00001
00002
00003
00004
00005
00006 #ifndef H_CPPPDFField
00007 #define H_CPPPDFField
00008
00009 #include <Common/UString.h>
00010 #include <C/PDF/TRN_Field.h>
00011 #include <SDF/Obj.h>
00012 #include <C/Common/TRN_Types.h>
00013
00014 namespace pdftron {
00015 namespace PDF {
00016
00066 class Field
00067 {
00068 public:
00069
00073 Field (SDF::Obj field_dict);
00074
00075 Field (const Field& p);
00076 Field& operator= (const Field& p);
00077 ~Field();
00078
00084 bool IsValid() const;
00085
00096 enum Type
00097 {
00098 e_button,
00099 e_check,
00100 e_radio,
00101 e_text,
00102 e_choice,
00103 e_signature,
00104 e_null
00105 };
00106
00111 Type GetType() const;
00112
00119 SDF::Obj GetValue();
00120 UString GetValueAsString();
00121
00126 bool GetValueAsBool();
00127
00153 void SetValue(const UString& value);
00154 void SetValue(SDF::Obj value);
00155 void SetValue(const char* value);
00156
00164 void SetValue(bool value);
00165
00166
00172 void RefreshAppearance();
00173
00177 void EraseAppearance();
00178
00185 SDF::Obj GetDefaultValue();
00186 UString GetDefaultValueAsString();
00187
00192 UString GetName();
00193
00198 UString GetPartialName();
00199
00206 void Rename(const UString& field_name);
00207
00213 bool IsAnnot() const;
00214
00297 enum Flag
00298 {
00299 e_read_only,
00300 e_required,
00301 e_no_export,
00302
00303 e_pushbutton_flag,
00304
00305 e_radio_flag,
00306 e_toggle_to_off,
00307 e_radios_in_unison,
00308
00309 e_multiline,
00310 e_password,
00311 e_file_select,
00312 e_no_spellcheck,
00313 e_no_scroll,
00314 e_comb,
00315 e_rich_text,
00316
00317 e_combo,
00318 e_edit,
00319 e_sort,
00320 e_multiselect,
00321 e_commit_on_sel_change
00322 };
00323
00327 bool GetFlag(Flag flag) const;
00328
00337 void SetFlag(Flag flag, bool value);
00338
00339
00340
00341
00342
00343 enum TextJustification
00344 {
00345 e_left_justified,
00346 e_centered,
00347 e_right_justified
00348 };
00349
00354 TextJustification GetJustification();
00355
00360 void SetJustification(TextJustification j);
00361
00366 void SetMaxLen(int max_len);
00367
00373 int GetMaxLen() const;
00374
00388 void Flatten(class Page page);
00389
00408 SDF::Obj FindInheritedAttribute (const char* attrib) const;
00409
00413 SDF::Obj GetSDFObj () const;
00414
00418 operator bool () { return IsValid();}
00419
00420
00422 TRN_Field mp_field;
00423 Field ();
00425
00426 };
00427
00428
00429
00430 };
00431 };
00432
00433
00434 #include <Impl/Page.inl>
00435 #endif
00436
00437
00438