msctf: Implement stub ITfContext.
[wine/multimedia.git] / dlls / msctf / documentmgr.c
blob6245037051cfe4215b306ea6e8c323f3a4b8e311
1 /*
2 * ITfDocumentMgr implementation
4 * Copyright 2009 Aric Stewart, CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "config.h"
23 #include <stdarg.h>
25 #define COBJMACROS
27 #include "wine/debug.h"
28 #include "windef.h"
29 #include "winbase.h"
30 #include "winreg.h"
31 #include "winuser.h"
32 #include "shlwapi.h"
33 #include "winerror.h"
34 #include "objbase.h"
36 #include "wine/unicode.h"
38 #include "msctf.h"
39 #include "msctf_internal.h"
41 WINE_DEFAULT_DEBUG_CHANNEL(msctf);
43 typedef struct tagDocumentMgr {
44 const ITfDocumentMgrVtbl *DocumentMgrVtbl;
45 LONG refCount;
46 } DocumentMgr;
48 static void DocumentMgr_Destructor(DocumentMgr *This)
50 TRACE("destroying %p\n", This);
51 HeapFree(GetProcessHeap(),0,This);
54 static HRESULT WINAPI DocumentMgr_QueryInterface(ITfDocumentMgr *iface, REFIID iid, LPVOID *ppvOut)
56 DocumentMgr *This = (DocumentMgr *)iface;
57 *ppvOut = NULL;
59 if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfDocumentMgr))
61 *ppvOut = This;
64 if (*ppvOut)
66 IUnknown_AddRef(iface);
67 return S_OK;
70 WARN("unsupported interface: %s\n", debugstr_guid(iid));
71 return E_NOINTERFACE;
74 static ULONG WINAPI DocumentMgr_AddRef(ITfDocumentMgr *iface)
76 DocumentMgr *This = (DocumentMgr *)iface;
77 return InterlockedIncrement(&This->refCount);
80 static ULONG WINAPI DocumentMgr_Release(ITfDocumentMgr *iface)
82 DocumentMgr *This = (DocumentMgr *)iface;
83 ULONG ret;
85 ret = InterlockedDecrement(&This->refCount);
86 if (ret == 0)
87 DocumentMgr_Destructor(This);
88 return ret;
91 /*****************************************************
92 * ITfDocumentMgr functions
93 *****************************************************/
94 static HRESULT WINAPI DocumentMgr_CreateContext(ITfDocumentMgr *iface,
95 TfClientId tidOwner,
96 DWORD dwFlags, IUnknown *punk, ITfContext **ppic,
97 TfEditCookie *pecTextStore)
99 DocumentMgr *This = (DocumentMgr *)iface;
100 TRACE("(%p) 0x%x 0x%x %p %p %p\n",This,tidOwner,dwFlags,punk,ppic,pecTextStore);
101 return Context_Constructor(tidOwner, punk, ppic, pecTextStore);
104 static HRESULT WINAPI DocumentMgr_Push(ITfDocumentMgr *iface, ITfContext *pic)
106 DocumentMgr *This = (DocumentMgr *)iface;
107 FIXME("STUB:(%p)\n",This);
108 return E_NOTIMPL;
111 static HRESULT WINAPI DocumentMgr_Pop(ITfDocumentMgr *iface, DWORD dwFlags)
113 DocumentMgr *This = (DocumentMgr *)iface;
114 FIXME("STUB:(%p)\n",This);
115 return E_NOTIMPL;
118 static HRESULT WINAPI DocumentMgr_GetTop(ITfDocumentMgr *iface, ITfContext **ppic)
120 DocumentMgr *This = (DocumentMgr *)iface;
121 FIXME("STUB:(%p)\n",This);
122 return E_NOTIMPL;
125 static HRESULT WINAPI DocumentMgr_GetBase(ITfDocumentMgr *iface, ITfContext **ppic)
127 DocumentMgr *This = (DocumentMgr *)iface;
128 FIXME("STUB:(%p)\n",This);
129 return E_NOTIMPL;
132 static HRESULT WINAPI DocumentMgr_EnumContexts(ITfDocumentMgr *iface, IEnumTfContexts **ppEnum)
134 DocumentMgr *This = (DocumentMgr *)iface;
135 FIXME("STUB:(%p)\n",This);
136 return E_NOTIMPL;
139 static const ITfDocumentMgrVtbl DocumentMgr_DocumentMgrVtbl =
141 DocumentMgr_QueryInterface,
142 DocumentMgr_AddRef,
143 DocumentMgr_Release,
145 DocumentMgr_CreateContext,
146 DocumentMgr_Push,
147 DocumentMgr_Pop,
148 DocumentMgr_GetTop,
149 DocumentMgr_GetBase,
150 DocumentMgr_EnumContexts
153 HRESULT DocumentMgr_Constructor(ITfDocumentMgr **ppOut)
155 DocumentMgr *This;
157 This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(DocumentMgr));
158 if (This == NULL)
159 return E_OUTOFMEMORY;
161 This->DocumentMgrVtbl= &DocumentMgr_DocumentMgrVtbl;
162 This->refCount = 1;
164 TRACE("returning %p\n", This);
165 *ppOut = (ITfDocumentMgr*)This;
166 return S_OK;