Loading...
Searching...
No Matches
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>
13#include <PDF/ViewChangeCollection.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();
124 UString GetValueAsString();
125
130 bool GetValueAsBool();
131
157 ViewChangeCollection SetValue(const UString& value);
158 ViewChangeCollection SetValue(SDF::Obj value);
159 ViewChangeCollection SetValue(const char* value);
160
161 enum ActionTriggerEvent
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
184 SDF::Obj GetTriggerAction(Field::ActionTriggerEvent trigger);
185
200 void RefreshAppearance();
201
205 void EraseAppearance();
206
213 SDF::Obj GetDefaultValue();
214 UString GetDefaultValueAsString();
215
220 UString GetName();
221
226 UString GetPartialName();
227
234 void Rename(const UString& field_name);
235
241 bool IsAnnot() const;
242
325 enum Flag
326 {
327 e_read_only, // Common flags
328 e_required,
329 e_no_export,
330
331 e_pushbutton_flag, // Pushbutton flags
332
333 e_radio_flag, // Radio buttons flags
334 e_toggle_to_off,
335 e_radios_in_unison,
336
337 e_multiline, // Text fields flags
338 e_password,
339 e_file_select,
340 e_no_spellcheck,
341 e_no_scroll,
342 e_comb,
343 e_rich_text,
344
345 e_combo, // Choice fields flags
346 e_edit,
347 e_sort,
348 e_multiselect,
349 e_commit_on_sel_change
350 };
351
355 bool GetFlag(Flag flag) const;
356
365 void SetFlag(Flag flag, bool value);
366
371 enum TextJustification
372 {
373 e_left_justified,
374 e_centered,
375 e_right_justified
376 };
377
382 TextJustification GetJustification();
383
389 void SetJustification(TextJustification j);
390
396 void SetMaxLen(int max_len);
397
401 int GetOptCount() const;
402
408 UString GetOpt(int index);
409
415 int GetMaxLen() const;
416
421 GState GetDefaultAppearance();
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
GState.h
Obj.h
SignatureHandler.h
UString.h
ViewChangeCollection.h
pdftron::PDF::Field::SetValue
ViewChangeCollection SetValue(const UString &value)
pdftron::PDF::Field::GetMaxLen
int GetMaxLen() const
pdftron::PDF::Field::~Field
~Field()
pdftron::PDF::Field::TextJustification
TextJustification
Definition Field.h:372
pdftron::PDF::Field::e_left_justified
@ e_left_justified
Definition Field.h:373
pdftron::PDF::Field::e_right_justified
@ e_right_justified
Definition Field.h:375
pdftron::PDF::Field::e_centered
@ e_centered
Definition Field.h:374
pdftron::PDF::Field::Flag
Flag
Definition Field.h:326
pdftron::PDF::Field::e_read_only
@ e_read_only
Definition Field.h:327
pdftron::PDF::Field::e_multiline
@ e_multiline
Definition Field.h:337
pdftron::PDF::Field::e_combo
@ e_combo
Definition Field.h:345
pdftron::PDF::Field::e_no_scroll
@ e_no_scroll
Definition Field.h:341
pdftron::PDF::Field::e_radios_in_unison
@ e_radios_in_unison
Definition Field.h:335
pdftron::PDF::Field::e_multiselect
@ e_multiselect
Definition Field.h:348
pdftron::PDF::Field::e_comb
@ e_comb
Definition Field.h:342
pdftron::PDF::Field::e_rich_text
@ e_rich_text
Definition Field.h:343
pdftron::PDF::Field::e_no_export
@ e_no_export
Definition Field.h:329
pdftron::PDF::Field::e_commit_on_sel_change
@ e_commit_on_sel_change
Definition Field.h:349
pdftron::PDF::Field::e_pushbutton_flag
@ e_pushbutton_flag
Definition Field.h:331
pdftron::PDF::Field::e_radio_flag
@ e_radio_flag
Definition Field.h:333
pdftron::PDF::Field::e_edit
@ e_edit
Definition Field.h:346
pdftron::PDF::Field::e_required
@ e_required
Definition Field.h:328
pdftron::PDF::Field::e_password
@ e_password
Definition Field.h:338
pdftron::PDF::Field::e_sort
@ e_sort
Definition Field.h:347
pdftron::PDF::Field::e_file_select
@ e_file_select
Definition Field.h:339
pdftron::PDF::Field::e_toggle_to_off
@ e_toggle_to_off
Definition Field.h:334
pdftron::PDF::Field::e_no_spellcheck
@ e_no_spellcheck
Definition Field.h:340
pdftron::PDF::Field::GetType
Type GetType() const
pdftron::PDF::Field::IsLockedByDigitalSignature
bool IsLockedByDigitalSignature() const
pdftron::PDF::Field::SetMaxLen
void SetMaxLen(int max_len)
pdftron::PDF::Field::Destroy
void Destroy()
pdftron::PDF::Field::SetFlag
void SetFlag(Flag flag, bool value)
pdftron::PDF::Field::GetPartialName
UString GetPartialName()
pdftron::PDF::Field::GetValue
SDF::Obj GetValue()
pdftron::PDF::Field::RefreshAppearance
void RefreshAppearance()
pdftron::PDF::Field::IsAnnot
bool IsAnnot() const
pdftron::PDF::Field::ActionTriggerEvent
ActionTriggerEvent
Definition Field.h:162
pdftron::PDF::Field::e_action_trigger_calculate
@ e_action_trigger_calculate
Definition Field.h:166
pdftron::PDF::Field::e_action_trigger_format
@ e_action_trigger_format
Definition Field.h:164
pdftron::PDF::Field::e_action_trigger_keystroke
@ e_action_trigger_keystroke
Definition Field.h:163
pdftron::PDF::Field::e_action_trigger_validate
@ e_action_trigger_validate
Definition Field.h:165
pdftron::PDF::Field::GetTriggerAction
SDF::Obj GetTriggerAction(Field::ActionTriggerEvent trigger)
pdftron::PDF::Field::GetDefaultValue
SDF::Obj GetDefaultValue()
pdftron::PDF::Field::SetValue
ViewChangeCollection SetValue(bool value)
pdftron::PDF::Field::operator=
Field & operator=(const Field &p)
pdftron::PDF::Field::IsValid
bool IsValid() const
pdftron::PDF::Field::GetDefaultAppearance
GState GetDefaultAppearance()
pdftron::PDF::Field::GetUpdateRect
Rect GetUpdateRect() const
pdftron::PDF::Field::GetValueAsBool
bool GetValueAsBool()
pdftron::PDF::Field::GetName
UString GetName()
pdftron::PDF::Field::GetOptCount
int GetOptCount() const
pdftron::PDF::Field::UseSignatureHandler
SDF::Obj UseSignatureHandler(const SDF::SignatureHandlerId signature_handler_id)
pdftron::PDF::Field::GetOpt
UString GetOpt(int index)
pdftron::PDF::Field::GetJustification
TextJustification GetJustification()
pdftron::PDF::Field::Field
Field(const Field &p)
pdftron::PDF::Field::SetJustification
void SetJustification(TextJustification j)
pdftron::PDF::Field::GetFlag
bool GetFlag(Flag flag) const
pdftron::PDF::Field::Rename
void Rename(const UString &field_name)
pdftron::PDF::Field::Type
Type
Definition Field.h:101
pdftron::PDF::Field::e_text
@ e_text
Definition Field.h:105
pdftron::PDF::Field::e_choice
@ e_choice
Definition Field.h:106
pdftron::PDF::Field::e_check
@ e_check
Definition Field.h:103
pdftron::PDF::Field::e_null
@ e_null
Definition Field.h:108
pdftron::PDF::Field::e_signature
@ e_signature
Definition Field.h:107
pdftron::PDF::Field::e_radio
@ e_radio
Definition Field.h:104
pdftron::PDF::Field::e_button
@ e_button
Definition Field.h:102
pdftron::PDF::Field::SetValue
ViewChangeCollection SetValue(SDF::Obj value)
pdftron::PDF::Field::GetValueAsString
UString GetValueAsString()
pdftron::PDF::Field::GetSDFObj
SDF::Obj GetSDFObj() const
pdftron::PDF::Field::FindInheritedAttribute
SDF::Obj FindInheritedAttribute(const char *attrib) const
pdftron::PDF::Field::EraseAppearance
void EraseAppearance()
pdftron::PDF::Field::SetValue
ViewChangeCollection SetValue(const char *value)
pdftron::PDF::Field::Flatten
void Flatten(class Page page)
pdftron::PDF::Field::Field
Field(SDF::Obj field_dict)
pdftron::PDF::Field::GetDefaultValueAsString
UString GetDefaultValueAsString()
pdftron::PDF::GState
Definition GState.h:27
pdftron::PDF::Page
Definition Page.h:32
pdftron::PDF::Rect
Definition Rect.h:29
pdftron::PDF::ViewChangeCollection
Definition ViewChangeCollection.h:10
pdftron::SDF::Obj
Definition Obj.h:41
pdftron::UString
Definition UString.h:28
pdftron::PDF
Definition Action.h:15
pdftron::SDF::SignatureHandlerId
size_t SignatureHandlerId
Definition SignatureHandler.h:21
pdftron
Definition BasicTypes.h:10