CFFL_FormFields only accept CPDFSDK_Widget subclass of CPDFSDK_Annot
So pass them as such. The end goal is fewer types from CPDFSDK that
CFFL needs to know about. In an ideal world, CPDFSDK_Widget might
implement some CFFL callback-interface that other annot classes
wouldn't.
Change-Id: I541f303fd3af600e78497fdcdc5e24c8a1c8beeb
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/85373
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.cpp b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
index 1822101..cfc71cb 100644
--- a/fpdfsdk/cpdfsdk_formfillenvironment.cpp
+++ b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
@@ -125,7 +125,7 @@
if (!pFormField)
return;
- auto* pPage = FPDFPageFromIPDFPage(pFormField->GetSDKAnnot()->GetPage());
+ auto* pPage = FPDFPageFromIPDFPage(pFormField->GetSDKWidget()->GetPage());
DCHECK(pPage);
CFX_PointF ptA = pFormField->PWLtoFFL(CFX_PointF(rect.left, rect.bottom));
diff --git a/fpdfsdk/formfiller/cffl_button.cpp b/fpdfsdk/formfiller/cffl_button.cpp
index 6458e02..53cb689 100644
--- a/fpdfsdk/formfiller/cffl_button.cpp
+++ b/fpdfsdk/formfiller/cffl_button.cpp
@@ -7,6 +7,7 @@
#include "fpdfsdk/formfiller/cffl_button.h"
#include "core/fpdfdoc/cpdf_formcontrol.h"
+#include "fpdfsdk/cpdfsdk_widget.h"
#include "third_party/base/check.h"
CFFL_Button::CFFL_Button(CFFL_InteractiveFormFiller* pFormFiller,
@@ -28,10 +29,10 @@
}
bool CFFL_Button::OnLButtonDown(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Widget* pWidget,
Mask<FWL_EVENTFLAG> nFlags,
const CFX_PointF& point) {
- if (!pAnnot->GetRect().Contains(point))
+ if (!pWidget->GetRect().Contains(point))
return false;
m_bMouseDown = true;
@@ -41,10 +42,10 @@
}
bool CFFL_Button::OnLButtonUp(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Widget* pWidget,
Mask<FWL_EVENTFLAG> nFlags,
const CFX_PointF& point) {
- if (!pAnnot->GetRect().Contains(point))
+ if (!pWidget->GetRect().Contains(point))
return false;
m_bMouseDown = false;
@@ -59,11 +60,10 @@
}
void CFFL_Button::OnDraw(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Widget* pWidget,
CFX_RenderDevice* pDevice,
const CFX_Matrix& mtUser2Device) {
DCHECK(pPageView);
- CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot);
CPDF_FormControl* pCtrl = pWidget->GetFormControl();
if (pCtrl->GetHighlightingMode() != CPDF_FormControl::kPush) {
pWidget->DrawAppearance(pDevice, mtUser2Device,
@@ -97,8 +97,8 @@
}
void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Widget* pWidget,
CFX_RenderDevice* pDevice,
const CFX_Matrix& mtUser2Device) {
- OnDraw(pPageView, pAnnot, pDevice, mtUser2Device);
+ OnDraw(pPageView, pWidget, pDevice, mtUser2Device);
}
diff --git a/fpdfsdk/formfiller/cffl_button.h b/fpdfsdk/formfiller/cffl_button.h
index 5759024..3704b17 100644
--- a/fpdfsdk/formfiller/cffl_button.h
+++ b/fpdfsdk/formfiller/cffl_button.h
@@ -12,7 +12,6 @@
class CFX_RenderDevice;
class CFX_Matrix;
-class CPDFSDK_Annot;
class CPDFSDK_PageView;
class CPDFSDK_Widget;
@@ -25,22 +24,22 @@
void OnMouseEnter(CPDFSDK_PageView* pPageView) override;
void OnMouseExit(CPDFSDK_PageView* pPageView) override;
bool OnLButtonDown(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Widget* pWidget,
Mask<FWL_EVENTFLAG> nFlags,
const CFX_PointF& point) override;
bool OnLButtonUp(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Widget* pWidget,
Mask<FWL_EVENTFLAG> nFlags,
const CFX_PointF& point) override;
bool OnMouseMove(CPDFSDK_PageView* pPageView,
Mask<FWL_EVENTFLAG> nFlags,
const CFX_PointF& point) override;
void OnDraw(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Widget* pWidget,
CFX_RenderDevice* pDevice,
const CFX_Matrix& mtUser2Device) override;
void OnDrawDeactive(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Widget* pWidget,
CFX_RenderDevice* pDevice,
const CFX_Matrix& mtUser2Device) override;
diff --git a/fpdfsdk/formfiller/cffl_checkbox.cpp b/fpdfsdk/formfiller/cffl_checkbox.cpp
index 326673c..d425d74 100644
--- a/fpdfsdk/formfiller/cffl_checkbox.cpp
+++ b/fpdfsdk/formfiller/cffl_checkbox.cpp
@@ -41,13 +41,14 @@
return CFFL_FormField::OnKeyDown(nKeyCode, nFlags);
}
}
-bool CFFL_CheckBox::OnChar(CPDFSDK_Annot* pAnnot,
+
+bool CFFL_CheckBox::OnChar(CPDFSDK_Widget* pWidget,
uint32_t nChar,
Mask<FWL_EVENTFLAG> nFlags) {
switch (nChar) {
case pdfium::ascii::kReturn:
case pdfium::ascii::kSpace: {
- CPDFSDK_PageView* pPageView = pAnnot->GetPageView();
+ CPDFSDK_PageView* pPageView = pWidget->GetPageView();
DCHECK(pPageView);
ObservedPtr<CPDFSDK_Annot> pObserved(m_pWidget.Get());
@@ -61,35 +62,31 @@
return true;
}
- CFFL_FormField::OnChar(pAnnot, nChar, nFlags);
+ CFFL_FormField::OnChar(pWidget, nChar, nFlags);
CPWL_CheckBox* pWnd = CreateOrUpdatePWLCheckBox(pPageView);
- if (pWnd && !pWnd->IsReadOnly()) {
- CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot);
+ if (pWnd && !pWnd->IsReadOnly())
pWnd->SetCheck(!pWidget->IsChecked());
- }
return CommitData(pPageView, nFlags);
}
default:
- return CFFL_FormField::OnChar(pAnnot, nChar, nFlags);
+ return CFFL_FormField::OnChar(pWidget, nChar, nFlags);
}
}
bool CFFL_CheckBox::OnLButtonUp(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Widget* pWidget,
Mask<FWL_EVENTFLAG> nFlags,
const CFX_PointF& point) {
- CFFL_Button::OnLButtonUp(pPageView, pAnnot, nFlags, point);
+ CFFL_Button::OnLButtonUp(pPageView, pWidget, nFlags, point);
if (!IsValid())
return true;
CPWL_CheckBox* pWnd = CreateOrUpdatePWLCheckBox(pPageView);
- if (pWnd) {
- CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot);
+ if (pWnd)
pWnd->SetCheck(!pWidget->IsChecked());
- }
return CommitData(pPageView, nFlags);
}
diff --git a/fpdfsdk/formfiller/cffl_checkbox.h b/fpdfsdk/formfiller/cffl_checkbox.h
index a2cdfda..60242fe 100644
--- a/fpdfsdk/formfiller/cffl_checkbox.h
+++ b/fpdfsdk/formfiller/cffl_checkbox.h
@@ -25,11 +25,11 @@
std::unique_ptr<IPWL_SystemHandler::PerWindowData> pAttachedData)
override;
bool OnKeyDown(FWL_VKEYCODE nKeyCode, Mask<FWL_EVENTFLAG> nFlags) override;
- bool OnChar(CPDFSDK_Annot* pAnnot,
+ bool OnChar(CPDFSDK_Widget* pWidget,
uint32_t nChar,
Mask<FWL_EVENTFLAG> nFlags) override;
bool OnLButtonUp(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Widget* pWidget,
Mask<FWL_EVENTFLAG> nFlags,
const CFX_PointF& point) override;
bool IsDataChanged(const CPDFSDK_PageView* pPageView) override;
diff --git a/fpdfsdk/formfiller/cffl_combobox.cpp b/fpdfsdk/formfiller/cffl_combobox.cpp
index 25dfd19..fef972c 100644
--- a/fpdfsdk/formfiller/cffl_combobox.cpp
+++ b/fpdfsdk/formfiller/cffl_combobox.cpp
@@ -63,10 +63,10 @@
return std::move(pWnd);
}
-bool CFFL_ComboBox::OnChar(CPDFSDK_Annot* pAnnot,
+bool CFFL_ComboBox::OnChar(CPDFSDK_Widget* pWidget,
uint32_t nChar,
Mask<FWL_EVENTFLAG> nFlags) {
- return CFFL_TextObject::OnChar(pAnnot, nChar, nFlags);
+ return CFFL_TextObject::OnChar(pWidget, nChar, nFlags);
}
bool CFFL_ComboBox::IsDataChanged(const CPDFSDK_PageView* pPageView) {
diff --git a/fpdfsdk/formfiller/cffl_combobox.h b/fpdfsdk/formfiller/cffl_combobox.h
index cb22f7c..b63a4d0 100644
--- a/fpdfsdk/formfiller/cffl_combobox.h
+++ b/fpdfsdk/formfiller/cffl_combobox.h
@@ -34,7 +34,7 @@
const CPWL_Wnd::CreateParams& cp,
std::unique_ptr<IPWL_SystemHandler::PerWindowData> pAttachedData)
override;
- bool OnChar(CPDFSDK_Annot* pAnnot,
+ bool OnChar(CPDFSDK_Widget* pWidget,
uint32_t nChar,
Mask<FWL_EVENTFLAG> nFlags) override;
bool IsDataChanged(const CPDFSDK_PageView* pPageView) override;
diff --git a/fpdfsdk/formfiller/cffl_formfield.cpp b/fpdfsdk/formfiller/cffl_formfield.cpp
index acb6e8d..e926b8e 100644
--- a/fpdfsdk/formfiller/cffl_formfield.cpp
+++ b/fpdfsdk/formfiller/cffl_formfield.cpp
@@ -54,7 +54,7 @@
}
void CFFL_FormField::OnDraw(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Widget* pWidget,
CFX_RenderDevice* pDevice,
const CFX_Matrix& mtUser2Device) {
CPWL_Wnd* pWnd = GetPWLWindow(pPageView);
@@ -62,8 +62,6 @@
pWnd->DrawAppearance(pDevice, GetCurMatrix() * mtUser2Device);
return;
}
-
- CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot);
if (!CFFL_InteractiveFormFiller::IsVisible(pWidget))
return;
@@ -72,11 +70,11 @@
}
void CFFL_FormField::OnDrawDeactive(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Widget* pWidget,
CFX_RenderDevice* pDevice,
const CFX_Matrix& mtUser2Device) {
- ToCPDFSDKWidget(pAnnot)->DrawAppearance(
- pDevice, mtUser2Device, CPDF_Annot::AppearanceMode::kNormal, nullptr);
+ pWidget->DrawAppearance(pDevice, mtUser2Device,
+ CPDF_Annot::AppearanceMode::kNormal, nullptr);
}
void CFFL_FormField::OnMouseEnter(CPDFSDK_PageView* pPageView) {}
@@ -87,7 +85,7 @@
}
bool CFFL_FormField::OnLButtonDown(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Widget* pWidget,
Mask<FWL_EVENTFLAG> nFlags,
const CFX_PointF& point) {
CPWL_Wnd* pWnd = CreateOrUpdatePWLWindow(pPageView);
@@ -103,7 +101,7 @@
}
bool CFFL_FormField::OnLButtonUp(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Widget* pWidget,
Mask<FWL_EVENTFLAG> nFlags,
const CFX_PointF& point) {
CPWL_Wnd* pWnd = GetPWLWindow(pPageView);
@@ -171,7 +169,7 @@
return pWnd && pWnd->OnKeyDown(nKeyCode, nFlags);
}
-bool CFFL_FormField::OnChar(CPDFSDK_Annot* pAnnot,
+bool CFFL_FormField::OnChar(CPDFSDK_Widget* pWidget,
uint32_t nChar,
Mask<FWL_EVENTFLAG> nFlags) {
if (!IsValid())
@@ -256,9 +254,8 @@
return pWnd && pWnd->Redo();
}
-void CFFL_FormField::SetFocusForAnnot(CPDFSDK_Annot* pAnnot,
+void CFFL_FormField::SetFocusForAnnot(CPDFSDK_Widget* pWidget,
Mask<FWL_EVENTFLAG> nFlag) {
- CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot);
CPDFSDK_PageView* pPageView =
m_pFormFiller->GetCallbackIface()->GetOrCreatePageView(
pWidget->GetPage());
diff --git a/fpdfsdk/formfiller/cffl_formfield.h b/fpdfsdk/formfiller/cffl_formfield.h
index 8dc2cf7..c7fed85 100644
--- a/fpdfsdk/formfiller/cffl_formfield.h
+++ b/fpdfsdk/formfiller/cffl_formfield.h
@@ -10,17 +10,17 @@
#include <map>
#include <memory>
+#include "core/fpdfdoc/cpdf_aaction.h"
#include "core/fxcrt/cfx_timer.h"
#include "core/fxcrt/mask.h"
#include "core/fxcrt/unowned_ptr.h"
-#include "fpdfsdk/cpdfsdk_widget.h"
#include "fpdfsdk/formfiller/cffl_fieldaction.h"
#include "fpdfsdk/formfiller/cffl_interactiveformfiller.h"
#include "fpdfsdk/pwl/cpwl_wnd.h"
#include "fpdfsdk/pwl/ipwl_systemhandler.h"
-class CPDFSDK_Annot;
class CPDFSDK_PageView;
+class CPDFSDK_Widget;
class CFFL_FormField : public CPWL_Wnd::ProviderIface,
public CFX_Timer::CallbackIface {
@@ -30,11 +30,11 @@
~CFFL_FormField() override;
virtual void OnDraw(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Widget* pAnnot,
CFX_RenderDevice* pDevice,
const CFX_Matrix& mtUser2Device);
virtual void OnDrawDeactive(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Widget* pAnnot,
CFX_RenderDevice* pDevice,
const CFX_Matrix& mtUser2Device);
@@ -42,11 +42,11 @@
virtual void OnMouseExit(CPDFSDK_PageView* pPageView);
virtual bool OnLButtonDown(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Widget* pAnnot,
Mask<FWL_EVENTFLAG> nFlags,
const CFX_PointF& point);
virtual bool OnLButtonUp(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Widget* pAnnot,
Mask<FWL_EVENTFLAG> nFlags,
const CFX_PointF& point);
virtual bool OnLButtonDblClk(CPDFSDK_PageView* pPageView,
@@ -67,7 +67,7 @@
const CFX_PointF& point);
virtual bool OnKeyDown(FWL_VKEYCODE nKeyCode, Mask<FWL_EVENTFLAG> nFlags);
- virtual bool OnChar(CPDFSDK_Annot* pAnnot,
+ virtual bool OnChar(CPDFSDK_Widget* pAnnot,
uint32_t nChar,
Mask<FWL_EVENTFLAG> nFlags);
virtual bool SetIndexSelected(int index, bool selected);
@@ -85,7 +85,7 @@
bool Undo();
bool Redo();
- void SetFocusForAnnot(CPDFSDK_Annot* pAnnot, Mask<FWL_EVENTFLAG> nFlag);
+ void SetFocusForAnnot(CPDFSDK_Widget* pAnnot, Mask<FWL_EVENTFLAG> nFlag);
void KillFocusForAnnot(Mask<FWL_EVENTFLAG> nFlag);
// CFX_Timer::CallbackIface:
@@ -135,7 +135,7 @@
CPDFSDK_PageView* GetCurPageView();
void SetChangeMark();
- CPDFSDK_Annot* GetSDKAnnot() const { return m_pWidget.Get(); }
+ CPDFSDK_Widget* GetSDKWidget() const { return m_pWidget.Get(); }
protected:
virtual CPWL_Wnd* ResetPWLWindow(const CPDFSDK_PageView* pPageView);
diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
index d14e60c..78f5255 100644
--- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
@@ -66,7 +66,7 @@
CFFL_FormField* pFormField = GetFormField(pAnnot);
if (pFormField && pFormField->IsValid()) {
- pFormField->OnDraw(pPageView, pAnnot, pDevice, mtUser2Device);
+ pFormField->OnDraw(pPageView, pWidget, pDevice, mtUser2Device);
if (m_pCallbackIface->GetFocusAnnot() != pAnnot)
return;
@@ -80,7 +80,7 @@
}
if (pFormField) {
- pFormField->OnDrawDeactive(pPageView, pAnnot, pDevice, mtUser2Device);
+ pFormField->OnDrawDeactive(pPageView, pWidget, pDevice, mtUser2Device);
} else {
pWidget->DrawAppearance(pDevice, mtUser2Device,
CPDF_Annot::AppearanceMode::kNormal, nullptr);
@@ -201,7 +201,8 @@
}
CFFL_FormField* pFormField = GetFormField(pAnnot->Get());
return pFormField &&
- pFormField->OnLButtonDown(pPageView, pAnnot->Get(), nFlags, point);
+ pFormField->OnLButtonDown(pPageView, ToCPDFSDKWidget(pAnnot->Get()),
+ nFlags, point);
}
bool CFFL_InteractiveFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView,
@@ -231,7 +232,8 @@
CFFL_FormField* pFormField = GetFormField(pAnnot->Get());
bool bRet = pFormField &&
- pFormField->OnLButtonUp(pPageView, pAnnot->Get(), nFlags, point);
+ pFormField->OnLButtonUp(pPageView, ToCPDFSDKWidget(pAnnot->Get()),
+ nFlags, point);
if (m_pCallbackIface->GetFocusAnnot() != pAnnot->Get())
return bRet;
if (OnButtonUp(pAnnot, pPageView, nFlags) || !pAnnot)
@@ -369,7 +371,8 @@
return true;
CFFL_FormField* pFormField = GetFormField(pAnnot);
- return pFormField && pFormField->OnChar(pAnnot, nChar, nFlags);
+ return pFormField &&
+ pFormField->OnChar(ToCPDFSDKWidget(pAnnot), nChar, nFlags);
}
bool CFFL_InteractiveFormFiller::OnSetFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot,
@@ -413,7 +416,7 @@
}
if (CFFL_FormField* pFormField = GetOrCreateFormField(pAnnot->Get()))
- pFormField->SetFocusForAnnot(pAnnot->Get(), nFlag);
+ pFormField->SetFocusForAnnot(ToCPDFSDKWidget(pAnnot->Get()), nFlag);
return true;
}
diff --git a/fpdfsdk/formfiller/cffl_listbox.cpp b/fpdfsdk/formfiller/cffl_listbox.cpp
index 6a1bc5a..42314af 100644
--- a/fpdfsdk/formfiller/cffl_listbox.cpp
+++ b/fpdfsdk/formfiller/cffl_listbox.cpp
@@ -77,10 +77,10 @@
return std::move(pWnd);
}
-bool CFFL_ListBox::OnChar(CPDFSDK_Annot* pAnnot,
+bool CFFL_ListBox::OnChar(CPDFSDK_Widget* pWidget,
uint32_t nChar,
Mask<FWL_EVENTFLAG> nFlags) {
- return CFFL_TextObject::OnChar(pAnnot, nChar, nFlags);
+ return CFFL_TextObject::OnChar(pWidget, nChar, nFlags);
}
bool CFFL_ListBox::IsDataChanged(const CPDFSDK_PageView* pPageView) {
diff --git a/fpdfsdk/formfiller/cffl_listbox.h b/fpdfsdk/formfiller/cffl_listbox.h
index b3bf02b..bad4deb 100644
--- a/fpdfsdk/formfiller/cffl_listbox.h
+++ b/fpdfsdk/formfiller/cffl_listbox.h
@@ -27,7 +27,7 @@
const CPWL_Wnd::CreateParams& cp,
std::unique_ptr<IPWL_SystemHandler::PerWindowData> pAttachedData)
override;
- bool OnChar(CPDFSDK_Annot* pAnnot,
+ bool OnChar(CPDFSDK_Widget* pWidget,
uint32_t nChar,
Mask<FWL_EVENTFLAG> nFlags) override;
bool IsDataChanged(const CPDFSDK_PageView* pPageView) override;
diff --git a/fpdfsdk/formfiller/cffl_radiobutton.cpp b/fpdfsdk/formfiller/cffl_radiobutton.cpp
index 39b28fd..54a5d50 100644
--- a/fpdfsdk/formfiller/cffl_radiobutton.cpp
+++ b/fpdfsdk/formfiller/cffl_radiobutton.cpp
@@ -42,13 +42,13 @@
}
}
-bool CFFL_RadioButton::OnChar(CPDFSDK_Annot* pAnnot,
+bool CFFL_RadioButton::OnChar(CPDFSDK_Widget* pWidget,
uint32_t nChar,
Mask<FWL_EVENTFLAG> nFlags) {
switch (nChar) {
case pdfium::ascii::kReturn:
case pdfium::ascii::kSpace: {
- CPDFSDK_PageView* pPageView = pAnnot->GetPageView();
+ CPDFSDK_PageView* pPageView = pWidget->GetPageView();
DCHECK(pPageView);
ObservedPtr<CPDFSDK_Annot> pObserved(m_pWidget.Get());
@@ -57,22 +57,22 @@
return true;
}
- CFFL_FormField::OnChar(pAnnot, nChar, nFlags);
+ CFFL_FormField::OnChar(pWidget, nChar, nFlags);
CPWL_RadioButton* pWnd = CreateOrUpdatePWLRadioButton(pPageView);
if (pWnd && !pWnd->IsReadOnly())
pWnd->SetCheck(true);
return CommitData(pPageView, nFlags);
}
default:
- return CFFL_FormField::OnChar(pAnnot, nChar, nFlags);
+ return CFFL_FormField::OnChar(pWidget, nChar, nFlags);
}
}
bool CFFL_RadioButton::OnLButtonUp(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Widget* pWidget,
Mask<FWL_EVENTFLAG> nFlags,
const CFX_PointF& point) {
- CFFL_Button::OnLButtonUp(pPageView, pAnnot, nFlags, point);
+ CFFL_Button::OnLButtonUp(pPageView, pWidget, nFlags, point);
if (!IsValid())
return true;
diff --git a/fpdfsdk/formfiller/cffl_radiobutton.h b/fpdfsdk/formfiller/cffl_radiobutton.h
index ce28ce2..12bc040 100644
--- a/fpdfsdk/formfiller/cffl_radiobutton.h
+++ b/fpdfsdk/formfiller/cffl_radiobutton.h
@@ -25,11 +25,11 @@
std::unique_ptr<IPWL_SystemHandler::PerWindowData> pAttachedData)
override;
bool OnKeyDown(FWL_VKEYCODE nKeyCode, Mask<FWL_EVENTFLAG> nFlags) override;
- bool OnChar(CPDFSDK_Annot* pAnnot,
+ bool OnChar(CPDFSDK_Widget* pWidget,
uint32_t nChar,
Mask<FWL_EVENTFLAG> nFlags) override;
bool OnLButtonUp(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Widget* pWidget,
Mask<FWL_EVENTFLAG> nFlags,
const CFX_PointF& point) override;
bool IsDataChanged(const CPDFSDK_PageView* pPageView) override;
diff --git a/fpdfsdk/formfiller/cffl_textfield.cpp b/fpdfsdk/formfiller/cffl_textfield.cpp
index 0c4dbf7..e1ff031 100644
--- a/fpdfsdk/formfiller/cffl_textfield.cpp
+++ b/fpdfsdk/formfiller/cffl_textfield.cpp
@@ -105,7 +105,7 @@
return std::move(pWnd);
}
-bool CFFL_TextField::OnChar(CPDFSDK_Annot* pAnnot,
+bool CFFL_TextField::OnChar(CPDFSDK_Widget* pWidget,
uint32_t nChar,
Mask<FWL_EVENTFLAG> nFlags) {
switch (nChar) {
@@ -117,7 +117,7 @@
DCHECK(pPageView);
m_bValid = !m_bValid;
m_pFormFiller->GetCallbackIface()->Invalidate(
- pAnnot->GetPage(), pAnnot->GetRect().GetOuterRect());
+ pWidget->GetPage(), pWidget->GetRect().GetOuterRect());
if (m_bValid) {
if (CPWL_Wnd* pWnd = CreateOrUpdatePWLWindow(pPageView))
pWnd->SetFocus();
@@ -138,7 +138,7 @@
}
}
- return CFFL_TextObject::OnChar(pAnnot, nChar, nFlags);
+ return CFFL_TextObject::OnChar(pWidget, nChar, nFlags);
}
bool CFFL_TextField::IsDataChanged(const CPDFSDK_PageView* pPageView) {
diff --git a/fpdfsdk/formfiller/cffl_textfield.h b/fpdfsdk/formfiller/cffl_textfield.h
index d1897fe..ace7256 100644
--- a/fpdfsdk/formfiller/cffl_textfield.h
+++ b/fpdfsdk/formfiller/cffl_textfield.h
@@ -32,7 +32,7 @@
const CPWL_Wnd::CreateParams& cp,
std::unique_ptr<IPWL_SystemHandler::PerWindowData> pAttachedData)
override;
- bool OnChar(CPDFSDK_Annot* pAnnot,
+ bool OnChar(CPDFSDK_Widget* pWidget,
uint32_t nChar,
Mask<FWL_EVENTFLAG> nFlags) override;
bool IsDataChanged(const CPDFSDK_PageView* pPageView) override;
diff --git a/fpdfsdk/formfiller/cffl_textobject.cpp b/fpdfsdk/formfiller/cffl_textobject.cpp
index d5c94e7..b056a4c 100644
--- a/fpdfsdk/formfiller/cffl_textobject.cpp
+++ b/fpdfsdk/formfiller/cffl_textobject.cpp
@@ -8,6 +8,7 @@
#include "core/fpdfapi/page/cpdf_page.h"
#include "core/fpdfdoc/cpdf_bafontmap.h"
+#include "fpdfsdk/cpdfsdk_widget.h"
CFFL_TextObject::CFFL_TextObject(CFFL_InteractiveFormFiller* pFormFiller,
CPDFSDK_Widget* pWidget)
diff --git a/fpdfsdk/pwl/cpwl_combo_box_embeddertest.cpp b/fpdfsdk/pwl/cpwl_combo_box_embeddertest.cpp
index d2b2221..ae60a4d 100644
--- a/fpdfsdk/pwl/cpwl_combo_box_embeddertest.cpp
+++ b/fpdfsdk/pwl/cpwl_combo_box_embeddertest.cpp
@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "fpdfsdk/cpdfsdk_annot.h"
#include "fpdfsdk/cpdfsdk_annotiterator.h"
#include "fpdfsdk/cpdfsdk_formfillenvironment.h"
#include "fpdfsdk/cpdfsdk_helpers.h"
+#include "fpdfsdk/cpdfsdk_widget.h"
#include "fpdfsdk/formfiller/cffl_formfield.h"
#include "fpdfsdk/formfiller/cffl_interactiveformfiller.h"
#include "fpdfsdk/pwl/cpwl_combo_box.h"
@@ -37,14 +37,12 @@
{CPDF_Annot::Subtype::WIDGET});
// User editable combobox.
- m_pAnnotEditable = iter.GetFirstAnnot();
+ m_pAnnotEditable = ToCPDFSDKWidget(iter.GetFirstAnnot());
ASSERT_TRUE(m_pAnnotEditable);
- ASSERT_EQ(CPDF_Annot::Subtype::WIDGET, m_pAnnotEditable->GetAnnotSubtype());
// Normal combobox with pre-selected value.
- m_pAnnotNormal = iter.GetNextAnnot(m_pAnnotEditable);
+ m_pAnnotNormal = ToCPDFSDKWidget(iter.GetNextAnnot(m_pAnnotEditable));
ASSERT_TRUE(m_pAnnotNormal);
- ASSERT_EQ(CPDF_Annot::Subtype::WIDGET, m_pAnnotNormal->GetAnnotSubtype());
// Read-only combobox.
CPDFSDK_Annot* pAnnotReadOnly = iter.GetNextAnnot(m_pAnnotNormal);
@@ -81,8 +79,8 @@
FPDF_PAGE GetPage() const { return m_page; }
CPWL_ComboBox* GetCPWLComboBox() const { return m_pComboBox; }
CFFL_FormField* GetCFFLFormFiller() const { return m_pFormFiller; }
- CPDFSDK_Annot* GetCPDFSDKAnnotNormal() const { return m_pAnnotNormal; }
- CPDFSDK_Annot* GetCPDFSDKAnnotUserEditable() const {
+ CPDFSDK_Widget* GetCPDFSDKAnnotNormal() const { return m_pAnnotNormal; }
+ CPDFSDK_Widget* GetCPDFSDKAnnotUserEditable() const {
return m_pAnnotEditable;
}
CPDFSDK_FormFillEnvironment* GetCPDFSDKFormFillEnv() const {
@@ -93,8 +91,8 @@
FPDF_PAGE m_page;
CPWL_ComboBox* m_pComboBox;
CFFL_FormField* m_pFormFiller;
- CPDFSDK_Annot* m_pAnnotNormal;
- CPDFSDK_Annot* m_pAnnotEditable;
+ CPDFSDK_Widget* m_pAnnotNormal;
+ CPDFSDK_Widget* m_pAnnotEditable;
CPDFSDK_FormFillEnvironment* m_pFormFillEnv;
};
diff --git a/fpdfsdk/pwl/cpwl_edit_embeddertest.cpp b/fpdfsdk/pwl/cpwl_edit_embeddertest.cpp
index f1f1051..739b440 100644
--- a/fpdfsdk/pwl/cpwl_edit_embeddertest.cpp
+++ b/fpdfsdk/pwl/cpwl_edit_embeddertest.cpp
@@ -4,10 +4,10 @@
#include "fpdfsdk/pwl/cpwl_edit.h"
-#include "fpdfsdk/cpdfsdk_annot.h"
#include "fpdfsdk/cpdfsdk_annotiterator.h"
#include "fpdfsdk/cpdfsdk_formfillenvironment.h"
#include "fpdfsdk/cpdfsdk_helpers.h"
+#include "fpdfsdk/cpdfsdk_widget.h"
#include "fpdfsdk/formfiller/cffl_formfield.h"
#include "fpdfsdk/formfiller/cffl_interactiveformfiller.h"
#include "public/fpdf_fwlevent.h"
@@ -36,18 +36,15 @@
CPDFSDK_AnnotIterator iter(m_pFormFillEnv->GetPageViewAtIndex(0),
{CPDF_Annot::Subtype::WIDGET});
// Normal text field.
- m_pAnnot = iter.GetFirstAnnot();
+ m_pAnnot = ToCPDFSDKWidget(iter.GetFirstAnnot());
ASSERT_TRUE(m_pAnnot);
- ASSERT_EQ(CPDF_Annot::Subtype::WIDGET, m_pAnnot->GetAnnotSubtype());
// Read-only text field.
CPDFSDK_Annot* pAnnotReadOnly = iter.GetNextAnnot(m_pAnnot);
// Pre-filled text field with char limit of 10.
- m_pAnnotCharLimit = iter.GetNextAnnot(pAnnotReadOnly);
+ m_pAnnotCharLimit = ToCPDFSDKWidget(iter.GetNextAnnot(pAnnotReadOnly));
ASSERT_TRUE(m_pAnnotCharLimit);
- ASSERT_EQ(CPDF_Annot::Subtype::WIDGET,
- m_pAnnotCharLimit->GetAnnotSubtype());
// Password text field.
CPDFSDK_Annot* password_annot = iter.GetNextAnnot(m_pAnnotCharLimit);
@@ -86,15 +83,15 @@
FPDF_PAGE GetPage() { return m_page; }
CPWL_Edit* GetCPWLEdit() { return m_pEdit; }
CFFL_FormField* GetCFFLFormFiller() { return m_pFormFiller; }
- CPDFSDK_Annot* GetCPDFSDKAnnot() { return m_pAnnot; }
- CPDFSDK_Annot* GetCPDFSDKAnnotCharLimit() { return m_pAnnotCharLimit; }
+ CPDFSDK_Widget* GetCPDFSDKAnnot() { return m_pAnnot; }
+ CPDFSDK_Widget* GetCPDFSDKAnnotCharLimit() { return m_pAnnotCharLimit; }
private:
FPDF_PAGE m_page;
CPWL_Edit* m_pEdit;
CFFL_FormField* m_pFormFiller;
- CPDFSDK_Annot* m_pAnnot;
- CPDFSDK_Annot* m_pAnnotCharLimit;
+ CPDFSDK_Widget* m_pAnnot;
+ CPDFSDK_Widget* m_pAnnotCharLimit;
CPDFSDK_FormFillEnvironment* m_pFormFillEnv;
};