diff options
Diffstat (limited to 'fpdfsdk/formfiller')
-rw-r--r-- | fpdfsdk/formfiller/cffl_combobox.h | 5 | ||||
-rw-r--r-- | fpdfsdk/formfiller/cffl_formfiller.cpp | 14 | ||||
-rw-r--r-- | fpdfsdk/formfiller/cffl_formfiller.h | 7 | ||||
-rw-r--r-- | fpdfsdk/formfiller/cffl_interactiveformfiller.cpp | 36 | ||||
-rw-r--r-- | fpdfsdk/formfiller/cffl_interactiveformfiller.h | 12 | ||||
-rw-r--r-- | fpdfsdk/formfiller/cffl_textfield.h | 5 |
6 files changed, 42 insertions, 37 deletions
diff --git a/fpdfsdk/formfiller/cffl_combobox.h b/fpdfsdk/formfiller/cffl_combobox.h index 7d5a38ef56..dc8441d1cd 100644 --- a/fpdfsdk/formfiller/cffl_combobox.h +++ b/fpdfsdk/formfiller/cffl_combobox.h @@ -19,7 +19,8 @@ struct FFL_ComboBoxState { CFX_WideString sValue; }; -class CFFL_ComboBox : public CFFL_TextObject, public IPWL_FocusHandler { +class CFFL_ComboBox : public CFFL_TextObject, + public CPWL_Wnd::FocusHandlerIface { public: CFFL_ComboBox(CPDFSDK_FormFillEnvironment* pApp, CPDFSDK_Widget* pWidget); ~CFFL_ComboBox() override; @@ -45,7 +46,7 @@ class CFFL_ComboBox : public CFFL_TextObject, public IPWL_FocusHandler { bool IsFieldFull(CPDFSDK_PageView* pPageView) override; #endif - // IPWL_FocusHandler: + // CPWL_Wnd::FocusHandlerIface: void OnSetFocus(CPWL_Edit* pEdit) override; private: diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp index f405e3578d..e59cd0520f 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.cpp +++ b/fpdfsdk/formfiller/cffl_formfiller.cpp @@ -37,8 +37,7 @@ CFFL_FormFiller::~CFFL_FormFiller() { void CFFL_FormFiller::DestroyWindows() { for (const auto& it : m_Maps) { CPWL_Wnd* pWnd = it.second; - CFFL_PrivateData* pData = - static_cast<CFFL_PrivateData*>(pWnd->GetAttachedData()); + auto* pData = static_cast<CFFL_PrivateData*>(pWnd->GetAttachedData()); pWnd->InvalidateProvider(this); pWnd->Destroy(); delete pWnd; @@ -359,7 +358,7 @@ CPWL_Wnd* CFFL_FormFiller::GetPDFWindow(CPDFSDK_PageView* pPageView, CPWL_Wnd::CreateParams cp = GetCreateParam(); cp.pAttachedWidget.Reset(m_pWidget.Get()); - CFFL_PrivateData* pPrivateData = new CFFL_PrivateData; + auto* pPrivateData = new CFFL_PrivateData; pPrivateData->pWidget = m_pWidget.Get(); pPrivateData->pPageView = pPageView; pPrivateData->nWidgetAge = m_pWidget->GetAppearanceAge(); @@ -384,18 +383,17 @@ void CFFL_FormFiller::DestroyPDFWindow(CPDFSDK_PageView* pPageView) { return; CPWL_Wnd* pWnd = it->second; - CFFL_PrivateData* pData = (CFFL_PrivateData*)pWnd->GetAttachedData(); + auto* pData = static_cast<CFFL_PrivateData*>(pWnd->GetAttachedData()); pWnd->Destroy(); delete pWnd; delete pData; - m_Maps.erase(it); } -CFX_Matrix CFFL_FormFiller::GetWindowMatrix(void* pAttachedData) { +CFX_Matrix CFFL_FormFiller::GetWindowMatrix(CPWL_Wnd::PrivateData* pAttached) { CFX_Matrix mt; - auto* pPrivateData = reinterpret_cast<CFFL_PrivateData*>(pAttachedData); - if (!pAttachedData || !pPrivateData->pPageView) + auto* pPrivateData = static_cast<CFFL_PrivateData*>(pAttached); + if (!pPrivateData || !pPrivateData->pPageView) return mt; CFX_Matrix mtPageView; diff --git a/fpdfsdk/formfiller/cffl_formfiller.h b/fpdfsdk/formfiller/cffl_formfiller.h index b9af3897e4..e9c2c551d2 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.h +++ b/fpdfsdk/formfiller/cffl_formfiller.h @@ -19,7 +19,8 @@ class CPDFSDK_FormFillEnvironment; class CPDFSDK_PageView; class CPDFSDK_Widget; -class CFFL_FormFiller : public IPWL_Provider, public CPWL_TimerHandler { +class CFFL_FormFiller : public CPWL_Wnd::ProviderIface, + public CPWL_TimerHandler { public: CFFL_FormFiller(CPDFSDK_FormFillEnvironment* pFormFillEnv, CPDFSDK_Widget* pWidget); @@ -84,8 +85,8 @@ class CFFL_FormFiller : public IPWL_Provider, public CPWL_TimerHandler { void TimerProc() override; CFX_SystemHandler* GetSystemHandler() const override; - // IPWL_Provider - CFX_Matrix GetWindowMatrix(void* pAttachedData) override; + // CPWL_Wnd::ProviderIface: + CFX_Matrix GetWindowMatrix(CPWL_Wnd::PrivateData* pAttached) override; virtual void GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp index 10cefd204b..425c2add35 100644 --- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp +++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp @@ -544,14 +544,15 @@ void CFFL_InteractiveFormFiller::UnRegisterFormFiller(CPDFSDK_Annot* pAnnot) { m_Maps.erase(it); } -void CFFL_InteractiveFormFiller::QueryWherePopup(void* pPrivateData, - float fPopupMin, - float fPopupMax, - bool* bBottom, - float* fPopupRet) { - CFFL_PrivateData* pData = reinterpret_cast<CFFL_PrivateData*>(pPrivateData); +void CFFL_InteractiveFormFiller::QueryWherePopup( + CPWL_Wnd::PrivateData* pAttached, + float fPopupMin, + float fPopupMax, + bool* bBottom, + float* fPopupRet) { + auto* pData = static_cast<CFFL_PrivateData*>(pAttached); CPDFSDK_Widget* pWidget = pData->pWidget; - auto* pPage = pWidget->GetPDFPage(); + CPDF_Page* pPage = pWidget->GetPDFPage(); CFX_FloatRect rcPageView(0, pPage->GetPageHeight(), pPage->GetPageWidth(), 0); rcPageView.Normalize(); @@ -767,9 +768,10 @@ bool CFFL_InteractiveFormFiller::OnFull(CPDFSDK_Annot::ObservedPtr* pAnnot, return true; } -bool CFFL_InteractiveFormFiller::OnPopupPreOpen(void* pPrivateData, - uint32_t nFlag) { - CFFL_PrivateData* pData = reinterpret_cast<CFFL_PrivateData*>(pPrivateData); +bool CFFL_InteractiveFormFiller::OnPopupPreOpen( + CPWL_Wnd::PrivateData* pAttached, + uint32_t nFlag) { + auto* pData = static_cast<CFFL_PrivateData*>(pAttached); ASSERT(pData); ASSERT(pData->pWidget); @@ -777,9 +779,10 @@ bool CFFL_InteractiveFormFiller::OnPopupPreOpen(void* pPrivateData, return OnPreOpen(&pObserved, pData->pPageView, nFlag) || !pObserved; } -bool CFFL_InteractiveFormFiller::OnPopupPostOpen(void* pPrivateData, - uint32_t nFlag) { - CFFL_PrivateData* pData = reinterpret_cast<CFFL_PrivateData*>(pPrivateData); +bool CFFL_InteractiveFormFiller::OnPopupPostOpen( + CPWL_Wnd::PrivateData* pAttached, + uint32_t nFlag) { + auto* pData = static_cast<CFFL_PrivateData*>(pAttached); ASSERT(pData); ASSERT(pData->pWidget); @@ -856,7 +859,7 @@ bool CFFL_InteractiveFormFiller::IsValidAnnot(CPDFSDK_PageView* pPageView, } std::pair<bool, bool> CFFL_InteractiveFormFiller::OnBeforeKeyStroke( - void* pPrivateData, + CPWL_Wnd::PrivateData* pAttached, CFX_WideString& strChange, const CFX_WideString& strChangeEx, int nSelStart, @@ -864,8 +867,7 @@ std::pair<bool, bool> CFFL_InteractiveFormFiller::OnBeforeKeyStroke( bool bKeyDown, uint32_t nFlag) { // Copy the private data since the window owning it may not survive. - CFFL_PrivateData privateData = - *reinterpret_cast<CFFL_PrivateData*>(pPrivateData); + CFFL_PrivateData privateData = *static_cast<CFFL_PrivateData*>(pAttached); ASSERT(privateData.pWidget); CFFL_FormFiller* pFormFiller = GetFormFiller(privateData.pWidget, false); @@ -921,7 +923,7 @@ std::pair<bool, bool> CFFL_InteractiveFormFiller::OnBeforeKeyStroke( privateData.pPageView, nValueAge == privateData.pWidget->GetValueAge()); if (!pWnd) return {true, true}; - privateData = *reinterpret_cast<CFFL_PrivateData*>(pWnd->GetAttachedData()); + privateData = *static_cast<CFFL_PrivateData*>(pWnd->GetAttachedData()); bExit = true; } if (fa.bRC) { diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.h b/fpdfsdk/formfiller/cffl_interactiveformfiller.h index b71f3a6ef7..ddab2adcda 100644 --- a/fpdfsdk/formfiller/cffl_interactiveformfiller.h +++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.h @@ -126,13 +126,13 @@ class CFFL_InteractiveFormFiller : public IPWL_Filler_Notify { std::map<CPDFSDK_Annot*, std::unique_ptr<CFFL_FormFiller>>; // IPWL_Filler_Notify: - void QueryWherePopup(void* pPrivateData, + void QueryWherePopup(CPWL_Wnd::PrivateData* pAttached, float fPopupMin, float fPopupMax, bool* bBottom, float* fPopupRet) override; // Returns {bRC, bExit}. - std::pair<bool, bool> OnBeforeKeyStroke(void* pPrivateData, + std::pair<bool, bool> OnBeforeKeyStroke(CPWL_Wnd::PrivateData* pAttached, CFX_WideString& strChange, const CFX_WideString& strChangeEx, int nSelStart, @@ -140,8 +140,10 @@ class CFFL_InteractiveFormFiller : public IPWL_Filler_Notify { bool bKeyDown, uint32_t nFlag) override; #ifdef PDF_ENABLE_XFA - bool OnPopupPreOpen(void* pPrivateData, uint32_t nFlag) override; - bool OnPopupPostOpen(void* pPrivateData, uint32_t nFlag) override; + bool OnPopupPreOpen(CPWL_Wnd::PrivateData* pAttached, + uint32_t nFlag) override; + bool OnPopupPostOpen(CPWL_Wnd::PrivateData* pAttached, + uint32_t nFlag) override; void SetFocusAnnotTab(CPDFSDK_Annot* pWidget, bool bSameField, bool bNext); #endif // PDF_ENABLE_XFA void UnRegisterFormFiller(CPDFSDK_Annot* pAnnot); @@ -151,7 +153,7 @@ class CFFL_InteractiveFormFiller : public IPWL_Filler_Notify { bool m_bNotifying; }; -class CFFL_PrivateData { +class CFFL_PrivateData : public CPWL_Wnd::PrivateData { public: CPDFSDK_Widget* pWidget; CPDFSDK_PageView* pPageView; diff --git a/fpdfsdk/formfiller/cffl_textfield.h b/fpdfsdk/formfiller/cffl_textfield.h index 6893516142..2a99413398 100644 --- a/fpdfsdk/formfiller/cffl_textfield.h +++ b/fpdfsdk/formfiller/cffl_textfield.h @@ -24,7 +24,8 @@ struct FFL_TextFieldState { CFX_WideString sValue; }; -class CFFL_TextField : public CFFL_TextObject, public IPWL_FocusHandler { +class CFFL_TextField : public CFFL_TextObject, + public CPWL_Wnd::FocusHandlerIface { public: CFFL_TextField(CPDFSDK_FormFillEnvironment* pApp, CPDFSDK_Widget* pWidget); ~CFFL_TextField() override; @@ -50,7 +51,7 @@ class CFFL_TextField : public CFFL_TextObject, public IPWL_FocusHandler { bool IsFieldFull(CPDFSDK_PageView* pPageView) override; #endif - // IPWL_FocusHandler: + // CPWL_Wnd::FocusHandlerIface: void OnSetFocus(CPWL_Edit* pEdit) override; private: |