7#include "fpdfsdk/formfiller/cffl_checkbox.h"
11#include "constants/ascii.h"
12#include "core/fpdfdoc/cpdf_formcontrol.h"
13#include "fpdfsdk/cpdfsdk_widget.h"
14#include "fpdfsdk/formfiller/cffl_formfield.h"
15#include "fpdfsdk/pwl/cpwl_special_button.h"
16#include "public/fpdf_fwlevent.h"
17#include "third_party/base/check.h"
20 CPDFSDK_Widget* pWidget)
27 std::unique_ptr<IPWL_FillerNotify::PerWindowData> pAttachedData) {
28 auto pWnd =
std::make_unique<CPWL_CheckBox>(cp,
std::move(pAttachedData));
30 pWnd->SetCheck(m_pWidget->IsChecked());
31 return std::move(pWnd);
35 Mask<FWL_EVENTFLAG> nFlags) {
45bool CFFL_CheckBox::
OnChar(CPDFSDK_Widget* pWidget,
47 Mask<FWL_EVENTFLAG> nFlags) {
54 ObservedPtr<CPDFSDK_Widget> pObserved(m_pWidget);
55 if (m_pFormFiller->OnButtonUp(pObserved, pPageView, nFlags)) {
67 CPWL_CheckBox* pWnd = CreateOrUpdatePWLCheckBox(pPageView);
69 ObservedPtr<CPWL_CheckBox> pObservedBox(pWnd);
72 pObservedBox->SetCheck(!is_checked);
83 CPDFSDK_Widget* pWidget,
84 Mask<FWL_EVENTFLAG> nFlags,
85 const CFX_PointF& point) {
90 CPWL_CheckBox* pWnd = CreateOrUpdatePWLCheckBox(pPageView);
92 ObservedPtr<CPWL_CheckBox> pObservedBox(pWnd);
95 pObservedBox->SetCheck(!is_checked);
102 CPWL_CheckBox* pWnd = GetPWLCheckBox(pPageView);
103 return pWnd && pWnd->IsChecked() != m_pWidget->IsChecked();
106void CFFL_CheckBox::
SaveData(
const CPDFSDK_PageView* pPageView) {
107 CPWL_CheckBox* pWnd = GetPWLCheckBox(pPageView);
112 ObservedPtr<CPDFSDK_Widget> observed_widget(m_pWidget);
113 ObservedPtr<CFFL_CheckBox> observed_this(
this);
114 m_pWidget->SetCheck(bNewChecked);
115 if (!observed_widget)
118 m_pWidget->UpdateField();
119 if (!observed_widget || !observed_this)
125CPWL_CheckBox* CFFL_CheckBox::GetPWLCheckBox(
126 const CPDFSDK_PageView* pPageView)
const {
127 return static_cast<CPWL_CheckBox*>(
GetPWLWindow(pPageView));
130CPWL_CheckBox* CFFL_CheckBox::CreateOrUpdatePWLCheckBox(
131 const CPDFSDK_PageView* pPageView) {
~CFFL_CheckBox() override
bool IsDataChanged(const CPDFSDK_PageView *pPageView) override
bool OnKeyDown(FWL_VKEYCODE nKeyCode, Mask< FWL_EVENTFLAG > nFlags) override
std::unique_ptr< CPWL_Wnd > NewPWLWindow(const CPWL_Wnd::CreateParams &cp, std::unique_ptr< IPWL_FillerNotify::PerWindowData > pAttachedData) override
bool OnChar(CPDFSDK_Widget *pWidget, uint32_t nChar, Mask< FWL_EVENTFLAG > nFlags) override
bool OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Widget *pWidget, Mask< FWL_EVENTFLAG > nFlags, const CFX_PointF &point) override
void SaveData(const CPDFSDK_PageView *pPageView) override
CFFL_CheckBox(CFFL_InteractiveFormFiller *pFormFiller, CPDFSDK_Widget *pWidget)
CPDFSDK_PageView * GetPageView() const
constexpr uint8_t kReturn