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.

420 lines
12 KiB

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