Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cpdfsdk_widget.cpp
Go to the documentation of this file.
1// Copyright 2016 The PDFium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7#include "fpdfsdk/cpdfsdk_widget.h"
8
9#include "constants/access_permissions.h"
10#include "constants/annotation_common.h"
11#include "constants/appearance.h"
12#include "constants/form_flags.h"
13#include "core/fpdfapi/parser/cpdf_array.h"
14#include "core/fpdfapi/parser/cpdf_dictionary.h"
15#include "core/fpdfapi/parser/cpdf_document.h"
16#include "core/fpdfapi/parser/cpdf_reference.h"
17#include "core/fpdfapi/parser/cpdf_stream.h"
18#include "core/fpdfapi/parser/cpdf_string.h"
19#include "core/fpdfdoc/cpdf_bafontmap.h"
20#include "core/fpdfdoc/cpdf_defaultappearance.h"
21#include "core/fpdfdoc/cpdf_formcontrol.h"
22#include "core/fpdfdoc/cpdf_formfield.h"
23#include "core/fpdfdoc/cpdf_iconfit.h"
24#include "core/fpdfdoc/cpdf_interactiveform.h"
25#include "core/fxge/cfx_fillrenderoptions.h"
26#include "core/fxge/cfx_graphstatedata.h"
27#include "core/fxge/cfx_path.h"
28#include "core/fxge/cfx_renderdevice.h"
29#include "fpdfsdk/cpdfsdk_appstream.h"
30#include "fpdfsdk/cpdfsdk_formfillenvironment.h"
31#include "fpdfsdk/cpdfsdk_interactiveform.h"
32#include "fpdfsdk/cpdfsdk_pageview.h"
33#include "fpdfsdk/formfiller/cffl_fieldaction.h"
34#include "fpdfsdk/pwl/cpwl_edit.h"
35#include "third_party/base/check.h"
36#include "third_party/base/notreached.h"
37
38#ifdef PDF_ENABLE_XFA
39#include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
40#include "xfa/fxfa/cxfa_eventparam.h"
41#include "xfa/fxfa/cxfa_ffdocview.h"
42#include "xfa/fxfa/cxfa_ffwidget.h"
43#include "xfa/fxfa/cxfa_ffwidgethandler.h"
44#include "xfa/fxfa/parser/cxfa_node.h"
45#endif // PDF_ENABLE_XFA
46
47CPDFSDK_Widget::CPDFSDK_Widget(CPDF_Annot* pAnnot,
48 CPDFSDK_PageView* pPageView,
49 CPDFSDK_InteractiveForm* pInteractiveForm)
50 : CPDFSDK_BAAnnot(pAnnot, pPageView),
52
53CPDFSDK_Widget::~CPDFSDK_Widget() {
54 GetInteractiveFormFiller()->OnDelete(this);
55 m_pInteractiveForm->RemoveMap(GetFormControl());
56}
57
58#ifdef PDF_ENABLE_XFA
59CXFA_FFWidget* CPDFSDK_Widget::GetMixXFAWidget() const {
60 CPDF_Document::Extension* pContext =
61 GetPageView()->GetFormFillEnv()->GetDocExtension();
62 if (!pContext || !pContext->ContainsExtensionForegroundForm())
63 return nullptr;
64
65 CXFA_FFDocView* pDocView =
66 static_cast<CPDFXFA_Context*>(pContext)->GetXFADocView();
67 if (!pDocView)
68 return nullptr;
69
70 WideString sName;
71 if (GetFieldType() == FormFieldType::kRadioButton) {
72 sName = GetAnnotName();
73 if (sName.IsEmpty())
74 sName = GetName();
75 } else {
76 sName = GetName();
77 }
78
79 if (sName.IsEmpty())
80 return nullptr;
81
82 return pDocView->GetWidgetByName(sName, nullptr);
83}
84
85CXFA_FFWidget* CPDFSDK_Widget::GetGroupMixXFAWidget() const {
86 CPDF_Document::Extension* pContext =
87 GetPageView()->GetFormFillEnv()->GetDocExtension();
88 if (!pContext || !pContext->ContainsExtensionForegroundForm())
89 return nullptr;
90
91 CXFA_FFDocView* pDocView =
92 static_cast<CPDFXFA_Context*>(pContext)->GetXFADocView();
93 if (!pDocView)
94 return nullptr;
95
96 WideString sName = GetName();
97 return !sName.IsEmpty() ? pDocView->GetWidgetByName(sName, nullptr) : nullptr;
98}
99
100CXFA_FFWidgetHandler* CPDFSDK_Widget::GetXFAWidgetHandler() const {
101 CPDF_Document::Extension* pContext =
102 GetPageView()->GetFormFillEnv()->GetDocExtension();
103 if (!pContext || !pContext->ContainsExtensionForegroundForm())
104 return nullptr;
105
106 CXFA_FFDocView* pDocView =
107 static_cast<CPDFXFA_Context*>(pContext)->GetXFADocView();
108 return pDocView ? pDocView->GetWidgetHandler() : nullptr;
109}
110
111static XFA_EVENTTYPE GetXFAEventType(PDFSDK_XFAAActionType eXFAAAT) {
112 XFA_EVENTTYPE eEventType = XFA_EVENT_Unknown;
113
114 switch (eXFAAAT) {
115 case PDFSDK_XFA_Click:
116 eEventType = XFA_EVENT_Click;
117 break;
118 case PDFSDK_XFA_Full:
119 eEventType = XFA_EVENT_Full;
120 break;
121 case PDFSDK_XFA_PreOpen:
122 eEventType = XFA_EVENT_PreOpen;
123 break;
124 case PDFSDK_XFA_PostOpen:
125 eEventType = XFA_EVENT_PostOpen;
126 break;
127 }
128
129 return eEventType;
130}
131
132static XFA_EVENTTYPE GetXFAEventType(CPDF_AAction::AActionType eAAT,
133 bool bWillCommit) {
134 XFA_EVENTTYPE eEventType = XFA_EVENT_Unknown;
135
136 switch (eAAT) {
137 case CPDF_AAction::kCursorEnter:
138 eEventType = XFA_EVENT_MouseEnter;
139 break;
140 case CPDF_AAction::kCursorExit:
141 eEventType = XFA_EVENT_MouseExit;
142 break;
143 case CPDF_AAction::kButtonDown:
144 eEventType = XFA_EVENT_MouseDown;
145 break;
146 case CPDF_AAction::kButtonUp:
147 eEventType = XFA_EVENT_MouseUp;
148 break;
149 case CPDF_AAction::kGetFocus:
150 eEventType = XFA_EVENT_Enter;
151 break;
152 case CPDF_AAction::kLoseFocus:
153 eEventType = XFA_EVENT_Exit;
154 break;
155 case CPDF_AAction::kPageOpen:
156 case CPDF_AAction::kPageClose:
157 case CPDF_AAction::kPageVisible:
158 case CPDF_AAction::kPageInvisible:
159 break;
160 case CPDF_AAction::kKeyStroke:
161 if (!bWillCommit)
162 eEventType = XFA_EVENT_Change;
163 break;
164 case CPDF_AAction::kValidate:
165 eEventType = XFA_EVENT_Validate;
166 break;
167 case CPDF_AAction::kOpenPage:
168 case CPDF_AAction::kClosePage:
169 case CPDF_AAction::kFormat:
170 case CPDF_AAction::kCalculate:
171 case CPDF_AAction::kCloseDocument:
172 case CPDF_AAction::kSaveDocument:
173 case CPDF_AAction::kDocumentSaved:
174 case CPDF_AAction::kPrintDocument:
175 case CPDF_AAction::kDocumentPrinted:
176 break;
177 case CPDF_AAction::kDocumentOpen:
178 case CPDF_AAction::kNumberOfActions:
179 NOTREACHED_NORETURN();
180 }
181
182 return eEventType;
183}
184
185bool CPDFSDK_Widget::HasXFAAAction(PDFSDK_XFAAActionType eXFAAAT) const {
186 CXFA_FFWidget* pWidget = GetMixXFAWidget();
187 if (!pWidget)
188 return false;
189
190 CXFA_FFWidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler();
191 if (!pXFAWidgetHandler)
192 return false;
193
194 XFA_EVENTTYPE eEventType = GetXFAEventType(eXFAAAT);
195 if ((eEventType == XFA_EVENT_Click || eEventType == XFA_EVENT_Change) &&
196 GetFieldType() == FormFieldType::kRadioButton) {
197 CXFA_FFWidget* hGroupWidget = GetGroupMixXFAWidget();
198 if (hGroupWidget &&
199 hGroupWidget->HasEventUnderHandler(eEventType, pXFAWidgetHandler)) {
200 return true;
201 }
202 }
203
204 return pWidget->HasEventUnderHandler(eEventType, pXFAWidgetHandler);
205}
206
207bool CPDFSDK_Widget::OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT,
208 CFFL_FieldAction* data,
209 const CPDFSDK_PageView* pPageView) {
210 auto* pContext = static_cast<CPDFXFA_Context*>(
211 GetPageView()->GetFormFillEnv()->GetDocExtension());
212 if (!pContext)
213 return false;
214
215 CXFA_FFWidget* pWidget = GetMixXFAWidget();
216 if (!pWidget)
217 return false;
218
219 XFA_EVENTTYPE eEventType = GetXFAEventType(eXFAAAT);
220 if (eEventType == XFA_EVENT_Unknown)
221 return false;
222
223 CXFA_FFWidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler();
224 if (!pXFAWidgetHandler)
225 return false;
226
227 CXFA_EventParam param(eEventType);
228 param.m_wsChange = data->sChange;
229 param.m_iCommitKey = 0;
230 param.m_bShift = data->bShift;
231 param.m_iSelStart = data->nSelStart;
232 param.m_iSelEnd = data->nSelEnd;
233 param.m_wsFullText = data->sValue;
234 param.m_bKeyDown = data->bKeyDown;
235 param.m_bModifier = data->bModifier;
236 param.m_wsPrevText = data->sValue;
237 if ((eEventType == XFA_EVENT_Click || eEventType == XFA_EVENT_Change) &&
238 GetFieldType() == FormFieldType::kRadioButton) {
239 CXFA_FFWidget* hGroupWidget = GetGroupMixXFAWidget();
240 if (hGroupWidget &&
241 !hGroupWidget->ProcessEventUnderHandler(&param, pXFAWidgetHandler)) {
242 return false;
243 }
244 }
245
246 bool ret = pWidget->ProcessEventUnderHandler(&param, pXFAWidgetHandler);
247 CXFA_FFDocView* pDocView = pContext->GetXFADocView();
248 if (pDocView)
249 pDocView->UpdateDocView();
250
251 return ret;
252}
253
254void CPDFSDK_Widget::Synchronize(bool bSynchronizeElse) {
255 CXFA_FFWidget* hWidget = GetMixXFAWidget();
256 if (!hWidget)
257 return;
258
259 CXFA_Node* node = hWidget->GetNode();
260 if (!node->IsWidgetReady())
261 return;
262
263 CPDF_FormField* pFormField = GetFormField();
264 switch (GetFieldType()) {
265 case FormFieldType::kCheckBox:
266 case FormFieldType::kRadioButton: {
267 CPDF_FormControl* pFormCtrl = GetFormControl();
268 XFA_CheckState eCheckState =
269 pFormCtrl->IsChecked() ? XFA_CheckState::kOn : XFA_CheckState::kOff;
270 node->SetCheckState(eCheckState);
271 break;
272 }
273 case FormFieldType::kTextField:
274 node->SetValue(XFA_ValuePicture::kEdit, pFormField->GetValue());
275 break;
276 case FormFieldType::kComboBox:
277 case FormFieldType::kListBox: {
278 node->ClearAllSelections();
279 for (int i = 0; i < pFormField->CountSelectedItems(); ++i) {
280 int nIndex = pFormField->GetSelectedIndex(i);
281 if (nIndex > -1 &&
282 static_cast<size_t>(nIndex) < node->CountChoiceListItems(false)) {
283 node->SetItemState(nIndex, true, false, false);
284 }
285 }
286 if (GetFieldType() == FormFieldType::kComboBox)
287 node->SetValue(XFA_ValuePicture::kEdit, pFormField->GetValue());
288 break;
289 }
290 default:
291 break;
292 }
293
294 if (bSynchronizeElse) {
295 auto* context = static_cast<CPDFXFA_Context*>(
296 GetPageView()->GetFormFillEnv()->GetDocExtension());
297 context->GetXFADocView()->ProcessValueChanged(node);
298 }
299}
300
301bool CPDFSDK_Widget::HandleXFAAAction(
302 CPDF_AAction::AActionType type,
303 CFFL_FieldAction* data,
304 CPDFSDK_FormFillEnvironment* pFormFillEnv) {
305 auto* pContext =
306 static_cast<CPDFXFA_Context*>(pFormFillEnv->GetDocExtension());
307 if (!pContext)
308 return false;
309
310 CXFA_FFWidget* hWidget = GetMixXFAWidget();
311 if (!hWidget)
312 return false;
313
314 XFA_EVENTTYPE eEventType = GetXFAEventType(type, data->bWillCommit);
315 if (eEventType == XFA_EVENT_Unknown)
316 return false;
317
318 CXFA_FFWidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler();
319 if (!pXFAWidgetHandler)
320 return false;
321
322 CXFA_EventParam param(eEventType);
323 param.m_wsChange = data->sChange;
324 param.m_iCommitKey = 0;
325 param.m_bShift = data->bShift;
326 param.m_iSelStart = data->nSelStart;
327 param.m_iSelEnd = data->nSelEnd;
328 param.m_wsFullText = data->sValue;
329 param.m_bKeyDown = data->bKeyDown;
330 param.m_bModifier = data->bModifier;
331 param.m_wsPrevText = data->sValue;
332 bool ret = hWidget->ProcessEventUnderHandler(&param, pXFAWidgetHandler);
333 CXFA_FFDocView* pDocView = pContext->GetXFADocView();
334 if (pDocView)
335 pDocView->UpdateDocView();
336
337 return ret;
338}
339#endif // PDF_ENABLE_XFA
340
341bool CPDFSDK_Widget::IsWidgetAppearanceValid(
342 CPDF_Annot::AppearanceMode mode) const {
343 RetainPtr<const CPDF_Dictionary> pAP =
344 GetAnnotDict()->GetDictFor(pdfium::annotation::kAP);
345 if (!pAP)
346 return false;
347
348 // Choose the right sub-ap
349 const char* ap_entry = "N";
351 ap_entry = "D";
353 ap_entry = "R";
354 if (!pAP->KeyExist(ap_entry))
355 ap_entry = "N";
356
357 // Get the AP stream or subdirectory
358 RetainPtr<const CPDF_Object> pSub = pAP->GetDirectObjectFor(ap_entry);
359 if (!pSub)
360 return false;
361
362 FormFieldType fieldType = GetFieldType();
363 switch (fieldType) {
369 return pSub->IsStream();
372 if (const CPDF_Dictionary* pSubDict = pSub->AsDictionary()) {
373 return !!pSubDict->GetStreamFor(GetAppState());
374 }
375 return false;
376 default:
377 return true;
378 }
379}
380
384
385FormFieldType CPDFSDK_Widget::GetFieldType() const {
387 return pField ? pField->GetFieldType() : FormFieldType::kUnknown;
388}
389
390void CPDFSDK_Widget::SetRect(const CFX_FloatRect& rect) {
391 DCHECK(rect.right - rect.left >= 1.0f);
392 DCHECK(rect.top - rect.bottom >= 1.0f);
393 GetMutableAnnotDict()->SetRectFor(pdfium::annotation::kRect, rect);
394}
395
396bool CPDFSDK_Widget::IsAppearanceValid() {
397#ifdef PDF_ENABLE_XFA
398 CPDF_Document::Extension* pContext =
399 GetPageView()->GetFormFillEnv()->GetDocExtension();
400 if (pContext && pContext->ContainsExtensionFullForm())
401 return true;
402#endif // PDF_ENABLE_XFA
404}
405
406int CPDFSDK_Widget::GetLayoutOrder() const {
407 return 2;
408}
409
410int CPDFSDK_Widget::GetFieldFlags() const {
412}
413
414bool CPDFSDK_Widget::IsSignatureWidget() const {
416}
417
418CPDF_FormField* CPDFSDK_Widget::GetFormField() const {
420 return pControl ? pControl->GetField() : nullptr;
421}
422
423CPDF_FormControl* CPDFSDK_Widget::GetFormControl() const {
424 CPDF_InteractiveForm* pPDFInteractiveForm =
425 m_pInteractiveForm->GetInteractiveForm();
426 return pPDFInteractiveForm->GetControlByDict(GetAnnotDict());
427}
428
429int CPDFSDK_Widget::GetRotate() const {
431 return pCtrl->GetRotation() % 360;
432}
433
434#ifdef PDF_ENABLE_XFA
435WideString CPDFSDK_Widget::GetName() const {
436 return GetFormField()->GetFullName();
437}
438#endif // PDF_ENABLE_XFA
439
440absl::optional<FX_COLORREF> CPDFSDK_Widget::GetFillColor() const {
441 CFX_Color::TypeAndARGB type_argb_pair =
443
444 if (type_argb_pair.color_type == CFX_Color::Type::kTransparent)
445 return absl::nullopt;
446
447 return ArgbToColorRef(type_argb_pair.argb);
448}
449
450absl::optional<FX_COLORREF> CPDFSDK_Widget::GetBorderColor() const {
451 CFX_Color::TypeAndARGB type_argb_pair =
453 if (type_argb_pair.color_type == CFX_Color::Type::kTransparent)
454 return absl::nullopt;
455
456 return ArgbToColorRef(type_argb_pair.argb);
457}
458
459absl::optional<FX_COLORREF> CPDFSDK_Widget::GetTextColor() const {
461 absl::optional<CFX_Color::TypeAndARGB> maybe_type_argb_pair =
462 da.GetColorARGB();
463
464 if (!maybe_type_argb_pair.has_value())
465 return absl::nullopt;
466
467 if (maybe_type_argb_pair.value().color_type == CFX_Color::Type::kTransparent)
468 return absl::nullopt;
469
470 return ArgbToColorRef(maybe_type_argb_pair.value().argb);
471}
472
473float CPDFSDK_Widget::GetFontSize() const {
476 float fFontSize;
477 pDa.GetFont(&fFontSize);
478 return fFontSize;
479}
480
481int CPDFSDK_Widget::GetSelectedIndex(int nIndex) const {
482#ifdef PDF_ENABLE_XFA
483 if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) {
484 CXFA_Node* node = hWidget->GetNode();
485 if (node->IsWidgetReady()) {
486 if (nIndex < node->CountSelectedItems())
487 return node->GetSelectedItem(nIndex);
488 }
489 }
490#endif // PDF_ENABLE_XFA
491 CPDF_FormField* pFormField = GetFormField();
492 return pFormField->GetSelectedIndex(nIndex);
493}
494
495WideString CPDFSDK_Widget::GetValue() const {
496#ifdef PDF_ENABLE_XFA
497 if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) {
498 CXFA_Node* node = hWidget->GetNode();
499 if (node->IsWidgetReady())
500 return node->GetValue(XFA_ValuePicture::kDisplay);
501 }
502#endif // PDF_ENABLE_XFA
503 CPDF_FormField* pFormField = GetFormField();
504 return pFormField->GetValue();
505}
506
507WideString CPDFSDK_Widget::GetExportValue() const {
509 return pFormCtrl->GetExportValue();
510}
511
512WideString CPDFSDK_Widget::GetOptionLabel(int nIndex) const {
513 CPDF_FormField* pFormField = GetFormField();
514 return pFormField->GetOptionLabel(nIndex);
515}
516
517WideString CPDFSDK_Widget::GetSelectExportText(int nIndex) const {
518 if (nIndex < 0)
519 return WideString();
520
521 CPDF_FormField* pFormField = GetFormField();
522 if (!pFormField)
523 return WideString();
524
525 WideString swRet = pFormField->GetOptionValue(nIndex);
526 if (!swRet.IsEmpty())
527 return swRet;
528
529 return pFormField->GetOptionLabel(nIndex);
530}
531
532int CPDFSDK_Widget::CountOptions() const {
533 CPDF_FormField* pFormField = GetFormField();
534 return pFormField->CountOptions();
535}
536
537bool CPDFSDK_Widget::IsOptionSelected(int nIndex) const {
538#ifdef PDF_ENABLE_XFA
539 if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) {
540 CXFA_Node* node = hWidget->GetNode();
541 if (node->IsWidgetReady()) {
542 if (nIndex > -1 &&
543 static_cast<size_t>(nIndex) < node->CountChoiceListItems(false)) {
544 return node->GetItemState(nIndex);
545 }
546 return false;
547 }
548 }
549#endif // PDF_ENABLE_XFA
550 CPDF_FormField* pFormField = GetFormField();
551 return pFormField->IsItemSelected(nIndex);
552}
553
554int CPDFSDK_Widget::GetTopVisibleIndex() const {
555 CPDF_FormField* pFormField = GetFormField();
556 return pFormField->GetTopVisibleIndex();
557}
558
559bool CPDFSDK_Widget::IsChecked() const {
560#ifdef PDF_ENABLE_XFA
561 if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) {
562 CXFA_Node* node = hWidget->GetNode();
563 if (node->IsWidgetReady())
564 return node->GetCheckState() == XFA_CheckState::kOn;
565 }
566#endif // PDF_ENABLE_XFA
568 return pFormCtrl->IsChecked();
569}
570
571int CPDFSDK_Widget::GetAlignment() const {
573 return pFormCtrl->GetControlAlignment();
574}
575
576int CPDFSDK_Widget::GetMaxLen() const {
577 CPDF_FormField* pFormField = GetFormField();
578 return pFormField->GetMaxLen();
579}
580
581void CPDFSDK_Widget::SetCheck(bool bChecked) {
583 CPDF_FormField* pFormField = pFormCtrl->GetField();
584 pFormField->CheckControl(pFormField->GetControlIndex(pFormCtrl), bChecked,
586#ifdef PDF_ENABLE_XFA
587 if (!IsWidgetAppearanceValid(CPDF_Annot::AppearanceMode::kNormal))
588 ResetXFAAppearance(CPDFSDK_Widget::kValueChanged);
589 Synchronize(true);
590#endif // PDF_ENABLE_XFA
591}
592
593void CPDFSDK_Widget::SetValue(const WideString& sValue) {
594 CPDF_FormField* pFormField = GetFormField();
596#ifdef PDF_ENABLE_XFA
597 Synchronize(true);
598#endif // PDF_ENABLE_XFA
599}
600
601void CPDFSDK_Widget::SetOptionSelection(int index) {
602 CPDF_FormField* pFormField = GetFormField();
604#ifdef PDF_ENABLE_XFA
605 Synchronize(true);
606#endif // PDF_ENABLE_XFA
607}
608
609void CPDFSDK_Widget::ClearSelection() {
610 CPDF_FormField* pFormField = GetFormField();
612#ifdef PDF_ENABLE_XFA
613 Synchronize(true);
614#endif // PDF_ENABLE_XFA
615}
616
617void CPDFSDK_Widget::SetTopVisibleIndex(int index) {}
618
619void CPDFSDK_Widget::SetAppModified() {
620 m_bAppModified = true;
621}
622
623void CPDFSDK_Widget::ClearAppModified() {
624 m_bAppModified = false;
625}
626
627bool CPDFSDK_Widget::IsAppModified() const {
628 return m_bAppModified;
629}
630
631#ifdef PDF_ENABLE_XFA
632void CPDFSDK_Widget::ResetXFAAppearance(ValueChanged bValueChanged) {
633 switch (GetFieldType()) {
634 case FormFieldType::kTextField:
635 case FormFieldType::kComboBox: {
636 ResetAppearance(OnFormat(), kValueChanged);
637 break;
638 }
639 default:
640 ResetAppearance(absl::nullopt, kValueUnchanged);
641 break;
642 }
643}
644#endif // PDF_ENABLE_XFA
645
646void CPDFSDK_Widget::ResetAppearance(absl::optional<WideString> sValue,
647 ValueChanged bValueChanged) {
648 SetAppModified();
649
650 m_nAppearanceAge++;
651 if (bValueChanged == kValueChanged)
652 m_nValueAge++;
653
654 CPDFSDK_AppStream appStream(this, GetAPDict().Get());
655 switch (GetFieldType()) {
656 case FormFieldType::kPushButton:
657 appStream.SetAsPushButton();
658 break;
659 case FormFieldType::kCheckBox:
660 appStream.SetAsCheckBox();
661 break;
662 case FormFieldType::kRadioButton:
663 appStream.SetAsRadioButton();
664 break;
665 case FormFieldType::kComboBox:
666 appStream.SetAsComboBox(sValue);
667 break;
668 case FormFieldType::kListBox:
669 appStream.SetAsListBox();
670 break;
671 case FormFieldType::kTextField:
672 appStream.SetAsTextField(sValue);
673 break;
674 default:
675 break;
676 }
677
678 ClearCachedAnnotAP();
679}
680
681absl::optional<WideString> CPDFSDK_Widget::OnFormat() {
682 CPDF_FormField* pFormField = GetFormField();
683 DCHECK(pFormField);
684 return m_pInteractiveForm->OnFormat(pFormField);
685}
686
687void CPDFSDK_Widget::ResetFieldAppearance() {
688 CPDF_FormField* pFormField = GetFormField();
689 DCHECK(pFormField);
690 m_pInteractiveForm->ResetFieldAppearance(pFormField, absl::nullopt);
691}
692
693void CPDFSDK_Widget::OnDraw(CFX_RenderDevice* pDevice,
694 const CFX_Matrix& mtUser2Device,
695 bool bDrawAnnots) {
698 return;
699 }
700
701 GetInteractiveFormFiller()->OnDraw(GetPageView(), this, pDevice,
702 mtUser2Device);
703}
704
705bool CPDFSDK_Widget::DoHitTest(const CFX_PointF& point) {
707 return false;
708
710 return false;
711
712 bool do_hit_test = GetFieldType() == FormFieldType::kPushButton;
713 if (!do_hit_test) {
714 uint32_t perms = GetPDFPage()->GetDocument()->GetUserPermissions(
715 /*get_owner_perms=*/true);
716 do_hit_test = (perms & pdfium::access_permissions::kFillForm) ||
718 }
719 return do_hit_test && GetViewBBox().Contains(point);
720}
721
722CFX_FloatRect CPDFSDK_Widget::GetViewBBox() {
724 return CFX_FloatRect();
725
726 auto* form_filler = GetInteractiveFormFiller();
727 return CFX_FloatRect(form_filler->GetViewBBox(GetPageView(), this));
728}
729
730void CPDFSDK_Widget::OnMouseEnter(Mask<FWL_EVENTFLAG> nFlags) {
732 return;
733
734 ObservedPtr<CPDFSDK_Widget> observer(this);
735 GetInteractiveFormFiller()->OnMouseEnter(GetPageView(), observer, nFlags);
736}
737
738void CPDFSDK_Widget::OnMouseExit(Mask<FWL_EVENTFLAG> nFlags) {
740 return;
741
742 ObservedPtr<CPDFSDK_Widget> observer(this);
743 GetInteractiveFormFiller()->OnMouseExit(GetPageView(), observer, nFlags);
744}
745
746bool CPDFSDK_Widget::OnLButtonDown(Mask<FWL_EVENTFLAG> nFlags,
747 const CFX_PointF& point) {
749 return false;
750
751 ObservedPtr<CPDFSDK_Widget> observer(this);
752 return GetInteractiveFormFiller()->OnLButtonDown(GetPageView(), observer,
753 nFlags, point);
754}
755
756bool CPDFSDK_Widget::OnLButtonUp(Mask<FWL_EVENTFLAG> nFlags,
757 const CFX_PointF& point) {
759 return false;
760
761 ObservedPtr<CPDFSDK_Widget> observer(this);
762 return GetInteractiveFormFiller()->OnLButtonUp(GetPageView(), observer,
763 nFlags, point);
764}
765
766bool CPDFSDK_Widget::OnLButtonDblClk(Mask<FWL_EVENTFLAG> nFlags,
767 const CFX_PointF& point) {
769 return false;
770
771 ObservedPtr<CPDFSDK_Widget> observer(this);
772 return GetInteractiveFormFiller()->OnLButtonDblClk(GetPageView(), observer,
773 nFlags, point);
774}
775
776bool CPDFSDK_Widget::OnMouseMove(Mask<FWL_EVENTFLAG> nFlags,
777 const CFX_PointF& point) {
779 return false;
780
781 ObservedPtr<CPDFSDK_Widget> observer(this);
782 return GetInteractiveFormFiller()->OnMouseMove(GetPageView(), observer,
783 nFlags, point);
784}
785
786bool CPDFSDK_Widget::OnMouseWheel(Mask<FWL_EVENTFLAG> nFlags,
787 const CFX_PointF& point,
788 const CFX_Vector& delta) {
790 return false;
791
792 ObservedPtr<CPDFSDK_Widget> observer(this);
793 return GetInteractiveFormFiller()->OnMouseWheel(GetPageView(), observer,
794 nFlags, point, delta);
795}
796
797bool CPDFSDK_Widget::OnRButtonDown(Mask<FWL_EVENTFLAG> nFlags,
798 const CFX_PointF& point) {
800 return false;
801
802 ObservedPtr<CPDFSDK_Widget> observer(this);
803 return GetInteractiveFormFiller()->OnRButtonDown(GetPageView(), observer,
804 nFlags, point);
805}
806
807bool CPDFSDK_Widget::OnRButtonUp(Mask<FWL_EVENTFLAG> nFlags,
808 const CFX_PointF& point) {
810 return false;
811
812 ObservedPtr<CPDFSDK_Widget> observer(this);
813 return GetInteractiveFormFiller()->OnRButtonUp(GetPageView(), observer,
814 nFlags, point);
815}
816
817bool CPDFSDK_Widget::OnChar(uint32_t nChar, Mask<FWL_EVENTFLAG> nFlags) {
818 return !IsSignatureWidget() &&
819 GetInteractiveFormFiller()->OnChar(this, nChar, nFlags);
820}
821
822bool CPDFSDK_Widget::OnKeyDown(FWL_VKEYCODE nKeyCode,
823 Mask<FWL_EVENTFLAG> nFlags) {
824 return !IsSignatureWidget() &&
825 GetInteractiveFormFiller()->OnKeyDown(this, nKeyCode, nFlags);
826}
827
828bool CPDFSDK_Widget::OnSetFocus(Mask<FWL_EVENTFLAG> nFlags) {
829 if (!IsFocusableAnnot(GetPDFAnnot()->GetSubtype()))
830 return false;
831
833 return true;
834
835 ObservedPtr<CPDFSDK_Widget> observer(this);
836 return GetInteractiveFormFiller()->OnSetFocus(observer, nFlags);
837}
838
839bool CPDFSDK_Widget::OnKillFocus(Mask<FWL_EVENTFLAG> nFlags) {
840 if (!IsFocusableAnnot(GetPDFAnnot()->GetSubtype()))
841 return false;
842
844 return true;
845
846 ObservedPtr<CPDFSDK_Widget> observer(this);
847 return GetInteractiveFormFiller()->OnKillFocus(observer, nFlags);
848}
849
850bool CPDFSDK_Widget::CanUndo() {
851 return !IsSignatureWidget() && GetInteractiveFormFiller()->CanUndo(this);
852}
853
854bool CPDFSDK_Widget::CanRedo() {
855 return !IsSignatureWidget() && GetInteractiveFormFiller()->CanRedo(this);
856}
857
858bool CPDFSDK_Widget::Undo() {
859 return !IsSignatureWidget() && GetInteractiveFormFiller()->Undo(this);
860}
861
862bool CPDFSDK_Widget::Redo() {
863 return !IsSignatureWidget() && GetInteractiveFormFiller()->Redo(this);
864}
865
866WideString CPDFSDK_Widget::GetText() {
868 return WideString();
869 return GetInteractiveFormFiller()->GetText(this);
870}
871
872WideString CPDFSDK_Widget::GetSelectedText() {
874 return WideString();
875 return GetInteractiveFormFiller()->GetSelectedText(this);
876}
877
878void CPDFSDK_Widget::ReplaceAndKeepSelection(const WideString& text) {
880 return;
881
882 GetInteractiveFormFiller()->ReplaceAndKeepSelection(this, text);
883}
884
885void CPDFSDK_Widget::ReplaceSelection(const WideString& text) {
887 return;
888
889 GetInteractiveFormFiller()->ReplaceSelection(this, text);
890}
891
892bool CPDFSDK_Widget::SelectAllText() {
893 return !IsSignatureWidget() &&
894 GetInteractiveFormFiller()->SelectAllText(this);
895}
896
897bool CPDFSDK_Widget::SetIndexSelected(int index, bool selected) {
898 ObservedPtr<CPDFSDK_Widget> observer(this);
899 return !IsSignatureWidget() && GetInteractiveFormFiller()->SetIndexSelected(
900 observer, index, selected);
901}
902
903bool CPDFSDK_Widget::IsIndexSelected(int index) {
904 ObservedPtr<CPDFSDK_Widget> observer(this);
905 return !IsSignatureWidget() &&
906 GetInteractiveFormFiller()->IsIndexSelected(observer, index);
907}
908
909void CPDFSDK_Widget::DrawAppearance(CFX_RenderDevice* pDevice,
910 const CFX_Matrix& mtUser2Device,
912 FormFieldType fieldType = GetFieldType();
913
914 if ((fieldType == FormFieldType::kCheckBox ||
915 fieldType == FormFieldType::kRadioButton) &&
919 gsd.m_LineWidth = 0.0f;
920
921 CFX_Path path;
923 pDevice->DrawPath(path, &mtUser2Device, &gsd, 0, 0xFFAAAAAA,
925 } else {
926 CPDFSDK_BAAnnot::DrawAppearance(pDevice, mtUser2Device, mode);
927 }
928}
929
930void CPDFSDK_Widget::UpdateField() {
931 CPDF_FormField* pFormField = GetFormField();
932 DCHECK(pFormField);
933 m_pInteractiveForm->UpdateField(pFormField);
934}
935
936void CPDFSDK_Widget::DrawShadow(CFX_RenderDevice* pDevice,
937 CPDFSDK_PageView* pPageView) {
938 FormFieldType fieldType = GetFieldType();
939 if (!m_pInteractiveForm->IsNeedHighLight(fieldType))
940 return;
941
942 CFX_Matrix page2device = pPageView->GetCurrentMatrix();
943 CFX_FloatRect rcDevice = GetRect();
944 CFX_PointF tmp =
945 page2device.Transform(CFX_PointF(rcDevice.left, rcDevice.bottom));
946 rcDevice.left = tmp.x;
947 rcDevice.bottom = tmp.y;
948
949 tmp = page2device.Transform(CFX_PointF(rcDevice.right, rcDevice.top));
950 rcDevice.right = tmp.x;
951 rcDevice.top = tmp.y;
952 rcDevice.Normalize();
953
954 pDevice->FillRect(
955 rcDevice.ToFxRect(),
956 AlphaAndColorRefToArgb(
957 static_cast<int>(m_pInteractiveForm->GetHighlightAlpha()),
958 m_pInteractiveForm->GetHighlightColor(fieldType)));
959}
960
961CFX_FloatRect CPDFSDK_Widget::GetClientRect() const {
963 float fBorderWidth = GetBorderWidth();
964 switch (GetBorderStyle()) {
967 fBorderWidth *= 2.0f;
968 break;
969 default:
970 break;
971 }
972 return rcWindow.GetDeflated(fBorderWidth, fBorderWidth);
973}
974
975CFX_FloatRect CPDFSDK_Widget::GetRotatedRect() const {
976 CFX_FloatRect rectAnnot = GetRect();
977 float fWidth = rectAnnot.Width();
978 float fHeight = rectAnnot.Height();
979
981 CFX_FloatRect rcPWLWindow;
982 switch (abs(pControl->GetRotation() % 360)) {
983 case 0:
984 case 180:
985 default:
986 rcPWLWindow = CFX_FloatRect(0, 0, fWidth, fHeight);
987 break;
988 case 90:
989 case 270:
990 rcPWLWindow = CFX_FloatRect(0, 0, fHeight, fWidth);
991 break;
992 }
993
994 return rcPWLWindow;
995}
996
997CFX_Matrix CPDFSDK_Widget::GetMatrix() const {
998 CFX_Matrix mt;
1000 CFX_FloatRect rcAnnot = GetRect();
1001 float fWidth = rcAnnot.Width();
1002 float fHeight = rcAnnot.Height();
1003
1004 switch (abs(pControl->GetRotation() % 360)) {
1005 default:
1006 case 0:
1007 break;
1008 case 90:
1009 mt = CFX_Matrix(0, 1, -1, 0, fWidth, 0);
1010 break;
1011 case 180:
1012 mt = CFX_Matrix(-1, 0, 0, -1, fWidth, fHeight);
1013 break;
1014 case 270:
1015 mt = CFX_Matrix(0, -1, 1, 0, 0, fHeight);
1016 break;
1017 }
1018
1019 return mt;
1020}
1021
1022CFX_Color CPDFSDK_Widget::GetTextPWLColor() const {
1024 absl::optional<CFX_Color> crText =
1025 pFormCtrl->GetDefaultAppearance().GetColor();
1026 return crText.value_or(CFX_Color(CFX_Color::Type::kGray, 0));
1027}
1028
1029CFX_Color CPDFSDK_Widget::GetBorderPWLColor() const {
1031 return pFormCtrl->GetOriginalBorderColor();
1032}
1033
1034CFX_Color CPDFSDK_Widget::GetFillPWLColor() const {
1036 return pFormCtrl->GetOriginalBackgroundColor();
1037}
1038
1039bool CPDFSDK_Widget::OnAAction(CPDF_AAction::AActionType type,
1040 CFFL_FieldAction* data,
1041 const CPDFSDK_PageView* pPageView) {
1042 CPDFSDK_FormFillEnvironment* pFormFillEnv = pPageView->GetFormFillEnv();
1043
1044#ifdef PDF_ENABLE_XFA
1045 if (HandleXFAAAction(type, data, pFormFillEnv))
1046 return true;
1047#endif // PDF_ENABLE_XFA
1048
1049 CPDF_Action action = GetAAction(type);
1051 pFormFillEnv->DoActionField(action, type, GetFormField(), data);
1052 }
1053 return false;
1054}
1055
1056void CPDFSDK_Widget::OnLoad() {
1058 return;
1059
1060 if (!IsAppearanceValid())
1061 ResetAppearance(absl::nullopt, CPDFSDK_Widget::kValueUnchanged);
1062
1063 FormFieldType field_type = GetFieldType();
1064 if (field_type == FormFieldType::kTextField ||
1065 field_type == FormFieldType::kComboBox) {
1066 ObservedPtr<CPDFSDK_Annot> pObserved(this);
1067 absl::optional<WideString> sValue = OnFormat();
1068 if (!pObserved)
1069 return;
1070
1071 if (sValue.has_value() && field_type == FormFieldType::kComboBox)
1072 ResetAppearance(sValue, CPDFSDK_Widget::kValueUnchanged);
1073 }
1074
1075#ifdef PDF_ENABLE_XFA
1076 auto* pContext = GetPageView()->GetFormFillEnv()->GetDocExtension();
1077 if (pContext && pContext->ContainsExtensionForegroundForm()) {
1078 if (!IsAppearanceValid() && !GetValue().IsEmpty())
1079 ResetXFAAppearance(CPDFSDK_Widget::kValueUnchanged);
1080 }
1081#endif // PDF_ENABLE_XFA
1082}
1083
1085 switch (eAAT) {
1096 return CPDFSDK_BAAnnot::GetAAction(eAAT);
1097
1104 return pField->GetAdditionalAction().GetAction(eAAT);
1105 return CPDFSDK_BAAnnot::GetAAction(eAAT);
1106 }
1107 default:
1108 break;
1109 }
1110
1111 return CPDF_Action(nullptr);
1112}
1113
1114CFFL_InteractiveFormFiller* CPDFSDK_Widget::GetInteractiveFormFiller() {
1115 return GetPageView()->GetFormFillEnv()->GetInteractiveFormFiller();
1116}
BorderStyle
bool OnChar(CPDFSDK_Widget *pWidget, uint32_t nChar, Mask< FWL_EVENTFLAG > nFlags)
bool OnRButtonDown(CPDFSDK_PageView *pPageView, ObservedPtr< CPDFSDK_Widget > &pWidget, Mask< FWL_EVENTFLAG > nFlags, const CFX_PointF &point)
bool OnMouseMove(CPDFSDK_PageView *pPageView, ObservedPtr< CPDFSDK_Widget > &pWidget, Mask< FWL_EVENTFLAG > nFlags, const CFX_PointF &point)
bool OnRButtonUp(CPDFSDK_PageView *pPageView, ObservedPtr< CPDFSDK_Widget > &pWidget, Mask< FWL_EVENTFLAG > nFlags, const CFX_PointF &point)
bool IsIndexSelected(ObservedPtr< CPDFSDK_Widget > &pWidget, int index)
bool OnMouseWheel(CPDFSDK_PageView *pPageView, ObservedPtr< CPDFSDK_Widget > &pWidget, Mask< FWL_EVENTFLAG > nFlags, const CFX_PointF &point, const CFX_Vector &delta)
WideString GetText(CPDFSDK_Widget *pWidget)
WideString GetSelectedText(CPDFSDK_Widget *pWidget)
bool OnLButtonDown(CPDFSDK_PageView *pPageView, ObservedPtr< CPDFSDK_Widget > &pWidget, Mask< FWL_EVENTFLAG > nFlags, const CFX_PointF &point)
bool OnKillFocus(ObservedPtr< CPDFSDK_Widget > &pWidget, Mask< FWL_EVENTFLAG > nFlag)
bool OnKeyDown(CPDFSDK_Widget *pWidget, FWL_VKEYCODE nKeyCode, Mask< FWL_EVENTFLAG > nFlags)
bool OnSetFocus(ObservedPtr< CPDFSDK_Widget > &pWidget, Mask< FWL_EVENTFLAG > nFlag)
void OnMouseEnter(CPDFSDK_PageView *pPageView, ObservedPtr< CPDFSDK_Widget > &pWidget, Mask< FWL_EVENTFLAG > nFlag)
bool CanUndo(CPDFSDK_Widget *pWidget)
void OnMouseExit(CPDFSDK_PageView *pPageView, ObservedPtr< CPDFSDK_Widget > &pWidget, Mask< FWL_EVENTFLAG > nFlag)
FX_RECT GetViewBBox(const CPDFSDK_PageView *pPageView, CPDFSDK_Widget *pWidget)
bool OnLButtonUp(CPDFSDK_PageView *pPageView, ObservedPtr< CPDFSDK_Widget > &pWidget, Mask< FWL_EVENTFLAG > nFlags, const CFX_PointF &point)
bool SetIndexSelected(ObservedPtr< CPDFSDK_Widget > &pWidget, int index, bool selected)
bool Redo(CPDFSDK_Widget *pWidget)
void OnDraw(CPDFSDK_PageView *pPageView, CPDFSDK_Widget *pWidget, CFX_RenderDevice *pDevice, const CFX_Matrix &mtUser2Device)
void OnDelete(CPDFSDK_Widget *pWidget)
bool Undo(CPDFSDK_Widget *pWidget)
void ReplaceSelection(CPDFSDK_Widget *pWidget, const WideString &text)
void ReplaceAndKeepSelection(CPDFSDK_Widget *pWidget, const WideString &text)
bool OnLButtonDblClk(CPDFSDK_PageView *pPageView, ObservedPtr< CPDFSDK_Widget > &pWidget, Mask< FWL_EVENTFLAG > nFlags, const CFX_PointF &point)
bool CanRedo(CPDFSDK_Widget *pWidget)
bool SelectAllText(CPDFSDK_Widget *pWidget)
bool Contains(const CFX_PointF &point) const
constexpr CFX_FloatRect(float l, float b, float r, float t)
constexpr CFX_FloatRect()=default
float Width() const
CFX_FloatRect & operator=(const CFX_FloatRect &that)=default
float Height() const
CFX_FloatRect GetDeflated(float x, float y) const
CFX_Matrix & operator=(const CFX_Matrix &other)=default
CFX_Matrix(float a1, float b1, float c1, float d1, float e1, float f1)
CFX_PointF Transform(const CFX_PointF &point) const
void AppendFloatRect(const CFX_FloatRect &rect)
Definition cfx_path.cpp:305
bool DrawPath(const CFX_Path &path, const CFX_Matrix *pObject2Device, const CFX_GraphStateData *pGraphState, uint32_t fill_color, uint32_t stroke_color, const CFX_FillRenderOptions &fill_options)
CPDF_Page * GetPDFPage()
CPDFSDK_PageView * GetPageView() const
const CPDF_Dictionary * GetAnnotDict() const
CPDF_Annot * GetPDFAnnot() const override
bool IsVisible() const
virtual void DrawAppearance(CFX_RenderDevice *pDevice, const CFX_Matrix &mtUser2Device, CPDF_Annot::AppearanceMode mode)
CPDFSDK_BAAnnot(CPDF_Annot *pAnnot, CPDFSDK_PageView *pPageView)
BorderStyle GetBorderStyle() const
int GetBorderWidth() const
virtual bool IsAppearanceValid()
CFX_FloatRect GetRect() const override
ByteString GetAppState() const
bool IsFocusableAnnot(const CPDF_Annot::Subtype &annot_type) const
RetainPtr< CPDF_Dictionary > GetMutableAnnotDict()
bool DoActionField(const CPDF_Action &action, CPDF_AAction::AActionType type, CPDF_FormField *pFormField, CFFL_FieldAction *data)
CPDFSDK_FormFillEnvironment * GetFormFillEnv() const
const CFX_Matrix & GetCurrentMatrix() const
void SetOptionSelection(int index)
WideString GetValue() const
bool CanUndo() override
int GetMaxLen() const
WideString GetSelectExportText(int nIndex) const
CPDF_FormField * GetFormField() const
bool IsWidgetAppearanceValid(CPDF_Annot::AppearanceMode mode) const
void SetRect(const CFX_FloatRect &rect)
bool OnMouseMove(Mask< FWL_EVENTFLAG > nFlags, const CFX_PointF &point) override
WideString GetSelectedText() override
int GetSelectedIndex(int nIndex) const
int GetAlignment() const
bool OnAAction(CPDF_AAction::AActionType type, CFFL_FieldAction *data, const CPDFSDK_PageView *pPageView)
int GetTopVisibleIndex() const
bool Undo() override
bool IsIndexSelected(int index) override
bool OnRButtonUp(Mask< FWL_EVENTFLAG > nFlags, const CFX_PointF &point) override
CFX_Matrix GetMatrix() const
bool OnLButtonUp(Mask< FWL_EVENTFLAG > nFlags, const CFX_PointF &point) override
bool OnLButtonDown(Mask< FWL_EVENTFLAG > nFlags, const CFX_PointF &point) override
bool IsSignatureWidget() const
bool CanRedo() override
bool IsChecked() const
bool IsOptionSelected(int nIndex) const
void SetCheck(bool bChecked)
absl::optional< WideString > OnFormat()
int GetRotate() const
void OnMouseExit(Mask< FWL_EVENTFLAG > nFlags) override
int GetFieldFlags() const
int CountOptions() const
void ReplaceSelection(const WideString &text) override
void DrawShadow(CFX_RenderDevice *pDevice, CPDFSDK_PageView *pPageView)
CFX_FloatRect GetViewBBox() override
bool SetIndexSelected(int index, bool selected) override
bool OnSetFocus(Mask< FWL_EVENTFLAG > nFlags) override
void ReplaceAndKeepSelection(const WideString &text) override
bool IsAppearanceValid() override
absl::optional< FX_COLORREF > GetTextColor() const
WideString GetOptionLabel(int nIndex) const
CPDF_FormControl * GetFormControl() const
void SetTopVisibleIndex(int index)
void DrawAppearance(CFX_RenderDevice *pDevice, const CFX_Matrix &mtUser2Device, CPDF_Annot::AppearanceMode mode) override
bool OnMouseWheel(Mask< FWL_EVENTFLAG > nFlags, const CFX_PointF &point, const CFX_Vector &delta) override
bool OnKeyDown(FWL_VKEYCODE nKeyCode, Mask< FWL_EVENTFLAG > nFlags) override
CPDF_Action GetAAction(CPDF_AAction::AActionType eAAT) override
bool OnLButtonDblClk(Mask< FWL_EVENTFLAG > nFlags, const CFX_PointF &point) override
CFX_FloatRect GetRotatedRect() const
bool IsAppModified() const
int GetLayoutOrder() const override
void OnMouseEnter(Mask< FWL_EVENTFLAG > nFlags) override
float GetFontSize() const
absl::optional< FX_COLORREF > GetBorderColor() const
absl::optional< FX_COLORREF > GetFillColor() const
~CPDFSDK_Widget() override
bool OnKillFocus(Mask< FWL_EVENTFLAG > nFlags) override
void SetValue(const WideString &sValue)
CFX_Color GetFillPWLColor() const
void OnDraw(CFX_RenderDevice *pDevice, const CFX_Matrix &mtUser2Device, bool bDrawAnnots) override
bool SelectAllText() override
CFX_FloatRect GetClientRect() const
WideString GetText() override
CFX_Color GetTextPWLColor() const
bool IsPushHighlighted() const
CPDFSDK_Widget(CPDF_Annot *pAnnot, CPDFSDK_PageView *pPageView, CPDFSDK_InteractiveForm *pInteractiveForm)
bool OnRButtonDown(Mask< FWL_EVENTFLAG > nFlags, const CFX_PointF &point) override
WideString GetExportValue() const
CFX_Color GetBorderPWLColor() const
bool DoHitTest(const CFX_PointF &point) override
bool OnChar(uint32_t nChar, Mask< FWL_EVENTFLAG > nFlags) override
FormFieldType GetFieldType() const
void OnLoad() override
bool Redo() override
bool HasDict() const
CPDF_Action GetAction(AActionType eType) const
Type GetType() const
RetainPtr< const CPDF_Stream > GetStreamFor(const ByteString &key) const
WideString GetExportValue() const
int GetControlAlignment() const
HighlightingMode GetHighlightingMode() const
CFX_Color GetOriginalBackgroundColor()
CPDF_FormField * GetField() const
CPDF_DefaultAppearance GetDefaultAppearance() const
CFX_Color::TypeAndARGB GetColorARGB(const ByteString &csEntry)
CFX_Color GetOriginalBorderColor()
int GetSelectedIndex(int index) const
int CountOptions() const
WideString GetValue() const
uint32_t GetFieldFlags() const
bool ClearSelection(NotificationOption notify)
int GetControlIndex(const CPDF_FormControl *pControl) const
bool SetItemSelection(int index, NotificationOption notify)
int GetMaxLen() const
bool IsItemSelected(int index) const
WideString GetOptionLabel(int index) const
int GetTopVisibleIndex() const
FormFieldType GetFieldType() const
WideString GetOptionValue(int index) const
CPDF_AAction GetAdditionalAction() const
bool CheckControl(int iControlIndex, bool bChecked, NotificationOption notify)
bool SetValue(const WideString &value, NotificationOption notify)
CPDF_FormControl * GetControlByDict(const CPDF_Dictionary *pWidgetDict) const
bool IsEmpty() const
Definition widestring.h:118
NotificationOption
FormFieldType
FX_COLORREF ArgbToColorRef(FX_ARGB argb)
Definition fx_dib.cpp:53
constexpr uint32_t kModifyAnnotation
const char kBC[]
const char kBG[]
constexpr uint32_t kReadOnly
Definition form_flags.h:13
static constexpr CFX_FillRenderOptions EvenOddOptions()