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*/
43 DEFINE_GUID(IID_ITextServices
, 0x8d33f740, 0xcf58, 0x11ce, 0xa8, 0x9d, 0x00, 0xaa, 0x00, 0x6c, 0xad, 0xc5);
44 DEFINE_GUID(IID_ITextHost
, 0x13e670f4,0x1a5a,0x11cf,0xab,0xeb,0x00,0xaa,0x00,0xb6,0x5e,0xa1);
45 DEFINE_GUID(IID_ITextHost2
, 0x13e670f5,0x1a5a,0x11cf,0xab,0xeb,0x00,0xaa,0x00,0xb6,0x5e,0xa1);
46 DEFINE_GUID(IID_ITextDocument
, 0x8cc497c0, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
47 DEFINE_GUID(IID_ITextRange
, 0x8cc497c2, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
48 DEFINE_GUID(IID_ITextSelection
, 0x8cc497c1, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
50 typedef struct ITextSelectionImpl ITextSelectionImpl
;
51 typedef struct IOleClientSiteImpl IOleClientSiteImpl
;
53 typedef struct IRichEditOleImpl
{
54 IRichEditOle IRichEditOle_iface
;
55 ITextDocument ITextDocument_iface
;
58 ME_TextEditor
*editor
;
59 ITextSelectionImpl
*txtSel
;
60 IOleClientSiteImpl
*clientSite
;
63 struct ITextSelectionImpl
{
64 ITextSelection ITextSelection_iface
;
67 IRichEditOleImpl
*reOle
;
70 struct IOleClientSiteImpl
{
71 IOleClientSite IOleClientSite_iface
;
74 IRichEditOleImpl
*reOle
;
77 static inline IRichEditOleImpl
*impl_from_IRichEditOle(IRichEditOle
*iface
)
79 return CONTAINING_RECORD(iface
, IRichEditOleImpl
, IRichEditOle_iface
);
82 static inline IRichEditOleImpl
*impl_from_ITextDocument(ITextDocument
*iface
)
84 return CONTAINING_RECORD(iface
, IRichEditOleImpl
, ITextDocument_iface
);
88 IRichEditOle_fnQueryInterface(IRichEditOle
*me
, REFIID riid
, LPVOID
*ppvObj
)
90 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
92 TRACE("%p %s\n", This
, debugstr_guid(riid
) );
95 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
96 IsEqualGUID(riid
, &IID_IRichEditOle
))
97 *ppvObj
= &This
->IRichEditOle_iface
;
98 else if (IsEqualGUID(riid
, &IID_ITextDocument
))
99 *ppvObj
= &This
->ITextDocument_iface
;
102 IRichEditOle_AddRef(me
);
105 FIXME("%p: unhandled interface %s\n", This
, debugstr_guid(riid
) );
107 return E_NOINTERFACE
;
111 IRichEditOle_fnAddRef(IRichEditOle
*me
)
113 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
114 ULONG ref
= InterlockedIncrement( &This
->ref
);
116 TRACE("%p ref = %u\n", This
, ref
);
122 IRichEditOle_fnRelease(IRichEditOle
*me
)
124 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
125 ULONG ref
= InterlockedDecrement(&This
->ref
);
127 TRACE ("%p ref=%u\n", This
, ref
);
131 TRACE ("Destroying %p\n", This
);
132 This
->txtSel
->reOle
= NULL
;
133 ITextSelection_Release(&This
->txtSel
->ITextSelection_iface
);
134 IOleClientSite_Release(&This
->clientSite
->IOleClientSite_iface
);
140 static HRESULT WINAPI
141 IRichEditOle_fnActivateAs(IRichEditOle
*me
, REFCLSID rclsid
, REFCLSID rclsidAs
)
143 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
144 FIXME("stub %p\n",This
);
148 static HRESULT WINAPI
149 IRichEditOle_fnContextSensitiveHelp(IRichEditOle
*me
, BOOL fEnterMode
)
151 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
152 FIXME("stub %p\n",This
);
156 static HRESULT WINAPI
157 IRichEditOle_fnConvertObject(IRichEditOle
*me
, LONG iob
,
158 REFCLSID rclsidNew
, LPCSTR lpstrUserTypeNew
)
160 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
161 FIXME("stub %p\n",This
);
165 static inline IOleClientSiteImpl
*impl_from_IOleClientSite(IOleClientSite
*iface
)
167 return CONTAINING_RECORD(iface
, IOleClientSiteImpl
, IOleClientSite_iface
);
170 static HRESULT WINAPI
171 IOleClientSite_fnQueryInterface(IOleClientSite
*me
, REFIID riid
, LPVOID
*ppvObj
)
173 TRACE("%p %s\n", me
, debugstr_guid(riid
) );
176 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
177 IsEqualGUID(riid
, &IID_IOleClientSite
))
181 IOleClientSite_AddRef(me
);
184 FIXME("%p: unhandled interface %s\n", me
, debugstr_guid(riid
) );
186 return E_NOINTERFACE
;
189 static ULONG WINAPI
IOleClientSite_fnAddRef(IOleClientSite
*iface
)
191 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
192 return InterlockedIncrement(&This
->ref
);
195 static ULONG WINAPI
IOleClientSite_fnRelease(IOleClientSite
*iface
)
197 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
198 ULONG ref
= InterlockedDecrement(&This
->ref
);
204 static HRESULT WINAPI
IOleClientSite_fnSaveObject(IOleClientSite
*iface
)
206 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
208 return CO_E_RELEASED
;
210 FIXME("stub %p\n", iface
);
215 static HRESULT WINAPI
IOleClientSite_fnGetMoniker(IOleClientSite
*iface
, DWORD dwAssign
,
216 DWORD dwWhichMoniker
, IMoniker
**ppmk
)
218 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
220 return CO_E_RELEASED
;
222 FIXME("stub %p\n", iface
);
226 static HRESULT WINAPI
IOleClientSite_fnGetContainer(IOleClientSite
*iface
,
227 IOleContainer
**ppContainer
)
229 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
231 return CO_E_RELEASED
;
233 FIXME("stub %p\n", iface
);
237 static HRESULT WINAPI
IOleClientSite_fnShowObject(IOleClientSite
*iface
)
239 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
241 return CO_E_RELEASED
;
243 FIXME("stub %p\n", iface
);
247 static HRESULT WINAPI
IOleClientSite_fnOnShowWindow(IOleClientSite
*iface
, BOOL fShow
)
249 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
251 return CO_E_RELEASED
;
253 FIXME("stub %p\n", iface
);
257 static HRESULT WINAPI
IOleClientSite_fnRequestNewObjectLayout(IOleClientSite
*iface
)
259 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
261 return CO_E_RELEASED
;
263 FIXME("stub %p\n", iface
);
267 static const IOleClientSiteVtbl ocst
= {
268 IOleClientSite_fnQueryInterface
,
269 IOleClientSite_fnAddRef
,
270 IOleClientSite_fnRelease
,
271 IOleClientSite_fnSaveObject
,
272 IOleClientSite_fnGetMoniker
,
273 IOleClientSite_fnGetContainer
,
274 IOleClientSite_fnShowObject
,
275 IOleClientSite_fnOnShowWindow
,
276 IOleClientSite_fnRequestNewObjectLayout
279 static IOleClientSiteImpl
*
280 CreateOleClientSite(IRichEditOleImpl
*reOle
)
282 IOleClientSiteImpl
*clientSite
= heap_alloc(sizeof *clientSite
);
286 clientSite
->IOleClientSite_iface
.lpVtbl
= &ocst
;
288 clientSite
->reOle
= reOle
;
292 static HRESULT WINAPI
293 IRichEditOle_fnGetClientSite(IRichEditOle
*me
,
294 LPOLECLIENTSITE
*lplpolesite
)
296 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
298 TRACE("%p,%p\n",This
, lplpolesite
);
302 *lplpolesite
= &This
->clientSite
->IOleClientSite_iface
;
303 IOleClientSite_fnAddRef(*lplpolesite
);
307 static HRESULT WINAPI
308 IRichEditOle_fnGetClipboardData(IRichEditOle
*me
, CHARRANGE
*lpchrg
,
309 DWORD reco
, LPDATAOBJECT
*lplpdataobj
)
311 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
315 TRACE("(%p,%p,%d)\n",This
, lpchrg
, reco
);
319 int nFrom
, nTo
, nStartCur
= ME_GetSelectionOfs(This
->editor
, &nFrom
, &nTo
);
320 start
= This
->editor
->pCursors
[nStartCur
];
321 nChars
= nTo
- nFrom
;
323 ME_CursorFromCharOfs(This
->editor
, lpchrg
->cpMin
, &start
);
324 nChars
= lpchrg
->cpMax
- lpchrg
->cpMin
;
326 return ME_GetDataObject(This
->editor
, &start
, nChars
, lplpdataobj
);
329 static LONG WINAPI
IRichEditOle_fnGetLinkCount(IRichEditOle
*me
)
331 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
332 FIXME("stub %p\n",This
);
336 static HRESULT WINAPI
337 IRichEditOle_fnGetObject(IRichEditOle
*me
, LONG iob
,
338 REOBJECT
*lpreobject
, DWORD dwFlags
)
340 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
341 FIXME("stub %p\n",This
);
346 IRichEditOle_fnGetObjectCount(IRichEditOle
*me
)
348 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
349 FIXME("stub %p\n",This
);
353 static HRESULT WINAPI
354 IRichEditOle_fnHandsOffStorage(IRichEditOle
*me
, LONG iob
)
356 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
357 FIXME("stub %p\n",This
);
361 static HRESULT WINAPI
362 IRichEditOle_fnImportDataObject(IRichEditOle
*me
, LPDATAOBJECT lpdataobj
,
363 CLIPFORMAT cf
, HGLOBAL hMetaPict
)
365 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
366 FIXME("stub %p\n",This
);
370 static HRESULT WINAPI
371 IRichEditOle_fnInPlaceDeactivate(IRichEditOle
*me
)
373 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
374 FIXME("stub %p\n",This
);
378 static HRESULT WINAPI
379 IRichEditOle_fnInsertObject(IRichEditOle
*me
, REOBJECT
*reo
)
381 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
382 TRACE("(%p,%p)\n", This
, reo
);
384 if (reo
->cbStruct
< sizeof(*reo
)) return STG_E_INVALIDPARAMETER
;
386 ME_InsertOLEFromCursor(This
->editor
, reo
, 0);
387 ME_CommitUndo(This
->editor
);
388 ME_UpdateRepaint(This
->editor
, FALSE
);
392 static HRESULT WINAPI
IRichEditOle_fnSaveCompleted(IRichEditOle
*me
, LONG iob
,
395 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
396 FIXME("stub %p\n",This
);
400 static HRESULT WINAPI
401 IRichEditOle_fnSetDvaspect(IRichEditOle
*me
, LONG iob
, DWORD dvaspect
)
403 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
404 FIXME("stub %p\n",This
);
408 static HRESULT WINAPI
IRichEditOle_fnSetHostNames(IRichEditOle
*me
,
409 LPCSTR lpstrContainerApp
, LPCSTR lpstrContainerObj
)
411 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
412 FIXME("stub %p %s %s\n",This
, lpstrContainerApp
, lpstrContainerObj
);
416 static HRESULT WINAPI
417 IRichEditOle_fnSetLinkAvailable(IRichEditOle
*me
, LONG iob
, BOOL fAvailable
)
419 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
420 FIXME("stub %p\n",This
);
424 static const IRichEditOleVtbl revt
= {
425 IRichEditOle_fnQueryInterface
,
426 IRichEditOle_fnAddRef
,
427 IRichEditOle_fnRelease
,
428 IRichEditOle_fnGetClientSite
,
429 IRichEditOle_fnGetObjectCount
,
430 IRichEditOle_fnGetLinkCount
,
431 IRichEditOle_fnGetObject
,
432 IRichEditOle_fnInsertObject
,
433 IRichEditOle_fnConvertObject
,
434 IRichEditOle_fnActivateAs
,
435 IRichEditOle_fnSetHostNames
,
436 IRichEditOle_fnSetLinkAvailable
,
437 IRichEditOle_fnSetDvaspect
,
438 IRichEditOle_fnHandsOffStorage
,
439 IRichEditOle_fnSaveCompleted
,
440 IRichEditOle_fnInPlaceDeactivate
,
441 IRichEditOle_fnContextSensitiveHelp
,
442 IRichEditOle_fnGetClipboardData
,
443 IRichEditOle_fnImportDataObject
446 static HRESULT WINAPI
447 ITextDocument_fnQueryInterface(ITextDocument
* me
, REFIID riid
,
450 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
451 return IRichEditOle_fnQueryInterface(&This
->IRichEditOle_iface
, riid
, ppvObject
);
455 ITextDocument_fnAddRef(ITextDocument
* me
)
457 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
458 return IRichEditOle_fnAddRef(&This
->IRichEditOle_iface
);
462 ITextDocument_fnRelease(ITextDocument
* me
)
464 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
465 return IRichEditOle_fnRelease(&This
->IRichEditOle_iface
);
468 static HRESULT WINAPI
469 ITextDocument_fnGetTypeInfoCount(ITextDocument
* me
,
472 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
473 FIXME("stub %p\n",This
);
477 static HRESULT WINAPI
478 ITextDocument_fnGetTypeInfo(ITextDocument
* me
, UINT iTInfo
, LCID lcid
,
481 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
482 FIXME("stub %p\n",This
);
486 static HRESULT WINAPI
487 ITextDocument_fnGetIDsOfNames(ITextDocument
* me
, REFIID riid
,
488 LPOLESTR
* rgszNames
, UINT cNames
, LCID lcid
, DISPID
* rgDispId
)
490 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
491 FIXME("stub %p\n",This
);
495 static HRESULT WINAPI
496 ITextDocument_fnInvoke(ITextDocument
* me
, DISPID dispIdMember
,
497 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
* pDispParams
,
498 VARIANT
* pVarResult
, EXCEPINFO
* pExcepInfo
, UINT
* puArgErr
)
500 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
501 FIXME("stub %p\n",This
);
505 static HRESULT WINAPI
506 ITextDocument_fnGetName(ITextDocument
* me
, BSTR
* pName
)
508 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
509 FIXME("stub %p\n",This
);
513 static HRESULT WINAPI
514 ITextDocument_fnGetSelection(ITextDocument
* me
, ITextSelection
** ppSel
)
516 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
518 *ppSel
= &This
->txtSel
->ITextSelection_iface
;
519 ITextSelection_AddRef(*ppSel
);
523 static HRESULT WINAPI
524 ITextDocument_fnGetStoryCount(ITextDocument
* me
, LONG
* pCount
)
526 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
527 FIXME("stub %p\n",This
);
531 static HRESULT WINAPI
532 ITextDocument_fnGetStoryRanges(ITextDocument
* me
,
533 ITextStoryRanges
** ppStories
)
535 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
536 FIXME("stub %p\n",This
);
540 static HRESULT WINAPI
541 ITextDocument_fnGetSaved(ITextDocument
* me
, LONG
* pValue
)
543 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
544 FIXME("stub %p\n",This
);
548 static HRESULT WINAPI
549 ITextDocument_fnSetSaved(ITextDocument
* me
, LONG Value
)
551 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
552 FIXME("stub %p\n",This
);
556 static HRESULT WINAPI
557 ITextDocument_fnGetDefaultTabStop(ITextDocument
* me
, float* pValue
)
559 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
560 FIXME("stub %p\n",This
);
564 static HRESULT WINAPI
565 ITextDocument_fnSetDefaultTabStop(ITextDocument
* me
, float Value
)
567 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
568 FIXME("stub %p\n",This
);
572 static HRESULT WINAPI
573 ITextDocument_fnNew(ITextDocument
* me
)
575 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
576 FIXME("stub %p\n",This
);
580 static HRESULT WINAPI
581 ITextDocument_fnOpen(ITextDocument
* me
, VARIANT
* pVar
, LONG Flags
,
584 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
585 FIXME("stub %p\n",This
);
589 static HRESULT WINAPI
590 ITextDocument_fnSave(ITextDocument
* me
, VARIANT
* pVar
, LONG Flags
,
593 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
594 FIXME("stub %p\n",This
);
598 static HRESULT WINAPI
599 ITextDocument_fnFreeze(ITextDocument
* me
, LONG
* pCount
)
601 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
602 FIXME("stub %p\n",This
);
606 static HRESULT WINAPI
607 ITextDocument_fnUnfreeze(ITextDocument
* me
, LONG
* pCount
)
609 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
610 FIXME("stub %p\n",This
);
614 static HRESULT WINAPI
615 ITextDocument_fnBeginEditCollection(ITextDocument
* me
)
617 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
618 FIXME("stub %p\n",This
);
622 static HRESULT WINAPI
623 ITextDocument_fnEndEditCollection(ITextDocument
* me
)
625 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
626 FIXME("stub %p\n",This
);
630 static HRESULT WINAPI
631 ITextDocument_fnUndo(ITextDocument
* me
, LONG Count
, LONG
* prop
)
633 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
634 FIXME("stub %p\n",This
);
638 static HRESULT WINAPI
639 ITextDocument_fnRedo(ITextDocument
* me
, LONG Count
, LONG
* prop
)
641 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
642 FIXME("stub %p\n",This
);
646 static HRESULT WINAPI
647 ITextDocument_fnRange(ITextDocument
* me
, LONG cp1
, LONG cp2
,
648 ITextRange
** ppRange
)
650 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
651 FIXME("stub %p\n",This
);
655 static HRESULT WINAPI
656 ITextDocument_fnRangeFromPoint(ITextDocument
* me
, LONG x
, LONG y
,
657 ITextRange
** ppRange
)
659 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
660 FIXME("stub %p\n",This
);
664 static const ITextDocumentVtbl tdvt
= {
665 ITextDocument_fnQueryInterface
,
666 ITextDocument_fnAddRef
,
667 ITextDocument_fnRelease
,
668 ITextDocument_fnGetTypeInfoCount
,
669 ITextDocument_fnGetTypeInfo
,
670 ITextDocument_fnGetIDsOfNames
,
671 ITextDocument_fnInvoke
,
672 ITextDocument_fnGetName
,
673 ITextDocument_fnGetSelection
,
674 ITextDocument_fnGetStoryCount
,
675 ITextDocument_fnGetStoryRanges
,
676 ITextDocument_fnGetSaved
,
677 ITextDocument_fnSetSaved
,
678 ITextDocument_fnGetDefaultTabStop
,
679 ITextDocument_fnSetDefaultTabStop
,
681 ITextDocument_fnOpen
,
682 ITextDocument_fnSave
,
683 ITextDocument_fnFreeze
,
684 ITextDocument_fnUnfreeze
,
685 ITextDocument_fnBeginEditCollection
,
686 ITextDocument_fnEndEditCollection
,
687 ITextDocument_fnUndo
,
688 ITextDocument_fnRedo
,
689 ITextDocument_fnRange
,
690 ITextDocument_fnRangeFromPoint
693 static inline ITextSelectionImpl
*impl_from_ITextSelection(ITextSelection
*iface
)
695 return CONTAINING_RECORD(iface
, ITextSelectionImpl
, ITextSelection_iface
);
698 static HRESULT WINAPI
ITextSelection_fnQueryInterface(
704 if (IsEqualGUID(riid
, &IID_IUnknown
)
705 || IsEqualGUID(riid
, &IID_IDispatch
)
706 || IsEqualGUID(riid
, &IID_ITextRange
)
707 || IsEqualGUID(riid
, &IID_ITextSelection
))
710 ITextSelection_AddRef(me
);
714 return E_NOINTERFACE
;
717 static ULONG WINAPI
ITextSelection_fnAddRef(ITextSelection
*me
)
719 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
720 return InterlockedIncrement(&This
->ref
);
723 static ULONG WINAPI
ITextSelection_fnRelease(ITextSelection
*me
)
725 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
726 ULONG ref
= InterlockedDecrement(&This
->ref
);
732 static HRESULT WINAPI
ITextSelection_fnGetTypeInfoCount(ITextSelection
*me
, UINT
*pctinfo
)
734 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
736 return CO_E_RELEASED
;
738 FIXME("not implemented\n");
742 static HRESULT WINAPI
ITextSelection_fnGetTypeInfo(ITextSelection
*me
, UINT iTInfo
, LCID lcid
,
745 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
747 return CO_E_RELEASED
;
749 FIXME("not implemented\n");
753 static HRESULT WINAPI
ITextSelection_fnGetIDsOfNames(ITextSelection
*me
, REFIID riid
,
754 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
756 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
758 return CO_E_RELEASED
;
760 FIXME("not implemented\n");
764 static HRESULT WINAPI
ITextSelection_fnInvoke(
770 DISPPARAMS
*pDispParams
,
772 EXCEPINFO
*pExcepInfo
,
775 FIXME("not implemented\n");
779 /*** ITextRange methods ***/
780 static HRESULT WINAPI
ITextSelection_fnGetText(ITextSelection
*me
, BSTR
*pbstr
)
782 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
784 return CO_E_RELEASED
;
786 FIXME("not implemented\n");
790 static HRESULT WINAPI
ITextSelection_fnSetText(ITextSelection
*me
, BSTR bstr
)
792 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
794 return CO_E_RELEASED
;
796 FIXME("not implemented\n");
800 static HRESULT WINAPI
ITextSelection_fnGetChar(ITextSelection
*me
, LONG
*pch
)
802 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
804 return CO_E_RELEASED
;
806 FIXME("not implemented\n");
810 static HRESULT WINAPI
ITextSelection_fnSetChar(ITextSelection
*me
, LONG ch
)
812 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
814 return CO_E_RELEASED
;
816 FIXME("not implemented\n");
820 static HRESULT WINAPI
ITextSelection_fnGetDuplicate(ITextSelection
*me
, ITextRange
**ppRange
)
822 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
824 return CO_E_RELEASED
;
826 FIXME("not implemented\n");
830 static HRESULT WINAPI
ITextSelection_fnGetFormattedText(ITextSelection
*me
, ITextRange
**ppRange
)
832 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
834 return CO_E_RELEASED
;
836 FIXME("not implemented\n");
840 static HRESULT WINAPI
ITextSelection_fnSetFormattedText(ITextSelection
*me
, ITextRange
*pRange
)
842 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
844 return CO_E_RELEASED
;
846 FIXME("not implemented\n");
850 static HRESULT WINAPI
ITextSelection_fnGetStart(ITextSelection
*me
, LONG
*pcpFirst
)
852 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
854 return CO_E_RELEASED
;
856 FIXME("not implemented\n");
860 static HRESULT WINAPI
ITextSelection_fnSetStart(ITextSelection
*me
, LONG cpFirst
)
862 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
864 return CO_E_RELEASED
;
866 FIXME("not implemented\n");
870 static HRESULT WINAPI
ITextSelection_fnGetEnd(ITextSelection
*me
, LONG
*pcpLim
)
872 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
874 return CO_E_RELEASED
;
876 FIXME("not implemented\n");
880 static HRESULT WINAPI
ITextSelection_fnSetEnd(ITextSelection
*me
, LONG cpLim
)
882 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
884 return CO_E_RELEASED
;
886 FIXME("not implemented\n");
890 static HRESULT WINAPI
ITextSelection_fnGetFont(ITextSelection
*me
, ITextFont
**pFont
)
892 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
894 return CO_E_RELEASED
;
896 FIXME("not implemented\n");
900 static HRESULT WINAPI
ITextSelection_fnSetFont(ITextSelection
*me
, ITextFont
*pFont
)
902 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
904 return CO_E_RELEASED
;
906 FIXME("not implemented\n");
910 static HRESULT WINAPI
ITextSelection_fnGetPara(ITextSelection
*me
, ITextPara
**ppPara
)
912 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
914 return CO_E_RELEASED
;
916 FIXME("not implemented\n");
920 static HRESULT WINAPI
ITextSelection_fnSetPara(ITextSelection
*me
, ITextPara
*pPara
)
922 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
924 return CO_E_RELEASED
;
926 FIXME("not implemented\n");
930 static HRESULT WINAPI
ITextSelection_fnGetStoryLength(ITextSelection
*me
, LONG
*pcch
)
932 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
934 return CO_E_RELEASED
;
936 FIXME("not implemented\n");
940 static HRESULT WINAPI
ITextSelection_fnGetStoryType(ITextSelection
*me
, LONG
*pValue
)
942 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
944 return CO_E_RELEASED
;
946 FIXME("not implemented\n");
950 static HRESULT WINAPI
ITextSelection_fnCollapse(ITextSelection
*me
, LONG bStart
)
952 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
954 return CO_E_RELEASED
;
956 FIXME("not implemented\n");
960 static HRESULT WINAPI
ITextSelection_fnExpand(ITextSelection
*me
, LONG Unit
, LONG
*pDelta
)
962 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
964 return CO_E_RELEASED
;
966 FIXME("not implemented\n");
970 static HRESULT WINAPI
ITextSelection_fnGetIndex(ITextSelection
*me
, LONG Unit
, LONG
*pIndex
)
972 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
974 return CO_E_RELEASED
;
976 FIXME("not implemented\n");
980 static HRESULT WINAPI
ITextSelection_fnSetIndex(ITextSelection
*me
, LONG Unit
, LONG Index
,
983 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
985 return CO_E_RELEASED
;
987 FIXME("not implemented\n");
991 static HRESULT WINAPI
ITextSelection_fnSetRange(ITextSelection
*me
, LONG cpActive
, LONG cpOther
)
993 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
995 return CO_E_RELEASED
;
997 FIXME("not implemented\n");
1001 static HRESULT WINAPI
ITextSelection_fnInRange(ITextSelection
*me
, ITextRange
*pRange
, LONG
*pb
)
1003 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1005 return CO_E_RELEASED
;
1007 FIXME("not implemented\n");
1011 static HRESULT WINAPI
ITextSelection_fnInStory(ITextSelection
*me
, ITextRange
*pRange
, LONG
*pb
)
1013 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1015 return CO_E_RELEASED
;
1017 FIXME("not implemented\n");
1021 static HRESULT WINAPI
ITextSelection_fnIsEqual(ITextSelection
*me
, ITextRange
*pRange
, LONG
*pb
)
1023 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1025 return CO_E_RELEASED
;
1027 FIXME("not implemented\n");
1031 static HRESULT WINAPI
ITextSelection_fnSelect(ITextSelection
*me
)
1033 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1035 return CO_E_RELEASED
;
1037 FIXME("not implemented\n");
1041 static HRESULT WINAPI
ITextSelection_fnStartOf(ITextSelection
*me
, LONG Unit
, LONG Extend
,
1044 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1046 return CO_E_RELEASED
;
1048 FIXME("not implemented\n");
1052 static HRESULT WINAPI
ITextSelection_fnEndOf(ITextSelection
*me
, LONG Unit
, LONG Extend
,
1055 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1057 return CO_E_RELEASED
;
1059 FIXME("not implemented\n");
1063 static HRESULT WINAPI
ITextSelection_fnMove(ITextSelection
*me
, LONG Unit
, LONG Count
, LONG
*pDelta
)
1065 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1067 return CO_E_RELEASED
;
1069 FIXME("not implemented\n");
1073 static HRESULT WINAPI
ITextSelection_fnMoveStart(ITextSelection
*me
, LONG Unit
, LONG Count
,
1076 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1078 return CO_E_RELEASED
;
1080 FIXME("not implemented\n");
1084 static HRESULT WINAPI
ITextSelection_fnMoveEnd(ITextSelection
*me
, LONG Unit
, LONG Count
,
1087 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1089 return CO_E_RELEASED
;
1091 FIXME("not implemented\n");
1095 static HRESULT WINAPI
ITextSelection_fnMoveWhile(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1098 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1100 return CO_E_RELEASED
;
1102 FIXME("not implemented\n");
1106 static HRESULT WINAPI
ITextSelection_fnMoveStartWhile(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1109 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1111 return CO_E_RELEASED
;
1113 FIXME("not implemented\n");
1117 static HRESULT WINAPI
ITextSelection_fnMoveEndWhile(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1120 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1122 return CO_E_RELEASED
;
1124 FIXME("not implemented\n");
1128 static HRESULT WINAPI
ITextSelection_fnMoveUntil(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1131 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1133 return CO_E_RELEASED
;
1135 FIXME("not implemented\n");
1139 static HRESULT WINAPI
ITextSelection_fnMoveStartUntil(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1142 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1144 return CO_E_RELEASED
;
1146 FIXME("not implemented\n");
1150 static HRESULT WINAPI
ITextSelection_fnMoveEndUntil(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1153 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1155 return CO_E_RELEASED
;
1157 FIXME("not implemented\n");
1161 static HRESULT WINAPI
ITextSelection_fnFindText(ITextSelection
*me
, BSTR bstr
, LONG cch
, LONG Flags
,
1164 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1166 return CO_E_RELEASED
;
1168 FIXME("not implemented\n");
1172 static HRESULT WINAPI
ITextSelection_fnFindTextStart(ITextSelection
*me
, BSTR bstr
, LONG cch
,
1173 LONG Flags
, LONG
*pLength
)
1175 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1177 return CO_E_RELEASED
;
1179 FIXME("not implemented\n");
1183 static HRESULT WINAPI
ITextSelection_fnFindTextEnd(ITextSelection
*me
, BSTR bstr
, LONG cch
,
1184 LONG Flags
, LONG
*pLength
)
1186 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1188 return CO_E_RELEASED
;
1190 FIXME("not implemented\n");
1194 static HRESULT WINAPI
ITextSelection_fnDelete(ITextSelection
*me
, LONG Unit
, LONG Count
,
1197 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1199 return CO_E_RELEASED
;
1201 FIXME("not implemented\n");
1205 static HRESULT WINAPI
ITextSelection_fnCut(ITextSelection
*me
, VARIANT
*pVar
)
1207 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1209 return CO_E_RELEASED
;
1211 FIXME("not implemented\n");
1215 static HRESULT WINAPI
ITextSelection_fnCopy(ITextSelection
*me
, VARIANT
*pVar
)
1217 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1219 return CO_E_RELEASED
;
1221 FIXME("not implemented\n");
1225 static HRESULT WINAPI
ITextSelection_fnPaste(ITextSelection
*me
, VARIANT
*pVar
, LONG Format
)
1227 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1229 return CO_E_RELEASED
;
1231 FIXME("not implemented\n");
1235 static HRESULT WINAPI
ITextSelection_fnCanPaste(ITextSelection
*me
, VARIANT
*pVar
, LONG Format
,
1238 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1240 return CO_E_RELEASED
;
1242 FIXME("not implemented\n");
1246 static HRESULT WINAPI
ITextSelection_fnCanEdit(ITextSelection
*me
, LONG
*pb
)
1248 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1250 return CO_E_RELEASED
;
1252 FIXME("not implemented\n");
1256 static HRESULT WINAPI
ITextSelection_fnChangeCase(ITextSelection
*me
, LONG Type
)
1258 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1260 return CO_E_RELEASED
;
1262 FIXME("not implemented\n");
1266 static HRESULT WINAPI
ITextSelection_fnGetPoint(ITextSelection
*me
, LONG Type
, LONG
*cx
, LONG
*cy
)
1268 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1270 return CO_E_RELEASED
;
1272 FIXME("not implemented\n");
1276 static HRESULT WINAPI
ITextSelection_fnSetPoint(ITextSelection
*me
, LONG x
, LONG y
, LONG Type
,
1279 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1281 return CO_E_RELEASED
;
1283 FIXME("not implemented\n");
1287 static HRESULT WINAPI
ITextSelection_fnScrollIntoView(ITextSelection
*me
, LONG Value
)
1289 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1291 return CO_E_RELEASED
;
1293 FIXME("not implemented\n");
1297 static HRESULT WINAPI
ITextSelection_fnGetEmbeddedObject(ITextSelection
*me
, IUnknown
**ppv
)
1299 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1301 return CO_E_RELEASED
;
1303 FIXME("not implemented\n");
1307 /*** ITextSelection methods ***/
1308 static HRESULT WINAPI
ITextSelection_fnGetFlags(ITextSelection
*me
, LONG
*pFlags
)
1310 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1312 return CO_E_RELEASED
;
1314 FIXME("not implemented\n");
1318 static HRESULT WINAPI
ITextSelection_fnSetFlags(ITextSelection
*me
, LONG Flags
)
1320 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1322 return CO_E_RELEASED
;
1324 FIXME("not implemented\n");
1328 static HRESULT WINAPI
ITextSelection_fnGetType(ITextSelection
*me
, LONG
*pType
)
1330 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1332 return CO_E_RELEASED
;
1334 FIXME("not implemented\n");
1338 static HRESULT WINAPI
ITextSelection_fnMoveLeft(ITextSelection
*me
, LONG Unit
, LONG Count
,
1339 LONG Extend
, LONG
*pDelta
)
1341 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1343 return CO_E_RELEASED
;
1345 FIXME("not implemented\n");
1349 static HRESULT WINAPI
ITextSelection_fnMoveRight(ITextSelection
*me
, LONG Unit
, LONG Count
,
1350 LONG Extend
, LONG
*pDelta
)
1352 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1354 return CO_E_RELEASED
;
1356 FIXME("not implemented\n");
1360 static HRESULT WINAPI
ITextSelection_fnMoveUp(ITextSelection
*me
, LONG Unit
, LONG Count
,
1361 LONG Extend
, LONG
*pDelta
)
1363 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1365 return CO_E_RELEASED
;
1367 FIXME("not implemented\n");
1371 static HRESULT WINAPI
ITextSelection_fnMoveDown(ITextSelection
*me
, LONG Unit
, LONG Count
,
1372 LONG Extend
, LONG
*pDelta
)
1374 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1376 return CO_E_RELEASED
;
1378 FIXME("not implemented\n");
1382 static HRESULT WINAPI
ITextSelection_fnHomeKey(ITextSelection
*me
, LONG Unit
, LONG Extend
,
1385 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1387 return CO_E_RELEASED
;
1389 FIXME("not implemented\n");
1393 static HRESULT WINAPI
ITextSelection_fnEndKey(ITextSelection
*me
, LONG Unit
, LONG Extend
,
1396 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1398 return CO_E_RELEASED
;
1400 FIXME("not implemented\n");
1404 static HRESULT WINAPI
ITextSelection_fnTypeText(ITextSelection
*me
, BSTR bstr
)
1406 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1408 return CO_E_RELEASED
;
1410 FIXME("not implemented\n");
1414 static const ITextSelectionVtbl tsvt
= {
1415 ITextSelection_fnQueryInterface
,
1416 ITextSelection_fnAddRef
,
1417 ITextSelection_fnRelease
,
1418 ITextSelection_fnGetTypeInfoCount
,
1419 ITextSelection_fnGetTypeInfo
,
1420 ITextSelection_fnGetIDsOfNames
,
1421 ITextSelection_fnInvoke
,
1422 ITextSelection_fnGetText
,
1423 ITextSelection_fnSetText
,
1424 ITextSelection_fnGetChar
,
1425 ITextSelection_fnSetChar
,
1426 ITextSelection_fnGetDuplicate
,
1427 ITextSelection_fnGetFormattedText
,
1428 ITextSelection_fnSetFormattedText
,
1429 ITextSelection_fnGetStart
,
1430 ITextSelection_fnSetStart
,
1431 ITextSelection_fnGetEnd
,
1432 ITextSelection_fnSetEnd
,
1433 ITextSelection_fnGetFont
,
1434 ITextSelection_fnSetFont
,
1435 ITextSelection_fnGetPara
,
1436 ITextSelection_fnSetPara
,
1437 ITextSelection_fnGetStoryLength
,
1438 ITextSelection_fnGetStoryType
,
1439 ITextSelection_fnCollapse
,
1440 ITextSelection_fnExpand
,
1441 ITextSelection_fnGetIndex
,
1442 ITextSelection_fnSetIndex
,
1443 ITextSelection_fnSetRange
,
1444 ITextSelection_fnInRange
,
1445 ITextSelection_fnInStory
,
1446 ITextSelection_fnIsEqual
,
1447 ITextSelection_fnSelect
,
1448 ITextSelection_fnStartOf
,
1449 ITextSelection_fnEndOf
,
1450 ITextSelection_fnMove
,
1451 ITextSelection_fnMoveStart
,
1452 ITextSelection_fnMoveEnd
,
1453 ITextSelection_fnMoveWhile
,
1454 ITextSelection_fnMoveStartWhile
,
1455 ITextSelection_fnMoveEndWhile
,
1456 ITextSelection_fnMoveUntil
,
1457 ITextSelection_fnMoveStartUntil
,
1458 ITextSelection_fnMoveEndUntil
,
1459 ITextSelection_fnFindText
,
1460 ITextSelection_fnFindTextStart
,
1461 ITextSelection_fnFindTextEnd
,
1462 ITextSelection_fnDelete
,
1463 ITextSelection_fnCut
,
1464 ITextSelection_fnCopy
,
1465 ITextSelection_fnPaste
,
1466 ITextSelection_fnCanPaste
,
1467 ITextSelection_fnCanEdit
,
1468 ITextSelection_fnChangeCase
,
1469 ITextSelection_fnGetPoint
,
1470 ITextSelection_fnSetPoint
,
1471 ITextSelection_fnScrollIntoView
,
1472 ITextSelection_fnGetEmbeddedObject
,
1473 ITextSelection_fnGetFlags
,
1474 ITextSelection_fnSetFlags
,
1475 ITextSelection_fnGetType
,
1476 ITextSelection_fnMoveLeft
,
1477 ITextSelection_fnMoveRight
,
1478 ITextSelection_fnMoveUp
,
1479 ITextSelection_fnMoveDown
,
1480 ITextSelection_fnHomeKey
,
1481 ITextSelection_fnEndKey
,
1482 ITextSelection_fnTypeText
1485 static ITextSelectionImpl
*
1486 CreateTextSelection(IRichEditOleImpl
*reOle
)
1488 ITextSelectionImpl
*txtSel
= heap_alloc(sizeof *txtSel
);
1492 txtSel
->ITextSelection_iface
.lpVtbl
= &tsvt
;
1494 txtSel
->reOle
= reOle
;
1498 LRESULT
CreateIRichEditOle(ME_TextEditor
*editor
, LPVOID
*ppObj
)
1500 IRichEditOleImpl
*reo
;
1502 reo
= heap_alloc(sizeof(IRichEditOleImpl
));
1506 reo
->IRichEditOle_iface
.lpVtbl
= &revt
;
1507 reo
->ITextDocument_iface
.lpVtbl
= &tdvt
;
1509 reo
->editor
= editor
;
1510 reo
->txtSel
= CreateTextSelection(reo
);
1516 reo
->clientSite
= CreateOleClientSite(reo
);
1519 ITextSelection_Release(&reo
->txtSel
->ITextSelection_iface
);
1523 TRACE("Created %p\n",reo
);
1529 static void convert_sizel(const ME_Context
*c
, const SIZEL
* szl
, SIZE
* sz
)
1531 /* sizel is in .01 millimeters, sz in pixels */
1532 sz
->cx
= MulDiv(szl
->cx
, c
->dpi
.cx
, 2540);
1533 sz
->cy
= MulDiv(szl
->cy
, c
->dpi
.cy
, 2540);
1536 /******************************************************************************
1537 * ME_GetOLEObjectSize
1539 * Sets run extent for OLE objects.
1541 void ME_GetOLEObjectSize(const ME_Context
*c
, ME_Run
*run
, SIZE
*pSize
)
1549 assert(run
->nFlags
& MERF_GRAPHICS
);
1550 assert(run
->ole_obj
);
1552 if (run
->ole_obj
->sizel
.cx
!= 0 || run
->ole_obj
->sizel
.cy
!= 0)
1554 convert_sizel(c
, &run
->ole_obj
->sizel
, pSize
);
1555 if (c
->editor
->nZoomNumerator
!= 0)
1557 pSize
->cx
= MulDiv(pSize
->cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1558 pSize
->cy
= MulDiv(pSize
->cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1563 IOleObject_QueryInterface(run
->ole_obj
->poleobj
, &IID_IDataObject
, (void**)&ido
);
1564 fmt
.cfFormat
= CF_BITMAP
;
1566 fmt
.dwAspect
= DVASPECT_CONTENT
;
1568 fmt
.tymed
= TYMED_GDI
;
1569 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
1571 fmt
.cfFormat
= CF_ENHMETAFILE
;
1572 fmt
.tymed
= TYMED_ENHMF
;
1573 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
1575 FIXME("unsupported format\n");
1576 pSize
->cx
= pSize
->cy
= 0;
1577 IDataObject_Release(ido
);
1585 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
1586 pSize
->cx
= dibsect
.dsBm
.bmWidth
;
1587 pSize
->cy
= dibsect
.dsBm
.bmHeight
;
1588 if (!stgm
.pUnkForRelease
) DeleteObject(stgm
.u
.hBitmap
);
1591 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
1592 pSize
->cx
= emh
.rclBounds
.right
- emh
.rclBounds
.left
;
1593 pSize
->cy
= emh
.rclBounds
.bottom
- emh
.rclBounds
.top
;
1594 if (!stgm
.pUnkForRelease
) DeleteEnhMetaFile(stgm
.u
.hEnhMetaFile
);
1597 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
1600 IDataObject_Release(ido
);
1601 if (c
->editor
->nZoomNumerator
!= 0)
1603 pSize
->cx
= MulDiv(pSize
->cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1604 pSize
->cy
= MulDiv(pSize
->cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1608 void ME_DrawOLE(ME_Context
*c
, int x
, int y
, ME_Run
*run
,
1609 ME_Paragraph
*para
, BOOL selected
)
1620 assert(run
->nFlags
& MERF_GRAPHICS
);
1621 assert(run
->ole_obj
);
1622 if (IOleObject_QueryInterface(run
->ole_obj
->poleobj
, &IID_IDataObject
, (void**)&ido
) != S_OK
)
1624 FIXME("Couldn't get interface\n");
1627 has_size
= run
->ole_obj
->sizel
.cx
!= 0 || run
->ole_obj
->sizel
.cy
!= 0;
1628 fmt
.cfFormat
= CF_BITMAP
;
1630 fmt
.dwAspect
= DVASPECT_CONTENT
;
1632 fmt
.tymed
= TYMED_GDI
;
1633 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
1635 fmt
.cfFormat
= CF_ENHMETAFILE
;
1636 fmt
.tymed
= TYMED_ENHMF
;
1637 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
1639 FIXME("Couldn't get storage medium\n");
1640 IDataObject_Release(ido
);
1647 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
1648 hMemDC
= CreateCompatibleDC(c
->hDC
);
1649 SelectObject(hMemDC
, stgm
.u
.hBitmap
);
1652 convert_sizel(c
, &run
->ole_obj
->sizel
, &sz
);
1654 sz
.cx
= MulDiv(dibsect
.dsBm
.bmWidth
, c
->dpi
.cx
, 96);
1655 sz
.cy
= MulDiv(dibsect
.dsBm
.bmHeight
, c
->dpi
.cy
, 96);
1657 if (c
->editor
->nZoomNumerator
!= 0)
1659 sz
.cx
= MulDiv(sz
.cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1660 sz
.cy
= MulDiv(sz
.cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1662 if (sz
.cx
== dibsect
.dsBm
.bmWidth
&& sz
.cy
== dibsect
.dsBm
.bmHeight
)
1664 BitBlt(c
->hDC
, x
, y
- sz
.cy
,
1665 dibsect
.dsBm
.bmWidth
, dibsect
.dsBm
.bmHeight
,
1666 hMemDC
, 0, 0, SRCCOPY
);
1668 StretchBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
,
1669 hMemDC
, 0, 0, dibsect
.dsBm
.bmWidth
,
1670 dibsect
.dsBm
.bmHeight
, SRCCOPY
);
1673 if (!stgm
.pUnkForRelease
) DeleteObject(stgm
.u
.hBitmap
);
1676 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
1679 convert_sizel(c
, &run
->ole_obj
->sizel
, &sz
);
1681 sz
.cy
= MulDiv(emh
.rclBounds
.bottom
- emh
.rclBounds
.top
, c
->dpi
.cx
, 96);
1682 sz
.cx
= MulDiv(emh
.rclBounds
.right
- emh
.rclBounds
.left
, c
->dpi
.cy
, 96);
1684 if (c
->editor
->nZoomNumerator
!= 0)
1686 sz
.cx
= MulDiv(sz
.cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1687 sz
.cy
= MulDiv(sz
.cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1695 rc
.right
= x
+ sz
.cx
;
1697 PlayEnhMetaFile(c
->hDC
, stgm
.u
.hEnhMetaFile
, &rc
);
1699 if (!stgm
.pUnkForRelease
) DeleteEnhMetaFile(stgm
.u
.hEnhMetaFile
);
1702 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
1706 if (selected
&& !c
->editor
->bHideSelection
)
1707 PatBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
, DSTINVERT
);
1708 IDataObject_Release(ido
);
1711 void ME_DeleteReObject(REOBJECT
* reo
)
1713 if (reo
->poleobj
) IOleObject_Release(reo
->poleobj
);
1714 if (reo
->pstg
) IStorage_Release(reo
->pstg
);
1715 if (reo
->polesite
) IOleClientSite_Release(reo
->polesite
);
1719 void ME_CopyReObject(REOBJECT
* dst
, const REOBJECT
* src
)
1723 if (dst
->poleobj
) IOleObject_AddRef(dst
->poleobj
);
1724 if (dst
->pstg
) IStorage_AddRef(dst
->pstg
);
1725 if (dst
->polesite
) IOleClientSite_AddRef(dst
->polesite
);