CheckboxField.h
1 #pragma once
2 // Copyright (c) 2001-2024 Aspose Pty Ltd. All Rights Reserved.
3 
4 #include <system/string.h>
5 #include <cstdint>
6 
7 #include "Aspose.PDF.Cpp/InteractiveFeatures/Forms/Field.h"
8 #include "Aspose.PDF.Cpp/InteractiveFeatures/Annotations/Annotation.h"
9 #include "Aspose.PDF.Cpp/aspose_pdf_api_defs.h"
10 
11 namespace Aspose
12 {
13 namespace Pdf
14 {
15 namespace Annotations
16 {
17 class FdfReader;
18 class WidgetAnnotation;
19 class XfdfReader;
20 } // namespace Annotations
21 class Document;
22 namespace Engine
23 {
24 namespace Data
25 {
26 class IPdfDictionary;
27 class IPdfObject;
28 class ITrailerable;
29 } // namespace Data
30 namespace IO
31 {
32 namespace ConvertStrategies
33 {
34 namespace ConvertHelpers
35 {
36 class FormExportImportUtils;
37 } // namespace ConvertHelpers
38 } // namespace ConvertStrategies
39 } // namespace IO
40 } // namespace Engine
41 namespace Facades
42 {
43 class Form;
44 } // namespace Facades
45 namespace Forms
46 {
47 enum class BoxStyle;
48 class Form;
49 class RadioButtonField;
50 class RadioButtonOptionField;
51 } // namespace Forms
52 class Operator;
53 class Page;
54 class Rectangle;
55 namespace Tests
56 {
57 namespace Annotations
58 {
59 class FormExportImportJsonTests;
60 } // namespace Annotations
61 class RegressionTests_v6_9;
62 } // namespace Tests
63 class XForm;
64 } // namespace Pdf
65 } // namespace Aspose
66 namespace System
67 {
68 namespace Collections
69 {
70 namespace Generic
71 {
72 template <typename> class List;
73 } // namespace Generic
74 } // namespace Collections
75 } // namespace System
76 
77 namespace Aspose {
78 
79 namespace Pdf {
80 
81 namespace Forms {
82 
86 class ASPOSE_PDF_SHARED_CLASS CheckboxField : public Aspose::Pdf::Forms::Field
87 {
88  typedef CheckboxField ThisType;
90 
91  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
92  ASPOSE_PDF_SHARED_RTTI_INFO_DECL();
93 
101  friend class Aspose::Pdf::Engine::IO::ConvertStrategies::ConvertHelpers::FormExportImportUtils;
102  friend class Aspose::Pdf::Tests::Annotations::FormExportImportJsonTests;
103  friend class Aspose::Pdf::Tests::RegressionTests_v6_9;
104 
105 public:
106 
111  ASPOSE_PDF_SHARED_API System::SharedPtr<System::Collections::Generic::List<System::String>> get_AllowedStates();
115  ASPOSE_PDF_SHARED_API BoxStyle get_Style();
119  ASPOSE_PDF_SHARED_API void set_Style(BoxStyle value);
123  ASPOSE_PDF_SHARED_API System::String get_ActiveState() override;
127  ASPOSE_PDF_SHARED_API void set_ActiveState(System::String value) override;
131  ASPOSE_PDF_SHARED_API bool get_Checked();
135  ASPOSE_PDF_SHARED_API void set_Checked(bool value);
139  ASPOSE_PDF_SHARED_API System::String get_Value() override;
143  ASPOSE_PDF_SHARED_API void set_Value(System::String value) override;
147  ASPOSE_PDF_SHARED_API System::String get_ExportValue();
151  ASPOSE_PDF_SHARED_API void set_ExportValue(System::String value);
152 
168  ASPOSE_PDF_SHARED_API CheckboxField();
173  ASPOSE_PDF_SHARED_API CheckboxField(System::SharedPtr<Document> doc);
174 
179  ASPOSE_PDF_SHARED_API System::SharedPtr<System::Object> Clone() override;
185  ASPOSE_PDF_SHARED_API void AddOption(System::String optionName);
191  ASPOSE_PDF_SHARED_API void AddOption(System::String optionName, System::SharedPtr<Rectangle> rect);
198  ASPOSE_PDF_SHARED_API void AddOption(System::String optionName, int32_t page, System::SharedPtr<Rectangle> rect);
199 
200 protected:
201 
207  System::String get_OnState();
212  System::String get_OffState();
216  System::String get_NormalCaption();
220  void set_NormalCaption(System::String value);
221 
222  static BoxStyle GetStyle(System::SharedPtr<XForm> xform, BoxStyle defaultStyle);
223  static void SetStyle(System::SharedPtr<XForm> xform, BoxStyle style);
224  void ResetAllowedStates();
225 
227 
228  MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(CheckboxField, CODEPORTING_ARGS(System::SharedPtr<Aspose::Pdf::Engine::Data::IPdfObject> annotation, System::SharedPtr<Document> document));
233  ASPOSE_PDF_SHARED_API void Initialize(System::SharedPtr<Aspose::Pdf::Engine::Data::ITrailerable> trailer) override;
234  ASPOSE_PDF_SHARED_API void UpdateAppearance(System::SharedPtr<Aspose::Pdf::Annotations::Annotation> annotation) override;
235  ASPOSE_PDF_SHARED_API bool AppearanceSupported() override;
243  static System::String TranslateStyle(BoxStyle style);
244  static BoxStyle TranslateCaption(System::String caption);
245  ASPOSE_PDF_SHARED_API System::SharedPtr<Field> CreateCopy() override;
257  bool HasSingleOption();
258 
259  virtual ASPOSE_PDF_SHARED_API ~CheckboxField();
260 
261 private:
262 
263  static const double DefaultItemHeight;
265  static System::String fontName;
266 
267  System::String ExtractStateName(System::String stateKey);
271  bool SetActiveState(System::SharedPtr<Aspose::Pdf::Annotations::Annotation> annotation, System::String value, bool throwExcpetion);
273  static void ReplaceExportValue(System::SharedPtr<Aspose::Pdf::Annotations::WidgetAnnotation> annotation, System::String newValue);
274 
275 };
276 
277 } // namespace Forms
278 } // namespace Pdf
279 } // namespace Aspose
280 
281 
String class used across the library. Is a substitute for C# System.String when translating code...
Definition: string.h:121
class ASPOSECPP_SHARED_CLASS List
Definition: ienumerable.h:17
Class representing Acro form object.
Definition: Form.h:115
Class representing form object.
Definition: Form.h:172
Definition: Artifact.h:67
Class which peroformes reading of XFDF format.
Definition: XfdfReader.h:63
BoxStyle
Represents styles of check box.
Definition: BoxStyle.h:18
Definition: signed_info.h:13
Base class for acro form fields.
Definition: Field.h:130
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: fwd.h:22
Class represents item of RadioButton field.
Definition: RadioButtonOptionField.h:62
Definition: AFRelationship.h:4
Defies a method that enables object cloning - creating a copy of an object. Objects of this class sho...
Definition: icloneable.h:15
Class representing radio button field.
Definition: RadioButtonField.h:75
The coordinates are in the page coordinate context.
Represents a abstract base object can be added to the page(doc.Paragraphs.Add()). ...
Definition: BaseParagraph.h:66
Class which performes reading of FDF format.
Definition: FdfReader.h:67
Class representing checkbox field
Definition: CheckboxField.h:86
Whole PDF file will be submitted.