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
27 #include "wine/debug.h"
36 #include "wine/unicode.h"
39 #include "msctf_internal.h"
41 WINE_DEFAULT_DEBUG_CHANNEL(msctf
);
43 typedef struct tagDocumentMgr
{
44 const ITfDocumentMgrVtbl
*DocumentMgrVtbl
;
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
;
59 if (IsEqualIID(iid
, &IID_IUnknown
) || IsEqualIID(iid
, &IID_ITfDocumentMgr
))
66 IUnknown_AddRef(iface
);
70 WARN("unsupported interface: %s\n", debugstr_guid(iid
));
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
;
85 ret
= InterlockedDecrement(&This
->refCount
);
87 DocumentMgr_Destructor(This
);
91 /*****************************************************
92 * ITfDocumentMgr functions
93 *****************************************************/
94 static HRESULT WINAPI
DocumentMgr_CreateContext(ITfDocumentMgr
*iface
,
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
);
111 static HRESULT WINAPI
DocumentMgr_Pop(ITfDocumentMgr
*iface
, DWORD dwFlags
)
113 DocumentMgr
*This
= (DocumentMgr
*)iface
;
114 FIXME("STUB:(%p)\n",This
);
118 static HRESULT WINAPI
DocumentMgr_GetTop(ITfDocumentMgr
*iface
, ITfContext
**ppic
)
120 DocumentMgr
*This
= (DocumentMgr
*)iface
;
121 FIXME("STUB:(%p)\n",This
);
125 static HRESULT WINAPI
DocumentMgr_GetBase(ITfDocumentMgr
*iface
, ITfContext
**ppic
)
127 DocumentMgr
*This
= (DocumentMgr
*)iface
;
128 FIXME("STUB:(%p)\n",This
);
132 static HRESULT WINAPI
DocumentMgr_EnumContexts(ITfDocumentMgr
*iface
, IEnumTfContexts
**ppEnum
)
134 DocumentMgr
*This
= (DocumentMgr
*)iface
;
135 FIXME("STUB:(%p)\n",This
);
139 static const ITfDocumentMgrVtbl DocumentMgr_DocumentMgrVtbl
=
141 DocumentMgr_QueryInterface
,
145 DocumentMgr_CreateContext
,
150 DocumentMgr_EnumContexts
153 HRESULT
DocumentMgr_Constructor(ITfDocumentMgr
**ppOut
)
157 This
= HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY
,sizeof(DocumentMgr
));
159 return E_OUTOFMEMORY
;
161 This
->DocumentMgrVtbl
= &DocumentMgr_DocumentMgrVtbl
;
164 TRACE("returning %p\n", This
);
165 *ppOut
= (ITfDocumentMgr
*)This
;