| 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 CORE_FPDFDOC_CPDF_FORMFIELD_H_ | 7 #ifndef CORE_FPDFDOC_CPDF_FORMFIELD_H_ |
| 8 #define CORE_FPDFDOC_CPDF_FORMFIELD_H_ | 8 #define CORE_FPDFDOC_CPDF_FORMFIELD_H_ |
| 9 | 9 |
| 10 #include "core/fpdfdoc/cpdf_aaction.h" | 10 #include "core/fpdfdoc/cpdf_aaction.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 CFX_WideString GetFullName() const; | 51 CFX_WideString GetFullName() const; |
| 52 | 52 |
| 53 Type GetType() const { return m_Type; } | 53 Type GetType() const { return m_Type; } |
| 54 uint32_t GetFlags() const { return m_Flags; } | 54 uint32_t GetFlags() const { return m_Flags; } |
| 55 | 55 |
| 56 CPDF_Dictionary* GetFieldDict() const { return m_pDict; } | 56 CPDF_Dictionary* GetFieldDict() const { return m_pDict; } |
| 57 void SetFieldDict(CPDF_Dictionary* pDict) { m_pDict = pDict; } | 57 void SetFieldDict(CPDF_Dictionary* pDict) { m_pDict = pDict; } |
| 58 | 58 |
| 59 FX_BOOL ResetField(FX_BOOL bNotify = FALSE); | 59 bool ResetField(bool bNotify = false); |
| 60 | 60 |
| 61 int CountControls() const { return m_ControlList.GetSize(); } | 61 int CountControls() const { return m_ControlList.GetSize(); } |
| 62 | 62 |
| 63 CPDF_FormControl* GetControl(int index) const { | 63 CPDF_FormControl* GetControl(int index) const { |
| 64 return m_ControlList.GetAt(index); | 64 return m_ControlList.GetAt(index); |
| 65 } | 65 } |
| 66 | 66 |
| 67 int GetControlIndex(const CPDF_FormControl* pControl) const; | 67 int GetControlIndex(const CPDF_FormControl* pControl) const; |
| 68 int GetFieldType() const; | 68 int GetFieldType() const; |
| 69 | 69 |
| 70 CPDF_AAction GetAdditionalAction() const; | 70 CPDF_AAction GetAdditionalAction() const; |
| 71 CFX_WideString GetAlternateName() const; | 71 CFX_WideString GetAlternateName() const; |
| 72 CFX_WideString GetMappingName() const; | 72 CFX_WideString GetMappingName() const; |
| 73 | 73 |
| 74 uint32_t GetFieldFlags() const; | 74 uint32_t GetFieldFlags() const; |
| 75 CFX_ByteString GetDefaultStyle() const; | 75 CFX_ByteString GetDefaultStyle() const; |
| 76 CFX_WideString GetRichTextString() const; | 76 CFX_WideString GetRichTextString() const; |
| 77 | 77 |
| 78 CFX_WideString GetValue() const; | 78 CFX_WideString GetValue() const; |
| 79 CFX_WideString GetDefaultValue() const; | 79 CFX_WideString GetDefaultValue() const; |
| 80 FX_BOOL SetValue(const CFX_WideString& value, FX_BOOL bNotify = FALSE); | 80 bool SetValue(const CFX_WideString& value, bool bNotify = false); |
| 81 | 81 |
| 82 int GetMaxLen() const; | 82 int GetMaxLen() const; |
| 83 int CountSelectedItems() const; | 83 int CountSelectedItems() const; |
| 84 int GetSelectedIndex(int index) const; | 84 int GetSelectedIndex(int index) const; |
| 85 | 85 |
| 86 FX_BOOL ClearSelection(FX_BOOL bNotify = FALSE); | 86 bool ClearSelection(bool bNotify = false); |
| 87 FX_BOOL IsItemSelected(int index) const; | 87 bool IsItemSelected(int index) const; |
| 88 FX_BOOL SetItemSelection(int index, | 88 bool SetItemSelection(int index, bool bSelected, bool bNotify = false); |
| 89 FX_BOOL bSelected, | |
| 90 FX_BOOL bNotify = FALSE); | |
| 91 | 89 |
| 92 FX_BOOL IsItemDefaultSelected(int index) const; | 90 bool IsItemDefaultSelected(int index) const; |
| 93 | 91 |
| 94 int GetDefaultSelectedItem() const; | 92 int GetDefaultSelectedItem() const; |
| 95 int CountOptions() const; | 93 int CountOptions() const; |
| 96 | 94 |
| 97 CFX_WideString GetOptionLabel(int index) const; | 95 CFX_WideString GetOptionLabel(int index) const; |
| 98 CFX_WideString GetOptionValue(int index) const; | 96 CFX_WideString GetOptionValue(int index) const; |
| 99 | 97 |
| 100 int FindOption(CFX_WideString csOptLabel) const; | 98 int FindOption(CFX_WideString csOptLabel) const; |
| 101 int FindOptionValue(const CFX_WideString& csOptValue) const; | 99 int FindOptionValue(const CFX_WideString& csOptValue) const; |
| 102 | 100 |
| 103 FX_BOOL CheckControl(int iControlIndex, bool bChecked, bool bNotify = false); | 101 bool CheckControl(int iControlIndex, bool bChecked, bool bNotify = false); |
| 104 | 102 |
| 105 int GetTopVisibleIndex() const; | 103 int GetTopVisibleIndex() const; |
| 106 int CountSelectedOptions() const; | 104 int CountSelectedOptions() const; |
| 107 | 105 |
| 108 int GetSelectedOptionIndex(int index) const; | 106 int GetSelectedOptionIndex(int index) const; |
| 109 FX_BOOL IsOptionSelected(int iOptIndex) const; | 107 bool IsOptionSelected(int iOptIndex) const; |
| 110 | 108 |
| 111 FX_BOOL SelectOption(int iOptIndex, | 109 bool SelectOption(int iOptIndex, bool bSelected, bool bNotify = false); |
| 112 FX_BOOL bSelected, | |
| 113 FX_BOOL bNotify = FALSE); | |
| 114 | 110 |
| 115 FX_BOOL ClearSelectedOptions(FX_BOOL bNotify = FALSE); | 111 bool ClearSelectedOptions(bool bNotify = false); |
| 116 | 112 |
| 117 #ifdef PDF_ENABLE_XFA | 113 #ifdef PDF_ENABLE_XFA |
| 118 FX_BOOL ClearOptions(FX_BOOL bNotify = FALSE); | 114 bool ClearOptions(bool bNotify = false); |
| 119 | 115 |
| 120 int InsertOption(CFX_WideString csOptLabel, | 116 int InsertOption(CFX_WideString csOptLabel, |
| 121 int index = -1, | 117 int index = -1, |
| 122 FX_BOOL bNotify = FALSE); | 118 bool bNotify = false); |
| 123 #endif // PDF_ENABLE_XFA | 119 #endif // PDF_ENABLE_XFA |
| 124 | 120 |
| 125 FX_FLOAT GetFontSize() const { return m_FontSize; } | 121 FX_FLOAT GetFontSize() const { return m_FontSize; } |
| 126 CPDF_Font* GetFont() const { return m_pFont; } | 122 CPDF_Font* GetFont() const { return m_pFont; } |
| 127 | 123 |
| 128 private: | 124 private: |
| 129 friend class CPDF_InterForm; | 125 friend class CPDF_InterForm; |
| 130 friend class CPDF_FormControl; | 126 friend class CPDF_FormControl; |
| 131 | 127 |
| 132 CPDF_FormField(CPDF_InterForm* pForm, CPDF_Dictionary* pDict); | 128 CPDF_FormField(CPDF_InterForm* pForm, CPDF_Dictionary* pDict); |
| 133 ~CPDF_FormField(); | 129 ~CPDF_FormField(); |
| 134 | 130 |
| 135 CFX_WideString GetValue(FX_BOOL bDefault) const; | 131 CFX_WideString GetValue(bool bDefault) const; |
| 136 FX_BOOL SetValue(const CFX_WideString& value, | 132 bool SetValue(const CFX_WideString& value, bool bDefault, bool bNotify); |
| 137 FX_BOOL bDefault, | |
| 138 FX_BOOL bNotify); | |
| 139 | 133 |
| 140 void SyncFieldFlags(); | 134 void SyncFieldFlags(); |
| 141 int FindListSel(CPDF_String* str); | 135 int FindListSel(CPDF_String* str); |
| 142 CFX_WideString GetOptionText(int index, int sub_index) const; | 136 CFX_WideString GetOptionText(int index, int sub_index) const; |
| 143 | 137 |
| 144 void LoadDA(); | 138 void LoadDA(); |
| 145 CFX_WideString GetCheckValue(FX_BOOL bDefault) const; | 139 CFX_WideString GetCheckValue(bool bDefault) const; |
| 146 FX_BOOL SetCheckValue(const CFX_WideString& value, | 140 bool SetCheckValue(const CFX_WideString& value, bool bDefault, bool bNotify); |
| 147 FX_BOOL bDefault, | |
| 148 FX_BOOL bNotify); | |
| 149 | 141 |
| 150 bool NotifyBeforeSelectionChange(const CFX_WideString& value); | 142 bool NotifyBeforeSelectionChange(const CFX_WideString& value); |
| 151 void NotifyAfterSelectionChange(); | 143 void NotifyAfterSelectionChange(); |
| 152 | 144 |
| 153 bool NotifyBeforeValueChange(const CFX_WideString& value); | 145 bool NotifyBeforeValueChange(const CFX_WideString& value); |
| 154 void NotifyAfterValueChange(); | 146 void NotifyAfterValueChange(); |
| 155 | 147 |
| 156 bool NotifyListOrComboBoxBeforeChange(const CFX_WideString& value); | 148 bool NotifyListOrComboBoxBeforeChange(const CFX_WideString& value); |
| 157 void NotifyListOrComboBoxAfterChange(); | 149 void NotifyListOrComboBoxAfterChange(); |
| 158 | 150 |
| 159 CPDF_FormField::Type m_Type; | 151 CPDF_FormField::Type m_Type; |
| 160 uint32_t m_Flags; | 152 uint32_t m_Flags; |
| 161 CPDF_InterForm* m_pForm; | 153 CPDF_InterForm* m_pForm; |
| 162 CPDF_Dictionary* m_pDict; | 154 CPDF_Dictionary* m_pDict; |
| 163 CFX_ArrayTemplate<CPDF_FormControl*> m_ControlList; | 155 CFX_ArrayTemplate<CPDF_FormControl*> m_ControlList; |
| 164 FX_FLOAT m_FontSize; | 156 FX_FLOAT m_FontSize; |
| 165 CPDF_Font* m_pFont; | 157 CPDF_Font* m_pFont; |
| 166 }; | 158 }; |
| 167 | 159 |
| 168 #endif // CORE_FPDFDOC_CPDF_FORMFIELD_H_ | 160 #endif // CORE_FPDFDOC_CPDF_FORMFIELD_H_ |
| OLD | NEW |