Avoid exposing CFFL_InteractiveFormFiller::CallbackIface to callers.

Remove GetCallbackIface at the cost of adding wrapper methods.

Change-Id: Iea0615cdd9d56003bb71533b2606c01fb94b8e3c
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/99414
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/fpdfsdk/formfiller/cffl_combobox.cpp b/fpdfsdk/formfiller/cffl_combobox.cpp
index cc2b8f6..2bf1284 100644
--- a/fpdfsdk/formfiller/cffl_combobox.cpp
+++ b/fpdfsdk/formfiller/cffl_combobox.cpp
@@ -235,7 +235,7 @@
 void CFFL_ComboBox::OnSetFocusForEdit(CPWL_Edit* pEdit) {
   pEdit->SetCharSet(FX_Charset::kChineseSimplified);
   pEdit->SetReadyToInput();
-  m_pFormFiller->GetCallbackIface()->OnSetFieldInputFocus(pEdit->GetText());
+  m_pFormFiller->OnSetFieldInputFocus(pEdit->GetText());
 }
 
 WideString CFFL_ComboBox::GetSelectExportText() {
diff --git a/fpdfsdk/formfiller/cffl_formfield.cpp b/fpdfsdk/formfiller/cffl_formfield.cpp
index 013e7a6..c21dca4 100644
--- a/fpdfsdk/formfiller/cffl_formfield.cpp
+++ b/fpdfsdk/formfiller/cffl_formfield.cpp
@@ -257,8 +257,7 @@
 void CFFL_FormField::SetFocusForAnnot(CPDFSDK_Widget* pWidget,
                                       Mask<FWL_EVENTFLAG> nFlag) {
   CPDFSDK_PageView* pPageView =
-      m_pFormFiller->GetCallbackIface()->GetOrCreatePageView(
-          pWidget->GetPage());
+      m_pFormFiller->GetOrCreatePageView(pWidget->GetPage());
   CPWL_Wnd* pWnd = CreateOrUpdatePWLWindow(pPageView);
   if (pWnd)
     pWnd->SetFocus();
@@ -272,7 +271,7 @@
     return;
 
   CPDFSDK_PageView* pPageView =
-      m_pFormFiller->GetCallbackIface()->GetPageView(m_pWidget->GetPage());
+      m_pFormFiller->GetPageView(m_pWidget->GetPage());
   if (!pPageView || !CommitData(pPageView, nFlag))
     return;
   if (CPWL_Wnd* pWnd = GetPWLWindow(pPageView))
@@ -297,9 +296,8 @@
 }
 
 CPWL_Wnd::CreateParams CFFL_FormField::GetCreateParam() {
-  CPWL_Wnd::CreateParams cp(
-      m_pFormFiller->GetCallbackIface()->GetTimerHandler(), m_pFormFiller,
-      this);
+  CPWL_Wnd::CreateParams cp(m_pFormFiller->GetTimerHandler(), m_pFormFiller,
+                            this);
 
   cp.rcRectWnd = GetPDFAnnotRect();
 
@@ -433,8 +431,7 @@
 }
 
 CPDFSDK_PageView* CFFL_FormField::GetCurPageView() {
-  return m_pFormFiller->GetCallbackIface()->GetOrCreatePageView(
-      m_pWidget->GetPage());
+  return m_pFormFiller->GetOrCreatePageView(m_pWidget->GetPage());
 }
 
 CFX_FloatRect CFFL_FormField::GetFocusBox(const CPDFSDK_PageView* pPageView) {
@@ -515,7 +512,7 @@
 #endif  // PDF_ENABLE_XFA
 
 void CFFL_FormField::SetChangeMark() {
-  m_pFormFiller->GetCallbackIface()->OnChange();
+  m_pFormFiller->OnChange();
 }
 
 void CFFL_FormField::GetActionData(const CPDFSDK_PageView* pPageView,
@@ -578,5 +575,5 @@
 }
 
 void CFFL_FormField::InvalidateRect(const FX_RECT& rect) {
-  m_pFormFiller->GetCallbackIface()->Invalidate(m_pWidget->GetPage(), rect);
+  m_pFormFiller->Invalidate(m_pWidget->GetPage(), rect);
 }
diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
index bcfc7e9..d6c44aa 100644
--- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
@@ -432,6 +432,32 @@
   return !!pWidget;
 }
 
+void CFFL_InteractiveFormFiller::OnSetFieldInputFocus(const WideString& text) {
+  m_pCallbackIface->OnSetFieldInputFocus(text);
+}
+
+void CFFL_InteractiveFormFiller::Invalidate(IPDF_Page* pPage,
+                                            const FX_RECT& rect) {
+  m_pCallbackIface->Invalidate(pPage, rect);
+}
+
+CPDFSDK_PageView* CFFL_InteractiveFormFiller::GetOrCreatePageView(
+    IPDF_Page* pPage) {
+  return m_pCallbackIface->GetOrCreatePageView(pPage);
+}
+
+CPDFSDK_PageView* CFFL_InteractiveFormFiller::GetPageView(IPDF_Page* pPage) {
+  return m_pCallbackIface->GetPageView(pPage);
+}
+
+CFX_Timer::HandlerIface* CFFL_InteractiveFormFiller::GetTimerHandler() {
+  return m_pCallbackIface->GetTimerHandler();
+}
+
+void CFFL_InteractiveFormFiller::OnChange() {
+  m_pCallbackIface->OnChange();
+}
+
 bool CFFL_InteractiveFormFiller::IsVisible(CPDFSDK_Widget* pWidget) {
   return pWidget->IsVisible();
 }
@@ -554,7 +580,7 @@
   if (!pWidget)
     return;
 
-  GetCallbackIface()->InvalidateRect(pWidget, rect);
+  m_pCallbackIface->InvalidateRect(pWidget, rect);
 }
 
 void CFFL_InteractiveFormFiller::OutputSelectedRect(PerWindowData* pWidgetData,
@@ -567,15 +593,15 @@
   if (!pFormField)
     return;
 
-  GetCallbackIface()->OutputSelectedRect(pFormField, rect);
+  m_pCallbackIface->OutputSelectedRect(pFormField, rect);
 }
 
 bool CFFL_InteractiveFormFiller::IsSelectionImplemented() const {
-  return GetCallbackIface()->IsSelectionImplemented();
+  return m_pCallbackIface->IsSelectionImplemented();
 }
 
 void CFFL_InteractiveFormFiller::SetCursor(CursorStyle nCursorStyle) {
-  GetCallbackIface()->SetCursor(nCursorStyle);
+  m_pCallbackIface->SetCursor(nCursorStyle);
 }
 
 void CFFL_InteractiveFormFiller::QueryWherePopup(
diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.h b/fpdfsdk/formfiller/cffl_interactiveformfiller.h
index 583339d..2be4ac2 100644
--- a/fpdfsdk/formfiller/cffl_interactiveformfiller.h
+++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.h
@@ -54,7 +54,6 @@
   explicit CFFL_InteractiveFormFiller(CallbackIface* pCallbackIface);
   ~CFFL_InteractiveFormFiller() override;
 
-  CallbackIface* GetCallbackIface() const { return m_pCallbackIface.Get(); }
   bool Annot_HitTest(const CPDFSDK_Widget* pWidget, const CFX_PointF& point);
   FX_RECT GetViewBBox(const CPDFSDK_PageView* pPageView,
                       CPDFSDK_Widget* pWidget);
@@ -113,6 +112,14 @@
   bool OnKillFocus(ObservedPtr<CPDFSDK_Widget>& pWidget,
                    Mask<FWL_EVENTFLAG> nFlag);
 
+  // Wrapper methods for CallbackIface
+  void OnSetFieldInputFocus(const WideString& text);
+  void Invalidate(IPDF_Page* pPage, const FX_RECT& rect);
+  CPDFSDK_PageView* GetOrCreatePageView(IPDF_Page* pPage);
+  CPDFSDK_PageView* GetPageView(IPDF_Page* pPage);
+  CFX_Timer::HandlerIface* GetTimerHandler();
+  void OnChange();
+
   CFFL_FormField* GetFormFieldForTesting(CPDFSDK_Widget* pAnnot) {
     return GetFormField(pAnnot);
   }
diff --git a/fpdfsdk/formfiller/cffl_textfield.cpp b/fpdfsdk/formfiller/cffl_textfield.cpp
index 5ae3e94..4ff64b1 100644
--- a/fpdfsdk/formfiller/cffl_textfield.cpp
+++ b/fpdfsdk/formfiller/cffl_textfield.cpp
@@ -111,8 +111,8 @@
       CPDFSDK_PageView* pPageView = GetCurPageView();
       DCHECK(pPageView);
       m_bValid = !m_bValid;
-      m_pFormFiller->GetCallbackIface()->Invalidate(
-          pWidget->GetPage(), pWidget->GetRect().GetOuterRect());
+      m_pFormFiller->Invalidate(pWidget->GetPage(),
+                                pWidget->GetRect().GetOuterRect());
       if (m_bValid) {
         if (CPWL_Wnd* pWnd = CreateOrUpdatePWLWindow(pPageView))
           pWnd->SetFocus();
@@ -240,7 +240,7 @@
 void CFFL_TextField::OnSetFocusForEdit(CPWL_Edit* pEdit) {
   pEdit->SetCharSet(FX_Charset::kChineseSimplified);
   pEdit->SetReadyToInput();
-  m_pFormFiller->GetCallbackIface()->OnSetFieldInputFocus(pEdit->GetText());
+  m_pFormFiller->OnSetFieldInputFocus(pEdit->GetText());
 }
 
 CPWL_Edit* CFFL_TextField::GetPWLEdit(const CPDFSDK_PageView* pPageView) const {