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);
51 DEFINE_GUID(IID_ITextRange, 0x8cc497c2, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
52 DEFINE_GUID(IID_ITextSelection, 0x8cc497c1, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
54 typedef struct ITextSelectionImpl ITextSelectionImpl;
55 typedef struct IOleClientSiteImpl IOleClientSiteImpl;
57 typedef struct IRichEditOleImpl {
58 const IRichEditOleVtbl *lpRichEditOleVtbl;
59 const ITextDocumentVtbl *lpTextDocumentVtbl;
62 ME_TextEditor *editor;
63 ITextSelectionImpl *txtSel;
64 IOleClientSiteImpl *clientSite;
67 struct ITextSelectionImpl {
68 const ITextSelectionVtbl *lpVtbl;
71 IRichEditOleImpl *reOle;
74 struct IOleClientSiteImpl {
75 const IOleClientSiteVtbl *lpVtbl;
78 IRichEditOleImpl *reOle;
81 static inline IRichEditOleImpl *impl_from_IRichEditOle(IRichEditOle *iface)
83 return (IRichEditOleImpl *)((BYTE*)iface - FIELD_OFFSET(IRichEditOleImpl, lpRichEditOleVtbl));
86 static inline IRichEditOleImpl *impl_from_ITextDocument(ITextDocument *iface)
88 return (IRichEditOleImpl *)((BYTE*)iface - FIELD_OFFSET(IRichEditOleImpl, lpTextDocumentVtbl));
92 IRichEditOle_fnQueryInterface(IRichEditOle *me, REFIID riid, LPVOID *ppvObj)
94 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
96 TRACE("%p %s\n", This, debugstr_guid(riid) );
99 if (IsEqualGUID(riid, &IID_IUnknown) ||
100 IsEqualGUID(riid, &IID_IRichEditOle))
101 *ppvObj = &This->lpRichEditOleVtbl;
102 else if (IsEqualGUID(riid, &IID_ITextDocument))
103 *ppvObj = &This->lpTextDocumentVtbl;
106 IRichEditOle_AddRef(me);
109 FIXME("%p: unhandled interface %s\n", This, debugstr_guid(riid) );
111 return E_NOINTERFACE;
115 IRichEditOle_fnAddRef(IRichEditOle *me)
117 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
118 ULONG ref = InterlockedIncrement( &This->ref );
120 TRACE("%p ref = %u\n", This, ref);
126 IRichEditOle_fnRelease(IRichEditOle *me)
128 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
129 ULONG ref = InterlockedDecrement(&This->ref);
131 TRACE ("%p ref=%u\n", This, ref);
135 TRACE ("Destroying %p\n", This);
136 This->txtSel->reOle = NULL;
137 ITextSelection_Release((ITextSelection *) This->txtSel);
138 IOleClientSite_Release((IOleClientSite *) This->clientSite);
144 static HRESULT WINAPI
145 IRichEditOle_fnActivateAs(IRichEditOle *me, REFCLSID rclsid, REFCLSID rclsidAs)
147 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
148 FIXME("stub %p\n",This);
152 static HRESULT WINAPI
153 IRichEditOle_fnContextSensitiveHelp(IRichEditOle *me, BOOL fEnterMode)
155 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
156 FIXME("stub %p\n",This);
160 static HRESULT WINAPI
161 IRichEditOle_fnConvertObject(IRichEditOle *me, LONG iob,
162 REFCLSID rclsidNew, LPCSTR lpstrUserTypeNew)
164 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
165 FIXME("stub %p\n",This);
169 static HRESULT WINAPI
170 IOleClientSite_fnQueryInterface(IOleClientSite *me, REFIID riid, LPVOID *ppvObj)
172 TRACE("%p %s\n", me, debugstr_guid(riid) );
175 if (IsEqualGUID(riid, &IID_IUnknown) ||
176 IsEqualGUID(riid, &IID_IOleClientSite))
180 IOleClientSite_AddRef(me);
183 FIXME("%p: unhandled interface %s\n", me, debugstr_guid(riid) );
185 return E_NOINTERFACE;
189 IOleClientSite_fnAddRef(IOleClientSite *me)
191 IOleClientSiteImpl *This = (IOleClientSiteImpl *) me;
192 return InterlockedIncrement(&This->ref);
196 IOleClientSite_fnRelease(IOleClientSite *me)
198 IOleClientSiteImpl *This = (IOleClientSiteImpl *) me;
199 ULONG ref = InterlockedDecrement(&This->ref);
205 static HRESULT WINAPI
206 IOleClientSite_fnSaveObject(IOleClientSite *me)
208 IOleClientSiteImpl *This = (IOleClientSiteImpl *) me;
210 return CO_E_RELEASED;
212 FIXME("stub %p\n",me);
217 static HRESULT WINAPI
218 IOleClientSite_fnGetMoniker(IOleClientSite *me, DWORD dwAssign, DWORD dwWhichMoniker,
221 IOleClientSiteImpl *This = (IOleClientSiteImpl *) me;
223 return CO_E_RELEASED;
225 FIXME("stub %p\n",me);
229 static HRESULT WINAPI
230 IOleClientSite_fnGetContainer(IOleClientSite *me, IOleContainer **ppContainer)
232 IOleClientSiteImpl *This = (IOleClientSiteImpl *) me;
234 return CO_E_RELEASED;
236 FIXME("stub %p\n",me);
240 static HRESULT WINAPI
241 IOleClientSite_fnShowObject(IOleClientSite *me)
243 IOleClientSiteImpl *This = (IOleClientSiteImpl *) me;
245 return CO_E_RELEASED;
247 FIXME("stub %p\n",me);
251 static HRESULT WINAPI
252 IOleClientSite_fnOnShowWindow(IOleClientSite *me, BOOL fShow)
254 IOleClientSiteImpl *This = (IOleClientSiteImpl *) me;
256 return CO_E_RELEASED;
258 FIXME("stub %p\n",me);
262 static HRESULT WINAPI
263 IOleClientSite_fnRequestNewObjectLayout(IOleClientSite *me)
265 IOleClientSiteImpl *This = (IOleClientSiteImpl *) me;
267 return CO_E_RELEASED;
269 FIXME("stub %p\n",me);
273 static const IOleClientSiteVtbl ocst = {
274 IOleClientSite_fnQueryInterface,
275 IOleClientSite_fnAddRef,
276 IOleClientSite_fnRelease,
277 IOleClientSite_fnSaveObject,
278 IOleClientSite_fnGetMoniker,
279 IOleClientSite_fnGetContainer,
280 IOleClientSite_fnShowObject,
281 IOleClientSite_fnOnShowWindow,
282 IOleClientSite_fnRequestNewObjectLayout
285 static IOleClientSiteImpl *
286 CreateOleClientSite(IRichEditOleImpl *reOle)
288 IOleClientSiteImpl *clientSite = heap_alloc(sizeof *clientSite);
292 clientSite->lpVtbl = &ocst;
294 clientSite->reOle = reOle;
298 static HRESULT WINAPI
299 IRichEditOle_fnGetClientSite(IRichEditOle *me,
300 LPOLECLIENTSITE *lplpolesite)
302 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
304 TRACE("%p,%p\n",This, lplpolesite);
308 *lplpolesite = (IOleClientSite *) This->clientSite;
309 IOleClientSite_fnAddRef(*lplpolesite);
313 static HRESULT WINAPI
314 IRichEditOle_fnGetClipboardData(IRichEditOle *me, CHARRANGE *lpchrg,
315 DWORD reco, LPDATAOBJECT *lplpdataobj)
317 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
320 TRACE("(%p,%p,%d)\n",This, lpchrg, reco);
324 ME_GetSelection(This->editor, &tmpchrg.cpMin, &tmpchrg.cpMax);
327 return ME_GetDataObject(This->editor, lpchrg, lplpdataobj);
330 static LONG WINAPI IRichEditOle_fnGetLinkCount(IRichEditOle *me)
332 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
333 FIXME("stub %p\n",This);
337 static HRESULT WINAPI
338 IRichEditOle_fnGetObject(IRichEditOle *me, LONG iob,
339 REOBJECT *lpreobject, DWORD dwFlags)
341 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
342 FIXME("stub %p\n",This);
347 IRichEditOle_fnGetObjectCount(IRichEditOle *me)
349 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
350 FIXME("stub %p\n",This);
354 static HRESULT WINAPI
355 IRichEditOle_fnHandsOffStorage(IRichEditOle *me, LONG iob)
357 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
358 FIXME("stub %p\n",This);
362 static HRESULT WINAPI
363 IRichEditOle_fnImportDataObject(IRichEditOle *me, LPDATAOBJECT lpdataobj,
364 CLIPFORMAT cf, HGLOBAL hMetaPict)
366 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
367 FIXME("stub %p\n",This);
371 static HRESULT WINAPI
372 IRichEditOle_fnInPlaceDeactivate(IRichEditOle *me)
374 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
375 FIXME("stub %p\n",This);
379 static HRESULT WINAPI
380 IRichEditOle_fnInsertObject(IRichEditOle *me, REOBJECT *reo)
382 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
383 TRACE("(%p,%p)\n", This, reo);
385 if (reo->cbStruct < sizeof(*reo)) return STG_E_INVALIDPARAMETER;
386 if (reo->poleobj) IOleObject_AddRef(reo->poleobj);
387 if (reo->pstg) IStorage_AddRef(reo->pstg);
388 if (reo->polesite) IOleClientSite_AddRef(reo->polesite);
390 ME_InsertOLEFromCursor(This->editor, reo, 0);
394 static HRESULT WINAPI IRichEditOle_fnSaveCompleted(IRichEditOle *me, LONG iob,
397 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
398 FIXME("stub %p\n",This);
402 static HRESULT WINAPI
403 IRichEditOle_fnSetDvaspect(IRichEditOle *me, LONG iob, DWORD dvaspect)
405 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
406 FIXME("stub %p\n",This);
410 static HRESULT WINAPI IRichEditOle_fnSetHostNames(IRichEditOle *me,
411 LPCSTR lpstrContainerApp, LPCSTR lpstrContainerObj)
413 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
414 FIXME("stub %p %s %s\n",This, lpstrContainerApp, lpstrContainerObj);
418 static HRESULT WINAPI
419 IRichEditOle_fnSetLinkAvailable(IRichEditOle *me, LONG iob, BOOL fAvailable)
421 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
422 FIXME("stub %p\n",This);
426 static const IRichEditOleVtbl revt = {
427 IRichEditOle_fnQueryInterface,
428 IRichEditOle_fnAddRef,
429 IRichEditOle_fnRelease,
430 IRichEditOle_fnGetClientSite,
431 IRichEditOle_fnGetObjectCount,
432 IRichEditOle_fnGetLinkCount,
433 IRichEditOle_fnGetObject,
434 IRichEditOle_fnInsertObject,
435 IRichEditOle_fnConvertObject,
436 IRichEditOle_fnActivateAs,
437 IRichEditOle_fnSetHostNames,
438 IRichEditOle_fnSetLinkAvailable,
439 IRichEditOle_fnSetDvaspect,
440 IRichEditOle_fnHandsOffStorage,
441 IRichEditOle_fnSaveCompleted,
442 IRichEditOle_fnInPlaceDeactivate,
443 IRichEditOle_fnContextSensitiveHelp,
444 IRichEditOle_fnGetClipboardData,
445 IRichEditOle_fnImportDataObject
448 static HRESULT WINAPI
449 ITextDocument_fnQueryInterface(ITextDocument* me, REFIID riid,
452 IRichEditOleImpl *This = impl_from_ITextDocument(me);
453 return IRichEditOle_fnQueryInterface((IRichEditOle*)&This->lpRichEditOleVtbl,
458 ITextDocument_fnAddRef(ITextDocument* me)
460 IRichEditOleImpl *This = impl_from_ITextDocument(me);
461 return IRichEditOle_fnAddRef((IRichEditOle*)&This->lpRichEditOleVtbl);
465 ITextDocument_fnRelease(ITextDocument* me)
467 IRichEditOleImpl *This = impl_from_ITextDocument(me);
468 return IRichEditOle_fnRelease((IRichEditOle*)&This->lpRichEditOleVtbl);
471 static HRESULT WINAPI
472 ITextDocument_fnGetTypeInfoCount(ITextDocument* me,
475 IRichEditOleImpl *This = impl_from_ITextDocument(me);
476 FIXME("stub %p\n",This);
480 static HRESULT WINAPI
481 ITextDocument_fnGetTypeInfo(ITextDocument* me, UINT iTInfo, LCID lcid,
484 IRichEditOleImpl *This = impl_from_ITextDocument(me);
485 FIXME("stub %p\n",This);
489 static HRESULT WINAPI
490 ITextDocument_fnGetIDsOfNames(ITextDocument* me, REFIID riid,
491 LPOLESTR* rgszNames, UINT cNames, LCID lcid, DISPID* rgDispId)
493 IRichEditOleImpl *This = impl_from_ITextDocument(me);
494 FIXME("stub %p\n",This);
498 static HRESULT WINAPI
499 ITextDocument_fnInvoke(ITextDocument* me, DISPID dispIdMember,
500 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams,
501 VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr)
503 IRichEditOleImpl *This = impl_from_ITextDocument(me);
504 FIXME("stub %p\n",This);
508 static HRESULT WINAPI
509 ITextDocument_fnGetName(ITextDocument* me, BSTR* pName)
511 IRichEditOleImpl *This = impl_from_ITextDocument(me);
512 FIXME("stub %p\n",This);
516 static HRESULT WINAPI
517 ITextDocument_fnGetSelection(ITextDocument* me, ITextSelection** ppSel)
519 IRichEditOleImpl *This = impl_from_ITextDocument(me);
521 *ppSel = (ITextSelection *) This->txtSel;
522 ITextSelection_AddRef(*ppSel);
526 static HRESULT WINAPI
527 ITextDocument_fnGetStoryCount(ITextDocument* me, LONG* pCount)
529 IRichEditOleImpl *This = impl_from_ITextDocument(me);
530 FIXME("stub %p\n",This);
534 static HRESULT WINAPI
535 ITextDocument_fnGetStoryRanges(ITextDocument* me,
536 ITextStoryRanges** ppStories)
538 IRichEditOleImpl *This = impl_from_ITextDocument(me);
539 FIXME("stub %p\n",This);
543 static HRESULT WINAPI
544 ITextDocument_fnGetSaved(ITextDocument* me, LONG* pValue)
546 IRichEditOleImpl *This = impl_from_ITextDocument(me);
547 FIXME("stub %p\n",This);
551 static HRESULT WINAPI
552 ITextDocument_fnSetSaved(ITextDocument* me, LONG Value)
554 IRichEditOleImpl *This = impl_from_ITextDocument(me);
555 FIXME("stub %p\n",This);
559 static HRESULT WINAPI
560 ITextDocument_fnGetDefaultTabStop(ITextDocument* me, float* pValue)
562 IRichEditOleImpl *This = impl_from_ITextDocument(me);
563 FIXME("stub %p\n",This);
567 static HRESULT WINAPI
568 ITextDocument_fnSetDefaultTabStop(ITextDocument* me, float Value)
570 IRichEditOleImpl *This = impl_from_ITextDocument(me);
571 FIXME("stub %p\n",This);
575 static HRESULT WINAPI
576 ITextDocument_fnNew(ITextDocument* me)
578 IRichEditOleImpl *This = impl_from_ITextDocument(me);
579 FIXME("stub %p\n",This);
583 static HRESULT WINAPI
584 ITextDocument_fnOpen(ITextDocument* me, VARIANT* pVar, LONG Flags,
587 IRichEditOleImpl *This = impl_from_ITextDocument(me);
588 FIXME("stub %p\n",This);
592 static HRESULT WINAPI
593 ITextDocument_fnSave(ITextDocument* me, VARIANT* pVar, LONG Flags,
596 IRichEditOleImpl *This = impl_from_ITextDocument(me);
597 FIXME("stub %p\n",This);
601 static HRESULT WINAPI
602 ITextDocument_fnFreeze(ITextDocument* me, LONG* pCount)
604 IRichEditOleImpl *This = impl_from_ITextDocument(me);
605 FIXME("stub %p\n",This);
609 static HRESULT WINAPI
610 ITextDocument_fnUnfreeze(ITextDocument* me, LONG* pCount)
612 IRichEditOleImpl *This = impl_from_ITextDocument(me);
613 FIXME("stub %p\n",This);
617 static HRESULT WINAPI
618 ITextDocument_fnBeginEditCollection(ITextDocument* me)
620 IRichEditOleImpl *This = impl_from_ITextDocument(me);
621 FIXME("stub %p\n",This);
625 static HRESULT WINAPI
626 ITextDocument_fnEndEditCollection(ITextDocument* me)
628 IRichEditOleImpl *This = impl_from_ITextDocument(me);
629 FIXME("stub %p\n",This);
633 static HRESULT WINAPI
634 ITextDocument_fnUndo(ITextDocument* me, LONG Count, LONG* prop)
636 IRichEditOleImpl *This = impl_from_ITextDocument(me);
637 FIXME("stub %p\n",This);
641 static HRESULT WINAPI
642 ITextDocument_fnRedo(ITextDocument* me, LONG Count, LONG* prop)
644 IRichEditOleImpl *This = impl_from_ITextDocument(me);
645 FIXME("stub %p\n",This);
649 static HRESULT WINAPI
650 ITextDocument_fnRange(ITextDocument* me, LONG cp1, LONG cp2,
651 ITextRange** ppRange)
653 IRichEditOleImpl *This = impl_from_ITextDocument(me);
654 FIXME("stub %p\n",This);
658 static HRESULT WINAPI
659 ITextDocument_fnRangeFromPoint(ITextDocument* me, LONG x, LONG y,
660 ITextRange** ppRange)
662 IRichEditOleImpl *This = impl_from_ITextDocument(me);
663 FIXME("stub %p\n",This);
667 static const ITextDocumentVtbl tdvt = {
668 ITextDocument_fnQueryInterface,
669 ITextDocument_fnAddRef,
670 ITextDocument_fnRelease,
671 ITextDocument_fnGetTypeInfoCount,
672 ITextDocument_fnGetTypeInfo,
673 ITextDocument_fnGetIDsOfNames,
674 ITextDocument_fnInvoke,
675 ITextDocument_fnGetName,
676 ITextDocument_fnGetSelection,
677 ITextDocument_fnGetStoryCount,
678 ITextDocument_fnGetStoryRanges,
679 ITextDocument_fnGetSaved,
680 ITextDocument_fnSetSaved,
681 ITextDocument_fnGetDefaultTabStop,
682 ITextDocument_fnSetDefaultTabStop,
684 ITextDocument_fnOpen,
685 ITextDocument_fnSave,
686 ITextDocument_fnFreeze,
687 ITextDocument_fnUnfreeze,
688 ITextDocument_fnBeginEditCollection,
689 ITextDocument_fnEndEditCollection,
690 ITextDocument_fnUndo,
691 ITextDocument_fnRedo,
692 ITextDocument_fnRange,
693 ITextDocument_fnRangeFromPoint
696 static HRESULT WINAPI ITextSelection_fnQueryInterface(
702 if (IsEqualGUID(riid, &IID_IUnknown)
703 || IsEqualGUID(riid, &IID_IDispatch)
704 || IsEqualGUID(riid, &IID_ITextRange)
705 || IsEqualGUID(riid, &IID_ITextSelection))
708 ITextSelection_AddRef(me);
712 return E_NOINTERFACE;
715 static ULONG WINAPI ITextSelection_fnAddRef(
718 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
719 return InterlockedIncrement(&This->ref);
722 static ULONG WINAPI ITextSelection_fnRelease(
725 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
726 ULONG ref = InterlockedDecrement(&This->ref);
732 static HRESULT WINAPI ITextSelection_fnGetTypeInfoCount(
736 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
738 return CO_E_RELEASED;
740 FIXME("not implemented\n");
744 static HRESULT WINAPI ITextSelection_fnGetTypeInfo(
750 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
752 return CO_E_RELEASED;
754 FIXME("not implemented\n");
758 static HRESULT WINAPI ITextSelection_fnGetIDsOfNames(
766 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
768 return CO_E_RELEASED;
770 FIXME("not implemented\n");
774 static HRESULT WINAPI ITextSelection_fnInvoke(
780 DISPPARAMS *pDispParams,
782 EXCEPINFO *pExcepInfo,
785 FIXME("not implemented\n");
789 /*** ITextRange methods ***/
790 static HRESULT WINAPI ITextSelection_fnGetText(
794 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
796 return CO_E_RELEASED;
798 FIXME("not implemented\n");
802 static HRESULT WINAPI ITextSelection_fnSetText(
806 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
808 return CO_E_RELEASED;
810 FIXME("not implemented\n");
814 static HRESULT WINAPI ITextSelection_fnGetChar(
818 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
820 return CO_E_RELEASED;
822 FIXME("not implemented\n");
826 static HRESULT WINAPI ITextSelection_fnSetChar(
830 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
832 return CO_E_RELEASED;
834 FIXME("not implemented\n");
838 static HRESULT WINAPI ITextSelection_fnGetDuplicate(
840 ITextRange **ppRange)
842 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
844 return CO_E_RELEASED;
846 FIXME("not implemented\n");
850 static HRESULT WINAPI ITextSelection_fnGetFormattedText(
852 ITextRange **ppRange)
854 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
856 return CO_E_RELEASED;
858 FIXME("not implemented\n");
862 static HRESULT WINAPI ITextSelection_fnSetFormattedText(
866 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
868 return CO_E_RELEASED;
870 FIXME("not implemented\n");
874 static HRESULT WINAPI ITextSelection_fnGetStart(
878 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
880 return CO_E_RELEASED;
882 FIXME("not implemented\n");
886 static HRESULT WINAPI ITextSelection_fnSetStart(
890 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
892 return CO_E_RELEASED;
894 FIXME("not implemented\n");
898 static HRESULT WINAPI ITextSelection_fnGetEnd(
902 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
904 return CO_E_RELEASED;
906 FIXME("not implemented\n");
910 static HRESULT WINAPI ITextSelection_fnSetEnd(
914 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
916 return CO_E_RELEASED;
918 FIXME("not implemented\n");
922 static HRESULT WINAPI ITextSelection_fnGetFont(
926 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
928 return CO_E_RELEASED;
930 FIXME("not implemented\n");
934 static HRESULT WINAPI ITextSelection_fnSetFont(
938 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
940 return CO_E_RELEASED;
942 FIXME("not implemented\n");
946 static HRESULT WINAPI ITextSelection_fnGetPara(
950 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
952 return CO_E_RELEASED;
954 FIXME("not implemented\n");
958 static HRESULT WINAPI ITextSelection_fnSetPara(
962 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
964 return CO_E_RELEASED;
966 FIXME("not implemented\n");
970 static HRESULT WINAPI ITextSelection_fnGetStoryLength(
974 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
976 return CO_E_RELEASED;
978 FIXME("not implemented\n");
982 static HRESULT WINAPI ITextSelection_fnGetStoryType(
986 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
988 return CO_E_RELEASED;
990 FIXME("not implemented\n");
994 static HRESULT WINAPI ITextSelection_fnCollapse(
998 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1000 return CO_E_RELEASED;
1002 FIXME("not implemented\n");
1006 static HRESULT WINAPI ITextSelection_fnExpand(
1011 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1013 return CO_E_RELEASED;
1015 FIXME("not implemented\n");
1019 static HRESULT WINAPI ITextSelection_fnGetIndex(
1024 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1026 return CO_E_RELEASED;
1028 FIXME("not implemented\n");
1032 static HRESULT WINAPI ITextSelection_fnSetIndex(
1038 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1040 return CO_E_RELEASED;
1042 FIXME("not implemented\n");
1046 static HRESULT WINAPI ITextSelection_fnSetRange(
1051 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1053 return CO_E_RELEASED;
1055 FIXME("not implemented\n");
1059 static HRESULT WINAPI ITextSelection_fnInRange(
1064 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1066 return CO_E_RELEASED;
1068 FIXME("not implemented\n");
1072 static HRESULT WINAPI ITextSelection_fnInStory(
1077 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1079 return CO_E_RELEASED;
1081 FIXME("not implemented\n");
1085 static HRESULT WINAPI ITextSelection_fnIsEqual(
1090 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1092 return CO_E_RELEASED;
1094 FIXME("not implemented\n");
1098 static HRESULT WINAPI ITextSelection_fnSelect(
1101 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1103 return CO_E_RELEASED;
1105 FIXME("not implemented\n");
1109 static HRESULT WINAPI ITextSelection_fnStartOf(
1115 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1117 return CO_E_RELEASED;
1119 FIXME("not implemented\n");
1123 static HRESULT WINAPI ITextSelection_fnEndOf(
1129 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1131 return CO_E_RELEASED;
1133 FIXME("not implemented\n");
1137 static HRESULT WINAPI ITextSelection_fnMove(
1143 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1145 return CO_E_RELEASED;
1147 FIXME("not implemented\n");
1151 static HRESULT WINAPI ITextSelection_fnMoveStart(
1157 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1159 return CO_E_RELEASED;
1161 FIXME("not implemented\n");
1165 static HRESULT WINAPI ITextSelection_fnMoveEnd(
1171 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1173 return CO_E_RELEASED;
1175 FIXME("not implemented\n");
1179 static HRESULT WINAPI ITextSelection_fnMoveWhile(
1185 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1187 return CO_E_RELEASED;
1189 FIXME("not implemented\n");
1193 static HRESULT WINAPI ITextSelection_fnMoveStartWhile(
1199 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1201 return CO_E_RELEASED;
1203 FIXME("not implemented\n");
1207 static HRESULT WINAPI ITextSelection_fnMoveEndWhile(
1213 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1215 return CO_E_RELEASED;
1217 FIXME("not implemented\n");
1221 static HRESULT WINAPI ITextSelection_fnMoveUntil(
1227 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1229 return CO_E_RELEASED;
1231 FIXME("not implemented\n");
1235 static HRESULT WINAPI ITextSelection_fnMoveStartUntil(
1241 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1243 return CO_E_RELEASED;
1245 FIXME("not implemented\n");
1249 static HRESULT WINAPI ITextSelection_fnMoveEndUntil(
1255 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1257 return CO_E_RELEASED;
1259 FIXME("not implemented\n");
1263 static HRESULT WINAPI ITextSelection_fnFindText(
1270 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1272 return CO_E_RELEASED;
1274 FIXME("not implemented\n");
1278 static HRESULT WINAPI ITextSelection_fnFindTextStart(
1285 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1287 return CO_E_RELEASED;
1289 FIXME("not implemented\n");
1293 static HRESULT WINAPI ITextSelection_fnFindTextEnd(
1300 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1302 return CO_E_RELEASED;
1304 FIXME("not implemented\n");
1308 static HRESULT WINAPI ITextSelection_fnDelete(
1314 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1316 return CO_E_RELEASED;
1318 FIXME("not implemented\n");
1322 static HRESULT WINAPI ITextSelection_fnCut(
1326 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1328 return CO_E_RELEASED;
1330 FIXME("not implemented\n");
1334 static HRESULT WINAPI ITextSelection_fnCopy(
1338 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1340 return CO_E_RELEASED;
1342 FIXME("not implemented\n");
1346 static HRESULT WINAPI ITextSelection_fnPaste(
1351 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1353 return CO_E_RELEASED;
1355 FIXME("not implemented\n");
1359 static HRESULT WINAPI ITextSelection_fnCanPaste(
1365 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1367 return CO_E_RELEASED;
1369 FIXME("not implemented\n");
1373 static HRESULT WINAPI ITextSelection_fnCanEdit(
1377 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1379 return CO_E_RELEASED;
1381 FIXME("not implemented\n");
1385 static HRESULT WINAPI ITextSelection_fnChangeCase(
1389 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1391 return CO_E_RELEASED;
1393 FIXME("not implemented\n");
1397 static HRESULT WINAPI ITextSelection_fnGetPoint(
1403 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1405 return CO_E_RELEASED;
1407 FIXME("not implemented\n");
1411 static HRESULT WINAPI ITextSelection_fnSetPoint(
1418 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1420 return CO_E_RELEASED;
1422 FIXME("not implemented\n");
1426 static HRESULT WINAPI ITextSelection_fnScrollIntoView(
1430 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1432 return CO_E_RELEASED;
1434 FIXME("not implemented\n");
1438 static HRESULT WINAPI ITextSelection_fnGetEmbeddedObject(
1442 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1444 return CO_E_RELEASED;
1446 FIXME("not implemented\n");
1450 /*** ITextSelection methods ***/
1451 static HRESULT WINAPI ITextSelection_fnGetFlags(
1455 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1457 return CO_E_RELEASED;
1459 FIXME("not implemented\n");
1463 static HRESULT WINAPI ITextSelection_fnSetFlags(
1467 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1469 return CO_E_RELEASED;
1471 FIXME("not implemented\n");
1475 static HRESULT WINAPI ITextSelection_fnGetType(
1479 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1481 return CO_E_RELEASED;
1483 FIXME("not implemented\n");
1487 static HRESULT WINAPI ITextSelection_fnMoveLeft(
1494 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1496 return CO_E_RELEASED;
1498 FIXME("not implemented\n");
1502 static HRESULT WINAPI ITextSelection_fnMoveRight(
1509 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1511 return CO_E_RELEASED;
1513 FIXME("not implemented\n");
1517 static HRESULT WINAPI ITextSelection_fnMoveUp(
1524 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1526 return CO_E_RELEASED;
1528 FIXME("not implemented\n");
1532 static HRESULT WINAPI ITextSelection_fnMoveDown(
1539 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1541 return CO_E_RELEASED;
1543 FIXME("not implemented\n");
1547 static HRESULT WINAPI ITextSelection_fnHomeKey(
1553 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1555 return CO_E_RELEASED;
1557 FIXME("not implemented\n");
1561 static HRESULT WINAPI ITextSelection_fnEndKey(
1567 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1569 return CO_E_RELEASED;
1571 FIXME("not implemented\n");
1575 static HRESULT WINAPI ITextSelection_fnTypeText(
1579 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1581 return CO_E_RELEASED;
1583 FIXME("not implemented\n");
1587 static const ITextSelectionVtbl tsvt = {
1588 ITextSelection_fnQueryInterface,
1589 ITextSelection_fnAddRef,
1590 ITextSelection_fnRelease,
1591 ITextSelection_fnGetTypeInfoCount,
1592 ITextSelection_fnGetTypeInfo,
1593 ITextSelection_fnGetIDsOfNames,
1594 ITextSelection_fnInvoke,
1595 ITextSelection_fnGetText,
1596 ITextSelection_fnSetText,
1597 ITextSelection_fnGetChar,
1598 ITextSelection_fnSetChar,
1599 ITextSelection_fnGetDuplicate,
1600 ITextSelection_fnGetFormattedText,
1601 ITextSelection_fnSetFormattedText,
1602 ITextSelection_fnGetStart,
1603 ITextSelection_fnSetStart,
1604 ITextSelection_fnGetEnd,
1605 ITextSelection_fnSetEnd,
1606 ITextSelection_fnGetFont,
1607 ITextSelection_fnSetFont,
1608 ITextSelection_fnGetPara,
1609 ITextSelection_fnSetPara,
1610 ITextSelection_fnGetStoryLength,
1611 ITextSelection_fnGetStoryType,
1612 ITextSelection_fnCollapse,
1613 ITextSelection_fnExpand,
1614 ITextSelection_fnGetIndex,
1615 ITextSelection_fnSetIndex,
1616 ITextSelection_fnSetRange,
1617 ITextSelection_fnInRange,
1618 ITextSelection_fnInStory,
1619 ITextSelection_fnIsEqual,
1620 ITextSelection_fnSelect,
1621 ITextSelection_fnStartOf,
1622 ITextSelection_fnEndOf,
1623 ITextSelection_fnMove,
1624 ITextSelection_fnMoveStart,
1625 ITextSelection_fnMoveEnd,
1626 ITextSelection_fnMoveWhile,
1627 ITextSelection_fnMoveStartWhile,
1628 ITextSelection_fnMoveEndWhile,
1629 ITextSelection_fnMoveUntil,
1630 ITextSelection_fnMoveStartUntil,
1631 ITextSelection_fnMoveEndUntil,
1632 ITextSelection_fnFindText,
1633 ITextSelection_fnFindTextStart,
1634 ITextSelection_fnFindTextEnd,
1635 ITextSelection_fnDelete,
1636 ITextSelection_fnCut,
1637 ITextSelection_fnCopy,
1638 ITextSelection_fnPaste,
1639 ITextSelection_fnCanPaste,
1640 ITextSelection_fnCanEdit,
1641 ITextSelection_fnChangeCase,
1642 ITextSelection_fnGetPoint,
1643 ITextSelection_fnSetPoint,
1644 ITextSelection_fnScrollIntoView,
1645 ITextSelection_fnGetEmbeddedObject,
1646 ITextSelection_fnGetFlags,
1647 ITextSelection_fnSetFlags,
1648 ITextSelection_fnGetType,
1649 ITextSelection_fnMoveLeft,
1650 ITextSelection_fnMoveRight,
1651 ITextSelection_fnMoveUp,
1652 ITextSelection_fnMoveDown,
1653 ITextSelection_fnHomeKey,
1654 ITextSelection_fnEndKey,
1655 ITextSelection_fnTypeText
1658 static ITextSelectionImpl *
1659 CreateTextSelection(IRichEditOleImpl *reOle)
1661 ITextSelectionImpl *txtSel = heap_alloc(sizeof *txtSel);
1665 txtSel->lpVtbl = &tsvt;
1667 txtSel->reOle = reOle;
1671 LRESULT CreateIRichEditOle(ME_TextEditor *editor, LPVOID *ppObj)
1673 IRichEditOleImpl *reo;
1675 reo = heap_alloc(sizeof(IRichEditOleImpl));
1679 reo->lpRichEditOleVtbl = &revt;
1680 reo->lpTextDocumentVtbl = &tdvt;
1682 reo->editor = editor;
1683 reo->txtSel = CreateTextSelection(reo);
1689 reo->clientSite = CreateOleClientSite(reo);
1692 ITextSelection_Release((ITextSelection *) reo->txtSel);
1696 TRACE("Created %p\n",reo);
1702 static void convert_sizel(ME_Context *c, const SIZEL* szl, SIZE* sz)
1704 /* sizel is in .01 millimeters, sz in pixels */
1705 sz->cx = MulDiv(szl->cx, c->dpi.cx, 2540);
1706 sz->cy = MulDiv(szl->cy, c->dpi.cy, 2540);
1709 /******************************************************************************
1710 * ME_GetOLEObjectSize
1712 * Sets run extent for OLE objects.
1714 void ME_GetOLEObjectSize(ME_Context *c, ME_Run *run, SIZE *pSize)
1722 assert(run->nFlags & MERF_GRAPHICS);
1723 assert(run->ole_obj);
1725 if (run->ole_obj->sizel.cx != 0 || run->ole_obj->sizel.cy != 0)
1727 convert_sizel(c, &run->ole_obj->sizel, pSize);
1731 IOleObject_QueryInterface(run->ole_obj->poleobj, &IID_IDataObject, (void**)&ido);
1732 fmt.cfFormat = CF_BITMAP;
1734 fmt.dwAspect = DVASPECT_CONTENT;
1736 fmt.tymed = TYMED_GDI;
1737 if (IDataObject_GetData(ido, &fmt, &stgm) != S_OK)
1739 fmt.cfFormat = CF_ENHMETAFILE;
1740 fmt.tymed = TYMED_ENHMF;
1741 if (IDataObject_GetData(ido, &fmt, &stgm) != S_OK)
1743 FIXME("unsupported format\n");
1744 pSize->cx = pSize->cy = 0;
1745 IDataObject_Release(ido);
1753 GetObjectW(stgm.u.hBitmap, sizeof(dibsect), &dibsect);
1754 pSize->cx = dibsect.dsBm.bmWidth;
1755 pSize->cy = dibsect.dsBm.bmHeight;
1756 if (!stgm.pUnkForRelease) DeleteObject(stgm.u.hBitmap);
1759 GetEnhMetaFileHeader(stgm.u.hEnhMetaFile, sizeof(emh), &emh);
1760 pSize->cx = emh.rclBounds.right - emh.rclBounds.left;
1761 pSize->cy = emh.rclBounds.bottom - emh.rclBounds.top;
1762 if (!stgm.pUnkForRelease) DeleteEnhMetaFile(stgm.u.hEnhMetaFile);
1765 FIXME("Unsupported tymed %d\n", stgm.tymed);
1768 IDataObject_Release(ido);
1769 if (c->editor->nZoomNumerator != 0)
1771 pSize->cx = MulDiv(pSize->cx, c->editor->nZoomNumerator, c->editor->nZoomDenominator);
1772 pSize->cy = MulDiv(pSize->cy, c->editor->nZoomNumerator, c->editor->nZoomDenominator);
1776 void ME_DrawOLE(ME_Context *c, int x, int y, ME_Run *run,
1777 ME_Paragraph *para, BOOL selected)
1788 assert(run->nFlags & MERF_GRAPHICS);
1789 assert(run->ole_obj);
1790 if (IOleObject_QueryInterface(run->ole_obj->poleobj, &IID_IDataObject, (void**)&ido) != S_OK)
1792 FIXME("Couldn't get interface\n");
1795 has_size = run->ole_obj->sizel.cx != 0 || run->ole_obj->sizel.cy != 0;
1796 fmt.cfFormat = CF_BITMAP;
1798 fmt.dwAspect = DVASPECT_CONTENT;
1800 fmt.tymed = TYMED_GDI;
1801 if (IDataObject_GetData(ido, &fmt, &stgm) != S_OK)
1803 fmt.cfFormat = CF_ENHMETAFILE;
1804 fmt.tymed = TYMED_ENHMF;
1805 if (IDataObject_GetData(ido, &fmt, &stgm) != S_OK)
1807 FIXME("Couldn't get storage medium\n");
1808 IDataObject_Release(ido);
1815 GetObjectW(stgm.u.hBitmap, sizeof(dibsect), &dibsect);
1816 hMemDC = CreateCompatibleDC(c->hDC);
1817 SelectObject(hMemDC, stgm.u.hBitmap);
1818 if (!has_size && c->editor->nZoomNumerator == 0)
1820 sz.cx = dibsect.dsBm.bmWidth;
1821 sz.cy = dibsect.dsBm.bmHeight;
1822 BitBlt(c->hDC, x, y - dibsect.dsBm.bmHeight,
1823 dibsect.dsBm.bmWidth, dibsect.dsBm.bmHeight,
1824 hMemDC, 0, 0, SRCCOPY);
1830 convert_sizel(c, &run->ole_obj->sizel, &sz);
1834 sz.cx = MulDiv(dibsect.dsBm.bmWidth,
1835 c->editor->nZoomNumerator, c->editor->nZoomDenominator);
1836 sz.cy = MulDiv(dibsect.dsBm.bmHeight,
1837 c->editor->nZoomNumerator, c->editor->nZoomDenominator);
1839 StretchBlt(c->hDC, x, y - sz.cy, sz.cx, sz.cy,
1840 hMemDC, 0, 0, dibsect.dsBm.bmWidth, dibsect.dsBm.bmHeight, SRCCOPY);
1842 if (!stgm.pUnkForRelease) DeleteObject(stgm.u.hBitmap);
1845 GetEnhMetaFileHeader(stgm.u.hEnhMetaFile, sizeof(emh), &emh);
1846 if (!has_size && c->editor->nZoomNumerator == 0)
1848 sz.cy = emh.rclBounds.bottom - emh.rclBounds.top;
1849 sz.cx = emh.rclBounds.right - emh.rclBounds.left;
1855 convert_sizel(c, &run->ole_obj->sizel, &sz);
1859 sz.cy = MulDiv(emh.rclBounds.bottom - emh.rclBounds.top,
1860 c->editor->nZoomNumerator, c->editor->nZoomDenominator);
1861 sz.cx = MulDiv(emh.rclBounds.right - emh.rclBounds.left,
1862 c->editor->nZoomNumerator, c->editor->nZoomDenominator);
1870 rc.right = x + sz.cx;
1872 PlayEnhMetaFile(c->hDC, stgm.u.hEnhMetaFile, &rc);
1874 if (!stgm.pUnkForRelease) DeleteEnhMetaFile(stgm.u.hEnhMetaFile);
1877 FIXME("Unsupported tymed %d\n", stgm.tymed);
1881 if (selected && !c->editor->bHideSelection)
1882 PatBlt(c->hDC, x, y - sz.cy, sz.cx, sz.cy, DSTINVERT);
1883 IDataObject_Release(ido);
1886 void ME_DeleteReObject(REOBJECT* reo)
1888 if (reo->poleobj) IOleObject_Release(reo->poleobj);
1889 if (reo->pstg) IStorage_Release(reo->pstg);
1890 if (reo->polesite) IOleClientSite_Release(reo->polesite);
1894 void ME_CopyReObject(REOBJECT* dst, const REOBJECT* src)
1898 if (dst->poleobj) IOleObject_AddRef(dst->poleobj);
1899 if (dst->pstg) IStorage_AddRef(dst->pstg);
1900 if (dst->polesite) IOleClientSite_AddRef(dst->polesite);