diff options
author | Tom Sepez <tsepez@chromium.org> | 2017-09-15 15:32:01 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-09-15 22:42:04 +0000 |
commit | 134ac9105586407eb3b1e06001101ff893dd4a31 (patch) | |
tree | 42742a4d7867643a9e30d637204bc320407a66c0 /fpdfsdk/formfiller/cffl_interactiveformfiller.cpp | |
parent | bf15730b2c9577d4efd2124d84c6c8ccc5f66b43 (diff) | |
download | pdfium-134ac9105586407eb3b1e06001101ff893dd4a31.tar.xz |
Introduce CPWL_Wnd::PrivateData class.
First step in passing ownership of this memory to the CPWL_Wnd.
In turn, nest two other classes that also require PrivateData to
satisfy nesting rules.
Move one stray #define to the appropriate file while at it.
Change-Id: I565934565421f5843a3b792b3bdc21b5e8839eb8
Reviewed-on: https://pdfium-review.googlesource.com/14170
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fpdfsdk/formfiller/cffl_interactiveformfiller.cpp')
-rw-r--r-- | fpdfsdk/formfiller/cffl_interactiveformfiller.cpp | 36 |
1 files changed, 19 insertions, 17 deletions
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) { |