diff options
Diffstat (limited to 'fpdfsdk/formfiller')
-rw-r--r-- | fpdfsdk/formfiller/cffl_interactiveformfiller.cpp | 127 | ||||
-rw-r--r-- | fpdfsdk/formfiller/cffl_interactiveformfiller.h | 16 |
2 files changed, 40 insertions, 103 deletions
diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp index 96e7645fb6..4d5ceb8d16 100644 --- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp +++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp @@ -251,8 +251,7 @@ bool CFFL_InteractiveFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, if (!pAnnot || bExit) return true; #ifdef PDF_ENABLE_XFA - OnClick(pAnnot, pPageView, bReset, bExit, nFlags); - if (!pAnnot || bExit) + if (OnClick(pAnnot, pPageView, nFlags) || !pAnnot) return true; #endif // PDF_ENABLE_XFA return bRet; @@ -699,17 +698,15 @@ void CFFL_InteractiveFormFiller::OnFormat(CPDFSDK_Annot::ObservedPtr* pAnnot, } #ifdef PDF_ENABLE_XFA -void CFFL_InteractiveFormFiller::OnClick(CPDFSDK_Annot::ObservedPtr* pAnnot, +bool CFFL_InteractiveFormFiller::OnClick(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, - bool& bReset, - bool& bExit, uint32_t nFlag) { if (m_bNotifying) - return; + return false; CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); if (!pWidget->HasXFAAAction(PDFSDK_XFA_Click)) - return; + return false; m_bNotifying = true; int nAge = pWidget->GetAppearanceAge(); @@ -721,37 +718,25 @@ void CFFL_InteractiveFormFiller::OnClick(CPDFSDK_Annot::ObservedPtr* pAnnot, pWidget->OnXFAAAction(PDFSDK_XFA_Click, fa, pPageView); m_bNotifying = false; - if (!(*pAnnot)) { - bExit = true; - return; - } - - if (!IsValidAnnot(pPageView, pWidget)) { - bExit = true; - return; - } - + if (!(*pAnnot) || !IsValidAnnot(pPageView, pWidget)) + return true; if (nAge == pWidget->GetAppearanceAge()) - return; + return false; - if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, false)) { + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, false)) pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget->GetValueAge()); - } - - bReset = true; + return false; } -void CFFL_InteractiveFormFiller::OnFull(CPDFSDK_Annot::ObservedPtr* pAnnot, +bool CFFL_InteractiveFormFiller::OnFull(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, - bool& bReset, - bool& bExit, uint32_t nFlag) { if (m_bNotifying) - return; + return false; CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); if (!pWidget->HasXFAAAction(PDFSDK_XFA_Full)) - return; + return false; m_bNotifying = true; int nAge = pWidget->GetAppearanceAge(); @@ -763,24 +748,15 @@ void CFFL_InteractiveFormFiller::OnFull(CPDFSDK_Annot::ObservedPtr* pAnnot, pWidget->OnXFAAAction(PDFSDK_XFA_Full, fa, pPageView); m_bNotifying = false; - if (!(*pAnnot)) { - bExit = true; - return; - } - - if (!IsValidAnnot(pPageView, pWidget)) { - bExit = true; - return; - } - + if (!(*pAnnot) || !IsValidAnnot(pPageView, pWidget)) + return true; if (nAge == pWidget->GetAppearanceAge()) - return; + return false; - if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, false)) { + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, false)) pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget->GetValueAge()); - } - bReset = true; + return true; } void CFFL_InteractiveFormFiller::OnPopupPreOpen(void* pPrivateData, @@ -790,11 +766,8 @@ void CFFL_InteractiveFormFiller::OnPopupPreOpen(void* pPrivateData, ASSERT(pData); ASSERT(pData->pWidget); - bool bTempReset = false; - bool bTempExit = false; CPDFSDK_Annot::ObservedPtr pObserved(pData->pWidget); - OnPreOpen(&pObserved, pData->pPageView, bTempReset, bTempExit, nFlag); - if (!pObserved || bTempReset || bTempExit) + if (OnPreOpen(&pObserved, pData->pPageView, nFlag) || !pObserved) bExit = true; } @@ -805,25 +778,20 @@ void CFFL_InteractiveFormFiller::OnPopupPostOpen(void* pPrivateData, ASSERT(pData); ASSERT(pData->pWidget); - bool bTempReset = false; - bool bTempExit = false; CPDFSDK_Annot::ObservedPtr pObserved(pData->pWidget); - OnPostOpen(&pObserved, pData->pPageView, bTempReset, bTempExit, nFlag); - if (!pObserved || bTempReset || bTempExit) + if (OnPostOpen(&pObserved, pData->pPageView, nFlag) || !pObserved) bExit = true; } -void CFFL_InteractiveFormFiller::OnPreOpen(CPDFSDK_Annot::ObservedPtr* pAnnot, +bool CFFL_InteractiveFormFiller::OnPreOpen(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, - bool& bReset, - bool& bExit, uint32_t nFlag) { if (m_bNotifying) - return; + return false; CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); if (!pWidget->HasXFAAAction(PDFSDK_XFA_PreOpen)) - return; + return false; m_bNotifying = true; int nAge = pWidget->GetAppearanceAge(); @@ -835,37 +803,26 @@ void CFFL_InteractiveFormFiller::OnPreOpen(CPDFSDK_Annot::ObservedPtr* pAnnot, pWidget->OnXFAAAction(PDFSDK_XFA_PreOpen, fa, pPageView); m_bNotifying = false; - if (!(*pAnnot)) { - bExit = true; - return; - } - - if (!IsValidAnnot(pPageView, pWidget)) { - bExit = true; - return; - } - + if (!(*pAnnot) || !IsValidAnnot(pPageView, pWidget)) + return true; if (nAge == pWidget->GetAppearanceAge()) - return; + return false; - if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, false)) { + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, false)) pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget->GetValueAge()); - } - bReset = true; + return true; } -void CFFL_InteractiveFormFiller::OnPostOpen(CPDFSDK_Annot::ObservedPtr* pAnnot, +bool CFFL_InteractiveFormFiller::OnPostOpen(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, - bool& bReset, - bool& bExit, uint32_t nFlag) { if (m_bNotifying) - return; + return false; CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); if (!pWidget->HasXFAAAction(PDFSDK_XFA_PostOpen)) - return; + return false; m_bNotifying = true; int nAge = pWidget->GetAppearanceAge(); @@ -877,24 +834,15 @@ void CFFL_InteractiveFormFiller::OnPostOpen(CPDFSDK_Annot::ObservedPtr* pAnnot, pWidget->OnXFAAAction(PDFSDK_XFA_PostOpen, fa, pPageView); m_bNotifying = false; - if (!(*pAnnot)) { - bExit = true; - return; - } - - if (!IsValidAnnot(pPageView, pWidget)) { - bExit = true; - return; - } - + if (!(*pAnnot) || !IsValidAnnot(pPageView, pWidget)) + return true; if (nAge == pWidget->GetAppearanceAge()) - return; + return false; - if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, false)) { + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, false)) pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget->GetValueAge()); - } - bReset = true; + return true; } #endif // PDF_ENABLE_XFA @@ -920,11 +868,8 @@ void CFFL_InteractiveFormFiller::OnBeforeKeyStroke( #ifdef PDF_ENABLE_XFA if (pFormFiller->IsFieldFull(pData->pPageView)) { - bool bFullExit = false; - bool bFullReset = false; CPDFSDK_Annot::ObservedPtr pObserved(pData->pWidget); - OnFull(&pObserved, pData->pPageView, bFullReset, bFullExit, nFlag); - if (!pObserved || bFullReset || bFullExit) { + if (OnFull(&pObserved, pData->pPageView, nFlag) || !pObserved) { bExit = true; return; } diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.h b/fpdfsdk/formfiller/cffl_interactiveformfiller.h index 3b6bc7f1d3..7be39f7137 100644 --- a/fpdfsdk/formfiller/cffl_interactiveformfiller.h +++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.h @@ -107,25 +107,17 @@ class CFFL_InteractiveFormFiller : public IPWL_Filler_Notify { bool& bExit, uint32_t nFlag); #ifdef PDF_ENABLE_XFA - void OnClick(CPDFSDK_Annot::ObservedPtr* pAnnot, + bool OnClick(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, - bool& bReset, - bool& bExit, uint32_t nFlag); - void OnFull(CPDFSDK_Annot::ObservedPtr* pAnnot, + bool OnFull(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, - bool& bReset, - bool& bExit, uint32_t nFlag); - void OnPreOpen(CPDFSDK_Annot::ObservedPtr* pAnnot, + bool OnPreOpen(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, - bool& bReset, - bool& bExit, uint32_t nFlag); - void OnPostOpen(CPDFSDK_Annot::ObservedPtr* pAnnot, + bool OnPostOpen(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, - bool& bReset, - bool& bExit, uint32_t nFlag); #endif // PDF_ENABLE_XFA |