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 IRichEditOle IRichEditOle_iface;
59 ITextDocument ITextDocument_iface;
62 ME_TextEditor *editor;
63 ITextSelectionImpl *txtSel;
64 IOleClientSiteImpl *clientSite;
67 struct ITextSelectionImpl {
68 ITextSelection ITextSelection_iface;
71 IRichEditOleImpl *reOle;
74 struct IOleClientSiteImpl {
75 IOleClientSite IOleClientSite_iface;
78 IRichEditOleImpl *reOle;
81 static inline IRichEditOleImpl *impl_from_IRichEditOle(IRichEditOle *iface)
83 return CONTAINING_RECORD(iface, IRichEditOleImpl, IRichEditOle_iface);
86 static inline IRichEditOleImpl *impl_from_ITextDocument(ITextDocument *iface)
88 return CONTAINING_RECORD(iface, IRichEditOleImpl, ITextDocument_iface);
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->IRichEditOle_iface;
102 else if (IsEqualGUID(riid, &IID_ITextDocument))
103 *ppvObj = &This->ITextDocument_iface;
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(&This->txtSel->ITextSelection_iface);
138 IOleClientSite_Release(&This->clientSite->IOleClientSite_iface);
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 inline IOleClientSiteImpl *impl_from_IOleClientSite(IOleClientSite *iface)
171 return CONTAINING_RECORD(iface, IOleClientSiteImpl, IOleClientSite_iface);
174 static HRESULT WINAPI
175 IOleClientSite_fnQueryInterface(IOleClientSite *me, REFIID riid, LPVOID *ppvObj)
177 TRACE("%p %s\n", me, debugstr_guid(riid) );
180 if (IsEqualGUID(riid, &IID_IUnknown) ||
181 IsEqualGUID(riid, &IID_IOleClientSite))
185 IOleClientSite_AddRef(me);
188 FIXME("%p: unhandled interface %s\n", me, debugstr_guid(riid) );
190 return E_NOINTERFACE;
193 static ULONG WINAPI IOleClientSite_fnAddRef(IOleClientSite *iface)
195 IOleClientSiteImpl *This = impl_from_IOleClientSite(iface);
196 return InterlockedIncrement(&This->ref);
199 static ULONG WINAPI IOleClientSite_fnRelease(IOleClientSite *iface)
201 IOleClientSiteImpl *This = impl_from_IOleClientSite(iface);
202 ULONG ref = InterlockedDecrement(&This->ref);
208 static HRESULT WINAPI IOleClientSite_fnSaveObject(IOleClientSite *iface)
210 IOleClientSiteImpl *This = impl_from_IOleClientSite(iface);
212 return CO_E_RELEASED;
214 FIXME("stub %p\n", iface);
219 static HRESULT WINAPI IOleClientSite_fnGetMoniker(IOleClientSite *iface, DWORD dwAssign,
220 DWORD dwWhichMoniker, IMoniker **ppmk)
222 IOleClientSiteImpl *This = impl_from_IOleClientSite(iface);
224 return CO_E_RELEASED;
226 FIXME("stub %p\n", iface);
230 static HRESULT WINAPI IOleClientSite_fnGetContainer(IOleClientSite *iface,
231 IOleContainer **ppContainer)
233 IOleClientSiteImpl *This = impl_from_IOleClientSite(iface);
235 return CO_E_RELEASED;
237 FIXME("stub %p\n", iface);
241 static HRESULT WINAPI IOleClientSite_fnShowObject(IOleClientSite *iface)
243 IOleClientSiteImpl *This = impl_from_IOleClientSite(iface);
245 return CO_E_RELEASED;
247 FIXME("stub %p\n", iface);
251 static HRESULT WINAPI IOleClientSite_fnOnShowWindow(IOleClientSite *iface, BOOL fShow)
253 IOleClientSiteImpl *This = impl_from_IOleClientSite(iface);
255 return CO_E_RELEASED;
257 FIXME("stub %p\n", iface);
261 static HRESULT WINAPI IOleClientSite_fnRequestNewObjectLayout(IOleClientSite *iface)
263 IOleClientSiteImpl *This = impl_from_IOleClientSite(iface);
265 return CO_E_RELEASED;
267 FIXME("stub %p\n", iface);
271 static const IOleClientSiteVtbl ocst = {
272 IOleClientSite_fnQueryInterface,
273 IOleClientSite_fnAddRef,
274 IOleClientSite_fnRelease,
275 IOleClientSite_fnSaveObject,
276 IOleClientSite_fnGetMoniker,
277 IOleClientSite_fnGetContainer,
278 IOleClientSite_fnShowObject,
279 IOleClientSite_fnOnShowWindow,
280 IOleClientSite_fnRequestNewObjectLayout
283 static IOleClientSiteImpl *
284 CreateOleClientSite(IRichEditOleImpl *reOle)
286 IOleClientSiteImpl *clientSite = heap_alloc(sizeof *clientSite);
290 clientSite->IOleClientSite_iface.lpVtbl = &ocst;
292 clientSite->reOle = reOle;
296 static HRESULT WINAPI
297 IRichEditOle_fnGetClientSite(IRichEditOle *me,
298 LPOLECLIENTSITE *lplpolesite)
300 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
302 TRACE("%p,%p\n",This, lplpolesite);
306 *lplpolesite = &This->clientSite->IOleClientSite_iface;
307 IOleClientSite_fnAddRef(*lplpolesite);
311 static HRESULT WINAPI
312 IRichEditOle_fnGetClipboardData(IRichEditOle *me, CHARRANGE *lpchrg,
313 DWORD reco, LPDATAOBJECT *lplpdataobj)
315 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
319 TRACE("(%p,%p,%d)\n",This, lpchrg, reco);
323 int nFrom, nTo, nStartCur = ME_GetSelectionOfs(This->editor, &nFrom, &nTo);
324 start = This->editor->pCursors[nStartCur];
325 nChars = nTo - nFrom;
327 ME_CursorFromCharOfs(This->editor, lpchrg->cpMin, &start);
328 nChars = lpchrg->cpMax - lpchrg->cpMin;
330 return ME_GetDataObject(This->editor, &start, nChars, lplpdataobj);
333 static LONG WINAPI IRichEditOle_fnGetLinkCount(IRichEditOle *me)
335 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
336 FIXME("stub %p\n",This);
340 static HRESULT WINAPI
341 IRichEditOle_fnGetObject(IRichEditOle *me, LONG iob,
342 REOBJECT *lpreobject, DWORD dwFlags)
344 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
345 FIXME("stub %p\n",This);
350 IRichEditOle_fnGetObjectCount(IRichEditOle *me)
352 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
353 FIXME("stub %p\n",This);
357 static HRESULT WINAPI
358 IRichEditOle_fnHandsOffStorage(IRichEditOle *me, LONG iob)
360 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
361 FIXME("stub %p\n",This);
365 static HRESULT WINAPI
366 IRichEditOle_fnImportDataObject(IRichEditOle *me, LPDATAOBJECT lpdataobj,
367 CLIPFORMAT cf, HGLOBAL hMetaPict)
369 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
370 FIXME("stub %p\n",This);
374 static HRESULT WINAPI
375 IRichEditOle_fnInPlaceDeactivate(IRichEditOle *me)
377 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
378 FIXME("stub %p\n",This);
382 static HRESULT WINAPI
383 IRichEditOle_fnInsertObject(IRichEditOle *me, REOBJECT *reo)
385 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
386 TRACE("(%p,%p)\n", This, reo);
388 if (reo->cbStruct < sizeof(*reo)) return STG_E_INVALIDPARAMETER;
390 ME_InsertOLEFromCursor(This->editor, reo, 0);
391 ME_CommitUndo(This->editor);
392 ME_UpdateRepaint(This->editor, FALSE);
396 static HRESULT WINAPI IRichEditOle_fnSaveCompleted(IRichEditOle *me, LONG iob,
399 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
400 FIXME("stub %p\n",This);
404 static HRESULT WINAPI
405 IRichEditOle_fnSetDvaspect(IRichEditOle *me, LONG iob, DWORD dvaspect)
407 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
408 FIXME("stub %p\n",This);
412 static HRESULT WINAPI IRichEditOle_fnSetHostNames(IRichEditOle *me,
413 LPCSTR lpstrContainerApp, LPCSTR lpstrContainerObj)
415 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
416 FIXME("stub %p %s %s\n",This, lpstrContainerApp, lpstrContainerObj);
420 static HRESULT WINAPI
421 IRichEditOle_fnSetLinkAvailable(IRichEditOle *me, LONG iob, BOOL fAvailable)
423 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
424 FIXME("stub %p\n",This);
428 static const IRichEditOleVtbl revt = {
429 IRichEditOle_fnQueryInterface,
430 IRichEditOle_fnAddRef,
431 IRichEditOle_fnRelease,
432 IRichEditOle_fnGetClientSite,
433 IRichEditOle_fnGetObjectCount,
434 IRichEditOle_fnGetLinkCount,
435 IRichEditOle_fnGetObject,
436 IRichEditOle_fnInsertObject,
437 IRichEditOle_fnConvertObject,
438 IRichEditOle_fnActivateAs,
439 IRichEditOle_fnSetHostNames,
440 IRichEditOle_fnSetLinkAvailable,
441 IRichEditOle_fnSetDvaspect,
442 IRichEditOle_fnHandsOffStorage,
443 IRichEditOle_fnSaveCompleted,
444 IRichEditOle_fnInPlaceDeactivate,
445 IRichEditOle_fnContextSensitiveHelp,
446 IRichEditOle_fnGetClipboardData,
447 IRichEditOle_fnImportDataObject
450 static HRESULT WINAPI
451 ITextDocument_fnQueryInterface(ITextDocument* me, REFIID riid,
454 IRichEditOleImpl *This = impl_from_ITextDocument(me);
455 return IRichEditOle_fnQueryInterface(&This->IRichEditOle_iface, riid, ppvObject);
459 ITextDocument_fnAddRef(ITextDocument* me)
461 IRichEditOleImpl *This = impl_from_ITextDocument(me);
462 return IRichEditOle_fnAddRef(&This->IRichEditOle_iface);
466 ITextDocument_fnRelease(ITextDocument* me)
468 IRichEditOleImpl *This = impl_from_ITextDocument(me);
469 return IRichEditOle_fnRelease(&This->IRichEditOle_iface);
472 static HRESULT WINAPI
473 ITextDocument_fnGetTypeInfoCount(ITextDocument* me,
476 IRichEditOleImpl *This = impl_from_ITextDocument(me);
477 FIXME("stub %p\n",This);
481 static HRESULT WINAPI
482 ITextDocument_fnGetTypeInfo(ITextDocument* me, UINT iTInfo, LCID lcid,
485 IRichEditOleImpl *This = impl_from_ITextDocument(me);
486 FIXME("stub %p\n",This);
490 static HRESULT WINAPI
491 ITextDocument_fnGetIDsOfNames(ITextDocument* me, REFIID riid,
492 LPOLESTR* rgszNames, UINT cNames, LCID lcid, DISPID* rgDispId)
494 IRichEditOleImpl *This = impl_from_ITextDocument(me);
495 FIXME("stub %p\n",This);
499 static HRESULT WINAPI
500 ITextDocument_fnInvoke(ITextDocument* me, DISPID dispIdMember,
501 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams,
502 VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr)
504 IRichEditOleImpl *This = impl_from_ITextDocument(me);
505 FIXME("stub %p\n",This);
509 static HRESULT WINAPI
510 ITextDocument_fnGetName(ITextDocument* me, BSTR* pName)
512 IRichEditOleImpl *This = impl_from_ITextDocument(me);
513 FIXME("stub %p\n",This);
517 static HRESULT WINAPI
518 ITextDocument_fnGetSelection(ITextDocument* me, ITextSelection** ppSel)
520 IRichEditOleImpl *This = impl_from_ITextDocument(me);
522 *ppSel = &This->txtSel->ITextSelection_iface;
523 ITextSelection_AddRef(*ppSel);
527 static HRESULT WINAPI
528 ITextDocument_fnGetStoryCount(ITextDocument* me, LONG* pCount)
530 IRichEditOleImpl *This = impl_from_ITextDocument(me);
531 FIXME("stub %p\n",This);
535 static HRESULT WINAPI
536 ITextDocument_fnGetStoryRanges(ITextDocument* me,
537 ITextStoryRanges** ppStories)
539 IRichEditOleImpl *This = impl_from_ITextDocument(me);
540 FIXME("stub %p\n",This);
544 static HRESULT WINAPI
545 ITextDocument_fnGetSaved(ITextDocument* me, LONG* pValue)
547 IRichEditOleImpl *This = impl_from_ITextDocument(me);
548 FIXME("stub %p\n",This);
552 static HRESULT WINAPI
553 ITextDocument_fnSetSaved(ITextDocument* me, LONG Value)
555 IRichEditOleImpl *This = impl_from_ITextDocument(me);
556 FIXME("stub %p\n",This);
560 static HRESULT WINAPI
561 ITextDocument_fnGetDefaultTabStop(ITextDocument* me, float* pValue)
563 IRichEditOleImpl *This = impl_from_ITextDocument(me);
564 FIXME("stub %p\n",This);
568 static HRESULT WINAPI
569 ITextDocument_fnSetDefaultTabStop(ITextDocument* me, float Value)
571 IRichEditOleImpl *This = impl_from_ITextDocument(me);
572 FIXME("stub %p\n",This);
576 static HRESULT WINAPI
577 ITextDocument_fnNew(ITextDocument* me)
579 IRichEditOleImpl *This = impl_from_ITextDocument(me);
580 FIXME("stub %p\n",This);
584 static HRESULT WINAPI
585 ITextDocument_fnOpen(ITextDocument* me, VARIANT* pVar, LONG Flags,
588 IRichEditOleImpl *This = impl_from_ITextDocument(me);
589 FIXME("stub %p\n",This);
593 static HRESULT WINAPI
594 ITextDocument_fnSave(ITextDocument* me, VARIANT* pVar, LONG Flags,
597 IRichEditOleImpl *This = impl_from_ITextDocument(me);
598 FIXME("stub %p\n",This);
602 static HRESULT WINAPI
603 ITextDocument_fnFreeze(ITextDocument* me, LONG* pCount)
605 IRichEditOleImpl *This = impl_from_ITextDocument(me);
606 FIXME("stub %p\n",This);
610 static HRESULT WINAPI
611 ITextDocument_fnUnfreeze(ITextDocument* me, LONG* pCount)
613 IRichEditOleImpl *This = impl_from_ITextDocument(me);
614 FIXME("stub %p\n",This);
618 static HRESULT WINAPI
619 ITextDocument_fnBeginEditCollection(ITextDocument* me)
621 IRichEditOleImpl *This = impl_from_ITextDocument(me);
622 FIXME("stub %p\n",This);
626 static HRESULT WINAPI
627 ITextDocument_fnEndEditCollection(ITextDocument* me)
629 IRichEditOleImpl *This = impl_from_ITextDocument(me);
630 FIXME("stub %p\n",This);
634 static HRESULT WINAPI
635 ITextDocument_fnUndo(ITextDocument* me, LONG Count, LONG* prop)
637 IRichEditOleImpl *This = impl_from_ITextDocument(me);
638 FIXME("stub %p\n",This);
642 static HRESULT WINAPI
643 ITextDocument_fnRedo(ITextDocument* me, LONG Count, LONG* prop)
645 IRichEditOleImpl *This = impl_from_ITextDocument(me);
646 FIXME("stub %p\n",This);
650 static HRESULT WINAPI
651 ITextDocument_fnRange(ITextDocument* me, LONG cp1, LONG cp2,
652 ITextRange** ppRange)
654 IRichEditOleImpl *This = impl_from_ITextDocument(me);
655 FIXME("stub %p\n",This);
659 static HRESULT WINAPI
660 ITextDocument_fnRangeFromPoint(ITextDocument* me, LONG x, LONG y,
661 ITextRange** ppRange)
663 IRichEditOleImpl *This = impl_from_ITextDocument(me);
664 FIXME("stub %p\n",This);
668 static const ITextDocumentVtbl tdvt = {
669 ITextDocument_fnQueryInterface,
670 ITextDocument_fnAddRef,
671 ITextDocument_fnRelease,
672 ITextDocument_fnGetTypeInfoCount,
673 ITextDocument_fnGetTypeInfo,
674 ITextDocument_fnGetIDsOfNames,
675 ITextDocument_fnInvoke,
676 ITextDocument_fnGetName,
677 ITextDocument_fnGetSelection,
678 ITextDocument_fnGetStoryCount,
679 ITextDocument_fnGetStoryRanges,
680 ITextDocument_fnGetSaved,
681 ITextDocument_fnSetSaved,
682 ITextDocument_fnGetDefaultTabStop,
683 ITextDocument_fnSetDefaultTabStop,
685 ITextDocument_fnOpen,
686 ITextDocument_fnSave,
687 ITextDocument_fnFreeze,
688 ITextDocument_fnUnfreeze,
689 ITextDocument_fnBeginEditCollection,
690 ITextDocument_fnEndEditCollection,
691 ITextDocument_fnUndo,
692 ITextDocument_fnRedo,
693 ITextDocument_fnRange,
694 ITextDocument_fnRangeFromPoint
697 static inline ITextSelectionImpl *impl_from_ITextSelection(ITextSelection *iface)
699 return CONTAINING_RECORD(iface, ITextSelectionImpl, ITextSelection_iface);
702 static HRESULT WINAPI ITextSelection_fnQueryInterface(
708 if (IsEqualGUID(riid, &IID_IUnknown)
709 || IsEqualGUID(riid, &IID_IDispatch)
710 || IsEqualGUID(riid, &IID_ITextRange)
711 || IsEqualGUID(riid, &IID_ITextSelection))
714 ITextSelection_AddRef(me);
718 return E_NOINTERFACE;
721 static ULONG WINAPI ITextSelection_fnAddRef(ITextSelection *me)
723 ITextSelectionImpl *This = impl_from_ITextSelection(me);
724 return InterlockedIncrement(&This->ref);
727 static ULONG WINAPI ITextSelection_fnRelease(ITextSelection *me)
729 ITextSelectionImpl *This = impl_from_ITextSelection(me);
730 ULONG ref = InterlockedDecrement(&This->ref);
736 static HRESULT WINAPI ITextSelection_fnGetTypeInfoCount(ITextSelection *me, UINT *pctinfo)
738 ITextSelectionImpl *This = impl_from_ITextSelection(me);
740 return CO_E_RELEASED;
742 FIXME("not implemented\n");
746 static HRESULT WINAPI ITextSelection_fnGetTypeInfo(ITextSelection *me, UINT iTInfo, LCID lcid,
749 ITextSelectionImpl *This = impl_from_ITextSelection(me);
751 return CO_E_RELEASED;
753 FIXME("not implemented\n");
757 static HRESULT WINAPI ITextSelection_fnGetIDsOfNames(ITextSelection *me, REFIID riid,
758 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
760 ITextSelectionImpl *This = impl_from_ITextSelection(me);
762 return CO_E_RELEASED;
764 FIXME("not implemented\n");
768 static HRESULT WINAPI ITextSelection_fnInvoke(
774 DISPPARAMS *pDispParams,
776 EXCEPINFO *pExcepInfo,
779 FIXME("not implemented\n");
783 /*** ITextRange methods ***/
784 static HRESULT WINAPI ITextSelection_fnGetText(ITextSelection *me, BSTR *pbstr)
786 ITextSelectionImpl *This = impl_from_ITextSelection(me);
788 return CO_E_RELEASED;
790 FIXME("not implemented\n");
794 static HRESULT WINAPI ITextSelection_fnSetText(ITextSelection *me, BSTR bstr)
796 ITextSelectionImpl *This = impl_from_ITextSelection(me);
798 return CO_E_RELEASED;
800 FIXME("not implemented\n");
804 static HRESULT WINAPI ITextSelection_fnGetChar(ITextSelection *me, LONG *pch)
806 ITextSelectionImpl *This = impl_from_ITextSelection(me);
808 return CO_E_RELEASED;
810 FIXME("not implemented\n");
814 static HRESULT WINAPI ITextSelection_fnSetChar(ITextSelection *me, LONG ch)
816 ITextSelectionImpl *This = impl_from_ITextSelection(me);
818 return CO_E_RELEASED;
820 FIXME("not implemented\n");
824 static HRESULT WINAPI ITextSelection_fnGetDuplicate(ITextSelection *me, ITextRange **ppRange)
826 ITextSelectionImpl *This = impl_from_ITextSelection(me);
828 return CO_E_RELEASED;
830 FIXME("not implemented\n");
834 static HRESULT WINAPI ITextSelection_fnGetFormattedText(ITextSelection *me, ITextRange **ppRange)
836 ITextSelectionImpl *This = impl_from_ITextSelection(me);
838 return CO_E_RELEASED;
840 FIXME("not implemented\n");
844 static HRESULT WINAPI ITextSelection_fnSetFormattedText(ITextSelection *me, ITextRange *pRange)
846 ITextSelectionImpl *This = impl_from_ITextSelection(me);
848 return CO_E_RELEASED;
850 FIXME("not implemented\n");
854 static HRESULT WINAPI ITextSelection_fnGetStart(ITextSelection *me, LONG *pcpFirst)
856 ITextSelectionImpl *This = impl_from_ITextSelection(me);
858 return CO_E_RELEASED;
860 FIXME("not implemented\n");
864 static HRESULT WINAPI ITextSelection_fnSetStart(ITextSelection *me, LONG cpFirst)
866 ITextSelectionImpl *This = impl_from_ITextSelection(me);
868 return CO_E_RELEASED;
870 FIXME("not implemented\n");
874 static HRESULT WINAPI ITextSelection_fnGetEnd(ITextSelection *me, LONG *pcpLim)
876 ITextSelectionImpl *This = impl_from_ITextSelection(me);
878 return CO_E_RELEASED;
880 FIXME("not implemented\n");
884 static HRESULT WINAPI ITextSelection_fnSetEnd(ITextSelection *me, LONG cpLim)
886 ITextSelectionImpl *This = impl_from_ITextSelection(me);
888 return CO_E_RELEASED;
890 FIXME("not implemented\n");
894 static HRESULT WINAPI ITextSelection_fnGetFont(ITextSelection *me, ITextFont **pFont)
896 ITextSelectionImpl *This = impl_from_ITextSelection(me);
898 return CO_E_RELEASED;
900 FIXME("not implemented\n");
904 static HRESULT WINAPI ITextSelection_fnSetFont(ITextSelection *me, ITextFont *pFont)
906 ITextSelectionImpl *This = impl_from_ITextSelection(me);
908 return CO_E_RELEASED;
910 FIXME("not implemented\n");
914 static HRESULT WINAPI ITextSelection_fnGetPara(ITextSelection *me, ITextPara **ppPara)
916 ITextSelectionImpl *This = impl_from_ITextSelection(me);
918 return CO_E_RELEASED;
920 FIXME("not implemented\n");
924 static HRESULT WINAPI ITextSelection_fnSetPara(ITextSelection *me, ITextPara *pPara)
926 ITextSelectionImpl *This = impl_from_ITextSelection(me);
928 return CO_E_RELEASED;
930 FIXME("not implemented\n");
934 static HRESULT WINAPI ITextSelection_fnGetStoryLength(ITextSelection *me, LONG *pcch)
936 ITextSelectionImpl *This = impl_from_ITextSelection(me);
938 return CO_E_RELEASED;
940 FIXME("not implemented\n");
944 static HRESULT WINAPI ITextSelection_fnGetStoryType(ITextSelection *me, LONG *pValue)
946 ITextSelectionImpl *This = impl_from_ITextSelection(me);
948 return CO_E_RELEASED;
950 FIXME("not implemented\n");
954 static HRESULT WINAPI ITextSelection_fnCollapse(ITextSelection *me, LONG bStart)
956 ITextSelectionImpl *This = impl_from_ITextSelection(me);
958 return CO_E_RELEASED;
960 FIXME("not implemented\n");
964 static HRESULT WINAPI ITextSelection_fnExpand(ITextSelection *me, LONG Unit, LONG *pDelta)
966 ITextSelectionImpl *This = impl_from_ITextSelection(me);
968 return CO_E_RELEASED;
970 FIXME("not implemented\n");
974 static HRESULT WINAPI ITextSelection_fnGetIndex(ITextSelection *me, LONG Unit, LONG *pIndex)
976 ITextSelectionImpl *This = impl_from_ITextSelection(me);
978 return CO_E_RELEASED;
980 FIXME("not implemented\n");
984 static HRESULT WINAPI ITextSelection_fnSetIndex(ITextSelection *me, LONG Unit, LONG Index,
987 ITextSelectionImpl *This = impl_from_ITextSelection(me);
989 return CO_E_RELEASED;
991 FIXME("not implemented\n");
995 static HRESULT WINAPI ITextSelection_fnSetRange(ITextSelection *me, LONG cpActive, LONG cpOther)
997 ITextSelectionImpl *This = impl_from_ITextSelection(me);
999 return CO_E_RELEASED;
1001 FIXME("not implemented\n");
1005 static HRESULT WINAPI ITextSelection_fnInRange(ITextSelection *me, ITextRange *pRange, LONG *pb)
1007 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1009 return CO_E_RELEASED;
1011 FIXME("not implemented\n");
1015 static HRESULT WINAPI ITextSelection_fnInStory(ITextSelection *me, ITextRange *pRange, LONG *pb)
1017 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1019 return CO_E_RELEASED;
1021 FIXME("not implemented\n");
1025 static HRESULT WINAPI ITextSelection_fnIsEqual(ITextSelection *me, ITextRange *pRange, LONG *pb)
1027 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1029 return CO_E_RELEASED;
1031 FIXME("not implemented\n");
1035 static HRESULT WINAPI ITextSelection_fnSelect(ITextSelection *me)
1037 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1039 return CO_E_RELEASED;
1041 FIXME("not implemented\n");
1045 static HRESULT WINAPI ITextSelection_fnStartOf(ITextSelection *me, LONG Unit, LONG Extend,
1048 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1050 return CO_E_RELEASED;
1052 FIXME("not implemented\n");
1056 static HRESULT WINAPI ITextSelection_fnEndOf(ITextSelection *me, LONG Unit, LONG Extend,
1059 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1061 return CO_E_RELEASED;
1063 FIXME("not implemented\n");
1067 static HRESULT WINAPI ITextSelection_fnMove(ITextSelection *me, LONG Unit, LONG Count, LONG *pDelta)
1069 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1071 return CO_E_RELEASED;
1073 FIXME("not implemented\n");
1077 static HRESULT WINAPI ITextSelection_fnMoveStart(ITextSelection *me, LONG Unit, LONG Count,
1080 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1082 return CO_E_RELEASED;
1084 FIXME("not implemented\n");
1088 static HRESULT WINAPI ITextSelection_fnMoveEnd(ITextSelection *me, LONG Unit, LONG Count,
1091 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1093 return CO_E_RELEASED;
1095 FIXME("not implemented\n");
1099 static HRESULT WINAPI ITextSelection_fnMoveWhile(ITextSelection *me, VARIANT *Cset, LONG Count,
1102 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1104 return CO_E_RELEASED;
1106 FIXME("not implemented\n");
1110 static HRESULT WINAPI ITextSelection_fnMoveStartWhile(ITextSelection *me, VARIANT *Cset, LONG Count,
1113 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1115 return CO_E_RELEASED;
1117 FIXME("not implemented\n");
1121 static HRESULT WINAPI ITextSelection_fnMoveEndWhile(ITextSelection *me, VARIANT *Cset, LONG Count,
1124 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1126 return CO_E_RELEASED;
1128 FIXME("not implemented\n");
1132 static HRESULT WINAPI ITextSelection_fnMoveUntil(ITextSelection *me, VARIANT *Cset, LONG Count,
1135 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1137 return CO_E_RELEASED;
1139 FIXME("not implemented\n");
1143 static HRESULT WINAPI ITextSelection_fnMoveStartUntil(ITextSelection *me, VARIANT *Cset, LONG Count,
1146 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1148 return CO_E_RELEASED;
1150 FIXME("not implemented\n");
1154 static HRESULT WINAPI ITextSelection_fnMoveEndUntil(ITextSelection *me, VARIANT *Cset, LONG Count,
1157 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1159 return CO_E_RELEASED;
1161 FIXME("not implemented\n");
1165 static HRESULT WINAPI ITextSelection_fnFindText(ITextSelection *me, BSTR bstr, LONG cch, LONG Flags,
1168 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1170 return CO_E_RELEASED;
1172 FIXME("not implemented\n");
1176 static HRESULT WINAPI ITextSelection_fnFindTextStart(ITextSelection *me, BSTR bstr, LONG cch,
1177 LONG Flags, LONG *pLength)
1179 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1181 return CO_E_RELEASED;
1183 FIXME("not implemented\n");
1187 static HRESULT WINAPI ITextSelection_fnFindTextEnd(ITextSelection *me, BSTR bstr, LONG cch,
1188 LONG Flags, LONG *pLength)
1190 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1192 return CO_E_RELEASED;
1194 FIXME("not implemented\n");
1198 static HRESULT WINAPI ITextSelection_fnDelete(ITextSelection *me, LONG Unit, LONG Count,
1201 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1203 return CO_E_RELEASED;
1205 FIXME("not implemented\n");
1209 static HRESULT WINAPI ITextSelection_fnCut(ITextSelection *me, VARIANT *pVar)
1211 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1213 return CO_E_RELEASED;
1215 FIXME("not implemented\n");
1219 static HRESULT WINAPI ITextSelection_fnCopy(ITextSelection *me, VARIANT *pVar)
1221 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1223 return CO_E_RELEASED;
1225 FIXME("not implemented\n");
1229 static HRESULT WINAPI ITextSelection_fnPaste(ITextSelection *me, VARIANT *pVar, LONG Format)
1231 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1233 return CO_E_RELEASED;
1235 FIXME("not implemented\n");
1239 static HRESULT WINAPI ITextSelection_fnCanPaste(ITextSelection *me, VARIANT *pVar, LONG Format,
1242 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1244 return CO_E_RELEASED;
1246 FIXME("not implemented\n");
1250 static HRESULT WINAPI ITextSelection_fnCanEdit(ITextSelection *me, LONG *pb)
1252 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1254 return CO_E_RELEASED;
1256 FIXME("not implemented\n");
1260 static HRESULT WINAPI ITextSelection_fnChangeCase(ITextSelection *me, LONG Type)
1262 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1264 return CO_E_RELEASED;
1266 FIXME("not implemented\n");
1270 static HRESULT WINAPI ITextSelection_fnGetPoint(ITextSelection *me, LONG Type, LONG *cx, LONG *cy)
1272 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1274 return CO_E_RELEASED;
1276 FIXME("not implemented\n");
1280 static HRESULT WINAPI ITextSelection_fnSetPoint(ITextSelection *me, LONG x, LONG y, LONG Type,
1283 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1285 return CO_E_RELEASED;
1287 FIXME("not implemented\n");
1291 static HRESULT WINAPI ITextSelection_fnScrollIntoView(ITextSelection *me, LONG Value)
1293 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1295 return CO_E_RELEASED;
1297 FIXME("not implemented\n");
1301 static HRESULT WINAPI ITextSelection_fnGetEmbeddedObject(ITextSelection *me, IUnknown **ppv)
1303 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1305 return CO_E_RELEASED;
1307 FIXME("not implemented\n");
1311 /*** ITextSelection methods ***/
1312 static HRESULT WINAPI ITextSelection_fnGetFlags(ITextSelection *me, LONG *pFlags)
1314 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1316 return CO_E_RELEASED;
1318 FIXME("not implemented\n");
1322 static HRESULT WINAPI ITextSelection_fnSetFlags(ITextSelection *me, LONG Flags)
1324 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1326 return CO_E_RELEASED;
1328 FIXME("not implemented\n");
1332 static HRESULT WINAPI ITextSelection_fnGetType(ITextSelection *me, LONG *pType)
1334 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1336 return CO_E_RELEASED;
1338 FIXME("not implemented\n");
1342 static HRESULT WINAPI ITextSelection_fnMoveLeft(ITextSelection *me, LONG Unit, LONG Count,
1343 LONG Extend, LONG *pDelta)
1345 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1347 return CO_E_RELEASED;
1349 FIXME("not implemented\n");
1353 static HRESULT WINAPI ITextSelection_fnMoveRight(ITextSelection *me, LONG Unit, LONG Count,
1354 LONG Extend, LONG *pDelta)
1356 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1358 return CO_E_RELEASED;
1360 FIXME("not implemented\n");
1364 static HRESULT WINAPI ITextSelection_fnMoveUp(ITextSelection *me, LONG Unit, LONG Count,
1365 LONG Extend, LONG *pDelta)
1367 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1369 return CO_E_RELEASED;
1371 FIXME("not implemented\n");
1375 static HRESULT WINAPI ITextSelection_fnMoveDown(ITextSelection *me, LONG Unit, LONG Count,
1376 LONG Extend, LONG *pDelta)
1378 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1380 return CO_E_RELEASED;
1382 FIXME("not implemented\n");
1386 static HRESULT WINAPI ITextSelection_fnHomeKey(ITextSelection *me, LONG Unit, LONG Extend,
1389 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1391 return CO_E_RELEASED;
1393 FIXME("not implemented\n");
1397 static HRESULT WINAPI ITextSelection_fnEndKey(ITextSelection *me, LONG Unit, LONG Extend,
1400 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1402 return CO_E_RELEASED;
1404 FIXME("not implemented\n");
1408 static HRESULT WINAPI ITextSelection_fnTypeText(ITextSelection *me, BSTR bstr)
1410 ITextSelectionImpl *This = impl_from_ITextSelection(me);
1412 return CO_E_RELEASED;
1414 FIXME("not implemented\n");
1418 static const ITextSelectionVtbl tsvt = {
1419 ITextSelection_fnQueryInterface,
1420 ITextSelection_fnAddRef,
1421 ITextSelection_fnRelease,
1422 ITextSelection_fnGetTypeInfoCount,
1423 ITextSelection_fnGetTypeInfo,
1424 ITextSelection_fnGetIDsOfNames,
1425 ITextSelection_fnInvoke,
1426 ITextSelection_fnGetText,
1427 ITextSelection_fnSetText,
1428 ITextSelection_fnGetChar,
1429 ITextSelection_fnSetChar,
1430 ITextSelection_fnGetDuplicate,
1431 ITextSelection_fnGetFormattedText,
1432 ITextSelection_fnSetFormattedText,
1433 ITextSelection_fnGetStart,
1434 ITextSelection_fnSetStart,
1435 ITextSelection_fnGetEnd,
1436 ITextSelection_fnSetEnd,
1437 ITextSelection_fnGetFont,
1438 ITextSelection_fnSetFont,
1439 ITextSelection_fnGetPara,
1440 ITextSelection_fnSetPara,
1441 ITextSelection_fnGetStoryLength,
1442 ITextSelection_fnGetStoryType,
1443 ITextSelection_fnCollapse,
1444 ITextSelection_fnExpand,
1445 ITextSelection_fnGetIndex,
1446 ITextSelection_fnSetIndex,
1447 ITextSelection_fnSetRange,
1448 ITextSelection_fnInRange,
1449 ITextSelection_fnInStory,
1450 ITextSelection_fnIsEqual,
1451 ITextSelection_fnSelect,
1452 ITextSelection_fnStartOf,
1453 ITextSelection_fnEndOf,
1454 ITextSelection_fnMove,
1455 ITextSelection_fnMoveStart,
1456 ITextSelection_fnMoveEnd,
1457 ITextSelection_fnMoveWhile,
1458 ITextSelection_fnMoveStartWhile,
1459 ITextSelection_fnMoveEndWhile,
1460 ITextSelection_fnMoveUntil,
1461 ITextSelection_fnMoveStartUntil,
1462 ITextSelection_fnMoveEndUntil,
1463 ITextSelection_fnFindText,
1464 ITextSelection_fnFindTextStart,
1465 ITextSelection_fnFindTextEnd,
1466 ITextSelection_fnDelete,
1467 ITextSelection_fnCut,
1468 ITextSelection_fnCopy,
1469 ITextSelection_fnPaste,
1470 ITextSelection_fnCanPaste,
1471 ITextSelection_fnCanEdit,
1472 ITextSelection_fnChangeCase,
1473 ITextSelection_fnGetPoint,
1474 ITextSelection_fnSetPoint,
1475 ITextSelection_fnScrollIntoView,
1476 ITextSelection_fnGetEmbeddedObject,
1477 ITextSelection_fnGetFlags,
1478 ITextSelection_fnSetFlags,
1479 ITextSelection_fnGetType,
1480 ITextSelection_fnMoveLeft,
1481 ITextSelection_fnMoveRight,
1482 ITextSelection_fnMoveUp,
1483 ITextSelection_fnMoveDown,
1484 ITextSelection_fnHomeKey,
1485 ITextSelection_fnEndKey,
1486 ITextSelection_fnTypeText
1489 static ITextSelectionImpl *
1490 CreateTextSelection(IRichEditOleImpl *reOle)
1492 ITextSelectionImpl *txtSel = heap_alloc(sizeof *txtSel);
1496 txtSel->ITextSelection_iface.lpVtbl = &tsvt;
1498 txtSel->reOle = reOle;
1502 LRESULT CreateIRichEditOle(ME_TextEditor *editor, LPVOID *ppObj)
1504 IRichEditOleImpl *reo;
1506 reo = heap_alloc(sizeof(IRichEditOleImpl));
1510 reo->IRichEditOle_iface.lpVtbl = &revt;
1511 reo->ITextDocument_iface.lpVtbl = &tdvt;
1513 reo->editor = editor;
1514 reo->txtSel = CreateTextSelection(reo);
1520 reo->clientSite = CreateOleClientSite(reo);
1523 ITextSelection_Release(&reo->txtSel->ITextSelection_iface);
1527 TRACE("Created %p\n",reo);
1533 static void convert_sizel(ME_Context *c, const SIZEL* szl, SIZE* sz)
1535 /* sizel is in .01 millimeters, sz in pixels */
1536 sz->cx = MulDiv(szl->cx, c->dpi.cx, 2540);
1537 sz->cy = MulDiv(szl->cy, c->dpi.cy, 2540);
1540 /******************************************************************************
1541 * ME_GetOLEObjectSize
1543 * Sets run extent for OLE objects.
1545 void ME_GetOLEObjectSize(ME_Context *c, ME_Run *run, SIZE *pSize)
1553 assert(run->nFlags & MERF_GRAPHICS);
1554 assert(run->ole_obj);
1556 if (run->ole_obj->sizel.cx != 0 || run->ole_obj->sizel.cy != 0)
1558 convert_sizel(c, &run->ole_obj->sizel, pSize);
1559 if (c->editor->nZoomNumerator != 0)
1561 pSize->cx = MulDiv(pSize->cx, c->editor->nZoomNumerator, c->editor->nZoomDenominator);
1562 pSize->cy = MulDiv(pSize->cy, c->editor->nZoomNumerator, c->editor->nZoomDenominator);
1567 IOleObject_QueryInterface(run->ole_obj->poleobj, &IID_IDataObject, (void**)&ido);
1568 fmt.cfFormat = CF_BITMAP;
1570 fmt.dwAspect = DVASPECT_CONTENT;
1572 fmt.tymed = TYMED_GDI;
1573 if (IDataObject_GetData(ido, &fmt, &stgm) != S_OK)
1575 fmt.cfFormat = CF_ENHMETAFILE;
1576 fmt.tymed = TYMED_ENHMF;
1577 if (IDataObject_GetData(ido, &fmt, &stgm) != S_OK)
1579 FIXME("unsupported format\n");
1580 pSize->cx = pSize->cy = 0;
1581 IDataObject_Release(ido);
1589 GetObjectW(stgm.u.hBitmap, sizeof(dibsect), &dibsect);
1590 pSize->cx = dibsect.dsBm.bmWidth;
1591 pSize->cy = dibsect.dsBm.bmHeight;
1592 if (!stgm.pUnkForRelease) DeleteObject(stgm.u.hBitmap);
1595 GetEnhMetaFileHeader(stgm.u.hEnhMetaFile, sizeof(emh), &emh);
1596 pSize->cx = emh.rclBounds.right - emh.rclBounds.left;
1597 pSize->cy = emh.rclBounds.bottom - emh.rclBounds.top;
1598 if (!stgm.pUnkForRelease) DeleteEnhMetaFile(stgm.u.hEnhMetaFile);
1601 FIXME("Unsupported tymed %d\n", stgm.tymed);
1604 IDataObject_Release(ido);
1605 if (c->editor->nZoomNumerator != 0)
1607 pSize->cx = MulDiv(pSize->cx, c->editor->nZoomNumerator, c->editor->nZoomDenominator);
1608 pSize->cy = MulDiv(pSize->cy, c->editor->nZoomNumerator, c->editor->nZoomDenominator);
1612 void ME_DrawOLE(ME_Context *c, int x, int y, ME_Run *run,
1613 ME_Paragraph *para, BOOL selected)
1624 assert(run->nFlags & MERF_GRAPHICS);
1625 assert(run->ole_obj);
1626 if (IOleObject_QueryInterface(run->ole_obj->poleobj, &IID_IDataObject, (void**)&ido) != S_OK)
1628 FIXME("Couldn't get interface\n");
1631 has_size = run->ole_obj->sizel.cx != 0 || run->ole_obj->sizel.cy != 0;
1632 fmt.cfFormat = CF_BITMAP;
1634 fmt.dwAspect = DVASPECT_CONTENT;
1636 fmt.tymed = TYMED_GDI;
1637 if (IDataObject_GetData(ido, &fmt, &stgm) != S_OK)
1639 fmt.cfFormat = CF_ENHMETAFILE;
1640 fmt.tymed = TYMED_ENHMF;
1641 if (IDataObject_GetData(ido, &fmt, &stgm) != S_OK)
1643 FIXME("Couldn't get storage medium\n");
1644 IDataObject_Release(ido);
1651 GetObjectW(stgm.u.hBitmap, sizeof(dibsect), &dibsect);
1652 hMemDC = CreateCompatibleDC(c->hDC);
1653 SelectObject(hMemDC, stgm.u.hBitmap);
1656 convert_sizel(c, &run->ole_obj->sizel, &sz);
1658 sz.cx = MulDiv(dibsect.dsBm.bmWidth, c->dpi.cx, 96);
1659 sz.cy = MulDiv(dibsect.dsBm.bmHeight, c->dpi.cy, 96);
1661 if (c->editor->nZoomNumerator != 0)
1663 sz.cx = MulDiv(sz.cx, c->editor->nZoomNumerator, c->editor->nZoomDenominator);
1664 sz.cy = MulDiv(sz.cy, c->editor->nZoomNumerator, c->editor->nZoomDenominator);
1666 if (sz.cx == dibsect.dsBm.bmWidth && sz.cy == dibsect.dsBm.bmHeight)
1668 BitBlt(c->hDC, x, y - sz.cy,
1669 dibsect.dsBm.bmWidth, dibsect.dsBm.bmHeight,
1670 hMemDC, 0, 0, SRCCOPY);
1672 StretchBlt(c->hDC, x, y - sz.cy, sz.cx, sz.cy,
1673 hMemDC, 0, 0, dibsect.dsBm.bmWidth,
1674 dibsect.dsBm.bmHeight, SRCCOPY);
1676 if (!stgm.pUnkForRelease) DeleteObject(stgm.u.hBitmap);
1679 GetEnhMetaFileHeader(stgm.u.hEnhMetaFile, sizeof(emh), &emh);
1682 convert_sizel(c, &run->ole_obj->sizel, &sz);
1684 sz.cy = MulDiv(emh.rclBounds.bottom - emh.rclBounds.top, c->dpi.cx, 96);
1685 sz.cx = MulDiv(emh.rclBounds.right - emh.rclBounds.left, c->dpi.cy, 96);
1687 if (c->editor->nZoomNumerator != 0)
1689 sz.cx = MulDiv(sz.cx, c->editor->nZoomNumerator, c->editor->nZoomDenominator);
1690 sz.cy = MulDiv(sz.cy, c->editor->nZoomNumerator, c->editor->nZoomDenominator);
1698 rc.right = x + sz.cx;
1700 PlayEnhMetaFile(c->hDC, stgm.u.hEnhMetaFile, &rc);
1702 if (!stgm.pUnkForRelease) DeleteEnhMetaFile(stgm.u.hEnhMetaFile);
1705 FIXME("Unsupported tymed %d\n", stgm.tymed);
1709 if (selected && !c->editor->bHideSelection)
1710 PatBlt(c->hDC, x, y - sz.cy, sz.cx, sz.cy, DSTINVERT);
1711 IDataObject_Release(ido);
1714 void ME_DeleteReObject(REOBJECT* reo)
1716 if (reo->poleobj) IOleObject_Release(reo->poleobj);
1717 if (reo->pstg) IStorage_Release(reo->pstg);
1718 if (reo->polesite) IOleClientSite_Release(reo->polesite);
1722 void ME_CopyReObject(REOBJECT* dst, const REOBJECT* src)
1726 if (dst->poleobj) IOleObject_AddRef(dst->poleobj);
1727 if (dst->pstg) IStorage_AddRef(dst->pstg);
1728 if (dst->polesite) IOleClientSite_AddRef(dst->polesite);