Leaked source code of windows server 2003
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.

1327 lines
41 KiB

  1. /*
  2. * RICHEDIT.H
  3. *
  4. * Purpose:
  5. * RICHEDIT v2.0/3.0/4.0 public definitions
  6. * functionality available for v2.0 and 3.0 that is not in the original
  7. * Windows 95 release.
  8. *
  9. * Copyright (c) 1993-2001, Microsoft Corporation
  10. */
  11. #ifndef _RICHEDIT_
  12. #define _RICHEDIT_
  13. #ifdef _WIN32
  14. #include <pshpack4.h>
  15. #elif !defined(RC_INVOKED)
  16. #pragma pack(4)
  17. #endif
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif // __cplusplus
  21. // To mimic older RichEdit behavior, set _RICHEDIT_VER to appropriate value
  22. // Version 1.0 0x0100
  23. // Version 2.0 0x0200
  24. // Version 2.1 0x0210
  25. #ifndef _RICHEDIT_VER
  26. #define _RICHEDIT_VER 0x0300
  27. #endif
  28. #define cchTextLimitDefault 32767
  29. #define MSFTEDIT_CLASS L"RICHEDIT50W"
  30. // NOTE: MSFTEDIT.DLL only registers MSFTEDIT_CLASS. If an application wants
  31. // to use the following Richedit classes, it needs to load the riched20.dll.
  32. // Otherwise, CreateWindow with RICHEDIT_CLASS would fail.
  33. // This also applies to any dialog that uses RICHEDIT_CLASS,
  34. // RichEdit 2.0 Window Class
  35. // On Windows CE, avoid possible conflicts on Win95
  36. #define CERICHEDIT_CLASSA "RichEditCEA"
  37. #define CERICHEDIT_CLASSW L"RichEditCEW"
  38. #define RICHEDIT_CLASSA "RichEdit20A"
  39. #define RICHEDIT_CLASS10A "RICHEDIT" // Richedit 1.0
  40. #ifndef MACPORT
  41. #define RICHEDIT_CLASSW L"RichEdit20W"
  42. #else //----------------------MACPORT
  43. #define RICHEDIT_CLASSW TEXT("RichEdit20W") // MACPORT change
  44. #endif // MACPORT
  45. #if (_RICHEDIT_VER >= 0x0200 )
  46. #ifdef UNICODE
  47. #define RICHEDIT_CLASS RICHEDIT_CLASSW
  48. #else
  49. #define RICHEDIT_CLASS RICHEDIT_CLASSA
  50. #endif // UNICODE
  51. #else
  52. #define RICHEDIT_CLASS RICHEDIT_CLASS10A
  53. #endif // _RICHEDIT_VER >= 0x0200
  54. // RichEdit messages
  55. #ifndef WM_CONTEXTMENU
  56. #define WM_CONTEXTMENU 0x007B
  57. #endif
  58. #ifndef WM_UNICHAR
  59. #define WM_UNICHAR 0x0109
  60. #endif
  61. #ifndef WM_PRINTCLIENT
  62. #define WM_PRINTCLIENT 0x0318
  63. #endif
  64. #ifndef EM_GETLIMITTEXT
  65. #define EM_GETLIMITTEXT (WM_USER + 37)
  66. #endif
  67. #ifndef EM_POSFROMCHAR
  68. #define EM_POSFROMCHAR (WM_USER + 38)
  69. #define EM_CHARFROMPOS (WM_USER + 39)
  70. #endif
  71. #ifndef EM_SCROLLCARET
  72. #define EM_SCROLLCARET (WM_USER + 49)
  73. #endif
  74. #define EM_CANPASTE (WM_USER + 50)
  75. #define EM_DISPLAYBAND (WM_USER + 51)
  76. #define EM_EXGETSEL (WM_USER + 52)
  77. #define EM_EXLIMITTEXT (WM_USER + 53)
  78. #define EM_EXLINEFROMCHAR (WM_USER + 54)
  79. #define EM_EXSETSEL (WM_USER + 55)
  80. #define EM_FINDTEXT (WM_USER + 56)
  81. #define EM_FORMATRANGE (WM_USER + 57)
  82. #define EM_GETCHARFORMAT (WM_USER + 58)
  83. #define EM_GETEVENTMASK (WM_USER + 59)
  84. #define EM_GETOLEINTERFACE (WM_USER + 60)
  85. #define EM_GETPARAFORMAT (WM_USER + 61)
  86. #define EM_GETSELTEXT (WM_USER + 62)
  87. #define EM_HIDESELECTION (WM_USER + 63)
  88. #define EM_PASTESPECIAL (WM_USER + 64)
  89. #define EM_REQUESTRESIZE (WM_USER + 65)
  90. #define EM_SELECTIONTYPE (WM_USER + 66)
  91. #define EM_SETBKGNDCOLOR (WM_USER + 67)
  92. #define EM_SETCHARFORMAT (WM_USER + 68)
  93. #define EM_SETEVENTMASK (WM_USER + 69)
  94. #define EM_SETOLECALLBACK (WM_USER + 70)
  95. #define EM_SETPARAFORMAT (WM_USER + 71)
  96. #define EM_SETTARGETDEVICE (WM_USER + 72)
  97. #define EM_STREAMIN (WM_USER + 73)
  98. #define EM_STREAMOUT (WM_USER + 74)
  99. #define EM_GETTEXTRANGE (WM_USER + 75)
  100. #define EM_FINDWORDBREAK (WM_USER + 76)
  101. #define EM_SETOPTIONS (WM_USER + 77)
  102. #define EM_GETOPTIONS (WM_USER + 78)
  103. #define EM_FINDTEXTEX (WM_USER + 79)
  104. #ifdef _WIN32
  105. #define EM_GETWORDBREAKPROCEX (WM_USER + 80)
  106. #define EM_SETWORDBREAKPROCEX (WM_USER + 81)
  107. #endif
  108. // RichEdit 2.0 messages
  109. #define EM_SETUNDOLIMIT (WM_USER + 82)
  110. #define EM_REDO (WM_USER + 84)
  111. #define EM_CANREDO (WM_USER + 85)
  112. #define EM_GETUNDONAME (WM_USER + 86)
  113. #define EM_GETREDONAME (WM_USER + 87)
  114. #define EM_STOPGROUPTYPING (WM_USER + 88)
  115. #define EM_SETTEXTMODE (WM_USER + 89)
  116. #define EM_GETTEXTMODE (WM_USER + 90)
  117. // enum for use with EM_GET/SETTEXTMODE
  118. typedef enum tagTextMode
  119. {
  120. TM_PLAINTEXT = 1,
  121. TM_RICHTEXT = 2, // Default behavior
  122. TM_SINGLELEVELUNDO = 4,
  123. TM_MULTILEVELUNDO = 8, // Default behavior
  124. TM_SINGLECODEPAGE = 16,
  125. TM_MULTICODEPAGE = 32 // Default behavior
  126. } TEXTMODE;
  127. #define EM_AUTOURLDETECT (WM_USER + 91)
  128. #define EM_GETAUTOURLDETECT (WM_USER + 92)
  129. #define EM_SETPALETTE (WM_USER + 93)
  130. #define EM_GETTEXTEX (WM_USER + 94)
  131. #define EM_GETTEXTLENGTHEX (WM_USER + 95)
  132. #define EM_SHOWSCROLLBAR (WM_USER + 96)
  133. #define EM_SETTEXTEX (WM_USER + 97)
  134. // East Asia specific messages
  135. #define EM_SETPUNCTUATION (WM_USER + 100)
  136. #define EM_GETPUNCTUATION (WM_USER + 101)
  137. #define EM_SETWORDWRAPMODE (WM_USER + 102)
  138. #define EM_GETWORDWRAPMODE (WM_USER + 103)
  139. #define EM_SETIMECOLOR (WM_USER + 104)
  140. #define EM_GETIMECOLOR (WM_USER + 105)
  141. #define EM_SETIMEOPTIONS (WM_USER + 106)
  142. #define EM_GETIMEOPTIONS (WM_USER + 107)
  143. #define EM_CONVPOSITION (WM_USER + 108)
  144. #define EM_SETLANGOPTIONS (WM_USER + 120)
  145. #define EM_GETLANGOPTIONS (WM_USER + 121)
  146. #define EM_GETIMECOMPMODE (WM_USER + 122)
  147. #define EM_FINDTEXTW (WM_USER + 123)
  148. #define EM_FINDTEXTEXW (WM_USER + 124)
  149. // RE3.0 FE messages
  150. #define EM_RECONVERSION (WM_USER + 125)
  151. #define EM_SETIMEMODEBIAS (WM_USER + 126)
  152. #define EM_GETIMEMODEBIAS (WM_USER + 127)
  153. // BiDi specific messages
  154. #define EM_SETBIDIOPTIONS (WM_USER + 200)
  155. #define EM_GETBIDIOPTIONS (WM_USER + 201)
  156. #define EM_SETTYPOGRAPHYOPTIONS (WM_USER + 202)
  157. #define EM_GETTYPOGRAPHYOPTIONS (WM_USER + 203)
  158. // Extended edit style specific messages
  159. #define EM_SETEDITSTYLE (WM_USER + 204)
  160. #define EM_GETEDITSTYLE (WM_USER + 205)
  161. // Extended edit style masks
  162. #define SES_EMULATESYSEDIT 1
  163. #define SES_BEEPONMAXTEXT 2
  164. #define SES_EXTENDBACKCOLOR 4
  165. #define SES_MAPCPS 8
  166. #define SES_EMULATE10 16
  167. #define SES_USECRLF 32
  168. #define SES_USEAIMM 64
  169. #define SES_NOIME 128
  170. #define SES_ALLOWBEEPS 256
  171. #define SES_UPPERCASE 512
  172. #define SES_LOWERCASE 1024
  173. #define SES_NOINPUTSEQUENCECHK 2048
  174. #define SES_BIDI 4096
  175. #define SES_SCROLLONKILLFOCUS 8192
  176. #define SES_XLTCRCRLFTOCR 16384
  177. #define SES_DRAFTMODE 32768
  178. #define SES_USECTF 0x0010000
  179. #define SES_HIDEGRIDLINES 0x0020000
  180. #define SES_USEATFONT 0x0040000
  181. #define SES_CUSTOMLOOK 0x0080000
  182. #define SES_LBSCROLLNOTIFY 0x0100000
  183. #define SES_CTFALLOWEMBED 0x0200000
  184. #define SES_CTFALLOWSMARTTAG 0x0400000
  185. #define SES_CTFALLOWPROOFING 0x0800000
  186. // REListbox scroll notification
  187. #define LBN_PRESCROLL 0x04000
  188. #define LBN_POSTSCROLL 0x08000
  189. // Options for EM_SETLANGOPTIONS and EM_GETLANGOPTIONS
  190. #define IMF_AUTOKEYBOARD 0x0001
  191. #define IMF_AUTOFONT 0x0002
  192. #define IMF_IMECANCELCOMPLETE 0x0004 // High completes comp string when aborting, low cancels
  193. #define IMF_IMEALWAYSSENDNOTIFY 0x0008
  194. #define IMF_AUTOFONTSIZEADJUST 0x0010
  195. #define IMF_UIFONTS 0x0020
  196. #define IMF_DUALFONT 0x0080
  197. // Values for EM_GETIMECOMPMODE
  198. #define ICM_NOTOPEN 0x0000
  199. #define ICM_LEVEL3 0x0001
  200. #define ICM_LEVEL2 0x0002
  201. #define ICM_LEVEL2_5 0x0003
  202. #define ICM_LEVEL2_SUI 0x0004
  203. #define ICM_CTF 0x0005
  204. // Options for EM_SETTYPOGRAPHYOPTIONS
  205. #define TO_ADVANCEDTYPOGRAPHY 1
  206. #define TO_SIMPLELINEBREAK 2
  207. #define TO_DISABLECUSTOMTEXTOUT 4
  208. #define TO_ADVANCEDLAYOUT 8
  209. // Pegasus outline mode messages (RE 3.0)
  210. // Outline mode message
  211. #define EM_OUTLINE (WM_USER + 220)
  212. // Message for getting and restoring scroll pos
  213. #define EM_GETSCROLLPOS (WM_USER + 221)
  214. #define EM_SETSCROLLPOS (WM_USER + 222)
  215. // Change fontsize in current selection by wParam
  216. #define EM_SETFONTSIZE (WM_USER + 223)
  217. #define EM_GETZOOM (WM_USER + 224)
  218. #define EM_SETZOOM (WM_USER + 225)
  219. #define EM_GETVIEWKIND (WM_USER + 226)
  220. #define EM_SETVIEWKIND (WM_USER + 227)
  221. // RichEdit 4.0 messages
  222. #define EM_GETPAGE (WM_USER + 228)
  223. #define EM_SETPAGE (WM_USER + 229)
  224. #define EM_GETHYPHENATEINFO (WM_USER + 230)
  225. #define EM_SETHYPHENATEINFO (WM_USER + 231)
  226. #define EM_GETPAGEROTATE (WM_USER + 235)
  227. #define EM_SETPAGEROTATE (WM_USER + 236)
  228. #define EM_GETCTFMODEBIAS (WM_USER + 237)
  229. #define EM_SETCTFMODEBIAS (WM_USER + 238)
  230. #define EM_GETCTFOPENSTATUS (WM_USER + 240)
  231. #define EM_SETCTFOPENSTATUS (WM_USER + 241)
  232. #define EM_GETIMECOMPTEXT (WM_USER + 242)
  233. #define EM_ISIME (WM_USER + 243)
  234. #define EM_GETIMEPROPERTY (WM_USER + 244)
  235. // EM_SETPAGEROTATE wparam values
  236. #define EPR_0 0 // Text flows left to right and top to bottom
  237. #define EPR_270 1 // Text flows top to bottom and right to left
  238. #define EPR_180 2 // Text flows right to left and bottom to top
  239. #define EPR_90 3 // Text flows bottom to top and left to right
  240. // EM_SETCTFMODEBIAS wparam values
  241. #define CTFMODEBIAS_DEFAULT 0x0000
  242. #define CTFMODEBIAS_FILENAME 0x0001
  243. #define CTFMODEBIAS_NAME 0x0002
  244. #define CTFMODEBIAS_READING 0x0003
  245. #define CTFMODEBIAS_DATETIME 0x0004
  246. #define CTFMODEBIAS_CONVERSATION 0x0005
  247. #define CTFMODEBIAS_NUMERIC 0x0006
  248. #define CTFMODEBIAS_HIRAGANA 0x0007
  249. #define CTFMODEBIAS_KATAKANA 0x0008
  250. #define CTFMODEBIAS_HANGUL 0x0009
  251. #define CTFMODEBIAS_HALFWIDTHKATAKANA 0x000A
  252. #define CTFMODEBIAS_FULLWIDTHALPHANUMERIC 0x000B
  253. #define CTFMODEBIAS_HALFWIDTHALPHANUMERIC 0x000C
  254. // EM_SETIMEMODEBIAS lparam values
  255. #define IMF_SMODE_PLAURALCLAUSE 0x0001
  256. #define IMF_SMODE_NONE 0x0002
  257. // EM_GETIMECOMPTEXT wparam structure
  258. typedef struct _imecomptext {
  259. LONG cb; // count of bytes in the output buffer.
  260. DWORD flags; // value specifying the composition string type.
  261. // Currently only support ICT_RESULTREADSTR
  262. } IMECOMPTEXT;
  263. #define ICT_RESULTREADSTR 1
  264. // Outline mode wparam values
  265. #define EMO_EXIT 0 // Enter normal mode, lparam ignored
  266. #define EMO_ENTER 1 // Enter outline mode, lparam ignored
  267. #define EMO_PROMOTE 2 // LOWORD(lparam) == 0 ==>
  268. // promote to body-text
  269. // LOWORD(lparam) != 0 ==>
  270. // promote/demote current selection
  271. // by indicated number of levels
  272. #define EMO_EXPAND 3 // HIWORD(lparam) = EMO_EXPANDSELECTION
  273. // -> expands selection to level
  274. // indicated in LOWORD(lparam)
  275. // LOWORD(lparam) = -1/+1 corresponds
  276. // to collapse/expand button presses
  277. // in winword (other values are
  278. // equivalent to having pressed these
  279. // buttons more than once)
  280. // HIWORD(lparam) = EMO_EXPANDDOCUMENT
  281. // -> expands whole document to
  282. // indicated level
  283. #define EMO_MOVESELECTION 4 // LOWORD(lparam) != 0 -> move current
  284. // selection up/down by indicated amount
  285. #define EMO_GETVIEWMODE 5 // Returns VM_NORMAL or VM_OUTLINE
  286. // EMO_EXPAND options
  287. #define EMO_EXPANDSELECTION 0
  288. #define EMO_EXPANDDOCUMENT 1
  289. #define VM_NORMAL 4 // Agrees with RTF \viewkindN
  290. #define VM_OUTLINE 2
  291. #define VM_PAGE 9 // Screen page view (not print layout)
  292. // New notifications
  293. #define EN_MSGFILTER 0x0700
  294. #define EN_REQUESTRESIZE 0x0701
  295. #define EN_SELCHANGE 0x0702
  296. #define EN_DROPFILES 0x0703
  297. #define EN_PROTECTED 0x0704
  298. #define EN_CORRECTTEXT 0x0705 // PenWin specific
  299. #define EN_STOPNOUNDO 0x0706
  300. #define EN_IMECHANGE 0x0707 // East Asia specific
  301. #define EN_SAVECLIPBOARD 0x0708
  302. #define EN_OLEOPFAILED 0x0709
  303. #define EN_OBJECTPOSITIONS 0x070a
  304. #define EN_LINK 0x070b
  305. #define EN_DRAGDROPDONE 0x070c
  306. #define EN_PARAGRAPHEXPANDED 0x070d
  307. #define EN_PAGECHANGE 0x070e
  308. #define EN_LOWFIRTF 0x070f
  309. #define EN_ALIGNLTR 0x0710 // BiDi specific notification
  310. #define EN_ALIGNRTL 0x0711 // BiDi specific notification
  311. #define EN_CLIPFORMAT 0x0712
  312. // Event notification masks
  313. #define ENM_NONE 0x00000000
  314. #define ENM_CHANGE 0x00000001
  315. #define ENM_UPDATE 0x00000002
  316. #define ENM_SCROLL 0x00000004
  317. #define ENM_SCROLLEVENTS 0x00000008
  318. #define ENM_DRAGDROPDONE 0x00000010
  319. #define ENM_PARAGRAPHEXPANDED 0x00000020
  320. #define ENM_PAGECHANGE 0x00000040
  321. #define ENM_CLIPFORMAT 0x00000080
  322. #define ENM_KEYEVENTS 0x00010000
  323. #define ENM_MOUSEEVENTS 0x00020000
  324. #define ENM_REQUESTRESIZE 0x00040000
  325. #define ENM_SELCHANGE 0x00080000
  326. #define ENM_DROPFILES 0x00100000
  327. #define ENM_PROTECTED 0x00200000
  328. #define ENM_CORRECTTEXT 0x00400000 // PenWin specific
  329. #define ENM_IMECHANGE 0x00800000 // Used by RE1.0 compatibility
  330. #define ENM_LANGCHANGE 0x01000000
  331. #define ENM_OBJECTPOSITIONS 0x02000000
  332. #define ENM_LINK 0x04000000
  333. #define ENM_LOWFIRTF 0x08000000
  334. // New edit control styles
  335. #define ES_SAVESEL 0x00008000
  336. #define ES_SUNKEN 0x00004000
  337. #define ES_DISABLENOSCROLL 0x00002000
  338. // Same as WS_MAXIMIZE, but that doesn't make sense so we re-use the value
  339. #define ES_SELECTIONBAR 0x01000000
  340. // Same as ES_UPPERCASE, but re-used to completely disable OLE drag'n'drop
  341. #define ES_NOOLEDRAGDROP 0x00000008
  342. // New edit control extended style
  343. #if (_WIN32_WINNT > 0x0400) || (WINVER > 0x0400)
  344. #define ES_EX_NOCALLOLEINIT 0x00000000 // Not supported in RE 2.0/3.0
  345. #else
  346. #ifdef _WIN32
  347. #define ES_EX_NOCALLOLEINIT 0x01000000
  348. #endif
  349. #endif
  350. // These flags are used in FE Windows
  351. #define ES_VERTICAL 0x00400000 // Not supported in RE 2.0/3.0
  352. #define ES_NOIME 0x00080000
  353. #define ES_SELFIME 0x00040000
  354. // Edit control options
  355. #define ECO_AUTOWORDSELECTION 0x00000001
  356. #define ECO_AUTOVSCROLL 0x00000040
  357. #define ECO_AUTOHSCROLL 0x00000080
  358. #define ECO_NOHIDESEL 0x00000100
  359. #define ECO_READONLY 0x00000800
  360. #define ECO_WANTRETURN 0x00001000
  361. #define ECO_SAVESEL 0x00008000
  362. #define ECO_SELECTIONBAR 0x01000000
  363. #define ECO_VERTICAL 0x00400000 // FE specific
  364. // ECO operations
  365. #define ECOOP_SET 0x0001
  366. #define ECOOP_OR 0x0002
  367. #define ECOOP_AND 0x0003
  368. #define ECOOP_XOR 0x0004
  369. // New word break function actions
  370. #define WB_CLASSIFY 3
  371. #define WB_MOVEWORDLEFT 4
  372. #define WB_MOVEWORDRIGHT 5
  373. #define WB_LEFTBREAK 6
  374. #define WB_RIGHTBREAK 7
  375. // East Asia specific flags
  376. #define WB_MOVEWORDPREV 4
  377. #define WB_MOVEWORDNEXT 5
  378. #define WB_PREVBREAK 6
  379. #define WB_NEXTBREAK 7
  380. #define PC_FOLLOWING 1
  381. #define PC_LEADING 2
  382. #define PC_OVERFLOW 3
  383. #define PC_DELIMITER 4
  384. #define WBF_WORDWRAP 0x010
  385. #define WBF_WORDBREAK 0x020
  386. #define WBF_OVERFLOW 0x040
  387. #define WBF_LEVEL1 0x080
  388. #define WBF_LEVEL2 0x100
  389. #define WBF_CUSTOM 0x200
  390. // East Asia specific flags
  391. #define IMF_FORCENONE 0x0001
  392. #define IMF_FORCEENABLE 0x0002
  393. #define IMF_FORCEDISABLE 0x0004
  394. #define IMF_CLOSESTATUSWINDOW 0x0008
  395. #define IMF_VERTICAL 0x0020
  396. #define IMF_FORCEACTIVE 0x0040
  397. #define IMF_FORCEINACTIVE 0x0080
  398. #define IMF_FORCEREMEMBER 0x0100
  399. #define IMF_MULTIPLEEDIT 0x0400
  400. // Word break flags (used with WB_CLASSIFY)
  401. #define WBF_CLASS ((BYTE) 0x0F)
  402. #define WBF_ISWHITE ((BYTE) 0x10)
  403. #define WBF_BREAKLINE ((BYTE) 0x20)
  404. #define WBF_BREAKAFTER ((BYTE) 0x40)
  405. // Data types
  406. #ifdef _WIN32
  407. // Extended edit word break proc (character set aware)
  408. typedef LONG (*EDITWORDBREAKPROCEX)(char *pchText, LONG cchText, BYTE bCharSet, INT action);
  409. #endif
  410. // All character format measurements are in twips
  411. typedef struct _charformat
  412. {
  413. UINT cbSize;
  414. DWORD dwMask;
  415. DWORD dwEffects;
  416. LONG yHeight;
  417. LONG yOffset;
  418. COLORREF crTextColor;
  419. BYTE bCharSet;
  420. BYTE bPitchAndFamily;
  421. char szFaceName[LF_FACESIZE];
  422. } CHARFORMATA;
  423. typedef struct _charformatw
  424. {
  425. UINT cbSize;
  426. DWORD dwMask;
  427. DWORD dwEffects;
  428. LONG yHeight;
  429. LONG yOffset;
  430. COLORREF crTextColor;
  431. BYTE bCharSet;
  432. BYTE bPitchAndFamily;
  433. WCHAR szFaceName[LF_FACESIZE];
  434. } CHARFORMATW;
  435. #if (_RICHEDIT_VER >= 0x0200)
  436. #ifdef UNICODE
  437. #define CHARFORMAT CHARFORMATW
  438. #else
  439. #define CHARFORMAT CHARFORMATA
  440. #endif // UNICODE
  441. #else
  442. #define CHARFORMAT CHARFORMATA
  443. #endif // _RICHEDIT_VER >= 0x0200
  444. // CHARFORMAT2 structure
  445. #ifdef __cplusplus
  446. struct CHARFORMAT2W : _charformatw
  447. {
  448. WORD wWeight; // Font weight (LOGFONT value)
  449. SHORT sSpacing; // Amount to space between letters
  450. COLORREF crBackColor; // Background color
  451. LCID lcid; // Locale ID
  452. DWORD dwReserved; // Reserved. Must be 0
  453. SHORT sStyle; // Style handle
  454. WORD wKerning; // Twip size above which to kern char pair
  455. BYTE bUnderlineType; // Underline type
  456. BYTE bAnimation; // Animated text like marching ants
  457. BYTE bRevAuthor; // Revision author index
  458. };
  459. struct CHARFORMAT2A : _charformat
  460. {
  461. WORD wWeight; // Font weight (LOGFONT value)
  462. SHORT sSpacing; // Amount to space between letters
  463. COLORREF crBackColor; // Background color
  464. LCID lcid; // Locale ID
  465. DWORD dwReserved; // Reserved. Must be 0
  466. SHORT sStyle; // Style handle
  467. WORD wKerning; // Twip size above which to kern char pair
  468. BYTE bUnderlineType; // Underline type
  469. BYTE bAnimation; // Animated text like marching ants
  470. BYTE bRevAuthor; // Revision author index
  471. };
  472. #else // regular C-style
  473. typedef struct _charformat2w
  474. {
  475. UINT cbSize;
  476. DWORD dwMask;
  477. DWORD dwEffects;
  478. LONG yHeight;
  479. LONG yOffset; // > 0 for superscript, < 0 for subscript
  480. COLORREF crTextColor;
  481. BYTE bCharSet;
  482. BYTE bPitchAndFamily;
  483. WCHAR szFaceName[LF_FACESIZE];
  484. WORD wWeight; // Font weight (LOGFONT value)
  485. SHORT sSpacing; // Amount to space between letters
  486. COLORREF crBackColor; // Background color
  487. LCID lcid; // Locale ID
  488. DWORD dwReserved; // Reserved. Must be 0
  489. SHORT sStyle; // Style handle
  490. WORD wKerning; // Twip size above which to kern char pair
  491. BYTE bUnderlineType; // Underline type
  492. BYTE bAnimation; // Animated text like marching ants
  493. BYTE bRevAuthor; // Revision author index
  494. BYTE bReserved1;
  495. } CHARFORMAT2W;
  496. typedef struct _charformat2a
  497. {
  498. UINT cbSize;
  499. DWORD dwMask;
  500. DWORD dwEffects;
  501. LONG yHeight;
  502. LONG yOffset; // > 0 for superscript, < 0 for subscript
  503. COLORREF crTextColor;
  504. BYTE bCharSet;
  505. BYTE bPitchAndFamily;
  506. char szFaceName[LF_FACESIZE];
  507. WORD wWeight; // Font weight (LOGFONT value)
  508. SHORT sSpacing; // Amount to space between letters
  509. COLORREF crBackColor; // Background color
  510. LCID lcid; // Locale ID
  511. DWORD dwReserved; // Reserved. Must be 0
  512. SHORT sStyle; // Style handle
  513. WORD wKerning; // Twip size above which to kern char pair
  514. BYTE bUnderlineType; // Underline type
  515. BYTE bAnimation; // Animated text like marching ants
  516. BYTE bRevAuthor; // Revision author index
  517. } CHARFORMAT2A;
  518. #endif // C++
  519. #ifdef UNICODE
  520. #define CHARFORMAT2 CHARFORMAT2W
  521. #else
  522. #define CHARFORMAT2 CHARFORMAT2A
  523. #endif
  524. #define CHARFORMATDELTA (sizeof(CHARFORMAT2) - sizeof(CHARFORMAT))
  525. // CFM_COLOR mirrors CFE_AUTOCOLOR, a little hack to easily deal with autocolor
  526. // CHARFORMAT masks
  527. #define CFM_BOLD 0x00000001
  528. #define CFM_ITALIC 0x00000002
  529. #define CFM_UNDERLINE 0x00000004
  530. #define CFM_STRIKEOUT 0x00000008
  531. #define CFM_PROTECTED 0x00000010
  532. #define CFM_LINK 0x00000020 // Exchange hyperlink extension
  533. #define CFM_SIZE 0x80000000
  534. #define CFM_COLOR 0x40000000
  535. #define CFM_FACE 0x20000000
  536. #define CFM_OFFSET 0x10000000
  537. #define CFM_CHARSET 0x08000000
  538. // CHARFORMAT effects
  539. #define CFE_BOLD 0x0001
  540. #define CFE_ITALIC 0x0002
  541. #define CFE_UNDERLINE 0x0004
  542. #define CFE_STRIKEOUT 0x0008
  543. #define CFE_PROTECTED 0x0010
  544. #define CFE_LINK 0x0020
  545. #define CFE_AUTOCOLOR 0x40000000 // NOTE: this corresponds to
  546. // CFM_COLOR, which controls it
  547. // Masks and effects defined for CHARFORMAT2 -- an (*) indicates
  548. // that the data is stored by RichEdit 2.0/3.0, but not displayed
  549. #define CFM_SMALLCAPS 0x0040 // (*)
  550. #define CFM_ALLCAPS 0x0080 // Displayed by 3.0
  551. #define CFM_HIDDEN 0x0100 // Hidden by 3.0
  552. #define CFM_OUTLINE 0x0200 // (*)
  553. #define CFM_SHADOW 0x0400 // (*)
  554. #define CFM_EMBOSS 0x0800 // (*)
  555. #define CFM_IMPRINT 0x1000 // (*)
  556. #define CFM_DISABLED 0x2000
  557. #define CFM_REVISED 0x4000
  558. #define CFM_BACKCOLOR 0x04000000
  559. #define CFM_LCID 0x02000000
  560. #define CFM_UNDERLINETYPE 0x00800000 // Many displayed by 3.0
  561. #define CFM_WEIGHT 0x00400000
  562. #define CFM_SPACING 0x00200000 // Displayed by 3.0
  563. #define CFM_KERNING 0x00100000 // (*)
  564. #define CFM_STYLE 0x00080000 // (*)
  565. #define CFM_ANIMATION 0x00040000 // (*)
  566. #define CFM_REVAUTHOR 0x00008000
  567. #define CFE_SUBSCRIPT 0x00010000 // Superscript and subscript are
  568. #define CFE_SUPERSCRIPT 0x00020000 // mutually exclusive
  569. #define CFM_SUBSCRIPT CFE_SUBSCRIPT | CFE_SUPERSCRIPT
  570. #define CFM_SUPERSCRIPT CFM_SUBSCRIPT
  571. // CHARFORMAT "ALL" masks
  572. #define CFM_EFFECTS (CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_COLOR | \
  573. CFM_STRIKEOUT | CFE_PROTECTED | CFM_LINK)
  574. #define CFM_ALL (CFM_EFFECTS | CFM_SIZE | CFM_FACE | CFM_OFFSET | CFM_CHARSET)
  575. #define CFM_EFFECTS2 (CFM_EFFECTS | CFM_DISABLED | CFM_SMALLCAPS | CFM_ALLCAPS \
  576. | CFM_HIDDEN | CFM_OUTLINE | CFM_SHADOW | CFM_EMBOSS \
  577. | CFM_IMPRINT | CFM_DISABLED | CFM_REVISED \
  578. | CFM_SUBSCRIPT | CFM_SUPERSCRIPT | CFM_BACKCOLOR)
  579. #define CFM_ALL2 (CFM_ALL | CFM_EFFECTS2 | CFM_BACKCOLOR | CFM_LCID \
  580. | CFM_UNDERLINETYPE | CFM_WEIGHT | CFM_REVAUTHOR \
  581. | CFM_SPACING | CFM_KERNING | CFM_STYLE | CFM_ANIMATION)
  582. #define CFE_SMALLCAPS CFM_SMALLCAPS
  583. #define CFE_ALLCAPS CFM_ALLCAPS
  584. #define CFE_HIDDEN CFM_HIDDEN
  585. #define CFE_OUTLINE CFM_OUTLINE
  586. #define CFE_SHADOW CFM_SHADOW
  587. #define CFE_EMBOSS CFM_EMBOSS
  588. #define CFE_IMPRINT CFM_IMPRINT
  589. #define CFE_DISABLED CFM_DISABLED
  590. #define CFE_REVISED CFM_REVISED
  591. // CFE_AUTOCOLOR and CFE_AUTOBACKCOLOR correspond to CFM_COLOR and
  592. // CFM_BACKCOLOR, respectively, which control them
  593. #define CFE_AUTOBACKCOLOR CFM_BACKCOLOR
  594. // Underline types. RE 1.0 displays only CFU_UNDERLINE
  595. #define CFU_CF1UNDERLINE 0xFF // Map charformat's bit underline to CF2
  596. #define CFU_INVERT 0xFE // For IME composition fake a selection
  597. #define CFU_UNDERLINETHICKLONGDASH 18 // (*) display as dash
  598. #define CFU_UNDERLINETHICKDOTTED 17 // (*) display as dot
  599. #define CFU_UNDERLINETHICKDASHDOTDOT 16 // (*) display as dash dot dot
  600. #define CFU_UNDERLINETHICKDASHDOT 15 // (*) display as dash dot
  601. #define CFU_UNDERLINETHICKDASH 14 // (*) display as dash
  602. #define CFU_UNDERLINELONGDASH 13 // (*) display as dash
  603. #define CFU_UNDERLINEHEAVYWAVE 12 // (*) display as wave
  604. #define CFU_UNDERLINEDOUBLEWAVE 11 // (*) display as wave
  605. #define CFU_UNDERLINEHAIRLINE 10 // (*) display as single
  606. #define CFU_UNDERLINETHICK 9
  607. #define CFU_UNDERLINEWAVE 8
  608. #define CFU_UNDERLINEDASHDOTDOT 7
  609. #define CFU_UNDERLINEDASHDOT 6
  610. #define CFU_UNDERLINEDASH 5
  611. #define CFU_UNDERLINEDOTTED 4
  612. #define CFU_UNDERLINEDOUBLE 3 // (*) display as single
  613. #define CFU_UNDERLINEWORD 2 // (*) display as single
  614. #define CFU_UNDERLINE 1
  615. #define CFU_UNDERLINENONE 0
  616. #define yHeightCharPtsMost 1638
  617. // EM_SETCHARFORMAT wParam masks
  618. #define SCF_SELECTION 0x0001
  619. #define SCF_WORD 0x0002
  620. #define SCF_DEFAULT 0x0000 // Set default charformat or paraformat
  621. #define SCF_ALL 0x0004 // Not valid with SCF_SELECTION or SCF_WORD
  622. #define SCF_USEUIRULES 0x0008 // Modifier for SCF_SELECTION; says that
  623. // format came from a toolbar, etc., and
  624. // hence UI formatting rules should be
  625. // used instead of literal formatting
  626. #define SCF_ASSOCIATEFONT 0x0010 // Associate fontname with bCharSet (one
  627. // possible for each of Western, ME, FE,
  628. // Thai)
  629. #define SCF_NOKBUPDATE 0x0020 // Do not update KB layput for this change
  630. // even if autokeyboard is on
  631. #define SCF_ASSOCIATEFONT2 0x0040 // Associate plane-2 (surrogate) font
  632. typedef struct _charrange
  633. {
  634. LONG cpMin;
  635. LONG cpMax;
  636. } CHARRANGE;
  637. typedef struct _textrange
  638. {
  639. CHARRANGE chrg;
  640. LPSTR lpstrText; // Allocated by caller, zero terminated by RichEdit
  641. } TEXTRANGEA;
  642. typedef struct _textrangew
  643. {
  644. CHARRANGE chrg;
  645. LPWSTR lpstrText; // Allocated by caller, zero terminated by RichEdit
  646. } TEXTRANGEW;
  647. #if (_RICHEDIT_VER >= 0x0200)
  648. #ifdef UNICODE
  649. #define TEXTRANGE TEXTRANGEW
  650. #else
  651. #define TEXTRANGE TEXTRANGEA
  652. #endif // UNICODE
  653. #else
  654. #define TEXTRANGE TEXTRANGEA
  655. #endif // _RICHEDIT_VER >= 0x0200
  656. #if (WINVER >= 0x0500) && defined( _OBJBASE_H_ )
  657. typedef DWORD (CALLBACK *EDITSTREAMCALLBACK)(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb);
  658. typedef struct _editstream
  659. {
  660. DWORD_PTR dwCookie; // User value passed to callback as first parameter
  661. DWORD dwError; // Last error
  662. EDITSTREAMCALLBACK pfnCallback;
  663. } EDITSTREAM;
  664. #else
  665. typedef DWORD (CALLBACK *EDITSTREAMCALLBACK)(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb);
  666. typedef struct _editstream
  667. {
  668. DWORD dwCookie; /* user value passed to callback as first parameter */
  669. DWORD dwError; /* last error */
  670. EDITSTREAMCALLBACK pfnCallback;
  671. } EDITSTREAM;
  672. #endif
  673. // Stream formats. Flags are all in low word, since high word
  674. // gives possible codepage choice.
  675. #define SF_TEXT 0x0001
  676. #define SF_RTF 0x0002
  677. #define SF_RTFNOOBJS 0x0003 // Write only
  678. #define SF_TEXTIZED 0x0004 // Write only
  679. #define SF_UNICODE 0x0010 // Unicode file (UCS2 little endian)
  680. #define SF_USECODEPAGE 0x0020 // CodePage given by high word
  681. #define SF_NCRFORNONASCII 0x40 // Output /uN for nonASCII
  682. #define SFF_WRITEXTRAPAR 0x80 // Output \par at end
  683. // Flag telling stream operations to operate on selection only
  684. // EM_STREAMIN replaces current selection
  685. // EM_STREAMOUT streams out current selection
  686. #define SFF_SELECTION 0x8000
  687. // Flag telling stream operations to ignore some FE control words
  688. // having to do with FE word breaking and horiz vs vertical text.
  689. // Not used in RichEdit 2.0 and later
  690. #define SFF_PLAINRTF 0x4000
  691. // Flag telling file stream output (SFF_SELECTION flag not set) to persist
  692. // \viewscaleN control word.
  693. #define SFF_PERSISTVIEWSCALE 0x2000
  694. // Flag telling file stream input with SFF_SELECTION flag not set not to
  695. // close the document
  696. #define SFF_KEEPDOCINFO 0x1000
  697. // Flag telling stream operations to output in Pocket Word format
  698. #define SFF_PWD 0x0800
  699. // 3-bit field specifying the value of N - 1 to use for \rtfN or \pwdN
  700. #define SF_RTFVAL 0x0700
  701. typedef struct _findtext
  702. {
  703. CHARRANGE chrg;
  704. LPCSTR lpstrText;
  705. } FINDTEXTA;
  706. typedef struct _findtextw
  707. {
  708. CHARRANGE chrg;
  709. LPCWSTR lpstrText;
  710. } FINDTEXTW;
  711. #if (_RICHEDIT_VER >= 0x0200)
  712. #ifdef UNICODE
  713. #define FINDTEXT FINDTEXTW
  714. #else
  715. #define FINDTEXT FINDTEXTA
  716. #endif // UNICODE
  717. #else
  718. #define FINDTEXT FINDTEXTA
  719. #endif // _RICHEDIT_VER >= 0x0200
  720. typedef struct _findtextexa
  721. {
  722. CHARRANGE chrg;
  723. LPCSTR lpstrText;
  724. CHARRANGE chrgText;
  725. } FINDTEXTEXA;
  726. typedef struct _findtextexw
  727. {
  728. CHARRANGE chrg;
  729. LPCWSTR lpstrText;
  730. CHARRANGE chrgText;
  731. } FINDTEXTEXW;
  732. #if (_RICHEDIT_VER >= 0x0200)
  733. #ifdef UNICODE
  734. #define FINDTEXTEX FINDTEXTEXW
  735. #else
  736. #define FINDTEXTEX FINDTEXTEXA
  737. #endif // UNICODE
  738. #else
  739. #define FINDTEXTEX FINDTEXTEXA
  740. #endif // _RICHEDIT_VER >= 0x0200
  741. typedef struct _formatrange
  742. {
  743. HDC hdc;
  744. HDC hdcTarget;
  745. RECT rc;
  746. RECT rcPage;
  747. CHARRANGE chrg;
  748. } FORMATRANGE;
  749. // All paragraph measurements are in twips
  750. #define MAX_TAB_STOPS 32
  751. #define lDefaultTab 720
  752. #define MAX_TABLE_CELLS 63
  753. // This is a hack to make PARAFORMAT compatible with RE 1.0
  754. #define wReserved wEffects
  755. typedef struct _paraformat
  756. {
  757. UINT cbSize;
  758. DWORD dwMask;
  759. WORD wNumbering;
  760. WORD wEffects;
  761. LONG dxStartIndent;
  762. LONG dxRightIndent;
  763. LONG dxOffset;
  764. WORD wAlignment;
  765. SHORT cTabCount;
  766. LONG rgxTabs[MAX_TAB_STOPS];
  767. } PARAFORMAT;
  768. #ifdef __cplusplus
  769. struct PARAFORMAT2 : _paraformat
  770. {
  771. LONG dySpaceBefore; // Vertical spacing before para
  772. LONG dySpaceAfter; // Vertical spacing after para
  773. LONG dyLineSpacing; // Line spacing depending on Rule
  774. SHORT sStyle; // Style handle
  775. BYTE bLineSpacingRule; // Rule for line spacing (see tom.doc)
  776. BYTE bOutlineLevel; // Outline level
  777. WORD wShadingWeight; // Shading in hundredths of a per cent
  778. WORD wShadingStyle; // Nibble 0: style, 1: cfpat, 2: cbpat
  779. WORD wNumberingStart; // Starting value for numbering
  780. WORD wNumberingStyle; // Alignment, roman/arabic, (), ), ., etc.
  781. WORD wNumberingTab; // Space bet FirstIndent & 1st-line text
  782. WORD wBorderSpace; // Border-text spaces (nbl/bdr in pts)
  783. WORD wBorderWidth; // Pen widths (nbl/bdr in half pts)
  784. WORD wBorders; // Border styles (nibble/border)
  785. };
  786. #else // Regular C-style
  787. typedef struct _paraformat2
  788. {
  789. UINT cbSize;
  790. DWORD dwMask;
  791. WORD wNumbering;
  792. WORD wReserved;
  793. LONG dxStartIndent;
  794. LONG dxRightIndent;
  795. LONG dxOffset;
  796. WORD wAlignment;
  797. SHORT cTabCount;
  798. LONG rgxTabs[MAX_TAB_STOPS];
  799. LONG dySpaceBefore; // Vertical spacing before para
  800. LONG dySpaceAfter; // Vertical spacing after para
  801. LONG dyLineSpacing; // Line spacing depending on Rule
  802. SHORT sStyle; // Style handle
  803. BYTE bLineSpacingRule; // Rule for line spacing (see tom.doc)
  804. BYTE bOutlineLevel; // Outline Level
  805. WORD wShadingWeight; // Shading in hundredths of a per cent
  806. WORD wShadingStyle; // Byte 0: style, nib 2: cfpat, 3: cbpat
  807. WORD wNumberingStart; // Starting value for numbering
  808. WORD wNumberingStyle; // Alignment, Roman/Arabic, (), ), ., etc.
  809. WORD wNumberingTab; // Space bet 1st indent and 1st-line text
  810. WORD wBorderSpace; // Border-text spaces (nbl/bdr in pts)
  811. WORD wBorderWidth; // Pen widths (nbl/bdr in half twips)
  812. WORD wBorders; // Border styles (nibble/border)
  813. } PARAFORMAT2;
  814. #endif // C++
  815. // PARAFORMAT mask values
  816. #define PFM_STARTINDENT 0x00000001
  817. #define PFM_RIGHTINDENT 0x00000002
  818. #define PFM_OFFSET 0x00000004
  819. #define PFM_ALIGNMENT 0x00000008
  820. #define PFM_TABSTOPS 0x00000010
  821. #define PFM_NUMBERING 0x00000020
  822. #define PFM_OFFSETINDENT 0x80000000
  823. // PARAFORMAT 2.0 masks and effects
  824. #define PFM_SPACEBEFORE 0x00000040
  825. #define PFM_SPACEAFTER 0x00000080
  826. #define PFM_LINESPACING 0x00000100
  827. #define PFM_STYLE 0x00000400
  828. #define PFM_BORDER 0x00000800 // (*)
  829. #define PFM_SHADING 0x00001000 // (*)
  830. #define PFM_NUMBERINGSTYLE 0x00002000 // RE 3.0
  831. #define PFM_NUMBERINGTAB 0x00004000 // RE 3.0
  832. #define PFM_NUMBERINGSTART 0x00008000 // RE 3.0
  833. #define PFM_RTLPARA 0x00010000
  834. #define PFM_KEEP 0x00020000 // (*)
  835. #define PFM_KEEPNEXT 0x00040000 // (*)
  836. #define PFM_PAGEBREAKBEFORE 0x00080000 // (*)
  837. #define PFM_NOLINENUMBER 0x00100000 // (*)
  838. #define PFM_NOWIDOWCONTROL 0x00200000 // (*)
  839. #define PFM_DONOTHYPHEN 0x00400000 // (*)
  840. #define PFM_SIDEBYSIDE 0x00800000 // (*)
  841. #define PFM_TABLE 0x40000000 // RE 3.0
  842. #define PFM_TEXTWRAPPINGBREAK 0x20000000 // RE 3.0
  843. #define PFM_TABLEROWDELIMITER 0x10000000 // RE 4.0
  844. // The following three properties are read only
  845. #define PFM_COLLAPSED 0x01000000 // RE 3.0
  846. #define PFM_OUTLINELEVEL 0x02000000 // RE 3.0
  847. #define PFM_BOX 0x04000000 // RE 3.0
  848. #define PFM_RESERVED2 0x08000000 // RE 4.0
  849. // PARAFORMAT "ALL" masks
  850. #define PFM_ALL (PFM_STARTINDENT | PFM_RIGHTINDENT | PFM_OFFSET | \
  851. PFM_ALIGNMENT | PFM_TABSTOPS | PFM_NUMBERING | \
  852. PFM_OFFSETINDENT| PFM_RTLPARA)
  853. // Note: PARAFORMAT has no effects (BiDi RichEdit 1.0 does have PFE_RTLPARA)
  854. #define PFM_EFFECTS (PFM_RTLPARA | PFM_KEEP | PFM_KEEPNEXT | PFM_TABLE \
  855. | PFM_PAGEBREAKBEFORE | PFM_NOLINENUMBER \
  856. | PFM_NOWIDOWCONTROL | PFM_DONOTHYPHEN | PFM_SIDEBYSIDE \
  857. | PFM_TABLE | PFM_TABLEROWDELIMITER)
  858. #define PFM_ALL2 (PFM_ALL | PFM_EFFECTS | PFM_SPACEBEFORE | PFM_SPACEAFTER \
  859. | PFM_LINESPACING | PFM_STYLE | PFM_SHADING | PFM_BORDER \
  860. | PFM_NUMBERINGTAB | PFM_NUMBERINGSTART | PFM_NUMBERINGSTYLE)
  861. #define PFE_RTLPARA (PFM_RTLPARA >> 16)
  862. #define PFE_KEEP (PFM_KEEP >> 16) // (*)
  863. #define PFE_KEEPNEXT (PFM_KEEPNEXT >> 16) // (*)
  864. #define PFE_PAGEBREAKBEFORE (PFM_PAGEBREAKBEFORE >> 16) // (*)
  865. #define PFE_NOLINENUMBER (PFM_NOLINENUMBER >> 16) // (*)
  866. #define PFE_NOWIDOWCONTROL (PFM_NOWIDOWCONTROL >> 16) // (*)
  867. #define PFE_DONOTHYPHEN (PFM_DONOTHYPHEN >> 16) // (*)
  868. #define PFE_SIDEBYSIDE (PFM_SIDEBYSIDE >> 16) // (*)
  869. #define PFE_TEXTWRAPPINGBREAK (PFM_TEXTWRAPPINGBREAK>>16) // (*)
  870. // The following four effects are read only
  871. #define PFE_COLLAPSED (PFM_COLLAPSED >> 16) // (+)
  872. #define PFE_BOX (PFM_BOX >> 16) // (+)
  873. #define PFE_TABLE (PFM_TABLE >> 16) // Inside table row. RE 3.0
  874. #define PFE_TABLEROWDELIMITER (PFM_TABLEROWDELIMITER>>16) // Table row start. RE 4.0
  875. // PARAFORMAT numbering options
  876. #define PFN_BULLET 1 // tomListBullet
  877. // PARAFORMAT2 wNumbering options
  878. #define PFN_ARABIC 2 // tomListNumberAsArabic: 0, 1, 2, ...
  879. #define PFN_LCLETTER 3 // tomListNumberAsLCLetter: a, b, c, ...
  880. #define PFN_UCLETTER 4 // tomListNumberAsUCLetter: A, B, C, ...
  881. #define PFN_LCROMAN 5 // tomListNumberAsLCRoman: i, ii, iii, ...
  882. #define PFN_UCROMAN 6 // tomListNumberAsUCRoman: I, II, III, ...
  883. // PARAFORMAT2 wNumberingStyle options
  884. #define PFNS_PAREN 0x000 // default, e.g., 1)
  885. #define PFNS_PARENS 0x100 // tomListParentheses/256, e.g., (1)
  886. #define PFNS_PERIOD 0x200 // tomListPeriod/256, e.g., 1.
  887. #define PFNS_PLAIN 0x300 // tomListPlain/256, e.g., 1
  888. #define PFNS_NONUMBER 0x400 // Used for continuation w/o number
  889. #define PFNS_NEWNUMBER 0x8000 // Start new number with wNumberingStart
  890. // (can be combined with other PFNS_xxx)
  891. // PARAFORMAT alignment options
  892. #define PFA_LEFT 1
  893. #define PFA_RIGHT 2
  894. #define PFA_CENTER 3
  895. // PARAFORMAT2 alignment options
  896. #define PFA_JUSTIFY 4 // New paragraph-alignment option 2.0 (*)
  897. #define PFA_FULL_INTERWORD 4 // These are supported in 3.0 with advanced
  898. #define PFA_FULL_INTERLETTER 5 // typography enabled
  899. #define PFA_FULL_SCALED 6
  900. #define PFA_FULL_GLYPHS 7
  901. #define PFA_SNAP_GRID 8
  902. // Notification structures
  903. #ifndef WM_NOTIFY
  904. #define WM_NOTIFY 0x004E
  905. typedef struct _nmhdr
  906. {
  907. HWND hwndFrom;
  908. UINT idFrom;
  909. UINT code;
  910. } NMHDR;
  911. #endif // !WM_NOTIFY
  912. typedef struct _msgfilter
  913. {
  914. NMHDR nmhdr;
  915. UINT msg;
  916. WPARAM wParam;
  917. LPARAM lParam;
  918. } MSGFILTER;
  919. typedef struct _reqresize
  920. {
  921. NMHDR nmhdr;
  922. RECT rc;
  923. } REQRESIZE;
  924. typedef struct _selchange
  925. {
  926. NMHDR nmhdr;
  927. CHARRANGE chrg;
  928. WORD seltyp;
  929. } SELCHANGE;
  930. #if (WINVER >= 0x0500) && defined( _OBJBASE_H_ )
  931. typedef struct _clipboardformat
  932. {
  933. NMHDR nmhdr;
  934. CLIPFORMAT cf;
  935. } CLIPBOARDFORMAT;
  936. #endif
  937. #define SEL_EMPTY 0x0000
  938. #define SEL_TEXT 0x0001
  939. #define SEL_OBJECT 0x0002
  940. #define SEL_MULTICHAR 0x0004
  941. #define SEL_MULTIOBJECT 0x0008
  942. // Used with IRichEditOleCallback::GetContextMenu, this flag will be
  943. // passed as a "selection type". It indicates that a context menu for
  944. // a right-mouse drag drop should be generated. The IOleObject parameter
  945. // will really be the IDataObject for the drop
  946. #define GCM_RIGHTMOUSEDROP 0x8000
  947. typedef struct _endropfiles
  948. {
  949. NMHDR nmhdr;
  950. HANDLE hDrop;
  951. LONG cp;
  952. BOOL fProtected;
  953. } ENDROPFILES;
  954. typedef struct _enprotected
  955. {
  956. NMHDR nmhdr;
  957. UINT msg;
  958. WPARAM wParam;
  959. LPARAM lParam;
  960. CHARRANGE chrg;
  961. } ENPROTECTED;
  962. typedef struct _ensaveclipboard
  963. {
  964. NMHDR nmhdr;
  965. LONG cObjectCount;
  966. LONG cch;
  967. } ENSAVECLIPBOARD;
  968. #ifndef MACPORT
  969. typedef struct _enoleopfailed
  970. {
  971. NMHDR nmhdr;
  972. LONG iob;
  973. LONG lOper;
  974. HRESULT hr;
  975. } ENOLEOPFAILED;
  976. #endif
  977. #define OLEOP_DOVERB 1
  978. typedef struct _objectpositions
  979. {
  980. NMHDR nmhdr;
  981. LONG cObjectCount;
  982. LONG *pcpPositions;
  983. } OBJECTPOSITIONS;
  984. typedef struct _enlink
  985. {
  986. NMHDR nmhdr;
  987. UINT msg;
  988. WPARAM wParam;
  989. LPARAM lParam;
  990. CHARRANGE chrg;
  991. } ENLINK;
  992. typedef struct _enlowfirtf
  993. {
  994. NMHDR nmhdr;
  995. char *szControl;
  996. } ENLOWFIRTF;
  997. // PenWin specific
  998. typedef struct _encorrecttext
  999. {
  1000. NMHDR nmhdr;
  1001. CHARRANGE chrg;
  1002. WORD seltyp;
  1003. } ENCORRECTTEXT;
  1004. // East Asia specific
  1005. typedef struct _punctuation
  1006. {
  1007. UINT iSize;
  1008. LPSTR szPunctuation;
  1009. } PUNCTUATION;
  1010. // East Asia specific
  1011. typedef struct _compcolor
  1012. {
  1013. COLORREF crText;
  1014. COLORREF crBackground;
  1015. DWORD dwEffects;
  1016. }COMPCOLOR;
  1017. // Clipboard formats - use as parameter to RegisterClipboardFormat()
  1018. #define CF_RTF TEXT("Rich Text Format")
  1019. #define CF_RTFNOOBJS TEXT("Rich Text Format Without Objects")
  1020. #define CF_RETEXTOBJ TEXT("RichEdit Text and Objects")
  1021. // Paste Special
  1022. typedef struct _repastespecial
  1023. {
  1024. DWORD dwAspect;
  1025. #if (WINVER >= 0x0500) && defined( _OBJBASE_H_ )
  1026. DWORD_PTR dwParam;
  1027. #else
  1028. DWORD dwParam;
  1029. #endif
  1030. } REPASTESPECIAL;
  1031. // UndoName info
  1032. typedef enum _undonameid
  1033. {
  1034. UID_UNKNOWN = 0,
  1035. UID_TYPING = 1,
  1036. UID_DELETE = 2,
  1037. UID_DRAGDROP = 3,
  1038. UID_CUT = 4,
  1039. UID_PASTE = 5,
  1040. UID_AUTOCORRECT = 6
  1041. } UNDONAMEID;
  1042. // Flags for the SETEXTEX data structure
  1043. #define ST_DEFAULT 0
  1044. #define ST_KEEPUNDO 1
  1045. #define ST_SELECTION 2
  1046. #define ST_NEWCHARS 4
  1047. // EM_SETTEXTEX info; this struct is passed in the wparam of the message
  1048. typedef struct _settextex
  1049. {
  1050. DWORD flags; // Flags (see the ST_XXX defines)
  1051. UINT codepage; // Code page for translation (CP_ACP for sys default,
  1052. // 1200 for Unicode, -1 for control default)
  1053. } SETTEXTEX;
  1054. // Flags for the GETEXTEX data structure
  1055. #define GT_DEFAULT 0
  1056. #define GT_USECRLF 1
  1057. #define GT_SELECTION 2
  1058. #define GT_RAWTEXT 4
  1059. #define GT_NOHIDDENTEXT 8
  1060. // EM_GETTEXTEX info; this struct is passed in the wparam of the message
  1061. typedef struct _gettextex
  1062. {
  1063. DWORD cb; // Count of bytes in the string
  1064. DWORD flags; // Flags (see the GT_XXX defines
  1065. UINT codepage; // Code page for translation (CP_ACP for sys default,
  1066. // 1200 for Unicode, -1 for control default)
  1067. LPCSTR lpDefaultChar; // Replacement for unmappable chars
  1068. LPBOOL lpUsedDefChar; // Pointer to flag set when def char used
  1069. } GETTEXTEX;
  1070. // Flags for the GETTEXTLENGTHEX data structure
  1071. #define GTL_DEFAULT 0 // Do default (return # of chars)
  1072. #define GTL_USECRLF 1 // Compute answer using CRLFs for paragraphs
  1073. #define GTL_PRECISE 2 // Compute a precise answer
  1074. #define GTL_CLOSE 4 // Fast computation of a "close" answer
  1075. #define GTL_NUMCHARS 8 // Return number of characters
  1076. #define GTL_NUMBYTES 16 // Return number of _bytes_
  1077. // EM_GETTEXTLENGTHEX info; this struct is passed in the wparam of the msg
  1078. typedef struct _gettextlengthex
  1079. {
  1080. DWORD flags; // Flags (see GTL_XXX defines)
  1081. UINT codepage; // Code page for translation (CP_ACP for default,
  1082. // 1200 for Unicode)
  1083. } GETTEXTLENGTHEX;
  1084. // BiDi specific features
  1085. typedef struct _bidioptions
  1086. {
  1087. UINT cbSize;
  1088. WORD wMask;
  1089. WORD wEffects;
  1090. } BIDIOPTIONS;
  1091. // BIDIOPTIONS masks
  1092. #if (_RICHEDIT_VER == 0x0100)
  1093. #define BOM_DEFPARADIR 0x0001 // Default paragraph direction (implies alignment) (obsolete)
  1094. #define BOM_PLAINTEXT 0x0002 // Use plain text layout (obsolete)
  1095. #endif // _RICHEDIT_VER == 0x0100
  1096. #define BOM_NEUTRALOVERRIDE 0x0004 // Override neutral layout (obsolete)
  1097. #define BOM_CONTEXTREADING 0x0008 // Context reading order
  1098. #define BOM_CONTEXTALIGNMENT 0x0010 // Context alignment
  1099. // BIDIOPTIONS effects
  1100. #if (_RICHEDIT_VER == 0x0100)
  1101. #define BOE_RTLDIR 0x0001 // Default paragraph direction (implies alignment) (obsolete)
  1102. #define BOE_PLAINTEXT 0x0002 // Use plain text layout (obsolete)
  1103. #endif // _RICHEDIT_VER == 0x0100
  1104. #define BOE_NEUTRALOVERRIDE 0x0004 // Override neutral layout (obsolete)
  1105. #define BOE_CONTEXTREADING 0x0008 // Context reading order
  1106. #define BOE_CONTEXTALIGNMENT 0x0010 // Context alignment
  1107. // Additional EM_FINDTEXT[EX] flags
  1108. #define FR_MATCHDIAC 0x20000000
  1109. #define FR_MATCHKASHIDA 0x40000000
  1110. #define FR_MATCHALEFHAMZA 0x80000000
  1111. // UNICODE embedding character
  1112. #ifndef WCH_EMBEDDING
  1113. #define WCH_EMBEDDING (WCHAR)0xFFFC
  1114. #endif // WCH_EMBEDDING
  1115. // khyph - Kind of hyphenation
  1116. typedef enum tagKHYPH
  1117. {
  1118. khyphNil, // No Hyphenation
  1119. khyphNormal, // Normal Hyphenation
  1120. khyphAddBefore, // Add letter before hyphen
  1121. khyphChangeBefore, // Change letter before hyphen
  1122. khyphDeleteBefore, // Delete letter before hyphen
  1123. khyphChangeAfter, // Change letter after hyphen
  1124. khyphDelAndChange // Delete letter before hyphen and change
  1125. // letter preceding hyphen
  1126. } KHYPH;
  1127. typedef struct hyphresult
  1128. {
  1129. KHYPH khyph; // Kind of hyphenation
  1130. long ichHyph; // Character which was hyphenated
  1131. WCHAR chHyph; // Depending on hyphenation type, character added, changed, etc.
  1132. } HYPHRESULT;
  1133. void WINAPI HyphenateProc(WCHAR *pszWord, LANGID langid, long ichExceed, HYPHRESULT *phyphresult);
  1134. typedef struct tagHyphenateInfo
  1135. {
  1136. SHORT cbSize; // Size of HYPHENATEINFO structure
  1137. SHORT dxHyphenateZone; // If a space character is closer to the margin
  1138. // than this value, don't hyphenate (in TWIPs)
  1139. void (WINAPI* pfnHyphenate)(WCHAR*, LANGID, long, HYPHRESULT*);
  1140. } HYPHENATEINFO;
  1141. #ifdef _WIN32
  1142. #include <poppack.h>
  1143. #elif !defined(RC_INVOKED)
  1144. #pragma pack()
  1145. #endif
  1146. #ifdef __cplusplus
  1147. }
  1148. #endif // __cplusplus
  1149. #endif // !_RICHEDIT_