configure: Make the font warning more explicit about what package is missing.
[wine/multimedia.git] / dlls / riched20 / richole.c
blob53ba71136494287273d7f2418623812f03b2f39b
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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 "editor.h"
35 #include "wine/debug.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(richedit);
39 typedef struct IRichEditOleImpl {
40 const IRichEditOleVtbl *lpVtbl;
41 LONG ref;
43 ME_TextEditor *editor;
44 } IRichEditOleImpl;
46 /* there is no way to be consistent across different sets of headers - mingw, Wine, Win32 SDK*/
48 /* FIXME: the next 6 lines should be in textserv.h */
49 #define TEXTSERV_GUID(name, l, w1, w2, b1, b2) \
50 GUID name = { l, w1, w2, {b1, b2, 0x00, 0xaa, 0x00, 0x6c, 0xad, 0xc5}}
52 TEXTSERV_GUID(IID_ITextServices, 0x8d33f740, 0xcf58, 0x11ce, 0xa8, 0x9d);
53 TEXTSERV_GUID(IID_ITextHost, 0xc5bdd8d0, 0xd26e, 0x11ce, 0xa8, 0x9e);
54 TEXTSERV_GUID(IID_ITextHost2, 0xc5bdd8d0, 0xd26e, 0x11ce, 0xa8, 0x9e);
56 static HRESULT WINAPI
57 IRichEditOle_fnQueryInterface(IRichEditOle *me, REFIID riid, LPVOID *ppvObj)
59 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
61 TRACE("%p %s\n", This, debugstr_guid(riid) );
63 if (IsEqualGUID(riid, &IID_IUnknown) ||
64 IsEqualGUID(riid, &IID_IRichEditOle))
66 IRichEditOle_AddRef(me);
67 *ppvObj = (LPVOID) This;
68 return S_OK;
70 FIXME("%p: unhandled interface %s\n", This, debugstr_guid(riid) );
72 return E_NOINTERFACE;
75 static ULONG WINAPI
76 IRichEditOle_fnAddRef(IRichEditOle *me)
78 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
79 ULONG ref = InterlockedIncrement( &This->ref );
81 TRACE("%p ref = %lu\n", This, ref);
83 return ref;
86 static ULONG WINAPI
87 IRichEditOle_fnRelease(IRichEditOle *me)
89 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
90 ULONG ref = InterlockedDecrement(&This->ref);
92 TRACE ("%p ref=%lu\n", This, ref);
94 if (!ref)
96 TRACE ("Destroying %p\n", This);
97 HeapFree(GetProcessHeap(),0,This);
99 return ref;
102 static HRESULT WINAPI
103 IRichEditOle_fnActivateAs(IRichEditOle *me, REFCLSID rclsid, REFCLSID rclsidAs)
105 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
106 FIXME("stub %p\n",This);
107 return E_NOTIMPL;
110 static HRESULT WINAPI
111 IRichEditOle_fnContextSensitiveHelp(IRichEditOle *me, BOOL fEnterMode)
113 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
114 FIXME("stub %p\n",This);
115 return E_NOTIMPL;
118 static HRESULT WINAPI
119 IRichEditOle_fnConvertObject(IRichEditOle *me, LONG iob,
120 REFCLSID rclsidNew, LPCSTR lpstrUserTypeNew)
122 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
123 FIXME("stub %p\n",This);
124 return E_NOTIMPL;
127 static HRESULT WINAPI
128 IRichEditOle_fnGetClientSite(IRichEditOle *me,
129 LPOLECLIENTSITE *lplpolesite)
131 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
132 FIXME("stub %p\n",This);
133 return E_NOTIMPL;
136 static HRESULT WINAPI
137 IRichEditOle_fnGetClipboardData(IRichEditOle *me, CHARRANGE *lpchrg,
138 DWORD reco, LPDATAOBJECT *lplpdataobj)
140 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
141 CHARRANGE tmpchrg;
143 TRACE("(%p,%p,%ld)\n",This, lpchrg, reco);
144 if(!lplpdataobj)
145 return E_INVALIDARG;
146 if(!lpchrg) {
147 ME_GetSelection(This->editor, (int*)&tmpchrg.cpMin, (int*)&tmpchrg.cpMax);
148 lpchrg = &tmpchrg;
150 return ME_GetDataObject(This->editor, lpchrg, lplpdataobj);
153 static LONG WINAPI IRichEditOle_fnGetLinkCount(IRichEditOle *me)
155 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
156 FIXME("stub %p\n",This);
157 return E_NOTIMPL;
160 static HRESULT WINAPI
161 IRichEditOle_fnGetObject(IRichEditOle *me, LONG iob,
162 REOBJECT *lpreobject, DWORD dwFlags)
164 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
165 FIXME("stub %p\n",This);
166 return E_NOTIMPL;
169 static LONG WINAPI
170 IRichEditOle_fnGetObjectCount(IRichEditOle *me)
172 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
173 FIXME("stub %p\n",This);
174 return E_NOTIMPL;
177 static HRESULT WINAPI
178 IRichEditOle_fnHandsOffStorage(IRichEditOle *me, LONG iob)
180 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
181 FIXME("stub %p\n",This);
182 return E_NOTIMPL;
185 static HRESULT WINAPI
186 IRichEditOle_fnImportDataObject(IRichEditOle *me, LPDATAOBJECT lpdataobj,
187 CLIPFORMAT cf, HGLOBAL hMetaPict)
189 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
190 FIXME("stub %p\n",This);
191 return E_NOTIMPL;
194 static HRESULT WINAPI
195 IRichEditOle_fnInPlaceDeactivate(IRichEditOle *me)
197 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
198 FIXME("stub %p\n",This);
199 return E_NOTIMPL;
202 static HRESULT WINAPI
203 IRichEditOle_fnInsertObject(IRichEditOle *me, REOBJECT *lpreobject)
205 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
206 FIXME("stub %p\n",This);
207 return E_NOTIMPL;
210 static HRESULT WINAPI IRichEditOle_fnSaveCompleted(IRichEditOle *me, LONG iob,
211 LPSTORAGE lpstg)
213 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
214 FIXME("stub %p\n",This);
215 return E_NOTIMPL;
218 static HRESULT WINAPI
219 IRichEditOle_fnSetDvaspect(IRichEditOle *me, LONG iob, DWORD dvaspect)
221 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
222 FIXME("stub %p\n",This);
223 return E_NOTIMPL;
226 static HRESULT WINAPI IRichEditOle_fnSetHostNames(IRichEditOle *me,
227 LPCSTR lpstrContainerApp, LPCSTR lpstrContainerObj)
229 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
230 FIXME("stub %p %s %s\n",This, lpstrContainerApp, lpstrContainerObj);
231 return E_NOTIMPL;
234 static HRESULT WINAPI
235 IRichEditOle_fnSetLinkAvailable(IRichEditOle *me, LONG iob, BOOL fAvailable)
237 IRichEditOleImpl *This = (IRichEditOleImpl *)me;
238 FIXME("stub %p\n",This);
239 return E_NOTIMPL;
242 static const IRichEditOleVtbl revt = {
243 IRichEditOle_fnQueryInterface,
244 IRichEditOle_fnAddRef,
245 IRichEditOle_fnRelease,
246 IRichEditOle_fnGetClientSite,
247 IRichEditOle_fnGetObjectCount,
248 IRichEditOle_fnGetLinkCount,
249 IRichEditOle_fnGetObject,
250 IRichEditOle_fnInsertObject,
251 IRichEditOle_fnConvertObject,
252 IRichEditOle_fnActivateAs,
253 IRichEditOle_fnSetHostNames,
254 IRichEditOle_fnSetLinkAvailable,
255 IRichEditOle_fnSetDvaspect,
256 IRichEditOle_fnHandsOffStorage,
257 IRichEditOle_fnSaveCompleted,
258 IRichEditOle_fnInPlaceDeactivate,
259 IRichEditOle_fnContextSensitiveHelp,
260 IRichEditOle_fnGetClipboardData,
261 IRichEditOle_fnImportDataObject
264 LRESULT CreateIRichEditOle(ME_TextEditor *editor, LPVOID *ppObj)
266 IRichEditOleImpl *reo;
268 reo = HeapAlloc(GetProcessHeap(), 0, sizeof(IRichEditOleImpl));
269 if (!reo)
270 return 0;
272 reo->lpVtbl = &revt;
273 reo->ref = 1;
274 reo->editor = editor;
275 TRACE("Created %p\n",reo);
276 *ppObj = (LPVOID) reo;
278 return 1;