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
;
52 typedef struct ITextRangeImpl ITextRangeImpl
;
54 typedef struct IRichEditOleImpl
{
55 IRichEditOle IRichEditOle_iface
;
56 ITextDocument ITextDocument_iface
;
59 ME_TextEditor
*editor
;
60 ITextSelectionImpl
*txtSel
;
61 IOleClientSiteImpl
*clientSite
;
62 struct list rangelist
;
65 struct ITextRangeImpl
{
66 ITextRange ITextRange_iface
;
71 IRichEditOleImpl
*reOle
;
74 struct ITextSelectionImpl
{
75 ITextSelection ITextSelection_iface
;
78 IRichEditOleImpl
*reOle
;
81 struct IOleClientSiteImpl
{
82 IOleClientSite IOleClientSite_iface
;
85 IRichEditOleImpl
*reOle
;
88 static inline IRichEditOleImpl
*impl_from_IRichEditOle(IRichEditOle
*iface
)
90 return CONTAINING_RECORD(iface
, IRichEditOleImpl
, IRichEditOle_iface
);
93 static inline IRichEditOleImpl
*impl_from_ITextDocument(ITextDocument
*iface
)
95 return CONTAINING_RECORD(iface
, IRichEditOleImpl
, ITextDocument_iface
);
99 IRichEditOle_fnQueryInterface(IRichEditOle
*me
, REFIID riid
, LPVOID
*ppvObj
)
101 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
103 TRACE("%p %s\n", This
, debugstr_guid(riid
) );
106 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
107 IsEqualGUID(riid
, &IID_IRichEditOle
))
108 *ppvObj
= &This
->IRichEditOle_iface
;
109 else if (IsEqualGUID(riid
, &IID_ITextDocument
))
110 *ppvObj
= &This
->ITextDocument_iface
;
113 IRichEditOle_AddRef(me
);
116 FIXME("%p: unhandled interface %s\n", This
, debugstr_guid(riid
) );
118 return E_NOINTERFACE
;
122 IRichEditOle_fnAddRef(IRichEditOle
*me
)
124 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
125 ULONG ref
= InterlockedIncrement( &This
->ref
);
127 TRACE("%p ref = %u\n", This
, ref
);
133 IRichEditOle_fnRelease(IRichEditOle
*me
)
135 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
136 ULONG ref
= InterlockedDecrement(&This
->ref
);
138 TRACE ("%p ref=%u\n", This
, ref
);
142 ITextRangeImpl
*txtRge
;
143 TRACE ("Destroying %p\n", This
);
144 This
->txtSel
->reOle
= NULL
;
145 ITextSelection_Release(&This
->txtSel
->ITextSelection_iface
);
146 IOleClientSite_Release(&This
->clientSite
->IOleClientSite_iface
);
147 LIST_FOR_EACH_ENTRY(txtRge
, &This
->rangelist
, ITextRangeImpl
, entry
)
148 txtRge
->reOle
= NULL
;
154 static HRESULT WINAPI
155 IRichEditOle_fnActivateAs(IRichEditOle
*me
, REFCLSID rclsid
, REFCLSID rclsidAs
)
157 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
158 FIXME("stub %p\n",This
);
162 static HRESULT WINAPI
163 IRichEditOle_fnContextSensitiveHelp(IRichEditOle
*me
, BOOL fEnterMode
)
165 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
166 FIXME("stub %p\n",This
);
170 static HRESULT WINAPI
171 IRichEditOle_fnConvertObject(IRichEditOle
*me
, LONG iob
,
172 REFCLSID rclsidNew
, LPCSTR lpstrUserTypeNew
)
174 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
175 FIXME("stub %p\n",This
);
179 static inline IOleClientSiteImpl
*impl_from_IOleClientSite(IOleClientSite
*iface
)
181 return CONTAINING_RECORD(iface
, IOleClientSiteImpl
, IOleClientSite_iface
);
184 static HRESULT WINAPI
185 IOleClientSite_fnQueryInterface(IOleClientSite
*me
, REFIID riid
, LPVOID
*ppvObj
)
187 TRACE("%p %s\n", me
, debugstr_guid(riid
) );
190 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
191 IsEqualGUID(riid
, &IID_IOleClientSite
))
195 IOleClientSite_AddRef(me
);
198 FIXME("%p: unhandled interface %s\n", me
, debugstr_guid(riid
) );
200 return E_NOINTERFACE
;
203 static ULONG WINAPI
IOleClientSite_fnAddRef(IOleClientSite
*iface
)
205 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
206 return InterlockedIncrement(&This
->ref
);
209 static ULONG WINAPI
IOleClientSite_fnRelease(IOleClientSite
*iface
)
211 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
212 ULONG ref
= InterlockedDecrement(&This
->ref
);
218 static HRESULT WINAPI
IOleClientSite_fnSaveObject(IOleClientSite
*iface
)
220 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
222 return CO_E_RELEASED
;
224 FIXME("stub %p\n", iface
);
229 static HRESULT WINAPI
IOleClientSite_fnGetMoniker(IOleClientSite
*iface
, DWORD dwAssign
,
230 DWORD dwWhichMoniker
, IMoniker
**ppmk
)
232 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
234 return CO_E_RELEASED
;
236 FIXME("stub %p\n", iface
);
240 static HRESULT WINAPI
IOleClientSite_fnGetContainer(IOleClientSite
*iface
,
241 IOleContainer
**ppContainer
)
243 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
245 return CO_E_RELEASED
;
247 FIXME("stub %p\n", iface
);
251 static HRESULT WINAPI
IOleClientSite_fnShowObject(IOleClientSite
*iface
)
253 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
255 return CO_E_RELEASED
;
257 FIXME("stub %p\n", iface
);
261 static HRESULT WINAPI
IOleClientSite_fnOnShowWindow(IOleClientSite
*iface
, BOOL fShow
)
263 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
265 return CO_E_RELEASED
;
267 FIXME("stub %p\n", iface
);
271 static HRESULT WINAPI
IOleClientSite_fnRequestNewObjectLayout(IOleClientSite
*iface
)
273 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
275 return CO_E_RELEASED
;
277 FIXME("stub %p\n", iface
);
281 static const IOleClientSiteVtbl ocst
= {
282 IOleClientSite_fnQueryInterface
,
283 IOleClientSite_fnAddRef
,
284 IOleClientSite_fnRelease
,
285 IOleClientSite_fnSaveObject
,
286 IOleClientSite_fnGetMoniker
,
287 IOleClientSite_fnGetContainer
,
288 IOleClientSite_fnShowObject
,
289 IOleClientSite_fnOnShowWindow
,
290 IOleClientSite_fnRequestNewObjectLayout
293 static IOleClientSiteImpl
*
294 CreateOleClientSite(IRichEditOleImpl
*reOle
)
296 IOleClientSiteImpl
*clientSite
= heap_alloc(sizeof *clientSite
);
300 clientSite
->IOleClientSite_iface
.lpVtbl
= &ocst
;
302 clientSite
->reOle
= reOle
;
306 static HRESULT WINAPI
307 IRichEditOle_fnGetClientSite(IRichEditOle
*me
,
308 LPOLECLIENTSITE
*lplpolesite
)
310 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
312 TRACE("%p,%p\n",This
, lplpolesite
);
316 *lplpolesite
= &This
->clientSite
->IOleClientSite_iface
;
317 IOleClientSite_AddRef(*lplpolesite
);
321 static HRESULT WINAPI
322 IRichEditOle_fnGetClipboardData(IRichEditOle
*me
, CHARRANGE
*lpchrg
,
323 DWORD reco
, LPDATAOBJECT
*lplpdataobj
)
325 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
329 TRACE("(%p,%p,%d)\n",This
, lpchrg
, reco
);
333 int nFrom
, nTo
, nStartCur
= ME_GetSelectionOfs(This
->editor
, &nFrom
, &nTo
);
334 start
= This
->editor
->pCursors
[nStartCur
];
335 nChars
= nTo
- nFrom
;
337 ME_CursorFromCharOfs(This
->editor
, lpchrg
->cpMin
, &start
);
338 nChars
= lpchrg
->cpMax
- lpchrg
->cpMin
;
340 return ME_GetDataObject(This
->editor
, &start
, nChars
, lplpdataobj
);
343 static LONG WINAPI
IRichEditOle_fnGetLinkCount(IRichEditOle
*me
)
345 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
346 FIXME("stub %p\n",This
);
350 static HRESULT WINAPI
351 IRichEditOle_fnGetObject(IRichEditOle
*me
, LONG iob
,
352 REOBJECT
*lpreobject
, DWORD dwFlags
)
354 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
355 FIXME("stub %p\n",This
);
360 IRichEditOle_fnGetObjectCount(IRichEditOle
*me
)
362 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
363 FIXME("stub %p\n",This
);
367 static HRESULT WINAPI
368 IRichEditOle_fnHandsOffStorage(IRichEditOle
*me
, LONG iob
)
370 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
371 FIXME("stub %p\n",This
);
375 static HRESULT WINAPI
376 IRichEditOle_fnImportDataObject(IRichEditOle
*me
, LPDATAOBJECT lpdataobj
,
377 CLIPFORMAT cf
, HGLOBAL hMetaPict
)
379 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
380 FIXME("stub %p\n",This
);
384 static HRESULT WINAPI
385 IRichEditOle_fnInPlaceDeactivate(IRichEditOle
*me
)
387 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
388 FIXME("stub %p\n",This
);
392 static HRESULT WINAPI
393 IRichEditOle_fnInsertObject(IRichEditOle
*me
, REOBJECT
*reo
)
395 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
396 TRACE("(%p,%p)\n", This
, reo
);
398 if (reo
->cbStruct
< sizeof(*reo
)) return STG_E_INVALIDPARAMETER
;
400 ME_InsertOLEFromCursor(This
->editor
, reo
, 0);
401 ME_CommitUndo(This
->editor
);
402 ME_UpdateRepaint(This
->editor
, FALSE
);
406 static HRESULT WINAPI
IRichEditOle_fnSaveCompleted(IRichEditOle
*me
, LONG iob
,
409 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
410 FIXME("stub %p\n",This
);
414 static HRESULT WINAPI
415 IRichEditOle_fnSetDvaspect(IRichEditOle
*me
, LONG iob
, DWORD dvaspect
)
417 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
418 FIXME("stub %p\n",This
);
422 static HRESULT WINAPI
IRichEditOle_fnSetHostNames(IRichEditOle
*me
,
423 LPCSTR lpstrContainerApp
, LPCSTR lpstrContainerObj
)
425 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
426 FIXME("stub %p %s %s\n",This
, lpstrContainerApp
, lpstrContainerObj
);
430 static HRESULT WINAPI
431 IRichEditOle_fnSetLinkAvailable(IRichEditOle
*me
, LONG iob
, BOOL fAvailable
)
433 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
434 FIXME("stub %p\n",This
);
438 static const IRichEditOleVtbl revt
= {
439 IRichEditOle_fnQueryInterface
,
440 IRichEditOle_fnAddRef
,
441 IRichEditOle_fnRelease
,
442 IRichEditOle_fnGetClientSite
,
443 IRichEditOle_fnGetObjectCount
,
444 IRichEditOle_fnGetLinkCount
,
445 IRichEditOle_fnGetObject
,
446 IRichEditOle_fnInsertObject
,
447 IRichEditOle_fnConvertObject
,
448 IRichEditOle_fnActivateAs
,
449 IRichEditOle_fnSetHostNames
,
450 IRichEditOle_fnSetLinkAvailable
,
451 IRichEditOle_fnSetDvaspect
,
452 IRichEditOle_fnHandsOffStorage
,
453 IRichEditOle_fnSaveCompleted
,
454 IRichEditOle_fnInPlaceDeactivate
,
455 IRichEditOle_fnContextSensitiveHelp
,
456 IRichEditOle_fnGetClipboardData
,
457 IRichEditOle_fnImportDataObject
460 /* ITextRange interface */
461 static inline ITextRangeImpl
*impl_from_ITextRange(ITextRange
*iface
)
463 return CONTAINING_RECORD(iface
, ITextRangeImpl
, ITextRange_iface
);
466 static HRESULT WINAPI
ITextRange_fnQueryInterface(ITextRange
*me
, REFIID riid
, void **ppvObj
)
469 if (IsEqualGUID(riid
, &IID_IUnknown
)
470 || IsEqualGUID(riid
, &IID_IDispatch
)
471 || IsEqualGUID(riid
, &IID_ITextRange
))
474 ITextRange_AddRef(me
);
478 return E_NOINTERFACE
;
481 static ULONG WINAPI
ITextRange_fnAddRef(ITextRange
*me
)
483 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
484 return InterlockedIncrement(&This
->ref
);
487 static ULONG WINAPI
ITextRange_fnRelease(ITextRange
*me
)
489 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
490 ULONG ref
= InterlockedDecrement(&This
->ref
);
492 TRACE ("%p ref=%u\n", This
, ref
);
497 list_remove(&This
->entry
);
505 static HRESULT WINAPI
ITextRange_fnGetTypeInfoCount(ITextRange
*me
, UINT
*pctinfo
)
507 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
509 return CO_E_RELEASED
;
511 FIXME("not implemented %p\n", This
);
515 static HRESULT WINAPI
ITextRange_fnGetTypeInfo(ITextRange
*me
, UINT iTInfo
, LCID lcid
,
518 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
520 return CO_E_RELEASED
;
522 FIXME("not implemented %p\n", This
);
526 static HRESULT WINAPI
ITextRange_fnGetIDsOfNames(ITextRange
*me
, REFIID riid
, LPOLESTR
*rgszNames
,
527 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
529 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
531 return CO_E_RELEASED
;
533 FIXME("not implemented %p\n", This
);
537 static HRESULT WINAPI
ITextRange_fnInvoke(ITextRange
*me
, DISPID dispIdMember
, REFIID riid
,
538 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
539 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
,
542 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
544 return CO_E_RELEASED
;
546 FIXME("not implemented %p\n", This
);
550 static HRESULT WINAPI
ITextRange_fnGetText(ITextRange
*me
, BSTR
*pbstr
)
552 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
554 return CO_E_RELEASED
;
556 FIXME("not implemented %p\n", This
);
560 static HRESULT WINAPI
ITextRange_fnSetText(ITextRange
*me
, BSTR bstr
)
562 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
564 return CO_E_RELEASED
;
566 FIXME("not implemented %p\n", This
);
570 static HRESULT
range_GetChar(ME_TextEditor
*editor
, ME_Cursor
*cursor
, LONG
*pch
)
574 ME_GetTextW(editor
, wch
, 1, cursor
, 1, FALSE
, cursor
->pRun
->next
->type
== diTextEnd
);
580 static HRESULT WINAPI
ITextRange_fnGetChar(ITextRange
*me
, LONG
*pch
)
582 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
586 return CO_E_RELEASED
;
591 ME_CursorFromCharOfs(This
->reOle
->editor
, This
->start
, &cursor
);
592 return range_GetChar(This
->reOle
->editor
, &cursor
, pch
);
595 static HRESULT WINAPI
ITextRange_fnSetChar(ITextRange
*me
, LONG ch
)
597 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
599 return CO_E_RELEASED
;
601 FIXME("not implemented %p\n", This
);
605 static HRESULT WINAPI
ITextRange_fnGetDuplicate(ITextRange
*me
, ITextRange
**ppRange
)
607 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
609 return CO_E_RELEASED
;
611 FIXME("not implemented %p\n", This
);
615 static HRESULT WINAPI
ITextRange_fnGetFormattedText(ITextRange
*me
, ITextRange
**ppRange
)
617 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
619 return CO_E_RELEASED
;
621 FIXME("not implemented %p\n", This
);
625 static HRESULT WINAPI
ITextRange_fnSetFormattedText(ITextRange
*me
, ITextRange
*pRange
)
627 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
629 return CO_E_RELEASED
;
631 FIXME("not implemented %p\n", This
);
635 static HRESULT WINAPI
ITextRange_fnGetStart(ITextRange
*me
, LONG
*pcpFirst
)
637 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
639 return CO_E_RELEASED
;
641 FIXME("not implemented %p\n", This
);
645 static HRESULT WINAPI
ITextRange_fnSetStart(ITextRange
*me
, LONG cpFirst
)
647 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
649 return CO_E_RELEASED
;
651 FIXME("not implemented %p\n", This
);
655 static HRESULT WINAPI
ITextRange_fnGetEnd(ITextRange
*me
, LONG
*pcpLim
)
657 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
659 return CO_E_RELEASED
;
661 FIXME("not implemented %p\n", This
);
665 static HRESULT WINAPI
ITextRange_fnSetEnd(ITextRange
*me
, LONG cpLim
)
667 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
669 return CO_E_RELEASED
;
671 FIXME("not implemented %p\n", This
);
675 static HRESULT WINAPI
ITextRange_fnGetFont(ITextRange
*me
, ITextFont
**pFont
)
677 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
679 return CO_E_RELEASED
;
681 FIXME("not implemented %p\n", This
);
685 static HRESULT WINAPI
ITextRange_fnSetFont(ITextRange
*me
, ITextFont
*pFont
)
687 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
689 return CO_E_RELEASED
;
691 FIXME("not implemented %p\n", This
);
695 static HRESULT WINAPI
ITextRange_fnGetPara(ITextRange
*me
, ITextPara
**ppPara
)
697 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
699 return CO_E_RELEASED
;
701 FIXME("not implemented %p\n", This
);
705 static HRESULT WINAPI
ITextRange_fnSetPara(ITextRange
*me
, ITextPara
*pPara
)
707 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
709 return CO_E_RELEASED
;
711 FIXME("not implemented %p\n", This
);
715 static HRESULT WINAPI
ITextRange_fnGetStoryLength(ITextRange
*me
, LONG
*pcch
)
717 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
719 return CO_E_RELEASED
;
721 FIXME("not implemented %p\n", This
);
725 static HRESULT WINAPI
ITextRange_fnGetStoryType(ITextRange
*me
, LONG
*pValue
)
727 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
729 return CO_E_RELEASED
;
731 FIXME("not implemented %p\n", This
);
735 static HRESULT WINAPI
ITextRange_fnCollapse(ITextRange
*me
, LONG bStart
)
737 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
739 return CO_E_RELEASED
;
741 FIXME("not implemented %p\n", This
);
745 static HRESULT WINAPI
ITextRange_fnExpand(ITextRange
*me
, LONG Unit
, LONG
*pDelta
)
747 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
749 return CO_E_RELEASED
;
751 FIXME("not implemented %p\n", This
);
755 static HRESULT WINAPI
ITextRange_fnGetIndex(ITextRange
*me
, LONG Unit
, LONG
*pIndex
)
757 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
759 return CO_E_RELEASED
;
761 FIXME("not implemented %p\n", This
);
765 static HRESULT WINAPI
ITextRange_fnSetIndex(ITextRange
*me
, LONG Unit
, LONG Index
,
768 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
770 return CO_E_RELEASED
;
772 FIXME("not implemented %p\n", This
);
776 static HRESULT WINAPI
ITextRange_fnSetRange(ITextRange
*me
, LONG cpActive
, LONG cpOther
)
778 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
780 return CO_E_RELEASED
;
782 FIXME("not implemented %p\n", This
);
786 static HRESULT WINAPI
ITextRange_fnInRange(ITextRange
*me
, ITextRange
*pRange
, LONG
*pb
)
788 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
790 return CO_E_RELEASED
;
792 FIXME("not implemented %p\n", This
);
796 static HRESULT WINAPI
ITextRange_fnInStory(ITextRange
*me
, ITextRange
*pRange
, LONG
*pb
)
798 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
800 return CO_E_RELEASED
;
802 FIXME("not implemented %p\n", This
);
806 static HRESULT WINAPI
ITextRange_fnIsEqual(ITextRange
*me
, ITextRange
*pRange
, LONG
*pb
)
808 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
810 return CO_E_RELEASED
;
812 FIXME("not implemented %p\n", This
);
816 static HRESULT WINAPI
ITextRange_fnSelect(ITextRange
*me
)
818 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
820 return CO_E_RELEASED
;
822 FIXME("not implemented %p\n", This
);
826 static HRESULT WINAPI
ITextRange_fnStartOf(ITextRange
*me
, LONG Unit
, LONG Extend
,
829 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
831 return CO_E_RELEASED
;
833 FIXME("not implemented %p\n", This
);
837 static HRESULT WINAPI
ITextRange_fnEndOf(ITextRange
*me
, LONG Unit
, LONG Extend
,
840 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
842 return CO_E_RELEASED
;
844 FIXME("not implemented %p\n", This
);
848 static HRESULT WINAPI
ITextRange_fnMove(ITextRange
*me
, LONG Unit
, LONG Count
, LONG
*pDelta
)
850 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
852 return CO_E_RELEASED
;
854 FIXME("not implemented %p\n", This
);
858 static HRESULT WINAPI
ITextRange_fnMoveStart(ITextRange
*me
, LONG Unit
, LONG Count
,
861 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
863 return CO_E_RELEASED
;
865 FIXME("not implemented %p\n", This
);
869 static HRESULT WINAPI
ITextRange_fnMoveEnd(ITextRange
*me
, LONG Unit
, LONG Count
,
872 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
874 return CO_E_RELEASED
;
876 FIXME("not implemented %p\n", This
);
880 static HRESULT WINAPI
ITextRange_fnMoveWhile(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
883 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
885 return CO_E_RELEASED
;
887 FIXME("not implemented %p\n", This
);
891 static HRESULT WINAPI
ITextRange_fnMoveStartWhile(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
894 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
896 return CO_E_RELEASED
;
898 FIXME("not implemented %p\n", This
);
902 static HRESULT WINAPI
ITextRange_fnMoveEndWhile(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
905 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
907 return CO_E_RELEASED
;
909 FIXME("not implemented %p\n", This
);
913 static HRESULT WINAPI
ITextRange_fnMoveUntil(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
916 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
918 return CO_E_RELEASED
;
920 FIXME("not implemented %p\n", This
);
924 static HRESULT WINAPI
ITextRange_fnMoveStartUntil(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
927 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
929 return CO_E_RELEASED
;
931 FIXME("not implemented %p\n", This
);
935 static HRESULT WINAPI
ITextRange_fnMoveEndUntil(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
938 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
940 return CO_E_RELEASED
;
942 FIXME("not implemented %p\n", This
);
946 static HRESULT WINAPI
ITextRange_fnFindText(ITextRange
*me
, BSTR bstr
, LONG cch
, LONG Flags
,
949 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
951 return CO_E_RELEASED
;
953 FIXME("not implemented %p\n", This
);
957 static HRESULT WINAPI
ITextRange_fnFindTextStart(ITextRange
*me
, BSTR bstr
, LONG cch
,
958 LONG Flags
, LONG
*pLength
)
960 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
962 return CO_E_RELEASED
;
964 FIXME("not implemented %p\n", This
);
968 static HRESULT WINAPI
ITextRange_fnFindTextEnd(ITextRange
*me
, BSTR bstr
, LONG cch
,
969 LONG Flags
, LONG
*pLength
)
971 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
973 return CO_E_RELEASED
;
975 FIXME("not implemented %p\n", This
);
979 static HRESULT WINAPI
ITextRange_fnDelete(ITextRange
*me
, LONG Unit
, LONG Count
,
982 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
984 return CO_E_RELEASED
;
986 FIXME("not implemented %p\n", This
);
990 static HRESULT WINAPI
ITextRange_fnCut(ITextRange
*me
, VARIANT
*pVar
)
992 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
994 return CO_E_RELEASED
;
996 FIXME("not implemented %p\n", This
);
1000 static HRESULT WINAPI
ITextRange_fnCopy(ITextRange
*me
, VARIANT
*pVar
)
1002 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1004 return CO_E_RELEASED
;
1006 FIXME("not implemented %p\n", This
);
1010 static HRESULT WINAPI
ITextRange_fnPaste(ITextRange
*me
, VARIANT
*pVar
, LONG Format
)
1012 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1014 return CO_E_RELEASED
;
1016 FIXME("not implemented %p\n", This
);
1020 static HRESULT WINAPI
ITextRange_fnCanPaste(ITextRange
*me
, VARIANT
*pVar
, LONG Format
,
1023 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1025 return CO_E_RELEASED
;
1027 FIXME("not implemented %p\n", This
);
1031 static HRESULT WINAPI
ITextRange_fnCanEdit(ITextRange
*me
, LONG
*pb
)
1033 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1035 return CO_E_RELEASED
;
1037 FIXME("not implemented %p\n", This
);
1041 static HRESULT WINAPI
ITextRange_fnChangeCase(ITextRange
*me
, LONG Type
)
1043 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1045 return CO_E_RELEASED
;
1047 FIXME("not implemented %p\n", This
);
1051 static HRESULT WINAPI
ITextRange_fnGetPoint(ITextRange
*me
, LONG Type
, LONG
*cx
, LONG
*cy
)
1053 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1055 return CO_E_RELEASED
;
1057 FIXME("not implemented %p\n", This
);
1061 static HRESULT WINAPI
ITextRange_fnSetPoint(ITextRange
*me
, LONG x
, LONG y
, LONG Type
,
1064 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1066 return CO_E_RELEASED
;
1068 FIXME("not implemented %p\n", This
);
1072 static HRESULT WINAPI
ITextRange_fnScrollIntoView(ITextRange
*me
, LONG Value
)
1074 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1076 return CO_E_RELEASED
;
1078 FIXME("not implemented %p\n", This
);
1082 static HRESULT WINAPI
ITextRange_fnGetEmbeddedObject(ITextRange
*me
, IUnknown
**ppv
)
1084 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1086 return CO_E_RELEASED
;
1088 FIXME("not implemented %p\n", This
);
1092 static const ITextRangeVtbl trvt
= {
1093 ITextRange_fnQueryInterface
,
1094 ITextRange_fnAddRef
,
1095 ITextRange_fnRelease
,
1096 ITextRange_fnGetTypeInfoCount
,
1097 ITextRange_fnGetTypeInfo
,
1098 ITextRange_fnGetIDsOfNames
,
1099 ITextRange_fnInvoke
,
1100 ITextRange_fnGetText
,
1101 ITextRange_fnSetText
,
1102 ITextRange_fnGetChar
,
1103 ITextRange_fnSetChar
,
1104 ITextRange_fnGetDuplicate
,
1105 ITextRange_fnGetFormattedText
,
1106 ITextRange_fnSetFormattedText
,
1107 ITextRange_fnGetStart
,
1108 ITextRange_fnSetStart
,
1109 ITextRange_fnGetEnd
,
1110 ITextRange_fnSetEnd
,
1111 ITextRange_fnGetFont
,
1112 ITextRange_fnSetFont
,
1113 ITextRange_fnGetPara
,
1114 ITextRange_fnSetPara
,
1115 ITextRange_fnGetStoryLength
,
1116 ITextRange_fnGetStoryType
,
1117 ITextRange_fnCollapse
,
1118 ITextRange_fnExpand
,
1119 ITextRange_fnGetIndex
,
1120 ITextRange_fnSetIndex
,
1121 ITextRange_fnSetRange
,
1122 ITextRange_fnInRange
,
1123 ITextRange_fnInStory
,
1124 ITextRange_fnIsEqual
,
1125 ITextRange_fnSelect
,
1126 ITextRange_fnStartOf
,
1129 ITextRange_fnMoveStart
,
1130 ITextRange_fnMoveEnd
,
1131 ITextRange_fnMoveWhile
,
1132 ITextRange_fnMoveStartWhile
,
1133 ITextRange_fnMoveEndWhile
,
1134 ITextRange_fnMoveUntil
,
1135 ITextRange_fnMoveStartUntil
,
1136 ITextRange_fnMoveEndUntil
,
1137 ITextRange_fnFindText
,
1138 ITextRange_fnFindTextStart
,
1139 ITextRange_fnFindTextEnd
,
1140 ITextRange_fnDelete
,
1144 ITextRange_fnCanPaste
,
1145 ITextRange_fnCanEdit
,
1146 ITextRange_fnChangeCase
,
1147 ITextRange_fnGetPoint
,
1148 ITextRange_fnSetPoint
,
1149 ITextRange_fnScrollIntoView
,
1150 ITextRange_fnGetEmbeddedObject
1152 /* ITextRange interface */
1154 static HRESULT WINAPI
1155 ITextDocument_fnQueryInterface(ITextDocument
* me
, REFIID riid
,
1158 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1159 return IRichEditOle_QueryInterface(&This
->IRichEditOle_iface
, riid
, ppvObject
);
1163 ITextDocument_fnAddRef(ITextDocument
* me
)
1165 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1166 return IRichEditOle_AddRef(&This
->IRichEditOle_iface
);
1170 ITextDocument_fnRelease(ITextDocument
* me
)
1172 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1173 return IRichEditOle_Release(&This
->IRichEditOle_iface
);
1176 static HRESULT WINAPI
1177 ITextDocument_fnGetTypeInfoCount(ITextDocument
* me
,
1180 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1181 FIXME("stub %p\n",This
);
1185 static HRESULT WINAPI
1186 ITextDocument_fnGetTypeInfo(ITextDocument
* me
, UINT iTInfo
, LCID lcid
,
1187 ITypeInfo
** ppTInfo
)
1189 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1190 FIXME("stub %p\n",This
);
1194 static HRESULT WINAPI
1195 ITextDocument_fnGetIDsOfNames(ITextDocument
* me
, REFIID riid
,
1196 LPOLESTR
* rgszNames
, UINT cNames
, LCID lcid
, DISPID
* rgDispId
)
1198 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1199 FIXME("stub %p\n",This
);
1203 static HRESULT WINAPI
1204 ITextDocument_fnInvoke(ITextDocument
* me
, DISPID dispIdMember
,
1205 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
* pDispParams
,
1206 VARIANT
* pVarResult
, EXCEPINFO
* pExcepInfo
, UINT
* puArgErr
)
1208 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1209 FIXME("stub %p\n",This
);
1213 static HRESULT WINAPI
1214 ITextDocument_fnGetName(ITextDocument
* me
, BSTR
* pName
)
1216 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1217 FIXME("stub %p\n",This
);
1221 static HRESULT WINAPI
1222 ITextDocument_fnGetSelection(ITextDocument
* me
, ITextSelection
** ppSel
)
1224 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1225 TRACE("(%p)\n", me
);
1228 return E_INVALIDARG
;
1229 *ppSel
= &This
->txtSel
->ITextSelection_iface
;
1230 ITextSelection_AddRef(*ppSel
);
1234 static HRESULT WINAPI
1235 ITextDocument_fnGetStoryCount(ITextDocument
* me
, LONG
* pCount
)
1237 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1238 FIXME("stub %p\n",This
);
1242 static HRESULT WINAPI
1243 ITextDocument_fnGetStoryRanges(ITextDocument
* me
,
1244 ITextStoryRanges
** ppStories
)
1246 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1247 FIXME("stub %p\n",This
);
1251 static HRESULT WINAPI
1252 ITextDocument_fnGetSaved(ITextDocument
* me
, LONG
* pValue
)
1254 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1255 FIXME("stub %p\n",This
);
1259 static HRESULT WINAPI
1260 ITextDocument_fnSetSaved(ITextDocument
* me
, LONG Value
)
1262 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1263 FIXME("stub %p\n",This
);
1267 static HRESULT WINAPI
1268 ITextDocument_fnGetDefaultTabStop(ITextDocument
* me
, float* pValue
)
1270 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1271 FIXME("stub %p\n",This
);
1275 static HRESULT WINAPI
1276 ITextDocument_fnSetDefaultTabStop(ITextDocument
* me
, float Value
)
1278 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1279 FIXME("stub %p\n",This
);
1283 static HRESULT WINAPI
1284 ITextDocument_fnNew(ITextDocument
* me
)
1286 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1287 FIXME("stub %p\n",This
);
1291 static HRESULT WINAPI
1292 ITextDocument_fnOpen(ITextDocument
* me
, VARIANT
* pVar
, LONG Flags
,
1295 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1296 FIXME("stub %p\n",This
);
1300 static HRESULT WINAPI
1301 ITextDocument_fnSave(ITextDocument
* me
, VARIANT
* pVar
, LONG Flags
,
1304 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1305 FIXME("stub %p\n",This
);
1309 static HRESULT WINAPI
1310 ITextDocument_fnFreeze(ITextDocument
* me
, LONG
* pCount
)
1312 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1313 FIXME("stub %p\n",This
);
1317 static HRESULT WINAPI
1318 ITextDocument_fnUnfreeze(ITextDocument
* me
, LONG
* pCount
)
1320 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1321 FIXME("stub %p\n",This
);
1325 static HRESULT WINAPI
1326 ITextDocument_fnBeginEditCollection(ITextDocument
* me
)
1328 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1329 FIXME("stub %p\n",This
);
1333 static HRESULT WINAPI
1334 ITextDocument_fnEndEditCollection(ITextDocument
* me
)
1336 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1337 FIXME("stub %p\n",This
);
1341 static HRESULT WINAPI
1342 ITextDocument_fnUndo(ITextDocument
* me
, LONG Count
, LONG
* prop
)
1344 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1345 FIXME("stub %p\n",This
);
1349 static HRESULT WINAPI
1350 ITextDocument_fnRedo(ITextDocument
* me
, LONG Count
, LONG
* prop
)
1352 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1353 FIXME("stub %p\n",This
);
1357 static HRESULT
CreateITextRange(IRichEditOleImpl
*reOle
, LONG start
, LONG end
, ITextRange
** ppRange
)
1359 ITextRangeImpl
*txtRge
= heap_alloc(sizeof(ITextRangeImpl
));
1362 return E_OUTOFMEMORY
;
1363 txtRge
->ITextRange_iface
.lpVtbl
= &trvt
;
1365 txtRge
->reOle
= reOle
;
1366 txtRge
->start
= start
;
1368 list_add_head(&reOle
->rangelist
, &txtRge
->entry
);
1369 *ppRange
= &txtRge
->ITextRange_iface
;
1373 static HRESULT WINAPI
1374 ITextDocument_fnRange(ITextDocument
* me
, LONG cp1
, LONG cp2
,
1375 ITextRange
** ppRange
)
1377 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1378 const int len
= ME_GetTextLength(This
->editor
) + 1;
1380 TRACE("%p %p %d %d\n", This
, ppRange
, cp1
, cp2
);
1382 return E_INVALIDARG
;
1386 cp1
= min(cp1
, len
);
1387 cp2
= min(cp2
, len
);
1396 cp1
= cp2
= len
- 1;
1398 return CreateITextRange(This
, cp1
, cp2
, ppRange
);
1401 static HRESULT WINAPI
1402 ITextDocument_fnRangeFromPoint(ITextDocument
* me
, LONG x
, LONG y
,
1403 ITextRange
** ppRange
)
1405 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1406 FIXME("stub %p\n",This
);
1410 static const ITextDocumentVtbl tdvt
= {
1411 ITextDocument_fnQueryInterface
,
1412 ITextDocument_fnAddRef
,
1413 ITextDocument_fnRelease
,
1414 ITextDocument_fnGetTypeInfoCount
,
1415 ITextDocument_fnGetTypeInfo
,
1416 ITextDocument_fnGetIDsOfNames
,
1417 ITextDocument_fnInvoke
,
1418 ITextDocument_fnGetName
,
1419 ITextDocument_fnGetSelection
,
1420 ITextDocument_fnGetStoryCount
,
1421 ITextDocument_fnGetStoryRanges
,
1422 ITextDocument_fnGetSaved
,
1423 ITextDocument_fnSetSaved
,
1424 ITextDocument_fnGetDefaultTabStop
,
1425 ITextDocument_fnSetDefaultTabStop
,
1426 ITextDocument_fnNew
,
1427 ITextDocument_fnOpen
,
1428 ITextDocument_fnSave
,
1429 ITextDocument_fnFreeze
,
1430 ITextDocument_fnUnfreeze
,
1431 ITextDocument_fnBeginEditCollection
,
1432 ITextDocument_fnEndEditCollection
,
1433 ITextDocument_fnUndo
,
1434 ITextDocument_fnRedo
,
1435 ITextDocument_fnRange
,
1436 ITextDocument_fnRangeFromPoint
1439 static inline ITextSelectionImpl
*impl_from_ITextSelection(ITextSelection
*iface
)
1441 return CONTAINING_RECORD(iface
, ITextSelectionImpl
, ITextSelection_iface
);
1444 static HRESULT WINAPI
ITextSelection_fnQueryInterface(
1450 if (IsEqualGUID(riid
, &IID_IUnknown
)
1451 || IsEqualGUID(riid
, &IID_IDispatch
)
1452 || IsEqualGUID(riid
, &IID_ITextRange
)
1453 || IsEqualGUID(riid
, &IID_ITextSelection
))
1456 ITextSelection_AddRef(me
);
1460 return E_NOINTERFACE
;
1463 static ULONG WINAPI
ITextSelection_fnAddRef(ITextSelection
*me
)
1465 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1466 return InterlockedIncrement(&This
->ref
);
1469 static ULONG WINAPI
ITextSelection_fnRelease(ITextSelection
*me
)
1471 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1472 ULONG ref
= InterlockedDecrement(&This
->ref
);
1478 static HRESULT WINAPI
ITextSelection_fnGetTypeInfoCount(ITextSelection
*me
, UINT
*pctinfo
)
1480 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1482 return CO_E_RELEASED
;
1484 FIXME("not implemented\n");
1488 static HRESULT WINAPI
ITextSelection_fnGetTypeInfo(ITextSelection
*me
, UINT iTInfo
, LCID lcid
,
1489 ITypeInfo
**ppTInfo
)
1491 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1493 return CO_E_RELEASED
;
1495 FIXME("not implemented\n");
1499 static HRESULT WINAPI
ITextSelection_fnGetIDsOfNames(ITextSelection
*me
, REFIID riid
,
1500 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
1502 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1504 return CO_E_RELEASED
;
1506 FIXME("not implemented\n");
1510 static HRESULT WINAPI
ITextSelection_fnInvoke(
1512 DISPID dispIdMember
,
1516 DISPPARAMS
*pDispParams
,
1517 VARIANT
*pVarResult
,
1518 EXCEPINFO
*pExcepInfo
,
1521 FIXME("not implemented\n");
1525 /*** ITextRange methods ***/
1526 static HRESULT WINAPI
ITextSelection_fnGetText(ITextSelection
*me
, BSTR
*pbstr
)
1528 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1529 ME_Cursor
*start
= NULL
, *end
= NULL
;
1534 return CO_E_RELEASED
;
1535 TRACE("%p\n", pbstr
);
1537 return E_INVALIDARG
;
1539 ME_GetSelection(This
->reOle
->editor
, &start
, &end
);
1540 endOfs
= ME_GetCursorOfs(end
);
1541 nChars
= endOfs
- ME_GetCursorOfs(start
);
1548 *pbstr
= SysAllocStringLen(NULL
, nChars
);
1550 return E_OUTOFMEMORY
;
1552 bEOP
= (end
->pRun
->next
->type
== diTextEnd
&& endOfs
> ME_GetTextLength(This
->reOle
->editor
));
1553 ME_GetTextW(This
->reOle
->editor
, *pbstr
, nChars
, start
, nChars
, FALSE
, bEOP
);
1554 TRACE("%s\n", wine_dbgstr_w(*pbstr
));
1559 static HRESULT WINAPI
ITextSelection_fnSetText(ITextSelection
*me
, BSTR bstr
)
1561 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1563 return CO_E_RELEASED
;
1565 FIXME("not implemented\n");
1569 static HRESULT WINAPI
ITextSelection_fnGetChar(ITextSelection
*me
, LONG
*pch
)
1571 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1573 return CO_E_RELEASED
;
1575 FIXME("not implemented\n");
1579 static HRESULT WINAPI
ITextSelection_fnSetChar(ITextSelection
*me
, LONG ch
)
1581 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1583 return CO_E_RELEASED
;
1585 FIXME("not implemented\n");
1589 static HRESULT WINAPI
ITextSelection_fnGetDuplicate(ITextSelection
*me
, ITextRange
**ppRange
)
1591 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1593 return CO_E_RELEASED
;
1595 FIXME("not implemented\n");
1599 static HRESULT WINAPI
ITextSelection_fnGetFormattedText(ITextSelection
*me
, ITextRange
**ppRange
)
1601 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1603 return CO_E_RELEASED
;
1605 FIXME("not implemented\n");
1609 static HRESULT WINAPI
ITextSelection_fnSetFormattedText(ITextSelection
*me
, ITextRange
*pRange
)
1611 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1613 return CO_E_RELEASED
;
1615 FIXME("not implemented\n");
1619 static HRESULT WINAPI
ITextSelection_fnGetStart(ITextSelection
*me
, LONG
*pcpFirst
)
1621 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1623 return CO_E_RELEASED
;
1625 FIXME("not implemented\n");
1629 static HRESULT WINAPI
ITextSelection_fnSetStart(ITextSelection
*me
, LONG cpFirst
)
1631 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1633 return CO_E_RELEASED
;
1635 FIXME("not implemented\n");
1639 static HRESULT WINAPI
ITextSelection_fnGetEnd(ITextSelection
*me
, LONG
*pcpLim
)
1641 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1643 return CO_E_RELEASED
;
1645 FIXME("not implemented\n");
1649 static HRESULT WINAPI
ITextSelection_fnSetEnd(ITextSelection
*me
, LONG cpLim
)
1651 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1653 return CO_E_RELEASED
;
1655 FIXME("not implemented\n");
1659 static HRESULT WINAPI
ITextSelection_fnGetFont(ITextSelection
*me
, ITextFont
**pFont
)
1661 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1663 return CO_E_RELEASED
;
1665 FIXME("not implemented\n");
1669 static HRESULT WINAPI
ITextSelection_fnSetFont(ITextSelection
*me
, ITextFont
*pFont
)
1671 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1673 return CO_E_RELEASED
;
1675 FIXME("not implemented\n");
1679 static HRESULT WINAPI
ITextSelection_fnGetPara(ITextSelection
*me
, ITextPara
**ppPara
)
1681 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1683 return CO_E_RELEASED
;
1685 FIXME("not implemented\n");
1689 static HRESULT WINAPI
ITextSelection_fnSetPara(ITextSelection
*me
, ITextPara
*pPara
)
1691 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1693 return CO_E_RELEASED
;
1695 FIXME("not implemented\n");
1699 static HRESULT WINAPI
ITextSelection_fnGetStoryLength(ITextSelection
*me
, LONG
*pcch
)
1701 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1703 return CO_E_RELEASED
;
1705 FIXME("not implemented\n");
1709 static HRESULT WINAPI
ITextSelection_fnGetStoryType(ITextSelection
*me
, LONG
*pValue
)
1711 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1713 return CO_E_RELEASED
;
1715 FIXME("not implemented\n");
1719 static HRESULT WINAPI
ITextSelection_fnCollapse(ITextSelection
*me
, LONG bStart
)
1721 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1723 return CO_E_RELEASED
;
1725 FIXME("not implemented\n");
1729 static HRESULT WINAPI
ITextSelection_fnExpand(ITextSelection
*me
, LONG Unit
, LONG
*pDelta
)
1731 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1733 return CO_E_RELEASED
;
1735 FIXME("not implemented\n");
1739 static HRESULT WINAPI
ITextSelection_fnGetIndex(ITextSelection
*me
, LONG Unit
, LONG
*pIndex
)
1741 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1743 return CO_E_RELEASED
;
1745 FIXME("not implemented\n");
1749 static HRESULT WINAPI
ITextSelection_fnSetIndex(ITextSelection
*me
, LONG Unit
, LONG Index
,
1752 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1754 return CO_E_RELEASED
;
1756 FIXME("not implemented\n");
1760 static HRESULT WINAPI
ITextSelection_fnSetRange(ITextSelection
*me
, LONG cpActive
, LONG cpOther
)
1762 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1764 return CO_E_RELEASED
;
1766 FIXME("not implemented\n");
1770 static HRESULT WINAPI
ITextSelection_fnInRange(ITextSelection
*me
, ITextRange
*pRange
, LONG
*pb
)
1772 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1774 return CO_E_RELEASED
;
1776 FIXME("not implemented\n");
1780 static HRESULT WINAPI
ITextSelection_fnInStory(ITextSelection
*me
, ITextRange
*pRange
, LONG
*pb
)
1782 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1784 return CO_E_RELEASED
;
1786 FIXME("not implemented\n");
1790 static HRESULT WINAPI
ITextSelection_fnIsEqual(ITextSelection
*me
, ITextRange
*pRange
, LONG
*pb
)
1792 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1794 return CO_E_RELEASED
;
1796 FIXME("not implemented\n");
1800 static HRESULT WINAPI
ITextSelection_fnSelect(ITextSelection
*me
)
1802 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1804 return CO_E_RELEASED
;
1806 FIXME("not implemented\n");
1810 static HRESULT WINAPI
ITextSelection_fnStartOf(ITextSelection
*me
, LONG Unit
, LONG Extend
,
1813 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1815 return CO_E_RELEASED
;
1817 FIXME("not implemented\n");
1821 static HRESULT WINAPI
ITextSelection_fnEndOf(ITextSelection
*me
, LONG Unit
, LONG Extend
,
1824 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1826 return CO_E_RELEASED
;
1828 FIXME("not implemented\n");
1832 static HRESULT WINAPI
ITextSelection_fnMove(ITextSelection
*me
, LONG Unit
, LONG Count
, LONG
*pDelta
)
1834 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1836 return CO_E_RELEASED
;
1838 FIXME("not implemented\n");
1842 static HRESULT WINAPI
ITextSelection_fnMoveStart(ITextSelection
*me
, LONG Unit
, LONG Count
,
1845 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1847 return CO_E_RELEASED
;
1849 FIXME("not implemented\n");
1853 static HRESULT WINAPI
ITextSelection_fnMoveEnd(ITextSelection
*me
, LONG Unit
, LONG Count
,
1856 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1858 return CO_E_RELEASED
;
1860 FIXME("not implemented\n");
1864 static HRESULT WINAPI
ITextSelection_fnMoveWhile(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1867 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1869 return CO_E_RELEASED
;
1871 FIXME("not implemented\n");
1875 static HRESULT WINAPI
ITextSelection_fnMoveStartWhile(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1878 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1880 return CO_E_RELEASED
;
1882 FIXME("not implemented\n");
1886 static HRESULT WINAPI
ITextSelection_fnMoveEndWhile(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1889 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1891 return CO_E_RELEASED
;
1893 FIXME("not implemented\n");
1897 static HRESULT WINAPI
ITextSelection_fnMoveUntil(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1900 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1902 return CO_E_RELEASED
;
1904 FIXME("not implemented\n");
1908 static HRESULT WINAPI
ITextSelection_fnMoveStartUntil(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1911 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1913 return CO_E_RELEASED
;
1915 FIXME("not implemented\n");
1919 static HRESULT WINAPI
ITextSelection_fnMoveEndUntil(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1922 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1924 return CO_E_RELEASED
;
1926 FIXME("not implemented\n");
1930 static HRESULT WINAPI
ITextSelection_fnFindText(ITextSelection
*me
, BSTR bstr
, LONG cch
, LONG Flags
,
1933 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1935 return CO_E_RELEASED
;
1937 FIXME("not implemented\n");
1941 static HRESULT WINAPI
ITextSelection_fnFindTextStart(ITextSelection
*me
, BSTR bstr
, LONG cch
,
1942 LONG Flags
, LONG
*pLength
)
1944 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1946 return CO_E_RELEASED
;
1948 FIXME("not implemented\n");
1952 static HRESULT WINAPI
ITextSelection_fnFindTextEnd(ITextSelection
*me
, BSTR bstr
, LONG cch
,
1953 LONG Flags
, LONG
*pLength
)
1955 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1957 return CO_E_RELEASED
;
1959 FIXME("not implemented\n");
1963 static HRESULT WINAPI
ITextSelection_fnDelete(ITextSelection
*me
, LONG Unit
, LONG Count
,
1966 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1968 return CO_E_RELEASED
;
1970 FIXME("not implemented\n");
1974 static HRESULT WINAPI
ITextSelection_fnCut(ITextSelection
*me
, VARIANT
*pVar
)
1976 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1978 return CO_E_RELEASED
;
1980 FIXME("not implemented\n");
1984 static HRESULT WINAPI
ITextSelection_fnCopy(ITextSelection
*me
, VARIANT
*pVar
)
1986 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1988 return CO_E_RELEASED
;
1990 FIXME("not implemented\n");
1994 static HRESULT WINAPI
ITextSelection_fnPaste(ITextSelection
*me
, VARIANT
*pVar
, LONG Format
)
1996 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1998 return CO_E_RELEASED
;
2000 FIXME("not implemented\n");
2004 static HRESULT WINAPI
ITextSelection_fnCanPaste(ITextSelection
*me
, VARIANT
*pVar
, LONG Format
,
2007 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2009 return CO_E_RELEASED
;
2011 FIXME("not implemented\n");
2015 static HRESULT WINAPI
ITextSelection_fnCanEdit(ITextSelection
*me
, LONG
*pb
)
2017 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2019 return CO_E_RELEASED
;
2021 FIXME("not implemented\n");
2025 static HRESULT WINAPI
ITextSelection_fnChangeCase(ITextSelection
*me
, LONG Type
)
2027 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2029 return CO_E_RELEASED
;
2031 FIXME("not implemented\n");
2035 static HRESULT WINAPI
ITextSelection_fnGetPoint(ITextSelection
*me
, LONG Type
, LONG
*cx
, LONG
*cy
)
2037 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2039 return CO_E_RELEASED
;
2041 FIXME("not implemented\n");
2045 static HRESULT WINAPI
ITextSelection_fnSetPoint(ITextSelection
*me
, LONG x
, LONG y
, LONG Type
,
2048 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2050 return CO_E_RELEASED
;
2052 FIXME("not implemented\n");
2056 static HRESULT WINAPI
ITextSelection_fnScrollIntoView(ITextSelection
*me
, LONG Value
)
2058 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2060 return CO_E_RELEASED
;
2062 FIXME("not implemented\n");
2066 static HRESULT WINAPI
ITextSelection_fnGetEmbeddedObject(ITextSelection
*me
, IUnknown
**ppv
)
2068 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2070 return CO_E_RELEASED
;
2072 FIXME("not implemented\n");
2076 /*** ITextSelection methods ***/
2077 static HRESULT WINAPI
ITextSelection_fnGetFlags(ITextSelection
*me
, LONG
*pFlags
)
2079 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2081 return CO_E_RELEASED
;
2083 FIXME("not implemented\n");
2087 static HRESULT WINAPI
ITextSelection_fnSetFlags(ITextSelection
*me
, LONG Flags
)
2089 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2091 return CO_E_RELEASED
;
2093 FIXME("not implemented\n");
2097 static HRESULT WINAPI
ITextSelection_fnGetType(ITextSelection
*me
, LONG
*pType
)
2099 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2101 return CO_E_RELEASED
;
2103 FIXME("not implemented\n");
2107 static HRESULT WINAPI
ITextSelection_fnMoveLeft(ITextSelection
*me
, LONG Unit
, LONG Count
,
2108 LONG Extend
, LONG
*pDelta
)
2110 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2112 return CO_E_RELEASED
;
2114 FIXME("not implemented\n");
2118 static HRESULT WINAPI
ITextSelection_fnMoveRight(ITextSelection
*me
, LONG Unit
, LONG Count
,
2119 LONG Extend
, LONG
*pDelta
)
2121 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2123 return CO_E_RELEASED
;
2125 FIXME("not implemented\n");
2129 static HRESULT WINAPI
ITextSelection_fnMoveUp(ITextSelection
*me
, LONG Unit
, LONG Count
,
2130 LONG Extend
, LONG
*pDelta
)
2132 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2134 return CO_E_RELEASED
;
2136 FIXME("not implemented\n");
2140 static HRESULT WINAPI
ITextSelection_fnMoveDown(ITextSelection
*me
, LONG Unit
, LONG Count
,
2141 LONG Extend
, LONG
*pDelta
)
2143 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2145 return CO_E_RELEASED
;
2147 FIXME("not implemented\n");
2151 static HRESULT WINAPI
ITextSelection_fnHomeKey(ITextSelection
*me
, LONG Unit
, LONG Extend
,
2154 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2156 return CO_E_RELEASED
;
2158 FIXME("not implemented\n");
2162 static HRESULT WINAPI
ITextSelection_fnEndKey(ITextSelection
*me
, LONG Unit
, LONG Extend
,
2165 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2167 return CO_E_RELEASED
;
2169 FIXME("not implemented\n");
2173 static HRESULT WINAPI
ITextSelection_fnTypeText(ITextSelection
*me
, BSTR bstr
)
2175 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2177 return CO_E_RELEASED
;
2179 FIXME("not implemented\n");
2183 static const ITextSelectionVtbl tsvt
= {
2184 ITextSelection_fnQueryInterface
,
2185 ITextSelection_fnAddRef
,
2186 ITextSelection_fnRelease
,
2187 ITextSelection_fnGetTypeInfoCount
,
2188 ITextSelection_fnGetTypeInfo
,
2189 ITextSelection_fnGetIDsOfNames
,
2190 ITextSelection_fnInvoke
,
2191 ITextSelection_fnGetText
,
2192 ITextSelection_fnSetText
,
2193 ITextSelection_fnGetChar
,
2194 ITextSelection_fnSetChar
,
2195 ITextSelection_fnGetDuplicate
,
2196 ITextSelection_fnGetFormattedText
,
2197 ITextSelection_fnSetFormattedText
,
2198 ITextSelection_fnGetStart
,
2199 ITextSelection_fnSetStart
,
2200 ITextSelection_fnGetEnd
,
2201 ITextSelection_fnSetEnd
,
2202 ITextSelection_fnGetFont
,
2203 ITextSelection_fnSetFont
,
2204 ITextSelection_fnGetPara
,
2205 ITextSelection_fnSetPara
,
2206 ITextSelection_fnGetStoryLength
,
2207 ITextSelection_fnGetStoryType
,
2208 ITextSelection_fnCollapse
,
2209 ITextSelection_fnExpand
,
2210 ITextSelection_fnGetIndex
,
2211 ITextSelection_fnSetIndex
,
2212 ITextSelection_fnSetRange
,
2213 ITextSelection_fnInRange
,
2214 ITextSelection_fnInStory
,
2215 ITextSelection_fnIsEqual
,
2216 ITextSelection_fnSelect
,
2217 ITextSelection_fnStartOf
,
2218 ITextSelection_fnEndOf
,
2219 ITextSelection_fnMove
,
2220 ITextSelection_fnMoveStart
,
2221 ITextSelection_fnMoveEnd
,
2222 ITextSelection_fnMoveWhile
,
2223 ITextSelection_fnMoveStartWhile
,
2224 ITextSelection_fnMoveEndWhile
,
2225 ITextSelection_fnMoveUntil
,
2226 ITextSelection_fnMoveStartUntil
,
2227 ITextSelection_fnMoveEndUntil
,
2228 ITextSelection_fnFindText
,
2229 ITextSelection_fnFindTextStart
,
2230 ITextSelection_fnFindTextEnd
,
2231 ITextSelection_fnDelete
,
2232 ITextSelection_fnCut
,
2233 ITextSelection_fnCopy
,
2234 ITextSelection_fnPaste
,
2235 ITextSelection_fnCanPaste
,
2236 ITextSelection_fnCanEdit
,
2237 ITextSelection_fnChangeCase
,
2238 ITextSelection_fnGetPoint
,
2239 ITextSelection_fnSetPoint
,
2240 ITextSelection_fnScrollIntoView
,
2241 ITextSelection_fnGetEmbeddedObject
,
2242 ITextSelection_fnGetFlags
,
2243 ITextSelection_fnSetFlags
,
2244 ITextSelection_fnGetType
,
2245 ITextSelection_fnMoveLeft
,
2246 ITextSelection_fnMoveRight
,
2247 ITextSelection_fnMoveUp
,
2248 ITextSelection_fnMoveDown
,
2249 ITextSelection_fnHomeKey
,
2250 ITextSelection_fnEndKey
,
2251 ITextSelection_fnTypeText
2254 static ITextSelectionImpl
*
2255 CreateTextSelection(IRichEditOleImpl
*reOle
)
2257 ITextSelectionImpl
*txtSel
= heap_alloc(sizeof *txtSel
);
2261 txtSel
->ITextSelection_iface
.lpVtbl
= &tsvt
;
2263 txtSel
->reOle
= reOle
;
2267 LRESULT
CreateIRichEditOle(ME_TextEditor
*editor
, LPVOID
*ppObj
)
2269 IRichEditOleImpl
*reo
;
2271 reo
= heap_alloc(sizeof(IRichEditOleImpl
));
2275 reo
->IRichEditOle_iface
.lpVtbl
= &revt
;
2276 reo
->ITextDocument_iface
.lpVtbl
= &tdvt
;
2278 reo
->editor
= editor
;
2279 reo
->txtSel
= CreateTextSelection(reo
);
2285 reo
->clientSite
= CreateOleClientSite(reo
);
2286 if (!reo
->clientSite
)
2288 ITextSelection_Release(&reo
->txtSel
->ITextSelection_iface
);
2292 TRACE("Created %p\n",reo
);
2294 list_init(&reo
->rangelist
);
2299 static void convert_sizel(const ME_Context
*c
, const SIZEL
* szl
, SIZE
* sz
)
2301 /* sizel is in .01 millimeters, sz in pixels */
2302 sz
->cx
= MulDiv(szl
->cx
, c
->dpi
.cx
, 2540);
2303 sz
->cy
= MulDiv(szl
->cy
, c
->dpi
.cy
, 2540);
2306 /******************************************************************************
2307 * ME_GetOLEObjectSize
2309 * Sets run extent for OLE objects.
2311 void ME_GetOLEObjectSize(const ME_Context
*c
, ME_Run
*run
, SIZE
*pSize
)
2319 assert(run
->nFlags
& MERF_GRAPHICS
);
2320 assert(run
->ole_obj
);
2322 if (run
->ole_obj
->sizel
.cx
!= 0 || run
->ole_obj
->sizel
.cy
!= 0)
2324 convert_sizel(c
, &run
->ole_obj
->sizel
, pSize
);
2325 if (c
->editor
->nZoomNumerator
!= 0)
2327 pSize
->cx
= MulDiv(pSize
->cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2328 pSize
->cy
= MulDiv(pSize
->cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2333 if (IOleObject_QueryInterface(run
->ole_obj
->poleobj
, &IID_IDataObject
, (void**)&ido
) != S_OK
)
2335 FIXME("Query Interface IID_IDataObject failed!\n");
2336 pSize
->cx
= pSize
->cy
= 0;
2339 fmt
.cfFormat
= CF_BITMAP
;
2341 fmt
.dwAspect
= DVASPECT_CONTENT
;
2343 fmt
.tymed
= TYMED_GDI
;
2344 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
2346 fmt
.cfFormat
= CF_ENHMETAFILE
;
2347 fmt
.tymed
= TYMED_ENHMF
;
2348 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
2350 FIXME("unsupported format\n");
2351 pSize
->cx
= pSize
->cy
= 0;
2352 IDataObject_Release(ido
);
2360 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
2361 pSize
->cx
= dibsect
.dsBm
.bmWidth
;
2362 pSize
->cy
= dibsect
.dsBm
.bmHeight
;
2363 if (!stgm
.pUnkForRelease
) DeleteObject(stgm
.u
.hBitmap
);
2366 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
2367 pSize
->cx
= emh
.rclBounds
.right
- emh
.rclBounds
.left
;
2368 pSize
->cy
= emh
.rclBounds
.bottom
- emh
.rclBounds
.top
;
2369 if (!stgm
.pUnkForRelease
) DeleteEnhMetaFile(stgm
.u
.hEnhMetaFile
);
2372 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
2375 IDataObject_Release(ido
);
2376 if (c
->editor
->nZoomNumerator
!= 0)
2378 pSize
->cx
= MulDiv(pSize
->cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2379 pSize
->cy
= MulDiv(pSize
->cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2383 void ME_DrawOLE(ME_Context
*c
, int x
, int y
, ME_Run
*run
,
2384 ME_Paragraph
*para
, BOOL selected
)
2395 assert(run
->nFlags
& MERF_GRAPHICS
);
2396 assert(run
->ole_obj
);
2397 if (IOleObject_QueryInterface(run
->ole_obj
->poleobj
, &IID_IDataObject
, (void**)&ido
) != S_OK
)
2399 FIXME("Couldn't get interface\n");
2402 has_size
= run
->ole_obj
->sizel
.cx
!= 0 || run
->ole_obj
->sizel
.cy
!= 0;
2403 fmt
.cfFormat
= CF_BITMAP
;
2405 fmt
.dwAspect
= DVASPECT_CONTENT
;
2407 fmt
.tymed
= TYMED_GDI
;
2408 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
2410 fmt
.cfFormat
= CF_ENHMETAFILE
;
2411 fmt
.tymed
= TYMED_ENHMF
;
2412 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
2414 FIXME("Couldn't get storage medium\n");
2415 IDataObject_Release(ido
);
2422 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
2423 hMemDC
= CreateCompatibleDC(c
->hDC
);
2424 SelectObject(hMemDC
, stgm
.u
.hBitmap
);
2427 convert_sizel(c
, &run
->ole_obj
->sizel
, &sz
);
2429 sz
.cx
= MulDiv(dibsect
.dsBm
.bmWidth
, c
->dpi
.cx
, 96);
2430 sz
.cy
= MulDiv(dibsect
.dsBm
.bmHeight
, c
->dpi
.cy
, 96);
2432 if (c
->editor
->nZoomNumerator
!= 0)
2434 sz
.cx
= MulDiv(sz
.cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2435 sz
.cy
= MulDiv(sz
.cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2437 if (sz
.cx
== dibsect
.dsBm
.bmWidth
&& sz
.cy
== dibsect
.dsBm
.bmHeight
)
2439 BitBlt(c
->hDC
, x
, y
- sz
.cy
,
2440 dibsect
.dsBm
.bmWidth
, dibsect
.dsBm
.bmHeight
,
2441 hMemDC
, 0, 0, SRCCOPY
);
2443 StretchBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
,
2444 hMemDC
, 0, 0, dibsect
.dsBm
.bmWidth
,
2445 dibsect
.dsBm
.bmHeight
, SRCCOPY
);
2448 if (!stgm
.pUnkForRelease
) DeleteObject(stgm
.u
.hBitmap
);
2451 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
2454 convert_sizel(c
, &run
->ole_obj
->sizel
, &sz
);
2456 sz
.cy
= MulDiv(emh
.rclBounds
.bottom
- emh
.rclBounds
.top
, c
->dpi
.cx
, 96);
2457 sz
.cx
= MulDiv(emh
.rclBounds
.right
- emh
.rclBounds
.left
, c
->dpi
.cy
, 96);
2459 if (c
->editor
->nZoomNumerator
!= 0)
2461 sz
.cx
= MulDiv(sz
.cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2462 sz
.cy
= MulDiv(sz
.cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2470 rc
.right
= x
+ sz
.cx
;
2472 PlayEnhMetaFile(c
->hDC
, stgm
.u
.hEnhMetaFile
, &rc
);
2474 if (!stgm
.pUnkForRelease
) DeleteEnhMetaFile(stgm
.u
.hEnhMetaFile
);
2477 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
2481 if (selected
&& !c
->editor
->bHideSelection
)
2482 PatBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
, DSTINVERT
);
2483 IDataObject_Release(ido
);
2486 void ME_DeleteReObject(REOBJECT
* reo
)
2488 if (reo
->poleobj
) IOleObject_Release(reo
->poleobj
);
2489 if (reo
->pstg
) IStorage_Release(reo
->pstg
);
2490 if (reo
->polesite
) IOleClientSite_Release(reo
->polesite
);
2494 void ME_CopyReObject(REOBJECT
* dst
, const REOBJECT
* src
)
2498 if (dst
->poleobj
) IOleObject_AddRef(dst
->poleobj
);
2499 if (dst
->pstg
) IStorage_AddRef(dst
->pstg
);
2500 if (dst
->polesite
) IOleClientSite_AddRef(dst
->polesite
);