From e35af1e3c93e5e1f374799da115eb4b99820831c Mon Sep 17 00:00:00 2001 From: dsinclair Date: Wed, 13 Jul 2016 11:26:20 -0700 Subject: Remove some IFX_* wrappers. This CL removes the IFX_* wrappers between fpdfsdk/fxedit and fpdfsdk/pdfwindow which only have a single implementation. Review-Url: https://codereview.chromium.org/2142213002 --- fpdfsdk/fxedit/include/fxet_list.h | 174 +++++++++++++++---------------------- 1 file changed, 70 insertions(+), 104 deletions(-) (limited to 'fpdfsdk/fxedit/include/fxet_list.h') diff --git a/fpdfsdk/fxedit/include/fxet_list.h b/fpdfsdk/fxedit/include/fxet_list.h index a763db52da..2377e1d080 100644 --- a/fpdfsdk/fxedit/include/fxet_list.h +++ b/fpdfsdk/fxedit/include/fxet_list.h @@ -7,30 +7,12 @@ #ifndef FPDFSDK_FXEDIT_INCLUDE_FXET_LIST_H_ #define FPDFSDK_FXEDIT_INCLUDE_FXET_LIST_H_ +#include "core/fxcrt/include/fx_coordinates.h" #include "fpdfsdk/fxedit/include/fx_edit.h" -class IFX_Edit; - -class CLST_Size { - public: - CLST_Size() : x(0.0f), y(0.0f) {} - - CLST_Size(FX_FLOAT other_x, FX_FLOAT other_y) { - x = other_x; - y = other_y; - } - - void Default() { - x = 0.0f; - y = 0.0f; - } - - FX_BOOL operator!=(const CLST_Size& size) const { - return FXSYS_memcmp(this, &size, sizeof(CLST_Size)) != 0; - } - - FX_FLOAT x, y; -}; +class CFX_Edit; +class CFX_Edit_Iterator; +class CPWL_List_Notify; class CLST_Rect : public CFX_FloatRect { public: @@ -119,7 +101,7 @@ class CFX_ListItem final { ~CFX_ListItem(); void SetFontMap(IPVT_FontMap* pFontMap); - IFX_Edit* GetEdit() const; + CFX_Edit* GetEdit() const; void SetRect(const CLST_Rect& rect); void SetSelect(FX_BOOL bSelected); @@ -133,9 +115,9 @@ class CFX_ListItem final { uint16_t GetFirstChar() const; private: - IFX_Edit_Iterator* GetIterator() const; + CFX_Edit_Iterator* GetIterator() const; - IFX_Edit* m_pEdit; + std::unique_ptr m_pEdit; FX_BOOL m_bSelected; CLST_Rect m_rcListItem; }; @@ -144,6 +126,7 @@ class CFX_ListContainer { public: CFX_ListContainer(); virtual ~CFX_ListContainer(); + virtual void SetPlateRect(const CFX_FloatRect& rect); CFX_FloatRect GetPlateRect() const { return m_rcPlate; } @@ -200,45 +183,6 @@ class CLST_ArrayTemplate : public CFX_ArrayTemplate { } }; -class CFX_List : protected CFX_ListContainer, public IFX_List { - public: - CFX_List(); - ~CFX_List() override; - - // IFX_List: - void SetFontMap(IPVT_FontMap* pFontMap) override; - void SetFontSize(FX_FLOAT fFontSize) 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; - FX_BOOL IsItemSelected(int32_t nIndex) const override; - FX_FLOAT GetFirstHeight() const override; - void SetMultipleSel(FX_BOOL bMultiple) override; - FX_BOOL IsMultipleSel() const override; - FX_BOOL IsValid(int32_t nItemIndex) const override; - int32_t FindNext(int32_t nIndex, FX_WCHAR nChar) const override; - void Empty() override; - CFX_FloatRect GetItemRect(int32_t nIndex) const override; - int32_t GetItemIndex(const CFX_FloatPoint& point) const override; - int32_t GetFirstSelected() const override; - - protected: - void AddItem(const FX_WCHAR* str); - virtual void ReArrange(int32_t nItemIndex); - CFX_WideString GetItemText(int32_t nIndex) const; - void SetItemSelect(int32_t nItemIndex, FX_BOOL bSelected); - int32_t GetLastSelected() const; - FX_WCHAR Toupper(FX_WCHAR c) const; - - private: - CLST_ArrayTemplate m_aListItems; - FX_FLOAT m_fFontSize; - IPVT_FontMap* m_pFontMap; - FX_BOOL m_bMultiple; -}; - struct CPLST_Select_Item { CPLST_Select_Item(int32_t other_nItemIndex, int32_t other_nState) { nItemIndex = other_nItemIndex; @@ -271,51 +215,65 @@ class CPLST_Select { CFX_ArrayTemplate m_aItems; }; -class CFX_ListCtrl : public CFX_List { +class CFX_ListCtrl : protected CFX_ListContainer { public: CFX_ListCtrl(); ~CFX_ListCtrl() override; - // CFX_List - void SetNotify(IFX_List_Notify* pNotify) override; - void OnMouseDown(const CFX_FloatPoint& point, - FX_BOOL bShift, - FX_BOOL bCtrl) override; - void OnMouseMove(const CFX_FloatPoint& point, - FX_BOOL bShift, - FX_BOOL bCtrl) override; - void OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl) override; - void OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl) override; - void OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl) override; - void OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl) override; - void OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl) override; - 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(uint16_t nChar, FX_BOOL bShift, FX_BOOL bCtrl) override; + // CFX_ListContainer void SetPlateRect(const CFX_FloatRect& rect) override; - void SetScrollPos(const CFX_FloatPoint& point) override; - void ScrollToListItem(int32_t nItemIndex) override; - CFX_FloatRect GetItemRect(int32_t nIndex) const override; - int32_t GetCaret() const override; - int32_t GetSelect() const override; - int32_t GetTopItem() const override; - CFX_FloatRect GetContentRect() const override; - int32_t GetItemIndex(const CFX_FloatPoint& point) const override; - void AddString(const FX_WCHAR* str) override; - void SetTopItem(int32_t nIndex) override; - void Select(int32_t nItemIndex) override; - void SetCaret(int32_t nItemIndex) override; - void Empty() override; - void Cancel() override; - CFX_WideString GetText() const override; - void ReArrange(int32_t nItemIndex) override; - - 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; + + void SetNotify(CPWL_List_Notify* pNotify); + void OnMouseDown(const CFX_FloatPoint& point, FX_BOOL bShift, FX_BOOL bCtrl); + void OnMouseMove(const CFX_FloatPoint& point, FX_BOOL bShift, FX_BOOL bCtrl); + void OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl); + void OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl); + void OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl); + void OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl); + void OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl); + void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl); + void OnVK(int32_t nItemIndex, FX_BOOL bShift, FX_BOOL bCtrl); + FX_BOOL OnChar(uint16_t nChar, FX_BOOL bShift, FX_BOOL bCtrl); + + void SetScrollPos(const CFX_FloatPoint& point); + void ScrollToListItem(int32_t nItemIndex); + CFX_FloatRect GetItemRect(int32_t nIndex) const; + int32_t GetCaret() const; + int32_t GetSelect() const; + int32_t GetTopItem() const; + CFX_FloatRect GetContentRect() const; + int32_t GetItemIndex(const CFX_FloatPoint& point) const; + void AddString(const FX_WCHAR* str); + void SetTopItem(int32_t nIndex); + void Select(int32_t nItemIndex); + void SetCaret(int32_t nItemIndex); + void Empty(); + void Cancel(); + CFX_WideString GetText() const; + + void SetFontMap(IPVT_FontMap* pFontMap); + void SetFontSize(FX_FLOAT fFontSize); + CFX_FloatRect GetPlateRect() const; + FX_FLOAT GetFontSize() const; + CFX_Edit* GetItemEdit(int32_t nIndex) const; + int32_t GetCount() const; + FX_BOOL IsItemSelected(int32_t nIndex) const; + FX_FLOAT GetFirstHeight() const; + void SetMultipleSel(FX_BOOL bMultiple); + FX_BOOL IsMultipleSel() const; + FX_BOOL IsValid(int32_t nItemIndex) const; + int32_t FindNext(int32_t nIndex, FX_WCHAR nChar) const; + int32_t GetFirstSelected() const; + + CFX_FloatPoint InToOut(const CFX_FloatPoint& point) const; + CFX_FloatPoint OutToIn(const CFX_FloatPoint& point) const; + CFX_FloatRect InToOut(const CFX_FloatRect& rect) const; + CFX_FloatRect OutToIn(const CFX_FloatRect& rect) const; private: + void ReArrange(int32_t nItemIndex); + CFX_FloatRect GetItemRectInternal(int32_t nIndex) const; + CFX_FloatRect GetContentRectInternal() const; void SetMultipleSelect(int32_t nItemIndex, FX_BOOL bSelected); void SetSingleSelect(int32_t nItemIndex); void InvalidateItem(int32_t nItemIndex); @@ -323,9 +281,13 @@ class CFX_ListCtrl : public CFX_List { FX_BOOL IsItemVisible(int32_t nItemIndex) const; void SetScrollInfo(); void SetScrollPosY(FX_FLOAT fy); + void AddItem(const FX_WCHAR* str); + CFX_WideString GetItemText(int32_t nIndex) const; + void SetItemSelect(int32_t nItemIndex, FX_BOOL bSelected); + int32_t GetLastSelected() const; + FX_WCHAR Toupper(FX_WCHAR c) const; - private: - IFX_List_Notify* m_pNotify; + CPWL_List_Notify* m_pNotify; FX_BOOL m_bNotifyFlag; CFX_FloatPoint m_ptScrollPos; CPLST_Select m_aSelItems; // for multiple @@ -333,6 +295,10 @@ class CFX_ListCtrl : public CFX_List { int32_t m_nFootIndex; // for multiple FX_BOOL m_bCtrlSel; // for multiple int32_t m_nCaretIndex; // for multiple + CLST_ArrayTemplate m_aListItems; + FX_FLOAT m_fFontSize; + IPVT_FontMap* m_pFontMap; + FX_BOOL m_bMultiple; }; #endif // FPDFSDK_FXEDIT_INCLUDE_FXET_LIST_H_ -- cgit v1.2.3