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
24 #define NONAMELESSUNION
25 #define NONAMELESSSTRUCT
36 #include "wine/debug.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(richedit);
40 /* there is no way to be consistent across different sets of headers - mingw, Wine, Win32 SDK*/
42 /* FIXME: the next 6 lines should be in textserv.h */
44 #define TEXTSERV_GUID(name, l, w1, w2, b1, b2) \
45 DEFINE_GUID(name, l, w1, w2, b1, b2, 0x00, 0xaa, 0x00, 0x6c, 0xad, 0xc5)
47 TEXTSERV_GUID(IID_ITextServices, 0x8d33f740, 0xcf58, 0x11ce, 0xa8, 0x9d);
48 TEXTSERV_GUID(IID_ITextHost, 0xc5bdd8d0, 0xd26e, 0x11ce, 0xa8, 0x9e);
49 TEXTSERV_GUID(IID_ITextHost2, 0xc5bdd8d0, 0xd26e, 0x11ce, 0xa8, 0x9e);
50 DEFINE_GUID(IID_ITextDocument, 0x8cc497c0, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
52 typedef struct IRichEditOleImpl {
53 const IRichEditOleVtbl *lpRichEditOleVtbl;
54 const ITextDocumentVtbl *lpTextDocumentVtbl;
57 ME_TextEditor *editor;
60 static inline IRichEditOleImpl *impl_from_IRichEditOle(IRichEditOle *iface)
62 return (IRichEditOleImpl *)((BYTE*)iface - FIELD_OFFSET(IRichEditOleImpl, lpRichEditOleVtbl));
65 static inline IRichEditOleImpl *impl_from_ITextDocument(ITextDocument *iface)
67 return (IRichEditOleImpl *)((BYTE*)iface - FIELD_OFFSET(IRichEditOleImpl, lpTextDocumentVtbl));
71 IRichEditOle_fnQueryInterface(IRichEditOle *me, REFIID riid, LPVOID *ppvObj)
73 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
75 TRACE("%p %s\n", This, debugstr_guid(riid) );
78 if (IsEqualGUID(riid, &IID_IUnknown) ||
79 IsEqualGUID(riid, &IID_IRichEditOle))
80 *ppvObj = &This->lpRichEditOleVtbl;
81 else if (IsEqualGUID(riid, &IID_ITextDocument))
82 *ppvObj = &This->lpTextDocumentVtbl;
85 IRichEditOle_AddRef(me);
88 FIXME("%p: unhandled interface %s\n", This, debugstr_guid(riid) );
94 IRichEditOle_fnAddRef(IRichEditOle *me)
96 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
97 ULONG ref = InterlockedIncrement( &This->ref );
99 TRACE("%p ref = %u\n", This, ref);
105 IRichEditOle_fnRelease(IRichEditOle *me)
107 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
108 ULONG ref = InterlockedDecrement(&This->ref);
110 TRACE ("%p ref=%u\n", This, ref);
114 TRACE ("Destroying %p\n", This);
120 static HRESULT WINAPI
121 IRichEditOle_fnActivateAs(IRichEditOle *me, REFCLSID rclsid, REFCLSID rclsidAs)
123 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
124 FIXME("stub %p\n",This);
128 static HRESULT WINAPI
129 IRichEditOle_fnContextSensitiveHelp(IRichEditOle *me, BOOL fEnterMode)
131 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
132 FIXME("stub %p\n",This);
136 static HRESULT WINAPI
137 IRichEditOle_fnConvertObject(IRichEditOle *me, LONG iob,
138 REFCLSID rclsidNew, LPCSTR lpstrUserTypeNew)
140 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
141 FIXME("stub %p\n",This);
145 static HRESULT WINAPI
146 IRichEditOle_fnGetClientSite(IRichEditOle *me,
147 LPOLECLIENTSITE *lplpolesite)
149 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
150 FIXME("stub %p\n",This);
154 static HRESULT WINAPI
155 IRichEditOle_fnGetClipboardData(IRichEditOle *me, CHARRANGE *lpchrg,
156 DWORD reco, LPDATAOBJECT *lplpdataobj)
158 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
161 TRACE("(%p,%p,%d)\n",This, lpchrg, reco);
165 ME_GetSelection(This->editor, (int*)&tmpchrg.cpMin, (int*)&tmpchrg.cpMax);
168 return ME_GetDataObject(This->editor, lpchrg, lplpdataobj);
171 static LONG WINAPI IRichEditOle_fnGetLinkCount(IRichEditOle *me)
173 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
174 FIXME("stub %p\n",This);
178 static HRESULT WINAPI
179 IRichEditOle_fnGetObject(IRichEditOle *me, LONG iob,
180 REOBJECT *lpreobject, DWORD dwFlags)
182 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
183 FIXME("stub %p\n",This);
188 IRichEditOle_fnGetObjectCount(IRichEditOle *me)
190 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
191 FIXME("stub %p\n",This);
195 static HRESULT WINAPI
196 IRichEditOle_fnHandsOffStorage(IRichEditOle *me, LONG iob)
198 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
199 FIXME("stub %p\n",This);
203 static HRESULT WINAPI
204 IRichEditOle_fnImportDataObject(IRichEditOle *me, LPDATAOBJECT lpdataobj,
205 CLIPFORMAT cf, HGLOBAL hMetaPict)
207 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
208 FIXME("stub %p\n",This);
212 static HRESULT WINAPI
213 IRichEditOle_fnInPlaceDeactivate(IRichEditOle *me)
215 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
216 FIXME("stub %p\n",This);
220 static HRESULT WINAPI
221 IRichEditOle_fnInsertObject(IRichEditOle *me, REOBJECT *lpreobject)
223 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
224 FIXME("stub %p\n",This);
228 static HRESULT WINAPI IRichEditOle_fnSaveCompleted(IRichEditOle *me, LONG iob,
231 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
232 FIXME("stub %p\n",This);
236 static HRESULT WINAPI
237 IRichEditOle_fnSetDvaspect(IRichEditOle *me, LONG iob, DWORD dvaspect)
239 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
240 FIXME("stub %p\n",This);
244 static HRESULT WINAPI IRichEditOle_fnSetHostNames(IRichEditOle *me,
245 LPCSTR lpstrContainerApp, LPCSTR lpstrContainerObj)
247 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
248 FIXME("stub %p %s %s\n",This, lpstrContainerApp, lpstrContainerObj);
252 static HRESULT WINAPI
253 IRichEditOle_fnSetLinkAvailable(IRichEditOle *me, LONG iob, BOOL fAvailable)
255 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
256 FIXME("stub %p\n",This);
260 static const IRichEditOleVtbl revt = {
261 IRichEditOle_fnQueryInterface,
262 IRichEditOle_fnAddRef,
263 IRichEditOle_fnRelease,
264 IRichEditOle_fnGetClientSite,
265 IRichEditOle_fnGetObjectCount,
266 IRichEditOle_fnGetLinkCount,
267 IRichEditOle_fnGetObject,
268 IRichEditOle_fnInsertObject,
269 IRichEditOle_fnConvertObject,
270 IRichEditOle_fnActivateAs,
271 IRichEditOle_fnSetHostNames,
272 IRichEditOle_fnSetLinkAvailable,
273 IRichEditOle_fnSetDvaspect,
274 IRichEditOle_fnHandsOffStorage,
275 IRichEditOle_fnSaveCompleted,
276 IRichEditOle_fnInPlaceDeactivate,
277 IRichEditOle_fnContextSensitiveHelp,
278 IRichEditOle_fnGetClipboardData,
279 IRichEditOle_fnImportDataObject
282 static HRESULT WINAPI
283 ITextDocument_fnQueryInterface(ITextDocument* me, REFIID riid,
286 IRichEditOleImpl *This = impl_from_ITextDocument(me);
287 return IRichEditOle_fnQueryInterface((IRichEditOle*)&This->lpRichEditOleVtbl,
292 ITextDocument_fnAddRef(ITextDocument* me)
294 IRichEditOleImpl *This = impl_from_ITextDocument(me);
295 return IRichEditOle_fnAddRef((IRichEditOle*)&This->lpRichEditOleVtbl);
299 ITextDocument_fnRelease(ITextDocument* me)
301 IRichEditOleImpl *This = impl_from_ITextDocument(me);
302 return IRichEditOle_fnRelease((IRichEditOle*)&This->lpRichEditOleVtbl);
305 static HRESULT WINAPI
306 ITextDocument_fnGetTypeInfoCount(ITextDocument* me,
309 IRichEditOleImpl *This = impl_from_ITextDocument(me);
310 FIXME("stub %p\n",This);
314 static HRESULT WINAPI
315 ITextDocument_fnGetTypeInfo(ITextDocument* me, UINT iTInfo, LCID lcid,
318 IRichEditOleImpl *This = impl_from_ITextDocument(me);
319 FIXME("stub %p\n",This);
323 static HRESULT WINAPI
324 ITextDocument_fnGetIDsOfNames(ITextDocument* me, REFIID riid,
325 LPOLESTR* rgszNames, UINT cNames, LCID lcid, DISPID* rgDispId)
327 IRichEditOleImpl *This = impl_from_ITextDocument(me);
328 FIXME("stub %p\n",This);
332 static HRESULT WINAPI
333 ITextDocument_fnInvoke(ITextDocument* me, DISPID dispIdMember,
334 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams,
335 VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr)
337 IRichEditOleImpl *This = impl_from_ITextDocument(me);
338 FIXME("stub %p\n",This);
342 static HRESULT WINAPI
343 ITextDocument_fnGetName(ITextDocument* me, BSTR* pName)
345 IRichEditOleImpl *This = impl_from_ITextDocument(me);
346 FIXME("stub %p\n",This);
350 static HRESULT WINAPI
351 ITextDocument_fnGetSelection(ITextDocument* me, ITextSelection** ppSel)
353 IRichEditOleImpl *This = impl_from_ITextDocument(me);
354 FIXME("stub %p\n",This);
358 static HRESULT WINAPI
359 ITextDocument_fnGetStoryCount(ITextDocument* me, long* pCount)
361 IRichEditOleImpl *This = impl_from_ITextDocument(me);
362 FIXME("stub %p\n",This);
366 static HRESULT WINAPI
367 ITextDocument_fnGetStoryRanges(ITextDocument* me,
368 ITextStoryRanges** ppStories)
370 IRichEditOleImpl *This = impl_from_ITextDocument(me);
371 FIXME("stub %p\n",This);
375 static HRESULT WINAPI
376 ITextDocument_fnGetSaved(ITextDocument* me, long* pValue)
378 IRichEditOleImpl *This = impl_from_ITextDocument(me);
379 FIXME("stub %p\n",This);
383 static HRESULT WINAPI
384 ITextDocument_fnSetSaved(ITextDocument* me, long Value)
386 IRichEditOleImpl *This = impl_from_ITextDocument(me);
387 FIXME("stub %p\n",This);
391 static HRESULT WINAPI
392 ITextDocument_fnGetDefaultTabStop(ITextDocument* me, float* pValue)
394 IRichEditOleImpl *This = impl_from_ITextDocument(me);
395 FIXME("stub %p\n",This);
399 static HRESULT WINAPI
400 ITextDocument_fnSetDefaultTabStop(ITextDocument* me, float Value)
402 IRichEditOleImpl *This = impl_from_ITextDocument(me);
403 FIXME("stub %p\n",This);
407 static HRESULT WINAPI
408 ITextDocument_fnNew(ITextDocument* me)
410 IRichEditOleImpl *This = impl_from_ITextDocument(me);
411 FIXME("stub %p\n",This);
415 static HRESULT WINAPI
416 ITextDocument_fnOpen(ITextDocument* me, VARIANT* pVar, long Flags,
419 IRichEditOleImpl *This = impl_from_ITextDocument(me);
420 FIXME("stub %p\n",This);
424 static HRESULT WINAPI
425 ITextDocument_fnSave(ITextDocument* me, VARIANT* pVar, long Flags,
428 IRichEditOleImpl *This = impl_from_ITextDocument(me);
429 FIXME("stub %p\n",This);
433 static HRESULT WINAPI
434 ITextDocument_fnFreeze(ITextDocument* me, long* pCount)
436 IRichEditOleImpl *This = impl_from_ITextDocument(me);
437 FIXME("stub %p\n",This);
441 static HRESULT WINAPI
442 ITextDocument_fnUnfreeze(ITextDocument* me, long* pCount)
444 IRichEditOleImpl *This = impl_from_ITextDocument(me);
445 FIXME("stub %p\n",This);
449 static HRESULT WINAPI
450 ITextDocument_fnBeginEditCollection(ITextDocument* me)
452 IRichEditOleImpl *This = impl_from_ITextDocument(me);
453 FIXME("stub %p\n",This);
457 static HRESULT WINAPI
458 ITextDocument_fnEndEditCollection(ITextDocument* me)
460 IRichEditOleImpl *This = impl_from_ITextDocument(me);
461 FIXME("stub %p\n",This);
465 static HRESULT WINAPI
466 ITextDocument_fnUndo(ITextDocument* me, long Count, long* prop)
468 IRichEditOleImpl *This = impl_from_ITextDocument(me);
469 FIXME("stub %p\n",This);
473 static HRESULT WINAPI
474 ITextDocument_fnRedo(ITextDocument* me, long Count, long* prop)
476 IRichEditOleImpl *This = impl_from_ITextDocument(me);
477 FIXME("stub %p\n",This);
481 static HRESULT WINAPI
482 ITextDocument_fnRange(ITextDocument* me, long cp1, long cp2,
483 ITextRange** ppRange)
485 IRichEditOleImpl *This = impl_from_ITextDocument(me);
486 FIXME("stub %p\n",This);
490 static HRESULT WINAPI
491 ITextDocument_fnRangeFromPoint(ITextDocument* me, long x, long y,
492 ITextRange** ppRange)
494 IRichEditOleImpl *This = impl_from_ITextDocument(me);
495 FIXME("stub %p\n",This);
499 static const ITextDocumentVtbl tdvt = {
500 ITextDocument_fnQueryInterface,
501 ITextDocument_fnAddRef,
502 ITextDocument_fnRelease,
503 ITextDocument_fnGetTypeInfoCount,
504 ITextDocument_fnGetTypeInfo,
505 ITextDocument_fnGetIDsOfNames,
506 ITextDocument_fnInvoke,
507 ITextDocument_fnGetName,
508 ITextDocument_fnGetSelection,
509 ITextDocument_fnGetStoryCount,
510 ITextDocument_fnGetStoryRanges,
511 ITextDocument_fnGetSaved,
512 ITextDocument_fnSetSaved,
513 ITextDocument_fnGetDefaultTabStop,
514 ITextDocument_fnSetDefaultTabStop,
516 ITextDocument_fnOpen,
517 ITextDocument_fnSave,
518 ITextDocument_fnFreeze,
519 ITextDocument_fnUnfreeze,
520 ITextDocument_fnBeginEditCollection,
521 ITextDocument_fnEndEditCollection,
522 ITextDocument_fnUndo,
523 ITextDocument_fnRedo,
524 ITextDocument_fnRange,
525 ITextDocument_fnRangeFromPoint
528 LRESULT CreateIRichEditOle(ME_TextEditor *editor, LPVOID *ppObj)
530 IRichEditOleImpl *reo;
532 reo = richedit_alloc(sizeof(IRichEditOleImpl));
536 reo->lpRichEditOleVtbl = &revt;
537 reo->lpTextDocumentVtbl = &tdvt;
539 reo->editor = editor;
540 TRACE("Created %p\n",reo);
541 *ppObj = (LPVOID) reo;