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
;
392 ME_InsertOLEFromCursor(This
->editor
, reo
, 0);
393 ME_CommitUndo(This
->editor
);
394 ME_UpdateRepaint(This
->editor
, FALSE
);
398 static HRESULT WINAPI
IRichEditOle_fnSaveCompleted(IRichEditOle
*me
, LONG iob
,
401 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
402 FIXME("stub %p\n",This
);
406 static HRESULT WINAPI
407 IRichEditOle_fnSetDvaspect(IRichEditOle
*me
, LONG iob
, DWORD dvaspect
)
409 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
410 FIXME("stub %p\n",This
);
414 static HRESULT WINAPI
IRichEditOle_fnSetHostNames(IRichEditOle
*me
,
415 LPCSTR lpstrContainerApp
, LPCSTR lpstrContainerObj
)
417 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
418 FIXME("stub %p %s %s\n",This
, lpstrContainerApp
, lpstrContainerObj
);
422 static HRESULT WINAPI
423 IRichEditOle_fnSetLinkAvailable(IRichEditOle
*me
, LONG iob
, BOOL fAvailable
)
425 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
426 FIXME("stub %p\n",This
);
430 static const IRichEditOleVtbl revt
= {
431 IRichEditOle_fnQueryInterface
,
432 IRichEditOle_fnAddRef
,
433 IRichEditOle_fnRelease
,
434 IRichEditOle_fnGetClientSite
,
435 IRichEditOle_fnGetObjectCount
,
436 IRichEditOle_fnGetLinkCount
,
437 IRichEditOle_fnGetObject
,
438 IRichEditOle_fnInsertObject
,
439 IRichEditOle_fnConvertObject
,
440 IRichEditOle_fnActivateAs
,
441 IRichEditOle_fnSetHostNames
,
442 IRichEditOle_fnSetLinkAvailable
,
443 IRichEditOle_fnSetDvaspect
,
444 IRichEditOle_fnHandsOffStorage
,
445 IRichEditOle_fnSaveCompleted
,
446 IRichEditOle_fnInPlaceDeactivate
,
447 IRichEditOle_fnContextSensitiveHelp
,
448 IRichEditOle_fnGetClipboardData
,
449 IRichEditOle_fnImportDataObject
452 static HRESULT WINAPI
453 ITextDocument_fnQueryInterface(ITextDocument
* me
, REFIID riid
,
456 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
457 return IRichEditOle_fnQueryInterface((IRichEditOle
*)&This
->lpRichEditOleVtbl
,
462 ITextDocument_fnAddRef(ITextDocument
* me
)
464 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
465 return IRichEditOle_fnAddRef((IRichEditOle
*)&This
->lpRichEditOleVtbl
);
469 ITextDocument_fnRelease(ITextDocument
* me
)
471 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
472 return IRichEditOle_fnRelease((IRichEditOle
*)&This
->lpRichEditOleVtbl
);
475 static HRESULT WINAPI
476 ITextDocument_fnGetTypeInfoCount(ITextDocument
* me
,
479 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
480 FIXME("stub %p\n",This
);
484 static HRESULT WINAPI
485 ITextDocument_fnGetTypeInfo(ITextDocument
* me
, UINT iTInfo
, LCID lcid
,
488 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
489 FIXME("stub %p\n",This
);
493 static HRESULT WINAPI
494 ITextDocument_fnGetIDsOfNames(ITextDocument
* me
, REFIID riid
,
495 LPOLESTR
* rgszNames
, UINT cNames
, LCID lcid
, DISPID
* rgDispId
)
497 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
498 FIXME("stub %p\n",This
);
502 static HRESULT WINAPI
503 ITextDocument_fnInvoke(ITextDocument
* me
, DISPID dispIdMember
,
504 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
* pDispParams
,
505 VARIANT
* pVarResult
, EXCEPINFO
* pExcepInfo
, UINT
* puArgErr
)
507 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
508 FIXME("stub %p\n",This
);
512 static HRESULT WINAPI
513 ITextDocument_fnGetName(ITextDocument
* me
, BSTR
* pName
)
515 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
516 FIXME("stub %p\n",This
);
520 static HRESULT WINAPI
521 ITextDocument_fnGetSelection(ITextDocument
* me
, ITextSelection
** ppSel
)
523 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
525 *ppSel
= (ITextSelection
*) This
->txtSel
;
526 ITextSelection_AddRef(*ppSel
);
530 static HRESULT WINAPI
531 ITextDocument_fnGetStoryCount(ITextDocument
* me
, LONG
* pCount
)
533 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
534 FIXME("stub %p\n",This
);
538 static HRESULT WINAPI
539 ITextDocument_fnGetStoryRanges(ITextDocument
* me
,
540 ITextStoryRanges
** ppStories
)
542 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
543 FIXME("stub %p\n",This
);
547 static HRESULT WINAPI
548 ITextDocument_fnGetSaved(ITextDocument
* me
, LONG
* pValue
)
550 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
551 FIXME("stub %p\n",This
);
555 static HRESULT WINAPI
556 ITextDocument_fnSetSaved(ITextDocument
* me
, LONG Value
)
558 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
559 FIXME("stub %p\n",This
);
563 static HRESULT WINAPI
564 ITextDocument_fnGetDefaultTabStop(ITextDocument
* me
, float* pValue
)
566 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
567 FIXME("stub %p\n",This
);
571 static HRESULT WINAPI
572 ITextDocument_fnSetDefaultTabStop(ITextDocument
* me
, float Value
)
574 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
575 FIXME("stub %p\n",This
);
579 static HRESULT WINAPI
580 ITextDocument_fnNew(ITextDocument
* me
)
582 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
583 FIXME("stub %p\n",This
);
587 static HRESULT WINAPI
588 ITextDocument_fnOpen(ITextDocument
* me
, VARIANT
* pVar
, LONG Flags
,
591 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
592 FIXME("stub %p\n",This
);
596 static HRESULT WINAPI
597 ITextDocument_fnSave(ITextDocument
* me
, VARIANT
* pVar
, LONG Flags
,
600 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
601 FIXME("stub %p\n",This
);
605 static HRESULT WINAPI
606 ITextDocument_fnFreeze(ITextDocument
* me
, LONG
* pCount
)
608 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
609 FIXME("stub %p\n",This
);
613 static HRESULT WINAPI
614 ITextDocument_fnUnfreeze(ITextDocument
* me
, LONG
* pCount
)
616 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
617 FIXME("stub %p\n",This
);
621 static HRESULT WINAPI
622 ITextDocument_fnBeginEditCollection(ITextDocument
* me
)
624 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
625 FIXME("stub %p\n",This
);
629 static HRESULT WINAPI
630 ITextDocument_fnEndEditCollection(ITextDocument
* me
)
632 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
633 FIXME("stub %p\n",This
);
637 static HRESULT WINAPI
638 ITextDocument_fnUndo(ITextDocument
* me
, LONG Count
, LONG
* prop
)
640 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
641 FIXME("stub %p\n",This
);
645 static HRESULT WINAPI
646 ITextDocument_fnRedo(ITextDocument
* me
, LONG Count
, LONG
* prop
)
648 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
649 FIXME("stub %p\n",This
);
653 static HRESULT WINAPI
654 ITextDocument_fnRange(ITextDocument
* me
, LONG cp1
, LONG cp2
,
655 ITextRange
** ppRange
)
657 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
658 FIXME("stub %p\n",This
);
662 static HRESULT WINAPI
663 ITextDocument_fnRangeFromPoint(ITextDocument
* me
, LONG x
, LONG y
,
664 ITextRange
** ppRange
)
666 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
667 FIXME("stub %p\n",This
);
671 static const ITextDocumentVtbl tdvt
= {
672 ITextDocument_fnQueryInterface
,
673 ITextDocument_fnAddRef
,
674 ITextDocument_fnRelease
,
675 ITextDocument_fnGetTypeInfoCount
,
676 ITextDocument_fnGetTypeInfo
,
677 ITextDocument_fnGetIDsOfNames
,
678 ITextDocument_fnInvoke
,
679 ITextDocument_fnGetName
,
680 ITextDocument_fnGetSelection
,
681 ITextDocument_fnGetStoryCount
,
682 ITextDocument_fnGetStoryRanges
,
683 ITextDocument_fnGetSaved
,
684 ITextDocument_fnSetSaved
,
685 ITextDocument_fnGetDefaultTabStop
,
686 ITextDocument_fnSetDefaultTabStop
,
688 ITextDocument_fnOpen
,
689 ITextDocument_fnSave
,
690 ITextDocument_fnFreeze
,
691 ITextDocument_fnUnfreeze
,
692 ITextDocument_fnBeginEditCollection
,
693 ITextDocument_fnEndEditCollection
,
694 ITextDocument_fnUndo
,
695 ITextDocument_fnRedo
,
696 ITextDocument_fnRange
,
697 ITextDocument_fnRangeFromPoint
700 static HRESULT WINAPI
ITextSelection_fnQueryInterface(
706 if (IsEqualGUID(riid
, &IID_IUnknown
)
707 || IsEqualGUID(riid
, &IID_IDispatch
)
708 || IsEqualGUID(riid
, &IID_ITextRange
)
709 || IsEqualGUID(riid
, &IID_ITextSelection
))
712 ITextSelection_AddRef(me
);
716 return E_NOINTERFACE
;
719 static ULONG WINAPI
ITextSelection_fnAddRef(
722 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
723 return InterlockedIncrement(&This
->ref
);
726 static ULONG WINAPI
ITextSelection_fnRelease(
729 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
730 ULONG ref
= InterlockedDecrement(&This
->ref
);
736 static HRESULT WINAPI
ITextSelection_fnGetTypeInfoCount(
740 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
742 return CO_E_RELEASED
;
744 FIXME("not implemented\n");
748 static HRESULT WINAPI
ITextSelection_fnGetTypeInfo(
754 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
756 return CO_E_RELEASED
;
758 FIXME("not implemented\n");
762 static HRESULT WINAPI
ITextSelection_fnGetIDsOfNames(
770 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
772 return CO_E_RELEASED
;
774 FIXME("not implemented\n");
778 static HRESULT WINAPI
ITextSelection_fnInvoke(
784 DISPPARAMS
*pDispParams
,
786 EXCEPINFO
*pExcepInfo
,
789 FIXME("not implemented\n");
793 /*** ITextRange methods ***/
794 static HRESULT WINAPI
ITextSelection_fnGetText(
798 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
800 return CO_E_RELEASED
;
802 FIXME("not implemented\n");
806 static HRESULT WINAPI
ITextSelection_fnSetText(
810 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
812 return CO_E_RELEASED
;
814 FIXME("not implemented\n");
818 static HRESULT WINAPI
ITextSelection_fnGetChar(
822 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
824 return CO_E_RELEASED
;
826 FIXME("not implemented\n");
830 static HRESULT WINAPI
ITextSelection_fnSetChar(
834 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
836 return CO_E_RELEASED
;
838 FIXME("not implemented\n");
842 static HRESULT WINAPI
ITextSelection_fnGetDuplicate(
844 ITextRange
**ppRange
)
846 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
848 return CO_E_RELEASED
;
850 FIXME("not implemented\n");
854 static HRESULT WINAPI
ITextSelection_fnGetFormattedText(
856 ITextRange
**ppRange
)
858 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
860 return CO_E_RELEASED
;
862 FIXME("not implemented\n");
866 static HRESULT WINAPI
ITextSelection_fnSetFormattedText(
870 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
872 return CO_E_RELEASED
;
874 FIXME("not implemented\n");
878 static HRESULT WINAPI
ITextSelection_fnGetStart(
882 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
884 return CO_E_RELEASED
;
886 FIXME("not implemented\n");
890 static HRESULT WINAPI
ITextSelection_fnSetStart(
894 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
896 return CO_E_RELEASED
;
898 FIXME("not implemented\n");
902 static HRESULT WINAPI
ITextSelection_fnGetEnd(
906 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
908 return CO_E_RELEASED
;
910 FIXME("not implemented\n");
914 static HRESULT WINAPI
ITextSelection_fnSetEnd(
918 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
920 return CO_E_RELEASED
;
922 FIXME("not implemented\n");
926 static HRESULT WINAPI
ITextSelection_fnGetFont(
930 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
932 return CO_E_RELEASED
;
934 FIXME("not implemented\n");
938 static HRESULT WINAPI
ITextSelection_fnSetFont(
942 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
944 return CO_E_RELEASED
;
946 FIXME("not implemented\n");
950 static HRESULT WINAPI
ITextSelection_fnGetPara(
954 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
956 return CO_E_RELEASED
;
958 FIXME("not implemented\n");
962 static HRESULT WINAPI
ITextSelection_fnSetPara(
966 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
968 return CO_E_RELEASED
;
970 FIXME("not implemented\n");
974 static HRESULT WINAPI
ITextSelection_fnGetStoryLength(
978 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
980 return CO_E_RELEASED
;
982 FIXME("not implemented\n");
986 static HRESULT WINAPI
ITextSelection_fnGetStoryType(
990 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
992 return CO_E_RELEASED
;
994 FIXME("not implemented\n");
998 static HRESULT WINAPI
ITextSelection_fnCollapse(
1002 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1004 return CO_E_RELEASED
;
1006 FIXME("not implemented\n");
1010 static HRESULT WINAPI
ITextSelection_fnExpand(
1015 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1017 return CO_E_RELEASED
;
1019 FIXME("not implemented\n");
1023 static HRESULT WINAPI
ITextSelection_fnGetIndex(
1028 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1030 return CO_E_RELEASED
;
1032 FIXME("not implemented\n");
1036 static HRESULT WINAPI
ITextSelection_fnSetIndex(
1042 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1044 return CO_E_RELEASED
;
1046 FIXME("not implemented\n");
1050 static HRESULT WINAPI
ITextSelection_fnSetRange(
1055 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1057 return CO_E_RELEASED
;
1059 FIXME("not implemented\n");
1063 static HRESULT WINAPI
ITextSelection_fnInRange(
1068 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1070 return CO_E_RELEASED
;
1072 FIXME("not implemented\n");
1076 static HRESULT WINAPI
ITextSelection_fnInStory(
1081 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1083 return CO_E_RELEASED
;
1085 FIXME("not implemented\n");
1089 static HRESULT WINAPI
ITextSelection_fnIsEqual(
1094 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1096 return CO_E_RELEASED
;
1098 FIXME("not implemented\n");
1102 static HRESULT WINAPI
ITextSelection_fnSelect(
1105 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1107 return CO_E_RELEASED
;
1109 FIXME("not implemented\n");
1113 static HRESULT WINAPI
ITextSelection_fnStartOf(
1119 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1121 return CO_E_RELEASED
;
1123 FIXME("not implemented\n");
1127 static HRESULT WINAPI
ITextSelection_fnEndOf(
1133 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1135 return CO_E_RELEASED
;
1137 FIXME("not implemented\n");
1141 static HRESULT WINAPI
ITextSelection_fnMove(
1147 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1149 return CO_E_RELEASED
;
1151 FIXME("not implemented\n");
1155 static HRESULT WINAPI
ITextSelection_fnMoveStart(
1161 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1163 return CO_E_RELEASED
;
1165 FIXME("not implemented\n");
1169 static HRESULT WINAPI
ITextSelection_fnMoveEnd(
1175 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1177 return CO_E_RELEASED
;
1179 FIXME("not implemented\n");
1183 static HRESULT WINAPI
ITextSelection_fnMoveWhile(
1189 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1191 return CO_E_RELEASED
;
1193 FIXME("not implemented\n");
1197 static HRESULT WINAPI
ITextSelection_fnMoveStartWhile(
1203 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1205 return CO_E_RELEASED
;
1207 FIXME("not implemented\n");
1211 static HRESULT WINAPI
ITextSelection_fnMoveEndWhile(
1217 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1219 return CO_E_RELEASED
;
1221 FIXME("not implemented\n");
1225 static HRESULT WINAPI
ITextSelection_fnMoveUntil(
1231 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1233 return CO_E_RELEASED
;
1235 FIXME("not implemented\n");
1239 static HRESULT WINAPI
ITextSelection_fnMoveStartUntil(
1245 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1247 return CO_E_RELEASED
;
1249 FIXME("not implemented\n");
1253 static HRESULT WINAPI
ITextSelection_fnMoveEndUntil(
1259 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1261 return CO_E_RELEASED
;
1263 FIXME("not implemented\n");
1267 static HRESULT WINAPI
ITextSelection_fnFindText(
1274 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1276 return CO_E_RELEASED
;
1278 FIXME("not implemented\n");
1282 static HRESULT WINAPI
ITextSelection_fnFindTextStart(
1289 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1291 return CO_E_RELEASED
;
1293 FIXME("not implemented\n");
1297 static HRESULT WINAPI
ITextSelection_fnFindTextEnd(
1304 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1306 return CO_E_RELEASED
;
1308 FIXME("not implemented\n");
1312 static HRESULT WINAPI
ITextSelection_fnDelete(
1318 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1320 return CO_E_RELEASED
;
1322 FIXME("not implemented\n");
1326 static HRESULT WINAPI
ITextSelection_fnCut(
1330 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1332 return CO_E_RELEASED
;
1334 FIXME("not implemented\n");
1338 static HRESULT WINAPI
ITextSelection_fnCopy(
1342 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1344 return CO_E_RELEASED
;
1346 FIXME("not implemented\n");
1350 static HRESULT WINAPI
ITextSelection_fnPaste(
1355 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1357 return CO_E_RELEASED
;
1359 FIXME("not implemented\n");
1363 static HRESULT WINAPI
ITextSelection_fnCanPaste(
1369 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1371 return CO_E_RELEASED
;
1373 FIXME("not implemented\n");
1377 static HRESULT WINAPI
ITextSelection_fnCanEdit(
1381 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1383 return CO_E_RELEASED
;
1385 FIXME("not implemented\n");
1389 static HRESULT WINAPI
ITextSelection_fnChangeCase(
1393 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1395 return CO_E_RELEASED
;
1397 FIXME("not implemented\n");
1401 static HRESULT WINAPI
ITextSelection_fnGetPoint(
1407 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1409 return CO_E_RELEASED
;
1411 FIXME("not implemented\n");
1415 static HRESULT WINAPI
ITextSelection_fnSetPoint(
1422 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1424 return CO_E_RELEASED
;
1426 FIXME("not implemented\n");
1430 static HRESULT WINAPI
ITextSelection_fnScrollIntoView(
1434 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1436 return CO_E_RELEASED
;
1438 FIXME("not implemented\n");
1442 static HRESULT WINAPI
ITextSelection_fnGetEmbeddedObject(
1446 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1448 return CO_E_RELEASED
;
1450 FIXME("not implemented\n");
1454 /*** ITextSelection methods ***/
1455 static HRESULT WINAPI
ITextSelection_fnGetFlags(
1459 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1461 return CO_E_RELEASED
;
1463 FIXME("not implemented\n");
1467 static HRESULT WINAPI
ITextSelection_fnSetFlags(
1471 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1473 return CO_E_RELEASED
;
1475 FIXME("not implemented\n");
1479 static HRESULT WINAPI
ITextSelection_fnGetType(
1483 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1485 return CO_E_RELEASED
;
1487 FIXME("not implemented\n");
1491 static HRESULT WINAPI
ITextSelection_fnMoveLeft(
1498 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1500 return CO_E_RELEASED
;
1502 FIXME("not implemented\n");
1506 static HRESULT WINAPI
ITextSelection_fnMoveRight(
1513 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1515 return CO_E_RELEASED
;
1517 FIXME("not implemented\n");
1521 static HRESULT WINAPI
ITextSelection_fnMoveUp(
1528 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1530 return CO_E_RELEASED
;
1532 FIXME("not implemented\n");
1536 static HRESULT WINAPI
ITextSelection_fnMoveDown(
1543 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1545 return CO_E_RELEASED
;
1547 FIXME("not implemented\n");
1551 static HRESULT WINAPI
ITextSelection_fnHomeKey(
1557 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1559 return CO_E_RELEASED
;
1561 FIXME("not implemented\n");
1565 static HRESULT WINAPI
ITextSelection_fnEndKey(
1571 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1573 return CO_E_RELEASED
;
1575 FIXME("not implemented\n");
1579 static HRESULT WINAPI
ITextSelection_fnTypeText(
1583 ITextSelectionImpl
*This
= (ITextSelectionImpl
*) me
;
1585 return CO_E_RELEASED
;
1587 FIXME("not implemented\n");
1591 static const ITextSelectionVtbl tsvt
= {
1592 ITextSelection_fnQueryInterface
,
1593 ITextSelection_fnAddRef
,
1594 ITextSelection_fnRelease
,
1595 ITextSelection_fnGetTypeInfoCount
,
1596 ITextSelection_fnGetTypeInfo
,
1597 ITextSelection_fnGetIDsOfNames
,
1598 ITextSelection_fnInvoke
,
1599 ITextSelection_fnGetText
,
1600 ITextSelection_fnSetText
,
1601 ITextSelection_fnGetChar
,
1602 ITextSelection_fnSetChar
,
1603 ITextSelection_fnGetDuplicate
,
1604 ITextSelection_fnGetFormattedText
,
1605 ITextSelection_fnSetFormattedText
,
1606 ITextSelection_fnGetStart
,
1607 ITextSelection_fnSetStart
,
1608 ITextSelection_fnGetEnd
,
1609 ITextSelection_fnSetEnd
,
1610 ITextSelection_fnGetFont
,
1611 ITextSelection_fnSetFont
,
1612 ITextSelection_fnGetPara
,
1613 ITextSelection_fnSetPara
,
1614 ITextSelection_fnGetStoryLength
,
1615 ITextSelection_fnGetStoryType
,
1616 ITextSelection_fnCollapse
,
1617 ITextSelection_fnExpand
,
1618 ITextSelection_fnGetIndex
,
1619 ITextSelection_fnSetIndex
,
1620 ITextSelection_fnSetRange
,
1621 ITextSelection_fnInRange
,
1622 ITextSelection_fnInStory
,
1623 ITextSelection_fnIsEqual
,
1624 ITextSelection_fnSelect
,
1625 ITextSelection_fnStartOf
,
1626 ITextSelection_fnEndOf
,
1627 ITextSelection_fnMove
,
1628 ITextSelection_fnMoveStart
,
1629 ITextSelection_fnMoveEnd
,
1630 ITextSelection_fnMoveWhile
,
1631 ITextSelection_fnMoveStartWhile
,
1632 ITextSelection_fnMoveEndWhile
,
1633 ITextSelection_fnMoveUntil
,
1634 ITextSelection_fnMoveStartUntil
,
1635 ITextSelection_fnMoveEndUntil
,
1636 ITextSelection_fnFindText
,
1637 ITextSelection_fnFindTextStart
,
1638 ITextSelection_fnFindTextEnd
,
1639 ITextSelection_fnDelete
,
1640 ITextSelection_fnCut
,
1641 ITextSelection_fnCopy
,
1642 ITextSelection_fnPaste
,
1643 ITextSelection_fnCanPaste
,
1644 ITextSelection_fnCanEdit
,
1645 ITextSelection_fnChangeCase
,
1646 ITextSelection_fnGetPoint
,
1647 ITextSelection_fnSetPoint
,
1648 ITextSelection_fnScrollIntoView
,
1649 ITextSelection_fnGetEmbeddedObject
,
1650 ITextSelection_fnGetFlags
,
1651 ITextSelection_fnSetFlags
,
1652 ITextSelection_fnGetType
,
1653 ITextSelection_fnMoveLeft
,
1654 ITextSelection_fnMoveRight
,
1655 ITextSelection_fnMoveUp
,
1656 ITextSelection_fnMoveDown
,
1657 ITextSelection_fnHomeKey
,
1658 ITextSelection_fnEndKey
,
1659 ITextSelection_fnTypeText
1662 static ITextSelectionImpl
*
1663 CreateTextSelection(IRichEditOleImpl
*reOle
)
1665 ITextSelectionImpl
*txtSel
= heap_alloc(sizeof *txtSel
);
1669 txtSel
->lpVtbl
= &tsvt
;
1671 txtSel
->reOle
= reOle
;
1675 LRESULT
CreateIRichEditOle(ME_TextEditor
*editor
, LPVOID
*ppObj
)
1677 IRichEditOleImpl
*reo
;
1679 reo
= heap_alloc(sizeof(IRichEditOleImpl
));
1683 reo
->lpRichEditOleVtbl
= &revt
;
1684 reo
->lpTextDocumentVtbl
= &tdvt
;
1686 reo
->editor
= editor
;
1687 reo
->txtSel
= CreateTextSelection(reo
);
1693 reo
->clientSite
= CreateOleClientSite(reo
);
1696 ITextSelection_Release((ITextSelection
*) reo
->txtSel
);
1700 TRACE("Created %p\n",reo
);
1706 static void convert_sizel(ME_Context
*c
, const SIZEL
* szl
, SIZE
* sz
)
1708 /* sizel is in .01 millimeters, sz in pixels */
1709 sz
->cx
= MulDiv(szl
->cx
, c
->dpi
.cx
, 2540);
1710 sz
->cy
= MulDiv(szl
->cy
, c
->dpi
.cy
, 2540);
1713 /******************************************************************************
1714 * ME_GetOLEObjectSize
1716 * Sets run extent for OLE objects.
1718 void ME_GetOLEObjectSize(ME_Context
*c
, ME_Run
*run
, SIZE
*pSize
)
1726 assert(run
->nFlags
& MERF_GRAPHICS
);
1727 assert(run
->ole_obj
);
1729 if (run
->ole_obj
->sizel
.cx
!= 0 || run
->ole_obj
->sizel
.cy
!= 0)
1731 convert_sizel(c
, &run
->ole_obj
->sizel
, pSize
);
1732 if (c
->editor
->nZoomNumerator
!= 0)
1734 pSize
->cx
= MulDiv(pSize
->cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1735 pSize
->cy
= MulDiv(pSize
->cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1740 IOleObject_QueryInterface(run
->ole_obj
->poleobj
, &IID_IDataObject
, (void**)&ido
);
1741 fmt
.cfFormat
= CF_BITMAP
;
1743 fmt
.dwAspect
= DVASPECT_CONTENT
;
1745 fmt
.tymed
= TYMED_GDI
;
1746 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
1748 fmt
.cfFormat
= CF_ENHMETAFILE
;
1749 fmt
.tymed
= TYMED_ENHMF
;
1750 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
1752 FIXME("unsupported format\n");
1753 pSize
->cx
= pSize
->cy
= 0;
1754 IDataObject_Release(ido
);
1762 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
1763 pSize
->cx
= dibsect
.dsBm
.bmWidth
;
1764 pSize
->cy
= dibsect
.dsBm
.bmHeight
;
1765 if (!stgm
.pUnkForRelease
) DeleteObject(stgm
.u
.hBitmap
);
1768 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
1769 pSize
->cx
= emh
.rclBounds
.right
- emh
.rclBounds
.left
;
1770 pSize
->cy
= emh
.rclBounds
.bottom
- emh
.rclBounds
.top
;
1771 if (!stgm
.pUnkForRelease
) DeleteEnhMetaFile(stgm
.u
.hEnhMetaFile
);
1774 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
1777 IDataObject_Release(ido
);
1778 if (c
->editor
->nZoomNumerator
!= 0)
1780 pSize
->cx
= MulDiv(pSize
->cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1781 pSize
->cy
= MulDiv(pSize
->cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1785 void ME_DrawOLE(ME_Context
*c
, int x
, int y
, ME_Run
*run
,
1786 ME_Paragraph
*para
, BOOL selected
)
1797 assert(run
->nFlags
& MERF_GRAPHICS
);
1798 assert(run
->ole_obj
);
1799 if (IOleObject_QueryInterface(run
->ole_obj
->poleobj
, &IID_IDataObject
, (void**)&ido
) != S_OK
)
1801 FIXME("Couldn't get interface\n");
1804 has_size
= run
->ole_obj
->sizel
.cx
!= 0 || run
->ole_obj
->sizel
.cy
!= 0;
1805 fmt
.cfFormat
= CF_BITMAP
;
1807 fmt
.dwAspect
= DVASPECT_CONTENT
;
1809 fmt
.tymed
= TYMED_GDI
;
1810 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
1812 fmt
.cfFormat
= CF_ENHMETAFILE
;
1813 fmt
.tymed
= TYMED_ENHMF
;
1814 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
1816 FIXME("Couldn't get storage medium\n");
1817 IDataObject_Release(ido
);
1824 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
1825 hMemDC
= CreateCompatibleDC(c
->hDC
);
1826 SelectObject(hMemDC
, stgm
.u
.hBitmap
);
1829 convert_sizel(c
, &run
->ole_obj
->sizel
, &sz
);
1831 sz
.cx
= MulDiv(dibsect
.dsBm
.bmWidth
, c
->dpi
.cx
, 96);
1832 sz
.cy
= MulDiv(dibsect
.dsBm
.bmHeight
, c
->dpi
.cy
, 96);
1834 if (c
->editor
->nZoomNumerator
!= 0)
1836 sz
.cx
= MulDiv(sz
.cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1837 sz
.cy
= MulDiv(sz
.cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1839 if (sz
.cx
== dibsect
.dsBm
.bmWidth
&& sz
.cy
== dibsect
.dsBm
.bmHeight
)
1841 BitBlt(c
->hDC
, x
, y
- sz
.cy
,
1842 dibsect
.dsBm
.bmWidth
, dibsect
.dsBm
.bmHeight
,
1843 hMemDC
, 0, 0, SRCCOPY
);
1845 StretchBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
,
1846 hMemDC
, 0, 0, dibsect
.dsBm
.bmWidth
,
1847 dibsect
.dsBm
.bmHeight
, SRCCOPY
);
1849 if (!stgm
.pUnkForRelease
) DeleteObject(stgm
.u
.hBitmap
);
1852 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
1855 convert_sizel(c
, &run
->ole_obj
->sizel
, &sz
);
1857 sz
.cy
= MulDiv(emh
.rclBounds
.bottom
- emh
.rclBounds
.top
, c
->dpi
.cx
, 96);
1858 sz
.cx
= MulDiv(emh
.rclBounds
.right
- emh
.rclBounds
.left
, c
->dpi
.cy
, 96);
1860 if (c
->editor
->nZoomNumerator
!= 0)
1862 sz
.cx
= MulDiv(sz
.cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1863 sz
.cy
= MulDiv(sz
.cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1871 rc
.right
= x
+ sz
.cx
;
1873 PlayEnhMetaFile(c
->hDC
, stgm
.u
.hEnhMetaFile
, &rc
);
1875 if (!stgm
.pUnkForRelease
) DeleteEnhMetaFile(stgm
.u
.hEnhMetaFile
);
1878 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
1882 if (selected
&& !c
->editor
->bHideSelection
)
1883 PatBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
, DSTINVERT
);
1884 IDataObject_Release(ido
);
1887 void ME_DeleteReObject(REOBJECT
* reo
)
1889 if (reo
->poleobj
) IOleObject_Release(reo
->poleobj
);
1890 if (reo
->pstg
) IStorage_Release(reo
->pstg
);
1891 if (reo
->polesite
) IOleClientSite_Release(reo
->polesite
);
1895 void ME_CopyReObject(REOBJECT
* dst
, const REOBJECT
* src
)
1899 if (dst
->poleobj
) IOleObject_AddRef(dst
->poleobj
);
1900 if (dst
->pstg
) IStorage_AddRef(dst
->pstg
);
1901 if (dst
->polesite
) IOleClientSite_AddRef(dst
->polesite
);