msctf: Implement stub ITfContext.
diff --git a/dlls/msctf/Makefile.in b/dlls/msctf/Makefile.in
index a629554..cdb51d8 100644
--- a/dlls/msctf/Makefile.in
+++ b/dlls/msctf/Makefile.in
@@ -6,6 +6,7 @@
IMPORTS = uuid ole32 user32 advapi32 kernel32 ntdll
C_SRCS = \
+ context.c \
documentmgr.c \
msctf.c \
regsvr.c \
diff --git a/dlls/msctf/context.c b/dlls/msctf/context.c
new file mode 100644
index 0000000..696db65
--- /dev/null
+++ b/dlls/msctf/context.c
@@ -0,0 +1,262 @@
+/*
+ * 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 "config.h"
+
+#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"
+
+#include "wine/unicode.h"
+
+#include "msctf.h"
+#include "msctf_internal.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(msctf);
+
+typedef struct tagContext {
+ const ITfContextVtbl *ContextVtbl;
+ LONG refCount;
+
+ TfClientId tidOwner;
+ IUnknown *punk; /* possible ITextStoreACP or ITfContextOwnerCompositionSink */
+} Context;
+
+static void Context_Destructor(Context *This)
+{
+ TRACE("destroying %p\n", This);
+ HeapFree(GetProcessHeap(),0,This);
+}
+
+static HRESULT WINAPI Context_QueryInterface(ITfContext *iface, REFIID iid, LPVOID *ppvOut)
+{
+ Context *This = (Context *)iface;
+ *ppvOut = NULL;
+
+ if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfContext))
+ {
+ *ppvOut = This;
+ }
+
+ if (*ppvOut)
+ {
+ IUnknown_AddRef(iface);
+ return S_OK;
+ }
+
+ WARN("unsupported interface: %s\n", debugstr_guid(iid));
+ return E_NOINTERFACE;
+}
+
+static ULONG WINAPI Context_AddRef(ITfContext *iface)
+{
+ Context *This = (Context *)iface;
+ return InterlockedIncrement(&This->refCount);
+}
+
+static ULONG WINAPI Context_Release(ITfContext *iface)
+{
+ Context *This = (Context *)iface;
+ 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)
+{
+ Context *This = (Context *)iface;
+ FIXME("STUB:(%p)\n",This);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Context_InWriteSession (ITfContext *iface,
+ TfClientId tid,
+ BOOL *pfWriteSession)
+{
+ Context *This = (Context *)iface;
+ 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)
+{
+ Context *This = (Context *)iface;
+ FIXME("STUB:(%p)\n",This);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Context_SetSelection (ITfContext *iface,
+ TfEditCookie ec, ULONG ulCount, const TF_SELECTION *pSelection)
+{
+ Context *This = (Context *)iface;
+ FIXME("STUB:(%p)\n",This);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Context_GetStart (ITfContext *iface,
+ TfEditCookie ec, ITfRange **ppStart)
+{
+ Context *This = (Context *)iface;
+ FIXME("STUB:(%p)\n",This);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Context_GetEnd (ITfContext *iface,
+ TfEditCookie ec, ITfRange **ppEnd)
+{
+ Context *This = (Context *)iface;
+ FIXME("STUB:(%p)\n",This);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Context_GetActiveView (ITfContext *iface,
+ ITfContextView **ppView)
+{
+ Context *This = (Context *)iface;
+ FIXME("STUB:(%p)\n",This);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Context_EnumViews (ITfContext *iface,
+ IEnumTfContextViews **ppEnum)
+{
+ Context *This = (Context *)iface;
+ FIXME("STUB:(%p)\n",This);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Context_GetStatus (ITfContext *iface,
+ TF_STATUS *pdcs)
+{
+ Context *This = (Context *)iface;
+ FIXME("STUB:(%p)\n",This);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Context_GetProperty (ITfContext *iface,
+ REFGUID guidProp, ITfProperty **ppProp)
+{
+ Context *This = (Context *)iface;
+ FIXME("STUB:(%p)\n",This);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Context_GetAppProperty (ITfContext *iface,
+ REFGUID guidProp, ITfReadOnlyProperty **ppProp)
+{
+ Context *This = (Context *)iface;
+ 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)
+{
+ Context *This = (Context *)iface;
+ FIXME("STUB:(%p)\n",This);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Context_EnumProperties (ITfContext *iface,
+ IEnumTfProperties **ppEnum)
+{
+ Context *This = (Context *)iface;
+ FIXME("STUB:(%p)\n",This);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Context_GetDocumentMgr (ITfContext *iface,
+ ITfDocumentMgr **ppDm)
+{
+ Context *This = (Context *)iface;
+ FIXME("STUB:(%p)\n",This);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Context_CreateRangeBackup (ITfContext *iface,
+ TfEditCookie ec, ITfRange *pRange, ITfRangeBackup **ppBackup)
+{
+ Context *This = (Context *)iface;
+ FIXME("STUB:(%p)\n",This);
+ return E_NOTIMPL;
+}
+
+static const ITfContextVtbl Context_ContextVtbl =
+{
+ 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
+};
+
+HRESULT Context_Constructor(TfClientId tidOwner, IUnknown *punk, ITfContext **ppOut, TfEditCookie *pecTextStore)
+{
+ Context *This;
+
+ This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(Context));
+ if (This == NULL)
+ return E_OUTOFMEMORY;
+
+ This->ContextVtbl= &Context_ContextVtbl;
+ This->refCount = 1;
+ This->tidOwner = tidOwner;
+ This->punk = punk;
+
+ TRACE("returning %p\n", This);
+ *ppOut = (ITfContext*)This;
+ /* FIXME */
+ *pecTextStore = 0xdeaddead;
+ return S_OK;
+}
diff --git a/dlls/msctf/documentmgr.c b/dlls/msctf/documentmgr.c
index fe02320..6245037 100644
--- a/dlls/msctf/documentmgr.c
+++ b/dlls/msctf/documentmgr.c
@@ -97,8 +97,8 @@
TfEditCookie *pecTextStore)
{
DocumentMgr *This = (DocumentMgr *)iface;
- FIXME("STUB:(%p)\n",This);
- return E_NOTIMPL;
+ TRACE("(%p) 0x%x 0x%x %p %p %p\n",This,tidOwner,dwFlags,punk,ppic,pecTextStore);
+ return Context_Constructor(tidOwner, punk, ppic, pecTextStore);
}
static HRESULT WINAPI DocumentMgr_Push(ITfDocumentMgr *iface, ITfContext *pic)
diff --git a/dlls/msctf/msctf_internal.h b/dlls/msctf/msctf_internal.h
index fa4a6ef..347c475 100644
--- a/dlls/msctf/msctf_internal.h
+++ b/dlls/msctf/msctf_internal.h
@@ -24,5 +24,6 @@
extern HRESULT ThreadMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut);
extern HRESULT DocumentMgr_Constructor(ITfDocumentMgr **ppOut);
+extern HRESULT Context_Constructor(TfClientId tidOwner, IUnknown *punk, ITfContext **ppOut, TfEditCookie *pecTextStore);
#endif /* __WINE_MSCTF_I_H */