Split IPWL_FillerNotify off into its own .h file. Remove an additional underscore along the way. Another step closer to having each class match its file name per style guide. -- fix pre-existing typo in comment along the way. -- de-duplicate some existing .cpp includes already in .h file. Change-Id: I08b9caccb691ea12fdee0c740a6a433f2b79109e Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/75130 Commit-Queue: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.h b/fpdfsdk/formfiller/cffl_interactiveformfiller.h index d663100..11b0f2f 100644 --- a/fpdfsdk/formfiller/cffl_interactiveformfiller.h +++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.h
@@ -14,8 +14,7 @@ #include "core/fxcrt/observed_ptr.h" #include "core/fxcrt/unowned_ptr.h" #include "fpdfsdk/cpdfsdk_annot.h" -#include "fpdfsdk/pwl/cpwl_edit.h" -#include "fpdfsdk/pwl/cpwl_wnd.h" +#include "fpdfsdk/pwl/ipwl_fillernotify.h" #include "fpdfsdk/pwl/ipwl_systemhandler.h" class CFFL_FormFiller; @@ -23,7 +22,7 @@ class CPDFSDK_PageView; class CPDFSDK_Widget; -class CFFL_InteractiveFormFiller final : public IPWL_Filler_Notify { +class CFFL_InteractiveFormFiller final : public IPWL_FillerNotify { public: explicit CFFL_InteractiveFormFiller( CPDFSDK_FormFillEnvironment* pFormFillEnv); @@ -125,7 +124,7 @@ using WidgetToFormFillerMap = std::map<CPDFSDK_Annot*, std::unique_ptr<CFFL_FormFiller>>; - // IPWL_Filler_Notify: + // IPWL_FillerNotify: void QueryWherePopup(const IPWL_SystemHandler::PerWindowData* pAttached, float fPopupMin, float fPopupMax, @@ -177,7 +176,7 @@ CFFL_PrivateData(const CFFL_PrivateData& that); ~CFFL_PrivateData() override; - // CPWL_Wnd::PrivateData: + // IPWL_SystemHandler::PerWindowData: std::unique_ptr<IPWL_SystemHandler::PerWindowData> Clone() const override; CPDFSDK_Widget* GetWidget() const { return pWidget.Get(); }
diff --git a/fpdfsdk/formfiller/cffl_textfield.cpp b/fpdfsdk/formfiller/cffl_textfield.cpp index 93ec9fe..fd1c719 100644 --- a/fpdfsdk/formfiller/cffl_textfield.cpp +++ b/fpdfsdk/formfiller/cffl_textfield.cpp
@@ -12,6 +12,7 @@ #include "core/fpdfdoc/cba_fontmap.h" #include "fpdfsdk/cpdfsdk_formfillenvironment.h" #include "fpdfsdk/cpdfsdk_widget.h" +#include "fpdfsdk/pwl/cpwl_edit.h" #include "public/fpdf_fwlevent.h" namespace {
diff --git a/fpdfsdk/pwl/BUILD.gn b/fpdfsdk/pwl/BUILD.gn index 17c0c95..fa8df3c 100644 --- a/fpdfsdk/pwl/BUILD.gn +++ b/fpdfsdk/pwl/BUILD.gn
@@ -31,6 +31,7 @@ "cpwl_special_button.h", "cpwl_wnd.cpp", "cpwl_wnd.h", + "ipwl_fillernotify.h", "ipwl_systemhandler.h", ] configs += [ "../../:pdfium_core_config" ]
diff --git a/fpdfsdk/pwl/cpwl_combo_box.cpp b/fpdfsdk/pwl/cpwl_combo_box.cpp index 0595969..af5dffc 100644 --- a/fpdfsdk/pwl/cpwl_combo_box.cpp +++ b/fpdfsdk/pwl/cpwl_combo_box.cpp
@@ -13,11 +13,9 @@ #include "core/fxge/cfx_fillrenderoptions.h" #include "core/fxge/cfx_pathdata.h" #include "core/fxge/cfx_renderdevice.h" -#include "fpdfsdk/pwl/cpwl_edit.h" #include "fpdfsdk/pwl/cpwl_edit_ctrl.h" -#include "fpdfsdk/pwl/cpwl_list_box.h" #include "fpdfsdk/pwl/cpwl_list_ctrl.h" -#include "fpdfsdk/pwl/cpwl_wnd.h" +#include "fpdfsdk/pwl/ipwl_fillernotify.h" #include "public/fpdf_fwlevent.h" namespace { @@ -607,7 +605,7 @@ m_nSelectItem = m_pList->GetCurSel(); } -void CPWL_ComboBox::SetFillerNotify(IPWL_Filler_Notify* pNotify) { +void CPWL_ComboBox::SetFillerNotify(IPWL_FillerNotify* pNotify) { m_pFillerNotify = pNotify; if (m_pEdit)
diff --git a/fpdfsdk/pwl/cpwl_combo_box.h b/fpdfsdk/pwl/cpwl_combo_box.h index cf1a875..1624af2 100644 --- a/fpdfsdk/pwl/cpwl_combo_box.h +++ b/fpdfsdk/pwl/cpwl_combo_box.h
@@ -15,6 +15,8 @@ #include "fpdfsdk/pwl/cpwl_list_box.h" #include "fpdfsdk/pwl/cpwl_wnd.h" +class IPWL_FillerNotify; + class CPWL_CBListBox final : public CPWL_ListBox { public: CPWL_CBListBox( @@ -74,7 +76,7 @@ bool Undo() override; bool Redo() override; - void SetFillerNotify(IPWL_Filler_Notify* pNotify); + void SetFillerNotify(IPWL_FillerNotify* pNotify); void SetText(const WideString& text); void AddString(const WideString& str); @@ -104,7 +106,7 @@ bool m_bPopup = false; bool m_bBottom = true; int32_t m_nSelectItem = -1; - UnownedPtr<IPWL_Filler_Notify> m_pFillerNotify; + UnownedPtr<IPWL_FillerNotify> m_pFillerNotify; UnownedPtr<CFFL_FormFiller> m_pFormFiller; };
diff --git a/fpdfsdk/pwl/cpwl_edit.cpp b/fpdfsdk/pwl/cpwl_edit.cpp index c47bccb..b26fbbc 100644 --- a/fpdfsdk/pwl/cpwl_edit.cpp +++ b/fpdfsdk/pwl/cpwl_edit.cpp
@@ -25,6 +25,7 @@ #include "fpdfsdk/pwl/cpwl_edit_impl.h" #include "fpdfsdk/pwl/cpwl_scroll_bar.h" #include "fpdfsdk/pwl/cpwl_wnd.h" +#include "fpdfsdk/pwl/ipwl_fillernotify.h" #include "public/fpdf_fwlevent.h" CPWL_Edit::CPWL_Edit(
diff --git a/fpdfsdk/pwl/cpwl_edit.h b/fpdfsdk/pwl/cpwl_edit.h index 8315527..06e1ae2 100644 --- a/fpdfsdk/pwl/cpwl_edit.h +++ b/fpdfsdk/pwl/cpwl_edit.h
@@ -16,36 +16,7 @@ #include "fpdfsdk/pwl/ipwl_systemhandler.h" class CPDF_Font; - -class IPWL_Filler_Notify { - public: - virtual ~IPWL_Filler_Notify() = default; - - // Must write to |bBottom| and |fPopupRet|. - virtual void QueryWherePopup( - const IPWL_SystemHandler::PerWindowData* pAttached, - float fPopupMin, - float fPopupMax, - bool* bBottom, - float* fPopupRet) = 0; - - virtual std::pair<bool, bool> OnBeforeKeyStroke( - const IPWL_SystemHandler::PerWindowData* pAttached, - WideString& strChange, - const WideString& strChangeEx, - int nSelStart, - int nSelEnd, - bool bKeyDown, - uint32_t nFlag) = 0; - - virtual bool OnPopupPreOpen( - const IPWL_SystemHandler::PerWindowData* pAttached, - uint32_t nFlag) = 0; - - virtual bool OnPopupPostOpen( - const IPWL_SystemHandler::PerWindowData* pAttached, - uint32_t nFlag) = 0; -}; +class IPWL_FillerNotify; class CPWL_Edit final : public CPWL_EditCtrl { public: @@ -90,7 +61,7 @@ const CFX_FloatRect& rcPlate, int32_t nCharArray); - void SetFillerNotify(IPWL_Filler_Notify* pNotify) { + void SetFillerNotify(IPWL_FillerNotify* pNotify) { m_pFillerNotify = pNotify; } @@ -128,7 +99,7 @@ bool m_bFocus = false; CFX_FloatRect m_rcOldWindow; - UnownedPtr<IPWL_Filler_Notify> m_pFillerNotify; + UnownedPtr<IPWL_FillerNotify> m_pFillerNotify; UnownedPtr<CFFL_FormFiller> m_pFormFiller; };
diff --git a/fpdfsdk/pwl/cpwl_list_box.cpp b/fpdfsdk/pwl/cpwl_list_box.cpp index 3c8d01d..ca5adde 100644 --- a/fpdfsdk/pwl/cpwl_list_box.cpp +++ b/fpdfsdk/pwl/cpwl_list_box.cpp
@@ -13,9 +13,8 @@ #include "fpdfsdk/pwl/cpwl_edit.h" #include "fpdfsdk/pwl/cpwl_edit_ctrl.h" #include "fpdfsdk/pwl/cpwl_edit_impl.h" -#include "fpdfsdk/pwl/cpwl_list_ctrl.h" #include "fpdfsdk/pwl/cpwl_scroll_bar.h" -#include "fpdfsdk/pwl/cpwl_wnd.h" +#include "fpdfsdk/pwl/ipwl_fillernotify.h" #include "public/fpdf_fwlevent.h" CPWL_ListBox::CPWL_ListBox(
diff --git a/fpdfsdk/pwl/cpwl_list_box.h b/fpdfsdk/pwl/cpwl_list_box.h index a5484c3..b3dc594 100644 --- a/fpdfsdk/pwl/cpwl_list_box.h +++ b/fpdfsdk/pwl/cpwl_list_box.h
@@ -13,7 +13,7 @@ #include "fpdfsdk/pwl/cpwl_list_ctrl.h" #include "fpdfsdk/pwl/cpwl_wnd.h" -class IPWL_Filler_Notify; +class IPWL_FillerNotify; struct CPVT_WordPlace; class CPWL_ListBox : public CPWL_Wnd, public CPWL_ListCtrl::NotifyIface { @@ -78,7 +78,7 @@ float GetFirstHeight() const; CFX_FloatRect GetListRect() const; - void SetFillerNotify(IPWL_Filler_Notify* pNotify) { + void SetFillerNotify(IPWL_FillerNotify* pNotify) { m_pFillerNotify = pNotify; } @@ -88,7 +88,7 @@ bool m_bMouseDown = false; bool m_bHoverSel = false; std::unique_ptr<CPWL_ListCtrl> m_pListCtrl; - UnownedPtr<IPWL_Filler_Notify> m_pFillerNotify; + UnownedPtr<IPWL_FillerNotify> m_pFillerNotify; private: UnownedPtr<CFFL_FormFiller> m_pFormFiller;
diff --git a/fpdfsdk/pwl/ipwl_fillernotify.h b/fpdfsdk/pwl/ipwl_fillernotify.h new file mode 100644 index 0000000..e968633 --- /dev/null +++ b/fpdfsdk/pwl/ipwl_fillernotify.h
@@ -0,0 +1,45 @@ +// Copyright 2020 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef FPDFSDK_PWL_IFWL_FILLERNOTIFY_H_ +#define FPDFSDK_PWL_IFWL_FILLERNOTIFY_H_ + +#include <utility> + +#include "core/fxcrt/fx_string.h" +#include "fpdfsdk/pwl/ipwl_systemhandler.h" + +class IPWL_FillerNotify { + public: + virtual ~IPWL_FillerNotify() = default; + + // Must write to |bBottom| and |fPopupRet|. + virtual void QueryWherePopup( + const IPWL_SystemHandler::PerWindowData* pAttached, + float fPopupMin, + float fPopupMax, + bool* bBottom, + float* fPopupRet) = 0; + + virtual std::pair<bool, bool> OnBeforeKeyStroke( + const IPWL_SystemHandler::PerWindowData* pAttached, + WideString& strChange, + const WideString& strChangeEx, + int nSelStart, + int nSelEnd, + bool bKeyDown, + uint32_t nFlag) = 0; + + virtual bool OnPopupPreOpen( + const IPWL_SystemHandler::PerWindowData* pAttached, + uint32_t nFlag) = 0; + + virtual bool OnPopupPostOpen( + const IPWL_SystemHandler::PerWindowData* pAttached, + uint32_t nFlag) = 0; +}; + +#endif // FPDFSDK_PWL_IFWL_FILLERNOTIFY_H_