Text Services Framework
ITextStoreACP
The
ITextStoreACP interface is implemented by the application and is used by the TSF manager to manipulate text streams or text stores in TSF. An application can obtain an instance of this interface with a call to the
ITfDocumentMgr::CreateContext method. The interface ID is IID_ITextStoreACP.
This interface exposes text stores through an application character position (ACP) format. Applications that use an anchor-based format should use ITextStoreAnchor.
Methods in Vtable Order
The ITextStoreACP interface inherits the methods of the standard COM interface IUnknown.
In addition, ITextStoreACP defines the following methods.
Example Code
[C++]
The following code example demonstrates how to create a
CTSFEditWnd class that implements the
ITextStoreACP methods:
class CTSFEditWnd : public ITextStoreACP
{
public:
CTSFEditWnd(HINSTANCE hInstance, HWND hwndParent);
~CTSFEditWnd();
//IUnknown methods.
STDMETHOD (QueryInterface)(REFIID, LPVOID*);
STDMETHOD_ (DWORD, AddRef)();
STDMETHOD_ (DWORD, Release)();
//ITextStoreACP methods.
STDMETHODIMP AdviseSink(REFIID riid, IUnknown *punk, DWORD dwMask);
STDMETHODIMP UnadviseSink(IUnknown *punk);
STDMETHODIMP RequestLock(DWORD dwLockFlags, HRESULT *phrSession);
STDMETHODIMP GetStatus(TS_STATUS *pdcs);
STDMETHODIMP QueryInsert(LONG acpTestStart, LONG acpTestEnd, ULONG cch, LONG *pacpResultStart, LONG *pacpResultEnd);
STDMETHODIMP GetSelection(ULONG ulIndex, ULONG ulCount, TS_SELECTION_ACP *pSelection, ULONG *pcFetched);
STDMETHODIMP SetSelection(ULONG ulCount, const TS_SELECTION_ACP *pSelection);
STDMETHODIMP GetText(LONG acpStart, LONG acpEnd, WCHAR *pchPlain, ULONG cchPlainReq, ULONG *pcchPlainOut, TS_RUNINFO *prgRunInfo, ULONG ulRunInfoReq, ULONG *pulRunInfoOut, LONG *pacpNext);
STDMETHODIMP SetText(DWORD dwFlags, LONG acpStart, LONG acpEnd, const WCHAR *pchText, ULONG cch, TS_TEXTCHANGE *pChange);
STDMETHODIMP GetFormattedText(LONG acpStart, LONG acpEnd, IDataObject **ppDataObject);
STDMETHODIMP GetEmbedded(LONG acpPos, REFGUID rguidService, REFIID riid, IUnknown **ppunk);
STDMETHODIMP QueryInsertEmbedded(const GUID *pguidService, const FORMATETC *pFormatEtc, BOOL *pfInsertable);
STDMETHODIMP InsertEmbedded(DWORD dwFlags, LONG acpStart, LONG acpEnd, IDataObject *pDataObject, TS_TEXTCHANGE *pChange);
STDMETHODIMP RequestSupportedAttrs(DWORD dwFlags, ULONG cFilterAttrs, const TS_ATTRID *paFilterAttrs);
STDMETHODIMP RequestAttrsAtPosition(LONG acpPos, ULONG cFilterAttrs, const TS_ATTRID *paFilterAttrs, DWORD dwFlags);
STDMETHODIMP RequestAttrsTransitioningAtPosition(LONG acpPos, ULONG cFilterAttrs, const TS_ATTRID *paFilterAttrs, DWORD dwFlags);
STDMETHODIMP FindNextAttrTransition(LONG acpStart, LONG acpHalt, ULONG cFilterAttrs, const TS_ATTRID *paFilterAttrs, DWORD dwFlags, LONG *pacpNext, BOOL *pfFound, LONG *plFoundOffset);
STDMETHODIMP RetrieveRequestedAttrs(ULONG ulCount, TS_ATTRVAL *paAttrVals, ULONG *pcFetched);
STDMETHODIMP GetEndACP(LONG *pacp);
STDMETHODIMP GetActiveView(TsViewCookie *pvcView);
STDMETHODIMP GetACPFromPoint(TsViewCookie vcView, const POINT *pt, DWORD dwFlags, LONG *pacp);
STDMETHODIMP GetTextExt(TsViewCookie vcView, LONG acpStart, LONG acpEnd, RECT *prc, BOOL *pfClipped);
STDMETHODIMP GetScreenExt(TsViewCookie vcView, RECT *prc);
STDMETHODIMP GetWnd(TsViewCookie vcView, HWND *phwnd);
STDMETHODIMP InsertTextAtSelection(DWORD dwFlags, const WCHAR *pchText, ULONG cch, LONG *pacpStart, LONG *pacpEnd, TS_TEXTCHANGE *pChange);
STDMETHODIMP InsertEmbeddedAtSelection(DWORD dwFlags, IDataObject *pDataObject, LONG *pacpStart, LONG *pacpEnd, TS_TEXTCHANGE *pChange);
};
This interface can be obtained using the following procedure.
HRESULT hr;
ITextStoreACP *ptsiACP;
hr = punk->QueryInterface(IID_ITextStoreACP, (void **)&ptsiACP);
Windows NT/2000/XP: Included in Windows XP.
Redistributable: Requires TSF 1.0 on Windows NT 4.0; Windows 2000; and Windows 98/Me.
Header: Declared in Textstor.idl and Textstor.h.
Library: Included as a resource in Msctf.dll.
See Also
Text Stores