From dee4e5d5d9466b8d70bdcd55a8b3823773bba641 Mon Sep 17 00:00:00 2001 From: Aric Stewart Date: Tue, 16 Jun 2009 18:37:54 +0900 Subject: [PATCH] msctf: Implement ITfContext::GetDocumentMgr. --- dlls/msctf/context.c | 16 +++++++++++++--- dlls/msctf/documentmgr.c | 2 +- dlls/msctf/msctf_internal.h | 2 +- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/dlls/msctf/context.c b/dlls/msctf/context.c index 2c7acb068bc..5eaffcff399 100644 --- a/dlls/msctf/context.c +++ b/dlls/msctf/context.c @@ -74,6 +74,7 @@ typedef struct tagContext { TfClientId tidOwner; TfEditCookie defaultCookie; TS_STATUS documentStatus; + ITfDocumentMgr *manager; ITextStoreACP *pITextStoreACP; ITfContextOwnerCompositionSink *pITfContextOwnerCompositionSink; @@ -506,8 +507,15 @@ static HRESULT WINAPI Context_GetDocumentMgr (ITfContext *iface, ITfDocumentMgr **ppDm) { Context *This = (Context *)iface; - FIXME("STUB:(%p)\n",This); - return E_NOTIMPL; + TRACE("(%p) %p\n",This,ppDm); + + if (!ppDm) + return E_INVALIDARG; + + *ppDm = This->manager; + if (!This->manager) + return S_FALSE; + return S_OK; } static HRESULT WINAPI Context_CreateRangeBackup (ITfContext *iface, @@ -758,7 +766,7 @@ HRESULT Context_Constructor(TfClientId tidOwner, IUnknown *punk, ITfContext **pp return S_OK; } -HRESULT Context_Initialize(ITfContext *iface) +HRESULT Context_Initialize(ITfContext *iface, ITfDocumentMgr *manager) { Context *This = (Context *)iface; @@ -769,6 +777,7 @@ HRESULT Context_Initialize(ITfContext *iface) (IUnknown*)This->pITextStoreACPSink, TS_AS_ALL_SINKS); } This->connected = TRUE; + This->manager = manager; return S_OK; } @@ -783,6 +792,7 @@ HRESULT Context_Uninitialize(ITfContext *iface) This->pITextStoreACPSink = NULL; } This->connected = FALSE; + This->manager = NULL; return S_OK; } diff --git a/dlls/msctf/documentmgr.c b/dlls/msctf/documentmgr.c index 3d4dbe9066b..09cadb6ace9 100644 --- a/dlls/msctf/documentmgr.c +++ b/dlls/msctf/documentmgr.c @@ -146,7 +146,7 @@ static HRESULT WINAPI DocumentMgr_Push(ITfDocumentMgr *iface, ITfContext *pic) This->contextStack[0] = check; ITfThreadMgrEventSink_OnPushContext(This->ThreadMgrSink,check); - Context_Initialize(check); + Context_Initialize(check, iface); return S_OK; } diff --git a/dlls/msctf/msctf_internal.h b/dlls/msctf/msctf_internal.h index 8e093eb3b4c..3b959be5c4d 100644 --- a/dlls/msctf/msctf_internal.h +++ b/dlls/msctf/msctf_internal.h @@ -40,7 +40,7 @@ extern HRESULT Range_Constructor(ITfContext *context, ITextStoreACP *textstore, extern HRESULT CompartmentMgr_Constructor(IUnknown *pUnkOuter, REFIID riid, IUnknown **ppOut); extern HRESULT CompartmentMgr_Destructor(ITfCompartmentMgr *This); -extern HRESULT Context_Initialize(ITfContext *cxt); +extern HRESULT Context_Initialize(ITfContext *cxt, ITfDocumentMgr *manager); extern HRESULT Context_Uninitialize(ITfContext *cxt); extern HRESULT TF_SELECTION_to_TS_SELECTION_ACP(const TF_SELECTION *tf, TS_SELECTION_ACP *tsAcp);