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-2025 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 
18 class Page;
19 
69 class Field
70 {
71 public:
72 
77  Field (SDF::Obj field_dict);
78 
79  Field (const Field& p);
80  Field& operator= (const Field& p);
81  ~Field();
82 
88  bool IsValid() const;
89 
100  enum Type
101  {
102  e_button, // Pushbutton field
103  e_check, // Check box field
104  e_radio, // Radio button field
105  e_text, // Text field
106  e_choice, // Choice field
107  e_signature, // Digital signature field
108  e_null // Unknown field type
109  };
110 
115  Type GetType() const;
116 
123  SDF::Obj GetValue();
125 
130  bool GetValueAsBool();
131 
157  ViewChangeCollection SetValue(const UString& value);
159  ViewChangeCollection SetValue(const char* value);
160 
162  {
163  e_action_trigger_keystroke = 13, //Triggered when user modifies text, or selection, in a text, combo or list field
164  e_action_trigger_format = 14, //Triggered before a field value is displayed.
165  e_action_trigger_validate = 15, //Triggered when a field value is changed
166  e_action_trigger_calculate = 16 //Triggered when field is recalculated due to a change in another field
167  };
168 
176  ViewChangeCollection SetValue(bool value);
177 
185 
200  void RefreshAppearance();
201 
205  void EraseAppearance();
206 
215 
220  UString GetName();
221 
227 
234  void Rename(const UString& field_name);
235 
241  bool IsAnnot() const;
242 
325  enum Flag
326  {
327  e_read_only, // Common flags
330 
331  e_pushbutton_flag, // Pushbutton flags
332 
333  e_radio_flag, // Radio buttons flags
336 
337  e_multiline, // Text fields flags
344 
345  e_combo, // Choice fields flags
350  };
351 
355  bool GetFlag(Flag flag) const;
356 
365  void SetFlag(Flag flag, bool value);
366 
372  {
376  };
377 
383 
390 
396  void SetMaxLen(int max_len);
397 
401  int GetOptCount() const;
402 
408  UString GetOpt(int index);
409 
415  int GetMaxLen() const;
416 
422 
437  void Flatten(class Page page);
438 
442  Rect GetUpdateRect() const;
443 
462  SDF::Obj FindInheritedAttribute (const char* attrib) const;
463 
467  SDF::Obj GetSDFObj () const;
468 
472  operator bool () { return IsValid();}
473 
477  void Destroy();
478 
491  SDF::Obj UseSignatureHandler(const SDF::SignatureHandlerId signature_handler_id);
492 
498  bool IsLockedByDigitalSignature() const;
499 
500 // @cond PRIVATE_DOC
501 #ifndef SWIGHIDDEN
502  TRN_Field mp_field;
503  Field ();
504 #endif
505 // @endcond
506 
507 };
508 
509 
510 
511  }; // namespace PDF
512 }; // namespace pdftron
513 
514 
515 #include <Impl/Page.inl>
516 
517 #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)