examples/PIPS/antiword/inc/wordconst.h

00001 /*
00002  * wordconst.h
00003  * Copyright (C) 1998-2004 A.J. van Os; Released under GNU GPL
00004  *
00005  * Description:
00006  * Constants and macros for the interpretation of MS Word files
00007  */
00008 
00009 #if !defined(__wordconst_h)
00010 #define __wordconst_h 1
00011 
00012 /*
00013  * A bit odd definition of the type Boolean, but RISC OS insists
00014  * on this and Linux/Unix doesn't mind.
00015  */
00016 #if !defined(BOOL)
00017 #define BOOL int
00018 #define TRUE 1
00019 #define FALSE 0
00020 #endif /* !BOOL */
00021 
00022 /* Block sizes */
00023 #define HEADER_SIZE                     768
00024 #define BIG_BLOCK_SIZE                  512
00025 #define PROPERTY_SET_STORAGE_SIZE       128
00026 #define SMALL_BLOCK_SIZE                 64
00027 /* Switch size of Depot use */
00028 #define MIN_SIZE_FOR_BBD_USE            0x1000
00029 /* Table sizes */
00030 #define TABLE_COLUMN_MAX                 31
00031 /* Maximum number of tabs positions in a paragraph */
00032 #define NUMBER_OF_TABS_MAX               64
00033 /* Font sizes (in half-points) */
00034 #define MIN_FONT_SIZE                     8
00035 #define DEFAULT_FONT_SIZE                20
00036 #define MAX_FONT_SIZE                   240
00037 #define MIN_TABLEFONT_SIZE               16
00038 #define MAX_TABLEFONT_SIZE               20
00039 /* Font styles */
00040 #define FONT_REGULAR                    0x0000
00041 #define FONT_BOLD                       0x0001
00042 #define FONT_ITALIC                     0x0002
00043 #define FONT_UNDERLINE                  0x0004
00044 #define FONT_CAPITALS                   0x0008
00045 #define FONT_SMALL_CAPITALS             0x0010
00046 #define FONT_STRIKE                     0x0020
00047 #define FONT_HIDDEN                     0x0040
00048 #define FONT_MARKDEL                    0x0080
00049 #define FONT_SUPERSCRIPT                0x0100
00050 #define FONT_SUBSCRIPT                  0x0200
00051 /* Font colors */
00052 #define FONT_COLOR_DEFAULT               0
00053 #define FONT_COLOR_BLACK                 1
00054 #define FONT_COLOR_BLUE                  2
00055 #define FONT_COLOR_CYAN                  3
00056 #define FONT_COLOR_GREEN                 4
00057 #define FONT_COLOR_MAGENTA               5
00058 #define FONT_COLOR_RED                   6
00059 #define FONT_COLOR_YELLOW                7
00060 #define FONT_COLOR_WHITE                 8
00061 /* Special block numbers */
00062 #define END_OF_CHAIN                    0xfffffffeUL
00063 #define UNUSED_BLOCK                    0xffffffffUL
00064 /* Blocksize (512 bytes) and maximum filesize (4 GB) gives 0..7fffff */
00065 #define MAX_BLOCKNUMBER                 0x007fffffUL
00066 /* Invalid character position */
00067 #define CP_INVALID                      0xffffffffUL
00068 /* Invalid file offset */
00069 #define FC_INVALID                      0xffffffffUL
00070 /* Special istd values */
00071 #define ISTD_INVALID                    USHRT_MAX
00072 #define ISTD_NORMAL                     0
00073 /* Properties modifier without value */
00074 #define IGNORE_PROPMOD                  0
00075 /* Types of lists */
00076 #define LIST_ARABIC_NUM                 0x00
00077 #define LIST_UPPER_ROMAN                0x01
00078 #define LIST_LOWER_ROMAN                0x02
00079 #define LIST_UPPER_ALPHA                0x03
00080 #define LIST_LOWER_ALPHA                0x04
00081 #define LIST_ORDINAL_NUM                0x05
00082 #define LIST_NUMBER_TXT                 0x06
00083 #define LIST_ORDINAL_TXT                0x07
00084 #define LIST_OUTLINE_NUM                0x16
00085 #define LIST_SPECIAL                    0x17
00086 #define LIST_SPECIAL2                   0x19
00087 #define LIST_BULLETS                    0xff
00088 /* Types of paragraph alignment */
00089 #define ALIGNMENT_LEFT                  0x00
00090 #define ALIGNMENT_CENTER                0x01
00091 #define ALIGNMENT_RIGHT                 0x02
00092 #define ALIGNMENT_JUSTIFY               0x03
00093 /* Minimum vertical space before and after a heading line */
00094 #define HEADING_GAP                     120     /* twips */
00095 /* Style identifier */
00096 #define STI_USER                        0xffe
00097 #define STI_NIL                         0xfff
00098 /* Table border style codes */
00099 #define TABLE_BORDER_TOP                0x01
00100 #define TABLE_BORDER_LEFT               0x02
00101 #define TABLE_BORDER_BOTTOM             0x04
00102 #define TABLE_BORDER_RIGHT              0x08
00103 
00104 /* Macros */
00105         /* Get macros */
00106 #define ucGetByte(i,a)          ((unsigned char)(a[i]))
00107 #define usGetWord(i,a)          ((unsigned short)\
00108                                         ((unsigned int)(a[(i)+1])<<8|\
00109                                          (unsigned int)(a[i])))
00110 #define ulGetLong(i,a)          ((unsigned long)(a[i])|\
00111                                         (unsigned long)(a[(i)+1])<<8|\
00112                                         (unsigned long)(a[(i)+2])<<16|\
00113                                         (unsigned long)(a[(i)+3])<<24)
00114 #define usGetWordBE(i,a)        ((unsigned short)\
00115                                         ((unsigned int)(a[i])<<8|\
00116                                          (unsigned int)(a[(i)+1])))
00117 #define ulGetLongBE(i,a)        ((unsigned long)(a[(i)+3])|\
00118                                         (unsigned long)(a[(i)+2])<<8|\
00119                                         (unsigned long)(a[(i)+1])<<16|\
00120                                         (unsigned long)(a[i])<<24)
00121         /* Font style macros */
00122 #define bIsBold(x)              (((x) & FONT_BOLD) == FONT_BOLD)
00123 #define bIsItalic(x)            (((x) & FONT_ITALIC) == FONT_ITALIC)
00124 #define bIsUnderline(x)         (((x) & FONT_UNDERLINE) == FONT_UNDERLINE)
00125 #define bIsCapitals(x)          (((x) & FONT_CAPITALS) == FONT_CAPITALS)
00126 #define bIsSmallCapitals(x)     (((x) & FONT_SMALL_CAPITALS) == FONT_SMALL_CAPITALS)
00127 #define bIsStrike(x)            (((x) & FONT_STRIKE) == FONT_STRIKE)
00128 #define bIsHidden(x)            (((x) & FONT_HIDDEN) == FONT_HIDDEN)
00129 #define bIsMarkDel(x)           (((x) & FONT_MARKDEL) == FONT_MARKDEL)
00130 #define bIsSuperscript(x)       (((x) & FONT_SUPERSCRIPT) == FONT_SUPERSCRIPT)
00131 #define bIsSubscript(x)         (((x) & FONT_SUBSCRIPT) == FONT_SUBSCRIPT)
00132         /* Table border style code macros */
00133 #define bIsTableBorderTop(x)    (((x) & TABLE_BORDER_TOP) == TABLE_BORDER_TOP)
00134 #define bIsTableBorderLeft(x)   (((x) & TABLE_BORDER_LEFT) == TABLE_BORDER_LEFT)
00135 #define bIsTableBorderBottom(x) (((x) & TABLE_BORDER_BOTTOM) == TABLE_BORDER_BOTTOM)
00136 #define bIsTableBorderRight(x)  (((x) & TABLE_BORDER_RIGHT) == TABLE_BORDER_RIGHT)
00137         /* Computation macros */
00138 #if defined(__riscos)
00139 /* From Words half-points to draw units (plus a percentage) */
00140 #define lWord2DrawUnits00(x)    ((long)(x) * 320)
00141 #define lWord2DrawUnits20(x)    ((long)(x) * 384)
00142 #define lToBaseLine(x)          ((long)(x) *  45)
00143 #endif /* __riscos */
00144 /* From twips (1/20 of a point) to millipoints */
00145 #define lTwips2MilliPoints(x)   ((long)(x) * 50)
00146 /* From twips (1/20 of a point) to points */
00147 #define dTwips2Points(x)        ((double)(x) / 20.0)
00148 /* From default characters (16 OS units wide) to millipoints */
00149 #define lChar2MilliPoints(x)    ((long)(x) * 6400)
00150 #define iMilliPoints2Char(x)    (int)(((long)(x) + 3200) / 6400)
00151 #define iDrawUnits2Char(x)      (int)(((long)(x) + 2048) / 4096)
00152 /* From draw units (1/180*256 inch) to millipoints (1/72*1000 inch) */
00153 #define lDrawUnits2MilliPoints(x)       (((long)(x) * 25 +  8) / 16)
00154 #define lMilliPoints2DrawUnits(x)       (((long)(x) * 16 + 12) / 25)
00155 #define lPoints2DrawUnits(x)            ((long)(x) * 640)
00156 #define dDrawUnits2Points(x)            ((double)(x) / 640.0)
00157 
00158 /* Special characters */
00159 #define IGNORE_CHARACTER        0x00    /* ^@ */
00160 #define PICTURE                 0x01    /* ^A */
00161 #define FOOTNOTE_OR_ENDNOTE     0x02    /* ^B */
00162 #define FOOTNOTE_SEPARATOR      0x03    /* ^C */
00163 #define FOOTNOTE_CONTINUATION   0x04    /* ^D */
00164 #define ANNOTATION              0x05    /* ^E */
00165 #define TABLE_SEPARATOR         0x07    /* ^G */
00166 #define FRAME                   0x08    /* ^H */
00167 #define TAB                     0x09    /* ^I */
00168 /* End of line characters */
00169 #define LINE_FEED               0x0a    /* ^J */
00170 #define HARD_RETURN             0x0b    /* ^K */
00171 #define PAGE_BREAK              0x0c    /* ^L */
00172 #define PAR_END                 0x0d    /* ^M */
00173 #define COLUMN_FEED             0x0e    /* ^N */
00174 /* Embedded stuff */
00175 #define START_EMBEDDED          0x13    /* ^S */
00176 #define END_IGNORE              0x14    /* ^T */
00177 #define END_EMBEDDED            0x15    /* ^U */
00178 /* Special characters */
00179 #if defined(DEBUG)
00180 #define FILLER_CHAR             '~'
00181 #else
00182 #define FILLER_CHAR             ' '
00183 #endif /* DEBUG */
00184 #define TABLE_SEPARATOR_CHAR    '|'
00185 /* Pseudo characters. These must be outside the Unicode range */
00186 #define FOOTNOTE_CHAR           ((unsigned long)0xffff + 1)
00187 #define ENDNOTE_CHAR            ((unsigned long)0xffff + 2)
00188 #define UNKNOWN_NOTE_CHAR       ((unsigned long)0xffff + 3)
00189 
00190 /* Charactercodes as used by Word */
00191 #define WORD_UNBREAKABLE_JOIN           0x1e
00192 #define WORD_SOFT_HYPHEN                0x1f
00193 
00194 /* Unicode characters */
00195 #define UNICODE_DOUBLE_LEFT_ANGLE_QMARK 0x00ab
00196 #define UNICODE_MIDDLE_DOT              0x00b7
00197 #define UNICODE_DOUBLE_RIGHT_ANGLE_QMARK        0x00bb
00198 #define UNICODE_CAPITAL_D_WITH_STROKE   0x0110
00199 #define UNICODE_SMALL_D_WITH_STROKE     0x0111
00200 #define UNICODE_CAPITAL_LIGATURE_OE     0x0152
00201 #define UNICODE_SMALL_LIGATURE_OE       0x0153
00202 #define UNICODE_SMALL_F_HOOK            0x0192
00203 #define UNICODE_GREEK_CAPITAL_CHI       0x03a7
00204 #define UNICODE_GREEK_SMALL_UPSILON     0x03c5
00205 #define UNICODE_MODIFIER_CIRCUMFLEX     0x02c6
00206 #define UNICODE_SMALL_TILDE             0x02dc
00207 #define UNICODE_SMALL_LETTER_OMEGA      0x03c9
00208 #define UNICODE_EN_QUAD                 0x2000
00209 #define UNICODE_EM_QUAD                 0x2001
00210 #define UNICODE_EN_SPACE                0x2002
00211 #define UNICODE_EM_SPACE                0x2003
00212 #define UNICODE_THREE_PER_EM_SPACE      0x2004
00213 #define UNICODE_FOUR_PER_EM_SPACE       0x2005
00214 #define UNICODE_SIX_PER_EM_SPACE        0x2006
00215 #define UNICODE_FIGURE_SPACE            0x2007
00216 #define UNICODE_PUNCTUATION_SPACE       0x2008
00217 #define UNICODE_THIN_SPACE              0x2009
00218 #define UNICODE_HAIR_SPACE              0x200a
00219 #define UNICODE_ZERO_WIDTH_SPACE        0x200b
00220 #define UNICODE_ZERO_WIDTH_NON_JOINER   0x200c
00221 #define UNICODE_ZERO_WIDTH_JOINER       0x200d
00222 #define UNICODE_LEFT_TO_RIGHT_MARK      0x200e
00223 #define UNICODE_RIGHT_TO_LEFT_MARK      0x200f
00224 #define UNICODE_HYPHEN                  0x2010
00225 #define UNICODE_NON_BREAKING_HYPHEN     0x2011
00226 #define UNICODE_FIGURE_DASH             0x2012
00227 #define UNICODE_EN_DASH                 0x2013
00228 #define UNICODE_EM_DASH                 0x2014
00229 #define UNICODE_HORIZONTAL_BAR          0x2015
00230 #define UNICODE_DOUBLE_VERTICAL_LINE    0x2016
00231 #define UNICODE_DOUBLE_LOW_LINE         0x2017
00232 #define UNICODE_LEFT_SINGLE_QMARK       0x2018
00233 #define UNICODE_RIGHT_SINGLE_QMARK      0x2019
00234 #define UNICODE_SINGLE_LOW_9_QMARK      0x201a
00235 #define UNICODE_SINGLE_HIGH_REV_9_QMARK 0x201b
00236 #define UNICODE_LEFT_DOUBLE_QMARK       0x201c
00237 #define UNICODE_RIGHT_DOUBLE_QMARK      0x201d
00238 #define UNICODE_DOUBLE_LOW_9_QMARK      0x201e
00239 #define UNICODE_DOUBLE_HIGH_REV_9_QMARK 0x201f
00240 #define UNICODE_DAGGER                  0x2020
00241 #define UNICODE_DOUBLE_DAGGER           0x2021
00242 #define UNICODE_BULLET                  0x2022
00243 #define UNICODE_TRIANGULAR_BULLET       0x2023
00244 #define UNICODE_ONE_DOT_LEADER          0x2024
00245 #define UNICODE_TWO_DOT_LEADER          0x2025
00246 #define UNICODE_ELLIPSIS                0x2026
00247 #define UNICODE_HYPHENATION_POINT       0x2027
00248 #define UNICODE_LEFT_TO_RIGHT_EMBEDDING 0x202a
00249 #define UNICODE_RIGHT_TO_LEFT_EMBEDDING 0x202b
00250 #define UNICODE_POP_DIRECTIONAL_FORMATTING      0x202c
00251 #define UNICODE_LEFT_TO_RIGHT_OVERRIDE  0x202d
00252 #define UNICODE_RIGHT_TO_LEFT_OVERRIDE  0x202e
00253 #define UNICODE_NARROW_NO_BREAK_SPACE   0x202f
00254 #define UNICODE_PER_MILLE_SIGN          0x2030
00255 #define UNICODE_PRIME                   0x2032
00256 #define UNICODE_DOUBLE_PRIME            0x2033
00257 #define UNICODE_SINGLE_LEFT_ANGLE_QMARK 0x2039
00258 #define UNICODE_SINGLE_RIGHT_ANGLE_QMARK        0x203a
00259 #define UNICODE_UNDERTIE                0x203f
00260 #define UNICODE_FRACTION_SLASH          0x2044
00261 #define UNICODE_EURO_SIGN               0x20ac
00262 #define UNICODE_CIRCLE                  0x20dd
00263 #define UNICODE_SQUARE                  0x20de
00264 #define UNICODE_DIAMOND                 0x20df
00265 #define UNICODE_NUMERO_SIGN             0x2116
00266 #define UNICODE_TRADEMARK_SIGN          0x2122
00267 #define UNICODE_KELVIN_SIGN             0x212a
00268 #define UNICODE_LEFTWARDS_ARROW         0x2190
00269 #define UNICODE_UPWARDS_ARROW           0x2191
00270 #define UNICODE_RIGHTWARDS_ARROW        0x2192
00271 #define UNICODE_DOWNWARDS_ARROW         0x2193
00272 #define UNICODE_N_ARY_SUMMATION         0x2211
00273 #define UNICODE_MINUS_SIGN              0x2212
00274 #define UNICODE_DIVISION_SLASH          0x2215
00275 #define UNICODE_ASTERISK_OPERATOR       0x2217
00276 #define UNICODE_BULLET_OPERATOR         0x2219
00277 #define UNICODE_RATIO                   0x2236
00278 #define UNICODE_TILDE_OPERATOR          0x223c
00279 #define UNICODE_BD_LIGHT_HORIZONTAL     0x2500
00280 #define UNICODE_BD_LIGHT_VERTICAL       0x2502
00281 #define UNICODE_BD_LIGHT_DOWN_RIGHT     0x250c
00282 #define UNICODE_BD_LIGHT_DOWN_AND_LEFT  0x2510
00283 #define UNICODE_BD_LIGHT_UP_AND_RIGHT   0x2514
00284 #define UNICODE_BD_LIGHT_UP_AND_LEFT    0x2518
00285 #define UNICODE_BD_LIGHT_VERTICAL_AND_RIGHT     0x251c
00286 #define UNICODE_BD_LIGHT_VERTICAL_AND_LEFT      0x2524
00287 #define UNICODE_BD_LIGHT_DOWN_AND_HORIZONTAL    0x252c
00288 #define UNICODE_BD_LIGHT_UP_AND_HORIZONTAL      0x2534
00289 #define UNICODE_BD_LIGHT_VERTICAL_AND_HORIZONTAL        0x253c
00290 #define UNICODE_BD_DOUBLE_HORIZONTAL    0x2550
00291 #define UNICODE_BD_DOUBLE_VERTICAL      0x2551
00292 #define UNICODE_BD_DOUBLE_DOWN_AND_RIGHT        0x2554
00293 #define UNICODE_BD_DOUBLE_DOWN_AND_LEFT 0x2557
00294 #define UNICODE_BD_DOUBLE_UP_AND_RIGHT  0x255a
00295 #define UNICODE_BD_DOUBLE_UP_AND_LEFT   0x255d
00296 #define UNICODE_BD_DOUBLE_VERTICAL_AND_RIGHT    0x2560
00297 #define UNICODE_BD_DOUBLE_VERTICAL_AND_LEFT     0x2563
00298 #define UNICODE_BD_DOUBLE_DOWN_AND_HORIZONTAL   0x2566
00299 #define UNICODE_BD_DOUBLE_UP_AND_HORIZONTAL     0x2569
00300 #define UNICODE_BD_DOUBLE_VERTICAL_AND_HORIZONTAL       0x256c
00301 #define UNICODE_LIGHT_SHADE             0x2591
00302 #define UNICODE_MEDIUM_SHADE            0x2592
00303 #define UNICODE_DARK_SHADE              0x2593
00304 #define UNICODE_BLACK_SQUARE            0x25a0
00305 #define UNICODE_BLACK_CLUB_SUIT         0x2663
00306 #define UNICODE_SMALL_LIGATURE_FI       0xfb01
00307 #define UNICODE_SMALL_LIGATURE_FL       0xfb02
00308 #define UNICODE_ZERO_WIDTH_NO_BREAK_SPACE       0xfeff
00309 
00310 #if defined(__riscos)
00311 #define OUR_ELLIPSIS                    0x8c
00312 #define OUR_EM_DASH                     0x98
00313 #define OUR_UNBREAKABLE_JOIN            0x99
00314 #else
00315 #define OUR_ELLIPSIS                    '.'
00316 #define OUR_EM_DASH                     '-'
00317 #define OUR_UNBREAKABLE_JOIN            '-'
00318 #endif /* __riscos */
00319 #define OUR_DIAMOND                     '-'
00320 
00321 #endif /* __wordconst_h */

Generated by  doxygen 1.6.2