diff options
author | dsinclair <dsinclair@chromium.org> | 2016-07-13 11:34:23 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-07-13 11:34:23 -0700 |
commit | dbc7716e1b8d67a5ca422ef0bbfe87ff8c5cf4ea (patch) | |
tree | be90424187b3e350b6ef824f0ac0a069cbd0beb8 /fpdfsdk/pdfwindow | |
parent | e35af1e3c93e5e1f374799da115eb4b99820831c (diff) | |
download | pdfium-dbc7716e1b8d67a5ca422ef0bbfe87ff8c5cf4ea.tar.xz |
Cleanup some PWL interfaces.chromium/2800chromium/2799chromium/2798chromium/2797
This CL removes IPWL_Edit_Notfy and removes the OnKillFocus override from
IPWL_FocusHandler.
Review-Url: https://codereview.chromium.org/2144813002
Diffstat (limited to 'fpdfsdk/pdfwindow')
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Edit.cpp | 42 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Edit.h | 3 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_EditCtrl.cpp | 15 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_EditCtrl.h | 34 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Wnd.h | 1 |
5 files changed, 5 insertions, 90 deletions
diff --git a/fpdfsdk/pdfwindow/PWL_Edit.cpp b/fpdfsdk/pdfwindow/PWL_Edit.cpp index d729945032..39ea822ea2 100644 --- a/fpdfsdk/pdfwindow/PWL_Edit.cpp +++ b/fpdfsdk/pdfwindow/PWL_Edit.cpp @@ -104,11 +104,6 @@ CFX_FloatRect CPWL_Edit::GetClientRect() const { return rcClient; } -void CPWL_Edit::SetAlignFormatH(PWL_EDIT_ALIGNFORMAT_H nFormat, - FX_BOOL bPaint) { - m_pEdit->SetAlignmentH((int32_t)nFormat, bPaint); -} - void CPWL_Edit::SetAlignFormatV(PWL_EDIT_ALIGNFORMAT_V nFormat, FX_BOOL bPaint) { m_pEdit->SetAlignmentV((int32_t)nFormat, bPaint); @@ -464,14 +459,7 @@ void CPWL_Edit::OnKillFocus() { m_pEdit->SelectNone(); SetCaret(FALSE, CFX_FloatPoint(0.0f, 0.0f), CFX_FloatPoint(0.0f, 0.0f)); - SetCharSet(FXFONT_ANSI_CHARSET); - - if (!IsReadOnly()) { - if (IPWL_FocusHandler* pFocusHandler = GetFocusHandler()) - pFocusHandler->OnKillFocus(this); - } - m_bFocus = FALSE; } @@ -770,10 +758,6 @@ void CPWL_Edit::OnInsertReturn(const CPVT_WordPlace& place, m_pEdit->RefreshWordRange(CombineWordRange(GetLatinWordsRange(oldplace), GetLatinWordsRange(place))); } - - if (m_pEditNotify) { - m_pEditNotify->OnInsertReturn(place, oldplace); - } } void CPWL_Edit::OnBackSpace(const CPVT_WordPlace& place, @@ -782,10 +766,6 @@ void CPWL_Edit::OnBackSpace(const CPVT_WordPlace& place, m_pEdit->RefreshWordRange(CombineWordRange(GetLatinWordsRange(oldplace), GetLatinWordsRange(place))); } - - if (m_pEditNotify) { - m_pEditNotify->OnBackSpace(place, oldplace); - } } void CPWL_Edit::OnDelete(const CPVT_WordPlace& place, @@ -794,10 +774,6 @@ void CPWL_Edit::OnDelete(const CPVT_WordPlace& place, m_pEdit->RefreshWordRange(CombineWordRange(GetLatinWordsRange(oldplace), GetLatinWordsRange(place))); } - - if (m_pEditNotify) { - m_pEditNotify->OnDelete(place, oldplace); - } } void CPWL_Edit::OnClear(const CPVT_WordPlace& place, @@ -806,10 +782,6 @@ void CPWL_Edit::OnClear(const CPVT_WordPlace& place, m_pEdit->RefreshWordRange(CombineWordRange(GetLatinWordsRange(oldplace), GetLatinWordsRange(place))); } - - if (m_pEditNotify) { - m_pEditNotify->OnClear(place, oldplace); - } } void CPWL_Edit::OnInsertWord(const CPVT_WordPlace& place, @@ -818,10 +790,6 @@ void CPWL_Edit::OnInsertWord(const CPVT_WordPlace& place, m_pEdit->RefreshWordRange(CombineWordRange(GetLatinWordsRange(oldplace), GetLatinWordsRange(place))); } - - if (m_pEditNotify) { - m_pEditNotify->OnInsertWord(place, oldplace); - } } void CPWL_Edit::OnInsertText(const CPVT_WordPlace& place, @@ -830,16 +798,6 @@ void CPWL_Edit::OnInsertText(const CPVT_WordPlace& place, m_pEdit->RefreshWordRange(CombineWordRange(GetLatinWordsRange(oldplace), GetLatinWordsRange(place))); } - - if (m_pEditNotify) { - m_pEditNotify->OnInsertText(place, oldplace); - } -} - -void CPWL_Edit::OnAddUndo(IFX_Edit_UndoItem* pUndoItem) { - if (m_pEditNotify) { - m_pEditNotify->OnAddUndo(this); - } } CPVT_WordRange CPWL_Edit::CombineWordRange(const CPVT_WordRange& wr1, diff --git a/fpdfsdk/pdfwindow/PWL_Edit.h b/fpdfsdk/pdfwindow/PWL_Edit.h index e1518ef86c..008e1fd4a5 100644 --- a/fpdfsdk/pdfwindow/PWL_Edit.h +++ b/fpdfsdk/pdfwindow/PWL_Edit.h @@ -70,8 +70,6 @@ class CPWL_Edit : public CPWL_EditCtrl { void OnSetFocus() override; void OnKillFocus() override; - void SetAlignFormatH(PWL_EDIT_ALIGNFORMAT_H nFormat = PEAH_LEFT, - FX_BOOL bPaint = TRUE); // 0:left 1:right 2:middle void SetAlignFormatV(PWL_EDIT_ALIGNFORMAT_V nFormat = PEAV_TOP, FX_BOOL bPaint = TRUE); // 0:top 1:bottom 2:center @@ -126,7 +124,6 @@ class CPWL_Edit : public CPWL_EditCtrl { void OnClear(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace); void OnInsertText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace); - void OnAddUndo(IFX_Edit_UndoItem* pUndoItem); private: CPVT_WordRange GetSelectWordRange() const; diff --git a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp index dd1094a868..1bb17db6de 100644 --- a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp +++ b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp @@ -25,12 +25,10 @@ CPWL_EditCtrl::CPWL_EditCtrl() : m_pEdit(new CFX_Edit), m_pEditCaret(nullptr), m_bMouseDown(FALSE), - m_pEditNotify(nullptr), m_nCharSet(DEFAULT_CHARSET), m_nCodePage(0) {} -CPWL_EditCtrl::~CPWL_EditCtrl() { -} +CPWL_EditCtrl::~CPWL_EditCtrl() {} void CPWL_EditCtrl::OnCreate(PWL_CREATEPARAM& cp) { cp.eCursorType = FXCT_VBEAM; @@ -566,13 +564,10 @@ void CPWL_EditCtrl::IOnSetCaret(FX_BOOL bVisible, OnNotify(this, PNM_SETCARETINFO, (intptr_t)&cInfo, (intptr_t) nullptr); } -void CPWL_EditCtrl::IOnContentChange(const CFX_FloatRect& rcContent) { - if (IsValid()) { - if (m_pEditNotify) { - m_pEditNotify->OnContentChange(rcContent); - } - } -} +void CPWL_EditCtrl::IOnCaretChange(const CPVT_SecProps& secProps, + const CPVT_WordProps& wordProps) {} + +void CPWL_EditCtrl::IOnContentChange(const CFX_FloatRect& rcContent) {} void CPWL_EditCtrl::IOnInvalidateRect(CFX_FloatRect* pRect) { InvalidateRect(pRect); diff --git a/fpdfsdk/pdfwindow/PWL_EditCtrl.h b/fpdfsdk/pdfwindow/PWL_EditCtrl.h index 028c41bcfd..f767d1ba72 100644 --- a/fpdfsdk/pdfwindow/PWL_EditCtrl.h +++ b/fpdfsdk/pdfwindow/PWL_EditCtrl.h @@ -15,7 +15,6 @@ class CFX_Edit; class CPWL_Caret; class CPWL_Edit; class CPWL_EditCtrl; -class IPWL_Edit_Notify; struct CPVT_SecProps; struct CPVT_WordPlace; struct CPVT_WordProps; @@ -25,36 +24,6 @@ enum PWL_EDIT_ALIGNFORMAT_H { PEAH_LEFT = 0, PEAH_MIDDLE, PEAH_RIGHT }; enum PWL_EDIT_ALIGNFORMAT_V { PEAV_TOP = 0, PEAV_CENTER, PEAV_BOTTOM }; -class IPWL_Edit_Notify { - public: - virtual ~IPWL_Edit_Notify() {} - // when the position of caret is changed in edit - virtual void OnCaretMove(int32_t x1, int32_t y1, int32_t x2, int32_t y2) {} - virtual void OnContentChange(const CFX_FloatRect& rcContent) {} - // OprType: 0 InsertWord - // 1 InsertReturn - // 2 BackSpace - // 3 Delete - // 4 Clear - // 5 InsertText - // 6 SetText - virtual void OnInsertWord(const CPVT_WordPlace& place, - const CPVT_WordPlace& oldplace) {} - virtual void OnInsertReturn(const CPVT_WordPlace& place, - const CPVT_WordPlace& oldplace) {} - virtual void OnBackSpace(const CPVT_WordPlace& place, - const CPVT_WordPlace& oldplace) {} - virtual void OnDelete(const CPVT_WordPlace& place, - const CPVT_WordPlace& oldplace) {} - virtual void OnClear(const CPVT_WordPlace& place, - const CPVT_WordPlace& oldplace) {} - virtual void OnInsertText(const CPVT_WordPlace& place, - const CPVT_WordPlace& oldplace) {} - virtual void OnSetText(const CPVT_WordPlace& place, - const CPVT_WordPlace& oldplace) {} - virtual void OnAddUndo(CPWL_Edit* pEdit) {} -}; - class CPWL_EditCtrl : public CPWL_Wnd { friend class CPWL_Edit_Notify; @@ -85,8 +54,6 @@ class CPWL_EditCtrl : public CPWL_Wnd { CFX_FloatPoint GetScrollPos() const; void SetScrollPos(const CFX_FloatPoint& point); - void SetEditNotify(IPWL_Edit_Notify* pNotify) { m_pEditNotify = pNotify; } - void SetCharSet(uint8_t nCharSet) { m_nCharSet = nCharSet; } int32_t GetCharSet() const; @@ -162,7 +129,6 @@ class CPWL_EditCtrl : public CPWL_Wnd { std::unique_ptr<CFX_Edit> m_pEdit; CPWL_Caret* m_pEditCaret; FX_BOOL m_bMouseDown; - IPWL_Edit_Notify* m_pEditNotify; private: void CreateEditCaret(const PWL_CREATEPARAM& cp); diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.h b/fpdfsdk/pdfwindow/PWL_Wnd.h index 197bdf0023..2e780c6d65 100644 --- a/fpdfsdk/pdfwindow/PWL_Wnd.h +++ b/fpdfsdk/pdfwindow/PWL_Wnd.h @@ -182,7 +182,6 @@ class IPWL_FocusHandler { public: virtual ~IPWL_FocusHandler() {} virtual void OnSetFocus(CPWL_Wnd* pWnd) = 0; - virtual void OnKillFocus(CPWL_Wnd* pWnd) = 0; }; struct PWL_CREATEPARAM { |