| OLD | NEW |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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_CPDFSDK_WIDGET_H_ | 7 #ifndef FPDFSDK_CPDFSDK_WIDGET_H_ |
| 8 #define FPDFSDK_CPDFSDK_WIDGET_H_ | 8 #define FPDFSDK_CPDFSDK_WIDGET_H_ |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 class CXFA_FFWidgetHandler; | 33 class CXFA_FFWidgetHandler; |
| 34 #endif // PDF_ENABLE_XFA | 34 #endif // PDF_ENABLE_XFA |
| 35 | 35 |
| 36 class CPDFSDK_Widget : public CPDFSDK_BAAnnot { | 36 class CPDFSDK_Widget : public CPDFSDK_BAAnnot { |
| 37 public: | 37 public: |
| 38 #ifdef PDF_ENABLE_XFA | 38 #ifdef PDF_ENABLE_XFA |
| 39 CXFA_FFWidget* GetMixXFAWidget() const; | 39 CXFA_FFWidget* GetMixXFAWidget() const; |
| 40 CXFA_FFWidget* GetGroupMixXFAWidget(); | 40 CXFA_FFWidget* GetGroupMixXFAWidget(); |
| 41 CXFA_FFWidgetHandler* GetXFAWidgetHandler() const; | 41 CXFA_FFWidgetHandler* GetXFAWidgetHandler() const; |
| 42 | 42 |
| 43 FX_BOOL HasXFAAAction(PDFSDK_XFAAActionType eXFAAAT); | 43 bool HasXFAAAction(PDFSDK_XFAAActionType eXFAAAT); |
| 44 FX_BOOL OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT, | 44 bool OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT, |
| 45 PDFSDK_FieldAction& data, | 45 PDFSDK_FieldAction& data, |
| 46 CPDFSDK_PageView* pPageView); | 46 CPDFSDK_PageView* pPageView); |
| 47 | 47 |
| 48 void Synchronize(FX_BOOL bSynchronizeElse); | 48 void Synchronize(bool bSynchronizeElse); |
| 49 void SynchronizeXFAValue(); | 49 void SynchronizeXFAValue(); |
| 50 void SynchronizeXFAItems(); | 50 void SynchronizeXFAItems(); |
| 51 | 51 |
| 52 static void SynchronizeXFAValue(CXFA_FFDocView* pXFADocView, | 52 static void SynchronizeXFAValue(CXFA_FFDocView* pXFADocView, |
| 53 CXFA_FFWidget* hWidget, | 53 CXFA_FFWidget* hWidget, |
| 54 CPDF_FormField* pFormField, | 54 CPDF_FormField* pFormField, |
| 55 CPDF_FormControl* pFormControl); | 55 CPDF_FormControl* pFormControl); |
| 56 static void SynchronizeXFAItems(CXFA_FFDocView* pXFADocView, | 56 static void SynchronizeXFAItems(CXFA_FFDocView* pXFADocView, |
| 57 CXFA_FFWidget* hWidget, | 57 CXFA_FFWidget* hWidget, |
| 58 CPDF_FormField* pFormField, | 58 CPDF_FormField* pFormField, |
| 59 CPDF_FormControl* pFormControl); | 59 CPDF_FormControl* pFormControl); |
| 60 #endif // PDF_ENABLE_XFA | 60 #endif // PDF_ENABLE_XFA |
| 61 | 61 |
| 62 CPDFSDK_Widget(CPDF_Annot* pAnnot, | 62 CPDFSDK_Widget(CPDF_Annot* pAnnot, |
| 63 CPDFSDK_PageView* pPageView, | 63 CPDFSDK_PageView* pPageView, |
| 64 CPDFSDK_InterForm* pInterForm); | 64 CPDFSDK_InterForm* pInterForm); |
| 65 ~CPDFSDK_Widget() override; | 65 ~CPDFSDK_Widget() override; |
| 66 | 66 |
| 67 bool IsSignatureWidget() const override; | 67 bool IsSignatureWidget() const override; |
| 68 CPDF_Action GetAAction(CPDF_AAction::AActionType eAAT) override; | 68 CPDF_Action GetAAction(CPDF_AAction::AActionType eAAT) override; |
| 69 FX_BOOL IsAppearanceValid() override; | 69 bool IsAppearanceValid() override; |
| 70 | 70 |
| 71 int GetLayoutOrder() const override; | 71 int GetLayoutOrder() const override; |
| 72 | 72 |
| 73 int GetFieldType() const; | 73 int GetFieldType() const; |
| 74 int GetFieldFlags() const; | 74 int GetFieldFlags() const; |
| 75 int GetRotate() const; | 75 int GetRotate() const; |
| 76 | 76 |
| 77 FX_BOOL GetFillColor(FX_COLORREF& color) const; | 77 bool GetFillColor(FX_COLORREF& color) const; |
| 78 FX_BOOL GetBorderColor(FX_COLORREF& color) const; | 78 bool GetBorderColor(FX_COLORREF& color) const; |
| 79 FX_BOOL GetTextColor(FX_COLORREF& color) const; | 79 bool GetTextColor(FX_COLORREF& color) const; |
| 80 FX_FLOAT GetFontSize() const; | 80 FX_FLOAT GetFontSize() const; |
| 81 | 81 |
| 82 int GetSelectedIndex(int nIndex) const; | 82 int GetSelectedIndex(int nIndex) const; |
| 83 #ifndef PDF_ENABLE_XFA | 83 #ifndef PDF_ENABLE_XFA |
| 84 CFX_WideString GetValue() const; | 84 CFX_WideString GetValue() const; |
| 85 #else | 85 #else |
| 86 CFX_WideString GetValue(FX_BOOL bDisplay = TRUE) const; | 86 CFX_WideString GetValue(bool bDisplay = true) const; |
| 87 #endif // PDF_ENABLE_XFA | 87 #endif // PDF_ENABLE_XFA |
| 88 CFX_WideString GetDefaultValue() const; | 88 CFX_WideString GetDefaultValue() const; |
| 89 CFX_WideString GetOptionLabel(int nIndex) const; | 89 CFX_WideString GetOptionLabel(int nIndex) const; |
| 90 int CountOptions() const; | 90 int CountOptions() const; |
| 91 FX_BOOL IsOptionSelected(int nIndex) const; | 91 bool IsOptionSelected(int nIndex) const; |
| 92 int GetTopVisibleIndex() const; | 92 int GetTopVisibleIndex() const; |
| 93 bool IsChecked() const; | 93 bool IsChecked() const; |
| 94 int GetAlignment() const; | 94 int GetAlignment() const; |
| 95 int GetMaxLen() const; | 95 int GetMaxLen() const; |
| 96 #ifdef PDF_ENABLE_XFA | 96 #ifdef PDF_ENABLE_XFA |
| 97 CFX_WideString GetName() const; | 97 CFX_WideString GetName() const; |
| 98 #endif // PDF_ENABLE_XFA | 98 #endif // PDF_ENABLE_XFA |
| 99 CFX_WideString GetAlternateName() const; | 99 CFX_WideString GetAlternateName() const; |
| 100 | 100 |
| 101 void SetCheck(bool bChecked, bool bNotify); | 101 void SetCheck(bool bChecked, bool bNotify); |
| 102 void SetValue(const CFX_WideString& sValue, FX_BOOL bNotify); | 102 void SetValue(const CFX_WideString& sValue, bool bNotify); |
| 103 void SetDefaultValue(const CFX_WideString& sValue); | 103 void SetDefaultValue(const CFX_WideString& sValue); |
| 104 void SetOptionSelection(int index, FX_BOOL bSelected, FX_BOOL bNotify); | 104 void SetOptionSelection(int index, bool bSelected, bool bNotify); |
| 105 void ClearSelection(FX_BOOL bNotify); | 105 void ClearSelection(bool bNotify); |
| 106 void SetTopVisibleIndex(int index); | 106 void SetTopVisibleIndex(int index); |
| 107 | 107 |
| 108 #ifdef PDF_ENABLE_XFA | 108 #ifdef PDF_ENABLE_XFA |
| 109 void ResetAppearance(FX_BOOL bValueChanged); | 109 void ResetAppearance(bool bValueChanged); |
| 110 #endif // PDF_ENABLE_XFA | 110 #endif // PDF_ENABLE_XFA |
| 111 void ResetAppearance(const CFX_WideString* sValue, FX_BOOL bValueChanged); | 111 void ResetAppearance(const CFX_WideString* sValue, bool bValueChanged); |
| 112 void ResetFieldAppearance(FX_BOOL bValueChanged); | 112 void ResetFieldAppearance(bool bValueChanged); |
| 113 void UpdateField(); | 113 void UpdateField(); |
| 114 CFX_WideString OnFormat(FX_BOOL& bFormatted); | 114 CFX_WideString OnFormat(bool& bFormatted); |
| 115 | 115 |
| 116 FX_BOOL OnAAction(CPDF_AAction::AActionType type, | 116 bool OnAAction(CPDF_AAction::AActionType type, |
| 117 PDFSDK_FieldAction& data, | 117 PDFSDK_FieldAction& data, |
| 118 CPDFSDK_PageView* pPageView); | 118 CPDFSDK_PageView* pPageView); |
| 119 | 119 |
| 120 CPDFSDK_InterForm* GetInterForm() const { return m_pInterForm; } | 120 CPDFSDK_InterForm* GetInterForm() const { return m_pInterForm; } |
| 121 CPDF_FormField* GetFormField() const; | 121 CPDF_FormField* GetFormField() const; |
| 122 CPDF_FormControl* GetFormControl() const; | 122 CPDF_FormControl* GetFormControl() const; |
| 123 static CPDF_FormControl* GetFormControl(CPDF_InterForm* pInterForm, | 123 static CPDF_FormControl* GetFormControl(CPDF_InterForm* pInterForm, |
| 124 const CPDF_Dictionary* pAnnotDict); | 124 const CPDF_Dictionary* pAnnotDict); |
| 125 | 125 |
| 126 void DrawShadow(CFX_RenderDevice* pDevice, CPDFSDK_PageView* pPageView); | 126 void DrawShadow(CFX_RenderDevice* pDevice, CPDFSDK_PageView* pPageView); |
| 127 | 127 |
| 128 void SetAppModified(); | 128 void SetAppModified(); |
| 129 void ClearAppModified(); | 129 void ClearAppModified(); |
| 130 FX_BOOL IsAppModified() const; | 130 bool IsAppModified() const; |
| 131 | 131 |
| 132 int32_t GetAppearanceAge() const; | 132 int32_t GetAppearanceAge() const; |
| 133 int32_t GetValueAge() const; | 133 int32_t GetValueAge() const; |
| 134 | 134 |
| 135 FX_BOOL IsWidgetAppearanceValid(CPDF_Annot::AppearanceMode mode); | 135 bool IsWidgetAppearanceValid(CPDF_Annot::AppearanceMode mode); |
| 136 void DrawAppearance(CFX_RenderDevice* pDevice, | 136 void DrawAppearance(CFX_RenderDevice* pDevice, |
| 137 const CFX_Matrix* pUser2Device, | 137 const CFX_Matrix* pUser2Device, |
| 138 CPDF_Annot::AppearanceMode mode, | 138 CPDF_Annot::AppearanceMode mode, |
| 139 const CPDF_RenderOptions* pOptions) override; | 139 const CPDF_RenderOptions* pOptions) override; |
| 140 | 140 |
| 141 FX_BOOL HitTest(FX_FLOAT pageX, FX_FLOAT pageY); | 141 bool HitTest(FX_FLOAT pageX, FX_FLOAT pageY); |
| 142 | 142 |
| 143 private: | 143 private: |
| 144 void ResetAppearance_PushButton(); | 144 void ResetAppearance_PushButton(); |
| 145 void ResetAppearance_CheckBox(); | 145 void ResetAppearance_CheckBox(); |
| 146 void ResetAppearance_RadioButton(); | 146 void ResetAppearance_RadioButton(); |
| 147 void ResetAppearance_ComboBox(const CFX_WideString* sValue); | 147 void ResetAppearance_ComboBox(const CFX_WideString* sValue); |
| 148 void ResetAppearance_ListBox(); | 148 void ResetAppearance_ListBox(); |
| 149 void ResetAppearance_TextField(const CFX_WideString* sValue); | 149 void ResetAppearance_TextField(const CFX_WideString* sValue); |
| 150 | 150 |
| 151 CFX_FloatRect GetClientRect() const; | 151 CFX_FloatRect GetClientRect() const; |
| 152 CFX_FloatRect GetRotatedRect() const; | 152 CFX_FloatRect GetRotatedRect() const; |
| 153 | 153 |
| 154 CFX_ByteString GetBackgroundAppStream() const; | 154 CFX_ByteString GetBackgroundAppStream() const; |
| 155 CFX_ByteString GetBorderAppStream() const; | 155 CFX_ByteString GetBorderAppStream() const; |
| 156 CFX_Matrix GetMatrix() const; | 156 CFX_Matrix GetMatrix() const; |
| 157 | 157 |
| 158 CPWL_Color GetTextPWLColor() const; | 158 CPWL_Color GetTextPWLColor() const; |
| 159 CPWL_Color GetBorderPWLColor() const; | 159 CPWL_Color GetBorderPWLColor() const; |
| 160 CPWL_Color GetFillPWLColor() const; | 160 CPWL_Color GetFillPWLColor() const; |
| 161 | 161 |
| 162 void AddImageToAppearance(const CFX_ByteString& sAPType, CPDF_Stream* pImage); | 162 void AddImageToAppearance(const CFX_ByteString& sAPType, CPDF_Stream* pImage); |
| 163 void RemoveAppearance(const CFX_ByteString& sAPType); | 163 void RemoveAppearance(const CFX_ByteString& sAPType); |
| 164 | 164 |
| 165 CPDFSDK_InterForm* const m_pInterForm; | 165 CPDFSDK_InterForm* const m_pInterForm; |
| 166 FX_BOOL m_bAppModified; | 166 bool m_bAppModified; |
| 167 int32_t m_nAppAge; | 167 int32_t m_nAppAge; |
| 168 int32_t m_nValueAge; | 168 int32_t m_nValueAge; |
| 169 | 169 |
| 170 #ifdef PDF_ENABLE_XFA | 170 #ifdef PDF_ENABLE_XFA |
| 171 mutable CXFA_FFWidget* m_hMixXFAWidget; | 171 mutable CXFA_FFWidget* m_hMixXFAWidget; |
| 172 mutable CXFA_FFWidgetHandler* m_pWidgetHandler; | 172 mutable CXFA_FFWidgetHandler* m_pWidgetHandler; |
| 173 #endif // PDF_ENABLE_XFA | 173 #endif // PDF_ENABLE_XFA |
| 174 }; | 174 }; |
| 175 | 175 |
| 176 #endif // FPDFSDK_CPDFSDK_WIDGET_H_ | 176 #endif // FPDFSDK_CPDFSDK_WIDGET_H_ |
| OLD | NEW |