From 3b8fdd34bdf57ec45291b77008a43249f838efcb Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Fri, 26 Feb 2016 13:09:42 -0800 Subject: Replace CPDF_Rect and CPDF_Point with CFX types. Too many rectangle types. Remove CPDF_Rect #define, and make an equivalent point type in CFX, but stop short of consolidating the N different forms of rectangles in CFX. Also banish PDF_ClipFloat to the one .cpp file that needs it, since it was in the vicinity of the .h file changes. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1740923003 . --- fpdfsdk/include/fxedit/fx_edit.h | 67 +++++++++++++------------- fpdfsdk/include/fxedit/fxet_edit.h | 54 ++++++++++----------- fpdfsdk/include/fxedit/fxet_list.h | 96 +++++++++++++++++++------------------- 3 files changed, 110 insertions(+), 107 deletions(-) (limited to 'fpdfsdk/include/fxedit') diff --git a/fpdfsdk/include/fxedit/fx_edit.h b/fpdfsdk/include/fxedit/fx_edit.h index 5e1ac0f390..089eecc1d9 100644 --- a/fpdfsdk/include/fxedit/fx_edit.h +++ b/fpdfsdk/include/fxedit/fx_edit.h @@ -15,7 +15,7 @@ class CFX_RenderDevice; class CPDF_Font; class CFX_Matrix; class CPDF_PageObjectHolder; -class CPDF_Point; +class CFX_FloatPoint; class CPDF_TextObject; class IFX_Edit; class IFX_Edit_FontMap; @@ -92,17 +92,17 @@ class IFX_Edit_Notify { virtual void IOnSetScrollPosY(FX_FLOAT fy) = 0; // set the caret information. virtual void IOnSetCaret(FX_BOOL bVisible, - const CPDF_Point& ptHead, - const CPDF_Point& ptFoot, + const CFX_FloatPoint& ptHead, + const CFX_FloatPoint& ptFoot, const CPVT_WordPlace& place) = 0; // if the caret position is changed ,send the information of current postion // to user. virtual void IOnCaretChange(const CPVT_SecProps& secProps, const CPVT_WordProps& wordProps) = 0; // if the text area is changed, send the information to user. - virtual void IOnContentChange(const CPDF_Rect& rcContent) = 0; + virtual void IOnContentChange(const CFX_FloatRect& rcContent) = 0; // Invalidate the rectangle relative to the bounding box of edit. - virtual void IOnInvalidateRect(CPDF_Rect* pRect) = 0; + virtual void IOnInvalidateRect(CFX_FloatRect* pRect) = 0; }; class IFX_Edit_OprNotify { @@ -204,9 +204,10 @@ class IFX_Edit { virtual void Initialize() = 0; // set the bounding box of the text area. - virtual void SetPlateRect(const CPDF_Rect& rect, FX_BOOL bPaint = TRUE) = 0; + virtual void SetPlateRect(const CFX_FloatRect& rect, + FX_BOOL bPaint = TRUE) = 0; // set the scroll origin - virtual void SetScrollPos(const CPDF_Point& point) = 0; + virtual void SetScrollPos(const CFX_FloatPoint& point) = 0; // set the horizontal text alignment in text box, nFormat (0:left 1:middle // 2:right). @@ -296,11 +297,11 @@ class IFX_Edit { // query if any text is selected. virtual FX_BOOL IsSelected() const = 0; // get the scroll origin - virtual CPDF_Point GetScrollPos() const = 0; + virtual CFX_FloatPoint GetScrollPos() const = 0; // get the bounding box of the text area. - virtual CPDF_Rect GetPlateRect() const = 0; + virtual CFX_FloatRect GetPlateRect() const = 0; // get the fact area of the text. - virtual CPDF_Rect GetContentRect() const = 0; + virtual CFX_FloatRect GetContentRect() const = 0; // get the visible word range virtual CPVT_WordRange GetVisibleWordRange() const = 0; // get the whole word range @@ -310,11 +311,11 @@ class IFX_Edit { // send the mousedown message to edit for response. // if Shift key is hold, bShift is TRUE, is Ctrl key is hold, bCtrl is TRUE. - virtual void OnMouseDown(const CPDF_Point& point, + virtual void OnMouseDown(const CFX_FloatPoint& point, FX_BOOL bShift, FX_BOOL bCtrl) = 0; // send the mousemove message to edit when mouse down is TRUE. - virtual void OnMouseMove(const CPDF_Point& point, + virtual void OnMouseMove(const CFX_FloatPoint& point, FX_BOOL bShift, FX_BOOL bCtrl) = 0; // send the UP key message to edit. @@ -399,7 +400,7 @@ class IFX_Edit { const CPVT_WordPlace& place) const = 0; // search a wordplace form point - virtual CPVT_WordPlace SearchWordPlace(const CPDF_Point& point) const = 0; + virtual CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& point) const = 0; // get the font size of non_rich text or default font size of richtext. virtual FX_FLOAT GetFontSize() const = 0; @@ -426,21 +427,21 @@ class IFX_Edit { static CFX_ByteString GetEditAppearanceStream( IFX_Edit* pEdit, - const CPDF_Point& ptOffset, + const CFX_FloatPoint& ptOffset, const CPVT_WordRange* pRange = NULL, FX_BOOL bContinuous = TRUE, FX_WORD SubWord = 0); static CFX_ByteString GetSelectAppearanceStream( IFX_Edit* pEdit, - const CPDF_Point& ptOffset, + const CFX_FloatPoint& ptOffset, const CPVT_WordRange* pRange = NULL); static void DrawEdit(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, IFX_Edit* pEdit, FX_COLORREF crTextFill, FX_COLORREF crTextStroke, - const CPDF_Rect& rcClip, - const CPDF_Point& ptOffset, + const CFX_FloatRect& rcClip, + const CFX_FloatPoint& ptOffset, const CPVT_WordRange* pRange, IFX_SystemHandler* pSystemHandler, void* pFFLData); @@ -448,31 +449,31 @@ class IFX_Edit { CFX_Matrix* pUser2Device, IFX_Edit* pEdit, FX_COLORREF color, - const CPDF_Rect& rcClip, - const CPDF_Point& ptOffset, + const CFX_FloatRect& rcClip, + const CFX_FloatPoint& ptOffset, const CPVT_WordRange* pRange); static void DrawRichEdit(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, IFX_Edit* pEdit, - const CPDF_Rect& rcClip, - const CPDF_Point& ptOffset, + const CFX_FloatRect& rcClip, + const CFX_FloatPoint& ptOffset, const CPVT_WordRange* pRange); static void GeneratePageObjects( CPDF_PageObjectHolder* pObjectHolder, IFX_Edit* pEdit, - const CPDF_Point& ptOffset, + const CFX_FloatPoint& ptOffset, const CPVT_WordRange* pRange, FX_COLORREF crText, CFX_ArrayTemplate& ObjArray); static void GenerateRichPageObjects( CPDF_PageObjectHolder* pObjectHolder, IFX_Edit* pEdit, - const CPDF_Point& ptOffset, + const CFX_FloatPoint& ptOffset, const CPVT_WordRange* pRange, CFX_ArrayTemplate& ObjArray); static void GenerateUnderlineObjects(CPDF_PageObjectHolder* pObjectHolder, IFX_Edit* pEdit, - const CPDF_Point& ptOffset, + const CFX_FloatPoint& ptOffset, const CPVT_WordRange* pRange, FX_COLORREF color); @@ -501,7 +502,7 @@ class IFX_List_Notify { // set the position of vertical scrollbar. virtual void IOnSetScrollPosY(FX_FLOAT fy) = 0; // Invalidate the rectangle relative to the bounding box of edit. - virtual void IOnInvalidateRect(CPDF_Rect* pRect) = 0; + virtual void IOnInvalidateRect(CFX_FloatRect* pRect) = 0; protected: virtual ~IFX_List_Notify() {} @@ -515,11 +516,11 @@ class IFX_List { virtual void SetFontMap(IFX_Edit_FontMap* pFontMap) = 0; virtual void SetNotify(IFX_List_Notify* pNotify) = 0; - virtual void SetPlateRect(const CPDF_Rect& rect) = 0; + virtual void SetPlateRect(const CFX_FloatRect& rect) = 0; virtual void SetFontSize(FX_FLOAT fFontSize) = 0; - virtual CPDF_Rect GetPlateRect() const = 0; - virtual CPDF_Rect GetContentRect() const = 0; + virtual CFX_FloatRect GetPlateRect() const = 0; + virtual CFX_FloatRect GetContentRect() const = 0; virtual FX_FLOAT GetFontSize() const = 0; virtual IFX_Edit* GetItemEdit(int32_t nIndex) const = 0; @@ -532,13 +533,13 @@ class IFX_List { virtual FX_BOOL IsValid(int32_t nItemIndex) const = 0; virtual int32_t FindNext(int32_t nIndex, FX_WCHAR nChar) const = 0; - virtual void SetScrollPos(const CPDF_Point& point) = 0; + virtual void SetScrollPos(const CFX_FloatPoint& point) = 0; virtual void ScrollToListItem(int32_t nItemIndex) = 0; - virtual CPDF_Rect GetItemRect(int32_t nIndex) const = 0; + virtual CFX_FloatRect GetItemRect(int32_t nIndex) const = 0; virtual int32_t GetCaret() const = 0; virtual int32_t GetSelect() const = 0; virtual int32_t GetTopItem() const = 0; - virtual int32_t GetItemIndex(const CPDF_Point& point) const = 0; + virtual int32_t GetItemIndex(const CFX_FloatPoint& point) const = 0; virtual int32_t GetFirstSelected() const = 0; virtual void AddString(const FX_WCHAR* string) = 0; @@ -549,10 +550,10 @@ class IFX_List { virtual void Cancel() = 0; virtual CFX_WideString GetText() const = 0; - virtual void OnMouseDown(const CPDF_Point& point, + virtual void OnMouseDown(const CFX_FloatPoint& point, FX_BOOL bShift, FX_BOOL bCtrl) = 0; - virtual void OnMouseMove(const CPDF_Point& point, + virtual void OnMouseMove(const CFX_FloatPoint& point, FX_BOOL bShift, FX_BOOL bCtrl) = 0; virtual void OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl) = 0; diff --git a/fpdfsdk/include/fxedit/fxet_edit.h b/fpdfsdk/include/fxedit/fxet_edit.h index d1df3812fc..9809ac9f7d 100644 --- a/fpdfsdk/include/fxedit/fxet_edit.h +++ b/fpdfsdk/include/fxedit/fxet_edit.h @@ -41,7 +41,7 @@ enum EDIT_PROPS_E { }; struct CFX_Edit_LineRect { - CFX_Edit_LineRect(const CPVT_WordRange& wrLine, const CPDF_Rect& rcLine) + CFX_Edit_LineRect(const CPVT_WordRange& wrLine, const CFX_FloatRect& rcLine) : m_wrLine(wrLine), m_rcLine(rcLine) {} FX_BOOL operator!=(const CFX_Edit_LineRect& linerect) const { @@ -67,7 +67,7 @@ struct CFX_Edit_LineRect { } CPVT_WordRange m_wrLine; - CPDF_Rect m_rcLine; + CFX_FloatRect m_rcLine; }; class CFX_Edit_LineRectArray { @@ -93,7 +93,7 @@ class CFX_Edit_LineRectArray { rects.RemoveAll(); } - void Add(const CPVT_WordRange& wrLine, const CPDF_Rect& rcLine) { + void Add(const CPVT_WordRange& wrLine, const CFX_FloatRect& rcLine) { m_LineRects.Add(new CFX_Edit_LineRect(wrLine, rcLine)); } @@ -122,27 +122,27 @@ class CFX_Edit_RectArray { m_Rects.RemoveAll(); } - void Add(const CPDF_Rect& rect) { + void Add(const CFX_FloatRect& rect) { // check for overlapped area for (int32_t i = 0, sz = m_Rects.GetSize(); i < sz; i++) { - CPDF_Rect* pRect = m_Rects.GetAt(i); + CFX_FloatRect* pRect = m_Rects.GetAt(i); if (pRect && pRect->Contains(rect)) return; } - m_Rects.Add(new CPDF_Rect(rect)); + m_Rects.Add(new CFX_FloatRect(rect)); } int32_t GetSize() const { return m_Rects.GetSize(); } - CPDF_Rect* GetAt(int32_t nIndex) const { + CFX_FloatRect* GetAt(int32_t nIndex) const { if (nIndex < 0 || nIndex >= m_Rects.GetSize()) return NULL; return m_Rects.GetAt(nIndex); } - CFX_ArrayTemplate m_Rects; + CFX_ArrayTemplate m_Rects; }; class CFX_Edit_Refresh { @@ -151,10 +151,10 @@ class CFX_Edit_Refresh { virtual ~CFX_Edit_Refresh(); void BeginRefresh(); - void Push(const CPVT_WordRange& linerange, const CPDF_Rect& rect); + void Push(const CPVT_WordRange& linerange, const CFX_FloatRect& rect); void NoAnalyse(); void Analyse(int32_t nAlignment); - void AddRefresh(const CPDF_Rect& rect); + void AddRefresh(const CFX_FloatRect& rect); const CFX_Edit_RectArray* GetRefreshRects() const; void EndRefresh(); @@ -533,8 +533,8 @@ class CFX_Edit : public IFX_Edit { IPDF_VariableText* GetVariableText() override; IFX_Edit_FontMap* GetFontMap() override; void Initialize() override; - void SetPlateRect(const CPDF_Rect& rect, FX_BOOL bPaint = TRUE) override; - void SetScrollPos(const CPDF_Point& point) override; + void SetPlateRect(const CFX_FloatRect& rect, FX_BOOL bPaint = TRUE) override; + void SetScrollPos(const CFX_FloatPoint& point) override; void SetAlignmentH(int32_t nFormat = 0, FX_BOOL bPaint = TRUE) override; void SetAlignmentV(int32_t nFormat = 0, FX_BOOL bPaint = TRUE) override; void SetPasswordChar(FX_WORD wSubWord = '*', FX_BOOL bPaint = TRUE) override; @@ -565,10 +565,10 @@ class CFX_Edit : public IFX_Edit { FX_BOOL SetRichTextLineLeading(FX_FLOAT fLineLeading) override; FX_BOOL SetRichTextLineIndent(FX_FLOAT fLineIndent) override; FX_BOOL SetRichTextAlignment(int32_t nAlignment) override; - void OnMouseDown(const CPDF_Point& point, + void OnMouseDown(const CFX_FloatPoint& point, FX_BOOL bShift, FX_BOOL bCtrl) override; - void OnMouseMove(const CPDF_Point& point, + void OnMouseMove(const CFX_FloatPoint& point, FX_BOOL bShift, FX_BOOL bCtrl) override; void OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl) override; @@ -602,17 +602,17 @@ class CFX_Edit : public IFX_Edit { CPVT_WordPlace GetSectionBeginPlace( const CPVT_WordPlace& place) const override; CPVT_WordPlace GetSectionEndPlace(const CPVT_WordPlace& place) const override; - CPVT_WordPlace SearchWordPlace(const CPDF_Point& point) const override; + CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& point) const override; int32_t GetCaret() const override; CPVT_WordPlace GetCaretWordPlace() const override; CFX_WideString GetSelText() const override; CFX_WideString GetText() const override; FX_FLOAT GetFontSize() const override; FX_WORD GetPasswordChar() const override; - CPDF_Point GetScrollPos() const override; + CFX_FloatPoint GetScrollPos() const override; int32_t GetCharArray() const override; - CPDF_Rect GetPlateRect() const override; - CPDF_Rect GetContentRect() const override; + CFX_FloatRect GetPlateRect() const override; + CFX_FloatRect GetContentRect() const override; CFX_WideString GetRangeText(const CPVT_WordRange& range) const override; int32_t GetHorzScale() const override; FX_FLOAT GetCharSpace() const override; @@ -704,10 +704,10 @@ class CFX_Edit : public IFX_Edit { void PaintInsertText(const CPVT_WordPlace& wpOld, const CPVT_WordPlace& wpNew); - inline CPDF_Point VTToEdit(const CPDF_Point& point) const; - inline CPDF_Point EditToVT(const CPDF_Point& point) const; - inline CPDF_Rect VTToEdit(const CPDF_Rect& rect) const; - inline CPDF_Rect EditToVT(const CPDF_Rect& rect) const; + inline CFX_FloatPoint VTToEdit(const CFX_FloatPoint& point) const; + inline CFX_FloatPoint EditToVT(const CFX_FloatPoint& point) const; + inline CFX_FloatRect VTToEdit(const CFX_FloatRect& rect) const; + inline CFX_FloatRect EditToVT(const CFX_FloatRect& rect) const; void Refresh(REFRESH_PLAN_E ePlan, const CPVT_WordRange* pRange1 = NULL, @@ -731,7 +731,7 @@ class CFX_Edit : public IFX_Edit { void SetPageInfo(const CPVT_WordPlace& place); CPVT_WordPlace SearchPageEndPlace(const CPVT_WordPlace& wpPageBegin, - const CPDF_Point& point) const; + const CFX_FloatPoint& point) const; FX_FLOAT GetLineTop(const CPVT_WordPlace& place) const; FX_FLOAT GetLineBottom(const CPVT_WordPlace& place) const; @@ -745,18 +745,18 @@ class CFX_Edit : public IFX_Edit { CPVT_WordPlace m_wpOldCaret; CFX_Edit_Select m_SelState; - CPDF_Point m_ptScrollPos; - CPDF_Point m_ptRefreshScrollPos; + CFX_FloatPoint m_ptScrollPos; + CFX_FloatPoint m_ptRefreshScrollPos; FX_BOOL m_bEnableScroll; IFX_Edit_Iterator* m_pIterator; CFX_Edit_Refresh m_Refresh; - CPDF_Point m_ptCaret; + CFX_FloatPoint m_ptCaret; CFX_Edit_Undo m_Undo; int32_t m_nAlignment; FX_BOOL m_bNotifyFlag; FX_BOOL m_bEnableOverflow; FX_BOOL m_bEnableRefresh; - CPDF_Rect m_rcOldContent; + CFX_FloatRect m_rcOldContent; FX_BOOL m_bEnableUndo; FX_BOOL m_bNotify; FX_BOOL m_bOprNotify; diff --git a/fpdfsdk/include/fxedit/fxet_list.h b/fpdfsdk/include/fxedit/fxet_list.h index a2f9524b2e..88d57c4928 100644 --- a/fpdfsdk/include/fxedit/fxet_list.h +++ b/fpdfsdk/include/fxedit/fxet_list.h @@ -7,7 +7,7 @@ #ifndef FPDFSDK_INCLUDE_FXEDIT_FXET_LIST_H_ #define FPDFSDK_INCLUDE_FXEDIT_FXET_LIST_H_ -#include "core/include/fpdfapi/fpdf_parser.h" // For CPDF_Point. +#include "core/include/fpdfapi/fpdf_parser.h" // For CFX_FloatPoint. #include "fpdfsdk/include/fxedit/fx_edit.h" class IFX_Edit; @@ -33,7 +33,7 @@ class CLST_Size { FX_FLOAT x, y; }; -class CLST_Rect : public CPDF_Rect { +class CLST_Rect : public CFX_FloatRect { public: CLST_Rect() { left = top = right = bottom = 0.0f; } @@ -47,7 +47,7 @@ class CLST_Rect : public CPDF_Rect { bottom = other_bottom; } - CLST_Rect(const CPDF_Rect& rect) { + CLST_Rect(const CFX_FloatRect& rect) { left = rect.left; top = rect.top; right = rect.right; @@ -58,7 +58,7 @@ class CLST_Rect : public CPDF_Rect { void Default() { left = top = right = bottom = 0.0f; } - const CLST_Rect operator=(const CPDF_Rect& rect) { + const CLST_Rect operator=(const CFX_FloatRect& rect) { left = rect.left; top = rect.top; right = rect.right; @@ -83,11 +83,11 @@ class CLST_Rect : public CPDF_Rect { return bottom - top; } - CPDF_Point LeftTop() const { return CPDF_Point(left, top); } + CFX_FloatPoint LeftTop() const { return CFX_FloatPoint(left, top); } - CPDF_Point RightBottom() const { return CPDF_Point(right, bottom); } + CFX_FloatPoint RightBottom() const { return CFX_FloatPoint(right, bottom); } - const CLST_Rect operator+=(const CPDF_Point& point) { + const CLST_Rect operator+=(const CFX_FloatPoint& point) { left += point.x; right += point.x; top += point.y; @@ -96,7 +96,7 @@ class CLST_Rect : public CPDF_Rect { return *this; } - const CLST_Rect operator-=(const CPDF_Point& point) { + const CLST_Rect operator-=(const CFX_FloatPoint& point) { left -= point.x; right -= point.x; top -= point.y; @@ -105,12 +105,12 @@ class CLST_Rect : public CPDF_Rect { return *this; } - CLST_Rect operator+(const CPDF_Point& point) const { + CLST_Rect operator+(const CFX_FloatPoint& point) const { return CLST_Rect(left + point.x, top + point.y, right + point.x, bottom + point.y); } - CLST_Rect operator-(const CPDF_Point& point) const { + CLST_Rect operator-(const CFX_FloatPoint& point) const { return CLST_Rect(left - point.x, top - point.y, right - point.x, bottom - point.y); } @@ -152,41 +152,43 @@ class CFX_ListContainer { : m_rcPlate(0.0f, 0.0f, 0.0f, 0.0f), m_rcContent(0.0f, 0.0f, 0.0f, 0.0f) {} virtual ~CFX_ListContainer() {} - virtual void SetPlateRect(const CPDF_Rect& rect) { m_rcPlate = rect; } - CPDF_Rect GetPlateRect() const { return m_rcPlate; } + virtual void SetPlateRect(const CFX_FloatRect& rect) { m_rcPlate = rect; } + CFX_FloatRect GetPlateRect() const { return m_rcPlate; } void SetContentRect(const CLST_Rect& rect) { m_rcContent = rect; } CLST_Rect GetContentRect() const { return m_rcContent; } - CPDF_Point GetBTPoint() const { - return CPDF_Point(m_rcPlate.left, m_rcPlate.top); + CFX_FloatPoint GetBTPoint() const { + return CFX_FloatPoint(m_rcPlate.left, m_rcPlate.top); } - CPDF_Point GetETPoint() const { - return CPDF_Point(m_rcPlate.right, m_rcPlate.bottom); + CFX_FloatPoint GetETPoint() const { + return CFX_FloatPoint(m_rcPlate.right, m_rcPlate.bottom); } public: - CPDF_Point InnerToOuter(const CPDF_Point& point) const { - return CPDF_Point(point.x + GetBTPoint().x, GetBTPoint().y - point.y); + CFX_FloatPoint InnerToOuter(const CFX_FloatPoint& point) const { + return CFX_FloatPoint(point.x + GetBTPoint().x, GetBTPoint().y - point.y); } - CPDF_Point OuterToInner(const CPDF_Point& point) const { - return CPDF_Point(point.x - GetBTPoint().x, GetBTPoint().y - point.y); + CFX_FloatPoint OuterToInner(const CFX_FloatPoint& point) const { + return CFX_FloatPoint(point.x - GetBTPoint().x, GetBTPoint().y - point.y); } - CPDF_Rect InnerToOuter(const CLST_Rect& rect) const { - CPDF_Point ptLeftTop = InnerToOuter(CPDF_Point(rect.left, rect.top)); - CPDF_Point ptRightBottom = - InnerToOuter(CPDF_Point(rect.right, rect.bottom)); - return CPDF_Rect(ptLeftTop.x, ptRightBottom.y, ptRightBottom.x, - ptLeftTop.y); + CFX_FloatRect InnerToOuter(const CLST_Rect& rect) const { + CFX_FloatPoint ptLeftTop = + InnerToOuter(CFX_FloatPoint(rect.left, rect.top)); + CFX_FloatPoint ptRightBottom = + InnerToOuter(CFX_FloatPoint(rect.right, rect.bottom)); + return CFX_FloatRect(ptLeftTop.x, ptRightBottom.y, ptRightBottom.x, + ptLeftTop.y); } - CLST_Rect OuterToInner(const CPDF_Rect& rect) const { - CPDF_Point ptLeftTop = OuterToInner(CPDF_Point(rect.left, rect.top)); - CPDF_Point ptRightBottom = - OuterToInner(CPDF_Point(rect.right, rect.bottom)); + CLST_Rect OuterToInner(const CFX_FloatRect& rect) const { + CFX_FloatPoint ptLeftTop = + OuterToInner(CFX_FloatPoint(rect.left, rect.top)); + CFX_FloatPoint ptRightBottom = + OuterToInner(CFX_FloatPoint(rect.right, rect.bottom)); return CLST_Rect(ptLeftTop.x, ptLeftTop.y, ptRightBottom.x, ptRightBottom.y); } private: - CPDF_Rect m_rcPlate; + CFX_FloatRect m_rcPlate; CLST_Rect m_rcContent; // positive forever! }; @@ -213,8 +215,8 @@ class CFX_List : protected CFX_ListContainer, public IFX_List { // IFX_List: void SetFontMap(IFX_Edit_FontMap* pFontMap) override; void SetFontSize(FX_FLOAT fFontSize) override; - CPDF_Rect GetPlateRect() const override; - CPDF_Rect GetContentRect() const override; + CFX_FloatRect GetPlateRect() const override; + CFX_FloatRect GetContentRect() const override; FX_FLOAT GetFontSize() const override; IFX_Edit* GetItemEdit(int32_t nIndex) const override; int32_t GetCount() const override; @@ -225,8 +227,8 @@ class CFX_List : protected CFX_ListContainer, public IFX_List { FX_BOOL IsValid(int32_t nItemIndex) const override; int32_t FindNext(int32_t nIndex, FX_WCHAR nChar) const override; void Empty() override; - CPDF_Rect GetItemRect(int32_t nIndex) const override; - int32_t GetItemIndex(const CPDF_Point& point) const override; + CFX_FloatRect GetItemRect(int32_t nIndex) const override; + int32_t GetItemIndex(const CFX_FloatPoint& point) const override; int32_t GetFirstSelected() const override; protected: @@ -284,10 +286,10 @@ class CFX_ListCtrl : public CFX_List { // CFX_List void SetNotify(IFX_List_Notify* pNotify) override; - void OnMouseDown(const CPDF_Point& point, + void OnMouseDown(const CFX_FloatPoint& point, FX_BOOL bShift, FX_BOOL bCtrl) override; - void OnMouseMove(const CPDF_Point& point, + void OnMouseMove(const CFX_FloatPoint& point, FX_BOOL bShift, FX_BOOL bCtrl) override; void OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl) override; @@ -298,15 +300,15 @@ class CFX_ListCtrl : public CFX_List { void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl) override; void OnVK(int32_t nItemIndex, FX_BOOL bShift, FX_BOOL bCtrl) override; FX_BOOL OnChar(FX_WORD nChar, FX_BOOL bShift, FX_BOOL bCtrl) override; - void SetPlateRect(const CPDF_Rect& rect) override; - void SetScrollPos(const CPDF_Point& point) override; + void SetPlateRect(const CFX_FloatRect& rect) override; + void SetScrollPos(const CFX_FloatPoint& point) override; void ScrollToListItem(int32_t nItemIndex) override; - CPDF_Rect GetItemRect(int32_t nIndex) const override; + CFX_FloatRect GetItemRect(int32_t nIndex) const override; int32_t GetCaret() const override { return m_nCaretIndex; } int32_t GetSelect() const override { return m_nSelItem; } int32_t GetTopItem() const override; - CPDF_Rect GetContentRect() const override; - int32_t GetItemIndex(const CPDF_Point& point) const override; + CFX_FloatRect GetContentRect() const override; + int32_t GetItemIndex(const CFX_FloatPoint& point) const override; void AddString(const FX_WCHAR* string) override; void SetTopItem(int32_t nIndex) override; void Select(int32_t nItemIndex) override; @@ -316,10 +318,10 @@ class CFX_ListCtrl : public CFX_List { CFX_WideString GetText() const override; void ReArrange(int32_t nItemIndex) override; - virtual CPDF_Point InToOut(const CPDF_Point& point) const; - virtual CPDF_Point OutToIn(const CPDF_Point& point) const; - virtual CPDF_Rect InToOut(const CPDF_Rect& rect) const; - virtual CPDF_Rect OutToIn(const CPDF_Rect& rect) const; + virtual CFX_FloatPoint InToOut(const CFX_FloatPoint& point) const; + virtual CFX_FloatPoint OutToIn(const CFX_FloatPoint& point) const; + virtual CFX_FloatRect InToOut(const CFX_FloatRect& rect) const; + virtual CFX_FloatRect OutToIn(const CFX_FloatRect& rect) const; private: void SetMultipleSelect(int32_t nItemIndex, FX_BOOL bSelected); @@ -333,7 +335,7 @@ class CFX_ListCtrl : public CFX_List { private: IFX_List_Notify* m_pNotify; FX_BOOL m_bNotifyFlag; - CPDF_Point m_ptScrollPos; + CFX_FloatPoint m_ptScrollPos; CPLST_Select m_aSelItems; // for multiple int32_t m_nSelItem; // for single int32_t m_nFootIndex; // for multiple -- cgit v1.2.3