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_AddRef(*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_QueryInterface(&This
->IRichEditOle_iface
, riid
, ppvObject
);
455 ITextDocument_fnAddRef(ITextDocument
* me
)
457 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
458 return IRichEditOle_AddRef(&This
->IRichEditOle_iface
);
462 ITextDocument_fnRelease(ITextDocument
* me
)
464 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
465 return IRichEditOle_Release(&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
);
521 *ppSel
= &This
->txtSel
->ITextSelection_iface
;
522 ITextSelection_AddRef(*ppSel
);
526 static HRESULT WINAPI
527 ITextDocument_fnGetStoryCount(ITextDocument
* me
, LONG
* pCount
)
529 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
530 FIXME("stub %p\n",This
);
534 static HRESULT WINAPI
535 ITextDocument_fnGetStoryRanges(ITextDocument
* me
,
536 ITextStoryRanges
** ppStories
)
538 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
539 FIXME("stub %p\n",This
);
543 static HRESULT WINAPI
544 ITextDocument_fnGetSaved(ITextDocument
* me
, LONG
* pValue
)
546 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
547 FIXME("stub %p\n",This
);
551 static HRESULT WINAPI
552 ITextDocument_fnSetSaved(ITextDocument
* me
, LONG Value
)
554 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
555 FIXME("stub %p\n",This
);
559 static HRESULT WINAPI
560 ITextDocument_fnGetDefaultTabStop(ITextDocument
* me
, float* pValue
)
562 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
563 FIXME("stub %p\n",This
);
567 static HRESULT WINAPI
568 ITextDocument_fnSetDefaultTabStop(ITextDocument
* me
, float Value
)
570 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
571 FIXME("stub %p\n",This
);
575 static HRESULT WINAPI
576 ITextDocument_fnNew(ITextDocument
* me
)
578 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
579 FIXME("stub %p\n",This
);
583 static HRESULT WINAPI
584 ITextDocument_fnOpen(ITextDocument
* me
, VARIANT
* pVar
, LONG Flags
,
587 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
588 FIXME("stub %p\n",This
);
592 static HRESULT WINAPI
593 ITextDocument_fnSave(ITextDocument
* me
, VARIANT
* pVar
, LONG Flags
,
596 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
597 FIXME("stub %p\n",This
);
601 static HRESULT WINAPI
602 ITextDocument_fnFreeze(ITextDocument
* me
, LONG
* pCount
)
604 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
605 FIXME("stub %p\n",This
);
609 static HRESULT WINAPI
610 ITextDocument_fnUnfreeze(ITextDocument
* me
, LONG
* pCount
)
612 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
613 FIXME("stub %p\n",This
);
617 static HRESULT WINAPI
618 ITextDocument_fnBeginEditCollection(ITextDocument
* me
)
620 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
621 FIXME("stub %p\n",This
);
625 static HRESULT WINAPI
626 ITextDocument_fnEndEditCollection(ITextDocument
* me
)
628 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
629 FIXME("stub %p\n",This
);
633 static HRESULT WINAPI
634 ITextDocument_fnUndo(ITextDocument
* me
, LONG Count
, LONG
* prop
)
636 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
637 FIXME("stub %p\n",This
);
641 static HRESULT WINAPI
642 ITextDocument_fnRedo(ITextDocument
* me
, LONG Count
, LONG
* prop
)
644 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
645 FIXME("stub %p\n",This
);
649 static HRESULT WINAPI
650 ITextDocument_fnRange(ITextDocument
* me
, LONG cp1
, LONG cp2
,
651 ITextRange
** ppRange
)
653 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
654 FIXME("stub %p\n",This
);
658 static HRESULT WINAPI
659 ITextDocument_fnRangeFromPoint(ITextDocument
* me
, LONG x
, LONG y
,
660 ITextRange
** ppRange
)
662 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
663 FIXME("stub %p\n",This
);
667 static const ITextDocumentVtbl tdvt
= {
668 ITextDocument_fnQueryInterface
,
669 ITextDocument_fnAddRef
,
670 ITextDocument_fnRelease
,
671 ITextDocument_fnGetTypeInfoCount
,
672 ITextDocument_fnGetTypeInfo
,
673 ITextDocument_fnGetIDsOfNames
,
674 ITextDocument_fnInvoke
,
675 ITextDocument_fnGetName
,
676 ITextDocument_fnGetSelection
,
677 ITextDocument_fnGetStoryCount
,
678 ITextDocument_fnGetStoryRanges
,
679 ITextDocument_fnGetSaved
,
680 ITextDocument_fnSetSaved
,
681 ITextDocument_fnGetDefaultTabStop
,
682 ITextDocument_fnSetDefaultTabStop
,
684 ITextDocument_fnOpen
,
685 ITextDocument_fnSave
,
686 ITextDocument_fnFreeze
,
687 ITextDocument_fnUnfreeze
,
688 ITextDocument_fnBeginEditCollection
,
689 ITextDocument_fnEndEditCollection
,
690 ITextDocument_fnUndo
,
691 ITextDocument_fnRedo
,
692 ITextDocument_fnRange
,
693 ITextDocument_fnRangeFromPoint
696 static inline ITextSelectionImpl
*impl_from_ITextSelection(ITextSelection
*iface
)
698 return CONTAINING_RECORD(iface
, ITextSelectionImpl
, ITextSelection_iface
);
701 static HRESULT WINAPI
ITextSelection_fnQueryInterface(
707 if (IsEqualGUID(riid
, &IID_IUnknown
)
708 || IsEqualGUID(riid
, &IID_IDispatch
)
709 || IsEqualGUID(riid
, &IID_ITextRange
)
710 || IsEqualGUID(riid
, &IID_ITextSelection
))
713 ITextSelection_AddRef(me
);
717 return E_NOINTERFACE
;
720 static ULONG WINAPI
ITextSelection_fnAddRef(ITextSelection
*me
)
722 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
723 return InterlockedIncrement(&This
->ref
);
726 static ULONG WINAPI
ITextSelection_fnRelease(ITextSelection
*me
)
728 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
729 ULONG ref
= InterlockedDecrement(&This
->ref
);
735 static HRESULT WINAPI
ITextSelection_fnGetTypeInfoCount(ITextSelection
*me
, UINT
*pctinfo
)
737 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
739 return CO_E_RELEASED
;
741 FIXME("not implemented\n");
745 static HRESULT WINAPI
ITextSelection_fnGetTypeInfo(ITextSelection
*me
, UINT iTInfo
, LCID lcid
,
748 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
750 return CO_E_RELEASED
;
752 FIXME("not implemented\n");
756 static HRESULT WINAPI
ITextSelection_fnGetIDsOfNames(ITextSelection
*me
, REFIID riid
,
757 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
759 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
761 return CO_E_RELEASED
;
763 FIXME("not implemented\n");
767 static HRESULT WINAPI
ITextSelection_fnInvoke(
773 DISPPARAMS
*pDispParams
,
775 EXCEPINFO
*pExcepInfo
,
778 FIXME("not implemented\n");
782 /*** ITextRange methods ***/
783 static HRESULT WINAPI
ITextSelection_fnGetText(ITextSelection
*me
, BSTR
*pbstr
)
785 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
787 return CO_E_RELEASED
;
789 FIXME("not implemented\n");
793 static HRESULT WINAPI
ITextSelection_fnSetText(ITextSelection
*me
, BSTR bstr
)
795 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
797 return CO_E_RELEASED
;
799 FIXME("not implemented\n");
803 static HRESULT WINAPI
ITextSelection_fnGetChar(ITextSelection
*me
, LONG
*pch
)
805 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
807 return CO_E_RELEASED
;
809 FIXME("not implemented\n");
813 static HRESULT WINAPI
ITextSelection_fnSetChar(ITextSelection
*me
, LONG ch
)
815 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
817 return CO_E_RELEASED
;
819 FIXME("not implemented\n");
823 static HRESULT WINAPI
ITextSelection_fnGetDuplicate(ITextSelection
*me
, ITextRange
**ppRange
)
825 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
827 return CO_E_RELEASED
;
829 FIXME("not implemented\n");
833 static HRESULT WINAPI
ITextSelection_fnGetFormattedText(ITextSelection
*me
, ITextRange
**ppRange
)
835 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
837 return CO_E_RELEASED
;
839 FIXME("not implemented\n");
843 static HRESULT WINAPI
ITextSelection_fnSetFormattedText(ITextSelection
*me
, ITextRange
*pRange
)
845 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
847 return CO_E_RELEASED
;
849 FIXME("not implemented\n");
853 static HRESULT WINAPI
ITextSelection_fnGetStart(ITextSelection
*me
, LONG
*pcpFirst
)
855 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
857 return CO_E_RELEASED
;
859 FIXME("not implemented\n");
863 static HRESULT WINAPI
ITextSelection_fnSetStart(ITextSelection
*me
, LONG cpFirst
)
865 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
867 return CO_E_RELEASED
;
869 FIXME("not implemented\n");
873 static HRESULT WINAPI
ITextSelection_fnGetEnd(ITextSelection
*me
, LONG
*pcpLim
)
875 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
877 return CO_E_RELEASED
;
879 FIXME("not implemented\n");
883 static HRESULT WINAPI
ITextSelection_fnSetEnd(ITextSelection
*me
, LONG cpLim
)
885 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
887 return CO_E_RELEASED
;
889 FIXME("not implemented\n");
893 static HRESULT WINAPI
ITextSelection_fnGetFont(ITextSelection
*me
, ITextFont
**pFont
)
895 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
897 return CO_E_RELEASED
;
899 FIXME("not implemented\n");
903 static HRESULT WINAPI
ITextSelection_fnSetFont(ITextSelection
*me
, ITextFont
*pFont
)
905 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
907 return CO_E_RELEASED
;
909 FIXME("not implemented\n");
913 static HRESULT WINAPI
ITextSelection_fnGetPara(ITextSelection
*me
, ITextPara
**ppPara
)
915 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
917 return CO_E_RELEASED
;
919 FIXME("not implemented\n");
923 static HRESULT WINAPI
ITextSelection_fnSetPara(ITextSelection
*me
, ITextPara
*pPara
)
925 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
927 return CO_E_RELEASED
;
929 FIXME("not implemented\n");
933 static HRESULT WINAPI
ITextSelection_fnGetStoryLength(ITextSelection
*me
, LONG
*pcch
)
935 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
937 return CO_E_RELEASED
;
939 FIXME("not implemented\n");
943 static HRESULT WINAPI
ITextSelection_fnGetStoryType(ITextSelection
*me
, LONG
*pValue
)
945 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
947 return CO_E_RELEASED
;
949 FIXME("not implemented\n");
953 static HRESULT WINAPI
ITextSelection_fnCollapse(ITextSelection
*me
, LONG bStart
)
955 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
957 return CO_E_RELEASED
;
959 FIXME("not implemented\n");
963 static HRESULT WINAPI
ITextSelection_fnExpand(ITextSelection
*me
, LONG Unit
, LONG
*pDelta
)
965 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
967 return CO_E_RELEASED
;
969 FIXME("not implemented\n");
973 static HRESULT WINAPI
ITextSelection_fnGetIndex(ITextSelection
*me
, LONG Unit
, LONG
*pIndex
)
975 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
977 return CO_E_RELEASED
;
979 FIXME("not implemented\n");
983 static HRESULT WINAPI
ITextSelection_fnSetIndex(ITextSelection
*me
, LONG Unit
, LONG Index
,
986 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
988 return CO_E_RELEASED
;
990 FIXME("not implemented\n");
994 static HRESULT WINAPI
ITextSelection_fnSetRange(ITextSelection
*me
, LONG cpActive
, LONG cpOther
)
996 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
998 return CO_E_RELEASED
;
1000 FIXME("not implemented\n");
1004 static HRESULT WINAPI
ITextSelection_fnInRange(ITextSelection
*me
, ITextRange
*pRange
, LONG
*pb
)
1006 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1008 return CO_E_RELEASED
;
1010 FIXME("not implemented\n");
1014 static HRESULT WINAPI
ITextSelection_fnInStory(ITextSelection
*me
, ITextRange
*pRange
, LONG
*pb
)
1016 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1018 return CO_E_RELEASED
;
1020 FIXME("not implemented\n");
1024 static HRESULT WINAPI
ITextSelection_fnIsEqual(ITextSelection
*me
, ITextRange
*pRange
, LONG
*pb
)
1026 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1028 return CO_E_RELEASED
;
1030 FIXME("not implemented\n");
1034 static HRESULT WINAPI
ITextSelection_fnSelect(ITextSelection
*me
)
1036 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1038 return CO_E_RELEASED
;
1040 FIXME("not implemented\n");
1044 static HRESULT WINAPI
ITextSelection_fnStartOf(ITextSelection
*me
, LONG Unit
, LONG Extend
,
1047 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1049 return CO_E_RELEASED
;
1051 FIXME("not implemented\n");
1055 static HRESULT WINAPI
ITextSelection_fnEndOf(ITextSelection
*me
, LONG Unit
, LONG Extend
,
1058 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1060 return CO_E_RELEASED
;
1062 FIXME("not implemented\n");
1066 static HRESULT WINAPI
ITextSelection_fnMove(ITextSelection
*me
, LONG Unit
, LONG Count
, LONG
*pDelta
)
1068 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1070 return CO_E_RELEASED
;
1072 FIXME("not implemented\n");
1076 static HRESULT WINAPI
ITextSelection_fnMoveStart(ITextSelection
*me
, LONG Unit
, LONG Count
,
1079 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1081 return CO_E_RELEASED
;
1083 FIXME("not implemented\n");
1087 static HRESULT WINAPI
ITextSelection_fnMoveEnd(ITextSelection
*me
, LONG Unit
, LONG Count
,
1090 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1092 return CO_E_RELEASED
;
1094 FIXME("not implemented\n");
1098 static HRESULT WINAPI
ITextSelection_fnMoveWhile(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1101 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1103 return CO_E_RELEASED
;
1105 FIXME("not implemented\n");
1109 static HRESULT WINAPI
ITextSelection_fnMoveStartWhile(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1112 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1114 return CO_E_RELEASED
;
1116 FIXME("not implemented\n");
1120 static HRESULT WINAPI
ITextSelection_fnMoveEndWhile(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1123 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1125 return CO_E_RELEASED
;
1127 FIXME("not implemented\n");
1131 static HRESULT WINAPI
ITextSelection_fnMoveUntil(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1134 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1136 return CO_E_RELEASED
;
1138 FIXME("not implemented\n");
1142 static HRESULT WINAPI
ITextSelection_fnMoveStartUntil(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1145 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1147 return CO_E_RELEASED
;
1149 FIXME("not implemented\n");
1153 static HRESULT WINAPI
ITextSelection_fnMoveEndUntil(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1156 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1158 return CO_E_RELEASED
;
1160 FIXME("not implemented\n");
1164 static HRESULT WINAPI
ITextSelection_fnFindText(ITextSelection
*me
, BSTR bstr
, LONG cch
, LONG Flags
,
1167 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1169 return CO_E_RELEASED
;
1171 FIXME("not implemented\n");
1175 static HRESULT WINAPI
ITextSelection_fnFindTextStart(ITextSelection
*me
, BSTR bstr
, LONG cch
,
1176 LONG Flags
, LONG
*pLength
)
1178 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1180 return CO_E_RELEASED
;
1182 FIXME("not implemented\n");
1186 static HRESULT WINAPI
ITextSelection_fnFindTextEnd(ITextSelection
*me
, BSTR bstr
, LONG cch
,
1187 LONG Flags
, LONG
*pLength
)
1189 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1191 return CO_E_RELEASED
;
1193 FIXME("not implemented\n");
1197 static HRESULT WINAPI
ITextSelection_fnDelete(ITextSelection
*me
, LONG Unit
, LONG Count
,
1200 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1202 return CO_E_RELEASED
;
1204 FIXME("not implemented\n");
1208 static HRESULT WINAPI
ITextSelection_fnCut(ITextSelection
*me
, VARIANT
*pVar
)
1210 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1212 return CO_E_RELEASED
;
1214 FIXME("not implemented\n");
1218 static HRESULT WINAPI
ITextSelection_fnCopy(ITextSelection
*me
, VARIANT
*pVar
)
1220 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1222 return CO_E_RELEASED
;
1224 FIXME("not implemented\n");
1228 static HRESULT WINAPI
ITextSelection_fnPaste(ITextSelection
*me
, VARIANT
*pVar
, LONG Format
)
1230 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1232 return CO_E_RELEASED
;
1234 FIXME("not implemented\n");
1238 static HRESULT WINAPI
ITextSelection_fnCanPaste(ITextSelection
*me
, VARIANT
*pVar
, LONG Format
,
1241 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1243 return CO_E_RELEASED
;
1245 FIXME("not implemented\n");
1249 static HRESULT WINAPI
ITextSelection_fnCanEdit(ITextSelection
*me
, LONG
*pb
)
1251 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1253 return CO_E_RELEASED
;
1255 FIXME("not implemented\n");
1259 static HRESULT WINAPI
ITextSelection_fnChangeCase(ITextSelection
*me
, LONG Type
)
1261 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1263 return CO_E_RELEASED
;
1265 FIXME("not implemented\n");
1269 static HRESULT WINAPI
ITextSelection_fnGetPoint(ITextSelection
*me
, LONG Type
, LONG
*cx
, LONG
*cy
)
1271 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1273 return CO_E_RELEASED
;
1275 FIXME("not implemented\n");
1279 static HRESULT WINAPI
ITextSelection_fnSetPoint(ITextSelection
*me
, LONG x
, LONG y
, LONG Type
,
1282 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1284 return CO_E_RELEASED
;
1286 FIXME("not implemented\n");
1290 static HRESULT WINAPI
ITextSelection_fnScrollIntoView(ITextSelection
*me
, LONG Value
)
1292 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1294 return CO_E_RELEASED
;
1296 FIXME("not implemented\n");
1300 static HRESULT WINAPI
ITextSelection_fnGetEmbeddedObject(ITextSelection
*me
, IUnknown
**ppv
)
1302 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1304 return CO_E_RELEASED
;
1306 FIXME("not implemented\n");
1310 /*** ITextSelection methods ***/
1311 static HRESULT WINAPI
ITextSelection_fnGetFlags(ITextSelection
*me
, LONG
*pFlags
)
1313 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1315 return CO_E_RELEASED
;
1317 FIXME("not implemented\n");
1321 static HRESULT WINAPI
ITextSelection_fnSetFlags(ITextSelection
*me
, LONG Flags
)
1323 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1325 return CO_E_RELEASED
;
1327 FIXME("not implemented\n");
1331 static HRESULT WINAPI
ITextSelection_fnGetType(ITextSelection
*me
, LONG
*pType
)
1333 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1335 return CO_E_RELEASED
;
1337 FIXME("not implemented\n");
1341 static HRESULT WINAPI
ITextSelection_fnMoveLeft(ITextSelection
*me
, LONG Unit
, LONG Count
,
1342 LONG Extend
, LONG
*pDelta
)
1344 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1346 return CO_E_RELEASED
;
1348 FIXME("not implemented\n");
1352 static HRESULT WINAPI
ITextSelection_fnMoveRight(ITextSelection
*me
, LONG Unit
, LONG Count
,
1353 LONG Extend
, LONG
*pDelta
)
1355 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1357 return CO_E_RELEASED
;
1359 FIXME("not implemented\n");
1363 static HRESULT WINAPI
ITextSelection_fnMoveUp(ITextSelection
*me
, LONG Unit
, LONG Count
,
1364 LONG Extend
, LONG
*pDelta
)
1366 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1368 return CO_E_RELEASED
;
1370 FIXME("not implemented\n");
1374 static HRESULT WINAPI
ITextSelection_fnMoveDown(ITextSelection
*me
, LONG Unit
, LONG Count
,
1375 LONG Extend
, LONG
*pDelta
)
1377 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1379 return CO_E_RELEASED
;
1381 FIXME("not implemented\n");
1385 static HRESULT WINAPI
ITextSelection_fnHomeKey(ITextSelection
*me
, LONG Unit
, LONG Extend
,
1388 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1390 return CO_E_RELEASED
;
1392 FIXME("not implemented\n");
1396 static HRESULT WINAPI
ITextSelection_fnEndKey(ITextSelection
*me
, LONG Unit
, LONG Extend
,
1399 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1401 return CO_E_RELEASED
;
1403 FIXME("not implemented\n");
1407 static HRESULT WINAPI
ITextSelection_fnTypeText(ITextSelection
*me
, BSTR bstr
)
1409 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1411 return CO_E_RELEASED
;
1413 FIXME("not implemented\n");
1417 static const ITextSelectionVtbl tsvt
= {
1418 ITextSelection_fnQueryInterface
,
1419 ITextSelection_fnAddRef
,
1420 ITextSelection_fnRelease
,
1421 ITextSelection_fnGetTypeInfoCount
,
1422 ITextSelection_fnGetTypeInfo
,
1423 ITextSelection_fnGetIDsOfNames
,
1424 ITextSelection_fnInvoke
,
1425 ITextSelection_fnGetText
,
1426 ITextSelection_fnSetText
,
1427 ITextSelection_fnGetChar
,
1428 ITextSelection_fnSetChar
,
1429 ITextSelection_fnGetDuplicate
,
1430 ITextSelection_fnGetFormattedText
,
1431 ITextSelection_fnSetFormattedText
,
1432 ITextSelection_fnGetStart
,
1433 ITextSelection_fnSetStart
,
1434 ITextSelection_fnGetEnd
,
1435 ITextSelection_fnSetEnd
,
1436 ITextSelection_fnGetFont
,
1437 ITextSelection_fnSetFont
,
1438 ITextSelection_fnGetPara
,
1439 ITextSelection_fnSetPara
,
1440 ITextSelection_fnGetStoryLength
,
1441 ITextSelection_fnGetStoryType
,
1442 ITextSelection_fnCollapse
,
1443 ITextSelection_fnExpand
,
1444 ITextSelection_fnGetIndex
,
1445 ITextSelection_fnSetIndex
,
1446 ITextSelection_fnSetRange
,
1447 ITextSelection_fnInRange
,
1448 ITextSelection_fnInStory
,
1449 ITextSelection_fnIsEqual
,
1450 ITextSelection_fnSelect
,
1451 ITextSelection_fnStartOf
,
1452 ITextSelection_fnEndOf
,
1453 ITextSelection_fnMove
,
1454 ITextSelection_fnMoveStart
,
1455 ITextSelection_fnMoveEnd
,
1456 ITextSelection_fnMoveWhile
,
1457 ITextSelection_fnMoveStartWhile
,
1458 ITextSelection_fnMoveEndWhile
,
1459 ITextSelection_fnMoveUntil
,
1460 ITextSelection_fnMoveStartUntil
,
1461 ITextSelection_fnMoveEndUntil
,
1462 ITextSelection_fnFindText
,
1463 ITextSelection_fnFindTextStart
,
1464 ITextSelection_fnFindTextEnd
,
1465 ITextSelection_fnDelete
,
1466 ITextSelection_fnCut
,
1467 ITextSelection_fnCopy
,
1468 ITextSelection_fnPaste
,
1469 ITextSelection_fnCanPaste
,
1470 ITextSelection_fnCanEdit
,
1471 ITextSelection_fnChangeCase
,
1472 ITextSelection_fnGetPoint
,
1473 ITextSelection_fnSetPoint
,
1474 ITextSelection_fnScrollIntoView
,
1475 ITextSelection_fnGetEmbeddedObject
,
1476 ITextSelection_fnGetFlags
,
1477 ITextSelection_fnSetFlags
,
1478 ITextSelection_fnGetType
,
1479 ITextSelection_fnMoveLeft
,
1480 ITextSelection_fnMoveRight
,
1481 ITextSelection_fnMoveUp
,
1482 ITextSelection_fnMoveDown
,
1483 ITextSelection_fnHomeKey
,
1484 ITextSelection_fnEndKey
,
1485 ITextSelection_fnTypeText
1488 static ITextSelectionImpl
*
1489 CreateTextSelection(IRichEditOleImpl
*reOle
)
1491 ITextSelectionImpl
*txtSel
= heap_alloc(sizeof *txtSel
);
1495 txtSel
->ITextSelection_iface
.lpVtbl
= &tsvt
;
1497 txtSel
->reOle
= reOle
;
1501 LRESULT
CreateIRichEditOle(ME_TextEditor
*editor
, LPVOID
*ppObj
)
1503 IRichEditOleImpl
*reo
;
1505 reo
= heap_alloc(sizeof(IRichEditOleImpl
));
1509 reo
->IRichEditOle_iface
.lpVtbl
= &revt
;
1510 reo
->ITextDocument_iface
.lpVtbl
= &tdvt
;
1512 reo
->editor
= editor
;
1513 reo
->txtSel
= CreateTextSelection(reo
);
1519 reo
->clientSite
= CreateOleClientSite(reo
);
1520 if (!reo
->clientSite
)
1522 ITextSelection_Release(&reo
->txtSel
->ITextSelection_iface
);
1526 TRACE("Created %p\n",reo
);
1532 static void convert_sizel(const ME_Context
*c
, const SIZEL
* szl
, SIZE
* sz
)
1534 /* sizel is in .01 millimeters, sz in pixels */
1535 sz
->cx
= MulDiv(szl
->cx
, c
->dpi
.cx
, 2540);
1536 sz
->cy
= MulDiv(szl
->cy
, c
->dpi
.cy
, 2540);
1539 /******************************************************************************
1540 * ME_GetOLEObjectSize
1542 * Sets run extent for OLE objects.
1544 void ME_GetOLEObjectSize(const ME_Context
*c
, ME_Run
*run
, SIZE
*pSize
)
1552 assert(run
->nFlags
& MERF_GRAPHICS
);
1553 assert(run
->ole_obj
);
1555 if (run
->ole_obj
->sizel
.cx
!= 0 || run
->ole_obj
->sizel
.cy
!= 0)
1557 convert_sizel(c
, &run
->ole_obj
->sizel
, pSize
);
1558 if (c
->editor
->nZoomNumerator
!= 0)
1560 pSize
->cx
= MulDiv(pSize
->cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1561 pSize
->cy
= MulDiv(pSize
->cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1566 IOleObject_QueryInterface(run
->ole_obj
->poleobj
, &IID_IDataObject
, (void**)&ido
);
1567 fmt
.cfFormat
= CF_BITMAP
;
1569 fmt
.dwAspect
= DVASPECT_CONTENT
;
1571 fmt
.tymed
= TYMED_GDI
;
1572 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
1574 fmt
.cfFormat
= CF_ENHMETAFILE
;
1575 fmt
.tymed
= TYMED_ENHMF
;
1576 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
1578 FIXME("unsupported format\n");
1579 pSize
->cx
= pSize
->cy
= 0;
1580 IDataObject_Release(ido
);
1588 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
1589 pSize
->cx
= dibsect
.dsBm
.bmWidth
;
1590 pSize
->cy
= dibsect
.dsBm
.bmHeight
;
1591 if (!stgm
.pUnkForRelease
) DeleteObject(stgm
.u
.hBitmap
);
1594 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
1595 pSize
->cx
= emh
.rclBounds
.right
- emh
.rclBounds
.left
;
1596 pSize
->cy
= emh
.rclBounds
.bottom
- emh
.rclBounds
.top
;
1597 if (!stgm
.pUnkForRelease
) DeleteEnhMetaFile(stgm
.u
.hEnhMetaFile
);
1600 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
1603 IDataObject_Release(ido
);
1604 if (c
->editor
->nZoomNumerator
!= 0)
1606 pSize
->cx
= MulDiv(pSize
->cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1607 pSize
->cy
= MulDiv(pSize
->cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1611 void ME_DrawOLE(ME_Context
*c
, int x
, int y
, ME_Run
*run
,
1612 ME_Paragraph
*para
, BOOL selected
)
1623 assert(run
->nFlags
& MERF_GRAPHICS
);
1624 assert(run
->ole_obj
);
1625 if (IOleObject_QueryInterface(run
->ole_obj
->poleobj
, &IID_IDataObject
, (void**)&ido
) != S_OK
)
1627 FIXME("Couldn't get interface\n");
1630 has_size
= run
->ole_obj
->sizel
.cx
!= 0 || run
->ole_obj
->sizel
.cy
!= 0;
1631 fmt
.cfFormat
= CF_BITMAP
;
1633 fmt
.dwAspect
= DVASPECT_CONTENT
;
1635 fmt
.tymed
= TYMED_GDI
;
1636 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
1638 fmt
.cfFormat
= CF_ENHMETAFILE
;
1639 fmt
.tymed
= TYMED_ENHMF
;
1640 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
1642 FIXME("Couldn't get storage medium\n");
1643 IDataObject_Release(ido
);
1650 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
1651 hMemDC
= CreateCompatibleDC(c
->hDC
);
1652 SelectObject(hMemDC
, stgm
.u
.hBitmap
);
1655 convert_sizel(c
, &run
->ole_obj
->sizel
, &sz
);
1657 sz
.cx
= MulDiv(dibsect
.dsBm
.bmWidth
, c
->dpi
.cx
, 96);
1658 sz
.cy
= MulDiv(dibsect
.dsBm
.bmHeight
, c
->dpi
.cy
, 96);
1660 if (c
->editor
->nZoomNumerator
!= 0)
1662 sz
.cx
= MulDiv(sz
.cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1663 sz
.cy
= MulDiv(sz
.cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1665 if (sz
.cx
== dibsect
.dsBm
.bmWidth
&& sz
.cy
== dibsect
.dsBm
.bmHeight
)
1667 BitBlt(c
->hDC
, x
, y
- sz
.cy
,
1668 dibsect
.dsBm
.bmWidth
, dibsect
.dsBm
.bmHeight
,
1669 hMemDC
, 0, 0, SRCCOPY
);
1671 StretchBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
,
1672 hMemDC
, 0, 0, dibsect
.dsBm
.bmWidth
,
1673 dibsect
.dsBm
.bmHeight
, SRCCOPY
);
1676 if (!stgm
.pUnkForRelease
) DeleteObject(stgm
.u
.hBitmap
);
1679 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
1682 convert_sizel(c
, &run
->ole_obj
->sizel
, &sz
);
1684 sz
.cy
= MulDiv(emh
.rclBounds
.bottom
- emh
.rclBounds
.top
, c
->dpi
.cx
, 96);
1685 sz
.cx
= MulDiv(emh
.rclBounds
.right
- emh
.rclBounds
.left
, c
->dpi
.cy
, 96);
1687 if (c
->editor
->nZoomNumerator
!= 0)
1689 sz
.cx
= MulDiv(sz
.cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1690 sz
.cy
= MulDiv(sz
.cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1698 rc
.right
= x
+ sz
.cx
;
1700 PlayEnhMetaFile(c
->hDC
, stgm
.u
.hEnhMetaFile
, &rc
);
1702 if (!stgm
.pUnkForRelease
) DeleteEnhMetaFile(stgm
.u
.hEnhMetaFile
);
1705 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
1709 if (selected
&& !c
->editor
->bHideSelection
)
1710 PatBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
, DSTINVERT
);
1711 IDataObject_Release(ido
);
1714 void ME_DeleteReObject(REOBJECT
* reo
)
1716 if (reo
->poleobj
) IOleObject_Release(reo
->poleobj
);
1717 if (reo
->pstg
) IStorage_Release(reo
->pstg
);
1718 if (reo
->polesite
) IOleClientSite_Release(reo
->polesite
);
1722 void ME_CopyReObject(REOBJECT
* dst
, const REOBJECT
* src
)
1726 if (dst
->poleobj
) IOleObject_AddRef(dst
->poleobj
);
1727 if (dst
->pstg
) IStorage_AddRef(dst
->pstg
);
1728 if (dst
->polesite
) IOleClientSite_AddRef(dst
->polesite
);