2009-02-02 16:24:59 +00:00
|
|
|
/*
|
|
|
|
* ITfContext implementation
|
|
|
|
*
|
|
|
|
* Copyright 2009 Aric Stewart, CodeWeavers
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winreg.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
#include "shlwapi.h"
|
|
|
|
#include "winerror.h"
|
|
|
|
#include "objbase.h"
|
2009-02-04 20:48:36 +00:00
|
|
|
#include "olectl.h"
|
2009-02-02 16:24:59 +00:00
|
|
|
|
|
|
|
#include "msctf.h"
|
|
|
|
#include "msctf_internal.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(msctf);
|
|
|
|
|
|
|
|
typedef struct tagContext {
|
2013-11-17 08:21:51 +00:00
|
|
|
ITfContext ITfContext_iface;
|
|
|
|
ITfSource ITfSource_iface;
|
2009-05-13 19:45:44 +00:00
|
|
|
/* const ITfContextCompositionVtbl *ContextCompositionVtbl; */
|
2019-08-14 08:36:48 +00:00
|
|
|
ITfContextOwnerCompositionServices ITfContextOwnerCompositionServices_iface;
|
2009-05-13 19:45:44 +00:00
|
|
|
/* const ITfContextOwnerServicesVtbl *ContextOwnerServicesVtbl; */
|
2013-11-17 08:21:51 +00:00
|
|
|
ITfInsertAtSelection ITfInsertAtSelection_iface;
|
2009-05-13 19:45:44 +00:00
|
|
|
/* const ITfMouseTrackerVtbl *MouseTrackerVtbl; */
|
|
|
|
/* const ITfQueryEmbeddedVtbl *QueryEmbeddedVtbl; */
|
2013-11-17 08:21:51 +00:00
|
|
|
ITfSourceSingle ITfSourceSingle_iface;
|
2016-03-22 07:09:36 +00:00
|
|
|
ITextStoreACPSink ITextStoreACPSink_iface;
|
2016-03-22 07:09:37 +00:00
|
|
|
ITextStoreACPServices ITextStoreACPServices_iface;
|
2009-02-02 16:24:59 +00:00
|
|
|
LONG refCount;
|
2009-05-15 19:09:58 +00:00
|
|
|
BOOL connected;
|
2009-02-02 16:24:59 +00:00
|
|
|
|
2009-06-11 18:33:33 +00:00
|
|
|
/* Aggregation */
|
|
|
|
ITfCompartmentMgr *CompartmentMgr;
|
|
|
|
|
2009-02-02 16:24:59 +00:00
|
|
|
TfClientId tidOwner;
|
2009-05-20 19:46:44 +00:00
|
|
|
TfEditCookie defaultCookie;
|
2009-05-22 19:49:30 +00:00
|
|
|
TS_STATUS documentStatus;
|
2009-06-16 09:37:54 +00:00
|
|
|
ITfDocumentMgr *manager;
|
2009-02-05 20:17:41 +00:00
|
|
|
|
|
|
|
ITextStoreACP *pITextStoreACP;
|
2009-02-06 20:02:21 +00:00
|
|
|
ITfContextOwnerCompositionSink *pITfContextOwnerCompositionSink;
|
2009-02-05 20:17:41 +00:00
|
|
|
|
2009-05-18 13:58:43 +00:00
|
|
|
ITfEditSession* currentEditSession;
|
2009-02-04 20:48:36 +00:00
|
|
|
|
2009-02-11 12:35:25 +00:00
|
|
|
/* kept as separate lists to reduce unnecessary iterations */
|
2009-02-04 20:48:36 +00:00
|
|
|
struct list pContextKeyEventSink;
|
|
|
|
struct list pEditTransactionSink;
|
|
|
|
struct list pStatusSink;
|
|
|
|
struct list pTextEditSink;
|
|
|
|
struct list pTextLayoutSink;
|
|
|
|
|
2009-02-02 16:24:59 +00:00
|
|
|
} Context;
|
|
|
|
|
2009-05-20 19:46:44 +00:00
|
|
|
typedef struct tagEditCookie {
|
|
|
|
DWORD lockType;
|
|
|
|
Context *pOwningContext;
|
|
|
|
} EditCookie;
|
2009-02-05 20:17:26 +00:00
|
|
|
|
2013-11-17 08:21:51 +00:00
|
|
|
static inline Context *impl_from_ITfContext(ITfContext *iface)
|
2009-02-02 16:25:42 +00:00
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
return CONTAINING_RECORD(iface, Context, ITfContext_iface);
|
2009-02-02 16:25:42 +00:00
|
|
|
}
|
|
|
|
|
2013-11-17 08:21:51 +00:00
|
|
|
static inline Context *impl_from_ITfSource(ITfSource *iface)
|
2009-05-26 18:30:13 +00:00
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
return CONTAINING_RECORD(iface, Context, ITfSource_iface);
|
2009-05-26 18:30:13 +00:00
|
|
|
}
|
|
|
|
|
2019-08-14 08:36:48 +00:00
|
|
|
static inline Context *impl_from_ITfContextOwnerCompositionServices(ITfContextOwnerCompositionServices *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, Context, ITfContextOwnerCompositionServices_iface);
|
|
|
|
}
|
|
|
|
|
2013-11-17 08:21:51 +00:00
|
|
|
static inline Context *impl_from_ITfInsertAtSelection(ITfInsertAtSelection *iface)
|
2009-08-28 19:08:20 +00:00
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
return CONTAINING_RECORD(iface, Context, ITfInsertAtSelection_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline Context *impl_from_ITfSourceSingle(ITfSourceSingle* iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, Context, ITfSourceSingle_iface);
|
|
|
|
}
|
|
|
|
|
2016-03-22 07:09:36 +00:00
|
|
|
static inline Context *impl_from_ITextStoreACPSink(ITextStoreACPSink *iface)
|
2013-11-17 08:21:51 +00:00
|
|
|
{
|
2016-03-22 07:09:36 +00:00
|
|
|
return CONTAINING_RECORD(iface, Context, ITextStoreACPSink_iface);
|
2009-08-28 19:08:20 +00:00
|
|
|
}
|
|
|
|
|
2016-03-22 07:09:37 +00:00
|
|
|
static inline Context *impl_from_ITextStoreACPServices(ITextStoreACPServices *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, Context, ITextStoreACPServices_iface);
|
|
|
|
}
|
|
|
|
|
2009-02-02 16:24:59 +00:00
|
|
|
static void Context_Destructor(Context *This)
|
|
|
|
{
|
2009-05-20 19:46:44 +00:00
|
|
|
EditCookie *cookie;
|
2009-02-02 16:24:59 +00:00
|
|
|
TRACE("destroying %p\n", This);
|
2009-02-04 20:48:36 +00:00
|
|
|
|
2009-02-05 20:17:41 +00:00
|
|
|
if (This->pITextStoreACP)
|
2012-08-19 18:01:36 +00:00
|
|
|
ITextStoreACP_Release(This->pITextStoreACP);
|
2009-02-05 20:17:41 +00:00
|
|
|
|
2009-02-06 20:02:21 +00:00
|
|
|
if (This->pITfContextOwnerCompositionSink)
|
2012-08-19 18:01:36 +00:00
|
|
|
ITfContextOwnerCompositionSink_Release(This->pITfContextOwnerCompositionSink);
|
2009-02-06 20:02:21 +00:00
|
|
|
|
2009-05-20 19:46:44 +00:00
|
|
|
if (This->defaultCookie)
|
|
|
|
{
|
|
|
|
cookie = remove_Cookie(This->defaultCookie);
|
|
|
|
HeapFree(GetProcessHeap(),0,cookie);
|
|
|
|
This->defaultCookie = 0;
|
|
|
|
}
|
|
|
|
|
2016-05-04 17:41:52 +00:00
|
|
|
free_sinks(&This->pContextKeyEventSink);
|
|
|
|
free_sinks(&This->pEditTransactionSink);
|
|
|
|
free_sinks(&This->pStatusSink);
|
|
|
|
free_sinks(&This->pTextEditSink);
|
|
|
|
free_sinks(&This->pTextLayoutSink);
|
2009-02-04 20:48:36 +00:00
|
|
|
|
2009-06-11 18:33:33 +00:00
|
|
|
CompartmentMgr_Destructor(This->CompartmentMgr);
|
2009-02-02 16:24:59 +00:00
|
|
|
HeapFree(GetProcessHeap(),0,This);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Context_QueryInterface(ITfContext *iface, REFIID iid, LPVOID *ppvOut)
|
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
Context *This = impl_from_ITfContext(iface);
|
2009-02-02 16:24:59 +00:00
|
|
|
*ppvOut = NULL;
|
|
|
|
|
|
|
|
if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfContext))
|
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
*ppvOut = &This->ITfContext_iface;
|
2009-02-02 16:24:59 +00:00
|
|
|
}
|
2009-02-02 16:25:42 +00:00
|
|
|
else if (IsEqualIID(iid, &IID_ITfSource))
|
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
*ppvOut = &This->ITfSource_iface;
|
2009-02-02 16:25:42 +00:00
|
|
|
}
|
2019-08-14 08:36:48 +00:00
|
|
|
else if (IsEqualIID(iid, &IID_ITfContextOwnerCompositionServices))
|
|
|
|
{
|
|
|
|
*ppvOut = &This->ITfContextOwnerCompositionServices_iface;
|
|
|
|
}
|
2009-05-26 18:30:13 +00:00
|
|
|
else if (IsEqualIID(iid, &IID_ITfInsertAtSelection))
|
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
*ppvOut = &This->ITfInsertAtSelection_iface;
|
2009-05-26 18:30:13 +00:00
|
|
|
}
|
2009-06-11 18:33:33 +00:00
|
|
|
else if (IsEqualIID(iid, &IID_ITfCompartmentMgr))
|
|
|
|
{
|
|
|
|
*ppvOut = This->CompartmentMgr;
|
|
|
|
}
|
2009-08-28 19:08:20 +00:00
|
|
|
else if (IsEqualIID(iid, &IID_ITfSourceSingle))
|
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
*ppvOut = &This->ITfSourceSingle_iface;
|
2009-08-28 19:08:20 +00:00
|
|
|
}
|
2009-02-02 16:24:59 +00:00
|
|
|
|
|
|
|
if (*ppvOut)
|
|
|
|
{
|
2012-08-19 18:01:36 +00:00
|
|
|
ITfContext_AddRef(iface);
|
2009-02-02 16:24:59 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
WARN("unsupported interface: %s\n", debugstr_guid(iid));
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI Context_AddRef(ITfContext *iface)
|
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
Context *This = impl_from_ITfContext(iface);
|
2009-02-02 16:24:59 +00:00
|
|
|
return InterlockedIncrement(&This->refCount);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI Context_Release(ITfContext *iface)
|
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
Context *This = impl_from_ITfContext(iface);
|
2009-02-02 16:24:59 +00:00
|
|
|
ULONG ret;
|
|
|
|
|
|
|
|
ret = InterlockedDecrement(&This->refCount);
|
|
|
|
if (ret == 0)
|
|
|
|
Context_Destructor(This);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************
|
|
|
|
* ITfContext functions
|
|
|
|
*****************************************************/
|
|
|
|
static HRESULT WINAPI Context_RequestEditSession (ITfContext *iface,
|
|
|
|
TfClientId tid, ITfEditSession *pes, DWORD dwFlags,
|
|
|
|
HRESULT *phrSession)
|
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
Context *This = impl_from_ITfContext(iface);
|
2009-05-18 13:58:43 +00:00
|
|
|
HRESULT hr;
|
|
|
|
DWORD dwLockFlags = 0x0;
|
|
|
|
|
2022-02-15 06:29:05 +00:00
|
|
|
TRACE("(%p) %li %p %lx %p\n",This, tid, pes, dwFlags, phrSession);
|
2009-05-18 13:58:43 +00:00
|
|
|
|
|
|
|
if (!(dwFlags & TF_ES_READ) && !(dwFlags & TF_ES_READWRITE))
|
|
|
|
{
|
|
|
|
*phrSession = E_FAIL;
|
|
|
|
return E_INVALIDARG;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!This->pITextStoreACP)
|
|
|
|
{
|
2010-07-25 01:21:26 +00:00
|
|
|
FIXME("No ITextStoreACP available\n");
|
2009-05-18 13:58:43 +00:00
|
|
|
*phrSession = E_FAIL;
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!(dwFlags & TF_ES_ASYNC))
|
2009-05-19 17:50:03 +00:00
|
|
|
dwLockFlags |= TS_LF_SYNC;
|
2009-05-18 13:58:43 +00:00
|
|
|
|
2009-05-21 18:44:51 +00:00
|
|
|
if ((dwFlags & TF_ES_READWRITE) == TF_ES_READWRITE)
|
2009-05-19 17:50:03 +00:00
|
|
|
dwLockFlags |= TS_LF_READWRITE;
|
2009-05-21 18:44:51 +00:00
|
|
|
else if (dwFlags & TF_ES_READ)
|
|
|
|
dwLockFlags |= TS_LF_READ;
|
2009-05-18 13:58:43 +00:00
|
|
|
|
2009-05-22 19:49:30 +00:00
|
|
|
if (!This->documentStatus.dwDynamicFlags)
|
|
|
|
ITextStoreACP_GetStatus(This->pITextStoreACP, &This->documentStatus);
|
2009-05-18 13:58:43 +00:00
|
|
|
|
2009-05-22 19:49:30 +00:00
|
|
|
if (((dwFlags & TF_ES_READWRITE) == TF_ES_READWRITE) && (This->documentStatus.dwDynamicFlags & TS_SD_READONLY))
|
2009-05-18 13:58:43 +00:00
|
|
|
{
|
|
|
|
*phrSession = TS_E_READONLY;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (FAILED (ITfEditSession_QueryInterface(pes, &IID_ITfEditSession, (LPVOID*)&This->currentEditSession)))
|
|
|
|
{
|
|
|
|
*phrSession = E_FAIL;
|
|
|
|
return E_INVALIDARG;
|
|
|
|
}
|
|
|
|
|
|
|
|
hr = ITextStoreACP_RequestLock(This->pITextStoreACP, dwLockFlags, phrSession);
|
|
|
|
|
|
|
|
return hr;
|
2009-02-02 16:24:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Context_InWriteSession (ITfContext *iface,
|
|
|
|
TfClientId tid,
|
|
|
|
BOOL *pfWriteSession)
|
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
Context *This = impl_from_ITfContext(iface);
|
2009-02-02 16:24:59 +00:00
|
|
|
FIXME("STUB:(%p)\n",This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Context_GetSelection (ITfContext *iface,
|
|
|
|
TfEditCookie ec, ULONG ulIndex, ULONG ulCount,
|
|
|
|
TF_SELECTION *pSelection, ULONG *pcFetched)
|
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
Context *This = impl_from_ITfContext(iface);
|
2009-05-21 18:45:57 +00:00
|
|
|
ULONG count, i;
|
|
|
|
ULONG totalFetched = 0;
|
|
|
|
HRESULT hr = S_OK;
|
|
|
|
|
|
|
|
if (!pSelection || !pcFetched)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
*pcFetched = 0;
|
|
|
|
|
|
|
|
if (!This->connected)
|
|
|
|
return TF_E_DISCONNECTED;
|
|
|
|
|
|
|
|
if (get_Cookie_magic(ec)!=COOKIE_MAGIC_EDITCOOKIE)
|
|
|
|
return TF_E_NOLOCK;
|
|
|
|
|
|
|
|
if (!This->pITextStoreACP)
|
|
|
|
{
|
|
|
|
FIXME("Context does not have a ITextStoreACP\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ulIndex == TF_DEFAULT_SELECTION)
|
|
|
|
count = 1;
|
|
|
|
else
|
|
|
|
count = ulCount;
|
|
|
|
|
|
|
|
for (i = 0; i < count; i++)
|
|
|
|
{
|
|
|
|
DWORD fetched;
|
|
|
|
TS_SELECTION_ACP acps;
|
|
|
|
|
|
|
|
hr = ITextStoreACP_GetSelection(This->pITextStoreACP, ulIndex + i,
|
|
|
|
1, &acps, &fetched);
|
|
|
|
|
|
|
|
if (hr == TS_E_NOLOCK)
|
|
|
|
return TF_E_NOLOCK;
|
|
|
|
else if (SUCCEEDED(hr))
|
|
|
|
{
|
|
|
|
pSelection[totalFetched].style.ase = acps.style.ase;
|
|
|
|
pSelection[totalFetched].style.fInterimChar = acps.style.fInterimChar;
|
2021-06-02 14:08:49 +00:00
|
|
|
Range_Constructor(iface, acps.acpStart, acps.acpEnd, &pSelection[totalFetched].range);
|
2009-05-21 18:45:57 +00:00
|
|
|
totalFetched ++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
*pcFetched = totalFetched;
|
|
|
|
|
|
|
|
return hr;
|
2009-02-02 16:24:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Context_SetSelection (ITfContext *iface,
|
|
|
|
TfEditCookie ec, ULONG ulCount, const TF_SELECTION *pSelection)
|
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
Context *This = impl_from_ITfContext(iface);
|
2009-06-03 16:27:31 +00:00
|
|
|
TS_SELECTION_ACP *acp;
|
2013-02-13 21:06:41 +00:00
|
|
|
ULONG i;
|
2009-06-03 16:27:31 +00:00
|
|
|
HRESULT hr;
|
|
|
|
|
2022-02-15 06:29:05 +00:00
|
|
|
TRACE("(%p) %li %li %p\n",This,ec,ulCount,pSelection);
|
2009-06-03 16:27:31 +00:00
|
|
|
|
|
|
|
if (!This->pITextStoreACP)
|
|
|
|
{
|
|
|
|
FIXME("Context does not have a ITextStoreACP\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (get_Cookie_magic(ec)!=COOKIE_MAGIC_EDITCOOKIE)
|
|
|
|
return TF_E_NOLOCK;
|
|
|
|
|
|
|
|
acp = HeapAlloc(GetProcessHeap(), 0, sizeof(TS_SELECTION_ACP) * ulCount);
|
|
|
|
if (!acp)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
for (i = 0; i < ulCount; i++)
|
|
|
|
if (FAILED(TF_SELECTION_to_TS_SELECTION_ACP(&pSelection[i], &acp[i])))
|
|
|
|
{
|
|
|
|
TRACE("Selection Conversion Failed\n");
|
|
|
|
HeapFree(GetProcessHeap(), 0 , acp);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
hr = ITextStoreACP_SetSelection(This->pITextStoreACP, ulCount, acp);
|
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, acp);
|
|
|
|
|
|
|
|
return hr;
|
2009-02-02 16:24:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Context_GetStart (ITfContext *iface,
|
|
|
|
TfEditCookie ec, ITfRange **ppStart)
|
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
Context *This = impl_from_ITfContext(iface);
|
2021-06-02 14:08:49 +00:00
|
|
|
|
2022-02-15 06:29:05 +00:00
|
|
|
TRACE("(%p) %li %p\n",This,ec,ppStart);
|
2009-05-21 18:45:26 +00:00
|
|
|
|
|
|
|
if (!ppStart)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
*ppStart = NULL;
|
|
|
|
|
|
|
|
if (!This->connected)
|
|
|
|
return TF_E_DISCONNECTED;
|
|
|
|
|
|
|
|
if (get_Cookie_magic(ec)!=COOKIE_MAGIC_EDITCOOKIE)
|
|
|
|
return TF_E_NOLOCK;
|
|
|
|
|
2021-06-02 14:08:49 +00:00
|
|
|
return Range_Constructor(iface, 0, 0, ppStart);
|
2009-02-02 16:24:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Context_GetEnd (ITfContext *iface,
|
|
|
|
TfEditCookie ec, ITfRange **ppEnd)
|
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
Context *This = impl_from_ITfContext(iface);
|
2009-05-21 18:45:36 +00:00
|
|
|
LONG end;
|
2022-02-15 06:29:05 +00:00
|
|
|
TRACE("(%p) %li %p\n",This,ec,ppEnd);
|
2009-05-21 18:45:36 +00:00
|
|
|
|
|
|
|
if (!ppEnd)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
*ppEnd = NULL;
|
|
|
|
|
|
|
|
if (!This->connected)
|
|
|
|
return TF_E_DISCONNECTED;
|
|
|
|
|
|
|
|
if (get_Cookie_magic(ec)!=COOKIE_MAGIC_EDITCOOKIE)
|
|
|
|
return TF_E_NOLOCK;
|
|
|
|
|
|
|
|
if (!This->pITextStoreACP)
|
|
|
|
{
|
|
|
|
FIXME("Context does not have a ITextStoreACP\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ITextStoreACP_GetEndACP(This->pITextStoreACP,&end);
|
|
|
|
|
2021-06-02 14:08:49 +00:00
|
|
|
return Range_Constructor(iface, end, end, ppEnd);
|
2009-02-02 16:24:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Context_GetActiveView (ITfContext *iface,
|
|
|
|
ITfContextView **ppView)
|
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
Context *This = impl_from_ITfContext(iface);
|
2009-02-02 16:24:59 +00:00
|
|
|
FIXME("STUB:(%p)\n",This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Context_EnumViews (ITfContext *iface,
|
|
|
|
IEnumTfContextViews **ppEnum)
|
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
Context *This = impl_from_ITfContext(iface);
|
2009-02-02 16:24:59 +00:00
|
|
|
FIXME("STUB:(%p)\n",This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Context_GetStatus (ITfContext *iface,
|
|
|
|
TF_STATUS *pdcs)
|
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
Context *This = impl_from_ITfContext(iface);
|
2009-06-24 08:28:31 +00:00
|
|
|
TRACE("(%p) %p\n",This,pdcs);
|
|
|
|
|
|
|
|
if (!This->connected)
|
|
|
|
return TF_E_DISCONNECTED;
|
|
|
|
|
|
|
|
if (!pdcs)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
if (!This->pITextStoreACP)
|
|
|
|
{
|
|
|
|
FIXME("Context does not have a ITextStoreACP\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ITextStoreACP_GetStatus(This->pITextStoreACP, &This->documentStatus);
|
|
|
|
|
|
|
|
*pdcs = This->documentStatus;
|
|
|
|
|
|
|
|
return S_OK;
|
2009-02-02 16:24:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Context_GetProperty (ITfContext *iface,
|
|
|
|
REFGUID guidProp, ITfProperty **ppProp)
|
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
Context *This = impl_from_ITfContext(iface);
|
2009-02-02 16:24:59 +00:00
|
|
|
FIXME("STUB:(%p)\n",This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Context_GetAppProperty (ITfContext *iface,
|
|
|
|
REFGUID guidProp, ITfReadOnlyProperty **ppProp)
|
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
Context *This = impl_from_ITfContext(iface);
|
2009-02-02 16:24:59 +00:00
|
|
|
FIXME("STUB:(%p)\n",This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Context_TrackProperties (ITfContext *iface,
|
|
|
|
const GUID **prgProp, ULONG cProp, const GUID **prgAppProp,
|
|
|
|
ULONG cAppProp, ITfReadOnlyProperty **ppProperty)
|
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
Context *This = impl_from_ITfContext(iface);
|
2009-02-02 16:24:59 +00:00
|
|
|
FIXME("STUB:(%p)\n",This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Context_EnumProperties (ITfContext *iface,
|
|
|
|
IEnumTfProperties **ppEnum)
|
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
Context *This = impl_from_ITfContext(iface);
|
2009-02-02 16:24:59 +00:00
|
|
|
FIXME("STUB:(%p)\n",This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Context_GetDocumentMgr (ITfContext *iface,
|
|
|
|
ITfDocumentMgr **ppDm)
|
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
Context *This = impl_from_ITfContext(iface);
|
2009-06-16 09:37:54 +00:00
|
|
|
TRACE("(%p) %p\n",This,ppDm);
|
|
|
|
|
|
|
|
if (!ppDm)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
*ppDm = This->manager;
|
|
|
|
if (!This->manager)
|
|
|
|
return S_FALSE;
|
2009-06-24 08:29:05 +00:00
|
|
|
|
|
|
|
ITfDocumentMgr_AddRef(This->manager);
|
|
|
|
|
2009-06-16 09:37:54 +00:00
|
|
|
return S_OK;
|
2009-02-02 16:24:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Context_CreateRangeBackup (ITfContext *iface,
|
|
|
|
TfEditCookie ec, ITfRange *pRange, ITfRangeBackup **ppBackup)
|
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
Context *This = impl_from_ITfContext(iface);
|
2009-02-02 16:24:59 +00:00
|
|
|
FIXME("STUB:(%p)\n",This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-11-17 08:21:51 +00:00
|
|
|
static const ITfContextVtbl ContextVtbl =
|
2009-02-02 16:24:59 +00:00
|
|
|
{
|
|
|
|
Context_QueryInterface,
|
|
|
|
Context_AddRef,
|
|
|
|
Context_Release,
|
|
|
|
Context_RequestEditSession,
|
|
|
|
Context_InWriteSession,
|
|
|
|
Context_GetSelection,
|
|
|
|
Context_SetSelection,
|
|
|
|
Context_GetStart,
|
|
|
|
Context_GetEnd,
|
|
|
|
Context_GetActiveView,
|
|
|
|
Context_EnumViews,
|
|
|
|
Context_GetStatus,
|
|
|
|
Context_GetProperty,
|
|
|
|
Context_GetAppProperty,
|
|
|
|
Context_TrackProperties,
|
|
|
|
Context_EnumProperties,
|
|
|
|
Context_GetDocumentMgr,
|
|
|
|
Context_CreateRangeBackup
|
|
|
|
};
|
|
|
|
|
2019-08-14 08:36:48 +00:00
|
|
|
/*****************************************************
|
|
|
|
* ITfSource functions
|
|
|
|
*****************************************************/
|
2013-11-17 08:21:51 +00:00
|
|
|
static HRESULT WINAPI ContextSource_QueryInterface(ITfSource *iface, REFIID iid, LPVOID *ppvOut)
|
2009-02-02 16:25:42 +00:00
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
Context *This = impl_from_ITfSource(iface);
|
2013-11-17 08:22:17 +00:00
|
|
|
return ITfContext_QueryInterface(&This->ITfContext_iface, iid, ppvOut);
|
2009-02-02 16:25:42 +00:00
|
|
|
}
|
|
|
|
|
2013-11-17 08:21:51 +00:00
|
|
|
static ULONG WINAPI ContextSource_AddRef(ITfSource *iface)
|
2009-02-02 16:25:42 +00:00
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
Context *This = impl_from_ITfSource(iface);
|
|
|
|
return ITfContext_AddRef(&This->ITfContext_iface);
|
2009-02-02 16:25:42 +00:00
|
|
|
}
|
|
|
|
|
2013-11-17 08:21:51 +00:00
|
|
|
static ULONG WINAPI ContextSource_Release(ITfSource *iface)
|
2009-02-02 16:25:42 +00:00
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
Context *This = impl_from_ITfSource(iface);
|
|
|
|
return ITfContext_Release(&This->ITfContext_iface);
|
2009-02-02 16:25:42 +00:00
|
|
|
}
|
|
|
|
|
2009-09-19 21:33:29 +00:00
|
|
|
static HRESULT WINAPI ContextSource_AdviseSink(ITfSource *iface,
|
2009-02-02 16:25:42 +00:00
|
|
|
REFIID riid, IUnknown *punk, DWORD *pdwCookie)
|
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
Context *This = impl_from_ITfSource(iface);
|
2016-05-04 17:41:52 +00:00
|
|
|
|
2009-02-04 20:48:36 +00:00
|
|
|
TRACE("(%p) %s %p %p\n",This,debugstr_guid(riid),punk,pdwCookie);
|
|
|
|
|
|
|
|
if (!riid || !punk || !pdwCookie)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
if (IsEqualIID(riid, &IID_ITfTextEditSink))
|
2016-05-04 17:41:52 +00:00
|
|
|
return advise_sink(&This->pTextEditSink, &IID_ITfTextEditSink, COOKIE_MAGIC_CONTEXTSINK, punk, pdwCookie);
|
2009-02-04 20:48:36 +00:00
|
|
|
|
2016-05-04 17:41:52 +00:00
|
|
|
FIXME("(%p) Unhandled Sink: %s\n",This,debugstr_guid(riid));
|
|
|
|
return E_NOTIMPL;
|
2009-02-02 16:25:42 +00:00
|
|
|
}
|
|
|
|
|
2009-09-19 21:33:29 +00:00
|
|
|
static HRESULT WINAPI ContextSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie)
|
2009-02-02 16:25:42 +00:00
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
Context *This = impl_from_ITfSource(iface);
|
2009-04-22 16:14:19 +00:00
|
|
|
|
2022-02-15 06:29:05 +00:00
|
|
|
TRACE("(%p) %lx\n",This,pdwCookie);
|
2009-02-04 20:48:36 +00:00
|
|
|
|
2009-04-22 16:14:19 +00:00
|
|
|
if (get_Cookie_magic(pdwCookie)!=COOKIE_MAGIC_CONTEXTSINK)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2016-05-04 17:41:52 +00:00
|
|
|
return unadvise_sink(pdwCookie);
|
2009-02-02 16:25:42 +00:00
|
|
|
}
|
|
|
|
|
2013-11-17 08:21:51 +00:00
|
|
|
static const ITfSourceVtbl ContextSourceVtbl =
|
2009-02-02 16:25:42 +00:00
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
ContextSource_QueryInterface,
|
|
|
|
ContextSource_AddRef,
|
|
|
|
ContextSource_Release,
|
2009-02-02 16:25:42 +00:00
|
|
|
ContextSource_AdviseSink,
|
2013-11-17 08:21:51 +00:00
|
|
|
ContextSource_UnadviseSink
|
2009-02-02 16:25:42 +00:00
|
|
|
};
|
|
|
|
|
2019-08-14 08:36:48 +00:00
|
|
|
/*****************************************************
|
|
|
|
* ITfContextOwnerCompositionServices functions
|
|
|
|
*****************************************************/
|
|
|
|
static HRESULT WINAPI ContextOwnerCompositionServices_QueryInterface(ITfContextOwnerCompositionServices *iface,
|
|
|
|
REFIID iid, LPVOID *ppvOut)
|
|
|
|
{
|
|
|
|
Context *This = impl_from_ITfContextOwnerCompositionServices(iface);
|
|
|
|
return ITfContext_QueryInterface(&This->ITfContext_iface, iid, ppvOut);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ContextOwnerCompositionServices_AddRef(ITfContextOwnerCompositionServices *iface)
|
|
|
|
{
|
|
|
|
Context *This = impl_from_ITfContextOwnerCompositionServices(iface);
|
|
|
|
return ITfContext_AddRef(&This->ITfContext_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ContextOwnerCompositionServices_Release(ITfContextOwnerCompositionServices *iface)
|
|
|
|
{
|
|
|
|
Context *This = impl_from_ITfContextOwnerCompositionServices(iface);
|
|
|
|
return ITfContext_Release(&This->ITfContext_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ContextOwnerCompositionServices_StartComposition(ITfContextOwnerCompositionServices *iface,
|
|
|
|
TfEditCookie ecWrite, ITfRange *pCompositionRange, ITfCompositionSink *pSink, ITfComposition **ppComposition)
|
|
|
|
{
|
|
|
|
Context *This = impl_from_ITfContextOwnerCompositionServices(iface);
|
2022-02-15 06:29:05 +00:00
|
|
|
FIXME("STUB:(%p) %#lx %p %p %p\n", This, ecWrite, pCompositionRange, pSink, ppComposition);
|
2019-08-14 08:36:48 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ContextOwnerCompositionServices_EnumCompositions(ITfContextOwnerCompositionServices *iface,
|
|
|
|
IEnumITfCompositionView **ppEnum)
|
|
|
|
{
|
|
|
|
Context *This = impl_from_ITfContextOwnerCompositionServices(iface);
|
|
|
|
FIXME("STUB:(%p) %p\n", This, ppEnum);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ContextOwnerCompositionServices_FindComposition(ITfContextOwnerCompositionServices *iface,
|
|
|
|
TfEditCookie ecRead, ITfRange *pTestRange, IEnumITfCompositionView **ppEnum)
|
|
|
|
{
|
|
|
|
Context *This = impl_from_ITfContextOwnerCompositionServices(iface);
|
2022-02-15 06:29:05 +00:00
|
|
|
FIXME("STUB:(%p) %#lx %p %p\n", This, ecRead, pTestRange, ppEnum);
|
2019-08-14 08:36:48 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ContextOwnerCompositionServices_TakeOwnership(ITfContextOwnerCompositionServices *iface,
|
|
|
|
TfEditCookie ecWrite, ITfCompositionView *pComposition, ITfCompositionSink *pSink, ITfComposition **ppComposition)
|
|
|
|
{
|
|
|
|
Context *This = impl_from_ITfContextOwnerCompositionServices(iface);
|
2022-02-15 06:29:05 +00:00
|
|
|
FIXME("STUB:(%p) %#lx %p %p %p\n", This, ecWrite, pComposition, pSink, ppComposition);
|
2019-08-14 08:36:48 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ContextOwnerCompositionServices_TerminateComposition(ITfContextOwnerCompositionServices *iface,
|
|
|
|
ITfCompositionView *pComposition)
|
|
|
|
{
|
|
|
|
Context *This = impl_from_ITfContextOwnerCompositionServices(iface);
|
|
|
|
FIXME("STUB:(%p) %p\n", This, pComposition);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const ITfContextOwnerCompositionServicesVtbl ContextOwnerCompositionServicesVtbl =
|
|
|
|
{
|
|
|
|
ContextOwnerCompositionServices_QueryInterface,
|
|
|
|
ContextOwnerCompositionServices_AddRef,
|
|
|
|
ContextOwnerCompositionServices_Release,
|
|
|
|
ContextOwnerCompositionServices_StartComposition,
|
|
|
|
ContextOwnerCompositionServices_EnumCompositions,
|
|
|
|
ContextOwnerCompositionServices_FindComposition,
|
|
|
|
ContextOwnerCompositionServices_TakeOwnership,
|
|
|
|
ContextOwnerCompositionServices_TerminateComposition
|
|
|
|
};
|
|
|
|
|
2009-05-26 18:30:13 +00:00
|
|
|
/*****************************************************
|
|
|
|
* ITfInsertAtSelection functions
|
|
|
|
*****************************************************/
|
|
|
|
static HRESULT WINAPI InsertAtSelection_QueryInterface(ITfInsertAtSelection *iface, REFIID iid, LPVOID *ppvOut)
|
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
Context *This = impl_from_ITfInsertAtSelection(iface);
|
2013-11-17 08:22:17 +00:00
|
|
|
return ITfContext_QueryInterface(&This->ITfContext_iface, iid, ppvOut);
|
2009-05-26 18:30:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI InsertAtSelection_AddRef(ITfInsertAtSelection *iface)
|
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
Context *This = impl_from_ITfInsertAtSelection(iface);
|
|
|
|
return ITfContext_AddRef(&This->ITfContext_iface);
|
2009-05-26 18:30:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI InsertAtSelection_Release(ITfInsertAtSelection *iface)
|
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
Context *This = impl_from_ITfInsertAtSelection(iface);
|
|
|
|
return ITfContext_Release(&This->ITfContext_iface);
|
2009-05-26 18:30:13 +00:00
|
|
|
}
|
|
|
|
|
2009-09-19 21:33:29 +00:00
|
|
|
static HRESULT WINAPI InsertAtSelection_InsertTextAtSelection(
|
2009-05-26 18:30:13 +00:00
|
|
|
ITfInsertAtSelection *iface, TfEditCookie ec, DWORD dwFlags,
|
|
|
|
const WCHAR *pchText, LONG cch, ITfRange **ppRange)
|
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
Context *This = impl_from_ITfInsertAtSelection(iface);
|
2009-06-03 16:27:24 +00:00
|
|
|
EditCookie *cookie;
|
|
|
|
LONG acpStart, acpEnd;
|
|
|
|
TS_TEXTCHANGE change;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2022-02-15 06:29:05 +00:00
|
|
|
TRACE("(%p) %li %lx %s %p\n",This, ec, dwFlags, debugstr_wn(pchText,cch), ppRange);
|
2009-06-03 16:27:24 +00:00
|
|
|
|
|
|
|
if (!This->connected)
|
|
|
|
return TF_E_DISCONNECTED;
|
|
|
|
|
|
|
|
if (get_Cookie_magic(ec)!=COOKIE_MAGIC_EDITCOOKIE)
|
|
|
|
return TF_E_NOLOCK;
|
|
|
|
|
|
|
|
cookie = get_Cookie_data(ec);
|
|
|
|
|
|
|
|
if ((cookie->lockType & TS_LF_READWRITE) != TS_LF_READWRITE )
|
|
|
|
return TS_E_READONLY;
|
|
|
|
|
|
|
|
if (!This->pITextStoreACP)
|
|
|
|
{
|
|
|
|
FIXME("Context does not have a ITextStoreACP\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
hr = ITextStoreACP_InsertTextAtSelection(This->pITextStoreACP, dwFlags, pchText, cch, &acpStart, &acpEnd, &change);
|
|
|
|
if (SUCCEEDED(hr))
|
2021-06-02 14:08:49 +00:00
|
|
|
Range_Constructor(&This->ITfContext_iface, change.acpStart, change.acpNewEnd, ppRange);
|
2009-06-03 16:27:24 +00:00
|
|
|
|
|
|
|
return hr;
|
2009-05-26 18:30:13 +00:00
|
|
|
}
|
|
|
|
|
2009-09-19 21:33:29 +00:00
|
|
|
static HRESULT WINAPI InsertAtSelection_InsertEmbeddedAtSelection(
|
2009-05-26 18:30:13 +00:00
|
|
|
ITfInsertAtSelection *iface, TfEditCookie ec, DWORD dwFlags,
|
|
|
|
IDataObject *pDataObject, ITfRange **ppRange)
|
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
Context *This = impl_from_ITfInsertAtSelection(iface);
|
2009-05-26 18:30:13 +00:00
|
|
|
FIXME("STUB:(%p)\n",This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-11-17 08:21:51 +00:00
|
|
|
static const ITfInsertAtSelectionVtbl InsertAtSelectionVtbl =
|
2009-05-26 18:30:13 +00:00
|
|
|
{
|
|
|
|
InsertAtSelection_QueryInterface,
|
|
|
|
InsertAtSelection_AddRef,
|
|
|
|
InsertAtSelection_Release,
|
|
|
|
InsertAtSelection_InsertTextAtSelection,
|
|
|
|
InsertAtSelection_InsertEmbeddedAtSelection,
|
|
|
|
};
|
|
|
|
|
2009-08-28 19:08:20 +00:00
|
|
|
/*****************************************************
|
|
|
|
* ITfSourceSingle functions
|
|
|
|
*****************************************************/
|
|
|
|
static HRESULT WINAPI SourceSingle_QueryInterface(ITfSourceSingle *iface, REFIID iid, LPVOID *ppvOut)
|
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
Context *This = impl_from_ITfSourceSingle(iface);
|
2013-11-17 08:22:17 +00:00
|
|
|
return ITfContext_QueryInterface(&This->ITfContext_iface, iid, ppvOut);
|
2009-08-28 19:08:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI SourceSingle_AddRef(ITfSourceSingle *iface)
|
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
Context *This = impl_from_ITfSourceSingle(iface);
|
2013-11-17 08:22:17 +00:00
|
|
|
return ITfContext_AddRef(&This->ITfContext_iface);
|
2009-08-28 19:08:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI SourceSingle_Release(ITfSourceSingle *iface)
|
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
Context *This = impl_from_ITfSourceSingle(iface);
|
2013-11-17 08:22:17 +00:00
|
|
|
return ITfContext_Release(&This->ITfContext_iface);
|
2009-08-28 19:08:20 +00:00
|
|
|
}
|
|
|
|
|
2009-09-19 21:33:29 +00:00
|
|
|
static HRESULT WINAPI SourceSingle_AdviseSingleSink( ITfSourceSingle *iface,
|
2009-08-28 19:08:20 +00:00
|
|
|
TfClientId tid, REFIID riid, IUnknown *punk)
|
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
Context *This = impl_from_ITfSourceSingle(iface);
|
2022-02-15 06:29:05 +00:00
|
|
|
FIXME("STUB:(%p) %li %s %p\n",This, tid, debugstr_guid(riid),punk);
|
2009-08-28 19:08:20 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2009-09-19 21:33:29 +00:00
|
|
|
static HRESULT WINAPI SourceSingle_UnadviseSingleSink( ITfSourceSingle *iface,
|
2009-08-28 19:08:20 +00:00
|
|
|
TfClientId tid, REFIID riid)
|
|
|
|
{
|
2013-11-17 08:21:51 +00:00
|
|
|
Context *This = impl_from_ITfSourceSingle(iface);
|
2022-02-15 06:29:05 +00:00
|
|
|
FIXME("STUB:(%p) %li %s\n",This, tid, debugstr_guid(riid));
|
2009-08-28 19:08:20 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-11-17 08:21:51 +00:00
|
|
|
static const ITfSourceSingleVtbl ContextSourceSingleVtbl =
|
2009-08-28 19:08:20 +00:00
|
|
|
{
|
|
|
|
SourceSingle_QueryInterface,
|
|
|
|
SourceSingle_AddRef,
|
|
|
|
SourceSingle_Release,
|
|
|
|
SourceSingle_AdviseSingleSink,
|
|
|
|
SourceSingle_UnadviseSingleSink,
|
|
|
|
};
|
|
|
|
|
2009-02-05 20:17:26 +00:00
|
|
|
/**************************************************************************
|
|
|
|
* ITextStoreACPSink
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
static HRESULT WINAPI TextStoreACPSink_QueryInterface(ITextStoreACPSink *iface, REFIID iid, LPVOID *ppvOut)
|
|
|
|
{
|
2016-03-22 07:09:36 +00:00
|
|
|
Context *This = impl_from_ITextStoreACPSink(iface);
|
|
|
|
|
2009-02-05 20:17:26 +00:00
|
|
|
*ppvOut = NULL;
|
|
|
|
|
|
|
|
if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITextStoreACPSink))
|
|
|
|
{
|
2013-11-17 08:22:17 +00:00
|
|
|
*ppvOut = &This->ITextStoreACPSink_iface;
|
2009-02-05 20:17:26 +00:00
|
|
|
}
|
2016-03-22 07:09:37 +00:00
|
|
|
else if (IsEqualIID(iid, &IID_ITextStoreACPServices))
|
|
|
|
*ppvOut = &This->ITextStoreACPServices_iface;
|
2009-02-05 20:17:26 +00:00
|
|
|
|
|
|
|
if (*ppvOut)
|
|
|
|
{
|
2012-08-19 18:01:36 +00:00
|
|
|
ITextStoreACPSink_AddRef(iface);
|
2009-02-05 20:17:26 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
WARN("unsupported interface: %s\n", debugstr_guid(iid));
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI TextStoreACPSink_AddRef(ITextStoreACPSink *iface)
|
|
|
|
{
|
2016-03-22 07:09:36 +00:00
|
|
|
Context *This = impl_from_ITextStoreACPSink(iface);
|
|
|
|
return ITfContext_AddRef(&This->ITfContext_iface);
|
2009-02-05 20:17:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI TextStoreACPSink_Release(ITextStoreACPSink *iface)
|
|
|
|
{
|
2016-03-22 07:09:36 +00:00
|
|
|
Context *This = impl_from_ITextStoreACPSink(iface);
|
|
|
|
return ITfContext_Release(&This->ITfContext_iface);
|
2009-02-05 20:17:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************
|
|
|
|
* ITextStoreACPSink functions
|
|
|
|
*****************************************************/
|
|
|
|
|
|
|
|
static HRESULT WINAPI TextStoreACPSink_OnTextChange(ITextStoreACPSink *iface,
|
|
|
|
DWORD dwFlags, const TS_TEXTCHANGE *pChange)
|
|
|
|
{
|
2016-03-22 07:09:36 +00:00
|
|
|
Context *This = impl_from_ITextStoreACPSink(iface);
|
2009-02-05 20:17:26 +00:00
|
|
|
FIXME("STUB:(%p)\n",This);
|
2018-04-04 09:47:59 +00:00
|
|
|
return S_OK;
|
2009-02-05 20:17:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI TextStoreACPSink_OnSelectionChange(ITextStoreACPSink *iface)
|
|
|
|
{
|
2016-03-22 07:09:36 +00:00
|
|
|
Context *This = impl_from_ITextStoreACPSink(iface);
|
2009-02-05 20:17:26 +00:00
|
|
|
FIXME("STUB:(%p)\n",This);
|
2018-04-04 09:48:00 +00:00
|
|
|
return S_OK;
|
2009-02-05 20:17:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI TextStoreACPSink_OnLayoutChange(ITextStoreACPSink *iface,
|
|
|
|
TsLayoutCode lcode, TsViewCookie vcView)
|
|
|
|
{
|
2016-03-22 07:09:36 +00:00
|
|
|
Context *This = impl_from_ITextStoreACPSink(iface);
|
2009-02-05 20:17:26 +00:00
|
|
|
FIXME("STUB:(%p)\n",This);
|
2018-04-04 09:48:01 +00:00
|
|
|
return S_OK;
|
2009-02-05 20:17:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI TextStoreACPSink_OnStatusChange(ITextStoreACPSink *iface,
|
|
|
|
DWORD dwFlags)
|
|
|
|
{
|
2016-03-22 07:09:36 +00:00
|
|
|
Context *This = impl_from_ITextStoreACPSink(iface);
|
2009-05-22 19:49:30 +00:00
|
|
|
HRESULT hr, hrSession;
|
|
|
|
|
2022-02-15 06:29:05 +00:00
|
|
|
TRACE("(%p) %lx\n",This, dwFlags);
|
2009-05-22 19:49:30 +00:00
|
|
|
|
2016-03-22 07:09:36 +00:00
|
|
|
if (!This->pITextStoreACP)
|
2009-05-22 19:49:30 +00:00
|
|
|
{
|
|
|
|
FIXME("Context does not have a ITextStoreACP\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2016-03-22 07:09:36 +00:00
|
|
|
hr = ITextStoreACP_RequestLock(This->pITextStoreACP, TS_LF_READ, &hrSession);
|
2009-05-22 19:49:30 +00:00
|
|
|
|
|
|
|
if(SUCCEEDED(hr) && SUCCEEDED(hrSession))
|
2016-03-22 07:09:36 +00:00
|
|
|
This->documentStatus.dwDynamicFlags = dwFlags;
|
2009-05-22 19:49:30 +00:00
|
|
|
|
|
|
|
return S_OK;
|
2009-02-05 20:17:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI TextStoreACPSink_OnAttrsChange(ITextStoreACPSink *iface,
|
|
|
|
LONG acpStart, LONG acpEnd, ULONG cAttrs, const TS_ATTRID *paAttrs)
|
|
|
|
{
|
2016-03-22 07:09:36 +00:00
|
|
|
Context *This = impl_from_ITextStoreACPSink(iface);
|
2009-02-05 20:17:26 +00:00
|
|
|
FIXME("STUB:(%p)\n",This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI TextStoreACPSink_OnLockGranted(ITextStoreACPSink *iface,
|
|
|
|
DWORD dwLockFlags)
|
|
|
|
{
|
2016-03-22 07:09:36 +00:00
|
|
|
Context *This = impl_from_ITextStoreACPSink(iface);
|
2009-05-18 13:58:43 +00:00
|
|
|
HRESULT hr;
|
2009-08-28 20:08:14 +00:00
|
|
|
EditCookie *cookie,*sinkcookie;
|
2009-05-20 19:46:50 +00:00
|
|
|
TfEditCookie ec;
|
2009-08-28 20:08:14 +00:00
|
|
|
struct list *cursor;
|
2009-05-18 13:58:43 +00:00
|
|
|
|
2022-02-15 06:29:05 +00:00
|
|
|
TRACE("(%p) %lx\n",This, dwLockFlags);
|
2009-05-18 13:58:43 +00:00
|
|
|
|
2016-03-22 07:09:36 +00:00
|
|
|
if (!This->currentEditSession)
|
2009-05-22 19:49:30 +00:00
|
|
|
{
|
|
|
|
FIXME("OnLockGranted called for something other than an EditSession\n");
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2009-05-20 19:46:50 +00:00
|
|
|
cookie = HeapAlloc(GetProcessHeap(),0,sizeof(EditCookie));
|
|
|
|
if (!cookie)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
2009-08-28 20:08:14 +00:00
|
|
|
sinkcookie = HeapAlloc(GetProcessHeap(),0,sizeof(EditCookie));
|
|
|
|
if (!sinkcookie)
|
2011-12-06 20:53:20 +00:00
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, cookie);
|
2009-08-28 20:08:14 +00:00
|
|
|
return E_OUTOFMEMORY;
|
2011-12-06 20:53:20 +00:00
|
|
|
}
|
2009-08-28 20:08:14 +00:00
|
|
|
|
2009-05-20 19:46:50 +00:00
|
|
|
cookie->lockType = dwLockFlags;
|
2016-03-22 07:09:36 +00:00
|
|
|
cookie->pOwningContext = This;
|
2009-05-20 19:46:50 +00:00
|
|
|
ec = generate_Cookie(COOKIE_MAGIC_EDITCOOKIE, cookie);
|
|
|
|
|
2016-03-22 07:09:36 +00:00
|
|
|
hr = ITfEditSession_DoEditSession(This->currentEditSession, ec);
|
2009-05-18 13:58:43 +00:00
|
|
|
|
2009-08-28 20:08:14 +00:00
|
|
|
if ((dwLockFlags&TS_LF_READWRITE) == TS_LF_READWRITE)
|
|
|
|
{
|
2016-05-04 17:41:52 +00:00
|
|
|
ITfTextEditSink *sink;
|
2009-08-28 20:08:14 +00:00
|
|
|
TfEditCookie sc;
|
|
|
|
|
|
|
|
sinkcookie->lockType = TS_LF_READ;
|
2016-03-22 07:09:36 +00:00
|
|
|
sinkcookie->pOwningContext = This;
|
2009-08-28 20:08:14 +00:00
|
|
|
sc = generate_Cookie(COOKIE_MAGIC_EDITCOOKIE, sinkcookie);
|
|
|
|
|
|
|
|
/*TODO: implement ITfEditRecord */
|
2016-05-04 17:41:52 +00:00
|
|
|
SINK_FOR_EACH(cursor, &This->pTextEditSink, ITfTextEditSink, sink)
|
2009-08-28 20:08:14 +00:00
|
|
|
{
|
2019-05-17 18:34:39 +00:00
|
|
|
ITfTextEditSink_OnEndEdit(sink, &This->ITfContext_iface, sc, NULL);
|
2009-08-28 20:08:14 +00:00
|
|
|
}
|
|
|
|
sinkcookie = remove_Cookie(sc);
|
|
|
|
}
|
|
|
|
HeapFree(GetProcessHeap(),0,sinkcookie);
|
|
|
|
|
2016-03-22 07:09:36 +00:00
|
|
|
ITfEditSession_Release(This->currentEditSession);
|
|
|
|
This->currentEditSession = NULL;
|
2009-05-18 13:58:43 +00:00
|
|
|
|
2009-05-20 19:46:50 +00:00
|
|
|
/* Edit Cookie is only valid during the edit session */
|
|
|
|
cookie = remove_Cookie(ec);
|
|
|
|
HeapFree(GetProcessHeap(),0,cookie);
|
|
|
|
|
2009-05-18 13:58:43 +00:00
|
|
|
return hr;
|
2009-02-05 20:17:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI TextStoreACPSink_OnStartEditTransaction(ITextStoreACPSink *iface)
|
|
|
|
{
|
2016-03-22 07:09:36 +00:00
|
|
|
Context *This = impl_from_ITextStoreACPSink(iface);
|
2009-02-05 20:17:26 +00:00
|
|
|
FIXME("STUB:(%p)\n",This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI TextStoreACPSink_OnEndEditTransaction(ITextStoreACPSink *iface)
|
|
|
|
{
|
2016-03-22 07:09:36 +00:00
|
|
|
Context *This = impl_from_ITextStoreACPSink(iface);
|
2009-02-05 20:17:26 +00:00
|
|
|
FIXME("STUB:(%p)\n",This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-11-17 08:21:51 +00:00
|
|
|
static const ITextStoreACPSinkVtbl TextStoreACPSinkVtbl =
|
2009-02-05 20:17:26 +00:00
|
|
|
{
|
|
|
|
TextStoreACPSink_QueryInterface,
|
|
|
|
TextStoreACPSink_AddRef,
|
|
|
|
TextStoreACPSink_Release,
|
|
|
|
TextStoreACPSink_OnTextChange,
|
|
|
|
TextStoreACPSink_OnSelectionChange,
|
|
|
|
TextStoreACPSink_OnLayoutChange,
|
|
|
|
TextStoreACPSink_OnStatusChange,
|
|
|
|
TextStoreACPSink_OnAttrsChange,
|
|
|
|
TextStoreACPSink_OnLockGranted,
|
|
|
|
TextStoreACPSink_OnStartEditTransaction,
|
|
|
|
TextStoreACPSink_OnEndEditTransaction
|
|
|
|
};
|
|
|
|
|
2016-03-22 07:09:37 +00:00
|
|
|
static HRESULT WINAPI TextStoreACPServices_QueryInterface(ITextStoreACPServices *iface, REFIID riid, void **obj)
|
|
|
|
{
|
|
|
|
Context *This = impl_from_ITextStoreACPServices(iface);
|
|
|
|
return ITextStoreACPSink_QueryInterface(&This->ITextStoreACPSink_iface, riid, obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI TextStoreACPServices_AddRef(ITextStoreACPServices *iface)
|
|
|
|
{
|
|
|
|
Context *This = impl_from_ITextStoreACPServices(iface);
|
|
|
|
return ITextStoreACPSink_AddRef(&This->ITextStoreACPSink_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI TextStoreACPServices_Release(ITextStoreACPServices *iface)
|
|
|
|
{
|
|
|
|
Context *This = impl_from_ITextStoreACPServices(iface);
|
|
|
|
return ITextStoreACPSink_Release(&This->ITextStoreACPSink_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI TextStoreACPServices_Serialize(ITextStoreACPServices *iface, ITfProperty *prop, ITfRange *range,
|
|
|
|
TF_PERSISTENT_PROPERTY_HEADER_ACP *header, IStream *stream)
|
|
|
|
{
|
|
|
|
Context *This = impl_from_ITextStoreACPServices(iface);
|
|
|
|
|
|
|
|
FIXME("stub: %p %p %p %p %p\n", This, prop, range, header, stream);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI TextStoreACPServices_Unserialize(ITextStoreACPServices *iface, ITfProperty *prop,
|
|
|
|
const TF_PERSISTENT_PROPERTY_HEADER_ACP *header, IStream *stream, ITfPersistentPropertyLoaderACP *loader)
|
|
|
|
{
|
|
|
|
Context *This = impl_from_ITextStoreACPServices(iface);
|
|
|
|
|
|
|
|
FIXME("stub: %p %p %p %p %p\n", This, prop, header, stream, loader);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI TextStoreACPServices_ForceLoadProperty(ITextStoreACPServices *iface, ITfProperty *prop)
|
|
|
|
{
|
|
|
|
Context *This = impl_from_ITextStoreACPServices(iface);
|
|
|
|
|
|
|
|
FIXME("stub: %p %p\n", This, prop);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI TextStoreACPServices_CreateRange(ITextStoreACPServices *iface,
|
|
|
|
LONG start, LONG end, ITfRangeACP **range)
|
|
|
|
{
|
|
|
|
Context *This = impl_from_ITextStoreACPServices(iface);
|
|
|
|
|
2022-02-15 06:29:05 +00:00
|
|
|
TRACE("%p, %ld, %ld, %p.\n", This, start, end, range);
|
2016-03-22 07:09:37 +00:00
|
|
|
|
2021-06-02 14:08:51 +00:00
|
|
|
return Range_Constructor(&This->ITfContext_iface, start, end, (ITfRange **)range);
|
2016-03-22 07:09:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static const ITextStoreACPServicesVtbl TextStoreACPServicesVtbl =
|
|
|
|
{
|
|
|
|
TextStoreACPServices_QueryInterface,
|
|
|
|
TextStoreACPServices_AddRef,
|
|
|
|
TextStoreACPServices_Release,
|
|
|
|
TextStoreACPServices_Serialize,
|
|
|
|
TextStoreACPServices_Unserialize,
|
|
|
|
TextStoreACPServices_ForceLoadProperty,
|
|
|
|
TextStoreACPServices_CreateRange
|
|
|
|
};
|
|
|
|
|
2016-03-22 07:09:36 +00:00
|
|
|
HRESULT Context_Constructor(TfClientId tidOwner, IUnknown *punk, ITfDocumentMgr *mgr, ITfContext **ppOut, TfEditCookie *pecTextStore)
|
2009-02-05 20:17:26 +00:00
|
|
|
{
|
2016-03-22 07:09:36 +00:00
|
|
|
Context *This;
|
|
|
|
EditCookie *cookie;
|
2009-02-05 20:17:26 +00:00
|
|
|
|
2016-03-22 07:09:36 +00:00
|
|
|
This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(Context));
|
2009-02-05 20:17:26 +00:00
|
|
|
if (This == NULL)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
2016-03-22 07:09:36 +00:00
|
|
|
cookie = HeapAlloc(GetProcessHeap(),0,sizeof(EditCookie));
|
|
|
|
if (cookie == NULL)
|
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(),0,This);
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
2022-02-15 06:29:05 +00:00
|
|
|
TRACE("(%p) %lx %p %p %p\n",This, tidOwner, punk, ppOut, pecTextStore);
|
2016-03-22 07:09:36 +00:00
|
|
|
|
|
|
|
This->ITfContext_iface.lpVtbl= &ContextVtbl;
|
|
|
|
This->ITfSource_iface.lpVtbl = &ContextSourceVtbl;
|
2019-08-14 08:36:48 +00:00
|
|
|
This->ITfContextOwnerCompositionServices_iface.lpVtbl = &ContextOwnerCompositionServicesVtbl;
|
2016-03-22 07:09:36 +00:00
|
|
|
This->ITfInsertAtSelection_iface.lpVtbl = &InsertAtSelectionVtbl;
|
|
|
|
This->ITfSourceSingle_iface.lpVtbl = &ContextSourceSingleVtbl;
|
|
|
|
This->ITextStoreACPSink_iface.lpVtbl = &TextStoreACPSinkVtbl;
|
2016-03-22 07:09:37 +00:00
|
|
|
This->ITextStoreACPServices_iface.lpVtbl = &TextStoreACPServicesVtbl;
|
2009-02-05 20:17:26 +00:00
|
|
|
This->refCount = 1;
|
2016-03-22 07:09:36 +00:00
|
|
|
This->tidOwner = tidOwner;
|
|
|
|
This->connected = FALSE;
|
|
|
|
This->manager = mgr;
|
|
|
|
|
|
|
|
CompartmentMgr_Constructor((IUnknown*)&This->ITfContext_iface, &IID_IUnknown, (IUnknown**)&This->CompartmentMgr);
|
|
|
|
|
|
|
|
cookie->lockType = TF_ES_READ;
|
|
|
|
cookie->pOwningContext = This;
|
|
|
|
|
|
|
|
if (punk)
|
|
|
|
{
|
|
|
|
IUnknown_QueryInterface(punk, &IID_ITextStoreACP,
|
|
|
|
(LPVOID*)&This->pITextStoreACP);
|
|
|
|
|
|
|
|
IUnknown_QueryInterface(punk, &IID_ITfContextOwnerCompositionSink,
|
|
|
|
(LPVOID*)&This->pITfContextOwnerCompositionSink);
|
2009-02-05 20:17:26 +00:00
|
|
|
|
2016-03-22 07:09:36 +00:00
|
|
|
if (!This->pITextStoreACP && !This->pITfContextOwnerCompositionSink)
|
|
|
|
FIXME("Unhandled pUnk\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
This->defaultCookie = generate_Cookie(COOKIE_MAGIC_EDITCOOKIE,cookie);
|
|
|
|
*pecTextStore = This->defaultCookie;
|
|
|
|
|
|
|
|
list_init(&This->pContextKeyEventSink);
|
|
|
|
list_init(&This->pEditTransactionSink);
|
|
|
|
list_init(&This->pStatusSink);
|
|
|
|
list_init(&This->pTextEditSink);
|
|
|
|
list_init(&This->pTextLayoutSink);
|
2009-02-05 20:17:26 +00:00
|
|
|
|
2016-03-22 07:09:36 +00:00
|
|
|
*ppOut = &This->ITfContext_iface;
|
2013-11-19 12:14:45 +00:00
|
|
|
TRACE("returning %p\n", *ppOut);
|
2016-03-22 07:09:36 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT Context_Initialize(ITfContext *iface, ITfDocumentMgr *manager)
|
|
|
|
{
|
|
|
|
Context *This = impl_from_ITfContext(iface);
|
|
|
|
|
|
|
|
if (This->pITextStoreACP)
|
|
|
|
ITextStoreACP_AdviseSink(This->pITextStoreACP, &IID_ITextStoreACPSink,
|
|
|
|
(IUnknown*)&This->ITextStoreACPSink_iface, TS_AS_ALL_SINKS);
|
|
|
|
This->connected = TRUE;
|
|
|
|
This->manager = manager;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT Context_Uninitialize(ITfContext *iface)
|
|
|
|
{
|
|
|
|
Context *This = impl_from_ITfContext(iface);
|
|
|
|
|
|
|
|
if (This->pITextStoreACP)
|
|
|
|
ITextStoreACP_UnadviseSink(This->pITextStoreACP, (IUnknown*)&This->ITextStoreACPSink_iface);
|
|
|
|
This->connected = FALSE;
|
|
|
|
This->manager = NULL;
|
2009-02-05 20:17:26 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|