blockref.h

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

Generated on Tue Jan 6 22:41:12 2009 for Autodesk DWF Whip 2D Toolkit by  doxygen 1.4.5