- Conversions between variants types of the same size should ignore
[wine/multimedia.git] / dlls / riched20 / rtf.h
blob53ec6eeac21a07dd276a98ff28e9c565dc636713
1 #ifndef _RTF
2 #define _RTF
4 #include <stdarg.h>
5 #include <stdio.h>
7 #include "windef.h"
8 #include "winbase.h"
9 #include "wingdi.h"
10 #include "winuser.h"
11 #include "richedit.h"
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.
24 # define rtfTpi 1440
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 * distinquish 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
55 * global token vars.
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)
78 # define rtfUnknown 0
79 # define rtfGroup 1
80 # define rtfText 2
81 # define rtfControl 3
82 # define rtfEOF 4
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.
96 # define rtfVersion 0
98 # define rtfDefFont 1
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 */
120 # define rtfInfo 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 */
132 # define rtfFNSep 22
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
154 # define rtfPict 44
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 */
175 # define rtfField 65
176 # define rtfFieldInst 66
177 # define rtfFieldResult 67
178 # define rtfDataField 68 /* new in 1.10 */
179 # define rtfIndex 69
180 # define rtfIndexText 70
181 # define rtfIndexRange 71
182 # define rtfTOC 72
183 # define rtfNeXTGraphic 73
184 # define rtfGenerator 74
185 # define rtfMaxDestination 75 /* highest dest + 1 */
187 # define rtfFontFamily 4
188 # define rtfFFNil 0
189 # define rtfFFRoman 1
190 # define rtfFFSwiss 2
191 # define rtfFFModern 3
192 # define rtfFFScript 4
193 # define rtfFFDecor 5
194 # define rtfFFTech 6
195 # define rtfFFBidirectional 7 /* new in 1.10 */
197 # define rtfColorName 5
198 # define rtfRed 0
199 # define rtfGreen 1
200 # define rtfBlue 2
202 # define rtfSpecialChar 6
203 /* special chars seen in \info destination */
204 # define rtfIIntVersion 0
205 # define rtfICreateTime 1
206 # define rtfIRevisionTime 2
207 # define rtfIPrintTime 3
208 # define rtfIBackupTime 4
209 # define rtfIEditTime 5
210 # define rtfIYear 6
211 # define rtfIMonth 7
212 # define rtfIDay 8
213 # define rtfIHour 9
214 # define rtfIMinute 10
215 # define rtfISecond 11 /* new in 1.10 */
216 # define rtfINPages 12
217 # define rtfINWords 13
218 # define rtfINChars 14
219 # define rtfIIntID 15
220 /* other special chars */
221 # define rtfCurHeadDate 16
222 # define rtfCurHeadDateLong 17
223 # define rtfCurHeadDateAbbrev 18
224 # define rtfCurHeadTime 19
225 # define rtfCurHeadPage 20
226 # define rtfSectNum 21 /* new in 1.10 */
227 # define rtfCurFNote 22
228 # define rtfCurAnnotRef 23
229 # define rtfFNoteSep 24
230 # define rtfFNoteCont 25
231 # define rtfCell 26
232 # define rtfRow 27
233 # define rtfPar 28
234 # define rtfSect 29
235 # define rtfPage 30
236 # define rtfColumn 31
237 # define rtfLine 32
238 # define rtfSoftPage 33 /* new in 1.10 */
239 # define rtfSoftColumn 34 /* new in 1.10 */
240 # define rtfSoftLine 35 /* new in 1.10 */
241 # define rtfSoftLineHt 36 /* new in 1.10 */
242 # define rtfTab 37
243 # define rtfEmDash 38
244 # define rtfEnDash 39
245 # define rtfEmSpace 40 /* new in 1.10 */
246 # define rtfEnSpace 41 /* new in 1.10 */
247 # define rtfBullet 42
248 # define rtfLQuote 43
249 # define rtfRQuote 44
250 # define rtfLDblQuote 45
251 # define rtfRDblQuote 46
252 # define rtfFormula 47
253 # define rtfNoBrkSpace 49
254 # define rtfNoReqHyphen 50
255 # define rtfNoBrkHyphen 51
256 # define rtfOptDest 52
257 # define rtfLTRMark 53 /* new in 1.10 */
258 # define rtfRTLMark 54 /* new in 1.10 */
259 # define rtfNoWidthJoiner 55 /* new in 1.10 */
260 # define rtfNoWidthNonJoiner 56 /* new in 1.10 */
261 # define rtfCurHeadPict 57 /* valid? */
262 /*# define rtfCurAnnot 58*/ /* apparently not used */
263 # define rtfUnicode 58 /* no better category*/
265 # define rtfStyleAttr 7
266 # define rtfAdditive 0 /* new in 1.10 */
267 # define rtfBasedOn 1
268 # define rtfNext 2
270 # define rtfDocAttr 8
271 # define rtfDefTab 0
272 # define rtfHyphHotZone 1
273 # define rtfHyphConsecLines 2 /* new in 1.10 */
274 # define rtfHyphCaps 3 /* new in 1.10 */
275 # define rtfHyphAuto 4 /* new in 1.10 */
276 # define rtfLineStart 5
277 # define rtfFracWidth 6
278 # define rtfMakeBackup 7
279 # define rtfRTFDefault 8
280 # define rtfPSOverlay 9
281 # define rtfDocTemplate 10 /* new in 1.10 */
282 # define rtfDefLanguage 11
283 # define rtfFENoteType 12 /* new in 1.10 */
284 # define rtfFNoteEndSect 13
285 # define rtfFNoteEndDoc 14
286 # define rtfFNoteText 15
287 # define rtfFNoteBottom 16
288 # define rtfENoteEndSect 17 /* new in 1.10 */
289 # define rtfENoteEndDoc 18 /* new in 1.10 */
290 # define rtfENoteText 19 /* new in 1.10 */
291 # define rtfENoteBottom 20 /* new in 1.10 */
292 # define rtfFNoteStart 21
293 # define rtfENoteStart 22 /* new in 1.10 */
294 # define rtfFNoteRestartPage 23 /* new in 1.10 */
295 # define rtfFNoteRestart 24
296 # define rtfFNoteRestartCont 25 /* new in 1.10 */
297 # define rtfENoteRestart 26 /* new in 1.10 */
298 # define rtfENoteRestartCont 27 /* new in 1.10 */
299 # define rtfFNoteNumArabic 28 /* new in 1.10 */
300 # define rtfFNoteNumLLetter 29 /* new in 1.10 */
301 # define rtfFNoteNumULetter 30 /* new in 1.10 */
302 # define rtfFNoteNumLRoman 31 /* new in 1.10 */
303 # define rtfFNoteNumURoman 32 /* new in 1.10 */
304 # define rtfFNoteNumChicago 33 /* new in 1.10 */
305 # define rtfENoteNumArabic 34 /* new in 1.10 */
306 # define rtfENoteNumLLetter 35 /* new in 1.10 */
307 # define rtfENoteNumULetter 36 /* new in 1.10 */
308 # define rtfENoteNumLRoman 37 /* new in 1.10 */
309 # define rtfENoteNumURoman 38 /* new in 1.10 */
310 # define rtfENoteNumChicago 39 /* new in 1.10 */
311 # define rtfPaperWidth 40
312 # define rtfPaperHeight 41
313 # define rtfPaperSize 42 /* new in 1.10 */
314 # define rtfLeftMargin 43
315 # define rtfRightMargin 44
316 # define rtfTopMargin 45
317 # define rtfBottomMargin 46
318 # define rtfFacingPage 47
319 # define rtfGutterWid 48
320 # define rtfMirrorMargin 49
321 # define rtfLandscape 50
322 # define rtfPageStart 51
323 # define rtfWidowCtrl 52
324 # define rtfLinkStyles 53 /* new in 1.10 */
325 # define rtfNoAutoTabIndent 54 /* new in 1.10 */
326 # define rtfWrapSpaces 55 /* new in 1.10 */
327 # define rtfPrintColorsBlack 56 /* new in 1.10 */
328 # define rtfNoExtraSpaceRL 57 /* new in 1.10 */
329 # define rtfNoColumnBalance 58 /* new in 1.10 */
330 # define rtfCvtMailMergeQuote 59 /* new in 1.10 */
331 # define rtfSuppressTopSpace 60 /* new in 1.10 */
332 # define rtfSuppressPreParSpace 61 /* new in 1.10 */
333 # define rtfCombineTblBorders 62 /* new in 1.10 */
334 # define rtfTranspMetafiles 63 /* new in 1.10 */
335 # define rtfSwapBorders 64 /* new in 1.10 */
336 # define rtfShowHardBreaks 65 /* new in 1.10 */
337 # define rtfFormProtected 66 /* new in 1.10 */
338 # define rtfAllProtected 67 /* new in 1.10 */
339 # define rtfFormShading 68 /* new in 1.10 */
340 # define rtfFormDisplay 69 /* new in 1.10 */
341 # define rtfPrintData 70 /* new in 1.10 */
342 # define rtfRevProtected 71 /* new in 1.10 */
343 # define rtfRevisions 72
344 # define rtfRevDisplay 73
345 # define rtfRevBar 74
346 # define rtfAnnotProtected 75 /* new in 1.10 */
347 # define rtfRTLDoc 76 /* new in 1.10 */
348 # define rtfLTRDoc 77 /* new in 1.10 */
349 # define rtfAnsiCodePage 78
350 # define rtfUTF8RTF 79
352 # define rtfSectAttr 9
353 # define rtfSectDef 0
354 # define rtfENoteHere 1
355 # define rtfPrtBinFirst 2
356 # define rtfPrtBin 3
357 # define rtfSectStyleNum 4 /* new in 1.10 */
358 # define rtfNoBreak 5
359 # define rtfColBreak 6
360 # define rtfPageBreak 7
361 # define rtfEvenBreak 8
362 # define rtfOddBreak 9
363 # define rtfColumns 10
364 # define rtfColumnSpace 11
365 # define rtfColumnNumber 12 /* new in 1.10 */
366 # define rtfColumnSpRight 13 /* new in 1.10 */
367 # define rtfColumnWidth 14 /* new in 1.10 */
368 # define rtfColumnLine 15
369 # define rtfLineModulus 16
370 # define rtfLineDist 17
371 # define rtfLineStarts 18
372 # define rtfLineRestart 19
373 # define rtfLineRestartPg 20
374 # define rtfLineCont 21
375 # define rtfSectPageWid 22
376 # define rtfSectPageHt 23
377 # define rtfSectMarginLeft 24
378 # define rtfSectMarginRight 25
379 # define rtfSectMarginTop 26
380 # define rtfSectMarginBottom 27
381 # define rtfSectMarginGutter 28
382 # define rtfSectLandscape 29
383 # define rtfTitleSpecial 30
384 # define rtfHeaderY 31
385 # define rtfFooterY 32
386 # define rtfPageStarts 33
387 # define rtfPageCont 34
388 # define rtfPageRestart 35
389 # define rtfPageNumRight 36 /* renamed in 1.10 */
390 # define rtfPageNumTop 37
391 # define rtfPageDecimal 38
392 # define rtfPageURoman 39
393 # define rtfPageLRoman 40
394 # define rtfPageULetter 41
395 # define rtfPageLLetter 42
396 # define rtfPageNumHyphSep 43 /* new in 1.10 */
397 # define rtfPageNumSpaceSep 44 /* new in 1.10 */
398 # define rtfPageNumColonSep 45 /* new in 1.10 */
399 # define rtfPageNumEmdashSep 46 /* new in 1.10 */
400 # define rtfPageNumEndashSep 47 /* new in 1.10 */
401 # define rtfTopVAlign 48
402 # define rtfBottomVAlign 49
403 # define rtfCenterVAlign 50
404 # define rtfJustVAlign 51
405 # define rtfRTLSect 52 /* new in 1.10 */
406 # define rtfLTRSect 53 /* new in 1.10 */
408 # define rtfTblAttr 10
409 # define rtfRowDef 0
410 # define rtfRowGapH 1
411 # define rtfCellPos 2
412 # define rtfMergeRngFirst 3
413 # define rtfMergePrevious 4
414 # define rtfRowLeft 5
415 # define rtfRowRight 6
416 # define rtfRowCenter 7
417 # define rtfRowLeftEdge 8
418 # define rtfRowHt 9
419 # define rtfRowHeader 10 /* new in 1.10 */
420 # define rtfRowKeep 11 /* new in 1.10 */
421 # define rtfRTLRow 12 /* new in 1.10 */
422 # define rtfLTRRow 13 /* new in 1.10 */
423 # define rtfRowBordTop 14 /* new in 1.10 */
424 # define rtfRowBordLeft 15 /* new in 1.10 */
425 # define rtfRowBordBottom 16 /* new in 1.10 */
426 # define rtfRowBordRight 17 /* new in 1.10 */
427 # define rtfRowBordHoriz 18 /* new in 1.10 */
428 # define rtfRowBordVert 19 /* new in 1.10 */
429 # define rtfCellBordBottom 20
430 # define rtfCellBordTop 21
431 # define rtfCellBordLeft 22
432 # define rtfCellBordRight 23
433 # define rtfCellShading 24
434 # define rtfCellBgPatH 25
435 # define rtfCellBgPatV 26
436 # define rtfCellFwdDiagBgPat 27
437 # define rtfCellBwdDiagBgPat 28
438 # define rtfCellHatchBgPat 29
439 # define rtfCellDiagHatchBgPat 30
440 # define rtfCellDarkBgPatH 31
441 # define rtfCellDarkBgPatV 32
442 # define rtfCellFwdDarkBgPat 33
443 # define rtfCellBwdDarkBgPat 34
444 # define rtfCellDarkHatchBgPat 35
445 # define rtfCellDarkDiagHatchBgPat 36
446 # define rtfCellBgPatLineColor 37
447 # define rtfCellBgPatColor 38
449 # define rtfParAttr 11
450 # define rtfParDef 0
451 # define rtfStyleNum 1
452 # define rtfHyphenate 2 /* new in 1.10 */
453 # define rtfInTable 3
454 # define rtfKeep 4
455 # define rtfNoWidowControl 5 /* new in 1.10 */
456 # define rtfKeepNext 6
457 # define rtfOutlineLevel 7 /* new in 1.10 */
458 # define rtfNoLineNum 8
459 # define rtfPBBefore 9
460 # define rtfSideBySide 10
461 # define rtfQuadLeft 11
462 # define rtfQuadRight 12
463 # define rtfQuadJust 13
464 # define rtfQuadCenter 14
465 # define rtfFirstIndent 15
466 # define rtfLeftIndent 16
467 # define rtfRightIndent 17
468 # define rtfSpaceBefore 18
469 # define rtfSpaceAfter 19
470 # define rtfSpaceBetween 20
471 # define rtfSpaceMultiply 21 /* new in 1.10 */
472 # define rtfSubDocument 22 /* new in 1.10 */
473 # define rtfRTLPar 23 /* new in 1.10 */
474 # define rtfLTRPar 24 /* new in 1.10 */
475 # define rtfTabPos 25
476 # define rtfTabLeft 26 /* new in 1.10 */
477 # define rtfTabRight 27
478 # define rtfTabCenter 28
479 # define rtfTabDecimal 29
480 # define rtfTabBar 30
481 # define rtfLeaderDot 31
482 # define rtfLeaderHyphen 32
483 # define rtfLeaderUnder 33
484 # define rtfLeaderThick 34
485 # define rtfLeaderEqual 35
486 # define rtfParLevel 36 /* new in 1.10 */
487 # define rtfParBullet 37 /* new in 1.10 */
488 # define rtfParSimple 38 /* new in 1.10 */
489 # define rtfParNumCont 39 /* new in 1.10 */
490 # define rtfParNumOnce 40 /* new in 1.10 */
491 # define rtfParNumAcross 41 /* new in 1.10 */
492 # define rtfParHangIndent 42 /* new in 1.10 */
493 # define rtfParNumRestart 43 /* new in 1.10 */
494 # define rtfParNumCardinal 44 /* new in 1.10 */
495 # define rtfParNumDecimal 45 /* new in 1.10 */
496 # define rtfParNumULetter 46 /* new in 1.10 */
497 # define rtfParNumURoman 47 /* new in 1.10 */
498 # define rtfParNumLLetter 48 /* new in 1.10 */
499 # define rtfParNumLRoman 49 /* new in 1.10 */
500 # define rtfParNumOrdinal 50 /* new in 1.10 */
501 # define rtfParNumOrdinalText 51 /* new in 1.10 */
502 # define rtfParNumBold 52 /* new in 1.10 */
503 # define rtfParNumItalic 53 /* new in 1.10 */
504 # define rtfParNumAllCaps 54 /* new in 1.10 */
505 # define rtfParNumSmallCaps 55 /* new in 1.10 */
506 # define rtfParNumUnder 56 /* new in 1.10 */
507 # define rtfParNumDotUnder 57 /* new in 1.10 */
508 # define rtfParNumDbUnder 58 /* new in 1.10 */
509 # define rtfParNumNoUnder 59 /* new in 1.10 */
510 # define rtfParNumWordUnder 60 /* new in 1.10 */
511 # define rtfParNumStrikethru 61 /* new in 1.10 */
512 # define rtfParNumForeColor 62 /* new in 1.10 */
513 # define rtfParNumFont 63 /* new in 1.10 */
514 # define rtfParNumFontSize 64 /* new in 1.10 */
515 # define rtfParNumIndent 65 /* new in 1.10 */
516 # define rtfParNumSpacing 66 /* new in 1.10 */
517 # define rtfParNumInclPrev 67 /* new in 1.10 */
518 # define rtfParNumCenter 68 /* new in 1.10 */
519 # define rtfParNumLeft 69 /* new in 1.10 */
520 # define rtfParNumRight 70 /* new in 1.10 */
521 # define rtfParNumStartAt 71 /* new in 1.10 */
522 # define rtfBorderTop 72
523 # define rtfBorderBottom 73
524 # define rtfBorderLeft 74
525 # define rtfBorderRight 75
526 # define rtfBorderBetween 76
527 # define rtfBorderBar 77
528 # define rtfBorderBox 78
529 # define rtfBorderSingle 79
530 # define rtfBorderThick 80
531 # define rtfBorderShadow 81
532 # define rtfBorderDouble 82
533 # define rtfBorderDot 83
534 # define rtfBorderDash 84 /* new in 1.10 */
535 # define rtfBorderHair 85
536 # define rtfBorderWidth 86
537 # define rtfBorderColor 87
538 # define rtfBorderSpace 88
539 # define rtfShading 89
540 # define rtfBgPatH 90
541 # define rtfBgPatV 91
542 # define rtfFwdDiagBgPat 92
543 # define rtfBwdDiagBgPat 93
544 # define rtfHatchBgPat 94
545 # define rtfDiagHatchBgPat 95
546 # define rtfDarkBgPatH 96
547 # define rtfDarkBgPatV 97
548 # define rtfFwdDarkBgPat 98
549 # define rtfBwdDarkBgPat 99
550 # define rtfDarkHatchBgPat 100
551 # define rtfDarkDiagHatchBgPat 101
552 # define rtfBgPatLineColor 102
553 # define rtfBgPatColor 103
555 # define rtfCharAttr 12
556 # define rtfPlain 0
557 # define rtfBold 1
558 # define rtfAllCaps 2
559 # define rtfDeleted 3
560 # define rtfSubScript 4
561 # define rtfSubScrShrink 5 /* new in 1.10 */
562 # define rtfNoSuperSub 6 /* new in 1.10 */
563 # define rtfExpand 7
564 # define rtfExpandTwips 8 /* new in 1.10 */
565 # define rtfKerning 9 /* new in 1.10 */
566 # define rtfFontNum 10
567 # define rtfFontSize 11
568 # define rtfItalic 12
569 # define rtfOutline 13
570 # define rtfRevised 14
571 # define rtfRevAuthor 15 /* new in 1.10 */
572 # define rtfRevDTTM 16 /* new in 1.10 */
573 # define rtfSmallCaps 17
574 # define rtfShadow 18
575 # define rtfStrikeThru 19
576 # define rtfUnderline 20
577 # define rtfDotUnderline 21 /* renamed in 1.10 */
578 # define rtfDbUnderline 22
579 # define rtfNoUnderline 23
580 # define rtfWordUnderline 24 /* renamed in 1.10 */
581 # define rtfSuperScript 25
582 # define rtfSuperScrShrink 26 /* new in 1.10 */
583 # define rtfInvisible 27
584 # define rtfForeColor 28
585 # define rtfBackColor 29
586 # define rtfRTLChar 30 /* new in 1.10 */
587 # define rtfLTRChar 31 /* new in 1.10 */
588 # define rtfCharStyleNum 32 /* new in 1.10 */
589 # define rtfCharCharSet 33 /* new in 1.10 */
590 # define rtfLanguage 34
591 # define rtfGray 35
592 # define rtfUnicodeLength 36
594 # define rtfPictAttr 13
595 # define rtfMacQD 0
596 # define rtfPMMetafile 1
597 # define rtfWinMetafile 2
598 # define rtfDevIndBitmap 3
599 # define rtfWinBitmap 4
600 # define rtfPixelBits 5
601 # define rtfBitmapPlanes 6
602 # define rtfBitmapWid 7
603 # define rtfPicWid 8
604 # define rtfPicHt 9
605 # define rtfPicGoalWid 10
606 # define rtfPicGoalHt 11
607 # define rtfPicScaleX 12
608 # define rtfPicScaleY 13
609 # define rtfPicScaled 14
610 # define rtfPicCropTop 15
611 # define rtfPicCropBottom 16
612 # define rtfPicCropLeft 17
613 # define rtfPicCropRight 18
614 # define rtfPicMFHasBitmap 19 /* new in 1.10 */
615 # define rtfPicMFBitsPerPixel 20 /* new in 1.10 */
616 # define rtfPicBinary 21
618 # define rtfBookmarkAttr 14
619 # define rtfBookmarkFirstCol 0
620 # define rtfBookmarkLastCol 1
622 # define rtfNeXTGrAttr 15
623 # define rtfNeXTGWidth 0
624 # define rtfNeXTGHeight 1
626 # define rtfFieldAttr 16
627 # define rtfFieldDirty 0
628 # define rtfFieldEdited 1
629 # define rtfFieldLocked 2
630 # define rtfFieldPrivate 3
631 # define rtfFieldAlt 4 /* new in 1.10 */
633 # define rtfTOCAttr 17
634 # define rtfTOCType 0
635 # define rtfTOCLevel 1
637 # define rtfPosAttr 18
638 # define rtfAbsWid 0
639 # define rtfAbsHt 1
640 # define rtfRPosMargH 2
641 # define rtfRPosPageH 3
642 # define rtfRPosColH 4
643 # define rtfPosX 5
644 # define rtfPosNegX 6 /* new in 1.10 */
645 # define rtfPosXCenter 7
646 # define rtfPosXInside 8
647 # define rtfPosXOutSide 9
648 # define rtfPosXRight 10
649 # define rtfPosXLeft 11
650 # define rtfRPosMargV 12
651 # define rtfRPosPageV 13
652 # define rtfRPosParaV 14
653 # define rtfPosY 15
654 # define rtfPosNegY 16 /* new in 1.10 */
655 # define rtfPosYInline 17
656 # define rtfPosYTop 18
657 # define rtfPosYCenter 19
658 # define rtfPosYBottom 20
659 # define rtfNoWrap 21
660 # define rtfDistFromTextAll 22 /* renamed in 1.10 */
661 # define rtfDistFromTextX 23 /* new in 1.10 */
662 # define rtfDistFromTextY 24 /* new in 1.10 */
663 # define rtfTextDistY 25
664 # define rtfDropCapLines 26 /* new in 1.10 */
665 # define rtfDropCapType 27 /* new in 1.10 */
667 # define rtfObjAttr 19
668 # define rtfObjEmb 0
669 # define rtfObjLink 1
670 # define rtfObjAutoLink 2
671 # define rtfObjSubscriber 3
672 # define rtfObjPublisher 4 /* new in 1.10 */
673 # define rtfObjICEmb 5
674 # define rtfObjLinkSelf 6
675 # define rtfObjLock 7
676 # define rtfObjUpdate 8 /* new in 1.10 */
677 # define rtfObjHt 9
678 # define rtfObjWid 10
679 # define rtfObjSetSize 11
680 # define rtfObjAlign 12 /* new in 1.10 */
681 # define rtfObjTransposeY 13
682 # define rtfObjCropTop 14
683 # define rtfObjCropBottom 15
684 # define rtfObjCropLeft 16
685 # define rtfObjCropRight 17
686 # define rtfObjScaleX 18
687 # define rtfObjScaleY 19
688 # define rtfObjResRTF 20
689 # define rtfObjResPict 21
690 # define rtfObjResBitmap 22
691 # define rtfObjResText 23
692 # define rtfObjResMerge 24
693 # define rtfObjBookmarkPubObj 25
694 # define rtfObjPubAutoUpdate 26
696 # define rtfFNoteAttr 20 /* new in 1.10 */
697 # define rtfFNAlt 0 /* new in 1.10 */
699 # define rtfKeyCodeAttr 21 /* new in 1.10 */
700 # define rtfAltKey 0 /* new in 1.10 */
701 # define rtfShiftKey 1 /* new in 1.10 */
702 # define rtfControlKey 2 /* new in 1.10 */
703 # define rtfFunctionKey 3 /* new in 1.10 */
705 # define rtfACharAttr 22 /* new in 1.10 */
706 # define rtfACBold 0 /* new in 1.10 */
707 # define rtfACAllCaps 1 /* new in 1.10 */
708 # define rtfACForeColor 2 /* new in 1.10 */
709 # define rtfACSubScript 3 /* new in 1.10 */
710 # define rtfACExpand 4 /* new in 1.10 */
711 # define rtfACFontNum 5 /* new in 1.10 */
712 # define rtfACFontSize 6 /* new in 1.10 */
713 # define rtfACItalic 7 /* new in 1.10 */
714 # define rtfACLanguage 8 /* new in 1.10 */
715 # define rtfACOutline 9 /* new in 1.10 */
716 # define rtfACSmallCaps 10 /* new in 1.10 */
717 # define rtfACShadow 11 /* new in 1.10 */
718 # define rtfACStrikeThru 12 /* new in 1.10 */
719 # define rtfACUnderline 13 /* new in 1.10 */
720 # define rtfACDotUnderline 14 /* new in 1.10 */
721 # define rtfACDbUnderline 15 /* new in 1.10 */
722 # define rtfACNoUnderline 16 /* new in 1.10 */
723 # define rtfACWordUnderline 17 /* new in 1.10 */
724 # define rtfACSuperScript 18 /* new in 1.10 */
726 # define rtfFontAttr 23 /* new in 1.10 */
727 # define rtfFontCharSet 0 /* new in 1.10 */
728 # define rtfFontPitch 1 /* new in 1.10 */
729 # define rtfFontCodePage 2 /* new in 1.10 */
730 # define rtfFTypeNil 3 /* new in 1.10 */
731 # define rtfFTypeTrueType 4 /* new in 1.10 */
733 # define rtfFileAttr 24 /* new in 1.10 */
734 # define rtfFileNum 0 /* new in 1.10 */
735 # define rtfFileRelPath 1 /* new in 1.10 */
736 # define rtfFileOSNum 2 /* new in 1.10 */
738 # define rtfFileSource 25 /* new in 1.10 */
739 # define rtfSrcMacintosh 0 /* new in 1.10 */
740 # define rtfSrcDOS 1 /* new in 1.10 */
741 # define rtfSrcNTFS 2 /* new in 1.10 */
742 # define rtfSrcHPFS 3 /* new in 1.10 */
743 # define rtfSrcNetwork 4 /* new in 1.10 */
746 * Drawing attributes
749 # define rtfDrawAttr 26 /* new in 1.10 */
750 # define rtfDrawLock 0 /* new in 1.10 */
751 # define rtfDrawPageRelX 1 /* new in 1.10 */
752 # define rtfDrawColumnRelX 2 /* new in 1.10 */
753 # define rtfDrawMarginRelX 3 /* new in 1.10 */
754 # define rtfDrawPageRelY 4 /* new in 1.10 */
755 # define rtfDrawColumnRelY 5 /* new in 1.10 */
756 # define rtfDrawMarginRelY 6 /* new in 1.10 */
757 # define rtfDrawHeight 7 /* new in 1.10 */
759 # define rtfDrawBeginGroup 8 /* new in 1.10 */
760 # define rtfDrawGroupCount 9 /* new in 1.10 */
761 # define rtfDrawEndGroup 10 /* new in 1.10 */
762 # define rtfDrawArc 11 /* new in 1.10 */
763 # define rtfDrawCallout 12 /* new in 1.10 */
764 # define rtfDrawEllipse 13 /* new in 1.10 */
765 # define rtfDrawLine 14 /* new in 1.10 */
766 # define rtfDrawPolygon 15 /* new in 1.10 */
767 # define rtfDrawPolyLine 16 /* new in 1.10 */
768 # define rtfDrawRect 17 /* new in 1.10 */
769 # define rtfDrawTextBox 18 /* new in 1.10 */
771 # define rtfDrawOffsetX 19 /* new in 1.10 */
772 # define rtfDrawSizeX 20 /* new in 1.10 */
773 # define rtfDrawOffsetY 21 /* new in 1.10 */
774 # define rtfDrawSizeY 22 /* new in 1.10 */
776 # define rtfCOAngle 23 /* new in 1.10 */
777 # define rtfCOAccentBar 24 /* new in 1.10 */
778 # define rtfCOBestFit 25 /* new in 1.10 */
779 # define rtfCOBorder 26 /* new in 1.10 */
780 # define rtfCOAttachAbsDist 27 /* new in 1.10 */
781 # define rtfCOAttachBottom 28 /* new in 1.10 */
782 # define rtfCOAttachCenter 29 /* new in 1.10 */
783 # define rtfCOAttachTop 30 /* new in 1.10 */
784 # define rtfCOLength 31 /* new in 1.10 */
785 # define rtfCONegXQuadrant 32 /* new in 1.10 */
786 # define rtfCONegYQuadrant 33 /* new in 1.10 */
787 # define rtfCOOffset 34 /* new in 1.10 */
788 # define rtfCOAttachSmart 35 /* new in 1.10 */
789 # define rtfCODoubleLine 36 /* new in 1.10 */
790 # define rtfCORightAngle 37 /* new in 1.10 */
791 # define rtfCOSingleLine 38 /* new in 1.10 */
792 # define rtfCOTripleLine 39 /* new in 1.10 */
794 # define rtfDrawTextBoxMargin 40 /* new in 1.10 */
795 # define rtfDrawTextBoxText 41 /* new in 1.10 */
796 # define rtfDrawRoundRect 42 /* new in 1.10 */
798 # define rtfDrawPointX 43 /* new in 1.10 */
799 # define rtfDrawPointY 44 /* new in 1.10 */
800 # define rtfDrawPolyCount 45 /* new in 1.10 */
802 # define rtfDrawArcFlipX 46 /* new in 1.10 */
803 # define rtfDrawArcFlipY 47 /* new in 1.10 */
805 # define rtfDrawLineBlue 48 /* new in 1.10 */
806 # define rtfDrawLineGreen 49 /* new in 1.10 */
807 # define rtfDrawLineRed 50 /* new in 1.10 */
808 # define rtfDrawLinePalette 51 /* new in 1.10 */
809 # define rtfDrawLineDashDot 52 /* new in 1.10 */
810 # define rtfDrawLineDashDotDot 53 /* new in 1.10 */
811 # define rtfDrawLineDash 54 /* new in 1.10 */
812 # define rtfDrawLineDot 55 /* new in 1.10 */
813 # define rtfDrawLineGray 56 /* new in 1.10 */
814 # define rtfDrawLineHollow 57 /* new in 1.10 */
815 # define rtfDrawLineSolid 58 /* new in 1.10 */
816 # define rtfDrawLineWidth 59 /* new in 1.10 */
818 # define rtfDrawHollowEndArrow 60 /* new in 1.10 */
819 # define rtfDrawEndArrowLength 61 /* new in 1.10 */
820 # define rtfDrawSolidEndArrow 62 /* new in 1.10 */
821 # define rtfDrawEndArrowWidth 63 /* new in 1.10 */
822 # define rtfDrawHollowStartArrow 64 /* new in 1.10 */
823 # define rtfDrawStartArrowLength 65 /* new in 1.10 */
824 # define rtfDrawSolidStartArrow 66 /* new in 1.10 */
825 # define rtfDrawStartArrowWidth 67 /* new in 1.10 */
827 # define rtfDrawBgFillBlue 68 /* new in 1.10 */
828 # define rtfDrawBgFillGreen 69 /* new in 1.10 */
829 # define rtfDrawBgFillRed 70 /* new in 1.10 */
830 # define rtfDrawBgFillPalette 71 /* new in 1.10 */
831 # define rtfDrawBgFillGray 72 /* new in 1.10 */
832 # define rtfDrawFgFillBlue 73 /* new in 1.10 */
833 # define rtfDrawFgFillGreen 74 /* new in 1.10 */
834 # define rtfDrawFgFillRed 75 /* new in 1.10 */
835 # define rtfDrawFgFillPalette 76 /* new in 1.10 */
836 # define rtfDrawFgFillGray 77 /* new in 1.10 */
837 # define rtfDrawFillPatIndex 78 /* new in 1.10 */
839 # define rtfDrawShadow 79 /* new in 1.10 */
840 # define rtfDrawShadowXOffset 80 /* new in 1.10 */
841 # define rtfDrawShadowYOffset 81 /* new in 1.10 */
844 * index entry attributes
847 # define rtfIndexAttr 27 /* new in 1.10 */
848 # define rtfIndexNumber 0 /* new in 1.10 */
849 # define rtfIndexBold 1 /* reclassified in 1.10 */
850 # define rtfIndexItalic 2 /* reclassified in 1.10 */
854 * \wmetafile argument values
857 # define rtfWmMmText 1
858 # define rtfWmMmLometric 2
859 # define rtfWmMmHimetric 3
860 # define rtfWmMmLoenglish 4
861 # define rtfWmMmHienglish 5
862 # define rtfWmMmTwips 6
863 # define rtfWmMmIsotropic 7
864 # define rtfWmMmAnisotropic 8
867 * \pmmetafile argument values
870 # define rtfPmPuArbitrary 4
871 # define rtfPmPuPels 8
872 # define rtfPmPuLometric 12
873 # define rtfPmPuHimetric 16
874 # define rtfPmPuLoenglish 20
875 # define rtfPmPuHienglish 24
876 # define rtfPmPuTwips 28
879 * \lang argument values
882 # define rtfLangNoLang 0x0400
883 # define rtfLangAlbanian 0x041c
884 # define rtfLangArabic 0x0401
885 # define rtfLangBahasa 0x0421
886 # define rtfLangBelgianDutch 0x0813
887 # define rtfLangBelgianFrench 0x080c
888 # define rtfLangBrazilianPortuguese 0x0416
889 # define rtfLangBulgarian 0x0402
890 # define rtfLangCatalan 0x0403
891 # define rtfLangLatinCroatoSerbian 0x041a
892 # define rtfLangCzech 0x0405
893 # define rtfLangDanish 0x0406
894 # define rtfLangDutch 0x0413
895 # define rtfLangAustralianEnglish 0x0c09
896 # define rtfLangUKEnglish 0x0809
897 # define rtfLangUSEnglish 0x0409
898 # define rtfLangFinnish 0x040b
899 # define rtfLangFrench 0x040c
900 # define rtfLangCanadianFrench 0x0c0c
901 # define rtfLangGerman 0x0407
902 # define rtfLangGreek 0x0408
903 # define rtfLangHebrew 0x040d
904 # define rtfLangHungarian 0x040e
905 # define rtfLangIcelandic 0x040f
906 # define rtfLangItalian 0x0410
907 # define rtfLangJapanese 0x0411
908 # define rtfLangKorean 0x0412
909 # define rtfLangBokmalNorwegian 0x0414
910 # define rtfLangNynorskNorwegian 0x0814
911 # define rtfLangPolish 0x0415
912 # define rtfLangPortuguese 0x0816
913 # define rtfLangRhaetoRomanic 0x0417
914 # define rtfLangRomanian 0x0418
915 # define rtfLangRussian 0x0419
916 # define rtfLangCyrillicSerboCroatian 0x081a
917 # define rtfLangSimplifiedChinese 0x0804
918 # define rtfLangSlovak 0x041b
919 # define rtfLangCastilianSpanish 0x040a
920 # define rtfLangMexicanSpanish 0x080a
921 # define rtfLangSwedish 0x041d
922 # define rtfLangSwissFrench 0x100c
923 # define rtfLangSwissGerman 0x0807
924 # define rtfLangSwissItalian 0x0810
925 # define rtfLangThai 0x041e
926 # define rtfLangTraditionalChinese 0x0404
927 # define rtfLangTurkish 0x041f
928 # define rtfLangUrdu 0x0420
931 * Style types
934 # define rtfParStyle 0 /* the default */
935 # define rtfCharStyle 1
936 # define rtfSectStyle 2
939 * RTF font, color and style structures. Used for font table,
940 * color table, and stylesheet processing.
943 typedef struct RTFFont RTFFont;
944 typedef struct RTFColor RTFColor;
945 typedef struct RTFStyle RTFStyle;
946 typedef struct RTFStyleElt RTFStyleElt;
949 struct RTFFont
951 char *rtfFName; /* font name */
952 char *rtfFAltName; /* font alternate name */
953 int rtfFNum; /* font number */
954 int rtfFFamily; /* font family */
955 int rtfFCharSet; /* font charset */
956 int rtfFPitch; /* font pitch */
957 int rtfFType; /* font type */
958 int rtfFCodePage; /* font code page */
959 RTFFont *rtfNextFont; /* next font in list */
964 * Color values are -1 if the default color for the the color
965 * number should be used. The default color is writer-dependent.
968 struct RTFColor
970 int rtfCNum; /* color number */
971 int rtfCRed; /* red value */
972 int rtfCGreen; /* green value */
973 int rtfCBlue; /* blue value */
974 RTFColor *rtfNextColor; /* next color in list */
978 struct RTFStyle
980 char *rtfSName; /* style name */
981 int rtfSType; /* style type */
982 int rtfSAdditive; /* whether or not style is additive */
983 int rtfSNum; /* style number */
984 int rtfSBasedOn; /* style this one's based on */
985 int rtfSNextPar; /* style next paragraph style */
986 RTFStyleElt *rtfSSEList; /* list of style words */
987 int rtfExpanding; /* non-zero = being expanded */
988 RTFStyle *rtfNextStyle; /* next style in style list */
992 struct RTFStyleElt
994 int rtfSEClass; /* token class */
995 int rtfSEMajor; /* token major number */
996 int rtfSEMinor; /* token minor number */
997 int rtfSEParam; /* control symbol parameter */
998 char *rtfSEText; /* text of symbol */
999 RTFStyleElt *rtfNextSE; /* next element in style */
1004 * Return pointer to new element of type t, or NULL
1005 * if no memory available.
1008 # define New(t) ((t *) RTFAlloc ((int) sizeof (t)))
1010 /* Parser stack size */
1012 # define maxStack 32
1014 struct _RTF_Info;
1015 typedef struct _RTF_Info RTF_Info;
1017 typedef void (*RTFFuncPtr) (RTF_Info *); /* generic function pointer */
1020 /* RTF parser stack element */
1021 struct tagRTFState {
1022 CHARFORMAT2W fmt;
1023 int codePage;
1024 int unicodeLength;
1026 typedef struct tagRTFState RTFState;
1029 struct _RTF_Info {
1031 * Public variables (listed in rtf.h)
1035 * Information pertaining to last token read by RTFToken. The
1036 * text is exactly as it occurs in the input file, e.g., "\{"
1037 * will be found in rtfTextBuf as "\{", even though it means "{".
1038 * These variables are also set when styles are reprocessed.
1041 int rtfClass;
1042 int rtfMajor;
1043 int rtfMinor;
1044 int rtfParam;
1045 int rtfFormat;
1046 char *rtfTextBuf;
1047 int rtfTextLen;
1049 long rtfLineNum;
1050 int rtfLinePos;
1054 * Private stuff
1057 int pushedChar; /* pushback char if read too far */
1059 int pushedClass; /* pushed token info for RTFUngetToken() */
1060 int pushedMajor;
1061 int pushedMinor;
1062 int pushedParam;
1063 char *pushedTextBuf;
1065 int prevChar;
1066 int bumpLine;
1068 /* Document-wide attributes */
1069 RTFFont *fontList; /* these lists MUST be */
1070 RTFColor *colorList; /* initialized to NULL */
1071 RTFStyle *styleList;
1072 int ansiCodePage; /* ANSI codepage used in conversion to Unicode */
1074 /* Character attributes */
1075 int unicodeLength; /* The length of ANSI representation of Unicode characters */
1076 int codePage; /* Current codepage for text conversion */
1078 char *inputName;
1079 char *outputName;
1081 ME_InStream *stream;
1083 /* edit window to output to */
1084 HWND hwndEdit;
1086 ME_TextEditor *editor;
1087 ME_Style *style;
1089 RTFFuncPtr ccb[rtfMaxClass]; /* class callbacks */
1091 RTFFuncPtr dcb[rtfMaxDestination]; /* destination callbacks */
1093 RTFFuncPtr readHook;
1095 RTFFuncPtr panicProc;
1097 DWORD dwOutputCount;
1098 WCHAR OutputBuffer[0x1000];
1100 DWORD dwCPOutputCount;
1101 DWORD dwMaxCPOutputCount;
1102 char *cpOutputBuffer;
1104 RTFState stack[maxStack];
1105 int stackTop;
1110 * Public RTF reader routines
1113 void RTFInit (RTF_Info *);
1114 void RTFDestroy(RTF_Info *info);
1115 void RTFSetInputName (RTF_Info *, char *);
1116 char *RTFGetInputName (RTF_Info *);
1117 void RTFSetOutputName (RTF_Info *, char *);
1118 char *RTFGetOutputName (RTF_Info *);
1119 void RTFSetClassCallback (RTF_Info *, int, RTFFuncPtr);
1120 RTFFuncPtr RTFGetClassCallback (RTF_Info *, int);
1121 void RTFSetDestinationCallback (RTF_Info *, int, RTFFuncPtr);
1122 RTFFuncPtr RTFGetDestinationCallback (RTF_Info *, int);
1123 void RTFRead (RTF_Info *);
1124 int RTFGetToken (RTF_Info *); /* writer should rarely need this */
1125 void RTFUngetToken (RTF_Info *);
1126 int RTFPeekToken (RTF_Info *);
1127 void RTFSetToken (RTF_Info *, int, int, int, int, const char *);
1128 void RTFSetReadHook (RTF_Info *, RTFFuncPtr);
1129 RTFFuncPtr RTFGetReadHook (RTF_Info *);
1130 void RTFRouteToken (RTF_Info *);
1131 void RTFSkipGroup (RTF_Info *);
1132 void RTFExpandStyle (RTF_Info *, int);
1133 int RTFCheckCM (RTF_Info *, int, int);
1134 int RTFCheckCMM (RTF_Info *, int, int, int);
1135 int RTFCheckMM (RTF_Info *, int, int);
1136 RTFFont *RTFGetFont (RTF_Info *, int);
1137 RTFColor *RTFGetColor (RTF_Info *, int);
1138 RTFStyle *RTFGetStyle (RTF_Info *, int);
1139 int RTFCharToHex ( char);
1140 int RTFHexToChar ( int );
1141 void RTFSetMsgProc ( RTFFuncPtr );
1142 void RTFSetPanicProc ( RTF_Info *, RTFFuncPtr);
1145 * The following messing around is used to allow RTFMsg() and RTFPanic()
1146 * to be variable-argument functions that are declared publicly but
1147 * without generating prototype-mismatch errors on systems that have
1148 * stdarg.h.
1151 void RTFMsg (RTF_Info *, const char *fmt, ...);
1152 void RTFPanic (RTF_Info *, const char *fmt, ...);
1154 void RTFFlushOutputBuffer( RTF_Info *info );
1155 void RTFSetEditStream(RTF_Info *info, ME_InStream *stream);
1157 void WriterInit (RTF_Info *);
1158 int BeginFile (RTF_Info *);
1160 int RTFCharSetToCodePage(RTF_Info *info, int charset);
1162 #endif