diff options
Diffstat (limited to 'fpdfsdk')
-rw-r--r-- | fpdfsdk/formfiller/cffl_formfiller.cpp | 4 | ||||
-rw-r--r-- | fpdfsdk/formfiller/cffl_interactiveformfiller.cpp | 55 | ||||
-rw-r--r-- | fpdfsdk/formfiller/cffl_interactiveformfiller.h | 16 |
3 files changed, 50 insertions, 25 deletions
diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp index cd531413c2..297d5b78d6 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.cpp +++ b/fpdfsdk/formfiller/cffl_formfiller.cpp @@ -514,13 +514,13 @@ bool CFFL_FormFiller::CommitData(CPDFSDK_PageView* pPageView, uint32_t nFlag) { } SaveData(pPageView); - pFormFiller->OnCalculate(m_pWidget.Get(), pPageView, bExit, nFlag); + pFormFiller->OnCalculate(&pObserved, pPageView, bExit, nFlag); if (!pObserved) return false; if (bExit) return true; - pFormFiller->OnFormat(m_pWidget.Get(), pPageView, bExit, nFlag); + pFormFiller->OnFormat(&pObserved, pPageView, bExit, nFlag); if (!pObserved) return false; if (bExit) diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp index 935e3fffb6..dca3194b7b 100644 --- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp +++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp @@ -249,7 +249,7 @@ bool CFFL_InteractiveFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, if (!pAnnot || bExit) return true; #ifdef PDF_ENABLE_XFA - OnClick(pWidget, pPageView, bReset, bExit, nFlags); + OnClick(pAnnot, pPageView, bReset, bExit, nFlags); if (!pAnnot || bExit) return true; #endif // PDF_ENABLE_XFA @@ -653,11 +653,12 @@ void CFFL_InteractiveFormFiller::OnValidate(CPDFSDK_Annot::ObservedPtr* pAnnot, } } -void CFFL_InteractiveFormFiller::OnCalculate(CPDFSDK_Widget* pWidget, +void CFFL_InteractiveFormFiller::OnCalculate(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, bool& bExit, uint32_t nFlag) { if (!m_bNotifying) { + CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); ASSERT(pWidget); CPDFSDK_InterForm* pInterForm = pPageView->GetFormFillEnv()->GetInterForm(); pInterForm->OnCalculate(pWidget->GetFormField()); @@ -665,18 +666,20 @@ void CFFL_InteractiveFormFiller::OnCalculate(CPDFSDK_Widget* pWidget, } } -void CFFL_InteractiveFormFiller::OnFormat(CPDFSDK_Widget* pWidget, +void CFFL_InteractiveFormFiller::OnFormat(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, bool& bExit, uint32_t nFlag) { if (!m_bNotifying) { + CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); ASSERT(pWidget); CPDFSDK_InterForm* pInterForm = pPageView->GetFormFillEnv()->GetInterForm(); bool bFormatted = false; CFX_WideString sValue = pInterForm->OnFormat(pWidget->GetFormField(), bFormatted); - + if (!(*pAnnot)) + return; if (bExit) return; @@ -690,12 +693,13 @@ void CFFL_InteractiveFormFiller::OnFormat(CPDFSDK_Widget* pWidget, } #ifdef PDF_ENABLE_XFA -void CFFL_InteractiveFormFiller::OnClick(CPDFSDK_Widget* pWidget, +void CFFL_InteractiveFormFiller::OnClick(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, bool& bReset, bool& bExit, uint32_t nFlag) { if (!m_bNotifying) { + CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); if (pWidget->HasXFAAAction(PDFSDK_XFA_Click)) { m_bNotifying = true; int nAge = pWidget->GetAppearanceAge(); @@ -707,6 +711,10 @@ void CFFL_InteractiveFormFiller::OnClick(CPDFSDK_Widget* pWidget, pWidget->OnXFAAAction(PDFSDK_XFA_Click, fa, pPageView); m_bNotifying = false; + if (!(*pAnnot)) { + bExit = true; + return; + } if (!IsValidAnnot(pPageView, pWidget)) { bExit = true; @@ -725,12 +733,13 @@ void CFFL_InteractiveFormFiller::OnClick(CPDFSDK_Widget* pWidget, } } -void CFFL_InteractiveFormFiller::OnFull(CPDFSDK_Widget* pWidget, +void CFFL_InteractiveFormFiller::OnFull(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, bool& bReset, bool& bExit, uint32_t nFlag) { if (!m_bNotifying) { + CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); if (pWidget->HasXFAAAction(PDFSDK_XFA_Full)) { m_bNotifying = true; int nAge = pWidget->GetAppearanceAge(); @@ -742,6 +751,10 @@ void CFFL_InteractiveFormFiller::OnFull(CPDFSDK_Widget* pWidget, pWidget->OnXFAAAction(PDFSDK_XFA_Full, fa, pPageView); m_bNotifying = false; + if (!(*pAnnot)) { + bExit = true; + return; + } if (!IsValidAnnot(pPageView, pWidget)) { bExit = true; @@ -769,8 +782,9 @@ void CFFL_InteractiveFormFiller::OnPopupPreOpen(void* pPrivateData, bool bTempReset = false; bool bTempExit = false; - OnPreOpen(pData->pWidget, pData->pPageView, bTempReset, bTempExit, nFlag); - if (bTempReset || bTempExit) + CPDFSDK_Annot::ObservedPtr pObserved(pData->pWidget); + OnPreOpen(&pObserved, pData->pPageView, bTempReset, bTempExit, nFlag); + if (!pObserved || bTempReset || bTempExit) bExit = true; } @@ -783,17 +797,19 @@ void CFFL_InteractiveFormFiller::OnPopupPostOpen(void* pPrivateData, bool bTempReset = false; bool bTempExit = false; - OnPostOpen(pData->pWidget, pData->pPageView, bTempReset, bTempExit, nFlag); - if (bTempReset || bTempExit) + CPDFSDK_Annot::ObservedPtr pObserved(pData->pWidget); + OnPostOpen(&pObserved, pData->pPageView, bTempReset, bTempExit, nFlag); + if (!pObserved || bTempReset || bTempExit) bExit = true; } -void CFFL_InteractiveFormFiller::OnPreOpen(CPDFSDK_Widget* pWidget, +void CFFL_InteractiveFormFiller::OnPreOpen(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, bool& bReset, bool& bExit, uint32_t nFlag) { if (!m_bNotifying) { + CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); if (pWidget->HasXFAAAction(PDFSDK_XFA_PreOpen)) { m_bNotifying = true; int nAge = pWidget->GetAppearanceAge(); @@ -805,6 +821,10 @@ void CFFL_InteractiveFormFiller::OnPreOpen(CPDFSDK_Widget* pWidget, pWidget->OnXFAAAction(PDFSDK_XFA_PreOpen, fa, pPageView); m_bNotifying = false; + if (!(*pAnnot)) { + bExit = true; + return; + } if (!IsValidAnnot(pPageView, pWidget)) { bExit = true; @@ -823,12 +843,13 @@ void CFFL_InteractiveFormFiller::OnPreOpen(CPDFSDK_Widget* pWidget, } } -void CFFL_InteractiveFormFiller::OnPostOpen(CPDFSDK_Widget* pWidget, +void CFFL_InteractiveFormFiller::OnPostOpen(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, bool& bReset, bool& bExit, uint32_t nFlag) { if (!m_bNotifying) { + CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); if (pWidget->HasXFAAAction(PDFSDK_XFA_PostOpen)) { m_bNotifying = true; int nAge = pWidget->GetAppearanceAge(); @@ -840,6 +861,10 @@ void CFFL_InteractiveFormFiller::OnPostOpen(CPDFSDK_Widget* pWidget, pWidget->OnXFAAAction(PDFSDK_XFA_PostOpen, fa, pPageView); m_bNotifying = false; + if (!(*pAnnot)) { + bExit = true; + return; + } if (!IsValidAnnot(pPageView, pWidget)) { bExit = true; @@ -883,9 +908,9 @@ void CFFL_InteractiveFormFiller::OnBeforeKeyStroke( if (pFormFiller->IsFieldFull(pData->pPageView)) { bool bFullExit = false; bool bFullReset = false; - OnFull(pData->pWidget, pData->pPageView, bFullReset, bFullExit, nFlag); - - if (bFullReset || bFullExit) { + CPDFSDK_Annot::ObservedPtr pObserved(pData->pWidget); + OnFull(&pObserved, pData->pPageView, bFullReset, bFullExit, nFlag); + if (!pObserved || bFullReset || bFullExit) { bExit = true; return; } diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.h b/fpdfsdk/formfiller/cffl_interactiveformfiller.h index d84b8b8a98..f72dfbcc61 100644 --- a/fpdfsdk/formfiller/cffl_interactiveformfiller.h +++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.h @@ -92,42 +92,42 @@ class CFFL_InteractiveFormFiller : public IPWL_Filler_Notify { bool& bRC, bool& bExit, uint32_t nFlag); - void OnValidate(CPDFSDK_Annot::ObservedPtr* pWidget, + void OnValidate(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, bool& bRC, bool& bExit, uint32_t nFlag); - void OnCalculate(CPDFSDK_Widget* pWidget, + void OnCalculate(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, bool& bExit, uint32_t nFlag); - void OnFormat(CPDFSDK_Widget* pWidget, + void OnFormat(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, bool& bExit, uint32_t nFlag); - void OnButtonUp(CPDFSDK_Annot::ObservedPtr* pWidget, + void OnButtonUp(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, bool& bReset, bool& bExit, uint32_t nFlag); #ifdef PDF_ENABLE_XFA - void OnClick(CPDFSDK_Widget* pWidget, + void OnClick(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, bool& bReset, bool& bExit, uint32_t nFlag); - void OnFull(CPDFSDK_Widget* pWidget, + void OnFull(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, bool& bReset, bool& bExit, uint32_t nFlag); - void OnPreOpen(CPDFSDK_Widget* pWidget, + void OnPreOpen(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, bool& bReset, bool& bExit, uint32_t nFlag); - void OnPostOpen(CPDFSDK_Widget* pWidget, + void OnPostOpen(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, bool& bReset, bool& bExit, |