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.

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