home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 April / Chip_1997-04_cd.bin / prezent / cb / data.z / RICHEDIT.H < prev    next >
C/C++ Source or Header  |  1997-01-16  |  30KB  |  1,029 lines

  1. /*
  2.  *    RICHEDIT.H
  3.  *    
  4.  *    Purpose:
  5.  *        RICHEDIT v2.0 public definitions.  Note that there is additional
  6.  *        functionality available for v2.0 that is not in the original
  7.  *        Windows 95 release.
  8.  *    
  9.  *    Copyright (c) 1985-1996, Microsoft Corporation
  10.  */
  11.  
  12. #ifndef _RICHEDIT_
  13. #define    _RICHEDIT_
  14.  
  15. #ifdef _WIN32
  16. #include <pshpack4.h>
  17. #elif !defined(RC_INVOKED)
  18. #pragma pack(4)
  19. #endif
  20.  
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif /* __cplusplus */
  24.  
  25. /* To mimic RichEdit 1.0 behavior for Unicode apps, simply set _RICHEDIT_VER to 0x0100 */
  26. #ifndef _RICHEDIT_VER
  27. #define _RICHEDIT_VER    0x0200
  28. #endif
  29.  
  30. /*
  31.  *    To make some structures which can be passed between 16 and 32 bit windows
  32.  *    almost compatible, padding is introduced to the 16 bit versions of the
  33.  *    structure.
  34.  */
  35. #ifdef _WIN32
  36. #    define    _WPAD    /##/
  37. #else
  38. #    define    _WPAD    WORD
  39. #endif
  40.  
  41. #define cchTextLimitDefault 32767
  42.  
  43. /* Richedit2.0 Window Class. */
  44.  
  45. #define RICHEDIT_CLASSA        "RichEdit20A"
  46. #define RICHEDIT_CLASS10A    "RICHEDIT"            // Richedit 1.0
  47.  
  48. #ifndef MACPORT
  49. #define RICHEDIT_CLASSW        L"RichEdit20W"
  50. #else    /*----------------------MACPORT */
  51. #define RICHEDIT_CLASSW        TEXT("RichEdit20W")    /* MACPORT change */
  52. #endif /* MACPORT  */
  53.  
  54. #if (_RICHEDIT_VER >= 0x0200 )
  55. #ifdef UNICODE
  56. #define RICHEDIT_CLASS        RICHEDIT_CLASSW
  57. #else
  58. #define RICHEDIT_CLASS        RICHEDIT_CLASSA
  59. #endif /* UNICODE */
  60. #else
  61. #define RICHEDIT_CLASS        RICHEDIT_CLASS10A
  62. #endif /* _RICHEDIT_VER >= 0x0200 */
  63.  
  64. /* RichEdit messages */
  65.  
  66. #ifndef WM_CONTEXTMENU
  67. #define WM_CONTEXTMENU            0x007B
  68. #endif
  69.  
  70. #ifndef WM_PRINTCLIENT
  71. #define WM_PRINTCLIENT            0x0318
  72. #endif
  73.  
  74. #ifndef EM_GETLIMITTEXT
  75. #define EM_GETLIMITTEXT            (WM_USER + 37)
  76. #endif
  77.  
  78. #ifndef EM_POSFROMCHAR    
  79. #define EM_POSFROMCHAR            (WM_USER + 38)
  80. #define EM_CHARFROMPOS            (WM_USER + 39)
  81. #endif
  82.  
  83. #ifndef EM_SCROLLCARET
  84. #define EM_SCROLLCARET            (WM_USER + 49)
  85. #endif
  86. #define EM_CANPASTE                (WM_USER + 50)
  87. #define EM_DISPLAYBAND            (WM_USER + 51)
  88. #define EM_EXGETSEL                (WM_USER + 52)
  89. #define EM_EXLIMITTEXT            (WM_USER + 53)
  90. #define EM_EXLINEFROMCHAR        (WM_USER + 54)
  91. #define EM_EXSETSEL                (WM_USER + 55)
  92. #define EM_FINDTEXT                (WM_USER + 56)
  93. #define EM_FORMATRANGE            (WM_USER + 57)
  94. #define EM_GETCHARFORMAT        (WM_USER + 58)
  95. #define EM_GETEVENTMASK            (WM_USER + 59)
  96. #define EM_GETOLEINTERFACE        (WM_USER + 60)
  97. #define EM_GETPARAFORMAT        (WM_USER + 61)
  98. #define EM_GETSELTEXT            (WM_USER + 62)
  99. #define EM_HIDESELECTION        (WM_USER + 63)
  100. #define EM_PASTESPECIAL            (WM_USER + 64)
  101. #define EM_REQUESTRESIZE        (WM_USER + 65)
  102. #define EM_SELECTIONTYPE        (WM_USER + 66)
  103. #define EM_SETBKGNDCOLOR        (WM_USER + 67)
  104. #define EM_SETCHARFORMAT        (WM_USER + 68)
  105. #define EM_SETEVENTMASK            (WM_USER + 69)
  106. #define EM_SETOLECALLBACK        (WM_USER + 70)
  107. #define EM_SETPARAFORMAT        (WM_USER + 71)
  108. #define EM_SETTARGETDEVICE        (WM_USER + 72)
  109. #define EM_STREAMIN                (WM_USER + 73)
  110. #define EM_STREAMOUT            (WM_USER + 74)
  111. #define EM_GETTEXTRANGE            (WM_USER + 75)
  112. #define EM_FINDWORDBREAK        (WM_USER + 76)
  113. #define EM_SETOPTIONS            (WM_USER + 77)
  114. #define EM_GETOPTIONS            (WM_USER + 78)
  115. #define EM_FINDTEXTEX            (WM_USER + 79)
  116. #ifdef _WIN32
  117. #define EM_GETWORDBREAKPROCEX    (WM_USER + 80)
  118. #define EM_SETWORDBREAKPROCEX    (WM_USER + 81)
  119. #endif
  120.  
  121. /* Richedit v2.0 messages */
  122. #define    EM_SETUNDOLIMIT            (WM_USER + 82)
  123. #define EM_REDO                    (WM_USER + 84)
  124. #define EM_CANREDO                (WM_USER + 85)
  125. #define EM_GETUNDONAME            (WM_USER + 86)
  126. #define EM_GETREDONAME            (WM_USER + 87)
  127. #define EM_STOPGROUPTYPING        (WM_USER + 88)
  128.  
  129. #define EM_SETTEXTMODE            (WM_USER + 89)
  130. #define EM_GETTEXTMODE            (WM_USER + 90)
  131.  
  132. /* enum for use with EM_GET/SETTEXTMODE */
  133. typedef enum tagTextMode
  134. {
  135.     TM_PLAINTEXT            = 1,
  136.     TM_RICHTEXT                = 2,    /* default behavior */
  137.     TM_SINGLELEVELUNDO        = 4,
  138.     TM_MULTILEVELUNDO        = 8,    /* default behavior */
  139.     TM_SINGLECODEPAGE        = 16,
  140.     TM_MULTICODEPAGE        = 32    /* default behavior */
  141. } TEXTMODE;
  142.  
  143. #define EM_AUTOURLDETECT        (WM_USER + 91)
  144. #define EM_GETAUTOURLDETECT        (WM_USER + 92)
  145. #define EM_SETPALETTE            (WM_USER + 93)
  146. #define EM_GETTEXTEX            (WM_USER + 94)
  147. #define EM_GETTEXTLENGTHEX        (WM_USER + 95)
  148.  
  149. /* Far East specific messages */
  150. #define EM_SETPUNCTUATION        (WM_USER + 100)
  151. #define EM_GETPUNCTUATION        (WM_USER + 101)
  152. #define EM_SETWORDWRAPMODE        (WM_USER + 102)
  153. #define EM_GETWORDWRAPMODE        (WM_USER + 103)
  154. #define EM_SETIMECOLOR            (WM_USER + 104)
  155. #define EM_GETIMECOLOR            (WM_USER + 105)
  156. #define EM_SETIMEOPTIONS        (WM_USER + 106)
  157. #define EM_GETIMEOPTIONS        (WM_USER + 107)
  158. #define EM_CONVPOSITION         (WM_USER + 108)
  159.  
  160. #define EM_SETLANGOPTIONS        (WM_USER + 120)
  161. #define EM_GETLANGOPTIONS        (WM_USER + 121)
  162. #define EM_GETIMECOMPMODE        (WM_USER + 122)
  163.  
  164. /* Options for EM_SETLANGOPTIONS and EM_GETLANGOPTIONS */
  165. #define IMF_AUTOKEYBOARD        0x0001
  166. #define IMF_AUTOFONT            0x0002
  167. #define IMF_IMECANCELCOMPLETE    0x0004    // high completes the comp string when aborting, low cancels.
  168. #define IMF_IMEALWAYSSENDNOTIFY 0x0008
  169.  
  170. /* Values for EM_GETIMECOMPMODE */
  171. #define ICM_NOTOPEN                0x0000
  172. #define ICM_LEVEL3                0x0001
  173. #define ICM_LEVEL2                0x0002
  174. #define ICM_LEVEL2_5            0x0003
  175. #define ICM_LEVEL2_SUI            0x0004
  176.  
  177. /* New notifications */
  178.  
  179. #define EN_MSGFILTER            0x0700
  180. #define EN_REQUESTRESIZE        0x0701
  181. #define EN_SELCHANGE            0x0702
  182. #define EN_DROPFILES            0x0703
  183. #define EN_PROTECTED            0x0704
  184. #define EN_CORRECTTEXT            0x0705            /* PenWin specific */
  185. #define EN_STOPNOUNDO            0x0706
  186. #define EN_IMECHANGE            0x0707            /* Far East specific */
  187. #define EN_SAVECLIPBOARD        0x0708
  188. #define EN_OLEOPFAILED            0x0709
  189. #define EN_OBJECTPOSITIONS        0x070a
  190. #define EN_LINK                    0x070b
  191. #define EN_DRAGDROPDONE            0x070c
  192.  
  193. /* Event notification masks */
  194.  
  195. #define ENM_NONE                0x00000000
  196. #define ENM_CHANGE                0x00000001
  197. #define ENM_UPDATE                0x00000002
  198. #define ENM_SCROLL                0x00000004
  199. #define ENM_KEYEVENTS            0x00010000
  200. #define ENM_MOUSEEVENTS            0x00020000
  201. #define ENM_REQUESTRESIZE        0x00040000
  202. #define ENM_SELCHANGE            0x00080000
  203. #define ENM_DROPFILES            0x00100000
  204. #define ENM_PROTECTED            0x00200000
  205. #define ENM_CORRECTTEXT            0x00400000        /* PenWin specific */
  206. #define ENM_SCROLLEVENTS        0x00000008
  207. #define ENM_DRAGDROPDONE        0x00000010
  208.  
  209. /* Far East specific notification mask */
  210. #define ENM_IMECHANGE            0x00800000        /* unused by RE2.0 */
  211. #define ENM_LANGCHANGE            0x01000000
  212. #define ENM_OBJECTPOSITIONS        0x02000000
  213. #define ENM_LINK                0x04000000
  214.  
  215. /* New edit control styles */
  216.  
  217. #define ES_SAVESEL                0x00008000
  218. #define ES_SUNKEN                0x00004000
  219. #define ES_DISABLENOSCROLL        0x00002000
  220. /* same as WS_MAXIMIZE, but that doesn't make sense so we re-use the value */
  221. #define ES_SELECTIONBAR            0x01000000
  222. /* same as ES_UPPERCASE, but re-used to completely disable OLE drag'n'drop */
  223. #define ES_NOOLEDRAGDROP        0x00000008
  224.  
  225. /* New edit control extended style */
  226. #ifdef    _WIN32
  227. #define ES_EX_NOCALLOLEINIT        0x01000000
  228. #endif    
  229.  
  230. /* These flags are used in FE Windows */
  231. #define ES_VERTICAL                0x00400000
  232. #define    ES_NOIME                0x00080000
  233. #define ES_SELFIME                0x00040000
  234.  
  235. /* Edit control options */
  236. #define ECO_AUTOWORDSELECTION    0x00000001
  237. #define ECO_AUTOVSCROLL            0x00000040
  238. #define ECO_AUTOHSCROLL            0x00000080
  239. #define ECO_NOHIDESEL            0x00000100
  240. #define ECO_READONLY            0x00000800
  241. #define ECO_WANTRETURN            0x00001000
  242. #define ECO_SAVESEL                0x00008000
  243. #define ECO_SELECTIONBAR        0x01000000
  244. #define ECO_VERTICAL            0x00400000        /* FE specific */
  245.  
  246.  
  247. /* ECO operations */
  248. #define ECOOP_SET                0x0001
  249. #define ECOOP_OR                0x0002
  250. #define ECOOP_AND                0x0003
  251. #define ECOOP_XOR                0x0004
  252.  
  253. /* new word break function actions */
  254. #define WB_CLASSIFY            3
  255. #define WB_MOVEWORDLEFT        4
  256. #define WB_MOVEWORDRIGHT    5
  257. #define WB_LEFTBREAK        6
  258. #define WB_RIGHTBREAK        7
  259.  
  260. /* Far East specific flags */
  261. #define WB_MOVEWORDPREV        4
  262. #define WB_MOVEWORDNEXT        5
  263. #define WB_PREVBREAK        6
  264. #define WB_NEXTBREAK        7
  265.  
  266. #define PC_FOLLOWING        1
  267. #define    PC_LEADING            2
  268. #define    PC_OVERFLOW            3
  269. #define    PC_DELIMITER        4
  270. #define WBF_WORDWRAP        0x010
  271. #define WBF_WORDBREAK        0x020
  272. #define    WBF_OVERFLOW        0x040    
  273. #define WBF_LEVEL1            0x080
  274. #define    WBF_LEVEL2            0x100
  275. #define    WBF_CUSTOM            0x200
  276.  
  277. /* Far East specific flags */
  278. #define IMF_FORCENONE           0x0001
  279. #define IMF_FORCEENABLE         0x0002
  280. #define IMF_FORCEDISABLE        0x0004
  281. #define IMF_CLOSESTATUSWINDOW   0x0008
  282. #define IMF_VERTICAL            0x0020
  283. #define IMF_FORCEACTIVE         0x0040
  284. #define IMF_FORCEINACTIVE       0x0080
  285. #define IMF_FORCEREMEMBER       0x0100
  286. #define IMF_MULTIPLEEDIT        0x0400
  287.  
  288. /* Word break flags (used with WB_CLASSIFY) */
  289. #define WBF_CLASS            ((BYTE) 0x0F)
  290. #define WBF_ISWHITE            ((BYTE) 0x10)
  291. #define WBF_BREAKLINE        ((BYTE) 0x20)
  292. #define WBF_BREAKAFTER        ((BYTE) 0x40)
  293.  
  294.  
  295. /* new data types */
  296.  
  297. #ifdef _WIN32
  298. /* extended edit word break proc (character set aware) */
  299. typedef LONG (*EDITWORDBREAKPROCEX)(char *pchText, LONG cchText, BYTE bCharSet, INT action);
  300. #endif
  301.  
  302. /* all character format measurements are in twips */
  303. typedef struct _charformat
  304. {
  305.     UINT        cbSize;
  306.     _WPAD        _wPad1;
  307.     DWORD        dwMask;
  308.     DWORD        dwEffects;
  309.     LONG        yHeight;
  310.     LONG        yOffset;
  311.     COLORREF    crTextColor;
  312.     BYTE        bCharSet;
  313.     BYTE        bPitchAndFamily;
  314.     char        szFaceName[LF_FACESIZE];
  315.     _WPAD        _wPad2;
  316. } CHARFORMATA;
  317.  
  318. typedef struct _charformatw
  319. {
  320.     UINT        cbSize;
  321.     _WPAD        _wPad1;
  322.     DWORD        dwMask;
  323.     DWORD        dwEffects;
  324.     LONG        yHeight;
  325.     LONG        yOffset;
  326.     COLORREF    crTextColor;
  327.     BYTE        bCharSet;
  328.     BYTE        bPitchAndFamily;
  329.     WCHAR        szFaceName[LF_FACESIZE];
  330.     _WPAD        _wPad2;
  331. } CHARFORMATW;
  332.  
  333. #if (_RICHEDIT_VER >= 0x0200)
  334. #ifdef UNICODE
  335. #define CHARFORMAT CHARFORMATW
  336. #else
  337. #define CHARFORMAT CHARFORMATA
  338. #endif /* UNICODE */
  339. #else
  340. #define CHARFORMAT CHARFORMATA
  341. #endif /* _RICHEDIT_VER >= 0x0200 */
  342.  
  343. /* CHARFORMAT masks */
  344. #define CFM_BOLD        0x00000001
  345. #define CFM_ITALIC        0x00000002
  346. #define CFM_UNDERLINE    0x00000004
  347. #define CFM_STRIKEOUT    0x00000008
  348. #define CFM_PROTECTED    0x00000010
  349. #define CFM_LINK        0x00000020        /* Exchange hyperlink extension */
  350. #define CFM_SIZE        0x80000000
  351. #define CFM_COLOR        0x40000000
  352. #define CFM_FACE        0x20000000
  353. #define CFM_OFFSET        0x10000000
  354. #define CFM_CHARSET        0x08000000
  355.  
  356. /* CHARFORMAT effects */
  357. #define CFE_BOLD        0x0001
  358. #define CFE_ITALIC        0x0002
  359. #define CFE_UNDERLINE    0x0004
  360. #define CFE_STRIKEOUT    0x0008
  361. #define CFE_PROTECTED    0x0010
  362. #define CFE_LINK        0x0020
  363. #define CFE_AUTOCOLOR    0x40000000        /* NOTE: this corresponds to */
  364.                                         /* CFM_COLOR, which controls it */
  365. #define yHeightCharPtsMost 1638
  366.  
  367. /* EM_SETCHARFORMAT wParam masks */
  368. #define SCF_SELECTION    0x0001
  369. #define SCF_WORD        0x0002
  370. #define SCF_DEFAULT        0x0000        // set the default charformat or paraformat
  371. #define SCF_ALL            0x0004        // not valid with SCF_SELECTION or SCF_WORD
  372. #define SCF_USEUIRULES    0x0008        // modifier for SCF_SELECTION; says that
  373.                                     // the format came from a toolbar, etc. and
  374.                                     // therefore UI formatting rules should be
  375.                                     // used instead of strictly formatting the
  376.                                     // selection.
  377.  
  378.  
  379. typedef struct _charrange
  380. {
  381.     LONG    cpMin;
  382.     LONG    cpMax;
  383. } CHARRANGE;
  384.  
  385. typedef struct _textrange
  386. {
  387.     CHARRANGE chrg;
  388.     LPSTR lpstrText;    /* allocated by caller, zero terminated by RichEdit */
  389. } TEXTRANGEA;
  390.  
  391. typedef struct _textrangew
  392. {
  393.     CHARRANGE chrg;
  394.     LPWSTR lpstrText;    /* allocated by caller, zero terminated by RichEdit */
  395. } TEXTRANGEW;
  396.  
  397. #if (_RICHEDIT_VER >= 0x0200)
  398. #ifdef UNICODE
  399. #define TEXTRANGE     TEXTRANGEW
  400. #else
  401. #define TEXTRANGE    TEXTRANGEA
  402. #endif /* UNICODE */
  403. #else
  404. #define TEXTRANGE    TEXTRANGEA
  405. #endif /* _RICHEDIT_VER >= 0x0200 */
  406.  
  407.  
  408. typedef DWORD (CALLBACK *EDITSTREAMCALLBACK)(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb);
  409.  
  410. typedef struct _editstream
  411. {
  412.     DWORD dwCookie;        /* user value passed to callback as first parameter */
  413.     DWORD dwError;        /* last error */
  414.     EDITSTREAMCALLBACK pfnCallback;
  415. } EDITSTREAM;
  416.  
  417. /* stream formats */
  418.  
  419. #define SF_TEXT            0x0001
  420. #define SF_RTF            0x0002
  421. #define SF_RTFNOOBJS    0x0003        /* outbound only */
  422. #define SF_TEXTIZED        0x0004        /* outbound only */
  423. #define SF_UNICODE        0x0010        /* Unicode file of some kind */
  424.  
  425. /* Flag telling stream operations to operate on the selection only */
  426. /* EM_STREAMIN will replace the current selection */
  427. /* EM_STREAMOUT will stream out the current selection */
  428. #define SFF_SELECTION    0x8000
  429.  
  430. /* Flag telling stream operations to operate on the common RTF keyword only */
  431. /* EM_STREAMIN will accept the only common RTF keyword */
  432. /* EM_STREAMOUT will stream out the only common RTF keyword */
  433. #define SFF_PLAINRTF    0x4000
  434.  
  435. typedef struct _findtext
  436. {
  437.     CHARRANGE chrg;
  438.     LPSTR lpstrText;
  439. } FINDTEXTA;
  440.  
  441. typedef struct _findtextw
  442. {
  443.     CHARRANGE chrg;
  444.     LPWSTR lpstrText;
  445. } FINDTEXTW;
  446.  
  447. #if (_RICHEDIT_VER >= 0x0200)
  448. #ifdef UNICODE
  449. #define FINDTEXT    FINDTEXTW
  450. #else
  451. #define FINDTEXT    FINDTEXTA
  452. #endif /* UNICODE */
  453. #else
  454. #define FINDTEXT    FINDTEXTA
  455. #endif /* _RICHEDIT_VER >= 0x0200 */
  456.  
  457. typedef struct _findtextexa
  458. {
  459.     CHARRANGE chrg;
  460.     LPSTR lpstrText;
  461.     CHARRANGE chrgText;
  462. } FINDTEXTEXA;
  463.  
  464. typedef struct _findtextexw
  465. {
  466.     CHARRANGE chrg;
  467.     LPWSTR lpstrText;
  468.     CHARRANGE chrgText;
  469. } FINDTEXTEXW;
  470.  
  471. #if (_RICHEDIT_VER >= 0x0200)
  472. #ifdef UNICODE
  473. #define FINDTEXTEX    FINDTEXTEXW
  474. #else
  475. #define FINDTEXTEX    FINDTEXTEXA
  476. #endif /* UNICODE */
  477. #else
  478. #define FINDTEXTEX    FINDTEXTEXA
  479. #endif /* _RICHEDIT_VER >= 0x0200 */
  480.  
  481.  
  482. typedef struct _formatrange
  483. {
  484.     HDC hdc;
  485.     HDC hdcTarget;
  486.     RECT rc;
  487.     RECT rcPage;
  488.     CHARRANGE chrg;
  489. } FORMATRANGE;
  490.  
  491. /* all paragraph measurements are in twips */
  492.  
  493. #define MAX_TAB_STOPS 32
  494. #define lDefaultTab 720
  495.  
  496. typedef struct _paraformat
  497. {
  498.     UINT    cbSize;
  499.     _WPAD    _wPad1;
  500.     DWORD    dwMask;
  501.     WORD    wNumbering;
  502.     WORD    wReserved;
  503.     LONG    dxStartIndent;
  504.     LONG    dxRightIndent;
  505.     LONG    dxOffset;
  506.     WORD    wAlignment;
  507.     SHORT    cTabCount;
  508.     LONG    rgxTabs[MAX_TAB_STOPS];
  509. } PARAFORMAT;
  510.  
  511. /* PARAFORMAT mask values */
  512. #define PFM_STARTINDENT            0x00000001
  513. #define PFM_RIGHTINDENT            0x00000002
  514. #define PFM_OFFSET                0x00000004
  515. #define PFM_ALIGNMENT            0x00000008
  516. #define PFM_TABSTOPS            0x00000010
  517. #define PFM_NUMBERING            0x00000020
  518. #define PFM_OFFSETINDENT        0x80000000
  519.  
  520. /* PARAFORMAT numbering options */
  521. #define PFN_BULLET        0x0001
  522.  
  523. /* PARAFORMAT alignment options */
  524. #define PFA_LEFT    0x0001
  525. #define PFA_RIGHT    0x0002
  526. #define PFA_CENTER    0x0003
  527.  
  528. /* CHARFORMAT2 and PARAFORMAT2 structures */
  529.  
  530. #ifdef __cplusplus
  531.  
  532. struct CHARFORMAT2W : _charformatw
  533. {
  534.     WORD        wWeight;            /* Font weight (LOGFONT value)        */
  535.     SHORT        sSpacing;            /* Amount to space between letters    */
  536.     COLORREF    crBackColor;        /* Background color                    */
  537.     LCID        lcid;                /* Locale ID                        */
  538.     DWORD        dwReserved;            /* Reserved. Must be 0                */
  539.     SHORT        sStyle;                /* Style handle                        */
  540.     WORD        wKerning;            /* Twip size above which to kern char pair*/
  541.     BYTE        bUnderlineType;        /* Underline type                    */
  542.     BYTE        bAnimation;            /* Animated text like marching ants */
  543.     BYTE        bRevAuthor;            /* Revision author index            */
  544. };
  545.  
  546. struct CHARFORMAT2A : _charformat
  547. {
  548.     WORD        wWeight;            /* Font weight (LOGFONT value)        */
  549.     SHORT        sSpacing;            /* Amount to space between letters    */
  550.     COLORREF    crBackColor;        /* Background color                    */
  551.     LCID        lcid;                /* Locale ID                        */
  552.     DWORD        dwReserved;            /* Reserved. Must be 0                */
  553.     SHORT        sStyle;                /* Style handle                        */
  554.     WORD        wKerning;            /* Twip size above which to kern char pair*/
  555.     BYTE        bUnderlineType;        /* Underline type                    */
  556.     BYTE        bAnimation;            /* Animated text like marching ants    */
  557.     BYTE        bRevAuthor;            /* Revision author index            */
  558. };
  559.  
  560. #else    /* regular C-style  */
  561.  
  562. typedef struct _charformat2w
  563. {
  564.     UINT        cbSize;
  565.     _WPAD        _wPad1;
  566.     DWORD        dwMask;
  567.     DWORD        dwEffects;
  568.     LONG        yHeight;
  569.     LONG        yOffset;            /* > 0 for superscript, < 0 for subscript */
  570.     COLORREF    crTextColor;
  571.     BYTE        bCharSet;
  572.     BYTE        bPitchAndFamily;
  573.     WCHAR        szFaceName[LF_FACESIZE];
  574.     _WPAD        _wPad2;
  575.     WORD        wWeight;            /* Font weight (LOGFONT value)        */
  576.     SHORT        sSpacing;            /* Amount to space between letters    */
  577.     COLORREF    crBackColor;        /* Background color                    */
  578.     LCID        lcid;                /* Locale ID                        */
  579.     DWORD        dwReserved;            /* Reserved. Must be 0                */
  580.     SHORT        sStyle;                /* Style handle                        */
  581.     WORD        wKerning;            /* Twip size above which to kern char pair*/
  582.     BYTE        bUnderlineType;        /* Underline type                    */
  583.     BYTE        bAnimation;            /* Animated text like marching ants    */
  584.     BYTE        bRevAuthor;            /* Revision author index            */
  585.     BYTE        bReserved1;
  586. } CHARFORMAT2W;
  587.  
  588. typedef struct _charformat2a
  589. {
  590.     UINT        cbSize;
  591.     _WPAD        _wPad1;
  592.     DWORD        dwMask;
  593.     DWORD        dwEffects;
  594.     LONG        yHeight;
  595.     LONG        yOffset;            /* > 0 for superscript, < 0 for subscript */
  596.     COLORREF    crTextColor;
  597.     BYTE        bCharSet;
  598.     BYTE        bPitchAndFamily;
  599.     char        szFaceName[LF_FACESIZE];
  600.     _WPAD        _wPad2;
  601.     WORD        wWeight;            /* Font weight (LOGFONT value)        */
  602.     SHORT        sSpacing;            /* Amount to space between letters    */
  603.     COLORREF    crBackColor;        /* Background color                    */
  604.     LCID        lcid;                /* Locale ID                        */
  605.     DWORD        dwReserved;            /* Reserved. Must be 0                */
  606.     SHORT        sStyle;                /* Style handle                        */
  607.     WORD        wKerning;            /* Twip size above which to kern char pair*/
  608.     BYTE        bUnderlineType;        /* Underline type                    */
  609.     BYTE        bAnimation;            /* Animated text like marching ants    */
  610.     BYTE        bRevAuthor;            /* Revision author index            */
  611. } CHARFORMAT2A;
  612.  
  613. #endif /* C++ */
  614.  
  615. #ifdef UNICODE
  616. #define CHARFORMAT2    CHARFORMAT2W
  617. #else
  618. #define CHARFORMAT2 CHARFORMAT2A
  619. #endif
  620.  
  621. #define CHARFORMATDELTA        (sizeof(CHARFORMAT2) - sizeof(CHARFORMAT))
  622.  
  623.  
  624. /* CHARFORMAT and PARAFORMAT "ALL" masks
  625.    CFM_COLOR mirrors CFE_AUTOCOLOR, a little hack to easily deal with autocolor*/
  626.  
  627. #define CFM_EFFECTS (CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_COLOR | \
  628.                      CFM_STRIKEOUT | CFE_PROTECTED | CFM_LINK)
  629. #define CFM_ALL (CFM_EFFECTS | CFM_SIZE | CFM_FACE | CFM_OFFSET | CFM_CHARSET)
  630.  
  631. #define    PFM_ALL (PFM_STARTINDENT | PFM_RIGHTINDENT | PFM_OFFSET    | \
  632.                  PFM_ALIGNMENT   | PFM_TABSTOPS    | PFM_NUMBERING | \
  633.                  PFM_OFFSETINDENT)
  634.  
  635. /* New masks and effects -- a parenthesized asterisk indicates that
  636.    the data is stored by RichEdit2.0, but not displayed */
  637.  
  638. #define CFM_SMALLCAPS        0x0040            /* (*)    */
  639. #define    CFM_ALLCAPS            0x0080            /* (*)    */
  640. #define    CFM_HIDDEN            0x0100            /* (*)    */
  641. #define    CFM_OUTLINE            0x0200            /* (*)    */
  642. #define    CFM_SHADOW            0x0400            /* (*)    */
  643. #define    CFM_EMBOSS            0x0800            /* (*)    */
  644. #define    CFM_IMPRINT            0x1000            /* (*)    */
  645. #define CFM_DISABLED        0x2000
  646. #define    CFM_REVISED            0x4000
  647.  
  648. #define CFM_BACKCOLOR        0x04000000
  649. #define CFM_LCID            0x02000000
  650. #define    CFM_UNDERLINETYPE    0x00800000        /* (*)    */
  651. #define    CFM_WEIGHT            0x00400000
  652. #define CFM_SPACING            0x00200000        /* (*)    */
  653. #define CFM_KERNING            0x00100000        /* (*)    */
  654. #define CFM_STYLE            0x00080000        /* (*)    */
  655. #define CFM_ANIMATION        0x00040000        /* (*)    */
  656. #define CFM_REVAUTHOR        0x00008000
  657.  
  658. #define CFE_SUBSCRIPT        0x00010000        /* Superscript and subscript are */
  659. #define CFE_SUPERSCRIPT        0x00020000        /*  mutually exclusive             */
  660.  
  661. #define CFM_SUBSCRIPT        CFE_SUBSCRIPT | CFE_SUPERSCRIPT
  662. #define CFM_SUPERSCRIPT        CFM_SUBSCRIPT
  663.  
  664. #define    CFM_EFFECTS2 (CFM_EFFECTS | CFM_DISABLED | CFM_SMALLCAPS | CFM_ALLCAPS \
  665.                     | CFM_HIDDEN  | CFM_OUTLINE | CFM_SHADOW | CFM_EMBOSS \
  666.                     | CFM_IMPRINT | CFM_DISABLED | CFM_REVISED \
  667.                     | CFM_SUBSCRIPT | CFM_SUPERSCRIPT | CFM_BACKCOLOR)
  668.  
  669. #define CFM_ALL2     (CFM_ALL | CFM_EFFECTS2 | CFM_BACKCOLOR | CFM_LCID \
  670.                     | CFM_UNDERLINETYPE | CFM_WEIGHT | CFM_REVAUTHOR \
  671.                     | CFM_SPACING | CFM_KERNING | CFM_STYLE | CFM_ANIMATION)
  672.  
  673. #define    CFE_SMALLCAPS        CFM_SMALLCAPS
  674. #define    CFE_ALLCAPS            CFM_ALLCAPS
  675. #define    CFE_HIDDEN            CFM_HIDDEN
  676. #define    CFE_OUTLINE            CFM_OUTLINE
  677. #define    CFE_SHADOW            CFM_SHADOW
  678. #define    CFE_EMBOSS            CFM_EMBOSS
  679. #define    CFE_IMPRINT            CFM_IMPRINT
  680. #define    CFE_DISABLED        CFM_DISABLED
  681. #define    CFE_REVISED            CFM_REVISED
  682.  
  683. /* NOTE: CFE_AUTOCOLOR and CFE_AUTOBACKCOLOR correspond to CFM_COLOR and
  684.    CFM_BACKCOLOR, respectively, which control them */
  685. #define CFE_AUTOBACKCOLOR    CFM_BACKCOLOR
  686.  
  687. /* Underline types */
  688. #define CFU_CF1UNDERLINE    0xFF    /* map charformat's bit underline to CF2.*/
  689. #define CFU_INVERT            0xFE    /* For IME composition fake a selection.*/    
  690. #define    CFU_UNDERLINEDOTTED    0x4        /* (*) displayed as ordinary underline    */
  691. #define    CFU_UNDERLINEDOUBLE    0x3        /* (*) displayed as ordinary underline    */
  692. #define CFU_UNDERLINEWORD    0x2        /* (*) displayed as ordinary underline    */
  693. #define CFU_UNDERLINE        0x1
  694. #define CFU_UNDERLINENONE    0
  695.  
  696. #ifdef __cplusplus
  697. struct PARAFORMAT2 : _paraformat
  698. {
  699.     LONG    dySpaceBefore;            /* Vertical spacing before para            */
  700.     LONG    dySpaceAfter;            /* Vertical spacing after para            */    
  701.     LONG    dyLineSpacing;            /* Line spacing depending on Rule        */
  702.     SHORT    sStyle;                    /* Style handle                            */
  703.     BYTE    bLineSpacingRule;        /* Rule for line spacing (see tom.doc)    */
  704.     BYTE    bCRC;                    /* Reserved for CRC for rapid searching    */
  705.     WORD    wShadingWeight;            /* Shading in hundredths of a per cent    */
  706.     WORD    wShadingStyle;            /* Nibble 0: style, 1: cfpat, 2: cbpat    */
  707.     WORD    wNumberingStart;        /* Starting value for numbering            */
  708.     WORD    wNumberingStyle;        /* Alignment, roman/arabic, (), ), ., etc.*/
  709.     WORD    wNumberingTab;            /* Space bet FirstIndent and 1st-line text*/
  710.     WORD    wBorderSpace;            /* Space between border and text (twips)*/
  711.     WORD    wBorderWidth;            /* Border pen width (twips)                */
  712.     WORD    wBorders;                /* Byte 0: bits specify which borders    */
  713.                                     /* Nibble 2: border style, 3: color index*/
  714. };
  715.  
  716. #else    /* regular C-style    */
  717.  
  718. typedef struct _paraformat2
  719. {
  720.     UINT    cbSize;
  721.     _WPAD    _wPad1;
  722.     DWORD    dwMask;
  723.     WORD    wNumbering;
  724.     WORD    wReserved;
  725.     LONG    dxStartIndent;
  726.     LONG    dxRightIndent;
  727.     LONG    dxOffset;
  728.     WORD    wAlignment;
  729.     SHORT    cTabCount;
  730.     LONG    rgxTabs[MAX_TAB_STOPS];
  731.      LONG    dySpaceBefore;            /* Vertical spacing before para            */
  732.     LONG    dySpaceAfter;            /* Vertical spacing after para            */
  733.     LONG    dyLineSpacing;            /* Line spacing depending on Rule        */
  734.     SHORT    sStyle;                    /* Style handle                            */
  735.     BYTE    bLineSpacingRule;        /* Rule for line spacing (see tom.doc)    */
  736.     BYTE    bCRC;                    /* Reserved for CRC for rapid searching    */
  737.     WORD    wShadingWeight;            /* Shading in hundredths of a per cent    */
  738.     WORD    wShadingStyle;            /* Nibble 0: style, 1: cfpat, 2: cbpat    */
  739.     WORD    wNumberingStart;        /* Starting value for numbering            */    
  740.     WORD    wNumberingStyle;        /* Alignment, roman/arabic, (), ), ., etc.*/
  741.     WORD    wNumberingTab;            /* Space bet 1st indent and 1st-line text*/
  742.     WORD    wBorderSpace;            /* Space between border and text (twips)*/
  743.     WORD    wBorderWidth;            /* Border pen width (twips)                */
  744.     WORD    wBorders;                /* Byte 0: bits specify which borders    */
  745.                                     /* Nibble 2: border style, 3: color index*/
  746. } PARAFORMAT2;
  747.  
  748. #endif /* C++    */
  749.  
  750. /* this is a hack to make PARAFORMAT code more readable.
  751.    it applies to the wReserved field in PARAFORMAT, which
  752.    in PARAFORMAT2 is now used. */
  753.  
  754. #define    wEffects            wReserved
  755.  
  756. /* PARAFORMAT 2.0 masks and effects */
  757.  
  758. #define PFM_SPACEBEFORE            0x00000040
  759. #define PFM_SPACEAFTER            0x00000080
  760. #define PFM_LINESPACING            0x00000100
  761. #define    PFM_STYLE                0x00000400
  762. #define PFM_BORDER                0x00000800    /* (*)    */
  763. #define PFM_SHADING                0x00001000    /* (*)    */
  764. #define PFM_NUMBERINGSTYLE        0x00002000    /* (*)    */
  765. #define PFM_NUMBERINGTAB        0x00004000    /* (*)    */
  766. #define PFM_NUMBERINGSTART        0x00008000    /* (*)    */
  767.  
  768. #define PFM_RTLPARA                0x00010000
  769. #define PFM_KEEP                0x00020000    /* (*)    */
  770. #define PFM_KEEPNEXT            0x00040000    /* (*)    */
  771. #define PFM_PAGEBREAKBEFORE        0x00080000    /* (*)    */
  772. #define PFM_NOLINENUMBER        0x00100000    /* (*)    */
  773. #define PFM_NOWIDOWCONTROL        0x00200000    /* (*)    */
  774. #define PFM_DONOTHYPHEN            0x00400000    /* (*)    */
  775. #define PFM_SIDEBYSIDE            0x00800000    /* (*)    */
  776.  
  777. #define PFM_TABLE                0xc0000000    /* (*)    */
  778.  
  779. /* Note: PARAFORMAT has no effects */
  780. #define PFM_EFFECTS  (PFM_RTLPARA | PFM_KEEP | PFM_KEEPNEXT | PFM_TABLE \
  781.                     | PFM_PAGEBREAKBEFORE | PFM_NOLINENUMBER  \
  782.                     | PFM_NOWIDOWCONTROL | PFM_DONOTHYPHEN | PFM_SIDEBYSIDE \
  783.                     | PFM_TABLE)
  784.  
  785. #define PFM_ALL2    (PFM_ALL | PFM_EFFECTS | PFM_SPACEBEFORE | PFM_SPACEAFTER \
  786.                     | PFM_LINESPACING | PFM_STYLE | PFM_SHADING | PFM_BORDER \
  787.                     | PFM_NUMBERINGTAB | PFM_NUMBERINGSTART | PFM_NUMBERINGSTYLE)
  788.  
  789. #define PFE_RTLPARA                (PFM_RTLPARA         >> 16)
  790. #define PFE_KEEP                (PFM_KEEP             >> 16)    /* (*)    */
  791. #define PFE_KEEPNEXT            (PFM_KEEPNEXT         >> 16)    /* (*)    */
  792. #define PFE_PAGEBREAKBEFORE        (PFM_PAGEBREAKBEFORE >> 16)    /* (*)    */
  793. #define PFE_NOLINENUMBER        (PFM_NOLINENUMBER     >> 16)    /* (*)    */
  794. #define PFE_NOWIDOWCONTROL        (PFM_NOWIDOWCONTROL     >> 16)    /* (*)    */
  795. #define PFE_DONOTHYPHEN            (PFM_DONOTHYPHEN      >> 16)    /* (*)    */
  796. #define PFE_SIDEBYSIDE            (PFM_SIDEBYSIDE         >> 16)    /* (*)    */
  797.  
  798. #define PFE_TABLEROW            0xc000        /* These 3 options are mutually    */
  799. #define PFE_TABLECELLEND        0x8000        /*  exclusive and each imply    */
  800. #define PFE_TABLECELL            0x4000        /*  that para is part of a table*/
  801.  
  802. /*
  803.  *    PARAFORMAT numbering options (values for wNumbering):
  804.  *
  805.  *        Numbering Type        Value    Meaning
  806.  *        tomNoNumbering          0        Turn off paragraph numbering
  807.  *        tomNumberAsLCLetter      1        a, b, c, ...
  808.  *        tomNumberAsUCLetter      2        A, B, C, ...
  809.  *        tomNumberAsLCRoman      3        i, ii, iii, ...
  810.  *        tomNumberAsUCRoman      4        I, II, III, ...
  811.  *        tomNumberAsSymbols      5        default is bullet
  812.  *        tomNumberAsNumber      6        0, 1, 2, ...
  813.  *        tomNumberAsSequence      7        tomNumberingStart is first Unicode to use
  814.  *
  815.  *    Other valid Unicode chars are Unicodes for bullets.
  816.  */
  817.  
  818.  
  819. #define    PFA_JUSTIFY            4    /* New paragraph-alignment option 2.0 (*)
  820.  
  821.  
  822. /* notification structures */
  823.  
  824. #ifndef WM_NOTIFY
  825. #define WM_NOTIFY                0x004E
  826.  
  827. typedef struct _nmhdr
  828. {
  829.     HWND    hwndFrom;
  830.     _WPAD    _wPad1;
  831.     UINT    idFrom;
  832.     _WPAD    _wPad2;
  833.     UINT    code;
  834.     _WPAD    _wPad3;
  835. } NMHDR;
  836. #endif  /* !WM_NOTIFY */
  837.  
  838. typedef struct _msgfilter
  839. {
  840.     NMHDR    nmhdr;
  841.     UINT    msg;
  842.     _WPAD    _wPad1;
  843.     WPARAM    wParam;
  844.     _WPAD    _wPad2;
  845.     LPARAM    lParam;
  846. } MSGFILTER;
  847.  
  848. typedef struct _reqresize
  849. {
  850.     NMHDR nmhdr;
  851.     RECT rc;
  852. } REQRESIZE;
  853.  
  854. typedef struct _selchange
  855. {
  856.     NMHDR nmhdr;
  857.     CHARRANGE chrg;
  858.     WORD seltyp;
  859. } SELCHANGE;
  860.  
  861. #define SEL_EMPTY        0x0000
  862. #define SEL_TEXT        0x0001
  863. #define SEL_OBJECT        0x0002
  864. #define SEL_MULTICHAR    0x0004
  865. #define SEL_MULTIOBJECT    0x0008
  866.  
  867. /* used with IRichEditOleCallback::GetContextMenu, this flag will be
  868.    passed as a "selection type".  It indicates that a context menu for
  869.    a right-mouse drag drop should be generated.  The IOleObject parameter
  870.    will really be the IDataObject for the drop
  871.  */
  872. #define GCM_RIGHTMOUSEDROP  0x8000
  873.  
  874. typedef struct _endropfiles
  875. {
  876.     NMHDR nmhdr;
  877.     HANDLE hDrop;
  878.     LONG cp;
  879.     BOOL fProtected;
  880. } ENDROPFILES;
  881.  
  882. typedef struct _enprotected
  883. {
  884.     NMHDR nmhdr;
  885.     UINT msg;
  886.     _WPAD    _wPad1;
  887.     WPARAM wParam;
  888.     _WPAD    _wPad2;
  889.     LPARAM lParam;
  890.     CHARRANGE chrg;
  891. } ENPROTECTED;
  892.  
  893. typedef struct _ensaveclipboard
  894. {
  895.     NMHDR nmhdr;
  896.     LONG cObjectCount;
  897.     LONG cch;
  898. } ENSAVECLIPBOARD;
  899.  
  900. #ifndef MACPORT
  901. typedef struct _enoleopfailed
  902. {
  903.     NMHDR nmhdr;
  904.     LONG iob;
  905.     LONG lOper;
  906.     HRESULT hr;
  907. } ENOLEOPFAILED;
  908. #endif
  909.  
  910. #define    OLEOP_DOVERB    1
  911.  
  912. typedef struct _objectpositions
  913. {
  914.     NMHDR nmhdr;
  915.     LONG cObjectCount;
  916.     LONG *pcpPositions;
  917. } OBJECTPOSITIONS;
  918.  
  919. typedef struct _enlink
  920. {
  921.     NMHDR nmhdr;
  922.     UINT msg;
  923.     _WPAD   _wPad1;
  924.     WPARAM wParam;
  925.     _WPAD   _wPad2;
  926.     LPARAM lParam;
  927.     CHARRANGE chrg;
  928. } ENLINK;
  929.  
  930. /* PenWin specific */
  931. typedef struct _encorrecttext
  932. {
  933.     NMHDR nmhdr;
  934.     CHARRANGE chrg;
  935.     WORD seltyp;
  936. } ENCORRECTTEXT;
  937.  
  938. /* Far East specific */
  939. typedef struct _punctuation
  940. {
  941.     UINT    iSize;
  942.     LPSTR    szPunctuation;
  943. } PUNCTUATION;
  944.  
  945. /* Far East specific */
  946. typedef struct _compcolor
  947. {
  948.     COLORREF crText;
  949.     COLORREF crBackground;
  950.     DWORD dwEffects;
  951. }COMPCOLOR;
  952.  
  953.  
  954. /* clipboard formats - use as parameter to RegisterClipboardFormat() */
  955. #define CF_RTF             TEXT("Rich Text Format")
  956. #define CF_RTFNOOBJS     TEXT("Rich Text Format Without Objects")
  957. #define CF_RETEXTOBJ     TEXT("RichEdit Text and Objects")
  958.  
  959. /* Paste Special */
  960. typedef struct _repastespecial
  961. {
  962.     DWORD    dwAspect;
  963.     DWORD    dwParam;
  964. } REPASTESPECIAL;
  965.  
  966. /*    UndoName info */
  967. typedef enum _undonameid
  968. {
  969.     UID_UNKNOWN     = 0,
  970.     UID_TYPING        = 1,
  971.     UID_DELETE         = 2,
  972.     UID_DRAGDROP    = 3,
  973.     UID_CUT            = 4,
  974.     UID_PASTE        = 5
  975. } UNDONAMEID;
  976.  
  977. /* flags for the GETEXTEX data structure */
  978. #define GT_DEFAULT        0
  979. #define GT_USECRLF        1
  980.  
  981. /* EM_GETTEXTEX info; this struct is passed in the wparam of the message */
  982. typedef struct _gettextex
  983. {
  984.     DWORD    cb;                /* count of bytes in the string                */
  985.     DWORD    flags;            /* flags (see the GT_XXX defines            */
  986.     UINT    codepage;        /* code page for translation (CP_ACP for default,
  987.                                1200 for Unicode                            */
  988.     LPCSTR    lpDefaultChar;    /* replacement for unmappable chars            */
  989.     LPBOOL    lpUsedDefChar;    /* pointer to flag set when def char used    */
  990. } GETTEXTEX;
  991.  
  992. /* flags for the GETTEXTLENGTHEX data structure                            */
  993. #define GTL_DEFAULT        0    /* do the default (return # of chars)        */
  994. #define GTL_USECRLF        1    /* compute answer using CRLFs for paragraphs*/
  995. #define GTL_PRECISE        2    /* compute a precise answer                    */
  996. #define GTL_CLOSE        4    /* fast computation of a "close" answer        */
  997. #define GTL_NUMCHARS    8    /* return the number of characters            */
  998. #define GTL_NUMBYTES    16    /* return the number of _bytes_                */
  999.  
  1000. /* EM_GETTEXTLENGTHEX info; this struct is passed in the wparam of the msg */
  1001. typedef struct _gettextlengthex
  1002. {
  1003.     DWORD    flags;            /* flags (see GTL_XXX defines)                */
  1004.     UINT    codepage;        /* code page for translation (CP_ACP for default,
  1005.                                1200 for Unicode                            */
  1006. } GETTEXTLENGTHEX;
  1007.     
  1008.     
  1009. /* UNICODE embedding character */
  1010. #ifndef WCH_EMBEDDING
  1011. #define WCH_EMBEDDING (WCHAR)0xFFFC
  1012. #endif /* WCH_EMBEDDING */
  1013.         
  1014.  
  1015. #undef _WPAD
  1016.  
  1017. #ifdef _WIN32
  1018. #include <poppack.h>
  1019. #elif !defined(RC_INVOKED)
  1020. #pragma pack()
  1021. #endif
  1022.  
  1023. #ifdef __cplusplus
  1024. }
  1025. #endif  /* __cplusplus */
  1026.  
  1027. #endif /* !_RICHEDIT_ */
  1028.  
  1029.