diff options
-rw-r--r-- | fpdfsdk/formfiller/cffl_formfiller.cpp | 31 | ||||
-rw-r--r-- | fpdfsdk/formfiller/cffl_interactiveformfiller.cpp | 28 | ||||
-rw-r--r-- | fpdfsdk/formfiller/cffl_interactiveformfiller.h | 11 |
3 files changed, 24 insertions, 46 deletions
diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp index 281f0d74a7..f45a52cd21 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.cpp +++ b/fpdfsdk/formfiller/cffl_formfiller.cpp @@ -485,43 +485,36 @@ CFX_FloatRect CFFL_FormFiller::FFLtoWnd(CPDFSDK_PageView* pPageView, bool CFFL_FormFiller::CommitData(CPDFSDK_PageView* pPageView, uint32_t nFlag) { if (IsDataChanged(pPageView)) { - bool bRC = true; - bool bExit = false; CFFL_InteractiveFormFiller* pFormFiller = m_pFormFillEnv->GetInteractiveFormFiller(); CPDFSDK_Annot::ObservedPtr pObserved(m_pWidget.Get()); - pFormFiller->OnKeyStrokeCommit(&pObserved, pPageView, bRC, bExit, nFlag); - if (!pObserved) - return false; - if (bExit) - return true; - if (!bRC) { + + if (!pFormFiller->OnKeyStrokeCommit(&pObserved, pPageView, nFlag)) { + if (!pObserved) + return false; ResetPDFWindow(pPageView, false); return true; } - - pFormFiller->OnValidate(&pObserved, pPageView, bRC, bExit, nFlag); if (!pObserved) return false; - if (bExit) - return true; - if (!bRC) { + + if (!pFormFiller->OnValidate(&pObserved, pPageView, nFlag)) { + if (!pObserved) + return false; ResetPDFWindow(pPageView, false); return true; } + if (!pObserved) + return false; SaveData(pPageView); - pFormFiller->OnCalculate(&pObserved, pPageView, bExit, nFlag); + pFormFiller->OnCalculate(&pObserved, pPageView, nFlag); if (!pObserved) return false; - if (bExit) - return true; - pFormFiller->OnFormat(&pObserved, pPageView, bExit, nFlag); + pFormFiller->OnFormat(&pObserved, pPageView, nFlag); if (!pObserved) return false; - if (bExit) - return true; } return true; } diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp index 682d41cabf..96e7645fb6 100644 --- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp +++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp @@ -597,18 +597,16 @@ void CFFL_InteractiveFormFiller::QueryWherePopup(void* pPrivateData, } } -void CFFL_InteractiveFormFiller::OnKeyStrokeCommit( +bool CFFL_InteractiveFormFiller::OnKeyStrokeCommit( CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, - bool& bRC, - bool& bExit, uint32_t nFlag) { if (m_bNotifying) - return; + return true; CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); if (!pWidget->GetAAction(CPDF_AAction::KeyStroke).GetDict()) - return; + return true; ASSERT(pPageView); m_bNotifying = true; @@ -626,23 +624,21 @@ void CFFL_InteractiveFormFiller::OnKeyStrokeCommit( pFormFiller->SaveState(pPageView); pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, pPageView); if (!(*pAnnot)) - return; + return true; - bRC = fa.bRC; m_bNotifying = false; + return fa.bRC; } -void CFFL_InteractiveFormFiller::OnValidate(CPDFSDK_Annot::ObservedPtr* pAnnot, +bool CFFL_InteractiveFormFiller::OnValidate(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, - bool& bRC, - bool& bExit, uint32_t nFlag) { if (m_bNotifying) - return; + return true; CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); if (!pWidget->GetAAction(CPDF_AAction::Validate).GetDict()) - return; + return true; ASSERT(pPageView); m_bNotifying = true; @@ -659,15 +655,14 @@ void CFFL_InteractiveFormFiller::OnValidate(CPDFSDK_Annot::ObservedPtr* pAnnot, pFormFiller->SaveState(pPageView); pWidget->OnAAction(CPDF_AAction::Validate, fa, pPageView); if (!(*pAnnot)) - return; + return true; - bRC = fa.bRC; m_bNotifying = false; + return fa.bRC; } void CFFL_InteractiveFormFiller::OnCalculate(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, - bool& bExit, uint32_t nFlag) { if (m_bNotifying) return; @@ -681,7 +676,6 @@ void CFFL_InteractiveFormFiller::OnCalculate(CPDFSDK_Annot::ObservedPtr* pAnnot, void CFFL_InteractiveFormFiller::OnFormat(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, - bool& bExit, uint32_t nFlag) { if (m_bNotifying) return; @@ -695,8 +689,6 @@ void CFFL_InteractiveFormFiller::OnFormat(CPDFSDK_Annot::ObservedPtr* pAnnot, pInterForm->OnFormat(pWidget->GetFormField(), bFormatted); if (!(*pAnnot)) return; - if (bExit) - return; if (bFormatted) { pInterForm->ResetFieldAppearance(pWidget->GetFormField(), &sValue, true); diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.h b/fpdfsdk/formfiller/cffl_interactiveformfiller.h index b7724a32e3..3b6bc7f1d3 100644 --- a/fpdfsdk/formfiller/cffl_interactiveformfiller.h +++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.h @@ -89,24 +89,17 @@ class CFFL_InteractiveFormFiller : public IPWL_Filler_Notify { static bool IsFillingAllowed(CPDFSDK_Widget* pWidget); static bool IsValidAnnot(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot); - void OnKeyStrokeCommit(CPDFSDK_Annot::ObservedPtr* pWidget, + bool OnKeyStrokeCommit(CPDFSDK_Annot::ObservedPtr* pWidget, CPDFSDK_PageView* pPageView, - bool& bRC, - bool& bExit, uint32_t nFlag); - void OnValidate(CPDFSDK_Annot::ObservedPtr* pAnnot, + bool OnValidate(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, - bool& bRC, - bool& bExit, uint32_t nFlag); - void OnCalculate(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, - bool& bExit, uint32_t nFlag); void OnFormat(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, - bool& bExit, uint32_t nFlag); void OnButtonUp(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, |