Richedit.h 40 KB

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