diff --git a/dlls/msctf/context.c b/dlls/msctf/context.c index 593f0ad33a3..17396ef7957 100644 --- a/dlls/msctf/context.c +++ b/dlls/msctf/context.c @@ -72,6 +72,17 @@ typedef struct tagContext { } Context; + +typedef struct tagTextStoreACPSink { + const ITextStoreACPSinkVtbl *TextStoreACPSinkVtbl; + LONG refCount; + + Context *pContext; +} TextStoreACPSink; + + +static HRESULT TextStoreACPSink_Constructor(ITextStoreACPSink **ppOut, Context *pContext); + static inline Context *impl_from_ITfSourceVtbl(ITfSource *iface) { return (Context *)((char *)iface - FIELD_OFFSET(Context,SourceVtbl)); @@ -416,3 +427,149 @@ HRESULT Context_Constructor(TfClientId tidOwner, IUnknown *punk, ITfContext **pp return S_OK; } + +/************************************************************************** + * ITextStoreACPSink + **************************************************************************/ + +static void TextStoreACPSink_Destructor(TextStoreACPSink *This) +{ + TRACE("destroying %p\n", This); + HeapFree(GetProcessHeap(),0,This); +} + +static HRESULT WINAPI TextStoreACPSink_QueryInterface(ITextStoreACPSink *iface, REFIID iid, LPVOID *ppvOut) +{ + TextStoreACPSink *This = (TextStoreACPSink *)iface; + *ppvOut = NULL; + + if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITextStoreACPSink)) + { + *ppvOut = This; + } + + if (*ppvOut) + { + IUnknown_AddRef(iface); + return S_OK; + } + + WARN("unsupported interface: %s\n", debugstr_guid(iid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI TextStoreACPSink_AddRef(ITextStoreACPSink *iface) +{ + TextStoreACPSink *This = (TextStoreACPSink *)iface; + return InterlockedIncrement(&This->refCount); +} + +static ULONG WINAPI TextStoreACPSink_Release(ITextStoreACPSink *iface) +{ + TextStoreACPSink *This = (TextStoreACPSink *)iface; + ULONG ret; + + ret = InterlockedDecrement(&This->refCount); + if (ret == 0) + TextStoreACPSink_Destructor(This); + return ret; +} + +/***************************************************** + * ITextStoreACPSink functions + *****************************************************/ + +static HRESULT WINAPI TextStoreACPSink_OnTextChange(ITextStoreACPSink *iface, + DWORD dwFlags, const TS_TEXTCHANGE *pChange) +{ + TextStoreACPSink *This = (TextStoreACPSink *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI TextStoreACPSink_OnSelectionChange(ITextStoreACPSink *iface) +{ + TextStoreACPSink *This = (TextStoreACPSink *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI TextStoreACPSink_OnLayoutChange(ITextStoreACPSink *iface, + TsLayoutCode lcode, TsViewCookie vcView) +{ + TextStoreACPSink *This = (TextStoreACPSink *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI TextStoreACPSink_OnStatusChange(ITextStoreACPSink *iface, + DWORD dwFlags) +{ + TextStoreACPSink *This = (TextStoreACPSink *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI TextStoreACPSink_OnAttrsChange(ITextStoreACPSink *iface, + LONG acpStart, LONG acpEnd, ULONG cAttrs, const TS_ATTRID *paAttrs) +{ + TextStoreACPSink *This = (TextStoreACPSink *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI TextStoreACPSink_OnLockGranted(ITextStoreACPSink *iface, + DWORD dwLockFlags) +{ + TextStoreACPSink *This = (TextStoreACPSink *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI TextStoreACPSink_OnStartEditTransaction(ITextStoreACPSink *iface) +{ + TextStoreACPSink *This = (TextStoreACPSink *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI TextStoreACPSink_OnEndEditTransaction(ITextStoreACPSink *iface) +{ + TextStoreACPSink *This = (TextStoreACPSink *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static const ITextStoreACPSinkVtbl TextStoreACPSink_TextStoreACPSinkVtbl = +{ + TextStoreACPSink_QueryInterface, + TextStoreACPSink_AddRef, + TextStoreACPSink_Release, + + TextStoreACPSink_OnTextChange, + TextStoreACPSink_OnSelectionChange, + TextStoreACPSink_OnLayoutChange, + TextStoreACPSink_OnStatusChange, + TextStoreACPSink_OnAttrsChange, + TextStoreACPSink_OnLockGranted, + TextStoreACPSink_OnStartEditTransaction, + TextStoreACPSink_OnEndEditTransaction +}; + +static HRESULT TextStoreACPSink_Constructor(ITextStoreACPSink **ppOut, Context *pContext) +{ + TextStoreACPSink *This; + + This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(TextStoreACPSink)); + if (This == NULL) + return E_OUTOFMEMORY; + + This->TextStoreACPSinkVtbl= &TextStoreACPSink_TextStoreACPSinkVtbl; + This->refCount = 1; + + This->pContext = pContext; + + TRACE("returning %p\n", This); + *ppOut = (ITextStoreACPSink*)This; + return S_OK; +} diff --git a/include/textstor.idl b/include/textstor.idl index f9624f6a0f5..86a01e0a1e5 100644 --- a/include/textstor.idl +++ b/include/textstor.idl @@ -35,3 +35,49 @@ typedef [uuid(fec4f516-c503-45b1-a5fd-7a3d8ab07049)] struct TS_STATUS DWORD dwDynamicFlags; DWORD dwStaticFlags; } TS_STATUS; + +typedef [uuid(f3181bd6-bcf0-41d3-a81c-474b17ec38fb)] struct TS_TEXTCHANGE +{ + LONG acpStart; + LONG acpOldEnd; + LONG acpNewEnd; +} TS_TEXTCHANGE; + +typedef [uuid(ef3457d9-8446-49a7-a9e6-b50d9d5f3fd9)] GUID TS_ATTRID; +typedef [uuid(7899d7c4-5f07-493c-a89a-fac8e777f476)] enum { TS_LC_CREATE, TS_LC_CHANGE, TS_LC_DESTROY } TsLayoutCode; +typedef [uuid(1faf509e-44c1-458e-950a-38a96705a62b)] DWORD TsViewCookie; + + +[ + object, + uuid(22d44c94-a419-4542-a272-ae26093ececf), + pointer_default(unique) +] +interface ITextStoreACPSink : IUnknown +{ + HRESULT OnTextChange( + [in] DWORD dwFlags, + [in] const TS_TEXTCHANGE *pChange); + + HRESULT OnSelectionChange(); + + HRESULT OnLayoutChange( + [in] TsLayoutCode lcode, + [in] TsViewCookie vcView); + + HRESULT OnStatusChange( + [in] DWORD dwFlags); + + HRESULT OnAttrsChange( + [in] LONG acpStart, + [in] LONG acpEnd, + [in] ULONG cAttrs, + [in, size_is(cAttrs)] const TS_ATTRID *paAttrs); + + HRESULT OnLockGranted( + [in] DWORD dwLockFlags); + + HRESULT OnStartEditTransaction(); + + HRESULT OnEndEditTransaction(); +};