Updated trace to support VERSIONED_PRINTER.
[wine.git] / dlls / riched20 / richole.c
blobd45741477d68de812fa8be2598882b054f24db5b
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 const IRichEditOleVtbl *lpVtbl;
40 LONG 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;
67 FIXME("%p: unhandled interface %s\n", This, debugstr_guid(riid) );
69 return E_NOINTERFACE;
72 static ULONG WINAPI
73 IRichEditOle_fnAddRef(IRichEditOle *me)
75 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
76 ULONG ref = InterlockedIncrement( &This->ref );
78 TRACE("%p ref = %lu\n", This, ref);
80 return ref;
83 static ULONG WINAPI
84 IRichEditOle_fnRelease(IRichEditOle *me)
86 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
87 ULONG ref = InterlockedDecrement(&This->ref);
89 TRACE ("%p ref=%lu\n", This, ref);
91 if (!ref)
93 TRACE ("Destroying %p\n", This);
94 HeapFree(GetProcessHeap(),0,This);
96 return ref;
99 static HRESULT WINAPI
100 IRichEditOle_fnActivateAs(IRichEditOle *me, REFCLSID rclsid, REFCLSID rclsidAs)
102 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
103 FIXME("stub %p\n",This);
104 return E_NOTIMPL;
107 static HRESULT WINAPI
108 IRichEditOle_fnContextSensitiveHelp(IRichEditOle *me, BOOL fEnterMode)
110 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
111 FIXME("stub %p\n",This);
112 return E_NOTIMPL;
115 static HRESULT WINAPI
116 IRichEditOle_fnConvertObject(IRichEditOle *me, LONG iob,
117 REFCLSID rclsidNew, LPCSTR lpstrUserTypeNew)
119 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
120 FIXME("stub %p\n",This);
121 return E_NOTIMPL;
124 static HRESULT WINAPI
125 IRichEditOle_fnGetClientSite(IRichEditOle *me,
126 LPOLECLIENTSITE *lplpolesite)
128 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
129 FIXME("stub %p\n",This);
130 return E_NOTIMPL;
133 static HRESULT WINAPI
134 IRichEditOle_fnGetClipboardData(IRichEditOle *me, CHARRANGE *lpchrg,
135 DWORD reco, LPDATAOBJECT *lplpdataobj)
137 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
138 FIXME("stub %p\n",This);
139 return E_NOTIMPL;
142 static LONG WINAPI IRichEditOle_fnGetLinkCount(IRichEditOle *me)
144 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
145 FIXME("stub %p\n",This);
146 return E_NOTIMPL;
149 static HRESULT WINAPI
150 IRichEditOle_fnGetObject(IRichEditOle *me, LONG iob,
151 REOBJECT *lpreobject, DWORD dwFlags)
153 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
154 FIXME("stub %p\n",This);
155 return E_NOTIMPL;
158 static LONG WINAPI
159 IRichEditOle_fnGetObjectCount(IRichEditOle *me)
161 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
162 FIXME("stub %p\n",This);
163 return E_NOTIMPL;
166 static HRESULT WINAPI
167 IRichEditOle_fnHandsOffStorage(IRichEditOle *me, LONG iob)
169 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
170 FIXME("stub %p\n",This);
171 return E_NOTIMPL;
174 static HRESULT WINAPI
175 IRichEditOle_fnImportDataObject(IRichEditOle *me, LPDATAOBJECT lpdataobj,
176 CLIPFORMAT cf, HGLOBAL hMetaPict)
178 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
179 FIXME("stub %p\n",This);
180 return E_NOTIMPL;
183 static HRESULT WINAPI
184 IRichEditOle_fnInPlaceDeactivate(IRichEditOle *me)
186 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
187 FIXME("stub %p\n",This);
188 return E_NOTIMPL;
191 static HRESULT WINAPI
192 IRichEditOle_fnInsertObject(IRichEditOle *me, REOBJECT *lpreobject)
194 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
195 FIXME("stub %p\n",This);
196 return E_NOTIMPL;
199 static HRESULT WINAPI IRichEditOle_fnSaveCompleted(IRichEditOle *me, LONG iob,
200 LPSTORAGE lpstg)
202 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
203 FIXME("stub %p\n",This);
204 return E_NOTIMPL;
207 static HRESULT WINAPI
208 IRichEditOle_fnSetDvaspect(IRichEditOle *me, LONG iob, DWORD dvaspect)
210 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
211 FIXME("stub %p\n",This);
212 return E_NOTIMPL;
215 static HRESULT WINAPI IRichEditOle_fnSetHostNames(IRichEditOle *me,
216 LPCSTR lpstrContainerApp, LPCSTR lpstrContainerObj)
218 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
219 FIXME("stub %p %s %s\n",This, lpstrContainerApp, lpstrContainerObj);
220 return E_NOTIMPL;
223 static HRESULT WINAPI
224 IRichEditOle_fnSetLinkAvailable(IRichEditOle *me, LONG iob, BOOL fAvailable)
226 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
227 FIXME("stub %p\n",This);
228 return E_NOTIMPL;
231 static const IRichEditOleVtbl revt = {
232 IRichEditOle_fnQueryInterface,
233 IRichEditOle_fnAddRef,
234 IRichEditOle_fnRelease,
235 IRichEditOle_fnGetClientSite,
236 IRichEditOle_fnGetObjectCount,
237 IRichEditOle_fnGetLinkCount,
238 IRichEditOle_fnGetObject,
239 IRichEditOle_fnInsertObject,
240 IRichEditOle_fnConvertObject,
241 IRichEditOle_fnActivateAs,
242 IRichEditOle_fnSetHostNames,
243 IRichEditOle_fnSetLinkAvailable,
244 IRichEditOle_fnSetDvaspect,
245 IRichEditOle_fnHandsOffStorage,
246 IRichEditOle_fnSaveCompleted,
247 IRichEditOle_fnInPlaceDeactivate,
248 IRichEditOle_fnContextSensitiveHelp,
249 IRichEditOle_fnGetClipboardData,
250 IRichEditOle_fnImportDataObject
253 LRESULT CreateIRichEditOle(LPVOID *ppObj)
255 IRichEditOleImpl *reo;
257 reo = HeapAlloc(GetProcessHeap(), 0, sizeof(IRichEditOleImpl));
258 if (!reo)
259 return 0;
261 reo->lpVtbl = &revt;
262 reo->ref = 1;
263 TRACE("Created %p\n",reo);
264 *ppObj = (LPVOID) reo;
266 return 1;