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_interactiveform.h
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#ifndef FPDFSDK_CPDFSDK_INTERACTIVEFORM_H_
8#define FPDFSDK_CPDFSDK_INTERACTIVEFORM_H_
9
10#include <functional>
11#include <map>
12#include <memory>
13#include <vector>
14
15#include "core/fpdfdoc/cpdf_action.h"
16#include "core/fpdfdoc/cpdf_interactiveform.h"
17#include "core/fxcrt/unowned_ptr.h"
18#include "core/fxge/dib/fx_dib.h"
19#include "fpdfsdk/cpdfsdk_widget.h"
20#include "third_party/abseil-cpp/absl/types/optional.h"
21
22class CPDF_Dictionary;
24class CPDF_FormField;
25class CPDF_Object;
26class CPDFSDK_FormFillEnvironment;
27
28class CPDFSDK_InteractiveForm final
30 public:
31 explicit CPDFSDK_InteractiveForm(CPDFSDK_FormFillEnvironment* pFormFillEnv);
33
35 return m_pInteractiveForm.get();
36 }
37
38 CPDFSDK_Widget* GetWidget(CPDF_FormControl* pControl) const;
39 void GetWidgets(const WideString& sFieldName,
40 std::vector<ObservedPtr<CPDFSDK_Widget>>* widgets) const;
41 void GetWidgets(CPDF_FormField* pField,
42 std::vector<ObservedPtr<CPDFSDK_Widget>>* widgets) const;
43
44 void AddMap(CPDF_FormControl* pControl, CPDFSDK_Widget* pWidget);
45 void RemoveMap(CPDF_FormControl* pControl);
46
47 void EnableCalculate(bool bEnabled);
48 bool IsCalculateEnabled() const;
49
50#ifdef PDF_ENABLE_XFA
51 void XfaEnableCalculate(bool bEnabled);
52 bool IsXfaCalculateEnabled() const;
53 bool IsXfaValidationsEnabled();
54 void XfaSetValidationsEnabled(bool bEnabled);
55 void SynchronizeField(CPDF_FormField* pFormField);
56#endif // PDF_ENABLE_XFA
57
58 bool OnKeyStrokeCommit(CPDF_FormField* pFormField, const WideString& csValue);
59 bool OnValidate(CPDF_FormField* pFormField, const WideString& csValue);
60 void OnCalculate(CPDF_FormField* pFormField);
62
63 void ResetFieldAppearance(CPDF_FormField* pFormField,
64 absl::optional<WideString> sValue);
65 void UpdateField(CPDF_FormField* pFormField);
66
67 bool DoAction_Hide(const CPDF_Action& action);
68 bool DoAction_SubmitForm(const CPDF_Action& action);
69 void DoAction_ResetForm(const CPDF_Action& action);
70
72 const std::vector<RetainPtr<const CPDF_Object>>& objects) const;
73 bool SubmitFields(const WideString& csDestination,
74 const std::vector<CPDF_FormField*>& fields,
75 bool bIncludeOrExclude,
76 bool bUrlEncoded);
77 bool SubmitForm(const WideString& sDestination);
78 ByteString ExportFormToFDFTextBuf();
79 ByteString ExportFieldsToFDFTextBuf(
80 const std::vector<CPDF_FormField*>& fields,
81 bool bIncludeOrExclude);
82
83 bool IsNeedHighLight(FormFieldType fieldType) const;
85 void SetHighlightAlpha(uint8_t alpha) { m_HighlightAlpha = alpha; }
86 uint8_t GetHighlightAlpha() { return m_HighlightAlpha; }
87 void SetHighlightColor(FX_COLORREF clr, FormFieldType fieldType);
88 void SetAllHighlightColors(FX_COLORREF clr);
89 FX_COLORREF GetHighlightColor(FormFieldType fieldType);
90
91 private:
92 // CPDF_InteractiveForm::NotifierIface:
94 const WideString& csValue) override;
95 void AfterValueChange(CPDF_FormField* pField) override;
97 const WideString& csValue) override;
98 void AfterSelectionChange(CPDF_FormField* pField) override;
99 void AfterCheckedStatusChange(CPDF_FormField* pField) override;
100 void AfterFormReset(CPDF_InteractiveForm* pForm) override;
101
102 int GetPageIndexByAnnotDict(CPDF_Document* pDocument,
103 const CPDF_Dictionary* pAnnotDict) const;
104
105 UnownedPtr<CPDFSDK_FormFillEnvironment> const m_pFormFillEnv;
106 std::unique_ptr<CPDF_InteractiveForm> const m_pInteractiveForm;
107 std::map<UnownedPtr<const CPDF_FormControl>,
108 UnownedPtr<CPDFSDK_Widget>,
109 std::less<>>
110 m_Map;
111#ifdef PDF_ENABLE_XFA
112 bool m_bXfaCalculate = true;
113 bool m_bXfaValidationsEnabled = true;
114#endif // PDF_ENABLE_XFA
115 bool m_bCalculate = true;
116 bool m_bBusy = false;
117 uint8_t m_HighlightAlpha = 0;
118 FX_COLORREF m_HighlightColor[kFormFieldTypeCount];
119 bool m_NeedsHighlight[kFormFieldTypeCount];
120};
121
122#endif // FPDFSDK_CPDFSDK_INTERACTIVEFORM_H_
BorderStyle
CFX_FloatRect GetCenterSquare() const
constexpr CFX_FloatRect(float l, float b, float r, float t)
float Width() const
bool IsEmpty() const
void ScaleFromCenterPoint(float fScale)
CFX_FloatRect & operator=(const CFX_FloatRect &that)=default
float Height() const
CFX_FloatRect GetDeflated(float x, float y) const
CFX_Matrix(float a1, float b1, float c1, float d1, float e1, float f1)
void SetAsTextField(absl::optional< WideString > sValue)
CPDFSDK_AppStream(CPDFSDK_Widget *widget, CPDF_Dictionary *dict)
void SetAsComboBox(absl::optional< WideString > sValue)
bool IsNeedHighLight(FormFieldType fieldType) const
std::vector< CPDF_FormField * > GetFieldFromObjects(const std::vector< RetainPtr< const CPDF_Object > > &objects) const
CPDFSDK_Widget * GetWidget(CPDF_FormControl *pControl) const
bool OnKeyStrokeCommit(CPDF_FormField *pFormField, const WideString &csValue)
~CPDFSDK_InteractiveForm() override
void SetHighlightColor(FX_COLORREF clr, FormFieldType fieldType)
void ResetFieldAppearance(CPDF_FormField *pFormField, absl::optional< WideString > sValue)
void SetAllHighlightColors(FX_COLORREF clr)
void GetWidgets(const WideString &sFieldName, std::vector< ObservedPtr< CPDFSDK_Widget > > *widgets) const
void GetWidgets(CPDF_FormField *pField, std::vector< ObservedPtr< CPDFSDK_Widget > > *widgets) const
void AfterFormReset(CPDF_InteractiveForm *pForm) override
FX_COLORREF GetHighlightColor(FormFieldType fieldType)
void AfterCheckedStatusChange(CPDF_FormField *pField) override
void AfterValueChange(CPDF_FormField *pField) override
bool DoAction_SubmitForm(const CPDF_Action &action)
bool BeforeValueChange(CPDF_FormField *pField, const WideString &csValue) override
ByteString ExportFieldsToFDFTextBuf(const std::vector< CPDF_FormField * > &fields, bool bIncludeOrExclude)
void RemoveMap(CPDF_FormControl *pControl)
bool DoAction_Hide(const CPDF_Action &action)
absl::optional< WideString > OnFormat(CPDF_FormField *pFormField)
void AfterSelectionChange(CPDF_FormField *pField) override
void UpdateField(CPDF_FormField *pFormField)
bool SubmitForm(const WideString &sDestination)
void DoAction_ResetForm(const CPDF_Action &action)
void AddMap(CPDF_FormControl *pControl, CPDFSDK_Widget *pWidget)
CPDFSDK_InteractiveForm(CPDFSDK_FormFillEnvironment *pFormFillEnv)
bool BeforeSelectionChange(CPDF_FormField *pField, const WideString &csValue) override
bool OnValidate(CPDF_FormField *pFormField, const WideString &csValue)
CPDF_InteractiveForm * GetInteractiveForm() const
void SetHighlightAlpha(uint8_t alpha)
bool SubmitFields(const WideString &csDestination, const std::vector< CPDF_FormField * > &fields, bool bIncludeOrExclude, bool bUrlEncoded)
void OnCalculate(CPDF_FormField *pFormField)
bool IsModifiedAPStream(const CPDF_Stream *stream) const
RetainPtr< CPDF_Stream > CreateModifiedAPStream()
bool HasMKEntry(const ByteString &csEntry) const
WideString GetDownCaption() const
HighlightingMode GetHighlightingMode() const
WideString GetRolloverCaption() const
CFX_Color GetOriginalBackgroundColor()
CPDF_FormField * GetField() const
WideString GetNormalCaption() const
ByteString GetCheckedAPState() const
CPDF_IconFit GetIconFit() const
CPDF_DefaultAppearance GetDefaultAppearance() const
CFX_Color GetOriginalBorderColor()
int GetTextPosition() const
int GetSelectedIndex(int index) const
int CountOptions() const
WideString GetOptionLabel(int index) const
int CountSelectedItems() const
int GetTopVisibleIndex() const
bool GetFittingBounds() const
uint16_t Word
Definition cpvt_word.h:19
int32_t nFontIndex
Definition cpvt_word.h:26
float fFontSize
Definition cpvt_word.h:27
void SetAt(int32_t nWordIndex)
bool GetWord(CPVT_Word &word) const
bool GetLine(CPVT_Line &line) const
const CPVT_WordPlace & GetAt() const
Iterator * GetIterator()
ByteString GetPDFWordString(int32_t nFontIndex, uint16_t Word, uint16_t SubWord)
IPVT_FontMap * GetFontMap()
CreateParams(CFX_Timer::HandlerIface *timer_handler, IPWL_FillerNotify *filler_notify, ProviderIface *provider)
Definition cpwl_wnd.cpp:36
virtual ByteString GetPDFFontAlias(int32_t nFontIndex)=0
ByteString & operator+=(const ByteString &str)
ByteString & operator=(const ByteString &that)
ByteString & operator=(ByteString &&that) noexcept
bool IsEmpty() const
Definition bytestring.h:119
WideString & operator=(WideString &&that) noexcept
CharType operator[](const size_t index) const
Definition widestring.h:146
bool IsEmpty() const
Definition widestring.h:118
WideString & operator=(const WideString &that)
#define TEXTPOS_ICON
#define TEXTPOS_RIGHT
#define TEXTPOS_LEFT
#define TEXTPOS_BELOW
#define TEXTPOS_OVERLAID
#define TEXTPOS_ABOVE
FormFieldType
#define PWS_VISIBLE
Definition cpwl_wnd.h:33
#define FXSYS_BEZIER
Definition fx_system.h:44
#define FXSYS_PI
Definition fx_system.h:43
#define FXSYS_IsFloatBigger(fa, fb)
Definition fx_system.h:36
#define FXSYS_IsFloatZero(f)
Definition fx_system.h:35
ByteString operator+(const ByteString &str1, const ByteString &str2)
Definition bytestring.h:270
const char kRC[]
const char kIX[]
const char kAC[]
const char kCA[]
const char kI[]
const char kRI[]
CFX_Color operator/(float fColorDivide) const
CFX_Color operator-(float fColorSub) const
float fColor4
Definition cfx_color.h:58
float fColor3
Definition cfx_color.h:57
Type nColorType
Definition cfx_color.h:54
CFX_Color & operator=(const CFX_Color &that)=default
constexpr CFX_Color(Type type=CFX_Color::Type::kTransparent, float color1=0.0f, float color2=0.0f, float color3=0.0f, float color4=0.0f)
Definition cfx_color.h:27
float fColor2
Definition cfx_color.h:56
float fColor1
Definition cfx_color.h:55
int32_t LineCmp(const CPVT_WordPlace &wp) const
CPWL_Dash(int32_t dash, int32_t gap, int32_t phase)
Definition cpwl_wnd.h:63
int32_t nPhase
Definition cpwl_wnd.h:74
int32_t nDash
Definition cpwl_wnd.h:72
int32_t nGap
Definition cpwl_wnd.h:73