home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / anwor032.zip / antiword.0.32 / wordtypes.h < prev    next >
Text File  |  2001-07-23  |  6KB  |  239 lines

  1. /*
  2.  * wordtypes.h
  3.  * Copyright (C) 1998-2001 A.J. van Os; Released under GPL
  4.  *
  5.  * Description:
  6.  * Typedefs for the interpretation of MS Word files
  7.  */
  8.  
  9. #if !defined(__wordtypes_h)
  10. #define __wordtypes_h 1
  11.  
  12. #if defined(__riscos)
  13. typedef struct diagram_tag {
  14.     draw_diag    tInfo;
  15.     wimp_w        tMainWindow;
  16.     wimp_w        tScaleWindow;
  17.     long        lXleft;            /* In DrawUnits */
  18.     long        lYtop;            /* In DrawUnits */
  19.     size_t        tMemorySize;
  20.     int        iScaleFactorCurr;    /* In percentage */
  21.     int        iScaleFactorTemp;    /* In percentage */
  22.     char        szFilename[19+1];
  23. } diagram_type;
  24. #else
  25. typedef struct diagram_tag {
  26.     FILE        *pOutFile;
  27.     long        lXleft;            /* In DrawUnits */
  28.     long        lYtop;            /* In DrawUnits */
  29. } diagram_type;
  30. typedef unsigned char    draw_fontref;
  31. #endif /* __riscos */
  32.  
  33. typedef struct output_tag {
  34.       char        *szStorage;
  35.     long        lStringWidth;        /* In millipoints */
  36.     size_t        tStorageSize;
  37.     int        iNextFree;
  38.     int        iColor;
  39.     short        sFontsize;
  40.     unsigned char    ucFontstyle;
  41.     draw_fontref    tFontRef;
  42.     struct output_tag    *pPrev;
  43.     struct output_tag    *pNext;
  44. } output_type;
  45.  
  46. /* Types of encoding */
  47. typedef enum encoding_tag {
  48.     encoding_neutral = 100,
  49.     encoding_iso_8859_1 = 801,
  50.     encoding_iso_8859_2 = 802,
  51.     encoding_utf8 = 1601
  52. } encoding_type;
  53.  
  54. /* Font translation table entry */
  55. typedef struct font_table_tag {
  56.     unsigned char    ucWordFontnumber;
  57.     unsigned char    ucFontstyle;
  58.     unsigned char    ucInUse;
  59.     char        szWordFontname[65];
  60.     char        szOurFontname[33];
  61. } font_table_type;
  62.  
  63. /* Options */
  64. typedef enum image_level_tag {
  65.     level_gs_special = 0,
  66.     level_no_images,
  67.     level_ps_2,
  68.     level_ps_3,
  69.     level_default = level_ps_2
  70. } image_level_enum;
  71.  
  72. typedef struct options_tag {
  73.     int        iParagraphBreak;
  74.     BOOL        bUseOutlineFonts;
  75.     BOOL        bHideHiddenText;
  76.     BOOL        bUseLandscape;
  77.     encoding_type    eEncoding;
  78.     int        iPageHeight;        /* In points */
  79.     int        iPageWidth;        /* In points */
  80.     image_level_enum    eImageLevel;
  81. #if defined(__riscos)
  82.     BOOL        bAutofiletypeAllowed;
  83.     int        iScaleFactor;        /* As a percentage */
  84. #endif /* __riscos */
  85. } options_type;
  86.  
  87. /* Property Set Storage */
  88. typedef struct pps_tag {
  89.     long    lSize;
  90.     long    lSb;
  91. } pps_type;
  92. typedef struct pps_info_tag {
  93.     pps_type    tWordDocument;
  94.     pps_type    tData;
  95.     pps_type    t0Table;
  96.     pps_type    t1Table;
  97. } pps_info_type;
  98.  
  99. /* Record of data block information */
  100. typedef struct data_block_tag {
  101.     long    lFileOffset;
  102.     long    lDataOffset;
  103.     long    lLength;
  104. } data_block_type;
  105.  
  106. /* Record of text block information */
  107. typedef struct text_block_tag {
  108.     long    lFileOffset;
  109.     long    lTextOffset;
  110.     long    lLength;
  111.     BOOL    bUsesUnicode;    /* This block uses 16 bits per character */
  112.     unsigned short    usPropMod;
  113. } text_block_type;
  114.  
  115. /* Record of table-row block information */
  116. typedef struct row_block_tag {
  117.     long    lFileOffsetStart;
  118.     long    lFileOffsetEnd;
  119.     long    lTextOffsetStart;
  120.     long    lTextOffsetEnd;
  121.     int    iColumnWidthSum;            /* In twips */
  122.     short    asColumnWidth[TABLE_COLUMN_MAX+1];    /* In twips */
  123.     unsigned char    ucNumberOfColumns;
  124. } row_block_type;
  125.  
  126. /* Linked list of style description information */
  127. typedef struct style_block_tag {
  128.     long    lFileOffset;
  129.     BOOL    bInList;
  130.     BOOL    bUnmarked;
  131.     short    sLeftIndent;    /* Left indentation in twips */
  132.     short    sRightIndent;    /* Right indentation in twips */
  133.     unsigned char    ucStyle;
  134.     unsigned char    ucAlignment;
  135.     unsigned char    ucListType;
  136.     unsigned char    ucListLevel;
  137.     unsigned char    ucListCharacter;
  138. } style_block_type;
  139. typedef struct style_desc_tag {
  140.     style_block_type    tInfo;
  141.     struct style_desc_tag    *pNext;
  142. } style_desc_type;
  143.  
  144. /* Linked list of font description information */
  145. typedef struct font_block_tag {
  146.     long    lFileOffset;
  147.     short        sFontsize;
  148.     unsigned char    ucFontnumber;
  149.     unsigned char    ucFontcolor;
  150.     unsigned char    ucFontstyle;
  151. } font_block_type;
  152. typedef struct font_desc_tag {
  153.     font_block_type    tInfo;
  154.     struct font_desc_tag    *pNext;
  155. } font_desc_type;
  156.  
  157. /* Linked list of picture description information */
  158. typedef struct picture_block_tag {
  159.     long    lFileOffset;
  160.     long    lFileOffsetPicture;
  161.     long    lPictureOffset;
  162. } picture_block_type;
  163. typedef struct picture_desc_tag {
  164.     picture_block_type    tInfo;
  165.     struct picture_desc_tag    *pNext;
  166. } picture_desc_type;
  167.  
  168. /* Types of images */
  169. typedef enum imagetype_tag {
  170.     imagetype_is_unknown = 0,
  171.     imagetype_is_external,
  172.     imagetype_is_emf,
  173.     imagetype_is_wmf,
  174.     imagetype_is_pict,
  175.     imagetype_is_jpeg,
  176.     imagetype_is_png,
  177.     imagetype_is_dib
  178. } imagetype_enum;
  179.  
  180. /* Types of compression */
  181. typedef enum compression_tag {
  182.     compression_unknown = 0,
  183.     compression_none,
  184.     compression_rle4,
  185.     compression_rle8,
  186.     compression_jpeg,
  187.     compression_zlib
  188. } compression_enum;
  189.  
  190. /* Image information */
  191. typedef struct imagedata_tag {
  192.     /* The type of the image */
  193.     imagetype_enum    eImageType;
  194.     /* Information from the Word document */
  195.     int    iPosition;
  196.     int    iLength;
  197.     int    iHorSizeScaled;        /* Size in points */
  198.     int    iVerSizeScaled;        /* Size in points */
  199.     /* Information from the image */
  200.     int    iWidth;            /* Size in pixels */
  201.     int    iHeight;        /* Size in pixels */
  202.     int    iComponents;        /* Number of color components */
  203.     int    iBitsPerComponent;    /* Bits per color component */
  204.     BOOL    bAdobe;    /* Image includes Adobe comment marker */
  205.     compression_enum    eCompression;    /* Type of compression */
  206.     BOOL    bColorImage;    /* Is color image */
  207.     int    iColorsUsed;    /* 0 = uses the maximum number of colors */
  208.     unsigned char aucPalette[256][3];    /* RGB palette */
  209. } imagedata_type;
  210.  
  211. typedef enum row_info_tag {
  212.     found_nothing,
  213.     found_a_cell,
  214.     found_not_a_cell,
  215.     found_end_of_row,
  216.     found_not_end_of_row
  217. } row_info_enum;
  218.  
  219. typedef enum list_id_tag {
  220.     text_list,
  221.     footnote_list,
  222.     endnote_list,
  223.     end_of_lists
  224. } list_id_enum;
  225.  
  226. typedef enum notetype_tag {
  227.     notetype_is_footnote,
  228.     notetype_is_endnote,
  229.     notetype_is_unknown
  230. } notetype_enum;
  231.  
  232. typedef enum image_info_tag {
  233.     image_no_information,
  234.     image_minimal_information,
  235.     image_full_information
  236. } image_info_enum;
  237.  
  238. #endif /* __wordtypes_h */
  239.