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 | |
parent | e35af1e3c93e5e1f374799da115eb4b99820831c (diff) | |
download | pdfium-chromium/2799.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
-rw-r--r-- | fpdfsdk/formfiller/cffl_combobox.cpp | 10 | ||||
-rw-r--r-- | fpdfsdk/formfiller/cffl_combobox.h | 8 | ||||
-rw-r--r-- | fpdfsdk/formfiller/cffl_textfield.cpp | 6 | ||||
-rw-r--r-- | fpdfsdk/formfiller/cffl_textfield.h | 8 | ||||
-rw-r--r-- | fpdfsdk/fxedit/fxet_edit.cpp | 6 | ||||
-rw-r--r-- | fpdfsdk/fxedit/include/fxet_edit.h | 1 | ||||
-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 |
11 files changed, 7 insertions, 127 deletions
diff --git a/fpdfsdk/formfiller/cffl_combobox.cpp b/fpdfsdk/formfiller/cffl_combobox.cpp index 262c485138..4b84733890 100644 --- a/fpdfsdk/formfiller/cffl_combobox.cpp +++ b/fpdfsdk/formfiller/cffl_combobox.cpp @@ -267,19 +267,9 @@ void CFFL_ComboBox::OnSetFocus(CPWL_Wnd* pWnd) { unsigned short* pBuffer = (unsigned short*)bsUTFText.c_str(); m_pApp->FFI_OnSetFieldInputFocus(m_pWidget->GetFormField(), pBuffer, nCharacters, TRUE); - - pEdit->SetEditNotify(this); } } -void CFFL_ComboBox::OnKillFocus(CPWL_Wnd* pWnd) { - ASSERT(m_pApp); -} - -void CFFL_ComboBox::OnAddUndo(CPWL_Edit* pEdit) { - ASSERT(pEdit); -} - CFX_WideString CFFL_ComboBox::GetSelectExportText() { CFX_WideString swRet; diff --git a/fpdfsdk/formfiller/cffl_combobox.h b/fpdfsdk/formfiller/cffl_combobox.h index 947f42548e..6b8fb4939b 100644 --- a/fpdfsdk/formfiller/cffl_combobox.h +++ b/fpdfsdk/formfiller/cffl_combobox.h @@ -19,9 +19,7 @@ struct FFL_ComboBoxState { CFX_WideString sValue; }; -class CFFL_ComboBox : public CFFL_FormFiller, - public IPWL_FocusHandler, - public IPWL_Edit_Notify { +class CFFL_ComboBox : public CFFL_FormFiller, public IPWL_FocusHandler { public: CFFL_ComboBox(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget); ~CFFL_ComboBox() override; @@ -49,10 +47,6 @@ class CFFL_ComboBox : public CFFL_FormFiller, // IPWL_FocusHandler: void OnSetFocus(CPWL_Wnd* pWnd) override; - void OnKillFocus(CPWL_Wnd* pWnd) override; - - // IPWL_Edit_Notify: - void OnAddUndo(CPWL_Edit* pEdit) override; #ifdef PDF_ENABLE_XFA // CFFL_FormFiller: diff --git a/fpdfsdk/formfiller/cffl_textfield.cpp b/fpdfsdk/formfiller/cffl_textfield.cpp index 4f32f42ac7..5e690313be 100644 --- a/fpdfsdk/formfiller/cffl_textfield.cpp +++ b/fpdfsdk/formfiller/cffl_textfield.cpp @@ -279,11 +279,5 @@ void CFFL_TextField::OnSetFocus(CPWL_Wnd* pWnd) { unsigned short* pBuffer = (unsigned short*)bsUTFText.c_str(); m_pApp->FFI_OnSetFieldInputFocus(m_pWidget->GetFormField(), pBuffer, nCharacters, TRUE); - - pEdit->SetEditNotify(this); } } - -void CFFL_TextField::OnKillFocus(CPWL_Wnd* pWnd) {} - -void CFFL_TextField::OnAddUndo(CPWL_Edit* pEdit) {} diff --git a/fpdfsdk/formfiller/cffl_textfield.h b/fpdfsdk/formfiller/cffl_textfield.h index d7bfc9ee8d..34968e8fc3 100644 --- a/fpdfsdk/formfiller/cffl_textfield.h +++ b/fpdfsdk/formfiller/cffl_textfield.h @@ -21,9 +21,7 @@ struct FFL_TextFieldState { CFX_WideString sValue; }; -class CFFL_TextField : public CFFL_FormFiller, - public IPWL_FocusHandler, - public IPWL_Edit_Notify { +class CFFL_TextField : public CFFL_FormFiller, public IPWL_FocusHandler { public: CFFL_TextField(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot); ~CFFL_TextField() override; @@ -51,10 +49,6 @@ class CFFL_TextField : public CFFL_FormFiller, // IPWL_FocusHandler: void OnSetFocus(CPWL_Wnd* pWnd) override; - void OnKillFocus(CPWL_Wnd* pWnd) override; - - // IPWL_Edit_Notify: - void OnAddUndo(CPWL_Edit* pEdit) override; #ifdef PDF_ENABLE_XFA // CFFL_FormFiller: diff --git a/fpdfsdk/fxedit/fxet_edit.cpp b/fpdfsdk/fxedit/fxet_edit.cpp index 2125eb8f0e..fb219ca16c 100644 --- a/fpdfsdk/fxedit/fxet_edit.cpp +++ b/fpdfsdk/fxedit/fxet_edit.cpp @@ -3094,8 +3094,6 @@ void CFX_Edit::BeginGroupUndo(const CFX_WideString& sTitle) { void CFX_Edit::EndGroupUndo() { m_pGroupUndoItem->UpdateItems(); m_Undo.AddItem(m_pGroupUndoItem); - if (m_bOprNotify && m_pOprNotify) - m_pOprNotify->OnAddUndo(m_pGroupUndoItem); m_pGroupUndoItem = nullptr; } @@ -3104,15 +3102,11 @@ void CFX_Edit::AddEditUndoItem(CFX_Edit_UndoItem* pEditUndoItem) { m_pGroupUndoItem->AddUndoItem(pEditUndoItem); } else { m_Undo.AddItem(pEditUndoItem); - if (m_bOprNotify && m_pOprNotify) - m_pOprNotify->OnAddUndo(pEditUndoItem); } } void CFX_Edit::AddUndoItem(IFX_Edit_UndoItem* pUndoItem) { m_Undo.AddItem(pUndoItem); - if (m_bOprNotify && m_pOprNotify) - m_pOprNotify->OnAddUndo(pUndoItem); } CFX_Edit_LineRectArray::CFX_Edit_LineRectArray() {} diff --git a/fpdfsdk/fxedit/include/fxet_edit.h b/fpdfsdk/fxedit/include/fxet_edit.h index 3bf5849211..4287705592 100644 --- a/fpdfsdk/fxedit/include/fxet_edit.h +++ b/fpdfsdk/fxedit/include/fxet_edit.h @@ -566,7 +566,6 @@ class CFX_Edit { friend class CFXEU_Backspace; friend class CFXEU_Delete; friend class CFXEU_Clear; - friend class CFXEU_ClearRich; friend class CFXEU_InsertText; void SetSel(const CPVT_WordPlace& begin, const CPVT_WordPlace& end); 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 { |