msctf: When a Context is created connect to the ITextStoreACP if provided and create and advise our ITextStoreACPSink.

oldstable
Aric Stewart 2009-02-05 14:17:41 -06:00 committed by Alexandre Julliard
parent 5e7493d51c
commit 67d00e3ee6
2 changed files with 35 additions and 2 deletions

View File

@ -61,7 +61,11 @@ typedef struct tagContext {
LONG refCount;
TfClientId tidOwner;
IUnknown *punk; /* possible ITextStoreACP or ITfContextOwnerCompositionSink */
ITextStoreACP *pITextStoreACP;
/* ITfContextOwnerCompositionSink */
ITextStoreACPSink *pITextStoreACPSink;
/* kept as seperate lists to reduce unnesseccary iterations */
struct list pContextKeyEventSink;
@ -99,6 +103,15 @@ static void Context_Destructor(Context *This)
struct list *cursor, *cursor2;
TRACE("destroying %p\n", This);
if (This->pITextStoreACPSink)
{
ITextStoreACP_UnadviseSink(This->pITextStoreACP, (IUnknown*)This->pITextStoreACPSink);
ITextStoreACPSink_Release(This->pITextStoreACPSink);
}
if (This->pITextStoreACP)
ITextStoreACPSink_Release(This->pITextStoreACP);
LIST_FOR_EACH_SAFE(cursor, cursor2, &This->pContextKeyEventSink)
{
ContextSink* sink = LIST_ENTRY(cursor,ContextSink,entry);
@ -408,11 +421,22 @@ HRESULT Context_Constructor(TfClientId tidOwner, IUnknown *punk, ITfContext **pp
if (This == NULL)
return E_OUTOFMEMORY;
TRACE("(%p) %x %p %p %p\n",This, tidOwner, punk, ppOut, pecTextStore);
This->ContextVtbl= &Context_ContextVtbl;
This->SourceVtbl = &Context_SourceVtbl;
This->refCount = 1;
This->tidOwner = tidOwner;
This->punk = punk;
if (punk && SUCCEEDED(IUnknown_QueryInterface(punk, &IID_ITextStoreACP,
(LPVOID*)&This->pITextStoreACP)))
{
if (SUCCEEDED(TextStoreACPSink_Constructor(&This->pITextStoreACPSink, This)))
ITextStoreACP_AdviseSink(This->pITextStoreACP, &IID_ITextStoreACPSink,
(IUnknown*)This->pITextStoreACPSink, TS_AS_ALL_SINKS);
}
else if (punk)
FIXME("Unhandled pUnk\n");
TRACE("returning %p\n", This);
*ppOut = (ITfContext*)This;

View File

@ -30,6 +30,15 @@ const DWORD TS_SS_REGIONS = 0x002;
const DWORD TS_SS_TRANSITORY = 0x004;
const DWORD TS_SS_NOHIDDENTEXT = 0x008;
const DWORD TS_AS_TEXT_CHANGE = 0x01;
const DWORD TS_AS_SEL_CHANGE = 0x02;
const DWORD TS_AS_LAYOUT_CHANGE = 0x04;
const DWORD TS_AS_ATTR_CHANGE = 0x08;
const DWORD TS_AS_STATUS_CHANGE = 0x10;
const DWORD TS_AS_ALL_SINKS = (TS_AS_TEXT_CHANGE | TS_AS_SEL_CHANGE | TS_AS_LAYOUT_CHANGE | TS_AS_ATTR_CHANGE | TS_AS_STATUS_CHANGE);
typedef [uuid(05fcf85b-5e9c-4c3e-ab71-29471d4f38e7)] enum { TS_AE_NONE, TS_AE_START, TS_AE_END } TsActiveSelEnd;
typedef [uuid(033b0df0-f193-4170-b47b-141afc247878)] enum { TS_RT_PLAIN, TS_RT_HIDDEN, TS_RT_OPAQUE } TsRunType;
typedef [uuid(ef3457d9-8446-49a7-a9e6-b50d9d5f3fd9)] GUID TS_ATTRID;