From bdb965338673ca2bcef831f20e98b7965b39b2fb Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 6 Jul 2017 10:40:51 -0400 Subject: Remove some in/out params from CFFL_InteractiveFormFiller This CL removes the bExit and bReset in-out params from CFFL_InteractiveFormFiller and switches to using returns. Change-Id: I1617afa3598c02fe56ef02adfb0b1443b5fd0e4a Reviewed-on: https://pdfium-review.googlesource.com/7311 Reviewed-by: Henrique Nakashima Commit-Queue: dsinclair --- fpdfsdk/formfiller/cffl_formfiller.cpp | 31 +++++++++-------------- fpdfsdk/formfiller/cffl_interactiveformfiller.cpp | 28 ++++++++------------ fpdfsdk/formfiller/cffl_interactiveformfiller.h | 11 ++------ 3 files changed, 24 insertions(+), 46 deletions(-) (limited to 'fpdfsdk') 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(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(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, -- cgit v1.2.3