diff --git a/dlls/msctf/context.c b/dlls/msctf/context.c index 35838c92382..9a0c8feeca6 100644 --- a/dlls/msctf/context.c +++ b/dlls/msctf/context.c @@ -61,7 +61,7 @@ typedef struct tagContext { /* const ITfContextCompositionVtbl *ContextCompositionVtbl; */ /* const ITfContextOwnerCompositionServicesVtbl *ContextOwnerCompositionServicesVtbl; */ /* const ITfContextOwnerServicesVtbl *ContextOwnerServicesVtbl; */ - /* const ITfInsertAtSelectionVtbl *InsertAtSelectionVtbl; */ + const ITfInsertAtSelectionVtbl *InsertAtSelectionVtbl; /* const ITfMouseTrackerVtbl *MouseTrackerVtbl; */ /* const ITfQueryEmbeddedVtbl *QueryEmbeddedVtbl; */ /* const ITfSourceSingleVtbl *SourceSingleVtbl; */ @@ -108,6 +108,11 @@ static inline Context *impl_from_ITfSourceVtbl(ITfSource *iface) return (Context *)((char *)iface - FIELD_OFFSET(Context,SourceVtbl)); } +static inline Context *impl_from_ITfInsertAtSelectionVtbl(ITfInsertAtSelection*iface) +{ + return (Context *)((char *)iface - FIELD_OFFSET(Context,InsertAtSelectionVtbl)); +} + static void free_sink(ContextSink *sink) { IUnknown_Release(sink->interfaces.pIUnknown); @@ -186,6 +191,10 @@ static HRESULT WINAPI Context_QueryInterface(ITfContext *iface, REFIID iid, LPVO { *ppvOut = &This->SourceVtbl; } + else if (IsEqualIID(iid, &IID_ITfInsertAtSelection)) + { + *ppvOut = &This->InsertAtSelectionVtbl; + } if (*ppvOut) { @@ -578,6 +587,55 @@ static const ITfSourceVtbl Context_SourceVtbl = ContextSource_UnadviseSink, }; +/***************************************************** + * ITfInsertAtSelection functions + *****************************************************/ +static HRESULT WINAPI InsertAtSelection_QueryInterface(ITfInsertAtSelection *iface, REFIID iid, LPVOID *ppvOut) +{ + Context *This = impl_from_ITfInsertAtSelectionVtbl(iface); + return Context_QueryInterface((ITfContext *)This, iid, *ppvOut); +} + +static ULONG WINAPI InsertAtSelection_AddRef(ITfInsertAtSelection *iface) +{ + Context *This = impl_from_ITfInsertAtSelectionVtbl(iface); + return Context_AddRef((ITfContext *)This); +} + +static ULONG WINAPI InsertAtSelection_Release(ITfInsertAtSelection *iface) +{ + Context *This = impl_from_ITfInsertAtSelectionVtbl(iface); + return Context_Release((ITfContext *)This); +} + +static WINAPI HRESULT InsertAtSelection_InsertTextAtSelection( + ITfInsertAtSelection *iface, TfEditCookie ec, DWORD dwFlags, + const WCHAR *pchText, LONG cch, ITfRange **ppRange) +{ + Context *This = impl_from_ITfInsertAtSelectionVtbl(iface); + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static WINAPI HRESULT InsertAtSelection_InsertEmbeddedAtSelection( + ITfInsertAtSelection *iface, TfEditCookie ec, DWORD dwFlags, + IDataObject *pDataObject, ITfRange **ppRange) +{ + Context *This = impl_from_ITfInsertAtSelectionVtbl(iface); + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static const ITfInsertAtSelectionVtbl Context_InsertAtSelectionVtbl = +{ + InsertAtSelection_QueryInterface, + InsertAtSelection_AddRef, + InsertAtSelection_Release, + + InsertAtSelection_InsertTextAtSelection, + InsertAtSelection_InsertEmbeddedAtSelection, +}; + HRESULT Context_Constructor(TfClientId tidOwner, IUnknown *punk, ITfContext **ppOut, TfEditCookie *pecTextStore) { Context *This; @@ -598,6 +656,7 @@ HRESULT Context_Constructor(TfClientId tidOwner, IUnknown *punk, ITfContext **pp This->ContextVtbl= &Context_ContextVtbl; This->SourceVtbl = &Context_SourceVtbl; + This->InsertAtSelectionVtbl = &Context_InsertAtSelectionVtbl; This->refCount = 1; This->tidOwner = tidOwner; This->connected = FALSE; diff --git a/include/msctf.idl b/include/msctf.idl index 93f70c177b9..fc87c0a4e24 100644 --- a/include/msctf.idl +++ b/include/msctf.idl @@ -868,3 +868,28 @@ interface ITfRange : IUnknown HRESULT GetContext( [out] ITfContext **ppContext); }; + +[ + object, + uuid(55ce16ba-3014-41c1-9ceb-fade1446ac6c), + pointer_default(unique) +] +interface ITfInsertAtSelection : IUnknown +{ + const DWORD TF_IAS_NOQUERY = 0x1; + const DWORD TF_IAS_QUERYONLY = 0x2; + const DWORD TF_IAS_NO_DEFAULT_COMPOSITION = 0x80000000; + + HRESULT InsertTextAtSelection( + [in] TfEditCookie ec, + [in] DWORD dwFlags, + [in, size_is(cch)] const WCHAR *pchText, + [in] LONG cch, + [out] ITfRange **ppRange); + + HRESULT InsertEmbeddedAtSelection( + [in] TfEditCookie ec, + [in] DWORD dwFlags, + [in] IDataObject *pDataObject, + [out] ITfRange **ppRange); +};