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