Field.h

Go to the documentation of this file.
00001 //---------------------------------------------------------------------------------------
00002 // Copyright (c) 2001-2008 by PDFTron Systems Inc. All Rights Reserved.
00003 // Consult legal.txt regarding legal and license information.
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,       // Pushbutton field
00099                 e_check,        // Check box field
00100                 e_radio,        // Radio button field
00101                 e_text,         // Text field
00102                 e_choice,       // Choice field
00103                 e_signature,    // Digital signature field
00104                 e_null                  // Unknown field type
00105         };
00106 
00111          Type GetType() const;
00112 
00119          SDF::Obj GetValue();
00120          UString GetValueAsString();
00121 
00146          void SetValue(const UString& value);
00147          void SetValue(SDF::Obj value);
00148 
00154          void RefreshAppearance();
00155 
00159          void EraseAppearance();
00160 
00167          SDF::Obj GetDefaultValue();
00168          UString GetDefaultValueAsString();
00169 
00174          UString GetName();
00175 
00180          UString GetPartialName();
00181 
00188          void Rename(const UString& field_name);
00189 
00195          bool IsAnnot() const;
00196 
00279         enum Flag
00280         {        
00281                 e_read_only,                // Common flags
00282                 e_required,
00283                 e_no_export,
00284                 
00285                 e_pushbutton_flag,          // Pushbutton flags
00286                 
00287                 e_radio_flag,               // Radio buttons flags
00288                 e_toggle_to_off,            
00289                 e_radios_in_unison,
00290                 
00291                 e_multiline,                // Text fields flags
00292                 e_password,
00293                 e_file_select,
00294                 e_no_spellcheck,
00295                 e_no_scroll,
00296                 e_comb,
00297                 e_rich_text,
00298                  
00299                 e_combo,                    // Choice fields flags
00300                 e_edit,
00301                 e_sort,
00302                 e_multiselect,
00303                 e_commit_on_sel_change
00304         };
00305 
00309          bool GetFlag(Flag flag) const;
00310     
00319          void SetFlag(Flag flag, bool value);
00320 
00321         /* 
00322         * Enumeration specifying the form of quadding (justification) to be used
00323         * in displaying the text fields. 
00324         */ 
00325         enum TextJustification 
00326         {
00327                 e_left_justified,
00328                 e_centered,
00329                 e_right_justified
00330         };
00331 
00336          TextJustification GetJustification();
00337 
00341          void SetJustification(TextJustification j);
00342 
00356          void Flatten(class Page page);
00357 
00376          SDF::Obj FindInheritedAttribute (const char* attrib) const;
00377 
00381          SDF::Obj GetSDFObj () const;
00382 
00386          operator bool () { return IsValid();}
00387 
00388 
00390         TRN_Field mp_field;
00391         Field ();
00393 
00394 };
00395 
00396 
00397 
00398         };      // namespace PDF
00399 };      // namespace pdftron
00400 
00401 
00402 #include <Impl/Page.inl>
00403 #endif
00404 
00405 
00406 

© 2002-2008 PDFTron Systems Inc.