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
);
321 TRACE("(%p,%p,%d)\n",This
, lpchrg
, reco
);
325 int nFrom
, nTo
, nStartCur
= ME_GetSelectionOfs(This
->editor
, &nFrom
, &nTo
);
326 start
= This
->editor
->pCursors
[nStartCur
];
327 nChars
= nTo
- nFrom
;
329 ME_CursorFromCharOfs(This
->editor
, lpchrg
->cpMin
, &start
);
330 nChars
= lpchrg
->cpMax
- lpchrg
->cpMin
;
332 return ME_GetDataObject(This
->editor
, &start
, nChars
, lplpdataobj
);
335 static LONG WINAPI
IRichEditOle_fnGetLinkCount(IRichEditOle
*me
)
337 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
338 FIXME("stub %p\n",This
);
342 static HRESULT WINAPI
343 IRichEditOle_fnGetObject(IRichEditOle
*me
, LONG iob
,
344 REOBJECT
*lpreobject
, DWORD dwFlags
)
346 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
347 FIXME("stub %p\n",This
);
352 IRichEditOle_fnGetObjectCount(IRichEditOle
*me
)
354 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
355 FIXME("stub %p\n",This
);
359 static HRESULT WINAPI
360 IRichEditOle_fnHandsOffStorage(IRichEditOle
*me
, LONG iob
)
362 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
363 FIXME("stub %p\n",This
);
367 static HRESULT WINAPI
368 IRichEditOle_fnImportDataObject(IRichEditOle
*me
, LPDATAOBJECT lpdataobj
,
369 CLIPFORMAT cf
, HGLOBAL hMetaPict
)
371 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
372 FIXME("stub %p\n",This
);
376 static HRESULT WINAPI
377 IRichEditOle_fnInPlaceDeactivate(IRichEditOle
*me
)
379 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
380 FIXME("stub %p\n",This
);
384 static HRESULT WINAPI
385 IRichEditOle_fnInsertObject(IRichEditOle
*me
, REOBJECT
*reo
)
387 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
388 TRACE("(%p,%p)\n", This
, reo
);
390 if (reo
->cbStruct
< sizeof(*reo
)) return STG_E_INVALIDPARAMETER
;
391 if (reo
->poleobj
) IOleObject_AddRef(reo
->poleobj
);
392 if (reo
->pstg
) IStorage_AddRef(reo
->pstg
);
393 if (reo
->polesite
) IOleClientSite_AddRef(reo
->polesite
);
395 ME_InsertOLEFromCursor(This
->editor
, reo
, 0);
396 ME_CommitUndo(This
->editor
);
397 ME_UpdateRepaint(This
->editor
);
401 static HRESULT WINAPI
IRichEditOle_fnSaveCompleted(IRichEditOle
*me
, LONG iob
,
404 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
405 FIXME("stub %p\n",This
);
409 static HRESULT WINAPI
410 IRichEditOle_fnSetDvaspect(IRichEditOle
*me
, LONG iob
, DWORD dvaspect
)
412 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
413 FIXME("stub %p\n",This
);
417 static HRESULT WINAPI
IRichEditOle_fnSetHostNames(IRichEditOle
*me
,
418 LPCSTR lpstrContainerApp
, LPCSTR lpstrContainerObj
)
420 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
421 FIXME("stub %p %s %s\n",This
, lpstrContainerApp
, lpstrContainerObj
);
425 static HRESULT WINAPI
426 IRichEditOle_fnSetLinkAvailable(IRichEditOle
*me
, LONG iob
, BOOL fAvailable
)
428 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
429 FIXME("stub %p\n",This
);
433 static const IRichEditOleVtbl revt
= {
434 IRichEditOle_fnQueryInterface
,
435 IRichEditOle_fnAddRef
,
436 IRichEditOle_fnRelease
,
437 IRichEditOle_fnGetClientSite
,
438 IRichEditOle_fnGetObjectCount
,
439 IRichEditOle_fnGetLinkCount
,
440 IRichEditOle_fnGetObject
,
441 IRichEditOle_fnInsertObject
,
442 IRichEditOle_fnConvertObject
,
443 IRichEditOle_fnActivateAs
,
444 IRichEditOle_fnSetHostNames
,
445 IRichEditOle_fnSetLinkAvailable
,
446 IRichEditOle_fnSetDvaspect
,
447 IRichEditOle_fnHandsOffStorage
,
448 IRichEditOle_fnSaveCompleted
,
449 IRichEditOle_fnInPlaceDeactivate
,
450 IRichEditOle_fnContextSensitiveHelp
,
451 IRichEditOle_fnGetClipboardData
,
452 IRichEditOle_fnImportDataObject
455 static HRESULT WINAPI
456 ITextDocument_fnQueryInterface(ITextDocument
* me
, REFIID riid
,
459 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
460 return IRichEditOle_fnQueryInterface((IRichEditOle
*)&This
->lpRichEditOleVtbl
,
465 ITextDocument_fnAddRef(ITextDocument
* me
)
467 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
468 return IRichEditOle_fnAddRef((IRichEditOle
*)&This
->lpRichEditOleVtbl
);
472 ITextDocument_fnRelease(ITextDocument
* me
)
474 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
475 return IRichEditOle_fnRelease((IRichEditOle
*)&This
->lpRichEditOleVtbl
);
478 static HRESULT WINAPI
479 ITextDocument_fnGetTypeInfoCount(ITextDocument
* me
,
482 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
483 FIXME("stub %p\n",This
);
487 static HRESULT WINAPI
488 ITextDocument_fnGetTypeInfo(ITextDocument
* me
, UINT iTInfo
, LCID lcid
,
491 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
492 FIXME("stub %p\n",This
);
496 static HRESULT WINAPI
497 ITextDocument_fnGetIDsOfNames(ITextDocument
* me
, REFIID riid
,
498 LPOLESTR
* rgszNames
, UINT cNames
, LCID lcid
, DISPID
* rgDispId
)
500 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
501 FIXME("stub %p\n",This
);
505 static HRESULT WINAPI
506 ITextDocument_fnInvoke(ITextDocument
* me
, DISPID dispIdMember
,
507 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
* pDispParams
,
508 VARIANT
* pVarResult
, EXCEPINFO
* pExcepInfo
, UINT
* puArgErr
)
510 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
511 FIXME("stub %p\n",This
);
515 static HRESULT WINAPI
516 ITextDocument_fnGetName(ITextDocument
* me
, BSTR
* pName
)
518 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
519 FIXME("stub %p\n",This
);
523 static HRESULT WINAPI
524 ITextDocument_fnGetSelection(ITextDocument
* me
, ITextSelection
** ppSel
)
526 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
528 *ppSel
= (ITextSelection
*) This
->txtSel
;
529 ITextSelection_AddRef(*ppSel
);
533 static HRESULT WINAPI
534 ITextDocument_fnGetStoryCount(ITextDocument
* me
, LONG
* pCount
)
536 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
537 FIXME("stub %p\n",This
);
541 static HRESULT WINAPI
542 ITextDocument_fnGetStoryRanges(ITextDocument
* me
,
543 ITextStoryRanges
** ppStories
)
545 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
546 FIXME("stub %p\n",This
);
550 static HRESULT WINAPI
551 ITextDocument_fnGetSaved(ITextDocument
* me
, LONG
* pValue
)
553 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
554 FIXME("stub %p\n",This
);
558 static HRESULT WINAPI
559 ITextDocument_fnSetSaved(ITextDocument
* me
, LONG Value
)
561 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
562 FIXME("stub %p\n",This
);
566 static HRESULT WINAPI
567 ITextDocument_fnGetDefaultTabStop(ITextDocument
* me
, float* pValue
)
569 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
570 FIXME("stub %p\n",This
);
574 static HRESULT WINAPI
575 ITextDocument_fnSetDefaultTabStop(ITextDocument
* me
, float Value
)
577 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
578 FIXME("stub %p\n",This
);
582 static HRESULT WINAPI
583 ITextDocument_fnNew(ITextDocument
* me
)
585 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
586 FIXME("stub %p\n",This
);
590 static HRESULT WINAPI
591 ITextDocument_fnOpen(ITextDocument
* me
, VARIANT
* pVar
, LONG Flags
,
594 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
595 FIXME("stub %p\n",This
);
599 static HRESULT WINAPI
600 ITextDocument_fnSave(ITextDocument
* me
, VARIANT
* pVar
, LONG Flags
,
603 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
604 FIXME("stub %p\n",This
);
608 static HRESULT WINAPI
609 ITextDocument_fnFreeze(ITextDocument
* me
, LONG
* pCount
)
611 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
612 FIXME("stub %p\n",This
);
616 static HRESULT WINAPI
617 ITextDocument_fnUnfreeze(ITextDocument
* me
, LONG
* pCount
)
619 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
620 FIXME("stub %p\n",This
);
624 static HRESULT WINAPI
625 ITextDocument_fnBeginEditCollection(ITextDocument
* me
)
627 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
628 FIXME("stub %p\n",This
);
632 static HRESULT WINAPI
633 ITextDocument_fnEndEditCollection(ITextDocument
* me
)
635 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
636 FIXME("stub %p\n",This
);
640 static HRESULT WINAPI
641 ITextDocument_fnUndo(ITextDocument
* me
, LONG Count
, LONG
* prop
)
643 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
644 FIXME("stub %p\n",This
);
648 static HRESULT WINAPI
649 ITextDocument_fnRedo(ITextDocument
* me
, LONG Count
, LONG
* prop
)
651 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
652 FIXME("stub %p\n",This
);
656 static HRESULT WINAPI
657 ITextDocument_fnRange(ITextDocument
* me
, LONG cp1
, LONG cp2
,
658 ITextRange
** ppRange
)
660 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
661 FIXME("stub %p\n",This
);
665 static HRESULT WINAPI
666 ITextDocument_fnRangeFromPoint(ITextDocument
* me
, LONG x
, LONG y
,
667 ITextRange
** ppRange
)
669 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
670 FIXME("stub %p\n",This
);
674 static const ITextDocumentVtbl tdvt
= {
675 ITextDocument_fnQueryInterface
,
676 ITextDocument_fnAddRef
,
677 ITextDocument_fnRelease
,
678 ITextDocument_fnGetTypeInfoCount
,
679 ITextDocument_fnGetTypeInfo
,
680 ITextDocument_fnGetIDsOfNames
,
681 ITextDocument_fnInvoke
,
682 ITextDocument_fnGetName
,
683 ITextDocument_fnGetSelection
,
684 ITextDocument_fnGetStoryCount
,
685 ITextDocument_fnGetStoryRanges
,
686 ITextDocument_fnGetSaved
,
687 ITextDocument_fnSetSaved
,
688 ITextDocument_fnGetDefaultTabStop
,
689 ITextDocument_fnSetDefaultTabStop
,
691 ITextDocument_fnOpen
,
692 ITextDocument_fnSave
,
693 ITextDocument_fnFreeze
,
694 ITextDocument_fnUnfreeze
,
695 ITextDocument_fnBeginEditCollection
,
696 ITextDocument_fnEndEditCollection
,
697 ITextDocument_fnUndo
,
698 ITextDocument_fnRedo
,
699 ITextDocument_fnRange
,
700 ITextDocument_fnRangeFromPoint
703 static HRESULT WINAPI
ITextSelection_fnQueryInterface(
709 if (IsEqualGUID(riid
, &IID_IUnknown
)
710 || IsEqualGUID(riid
, &IID_IDispatch
)
711 || IsEqualGUID(riid
, &IID_ITextRange
)
712 || IsEqualGUID(riid
, &IID_ITextSelection
))
715 ITextSelection_AddRef(me
);
719 return E_NOINTERFACE
;
722 static ULONG WINAPI
ITextSelection_fnAddRef(
725 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
726 return InterlockedIncrement(&This
->ref
);
729 static ULONG WINAPI
ITextSelection_fnRelease(
732 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
733 ULONG ref
= InterlockedDecrement(&This
->ref
);
739 static HRESULT WINAPI
ITextSelection_fnGetTypeInfoCount(
743 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
745 return CO_E_RELEASED
;
747 FIXME("not implemented\n");
751 static HRESULT WINAPI
ITextSelection_fnGetTypeInfo(
757 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
759 return CO_E_RELEASED
;
761 FIXME("not implemented\n");
765 static HRESULT WINAPI
ITextSelection_fnGetIDsOfNames(
773 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
775 return CO_E_RELEASED
;
777 FIXME("not implemented\n");
781 static HRESULT WINAPI
ITextSelection_fnInvoke(
787 DISPPARAMS
*pDispParams
,
789 EXCEPINFO
*pExcepInfo
,
792 FIXME("not implemented\n");
796 /*** ITextRange methods ***/
797 static HRESULT WINAPI
ITextSelection_fnGetText(
801 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
803 return CO_E_RELEASED
;
805 FIXME("not implemented\n");
809 static HRESULT WINAPI
ITextSelection_fnSetText(
813 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
815 return CO_E_RELEASED
;
817 FIXME("not implemented\n");
821 static HRESULT WINAPI
ITextSelection_fnGetChar(
825 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
827 return CO_E_RELEASED
;
829 FIXME("not implemented\n");
833 static HRESULT WINAPI
ITextSelection_fnSetChar(
837 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
839 return CO_E_RELEASED
;
841 FIXME("not implemented\n");
845 static HRESULT WINAPI
ITextSelection_fnGetDuplicate(
847 ITextRange
**ppRange
)
849 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
851 return CO_E_RELEASED
;
853 FIXME("not implemented\n");
857 static HRESULT WINAPI
ITextSelection_fnGetFormattedText(
859 ITextRange
**ppRange
)
861 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
863 return CO_E_RELEASED
;
865 FIXME("not implemented\n");
869 static HRESULT WINAPI
ITextSelection_fnSetFormattedText(
873 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
875 return CO_E_RELEASED
;
877 FIXME("not implemented\n");
881 static HRESULT WINAPI
ITextSelection_fnGetStart(
885 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
887 return CO_E_RELEASED
;
889 FIXME("not implemented\n");
893 static HRESULT WINAPI
ITextSelection_fnSetStart(
897 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
899 return CO_E_RELEASED
;
901 FIXME("not implemented\n");
905 static HRESULT WINAPI
ITextSelection_fnGetEnd(
909 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
911 return CO_E_RELEASED
;
913 FIXME("not implemented\n");
917 static HRESULT WINAPI
ITextSelection_fnSetEnd(
921 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
923 return CO_E_RELEASED
;
925 FIXME("not implemented\n");
929 static HRESULT WINAPI
ITextSelection_fnGetFont(
933 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
935 return CO_E_RELEASED
;
937 FIXME("not implemented\n");
941 static HRESULT WINAPI
ITextSelection_fnSetFont(
945 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
947 return CO_E_RELEASED
;
949 FIXME("not implemented\n");
953 static HRESULT WINAPI
ITextSelection_fnGetPara(
957 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
959 return CO_E_RELEASED
;
961 FIXME("not implemented\n");
965 static HRESULT WINAPI
ITextSelection_fnSetPara(
969 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
971 return CO_E_RELEASED
;
973 FIXME("not implemented\n");
977 static HRESULT WINAPI
ITextSelection_fnGetStoryLength(
981 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
983 return CO_E_RELEASED
;
985 FIXME("not implemented\n");
989 static HRESULT WINAPI
ITextSelection_fnGetStoryType(
993 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
995 return CO_E_RELEASED
;
997 FIXME("not implemented\n");
1001 static HRESULT WINAPI
ITextSelection_fnCollapse(
1005 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1007 return CO_E_RELEASED
;
1009 FIXME("not implemented\n");
1013 static HRESULT WINAPI
ITextSelection_fnExpand(
1018 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1020 return CO_E_RELEASED
;
1022 FIXME("not implemented\n");
1026 static HRESULT WINAPI
ITextSelection_fnGetIndex(
1031 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1033 return CO_E_RELEASED
;
1035 FIXME("not implemented\n");
1039 static HRESULT WINAPI
ITextSelection_fnSetIndex(
1045 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1047 return CO_E_RELEASED
;
1049 FIXME("not implemented\n");
1053 static HRESULT WINAPI
ITextSelection_fnSetRange(
1058 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1060 return CO_E_RELEASED
;
1062 FIXME("not implemented\n");
1066 static HRESULT WINAPI
ITextSelection_fnInRange(
1071 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1073 return CO_E_RELEASED
;
1075 FIXME("not implemented\n");
1079 static HRESULT WINAPI
ITextSelection_fnInStory(
1084 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1086 return CO_E_RELEASED
;
1088 FIXME("not implemented\n");
1092 static HRESULT WINAPI
ITextSelection_fnIsEqual(
1097 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1099 return CO_E_RELEASED
;
1101 FIXME("not implemented\n");
1105 static HRESULT WINAPI
ITextSelection_fnSelect(
1108 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1110 return CO_E_RELEASED
;
1112 FIXME("not implemented\n");
1116 static HRESULT WINAPI
ITextSelection_fnStartOf(
1122 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1124 return CO_E_RELEASED
;
1126 FIXME("not implemented\n");
1130 static HRESULT WINAPI
ITextSelection_fnEndOf(
1136 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1138 return CO_E_RELEASED
;
1140 FIXME("not implemented\n");
1144 static HRESULT WINAPI
ITextSelection_fnMove(
1150 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1152 return CO_E_RELEASED
;
1154 FIXME("not implemented\n");
1158 static HRESULT WINAPI
ITextSelection_fnMoveStart(
1164 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1166 return CO_E_RELEASED
;
1168 FIXME("not implemented\n");
1172 static HRESULT WINAPI
ITextSelection_fnMoveEnd(
1178 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1180 return CO_E_RELEASED
;
1182 FIXME("not implemented\n");
1186 static HRESULT WINAPI
ITextSelection_fnMoveWhile(
1192 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1194 return CO_E_RELEASED
;
1196 FIXME("not implemented\n");
1200 static HRESULT WINAPI
ITextSelection_fnMoveStartWhile(
1206 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1208 return CO_E_RELEASED
;
1210 FIXME("not implemented\n");
1214 static HRESULT WINAPI
ITextSelection_fnMoveEndWhile(
1220 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1222 return CO_E_RELEASED
;
1224 FIXME("not implemented\n");
1228 static HRESULT WINAPI
ITextSelection_fnMoveUntil(
1234 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1236 return CO_E_RELEASED
;
1238 FIXME("not implemented\n");
1242 static HRESULT WINAPI
ITextSelection_fnMoveStartUntil(
1248 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1250 return CO_E_RELEASED
;
1252 FIXME("not implemented\n");
1256 static HRESULT WINAPI
ITextSelection_fnMoveEndUntil(
1262 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1264 return CO_E_RELEASED
;
1266 FIXME("not implemented\n");
1270 static HRESULT WINAPI
ITextSelection_fnFindText(
1277 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1279 return CO_E_RELEASED
;
1281 FIXME("not implemented\n");
1285 static HRESULT WINAPI
ITextSelection_fnFindTextStart(
1292 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1294 return CO_E_RELEASED
;
1296 FIXME("not implemented\n");
1300 static HRESULT WINAPI
ITextSelection_fnFindTextEnd(
1307 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1309 return CO_E_RELEASED
;
1311 FIXME("not implemented\n");
1315 static HRESULT WINAPI
ITextSelection_fnDelete(
1321 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1323 return CO_E_RELEASED
;
1325 FIXME("not implemented\n");
1329 static HRESULT WINAPI
ITextSelection_fnCut(
1333 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1335 return CO_E_RELEASED
;
1337 FIXME("not implemented\n");
1341 static HRESULT WINAPI
ITextSelection_fnCopy(
1345 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1347 return CO_E_RELEASED
;
1349 FIXME("not implemented\n");
1353 static HRESULT WINAPI
ITextSelection_fnPaste(
1358 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1360 return CO_E_RELEASED
;
1362 FIXME("not implemented\n");
1366 static HRESULT WINAPI
ITextSelection_fnCanPaste(
1372 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1374 return CO_E_RELEASED
;
1376 FIXME("not implemented\n");
1380 static HRESULT WINAPI
ITextSelection_fnCanEdit(
1384 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1386 return CO_E_RELEASED
;
1388 FIXME("not implemented\n");
1392 static HRESULT WINAPI
ITextSelection_fnChangeCase(
1396 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1398 return CO_E_RELEASED
;
1400 FIXME("not implemented\n");
1404 static HRESULT WINAPI
ITextSelection_fnGetPoint(
1410 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1412 return CO_E_RELEASED
;
1414 FIXME("not implemented\n");
1418 static HRESULT WINAPI
ITextSelection_fnSetPoint(
1425 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1427 return CO_E_RELEASED
;
1429 FIXME("not implemented\n");
1433 static HRESULT WINAPI
ITextSelection_fnScrollIntoView(
1437 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1439 return CO_E_RELEASED
;
1441 FIXME("not implemented\n");
1445 static HRESULT WINAPI
ITextSelection_fnGetEmbeddedObject(
1449 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1451 return CO_E_RELEASED
;
1453 FIXME("not implemented\n");
1457 /*** ITextSelection methods ***/
1458 static HRESULT WINAPI
ITextSelection_fnGetFlags(
1462 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1464 return CO_E_RELEASED
;
1466 FIXME("not implemented\n");
1470 static HRESULT WINAPI
ITextSelection_fnSetFlags(
1474 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1476 return CO_E_RELEASED
;
1478 FIXME("not implemented\n");
1482 static HRESULT WINAPI
ITextSelection_fnGetType(
1486 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1488 return CO_E_RELEASED
;
1490 FIXME("not implemented\n");
1494 static HRESULT WINAPI
ITextSelection_fnMoveLeft(
1501 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1503 return CO_E_RELEASED
;
1505 FIXME("not implemented\n");
1509 static HRESULT WINAPI
ITextSelection_fnMoveRight(
1516 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1518 return CO_E_RELEASED
;
1520 FIXME("not implemented\n");
1524 static HRESULT WINAPI
ITextSelection_fnMoveUp(
1531 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1533 return CO_E_RELEASED
;
1535 FIXME("not implemented\n");
1539 static HRESULT WINAPI
ITextSelection_fnMoveDown(
1546 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1548 return CO_E_RELEASED
;
1550 FIXME("not implemented\n");
1554 static HRESULT WINAPI
ITextSelection_fnHomeKey(
1560 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1562 return CO_E_RELEASED
;
1564 FIXME("not implemented\n");
1568 static HRESULT WINAPI
ITextSelection_fnEndKey(
1574 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1576 return CO_E_RELEASED
;
1578 FIXME("not implemented\n");
1582 static HRESULT WINAPI
ITextSelection_fnTypeText(
1586 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1588 return CO_E_RELEASED
;
1590 FIXME("not implemented\n");
1594 static const ITextSelectionVtbl tsvt
= {
1595 ITextSelection_fnQueryInterface
,
1596 ITextSelection_fnAddRef
,
1597 ITextSelection_fnRelease
,
1598 ITextSelection_fnGetTypeInfoCount
,
1599 ITextSelection_fnGetTypeInfo
,
1600 ITextSelection_fnGetIDsOfNames
,
1601 ITextSelection_fnInvoke
,
1602 ITextSelection_fnGetText
,
1603 ITextSelection_fnSetText
,
1604 ITextSelection_fnGetChar
,
1605 ITextSelection_fnSetChar
,
1606 ITextSelection_fnGetDuplicate
,
1607 ITextSelection_fnGetFormattedText
,
1608 ITextSelection_fnSetFormattedText
,
1609 ITextSelection_fnGetStart
,
1610 ITextSelection_fnSetStart
,
1611 ITextSelection_fnGetEnd
,
1612 ITextSelection_fnSetEnd
,
1613 ITextSelection_fnGetFont
,
1614 ITextSelection_fnSetFont
,
1615 ITextSelection_fnGetPara
,
1616 ITextSelection_fnSetPara
,
1617 ITextSelection_fnGetStoryLength
,
1618 ITextSelection_fnGetStoryType
,
1619 ITextSelection_fnCollapse
,
1620 ITextSelection_fnExpand
,
1621 ITextSelection_fnGetIndex
,
1622 ITextSelection_fnSetIndex
,
1623 ITextSelection_fnSetRange
,
1624 ITextSelection_fnInRange
,
1625 ITextSelection_fnInStory
,
1626 ITextSelection_fnIsEqual
,
1627 ITextSelection_fnSelect
,
1628 ITextSelection_fnStartOf
,
1629 ITextSelection_fnEndOf
,
1630 ITextSelection_fnMove
,
1631 ITextSelection_fnMoveStart
,
1632 ITextSelection_fnMoveEnd
,
1633 ITextSelection_fnMoveWhile
,
1634 ITextSelection_fnMoveStartWhile
,
1635 ITextSelection_fnMoveEndWhile
,
1636 ITextSelection_fnMoveUntil
,
1637 ITextSelection_fnMoveStartUntil
,
1638 ITextSelection_fnMoveEndUntil
,
1639 ITextSelection_fnFindText
,
1640 ITextSelection_fnFindTextStart
,
1641 ITextSelection_fnFindTextEnd
,
1642 ITextSelection_fnDelete
,
1643 ITextSelection_fnCut
,
1644 ITextSelection_fnCopy
,
1645 ITextSelection_fnPaste
,
1646 ITextSelection_fnCanPaste
,
1647 ITextSelection_fnCanEdit
,
1648 ITextSelection_fnChangeCase
,
1649 ITextSelection_fnGetPoint
,
1650 ITextSelection_fnSetPoint
,
1651 ITextSelection_fnScrollIntoView
,
1652 ITextSelection_fnGetEmbeddedObject
,
1653 ITextSelection_fnGetFlags
,
1654 ITextSelection_fnSetFlags
,
1655 ITextSelection_fnGetType
,
1656 ITextSelection_fnMoveLeft
,
1657 ITextSelection_fnMoveRight
,
1658 ITextSelection_fnMoveUp
,
1659 ITextSelection_fnMoveDown
,
1660 ITextSelection_fnHomeKey
,
1661 ITextSelection_fnEndKey
,
1662 ITextSelection_fnTypeText
1665 static ITextSelectionImpl
*
1666 CreateTextSelection(IRichEditOleImpl
*reOle
)
1668 ITextSelectionImpl
*txtSel
= heap_alloc(sizeof *txtSel
);
1672 txtSel
->lpVtbl
= &tsvt
;
1674 txtSel
->reOle
= reOle
;
1678 LRESULT
CreateIRichEditOle(ME_TextEditor
*editor
, LPVOID
*ppObj
)
1680 IRichEditOleImpl
*reo
;
1682 reo
= heap_alloc(sizeof(IRichEditOleImpl
));
1686 reo
->lpRichEditOleVtbl
= &revt
;
1687 reo
->lpTextDocumentVtbl
= &tdvt
;
1689 reo
->editor
= editor
;
1690 reo
->txtSel
= CreateTextSelection(reo
);
1696 reo
->clientSite
= CreateOleClientSite(reo
);
1699 ITextSelection_Release((ITextSelection
*) reo
->txtSel
);
1703 TRACE("Created %p\n",reo
);
1709 static void convert_sizel(ME_Context
*c
, const SIZEL
* szl
, SIZE
* sz
)
1711 /* sizel is in .01 millimeters, sz in pixels */
1712 sz
->cx
= MulDiv(szl
->cx
, c
->dpi
.cx
, 2540);
1713 sz
->cy
= MulDiv(szl
->cy
, c
->dpi
.cy
, 2540);
1716 /******************************************************************************
1717 * ME_GetOLEObjectSize
1719 * Sets run extent for OLE objects.
1721 void ME_GetOLEObjectSize(ME_Context
*c
, ME_Run
*run
, SIZE
*pSize
)
1729 assert(run
->nFlags
& MERF_GRAPHICS
);
1730 assert(run
->ole_obj
);
1732 if (run
->ole_obj
->sizel
.cx
!= 0 || run
->ole_obj
->sizel
.cy
!= 0)
1734 convert_sizel(c
, &run
->ole_obj
->sizel
, pSize
);
1738 IOleObject_QueryInterface(run
->ole_obj
->poleobj
, &IID_IDataObject
, (void**)&ido
);
1739 fmt
.cfFormat
= CF_BITMAP
;
1741 fmt
.dwAspect
= DVASPECT_CONTENT
;
1743 fmt
.tymed
= TYMED_GDI
;
1744 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
1746 fmt
.cfFormat
= CF_ENHMETAFILE
;
1747 fmt
.tymed
= TYMED_ENHMF
;
1748 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
1750 FIXME("unsupported format\n");
1751 pSize
->cx
= pSize
->cy
= 0;
1752 IDataObject_Release(ido
);
1760 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
1761 pSize
->cx
= dibsect
.dsBm
.bmWidth
;
1762 pSize
->cy
= dibsect
.dsBm
.bmHeight
;
1763 if (!stgm
.pUnkForRelease
) DeleteObject(stgm
.u
.hBitmap
);
1766 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
1767 pSize
->cx
= emh
.rclBounds
.right
- emh
.rclBounds
.left
;
1768 pSize
->cy
= emh
.rclBounds
.bottom
- emh
.rclBounds
.top
;
1769 if (!stgm
.pUnkForRelease
) DeleteEnhMetaFile(stgm
.u
.hEnhMetaFile
);
1772 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
1775 IDataObject_Release(ido
);
1776 if (c
->editor
->nZoomNumerator
!= 0)
1778 pSize
->cx
= MulDiv(pSize
->cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1779 pSize
->cy
= MulDiv(pSize
->cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1783 void ME_DrawOLE(ME_Context
*c
, int x
, int y
, ME_Run
*run
,
1784 ME_Paragraph
*para
, BOOL selected
)
1795 assert(run
->nFlags
& MERF_GRAPHICS
);
1796 assert(run
->ole_obj
);
1797 if (IOleObject_QueryInterface(run
->ole_obj
->poleobj
, &IID_IDataObject
, (void**)&ido
) != S_OK
)
1799 FIXME("Couldn't get interface\n");
1802 has_size
= run
->ole_obj
->sizel
.cx
!= 0 || run
->ole_obj
->sizel
.cy
!= 0;
1803 fmt
.cfFormat
= CF_BITMAP
;
1805 fmt
.dwAspect
= DVASPECT_CONTENT
;
1807 fmt
.tymed
= TYMED_GDI
;
1808 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
1810 fmt
.cfFormat
= CF_ENHMETAFILE
;
1811 fmt
.tymed
= TYMED_ENHMF
;
1812 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
1814 FIXME("Couldn't get storage medium\n");
1815 IDataObject_Release(ido
);
1822 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
1823 hMemDC
= CreateCompatibleDC(c
->hDC
);
1824 SelectObject(hMemDC
, stgm
.u
.hBitmap
);
1825 if (!has_size
&& c
->editor
->nZoomNumerator
== 0)
1827 sz
.cx
= dibsect
.dsBm
.bmWidth
;
1828 sz
.cy
= dibsect
.dsBm
.bmHeight
;
1829 BitBlt(c
->hDC
, x
, y
- dibsect
.dsBm
.bmHeight
,
1830 dibsect
.dsBm
.bmWidth
, dibsect
.dsBm
.bmHeight
,
1831 hMemDC
, 0, 0, SRCCOPY
);
1837 convert_sizel(c
, &run
->ole_obj
->sizel
, &sz
);
1841 sz
.cx
= MulDiv(dibsect
.dsBm
.bmWidth
,
1842 c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1843 sz
.cy
= MulDiv(dibsect
.dsBm
.bmHeight
,
1844 c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1846 StretchBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
,
1847 hMemDC
, 0, 0, dibsect
.dsBm
.bmWidth
, dibsect
.dsBm
.bmHeight
, SRCCOPY
);
1849 if (!stgm
.pUnkForRelease
) DeleteObject(stgm
.u
.hBitmap
);
1852 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
1853 if (!has_size
&& c
->editor
->nZoomNumerator
== 0)
1855 sz
.cy
= emh
.rclBounds
.bottom
- emh
.rclBounds
.top
;
1856 sz
.cx
= emh
.rclBounds
.right
- emh
.rclBounds
.left
;
1862 convert_sizel(c
, &run
->ole_obj
->sizel
, &sz
);
1866 sz
.cy
= MulDiv(emh
.rclBounds
.bottom
- emh
.rclBounds
.top
,
1867 c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1868 sz
.cx
= MulDiv(emh
.rclBounds
.right
- emh
.rclBounds
.left
,
1869 c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1877 rc
.right
= x
+ sz
.cx
;
1879 PlayEnhMetaFile(c
->hDC
, stgm
.u
.hEnhMetaFile
, &rc
);
1881 if (!stgm
.pUnkForRelease
) DeleteEnhMetaFile(stgm
.u
.hEnhMetaFile
);
1884 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
1888 if (selected
&& !c
->editor
->bHideSelection
)
1889 PatBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
, DSTINVERT
);
1890 IDataObject_Release(ido
);
1893 void ME_DeleteReObject(REOBJECT
* reo
)
1895 if (reo
->poleobj
) IOleObject_Release(reo
->poleobj
);
1896 if (reo
->pstg
) IStorage_Release(reo
->pstg
);
1897 if (reo
->polesite
) IOleClientSite_Release(reo
->polesite
);
1901 void ME_CopyReObject(REOBJECT
* dst
, const REOBJECT
* src
)
1905 if (dst
->poleobj
) IOleObject_AddRef(dst
->poleobj
);
1906 if (dst
->pstg
) IStorage_AddRef(dst
->pstg
);
1907 if (dst
->polesite
) IOleClientSite_AddRef(dst
->polesite
);