OLD | NEW |
---|---|
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef FPDFSDK_INCLUDE_FSDK_BASEFORM_H_ | 7 #ifndef FPDFSDK_INCLUDE_FSDK_BASEFORM_H_ |
8 #define FPDFSDK_INCLUDE_FSDK_BASEFORM_H_ | 8 #define FPDFSDK_INCLUDE_FSDK_BASEFORM_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <set> | |
11 #include <vector> | 12 #include <vector> |
12 | 13 |
13 #include "core/fpdfdoc/include/fpdf_doc.h" | 14 #include "core/fpdfdoc/include/fpdf_doc.h" |
14 #include "core/fxcrt/include/fx_basic.h" | 15 #include "core/fxcrt/include/fx_basic.h" |
15 #include "core/fxge/include/fx_dib.h" | 16 #include "core/fxge/include/fx_dib.h" |
16 #include "fpdfsdk/include/fsdk_baseannot.h" | 17 #include "fpdfsdk/include/fsdk_baseannot.h" |
17 | 18 |
18 #if _FX_OS_ == _FX_ANDROID_ | 19 #if _FX_OS_ == _FX_ANDROID_ |
19 #include "time.h" | 20 #include "time.h" |
20 #else | 21 #else |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
53 int nSelEnd; // in[out] | 54 int nSelEnd; // in[out] |
54 int nSelStart; // in[out] | 55 int nSelStart; // in[out] |
55 CFX_WideString sValue; // in[out] | 56 CFX_WideString sValue; // in[out] |
56 FX_BOOL bWillCommit; // in | 57 FX_BOOL bWillCommit; // in |
57 FX_BOOL bFieldFull; // in | 58 FX_BOOL bFieldFull; // in |
58 FX_BOOL bRC; // in[out] | 59 FX_BOOL bRC; // in[out] |
59 }; | 60 }; |
60 | 61 |
61 class CPDFSDK_Widget : public CPDFSDK_BAAnnot { | 62 class CPDFSDK_Widget : public CPDFSDK_BAAnnot { |
62 public: | 63 public: |
64 class Observer { | |
65 public: | |
66 Observer(CPDFSDK_Widget** pWatchedPtr); | |
Lei Zhang
2016/07/29 22:30:06
explicit
Tom Sepez
2016/08/01 16:24:54
Done.
| |
67 ~Observer(); | |
68 void OnWidgetDestroyed(); | |
Lei Zhang
2016/07/29 22:30:06
new line before
Tom Sepez
2016/08/01 16:24:54
Done.
| |
69 | |
70 private: | |
71 CPDFSDK_Widget** m_pWatchedPtr; | |
72 }; | |
73 | |
63 #ifdef PDF_ENABLE_XFA | 74 #ifdef PDF_ENABLE_XFA |
64 CXFA_FFWidget* GetMixXFAWidget() const; | 75 CXFA_FFWidget* GetMixXFAWidget() const; |
65 CXFA_FFWidget* GetGroupMixXFAWidget(); | 76 CXFA_FFWidget* GetGroupMixXFAWidget(); |
66 CXFA_FFWidgetHandler* GetXFAWidgetHandler() const; | 77 CXFA_FFWidgetHandler* GetXFAWidgetHandler() const; |
67 | 78 |
68 FX_BOOL HasXFAAAction(PDFSDK_XFAAActionType eXFAAAT); | 79 FX_BOOL HasXFAAAction(PDFSDK_XFAAActionType eXFAAAT); |
69 FX_BOOL OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT, | 80 FX_BOOL OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT, |
70 PDFSDK_FieldAction& data, | 81 PDFSDK_FieldAction& data, |
71 CPDFSDK_PageView* pPageView); | 82 CPDFSDK_PageView* pPageView); |
72 | 83 |
73 void Synchronize(FX_BOOL bSynchronizeElse); | 84 void Synchronize(FX_BOOL bSynchronizeElse); |
74 void SynchronizeXFAValue(); | 85 void SynchronizeXFAValue(); |
75 void SynchronizeXFAItems(); | 86 void SynchronizeXFAItems(); |
76 | 87 |
77 static void SynchronizeXFAValue(CXFA_FFDocView* pXFADocView, | 88 static void SynchronizeXFAValue(CXFA_FFDocView* pXFADocView, |
78 CXFA_FFWidget* hWidget, | 89 CXFA_FFWidget* hWidget, |
79 CPDF_FormField* pFormField, | 90 CPDF_FormField* pFormField, |
80 CPDF_FormControl* pFormControl); | 91 CPDF_FormControl* pFormControl); |
81 static void SynchronizeXFAItems(CXFA_FFDocView* pXFADocView, | 92 static void SynchronizeXFAItems(CXFA_FFDocView* pXFADocView, |
82 CXFA_FFWidget* hWidget, | 93 CXFA_FFWidget* hWidget, |
83 CPDF_FormField* pFormField, | 94 CPDF_FormField* pFormField, |
84 CPDF_FormControl* pFormControl); | 95 CPDF_FormControl* pFormControl); |
85 #endif // PDF_ENABLE_XFA | 96 #endif // PDF_ENABLE_XFA |
86 | 97 |
87 CPDFSDK_Widget(CPDF_Annot* pAnnot, | 98 CPDFSDK_Widget(CPDF_Annot* pAnnot, |
88 CPDFSDK_PageView* pPageView, | 99 CPDFSDK_PageView* pPageView, |
89 CPDFSDK_InterForm* pInterForm); | 100 CPDFSDK_InterForm* pInterForm); |
90 ~CPDFSDK_Widget() override; | 101 ~CPDFSDK_Widget() override; |
91 | 102 |
103 void AddObserver(Observer* observer); | |
104 void RemoveObserver(Observer* observer); | |
105 | |
92 // CPDFSDK_Annot | 106 // CPDFSDK_Annot |
93 CFX_ByteString GetSubType() const override; | 107 CFX_ByteString GetSubType() const override; |
94 CPDF_Action GetAAction(CPDF_AAction::AActionType eAAT) override; | 108 CPDF_Action GetAAction(CPDF_AAction::AActionType eAAT) override; |
95 FX_BOOL IsAppearanceValid() override; | 109 FX_BOOL IsAppearanceValid() override; |
96 | 110 |
97 int GetLayoutOrder() const override; | 111 int GetLayoutOrder() const override; |
98 | 112 |
99 int GetFieldType() const; | 113 int GetFieldType() const; |
100 | 114 |
101 // Possible values from PDF 32000-1:2008, table 221. | 115 // Possible values from PDF 32000-1:2008, table 221. |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
163 | 177 |
164 void DrawShadow(CFX_RenderDevice* pDevice, CPDFSDK_PageView* pPageView); | 178 void DrawShadow(CFX_RenderDevice* pDevice, CPDFSDK_PageView* pPageView); |
165 | 179 |
166 void SetAppModified(); | 180 void SetAppModified(); |
167 void ClearAppModified(); | 181 void ClearAppModified(); |
168 FX_BOOL IsAppModified() const; | 182 FX_BOOL IsAppModified() const; |
169 | 183 |
170 int32_t GetAppearanceAge() const; | 184 int32_t GetAppearanceAge() const; |
171 int32_t GetValueAge() const; | 185 int32_t GetValueAge() const; |
172 | 186 |
187 FX_BOOL IsWidgetAppearanceValid(CPDF_Annot::AppearanceMode mode); | |
188 void DrawAppearance(CFX_RenderDevice* pDevice, | |
189 const CFX_Matrix* pUser2Device, | |
190 CPDF_Annot::AppearanceMode mode, | |
191 const CPDF_RenderOptions* pOptions) override; | |
192 | |
193 FX_BOOL HitTest(FX_FLOAT pageX, FX_FLOAT pageY); | |
194 | |
173 private: | 195 private: |
174 void ResetAppearance_PushButton(); | 196 void ResetAppearance_PushButton(); |
175 void ResetAppearance_CheckBox(); | 197 void ResetAppearance_CheckBox(); |
176 void ResetAppearance_RadioButton(); | 198 void ResetAppearance_RadioButton(); |
177 void ResetAppearance_ComboBox(const FX_WCHAR* sValue); | 199 void ResetAppearance_ComboBox(const FX_WCHAR* sValue); |
178 void ResetAppearance_ListBox(); | 200 void ResetAppearance_ListBox(); |
179 void ResetAppearance_TextField(const FX_WCHAR* sValue); | 201 void ResetAppearance_TextField(const FX_WCHAR* sValue); |
180 | 202 |
181 CFX_FloatRect GetClientRect() const; | 203 CFX_FloatRect GetClientRect() const; |
182 CFX_FloatRect GetRotatedRect() const; | 204 CFX_FloatRect GetRotatedRect() const; |
183 | 205 |
184 CFX_ByteString GetBackgroundAppStream() const; | 206 CFX_ByteString GetBackgroundAppStream() const; |
185 CFX_ByteString GetBorderAppStream() const; | 207 CFX_ByteString GetBorderAppStream() const; |
186 CFX_Matrix GetMatrix() const; | 208 CFX_Matrix GetMatrix() const; |
187 | 209 |
188 CPWL_Color GetTextPWLColor() const; | 210 CPWL_Color GetTextPWLColor() const; |
189 CPWL_Color GetBorderPWLColor() const; | 211 CPWL_Color GetBorderPWLColor() const; |
190 CPWL_Color GetFillPWLColor() const; | 212 CPWL_Color GetFillPWLColor() const; |
191 | 213 |
192 void AddImageToAppearance(const CFX_ByteString& sAPType, CPDF_Stream* pImage); | 214 void AddImageToAppearance(const CFX_ByteString& sAPType, CPDF_Stream* pImage); |
193 void RemoveAppearance(const CFX_ByteString& sAPType); | 215 void RemoveAppearance(const CFX_ByteString& sAPType); |
194 | 216 |
195 public: | |
196 FX_BOOL IsWidgetAppearanceValid(CPDF_Annot::AppearanceMode mode); | |
197 void DrawAppearance(CFX_RenderDevice* pDevice, | |
198 const CFX_Matrix* pUser2Device, | |
199 CPDF_Annot::AppearanceMode mode, | |
200 const CPDF_RenderOptions* pOptions) override; | |
201 | |
202 FX_BOOL HitTest(FX_FLOAT pageX, FX_FLOAT pageY); | |
203 | |
204 private: | |
205 CPDFSDK_InterForm* const m_pInterForm; | 217 CPDFSDK_InterForm* const m_pInterForm; |
206 FX_BOOL m_bAppModified; | 218 FX_BOOL m_bAppModified; |
207 int32_t m_nAppAge; | 219 int32_t m_nAppAge; |
208 int32_t m_nValueAge; | 220 int32_t m_nValueAge; |
221 std::set<Observer*> m_Observers; | |
209 | 222 |
210 #ifdef PDF_ENABLE_XFA | 223 #ifdef PDF_ENABLE_XFA |
211 mutable CXFA_FFWidget* m_hMixXFAWidget; | 224 mutable CXFA_FFWidget* m_hMixXFAWidget; |
212 mutable CXFA_FFWidgetHandler* m_pWidgetHandler; | 225 mutable CXFA_FFWidgetHandler* m_pWidgetHandler; |
213 #endif // PDF_ENABLE_XFA | 226 #endif // PDF_ENABLE_XFA |
214 }; | 227 }; |
215 | 228 |
216 #ifdef PDF_ENABLE_XFA | 229 #ifdef PDF_ENABLE_XFA |
217 class CPDFSDK_XFAWidget : public CPDFSDK_Annot { | 230 class CPDFSDK_XFAWidget : public CPDFSDK_Annot { |
218 public: | 231 public: |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
380 const CPDFSDK_Annot* p2); | 393 const CPDFSDK_Annot* p2); |
381 | 394 |
382 TabOrder m_eTabOrder; | 395 TabOrder m_eTabOrder; |
383 CPDFSDK_PageView* m_pPageView; | 396 CPDFSDK_PageView* m_pPageView; |
384 CFX_ByteString m_sType; | 397 CFX_ByteString m_sType; |
385 CFX_ByteString m_sSubType; | 398 CFX_ByteString m_sSubType; |
386 std::vector<CPDFSDK_Annot*> m_Annots; | 399 std::vector<CPDFSDK_Annot*> m_Annots; |
387 }; | 400 }; |
388 | 401 |
389 #endif // FPDFSDK_INCLUDE_FSDK_BASEFORM_H_ | 402 #endif // FPDFSDK_INCLUDE_FSDK_BASEFORM_H_ |
OLD | NEW |