| 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 explicit Observer(CPDFSDK_Widget** pWatchedPtr); |
| 67 ~Observer(); |
| 68 |
| 69 void OnWidgetDestroyed(); |
| 70 |
| 71 private: |
| 72 CPDFSDK_Widget** m_pWatchedPtr; |
| 73 }; |
| 74 |
| 63 #ifdef PDF_ENABLE_XFA | 75 #ifdef PDF_ENABLE_XFA |
| 64 CXFA_FFWidget* GetMixXFAWidget() const; | 76 CXFA_FFWidget* GetMixXFAWidget() const; |
| 65 CXFA_FFWidget* GetGroupMixXFAWidget(); | 77 CXFA_FFWidget* GetGroupMixXFAWidget(); |
| 66 CXFA_FFWidgetHandler* GetXFAWidgetHandler() const; | 78 CXFA_FFWidgetHandler* GetXFAWidgetHandler() const; |
| 67 | 79 |
| 68 FX_BOOL HasXFAAAction(PDFSDK_XFAAActionType eXFAAAT); | 80 FX_BOOL HasXFAAAction(PDFSDK_XFAAActionType eXFAAAT); |
| 69 FX_BOOL OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT, | 81 FX_BOOL OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT, |
| 70 PDFSDK_FieldAction& data, | 82 PDFSDK_FieldAction& data, |
| 71 CPDFSDK_PageView* pPageView); | 83 CPDFSDK_PageView* pPageView); |
| 72 | 84 |
| 73 void Synchronize(FX_BOOL bSynchronizeElse); | 85 void Synchronize(FX_BOOL bSynchronizeElse); |
| 74 void SynchronizeXFAValue(); | 86 void SynchronizeXFAValue(); |
| 75 void SynchronizeXFAItems(); | 87 void SynchronizeXFAItems(); |
| 76 | 88 |
| 77 static void SynchronizeXFAValue(CXFA_FFDocView* pXFADocView, | 89 static void SynchronizeXFAValue(CXFA_FFDocView* pXFADocView, |
| 78 CXFA_FFWidget* hWidget, | 90 CXFA_FFWidget* hWidget, |
| 79 CPDF_FormField* pFormField, | 91 CPDF_FormField* pFormField, |
| 80 CPDF_FormControl* pFormControl); | 92 CPDF_FormControl* pFormControl); |
| 81 static void SynchronizeXFAItems(CXFA_FFDocView* pXFADocView, | 93 static void SynchronizeXFAItems(CXFA_FFDocView* pXFADocView, |
| 82 CXFA_FFWidget* hWidget, | 94 CXFA_FFWidget* hWidget, |
| 83 CPDF_FormField* pFormField, | 95 CPDF_FormField* pFormField, |
| 84 CPDF_FormControl* pFormControl); | 96 CPDF_FormControl* pFormControl); |
| 85 #endif // PDF_ENABLE_XFA | 97 #endif // PDF_ENABLE_XFA |
| 86 | 98 |
| 87 CPDFSDK_Widget(CPDF_Annot* pAnnot, | 99 CPDFSDK_Widget(CPDF_Annot* pAnnot, |
| 88 CPDFSDK_PageView* pPageView, | 100 CPDFSDK_PageView* pPageView, |
| 89 CPDFSDK_InterForm* pInterForm); | 101 CPDFSDK_InterForm* pInterForm); |
| 90 ~CPDFSDK_Widget() override; | 102 ~CPDFSDK_Widget() override; |
| 91 | 103 |
| 104 void AddObserver(Observer* observer); |
| 105 void RemoveObserver(Observer* observer); |
| 106 |
| 92 // CPDFSDK_Annot | 107 // CPDFSDK_Annot |
| 93 CFX_ByteString GetSubType() const override; | 108 CFX_ByteString GetSubType() const override; |
| 94 CPDF_Action GetAAction(CPDF_AAction::AActionType eAAT) override; | 109 CPDF_Action GetAAction(CPDF_AAction::AActionType eAAT) override; |
| 95 FX_BOOL IsAppearanceValid() override; | 110 FX_BOOL IsAppearanceValid() override; |
| 96 | 111 |
| 97 int GetLayoutOrder() const override; | 112 int GetLayoutOrder() const override; |
| 98 | 113 |
| 99 int GetFieldType() const; | 114 int GetFieldType() const; |
| 100 | 115 |
| 101 // Possible values from PDF 32000-1:2008, table 221. | 116 // Possible values from PDF 32000-1:2008, table 221. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 178 |
| 164 void DrawShadow(CFX_RenderDevice* pDevice, CPDFSDK_PageView* pPageView); | 179 void DrawShadow(CFX_RenderDevice* pDevice, CPDFSDK_PageView* pPageView); |
| 165 | 180 |
| 166 void SetAppModified(); | 181 void SetAppModified(); |
| 167 void ClearAppModified(); | 182 void ClearAppModified(); |
| 168 FX_BOOL IsAppModified() const; | 183 FX_BOOL IsAppModified() const; |
| 169 | 184 |
| 170 int32_t GetAppearanceAge() const; | 185 int32_t GetAppearanceAge() const; |
| 171 int32_t GetValueAge() const; | 186 int32_t GetValueAge() const; |
| 172 | 187 |
| 188 FX_BOOL IsWidgetAppearanceValid(CPDF_Annot::AppearanceMode mode); |
| 189 void DrawAppearance(CFX_RenderDevice* pDevice, |
| 190 const CFX_Matrix* pUser2Device, |
| 191 CPDF_Annot::AppearanceMode mode, |
| 192 const CPDF_RenderOptions* pOptions) override; |
| 193 |
| 194 FX_BOOL HitTest(FX_FLOAT pageX, FX_FLOAT pageY); |
| 195 |
| 173 private: | 196 private: |
| 174 void ResetAppearance_PushButton(); | 197 void ResetAppearance_PushButton(); |
| 175 void ResetAppearance_CheckBox(); | 198 void ResetAppearance_CheckBox(); |
| 176 void ResetAppearance_RadioButton(); | 199 void ResetAppearance_RadioButton(); |
| 177 void ResetAppearance_ComboBox(const FX_WCHAR* sValue); | 200 void ResetAppearance_ComboBox(const FX_WCHAR* sValue); |
| 178 void ResetAppearance_ListBox(); | 201 void ResetAppearance_ListBox(); |
| 179 void ResetAppearance_TextField(const FX_WCHAR* sValue); | 202 void ResetAppearance_TextField(const FX_WCHAR* sValue); |
| 180 | 203 |
| 181 CFX_FloatRect GetClientRect() const; | 204 CFX_FloatRect GetClientRect() const; |
| 182 CFX_FloatRect GetRotatedRect() const; | 205 CFX_FloatRect GetRotatedRect() const; |
| 183 | 206 |
| 184 CFX_ByteString GetBackgroundAppStream() const; | 207 CFX_ByteString GetBackgroundAppStream() const; |
| 185 CFX_ByteString GetBorderAppStream() const; | 208 CFX_ByteString GetBorderAppStream() const; |
| 186 CFX_Matrix GetMatrix() const; | 209 CFX_Matrix GetMatrix() const; |
| 187 | 210 |
| 188 CPWL_Color GetTextPWLColor() const; | 211 CPWL_Color GetTextPWLColor() const; |
| 189 CPWL_Color GetBorderPWLColor() const; | 212 CPWL_Color GetBorderPWLColor() const; |
| 190 CPWL_Color GetFillPWLColor() const; | 213 CPWL_Color GetFillPWLColor() const; |
| 191 | 214 |
| 192 void AddImageToAppearance(const CFX_ByteString& sAPType, CPDF_Stream* pImage); | 215 void AddImageToAppearance(const CFX_ByteString& sAPType, CPDF_Stream* pImage); |
| 193 void RemoveAppearance(const CFX_ByteString& sAPType); | 216 void RemoveAppearance(const CFX_ByteString& sAPType); |
| 194 | 217 |
| 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; | 218 CPDFSDK_InterForm* const m_pInterForm; |
| 206 FX_BOOL m_bAppModified; | 219 FX_BOOL m_bAppModified; |
| 207 int32_t m_nAppAge; | 220 int32_t m_nAppAge; |
| 208 int32_t m_nValueAge; | 221 int32_t m_nValueAge; |
| 222 std::set<Observer*> m_Observers; |
| 209 | 223 |
| 210 #ifdef PDF_ENABLE_XFA | 224 #ifdef PDF_ENABLE_XFA |
| 211 mutable CXFA_FFWidget* m_hMixXFAWidget; | 225 mutable CXFA_FFWidget* m_hMixXFAWidget; |
| 212 mutable CXFA_FFWidgetHandler* m_pWidgetHandler; | 226 mutable CXFA_FFWidgetHandler* m_pWidgetHandler; |
| 213 #endif // PDF_ENABLE_XFA | 227 #endif // PDF_ENABLE_XFA |
| 214 }; | 228 }; |
| 215 | 229 |
| 216 #ifdef PDF_ENABLE_XFA | 230 #ifdef PDF_ENABLE_XFA |
| 217 class CPDFSDK_XFAWidget : public CPDFSDK_Annot { | 231 class CPDFSDK_XFAWidget : public CPDFSDK_Annot { |
| 218 public: | 232 public: |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 const CPDFSDK_Annot* p2); | 394 const CPDFSDK_Annot* p2); |
| 381 | 395 |
| 382 TabOrder m_eTabOrder; | 396 TabOrder m_eTabOrder; |
| 383 CPDFSDK_PageView* m_pPageView; | 397 CPDFSDK_PageView* m_pPageView; |
| 384 CFX_ByteString m_sType; | 398 CFX_ByteString m_sType; |
| 385 CFX_ByteString m_sSubType; | 399 CFX_ByteString m_sSubType; |
| 386 std::vector<CPDFSDK_Annot*> m_Annots; | 400 std::vector<CPDFSDK_Annot*> m_Annots; |
| 387 }; | 401 }; |
| 388 | 402 |
| 389 #endif // FPDFSDK_INCLUDE_FSDK_BASEFORM_H_ | 403 #endif // FPDFSDK_INCLUDE_FSDK_BASEFORM_H_ |
| OLD | NEW |