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 IUnknown IUnknown_inner
;
56 IRichEditOle IRichEditOle_iface
;
57 ITextDocument ITextDocument_iface
;
61 ME_TextEditor
*editor
;
62 ITextSelectionImpl
*txtSel
;
63 IOleClientSiteImpl
*clientSite
;
64 struct list rangelist
;
67 struct ITextRangeImpl
{
68 ITextRange ITextRange_iface
;
73 IRichEditOleImpl
*reOle
;
76 struct ITextSelectionImpl
{
77 ITextSelection ITextSelection_iface
;
80 IRichEditOleImpl
*reOle
;
83 struct IOleClientSiteImpl
{
84 IOleClientSite IOleClientSite_iface
;
87 IRichEditOleImpl
*reOle
;
90 static inline IRichEditOleImpl
*impl_from_IRichEditOle(IRichEditOle
*iface
)
92 return CONTAINING_RECORD(iface
, IRichEditOleImpl
, IRichEditOle_iface
);
95 static inline IRichEditOleImpl
*impl_from_ITextDocument(ITextDocument
*iface
)
97 return CONTAINING_RECORD(iface
, IRichEditOleImpl
, ITextDocument_iface
);
100 static inline IRichEditOleImpl
*impl_from_IUnknown(IUnknown
*iface
)
102 return CONTAINING_RECORD(iface
, IRichEditOleImpl
, IUnknown_inner
);
105 static HRESULT WINAPI
IRichEditOleImpl_inner_fnQueryInterface(IUnknown
*iface
, REFIID riid
, LPVOID
*ppvObj
)
107 IRichEditOleImpl
*This
= impl_from_IUnknown(iface
);
109 TRACE("%p %s\n", This
, debugstr_guid(riid
));
112 if (IsEqualGUID(riid
, &IID_IUnknown
))
113 *ppvObj
= &This
->IUnknown_inner
;
114 else if (IsEqualGUID(riid
, &IID_IRichEditOle
))
115 *ppvObj
= &This
->IRichEditOle_iface
;
116 else if (IsEqualGUID(riid
, &IID_ITextDocument
))
117 *ppvObj
= &This
->ITextDocument_iface
;
120 IUnknown_AddRef((IUnknown
*)*ppvObj
);
123 FIXME("%p: unhandled interface %s\n", This
, debugstr_guid(riid
));
125 return E_NOINTERFACE
;
128 static ULONG WINAPI
IRichEditOleImpl_inner_fnAddRef(IUnknown
*iface
)
130 IRichEditOleImpl
*This
= impl_from_IUnknown(iface
);
131 ULONG ref
= InterlockedIncrement(&This
->ref
);
133 TRACE("%p ref = %u\n", This
, ref
);
138 static ULONG WINAPI
IRichEditOleImpl_inner_fnRelease(IUnknown
*iface
)
140 IRichEditOleImpl
*This
= impl_from_IUnknown(iface
);
141 ULONG ref
= InterlockedDecrement(&This
->ref
);
143 TRACE ("%p ref=%u\n", This
, ref
);
147 ITextRangeImpl
*txtRge
;
149 TRACE("Destroying %p\n", This
);
150 This
->txtSel
->reOle
= NULL
;
151 This
->editor
->reOle
= NULL
;
152 ITextSelection_Release(&This
->txtSel
->ITextSelection_iface
);
153 IOleClientSite_Release(&This
->clientSite
->IOleClientSite_iface
);
154 LIST_FOR_EACH_ENTRY(txtRge
, &This
->rangelist
, ITextRangeImpl
, entry
)
155 txtRge
->reOle
= NULL
;
161 static const IUnknownVtbl reo_unk_vtbl
=
163 IRichEditOleImpl_inner_fnQueryInterface
,
164 IRichEditOleImpl_inner_fnAddRef
,
165 IRichEditOleImpl_inner_fnRelease
168 static HRESULT WINAPI
169 IRichEditOle_fnQueryInterface(IRichEditOle
*me
, REFIID riid
, LPVOID
*ppvObj
)
171 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
172 return IUnknown_QueryInterface(This
->outer_unk
, riid
, ppvObj
);
176 IRichEditOle_fnAddRef(IRichEditOle
*me
)
178 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
179 return IUnknown_AddRef(This
->outer_unk
);
183 IRichEditOle_fnRelease(IRichEditOle
*me
)
185 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
186 return IUnknown_Release(This
->outer_unk
);
189 static HRESULT WINAPI
190 IRichEditOle_fnActivateAs(IRichEditOle
*me
, REFCLSID rclsid
, REFCLSID rclsidAs
)
192 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
193 FIXME("stub %p\n",This
);
197 static HRESULT WINAPI
198 IRichEditOle_fnContextSensitiveHelp(IRichEditOle
*me
, BOOL fEnterMode
)
200 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
201 FIXME("stub %p\n",This
);
205 static HRESULT WINAPI
206 IRichEditOle_fnConvertObject(IRichEditOle
*me
, LONG iob
,
207 REFCLSID rclsidNew
, LPCSTR lpstrUserTypeNew
)
209 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
210 FIXME("stub %p\n",This
);
214 static inline IOleClientSiteImpl
*impl_from_IOleClientSite(IOleClientSite
*iface
)
216 return CONTAINING_RECORD(iface
, IOleClientSiteImpl
, IOleClientSite_iface
);
219 static HRESULT WINAPI
220 IOleClientSite_fnQueryInterface(IOleClientSite
*me
, REFIID riid
, LPVOID
*ppvObj
)
222 TRACE("%p %s\n", me
, debugstr_guid(riid
) );
225 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
226 IsEqualGUID(riid
, &IID_IOleClientSite
))
230 IOleClientSite_AddRef(me
);
233 FIXME("%p: unhandled interface %s\n", me
, debugstr_guid(riid
) );
235 return E_NOINTERFACE
;
238 static ULONG WINAPI
IOleClientSite_fnAddRef(IOleClientSite
*iface
)
240 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
241 return InterlockedIncrement(&This
->ref
);
244 static ULONG WINAPI
IOleClientSite_fnRelease(IOleClientSite
*iface
)
246 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
247 ULONG ref
= InterlockedDecrement(&This
->ref
);
253 static HRESULT WINAPI
IOleClientSite_fnSaveObject(IOleClientSite
*iface
)
255 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
257 return CO_E_RELEASED
;
259 FIXME("stub %p\n", iface
);
264 static HRESULT WINAPI
IOleClientSite_fnGetMoniker(IOleClientSite
*iface
, DWORD dwAssign
,
265 DWORD dwWhichMoniker
, IMoniker
**ppmk
)
267 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
269 return CO_E_RELEASED
;
271 FIXME("stub %p\n", iface
);
275 static HRESULT WINAPI
IOleClientSite_fnGetContainer(IOleClientSite
*iface
,
276 IOleContainer
**ppContainer
)
278 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
280 return CO_E_RELEASED
;
282 FIXME("stub %p\n", iface
);
286 static HRESULT WINAPI
IOleClientSite_fnShowObject(IOleClientSite
*iface
)
288 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
290 return CO_E_RELEASED
;
292 FIXME("stub %p\n", iface
);
296 static HRESULT WINAPI
IOleClientSite_fnOnShowWindow(IOleClientSite
*iface
, BOOL fShow
)
298 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
300 return CO_E_RELEASED
;
302 FIXME("stub %p\n", iface
);
306 static HRESULT WINAPI
IOleClientSite_fnRequestNewObjectLayout(IOleClientSite
*iface
)
308 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
310 return CO_E_RELEASED
;
312 FIXME("stub %p\n", iface
);
316 static const IOleClientSiteVtbl ocst
= {
317 IOleClientSite_fnQueryInterface
,
318 IOleClientSite_fnAddRef
,
319 IOleClientSite_fnRelease
,
320 IOleClientSite_fnSaveObject
,
321 IOleClientSite_fnGetMoniker
,
322 IOleClientSite_fnGetContainer
,
323 IOleClientSite_fnShowObject
,
324 IOleClientSite_fnOnShowWindow
,
325 IOleClientSite_fnRequestNewObjectLayout
328 static IOleClientSiteImpl
*
329 CreateOleClientSite(IRichEditOleImpl
*reOle
)
331 IOleClientSiteImpl
*clientSite
= heap_alloc(sizeof *clientSite
);
335 clientSite
->IOleClientSite_iface
.lpVtbl
= &ocst
;
337 clientSite
->reOle
= reOle
;
341 static HRESULT WINAPI
342 IRichEditOle_fnGetClientSite(IRichEditOle
*me
,
343 LPOLECLIENTSITE
*lplpolesite
)
345 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
347 TRACE("%p,%p\n",This
, lplpolesite
);
351 *lplpolesite
= &This
->clientSite
->IOleClientSite_iface
;
352 IOleClientSite_AddRef(*lplpolesite
);
356 static HRESULT WINAPI
357 IRichEditOle_fnGetClipboardData(IRichEditOle
*me
, CHARRANGE
*lpchrg
,
358 DWORD reco
, LPDATAOBJECT
*lplpdataobj
)
360 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
364 TRACE("(%p,%p,%d)\n",This
, lpchrg
, reco
);
368 int nFrom
, nTo
, nStartCur
= ME_GetSelectionOfs(This
->editor
, &nFrom
, &nTo
);
369 start
= This
->editor
->pCursors
[nStartCur
];
370 nChars
= nTo
- nFrom
;
372 ME_CursorFromCharOfs(This
->editor
, lpchrg
->cpMin
, &start
);
373 nChars
= lpchrg
->cpMax
- lpchrg
->cpMin
;
375 return ME_GetDataObject(This
->editor
, &start
, nChars
, lplpdataobj
);
378 static LONG WINAPI
IRichEditOle_fnGetLinkCount(IRichEditOle
*me
)
380 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
381 FIXME("stub %p\n",This
);
385 static HRESULT WINAPI
386 IRichEditOle_fnGetObject(IRichEditOle
*me
, LONG iob
,
387 REOBJECT
*lpreobject
, DWORD dwFlags
)
389 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
390 FIXME("stub %p\n",This
);
395 IRichEditOle_fnGetObjectCount(IRichEditOle
*me
)
397 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
398 FIXME("stub %p\n",This
);
402 static HRESULT WINAPI
403 IRichEditOle_fnHandsOffStorage(IRichEditOle
*me
, LONG iob
)
405 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
406 FIXME("stub %p\n",This
);
410 static HRESULT WINAPI
411 IRichEditOle_fnImportDataObject(IRichEditOle
*me
, LPDATAOBJECT lpdataobj
,
412 CLIPFORMAT cf
, HGLOBAL hMetaPict
)
414 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
415 FIXME("stub %p\n",This
);
419 static HRESULT WINAPI
420 IRichEditOle_fnInPlaceDeactivate(IRichEditOle
*me
)
422 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
423 FIXME("stub %p\n",This
);
427 static HRESULT WINAPI
428 IRichEditOle_fnInsertObject(IRichEditOle
*me
, REOBJECT
*reo
)
430 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
431 TRACE("(%p,%p)\n", This
, reo
);
433 if (reo
->cbStruct
< sizeof(*reo
)) return STG_E_INVALIDPARAMETER
;
435 ME_InsertOLEFromCursor(This
->editor
, reo
, 0);
436 ME_CommitUndo(This
->editor
);
437 ME_UpdateRepaint(This
->editor
, FALSE
);
441 static HRESULT WINAPI
IRichEditOle_fnSaveCompleted(IRichEditOle
*me
, LONG iob
,
444 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
445 FIXME("stub %p\n",This
);
449 static HRESULT WINAPI
450 IRichEditOle_fnSetDvaspect(IRichEditOle
*me
, LONG iob
, DWORD dvaspect
)
452 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
453 FIXME("stub %p\n",This
);
457 static HRESULT WINAPI
IRichEditOle_fnSetHostNames(IRichEditOle
*me
,
458 LPCSTR lpstrContainerApp
, LPCSTR lpstrContainerObj
)
460 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
461 FIXME("stub %p %s %s\n",This
, lpstrContainerApp
, lpstrContainerObj
);
465 static HRESULT WINAPI
466 IRichEditOle_fnSetLinkAvailable(IRichEditOle
*me
, LONG iob
, BOOL fAvailable
)
468 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
469 FIXME("stub %p\n",This
);
473 static const IRichEditOleVtbl revt
= {
474 IRichEditOle_fnQueryInterface
,
475 IRichEditOle_fnAddRef
,
476 IRichEditOle_fnRelease
,
477 IRichEditOle_fnGetClientSite
,
478 IRichEditOle_fnGetObjectCount
,
479 IRichEditOle_fnGetLinkCount
,
480 IRichEditOle_fnGetObject
,
481 IRichEditOle_fnInsertObject
,
482 IRichEditOle_fnConvertObject
,
483 IRichEditOle_fnActivateAs
,
484 IRichEditOle_fnSetHostNames
,
485 IRichEditOle_fnSetLinkAvailable
,
486 IRichEditOle_fnSetDvaspect
,
487 IRichEditOle_fnHandsOffStorage
,
488 IRichEditOle_fnSaveCompleted
,
489 IRichEditOle_fnInPlaceDeactivate
,
490 IRichEditOle_fnContextSensitiveHelp
,
491 IRichEditOle_fnGetClipboardData
,
492 IRichEditOle_fnImportDataObject
495 /* ITextRange interface */
496 static inline ITextRangeImpl
*impl_from_ITextRange(ITextRange
*iface
)
498 return CONTAINING_RECORD(iface
, ITextRangeImpl
, ITextRange_iface
);
501 static HRESULT WINAPI
ITextRange_fnQueryInterface(ITextRange
*me
, REFIID riid
, void **ppvObj
)
504 if (IsEqualGUID(riid
, &IID_IUnknown
)
505 || IsEqualGUID(riid
, &IID_IDispatch
)
506 || IsEqualGUID(riid
, &IID_ITextRange
))
509 ITextRange_AddRef(me
);
513 return E_NOINTERFACE
;
516 static ULONG WINAPI
ITextRange_fnAddRef(ITextRange
*me
)
518 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
519 return InterlockedIncrement(&This
->ref
);
522 static ULONG WINAPI
ITextRange_fnRelease(ITextRange
*me
)
524 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
525 ULONG ref
= InterlockedDecrement(&This
->ref
);
527 TRACE ("%p ref=%u\n", This
, ref
);
532 list_remove(&This
->entry
);
540 static HRESULT WINAPI
ITextRange_fnGetTypeInfoCount(ITextRange
*me
, UINT
*pctinfo
)
542 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
544 return CO_E_RELEASED
;
546 FIXME("not implemented %p\n", This
);
550 static HRESULT WINAPI
ITextRange_fnGetTypeInfo(ITextRange
*me
, UINT iTInfo
, LCID lcid
,
553 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
555 return CO_E_RELEASED
;
557 FIXME("not implemented %p\n", This
);
561 static HRESULT WINAPI
ITextRange_fnGetIDsOfNames(ITextRange
*me
, REFIID riid
, LPOLESTR
*rgszNames
,
562 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
564 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
566 return CO_E_RELEASED
;
568 FIXME("not implemented %p\n", This
);
572 static HRESULT WINAPI
ITextRange_fnInvoke(ITextRange
*me
, DISPID dispIdMember
, REFIID riid
,
573 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
574 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
,
577 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
579 return CO_E_RELEASED
;
581 FIXME("not implemented %p\n", This
);
585 static HRESULT WINAPI
ITextRange_fnGetText(ITextRange
*me
, BSTR
*pbstr
)
587 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
589 return CO_E_RELEASED
;
591 FIXME("not implemented %p\n", This
);
595 static HRESULT WINAPI
ITextRange_fnSetText(ITextRange
*me
, BSTR bstr
)
597 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
599 return CO_E_RELEASED
;
601 FIXME("not implemented %p\n", This
);
605 static HRESULT
range_GetChar(ME_TextEditor
*editor
, ME_Cursor
*cursor
, LONG
*pch
)
609 ME_GetTextW(editor
, wch
, 1, cursor
, 1, FALSE
, cursor
->pRun
->next
->type
== diTextEnd
);
615 static HRESULT WINAPI
ITextRange_fnGetChar(ITextRange
*me
, LONG
*pch
)
617 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
621 return CO_E_RELEASED
;
626 ME_CursorFromCharOfs(This
->reOle
->editor
, This
->start
, &cursor
);
627 return range_GetChar(This
->reOle
->editor
, &cursor
, pch
);
630 static HRESULT WINAPI
ITextRange_fnSetChar(ITextRange
*me
, LONG ch
)
632 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
634 return CO_E_RELEASED
;
636 FIXME("not implemented %p\n", This
);
640 static HRESULT
CreateITextRange(IRichEditOleImpl
*reOle
, LONG start
, LONG end
, ITextRange
** ppRange
);
642 static HRESULT WINAPI
ITextRange_fnGetDuplicate(ITextRange
*me
, ITextRange
**ppRange
)
644 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
646 return CO_E_RELEASED
;
648 TRACE("%p %p\n", This
, ppRange
);
652 return CreateITextRange(This
->reOle
, This
->start
, This
->end
, ppRange
);
655 static HRESULT WINAPI
ITextRange_fnGetFormattedText(ITextRange
*me
, ITextRange
**ppRange
)
657 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
659 return CO_E_RELEASED
;
661 FIXME("not implemented %p\n", This
);
665 static HRESULT WINAPI
ITextRange_fnSetFormattedText(ITextRange
*me
, ITextRange
*pRange
)
667 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
669 return CO_E_RELEASED
;
671 FIXME("not implemented %p\n", This
);
675 static HRESULT WINAPI
ITextRange_fnGetStart(ITextRange
*me
, LONG
*pcpFirst
)
677 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
679 return CO_E_RELEASED
;
683 *pcpFirst
= This
->start
;
684 TRACE("%d\n", *pcpFirst
);
688 static HRESULT WINAPI
ITextRange_fnSetStart(ITextRange
*me
, LONG cpFirst
)
690 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
692 return CO_E_RELEASED
;
694 FIXME("not implemented %p\n", This
);
698 static HRESULT WINAPI
ITextRange_fnGetEnd(ITextRange
*me
, LONG
*pcpLim
)
700 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
702 return CO_E_RELEASED
;
707 TRACE("%d\n", *pcpLim
);
711 static HRESULT WINAPI
ITextRange_fnSetEnd(ITextRange
*me
, LONG cpLim
)
713 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
715 return CO_E_RELEASED
;
717 FIXME("not implemented %p\n", This
);
721 static HRESULT WINAPI
ITextRange_fnGetFont(ITextRange
*me
, ITextFont
**pFont
)
723 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
725 return CO_E_RELEASED
;
727 FIXME("not implemented %p\n", This
);
731 static HRESULT WINAPI
ITextRange_fnSetFont(ITextRange
*me
, ITextFont
*pFont
)
733 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
735 return CO_E_RELEASED
;
737 FIXME("not implemented %p\n", This
);
741 static HRESULT WINAPI
ITextRange_fnGetPara(ITextRange
*me
, ITextPara
**ppPara
)
743 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
745 return CO_E_RELEASED
;
747 FIXME("not implemented %p\n", This
);
751 static HRESULT WINAPI
ITextRange_fnSetPara(ITextRange
*me
, ITextPara
*pPara
)
753 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
755 return CO_E_RELEASED
;
757 FIXME("not implemented %p\n", This
);
761 static HRESULT WINAPI
ITextRange_fnGetStoryLength(ITextRange
*me
, LONG
*pcch
)
763 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
765 return CO_E_RELEASED
;
767 FIXME("not implemented %p\n", This
);
771 static HRESULT WINAPI
ITextRange_fnGetStoryType(ITextRange
*me
, LONG
*pValue
)
773 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
775 return CO_E_RELEASED
;
777 FIXME("not implemented %p\n", This
);
781 static HRESULT
range_Collapse(LONG bStart
, LONG
*start
, LONG
*end
)
786 if (bStart
== tomEnd
|| bStart
== tomFalse
)
793 static HRESULT WINAPI
ITextRange_fnCollapse(ITextRange
*me
, LONG bStart
)
795 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
797 return CO_E_RELEASED
;
799 return range_Collapse(bStart
, &This
->start
, &This
->end
);
802 static HRESULT WINAPI
ITextRange_fnExpand(ITextRange
*me
, LONG Unit
, LONG
*pDelta
)
804 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
806 return CO_E_RELEASED
;
808 FIXME("not implemented %p\n", This
);
812 static HRESULT WINAPI
ITextRange_fnGetIndex(ITextRange
*me
, LONG Unit
, LONG
*pIndex
)
814 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
816 return CO_E_RELEASED
;
818 FIXME("not implemented %p\n", This
);
822 static HRESULT WINAPI
ITextRange_fnSetIndex(ITextRange
*me
, LONG Unit
, LONG Index
,
825 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
827 return CO_E_RELEASED
;
829 FIXME("not implemented %p\n", This
);
833 static HRESULT WINAPI
ITextRange_fnSetRange(ITextRange
*me
, LONG cpActive
, LONG cpOther
)
835 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
837 return CO_E_RELEASED
;
839 FIXME("not implemented %p\n", This
);
843 static HRESULT WINAPI
ITextRange_fnInRange(ITextRange
*me
, ITextRange
*pRange
, LONG
*pb
)
845 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
847 return CO_E_RELEASED
;
849 FIXME("not implemented %p\n", This
);
853 static HRESULT WINAPI
ITextRange_fnInStory(ITextRange
*me
, ITextRange
*pRange
, LONG
*pb
)
855 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
857 return CO_E_RELEASED
;
859 FIXME("not implemented %p\n", This
);
863 static HRESULT WINAPI
ITextRange_fnIsEqual(ITextRange
*me
, ITextRange
*pRange
, LONG
*pb
)
865 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
867 return CO_E_RELEASED
;
869 FIXME("not implemented %p\n", This
);
873 static HRESULT WINAPI
ITextRange_fnSelect(ITextRange
*me
)
875 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
877 return CO_E_RELEASED
;
879 FIXME("not implemented %p\n", This
);
883 static HRESULT WINAPI
ITextRange_fnStartOf(ITextRange
*me
, LONG Unit
, LONG Extend
,
886 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
888 return CO_E_RELEASED
;
890 FIXME("not implemented %p\n", This
);
894 static HRESULT WINAPI
ITextRange_fnEndOf(ITextRange
*me
, LONG Unit
, LONG Extend
,
897 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
899 return CO_E_RELEASED
;
901 FIXME("not implemented %p\n", This
);
905 static HRESULT WINAPI
ITextRange_fnMove(ITextRange
*me
, LONG Unit
, LONG Count
, LONG
*pDelta
)
907 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
909 return CO_E_RELEASED
;
911 FIXME("not implemented %p\n", This
);
915 static HRESULT WINAPI
ITextRange_fnMoveStart(ITextRange
*me
, LONG Unit
, LONG Count
,
918 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
920 return CO_E_RELEASED
;
922 FIXME("not implemented %p\n", This
);
926 static HRESULT WINAPI
ITextRange_fnMoveEnd(ITextRange
*me
, LONG Unit
, LONG Count
,
929 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
931 return CO_E_RELEASED
;
933 FIXME("not implemented %p\n", This
);
937 static HRESULT WINAPI
ITextRange_fnMoveWhile(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
940 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
942 return CO_E_RELEASED
;
944 FIXME("not implemented %p\n", This
);
948 static HRESULT WINAPI
ITextRange_fnMoveStartWhile(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
951 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
953 return CO_E_RELEASED
;
955 FIXME("not implemented %p\n", This
);
959 static HRESULT WINAPI
ITextRange_fnMoveEndWhile(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
962 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
964 return CO_E_RELEASED
;
966 FIXME("not implemented %p\n", This
);
970 static HRESULT WINAPI
ITextRange_fnMoveUntil(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
973 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
975 return CO_E_RELEASED
;
977 FIXME("not implemented %p\n", This
);
981 static HRESULT WINAPI
ITextRange_fnMoveStartUntil(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
984 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
986 return CO_E_RELEASED
;
988 FIXME("not implemented %p\n", This
);
992 static HRESULT WINAPI
ITextRange_fnMoveEndUntil(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
995 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
997 return CO_E_RELEASED
;
999 FIXME("not implemented %p\n", This
);
1003 static HRESULT WINAPI
ITextRange_fnFindText(ITextRange
*me
, BSTR bstr
, LONG cch
, LONG Flags
,
1006 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1008 return CO_E_RELEASED
;
1010 FIXME("not implemented %p\n", This
);
1014 static HRESULT WINAPI
ITextRange_fnFindTextStart(ITextRange
*me
, BSTR bstr
, LONG cch
,
1015 LONG Flags
, LONG
*pLength
)
1017 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1019 return CO_E_RELEASED
;
1021 FIXME("not implemented %p\n", This
);
1025 static HRESULT WINAPI
ITextRange_fnFindTextEnd(ITextRange
*me
, BSTR bstr
, LONG cch
,
1026 LONG Flags
, LONG
*pLength
)
1028 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1030 return CO_E_RELEASED
;
1032 FIXME("not implemented %p\n", This
);
1036 static HRESULT WINAPI
ITextRange_fnDelete(ITextRange
*me
, LONG Unit
, LONG Count
,
1039 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1041 return CO_E_RELEASED
;
1043 FIXME("not implemented %p\n", This
);
1047 static HRESULT WINAPI
ITextRange_fnCut(ITextRange
*me
, VARIANT
*pVar
)
1049 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1051 return CO_E_RELEASED
;
1053 FIXME("not implemented %p\n", This
);
1057 static HRESULT WINAPI
ITextRange_fnCopy(ITextRange
*me
, VARIANT
*pVar
)
1059 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1061 return CO_E_RELEASED
;
1063 FIXME("not implemented %p\n", This
);
1067 static HRESULT WINAPI
ITextRange_fnPaste(ITextRange
*me
, VARIANT
*pVar
, LONG Format
)
1069 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1071 return CO_E_RELEASED
;
1073 FIXME("not implemented %p\n", This
);
1077 static HRESULT WINAPI
ITextRange_fnCanPaste(ITextRange
*me
, VARIANT
*pVar
, LONG Format
,
1080 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1082 return CO_E_RELEASED
;
1084 FIXME("not implemented %p\n", This
);
1088 static HRESULT WINAPI
ITextRange_fnCanEdit(ITextRange
*me
, LONG
*pb
)
1090 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1092 return CO_E_RELEASED
;
1094 FIXME("not implemented %p\n", This
);
1098 static HRESULT WINAPI
ITextRange_fnChangeCase(ITextRange
*me
, LONG Type
)
1100 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1102 return CO_E_RELEASED
;
1104 FIXME("not implemented %p\n", This
);
1108 static HRESULT WINAPI
ITextRange_fnGetPoint(ITextRange
*me
, LONG Type
, LONG
*cx
, LONG
*cy
)
1110 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1112 return CO_E_RELEASED
;
1114 FIXME("not implemented %p\n", This
);
1118 static HRESULT WINAPI
ITextRange_fnSetPoint(ITextRange
*me
, LONG x
, LONG y
, LONG Type
,
1121 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1123 return CO_E_RELEASED
;
1125 FIXME("not implemented %p\n", This
);
1129 static HRESULT WINAPI
ITextRange_fnScrollIntoView(ITextRange
*me
, LONG Value
)
1131 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1133 return CO_E_RELEASED
;
1135 FIXME("not implemented %p\n", This
);
1139 static HRESULT WINAPI
ITextRange_fnGetEmbeddedObject(ITextRange
*me
, IUnknown
**ppv
)
1141 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1143 return CO_E_RELEASED
;
1145 FIXME("not implemented %p\n", This
);
1149 static const ITextRangeVtbl trvt
= {
1150 ITextRange_fnQueryInterface
,
1151 ITextRange_fnAddRef
,
1152 ITextRange_fnRelease
,
1153 ITextRange_fnGetTypeInfoCount
,
1154 ITextRange_fnGetTypeInfo
,
1155 ITextRange_fnGetIDsOfNames
,
1156 ITextRange_fnInvoke
,
1157 ITextRange_fnGetText
,
1158 ITextRange_fnSetText
,
1159 ITextRange_fnGetChar
,
1160 ITextRange_fnSetChar
,
1161 ITextRange_fnGetDuplicate
,
1162 ITextRange_fnGetFormattedText
,
1163 ITextRange_fnSetFormattedText
,
1164 ITextRange_fnGetStart
,
1165 ITextRange_fnSetStart
,
1166 ITextRange_fnGetEnd
,
1167 ITextRange_fnSetEnd
,
1168 ITextRange_fnGetFont
,
1169 ITextRange_fnSetFont
,
1170 ITextRange_fnGetPara
,
1171 ITextRange_fnSetPara
,
1172 ITextRange_fnGetStoryLength
,
1173 ITextRange_fnGetStoryType
,
1174 ITextRange_fnCollapse
,
1175 ITextRange_fnExpand
,
1176 ITextRange_fnGetIndex
,
1177 ITextRange_fnSetIndex
,
1178 ITextRange_fnSetRange
,
1179 ITextRange_fnInRange
,
1180 ITextRange_fnInStory
,
1181 ITextRange_fnIsEqual
,
1182 ITextRange_fnSelect
,
1183 ITextRange_fnStartOf
,
1186 ITextRange_fnMoveStart
,
1187 ITextRange_fnMoveEnd
,
1188 ITextRange_fnMoveWhile
,
1189 ITextRange_fnMoveStartWhile
,
1190 ITextRange_fnMoveEndWhile
,
1191 ITextRange_fnMoveUntil
,
1192 ITextRange_fnMoveStartUntil
,
1193 ITextRange_fnMoveEndUntil
,
1194 ITextRange_fnFindText
,
1195 ITextRange_fnFindTextStart
,
1196 ITextRange_fnFindTextEnd
,
1197 ITextRange_fnDelete
,
1201 ITextRange_fnCanPaste
,
1202 ITextRange_fnCanEdit
,
1203 ITextRange_fnChangeCase
,
1204 ITextRange_fnGetPoint
,
1205 ITextRange_fnSetPoint
,
1206 ITextRange_fnScrollIntoView
,
1207 ITextRange_fnGetEmbeddedObject
1209 /* ITextRange interface */
1211 static HRESULT WINAPI
1212 ITextDocument_fnQueryInterface(ITextDocument
* me
, REFIID riid
,
1215 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1216 return IRichEditOle_QueryInterface(&This
->IRichEditOle_iface
, riid
, ppvObject
);
1220 ITextDocument_fnAddRef(ITextDocument
* me
)
1222 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1223 return IRichEditOle_AddRef(&This
->IRichEditOle_iface
);
1227 ITextDocument_fnRelease(ITextDocument
* me
)
1229 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1230 return IRichEditOle_Release(&This
->IRichEditOle_iface
);
1233 static HRESULT WINAPI
1234 ITextDocument_fnGetTypeInfoCount(ITextDocument
* me
,
1237 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1238 FIXME("stub %p\n",This
);
1242 static HRESULT WINAPI
1243 ITextDocument_fnGetTypeInfo(ITextDocument
* me
, UINT iTInfo
, LCID lcid
,
1244 ITypeInfo
** ppTInfo
)
1246 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1247 FIXME("stub %p\n",This
);
1251 static HRESULT WINAPI
1252 ITextDocument_fnGetIDsOfNames(ITextDocument
* me
, REFIID riid
,
1253 LPOLESTR
* rgszNames
, UINT cNames
, LCID lcid
, DISPID
* rgDispId
)
1255 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1256 FIXME("stub %p\n",This
);
1260 static HRESULT WINAPI
1261 ITextDocument_fnInvoke(ITextDocument
* me
, DISPID dispIdMember
,
1262 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
* pDispParams
,
1263 VARIANT
* pVarResult
, EXCEPINFO
* pExcepInfo
, UINT
* puArgErr
)
1265 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1266 FIXME("stub %p\n",This
);
1270 static HRESULT WINAPI
1271 ITextDocument_fnGetName(ITextDocument
* me
, BSTR
* pName
)
1273 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1274 FIXME("stub %p\n",This
);
1278 static HRESULT WINAPI
1279 ITextDocument_fnGetSelection(ITextDocument
* me
, ITextSelection
** ppSel
)
1281 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1282 TRACE("(%p)\n", me
);
1285 return E_INVALIDARG
;
1286 *ppSel
= &This
->txtSel
->ITextSelection_iface
;
1287 ITextSelection_AddRef(*ppSel
);
1291 static HRESULT WINAPI
1292 ITextDocument_fnGetStoryCount(ITextDocument
* me
, LONG
* pCount
)
1294 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1295 FIXME("stub %p\n",This
);
1299 static HRESULT WINAPI
1300 ITextDocument_fnGetStoryRanges(ITextDocument
* me
,
1301 ITextStoryRanges
** ppStories
)
1303 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1304 FIXME("stub %p\n",This
);
1308 static HRESULT WINAPI
1309 ITextDocument_fnGetSaved(ITextDocument
* me
, LONG
* pValue
)
1311 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1312 FIXME("stub %p\n",This
);
1316 static HRESULT WINAPI
1317 ITextDocument_fnSetSaved(ITextDocument
* me
, LONG Value
)
1319 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1320 FIXME("stub %p\n",This
);
1324 static HRESULT WINAPI
1325 ITextDocument_fnGetDefaultTabStop(ITextDocument
* me
, float* pValue
)
1327 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1328 FIXME("stub %p\n",This
);
1332 static HRESULT WINAPI
1333 ITextDocument_fnSetDefaultTabStop(ITextDocument
* me
, float Value
)
1335 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1336 FIXME("stub %p\n",This
);
1340 static HRESULT WINAPI
1341 ITextDocument_fnNew(ITextDocument
* me
)
1343 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1344 FIXME("stub %p\n",This
);
1348 static HRESULT WINAPI
1349 ITextDocument_fnOpen(ITextDocument
* me
, VARIANT
* pVar
, LONG Flags
,
1352 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1353 FIXME("stub %p\n",This
);
1357 static HRESULT WINAPI
1358 ITextDocument_fnSave(ITextDocument
* me
, VARIANT
* pVar
, LONG Flags
,
1361 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1362 FIXME("stub %p\n",This
);
1366 static HRESULT WINAPI
1367 ITextDocument_fnFreeze(ITextDocument
* me
, LONG
* pCount
)
1369 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1370 FIXME("stub %p\n",This
);
1374 static HRESULT WINAPI
1375 ITextDocument_fnUnfreeze(ITextDocument
* me
, LONG
* pCount
)
1377 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1378 FIXME("stub %p\n",This
);
1382 static HRESULT WINAPI
1383 ITextDocument_fnBeginEditCollection(ITextDocument
* me
)
1385 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1386 FIXME("stub %p\n",This
);
1390 static HRESULT WINAPI
1391 ITextDocument_fnEndEditCollection(ITextDocument
* me
)
1393 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1394 FIXME("stub %p\n",This
);
1398 static HRESULT WINAPI
1399 ITextDocument_fnUndo(ITextDocument
* me
, LONG Count
, LONG
* prop
)
1401 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1402 FIXME("stub %p\n",This
);
1406 static HRESULT WINAPI
1407 ITextDocument_fnRedo(ITextDocument
* me
, LONG Count
, LONG
* prop
)
1409 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1410 FIXME("stub %p\n",This
);
1414 static HRESULT
CreateITextRange(IRichEditOleImpl
*reOle
, LONG start
, LONG end
, ITextRange
** ppRange
)
1416 ITextRangeImpl
*txtRge
= heap_alloc(sizeof(ITextRangeImpl
));
1419 return E_OUTOFMEMORY
;
1420 txtRge
->ITextRange_iface
.lpVtbl
= &trvt
;
1422 txtRge
->reOle
= reOle
;
1423 txtRge
->start
= start
;
1425 list_add_head(&reOle
->rangelist
, &txtRge
->entry
);
1426 *ppRange
= &txtRge
->ITextRange_iface
;
1430 static HRESULT WINAPI
1431 ITextDocument_fnRange(ITextDocument
* me
, LONG cp1
, LONG cp2
,
1432 ITextRange
** ppRange
)
1434 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1435 const int len
= ME_GetTextLength(This
->editor
) + 1;
1437 TRACE("%p %p %d %d\n", This
, ppRange
, cp1
, cp2
);
1439 return E_INVALIDARG
;
1443 cp1
= min(cp1
, len
);
1444 cp2
= min(cp2
, len
);
1453 cp1
= cp2
= len
- 1;
1455 return CreateITextRange(This
, cp1
, cp2
, ppRange
);
1458 static HRESULT WINAPI
1459 ITextDocument_fnRangeFromPoint(ITextDocument
* me
, LONG x
, LONG y
,
1460 ITextRange
** ppRange
)
1462 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1463 FIXME("stub %p\n",This
);
1467 static const ITextDocumentVtbl tdvt
= {
1468 ITextDocument_fnQueryInterface
,
1469 ITextDocument_fnAddRef
,
1470 ITextDocument_fnRelease
,
1471 ITextDocument_fnGetTypeInfoCount
,
1472 ITextDocument_fnGetTypeInfo
,
1473 ITextDocument_fnGetIDsOfNames
,
1474 ITextDocument_fnInvoke
,
1475 ITextDocument_fnGetName
,
1476 ITextDocument_fnGetSelection
,
1477 ITextDocument_fnGetStoryCount
,
1478 ITextDocument_fnGetStoryRanges
,
1479 ITextDocument_fnGetSaved
,
1480 ITextDocument_fnSetSaved
,
1481 ITextDocument_fnGetDefaultTabStop
,
1482 ITextDocument_fnSetDefaultTabStop
,
1483 ITextDocument_fnNew
,
1484 ITextDocument_fnOpen
,
1485 ITextDocument_fnSave
,
1486 ITextDocument_fnFreeze
,
1487 ITextDocument_fnUnfreeze
,
1488 ITextDocument_fnBeginEditCollection
,
1489 ITextDocument_fnEndEditCollection
,
1490 ITextDocument_fnUndo
,
1491 ITextDocument_fnRedo
,
1492 ITextDocument_fnRange
,
1493 ITextDocument_fnRangeFromPoint
1496 static inline ITextSelectionImpl
*impl_from_ITextSelection(ITextSelection
*iface
)
1498 return CONTAINING_RECORD(iface
, ITextSelectionImpl
, ITextSelection_iface
);
1501 static HRESULT WINAPI
ITextSelection_fnQueryInterface(
1507 if (IsEqualGUID(riid
, &IID_IUnknown
)
1508 || IsEqualGUID(riid
, &IID_IDispatch
)
1509 || IsEqualGUID(riid
, &IID_ITextRange
)
1510 || IsEqualGUID(riid
, &IID_ITextSelection
))
1513 ITextSelection_AddRef(me
);
1517 return E_NOINTERFACE
;
1520 static ULONG WINAPI
ITextSelection_fnAddRef(ITextSelection
*me
)
1522 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1523 return InterlockedIncrement(&This
->ref
);
1526 static ULONG WINAPI
ITextSelection_fnRelease(ITextSelection
*me
)
1528 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1529 ULONG ref
= InterlockedDecrement(&This
->ref
);
1535 static HRESULT WINAPI
ITextSelection_fnGetTypeInfoCount(ITextSelection
*me
, UINT
*pctinfo
)
1537 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1539 return CO_E_RELEASED
;
1541 FIXME("not implemented\n");
1545 static HRESULT WINAPI
ITextSelection_fnGetTypeInfo(ITextSelection
*me
, UINT iTInfo
, LCID lcid
,
1546 ITypeInfo
**ppTInfo
)
1548 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1550 return CO_E_RELEASED
;
1552 FIXME("not implemented\n");
1556 static HRESULT WINAPI
ITextSelection_fnGetIDsOfNames(ITextSelection
*me
, REFIID riid
,
1557 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
1559 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1561 return CO_E_RELEASED
;
1563 FIXME("not implemented\n");
1567 static HRESULT WINAPI
ITextSelection_fnInvoke(
1569 DISPID dispIdMember
,
1573 DISPPARAMS
*pDispParams
,
1574 VARIANT
*pVarResult
,
1575 EXCEPINFO
*pExcepInfo
,
1578 FIXME("not implemented\n");
1582 /*** ITextRange methods ***/
1583 static HRESULT WINAPI
ITextSelection_fnGetText(ITextSelection
*me
, BSTR
*pbstr
)
1585 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1586 ME_Cursor
*start
= NULL
, *end
= NULL
;
1591 return CO_E_RELEASED
;
1592 TRACE("%p\n", pbstr
);
1594 return E_INVALIDARG
;
1596 ME_GetSelection(This
->reOle
->editor
, &start
, &end
);
1597 endOfs
= ME_GetCursorOfs(end
);
1598 nChars
= endOfs
- ME_GetCursorOfs(start
);
1605 *pbstr
= SysAllocStringLen(NULL
, nChars
);
1607 return E_OUTOFMEMORY
;
1609 bEOP
= (end
->pRun
->next
->type
== diTextEnd
&& endOfs
> ME_GetTextLength(This
->reOle
->editor
));
1610 ME_GetTextW(This
->reOle
->editor
, *pbstr
, nChars
, start
, nChars
, FALSE
, bEOP
);
1611 TRACE("%s\n", wine_dbgstr_w(*pbstr
));
1616 static HRESULT WINAPI
ITextSelection_fnSetText(ITextSelection
*me
, BSTR bstr
)
1618 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1620 return CO_E_RELEASED
;
1622 FIXME("not implemented\n");
1626 static HRESULT WINAPI
ITextSelection_fnGetChar(ITextSelection
*me
, LONG
*pch
)
1628 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1629 ME_Cursor
*start
= NULL
, *end
= NULL
;
1632 return CO_E_RELEASED
;
1635 return E_INVALIDARG
;
1637 ME_GetSelection(This
->reOle
->editor
, &start
, &end
);
1638 return range_GetChar(This
->reOle
->editor
, start
, pch
);
1641 static HRESULT WINAPI
ITextSelection_fnSetChar(ITextSelection
*me
, LONG ch
)
1643 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1645 return CO_E_RELEASED
;
1647 FIXME("not implemented\n");
1651 static HRESULT WINAPI
ITextSelection_fnGetDuplicate(ITextSelection
*me
, ITextRange
**ppRange
)
1653 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1655 return CO_E_RELEASED
;
1657 FIXME("not implemented\n");
1661 static HRESULT WINAPI
ITextSelection_fnGetFormattedText(ITextSelection
*me
, ITextRange
**ppRange
)
1663 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1665 return CO_E_RELEASED
;
1667 FIXME("not implemented\n");
1671 static HRESULT WINAPI
ITextSelection_fnSetFormattedText(ITextSelection
*me
, ITextRange
*pRange
)
1673 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1675 return CO_E_RELEASED
;
1677 FIXME("not implemented\n");
1681 static HRESULT WINAPI
ITextSelection_fnGetStart(ITextSelection
*me
, LONG
*pcpFirst
)
1683 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1686 return CO_E_RELEASED
;
1689 return E_INVALIDARG
;
1690 ME_GetSelectionOfs(This
->reOle
->editor
, pcpFirst
, &lim
);
1691 TRACE("%d\n", *pcpFirst
);
1695 static HRESULT WINAPI
ITextSelection_fnSetStart(ITextSelection
*me
, LONG cpFirst
)
1697 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1699 return CO_E_RELEASED
;
1701 FIXME("not implemented\n");
1705 static HRESULT WINAPI
ITextSelection_fnGetEnd(ITextSelection
*me
, LONG
*pcpLim
)
1707 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1710 return CO_E_RELEASED
;
1713 return E_INVALIDARG
;
1714 ME_GetSelectionOfs(This
->reOle
->editor
, &first
, pcpLim
);
1715 TRACE("%d\n", *pcpLim
);
1719 static HRESULT WINAPI
ITextSelection_fnSetEnd(ITextSelection
*me
, LONG cpLim
)
1721 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1723 return CO_E_RELEASED
;
1725 FIXME("not implemented\n");
1729 static HRESULT WINAPI
ITextSelection_fnGetFont(ITextSelection
*me
, ITextFont
**pFont
)
1731 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1733 return CO_E_RELEASED
;
1735 FIXME("not implemented\n");
1739 static HRESULT WINAPI
ITextSelection_fnSetFont(ITextSelection
*me
, ITextFont
*pFont
)
1741 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1743 return CO_E_RELEASED
;
1745 FIXME("not implemented\n");
1749 static HRESULT WINAPI
ITextSelection_fnGetPara(ITextSelection
*me
, ITextPara
**ppPara
)
1751 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1753 return CO_E_RELEASED
;
1755 FIXME("not implemented\n");
1759 static HRESULT WINAPI
ITextSelection_fnSetPara(ITextSelection
*me
, ITextPara
*pPara
)
1761 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1763 return CO_E_RELEASED
;
1765 FIXME("not implemented\n");
1769 static HRESULT WINAPI
ITextSelection_fnGetStoryLength(ITextSelection
*me
, LONG
*pcch
)
1771 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1773 return CO_E_RELEASED
;
1775 FIXME("not implemented\n");
1779 static HRESULT WINAPI
ITextSelection_fnGetStoryType(ITextSelection
*me
, LONG
*pValue
)
1781 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1783 return CO_E_RELEASED
;
1785 FIXME("not implemented\n");
1789 static HRESULT WINAPI
ITextSelection_fnCollapse(ITextSelection
*me
, LONG bStart
)
1791 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1795 return CO_E_RELEASED
;
1797 ME_GetSelectionOfs(This
->reOle
->editor
, &start
, &end
);
1798 hres
= range_Collapse(bStart
, &start
, &end
);
1799 if (SUCCEEDED(hres
))
1800 ME_SetSelection(This
->reOle
->editor
, start
, end
);
1804 static HRESULT WINAPI
ITextSelection_fnExpand(ITextSelection
*me
, LONG Unit
, LONG
*pDelta
)
1806 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1808 return CO_E_RELEASED
;
1810 FIXME("not implemented\n");
1814 static HRESULT WINAPI
ITextSelection_fnGetIndex(ITextSelection
*me
, LONG Unit
, LONG
*pIndex
)
1816 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1818 return CO_E_RELEASED
;
1820 FIXME("not implemented\n");
1824 static HRESULT WINAPI
ITextSelection_fnSetIndex(ITextSelection
*me
, LONG Unit
, LONG Index
,
1827 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1829 return CO_E_RELEASED
;
1831 FIXME("not implemented\n");
1835 static HRESULT WINAPI
ITextSelection_fnSetRange(ITextSelection
*me
, LONG cpActive
, LONG cpOther
)
1837 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1839 return CO_E_RELEASED
;
1841 FIXME("not implemented\n");
1845 static HRESULT WINAPI
ITextSelection_fnInRange(ITextSelection
*me
, ITextRange
*pRange
, LONG
*pb
)
1847 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1849 return CO_E_RELEASED
;
1851 FIXME("not implemented\n");
1855 static HRESULT WINAPI
ITextSelection_fnInStory(ITextSelection
*me
, ITextRange
*pRange
, LONG
*pb
)
1857 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1859 return CO_E_RELEASED
;
1861 FIXME("not implemented\n");
1865 static HRESULT WINAPI
ITextSelection_fnIsEqual(ITextSelection
*me
, ITextRange
*pRange
, LONG
*pb
)
1867 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1869 return CO_E_RELEASED
;
1871 FIXME("not implemented\n");
1875 static HRESULT WINAPI
ITextSelection_fnSelect(ITextSelection
*me
)
1877 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1879 return CO_E_RELEASED
;
1881 FIXME("not implemented\n");
1885 static HRESULT WINAPI
ITextSelection_fnStartOf(ITextSelection
*me
, LONG Unit
, LONG Extend
,
1888 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1890 return CO_E_RELEASED
;
1892 FIXME("not implemented\n");
1896 static HRESULT WINAPI
ITextSelection_fnEndOf(ITextSelection
*me
, LONG Unit
, LONG Extend
,
1899 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1901 return CO_E_RELEASED
;
1903 FIXME("not implemented\n");
1907 static HRESULT WINAPI
ITextSelection_fnMove(ITextSelection
*me
, LONG Unit
, LONG Count
, LONG
*pDelta
)
1909 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1911 return CO_E_RELEASED
;
1913 FIXME("not implemented\n");
1917 static HRESULT WINAPI
ITextSelection_fnMoveStart(ITextSelection
*me
, LONG Unit
, LONG Count
,
1920 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1922 return CO_E_RELEASED
;
1924 FIXME("not implemented\n");
1928 static HRESULT WINAPI
ITextSelection_fnMoveEnd(ITextSelection
*me
, LONG Unit
, LONG Count
,
1931 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1933 return CO_E_RELEASED
;
1935 FIXME("not implemented\n");
1939 static HRESULT WINAPI
ITextSelection_fnMoveWhile(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1942 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1944 return CO_E_RELEASED
;
1946 FIXME("not implemented\n");
1950 static HRESULT WINAPI
ITextSelection_fnMoveStartWhile(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1953 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1955 return CO_E_RELEASED
;
1957 FIXME("not implemented\n");
1961 static HRESULT WINAPI
ITextSelection_fnMoveEndWhile(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1964 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1966 return CO_E_RELEASED
;
1968 FIXME("not implemented\n");
1972 static HRESULT WINAPI
ITextSelection_fnMoveUntil(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1975 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1977 return CO_E_RELEASED
;
1979 FIXME("not implemented\n");
1983 static HRESULT WINAPI
ITextSelection_fnMoveStartUntil(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1986 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1988 return CO_E_RELEASED
;
1990 FIXME("not implemented\n");
1994 static HRESULT WINAPI
ITextSelection_fnMoveEndUntil(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1997 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1999 return CO_E_RELEASED
;
2001 FIXME("not implemented\n");
2005 static HRESULT WINAPI
ITextSelection_fnFindText(ITextSelection
*me
, BSTR bstr
, LONG cch
, LONG Flags
,
2008 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2010 return CO_E_RELEASED
;
2012 FIXME("not implemented\n");
2016 static HRESULT WINAPI
ITextSelection_fnFindTextStart(ITextSelection
*me
, BSTR bstr
, LONG cch
,
2017 LONG Flags
, LONG
*pLength
)
2019 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2021 return CO_E_RELEASED
;
2023 FIXME("not implemented\n");
2027 static HRESULT WINAPI
ITextSelection_fnFindTextEnd(ITextSelection
*me
, BSTR bstr
, LONG cch
,
2028 LONG Flags
, LONG
*pLength
)
2030 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2032 return CO_E_RELEASED
;
2034 FIXME("not implemented\n");
2038 static HRESULT WINAPI
ITextSelection_fnDelete(ITextSelection
*me
, LONG Unit
, LONG Count
,
2041 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2043 return CO_E_RELEASED
;
2045 FIXME("not implemented\n");
2049 static HRESULT WINAPI
ITextSelection_fnCut(ITextSelection
*me
, VARIANT
*pVar
)
2051 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2053 return CO_E_RELEASED
;
2055 FIXME("not implemented\n");
2059 static HRESULT WINAPI
ITextSelection_fnCopy(ITextSelection
*me
, VARIANT
*pVar
)
2061 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2063 return CO_E_RELEASED
;
2065 FIXME("not implemented\n");
2069 static HRESULT WINAPI
ITextSelection_fnPaste(ITextSelection
*me
, VARIANT
*pVar
, LONG Format
)
2071 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2073 return CO_E_RELEASED
;
2075 FIXME("not implemented\n");
2079 static HRESULT WINAPI
ITextSelection_fnCanPaste(ITextSelection
*me
, VARIANT
*pVar
, LONG Format
,
2082 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2084 return CO_E_RELEASED
;
2086 FIXME("not implemented\n");
2090 static HRESULT WINAPI
ITextSelection_fnCanEdit(ITextSelection
*me
, LONG
*pb
)
2092 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2094 return CO_E_RELEASED
;
2096 FIXME("not implemented\n");
2100 static HRESULT WINAPI
ITextSelection_fnChangeCase(ITextSelection
*me
, LONG Type
)
2102 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2104 return CO_E_RELEASED
;
2106 FIXME("not implemented\n");
2110 static HRESULT WINAPI
ITextSelection_fnGetPoint(ITextSelection
*me
, LONG Type
, LONG
*cx
, LONG
*cy
)
2112 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2114 return CO_E_RELEASED
;
2116 FIXME("not implemented\n");
2120 static HRESULT WINAPI
ITextSelection_fnSetPoint(ITextSelection
*me
, LONG x
, LONG y
, LONG Type
,
2123 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2125 return CO_E_RELEASED
;
2127 FIXME("not implemented\n");
2131 static HRESULT WINAPI
ITextSelection_fnScrollIntoView(ITextSelection
*me
, LONG Value
)
2133 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2135 return CO_E_RELEASED
;
2137 FIXME("not implemented\n");
2141 static HRESULT WINAPI
ITextSelection_fnGetEmbeddedObject(ITextSelection
*me
, IUnknown
**ppv
)
2143 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2145 return CO_E_RELEASED
;
2147 FIXME("not implemented\n");
2151 /*** ITextSelection methods ***/
2152 static HRESULT WINAPI
ITextSelection_fnGetFlags(ITextSelection
*me
, LONG
*pFlags
)
2154 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2156 return CO_E_RELEASED
;
2158 FIXME("not implemented\n");
2162 static HRESULT WINAPI
ITextSelection_fnSetFlags(ITextSelection
*me
, LONG Flags
)
2164 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2166 return CO_E_RELEASED
;
2168 FIXME("not implemented\n");
2172 static HRESULT WINAPI
ITextSelection_fnGetType(ITextSelection
*me
, LONG
*pType
)
2174 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2176 return CO_E_RELEASED
;
2178 FIXME("not implemented\n");
2182 static HRESULT WINAPI
ITextSelection_fnMoveLeft(ITextSelection
*me
, LONG Unit
, LONG Count
,
2183 LONG Extend
, LONG
*pDelta
)
2185 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2187 return CO_E_RELEASED
;
2189 FIXME("not implemented\n");
2193 static HRESULT WINAPI
ITextSelection_fnMoveRight(ITextSelection
*me
, LONG Unit
, LONG Count
,
2194 LONG Extend
, LONG
*pDelta
)
2196 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2198 return CO_E_RELEASED
;
2200 FIXME("not implemented\n");
2204 static HRESULT WINAPI
ITextSelection_fnMoveUp(ITextSelection
*me
, LONG Unit
, LONG Count
,
2205 LONG Extend
, LONG
*pDelta
)
2207 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2209 return CO_E_RELEASED
;
2211 FIXME("not implemented\n");
2215 static HRESULT WINAPI
ITextSelection_fnMoveDown(ITextSelection
*me
, LONG Unit
, LONG Count
,
2216 LONG Extend
, LONG
*pDelta
)
2218 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2220 return CO_E_RELEASED
;
2222 FIXME("not implemented\n");
2226 static HRESULT WINAPI
ITextSelection_fnHomeKey(ITextSelection
*me
, LONG Unit
, LONG Extend
,
2229 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2231 return CO_E_RELEASED
;
2233 FIXME("not implemented\n");
2237 static HRESULT WINAPI
ITextSelection_fnEndKey(ITextSelection
*me
, LONG Unit
, LONG Extend
,
2240 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2242 return CO_E_RELEASED
;
2244 FIXME("not implemented\n");
2248 static HRESULT WINAPI
ITextSelection_fnTypeText(ITextSelection
*me
, BSTR bstr
)
2250 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2252 return CO_E_RELEASED
;
2254 FIXME("not implemented\n");
2258 static const ITextSelectionVtbl tsvt
= {
2259 ITextSelection_fnQueryInterface
,
2260 ITextSelection_fnAddRef
,
2261 ITextSelection_fnRelease
,
2262 ITextSelection_fnGetTypeInfoCount
,
2263 ITextSelection_fnGetTypeInfo
,
2264 ITextSelection_fnGetIDsOfNames
,
2265 ITextSelection_fnInvoke
,
2266 ITextSelection_fnGetText
,
2267 ITextSelection_fnSetText
,
2268 ITextSelection_fnGetChar
,
2269 ITextSelection_fnSetChar
,
2270 ITextSelection_fnGetDuplicate
,
2271 ITextSelection_fnGetFormattedText
,
2272 ITextSelection_fnSetFormattedText
,
2273 ITextSelection_fnGetStart
,
2274 ITextSelection_fnSetStart
,
2275 ITextSelection_fnGetEnd
,
2276 ITextSelection_fnSetEnd
,
2277 ITextSelection_fnGetFont
,
2278 ITextSelection_fnSetFont
,
2279 ITextSelection_fnGetPara
,
2280 ITextSelection_fnSetPara
,
2281 ITextSelection_fnGetStoryLength
,
2282 ITextSelection_fnGetStoryType
,
2283 ITextSelection_fnCollapse
,
2284 ITextSelection_fnExpand
,
2285 ITextSelection_fnGetIndex
,
2286 ITextSelection_fnSetIndex
,
2287 ITextSelection_fnSetRange
,
2288 ITextSelection_fnInRange
,
2289 ITextSelection_fnInStory
,
2290 ITextSelection_fnIsEqual
,
2291 ITextSelection_fnSelect
,
2292 ITextSelection_fnStartOf
,
2293 ITextSelection_fnEndOf
,
2294 ITextSelection_fnMove
,
2295 ITextSelection_fnMoveStart
,
2296 ITextSelection_fnMoveEnd
,
2297 ITextSelection_fnMoveWhile
,
2298 ITextSelection_fnMoveStartWhile
,
2299 ITextSelection_fnMoveEndWhile
,
2300 ITextSelection_fnMoveUntil
,
2301 ITextSelection_fnMoveStartUntil
,
2302 ITextSelection_fnMoveEndUntil
,
2303 ITextSelection_fnFindText
,
2304 ITextSelection_fnFindTextStart
,
2305 ITextSelection_fnFindTextEnd
,
2306 ITextSelection_fnDelete
,
2307 ITextSelection_fnCut
,
2308 ITextSelection_fnCopy
,
2309 ITextSelection_fnPaste
,
2310 ITextSelection_fnCanPaste
,
2311 ITextSelection_fnCanEdit
,
2312 ITextSelection_fnChangeCase
,
2313 ITextSelection_fnGetPoint
,
2314 ITextSelection_fnSetPoint
,
2315 ITextSelection_fnScrollIntoView
,
2316 ITextSelection_fnGetEmbeddedObject
,
2317 ITextSelection_fnGetFlags
,
2318 ITextSelection_fnSetFlags
,
2319 ITextSelection_fnGetType
,
2320 ITextSelection_fnMoveLeft
,
2321 ITextSelection_fnMoveRight
,
2322 ITextSelection_fnMoveUp
,
2323 ITextSelection_fnMoveDown
,
2324 ITextSelection_fnHomeKey
,
2325 ITextSelection_fnEndKey
,
2326 ITextSelection_fnTypeText
2329 static ITextSelectionImpl
*
2330 CreateTextSelection(IRichEditOleImpl
*reOle
)
2332 ITextSelectionImpl
*txtSel
= heap_alloc(sizeof *txtSel
);
2336 txtSel
->ITextSelection_iface
.lpVtbl
= &tsvt
;
2338 txtSel
->reOle
= reOle
;
2342 LRESULT
CreateIRichEditOle(IUnknown
*outer_unk
, ME_TextEditor
*editor
, LPVOID
*ppvObj
)
2344 IRichEditOleImpl
*reo
;
2346 reo
= heap_alloc(sizeof(IRichEditOleImpl
));
2350 reo
->IUnknown_inner
.lpVtbl
= &reo_unk_vtbl
;
2351 reo
->IRichEditOle_iface
.lpVtbl
= &revt
;
2352 reo
->ITextDocument_iface
.lpVtbl
= &tdvt
;
2354 reo
->editor
= editor
;
2355 reo
->txtSel
= CreateTextSelection(reo
);
2361 reo
->clientSite
= CreateOleClientSite(reo
);
2362 if (!reo
->clientSite
)
2364 ITextSelection_Release(&reo
->txtSel
->ITextSelection_iface
);
2368 TRACE("Created %p\n",reo
);
2369 list_init(&reo
->rangelist
);
2371 reo
->outer_unk
= outer_unk
;
2373 reo
->outer_unk
= &reo
->IUnknown_inner
;
2374 *ppvObj
= &reo
->IRichEditOle_iface
;
2379 static void convert_sizel(const ME_Context
*c
, const SIZEL
* szl
, SIZE
* sz
)
2381 /* sizel is in .01 millimeters, sz in pixels */
2382 sz
->cx
= MulDiv(szl
->cx
, c
->dpi
.cx
, 2540);
2383 sz
->cy
= MulDiv(szl
->cy
, c
->dpi
.cy
, 2540);
2386 /******************************************************************************
2387 * ME_GetOLEObjectSize
2389 * Sets run extent for OLE objects.
2391 void ME_GetOLEObjectSize(const ME_Context
*c
, ME_Run
*run
, SIZE
*pSize
)
2399 assert(run
->nFlags
& MERF_GRAPHICS
);
2400 assert(run
->ole_obj
);
2402 if (run
->ole_obj
->sizel
.cx
!= 0 || run
->ole_obj
->sizel
.cy
!= 0)
2404 convert_sizel(c
, &run
->ole_obj
->sizel
, pSize
);
2405 if (c
->editor
->nZoomNumerator
!= 0)
2407 pSize
->cx
= MulDiv(pSize
->cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2408 pSize
->cy
= MulDiv(pSize
->cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2413 if (IOleObject_QueryInterface(run
->ole_obj
->poleobj
, &IID_IDataObject
, (void**)&ido
) != S_OK
)
2415 FIXME("Query Interface IID_IDataObject failed!\n");
2416 pSize
->cx
= pSize
->cy
= 0;
2419 fmt
.cfFormat
= CF_BITMAP
;
2421 fmt
.dwAspect
= DVASPECT_CONTENT
;
2423 fmt
.tymed
= TYMED_GDI
;
2424 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
2426 fmt
.cfFormat
= CF_ENHMETAFILE
;
2427 fmt
.tymed
= TYMED_ENHMF
;
2428 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
2430 FIXME("unsupported format\n");
2431 pSize
->cx
= pSize
->cy
= 0;
2432 IDataObject_Release(ido
);
2440 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
2441 pSize
->cx
= dibsect
.dsBm
.bmWidth
;
2442 pSize
->cy
= dibsect
.dsBm
.bmHeight
;
2443 if (!stgm
.pUnkForRelease
) DeleteObject(stgm
.u
.hBitmap
);
2446 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
2447 pSize
->cx
= emh
.rclBounds
.right
- emh
.rclBounds
.left
;
2448 pSize
->cy
= emh
.rclBounds
.bottom
- emh
.rclBounds
.top
;
2449 if (!stgm
.pUnkForRelease
) DeleteEnhMetaFile(stgm
.u
.hEnhMetaFile
);
2452 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
2455 IDataObject_Release(ido
);
2456 if (c
->editor
->nZoomNumerator
!= 0)
2458 pSize
->cx
= MulDiv(pSize
->cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2459 pSize
->cy
= MulDiv(pSize
->cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2463 void ME_DrawOLE(ME_Context
*c
, int x
, int y
, ME_Run
*run
,
2464 ME_Paragraph
*para
, BOOL selected
)
2475 assert(run
->nFlags
& MERF_GRAPHICS
);
2476 assert(run
->ole_obj
);
2477 if (IOleObject_QueryInterface(run
->ole_obj
->poleobj
, &IID_IDataObject
, (void**)&ido
) != S_OK
)
2479 FIXME("Couldn't get interface\n");
2482 has_size
= run
->ole_obj
->sizel
.cx
!= 0 || run
->ole_obj
->sizel
.cy
!= 0;
2483 fmt
.cfFormat
= CF_BITMAP
;
2485 fmt
.dwAspect
= DVASPECT_CONTENT
;
2487 fmt
.tymed
= TYMED_GDI
;
2488 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
2490 fmt
.cfFormat
= CF_ENHMETAFILE
;
2491 fmt
.tymed
= TYMED_ENHMF
;
2492 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
2494 FIXME("Couldn't get storage medium\n");
2495 IDataObject_Release(ido
);
2502 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
2503 hMemDC
= CreateCompatibleDC(c
->hDC
);
2504 SelectObject(hMemDC
, stgm
.u
.hBitmap
);
2507 convert_sizel(c
, &run
->ole_obj
->sizel
, &sz
);
2509 sz
.cx
= MulDiv(dibsect
.dsBm
.bmWidth
, c
->dpi
.cx
, 96);
2510 sz
.cy
= MulDiv(dibsect
.dsBm
.bmHeight
, c
->dpi
.cy
, 96);
2512 if (c
->editor
->nZoomNumerator
!= 0)
2514 sz
.cx
= MulDiv(sz
.cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2515 sz
.cy
= MulDiv(sz
.cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2517 if (sz
.cx
== dibsect
.dsBm
.bmWidth
&& sz
.cy
== dibsect
.dsBm
.bmHeight
)
2519 BitBlt(c
->hDC
, x
, y
- sz
.cy
,
2520 dibsect
.dsBm
.bmWidth
, dibsect
.dsBm
.bmHeight
,
2521 hMemDC
, 0, 0, SRCCOPY
);
2523 StretchBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
,
2524 hMemDC
, 0, 0, dibsect
.dsBm
.bmWidth
,
2525 dibsect
.dsBm
.bmHeight
, SRCCOPY
);
2528 if (!stgm
.pUnkForRelease
) DeleteObject(stgm
.u
.hBitmap
);
2531 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
2534 convert_sizel(c
, &run
->ole_obj
->sizel
, &sz
);
2536 sz
.cy
= MulDiv(emh
.rclBounds
.bottom
- emh
.rclBounds
.top
, c
->dpi
.cx
, 96);
2537 sz
.cx
= MulDiv(emh
.rclBounds
.right
- emh
.rclBounds
.left
, c
->dpi
.cy
, 96);
2539 if (c
->editor
->nZoomNumerator
!= 0)
2541 sz
.cx
= MulDiv(sz
.cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2542 sz
.cy
= MulDiv(sz
.cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2550 rc
.right
= x
+ sz
.cx
;
2552 PlayEnhMetaFile(c
->hDC
, stgm
.u
.hEnhMetaFile
, &rc
);
2554 if (!stgm
.pUnkForRelease
) DeleteEnhMetaFile(stgm
.u
.hEnhMetaFile
);
2557 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
2561 if (selected
&& !c
->editor
->bHideSelection
)
2562 PatBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
, DSTINVERT
);
2563 IDataObject_Release(ido
);
2566 void ME_DeleteReObject(REOBJECT
* reo
)
2568 if (reo
->poleobj
) IOleObject_Release(reo
->poleobj
);
2569 if (reo
->pstg
) IStorage_Release(reo
->pstg
);
2570 if (reo
->polesite
) IOleClientSite_Release(reo
->polesite
);
2574 void ME_CopyReObject(REOBJECT
* dst
, const REOBJECT
* src
)
2578 if (dst
->poleobj
) IOleObject_AddRef(dst
->poleobj
);
2579 if (dst
->pstg
) IStorage_AddRef(dst
->pstg
);
2580 if (dst
->polesite
) IOleClientSite_AddRef(dst
->polesite
);
2583 void ME_GetITextDocumentInterface(IRichEditOle
*iface
, LPVOID
*ppvObj
)
2585 IRichEditOleImpl
*This
= impl_from_IRichEditOle(iface
);
2586 *ppvObj
= &This
->ITextDocument_iface
;