examples/PIPS/antiword/inc/wordtypes.h

00001 /*
00002  * wordtypes.h
00003  * Copyright (C) 1998-2004 A.J. van Os; Released under GPL
00004  *
00005  * Description:
00006  * Typedefs for the interpretation of MS Word files
00007  */
00008 
00009 #if !defined(__wordtypes_h)
00010 #define __wordtypes_h 1
00011 
00012 #include <time.h>
00013 #if defined(__riscos)
00014 #include "DeskLib:Font.h"
00015 #include "DeskLib:Wimp.h"
00016 #endif /* __riscos */
00017 
00018 typedef unsigned char   UCHAR;
00019 typedef unsigned short  USHORT;
00020 typedef unsigned int    UINT;
00021 typedef unsigned long   ULONG;
00022 
00023 #if defined(__riscos)
00024 typedef struct diagram_tag {
00025         drawfile_info   tInfo;
00026         window_handle   tMainWindow;
00027         window_handle   tScaleWindow;
00028         menu_ptr        pSaveMenu;
00029         long            lXleft;                 /* In DrawUnits */
00030         long            lYtop;                  /* In DrawUnits */
00031         size_t          tMemorySize;
00032         int             iScaleFactorCurr;       /* In percentage */
00033         int             iScaleFactorTemp;       /* In percentage */
00034         char            szFilename[19+1];
00035 } diagram_type;
00036 #else
00037 typedef struct diagram_tag {
00038         FILE            *pOutFile;
00039         long            lXleft;                 /* In DrawUnits */
00040         long            lYtop;                  /* In DrawUnits */
00041 } diagram_type;
00042 typedef UCHAR           drawfile_fontref;
00043 #endif /* __riscos */
00044 
00045 typedef struct output_tag {
00046         char    *szStorage;
00047         long    lStringWidth;           /* In millipoints */
00048         size_t  tStorageSize;
00049         size_t  tNextFree;
00050         USHORT  usFontStyle;
00051         USHORT  usFontSize;
00052         UCHAR   ucFontColor;
00053         drawfile_fontref        tFontRef;
00054         struct output_tag       *pPrev;
00055         struct output_tag       *pNext;
00056 } output_type;
00057 
00058 /* Types of conversion */
00059 typedef enum conversion_tag {
00060         conversion_unknown = 0,
00061         conversion_text,
00062         conversion_draw,
00063         conversion_ps,
00064         conversion_xml,
00065         conversion_pdf,
00066         conversion_fmt_text
00067 } conversion_type;
00068 
00069 /* Types of encoding */
00070 typedef enum encoding_tag {
00071         encoding_neutral = 100,
00072         encoding_latin_1 = 801,
00073         encoding_latin_2 = 802,
00074         encoding_cyrillic = 805,
00075         encoding_utf_8 = 1601
00076 } encoding_type;
00077 
00078 /* Font translation table entry */
00079 typedef struct font_table_tag {
00080         USHORT  usFontStyle;
00081         UCHAR   ucWordFontNumber;
00082         UCHAR   ucFFN;
00083         UCHAR   ucEmphasis;
00084         UCHAR   ucInUse;
00085         char    szWordFontname[65];
00086         char    szOurFontname[33];
00087 } font_table_type;
00088 
00089 /* Options */
00090 typedef enum image_level_tag {
00091         level_gs_special = 0,
00092         level_no_images,
00093         level_ps_2,
00094         level_ps_3,
00095         level_default = level_ps_2
00096 } image_level_enum;
00097 
00098 typedef struct options_tag {
00099         int             iParagraphBreak;
00100         conversion_type eConversionType;
00101         BOOL            bHideHiddenText;
00102         BOOL            bRemoveRemovedText;
00103         BOOL            bUseLandscape;
00104         encoding_type   eEncoding;
00105         int             iPageHeight;            /* In points */
00106         int             iPageWidth;             /* In points */
00107         image_level_enum        eImageLevel;
00108 #if defined(__riscos)
00109         BOOL            bAutofiletypeAllowed;
00110         int             iScaleFactor;           /* As a percentage */
00111 #endif /* __riscos */
00112 } options_type;
00113 
00114 /* Property Set Storage */
00115 typedef struct pps_tag {
00116         ULONG   ulSB;
00117         ULONG   ulSize;
00118 } pps_type;
00119 typedef struct pps_info_tag {
00120         pps_type        tWordDocument;  /* Text stream */
00121         pps_type        tData;          /* Data stream */
00122         pps_type        tTable;         /* Table stream */
00123         pps_type        tSummaryInfo;   /* Summary Information */
00124         pps_type        tDocSummaryInfo;/* Document Summary Information */
00125         pps_type        t0Table;        /* Table 0 stream */
00126         pps_type        t1Table;        /* Table 1 stream */
00127 } pps_info_type;
00128 
00129 /* Record of data block information */
00130 typedef struct data_block_tag {
00131         ULONG   ulFileOffset;
00132         ULONG   ulDataPos;
00133         ULONG   ulLength;
00134 } data_block_type;
00135 
00136 /* Record of text block information */
00137 typedef struct text_block_tag {
00138         ULONG   ulFileOffset;
00139         ULONG   ulCharPos;
00140         ULONG   ulLength;
00141         BOOL    bUsesUnicode;   /* This block uses 16 bits per character */
00142         USHORT  usPropMod;
00143 } text_block_type;
00144 
00145 /* Record of the document block information */
00146 typedef struct document_block_tag {
00147         time_t  tCreateDate;            /* Unix timestamp */
00148         time_t  tRevisedDate;           /* Unix timestamp */
00149         USHORT  usDefaultTabWidth;      /* In twips */
00150         UCHAR   ucHdrFtrSpecification;
00151 } document_block_type;
00152 
00153 /* Record of table-row block information */
00154 typedef struct row_block_tag {
00155         ULONG   ulFileOffsetStart;
00156         ULONG   ulFileOffsetEnd;
00157         ULONG   ulCharPosStart;
00158         ULONG   ulCharPosEnd;
00159         short   asColumnWidth[TABLE_COLUMN_MAX+1];      /* In twips */
00160         UCHAR   ucNumberOfColumns;
00161         UCHAR   ucBorderInfo;
00162 } row_block_type;
00163 
00164 /* Various level types */
00165 typedef enum level_type_tag {
00166         level_type_none = 0,
00167         level_type_outline,
00168         level_type_numbering,
00169         level_type_sequence,
00170         level_type_pause
00171 } level_type_enum;
00172 
00173 typedef enum list_id_tag {
00174         no_list = 0,
00175         text_list,
00176         footnote_list,
00177         hdrftr_list,
00178         macro_list,
00179         annotation_list,
00180         endnote_list,
00181         textbox_list,
00182         hdrtextbox_list,
00183         end_of_lists
00184 } list_id_enum;
00185 
00186 /* Linked list of style description information */
00187 typedef struct style_block_tag {
00188         ULONG   ulFileOffset;   /* The style start with this character */
00189         list_id_enum    eListID;/* The fileoffset is in this list */
00190         BOOL    bNumPause;
00191         BOOL    bNoRestart;     /* Don't restart by more significant levels */
00192         USHORT  usIstd;         /* Current style */
00193         USHORT  usIstdNext;     /* Next style unless overruled */
00194         USHORT  usStartAt;      /* Number at the start of a list */
00195         USHORT  usBeforeIndent; /* Vertical indent before paragraph in twips */
00196         USHORT  usAfterIndent;  /* Vertical indent after paragraph in twips */
00197         USHORT  usListIndex;    /* Before Word 8 this field was not filled */
00198         USHORT  usListChar;     /* Character for an itemized list (Unicode) */
00199         short   sLeftIndent;    /* Left indentation in twips */
00200         short   sLeftIndent1;   /* First line left indentation in twips */
00201         short   sRightIndent;   /* Right indentation in twips */
00202         UCHAR   ucAlignment;
00203         UCHAR   ucNFC;          /* Number format code */
00204         UCHAR   ucNumLevel;
00205         UCHAR   ucListLevel;    /* Before Word 8 this field was not filled */
00206         char    szListChar[4];  /* Character for an itemized list */
00207 } style_block_type;
00208 
00209 /* Font description information */
00210 typedef struct font_block_tag {
00211         ULONG   ulFileOffset;
00212         USHORT  usFontStyle;
00213         USHORT  usFontSize;
00214         UCHAR   ucFontNumber;
00215         UCHAR   ucFontColor;
00216 } font_block_type;
00217 
00218 /* Picture description information */
00219 typedef struct picture_block_tag {
00220         ULONG   ulFileOffset;
00221         ULONG   ulFileOffsetPicture;
00222         ULONG   ulPictureOffset;
00223 } picture_block_type;
00224 
00225 /* Section description information */
00226 typedef struct section_block_tag {
00227         BOOL    bNewPage;
00228         USHORT  usNeedPrevLvl;          /* Print previous level numbers */
00229         USHORT  usHangingIndent;
00230         UCHAR   aucNFC[9];              /* Number format code */
00231         UCHAR   ucHdrFtrSpecification;  /* Which headers/footers Word < 8 */
00232 } section_block_type;
00233 
00234 /* Header/footer description information */
00235 typedef struct hdrftr_block_tag {
00236         output_type     *pText;
00237         long            lHeight;        /* In DrawUnits */
00238 } hdrftr_block_type;
00239 
00240 /* Footnote description information */
00241 typedef struct footnote_block_tag {
00242         char            *szText;
00243 } footnote_block_type;
00244 
00245 /* List description information */
00246 typedef struct list_block_tag {
00247         ULONG   ulStartAt;      /* Number at the start of a list */
00248         BOOL    bNoRestart;     /* Don't restart by more significant levels */
00249         USHORT  usListChar;     /* Character for an itemized list (Unicode) */
00250         short   sLeftIndent;    /* Left indentation in twips */
00251         UCHAR   ucNFC;          /* Number format code */
00252 } list_block_type;
00253 
00254 /* Types of images */
00255 typedef enum imagetype_tag {
00256         imagetype_is_unknown = 0,
00257         imagetype_is_external,
00258         imagetype_is_emf,
00259         imagetype_is_wmf,
00260         imagetype_is_pict,
00261         imagetype_is_jpeg,
00262         imagetype_is_png,
00263         imagetype_is_dib
00264 } imagetype_enum;
00265 
00266 /* Types of compression */
00267 typedef enum compression_tag {
00268         compression_unknown = 0,
00269         compression_none,
00270         compression_rle4,
00271         compression_rle8,
00272         compression_jpeg,
00273         compression_zlib
00274 } compression_enum;
00275 
00276 /* Image information */
00277 typedef struct imagedata_tag {
00278         /* The type of the image */
00279         imagetype_enum  eImageType;
00280         /* Information from the Word document */
00281         size_t  tPosition;
00282         size_t  tLength;
00283         int     iHorSizeScaled;         /* Size in points */
00284         int     iVerSizeScaled;         /* Size in points */
00285         /* Information from the image */
00286         int     iWidth;                 /* Size in pixels */
00287         int     iHeight;                /* Size in pixels */
00288         int     iComponents;            /* Number of color components */
00289         UINT    uiBitsPerComponent;     /* Bits per color component */
00290         BOOL    bAdobe; /* Image includes Adobe comment marker */
00291         compression_enum        eCompression;   /* Type of compression */
00292         BOOL    bColorImage;    /* Is color image */
00293         int     iColorsUsed;    /* 0 = uses the maximum number of colors */
00294         UCHAR   aucPalette[256][3];     /* RGB palette */
00295 } imagedata_type;
00296 
00297 typedef enum row_info_tag {
00298         found_nothing,
00299         found_a_cell,
00300         found_not_a_cell,
00301         found_end_of_row,
00302         found_not_end_of_row
00303 } row_info_enum;
00304 
00305 typedef enum notetype_tag {
00306         notetype_is_footnote,
00307         notetype_is_endnote,
00308         notetype_is_unknown
00309 } notetype_enum;
00310 
00311 typedef enum image_info_tag {
00312         image_no_information,
00313         image_minimal_information,
00314         image_full_information
00315 } image_info_enum;
00316 
00317 #endif /* __wordtypes_h */

Generated by  doxygen 1.6.2