home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / anwor032.zip / antiword.0.32 / wordconst.h < prev    next >
Text File  |  2001-10-02  |  7KB  |  211 lines

  1. /*
  2.  * wordconst.h
  3.  * Copyright (C) 1998-2000 A.J. van Os; Released under GPL
  4.  *
  5.  * Description:
  6.  * Constants and macros for the interpretation of MS Word files
  7.  */
  8.  
  9. #if !defined(__wordconst_h)
  10. #define __wordconst_h 1
  11.  
  12. /*
  13.  * A bit odd definition of the type Boolean, but RISC OS insists
  14.  * on this and Unix doesn't mind.
  15.  */
  16. #if !defined(BOOL)
  17. #define BOOL int
  18. #define TRUE 1
  19. #define FALSE 0
  20. #endif /* !BOOL */
  21.  
  22. /* Block sizes */
  23. #define HEADER_SIZE            768
  24. #define BIG_BLOCK_SIZE            512
  25. #define PROPERTY_SET_STORAGE_SIZE    128
  26. #define SMALL_BLOCK_SIZE         64
  27. /* Switch size of Depot use */
  28. #define MIN_SIZE_FOR_BBD_USE        0x1000
  29. /* Table sizes */
  30. #define TABLE_COLUMN_MAX         31
  31. /* Maximum number of tabs positions in a paragraph */
  32. #define NUMBER_OF_TABS_MAX         64
  33. /* Font sizes (in half-points) */
  34. #define MIN_FONT_SIZE              8
  35. #define DEFAULT_FONT_SIZE         20
  36. #define MAX_FONT_SIZE            240
  37. /* Font styles */
  38. #define FONT_REGULAR            0x00
  39. #define FONT_BOLD            0x01
  40. #define FONT_ITALIC            0x02
  41. #define FONT_UNDERLINE            0x04
  42. #define FONT_CAPITALS            0x08
  43. #define FONT_SMALL_CAPITALS        0x10
  44. #define FONT_STRIKE            0x20
  45. #define FONT_HIDDEN            0x40
  46. /* Font colors */
  47. #define FONT_COLOR_DEFAULT         0
  48. #define FONT_COLOR_BLACK         1
  49. #define FONT_COLOR_RED             6
  50. /* End of a block chain */
  51. #define END_OF_CHAIN            (-2)
  52. /* Properties modifier without value */
  53. #define IGNORE_PROPMOD            0
  54. /* Types of lists */
  55. #define LIST_ARABIC_NUM            0x00
  56. #define LIST_ROMAN_NUM_UPPER        0x01
  57. #define LIST_ROMAN_NUM_LOWER        0x02
  58. #define LIST_UPPER_ALPHA        0x03
  59. #define LIST_LOWER_ALPHA        0x04
  60. #define LIST_ORDINAL_NUM        0x05
  61. #define LIST_BULLETS            0xff
  62. /* Types of paragraph alignment */
  63. #define ALIGNMENT_LEFT            0x00
  64. #define ALIGNMENT_CENTER        0x01
  65. #define ALIGNMENT_RIGHT            0x02
  66. #define ALIGNMENT_JUSTIFY        0x03
  67.  
  68. /* Macros */
  69.     /* Get macros */
  70. #define ucGetByte(i,a)        ((unsigned char)(a[i]))
  71. #define usGetWord(i,a)        ((unsigned short)(a[(i)+1])<<8|\
  72.                     (unsigned short)(a[i]))
  73. #define ulGetLong(i,a)        ((unsigned long)(a[i])|\
  74.                     (unsigned long)(a[(i)+1])<<8|\
  75.                     (unsigned long)(a[(i)+2])<<16|\
  76.                     (unsigned long)(a[(i)+3])<<24)
  77.     /* Font style macros */
  78. #define bIsBold(x)        (((x) & FONT_BOLD) == FONT_BOLD)
  79. #define bIsItalic(x)        (((x) & FONT_ITALIC) == FONT_ITALIC)
  80. #define bIsUnderline(x)        (((x) & FONT_UNDERLINE) == FONT_UNDERLINE)
  81. #define bIsCapitals(x)        (((x) & FONT_CAPITALS) == FONT_CAPITALS)
  82. #define bIsSmallCapitals(x)    (((x) & FONT_SMALL_CAPITALS) == FONT_SMALL_CAPITALS)
  83. #define bIsStrike(x)        (((x) & FONT_STRIKE) == FONT_STRIKE)
  84. #define bIsHidden(x)        (((x) & FONT_HIDDEN) == FONT_HIDDEN)
  85.     /* Computation macros */
  86. #if defined(__riscos)
  87. /* From Words half-points to draw units (plus a percentage) */
  88. #define lWord2DrawUnits00(x)    ((long)(x) * 320)
  89. #define lWord2DrawUnits20(x)    ((long)(x) * 384)
  90. #define lToBaseLine(x)        ((long)(x) *  45)
  91. #endif /* __riscos */
  92. /* From twips (1/20 of a point) to millipoints */
  93. #define lTwips2MilliPoints(x)    ((long)(x) * 50)
  94. /* From default characters (16 OS units wide) to millipoints */
  95. #define lChar2MilliPoints(x)    ((long)(x) * 6400)
  96. #define iMilliPoints2Char(x)    (int)(((long)(x) + 3200) / 6400)
  97. #define iDrawUnits2Char(x)    (int)(((long)(x) + 2048) / 4096)
  98. /* From draw units (1/180*256 inch) to millipoints (1/72*1000 inch) */
  99. #define lDrawUnits2MilliPoints(x)    (((long)(x) * 25 +  8) / 16)
  100. #define lMilliPoints2DrawUnits(x)    (((long)(x) * 16 + 12) / 25)
  101. #define lPoints2DrawUnits(x)        ((long)(x) * 640)
  102. #define dDrawUnits2Points(x)        ((double)(x) / 640.0)
  103.  
  104. /* Special characters */
  105. #define IGNORE_CHARACTER    0x00    /* ^@ */
  106. #define PICTURE            0x01    /* ^A */
  107. #define FOOTNOTE_OR_ENDNOTE    0x02    /* ^B */
  108. #define ANNOTATION        0x05    /* ^E */
  109. #define TABLE_SEPARATOR        0x07    /* ^G */
  110. #define FRAME            0x08    /* ^H */
  111. #define TAB            0x09    /* ^I */
  112. /* End of line characters */
  113. #define HARD_RETURN        0x0b    /* ^K */
  114. #define FORM_FEED        0x0c    /* ^L */
  115. #define PAR_END            0x0d    /* ^M */
  116. #define COLUMN_FEED        0x0e    /* ^N */
  117. /* Embedded stuff */
  118. #define START_EMBEDDED        0x13    /* ^S */
  119. #define END_IGNORE        0x14    /* ^T */
  120. #define END_EMBEDDED        0x15    /* ^U */
  121. /* Special characters */
  122. #if defined(DEBUG)
  123. #define FILLER_CHAR        '~'
  124. #else
  125. #define FILLER_CHAR        ' '
  126. #endif /* DEBUG */
  127. #define TABLE_SEPARATOR_CHAR    '|'
  128. /* Pseudo characters. These must be outside the Unicode range */
  129. #define FOOTNOTE_CHAR        ((unsigned long)0xffff + 1)
  130. #define ENDNOTE_CHAR        ((unsigned long)0xffff + 2)
  131. #define UNKNOWN_NOTE_CHAR    ((unsigned long)0xffff + 3)
  132.  
  133. /* Charactercodes as used by Word */
  134. #define WORD_UNBREAKABLE_JOIN        0x1e
  135. #define WORD_SOFT_HYPHEN        0x1f
  136.  
  137. /* Unicode characters */
  138. #define UNICODE_COPYRIGHT_SIGN        0x00a9
  139. #define UNICODE_SMALL_F_HOOK        0x0192
  140. #define UNICODE_MODIFIER_CIRCUMFLEX    0x02c6
  141. #define UNICODE_SMALL_TILDE        0x02dc
  142. #define UNICODE_EN_QUAD            0x2000
  143. #define UNICODE_EM_QUAD            0x2001
  144. #define UNICODE_EN_SPACE        0x2002
  145. #define UNICODE_EM_SPACE        0x2003
  146. #define UNICODE_THREE_PER_EM_SPACE    0x2004
  147. #define UNICODE_FOUR_PER_EM_SPACE    0x2005
  148. #define UNICODE_SIX_PER_EM_SPACE    0x2006
  149. #define UNICODE_FIGURE_SPACE        0x2007
  150. #define UNICODE_PUNCTUATION_SPACE    0x2008
  151. #define UNICODE_THIN_SPACE        0x2009
  152. #define UNICODE_HAIR_SPACE        0x200a
  153. #define UNICODE_ZERO_WIDTH_SPACE    0x200b
  154. #define UNICODE_HYPHEN            0x2010
  155. #define UNICODE_NON_BREAKING_HYPHEN    0x2011
  156. #define UNICODE_FIGURE_DASH        0x2012
  157. #define UNICODE_EN_DASH            0x2013
  158. #define UNICODE_EM_DASH            0x2014
  159. #define UNICODE_HORIZONTAL_BAR        0x2015
  160. #define UNICODE_DOUBLE_VERTICAL_LINE    0x2016
  161. #define UNICODE_DOUBLE_LOW_LINE        0x2017
  162. #define UNICODE_LEFT_SINGLE_QMARK    0x2018
  163. #define UNICODE_RIGHT_SINGLE_QMARK    0x2019
  164. #define UNICODE_SINGLE_LOW_9_QMARK    0x201a
  165. #define UNICODE_SINGLE_HIGH_REV_9_QMARK    0x201b
  166. #define UNICODE_LEFT_DOUBLE_QMARK    0x201c
  167. #define UNICODE_RIGHT_DOUBLE_QMARK    0x201d
  168. #define UNICODE_DOUBLE_LOW_9_QMARK    0x201e
  169. #define UNICODE_DOUBLE_HIGH_REV_9_QMARK    0x201f
  170. #define UNICODE_DAGGER            0x2020
  171. #define UNICODE_DOUBLE_DAGGER        0x2021
  172. #define UNICODE_BULLET            0x2022
  173. #define UNICODE_ONE_DOT_LEADER        0x2024
  174. #define UNICODE_ELLIPSIS        0x2026
  175. #define UNICODE_HYPHENATION_POINT    0x2027
  176. #define UNICODE_PRIME            0x2032
  177. #define UNICODE_DOUBLE_PRIME        0x2033
  178. #define UNICODE_SINGLE_LEFT_ANGLE_QMARK    0x2039
  179. #define UNICODE_SINGLE_RIGHT_ANGLE_QMARK    0x203a
  180. #define UNICODE_UNDERTIE        0x203f
  181. #define UNICODE_FRACTION_SLASH        0x2044
  182. #define UNICODE_EURO_SIGN        0x20ac
  183. #define UNICODE_DIAMOND            0x20df
  184. #define UNICODE_TRADEMARK_SIGN        0x2122
  185. #define UNICODE_MINUS_SIGN        0x2212
  186. #define UNICODE_DIVISION_SLASH        0x2215
  187. #define UNICODE_ASTERISK_OPERATOR    0x2217
  188. #define UNICODE_RATIO            0x2236
  189. #define UNICODE_TILDE_OPERATOR        0x223c
  190. #define UNICODE_BLACK_SQUARE        0x25a0
  191. #define UNICODE_MS_DIAMOND        0xf075
  192. #define UNICODE_MS_BULLET1        0xf093
  193. #define UNICODE_MS_UNDERTIE        0xf0a4
  194. #define UNICODE_MS_BLACK_SQUARE        0xf0a7
  195. #define UNICODE_MS_BULLET2        0xf0b7
  196. #define UNICODE_MS_COPYRIGHT_SIGN    0xf0d3
  197.  
  198. #if defined(__riscos)
  199. #define OUR_ELLIPSIS            0x8c
  200. #define OUR_BULLET            0x8f
  201. #define OUR_EM_DASH            0x98
  202. #define OUR_UNBREAKABLE_JOIN        0x99
  203. #else
  204. #define OUR_BULLET            '+'
  205. #define OUR_EM_DASH            '-'
  206. #define OUR_UNBREAKABLE_JOIN        '-'
  207. #endif /* __riscos */
  208. #define OUR_DIAMOND            '-'
  209.  
  210. #endif /* __wordconst_h */
  211.