Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | Related Pages | Examples

blockref.h

00001 //  Copyright (c) 1996-2002 by Autodesk, Inc.
00002 //
00003 //  By using this code, you are agreeing to the terms and conditions of
00004 //  the License Agreement included in the documentation for this code.
00005 //
00006 //  AUTODESK MAKES     false, WARRANTIES, EXPRESS OR IMPLIED, AS TO THE CORRECTNESS
00007 //  OF THIS CODE OR ANY DERIVATIVE WORKS WHICH INCORPORATE IT. AUTODESK
00008 //  PROVIDES THE CODE ON AN "AS-IS" BASIS AND EXPLICITLY DISCLAIMS ANY
00009 //  LIABILITY, INCLUDING CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS,
00010 //  OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
00011 //
00012 //  Use, duplication, or disclosure by the U.S. Government is subject to
00013 //  restrictions set forth in FAR 52.227-19 (Commercial Computer Software
00014 //  Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical
00015 //  Data and Computer Software), as applicable.
00016 //
00017 
00018 #if !defined BLOCKREF_HEADER
00019 #define BLOCKREF_HEADER
00020 
00021 #include "whiptk/whipcore.h"
00022 #include "whiptk/file.h"
00023 #include "whiptk/blockref_defs.h"
00024 #include "whiptk/filetime.h"
00025 #include "whiptk/matrix.h"
00026 
00027 
00028 //The following macro tells you whether a WT_BlockRef field is applicable for a particular
00029 //blockref kind or not by looking at the BLOCK_VARIABLE_RELATION table.
00030 #define Verify(Variable, BlockType)\
00031     BLOCK_VARIABLE_RELATION[WT_BlockRef::n_##Variable][BlockType - WD_EXBO_GRAPHICS_HDR]
00032 
00033 //The following macro just defines a variable
00034 //if specified a variable name and variable type.
00035 #define DEFINEVARIABLE(VARIABLETYPE, VARIABLENAME)\
00036     VARIABLETYPE m_##VARIABLENAME;
00037 
00038 //Macro defines the get/set methods based on the variable name and type.
00039 #define DEFINEGETSETMETHODS(VARIABLETYPE, METHODNAME)\
00040  VARIABLETYPE get_##METHODNAME() const {\
00041    return m_##METHODNAME;\
00042 }\
00043  void set_##METHODNAME(VARIABLETYPE local_variable_name) {\
00044    m_##METHODNAME = local_variable_name;\
00045 }
00046 
00047 //The following macro just defines a variable
00048 //as an array if specified a name and type.
00049 #define DEFINEVARIABLEARRAY(VARIABLETYPE, VARIABLENAME, ARRAYLENGTH)\
00050     VARIABLETYPE m_##VARIABLENAME[ARRAYLENGTH];
00051 
00052 //For array variable fields we define get/set methods little bit differently.
00053 #define DEFINEARRAYGETSETMETHODS(VARIABLETYPE, METHODNAME, ARRAYLENGTH)\
00054  VARIABLETYPE * get_##METHODNAME() {\
00055    return (VARIABLETYPE *) &m_##METHODNAME;\
00056 }\
00057  WT_Integer32 get_##METHODNAME##_length() {\
00058    return ARRAYLENGTH;\
00059 }\
00060  void set_##METHODNAME(VARIABLETYPE *local_variable_name) {\
00061    for(int zz=0; zz < ARRAYLENGTH; zz++) m_##METHODNAME[zz] = local_variable_name[zz];\
00062 }
00063 
00068 
00069 
00103 class WHIPTK_API WT_BlockRef : public WT_Item, public WT_Attribute
00104 {
00105 
00106 public:
00107     friend class WT_File;
00108     friend class WT_Directory;
00109 
00111     enum WT_BlockRef_Format
00112     {
00113         Graphics_Hdr       = WD_EXBO_GRAPHICS_HDR           ,
00114         Overlay_Hdr        = WD_EXBO_OVERLAY_HDR            ,
00115         Redline_Hdr        = WD_EXBO_REDLINE_HDR            ,
00116         Thumbnail          = WD_EXBO_THUMBNAIL              ,
00117         Preview            = WD_EXBO_PREVIEW                ,
00118         Overlay_Preview    = WD_EXBO_OVERLAY_PREVIEW        ,
00119         EmbedFont          = WD_EXBO_FONT                   ,
00120         Graphics           = WD_EXBO_GRAPHICS               ,
00121         Overlay            = WD_EXBO_OVERLAY                ,
00122         Redline            = WD_EXBO_REDLINE                ,
00123         User               = WD_EXBO_USER                   ,
00124         Null               = WD_EXBO_NULL                   ,
00125         Global_Sheet       = WD_EXBO_GLOBAL_SHEET           ,
00126         Global             = WD_EXBO_GLOBAL                 ,
00127         Signature          = WD_EXBO_SIGNATURE
00128     };
00129 
00131     WT_BlockRef ();
00133     WT_BlockRef (WT_BlockRef_Format format);
00135     WT_BlockRef (WT_BlockRef const & blockref);
00137     ~WT_BlockRef()
00138     {
00139     }
00140 
00142     WT_Boolean    operator!= (WT_BlockRef const & attrib) const;
00144     WT_Boolean    operator== (WT_BlockRef const & attrib) const;
00146     WT_BlockRef   const &   operator=(WT_BlockRef const & blockref);
00147 
00149 
00150     DEFINEGETSETMETHODS(WT_Alignment            ,alignment);
00151     DEFINEGETSETMETHODS(WT_Guid                 ,block_guid);
00152     DEFINEGETSETMETHODS(WT_Block_Meaning        ,block_meaning);
00153     DEFINEARRAYGETSETMETHODS(WT_Logical_Point   ,clip_rectangle, 2);
00154     DEFINEGETSETMETHODS(WT_FileTime             ,container_modified_time);
00155     DEFINEGETSETMETHODS(WT_FileTime             ,creation_time);
00156     DEFINEGETSETMETHODS(WT_Integer16            ,dpi_resolution);
00157     DEFINEGETSETMETHODS(WT_Guid                 ,dwf_container_guid);
00158     DEFINEGETSETMETHODS(WT_Guid                 ,dwf_discipline_guid);
00159     DEFINEGETSETMETHODS(WT_FileTime             ,dwf_discipline_modified_time);
00160     DEFINEGETSETMETHODS(WT_Encryption           ,encryption);
00161     DEFINEGETSETMETHODS(WT_Boolean              ,flag_mini_dwf);
00162 
00164     WT_Unsigned_Integer32 get_block_size() const {
00165        return m_block_size;
00166     }
00167 
00169 
00173     WT_Unsigned_Integer32 get_file_offset() const {
00174        return m_file_offset;
00175     }
00176 
00178     WT_BlockRef_Format get_format() const {
00179         return m_format;
00180     }
00181 
00183     WT_Integer32 index() const {
00184         return m_index;
00185     }
00186 
00187     DEFINEARRAYGETSETMETHODS(WT_Integer32       ,image_representation, 3);
00188     DEFINEARRAYGETSETMETHODS(double             ,inked_area, 2);
00189     DEFINEGETSETMETHODS(WT_Boolean              ,inversion_flag);
00190     DEFINEGETSETMETHODS(WT_FileTime             ,last_sync_time);
00191     DEFINEGETSETMETHODS(WT_Boolean              ,mirror_flag);
00192     DEFINEGETSETMETHODS(WT_FileTime             ,modification_time);
00193     DEFINEGETSETMETHODS(WT_FileTime             ,modified_block_timestamp);
00194     DEFINEGETSETMETHODS(WT_Orientation          ,orientation);
00195     DEFINEARRAYGETSETMETHODS(double             ,paper_offset, 2);
00196     DEFINEGETSETMETHODS(double                  ,paper_scale);
00197     DEFINEGETSETMETHODS(WT_Guid                 ,parent_block_guid);
00198     DEFINEGETSETMETHODS(WT_Password             ,password);
00199     DEFINEGETSETMETHODS(WT_Guid                 ,plans_and_specs_website_guid);
00200     DEFINEGETSETMETHODS(WT_FileTime             ,print_sequence_modified_time);
00201     DEFINEGETSETMETHODS(WT_Guid                 ,related_overlay_hdr_block_guid);
00202     DEFINEGETSETMETHODS(WT_Integer16            ,rotation);
00203     DEFINEGETSETMETHODS(WT_Boolean              ,scan_flag);
00205     void    set_format(WT_BlockRef_Format format);
00206     DEFINEGETSETMETHODS(WT_Integer32            ,sheet_print_sequence);
00207     DEFINEGETSETMETHODS(WT_Matrix               ,targeted_matrix_rep);
00208     DEFINEGETSETMETHODS(WT_Boolean              ,validity);
00209     DEFINEGETSETMETHODS(WT_Boolean              ,visibility);
00210     DEFINEGETSETMETHODS(WT_Integer32            ,zValue);
00212 
00214     WT_Result materialize (WT_Opcode const & opcode, WT_File & file);
00215     WT_ID     object_id() const;
00216     WT_Type   object_type() const;
00217     WT_Result process(WT_File & file);
00218     WT_Result serialize(WT_File & file) const;
00219     WT_Result skip_operand (WT_Opcode const & opcode, WT_File & file);
00220     WT_Result sync (WT_File & file) const;
00221     WT_Boolean    operator==(WT_Attribute const & attrib) const;
00223 
00225 
00227     static WT_Result default_process(
00228         WT_BlockRef & item, 
00229         WT_File & file 
00230         );
00231 
00232 private:
00233     WT_BlockRef_Format      m_format;
00234     WT_Opcode *             m_optioncode;
00235     WT_Integer32            m_total_binary_opcode_size;
00236     WT_Integer32            m_index;
00237 
00238     WT_Result        serialize(WT_File & file, WT_Boolean bAsPartOfList, WT_Boolean bForBlockSizeRewrite) const;
00239     WT_Result        materialize(WT_Opcode const & opcode, WT_File & file, WT_Boolean bAsPartOfList);
00240 
00241     void _deleteObject(void *object)
00242     {
00243         delete (WT_BlockRef*)object;
00244     }
00245 
00247     void set_block_size(WT_Unsigned_Integer32 block_size) {
00248        m_block_size = block_size;
00249     }
00250 
00252     WT_Unsigned_Integer32 get_total_binary_opcode_size() {
00253        return m_total_binary_opcode_size;
00254     }
00255 
00256     //let us now use the macro and define some private variables.
00257     DEFINEVARIABLE(WT_Unsigned_Integer32   ,file_offset)
00258     DEFINEVARIABLE(WT_Unsigned_Integer32   ,block_size)
00259     DEFINEVARIABLE(WT_Guid                 ,block_guid)
00260     DEFINEVARIABLE(WT_FileTime             ,creation_time)
00261     DEFINEVARIABLE(WT_FileTime             ,modification_time)
00262     DEFINEVARIABLE(WT_Encryption           ,encryption)
00263     DEFINEVARIABLE(WT_Boolean              ,validity)
00264     DEFINEVARIABLE(WT_Boolean              ,visibility)
00265     DEFINEVARIABLE(WT_Block_Meaning        ,block_meaning)
00266     DEFINEVARIABLE(WT_Guid                 ,parent_block_guid)
00267     DEFINEVARIABLE(WT_Guid                 ,related_overlay_hdr_block_guid)
00268     DEFINEVARIABLE(WT_Integer32            ,sheet_print_sequence)
00269     DEFINEVARIABLE(WT_FileTime             ,print_sequence_modified_time)
00270     DEFINEVARIABLE(WT_Guid                 ,plans_and_specs_website_guid)
00271     DEFINEVARIABLE(WT_FileTime             ,last_sync_time)
00272     DEFINEVARIABLE(WT_Boolean              ,flag_mini_dwf)
00273     DEFINEVARIABLE(WT_FileTime             ,modified_block_timestamp)
00274     DEFINEVARIABLE(WT_Guid                 ,dwf_container_guid)
00275     DEFINEVARIABLE(WT_FileTime             ,container_modified_time)
00276     DEFINEVARIABLE(WT_Guid                 ,dwf_discipline_guid)
00277     DEFINEVARIABLE(WT_FileTime             ,dwf_discipline_modified_time)
00278     DEFINEVARIABLE(WT_Integer32            ,zValue)
00279     DEFINEVARIABLE(WT_Boolean              ,scan_flag)
00280     DEFINEVARIABLE(WT_Boolean              ,mirror_flag)
00281     DEFINEVARIABLE(WT_Boolean              ,inversion_flag)
00282     DEFINEVARIABLE(double                  ,paper_scale)
00283     DEFINEVARIABLE(WT_Orientation          ,orientation)
00284     DEFINEVARIABLE(WT_Integer16            ,rotation)
00285     DEFINEVARIABLE(WT_Alignment            ,alignment)
00286     DEFINEVARIABLEARRAY(double             ,inked_area, 2)
00287     DEFINEVARIABLE(WT_Integer16            ,dpi_resolution)
00288     DEFINEVARIABLEARRAY(double             ,paper_offset, 2)
00289     DEFINEVARIABLEARRAY(WT_Logical_Point   ,clip_rectangle, 2)
00290     DEFINEVARIABLE(WT_Password             ,password)
00291     DEFINEVARIABLEARRAY(WT_Integer32       ,image_representation, 3)
00292     DEFINEVARIABLE(WT_Matrix               ,targeted_matrix_rep)
00293 
00294     enum
00295     {
00296         Starting,
00297         Getting_Format,
00298         Getting_File_Offset,
00299         Getting_Block_Size,
00300         Getting_Block_Guid,
00301         Getting_Creation_Time,
00302         Getting_Modification_Time,
00303         Getting_Encryption,
00304         Getting_Block_Validity_Flag,
00305         Getting_Block_Visibility_Flag,
00306         Getting_Block_Meaning,
00307         Getting_Parent_Block_Guid,
00308         Getting_Related_Overlay_Hdr_Block_Guid,
00309         Getting_Sheet_Print_Sequence,
00310         Getting_Print_Sequence_Modification_Time,
00311         Getting_Plans_And_Website_Guid,
00312         Getting_Last_Sync_Time,
00313         Gettinig_Mini_Dwf_Flag,
00314         Getting_Block_Modified_TimeStamp,
00315         Getting_Dwf_Container_Id,
00316         Getting_Dwf_Container_Modification_Time,
00317         Getting_Dwf_Discipline_Guid,
00318         Getting_Dwf_Discipline_Modification_Time,
00319         Getting_ZValue,
00320         Getting_Scan_Flag,
00321         Getting_Mirror_Flag,
00322         Getting_Inversion_Flag,
00323         Getting_Paper_Scale,
00324         Getting_Orientation,
00325         Getting_Paper_Rotation,
00326         Getting_Alignment,
00327         Getting_Inked_Area,
00328         Getting_Dpi_Resolution,
00329         Getting_Paper_Offset,
00330         Getting_Clipping_Rectangle,
00331         Getting_Password,
00332         Getting_Image_Size_Representation,
00333         Getting_Targeted_Matrix_Representation,
00334         Getting_Close
00335     }   m_stage;
00336 
00338     enum WT_BlockRef_Variables
00339     {
00340         n_file_offset                      = 0,
00341         n_block_size                       = 1,
00342         n_block_guid                       = 2,
00343         n_creation_time                    = 3,
00344         n_modification_time                = 4,
00345         n_encryption                       = 5,
00346         n_validity                         = 6,
00347         n_visibility                       = 7,
00348         n_block_meaning                    = 8,
00349         n_parent_block_guid                = 9,
00350         n_related_overlay_hdr_block_guid   = 10,
00351         n_sheet_print_sequence             = 11,
00352         n_print_sequence_modified_time     = 12,
00353         n_plans_and_specs_website_guid     = 13,
00354         n_last_sync_time                   = 14,
00355         n_flag_mini_dwf                    = 15,
00356         n_modified_block_timestamp         = 16,
00357         n_dwf_container_guid               = 17,
00358         n_container_modified_time          = 18,
00359         n_dwf_discipline_guid              = 19,
00360         n_dwf_discipline_modified_time     = 20,
00361         n_zValue                           = 21,
00362         n_scan_flag                        = 22,
00363         n_mirror_flag                      = 23,
00364         n_inversion_flag                   = 24,
00365         n_paper_scale                      = 25,
00366         n_orientation                      = 26,
00367         n_rotation                         = 27,
00368         n_alignment                        = 28,
00369         n_inked_area                       = 29,
00370         n_dpi_resolution                   = 30,
00371         n_paper_offset                     = 31,
00372         n_clip_rectangle                   = 32,
00373         n_password                         = 33,
00374         n_image_representation             = 34,
00375         n_targeted_matrix_rep              = 35
00376     };
00377 
00378     //The moment the blockref format changes, this method has to be
00379     //called to re-compute the binary blockref opcode size based on the
00380     //new blockref format.
00381     void InitializeTotalBinaryOpcodeSize();
00382 
00383     WT_Integer32 ComputeBinaryOpcodeSize(WT_BlockRef_Format format,
00384         WT_Boolean bAsPartOfList);
00385 
00386     WT_Integer32 ComputeTotalBinaryOpcodeSize(
00387         WT_Boolean bAsPartOfList);
00388 
00389 };
00390 
00392 
00393 #endif // BLOCKREF_HEADER

Generated on Tue May 17 12:07:43 2005 for Autodesk DWF Whip 2D Toolkit by  doxygen 1.4.1