15 * rtf.h - RTF document processing stuff. Release 1.10.
20 * Twentieths of a point (twips) per inch (Many RTF measurements
21 * are in twips per inch (tpi) units). Assumes 72 points/inch.
27 * RTF buffer size (avoids BUFSIZ, which differs across systems)
30 # define rtfBufSiz 1024
33 * Tokens are associated with up to three classification numbers:
35 * Class number: Broadest (least detailed) breakdown. For programs
36 * that only care about gross token distinctions.
37 * Major/minor numbers: Within their class, tokens have a major
38 * number, and may also have a minor number to further
39 * distinguish tokens with the same major number.
41 * *** Class, major and minor token numbers are all >= 0 ***
43 * Tokens that can't be classified are put in the "unknown" class.
44 * For such, the major and minor numbers are meaningless, although
45 * rtfTextBuf may be of interest then.
47 * Text tokens are a single character, and the major number indicates
48 * the character value (note: can be non-ascii, i.e., greater than 127).
49 * There is no minor number.
51 * Control symbols may have a parameter value, which will be found in
52 * rtfParam. If no parameter was given, rtfParam = rtfNoParam.
54 * RTFGetToken() return value is the class number, but it sets all the
57 * rtfEOF is a fake token used by the reader; the writer never sees
58 * it (except in the token reader hook, if it installs one).
62 # define rtfNoParam (-1000000)
67 * For some reason, the no-style number is 222
70 # define rtfNoStyleNum 222
71 # define rtfNormalStyleNum 0
75 * Token classes (must be zero-based and sequential)
83 # define rtfMaxClass 5 /* highest class + 1 */
86 * Group class major numbers
89 # define rtfBeginGroup 0
90 # define rtfEndGroup 1
93 * Control class major and minor numbers.
100 # define rtfCharSet 2
101 # define rtfAnsiCharSet 0
102 # define rtfMacCharSet 1
103 # define rtfPcCharSet 2
104 # define rtfPcaCharSet 3
107 /* destination minor numbers should be zero-based and sequential */
109 # define rtfDestination 3
110 # define rtfFontTbl 0
111 # define rtfFontAltName 1 /* new in 1.10 */
112 # define rtfEmbeddedFont 2 /* new in 1.10 */
113 # define rtfFontFile 3 /* new in 1.10 */
114 # define rtfFileTbl 4 /* new in 1.10 */
115 # define rtfFileInfo 5 /* new in 1.10 */
116 # define rtfColorTbl 6
117 # define rtfStyleSheet 7
118 # define rtfKeyCode 8
119 # define rtfRevisionTbl 9 /* new in 1.10 */
121 # define rtfITitle 11
122 # define rtfISubject 12
123 # define rtfIAuthor 13
124 # define rtfIOperator 14
125 # define rtfIKeywords 15
126 # define rtfIComment 16
127 # define rtfIVersion 17
128 # define rtfIDoccomm 18
129 # define rtfIVerscomm 19
130 # define rtfNextFile 20 /* reclassified in 1.10 */
131 # define rtfTemplate 21 /* reclassified in 1.10 */
133 # define rtfFNContSep 23
134 # define rtfFNContNotice 24
135 # define rtfENSep 25 /* new in 1.10 */
136 # define rtfENContSep 26 /* new in 1.10 */
137 # define rtfENContNotice 27 /* new in 1.10 */
138 # define rtfPageNumLevel 28 /* new in 1.10 */
139 # define rtfParNumLevelStyle 29 /* new in 1.10 */
140 # define rtfHeader 30
141 # define rtfFooter 31
142 # define rtfHeaderLeft 32
143 # define rtfHeaderRight 33
144 # define rtfHeaderFirst 34
145 # define rtfFooterLeft 35
146 # define rtfFooterRight 36
147 # define rtfFooterFirst 37
148 # define rtfParNumText 38 /* new in 1.10 */
149 # define rtfParNumbering 39 /* new in 1.10 */
150 # define rtfParNumTextAfter 40 /* new in 1.10 */
151 # define rtfParNumTextBefore 41 /* new in 1.10 */
152 # define rtfBookmarkStart 42
153 # define rtfBookmarkEnd 43
155 # define rtfObject 45
156 # define rtfObjClass 46
157 # define rtfObjName 47
158 # define rtfObjTime 48 /* new in 1.10 */
159 # define rtfObjData 49
160 # define rtfObjAlias 50
161 # define rtfObjSection 51
162 # define rtfObjResult 52
163 # define rtfObjItem 53 /* new in 1.10 */
164 # define rtfObjTopic 54 /* new in 1.10 */
165 # define rtfDrawObject 55 /* new in 1.10 */
166 # define rtfFootnote 56
167 # define rtfAnnotRefStart 57 /* new in 1.10 */
168 # define rtfAnnotRefEnd 58 /* new in 1.10 */
169 # define rtfAnnotID 59 /* reclassified in 1.10 */
170 # define rtfAnnotAuthor 60 /* new in 1.10 */
171 # define rtfAnnotation 61 /* reclassified in 1.10 */
172 # define rtfAnnotRef 62 /* new in 1.10 */
173 # define rtfAnnotTime 63 /* new in 1.10 */
174 # define rtfAnnotIcon 64 /* new in 1.10 */
176 # define rtfFieldInst 66
177 # define rtfFieldResult 67
178 # define rtfDataField 68 /* new in 1.10 */
180 # define rtfIndexText 70
181 # define rtfIndexRange 71
183 # define rtfNeXTGraphic 73
184 # define rtfGenerator 74
185 # define rtfNestTableProps 75
186 # define rtfNoNestTables 76
187 # define rtfShpPict 77
188 # define rtfNonShpPict 78
189 # define rtfMaxDestination 79 /* highest dest + 1 */
191 # define rtfFontFamily 4
193 # define rtfFFRoman 1
194 # define rtfFFSwiss 2
195 # define rtfFFModern 3
196 # define rtfFFScript 4
197 # define rtfFFDecor 5
199 # define rtfFFBidirectional 7 /* new in 1.10 */
201 # define rtfColorName 5
206 # define rtfSpecialChar 6
207 /* special chars seen in \info destination */
208 # define rtfIIntVersion 0
209 # define rtfICreateTime 1
210 # define rtfIRevisionTime 2
211 # define rtfIPrintTime 3
212 # define rtfIBackupTime 4
213 # define rtfIEditTime 5
218 # define rtfIMinute 10
219 # define rtfISecond 11 /* new in 1.10 */
220 # define rtfINPages 12
221 # define rtfINWords 13
222 # define rtfINChars 14
223 # define rtfIIntID 15
224 /* other special chars */
225 # define rtfCurHeadDate 16
226 # define rtfCurHeadDateLong 17
227 # define rtfCurHeadDateAbbrev 18
228 # define rtfCurHeadTime 19
229 # define rtfCurHeadPage 20
230 # define rtfSectNum 21 /* new in 1.10 */
231 # define rtfCurFNote 22
232 # define rtfCurAnnotRef 23
233 # define rtfFNoteSep 24
234 # define rtfFNoteCont 25
240 # define rtfColumn 31
242 # define rtfSoftPage 33 /* new in 1.10 */
243 # define rtfSoftColumn 34 /* new in 1.10 */
244 # define rtfSoftLine 35 /* new in 1.10 */
245 # define rtfSoftLineHt 36 /* new in 1.10 */
247 # define rtfEmDash 38
248 # define rtfEnDash 39
249 # define rtfEmSpace 40 /* new in 1.10 */
250 # define rtfEnSpace 41 /* new in 1.10 */
251 # define rtfBullet 42
252 # define rtfLQuote 43
253 # define rtfRQuote 44
254 # define rtfLDblQuote 45
255 # define rtfRDblQuote 46
256 # define rtfFormula 47
257 # define rtfNoBrkSpace 49
258 # define rtfNoReqHyphen 50
259 # define rtfNoBrkHyphen 51
260 # define rtfOptDest 52
261 # define rtfLTRMark 53 /* new in 1.10 */
262 # define rtfRTLMark 54 /* new in 1.10 */
263 # define rtfNoWidthJoiner 55 /* new in 1.10 */
264 # define rtfNoWidthNonJoiner 56 /* new in 1.10 */
265 # define rtfCurHeadPict 57 /* valid? */
266 /*# define rtfCurAnnot 58*/ /* apparently not used */
267 # define rtfUnicode 58 /* no better category*/
268 # define rtfNestCell 59
269 # define rtfNestRow 60
271 # define rtfStyleAttr 7
272 # define rtfAdditive 0 /* new in 1.10 */
273 # define rtfBasedOn 1
276 # define rtfDocAttr 8
278 # define rtfHyphHotZone 1
279 # define rtfHyphConsecLines 2 /* new in 1.10 */
280 # define rtfHyphCaps 3 /* new in 1.10 */
281 # define rtfHyphAuto 4 /* new in 1.10 */
282 # define rtfLineStart 5
283 # define rtfFracWidth 6
284 # define rtfMakeBackup 7
285 # define rtfRTFDefault 8
286 # define rtfPSOverlay 9
287 # define rtfDocTemplate 10 /* new in 1.10 */
288 # define rtfDefLanguage 11
289 # define rtfFENoteType 12 /* new in 1.10 */
290 # define rtfFNoteEndSect 13
291 # define rtfFNoteEndDoc 14
292 # define rtfFNoteText 15
293 # define rtfFNoteBottom 16
294 # define rtfENoteEndSect 17 /* new in 1.10 */
295 # define rtfENoteEndDoc 18 /* new in 1.10 */
296 # define rtfENoteText 19 /* new in 1.10 */
297 # define rtfENoteBottom 20 /* new in 1.10 */
298 # define rtfFNoteStart 21
299 # define rtfENoteStart 22 /* new in 1.10 */
300 # define rtfFNoteRestartPage 23 /* new in 1.10 */
301 # define rtfFNoteRestart 24
302 # define rtfFNoteRestartCont 25 /* new in 1.10 */
303 # define rtfENoteRestart 26 /* new in 1.10 */
304 # define rtfENoteRestartCont 27 /* new in 1.10 */
305 # define rtfFNoteNumArabic 28 /* new in 1.10 */
306 # define rtfFNoteNumLLetter 29 /* new in 1.10 */
307 # define rtfFNoteNumULetter 30 /* new in 1.10 */
308 # define rtfFNoteNumLRoman 31 /* new in 1.10 */
309 # define rtfFNoteNumURoman 32 /* new in 1.10 */
310 # define rtfFNoteNumChicago 33 /* new in 1.10 */
311 # define rtfENoteNumArabic 34 /* new in 1.10 */
312 # define rtfENoteNumLLetter 35 /* new in 1.10 */
313 # define rtfENoteNumULetter 36 /* new in 1.10 */
314 # define rtfENoteNumLRoman 37 /* new in 1.10 */
315 # define rtfENoteNumURoman 38 /* new in 1.10 */
316 # define rtfENoteNumChicago 39 /* new in 1.10 */
317 # define rtfPaperWidth 40
318 # define rtfPaperHeight 41
319 # define rtfPaperSize 42 /* new in 1.10 */
320 # define rtfLeftMargin 43
321 # define rtfRightMargin 44
322 # define rtfTopMargin 45
323 # define rtfBottomMargin 46
324 # define rtfFacingPage 47
325 # define rtfGutterWid 48
326 # define rtfMirrorMargin 49
327 # define rtfLandscape 50
328 # define rtfPageStart 51
329 # define rtfWidowCtrl 52
330 # define rtfLinkStyles 53 /* new in 1.10 */
331 # define rtfNoAutoTabIndent 54 /* new in 1.10 */
332 # define rtfWrapSpaces 55 /* new in 1.10 */
333 # define rtfPrintColorsBlack 56 /* new in 1.10 */
334 # define rtfNoExtraSpaceRL 57 /* new in 1.10 */
335 # define rtfNoColumnBalance 58 /* new in 1.10 */
336 # define rtfCvtMailMergeQuote 59 /* new in 1.10 */
337 # define rtfSuppressTopSpace 60 /* new in 1.10 */
338 # define rtfSuppressPreParSpace 61 /* new in 1.10 */
339 # define rtfCombineTblBorders 62 /* new in 1.10 */
340 # define rtfTranspMetafiles 63 /* new in 1.10 */
341 # define rtfSwapBorders 64 /* new in 1.10 */
342 # define rtfShowHardBreaks 65 /* new in 1.10 */
343 # define rtfFormProtected 66 /* new in 1.10 */
344 # define rtfAllProtected 67 /* new in 1.10 */
345 # define rtfFormShading 68 /* new in 1.10 */
346 # define rtfFormDisplay 69 /* new in 1.10 */
347 # define rtfPrintData 70 /* new in 1.10 */
348 # define rtfRevProtected 71 /* new in 1.10 */
349 # define rtfRevisions 72
350 # define rtfRevDisplay 73
351 # define rtfRevBar 74
352 # define rtfAnnotProtected 75 /* new in 1.10 */
353 # define rtfRTLDoc 76 /* new in 1.10 */
354 # define rtfLTRDoc 77 /* new in 1.10 */
355 # define rtfAnsiCodePage 78
356 # define rtfUTF8RTF 79
358 # define rtfSectAttr 9
359 # define rtfSectDef 0
360 # define rtfENoteHere 1
361 # define rtfPrtBinFirst 2
363 # define rtfSectStyleNum 4 /* new in 1.10 */
364 # define rtfNoBreak 5
365 # define rtfColBreak 6
366 # define rtfPageBreak 7
367 # define rtfEvenBreak 8
368 # define rtfOddBreak 9
369 # define rtfColumns 10
370 # define rtfColumnSpace 11
371 # define rtfColumnNumber 12 /* new in 1.10 */
372 # define rtfColumnSpRight 13 /* new in 1.10 */
373 # define rtfColumnWidth 14 /* new in 1.10 */
374 # define rtfColumnLine 15
375 # define rtfLineModulus 16
376 # define rtfLineDist 17
377 # define rtfLineStarts 18
378 # define rtfLineRestart 19
379 # define rtfLineRestartPg 20
380 # define rtfLineCont 21
381 # define rtfSectPageWid 22
382 # define rtfSectPageHt 23
383 # define rtfSectMarginLeft 24
384 # define rtfSectMarginRight 25
385 # define rtfSectMarginTop 26
386 # define rtfSectMarginBottom 27
387 # define rtfSectMarginGutter 28
388 # define rtfSectLandscape 29
389 # define rtfTitleSpecial 30
390 # define rtfHeaderY 31
391 # define rtfFooterY 32
392 # define rtfPageStarts 33
393 # define rtfPageCont 34
394 # define rtfPageRestart 35
395 # define rtfPageNumRight 36 /* renamed in 1.10 */
396 # define rtfPageNumTop 37
397 # define rtfPageDecimal 38
398 # define rtfPageURoman 39
399 # define rtfPageLRoman 40
400 # define rtfPageULetter 41
401 # define rtfPageLLetter 42
402 # define rtfPageNumHyphSep 43 /* new in 1.10 */
403 # define rtfPageNumSpaceSep 44 /* new in 1.10 */
404 # define rtfPageNumColonSep 45 /* new in 1.10 */
405 # define rtfPageNumEmdashSep 46 /* new in 1.10 */
406 # define rtfPageNumEndashSep 47 /* new in 1.10 */
407 # define rtfTopVAlign 48
408 # define rtfBottomVAlign 49
409 # define rtfCenterVAlign 50
410 # define rtfJustVAlign 51
411 # define rtfRTLSect 52 /* new in 1.10 */
412 # define rtfLTRSect 53 /* new in 1.10 */
414 # define rtfTblAttr 10
416 # define rtfRowGapH 1
417 # define rtfCellPos 2
418 # define rtfMergeRngFirst 3
419 # define rtfMergePrevious 4
420 # define rtfRowLeft 5
421 # define rtfRowRight 6
422 # define rtfRowCenter 7
423 # define rtfRowLeftEdge 8
425 # define rtfRowHeader 10 /* new in 1.10 */
426 # define rtfRowKeep 11 /* new in 1.10 */
427 # define rtfRTLRow 12 /* new in 1.10 */
428 # define rtfLTRRow 13 /* new in 1.10 */
429 # define rtfRowBordTop 14 /* new in 1.10 */
430 # define rtfRowBordLeft 15 /* new in 1.10 */
431 # define rtfRowBordBottom 16 /* new in 1.10 */
432 # define rtfRowBordRight 17 /* new in 1.10 */
433 # define rtfRowBordHoriz 18 /* new in 1.10 */
434 # define rtfRowBordVert 19 /* new in 1.10 */
435 # define rtfCellBordBottom 20
436 # define rtfCellBordTop 21
437 # define rtfCellBordLeft 22
438 # define rtfCellBordRight 23
439 # define rtfCellShading 24
440 # define rtfCellBgPatH 25
441 # define rtfCellBgPatV 26
442 # define rtfCellFwdDiagBgPat 27
443 # define rtfCellBwdDiagBgPat 28
444 # define rtfCellHatchBgPat 29
445 # define rtfCellDiagHatchBgPat 30
446 # define rtfCellDarkBgPatH 31
447 # define rtfCellDarkBgPatV 32
448 # define rtfCellFwdDarkBgPat 33
449 # define rtfCellBwdDarkBgPat 34
450 # define rtfCellDarkHatchBgPat 35
451 # define rtfCellDarkDiagHatchBgPat 36
452 # define rtfCellBgPatLineColor 37
453 # define rtfCellBgPatColor 38
455 # define rtfParAttr 11
457 # define rtfStyleNum 1
458 # define rtfHyphenate 2 /* new in 1.10 */
459 # define rtfInTable 3
461 # define rtfNoWidowControl 5 /* new in 1.10 */
462 # define rtfKeepNext 6
463 # define rtfOutlineLevel 7 /* new in 1.10 */
464 # define rtfNoLineNum 8
465 # define rtfPBBefore 9
466 # define rtfSideBySide 10
467 # define rtfQuadLeft 11
468 # define rtfQuadRight 12
469 # define rtfQuadJust 13
470 # define rtfQuadCenter 14
471 # define rtfFirstIndent 15
472 # define rtfLeftIndent 16
473 # define rtfRightIndent 17
474 # define rtfSpaceBefore 18
475 # define rtfSpaceAfter 19
476 # define rtfSpaceBetween 20
477 # define rtfSpaceMultiply 21 /* new in 1.10 */
478 # define rtfSubDocument 22 /* new in 1.10 */
479 # define rtfRTLPar 23 /* new in 1.10 */
480 # define rtfLTRPar 24 /* new in 1.10 */
481 # define rtfTabPos 25
482 # define rtfTabLeft 26 /* new in 1.10 */
483 # define rtfTabRight 27
484 # define rtfTabCenter 28
485 # define rtfTabDecimal 29
486 # define rtfTabBar 30
487 # define rtfLeaderDot 31
488 # define rtfLeaderHyphen 32
489 # define rtfLeaderUnder 33
490 # define rtfLeaderThick 34
491 # define rtfLeaderEqual 35
492 # define rtfParLevel 36 /* new in 1.10 */
493 # define rtfParBullet 37 /* new in 1.10 */
494 # define rtfParSimple 38 /* new in 1.10 */
495 # define rtfParNumCont 39 /* new in 1.10 */
496 # define rtfParNumOnce 40 /* new in 1.10 */
497 # define rtfParNumAcross 41 /* new in 1.10 */
498 # define rtfParHangIndent 42 /* new in 1.10 */
499 # define rtfParNumRestart 43 /* new in 1.10 */
500 # define rtfParNumCardinal 44 /* new in 1.10 */
501 # define rtfParNumDecimal 45 /* new in 1.10 */
502 # define rtfParNumULetter 46 /* new in 1.10 */
503 # define rtfParNumURoman 47 /* new in 1.10 */
504 # define rtfParNumLLetter 48 /* new in 1.10 */
505 # define rtfParNumLRoman 49 /* new in 1.10 */
506 # define rtfParNumOrdinal 50 /* new in 1.10 */
507 # define rtfParNumOrdinalText 51 /* new in 1.10 */
508 # define rtfParNumBold 52 /* new in 1.10 */
509 # define rtfParNumItalic 53 /* new in 1.10 */
510 # define rtfParNumAllCaps 54 /* new in 1.10 */
511 # define rtfParNumSmallCaps 55 /* new in 1.10 */
512 # define rtfParNumUnder 56 /* new in 1.10 */
513 # define rtfParNumDotUnder 57 /* new in 1.10 */
514 # define rtfParNumDbUnder 58 /* new in 1.10 */
515 # define rtfParNumNoUnder 59 /* new in 1.10 */
516 # define rtfParNumWordUnder 60 /* new in 1.10 */
517 # define rtfParNumStrikethru 61 /* new in 1.10 */
518 # define rtfParNumForeColor 62 /* new in 1.10 */
519 # define rtfParNumFont 63 /* new in 1.10 */
520 # define rtfParNumFontSize 64 /* new in 1.10 */
521 # define rtfParNumIndent 65 /* new in 1.10 */
522 # define rtfParNumSpacing 66 /* new in 1.10 */
523 # define rtfParNumInclPrev 67 /* new in 1.10 */
524 # define rtfParNumCenter 68 /* new in 1.10 */
525 # define rtfParNumLeft 69 /* new in 1.10 */
526 # define rtfParNumRight 70 /* new in 1.10 */
527 # define rtfParNumStartAt 71 /* new in 1.10 */
528 # define rtfBorderTop 72
529 # define rtfBorderBottom 73
530 # define rtfBorderLeft 74
531 # define rtfBorderRight 75
532 # define rtfBorderBetween 76
533 # define rtfBorderBar 77
534 # define rtfBorderBox 78
535 # define rtfBorderSingle 79
536 # define rtfBorderThick 80
537 # define rtfBorderShadow 81
538 # define rtfBorderDouble 82
539 # define rtfBorderDot 83
540 # define rtfBorderDash 84 /* new in 1.10 */
541 # define rtfBorderHair 85
542 # define rtfBorderWidth 86
543 # define rtfBorderColor 87
544 # define rtfBorderSpace 88
545 # define rtfShading 89
546 # define rtfBgPatH 90
547 # define rtfBgPatV 91
548 # define rtfFwdDiagBgPat 92
549 # define rtfBwdDiagBgPat 93
550 # define rtfHatchBgPat 94
551 # define rtfDiagHatchBgPat 95
552 # define rtfDarkBgPatH 96
553 # define rtfDarkBgPatV 97
554 # define rtfFwdDarkBgPat 98
555 # define rtfBwdDarkBgPat 99
556 # define rtfDarkHatchBgPat 100
557 # define rtfDarkDiagHatchBgPat 101
558 # define rtfBgPatLineColor 102
559 # define rtfBgPatColor 103
560 # define rtfNestLevel 104
562 # define rtfCharAttr 12
565 # define rtfAllCaps 2
566 # define rtfDeleted 3
567 # define rtfSubScript 4
568 # define rtfSubScrShrink 5 /* new in 1.10 */
569 # define rtfNoSuperSub 6 /* new in 1.10 */
571 # define rtfExpandTwips 8 /* new in 1.10 */
572 # define rtfKerning 9 /* new in 1.10 */
573 # define rtfFontNum 10
574 # define rtfFontSize 11
575 # define rtfItalic 12
576 # define rtfOutline 13
577 # define rtfRevised 14
578 # define rtfRevAuthor 15 /* new in 1.10 */
579 # define rtfRevDTTM 16 /* new in 1.10 */
580 # define rtfSmallCaps 17
581 # define rtfShadow 18
582 # define rtfStrikeThru 19
583 # define rtfUnderline 20
584 # define rtfDotUnderline 21 /* renamed in 1.10 */
585 # define rtfDbUnderline 22
586 # define rtfNoUnderline 23
587 # define rtfWordUnderline 24 /* renamed in 1.10 */
588 # define rtfSuperScript 25
589 # define rtfSuperScrShrink 26 /* new in 1.10 */
590 # define rtfInvisible 27
591 # define rtfForeColor 28
592 # define rtfBackColor 29
593 # define rtfRTLChar 30 /* new in 1.10 */
594 # define rtfLTRChar 31 /* new in 1.10 */
595 # define rtfCharStyleNum 32 /* new in 1.10 */
596 # define rtfCharCharSet 33 /* new in 1.10 */
597 # define rtfLanguage 34
599 # define rtfUnicodeLength 36
601 # define rtfPictAttr 13
603 # define rtfPMMetafile 1
604 # define rtfWinMetafile 2
605 # define rtfDevIndBitmap 3
606 # define rtfWinBitmap 4
607 # define rtfEmfBlip 5
608 # define rtfPixelBits 6
609 # define rtfBitmapPlanes 7
610 # define rtfBitmapWid 8
613 # define rtfPicGoalWid 11
614 # define rtfPicGoalHt 12
615 # define rtfPicScaleX 13
616 # define rtfPicScaleY 14
617 # define rtfPicScaled 15
618 # define rtfPicCropTop 16
619 # define rtfPicCropBottom 17
620 # define rtfPicCropLeft 18
621 # define rtfPicCropRight 19
622 # define rtfPicMFHasBitmap 20 /* new in 1.10 */
623 # define rtfPicMFBitsPerPixel 21 /* new in 1.10 */
624 # define rtfPicBinary 22
626 # define rtfBookmarkAttr 14
627 # define rtfBookmarkFirstCol 0
628 # define rtfBookmarkLastCol 1
630 # define rtfNeXTGrAttr 15
631 # define rtfNeXTGWidth 0
632 # define rtfNeXTGHeight 1
634 # define rtfFieldAttr 16
635 # define rtfFieldDirty 0
636 # define rtfFieldEdited 1
637 # define rtfFieldLocked 2
638 # define rtfFieldPrivate 3
639 # define rtfFieldAlt 4 /* new in 1.10 */
641 # define rtfTOCAttr 17
642 # define rtfTOCType 0
643 # define rtfTOCLevel 1
645 # define rtfPosAttr 18
648 # define rtfRPosMargH 2
649 # define rtfRPosPageH 3
650 # define rtfRPosColH 4
652 # define rtfPosNegX 6 /* new in 1.10 */
653 # define rtfPosXCenter 7
654 # define rtfPosXInside 8
655 # define rtfPosXOutSide 9
656 # define rtfPosXRight 10
657 # define rtfPosXLeft 11
658 # define rtfRPosMargV 12
659 # define rtfRPosPageV 13
660 # define rtfRPosParaV 14
662 # define rtfPosNegY 16 /* new in 1.10 */
663 # define rtfPosYInline 17
664 # define rtfPosYTop 18
665 # define rtfPosYCenter 19
666 # define rtfPosYBottom 20
667 # define rtfNoWrap 21
668 # define rtfDistFromTextAll 22 /* renamed in 1.10 */
669 # define rtfDistFromTextX 23 /* new in 1.10 */
670 # define rtfDistFromTextY 24 /* new in 1.10 */
671 # define rtfTextDistY 25
672 # define rtfDropCapLines 26 /* new in 1.10 */
673 # define rtfDropCapType 27 /* new in 1.10 */
675 # define rtfObjAttr 19
677 # define rtfObjLink 1
678 # define rtfObjAutoLink 2
679 # define rtfObjSubscriber 3
680 # define rtfObjPublisher 4 /* new in 1.10 */
681 # define rtfObjICEmb 5
682 # define rtfObjLinkSelf 6
683 # define rtfObjLock 7
684 # define rtfObjUpdate 8 /* new in 1.10 */
686 # define rtfObjWid 10
687 # define rtfObjSetSize 11
688 # define rtfObjAlign 12 /* new in 1.10 */
689 # define rtfObjTransposeY 13
690 # define rtfObjCropTop 14
691 # define rtfObjCropBottom 15
692 # define rtfObjCropLeft 16
693 # define rtfObjCropRight 17
694 # define rtfObjScaleX 18
695 # define rtfObjScaleY 19
696 # define rtfObjResRTF 20
697 # define rtfObjResPict 21
698 # define rtfObjResBitmap 22
699 # define rtfObjResText 23
700 # define rtfObjResMerge 24
701 # define rtfObjBookmarkPubObj 25
702 # define rtfObjPubAutoUpdate 26
704 # define rtfFNoteAttr 20 /* new in 1.10 */
705 # define rtfFNAlt 0 /* new in 1.10 */
707 # define rtfKeyCodeAttr 21 /* new in 1.10 */
708 # define rtfAltKey 0 /* new in 1.10 */
709 # define rtfShiftKey 1 /* new in 1.10 */
710 # define rtfControlKey 2 /* new in 1.10 */
711 # define rtfFunctionKey 3 /* new in 1.10 */
713 # define rtfACharAttr 22 /* new in 1.10 */
714 # define rtfACBold 0 /* new in 1.10 */
715 # define rtfACAllCaps 1 /* new in 1.10 */
716 # define rtfACForeColor 2 /* new in 1.10 */
717 # define rtfACSubScript 3 /* new in 1.10 */
718 # define rtfACExpand 4 /* new in 1.10 */
719 # define rtfACFontNum 5 /* new in 1.10 */
720 # define rtfACFontSize 6 /* new in 1.10 */
721 # define rtfACItalic 7 /* new in 1.10 */
722 # define rtfACLanguage 8 /* new in 1.10 */
723 # define rtfACOutline 9 /* new in 1.10 */
724 # define rtfACSmallCaps 10 /* new in 1.10 */
725 # define rtfACShadow 11 /* new in 1.10 */
726 # define rtfACStrikeThru 12 /* new in 1.10 */
727 # define rtfACUnderline 13 /* new in 1.10 */
728 # define rtfACDotUnderline 14 /* new in 1.10 */
729 # define rtfACDbUnderline 15 /* new in 1.10 */
730 # define rtfACNoUnderline 16 /* new in 1.10 */
731 # define rtfACWordUnderline 17 /* new in 1.10 */
732 # define rtfACSuperScript 18 /* new in 1.10 */
734 # define rtfFontAttr 23 /* new in 1.10 */
735 # define rtfFontCharSet 0 /* new in 1.10 */
736 # define rtfFontPitch 1 /* new in 1.10 */
737 # define rtfFontCodePage 2 /* new in 1.10 */
738 # define rtfFTypeNil 3 /* new in 1.10 */
739 # define rtfFTypeTrueType 4 /* new in 1.10 */
741 # define rtfFileAttr 24 /* new in 1.10 */
742 # define rtfFileNum 0 /* new in 1.10 */
743 # define rtfFileRelPath 1 /* new in 1.10 */
744 # define rtfFileOSNum 2 /* new in 1.10 */
746 # define rtfFileSource 25 /* new in 1.10 */
747 # define rtfSrcMacintosh 0 /* new in 1.10 */
748 # define rtfSrcDOS 1 /* new in 1.10 */
749 # define rtfSrcNTFS 2 /* new in 1.10 */
750 # define rtfSrcHPFS 3 /* new in 1.10 */
751 # define rtfSrcNetwork 4 /* new in 1.10 */
757 # define rtfDrawAttr 26 /* new in 1.10 */
758 # define rtfDrawLock 0 /* new in 1.10 */
759 # define rtfDrawPageRelX 1 /* new in 1.10 */
760 # define rtfDrawColumnRelX 2 /* new in 1.10 */
761 # define rtfDrawMarginRelX 3 /* new in 1.10 */
762 # define rtfDrawPageRelY 4 /* new in 1.10 */
763 # define rtfDrawColumnRelY 5 /* new in 1.10 */
764 # define rtfDrawMarginRelY 6 /* new in 1.10 */
765 # define rtfDrawHeight 7 /* new in 1.10 */
767 # define rtfDrawBeginGroup 8 /* new in 1.10 */
768 # define rtfDrawGroupCount 9 /* new in 1.10 */
769 # define rtfDrawEndGroup 10 /* new in 1.10 */
770 # define rtfDrawArc 11 /* new in 1.10 */
771 # define rtfDrawCallout 12 /* new in 1.10 */
772 # define rtfDrawEllipse 13 /* new in 1.10 */
773 # define rtfDrawLine 14 /* new in 1.10 */
774 # define rtfDrawPolygon 15 /* new in 1.10 */
775 # define rtfDrawPolyLine 16 /* new in 1.10 */
776 # define rtfDrawRect 17 /* new in 1.10 */
777 # define rtfDrawTextBox 18 /* new in 1.10 */
779 # define rtfDrawOffsetX 19 /* new in 1.10 */
780 # define rtfDrawSizeX 20 /* new in 1.10 */
781 # define rtfDrawOffsetY 21 /* new in 1.10 */
782 # define rtfDrawSizeY 22 /* new in 1.10 */
784 # define rtfCOAngle 23 /* new in 1.10 */
785 # define rtfCOAccentBar 24 /* new in 1.10 */
786 # define rtfCOBestFit 25 /* new in 1.10 */
787 # define rtfCOBorder 26 /* new in 1.10 */
788 # define rtfCOAttachAbsDist 27 /* new in 1.10 */
789 # define rtfCOAttachBottom 28 /* new in 1.10 */
790 # define rtfCOAttachCenter 29 /* new in 1.10 */
791 # define rtfCOAttachTop 30 /* new in 1.10 */
792 # define rtfCOLength 31 /* new in 1.10 */
793 # define rtfCONegXQuadrant 32 /* new in 1.10 */
794 # define rtfCONegYQuadrant 33 /* new in 1.10 */
795 # define rtfCOOffset 34 /* new in 1.10 */
796 # define rtfCOAttachSmart 35 /* new in 1.10 */
797 # define rtfCODoubleLine 36 /* new in 1.10 */
798 # define rtfCORightAngle 37 /* new in 1.10 */
799 # define rtfCOSingleLine 38 /* new in 1.10 */
800 # define rtfCOTripleLine 39 /* new in 1.10 */
802 # define rtfDrawTextBoxMargin 40 /* new in 1.10 */
803 # define rtfDrawTextBoxText 41 /* new in 1.10 */
804 # define rtfDrawRoundRect 42 /* new in 1.10 */
806 # define rtfDrawPointX 43 /* new in 1.10 */
807 # define rtfDrawPointY 44 /* new in 1.10 */
808 # define rtfDrawPolyCount 45 /* new in 1.10 */
810 # define rtfDrawArcFlipX 46 /* new in 1.10 */
811 # define rtfDrawArcFlipY 47 /* new in 1.10 */
813 # define rtfDrawLineBlue 48 /* new in 1.10 */
814 # define rtfDrawLineGreen 49 /* new in 1.10 */
815 # define rtfDrawLineRed 50 /* new in 1.10 */
816 # define rtfDrawLinePalette 51 /* new in 1.10 */
817 # define rtfDrawLineDashDot 52 /* new in 1.10 */
818 # define rtfDrawLineDashDotDot 53 /* new in 1.10 */
819 # define rtfDrawLineDash 54 /* new in 1.10 */
820 # define rtfDrawLineDot 55 /* new in 1.10 */
821 # define rtfDrawLineGray 56 /* new in 1.10 */
822 # define rtfDrawLineHollow 57 /* new in 1.10 */
823 # define rtfDrawLineSolid 58 /* new in 1.10 */
824 # define rtfDrawLineWidth 59 /* new in 1.10 */
826 # define rtfDrawHollowEndArrow 60 /* new in 1.10 */
827 # define rtfDrawEndArrowLength 61 /* new in 1.10 */
828 # define rtfDrawSolidEndArrow 62 /* new in 1.10 */
829 # define rtfDrawEndArrowWidth 63 /* new in 1.10 */
830 # define rtfDrawHollowStartArrow 64 /* new in 1.10 */
831 # define rtfDrawStartArrowLength 65 /* new in 1.10 */
832 # define rtfDrawSolidStartArrow 66 /* new in 1.10 */
833 # define rtfDrawStartArrowWidth 67 /* new in 1.10 */
835 # define rtfDrawBgFillBlue 68 /* new in 1.10 */
836 # define rtfDrawBgFillGreen 69 /* new in 1.10 */
837 # define rtfDrawBgFillRed 70 /* new in 1.10 */
838 # define rtfDrawBgFillPalette 71 /* new in 1.10 */
839 # define rtfDrawBgFillGray 72 /* new in 1.10 */
840 # define rtfDrawFgFillBlue 73 /* new in 1.10 */
841 # define rtfDrawFgFillGreen 74 /* new in 1.10 */
842 # define rtfDrawFgFillRed 75 /* new in 1.10 */
843 # define rtfDrawFgFillPalette 76 /* new in 1.10 */
844 # define rtfDrawFgFillGray 77 /* new in 1.10 */
845 # define rtfDrawFillPatIndex 78 /* new in 1.10 */
847 # define rtfDrawShadow 79 /* new in 1.10 */
848 # define rtfDrawShadowXOffset 80 /* new in 1.10 */
849 # define rtfDrawShadowYOffset 81 /* new in 1.10 */
852 * index entry attributes
855 # define rtfIndexAttr 27 /* new in 1.10 */
856 # define rtfIndexNumber 0 /* new in 1.10 */
857 # define rtfIndexBold 1 /* reclassified in 1.10 */
858 # define rtfIndexItalic 2 /* reclassified in 1.10 */
862 * \wmetafile argument values
865 # define rtfWmMmText 1
866 # define rtfWmMmLometric 2
867 # define rtfWmMmHimetric 3
868 # define rtfWmMmLoenglish 4
869 # define rtfWmMmHienglish 5
870 # define rtfWmMmTwips 6
871 # define rtfWmMmIsotropic 7
872 # define rtfWmMmAnisotropic 8
875 * \pmmetafile argument values
878 # define rtfPmPuArbitrary 4
879 # define rtfPmPuPels 8
880 # define rtfPmPuLometric 12
881 # define rtfPmPuHimetric 16
882 # define rtfPmPuLoenglish 20
883 # define rtfPmPuHienglish 24
884 # define rtfPmPuTwips 28
887 * \lang argument values
890 # define rtfLangNoLang 0x0400
891 # define rtfLangAlbanian 0x041c
892 # define rtfLangArabic 0x0401
893 # define rtfLangBahasa 0x0421
894 # define rtfLangBelgianDutch 0x0813
895 # define rtfLangBelgianFrench 0x080c
896 # define rtfLangBrazilianPortuguese 0x0416
897 # define rtfLangBulgarian 0x0402
898 # define rtfLangCatalan 0x0403
899 # define rtfLangLatinCroatoSerbian 0x041a
900 # define rtfLangCzech 0x0405
901 # define rtfLangDanish 0x0406
902 # define rtfLangDutch 0x0413
903 # define rtfLangAustralianEnglish 0x0c09
904 # define rtfLangUKEnglish 0x0809
905 # define rtfLangUSEnglish 0x0409
906 # define rtfLangFinnish 0x040b
907 # define rtfLangFrench 0x040c
908 # define rtfLangCanadianFrench 0x0c0c
909 # define rtfLangGerman 0x0407
910 # define rtfLangGreek 0x0408
911 # define rtfLangHebrew 0x040d
912 # define rtfLangHungarian 0x040e
913 # define rtfLangIcelandic 0x040f
914 # define rtfLangItalian 0x0410
915 # define rtfLangJapanese 0x0411
916 # define rtfLangKorean 0x0412
917 # define rtfLangBokmalNorwegian 0x0414
918 # define rtfLangNynorskNorwegian 0x0814
919 # define rtfLangPolish 0x0415
920 # define rtfLangPortuguese 0x0816
921 # define rtfLangRhaetoRomanic 0x0417
922 # define rtfLangRomanian 0x0418
923 # define rtfLangRussian 0x0419
924 # define rtfLangCyrillicSerboCroatian 0x081a
925 # define rtfLangSimplifiedChinese 0x0804
926 # define rtfLangSlovak 0x041b
927 # define rtfLangCastilianSpanish 0x040a
928 # define rtfLangMexicanSpanish 0x080a
929 # define rtfLangSwedish 0x041d
930 # define rtfLangSwissFrench 0x100c
931 # define rtfLangSwissGerman 0x0807
932 # define rtfLangSwissItalian 0x0810
933 # define rtfLangThai 0x041e
934 # define rtfLangTraditionalChinese 0x0404
935 # define rtfLangTurkish 0x041f
936 # define rtfLangUrdu 0x0420
942 # define rtfParStyle 0 /* the default */
943 # define rtfCharStyle 1
944 # define rtfSectStyle 2
947 * RTF font, color and style structures. Used for font table,
948 * color table, and stylesheet processing.
951 typedef struct RTFFont RTFFont
;
952 typedef struct RTFColor RTFColor
;
953 typedef struct RTFStyle RTFStyle
;
954 typedef struct RTFStyleElt RTFStyleElt
;
955 typedef struct RTFBorder RTFBorder
;
956 typedef struct RTFCell RTFCell
;
957 typedef struct RTFTable RTFTable
;
961 char *rtfFName
; /* font name */
962 char *rtfFAltName
; /* font alternate name */
963 int rtfFNum
; /* font number */
964 int rtfFFamily
; /* font family */
965 int rtfFCharSet
; /* font charset */
966 int rtfFPitch
; /* font pitch */
967 int rtfFType
; /* font type */
968 int rtfFCodePage
; /* font code page */
969 RTFFont
*rtfNextFont
; /* next font in list */
974 * Color values are -1 if the default color for the color
975 * number should be used. The default color is writer-dependent.
980 int rtfCNum
; /* color number */
981 int rtfCRed
; /* red value */
982 int rtfCGreen
; /* green value */
983 int rtfCBlue
; /* blue value */
984 RTFColor
*rtfNextColor
; /* next color in list */
990 char *rtfSName
; /* style name */
991 int rtfSType
; /* style type */
992 int rtfSAdditive
; /* whether or not style is additive */
993 int rtfSNum
; /* style number */
994 int rtfSBasedOn
; /* style this one's based on */
995 int rtfSNextPar
; /* style next paragraph style */
996 RTFStyleElt
*rtfSSEList
; /* list of style words */
997 int rtfExpanding
; /* non-zero = being expanded */
998 RTFStyle
*rtfNextStyle
; /* next style in style list */
1004 int rtfSEClass
; /* token class */
1005 int rtfSEMajor
; /* token major number */
1006 int rtfSEMinor
; /* token minor number */
1007 int rtfSEParam
; /* control symbol parameter */
1008 char *rtfSEText
; /* text of symbol */
1009 RTFStyleElt
*rtfNextSE
; /* next element in style */
1021 RTFBorder border
[4];
1027 RTFCell cells
[MAX_TABLE_CELLS
];
1028 int numCellsDefined
;
1031 /* borders for the table row */
1032 RTFBorder border
[6];
1034 /* Used in v1.0 - v3.0 */
1035 int numCellsInserted
;
1038 /* tableRowStart may be the start row paragraph of the table row,
1039 * or it may store the end of the previous row if it may still be
1040 * continued, otherwise NULL is stored. */
1041 ME_DisplayItem
*tableRowStart
;
1043 /* Table definitions are stored as a stack to support nested tables. */
1048 # define RTFBorderTypeNone 0x00
1049 # define RTFBorderTypePara 0x10 /* for \brdrX control words */
1050 # define RTFBorderTypeRow 0x20 /* for \trbrdrX control words */
1051 # define RTFBorderTypeCell 0x30 /* for \clbrdrX control words */
1052 # define RTFBorderTypeMask 0xf0
1054 /* The X in the control words \brdrX \trbrdrX and \clbrdrX mentioned above
1055 * should be one of t, l, b, r which stand for top, left, bottom, right
1057 # define RTFBorderSideTop 0x00
1058 # define RTFBorderSideLeft 0x01
1059 # define RTFBorderSideBottom 0x02
1060 # define RTFBorderSideRight 0x03
1061 # define RTFBorderSideHorizontal 0x04
1062 # define RTFBorderSideVertical 0x05
1063 # define RTFBorderSideMask 0x0f
1065 /* Here are the values from the border types and sides put together. */
1066 # define RTFBorderParaTop 0x10
1067 # define RTFBorderParaLeft 0x11
1068 # define RTFBorderParaBottom 0x12
1069 # define RTFBorderParaRight 0x13
1070 # define RTFBorderRowTop 0x20
1071 # define RTFBorderRowLeft 0x21
1072 # define RTFBorderRowBottom 0x22
1073 # define RTFBorderRowRight 0x23
1074 # define RTFBorderRowHorizontal 0x24
1075 # define RTFBorderRowVertical 0x25
1076 # define RTFBorderCellTop 0x30
1077 # define RTFBorderCellLeft 0x31
1078 # define RTFBorderCellBottom 0x32
1079 # define RTFBorderCellRight 0x33
1082 * Return pointer to new element of type t, or NULL
1083 * if no memory available.
1086 # define New(t) (heap_alloc (sizeof (t)))
1088 /* Parser stack size */
1090 # define maxStack 32
1093 typedef struct _RTF_Info RTF_Info
;
1095 typedef void (*RTFFuncPtr
) (RTF_Info
*); /* generic function pointer */
1098 /* RTF parser stack element */
1099 struct tagRTFState
{
1104 typedef struct tagRTFState RTFState
;
1109 * Public variables (listed in rtf.h)
1113 * Information pertaining to last token read by RTFToken. The
1114 * text is exactly as it occurs in the input file, e.g., "\{"
1115 * will be found in rtfTextBuf as "\{", even though it means "{".
1116 * These variables are also set when styles are reprocessed.
1135 int pushedChar
; /* pushback char if read too far */
1137 int pushedClass
; /* pushed token info for RTFUngetToken() */
1141 char *pushedTextBuf
;
1146 /* Document-wide attributes */
1147 RTFFont
*fontList
; /* these lists MUST be */
1148 RTFColor
*colorList
; /* initialized to NULL */
1149 RTFStyle
*styleList
;
1150 int ansiCodePage
; /* ANSI codepage used in conversion to Unicode */
1153 /* Character attributes */
1154 int unicodeLength
; /* The length of ANSI representation of Unicode characters */
1155 int codePage
; /* Current codepage for text conversion */
1157 ME_InStream
*stream
;
1159 ME_TextEditor
*editor
;
1162 RTFFuncPtr ccb
[rtfMaxClass
]; /* class callbacks */
1164 RTFFuncPtr dcb
[rtfMaxDestination
]; /* destination callbacks */
1166 RTFFuncPtr readHook
;
1168 DWORD dwOutputCount
;
1169 WCHAR OutputBuffer
[0x1000];
1171 DWORD dwCPOutputCount
;
1172 DWORD dwMaxCPOutputCount
;
1173 char *cpOutputBuffer
;
1175 RTFState stack
[maxStack
];
1181 BOOL canInheritInTbl
;
1182 int borderType
; /* value corresponds to the RTFBorder constants. */
1184 PARAFORMAT2 fmt
; /* Accumulated para fmt for current paragraph. */
1189 * Public RTF reader routines
1192 void RTFInit (RTF_Info
*) DECLSPEC_HIDDEN
;
1193 void RTFDestroy(RTF_Info
*info
) DECLSPEC_HIDDEN
;
1194 void RTFSetDestinationCallback (RTF_Info
*, int, RTFFuncPtr
) DECLSPEC_HIDDEN
;
1195 void RTFRead (RTF_Info
*) DECLSPEC_HIDDEN
;
1196 int RTFGetToken (RTF_Info
*) DECLSPEC_HIDDEN
; /* writer should rarely need this */
1197 void RTFSetReadHook (RTF_Info
*, RTFFuncPtr
) DECLSPEC_HIDDEN
;
1198 void RTFRouteToken (RTF_Info
*) DECLSPEC_HIDDEN
;
1199 void RTFSkipGroup (RTF_Info
*) DECLSPEC_HIDDEN
;
1200 void RTFReadGroup (RTF_Info
*) DECLSPEC_HIDDEN
;
1201 int RTFCheckCM (const RTF_Info
*, int, int) DECLSPEC_HIDDEN
;
1202 int RTFCheckCMM (const RTF_Info
*, int, int, int) DECLSPEC_HIDDEN
;
1203 int RTFCheckMM (const RTF_Info
*, int, int) DECLSPEC_HIDDEN
;
1204 RTFFont
*RTFGetFont (const RTF_Info
*, int) DECLSPEC_HIDDEN
;
1205 RTFColor
*RTFGetColor (const RTF_Info
*, int) DECLSPEC_HIDDEN
;
1206 int RTFCharToHex ( char) DECLSPEC_HIDDEN
;
1208 void RTFFlushOutputBuffer( RTF_Info
*info
) DECLSPEC_HIDDEN
;
1209 void RTFSetEditStream(RTF_Info
*info
, ME_InStream
*stream
) DECLSPEC_HIDDEN
;
1211 void WriterInit (RTF_Info
*) DECLSPEC_HIDDEN
;
1212 int BeginFile (RTF_Info
*) DECLSPEC_HIDDEN
;
1214 int RTFCharSetToCodePage(RTF_Info
*info
, int charset
) DECLSPEC_HIDDEN
;
1216 void LookupInit (void) DECLSPEC_HIDDEN
;
1217 void LookupCleanup (void) DECLSPEC_HIDDEN
;