S
sauchan
Unregistered / Unconfirmed
GUEST, unregistred user!
/* @doc EXTERNAL<br> *<br> * Copyright (c) Microsoft Corporation. All rights reserved.<br> *<br> * @module TEXTSRV.H Text Service Interface |<br> * <br> * Define interfaces between the Text Services component and the host<br> *<br> * Original Author: &lt;nl&gt;<br> * Christian Fortini<br> *<br> * History: &lt;nl&gt;<br> * 8/1/95 ricksa Revised interface definition<br> */<br><br>#ifndef _TEXTSERV_H<br>#define _TEXTSERV_H<br><br>#if _MSC_VER &gt; 1000<br>#pragma once<br>#endif<br><br>EXTERN_C const IID IID_ITextServices;<br>EXTERN_C const IID IID_ITextHost;<br><br>// Note: error code is first outside of range reserved for OLE.<br>#define S_MSG_KEY_IGNORED /<br> MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_ITF, 0x201)<br><br>// Enums used by property methods<br><br>/*<br> * TXTBACKSTYLE<br> *<br> * @enum Defines different background styles control<br> */<br>enum TXTBACKSTYLE {<br> TXTBACK_TRANSPARENT = 0, //@emem background should show through<br> TXTBACK_OPAQUE, //@emem erase background<br>};<br><br><br>/*<br> * TXTHITRESULT<br> *<br> * @enum Defines different hitresults<br> */<br>enum TXTHITRESULT {<br> TXTHITRESULT_NOHIT = 0, //@emem no hit<br> TXTHITRESULT_TRANSPARENT = 1, //@emem point is within the text's rectangle, but<br> //in a transparent region<br> TXTHITRESULT_CLOSE = 2, //@emem point is close to the text<br> TXTHITRESULT_HIT = 3 //@emem dead-on hit<br>};<br><br>/*<br> * TXTNATURALSIZE<br> *<br> * @enum useful values for TxGetNaturalSize.<br> *<br> * @xref &lt;mf CTxtEdit::TxGetNaturalSize&gt;<br> */<br>enum TXTNATURALSIZE {<br> TXTNS_FITTOCONTENT = 1, //@emem Get a size that fits the content<br> TXTNS_ROUNDTOLINE = 2 //@emem Round to the nearest whole line.<br>};<br><br>/*<br> * TXTVIEW<br> *<br> * @enum useful values for TxDraw lViewId parameter<br> *<br> * @xref &lt;mf CTxtEdit::TxDraw&gt;<br> */<br>enum TXTVIEW {<br> TXTVIEW_ACTIVE = 0,<br> TXTVIEW_INACTIVE = -1<br>};<br><br><br>/*<br> * CHANGETYPE<br> *<br> * @enum used for CHANGENOTIFY.dwChangeType; indicates what happened<br> * for a particular change.<br> */<br>enum CHANGETYPE<br>{<br> CN_GENERIC = 0, //@emem Nothing special happened<br> CN_TEXTCHANGED = 1, //@emem the text changed<br> CN_NEWUNDO = 2, //@emem A new undo action was added<br> CN_NEWREDO = 4 //@emem A new redo action was added<br>};<br><br>/*<br> * @struct CHANGENOTIFY |<br> *<br> * passed during an EN_CHANGE notification; contains information about<br> * what actually happened for a change.<br> */<br>struct CHANGENOTIFY {<br> DWORD dwChangeType; //@field TEXT changed, etc<br> void * pvCookieData; //@field cookie for the undo action<br> // associated with the change.<br>};<br><br>// The TxGetPropertyBits and OnTxPropertyBitsChange methods can pass the following bits:<br><br>// NB!!! Do NOT rely on the ordering of these bits yet; the are subject<br>// to change.<br>#define TXTBIT_RICHTEXT 1 // rich-text control<br>#define TXTBIT_MULTILINE 2 // single vs multi-line control<br>#define TXTBIT_READONLY 4 // read only text<br>#define TXTBIT_SHOWACCELERATOR 8 // underline accelerator character<br>#define TXTBIT_USEPASSWORD 0x10 // use password char to display text<br>#define TXTBIT_HIDESELECTION 0x20 // show selection when inactive<br>#define TXTBIT_SAVESELECTION 0x40 // remember selection when inactive<br>#define TXTBIT_AUTOWORDSEL 0x80 // auto-word selection<br>#define TXTBIT_VERTICAL 0x100 // vertical<br>#define TXTBIT_SELBARCHANGE 0x200 // notification that the selection bar width<br> // has changed.<br> // FUTURE: move this bit to the end to<br> // maintain the division between<br> // properties and notifications.<br>#define TXTBIT_WORDWRAP 0x400 // if set, then multi-line controls<br> // should wrap words to fit the available<br> // display<br>#define TXTBIT_ALLOWBEEP 0x800 // enable/disable beeping<br>#define TXTBIT_DISABLEDRAG 0x1000 // disable/enable dragging<br>#define TXTBIT_VIEWINSETCHANGE 0x2000 // the inset changed<br>#define TXTBIT_BACKSTYLECHANGE 0x4000<br>#define TXTBIT_MAXLENGTHCHANGE 0x8000<br>#define TXTBIT_SCROLLBARCHANGE 0x10000<br>#define TXTBIT_CHARFORMATCHANGE 0x20000<br>#define TXTBIT_PARAFORMATCHANGE 0x40000<br>#define TXTBIT_EXTENTCHANGE 0x80000<br>#define TXTBIT_CLIENTRECTCHANGE 0x100000 // the client rectangle changed<br>#define TXTBIT_USECURRENTBKG 0x200000 // tells the renderer to use the current background<br> // color rather than the system default for an entire line<br><br><br>/*<br> * ITextServices<br> * <br> * @class An interface extending Microsoft's Text Object Model to provide<br> * extra functionality for windowless operation. In conjunction<br> * with ITextHost, ITextServices provides the means by which the<br> * the RichEdit control can be used *without* creating a window.<br> *<br> * @base public | IUnknown<br> */<br>class ITextServices : public IUnknown<br>{<br>public:<br><br> //@cmember Generic Send Message interface<br> virtual HRESULT TxSendMessage(<br> UINT msg,<br> WPARAM wparam,<br> LPARAM lparam,<br> LRESULT *plresult) = 0;<br> <br> //@cmember Rendering<br> virtual HRESULT TxDraw( <br> DWORD dwDrawAspect, <br> LONG lindex, <br> void * pvAspect, <br> DVTARGETDEVICE * ptd, <br> HDC hdcDraw, <br> HDC hicTargetDev, <br> LPCRECTL lprcBounds, <br> LPCRECTL lprcWBounds, <br> LPRECT lprcUpdate, <br> BOOL (CALLBACK * pfnContinue) (DWORD),<br> DWORD dwContinue,<br> LONG lViewId) = 0; <br><br> //@cmember Horizontal scrollbar support<br> virtual HRESULT TxGetHScroll(<br> LONG *plMin,<br> LONG *plMax,<br> LONG *plPos,<br> LONG *plPage,<br> BOOL * pfEnabled ) = 0;<br><br> //@cmember Horizontal scrollbar support<br> virtual HRESULT TxGetVScroll(<br> LONG *plMin,<br> LONG *plMax,<br> LONG *plPos,<br> LONG *plPage,<br> BOOL * pfEnabled ) = 0;<br><br> //@cmember Setcursor<br> virtual HRESULT OnTxSetCursor(<br> DWORD dwDrawAspect, <br> LONG lindex, <br> void * pvAspect, <br> DVTARGETDEVICE * ptd, <br> HDC hdcDraw, <br> HDC hicTargetDev, <br> LPCRECT lprcClient,<br> INT x,<br> INT y) = 0;<br><br> //@cmember Hit-test<br> virtual HRESULT TxQueryHitPoint(<br> DWORD dwDrawAspect, <br> LONG lindex, <br> void * pvAspect, <br> DVTARGETDEVICE * ptd, <br> HDC hdcDraw, <br> HDC hicTargetDev, <br> LPCRECT lprcClient,<br> INT x,<br> INT y,<br> DWORD * pHitResult) = 0;<br><br> //@cmember Inplace activate notification<br> virtual HRESULT OnTxInPlaceActivate(LPCRECT prcClient) = 0;<br><br> //@cmember Inplace deactivate notification<br> virtual HRESULT OnTxInPlaceDeactivate() = 0;<br><br> //@cmember UI activate notification<br> virtual HRESULT OnTxUIActivate() = 0;<br><br> //@cmember UI deactivate notification<br> virtual HRESULT OnTxUIDeactivate() = 0;<br><br> //@cmember Get text in control<br> virtual HRESULT TxGetText(BSTR *pbstrText) = 0;<br><br> //@cmember Set text in control<br> virtual HRESULT TxSetText(LPCWSTR pszText) = 0;<br> <br> //@cmember Get x position of<br> virtual HRESULT TxGetCurTargetX(LONG *) = 0;<br> //@cmember Get baseline position<br> virtual HRESULT TxGetBaseLinePos(LONG *) = 0;<br><br> //@cmember Get Size to fit / Natural size<br> virtual HRESULT TxGetNaturalSize(<br> DWORD dwAspect,<br> HDC hdcDraw,<br> HDC hicTargetDev,<br> DVTARGETDEVICE *ptd,<br> DWORD dwMode, <br> const SIZEL *psizelExtent,<br> LONG *pwidth,<br> LONG *pheight) = 0;<br><br> //@cmember Drag & drop<br> virtual HRESULT TxGetDropTarget( IDropTarget **ppDropTarget ) = 0;<br><br> //@cmember Bulk bit property change notifications<br> virtual HRESULT OnTxPropertyBitsChange(DWORD dwMask, DWORD dwBits) = 0;<br><br> //@cmember Fetch the cached drawing size<br> virtual HRESULT TxGetCachedSize(DWORD *pdwWidth, DWORD *pdwHeight)=0;<br>};<br><br><br>/*<br> * ITextHost<br> * <br> * @class Interface to be used by text services to obtain text host services<br> *<br> * @base public | IUnknown<br> */<br>class ITextHost : public IUnknown<br>{<br>public:<br><br> //@cmember Get the DC for the host<br> virtual HDC TxGetDC() = 0;<br><br> //@cmember Release the DC gotten from the host<br> virtual INT TxReleaseDC(HDC hdc) = 0;<br> <br> //@cmember Show the scroll bar<br> virtual BOOL TxShowScrollBar(INT fnBar, BOOL fShow) = 0;<br><br> //@cmember Enable the scroll bar<br> virtual BOOL TxEnableScrollBar (INT fuSBFlags, INT fuArrowflags) = 0;<br><br> //@cmember Set the scroll range<br> virtual BOOL TxSetScrollRange(<br> INT fnBar,<br> LONG nMinPos,<br> INT nMaxPos,<br> BOOL fRedraw) = 0;<br><br> //@cmember Set the scroll position<br> virtual BOOL TxSetScrollPos (INT fnBar, INT nPos, BOOL fRedraw) = 0;<br><br> //@cmember InvalidateRect<br> virtual void TxInvalidateRect(LPCRECT prc, BOOL fMode) = 0;<br><br> //@cmember Send a WM_PAINT to the window<br> virtual void TxViewChange(BOOL fUpdate) = 0;<br> <br> //@cmember Create the caret<br> virtual BOOL TxCreateCaret(HBITMAP hbmp, INT xWidth, INT yHeight) = 0;<br><br> //@cmember Show the caret<br> virtual BOOL TxShowCaret(BOOL fShow) = 0;<br><br> //@cmember Set the caret position<br> virtual BOOL TxSetCaretPos(INT x, INT y) = 0;<br><br> //@cmember Create a timer with the specified timeout<br> virtual BOOL TxSetTimer(UINT idTimer, UINT uTimeout) = 0;<br><br> //@cmember Destroy a timer<br> virtual void TxKillTimer(UINT idTimer) = 0;<br><br> //@cmember Scroll the content of the specified window's client area<br> virtual void TxScrollWindowEx (<br> INT dx,<br> INT dy,<br> LPCRECT lprcScroll,<br> LPCRECT lprcClip,<br> HRGN hrgnUpdate,<br> LPRECT lprcUpdate,<br> UINT fuScroll) = 0;<br> <br> //@cmember Get mouse capture<br> virtual void TxSetCapture(BOOL fCapture) = 0;<br><br> //@cmember Set the focus to the text window<br> virtual void TxSetFocus() = 0;<br><br> //@cmember Establish a new cursor shape<br> virtual void TxSetCursor(HCURSOR hcur, BOOL fText) = 0;<br><br> //@cmember Converts screen coordinates of a specified point to the client coordinates<br> virtual BOOL TxScreenToClient (LPPOINT lppt) = 0;<br><br> //@cmember Converts the client coordinates of a specified point to screen coordinates<br> virtual BOOL TxClientToScreen (LPPOINT lppt) = 0;<br><br> //@cmember Request host to activate text services<br> virtual HRESULT TxActivate( LONG * plOldState ) = 0;<br><br> //@cmember Request host to deactivate text services<br> virtual HRESULT TxDeactivate( LONG lNewState ) = 0;<br><br> //@cmember Retrieves the coordinates of a window's client area<br> virtual HRESULT TxGetClientRect(LPRECT prc) = 0;<br><br> //@cmember Get the view rectangle relative to the inset<br> virtual HRESULT TxGetViewInset(LPRECT prc) = 0;<br><br> //@cmember Get the default character format for the text<br> virtual HRESULT TxGetCharFormat(const CHARFORMATW **ppCF ) = 0;<br><br> //@cmember Get the default paragraph format for the text<br> virtual HRESULT TxGetParaFormat(const PARAFORMAT **ppPF) = 0;<br><br> //@cmember Get the background color for the window<br> virtual COLORREF TxGetSysColor(int nIndex) = 0;<br><br> //@cmember Get the background (either opaque or transparent)<br> virtual HRESULT TxGetBackStyle(TXTBACKSTYLE *pstyle) = 0;<br><br> //@cmember Get the maximum length for the text<br> virtual HRESULT TxGetMaxLength(DWORD *plength) = 0;<br><br> //@cmember Get the bits representing requested scroll bars for the window<br> virtual HRESULT TxGetScrollBars(DWORD *pdwScrollBar) = 0;<br><br> //@cmember Get the character to display for password input<br> virtual HRESULT TxGetPasswordChar(TCHAR *pch) = 0;<br><br> //@cmember Get the accelerator character<br> virtual HRESULT TxGetAcceleratorPos(LONG *pcp) = 0;<br><br> //@cmember Get the native size<br> virtual HRESULT TxGetExtent(LPSIZEL lpExtent) = 0;<br><br> //@cmember Notify host that default character format has changed<br> virtual HRESULT OnTxCharFormatChange (const CHARFORMATW * pcf) = 0;<br><br> //@cmember Notify host that default paragraph format has changed<br> virtual HRESULT OnTxParaFormatChange (const PARAFORMAT * ppf) = 0;<br><br> //@cmember Bulk access to bit properties<br> virtual HRESULT TxGetPropertyBits(DWORD dwMask, DWORD *pdwBits) = 0;<br><br> //@cmember Notify host of events<br> virtual HRESULT TxNotify(DWORD iNotify, void *pv) = 0;<br><br> // Far East Methods for getting the Input Context<br>//#ifdef WIN95_IME<br> virtual HIMC TxImmGetContext() = 0;<br> virtual void TxImmReleaseContext( HIMC himc ) = 0;<br>//#endif<br><br> //@cmember Returns HIMETRIC size of the control bar.<br> virtual HRESULT TxGetSelectionBarWidth (LONG *lSelBarWidth) = 0;<br><br>};<br> <br>//+-----------------------------------------------------------------------<br>// Factories<br>//------------------------------------------------------------------------<br><br>// Text Services factory<br>STDAPI CreateTextServices(<br> IUnknown *punkOuter,<br> ITextHost *pITextHost,<br> IUnknown **ppUnk);<br><br>typedef HRESULT (STDAPICALLTYPE * PCreateTextServices)(<br> IUnknown *punkOuter,<br> ITextHost *pITextHost,<br> IUnknown **ppUnk);<br><br>#endif // _TEXTSERV_H<br>