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
);
146 DestroyIRichEditOle(&This
->IRichEditOle_iface
);
150 static const IUnknownVtbl reo_unk_vtbl
=
152 IRichEditOleImpl_inner_fnQueryInterface
,
153 IRichEditOleImpl_inner_fnAddRef
,
154 IRichEditOleImpl_inner_fnRelease
157 static HRESULT WINAPI
158 IRichEditOle_fnQueryInterface(IRichEditOle
*me
, REFIID riid
, LPVOID
*ppvObj
)
160 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
161 return IUnknown_QueryInterface(This
->outer_unk
, riid
, ppvObj
);
165 IRichEditOle_fnAddRef(IRichEditOle
*me
)
167 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
168 return IUnknown_AddRef(This
->outer_unk
);
172 IRichEditOle_fnRelease(IRichEditOle
*me
)
174 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
175 return IUnknown_Release(This
->outer_unk
);
178 static HRESULT WINAPI
179 IRichEditOle_fnActivateAs(IRichEditOle
*me
, REFCLSID rclsid
, REFCLSID rclsidAs
)
181 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
182 FIXME("stub %p\n",This
);
186 static HRESULT WINAPI
187 IRichEditOle_fnContextSensitiveHelp(IRichEditOle
*me
, BOOL fEnterMode
)
189 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
190 FIXME("stub %p\n",This
);
194 static HRESULT WINAPI
195 IRichEditOle_fnConvertObject(IRichEditOle
*me
, LONG iob
,
196 REFCLSID rclsidNew
, LPCSTR lpstrUserTypeNew
)
198 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
199 FIXME("stub %p\n",This
);
203 static inline IOleClientSiteImpl
*impl_from_IOleClientSite(IOleClientSite
*iface
)
205 return CONTAINING_RECORD(iface
, IOleClientSiteImpl
, IOleClientSite_iface
);
208 static HRESULT WINAPI
209 IOleClientSite_fnQueryInterface(IOleClientSite
*me
, REFIID riid
, LPVOID
*ppvObj
)
211 TRACE("%p %s\n", me
, debugstr_guid(riid
) );
214 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
215 IsEqualGUID(riid
, &IID_IOleClientSite
))
219 IOleClientSite_AddRef(me
);
222 FIXME("%p: unhandled interface %s\n", me
, debugstr_guid(riid
) );
224 return E_NOINTERFACE
;
227 static ULONG WINAPI
IOleClientSite_fnAddRef(IOleClientSite
*iface
)
229 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
230 return InterlockedIncrement(&This
->ref
);
233 static ULONG WINAPI
IOleClientSite_fnRelease(IOleClientSite
*iface
)
235 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
236 ULONG ref
= InterlockedDecrement(&This
->ref
);
242 static HRESULT WINAPI
IOleClientSite_fnSaveObject(IOleClientSite
*iface
)
244 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
246 return CO_E_RELEASED
;
248 FIXME("stub %p\n", iface
);
253 static HRESULT WINAPI
IOleClientSite_fnGetMoniker(IOleClientSite
*iface
, DWORD dwAssign
,
254 DWORD dwWhichMoniker
, IMoniker
**ppmk
)
256 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
258 return CO_E_RELEASED
;
260 FIXME("stub %p\n", iface
);
264 static HRESULT WINAPI
IOleClientSite_fnGetContainer(IOleClientSite
*iface
,
265 IOleContainer
**ppContainer
)
267 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
269 return CO_E_RELEASED
;
271 FIXME("stub %p\n", iface
);
275 static HRESULT WINAPI
IOleClientSite_fnShowObject(IOleClientSite
*iface
)
277 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
279 return CO_E_RELEASED
;
281 FIXME("stub %p\n", iface
);
285 static HRESULT WINAPI
IOleClientSite_fnOnShowWindow(IOleClientSite
*iface
, BOOL fShow
)
287 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
289 return CO_E_RELEASED
;
291 FIXME("stub %p\n", iface
);
295 static HRESULT WINAPI
IOleClientSite_fnRequestNewObjectLayout(IOleClientSite
*iface
)
297 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
299 return CO_E_RELEASED
;
301 FIXME("stub %p\n", iface
);
305 static const IOleClientSiteVtbl ocst
= {
306 IOleClientSite_fnQueryInterface
,
307 IOleClientSite_fnAddRef
,
308 IOleClientSite_fnRelease
,
309 IOleClientSite_fnSaveObject
,
310 IOleClientSite_fnGetMoniker
,
311 IOleClientSite_fnGetContainer
,
312 IOleClientSite_fnShowObject
,
313 IOleClientSite_fnOnShowWindow
,
314 IOleClientSite_fnRequestNewObjectLayout
317 static IOleClientSiteImpl
*
318 CreateOleClientSite(IRichEditOleImpl
*reOle
)
320 IOleClientSiteImpl
*clientSite
= heap_alloc(sizeof *clientSite
);
324 clientSite
->IOleClientSite_iface
.lpVtbl
= &ocst
;
326 clientSite
->reOle
= reOle
;
330 static HRESULT WINAPI
331 IRichEditOle_fnGetClientSite(IRichEditOle
*me
,
332 LPOLECLIENTSITE
*lplpolesite
)
334 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
336 TRACE("%p,%p\n",This
, lplpolesite
);
340 *lplpolesite
= &This
->clientSite
->IOleClientSite_iface
;
341 IOleClientSite_AddRef(*lplpolesite
);
345 static HRESULT WINAPI
346 IRichEditOle_fnGetClipboardData(IRichEditOle
*me
, CHARRANGE
*lpchrg
,
347 DWORD reco
, LPDATAOBJECT
*lplpdataobj
)
349 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
353 TRACE("(%p,%p,%d)\n",This
, lpchrg
, reco
);
357 int nFrom
, nTo
, nStartCur
= ME_GetSelectionOfs(This
->editor
, &nFrom
, &nTo
);
358 start
= This
->editor
->pCursors
[nStartCur
];
359 nChars
= nTo
- nFrom
;
361 ME_CursorFromCharOfs(This
->editor
, lpchrg
->cpMin
, &start
);
362 nChars
= lpchrg
->cpMax
- lpchrg
->cpMin
;
364 return ME_GetDataObject(This
->editor
, &start
, nChars
, lplpdataobj
);
367 static LONG WINAPI
IRichEditOle_fnGetLinkCount(IRichEditOle
*me
)
369 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
370 FIXME("stub %p\n",This
);
374 static HRESULT WINAPI
375 IRichEditOle_fnGetObject(IRichEditOle
*me
, LONG iob
,
376 REOBJECT
*lpreobject
, DWORD dwFlags
)
378 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
379 FIXME("stub %p\n",This
);
384 IRichEditOle_fnGetObjectCount(IRichEditOle
*me
)
386 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
387 FIXME("stub %p\n",This
);
391 static HRESULT WINAPI
392 IRichEditOle_fnHandsOffStorage(IRichEditOle
*me
, LONG iob
)
394 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
395 FIXME("stub %p\n",This
);
399 static HRESULT WINAPI
400 IRichEditOle_fnImportDataObject(IRichEditOle
*me
, LPDATAOBJECT lpdataobj
,
401 CLIPFORMAT cf
, HGLOBAL hMetaPict
)
403 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
404 FIXME("stub %p\n",This
);
408 static HRESULT WINAPI
409 IRichEditOle_fnInPlaceDeactivate(IRichEditOle
*me
)
411 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
412 FIXME("stub %p\n",This
);
416 static HRESULT WINAPI
417 IRichEditOle_fnInsertObject(IRichEditOle
*me
, REOBJECT
*reo
)
419 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
420 TRACE("(%p,%p)\n", This
, reo
);
422 if (reo
->cbStruct
< sizeof(*reo
)) return STG_E_INVALIDPARAMETER
;
424 ME_InsertOLEFromCursor(This
->editor
, reo
, 0);
425 ME_CommitUndo(This
->editor
);
426 ME_UpdateRepaint(This
->editor
, FALSE
);
430 static HRESULT WINAPI
IRichEditOle_fnSaveCompleted(IRichEditOle
*me
, LONG iob
,
433 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
434 FIXME("stub %p\n",This
);
438 static HRESULT WINAPI
439 IRichEditOle_fnSetDvaspect(IRichEditOle
*me
, LONG iob
, DWORD dvaspect
)
441 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
442 FIXME("stub %p\n",This
);
446 static HRESULT WINAPI
IRichEditOle_fnSetHostNames(IRichEditOle
*me
,
447 LPCSTR lpstrContainerApp
, LPCSTR lpstrContainerObj
)
449 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
450 FIXME("stub %p %s %s\n",This
, lpstrContainerApp
, lpstrContainerObj
);
454 static HRESULT WINAPI
455 IRichEditOle_fnSetLinkAvailable(IRichEditOle
*me
, LONG iob
, BOOL fAvailable
)
457 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
458 FIXME("stub %p\n",This
);
462 static const IRichEditOleVtbl revt
= {
463 IRichEditOle_fnQueryInterface
,
464 IRichEditOle_fnAddRef
,
465 IRichEditOle_fnRelease
,
466 IRichEditOle_fnGetClientSite
,
467 IRichEditOle_fnGetObjectCount
,
468 IRichEditOle_fnGetLinkCount
,
469 IRichEditOle_fnGetObject
,
470 IRichEditOle_fnInsertObject
,
471 IRichEditOle_fnConvertObject
,
472 IRichEditOle_fnActivateAs
,
473 IRichEditOle_fnSetHostNames
,
474 IRichEditOle_fnSetLinkAvailable
,
475 IRichEditOle_fnSetDvaspect
,
476 IRichEditOle_fnHandsOffStorage
,
477 IRichEditOle_fnSaveCompleted
,
478 IRichEditOle_fnInPlaceDeactivate
,
479 IRichEditOle_fnContextSensitiveHelp
,
480 IRichEditOle_fnGetClipboardData
,
481 IRichEditOle_fnImportDataObject
484 /* ITextRange interface */
485 static inline ITextRangeImpl
*impl_from_ITextRange(ITextRange
*iface
)
487 return CONTAINING_RECORD(iface
, ITextRangeImpl
, ITextRange_iface
);
490 static HRESULT WINAPI
ITextRange_fnQueryInterface(ITextRange
*me
, REFIID riid
, void **ppvObj
)
493 if (IsEqualGUID(riid
, &IID_IUnknown
)
494 || IsEqualGUID(riid
, &IID_IDispatch
)
495 || IsEqualGUID(riid
, &IID_ITextRange
))
498 ITextRange_AddRef(me
);
502 return E_NOINTERFACE
;
505 static ULONG WINAPI
ITextRange_fnAddRef(ITextRange
*me
)
507 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
508 return InterlockedIncrement(&This
->ref
);
511 static ULONG WINAPI
ITextRange_fnRelease(ITextRange
*me
)
513 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
514 ULONG ref
= InterlockedDecrement(&This
->ref
);
516 TRACE ("%p ref=%u\n", This
, ref
);
521 list_remove(&This
->entry
);
529 static HRESULT WINAPI
ITextRange_fnGetTypeInfoCount(ITextRange
*me
, UINT
*pctinfo
)
531 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
533 return CO_E_RELEASED
;
535 FIXME("not implemented %p\n", This
);
539 static HRESULT WINAPI
ITextRange_fnGetTypeInfo(ITextRange
*me
, UINT iTInfo
, LCID lcid
,
542 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
544 return CO_E_RELEASED
;
546 FIXME("not implemented %p\n", This
);
550 static HRESULT WINAPI
ITextRange_fnGetIDsOfNames(ITextRange
*me
, REFIID riid
, LPOLESTR
*rgszNames
,
551 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
553 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
555 return CO_E_RELEASED
;
557 FIXME("not implemented %p\n", This
);
561 static HRESULT WINAPI
ITextRange_fnInvoke(ITextRange
*me
, DISPID dispIdMember
, REFIID riid
,
562 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
563 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
,
566 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
568 return CO_E_RELEASED
;
570 FIXME("not implemented %p\n", This
);
574 static HRESULT WINAPI
ITextRange_fnGetText(ITextRange
*me
, BSTR
*pbstr
)
576 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
578 return CO_E_RELEASED
;
580 FIXME("not implemented %p\n", This
);
584 static HRESULT WINAPI
ITextRange_fnSetText(ITextRange
*me
, BSTR bstr
)
586 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
588 return CO_E_RELEASED
;
590 FIXME("not implemented %p\n", This
);
594 static HRESULT
range_GetChar(ME_TextEditor
*editor
, ME_Cursor
*cursor
, LONG
*pch
)
598 ME_GetTextW(editor
, wch
, 1, cursor
, 1, FALSE
, cursor
->pRun
->next
->type
== diTextEnd
);
604 static HRESULT WINAPI
ITextRange_fnGetChar(ITextRange
*me
, LONG
*pch
)
606 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
610 return CO_E_RELEASED
;
615 ME_CursorFromCharOfs(This
->reOle
->editor
, This
->start
, &cursor
);
616 return range_GetChar(This
->reOle
->editor
, &cursor
, pch
);
619 static HRESULT WINAPI
ITextRange_fnSetChar(ITextRange
*me
, LONG ch
)
621 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
623 return CO_E_RELEASED
;
625 FIXME("not implemented %p\n", This
);
629 static HRESULT
CreateITextRange(IRichEditOleImpl
*reOle
, LONG start
, LONG end
, ITextRange
** ppRange
);
631 static HRESULT WINAPI
ITextRange_fnGetDuplicate(ITextRange
*me
, ITextRange
**ppRange
)
633 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
635 return CO_E_RELEASED
;
637 TRACE("%p %p\n", This
, ppRange
);
641 return CreateITextRange(This
->reOle
, This
->start
, This
->end
, ppRange
);
644 static HRESULT WINAPI
ITextRange_fnGetFormattedText(ITextRange
*me
, ITextRange
**ppRange
)
646 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
648 return CO_E_RELEASED
;
650 FIXME("not implemented %p\n", This
);
654 static HRESULT WINAPI
ITextRange_fnSetFormattedText(ITextRange
*me
, ITextRange
*pRange
)
656 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
658 return CO_E_RELEASED
;
660 FIXME("not implemented %p\n", This
);
664 static HRESULT WINAPI
ITextRange_fnGetStart(ITextRange
*me
, LONG
*pcpFirst
)
666 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
668 return CO_E_RELEASED
;
672 *pcpFirst
= This
->start
;
673 TRACE("%d\n", *pcpFirst
);
677 static HRESULT WINAPI
ITextRange_fnSetStart(ITextRange
*me
, LONG cpFirst
)
679 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
681 return CO_E_RELEASED
;
683 FIXME("not implemented %p\n", This
);
687 static HRESULT WINAPI
ITextRange_fnGetEnd(ITextRange
*me
, LONG
*pcpLim
)
689 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
691 return CO_E_RELEASED
;
696 TRACE("%d\n", *pcpLim
);
700 static HRESULT WINAPI
ITextRange_fnSetEnd(ITextRange
*me
, LONG cpLim
)
702 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
704 return CO_E_RELEASED
;
706 FIXME("not implemented %p\n", This
);
710 static HRESULT WINAPI
ITextRange_fnGetFont(ITextRange
*me
, ITextFont
**pFont
)
712 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
714 return CO_E_RELEASED
;
716 FIXME("not implemented %p\n", This
);
720 static HRESULT WINAPI
ITextRange_fnSetFont(ITextRange
*me
, ITextFont
*pFont
)
722 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
724 return CO_E_RELEASED
;
726 FIXME("not implemented %p\n", This
);
730 static HRESULT WINAPI
ITextRange_fnGetPara(ITextRange
*me
, ITextPara
**ppPara
)
732 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
734 return CO_E_RELEASED
;
736 FIXME("not implemented %p\n", This
);
740 static HRESULT WINAPI
ITextRange_fnSetPara(ITextRange
*me
, ITextPara
*pPara
)
742 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
744 return CO_E_RELEASED
;
746 FIXME("not implemented %p\n", This
);
750 static HRESULT WINAPI
ITextRange_fnGetStoryLength(ITextRange
*me
, LONG
*pcch
)
752 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
754 return CO_E_RELEASED
;
756 FIXME("not implemented %p\n", This
);
760 static HRESULT WINAPI
ITextRange_fnGetStoryType(ITextRange
*me
, LONG
*pValue
)
762 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
764 return CO_E_RELEASED
;
766 FIXME("not implemented %p\n", This
);
770 static HRESULT
range_Collapse(LONG bStart
, LONG
*start
, LONG
*end
)
775 if (bStart
== tomEnd
|| bStart
== tomFalse
)
782 static HRESULT WINAPI
ITextRange_fnCollapse(ITextRange
*me
, LONG bStart
)
784 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
786 return CO_E_RELEASED
;
788 return range_Collapse(bStart
, &This
->start
, &This
->end
);
791 static HRESULT WINAPI
ITextRange_fnExpand(ITextRange
*me
, LONG Unit
, LONG
*pDelta
)
793 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
795 return CO_E_RELEASED
;
797 FIXME("not implemented %p\n", This
);
801 static HRESULT WINAPI
ITextRange_fnGetIndex(ITextRange
*me
, LONG Unit
, LONG
*pIndex
)
803 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
805 return CO_E_RELEASED
;
807 FIXME("not implemented %p\n", This
);
811 static HRESULT WINAPI
ITextRange_fnSetIndex(ITextRange
*me
, LONG Unit
, LONG Index
,
814 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
816 return CO_E_RELEASED
;
818 FIXME("not implemented %p\n", This
);
822 static HRESULT WINAPI
ITextRange_fnSetRange(ITextRange
*me
, LONG cpActive
, LONG cpOther
)
824 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
826 return CO_E_RELEASED
;
828 FIXME("not implemented %p\n", This
);
832 static HRESULT WINAPI
ITextRange_fnInRange(ITextRange
*me
, ITextRange
*pRange
, LONG
*pb
)
834 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
836 return CO_E_RELEASED
;
838 FIXME("not implemented %p\n", This
);
842 static HRESULT WINAPI
ITextRange_fnInStory(ITextRange
*me
, ITextRange
*pRange
, LONG
*pb
)
844 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
846 return CO_E_RELEASED
;
848 FIXME("not implemented %p\n", This
);
852 static HRESULT WINAPI
ITextRange_fnIsEqual(ITextRange
*me
, ITextRange
*pRange
, LONG
*pb
)
854 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
856 return CO_E_RELEASED
;
858 FIXME("not implemented %p\n", This
);
862 static HRESULT WINAPI
ITextRange_fnSelect(ITextRange
*me
)
864 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
866 return CO_E_RELEASED
;
868 FIXME("not implemented %p\n", This
);
872 static HRESULT WINAPI
ITextRange_fnStartOf(ITextRange
*me
, LONG Unit
, LONG Extend
,
875 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
877 return CO_E_RELEASED
;
879 FIXME("not implemented %p\n", This
);
883 static HRESULT WINAPI
ITextRange_fnEndOf(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_fnMove(ITextRange
*me
, LONG Unit
, LONG Count
, LONG
*pDelta
)
896 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
898 return CO_E_RELEASED
;
900 FIXME("not implemented %p\n", This
);
904 static HRESULT WINAPI
ITextRange_fnMoveStart(ITextRange
*me
, LONG Unit
, LONG Count
,
907 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
909 return CO_E_RELEASED
;
911 FIXME("not implemented %p\n", This
);
915 static HRESULT WINAPI
ITextRange_fnMoveEnd(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_fnMoveWhile(ITextRange
*me
, VARIANT
*Cset
, 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_fnMoveStartWhile(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_fnMoveEndWhile(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_fnMoveUntil(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_fnMoveStartUntil(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_fnMoveEndUntil(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_fnFindText(ITextRange
*me
, BSTR bstr
, LONG cch
, LONG Flags
,
995 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
997 return CO_E_RELEASED
;
999 FIXME("not implemented %p\n", This
);
1003 static HRESULT WINAPI
ITextRange_fnFindTextStart(ITextRange
*me
, BSTR bstr
, LONG cch
,
1004 LONG Flags
, LONG
*pLength
)
1006 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1008 return CO_E_RELEASED
;
1010 FIXME("not implemented %p\n", This
);
1014 static HRESULT WINAPI
ITextRange_fnFindTextEnd(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_fnDelete(ITextRange
*me
, LONG Unit
, LONG Count
,
1028 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1030 return CO_E_RELEASED
;
1032 FIXME("not implemented %p\n", This
);
1036 static HRESULT WINAPI
ITextRange_fnCut(ITextRange
*me
, VARIANT
*pVar
)
1038 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1040 return CO_E_RELEASED
;
1042 FIXME("not implemented %p\n", This
);
1046 static HRESULT WINAPI
ITextRange_fnCopy(ITextRange
*me
, VARIANT
*pVar
)
1048 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1050 return CO_E_RELEASED
;
1052 FIXME("not implemented %p\n", This
);
1056 static HRESULT WINAPI
ITextRange_fnPaste(ITextRange
*me
, VARIANT
*pVar
, LONG Format
)
1058 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1060 return CO_E_RELEASED
;
1062 FIXME("not implemented %p\n", This
);
1066 static HRESULT WINAPI
ITextRange_fnCanPaste(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_fnCanEdit(ITextRange
*me
, LONG
*pb
)
1079 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1081 return CO_E_RELEASED
;
1083 FIXME("not implemented %p\n", This
);
1087 static HRESULT WINAPI
ITextRange_fnChangeCase(ITextRange
*me
, LONG Type
)
1089 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1091 return CO_E_RELEASED
;
1093 FIXME("not implemented %p\n", This
);
1097 static HRESULT WINAPI
ITextRange_fnGetPoint(ITextRange
*me
, LONG Type
, LONG
*cx
, LONG
*cy
)
1099 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1101 return CO_E_RELEASED
;
1103 FIXME("not implemented %p\n", This
);
1107 static HRESULT WINAPI
ITextRange_fnSetPoint(ITextRange
*me
, LONG x
, LONG y
, LONG Type
,
1110 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1112 return CO_E_RELEASED
;
1114 FIXME("not implemented %p\n", This
);
1118 static HRESULT WINAPI
ITextRange_fnScrollIntoView(ITextRange
*me
, LONG Value
)
1120 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1122 return CO_E_RELEASED
;
1124 FIXME("not implemented %p\n", This
);
1128 static HRESULT WINAPI
ITextRange_fnGetEmbeddedObject(ITextRange
*me
, IUnknown
**ppv
)
1130 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1132 return CO_E_RELEASED
;
1134 FIXME("not implemented %p\n", This
);
1138 static const ITextRangeVtbl trvt
= {
1139 ITextRange_fnQueryInterface
,
1140 ITextRange_fnAddRef
,
1141 ITextRange_fnRelease
,
1142 ITextRange_fnGetTypeInfoCount
,
1143 ITextRange_fnGetTypeInfo
,
1144 ITextRange_fnGetIDsOfNames
,
1145 ITextRange_fnInvoke
,
1146 ITextRange_fnGetText
,
1147 ITextRange_fnSetText
,
1148 ITextRange_fnGetChar
,
1149 ITextRange_fnSetChar
,
1150 ITextRange_fnGetDuplicate
,
1151 ITextRange_fnGetFormattedText
,
1152 ITextRange_fnSetFormattedText
,
1153 ITextRange_fnGetStart
,
1154 ITextRange_fnSetStart
,
1155 ITextRange_fnGetEnd
,
1156 ITextRange_fnSetEnd
,
1157 ITextRange_fnGetFont
,
1158 ITextRange_fnSetFont
,
1159 ITextRange_fnGetPara
,
1160 ITextRange_fnSetPara
,
1161 ITextRange_fnGetStoryLength
,
1162 ITextRange_fnGetStoryType
,
1163 ITextRange_fnCollapse
,
1164 ITextRange_fnExpand
,
1165 ITextRange_fnGetIndex
,
1166 ITextRange_fnSetIndex
,
1167 ITextRange_fnSetRange
,
1168 ITextRange_fnInRange
,
1169 ITextRange_fnInStory
,
1170 ITextRange_fnIsEqual
,
1171 ITextRange_fnSelect
,
1172 ITextRange_fnStartOf
,
1175 ITextRange_fnMoveStart
,
1176 ITextRange_fnMoveEnd
,
1177 ITextRange_fnMoveWhile
,
1178 ITextRange_fnMoveStartWhile
,
1179 ITextRange_fnMoveEndWhile
,
1180 ITextRange_fnMoveUntil
,
1181 ITextRange_fnMoveStartUntil
,
1182 ITextRange_fnMoveEndUntil
,
1183 ITextRange_fnFindText
,
1184 ITextRange_fnFindTextStart
,
1185 ITextRange_fnFindTextEnd
,
1186 ITextRange_fnDelete
,
1190 ITextRange_fnCanPaste
,
1191 ITextRange_fnCanEdit
,
1192 ITextRange_fnChangeCase
,
1193 ITextRange_fnGetPoint
,
1194 ITextRange_fnSetPoint
,
1195 ITextRange_fnScrollIntoView
,
1196 ITextRange_fnGetEmbeddedObject
1198 /* ITextRange interface */
1200 static HRESULT WINAPI
1201 ITextDocument_fnQueryInterface(ITextDocument
* me
, REFIID riid
,
1204 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1205 return IRichEditOle_QueryInterface(&This
->IRichEditOle_iface
, riid
, ppvObject
);
1209 ITextDocument_fnAddRef(ITextDocument
* me
)
1211 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1212 return IRichEditOle_AddRef(&This
->IRichEditOle_iface
);
1216 ITextDocument_fnRelease(ITextDocument
* me
)
1218 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1219 return IRichEditOle_Release(&This
->IRichEditOle_iface
);
1222 static HRESULT WINAPI
1223 ITextDocument_fnGetTypeInfoCount(ITextDocument
* me
,
1226 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1227 FIXME("stub %p\n",This
);
1231 static HRESULT WINAPI
1232 ITextDocument_fnGetTypeInfo(ITextDocument
* me
, UINT iTInfo
, LCID lcid
,
1233 ITypeInfo
** ppTInfo
)
1235 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1236 FIXME("stub %p\n",This
);
1240 static HRESULT WINAPI
1241 ITextDocument_fnGetIDsOfNames(ITextDocument
* me
, REFIID riid
,
1242 LPOLESTR
* rgszNames
, UINT cNames
, LCID lcid
, DISPID
* rgDispId
)
1244 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1245 FIXME("stub %p\n",This
);
1249 static HRESULT WINAPI
1250 ITextDocument_fnInvoke(ITextDocument
* me
, DISPID dispIdMember
,
1251 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
* pDispParams
,
1252 VARIANT
* pVarResult
, EXCEPINFO
* pExcepInfo
, UINT
* puArgErr
)
1254 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1255 FIXME("stub %p\n",This
);
1259 static HRESULT WINAPI
1260 ITextDocument_fnGetName(ITextDocument
* me
, BSTR
* pName
)
1262 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1263 FIXME("stub %p\n",This
);
1267 static HRESULT WINAPI
1268 ITextDocument_fnGetSelection(ITextDocument
* me
, ITextSelection
** ppSel
)
1270 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1271 TRACE("(%p)\n", me
);
1274 return E_INVALIDARG
;
1275 *ppSel
= &This
->txtSel
->ITextSelection_iface
;
1276 ITextSelection_AddRef(*ppSel
);
1280 static HRESULT WINAPI
1281 ITextDocument_fnGetStoryCount(ITextDocument
* me
, LONG
* pCount
)
1283 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1284 FIXME("stub %p\n",This
);
1288 static HRESULT WINAPI
1289 ITextDocument_fnGetStoryRanges(ITextDocument
* me
,
1290 ITextStoryRanges
** ppStories
)
1292 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1293 FIXME("stub %p\n",This
);
1297 static HRESULT WINAPI
1298 ITextDocument_fnGetSaved(ITextDocument
* me
, LONG
* pValue
)
1300 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1301 FIXME("stub %p\n",This
);
1305 static HRESULT WINAPI
1306 ITextDocument_fnSetSaved(ITextDocument
* me
, LONG Value
)
1308 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1309 FIXME("stub %p\n",This
);
1313 static HRESULT WINAPI
1314 ITextDocument_fnGetDefaultTabStop(ITextDocument
* me
, float* pValue
)
1316 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1317 FIXME("stub %p\n",This
);
1321 static HRESULT WINAPI
1322 ITextDocument_fnSetDefaultTabStop(ITextDocument
* me
, float Value
)
1324 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1325 FIXME("stub %p\n",This
);
1329 static HRESULT WINAPI
1330 ITextDocument_fnNew(ITextDocument
* me
)
1332 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1333 FIXME("stub %p\n",This
);
1337 static HRESULT WINAPI
1338 ITextDocument_fnOpen(ITextDocument
* me
, VARIANT
* pVar
, LONG Flags
,
1341 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1342 FIXME("stub %p\n",This
);
1346 static HRESULT WINAPI
1347 ITextDocument_fnSave(ITextDocument
* me
, VARIANT
* pVar
, LONG Flags
,
1350 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1351 FIXME("stub %p\n",This
);
1355 static HRESULT WINAPI
1356 ITextDocument_fnFreeze(ITextDocument
* me
, LONG
* pCount
)
1358 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1359 FIXME("stub %p\n",This
);
1363 static HRESULT WINAPI
1364 ITextDocument_fnUnfreeze(ITextDocument
* me
, LONG
* pCount
)
1366 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1367 FIXME("stub %p\n",This
);
1371 static HRESULT WINAPI
1372 ITextDocument_fnBeginEditCollection(ITextDocument
* me
)
1374 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1375 FIXME("stub %p\n",This
);
1379 static HRESULT WINAPI
1380 ITextDocument_fnEndEditCollection(ITextDocument
* me
)
1382 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1383 FIXME("stub %p\n",This
);
1387 static HRESULT WINAPI
1388 ITextDocument_fnUndo(ITextDocument
* me
, LONG Count
, LONG
* prop
)
1390 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1391 FIXME("stub %p\n",This
);
1395 static HRESULT WINAPI
1396 ITextDocument_fnRedo(ITextDocument
* me
, LONG Count
, LONG
* prop
)
1398 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1399 FIXME("stub %p\n",This
);
1403 static HRESULT
CreateITextRange(IRichEditOleImpl
*reOle
, LONG start
, LONG end
, ITextRange
** ppRange
)
1405 ITextRangeImpl
*txtRge
= heap_alloc(sizeof(ITextRangeImpl
));
1408 return E_OUTOFMEMORY
;
1409 txtRge
->ITextRange_iface
.lpVtbl
= &trvt
;
1411 txtRge
->reOle
= reOle
;
1412 txtRge
->start
= start
;
1414 list_add_head(&reOle
->rangelist
, &txtRge
->entry
);
1415 *ppRange
= &txtRge
->ITextRange_iface
;
1419 static HRESULT WINAPI
1420 ITextDocument_fnRange(ITextDocument
* me
, LONG cp1
, LONG cp2
,
1421 ITextRange
** ppRange
)
1423 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1424 const int len
= ME_GetTextLength(This
->editor
) + 1;
1426 TRACE("%p %p %d %d\n", This
, ppRange
, cp1
, cp2
);
1428 return E_INVALIDARG
;
1432 cp1
= min(cp1
, len
);
1433 cp2
= min(cp2
, len
);
1442 cp1
= cp2
= len
- 1;
1444 return CreateITextRange(This
, cp1
, cp2
, ppRange
);
1447 static HRESULT WINAPI
1448 ITextDocument_fnRangeFromPoint(ITextDocument
* me
, LONG x
, LONG y
,
1449 ITextRange
** ppRange
)
1451 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1452 FIXME("stub %p\n",This
);
1456 static const ITextDocumentVtbl tdvt
= {
1457 ITextDocument_fnQueryInterface
,
1458 ITextDocument_fnAddRef
,
1459 ITextDocument_fnRelease
,
1460 ITextDocument_fnGetTypeInfoCount
,
1461 ITextDocument_fnGetTypeInfo
,
1462 ITextDocument_fnGetIDsOfNames
,
1463 ITextDocument_fnInvoke
,
1464 ITextDocument_fnGetName
,
1465 ITextDocument_fnGetSelection
,
1466 ITextDocument_fnGetStoryCount
,
1467 ITextDocument_fnGetStoryRanges
,
1468 ITextDocument_fnGetSaved
,
1469 ITextDocument_fnSetSaved
,
1470 ITextDocument_fnGetDefaultTabStop
,
1471 ITextDocument_fnSetDefaultTabStop
,
1472 ITextDocument_fnNew
,
1473 ITextDocument_fnOpen
,
1474 ITextDocument_fnSave
,
1475 ITextDocument_fnFreeze
,
1476 ITextDocument_fnUnfreeze
,
1477 ITextDocument_fnBeginEditCollection
,
1478 ITextDocument_fnEndEditCollection
,
1479 ITextDocument_fnUndo
,
1480 ITextDocument_fnRedo
,
1481 ITextDocument_fnRange
,
1482 ITextDocument_fnRangeFromPoint
1485 static inline ITextSelectionImpl
*impl_from_ITextSelection(ITextSelection
*iface
)
1487 return CONTAINING_RECORD(iface
, ITextSelectionImpl
, ITextSelection_iface
);
1490 static HRESULT WINAPI
ITextSelection_fnQueryInterface(
1496 if (IsEqualGUID(riid
, &IID_IUnknown
)
1497 || IsEqualGUID(riid
, &IID_IDispatch
)
1498 || IsEqualGUID(riid
, &IID_ITextRange
)
1499 || IsEqualGUID(riid
, &IID_ITextSelection
))
1502 ITextSelection_AddRef(me
);
1506 return E_NOINTERFACE
;
1509 static ULONG WINAPI
ITextSelection_fnAddRef(ITextSelection
*me
)
1511 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1512 return InterlockedIncrement(&This
->ref
);
1515 static ULONG WINAPI
ITextSelection_fnRelease(ITextSelection
*me
)
1517 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1518 ULONG ref
= InterlockedDecrement(&This
->ref
);
1524 static HRESULT WINAPI
ITextSelection_fnGetTypeInfoCount(ITextSelection
*me
, UINT
*pctinfo
)
1526 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1528 return CO_E_RELEASED
;
1530 FIXME("not implemented\n");
1534 static HRESULT WINAPI
ITextSelection_fnGetTypeInfo(ITextSelection
*me
, UINT iTInfo
, LCID lcid
,
1535 ITypeInfo
**ppTInfo
)
1537 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1539 return CO_E_RELEASED
;
1541 FIXME("not implemented\n");
1545 static HRESULT WINAPI
ITextSelection_fnGetIDsOfNames(ITextSelection
*me
, REFIID riid
,
1546 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
1548 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1550 return CO_E_RELEASED
;
1552 FIXME("not implemented\n");
1556 static HRESULT WINAPI
ITextSelection_fnInvoke(
1558 DISPID dispIdMember
,
1562 DISPPARAMS
*pDispParams
,
1563 VARIANT
*pVarResult
,
1564 EXCEPINFO
*pExcepInfo
,
1567 FIXME("not implemented\n");
1571 /*** ITextRange methods ***/
1572 static HRESULT WINAPI
ITextSelection_fnGetText(ITextSelection
*me
, BSTR
*pbstr
)
1574 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1575 ME_Cursor
*start
= NULL
, *end
= NULL
;
1580 return CO_E_RELEASED
;
1581 TRACE("%p\n", pbstr
);
1583 return E_INVALIDARG
;
1585 ME_GetSelection(This
->reOle
->editor
, &start
, &end
);
1586 endOfs
= ME_GetCursorOfs(end
);
1587 nChars
= endOfs
- ME_GetCursorOfs(start
);
1594 *pbstr
= SysAllocStringLen(NULL
, nChars
);
1596 return E_OUTOFMEMORY
;
1598 bEOP
= (end
->pRun
->next
->type
== diTextEnd
&& endOfs
> ME_GetTextLength(This
->reOle
->editor
));
1599 ME_GetTextW(This
->reOle
->editor
, *pbstr
, nChars
, start
, nChars
, FALSE
, bEOP
);
1600 TRACE("%s\n", wine_dbgstr_w(*pbstr
));
1605 static HRESULT WINAPI
ITextSelection_fnSetText(ITextSelection
*me
, BSTR bstr
)
1607 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1609 return CO_E_RELEASED
;
1611 FIXME("not implemented\n");
1615 static HRESULT WINAPI
ITextSelection_fnGetChar(ITextSelection
*me
, LONG
*pch
)
1617 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1618 ME_Cursor
*start
= NULL
, *end
= NULL
;
1621 return CO_E_RELEASED
;
1624 return E_INVALIDARG
;
1626 ME_GetSelection(This
->reOle
->editor
, &start
, &end
);
1627 return range_GetChar(This
->reOle
->editor
, start
, pch
);
1630 static HRESULT WINAPI
ITextSelection_fnSetChar(ITextSelection
*me
, LONG ch
)
1632 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1634 return CO_E_RELEASED
;
1636 FIXME("not implemented\n");
1640 static HRESULT WINAPI
ITextSelection_fnGetDuplicate(ITextSelection
*me
, ITextRange
**ppRange
)
1642 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1644 return CO_E_RELEASED
;
1646 FIXME("not implemented\n");
1650 static HRESULT WINAPI
ITextSelection_fnGetFormattedText(ITextSelection
*me
, ITextRange
**ppRange
)
1652 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1654 return CO_E_RELEASED
;
1656 FIXME("not implemented\n");
1660 static HRESULT WINAPI
ITextSelection_fnSetFormattedText(ITextSelection
*me
, ITextRange
*pRange
)
1662 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1664 return CO_E_RELEASED
;
1666 FIXME("not implemented\n");
1670 static HRESULT WINAPI
ITextSelection_fnGetStart(ITextSelection
*me
, LONG
*pcpFirst
)
1672 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1675 return CO_E_RELEASED
;
1678 return E_INVALIDARG
;
1679 ME_GetSelectionOfs(This
->reOle
->editor
, pcpFirst
, &lim
);
1680 TRACE("%d\n", *pcpFirst
);
1684 static HRESULT WINAPI
ITextSelection_fnSetStart(ITextSelection
*me
, LONG cpFirst
)
1686 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1688 return CO_E_RELEASED
;
1690 FIXME("not implemented\n");
1694 static HRESULT WINAPI
ITextSelection_fnGetEnd(ITextSelection
*me
, LONG
*pcpLim
)
1696 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1699 return CO_E_RELEASED
;
1702 return E_INVALIDARG
;
1703 ME_GetSelectionOfs(This
->reOle
->editor
, &first
, pcpLim
);
1704 TRACE("%d\n", *pcpLim
);
1708 static HRESULT WINAPI
ITextSelection_fnSetEnd(ITextSelection
*me
, LONG cpLim
)
1710 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1712 return CO_E_RELEASED
;
1714 FIXME("not implemented\n");
1718 static HRESULT WINAPI
ITextSelection_fnGetFont(ITextSelection
*me
, ITextFont
**pFont
)
1720 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1722 return CO_E_RELEASED
;
1724 FIXME("not implemented\n");
1728 static HRESULT WINAPI
ITextSelection_fnSetFont(ITextSelection
*me
, ITextFont
*pFont
)
1730 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1732 return CO_E_RELEASED
;
1734 FIXME("not implemented\n");
1738 static HRESULT WINAPI
ITextSelection_fnGetPara(ITextSelection
*me
, ITextPara
**ppPara
)
1740 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1742 return CO_E_RELEASED
;
1744 FIXME("not implemented\n");
1748 static HRESULT WINAPI
ITextSelection_fnSetPara(ITextSelection
*me
, ITextPara
*pPara
)
1750 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1752 return CO_E_RELEASED
;
1754 FIXME("not implemented\n");
1758 static HRESULT WINAPI
ITextSelection_fnGetStoryLength(ITextSelection
*me
, LONG
*pcch
)
1760 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1762 return CO_E_RELEASED
;
1764 FIXME("not implemented\n");
1768 static HRESULT WINAPI
ITextSelection_fnGetStoryType(ITextSelection
*me
, LONG
*pValue
)
1770 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1772 return CO_E_RELEASED
;
1774 FIXME("not implemented\n");
1778 static HRESULT WINAPI
ITextSelection_fnCollapse(ITextSelection
*me
, LONG bStart
)
1780 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1784 return CO_E_RELEASED
;
1786 ME_GetSelectionOfs(This
->reOle
->editor
, &start
, &end
);
1787 hres
= range_Collapse(bStart
, &start
, &end
);
1788 if (SUCCEEDED(hres
))
1789 ME_SetSelection(This
->reOle
->editor
, start
, end
);
1793 static HRESULT WINAPI
ITextSelection_fnExpand(ITextSelection
*me
, LONG Unit
, LONG
*pDelta
)
1795 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1797 return CO_E_RELEASED
;
1799 FIXME("not implemented\n");
1803 static HRESULT WINAPI
ITextSelection_fnGetIndex(ITextSelection
*me
, LONG Unit
, LONG
*pIndex
)
1805 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1807 return CO_E_RELEASED
;
1809 FIXME("not implemented\n");
1813 static HRESULT WINAPI
ITextSelection_fnSetIndex(ITextSelection
*me
, LONG Unit
, LONG Index
,
1816 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1818 return CO_E_RELEASED
;
1820 FIXME("not implemented\n");
1824 static HRESULT WINAPI
ITextSelection_fnSetRange(ITextSelection
*me
, LONG cpActive
, LONG cpOther
)
1826 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1828 return CO_E_RELEASED
;
1830 FIXME("not implemented\n");
1834 static HRESULT WINAPI
ITextSelection_fnInRange(ITextSelection
*me
, ITextRange
*pRange
, LONG
*pb
)
1836 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1838 return CO_E_RELEASED
;
1840 FIXME("not implemented\n");
1844 static HRESULT WINAPI
ITextSelection_fnInStory(ITextSelection
*me
, ITextRange
*pRange
, LONG
*pb
)
1846 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1848 return CO_E_RELEASED
;
1850 FIXME("not implemented\n");
1854 static HRESULT WINAPI
ITextSelection_fnIsEqual(ITextSelection
*me
, ITextRange
*pRange
, LONG
*pb
)
1856 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1858 return CO_E_RELEASED
;
1860 FIXME("not implemented\n");
1864 static HRESULT WINAPI
ITextSelection_fnSelect(ITextSelection
*me
)
1866 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1868 return CO_E_RELEASED
;
1870 FIXME("not implemented\n");
1874 static HRESULT WINAPI
ITextSelection_fnStartOf(ITextSelection
*me
, LONG Unit
, LONG Extend
,
1877 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1879 return CO_E_RELEASED
;
1881 FIXME("not implemented\n");
1885 static HRESULT WINAPI
ITextSelection_fnEndOf(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_fnMove(ITextSelection
*me
, LONG Unit
, LONG Count
, LONG
*pDelta
)
1898 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1900 return CO_E_RELEASED
;
1902 FIXME("not implemented\n");
1906 static HRESULT WINAPI
ITextSelection_fnMoveStart(ITextSelection
*me
, LONG Unit
, LONG Count
,
1909 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1911 return CO_E_RELEASED
;
1913 FIXME("not implemented\n");
1917 static HRESULT WINAPI
ITextSelection_fnMoveEnd(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_fnMoveWhile(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1931 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1933 return CO_E_RELEASED
;
1935 FIXME("not implemented\n");
1939 static HRESULT WINAPI
ITextSelection_fnMoveStartWhile(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_fnMoveEndWhile(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_fnMoveUntil(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_fnMoveStartUntil(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_fnMoveEndUntil(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_fnFindText(ITextSelection
*me
, BSTR bstr
, LONG cch
, LONG Flags
,
1997 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1999 return CO_E_RELEASED
;
2001 FIXME("not implemented\n");
2005 static HRESULT WINAPI
ITextSelection_fnFindTextStart(ITextSelection
*me
, BSTR bstr
, LONG cch
,
2006 LONG Flags
, LONG
*pLength
)
2008 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2010 return CO_E_RELEASED
;
2012 FIXME("not implemented\n");
2016 static HRESULT WINAPI
ITextSelection_fnFindTextEnd(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_fnDelete(ITextSelection
*me
, LONG Unit
, LONG Count
,
2030 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2032 return CO_E_RELEASED
;
2034 FIXME("not implemented\n");
2038 static HRESULT WINAPI
ITextSelection_fnCut(ITextSelection
*me
, VARIANT
*pVar
)
2040 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2042 return CO_E_RELEASED
;
2044 FIXME("not implemented\n");
2048 static HRESULT WINAPI
ITextSelection_fnCopy(ITextSelection
*me
, VARIANT
*pVar
)
2050 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2052 return CO_E_RELEASED
;
2054 FIXME("not implemented\n");
2058 static HRESULT WINAPI
ITextSelection_fnPaste(ITextSelection
*me
, VARIANT
*pVar
, LONG Format
)
2060 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2062 return CO_E_RELEASED
;
2064 FIXME("not implemented\n");
2068 static HRESULT WINAPI
ITextSelection_fnCanPaste(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_fnCanEdit(ITextSelection
*me
, LONG
*pb
)
2081 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2083 return CO_E_RELEASED
;
2085 FIXME("not implemented\n");
2089 static HRESULT WINAPI
ITextSelection_fnChangeCase(ITextSelection
*me
, LONG Type
)
2091 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2093 return CO_E_RELEASED
;
2095 FIXME("not implemented\n");
2099 static HRESULT WINAPI
ITextSelection_fnGetPoint(ITextSelection
*me
, LONG Type
, LONG
*cx
, LONG
*cy
)
2101 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2103 return CO_E_RELEASED
;
2105 FIXME("not implemented\n");
2109 static HRESULT WINAPI
ITextSelection_fnSetPoint(ITextSelection
*me
, LONG x
, LONG y
, LONG Type
,
2112 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2114 return CO_E_RELEASED
;
2116 FIXME("not implemented\n");
2120 static HRESULT WINAPI
ITextSelection_fnScrollIntoView(ITextSelection
*me
, LONG Value
)
2122 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2124 return CO_E_RELEASED
;
2126 FIXME("not implemented\n");
2130 static HRESULT WINAPI
ITextSelection_fnGetEmbeddedObject(ITextSelection
*me
, IUnknown
**ppv
)
2132 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2134 return CO_E_RELEASED
;
2136 FIXME("not implemented\n");
2140 /*** ITextSelection methods ***/
2141 static HRESULT WINAPI
ITextSelection_fnGetFlags(ITextSelection
*me
, LONG
*pFlags
)
2143 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2145 return CO_E_RELEASED
;
2147 FIXME("not implemented\n");
2151 static HRESULT WINAPI
ITextSelection_fnSetFlags(ITextSelection
*me
, LONG Flags
)
2153 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2155 return CO_E_RELEASED
;
2157 FIXME("not implemented\n");
2161 static HRESULT WINAPI
ITextSelection_fnGetType(ITextSelection
*me
, LONG
*pType
)
2163 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2165 return CO_E_RELEASED
;
2167 FIXME("not implemented\n");
2171 static HRESULT WINAPI
ITextSelection_fnMoveLeft(ITextSelection
*me
, LONG Unit
, LONG Count
,
2172 LONG Extend
, LONG
*pDelta
)
2174 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2176 return CO_E_RELEASED
;
2178 FIXME("not implemented\n");
2182 static HRESULT WINAPI
ITextSelection_fnMoveRight(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_fnMoveUp(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_fnMoveDown(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_fnHomeKey(ITextSelection
*me
, LONG Unit
, LONG Extend
,
2218 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2220 return CO_E_RELEASED
;
2222 FIXME("not implemented\n");
2226 static HRESULT WINAPI
ITextSelection_fnEndKey(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_fnTypeText(ITextSelection
*me
, BSTR bstr
)
2239 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2241 return CO_E_RELEASED
;
2243 FIXME("not implemented\n");
2247 static const ITextSelectionVtbl tsvt
= {
2248 ITextSelection_fnQueryInterface
,
2249 ITextSelection_fnAddRef
,
2250 ITextSelection_fnRelease
,
2251 ITextSelection_fnGetTypeInfoCount
,
2252 ITextSelection_fnGetTypeInfo
,
2253 ITextSelection_fnGetIDsOfNames
,
2254 ITextSelection_fnInvoke
,
2255 ITextSelection_fnGetText
,
2256 ITextSelection_fnSetText
,
2257 ITextSelection_fnGetChar
,
2258 ITextSelection_fnSetChar
,
2259 ITextSelection_fnGetDuplicate
,
2260 ITextSelection_fnGetFormattedText
,
2261 ITextSelection_fnSetFormattedText
,
2262 ITextSelection_fnGetStart
,
2263 ITextSelection_fnSetStart
,
2264 ITextSelection_fnGetEnd
,
2265 ITextSelection_fnSetEnd
,
2266 ITextSelection_fnGetFont
,
2267 ITextSelection_fnSetFont
,
2268 ITextSelection_fnGetPara
,
2269 ITextSelection_fnSetPara
,
2270 ITextSelection_fnGetStoryLength
,
2271 ITextSelection_fnGetStoryType
,
2272 ITextSelection_fnCollapse
,
2273 ITextSelection_fnExpand
,
2274 ITextSelection_fnGetIndex
,
2275 ITextSelection_fnSetIndex
,
2276 ITextSelection_fnSetRange
,
2277 ITextSelection_fnInRange
,
2278 ITextSelection_fnInStory
,
2279 ITextSelection_fnIsEqual
,
2280 ITextSelection_fnSelect
,
2281 ITextSelection_fnStartOf
,
2282 ITextSelection_fnEndOf
,
2283 ITextSelection_fnMove
,
2284 ITextSelection_fnMoveStart
,
2285 ITextSelection_fnMoveEnd
,
2286 ITextSelection_fnMoveWhile
,
2287 ITextSelection_fnMoveStartWhile
,
2288 ITextSelection_fnMoveEndWhile
,
2289 ITextSelection_fnMoveUntil
,
2290 ITextSelection_fnMoveStartUntil
,
2291 ITextSelection_fnMoveEndUntil
,
2292 ITextSelection_fnFindText
,
2293 ITextSelection_fnFindTextStart
,
2294 ITextSelection_fnFindTextEnd
,
2295 ITextSelection_fnDelete
,
2296 ITextSelection_fnCut
,
2297 ITextSelection_fnCopy
,
2298 ITextSelection_fnPaste
,
2299 ITextSelection_fnCanPaste
,
2300 ITextSelection_fnCanEdit
,
2301 ITextSelection_fnChangeCase
,
2302 ITextSelection_fnGetPoint
,
2303 ITextSelection_fnSetPoint
,
2304 ITextSelection_fnScrollIntoView
,
2305 ITextSelection_fnGetEmbeddedObject
,
2306 ITextSelection_fnGetFlags
,
2307 ITextSelection_fnSetFlags
,
2308 ITextSelection_fnGetType
,
2309 ITextSelection_fnMoveLeft
,
2310 ITextSelection_fnMoveRight
,
2311 ITextSelection_fnMoveUp
,
2312 ITextSelection_fnMoveDown
,
2313 ITextSelection_fnHomeKey
,
2314 ITextSelection_fnEndKey
,
2315 ITextSelection_fnTypeText
2318 static ITextSelectionImpl
*
2319 CreateTextSelection(IRichEditOleImpl
*reOle
)
2321 ITextSelectionImpl
*txtSel
= heap_alloc(sizeof *txtSel
);
2325 txtSel
->ITextSelection_iface
.lpVtbl
= &tsvt
;
2327 txtSel
->reOle
= reOle
;
2331 LRESULT
CreateIRichEditOle(IUnknown
*outer_unk
, ME_TextEditor
*editor
, LPVOID
*ppvObj
)
2333 IRichEditOleImpl
*reo
;
2335 reo
= heap_alloc(sizeof(IRichEditOleImpl
));
2339 reo
->IUnknown_inner
.lpVtbl
= &reo_unk_vtbl
;
2340 reo
->IRichEditOle_iface
.lpVtbl
= &revt
;
2341 reo
->ITextDocument_iface
.lpVtbl
= &tdvt
;
2343 reo
->editor
= editor
;
2344 reo
->txtSel
= CreateTextSelection(reo
);
2350 reo
->clientSite
= CreateOleClientSite(reo
);
2351 if (!reo
->clientSite
)
2353 ITextSelection_Release(&reo
->txtSel
->ITextSelection_iface
);
2357 TRACE("Created %p\n",reo
);
2358 list_init(&reo
->rangelist
);
2360 reo
->outer_unk
= outer_unk
;
2362 reo
->outer_unk
= &reo
->IUnknown_inner
;
2363 *ppvObj
= &reo
->IRichEditOle_iface
;
2368 void DestroyIRichEditOle(IRichEditOle
*iface
)
2370 IRichEditOleImpl
*This
= impl_from_IRichEditOle(iface
);
2371 ITextRangeImpl
*txtRge
;
2373 TRACE("Destroying %p\n", This
);
2374 This
->txtSel
->reOle
= NULL
;
2375 This
->editor
->reOle
= NULL
;
2376 ITextSelection_Release(&This
->txtSel
->ITextSelection_iface
);
2377 IOleClientSite_Release(&This
->clientSite
->IOleClientSite_iface
);
2378 LIST_FOR_EACH_ENTRY(txtRge
, &This
->rangelist
, ITextRangeImpl
, entry
)
2379 txtRge
->reOle
= NULL
;
2383 static void convert_sizel(const ME_Context
*c
, const SIZEL
* szl
, SIZE
* sz
)
2385 /* sizel is in .01 millimeters, sz in pixels */
2386 sz
->cx
= MulDiv(szl
->cx
, c
->dpi
.cx
, 2540);
2387 sz
->cy
= MulDiv(szl
->cy
, c
->dpi
.cy
, 2540);
2390 /******************************************************************************
2391 * ME_GetOLEObjectSize
2393 * Sets run extent for OLE objects.
2395 void ME_GetOLEObjectSize(const ME_Context
*c
, ME_Run
*run
, SIZE
*pSize
)
2403 assert(run
->nFlags
& MERF_GRAPHICS
);
2404 assert(run
->ole_obj
);
2406 if (run
->ole_obj
->sizel
.cx
!= 0 || run
->ole_obj
->sizel
.cy
!= 0)
2408 convert_sizel(c
, &run
->ole_obj
->sizel
, pSize
);
2409 if (c
->editor
->nZoomNumerator
!= 0)
2411 pSize
->cx
= MulDiv(pSize
->cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2412 pSize
->cy
= MulDiv(pSize
->cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2417 if (IOleObject_QueryInterface(run
->ole_obj
->poleobj
, &IID_IDataObject
, (void**)&ido
) != S_OK
)
2419 FIXME("Query Interface IID_IDataObject failed!\n");
2420 pSize
->cx
= pSize
->cy
= 0;
2423 fmt
.cfFormat
= CF_BITMAP
;
2425 fmt
.dwAspect
= DVASPECT_CONTENT
;
2427 fmt
.tymed
= TYMED_GDI
;
2428 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
2430 fmt
.cfFormat
= CF_ENHMETAFILE
;
2431 fmt
.tymed
= TYMED_ENHMF
;
2432 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
2434 FIXME("unsupported format\n");
2435 pSize
->cx
= pSize
->cy
= 0;
2436 IDataObject_Release(ido
);
2444 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
2445 pSize
->cx
= dibsect
.dsBm
.bmWidth
;
2446 pSize
->cy
= dibsect
.dsBm
.bmHeight
;
2447 if (!stgm
.pUnkForRelease
) DeleteObject(stgm
.u
.hBitmap
);
2450 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
2451 pSize
->cx
= emh
.rclBounds
.right
- emh
.rclBounds
.left
;
2452 pSize
->cy
= emh
.rclBounds
.bottom
- emh
.rclBounds
.top
;
2453 if (!stgm
.pUnkForRelease
) DeleteEnhMetaFile(stgm
.u
.hEnhMetaFile
);
2456 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
2459 IDataObject_Release(ido
);
2460 if (c
->editor
->nZoomNumerator
!= 0)
2462 pSize
->cx
= MulDiv(pSize
->cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2463 pSize
->cy
= MulDiv(pSize
->cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2467 void ME_DrawOLE(ME_Context
*c
, int x
, int y
, ME_Run
*run
,
2468 ME_Paragraph
*para
, BOOL selected
)
2479 assert(run
->nFlags
& MERF_GRAPHICS
);
2480 assert(run
->ole_obj
);
2481 if (IOleObject_QueryInterface(run
->ole_obj
->poleobj
, &IID_IDataObject
, (void**)&ido
) != S_OK
)
2483 FIXME("Couldn't get interface\n");
2486 has_size
= run
->ole_obj
->sizel
.cx
!= 0 || run
->ole_obj
->sizel
.cy
!= 0;
2487 fmt
.cfFormat
= CF_BITMAP
;
2489 fmt
.dwAspect
= DVASPECT_CONTENT
;
2491 fmt
.tymed
= TYMED_GDI
;
2492 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
2494 fmt
.cfFormat
= CF_ENHMETAFILE
;
2495 fmt
.tymed
= TYMED_ENHMF
;
2496 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
2498 FIXME("Couldn't get storage medium\n");
2499 IDataObject_Release(ido
);
2506 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
2507 hMemDC
= CreateCompatibleDC(c
->hDC
);
2508 SelectObject(hMemDC
, stgm
.u
.hBitmap
);
2511 convert_sizel(c
, &run
->ole_obj
->sizel
, &sz
);
2513 sz
.cx
= MulDiv(dibsect
.dsBm
.bmWidth
, c
->dpi
.cx
, 96);
2514 sz
.cy
= MulDiv(dibsect
.dsBm
.bmHeight
, c
->dpi
.cy
, 96);
2516 if (c
->editor
->nZoomNumerator
!= 0)
2518 sz
.cx
= MulDiv(sz
.cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2519 sz
.cy
= MulDiv(sz
.cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2521 if (sz
.cx
== dibsect
.dsBm
.bmWidth
&& sz
.cy
== dibsect
.dsBm
.bmHeight
)
2523 BitBlt(c
->hDC
, x
, y
- sz
.cy
,
2524 dibsect
.dsBm
.bmWidth
, dibsect
.dsBm
.bmHeight
,
2525 hMemDC
, 0, 0, SRCCOPY
);
2527 StretchBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
,
2528 hMemDC
, 0, 0, dibsect
.dsBm
.bmWidth
,
2529 dibsect
.dsBm
.bmHeight
, SRCCOPY
);
2532 if (!stgm
.pUnkForRelease
) DeleteObject(stgm
.u
.hBitmap
);
2535 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
2538 convert_sizel(c
, &run
->ole_obj
->sizel
, &sz
);
2540 sz
.cy
= MulDiv(emh
.rclBounds
.bottom
- emh
.rclBounds
.top
, c
->dpi
.cx
, 96);
2541 sz
.cx
= MulDiv(emh
.rclBounds
.right
- emh
.rclBounds
.left
, c
->dpi
.cy
, 96);
2543 if (c
->editor
->nZoomNumerator
!= 0)
2545 sz
.cx
= MulDiv(sz
.cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2546 sz
.cy
= MulDiv(sz
.cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2554 rc
.right
= x
+ sz
.cx
;
2556 PlayEnhMetaFile(c
->hDC
, stgm
.u
.hEnhMetaFile
, &rc
);
2558 if (!stgm
.pUnkForRelease
) DeleteEnhMetaFile(stgm
.u
.hEnhMetaFile
);
2561 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
2565 if (selected
&& !c
->editor
->bHideSelection
)
2566 PatBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
, DSTINVERT
);
2567 IDataObject_Release(ido
);
2570 void ME_DeleteReObject(REOBJECT
* reo
)
2572 if (reo
->poleobj
) IOleObject_Release(reo
->poleobj
);
2573 if (reo
->pstg
) IStorage_Release(reo
->pstg
);
2574 if (reo
->polesite
) IOleClientSite_Release(reo
->polesite
);
2578 void ME_CopyReObject(REOBJECT
* dst
, const REOBJECT
* src
)
2582 if (dst
->poleobj
) IOleObject_AddRef(dst
->poleobj
);
2583 if (dst
->pstg
) IStorage_AddRef(dst
->pstg
);
2584 if (dst
->polesite
) IOleClientSite_AddRef(dst
->polesite
);
2587 void ME_GetITextDocumentInterface(IRichEditOle
*iface
, LPVOID
*ppvObj
)
2589 IRichEditOleImpl
*This
= impl_from_IRichEditOle(iface
);
2590 *ppvObj
= &This
->ITextDocument_iface
;