Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

327 lines
9.9 KiB

  1. /*
  2. * tokens.cpp
  3. *
  4. * The sorted table of strings and token values
  5. *
  6. * Note: if you insert new keywords, be sure to insert the corresponding
  7. * i_keyword in the i_xxx enum in tokens.h. This enum defines the
  8. * indices used by RTFWrit to output RTF control words.
  9. *
  10. * Original RichEdit 1.0 RTF converter: Anthony Francisco
  11. * Conversion to C++ and RichEdit 2.0: Murray Sargent
  12. *
  13. * Copyright (c) 1995-1998 Microsoft Corporation. All rights reserved.
  14. */
  15. #include "_common.h"
  16. #include "tokens.h"
  17. extern const KEYWORD rgKeyword[] =
  18. {
  19. {"adeff", tokenDefaultBiDiFont},
  20. {"af", tokenAssocFontSelect},
  21. {"animtext", tokenAnimText},
  22. {"ansi", tokenCharSetAnsi},
  23. {"ansicpg", tokenAnsiCodePage},
  24. {"b", tokenBold},
  25. {"bgbdiag", tokenBckgrndBckDiag},
  26. {"bgcross", tokenBckgrndCross},
  27. {"bgdcross", tokenBckgrndDiagCross},
  28. {"bgdkbdiag", tokenBckgrndDrkBckDiag},
  29. {"bgdkcross", tokenBckgrndDrkCross},
  30. {"bgdkdcross", tokenBckgrndDrkDiagCross},
  31. {"bgdkfdiag", tokenBckgrndDrkFwdDiag},
  32. {"bgdkhoriz", tokenBckgrndDrkHoriz},
  33. {"bgdkvert", tokenBckgrndDrkVert},
  34. {"bgfdiag", tokenBckgrndFwdDiag},
  35. {"bghoriz", tokenBckgrndHoriz},
  36. {"bgvert", tokenBckgrndVert},
  37. {"bin", tokenBinaryData},
  38. {"blue", tokenColorBlue},
  39. {"box", tokenBox},
  40. {"brdrb", tokenBorderBottom},
  41. {"brdrbar", tokenBorderOutside},
  42. {"brdrbtw", tokenBorderBetween},
  43. {"brdrcf", tokenBorderColor},
  44. {"brdrdash", tokenBorderDash},
  45. {"brdrdashsm", tokenBorderDashSmall},
  46. {"brdrdb", tokenBorderDouble},
  47. {"brdrdot", tokenBorderDot},
  48. {"brdrhair", tokenBorderHairline},
  49. {"brdrl", tokenBorderLeft},
  50. {"brdrr", tokenBorderRight},
  51. {"brdrs", tokenBorderSingleThick},
  52. {"brdrsh", tokenBorderShadow},
  53. {"brdrt", tokenBorderTop},
  54. {"brdrth", tokenBorderDoubleThick},
  55. {"brdrtriple", tokenBorderTriple},
  56. {"brdrw", tokenBorderWidth},
  57. {"brsp", tokenBorderSpace},
  58. {"bullet", BULLET},
  59. {"caps", tokenCaps},
  60. {"cbpat", tokenColorBckgrndPat},
  61. {"cell", tokenCell},
  62. {"cellx", tokenCellX},
  63. {"cf", tokenColorForeground},
  64. {"cfpat", tokenColorForgrndPat},
  65. {"clbrdrb", tokenCellBorderBottom},
  66. {"clbrdrl", tokenCellBorderLeft},
  67. {"clbrdrr", tokenCellBorderRight},
  68. {"clbrdrt", tokenCellBorderTop},
  69. {"collapsed", tokenCollapsed},
  70. {"colortbl", tokenColorTable},
  71. {"cpg", tokenCodePage},
  72. {"cs", tokenCharStyle},
  73. {"dbch", tokenDBChars},
  74. {"deff", tokenDefaultFont},
  75. {"deflang", tokenDefaultLanguage},
  76. {"deflangfe", tokenDefaultLanguageFE},
  77. {"deftab", tokenDefaultTabWidth},
  78. {"deleted", tokenDeleted},
  79. {"dibitmap", tokenPictureWindowsDIB},
  80. {"disabled", tokenDisabled},
  81. {"dn", tokenDown},
  82. {"dropcapli", tokenDropCapLines},
  83. {"embo", tokenEmboss},
  84. #if 1
  85. {"emdash", '-'},
  86. {"emspace", ' '},
  87. {"endash", '-'},
  88. {"enspace", ' '},
  89. #else
  90. // FUTURE(BradO): It turns out that we can't reliably
  91. // display these Unicode characters for any particular
  92. // font applied to them. If we choose to do something
  93. // more intelligent to ensure that these special chars
  94. // are displayed regardless of the font applied, then
  95. // we should re-enable this code (see Bug #3179).
  96. {"emdash", EMDASH},
  97. {"emspace", EMSPACE},
  98. {"endash", ENDASH},
  99. {"enspace", ENSPACE},
  100. #endif
  101. {"expndtw", tokenExpand},
  102. {"f", tokenFontSelect},
  103. {"fbidi", tokenFontFamilyBidi},
  104. {"fchars", tokenFollowingPunct},
  105. {"fcharset", tokenCharSet},
  106. {"fdecor", tokenFontFamilyDecorative},
  107. {"fi", tokenIndentFirst},
  108. {"field", tokenField},
  109. {"fldinst", tokenFieldInstruction},
  110. {"fldrslt", tokenFieldResult},
  111. {"fmodern", tokenFontFamilyModern},
  112. {"fname", tokenRealFontName},
  113. {"fnil", tokenFontFamilyDefault},
  114. {"fonttbl", tokenFontTable},
  115. {"footer", tokenNullDestination},
  116. {"footerf", tokenNullDestination},
  117. {"footerl", tokenNullDestination},
  118. {"footerr", tokenNullDestination},
  119. {"footnote", tokenNullDestination},
  120. {"fprq", tokenPitch},
  121. {"froman", tokenFontFamilyRoman},
  122. {"fs", tokenFontSize},
  123. {"fscript", tokenFontFamilyScript},
  124. {"fswiss", tokenFontFamilySwiss},
  125. {"ftech", tokenFontFamilyTechnical},
  126. {"ftncn", tokenNullDestination},
  127. {"ftnsep", tokenNullDestination},
  128. {"ftnsepc", tokenNullDestination},
  129. {"green", tokenColorGreen},
  130. {"header", tokenNullDestination},
  131. {"headerf", tokenNullDestination},
  132. {"headerl", tokenNullDestination},
  133. {"headerr", tokenNullDestination},
  134. {"highlight", tokenColorBackground},
  135. {"hyphpar", tokenHyphPar},
  136. {"i", tokenItalic},
  137. {"impr", tokenImprint},
  138. {"info", tokenDocumentArea},
  139. {"intbl", tokenInTable},
  140. {"keep", tokenKeep},
  141. {"keepn", tokenKeepNext},
  142. {"kerning", tokenKerning},
  143. {"lang", tokenLanguage},
  144. {"lchars", tokenLeadingPunct},
  145. {"ldblquote", LDBLQUOTE},
  146. {"li", tokenIndentLeft},
  147. {"line", tokenLineBreak},
  148. {"lnkd", tokenLink},
  149. {"lquote", LQUOTE},
  150. {"ltrch", tokenLToRChars},
  151. {"ltrdoc", tokenLToRDocument},
  152. {"ltrmark", LTRMARK},
  153. {"ltrpar", tokenLToRPara},
  154. {"macpict", tokenPictureQuickDraw},
  155. {"noline", tokenNoLineNumber},
  156. {"nosupersub", tokenNoSuperSub},
  157. {"nowidctlpar", tokenNoWidCtlPar},
  158. {"objattph", tokenObjectPlaceholder},
  159. {"objautlink", tokenObjectAutoLink},
  160. {"objclass", tokenObjectClass},
  161. {"objcropb", tokenCropBottom},
  162. {"objcropl", tokenCropLeft},
  163. {"objcropr", tokenCropRight},
  164. {"objcropt", tokenCropTop},
  165. {"objdata", tokenObjectData},
  166. {"object", tokenObject},
  167. {"objemb", tokenObjectEmbedded},
  168. {"objh", tokenHeight},
  169. {"objicemb", tokenObjectMacICEmbedder},
  170. {"objlink", tokenObjectLink},
  171. {"objname", tokenObjectName},
  172. {"objpub", tokenObjectMacPublisher},
  173. {"objscalex", tokenScaleX},
  174. {"objscaley", tokenScaleY},
  175. {"objsetsize", tokenObjectSetSize},
  176. {"objsub", tokenObjectMacSubscriber},
  177. {"objw", tokenWidth},
  178. {"outl", tokenOutline},
  179. {"page", tokenPage},
  180. {"pagebb", tokenPageBreakBefore},
  181. {"par", tokenEndParagraph},
  182. {"pard", tokenParagraphDefault},
  183. {"piccropb", tokenCropBottom},
  184. {"piccropl", tokenCropLeft},
  185. {"piccropr", tokenCropRight},
  186. {"piccropt", tokenCropTop},
  187. {"pich", tokenHeight},
  188. {"pichgoal", tokenDesiredHeight},
  189. {"picscalex", tokenScaleX},
  190. {"picscaley", tokenScaleY},
  191. {"pict", tokenPicture},
  192. {"picw", tokenWidth},
  193. {"picwgoal", tokenDesiredWidth},
  194. {"plain", tokenCharacterDefault},
  195. {"pmmetafile", tokenPictureOS2Metafile},
  196. {"pn", tokenParaNum},
  197. {"pndec", tokenParaNumDecimal},
  198. {"pnindent", tokenParaNumIndent},
  199. {"pnlcltr", tokenParaNumLCLetter},
  200. {"pnlcrm", tokenParaNumLCRoman},
  201. {"pnlvlblt", tokenParaNumBullet},
  202. {"pnlvlbody", tokenParaNumBody},
  203. {"pnlvlcont", tokenParaNumCont},
  204. {"pnqc", tokenParaNumAlignCenter},
  205. {"pnqr", tokenParaNumAlignRight},
  206. {"pnstart", tokenParaNumStart},
  207. {"pntext", tokenParaNumText},
  208. {"pntxta", tokenParaNumAfter},
  209. {"pntxtb", tokenParaNumBefore},
  210. {"pnucltr", tokenParaNumUCLetter},
  211. {"pnucrm", tokenParaNumUCRoman},
  212. {"protect", tokenProtect},
  213. {"pwd", tokenPocketWord},
  214. {"qc", tokenAlignCenter},
  215. {"qj", tokenAlignJustify},
  216. {"ql", tokenAlignLeft},
  217. {"qr", tokenAlignRight},
  218. {"rdblquote", RDBLQUOTE},
  219. {"red", tokenColorRed},
  220. {"result", tokenObjectResult},
  221. {"revauth", tokenRevAuthor},
  222. {"revised", tokenRevised},
  223. {"ri", tokenIndentRight},
  224. {"row", tokenRow},
  225. {"rquote", RQUOTE},
  226. {"rtf", tokenRtf},
  227. {"rtlch", tokenRToLChars},
  228. {"rtldoc", tokenRToLDocument},
  229. {"rtlmark", RTLMARK},
  230. {"rtlpar", tokenRToLPara},
  231. {"s", tokenStyle},
  232. {"sa", tokenSpaceAfter},
  233. {"sb", tokenSpaceBefore},
  234. {"sbys", tokenSideBySide},
  235. {"scaps", tokenSmallCaps},
  236. {"sect", tokenEndSection},
  237. {"sectd", tokenSectionDefault},
  238. {"shad", tokenShadow},
  239. {"shading", tokenShading},
  240. {"sl", tokenLineSpacing},
  241. {"slmult", tokenLineSpacingRule},
  242. {"strike", tokenStrikeOut},
  243. {"stylesheet", tokenStyleSheet},
  244. {"sub", tokenSubscript},
  245. {"super", tokenSuperscript},
  246. {"tab", 9},
  247. {"tb", tokenTabBar},
  248. {"tc", tokenNullDestination},
  249. {"tldot", tokenTabLeaderDots},
  250. {"tleq", tokenTabLeaderEqual},
  251. {"tlhyph", tokenTabLeaderHyphen},
  252. {"tlth", tokenTabLeaderThick},
  253. {"tlul", tokenTabLeaderUnderline},
  254. {"tqc", tokenCenterTab},
  255. {"tqdec", tokenDecimalTab},
  256. {"tqr", tokenFlushRightTab},
  257. {"trbrdrb", tokenBorderBottom},
  258. {"trbrdrl", tokenBorderLeft},
  259. {"trbrdrr", tokenBorderRight},
  260. {"trbrdrt", tokenBorderTop},
  261. {"trgaph", tokenCellHalfGap},
  262. {"trleft", tokenRowLeft},
  263. {"trowd", tokenRowDefault},
  264. {"trqc", tokenRowAlignCenter},
  265. {"trqr", tokenRowAlignRight},
  266. {"tx", tokenTabPosition},
  267. {"u", tokenUnicode},
  268. {"uc", tokenUnicodeCharByteCount},
  269. {"ul", tokenUnderline},
  270. {"uld", tokenUnderlineDotted},
  271. {"uldash", tokenUnderlineDash},
  272. {"uldashd", tokenUnderlineDashDotted},
  273. {"uldashdd", tokenUnderlineDashDotDotted},
  274. {"uldb", tokenUnderlineDouble},
  275. {"ulhair", tokenUnderlineHairline},
  276. {"ulnone", tokenStopUnderline},
  277. {"ulth", tokenUnderlineThick},
  278. {"ulw", tokenUnderlineWord},
  279. {"ulwave", tokenUnderlineWave},
  280. {"up", tokenUp},
  281. {"urtf", tokenURtf},
  282. {"v", tokenHiddenText},
  283. {"viewkind", tokenViewKind},
  284. {"viewscale", tokenViewScale},
  285. {"wbitmap", tokenPictureWindowsBitmap},
  286. {"wbmbitspixel",tokenBitmapBitsPerPixel},
  287. {"wbmplanes", tokenBitmapNumPlanes},
  288. {"wbmwidthbytes",tokenBitmapWidthBytes},
  289. {"wmetafile", tokenPictureWindowsMetafile},
  290. {"xe", tokenNullDestination},
  291. {"zwj", ZWJ},
  292. {"zwnj", ZWNJ}
  293. };
  294. INT cKeywords = sizeof(rgKeyword) / sizeof(rgKeyword[0]);
  295. extern const BYTE szSymbolKeywords[] = "*:{}\\_|\r\n-~";
  296. extern const TOKEN tokenSymbol[] = // Keep in same order as szSymbolKeywords
  297. {
  298. tokenOptionalDestination, // *
  299. tokenIndexSubentry, // :
  300. '{', // {
  301. '}', // }
  302. '\\', // BSLASH
  303. '-', // _ (nonbreaking hyphen; should be 0x2011)
  304. tokenFormulaCharacter, // |
  305. tokenEndParagraph, // CR
  306. tokenEndParagraph, // LF
  307. 0xAD, // - (optional hyphen)
  308. #if 1
  309. ' ' // ~ (nonbreaking space)
  310. #else
  311. // FUTURE(BradO): It turns out that we can't reliably
  312. // display these Unicode characters for any particular
  313. // font applied to them. If we choose to do something
  314. // more intelligent to ensure that these special chars
  315. // are displayed regardless of the font applied, then
  316. // we should re-enable this code (see Bug #3179).
  317. 0xa0 // ~ (nonbreaking space)
  318. #endif
  319. };