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 rtfMaxDestination 77 /* highest dest + 1 */
189 # define rtfFontFamily 4
191 # define rtfFFRoman 1
192 # define rtfFFSwiss 2
193 # define rtfFFModern 3
194 # define rtfFFScript 4
195 # define rtfFFDecor 5
197 # define rtfFFBidirectional 7 /* new in 1.10 */
199 # define rtfColorName 5
204 # define rtfSpecialChar 6
205 /* special chars seen in \info destination */
206 # define rtfIIntVersion 0
207 # define rtfICreateTime 1
208 # define rtfIRevisionTime 2
209 # define rtfIPrintTime 3
210 # define rtfIBackupTime 4
211 # define rtfIEditTime 5
216 # define rtfIMinute 10
217 # define rtfISecond 11 /* new in 1.10 */
218 # define rtfINPages 12
219 # define rtfINWords 13
220 # define rtfINChars 14
221 # define rtfIIntID 15
222 /* other special chars */
223 # define rtfCurHeadDate 16
224 # define rtfCurHeadDateLong 17
225 # define rtfCurHeadDateAbbrev 18
226 # define rtfCurHeadTime 19
227 # define rtfCurHeadPage 20
228 # define rtfSectNum 21 /* new in 1.10 */
229 # define rtfCurFNote 22
230 # define rtfCurAnnotRef 23
231 # define rtfFNoteSep 24
232 # define rtfFNoteCont 25
238 # define rtfColumn 31
240 # define rtfSoftPage 33 /* new in 1.10 */
241 # define rtfSoftColumn 34 /* new in 1.10 */
242 # define rtfSoftLine 35 /* new in 1.10 */
243 # define rtfSoftLineHt 36 /* new in 1.10 */
245 # define rtfEmDash 38
246 # define rtfEnDash 39
247 # define rtfEmSpace 40 /* new in 1.10 */
248 # define rtfEnSpace 41 /* new in 1.10 */
249 # define rtfBullet 42
250 # define rtfLQuote 43
251 # define rtfRQuote 44
252 # define rtfLDblQuote 45
253 # define rtfRDblQuote 46
254 # define rtfFormula 47
255 # define rtfNoBrkSpace 49
256 # define rtfNoReqHyphen 50
257 # define rtfNoBrkHyphen 51
258 # define rtfOptDest 52
259 # define rtfLTRMark 53 /* new in 1.10 */
260 # define rtfRTLMark 54 /* new in 1.10 */
261 # define rtfNoWidthJoiner 55 /* new in 1.10 */
262 # define rtfNoWidthNonJoiner 56 /* new in 1.10 */
263 # define rtfCurHeadPict 57 /* valid? */
264 /*# define rtfCurAnnot 58*/ /* apparently not used */
265 # define rtfUnicode 58 /* no better category*/
266 # define rtfNestCell 59
267 # define rtfNestRow 60
269 # define rtfStyleAttr 7
270 # define rtfAdditive 0 /* new in 1.10 */
271 # define rtfBasedOn 1
274 # define rtfDocAttr 8
276 # define rtfHyphHotZone 1
277 # define rtfHyphConsecLines 2 /* new in 1.10 */
278 # define rtfHyphCaps 3 /* new in 1.10 */
279 # define rtfHyphAuto 4 /* new in 1.10 */
280 # define rtfLineStart 5
281 # define rtfFracWidth 6
282 # define rtfMakeBackup 7
283 # define rtfRTFDefault 8
284 # define rtfPSOverlay 9
285 # define rtfDocTemplate 10 /* new in 1.10 */
286 # define rtfDefLanguage 11
287 # define rtfFENoteType 12 /* new in 1.10 */
288 # define rtfFNoteEndSect 13
289 # define rtfFNoteEndDoc 14
290 # define rtfFNoteText 15
291 # define rtfFNoteBottom 16
292 # define rtfENoteEndSect 17 /* new in 1.10 */
293 # define rtfENoteEndDoc 18 /* new in 1.10 */
294 # define rtfENoteText 19 /* new in 1.10 */
295 # define rtfENoteBottom 20 /* new in 1.10 */
296 # define rtfFNoteStart 21
297 # define rtfENoteStart 22 /* new in 1.10 */
298 # define rtfFNoteRestartPage 23 /* new in 1.10 */
299 # define rtfFNoteRestart 24
300 # define rtfFNoteRestartCont 25 /* new in 1.10 */
301 # define rtfENoteRestart 26 /* new in 1.10 */
302 # define rtfENoteRestartCont 27 /* new in 1.10 */
303 # define rtfFNoteNumArabic 28 /* new in 1.10 */
304 # define rtfFNoteNumLLetter 29 /* new in 1.10 */
305 # define rtfFNoteNumULetter 30 /* new in 1.10 */
306 # define rtfFNoteNumLRoman 31 /* new in 1.10 */
307 # define rtfFNoteNumURoman 32 /* new in 1.10 */
308 # define rtfFNoteNumChicago 33 /* new in 1.10 */
309 # define rtfENoteNumArabic 34 /* new in 1.10 */
310 # define rtfENoteNumLLetter 35 /* new in 1.10 */
311 # define rtfENoteNumULetter 36 /* new in 1.10 */
312 # define rtfENoteNumLRoman 37 /* new in 1.10 */
313 # define rtfENoteNumURoman 38 /* new in 1.10 */
314 # define rtfENoteNumChicago 39 /* new in 1.10 */
315 # define rtfPaperWidth 40
316 # define rtfPaperHeight 41
317 # define rtfPaperSize 42 /* new in 1.10 */
318 # define rtfLeftMargin 43
319 # define rtfRightMargin 44
320 # define rtfTopMargin 45
321 # define rtfBottomMargin 46
322 # define rtfFacingPage 47
323 # define rtfGutterWid 48
324 # define rtfMirrorMargin 49
325 # define rtfLandscape 50
326 # define rtfPageStart 51
327 # define rtfWidowCtrl 52
328 # define rtfLinkStyles 53 /* new in 1.10 */
329 # define rtfNoAutoTabIndent 54 /* new in 1.10 */
330 # define rtfWrapSpaces 55 /* new in 1.10 */
331 # define rtfPrintColorsBlack 56 /* new in 1.10 */
332 # define rtfNoExtraSpaceRL 57 /* new in 1.10 */
333 # define rtfNoColumnBalance 58 /* new in 1.10 */
334 # define rtfCvtMailMergeQuote 59 /* new in 1.10 */
335 # define rtfSuppressTopSpace 60 /* new in 1.10 */
336 # define rtfSuppressPreParSpace 61 /* new in 1.10 */
337 # define rtfCombineTblBorders 62 /* new in 1.10 */
338 # define rtfTranspMetafiles 63 /* new in 1.10 */
339 # define rtfSwapBorders 64 /* new in 1.10 */
340 # define rtfShowHardBreaks 65 /* new in 1.10 */
341 # define rtfFormProtected 66 /* new in 1.10 */
342 # define rtfAllProtected 67 /* new in 1.10 */
343 # define rtfFormShading 68 /* new in 1.10 */
344 # define rtfFormDisplay 69 /* new in 1.10 */
345 # define rtfPrintData 70 /* new in 1.10 */
346 # define rtfRevProtected 71 /* new in 1.10 */
347 # define rtfRevisions 72
348 # define rtfRevDisplay 73
349 # define rtfRevBar 74
350 # define rtfAnnotProtected 75 /* new in 1.10 */
351 # define rtfRTLDoc 76 /* new in 1.10 */
352 # define rtfLTRDoc 77 /* new in 1.10 */
353 # define rtfAnsiCodePage 78
354 # define rtfUTF8RTF 79
356 # define rtfSectAttr 9
357 # define rtfSectDef 0
358 # define rtfENoteHere 1
359 # define rtfPrtBinFirst 2
361 # define rtfSectStyleNum 4 /* new in 1.10 */
362 # define rtfNoBreak 5
363 # define rtfColBreak 6
364 # define rtfPageBreak 7
365 # define rtfEvenBreak 8
366 # define rtfOddBreak 9
367 # define rtfColumns 10
368 # define rtfColumnSpace 11
369 # define rtfColumnNumber 12 /* new in 1.10 */
370 # define rtfColumnSpRight 13 /* new in 1.10 */
371 # define rtfColumnWidth 14 /* new in 1.10 */
372 # define rtfColumnLine 15
373 # define rtfLineModulus 16
374 # define rtfLineDist 17
375 # define rtfLineStarts 18
376 # define rtfLineRestart 19
377 # define rtfLineRestartPg 20
378 # define rtfLineCont 21
379 # define rtfSectPageWid 22
380 # define rtfSectPageHt 23
381 # define rtfSectMarginLeft 24
382 # define rtfSectMarginRight 25
383 # define rtfSectMarginTop 26
384 # define rtfSectMarginBottom 27
385 # define rtfSectMarginGutter 28
386 # define rtfSectLandscape 29
387 # define rtfTitleSpecial 30
388 # define rtfHeaderY 31
389 # define rtfFooterY 32
390 # define rtfPageStarts 33
391 # define rtfPageCont 34
392 # define rtfPageRestart 35
393 # define rtfPageNumRight 36 /* renamed in 1.10 */
394 # define rtfPageNumTop 37
395 # define rtfPageDecimal 38
396 # define rtfPageURoman 39
397 # define rtfPageLRoman 40
398 # define rtfPageULetter 41
399 # define rtfPageLLetter 42
400 # define rtfPageNumHyphSep 43 /* new in 1.10 */
401 # define rtfPageNumSpaceSep 44 /* new in 1.10 */
402 # define rtfPageNumColonSep 45 /* new in 1.10 */
403 # define rtfPageNumEmdashSep 46 /* new in 1.10 */
404 # define rtfPageNumEndashSep 47 /* new in 1.10 */
405 # define rtfTopVAlign 48
406 # define rtfBottomVAlign 49
407 # define rtfCenterVAlign 50
408 # define rtfJustVAlign 51
409 # define rtfRTLSect 52 /* new in 1.10 */
410 # define rtfLTRSect 53 /* new in 1.10 */
412 # define rtfTblAttr 10
414 # define rtfRowGapH 1
415 # define rtfCellPos 2
416 # define rtfMergeRngFirst 3
417 # define rtfMergePrevious 4
418 # define rtfRowLeft 5
419 # define rtfRowRight 6
420 # define rtfRowCenter 7
421 # define rtfRowLeftEdge 8
423 # define rtfRowHeader 10 /* new in 1.10 */
424 # define rtfRowKeep 11 /* new in 1.10 */
425 # define rtfRTLRow 12 /* new in 1.10 */
426 # define rtfLTRRow 13 /* new in 1.10 */
427 # define rtfRowBordTop 14 /* new in 1.10 */
428 # define rtfRowBordLeft 15 /* new in 1.10 */
429 # define rtfRowBordBottom 16 /* new in 1.10 */
430 # define rtfRowBordRight 17 /* new in 1.10 */
431 # define rtfRowBordHoriz 18 /* new in 1.10 */
432 # define rtfRowBordVert 19 /* new in 1.10 */
433 # define rtfCellBordBottom 20
434 # define rtfCellBordTop 21
435 # define rtfCellBordLeft 22
436 # define rtfCellBordRight 23
437 # define rtfCellShading 24
438 # define rtfCellBgPatH 25
439 # define rtfCellBgPatV 26
440 # define rtfCellFwdDiagBgPat 27
441 # define rtfCellBwdDiagBgPat 28
442 # define rtfCellHatchBgPat 29
443 # define rtfCellDiagHatchBgPat 30
444 # define rtfCellDarkBgPatH 31
445 # define rtfCellDarkBgPatV 32
446 # define rtfCellFwdDarkBgPat 33
447 # define rtfCellBwdDarkBgPat 34
448 # define rtfCellDarkHatchBgPat 35
449 # define rtfCellDarkDiagHatchBgPat 36
450 # define rtfCellBgPatLineColor 37
451 # define rtfCellBgPatColor 38
453 # define rtfParAttr 11
455 # define rtfStyleNum 1
456 # define rtfHyphenate 2 /* new in 1.10 */
457 # define rtfInTable 3
459 # define rtfNoWidowControl 5 /* new in 1.10 */
460 # define rtfKeepNext 6
461 # define rtfOutlineLevel 7 /* new in 1.10 */
462 # define rtfNoLineNum 8
463 # define rtfPBBefore 9
464 # define rtfSideBySide 10
465 # define rtfQuadLeft 11
466 # define rtfQuadRight 12
467 # define rtfQuadJust 13
468 # define rtfQuadCenter 14
469 # define rtfFirstIndent 15
470 # define rtfLeftIndent 16
471 # define rtfRightIndent 17
472 # define rtfSpaceBefore 18
473 # define rtfSpaceAfter 19
474 # define rtfSpaceBetween 20
475 # define rtfSpaceMultiply 21 /* new in 1.10 */
476 # define rtfSubDocument 22 /* new in 1.10 */
477 # define rtfRTLPar 23 /* new in 1.10 */
478 # define rtfLTRPar 24 /* new in 1.10 */
479 # define rtfTabPos 25
480 # define rtfTabLeft 26 /* new in 1.10 */
481 # define rtfTabRight 27
482 # define rtfTabCenter 28
483 # define rtfTabDecimal 29
484 # define rtfTabBar 30
485 # define rtfLeaderDot 31
486 # define rtfLeaderHyphen 32
487 # define rtfLeaderUnder 33
488 # define rtfLeaderThick 34
489 # define rtfLeaderEqual 35
490 # define rtfParLevel 36 /* new in 1.10 */
491 # define rtfParBullet 37 /* new in 1.10 */
492 # define rtfParSimple 38 /* new in 1.10 */
493 # define rtfParNumCont 39 /* new in 1.10 */
494 # define rtfParNumOnce 40 /* new in 1.10 */
495 # define rtfParNumAcross 41 /* new in 1.10 */
496 # define rtfParHangIndent 42 /* new in 1.10 */
497 # define rtfParNumRestart 43 /* new in 1.10 */
498 # define rtfParNumCardinal 44 /* new in 1.10 */
499 # define rtfParNumDecimal 45 /* new in 1.10 */
500 # define rtfParNumULetter 46 /* new in 1.10 */
501 # define rtfParNumURoman 47 /* new in 1.10 */
502 # define rtfParNumLLetter 48 /* new in 1.10 */
503 # define rtfParNumLRoman 49 /* new in 1.10 */
504 # define rtfParNumOrdinal 50 /* new in 1.10 */
505 # define rtfParNumOrdinalText 51 /* new in 1.10 */
506 # define rtfParNumBold 52 /* new in 1.10 */
507 # define rtfParNumItalic 53 /* new in 1.10 */
508 # define rtfParNumAllCaps 54 /* new in 1.10 */
509 # define rtfParNumSmallCaps 55 /* new in 1.10 */
510 # define rtfParNumUnder 56 /* new in 1.10 */
511 # define rtfParNumDotUnder 57 /* new in 1.10 */
512 # define rtfParNumDbUnder 58 /* new in 1.10 */
513 # define rtfParNumNoUnder 59 /* new in 1.10 */
514 # define rtfParNumWordUnder 60 /* new in 1.10 */
515 # define rtfParNumStrikethru 61 /* new in 1.10 */
516 # define rtfParNumForeColor 62 /* new in 1.10 */
517 # define rtfParNumFont 63 /* new in 1.10 */
518 # define rtfParNumFontSize 64 /* new in 1.10 */
519 # define rtfParNumIndent 65 /* new in 1.10 */
520 # define rtfParNumSpacing 66 /* new in 1.10 */
521 # define rtfParNumInclPrev 67 /* new in 1.10 */
522 # define rtfParNumCenter 68 /* new in 1.10 */
523 # define rtfParNumLeft 69 /* new in 1.10 */
524 # define rtfParNumRight 70 /* new in 1.10 */
525 # define rtfParNumStartAt 71 /* new in 1.10 */
526 # define rtfBorderTop 72
527 # define rtfBorderBottom 73
528 # define rtfBorderLeft 74
529 # define rtfBorderRight 75
530 # define rtfBorderBetween 76
531 # define rtfBorderBar 77
532 # define rtfBorderBox 78
533 # define rtfBorderSingle 79
534 # define rtfBorderThick 80
535 # define rtfBorderShadow 81
536 # define rtfBorderDouble 82
537 # define rtfBorderDot 83
538 # define rtfBorderDash 84 /* new in 1.10 */
539 # define rtfBorderHair 85
540 # define rtfBorderWidth 86
541 # define rtfBorderColor 87
542 # define rtfBorderSpace 88
543 # define rtfShading 89
544 # define rtfBgPatH 90
545 # define rtfBgPatV 91
546 # define rtfFwdDiagBgPat 92
547 # define rtfBwdDiagBgPat 93
548 # define rtfHatchBgPat 94
549 # define rtfDiagHatchBgPat 95
550 # define rtfDarkBgPatH 96
551 # define rtfDarkBgPatV 97
552 # define rtfFwdDarkBgPat 98
553 # define rtfBwdDarkBgPat 99
554 # define rtfDarkHatchBgPat 100
555 # define rtfDarkDiagHatchBgPat 101
556 # define rtfBgPatLineColor 102
557 # define rtfBgPatColor 103
558 # define rtfNestLevel 104
560 # define rtfCharAttr 12
563 # define rtfAllCaps 2
564 # define rtfDeleted 3
565 # define rtfSubScript 4
566 # define rtfSubScrShrink 5 /* new in 1.10 */
567 # define rtfNoSuperSub 6 /* new in 1.10 */
569 # define rtfExpandTwips 8 /* new in 1.10 */
570 # define rtfKerning 9 /* new in 1.10 */
571 # define rtfFontNum 10
572 # define rtfFontSize 11
573 # define rtfItalic 12
574 # define rtfOutline 13
575 # define rtfRevised 14
576 # define rtfRevAuthor 15 /* new in 1.10 */
577 # define rtfRevDTTM 16 /* new in 1.10 */
578 # define rtfSmallCaps 17
579 # define rtfShadow 18
580 # define rtfStrikeThru 19
581 # define rtfUnderline 20
582 # define rtfDotUnderline 21 /* renamed in 1.10 */
583 # define rtfDbUnderline 22
584 # define rtfNoUnderline 23
585 # define rtfWordUnderline 24 /* renamed in 1.10 */
586 # define rtfSuperScript 25
587 # define rtfSuperScrShrink 26 /* new in 1.10 */
588 # define rtfInvisible 27
589 # define rtfForeColor 28
590 # define rtfBackColor 29
591 # define rtfRTLChar 30 /* new in 1.10 */
592 # define rtfLTRChar 31 /* new in 1.10 */
593 # define rtfCharStyleNum 32 /* new in 1.10 */
594 # define rtfCharCharSet 33 /* new in 1.10 */
595 # define rtfLanguage 34
597 # define rtfUnicodeLength 36
599 # define rtfPictAttr 13
601 # define rtfPMMetafile 1
602 # define rtfWinMetafile 2
603 # define rtfDevIndBitmap 3
604 # define rtfWinBitmap 4
605 # define rtfEmfBlip 5
606 # define rtfPixelBits 6
607 # define rtfBitmapPlanes 7
608 # define rtfBitmapWid 8
611 # define rtfPicGoalWid 11
612 # define rtfPicGoalHt 12
613 # define rtfPicScaleX 13
614 # define rtfPicScaleY 14
615 # define rtfPicScaled 15
616 # define rtfPicCropTop 16
617 # define rtfPicCropBottom 17
618 # define rtfPicCropLeft 18
619 # define rtfPicCropRight 19
620 # define rtfPicMFHasBitmap 20 /* new in 1.10 */
621 # define rtfPicMFBitsPerPixel 21 /* new in 1.10 */
622 # define rtfPicBinary 22
624 # define rtfBookmarkAttr 14
625 # define rtfBookmarkFirstCol 0
626 # define rtfBookmarkLastCol 1
628 # define rtfNeXTGrAttr 15
629 # define rtfNeXTGWidth 0
630 # define rtfNeXTGHeight 1
632 # define rtfFieldAttr 16
633 # define rtfFieldDirty 0
634 # define rtfFieldEdited 1
635 # define rtfFieldLocked 2
636 # define rtfFieldPrivate 3
637 # define rtfFieldAlt 4 /* new in 1.10 */
639 # define rtfTOCAttr 17
640 # define rtfTOCType 0
641 # define rtfTOCLevel 1
643 # define rtfPosAttr 18
646 # define rtfRPosMargH 2
647 # define rtfRPosPageH 3
648 # define rtfRPosColH 4
650 # define rtfPosNegX 6 /* new in 1.10 */
651 # define rtfPosXCenter 7
652 # define rtfPosXInside 8
653 # define rtfPosXOutSide 9
654 # define rtfPosXRight 10
655 # define rtfPosXLeft 11
656 # define rtfRPosMargV 12
657 # define rtfRPosPageV 13
658 # define rtfRPosParaV 14
660 # define rtfPosNegY 16 /* new in 1.10 */
661 # define rtfPosYInline 17
662 # define rtfPosYTop 18
663 # define rtfPosYCenter 19
664 # define rtfPosYBottom 20
665 # define rtfNoWrap 21
666 # define rtfDistFromTextAll 22 /* renamed in 1.10 */
667 # define rtfDistFromTextX 23 /* new in 1.10 */
668 # define rtfDistFromTextY 24 /* new in 1.10 */
669 # define rtfTextDistY 25
670 # define rtfDropCapLines 26 /* new in 1.10 */
671 # define rtfDropCapType 27 /* new in 1.10 */
673 # define rtfObjAttr 19
675 # define rtfObjLink 1
676 # define rtfObjAutoLink 2
677 # define rtfObjSubscriber 3
678 # define rtfObjPublisher 4 /* new in 1.10 */
679 # define rtfObjICEmb 5
680 # define rtfObjLinkSelf 6
681 # define rtfObjLock 7
682 # define rtfObjUpdate 8 /* new in 1.10 */
684 # define rtfObjWid 10
685 # define rtfObjSetSize 11
686 # define rtfObjAlign 12 /* new in 1.10 */
687 # define rtfObjTransposeY 13
688 # define rtfObjCropTop 14
689 # define rtfObjCropBottom 15
690 # define rtfObjCropLeft 16
691 # define rtfObjCropRight 17
692 # define rtfObjScaleX 18
693 # define rtfObjScaleY 19
694 # define rtfObjResRTF 20
695 # define rtfObjResPict 21
696 # define rtfObjResBitmap 22
697 # define rtfObjResText 23
698 # define rtfObjResMerge 24
699 # define rtfObjBookmarkPubObj 25
700 # define rtfObjPubAutoUpdate 26
702 # define rtfFNoteAttr 20 /* new in 1.10 */
703 # define rtfFNAlt 0 /* new in 1.10 */
705 # define rtfKeyCodeAttr 21 /* new in 1.10 */
706 # define rtfAltKey 0 /* new in 1.10 */
707 # define rtfShiftKey 1 /* new in 1.10 */
708 # define rtfControlKey 2 /* new in 1.10 */
709 # define rtfFunctionKey 3 /* new in 1.10 */
711 # define rtfACharAttr 22 /* new in 1.10 */
712 # define rtfACBold 0 /* new in 1.10 */
713 # define rtfACAllCaps 1 /* new in 1.10 */
714 # define rtfACForeColor 2 /* new in 1.10 */
715 # define rtfACSubScript 3 /* new in 1.10 */
716 # define rtfACExpand 4 /* new in 1.10 */
717 # define rtfACFontNum 5 /* new in 1.10 */
718 # define rtfACFontSize 6 /* new in 1.10 */
719 # define rtfACItalic 7 /* new in 1.10 */
720 # define rtfACLanguage 8 /* new in 1.10 */
721 # define rtfACOutline 9 /* new in 1.10 */
722 # define rtfACSmallCaps 10 /* new in 1.10 */
723 # define rtfACShadow 11 /* new in 1.10 */
724 # define rtfACStrikeThru 12 /* new in 1.10 */
725 # define rtfACUnderline 13 /* new in 1.10 */
726 # define rtfACDotUnderline 14 /* new in 1.10 */
727 # define rtfACDbUnderline 15 /* new in 1.10 */
728 # define rtfACNoUnderline 16 /* new in 1.10 */
729 # define rtfACWordUnderline 17 /* new in 1.10 */
730 # define rtfACSuperScript 18 /* new in 1.10 */
732 # define rtfFontAttr 23 /* new in 1.10 */
733 # define rtfFontCharSet 0 /* new in 1.10 */
734 # define rtfFontPitch 1 /* new in 1.10 */
735 # define rtfFontCodePage 2 /* new in 1.10 */
736 # define rtfFTypeNil 3 /* new in 1.10 */
737 # define rtfFTypeTrueType 4 /* new in 1.10 */
739 # define rtfFileAttr 24 /* new in 1.10 */
740 # define rtfFileNum 0 /* new in 1.10 */
741 # define rtfFileRelPath 1 /* new in 1.10 */
742 # define rtfFileOSNum 2 /* new in 1.10 */
744 # define rtfFileSource 25 /* new in 1.10 */
745 # define rtfSrcMacintosh 0 /* new in 1.10 */
746 # define rtfSrcDOS 1 /* new in 1.10 */
747 # define rtfSrcNTFS 2 /* new in 1.10 */
748 # define rtfSrcHPFS 3 /* new in 1.10 */
749 # define rtfSrcNetwork 4 /* new in 1.10 */
755 # define rtfDrawAttr 26 /* new in 1.10 */
756 # define rtfDrawLock 0 /* new in 1.10 */
757 # define rtfDrawPageRelX 1 /* new in 1.10 */
758 # define rtfDrawColumnRelX 2 /* new in 1.10 */
759 # define rtfDrawMarginRelX 3 /* new in 1.10 */
760 # define rtfDrawPageRelY 4 /* new in 1.10 */
761 # define rtfDrawColumnRelY 5 /* new in 1.10 */
762 # define rtfDrawMarginRelY 6 /* new in 1.10 */
763 # define rtfDrawHeight 7 /* new in 1.10 */
765 # define rtfDrawBeginGroup 8 /* new in 1.10 */
766 # define rtfDrawGroupCount 9 /* new in 1.10 */
767 # define rtfDrawEndGroup 10 /* new in 1.10 */
768 # define rtfDrawArc 11 /* new in 1.10 */
769 # define rtfDrawCallout 12 /* new in 1.10 */
770 # define rtfDrawEllipse 13 /* new in 1.10 */
771 # define rtfDrawLine 14 /* new in 1.10 */
772 # define rtfDrawPolygon 15 /* new in 1.10 */
773 # define rtfDrawPolyLine 16 /* new in 1.10 */
774 # define rtfDrawRect 17 /* new in 1.10 */
775 # define rtfDrawTextBox 18 /* new in 1.10 */
777 # define rtfDrawOffsetX 19 /* new in 1.10 */
778 # define rtfDrawSizeX 20 /* new in 1.10 */
779 # define rtfDrawOffsetY 21 /* new in 1.10 */
780 # define rtfDrawSizeY 22 /* new in 1.10 */
782 # define rtfCOAngle 23 /* new in 1.10 */
783 # define rtfCOAccentBar 24 /* new in 1.10 */
784 # define rtfCOBestFit 25 /* new in 1.10 */
785 # define rtfCOBorder 26 /* new in 1.10 */
786 # define rtfCOAttachAbsDist 27 /* new in 1.10 */
787 # define rtfCOAttachBottom 28 /* new in 1.10 */
788 # define rtfCOAttachCenter 29 /* new in 1.10 */
789 # define rtfCOAttachTop 30 /* new in 1.10 */
790 # define rtfCOLength 31 /* new in 1.10 */
791 # define rtfCONegXQuadrant 32 /* new in 1.10 */
792 # define rtfCONegYQuadrant 33 /* new in 1.10 */
793 # define rtfCOOffset 34 /* new in 1.10 */
794 # define rtfCOAttachSmart 35 /* new in 1.10 */
795 # define rtfCODoubleLine 36 /* new in 1.10 */
796 # define rtfCORightAngle 37 /* new in 1.10 */
797 # define rtfCOSingleLine 38 /* new in 1.10 */
798 # define rtfCOTripleLine 39 /* new in 1.10 */
800 # define rtfDrawTextBoxMargin 40 /* new in 1.10 */
801 # define rtfDrawTextBoxText 41 /* new in 1.10 */
802 # define rtfDrawRoundRect 42 /* new in 1.10 */
804 # define rtfDrawPointX 43 /* new in 1.10 */
805 # define rtfDrawPointY 44 /* new in 1.10 */
806 # define rtfDrawPolyCount 45 /* new in 1.10 */
808 # define rtfDrawArcFlipX 46 /* new in 1.10 */
809 # define rtfDrawArcFlipY 47 /* new in 1.10 */
811 # define rtfDrawLineBlue 48 /* new in 1.10 */
812 # define rtfDrawLineGreen 49 /* new in 1.10 */
813 # define rtfDrawLineRed 50 /* new in 1.10 */
814 # define rtfDrawLinePalette 51 /* new in 1.10 */
815 # define rtfDrawLineDashDot 52 /* new in 1.10 */
816 # define rtfDrawLineDashDotDot 53 /* new in 1.10 */
817 # define rtfDrawLineDash 54 /* new in 1.10 */
818 # define rtfDrawLineDot 55 /* new in 1.10 */
819 # define rtfDrawLineGray 56 /* new in 1.10 */
820 # define rtfDrawLineHollow 57 /* new in 1.10 */
821 # define rtfDrawLineSolid 58 /* new in 1.10 */
822 # define rtfDrawLineWidth 59 /* new in 1.10 */
824 # define rtfDrawHollowEndArrow 60 /* new in 1.10 */
825 # define rtfDrawEndArrowLength 61 /* new in 1.10 */
826 # define rtfDrawSolidEndArrow 62 /* new in 1.10 */
827 # define rtfDrawEndArrowWidth 63 /* new in 1.10 */
828 # define rtfDrawHollowStartArrow 64 /* new in 1.10 */
829 # define rtfDrawStartArrowLength 65 /* new in 1.10 */
830 # define rtfDrawSolidStartArrow 66 /* new in 1.10 */
831 # define rtfDrawStartArrowWidth 67 /* new in 1.10 */
833 # define rtfDrawBgFillBlue 68 /* new in 1.10 */
834 # define rtfDrawBgFillGreen 69 /* new in 1.10 */
835 # define rtfDrawBgFillRed 70 /* new in 1.10 */
836 # define rtfDrawBgFillPalette 71 /* new in 1.10 */
837 # define rtfDrawBgFillGray 72 /* new in 1.10 */
838 # define rtfDrawFgFillBlue 73 /* new in 1.10 */
839 # define rtfDrawFgFillGreen 74 /* new in 1.10 */
840 # define rtfDrawFgFillRed 75 /* new in 1.10 */
841 # define rtfDrawFgFillPalette 76 /* new in 1.10 */
842 # define rtfDrawFgFillGray 77 /* new in 1.10 */
843 # define rtfDrawFillPatIndex 78 /* new in 1.10 */
845 # define rtfDrawShadow 79 /* new in 1.10 */
846 # define rtfDrawShadowXOffset 80 /* new in 1.10 */
847 # define rtfDrawShadowYOffset 81 /* new in 1.10 */
850 * index entry attributes
853 # define rtfIndexAttr 27 /* new in 1.10 */
854 # define rtfIndexNumber 0 /* new in 1.10 */
855 # define rtfIndexBold 1 /* reclassified in 1.10 */
856 # define rtfIndexItalic 2 /* reclassified in 1.10 */
860 * \wmetafile argument values
863 # define rtfWmMmText 1
864 # define rtfWmMmLometric 2
865 # define rtfWmMmHimetric 3
866 # define rtfWmMmLoenglish 4
867 # define rtfWmMmHienglish 5
868 # define rtfWmMmTwips 6
869 # define rtfWmMmIsotropic 7
870 # define rtfWmMmAnisotropic 8
873 * \pmmetafile argument values
876 # define rtfPmPuArbitrary 4
877 # define rtfPmPuPels 8
878 # define rtfPmPuLometric 12
879 # define rtfPmPuHimetric 16
880 # define rtfPmPuLoenglish 20
881 # define rtfPmPuHienglish 24
882 # define rtfPmPuTwips 28
885 * \lang argument values
888 # define rtfLangNoLang 0x0400
889 # define rtfLangAlbanian 0x041c
890 # define rtfLangArabic 0x0401
891 # define rtfLangBahasa 0x0421
892 # define rtfLangBelgianDutch 0x0813
893 # define rtfLangBelgianFrench 0x080c
894 # define rtfLangBrazilianPortuguese 0x0416
895 # define rtfLangBulgarian 0x0402
896 # define rtfLangCatalan 0x0403
897 # define rtfLangLatinCroatoSerbian 0x041a
898 # define rtfLangCzech 0x0405
899 # define rtfLangDanish 0x0406
900 # define rtfLangDutch 0x0413
901 # define rtfLangAustralianEnglish 0x0c09
902 # define rtfLangUKEnglish 0x0809
903 # define rtfLangUSEnglish 0x0409
904 # define rtfLangFinnish 0x040b
905 # define rtfLangFrench 0x040c
906 # define rtfLangCanadianFrench 0x0c0c
907 # define rtfLangGerman 0x0407
908 # define rtfLangGreek 0x0408
909 # define rtfLangHebrew 0x040d
910 # define rtfLangHungarian 0x040e
911 # define rtfLangIcelandic 0x040f
912 # define rtfLangItalian 0x0410
913 # define rtfLangJapanese 0x0411
914 # define rtfLangKorean 0x0412
915 # define rtfLangBokmalNorwegian 0x0414
916 # define rtfLangNynorskNorwegian 0x0814
917 # define rtfLangPolish 0x0415
918 # define rtfLangPortuguese 0x0816
919 # define rtfLangRhaetoRomanic 0x0417
920 # define rtfLangRomanian 0x0418
921 # define rtfLangRussian 0x0419
922 # define rtfLangCyrillicSerboCroatian 0x081a
923 # define rtfLangSimplifiedChinese 0x0804
924 # define rtfLangSlovak 0x041b
925 # define rtfLangCastilianSpanish 0x040a
926 # define rtfLangMexicanSpanish 0x080a
927 # define rtfLangSwedish 0x041d
928 # define rtfLangSwissFrench 0x100c
929 # define rtfLangSwissGerman 0x0807
930 # define rtfLangSwissItalian 0x0810
931 # define rtfLangThai 0x041e
932 # define rtfLangTraditionalChinese 0x0404
933 # define rtfLangTurkish 0x041f
934 # define rtfLangUrdu 0x0420
940 # define rtfParStyle 0 /* the default */
941 # define rtfCharStyle 1
942 # define rtfSectStyle 2
945 * RTF font, color and style structures. Used for font table,
946 * color table, and stylesheet processing.
949 typedef struct RTFFont RTFFont
;
950 typedef struct RTFColor RTFColor
;
951 typedef struct RTFStyle RTFStyle
;
952 typedef struct RTFStyleElt RTFStyleElt
;
953 typedef struct RTFBorder RTFBorder
;
954 typedef struct RTFCell RTFCell
;
955 typedef struct RTFTable RTFTable
;
959 char *rtfFName
; /* font name */
960 char *rtfFAltName
; /* font alternate name */
961 int rtfFNum
; /* font number */
962 int rtfFFamily
; /* font family */
963 int rtfFCharSet
; /* font charset */
964 int rtfFPitch
; /* font pitch */
965 int rtfFType
; /* font type */
966 int rtfFCodePage
; /* font code page */
967 RTFFont
*rtfNextFont
; /* next font in list */
972 * Color values are -1 if the default color for the color
973 * number should be used. The default color is writer-dependent.
978 int rtfCNum
; /* color number */
979 int rtfCRed
; /* red value */
980 int rtfCGreen
; /* green value */
981 int rtfCBlue
; /* blue value */
982 RTFColor
*rtfNextColor
; /* next color in list */
988 char *rtfSName
; /* style name */
989 int rtfSType
; /* style type */
990 int rtfSAdditive
; /* whether or not style is additive */
991 int rtfSNum
; /* style number */
992 int rtfSBasedOn
; /* style this one's based on */
993 int rtfSNextPar
; /* style next paragraph style */
994 RTFStyleElt
*rtfSSEList
; /* list of style words */
995 int rtfExpanding
; /* non-zero = being expanded */
996 RTFStyle
*rtfNextStyle
; /* next style in style list */
1002 int rtfSEClass
; /* token class */
1003 int rtfSEMajor
; /* token major number */
1004 int rtfSEMinor
; /* token minor number */
1005 int rtfSEParam
; /* control symbol parameter */
1006 char *rtfSEText
; /* text of symbol */
1007 RTFStyleElt
*rtfNextSE
; /* next element in style */
1019 RTFBorder border
[4];
1025 RTFCell cells
[MAX_TABLE_CELLS
];
1026 int numCellsDefined
;
1029 /* borders for the table row */
1030 RTFBorder border
[6];
1032 /* Used in v1.0 - v3.0 */
1033 int numCellsInserted
;
1036 /* tableRowStart may be the start row paragraph of the table row,
1037 * or it may store the end of the previous row if it may still be
1038 * continued, otherwise NULL is stored. */
1039 ME_DisplayItem
*tableRowStart
;
1041 /* Table definitions are stored as a stack to support nested tables. */
1046 # define RTFBorderTypeNone 0x00
1047 # define RTFBorderTypePara 0x10 /* for \brdrX control words */
1048 # define RTFBorderTypeRow 0x20 /* for \trbrdrX control words */
1049 # define RTFBorderTypeCell 0x30 /* for \clbrdrX control words */
1050 # define RTFBorderTypeMask 0xf0
1052 /* The X in the control words \brdrX \trbrdrX and \clbrdrX mentioned above
1053 * should be one of t, l, b, r which stand for top, left, bottom, right
1055 # define RTFBorderSideTop 0x00
1056 # define RTFBorderSideLeft 0x01
1057 # define RTFBorderSideBottom 0x02
1058 # define RTFBorderSideRight 0x03
1059 # define RTFBorderSideHorizontal 0x04
1060 # define RTFBorderSideVertical 0x05
1061 # define RTFBorderSideMask 0x0f
1063 /* Here are the values from the border types and sides put together. */
1064 # define RTFBorderParaTop 0x10
1065 # define RTFBorderParaLeft 0x11
1066 # define RTFBorderParaBottom 0x12
1067 # define RTFBorderParaRight 0x13
1068 # define RTFBorderRowTop 0x20
1069 # define RTFBorderRowLeft 0x21
1070 # define RTFBorderRowBottom 0x22
1071 # define RTFBorderRowRight 0x23
1072 # define RTFBorderRowHorizontal 0x24
1073 # define RTFBorderRowVertical 0x25
1074 # define RTFBorderCellTop 0x30
1075 # define RTFBorderCellLeft 0x31
1076 # define RTFBorderCellBottom 0x32
1077 # define RTFBorderCellRight 0x33
1080 * Return pointer to new element of type t, or NULL
1081 * if no memory available.
1084 # define New(t) (heap_alloc (sizeof (t)))
1086 /* Parser stack size */
1088 # define maxStack 32
1091 typedef struct _RTF_Info RTF_Info
;
1093 typedef void (*RTFFuncPtr
) (RTF_Info
*); /* generic function pointer */
1096 /* RTF parser stack element */
1097 struct tagRTFState
{
1102 typedef struct tagRTFState RTFState
;
1107 * Public variables (listed in rtf.h)
1111 * Information pertaining to last token read by RTFToken. The
1112 * text is exactly as it occurs in the input file, e.g., "\{"
1113 * will be found in rtfTextBuf as "\{", even though it means "{".
1114 * These variables are also set when styles are reprocessed.
1133 int pushedChar
; /* pushback char if read too far */
1135 int pushedClass
; /* pushed token info for RTFUngetToken() */
1139 char *pushedTextBuf
;
1144 /* Document-wide attributes */
1145 RTFFont
*fontList
; /* these lists MUST be */
1146 RTFColor
*colorList
; /* initialized to NULL */
1147 RTFStyle
*styleList
;
1148 int ansiCodePage
; /* ANSI codepage used in conversion to Unicode */
1151 /* Character attributes */
1152 int unicodeLength
; /* The length of ANSI representation of Unicode characters */
1153 int codePage
; /* Current codepage for text conversion */
1158 ME_InStream
*stream
;
1160 ME_TextEditor
*editor
;
1163 RTFFuncPtr ccb
[rtfMaxClass
]; /* class callbacks */
1165 RTFFuncPtr dcb
[rtfMaxDestination
]; /* destination callbacks */
1167 RTFFuncPtr readHook
;
1169 DWORD dwOutputCount
;
1170 WCHAR OutputBuffer
[0x1000];
1172 DWORD dwCPOutputCount
;
1173 DWORD dwMaxCPOutputCount
;
1174 char *cpOutputBuffer
;
1176 RTFState stack
[maxStack
];
1179 LPRICHEDITOLE lpRichEditOle
;
1183 BOOL canInheritInTbl
;
1184 int borderType
; /* value corresponds to the RTFBorder constants. */
1189 * Public RTF reader routines
1192 void RTFInit (RTF_Info
*);
1193 void RTFDestroy(RTF_Info
*info
);
1194 void RTFSetInputName (RTF_Info
*, const char *);
1195 char *RTFGetInputName (const RTF_Info
*);
1196 void RTFSetOutputName (RTF_Info
*, const char *);
1197 char *RTFGetOutputName (const RTF_Info
*);
1198 void RTFSetDestinationCallback (RTF_Info
*, int, RTFFuncPtr
);
1199 void RTFRead (RTF_Info
*);
1200 int RTFGetToken (RTF_Info
*); /* writer should rarely need this */
1201 int RTFPeekToken (RTF_Info
*);
1202 void RTFSetReadHook (RTF_Info
*, RTFFuncPtr
);
1203 void RTFRouteToken (RTF_Info
*);
1204 void RTFSkipGroup (RTF_Info
*);
1205 void RTFReadGroup (RTF_Info
*);
1206 void RTFExpandStyle (RTF_Info
*, int);
1207 int RTFCheckCM (const RTF_Info
*, int, int);
1208 int RTFCheckCMM (const RTF_Info
*, int, int, int);
1209 int RTFCheckMM (const RTF_Info
*, int, int);
1210 RTFFont
*RTFGetFont (const RTF_Info
*, int);
1211 RTFColor
*RTFGetColor (const RTF_Info
*, int);
1212 int RTFCharToHex ( char);
1213 int RTFHexToChar ( int );
1215 void RTFFlushOutputBuffer( RTF_Info
*info
);
1216 void RTFSetEditStream(RTF_Info
*info
, ME_InStream
*stream
);
1218 void WriterInit (RTF_Info
*);
1219 int BeginFile (RTF_Info
*);
1221 int RTFCharSetToCodePage(RTF_Info
*info
, int charset
);
1223 void LookupInit (void);
1224 void LookupCleanup (void);