2 * RichEdit GUIDs and OLE interface
4 * Copyright 2004 by Krzysztof Foltman
5 * Copyright 2004 Aric Stewart
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #define NONAMELESSUNION
25 #define NONAMELESSSTRUCT
36 #include "wine/debug.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(richedit
);
40 /* there is no way to be consistent across different sets of headers - mingw, Wine, Win32 SDK*/
42 /* FIXME: the next 6 lines should be in textserv.h */
44 #define TEXTSERV_GUID(name, l, w1, w2, b1, b2) \
45 DEFINE_GUID(name, l, w1, w2, b1, b2, 0x00, 0xaa, 0x00, 0x6c, 0xad, 0xc5)
47 TEXTSERV_GUID(IID_ITextServices
, 0x8d33f740, 0xcf58, 0x11ce, 0xa8, 0x9d);
48 TEXTSERV_GUID(IID_ITextHost
, 0xc5bdd8d0, 0xd26e, 0x11ce, 0xa8, 0x9e);
49 TEXTSERV_GUID(IID_ITextHost2
, 0xc5bdd8d0, 0xd26e, 0x11ce, 0xa8, 0x9e);
50 DEFINE_GUID(IID_ITextDocument
, 0x8cc497c0, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
52 typedef struct IRichEditOleImpl
{
53 const IRichEditOleVtbl
*lpRichEditOleVtbl
;
54 const ITextDocumentVtbl
*lpTextDocumentVtbl
;
57 ME_TextEditor
*editor
;
60 static inline IRichEditOleImpl
*impl_from_IRichEditOle(IRichEditOle
*iface
)
62 return (IRichEditOleImpl
*)((BYTE
*)iface
- FIELD_OFFSET(IRichEditOleImpl
, lpRichEditOleVtbl
));
65 static inline IRichEditOleImpl
*impl_from_ITextDocument(ITextDocument
*iface
)
67 return (IRichEditOleImpl
*)((BYTE
*)iface
- FIELD_OFFSET(IRichEditOleImpl
, lpTextDocumentVtbl
));
71 IRichEditOle_fnQueryInterface(IRichEditOle
*me
, REFIID riid
, LPVOID
*ppvObj
)
73 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
75 TRACE("%p %s\n", This
, debugstr_guid(riid
) );
78 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
79 IsEqualGUID(riid
, &IID_IRichEditOle
))
80 *ppvObj
= &This
->lpRichEditOleVtbl
;
81 else if (IsEqualGUID(riid
, &IID_ITextDocument
))
82 *ppvObj
= &This
->lpTextDocumentVtbl
;
85 IRichEditOle_AddRef(me
);
88 FIXME("%p: unhandled interface %s\n", This
, debugstr_guid(riid
) );
94 IRichEditOle_fnAddRef(IRichEditOle
*me
)
96 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
97 ULONG ref
= InterlockedIncrement( &This
->ref
);
99 TRACE("%p ref = %u\n", This
, ref
);
105 IRichEditOle_fnRelease(IRichEditOle
*me
)
107 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
108 ULONG ref
= InterlockedDecrement(&This
->ref
);
110 TRACE ("%p ref=%u\n", This
, ref
);
114 TRACE ("Destroying %p\n", This
);
120 static HRESULT WINAPI
121 IRichEditOle_fnActivateAs(IRichEditOle
*me
, REFCLSID rclsid
, REFCLSID rclsidAs
)
123 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
124 FIXME("stub %p\n",This
);
128 static HRESULT WINAPI
129 IRichEditOle_fnContextSensitiveHelp(IRichEditOle
*me
, BOOL fEnterMode
)
131 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
132 FIXME("stub %p\n",This
);
136 static HRESULT WINAPI
137 IRichEditOle_fnConvertObject(IRichEditOle
*me
, LONG iob
,
138 REFCLSID rclsidNew
, LPCSTR lpstrUserTypeNew
)
140 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
141 FIXME("stub %p\n",This
);
145 static HRESULT WINAPI
146 IRichEditOle_fnGetClientSite(IRichEditOle
*me
,
147 LPOLECLIENTSITE
*lplpolesite
)
149 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
150 FIXME("stub %p\n",This
);
154 static HRESULT WINAPI
155 IRichEditOle_fnGetClipboardData(IRichEditOle
*me
, CHARRANGE
*lpchrg
,
156 DWORD reco
, LPDATAOBJECT
*lplpdataobj
)
158 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
161 TRACE("(%p,%p,%d)\n",This
, lpchrg
, reco
);
165 ME_GetSelection(This
->editor
, &tmpchrg
.cpMin
, &tmpchrg
.cpMax
);
168 return ME_GetDataObject(This
->editor
, lpchrg
, lplpdataobj
);
171 static LONG WINAPI
IRichEditOle_fnGetLinkCount(IRichEditOle
*me
)
173 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
174 FIXME("stub %p\n",This
);
178 static HRESULT WINAPI
179 IRichEditOle_fnGetObject(IRichEditOle
*me
, LONG iob
,
180 REOBJECT
*lpreobject
, DWORD dwFlags
)
182 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
183 FIXME("stub %p\n",This
);
188 IRichEditOle_fnGetObjectCount(IRichEditOle
*me
)
190 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
191 FIXME("stub %p\n",This
);
195 static HRESULT WINAPI
196 IRichEditOle_fnHandsOffStorage(IRichEditOle
*me
, LONG iob
)
198 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
199 FIXME("stub %p\n",This
);
203 static HRESULT WINAPI
204 IRichEditOle_fnImportDataObject(IRichEditOle
*me
, LPDATAOBJECT lpdataobj
,
205 CLIPFORMAT cf
, HGLOBAL hMetaPict
)
207 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
208 FIXME("stub %p\n",This
);
212 static HRESULT WINAPI
213 IRichEditOle_fnInPlaceDeactivate(IRichEditOle
*me
)
215 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
216 FIXME("stub %p\n",This
);
220 static HRESULT WINAPI
221 IRichEditOle_fnInsertObject(IRichEditOle
*me
, REOBJECT
*reo
)
223 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
224 TRACE("(%p,%p)\n", This
, reo
);
226 if (reo
->cbStruct
< sizeof(*reo
)) return STG_E_INVALIDPARAMETER
;
227 if (reo
->poleobj
) IOleObject_AddRef(reo
->poleobj
);
228 if (reo
->pstg
) IStorage_AddRef(reo
->pstg
);
229 if (reo
->polesite
) IOleClientSite_AddRef(reo
->polesite
);
231 ME_InsertOLEFromCursor(This
->editor
, reo
, 0);
235 static HRESULT WINAPI
IRichEditOle_fnSaveCompleted(IRichEditOle
*me
, LONG iob
,
238 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
239 FIXME("stub %p\n",This
);
243 static HRESULT WINAPI
244 IRichEditOle_fnSetDvaspect(IRichEditOle
*me
, LONG iob
, DWORD dvaspect
)
246 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
247 FIXME("stub %p\n",This
);
251 static HRESULT WINAPI
IRichEditOle_fnSetHostNames(IRichEditOle
*me
,
252 LPCSTR lpstrContainerApp
, LPCSTR lpstrContainerObj
)
254 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
255 FIXME("stub %p %s %s\n",This
, lpstrContainerApp
, lpstrContainerObj
);
259 static HRESULT WINAPI
260 IRichEditOle_fnSetLinkAvailable(IRichEditOle
*me
, LONG iob
, BOOL fAvailable
)
262 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
263 FIXME("stub %p\n",This
);
267 static const IRichEditOleVtbl revt
= {
268 IRichEditOle_fnQueryInterface
,
269 IRichEditOle_fnAddRef
,
270 IRichEditOle_fnRelease
,
271 IRichEditOle_fnGetClientSite
,
272 IRichEditOle_fnGetObjectCount
,
273 IRichEditOle_fnGetLinkCount
,
274 IRichEditOle_fnGetObject
,
275 IRichEditOle_fnInsertObject
,
276 IRichEditOle_fnConvertObject
,
277 IRichEditOle_fnActivateAs
,
278 IRichEditOle_fnSetHostNames
,
279 IRichEditOle_fnSetLinkAvailable
,
280 IRichEditOle_fnSetDvaspect
,
281 IRichEditOle_fnHandsOffStorage
,
282 IRichEditOle_fnSaveCompleted
,
283 IRichEditOle_fnInPlaceDeactivate
,
284 IRichEditOle_fnContextSensitiveHelp
,
285 IRichEditOle_fnGetClipboardData
,
286 IRichEditOle_fnImportDataObject
289 static HRESULT WINAPI
290 ITextDocument_fnQueryInterface(ITextDocument
* me
, REFIID riid
,
293 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
294 return IRichEditOle_fnQueryInterface((IRichEditOle
*)&This
->lpRichEditOleVtbl
,
299 ITextDocument_fnAddRef(ITextDocument
* me
)
301 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
302 return IRichEditOle_fnAddRef((IRichEditOle
*)&This
->lpRichEditOleVtbl
);
306 ITextDocument_fnRelease(ITextDocument
* me
)
308 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
309 return IRichEditOle_fnRelease((IRichEditOle
*)&This
->lpRichEditOleVtbl
);
312 static HRESULT WINAPI
313 ITextDocument_fnGetTypeInfoCount(ITextDocument
* me
,
316 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
317 FIXME("stub %p\n",This
);
321 static HRESULT WINAPI
322 ITextDocument_fnGetTypeInfo(ITextDocument
* me
, UINT iTInfo
, LCID lcid
,
325 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
326 FIXME("stub %p\n",This
);
330 static HRESULT WINAPI
331 ITextDocument_fnGetIDsOfNames(ITextDocument
* me
, REFIID riid
,
332 LPOLESTR
* rgszNames
, UINT cNames
, LCID lcid
, DISPID
* rgDispId
)
334 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
335 FIXME("stub %p\n",This
);
339 static HRESULT WINAPI
340 ITextDocument_fnInvoke(ITextDocument
* me
, DISPID dispIdMember
,
341 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
* pDispParams
,
342 VARIANT
* pVarResult
, EXCEPINFO
* pExcepInfo
, UINT
* puArgErr
)
344 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
345 FIXME("stub %p\n",This
);
349 static HRESULT WINAPI
350 ITextDocument_fnGetName(ITextDocument
* me
, BSTR
* pName
)
352 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
353 FIXME("stub %p\n",This
);
357 static HRESULT WINAPI
358 ITextDocument_fnGetSelection(ITextDocument
* me
, ITextSelection
** ppSel
)
360 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
361 FIXME("stub %p\n",This
);
365 static HRESULT WINAPI
366 ITextDocument_fnGetStoryCount(ITextDocument
* me
, long* pCount
)
368 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
369 FIXME("stub %p\n",This
);
373 static HRESULT WINAPI
374 ITextDocument_fnGetStoryRanges(ITextDocument
* me
,
375 ITextStoryRanges
** ppStories
)
377 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
378 FIXME("stub %p\n",This
);
382 static HRESULT WINAPI
383 ITextDocument_fnGetSaved(ITextDocument
* me
, long* pValue
)
385 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
386 FIXME("stub %p\n",This
);
390 static HRESULT WINAPI
391 ITextDocument_fnSetSaved(ITextDocument
* me
, long Value
)
393 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
394 FIXME("stub %p\n",This
);
398 static HRESULT WINAPI
399 ITextDocument_fnGetDefaultTabStop(ITextDocument
* me
, float* pValue
)
401 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
402 FIXME("stub %p\n",This
);
406 static HRESULT WINAPI
407 ITextDocument_fnSetDefaultTabStop(ITextDocument
* me
, float Value
)
409 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
410 FIXME("stub %p\n",This
);
414 static HRESULT WINAPI
415 ITextDocument_fnNew(ITextDocument
* me
)
417 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
418 FIXME("stub %p\n",This
);
422 static HRESULT WINAPI
423 ITextDocument_fnOpen(ITextDocument
* me
, VARIANT
* pVar
, long Flags
,
426 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
427 FIXME("stub %p\n",This
);
431 static HRESULT WINAPI
432 ITextDocument_fnSave(ITextDocument
* me
, VARIANT
* pVar
, long Flags
,
435 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
436 FIXME("stub %p\n",This
);
440 static HRESULT WINAPI
441 ITextDocument_fnFreeze(ITextDocument
* me
, long* pCount
)
443 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
444 FIXME("stub %p\n",This
);
448 static HRESULT WINAPI
449 ITextDocument_fnUnfreeze(ITextDocument
* me
, long* pCount
)
451 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
452 FIXME("stub %p\n",This
);
456 static HRESULT WINAPI
457 ITextDocument_fnBeginEditCollection(ITextDocument
* me
)
459 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
460 FIXME("stub %p\n",This
);
464 static HRESULT WINAPI
465 ITextDocument_fnEndEditCollection(ITextDocument
* me
)
467 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
468 FIXME("stub %p\n",This
);
472 static HRESULT WINAPI
473 ITextDocument_fnUndo(ITextDocument
* me
, long Count
, long* prop
)
475 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
476 FIXME("stub %p\n",This
);
480 static HRESULT WINAPI
481 ITextDocument_fnRedo(ITextDocument
* me
, long Count
, long* prop
)
483 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
484 FIXME("stub %p\n",This
);
488 static HRESULT WINAPI
489 ITextDocument_fnRange(ITextDocument
* me
, long cp1
, long cp2
,
490 ITextRange
** ppRange
)
492 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
493 FIXME("stub %p\n",This
);
497 static HRESULT WINAPI
498 ITextDocument_fnRangeFromPoint(ITextDocument
* me
, long x
, long y
,
499 ITextRange
** ppRange
)
501 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
502 FIXME("stub %p\n",This
);
506 static const ITextDocumentVtbl tdvt
= {
507 ITextDocument_fnQueryInterface
,
508 ITextDocument_fnAddRef
,
509 ITextDocument_fnRelease
,
510 ITextDocument_fnGetTypeInfoCount
,
511 ITextDocument_fnGetTypeInfo
,
512 ITextDocument_fnGetIDsOfNames
,
513 ITextDocument_fnInvoke
,
514 ITextDocument_fnGetName
,
515 ITextDocument_fnGetSelection
,
516 ITextDocument_fnGetStoryCount
,
517 ITextDocument_fnGetStoryRanges
,
518 ITextDocument_fnGetSaved
,
519 ITextDocument_fnSetSaved
,
520 ITextDocument_fnGetDefaultTabStop
,
521 ITextDocument_fnSetDefaultTabStop
,
523 ITextDocument_fnOpen
,
524 ITextDocument_fnSave
,
525 ITextDocument_fnFreeze
,
526 ITextDocument_fnUnfreeze
,
527 ITextDocument_fnBeginEditCollection
,
528 ITextDocument_fnEndEditCollection
,
529 ITextDocument_fnUndo
,
530 ITextDocument_fnRedo
,
531 ITextDocument_fnRange
,
532 ITextDocument_fnRangeFromPoint
535 LRESULT
CreateIRichEditOle(ME_TextEditor
*editor
, LPVOID
*ppObj
)
537 IRichEditOleImpl
*reo
;
539 reo
= heap_alloc(sizeof(IRichEditOleImpl
));
543 reo
->lpRichEditOleVtbl
= &revt
;
544 reo
->lpTextDocumentVtbl
= &tdvt
;
546 reo
->editor
= editor
;
547 TRACE("Created %p\n",reo
);
548 *ppObj
= (LPVOID
) reo
;
553 static void convert_sizel(ME_Context
*c
, const SIZEL
* szl
, SIZE
* sz
)
555 /* sizel is in .01 millimeters, sz in pixels */
556 sz
->cx
= MulDiv(szl
->cx
, c
->dpi
.cx
, 2540);
557 sz
->cy
= MulDiv(szl
->cy
, c
->dpi
.cy
, 2540);
560 /******************************************************************************
561 * ME_GetOLEObjectSize
563 * Sets run extent for OLE objects.
565 void ME_GetOLEObjectSize(ME_Context
*c
, ME_Run
*run
, SIZE
*pSize
)
573 assert(run
->nFlags
& MERF_GRAPHICS
);
574 assert(run
->ole_obj
);
576 if (run
->ole_obj
->sizel
.cx
!= 0 || run
->ole_obj
->sizel
.cy
!= 0)
578 convert_sizel(c
, &run
->ole_obj
->sizel
, pSize
);
582 IOleObject_QueryInterface(run
->ole_obj
->poleobj
, &IID_IDataObject
, (void**)&ido
);
583 fmt
.cfFormat
= CF_BITMAP
;
585 fmt
.dwAspect
= DVASPECT_CONTENT
;
587 fmt
.tymed
= TYMED_GDI
;
588 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
590 fmt
.cfFormat
= CF_ENHMETAFILE
;
591 fmt
.tymed
= TYMED_ENHMF
;
592 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
594 FIXME("unsupported format\n");
595 pSize
->cx
= pSize
->cy
= 0;
596 IDataObject_Release(ido
);
604 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
605 pSize
->cx
= dibsect
.dsBm
.bmWidth
;
606 pSize
->cy
= dibsect
.dsBm
.bmHeight
;
607 if (!stgm
.pUnkForRelease
) DeleteObject(stgm
.u
.hBitmap
);
610 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
611 pSize
->cx
= emh
.rclBounds
.right
- emh
.rclBounds
.left
;
612 pSize
->cy
= emh
.rclBounds
.bottom
- emh
.rclBounds
.top
;
613 if (!stgm
.pUnkForRelease
) DeleteEnhMetaFile(stgm
.u
.hEnhMetaFile
);
616 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
619 IDataObject_Release(ido
);
620 if (c
->editor
->nZoomNumerator
!= 0)
622 pSize
->cx
= MulDiv(pSize
->cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
623 pSize
->cy
= MulDiv(pSize
->cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
627 void ME_DrawOLE(ME_Context
*c
, int x
, int y
, ME_Run
*run
,
628 ME_Paragraph
*para
, BOOL selected
)
639 assert(run
->nFlags
& MERF_GRAPHICS
);
640 assert(run
->ole_obj
);
641 if (IOleObject_QueryInterface(run
->ole_obj
->poleobj
, &IID_IDataObject
, (void**)&ido
) != S_OK
)
643 FIXME("Couldn't get interface\n");
646 has_size
= run
->ole_obj
->sizel
.cx
!= 0 || run
->ole_obj
->sizel
.cy
!= 0;
647 fmt
.cfFormat
= CF_BITMAP
;
649 fmt
.dwAspect
= DVASPECT_CONTENT
;
651 fmt
.tymed
= TYMED_GDI
;
652 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
654 fmt
.cfFormat
= CF_ENHMETAFILE
;
655 fmt
.tymed
= TYMED_ENHMF
;
656 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
658 FIXME("Couldn't get storage medium\n");
659 IDataObject_Release(ido
);
666 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
667 hMemDC
= CreateCompatibleDC(c
->hDC
);
668 SelectObject(hMemDC
, stgm
.u
.hBitmap
);
669 if (!has_size
&& c
->editor
->nZoomNumerator
== 0)
671 sz
.cx
= dibsect
.dsBm
.bmWidth
;
672 sz
.cy
= dibsect
.dsBm
.bmHeight
;
673 BitBlt(c
->hDC
, x
, y
- dibsect
.dsBm
.bmHeight
,
674 dibsect
.dsBm
.bmWidth
, dibsect
.dsBm
.bmHeight
,
675 hMemDC
, 0, 0, SRCCOPY
);
681 convert_sizel(c
, &run
->ole_obj
->sizel
, &sz
);
685 sz
.cx
= MulDiv(dibsect
.dsBm
.bmWidth
,
686 c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
687 sz
.cy
= MulDiv(dibsect
.dsBm
.bmHeight
,
688 c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
690 StretchBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
,
691 hMemDC
, 0, 0, dibsect
.dsBm
.bmWidth
, dibsect
.dsBm
.bmHeight
, SRCCOPY
);
693 if (!stgm
.pUnkForRelease
) DeleteObject(stgm
.u
.hBitmap
);
696 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
697 if (!has_size
&& c
->editor
->nZoomNumerator
== 0)
699 sz
.cy
= emh
.rclBounds
.bottom
- emh
.rclBounds
.top
;
700 sz
.cx
= emh
.rclBounds
.right
- emh
.rclBounds
.left
;
706 convert_sizel(c
, &run
->ole_obj
->sizel
, &sz
);
710 sz
.cy
= MulDiv(emh
.rclBounds
.bottom
- emh
.rclBounds
.top
,
711 c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
712 sz
.cx
= MulDiv(emh
.rclBounds
.right
- emh
.rclBounds
.left
,
713 c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
721 rc
.right
= x
+ sz
.cx
;
723 PlayEnhMetaFile(c
->hDC
, stgm
.u
.hEnhMetaFile
, &rc
);
725 if (!stgm
.pUnkForRelease
) DeleteEnhMetaFile(stgm
.u
.hEnhMetaFile
);
728 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
732 if (selected
&& !c
->editor
->bHideSelection
)
733 PatBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
, DSTINVERT
);
734 IDataObject_Release(ido
);
737 void ME_DeleteReObject(REOBJECT
* reo
)
739 if (reo
->poleobj
) IOleObject_Release(reo
->poleobj
);
740 if (reo
->pstg
) IStorage_Release(reo
->pstg
);
741 if (reo
->polesite
) IOleClientSite_Release(reo
->polesite
);
745 void ME_CopyReObject(REOBJECT
* dst
, const REOBJECT
* src
)
749 if (dst
->poleobj
) IOleObject_AddRef(dst
->poleobj
);
750 if (dst
->pstg
) IStorage_AddRef(dst
->pstg
);
751 if (dst
->polesite
) IOleClientSite_AddRef(dst
->polesite
);