All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Field.h
Go to the documentation of this file.
1 //---------------------------------------------------------------------------------------
2 // Copyright (c) 2001-2023 by Apryse Software Inc. All Rights Reserved.
3 // Consult legal.txt regarding legal and license information.
4 //---------------------------------------------------------------------------------------
5 #ifndef PDFTRON_H_CPPPDFField
6 #define PDFTRON_H_CPPPDFField
7 
8 #include <Common/UString.h>
9 #include <SDF/Obj.h>
10 #include <PDF/GState.h>
11 #include <C/PDF/TRN_Field.h>
12 #include <SDF/SignatureHandler.h>
14 
15 namespace pdftron {
16  namespace PDF {
17 
67 class Field
68 {
69 public:
70 
75  Field (SDF::Obj field_dict);
76 
77  Field (const Field& p);
78  Field& operator= (const Field& p);
79  ~Field();
80 
86  bool IsValid() const;
87 
98  enum Type
99  {
100  e_button, // Pushbutton field
101  e_check, // Check box field
102  e_radio, // Radio button field
103  e_text, // Text field
104  e_choice, // Choice field
105  e_signature, // Digital signature field
106  e_null // Unknown field type
107  };
108 
113  Type GetType() const;
114 
121  SDF::Obj GetValue();
123 
128  bool GetValueAsBool();
129 
155  ViewChangeCollection SetValue(const UString& value);
157  ViewChangeCollection SetValue(const char* value);
158 
160  {
161  e_action_trigger_keystroke = 13, //Triggered when user modifies text, or selection, in a text, combo or list field
162  e_action_trigger_format = 14, //Triggered before a field value is displayed.
163  e_action_trigger_validate = 15, //Triggered when a field value is changed
164  e_action_trigger_calculate = 16 //Triggered when field is recalculated due to a change in another field
165  };
166 
174  ViewChangeCollection SetValue(bool value);
175 
183 
198  void RefreshAppearance();
199 
203  void EraseAppearance();
204 
213 
218  UString GetName();
219 
225 
232  void Rename(const UString& field_name);
233 
239  bool IsAnnot() const;
240 
323  enum Flag
324  {
325  e_read_only, // Common flags
328 
329  e_pushbutton_flag, // Pushbutton flags
330 
331  e_radio_flag, // Radio buttons flags
334 
335  e_multiline, // Text fields flags
342 
343  e_combo, // Choice fields flags
348  };
349 
353  bool GetFlag(Flag flag) const;
354 
363  void SetFlag(Flag flag, bool value);
364 
370  {
374  };
375 
381 
388 
394  void SetMaxLen(int max_len);
395 
399  int GetOptCount() const;
400 
406  UString GetOpt(int index);
407 
413  int GetMaxLen() const;
414 
420 
435  void Flatten(class Page page);
436 
440  Rect GetUpdateRect() const;
441 
460  SDF::Obj FindInheritedAttribute (const char* attrib) const;
461 
465  SDF::Obj GetSDFObj () const;
466 
470  operator bool () { return IsValid();}
471 
475  void Destroy();
476 
489  SDF::Obj UseSignatureHandler(const SDF::SignatureHandlerId signature_handler_id);
490 
496  bool IsLockedByDigitalSignature() const;
497 
498 // @cond PRIVATE_DOC
499 #ifndef SWIGHIDDEN
500  TRN_Field mp_field;
501  Field ();
502 #endif
503 // @endcond
504 
505 };
506 
507 
508 
509  }; // namespace PDF
510 }; // namespace pdftron
511 
512 
513 #include <Impl/Page.inl>
514 
515 #endif // PDFTRON_H_CPPPDFField
SDF::Obj FindInheritedAttribute(const char *attrib) const
bool IsValid() const
SDF::Obj GetTriggerAction(Field::ActionTriggerEvent trigger)
Field & operator=(const Field &p)
SDF::Obj GetDefaultValue()
void Rename(const UString &field_name)
size_t SignatureHandlerId
SDF::Obj UseSignatureHandler(const SDF::SignatureHandlerId signature_handler_id)
TextJustification GetJustification()
Rect GetUpdateRect() const
bool GetFlag(Flag flag) const
bool IsAnnot() const
ViewChangeCollection SetValue(const UString &value)
void Flatten(class Page page)
int GetMaxLen() const
Type GetType() const
UString GetPartialName()
void SetJustification(TextJustification j)
int GetOptCount() const
GState GetDefaultAppearance()
Field(SDF::Obj field_dict)
void SetFlag(Flag flag, bool value)
UString GetDefaultValueAsString()
bool IsLockedByDigitalSignature() const
UString GetOpt(int index)
UString GetValueAsString()
SDF::Obj GetSDFObj() const
void SetMaxLen(int max_len)