msctf: Framework for ITfInsertAtSelection in ITfContext.

This commit is contained in:
Aric Stewart 2009-05-26 13:30:13 -05:00 committed by Alexandre Julliard
parent acbefe5b9e
commit 374d41d5b0
2 changed files with 85 additions and 1 deletions

View File

@ -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;

View File

@ -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);
};