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 <vector> |
| 11 |
10 #include "core/fpdfdoc/cpdf_aaction.h" | 12 #include "core/fpdfdoc/cpdf_aaction.h" |
11 #include "core/fpdfdoc/cpdf_formfield.h" | 13 #include "core/fpdfdoc/cpdf_formfield.h" |
12 #include "core/fxcrt/fx_basic.h" | 14 #include "core/fxcrt/fx_basic.h" |
13 #include "core/fxcrt/fx_string.h" | 15 #include "core/fxcrt/fx_string.h" |
14 #include "core/fxcrt/fx_system.h" | 16 #include "core/fxcrt/fx_system.h" |
| 17 #include "third_party/base/stl_util.h" |
15 | 18 |
16 #define FIELDTYPE_UNKNOWN 0 | 19 #define FIELDTYPE_UNKNOWN 0 |
17 #define FIELDTYPE_PUSHBUTTON 1 | 20 #define FIELDTYPE_PUSHBUTTON 1 |
18 #define FIELDTYPE_CHECKBOX 2 | 21 #define FIELDTYPE_CHECKBOX 2 |
19 #define FIELDTYPE_RADIOBUTTON 3 | 22 #define FIELDTYPE_RADIOBUTTON 3 |
20 #define FIELDTYPE_COMBOBOX 4 | 23 #define FIELDTYPE_COMBOBOX 4 |
21 #define FIELDTYPE_LISTBOX 5 | 24 #define FIELDTYPE_LISTBOX 5 |
22 #define FIELDTYPE_TEXTFIELD 6 | 25 #define FIELDTYPE_TEXTFIELD 6 |
23 #define FIELDTYPE_SIGNATURE 7 | 26 #define FIELDTYPE_SIGNATURE 7 |
24 | 27 |
(...skipping 26 matching lines...) Expand all Loading... |
51 CFX_WideString GetFullName() const; | 54 CFX_WideString GetFullName() const; |
52 | 55 |
53 Type GetType() const { return m_Type; } | 56 Type GetType() const { return m_Type; } |
54 uint32_t GetFlags() const { return m_Flags; } | 57 uint32_t GetFlags() const { return m_Flags; } |
55 | 58 |
56 CPDF_Dictionary* GetFieldDict() const { return m_pDict; } | 59 CPDF_Dictionary* GetFieldDict() const { return m_pDict; } |
57 void SetFieldDict(CPDF_Dictionary* pDict) { m_pDict = pDict; } | 60 void SetFieldDict(CPDF_Dictionary* pDict) { m_pDict = pDict; } |
58 | 61 |
59 bool ResetField(bool bNotify = false); | 62 bool ResetField(bool bNotify = false); |
60 | 63 |
61 int CountControls() const { return m_ControlList.GetSize(); } | 64 int CountControls() const { |
| 65 return pdfium::CollectionSize<int>(m_ControlList); |
| 66 } |
62 | 67 |
63 CPDF_FormControl* GetControl(int index) const { | 68 CPDF_FormControl* GetControl(int index) const { return m_ControlList[index]; } |
64 return m_ControlList.GetAt(index); | |
65 } | |
66 | 69 |
67 int GetControlIndex(const CPDF_FormControl* pControl) const; | 70 int GetControlIndex(const CPDF_FormControl* pControl) const; |
68 int GetFieldType() const; | 71 int GetFieldType() const; |
69 | 72 |
70 CPDF_AAction GetAdditionalAction() const; | 73 CPDF_AAction GetAdditionalAction() const; |
71 CFX_WideString GetAlternateName() const; | 74 CFX_WideString GetAlternateName() const; |
72 CFX_WideString GetMappingName() const; | 75 CFX_WideString GetMappingName() const; |
73 | 76 |
74 uint32_t GetFieldFlags() const; | 77 uint32_t GetFieldFlags() const; |
75 CFX_ByteString GetDefaultStyle() const; | 78 CFX_ByteString GetDefaultStyle() const; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 void NotifyAfterSelectionChange(); | 146 void NotifyAfterSelectionChange(); |
144 | 147 |
145 bool NotifyBeforeValueChange(const CFX_WideString& value); | 148 bool NotifyBeforeValueChange(const CFX_WideString& value); |
146 void NotifyAfterValueChange(); | 149 void NotifyAfterValueChange(); |
147 | 150 |
148 bool NotifyListOrComboBoxBeforeChange(const CFX_WideString& value); | 151 bool NotifyListOrComboBoxBeforeChange(const CFX_WideString& value); |
149 void NotifyListOrComboBoxAfterChange(); | 152 void NotifyListOrComboBoxAfterChange(); |
150 | 153 |
151 CPDF_FormField::Type m_Type; | 154 CPDF_FormField::Type m_Type; |
152 uint32_t m_Flags; | 155 uint32_t m_Flags; |
153 CPDF_InterForm* m_pForm; | 156 CPDF_InterForm* const m_pForm; |
154 CPDF_Dictionary* m_pDict; | 157 CPDF_Dictionary* m_pDict; |
155 CFX_ArrayTemplate<CPDF_FormControl*> m_ControlList; | 158 std::vector<CPDF_FormControl*> m_ControlList; // Owned by InterForm parent. |
156 FX_FLOAT m_FontSize; | 159 FX_FLOAT m_FontSize; |
157 CPDF_Font* m_pFont; | 160 CPDF_Font* m_pFont; |
158 }; | 161 }; |
159 | 162 |
160 #endif // CORE_FPDFDOC_CPDF_FORMFIELD_H_ | 163 #endif // CORE_FPDFDOC_CPDF_FORMFIELD_H_ |
OLD | NEW |