Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

413 lines
12 KiB

  1. /* @doc EXTERNAL
  2. *
  3. * @module TEXTSRV.H Text Service Interface |
  4. *
  5. * Define interfaces between the Text Services component and the host
  6. *
  7. * Original Author: <nl>
  8. * Christian Fortini
  9. *
  10. * History: <nl>
  11. * 8/1/95 ricksa Revised interface definition
  12. */
  13. #ifndef _TEXTSERV_H
  14. #define _TEXTSERV_H
  15. EXTERN_C const IID IID_ITextServices;
  16. EXTERN_C const IID IID_ITextHost;
  17. EXTERN_C const IID IID_ITextHost2;
  18. // Note: error code is first outside of range reserved for OLE.
  19. #define S_MSG_KEY_IGNORED \
  20. MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_ITF, 0x201)
  21. // Enums used by property methods
  22. /*
  23. * TXTBACKSTYLE
  24. *
  25. * @enum Defines different background styles control
  26. */
  27. enum TXTBACKSTYLE {
  28. TXTBACK_TRANSPARENT = 0, //@emem background should show through
  29. TXTBACK_OPAQUE, //@emem erase background
  30. };
  31. /*
  32. * TXTHITRESULT
  33. *
  34. * @enum Defines different hitresults
  35. */
  36. enum TXTHITRESULT {
  37. TXTHITRESULT_NOHIT = 0, //@emem no hit
  38. TXTHITRESULT_TRANSPARENT = 1, //@emem point is within the text's rectangle, but
  39. //in a transparent region
  40. TXTHITRESULT_CLOSE = 2, //@emem point is close to the text
  41. TXTHITRESULT_HIT = 3 //@emem dead-on hit
  42. };
  43. /*
  44. * TXTNATURALSIZE
  45. *
  46. * @enum useful values for TxGetNaturalSize.
  47. *
  48. * @xref <mf CTxtEdit::TxGetNaturalSize>
  49. */
  50. enum TXTNATURALSIZE {
  51. TXTNS_FITTOCONTENT2 = 0, //@emem Get size that fits indented content
  52. TXTNS_FITTOCONTENT = 1, //@emem Get size that fits content
  53. TXTNS_ROUNDTOLINE = 2 //@emem Round to nearest whole line
  54. };
  55. /*
  56. * TXTVIEW
  57. *
  58. * @enum useful values for TxDraw lViewId parameter
  59. *
  60. * @xref <mf CTxtEdit::TxDraw>
  61. */
  62. enum TXTVIEW {
  63. TXTVIEW_ACTIVE = 0,
  64. TXTVIEW_INACTIVE = -1
  65. };
  66. /*
  67. * CHANGETYPE
  68. *
  69. * @enum used for CHANGENOTIFY.dwChangeType; indicates what happened
  70. * for a particular change.
  71. */
  72. enum CHANGETYPE
  73. {
  74. CN_GENERIC = 0, //@emem Nothing special happened
  75. CN_TEXTCHANGED = 1, //@emem the text changed
  76. CN_NEWUNDO = 2, //@emem A new undo action was added
  77. CN_NEWREDO = 4 //@emem A new redo action was added
  78. };
  79. /*
  80. * @struct CHANGENOTIFY |
  81. *
  82. * passed during an EN_CHANGE notification; contains information about
  83. * what actually happened for a change.
  84. */
  85. struct CHANGENOTIFY {
  86. DWORD dwChangeType; //@field TEXT changed, etc
  87. void * pvCookieData; //@field cookie for the undo action
  88. // associated with the change.
  89. };
  90. // The TxGetPropertyBits and OnTxPropertyBitsChange methods can pass the following bits:
  91. // NB!!! Do NOT rely on the ordering of these bits yet; the are subject
  92. // to change.
  93. #define TXTBIT_RICHTEXT 1 // rich-text control
  94. #define TXTBIT_MULTILINE 2 // single vs multi-line control
  95. #define TXTBIT_READONLY 4 // read only text
  96. #define TXTBIT_SHOWACCELERATOR 8 // underline accelerator character
  97. #define TXTBIT_USEPASSWORD 0x10 // use password char to display text
  98. #define TXTBIT_HIDESELECTION 0x20 // show selection when inactive
  99. #define TXTBIT_SAVESELECTION 0x40 // remember selection when inactive
  100. #define TXTBIT_AUTOWORDSEL 0x80 // auto-word selection
  101. #define TXTBIT_VERTICAL 0x100 // vertical
  102. #define TXTBIT_SELBARCHANGE 0x200 // notification that the selection bar width
  103. // has changed.
  104. // FUTURE: move this bit to the end to
  105. // maintain the division between
  106. // properties and notifications.
  107. #define TXTBIT_WORDWRAP 0x400 // if set, then multi-line controls
  108. // should wrap words to fit the available
  109. // display
  110. #define TXTBIT_ALLOWBEEP 0x800 // enable/disable beeping
  111. #define TXTBIT_DISABLEDRAG 0x1000 // disable/enable dragging
  112. #define TXTBIT_VIEWINSETCHANGE 0x2000 // the inset changed
  113. #define TXTBIT_BACKSTYLECHANGE 0x4000
  114. #define TXTBIT_MAXLENGTHCHANGE 0x8000
  115. #define TXTBIT_SCROLLBARCHANGE 0x10000
  116. #define TXTBIT_CHARFORMATCHANGE 0x20000
  117. #define TXTBIT_PARAFORMATCHANGE 0x40000
  118. #define TXTBIT_EXTENTCHANGE 0x80000
  119. #define TXTBIT_CLIENTRECTCHANGE 0x100000 // the client rectangle changed
  120. #define TXTBIT_USECURRENTBKG 0x200000 // tells the renderer to use the current background
  121. // color rather than the system default for an entire line
  122. /*
  123. * ITextServices
  124. *
  125. * @class An interface extending Microsoft's Text Object Model to provide
  126. * extra functionality for windowless operation. In conjunction
  127. * with ITextHost, ITextServices provides the means by which the
  128. * the RichEdit control can be used *without* creating a window.
  129. *
  130. * @base public | IUnknown
  131. */
  132. class ITextServices : public IUnknown
  133. {
  134. public:
  135. //@cmember Generic Send Message interface
  136. virtual HRESULT TxSendMessage(
  137. UINT msg,
  138. WPARAM wparam,
  139. LPARAM lparam,
  140. LRESULT *plresult) = 0;
  141. //@cmember Rendering
  142. virtual HRESULT TxDraw(
  143. DWORD dwDrawAspect,
  144. LONG lindex,
  145. void * pvAspect,
  146. DVTARGETDEVICE * ptd,
  147. HDC hdcDraw,
  148. HDC hicTargetDev,
  149. LPCRECTL lprcBounds,
  150. LPCRECTL lprcWBounds,
  151. LPRECT lprcUpdate,
  152. BOOL (CALLBACK * pfnContinue) (DWORD),
  153. DWORD dwContinue,
  154. LONG lViewId) = 0;
  155. //@cmember Horizontal scrollbar support
  156. virtual HRESULT TxGetHScroll(
  157. LONG *plMin,
  158. LONG *plMax,
  159. LONG *plPos,
  160. LONG *plPage,
  161. BOOL * pfEnabled ) = 0;
  162. //@cmember Horizontal scrollbar support
  163. virtual HRESULT TxGetVScroll(
  164. LONG *plMin,
  165. LONG *plMax,
  166. LONG *plPos,
  167. LONG *plPage,
  168. BOOL * pfEnabled ) = 0;
  169. //@cmember Setcursor
  170. virtual HRESULT OnTxSetCursor(
  171. DWORD dwDrawAspect,
  172. LONG lindex,
  173. void * pvAspect,
  174. DVTARGETDEVICE * ptd,
  175. HDC hdcDraw,
  176. HDC hicTargetDev,
  177. LPCRECT lprcClient,
  178. INT x,
  179. INT y) = 0;
  180. //@cmember Hit-test
  181. virtual HRESULT TxQueryHitPoint(
  182. DWORD dwDrawAspect,
  183. LONG lindex,
  184. void * pvAspect,
  185. DVTARGETDEVICE * ptd,
  186. HDC hdcDraw,
  187. HDC hicTargetDev,
  188. LPCRECT lprcClient,
  189. INT x,
  190. INT y,
  191. DWORD * pHitResult) = 0;
  192. //@cmember Inplace activate notification
  193. virtual HRESULT OnTxInPlaceActivate(LPCRECT prcClient) = 0;
  194. //@cmember Inplace deactivate notification
  195. virtual HRESULT OnTxInPlaceDeactivate() = 0;
  196. //@cmember UI activate notification
  197. virtual HRESULT OnTxUIActivate() = 0;
  198. //@cmember UI deactivate notification
  199. virtual HRESULT OnTxUIDeactivate() = 0;
  200. //@cmember Get text in control
  201. virtual HRESULT TxGetText(BSTR *pbstrText) = 0;
  202. //@cmember Set text in control
  203. virtual HRESULT TxSetText(LPCWSTR pszText) = 0;
  204. //@cmember Get x position of
  205. virtual HRESULT TxGetCurTargetX(LONG *) = 0;
  206. //@cmember Get baseline position
  207. virtual HRESULT TxGetBaseLinePos(LONG *) = 0;
  208. //@cmember Get Size to fit / Natural size
  209. virtual HRESULT TxGetNaturalSize(
  210. DWORD dwAspect,
  211. HDC hdcDraw,
  212. HDC hicTargetDev,
  213. DVTARGETDEVICE *ptd,
  214. DWORD dwMode,
  215. const SIZEL *psizelExtent,
  216. LONG *pwidth,
  217. LONG *pheight) = 0;
  218. //@cmember Drag & drop
  219. virtual HRESULT TxGetDropTarget( IDropTarget **ppDropTarget ) = 0;
  220. //@cmember Bulk bit property change notifications
  221. virtual HRESULT OnTxPropertyBitsChange(DWORD dwMask, DWORD dwBits) = 0;
  222. //@cmember Fetch the cached drawing size (logical not physical)
  223. virtual HRESULT TxGetCachedSize(DWORD *pdwWidth, DWORD *pdwHeight)=0;
  224. };
  225. /*
  226. * ITextHost
  227. *
  228. * @class Interface to be used by text services to obtain text host services
  229. *
  230. * @base public | IUnknown
  231. */
  232. class ITextHost : public IUnknown
  233. {
  234. public:
  235. //@cmember Get the DC for the host
  236. virtual HDC TxGetDC() = 0;
  237. //@cmember Release the DC gotten from the host
  238. virtual INT TxReleaseDC(HDC hdc) = 0;
  239. //@cmember Show the scroll bar
  240. virtual BOOL TxShowScrollBar(INT fnBar, BOOL fShow) = 0;
  241. //@cmember Enable the scroll bar
  242. virtual BOOL TxEnableScrollBar (INT fuSBFlags, INT fuArrowflags) = 0;
  243. //@cmember Set the scroll range
  244. virtual BOOL TxSetScrollRange(
  245. INT fnBar,
  246. LONG nMinPos,
  247. INT nMaxPos,
  248. BOOL fRedraw) = 0;
  249. //@cmember Set the scroll position
  250. virtual BOOL TxSetScrollPos (INT fnBar, INT nPos, BOOL fRedraw) = 0;
  251. //@cmember InvalidateRect
  252. virtual void TxInvalidateRect(LPCRECT prc, BOOL fMode) = 0;
  253. //@cmember Send a WM_PAINT to the window
  254. virtual void TxViewChange(BOOL fUpdate) = 0;
  255. //@cmember Create the caret
  256. virtual BOOL TxCreateCaret(HBITMAP hbmp, INT xWidth, INT yHeight) = 0;
  257. //@cmember Show the caret
  258. virtual BOOL TxShowCaret(BOOL fShow) = 0;
  259. //@cmember Set the caret position
  260. virtual BOOL TxSetCaretPos(INT x, INT y) = 0;
  261. //@cmember Create a timer with the specified timeout
  262. virtual BOOL TxSetTimer(UINT idTimer, UINT uTimeout) = 0;
  263. //@cmember Destroy a timer
  264. virtual void TxKillTimer(UINT idTimer) = 0;
  265. //@cmember Scroll the content of the specified window's client area
  266. virtual void TxScrollWindowEx (
  267. INT dx,
  268. INT dy,
  269. LPCRECT lprcScroll,
  270. LPCRECT lprcClip,
  271. HRGN hrgnUpdate,
  272. LPRECT lprcUpdate,
  273. UINT fuScroll) = 0;
  274. //@cmember Get mouse capture
  275. virtual void TxSetCapture(BOOL fCapture) = 0;
  276. //@cmember Set the focus to the text window
  277. virtual void TxSetFocus() = 0;
  278. //@cmember Establish a new cursor shape
  279. virtual void TxSetCursor(HCURSOR hcur, BOOL fText) = 0;
  280. //@cmember Converts screen coordinates of a specified point to the client coordinates
  281. virtual BOOL TxScreenToClient (LPPOINT lppt) = 0;
  282. //@cmember Converts the client coordinates of a specified point to screen coordinates
  283. virtual BOOL TxClientToScreen (LPPOINT lppt) = 0;
  284. //@cmember Request host to activate text services
  285. virtual HRESULT TxActivate( LONG * plOldState ) = 0;
  286. //@cmember Request host to deactivate text services
  287. virtual HRESULT TxDeactivate( LONG lNewState ) = 0;
  288. //@cmember Retrieves the coordinates of a window's client area
  289. virtual HRESULT TxGetClientRect(LPRECT prc) = 0;
  290. //@cmember Get the view rectangle relative to the inset
  291. virtual HRESULT TxGetViewInset(LPRECT prc) = 0;
  292. //@cmember Get the default character format for the text
  293. virtual HRESULT TxGetCharFormat(const CHARFORMATW **ppCF ) = 0;
  294. //@cmember Get the default paragraph format for the text
  295. virtual HRESULT TxGetParaFormat(const PARAFORMAT **ppPF) = 0;
  296. //@cmember Get the background color for the window
  297. virtual COLORREF TxGetSysColor(int nIndex) = 0;
  298. //@cmember Get the background (either opaque or transparent)
  299. virtual HRESULT TxGetBackStyle(TXTBACKSTYLE *pstyle) = 0;
  300. //@cmember Get the maximum length for the text
  301. virtual HRESULT TxGetMaxLength(DWORD *plength) = 0;
  302. //@cmember Get the bits representing requested scroll bars for the window
  303. virtual HRESULT TxGetScrollBars(DWORD *pdwScrollBar) = 0;
  304. //@cmember Get the character to display for password input
  305. virtual HRESULT TxGetPasswordChar(TCHAR *pch) = 0;
  306. //@cmember Get the accelerator character
  307. virtual HRESULT TxGetAcceleratorPos(LONG *pcp) = 0;
  308. //@cmember Get the native size
  309. virtual HRESULT TxGetExtent(LPSIZEL lpExtent) = 0;
  310. //@cmember Notify host that default character format has changed
  311. virtual HRESULT OnTxCharFormatChange (const CHARFORMATW * pcf) = 0;
  312. //@cmember Notify host that default paragraph format has changed
  313. virtual HRESULT OnTxParaFormatChange (const PARAFORMAT * ppf) = 0;
  314. //@cmember Bulk access to bit properties
  315. virtual HRESULT TxGetPropertyBits(DWORD dwMask, DWORD *pdwBits) = 0;
  316. //@cmember Notify host of events
  317. virtual HRESULT TxNotify(DWORD iNotify, void *pv) = 0;
  318. // East Asia Methods for getting the Input Context
  319. virtual HIMC TxImmGetContext() = 0;
  320. virtual void TxImmReleaseContext( HIMC himc ) = 0;
  321. //@cmember Returns HIMETRIC size of the control bar.
  322. virtual HRESULT TxGetSelectionBarWidth (LONG *lSelBarWidth) = 0;
  323. };
  324. //+-----------------------------------------------------------------------
  325. // Factories
  326. //------------------------------------------------------------------------
  327. // Text Services factory
  328. STDAPI CreateTextServices(
  329. IUnknown *punkOuter,
  330. ITextHost *pITextHost,
  331. IUnknown **ppUnk);
  332. typedef HRESULT (STDAPICALLTYPE * PCreateTextServices)(
  333. IUnknown *punkOuter,
  334. ITextHost *pITextHost,
  335. IUnknown **ppUnk);
  336. #endif // _TEXTSERV_H