Implement EM_GETOLEINTERFACE.
[wine/gsoc_dplay.git] / dlls / riched20 / richole.c
blob1c9e4509a75326aeecdb080d54d590afe903ed93
1 /*
2 * RichEdit GUIDs and OLE interface
4 * Copyright 2004 by Krzysztof Foltman
5 * Copyright 2004 Aric Stewart
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include <stdarg.h>
24 #define NONAMELESSUNION
25 #define NONAMELESSSTRUCT
26 #define COBJMACROS
28 #include "windef.h"
29 #include "winbase.h"
30 #include "wingdi.h"
31 #include "winuser.h"
32 #include "ole2.h"
33 #include "richole.h"
34 #include "wine/debug.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(richedit);
38 typedef struct IRichEditOleImpl {
39 IRichEditOleVtbl *lpVtbl;
40 DWORD ref;
41 } IRichEditOleImpl;
43 /* there is no way to be consistent across different sets of headers - mingw, Wine, Win32 SDK*/
45 /* FIXME: the next 6 lines should be in textserv.h */
46 #define TEXTSERV_GUID(name, l, w1, w2, b1, b2) \
47 GUID name = { l, w1, w2, {b1, b2, 0x00, 0xaa, 0x00, 0x6c, 0xad, 0xc5}}
49 TEXTSERV_GUID(IID_ITextServices, 0x8d33f740, 0xcf58, 0x11ce, 0xa8, 0x9d);
50 TEXTSERV_GUID(IID_ITextHost, 0xc5bdd8d0, 0xd26e, 0x11ce, 0xa8, 0x9e);
51 TEXTSERV_GUID(IID_ITextHost2, 0xc5bdd8d0, 0xd26e, 0x11ce, 0xa8, 0x9e);
53 static HRESULT WINAPI
54 IRichEditOle_fnQueryInterface(IRichEditOle *me, REFIID riid, LPVOID *ppvObj)
56 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
58 TRACE("%p %s\n", This, debugstr_guid(riid) );
60 if (IsEqualGUID(riid, &IID_IUnknown) ||
61 IsEqualGUID(riid, &IID_IRichEditOle))
63 IRichEditOle_AddRef(me);
64 *ppvObj = (LPVOID) This;
65 return S_OK;
68 return E_NOINTERFACE;
71 static ULONG WINAPI
72 IRichEditOle_fnAddRef(IRichEditOle *me)
74 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
75 ULONG ref = InterlockedIncrement( &This->ref );
77 TRACE("%p ref = %lu\n", This, ref);
79 return ref;
82 static ULONG WINAPI
83 IRichEditOle_fnRelease(IRichEditOle *me)
85 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
86 ULONG ref = InterlockedDecrement(&This->ref);
88 TRACE ("%p ref=%lu\n", This, ref);
90 if (!ref)
92 TRACE ("Destroying %p\n", This);
93 HeapFree(GetProcessHeap(),0,This);
95 return ref;
98 static HRESULT WINAPI
99 IRichEditOle_fnActivateAs(IRichEditOle *me, REFCLSID rclsid, REFCLSID rclsidAs)
101 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
102 FIXME("stub %p\n",This);
103 return E_NOTIMPL;
106 static HRESULT WINAPI
107 IRichEditOle_fnContextSensitiveHelp(IRichEditOle *me, BOOL fEnterMode)
109 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
110 FIXME("stub %p\n",This);
111 return E_NOTIMPL;
114 static HRESULT WINAPI
115 IRichEditOle_fnConvertObject(IRichEditOle *me, LONG iob,
116 REFCLSID rclsidNew, LPCSTR lpstrUserTypeNew)
118 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
119 FIXME("stub %p\n",This);
120 return E_NOTIMPL;
123 static HRESULT WINAPI
124 IRichEditOle_fnGetClientSite(IRichEditOle *me,
125 LPOLECLIENTSITE *lplpolesite)
127 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
128 FIXME("stub %p\n",This);
129 return E_NOTIMPL;
132 static HRESULT WINAPI
133 IRichEditOle_fnGetClipboardData(IRichEditOle *me, CHARRANGE *lpchrg,
134 DWORD reco, LPDATAOBJECT *lplpdataobj)
136 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
137 FIXME("stub %p\n",This);
138 return E_NOTIMPL;
141 static LONG WINAPI IRichEditOle_fnGetLinkCount(IRichEditOle *me)
143 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
144 FIXME("stub %p\n",This);
145 return E_NOTIMPL;
148 static HRESULT WINAPI
149 IRichEditOle_fnGetObject(IRichEditOle *me, LONG iob,
150 REOBJECT *lpreobject, DWORD dwFlags)
152 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
153 FIXME("stub %p\n",This);
154 return E_NOTIMPL;
157 static LONG WINAPI
158 IRichEditOle_fnGetObjectCount(IRichEditOle *me)
160 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
161 FIXME("stub %p\n",This);
162 return E_NOTIMPL;
165 static HRESULT WINAPI
166 IRichEditOle_fnHandsOffStorage(IRichEditOle *me, LONG iob)
168 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
169 FIXME("stub %p\n",This);
170 return E_NOTIMPL;
173 static HRESULT WINAPI
174 IRichEditOle_fnImportDataObject(IRichEditOle *me, LPDATAOBJECT lpdataobj,
175 CLIPFORMAT cf, HGLOBAL hMetaPict)
177 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
178 FIXME("stub %p\n",This);
179 return E_NOTIMPL;
182 static HRESULT WINAPI
183 IRichEditOle_fnInPlaceDeactivate(IRichEditOle *me)
185 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
186 FIXME("stub %p\n",This);
187 return E_NOTIMPL;
190 static HRESULT WINAPI
191 IRichEditOle_fnInsertObject(IRichEditOle *me, REOBJECT *lpreobject)
193 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
194 FIXME("stub %p\n",This);
195 return E_NOTIMPL;
198 static HRESULT WINAPI IRichEditOle_fnSaveCompleted(IRichEditOle *me, LONG iob,
199 LPSTORAGE lpstg)
201 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
202 FIXME("stub %p\n",This);
203 return E_NOTIMPL;
206 static HRESULT WINAPI
207 IRichEditOle_fnSetDvaspect(IRichEditOle *me, LONG iob, DWORD dvaspect)
209 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
210 FIXME("stub %p\n",This);
211 return E_NOTIMPL;
214 static HRESULT WINAPI IRichEditOle_fnSetHostNames(IRichEditOle *me,
215 LPCSTR lpstrContainerApp, LPCSTR lpstrContainerObj)
217 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
218 FIXME("stub %p\n",This);
219 return E_NOTIMPL;
222 static HRESULT WINAPI
223 IRichEditOle_fnSetLinkAvailable(IRichEditOle *me, LONG iob, BOOL fAvailable)
225 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
226 FIXME("stub %p\n",This);
227 return E_NOTIMPL;
230 static IRichEditOleVtbl revt = {
231 IRichEditOle_fnQueryInterface,
232 IRichEditOle_fnAddRef,
233 IRichEditOle_fnRelease,
234 IRichEditOle_fnGetClientSite,
235 IRichEditOle_fnGetObjectCount,
236 IRichEditOle_fnGetLinkCount,
237 IRichEditOle_fnGetObject,
238 IRichEditOle_fnInsertObject,
239 IRichEditOle_fnConvertObject,
240 IRichEditOle_fnActivateAs,
241 IRichEditOle_fnSetHostNames,
242 IRichEditOle_fnSetLinkAvailable,
243 IRichEditOle_fnSetDvaspect,
244 IRichEditOle_fnHandsOffStorage,
245 IRichEditOle_fnSaveCompleted,
246 IRichEditOle_fnInPlaceDeactivate,
247 IRichEditOle_fnContextSensitiveHelp,
248 IRichEditOle_fnGetClipboardData,
249 IRichEditOle_fnImportDataObject
252 LRESULT CreateIRichEditOle(LPVOID *ppObj)
254 IRichEditOleImpl *reo;
256 reo = HeapAlloc(GetProcessHeap(), 0, sizeof(IRichEditOleImpl));
257 if (!reo)
258 return 0;
260 reo->lpVtbl = &revt;
261 reo->ref = 1;
262 TRACE("Created %p\n",reo);
263 *ppObj = (LPVOID) reo;
265 return 1;