Field.h
1 #pragma once
2 // Copyright (c) 2001-2024 Aspose Pty Ltd. All Rights Reserved.
3 //using Aspose.Doc.DocumentModel;
4 
5 #include <system/nullable.h>
6 #include <system/details/pointer_collection_helpers.h>
7 #include <system/collections/icollection.h>
8 #include <system/array.h>
9 
10 #include "Aspose.PDF.Cpp/InteractiveFeatures/Annotations/WidgetAnnotation.h"
11 #include "Aspose.PDF.Cpp/aspose_pdf_api_defs.h"
12 
13 namespace Aspose
14 {
15 namespace Pdf
16 {
17 namespace Annotations
18 {
19 class Annotation;
20 class AnnotationCollection;
21 class JavascriptAction;
22 namespace JavascriptExtensions
23 {
24 class FieldExtension;
25 } // namespace JavascriptExtensions
26 } // namespace Annotations
27 class ApsToPdfConverter;
28 namespace Collections
29 {
30 template <typename, typename> class AsposeHashDictionary;
31 } // namespace Collections
32 namespace Devices
33 {
34 class DocumentDevice;
35 } // namespace Devices
36 class Document;
37 namespace Engine
38 {
39 namespace Data
40 {
41 class IPdfArray;
42 class IPdfDictionary;
43 class IPdfObject;
44 class IPdfPrimitive;
45 class ITrailerable;
46 } // namespace Data
47 } // namespace Engine
48 namespace Facades
49 {
50 class Form;
51 class FormEditor;
52 } // namespace Facades
53 namespace Forms
54 {
55 class ButtonField;
56 class CheckboxField;
57 class ChoiceField;
58 class ChoiceOption;
59 class ComboBoxField;
60 class Field;
61 class Form;
62 class ListBoxField;
63 class RadioButtonField;
64 class RadioButtonOptionField;
65 class SignatureField;
66 class TextBoxField;
67 class XFA;
68 } // namespace Forms
69 namespace InteractiveFeatures
70 {
71 namespace Forms
72 {
73 class WidgetWrapper;
74 } // namespace Forms
75 } // namespace InteractiveFeatures
76 class Page;
77 class PageCollection;
78 class PageGenerator;
79 class Point;
80 class Rectangle;
81 namespace Tests
82 {
83 namespace Annotations
84 {
85 class AnnotationTests;
86 } // namespace Annotations
87 class RegressionTests_v12_1;
88 class RegressionTests_v22_12;
89 class RegressionTests_v23_11;
90 class RegressionTests_v6_3;
91 class RegressionTests_v7_3;
92 } // namespace Tests
93 } // namespace Pdf
94 } // namespace Aspose
95 namespace System
96 {
97 namespace Collections
98 {
99 namespace Generic
100 {
101 template <typename> class HashSet;
102 template <typename> class IEnumerator;
103 template <typename> class List;
104 } // namespace Generic
105 } // namespace Collections
106 namespace IO
107 {
108 class Stream;
109 } // namespace IO
110 namespace Xml
111 {
112 class XmlNamespaceManager;
113 class XmlNode;
114 } // namespace Xml
115 } // namespace System
116 
117 namespace Aspose {
118 
119 namespace Pdf {
120 
121 namespace Forms {
122 
126 class ASPOSE_PDF_SHARED_CLASS Field : public Aspose::Pdf::Annotations::WidgetAnnotation, public System::Collections::Generic::ICollection<System::SharedPtr<Aspose::Pdf::Annotations::WidgetAnnotation>>
127 {
128  typedef Field ThisType;
131 
132  typedef ::System::BaseTypesInfo<BaseType, BaseType1> ThisTypeBaseTypesInfo;
133  ASPOSE_PDF_SHARED_RTTI_INFO_DECL();
134 
135  friend class Aspose::Pdf::ApsToPdfConverter;
137  friend class Aspose::Pdf::PageGenerator;
139  friend class Aspose::Pdf::Document;
149  friend class Aspose::Pdf::Forms::ChoiceOption;
156  friend class Aspose::Pdf::Page;
158  friend class Aspose::Pdf::ApsToPdfConverter;
159  friend class Aspose::Pdf::Annotations::JavascriptExtensions::FieldExtension;
160  friend class Aspose::Pdf::InteractiveFeatures::Forms::WidgetWrapper;
161  friend class Aspose::Pdf::Tests::Annotations::AnnotationTests;
162  friend class Aspose::Pdf::Tests::RegressionTests_v12_1;
163  friend class Aspose::Pdf::Tests::RegressionTests_v6_3;
164  friend class Aspose::Pdf::Tests::RegressionTests_v7_3;
165  friend class Aspose::Pdf::Tests::RegressionTests_v22_12;
166  friend class Aspose::Pdf::Tests::RegressionTests_v23_11;
167 
168 public:
169 
173  ASPOSE_PDF_SHARED_API System::String get_PartialName();
177  ASPOSE_PDF_SHARED_API void set_PartialName(System::String value);
184  ASPOSE_PDF_SHARED_API System::String get_AlternateName();
191  ASPOSE_PDF_SHARED_API void set_AlternateName(System::String value);
195  ASPOSE_PDF_SHARED_API System::String get_MappingName();
199  ASPOSE_PDF_SHARED_API void set_MappingName(System::String value);
203  virtual ASPOSE_PDF_SHARED_API System::String get_Value();
207  virtual ASPOSE_PDF_SHARED_API void set_Value(System::String value);
211  ASPOSE_PDF_SHARED_API bool get_IsSynchronized();
215  ASPOSE_PDF_SHARED_API int32_t get_Count() const override;
219  ASPOSE_PDF_SHARED_API System::SharedPtr<System::Object> get_SyncRoot() const;
223  ASPOSE_PDF_SHARED_API bool get_IsGroup() const;
227  ASPOSE_PDF_SHARED_API int32_t get_AnnotationIndex();
231  ASPOSE_PDF_SHARED_API void set_AnnotationIndex(int32_t value);
235  ASPOSE_PDF_SHARED_API int32_t get_PageIndex() override;
239  ASPOSE_PDF_SHARED_API System::SharedPtr<Rectangle> get_Rect() override;
243  ASPOSE_PDF_SHARED_API void set_Rect(System::SharedPtr<Rectangle> value) override;
247  ASPOSE_PDF_SHARED_API bool get_IsSharedField() const;
251  ASPOSE_PDF_SHARED_API void set_IsSharedField(bool value);
255  static ASPOSE_PDF_SHARED_API bool get_FitIntoRectangle();
259  static ASPOSE_PDF_SHARED_API void set_FitIntoRectangle(bool value);
263  static ASPOSE_PDF_SHARED_API double get_MaxFontSize();
267  static ASPOSE_PDF_SHARED_API void set_MaxFontSize(double value);
271  static ASPOSE_PDF_SHARED_API double get_MinFontSize();
275  static ASPOSE_PDF_SHARED_API void set_MinFontSize(double value);
279  ASPOSE_PDF_SHARED_API int32_t get_TabOrder();
283  ASPOSE_PDF_SHARED_API void set_TabOrder(int32_t value);
284 
289  ASPOSE_PDF_SHARED_API bool Recalculate();
296  ASPOSE_PDF_SHARED_API void CopyTo(System::ArrayPtr<System::SharedPtr<Field>> array, int32_t index);
302  ASPOSE_PDF_SHARED_API void CopyToWidgetArray(System::ArrayPtr<System::SharedPtr<Aspose::Pdf::Annotations::WidgetAnnotation>> array, int32_t index);
308 
313  ASPOSE_PDF_SHARED_API Field(System::SharedPtr<Document> doc);
314 
318  ASPOSE_PDF_SHARED_API void Flatten() override;
319 
331  ASPOSE_PDF_SHARED_API System::SharedPtr<Aspose::Pdf::Annotations::WidgetAnnotation> idx_get(int32_t index);
332 
337  virtual ASPOSE_PDF_SHARED_API void SetPosition(System::SharedPtr<Point> point);
342  ASPOSE_PDF_SHARED_API void ExecuteFieldJavaScript(System::SharedPtr<Aspose::Pdf::Annotations::JavascriptAction> javaScriptAction);
343  ASPOSE_PDF_SHARED_API void SetTemplateWeakPtr(uint32_t argument) override;
344 
345 protected:
346 
347  static const int32_t _NoToggleToOff;
348  static const int32_t _Radio;
349  static const int32_t _Pushbutton;
350  static const int32_t _RadiosInUnison;
351  static const int32_t _Multiline;
352  static const int32_t _Password;
353  static const int32_t _FileSelect;
354  static const int32_t _DoNotSpellCheck;
355  static const int32_t _DoNotScroll;
356  static const int32_t _Comb;
357  static const int32_t _RichText;
358  static const int32_t _Combo;
359  static const int32_t _Edit;
360  static const int32_t _Sort;
361  static const int32_t _MultiSelect;
362  static const int32_t _CommitOnSelChange;
364 
366 
372  virtual ASPOSE_PDF_SHARED_API bool IsEqualTo(System::String value);
378  virtual ASPOSE_PDF_SHARED_API System::String GetConformXFAValue(System::String value);
379  bool IsCalculated();
380  void RemoveFromKids(System::SharedPtr<Aspose::Pdf::Annotations::Annotation> fieldInKids);
382 
384 
385  MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Field, CODEPORTING_ARGS(System::SharedPtr<Aspose::Pdf::Engine::Data::IPdfObject> annotation, System::SharedPtr<Document> document));
386  ASPOSE_PDF_SHARED_API void Initialize(System::SharedPtr<Aspose::Pdf::Engine::Data::ITrailerable> trailer, System::SharedPtr<Rectangle> rect) override;
391  virtual ASPOSE_PDF_SHARED_API void Initialize(System::SharedPtr<Aspose::Pdf::Engine::Data::ITrailerable> trailer);
392 
393  Field();
394 
395  MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Field, CODEPORTING_ARGS());
396 
398 
399  MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Field, CODEPORTING_ARGS(System::SharedPtr<Document> doc, System::SharedPtr<Rectangle> rect));
400 
401  Field(System::SharedPtr<Aspose::Pdf::Page> page, System::SharedPtr<Rectangle> rect, bool addToForm = false);
402 
403  MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Field, CODEPORTING_ARGS(System::SharedPtr<Aspose::Pdf::Page> page, System::SharedPtr<Rectangle> rect, bool addToForm = false));
407  void RemoveEmptyParents();
415  void setValue(System::String value);
416  ASPOSE_PDF_SHARED_API void UpdateAppearances() override;
417  System::String GetFieldReferencePath();
418  System::SharedPtr<System::Xml::XmlNode> GetFieldTemplate();
419  void SetFieldImage(System::SharedPtr<System::IO::Stream> image);
420  System::ArrayPtr<uint8_t> GetFieldImage();
421  void AddNext(System::SharedPtr<Field> field);
422  void ConvertToFieldWithKids();
424  void EmbedAnnotation();
429  virtual ASPOSE_PDF_SHARED_API System::SharedPtr<Field> CreateCopy();
430  ASPOSE_PDF_SHARED_API bool AppearanceSupported() override;
431  System::String GetCharacteristicsString(System::String entry);
432  static void SetCharacteristicsString(System::SharedPtr<Aspose::Pdf::Annotations::Annotation> annot, System::String entry, System::String value);
433  void SetCharacteristicsString(System::String entry, System::String value);
434 
435  virtual ASPOSE_PDF_SHARED_API ~Field();
436 
437 private:
438 
440  System::String partialName;
441  System::String alternateName;
442  System::String mappingName;
443  bool enableRecalculate;
444  System::String _ReferencePath;
447  bool _isSharedField;
448  static const System::String Prologue;
449 
450  static System::Nullable<bool>& _fitIntoRectangle();
451  static System::Nullable<double>& _maxFontSize();
452  static System::Nullable<double>& _minFontSize();
453 
454  static const double FontSizeNotDefined;
455  static const double DefaultMaxFontSize;
459  bool isGroup;
460 
461  bool get_IsReadOnly() const override;
462 
463  bool IsValidValueType(System::String typeName);
464  System::String CalculateValue(System::String script);
465  static bool IsRadioButtonOption(System::SharedPtr<Aspose::Pdf::Engine::Data::IPdfDictionary> field);
466  static bool IsRadioButton(System::SharedPtr<Aspose::Pdf::Engine::Data::IPdfDictionary> field);
473  static bool IsGroupField(System::SharedPtr<Aspose::Pdf::Engine::Data::IPdfDictionary> field);
474  void RemoveFromCache(int32_t objectId);
479  System::SharedPtr<Rectangle> GetKidsRectangle(int32_t pageIndex);
483  void Clear() override;
484  bool Contains(const System::SharedPtr<Aspose::Pdf::Annotations::WidgetAnnotation>& item) const override;
485  void CopyTo(System::ArrayPtr<System::SharedPtr<Aspose::Pdf::Annotations::WidgetAnnotation>> array, int32_t arrayIndex) override;
486  bool Remove(const System::SharedPtr<Aspose::Pdf::Annotations::WidgetAnnotation>& item) override;
487 
488 };
489 
490 } // namespace Forms
491 } // namespace Pdf
492 } // namespace Aspose
493 
494 
static const int32_t _Sort
Definition: Field.h:360
System::String _value
Definition: Field.h:363
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
static const int32_t _CommitOnSelChange
Definition: Field.h:362
Class representing Combobox field of the form.
Definition: ComboBoxField.h:63
Class representing Acro form object.
Definition: Form.h:115
Class representing form object.
Definition: Form.h:167
Class representing PDF document
Definition: Document.h:620
Definition: Artifact.h:67
Represents signature form field.
Definition: SignatureField.h:83
Class represnets push button field.
Definition: ButtonField.h:74
static const int32_t _FileSelect
Definition: Field.h:353
static const int32_t _RadiosInUnison
Definition: Field.h:350
Represents XML form regarding XML Forms Architecture (XFA).
Definition: XFA.h:93
static const int32_t _DoNotScroll
Definition: Field.h:355
static const int32_t _Combo
Definition: Field.h:358
Class representing widget annotation.
Definition: WidgetAnnotation.h:88
Definition: signed_info.h:13
Base class for acro form fields.
Definition: Field.h:126
static const int32_t _Edit
Definition: Field.h:359
The type that supports reliable, two-way, connection-based byte streams without duplication of data a...
static const int32_t _NoToggleToOff
Definition: Field.h:347
Abstract class for all devices which is used to process the whole pdf document.
Definition: DocumentDevice.h:38
static const int32_t _MultiSelect
Definition: Field.h:361
Specifies that the member is a field.
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: fwd.h:22
means saving in XML format
Class represents item of RadioButton field.
Definition: RadioButtonOptionField.h:62
static const int32_t _Radio
Definition: Field.h:348
Class representing text box field.
Definition: TextBoxField.h:88
Class representing page of PDF document.
Definition: Page.h:381
Represents base class for choice fields.
Definition: ChoiceField.h:53
Definition: AFRelationship.h:4
Class represents ListBox field.
Definition: ListBoxField.h:54
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
static const int32_t _Password
Definition: Field.h:352
Class representing annotation collection.
Definition: AnnotationCollection.h:56
A printer&#39;s point (1/72 of an inch).
Interface of collection of elements. Objects of this class should only be allocated using System::Mak...
Definition: Collection.h:41
The coordinates are in the page coordinate context.
static const int32_t _Multiline
Definition: Field.h:351
static const int32_t _Comb
Definition: Field.h:356
Collection of PDF document pages.
Definition: PageCollection.h:135
static const int32_t _RichText
Definition: Field.h:357
Class representing annotation object.
Definition: Annotation.h:303
Represents a abstract base object can be added to the page(doc.Paragraphs.Add()). ...
Definition: BaseParagraph.h:66
Class representing checkbox field
Definition: CheckboxField.h:86
static const int32_t _Pushbutton
Definition: Field.h:349
static const int32_t _DoNotSpellCheck
Definition: Field.h:354
Class for editing forms (ading/deleting field etc)
Definition: FormEditor.h:73
Whole PDF file will be submitted.