2 * RichEdit GUIDs and OLE interface
4 * Copyright 2004 by Krzysztof Foltman
5 * Copyright 2004 Aric Stewart
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #define NONAMELESSUNION
25 #define NONAMELESSSTRUCT
36 #include "wine/debug.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(richedit
);
40 /* there is no way to be consistent across different sets of headers - mingw, Wine, Win32 SDK*/
43 DEFINE_GUID(IID_ITextServices
, 0x8d33f740, 0xcf58, 0x11ce, 0xa8, 0x9d, 0x00, 0xaa, 0x00, 0x6c, 0xad, 0xc5);
44 DEFINE_GUID(IID_ITextHost
, 0x13e670f4,0x1a5a,0x11cf,0xab,0xeb,0x00,0xaa,0x00,0xb6,0x5e,0xa1);
45 DEFINE_GUID(IID_ITextHost2
, 0x13e670f5,0x1a5a,0x11cf,0xab,0xeb,0x00,0xaa,0x00,0xb6,0x5e,0xa1);
46 DEFINE_GUID(IID_ITextDocument
, 0x8cc497c0, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
47 DEFINE_GUID(IID_ITextRange
, 0x8cc497c2, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
48 DEFINE_GUID(IID_ITextSelection
, 0x8cc497c1, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
50 typedef struct ITextSelectionImpl ITextSelectionImpl
;
51 typedef struct IOleClientSiteImpl IOleClientSiteImpl
;
52 typedef struct ITextRangeImpl ITextRangeImpl
;
54 typedef struct IRichEditOleImpl
{
55 IRichEditOle IRichEditOle_iface
;
56 ITextDocument ITextDocument_iface
;
59 ME_TextEditor
*editor
;
60 ITextSelectionImpl
*txtSel
;
61 IOleClientSiteImpl
*clientSite
;
62 struct list rangelist
;
65 struct ITextRangeImpl
{
66 ITextRange ITextRange_iface
;
71 IRichEditOleImpl
*reOle
;
74 struct ITextSelectionImpl
{
75 ITextSelection ITextSelection_iface
;
78 IRichEditOleImpl
*reOle
;
81 struct IOleClientSiteImpl
{
82 IOleClientSite IOleClientSite_iface
;
85 IRichEditOleImpl
*reOle
;
88 static inline IRichEditOleImpl
*impl_from_IRichEditOle(IRichEditOle
*iface
)
90 return CONTAINING_RECORD(iface
, IRichEditOleImpl
, IRichEditOle_iface
);
93 static inline IRichEditOleImpl
*impl_from_ITextDocument(ITextDocument
*iface
)
95 return CONTAINING_RECORD(iface
, IRichEditOleImpl
, ITextDocument_iface
);
99 IRichEditOle_fnQueryInterface(IRichEditOle
*me
, REFIID riid
, LPVOID
*ppvObj
)
101 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
103 TRACE("%p %s\n", This
, debugstr_guid(riid
) );
106 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
107 IsEqualGUID(riid
, &IID_IRichEditOle
))
108 *ppvObj
= &This
->IRichEditOle_iface
;
109 else if (IsEqualGUID(riid
, &IID_ITextDocument
))
110 *ppvObj
= &This
->ITextDocument_iface
;
113 IRichEditOle_AddRef(me
);
116 FIXME("%p: unhandled interface %s\n", This
, debugstr_guid(riid
) );
118 return E_NOINTERFACE
;
122 IRichEditOle_fnAddRef(IRichEditOle
*me
)
124 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
125 ULONG ref
= InterlockedIncrement( &This
->ref
);
127 TRACE("%p ref = %u\n", This
, ref
);
133 IRichEditOle_fnRelease(IRichEditOle
*me
)
135 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
136 ULONG ref
= InterlockedDecrement(&This
->ref
);
138 TRACE ("%p ref=%u\n", This
, ref
);
142 ITextRangeImpl
*txtRge
;
143 TRACE ("Destroying %p\n", This
);
144 This
->txtSel
->reOle
= NULL
;
145 ITextSelection_Release(&This
->txtSel
->ITextSelection_iface
);
146 IOleClientSite_Release(&This
->clientSite
->IOleClientSite_iface
);
147 LIST_FOR_EACH_ENTRY(txtRge
, &This
->rangelist
, ITextRangeImpl
, entry
)
148 txtRge
->reOle
= NULL
;
154 static HRESULT WINAPI
155 IRichEditOle_fnActivateAs(IRichEditOle
*me
, REFCLSID rclsid
, REFCLSID rclsidAs
)
157 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
158 FIXME("stub %p\n",This
);
162 static HRESULT WINAPI
163 IRichEditOle_fnContextSensitiveHelp(IRichEditOle
*me
, BOOL fEnterMode
)
165 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
166 FIXME("stub %p\n",This
);
170 static HRESULT WINAPI
171 IRichEditOle_fnConvertObject(IRichEditOle
*me
, LONG iob
,
172 REFCLSID rclsidNew
, LPCSTR lpstrUserTypeNew
)
174 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
175 FIXME("stub %p\n",This
);
179 static inline IOleClientSiteImpl
*impl_from_IOleClientSite(IOleClientSite
*iface
)
181 return CONTAINING_RECORD(iface
, IOleClientSiteImpl
, IOleClientSite_iface
);
184 static HRESULT WINAPI
185 IOleClientSite_fnQueryInterface(IOleClientSite
*me
, REFIID riid
, LPVOID
*ppvObj
)
187 TRACE("%p %s\n", me
, debugstr_guid(riid
) );
190 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
191 IsEqualGUID(riid
, &IID_IOleClientSite
))
195 IOleClientSite_AddRef(me
);
198 FIXME("%p: unhandled interface %s\n", me
, debugstr_guid(riid
) );
200 return E_NOINTERFACE
;
203 static ULONG WINAPI
IOleClientSite_fnAddRef(IOleClientSite
*iface
)
205 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
206 return InterlockedIncrement(&This
->ref
);
209 static ULONG WINAPI
IOleClientSite_fnRelease(IOleClientSite
*iface
)
211 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
212 ULONG ref
= InterlockedDecrement(&This
->ref
);
218 static HRESULT WINAPI
IOleClientSite_fnSaveObject(IOleClientSite
*iface
)
220 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
222 return CO_E_RELEASED
;
224 FIXME("stub %p\n", iface
);
229 static HRESULT WINAPI
IOleClientSite_fnGetMoniker(IOleClientSite
*iface
, DWORD dwAssign
,
230 DWORD dwWhichMoniker
, IMoniker
**ppmk
)
232 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
234 return CO_E_RELEASED
;
236 FIXME("stub %p\n", iface
);
240 static HRESULT WINAPI
IOleClientSite_fnGetContainer(IOleClientSite
*iface
,
241 IOleContainer
**ppContainer
)
243 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
245 return CO_E_RELEASED
;
247 FIXME("stub %p\n", iface
);
251 static HRESULT WINAPI
IOleClientSite_fnShowObject(IOleClientSite
*iface
)
253 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
255 return CO_E_RELEASED
;
257 FIXME("stub %p\n", iface
);
261 static HRESULT WINAPI
IOleClientSite_fnOnShowWindow(IOleClientSite
*iface
, BOOL fShow
)
263 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
265 return CO_E_RELEASED
;
267 FIXME("stub %p\n", iface
);
271 static HRESULT WINAPI
IOleClientSite_fnRequestNewObjectLayout(IOleClientSite
*iface
)
273 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
275 return CO_E_RELEASED
;
277 FIXME("stub %p\n", iface
);
281 static const IOleClientSiteVtbl ocst
= {
282 IOleClientSite_fnQueryInterface
,
283 IOleClientSite_fnAddRef
,
284 IOleClientSite_fnRelease
,
285 IOleClientSite_fnSaveObject
,
286 IOleClientSite_fnGetMoniker
,
287 IOleClientSite_fnGetContainer
,
288 IOleClientSite_fnShowObject
,
289 IOleClientSite_fnOnShowWindow
,
290 IOleClientSite_fnRequestNewObjectLayout
293 static IOleClientSiteImpl
*
294 CreateOleClientSite(IRichEditOleImpl
*reOle
)
296 IOleClientSiteImpl
*clientSite
= heap_alloc(sizeof *clientSite
);
300 clientSite
->IOleClientSite_iface
.lpVtbl
= &ocst
;
302 clientSite
->reOle
= reOle
;
306 static HRESULT WINAPI
307 IRichEditOle_fnGetClientSite(IRichEditOle
*me
,
308 LPOLECLIENTSITE
*lplpolesite
)
310 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
312 TRACE("%p,%p\n",This
, lplpolesite
);
316 *lplpolesite
= &This
->clientSite
->IOleClientSite_iface
;
317 IOleClientSite_AddRef(*lplpolesite
);
321 static HRESULT WINAPI
322 IRichEditOle_fnGetClipboardData(IRichEditOle
*me
, CHARRANGE
*lpchrg
,
323 DWORD reco
, LPDATAOBJECT
*lplpdataobj
)
325 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
329 TRACE("(%p,%p,%d)\n",This
, lpchrg
, reco
);
333 int nFrom
, nTo
, nStartCur
= ME_GetSelectionOfs(This
->editor
, &nFrom
, &nTo
);
334 start
= This
->editor
->pCursors
[nStartCur
];
335 nChars
= nTo
- nFrom
;
337 ME_CursorFromCharOfs(This
->editor
, lpchrg
->cpMin
, &start
);
338 nChars
= lpchrg
->cpMax
- lpchrg
->cpMin
;
340 return ME_GetDataObject(This
->editor
, &start
, nChars
, lplpdataobj
);
343 static LONG WINAPI
IRichEditOle_fnGetLinkCount(IRichEditOle
*me
)
345 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
346 FIXME("stub %p\n",This
);
350 static HRESULT WINAPI
351 IRichEditOle_fnGetObject(IRichEditOle
*me
, LONG iob
,
352 REOBJECT
*lpreobject
, DWORD dwFlags
)
354 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
355 FIXME("stub %p\n",This
);
360 IRichEditOle_fnGetObjectCount(IRichEditOle
*me
)
362 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
363 FIXME("stub %p\n",This
);
367 static HRESULT WINAPI
368 IRichEditOle_fnHandsOffStorage(IRichEditOle
*me
, LONG iob
)
370 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
371 FIXME("stub %p\n",This
);
375 static HRESULT WINAPI
376 IRichEditOle_fnImportDataObject(IRichEditOle
*me
, LPDATAOBJECT lpdataobj
,
377 CLIPFORMAT cf
, HGLOBAL hMetaPict
)
379 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
380 FIXME("stub %p\n",This
);
384 static HRESULT WINAPI
385 IRichEditOle_fnInPlaceDeactivate(IRichEditOle
*me
)
387 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
388 FIXME("stub %p\n",This
);
392 static HRESULT WINAPI
393 IRichEditOle_fnInsertObject(IRichEditOle
*me
, REOBJECT
*reo
)
395 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
396 TRACE("(%p,%p)\n", This
, reo
);
398 if (reo
->cbStruct
< sizeof(*reo
)) return STG_E_INVALIDPARAMETER
;
400 ME_InsertOLEFromCursor(This
->editor
, reo
, 0);
401 ME_CommitUndo(This
->editor
);
402 ME_UpdateRepaint(This
->editor
, FALSE
);
406 static HRESULT WINAPI
IRichEditOle_fnSaveCompleted(IRichEditOle
*me
, LONG iob
,
409 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
410 FIXME("stub %p\n",This
);
414 static HRESULT WINAPI
415 IRichEditOle_fnSetDvaspect(IRichEditOle
*me
, LONG iob
, DWORD dvaspect
)
417 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
418 FIXME("stub %p\n",This
);
422 static HRESULT WINAPI
IRichEditOle_fnSetHostNames(IRichEditOle
*me
,
423 LPCSTR lpstrContainerApp
, LPCSTR lpstrContainerObj
)
425 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
426 FIXME("stub %p %s %s\n",This
, lpstrContainerApp
, lpstrContainerObj
);
430 static HRESULT WINAPI
431 IRichEditOle_fnSetLinkAvailable(IRichEditOle
*me
, LONG iob
, BOOL fAvailable
)
433 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
434 FIXME("stub %p\n",This
);
438 static const IRichEditOleVtbl revt
= {
439 IRichEditOle_fnQueryInterface
,
440 IRichEditOle_fnAddRef
,
441 IRichEditOle_fnRelease
,
442 IRichEditOle_fnGetClientSite
,
443 IRichEditOle_fnGetObjectCount
,
444 IRichEditOle_fnGetLinkCount
,
445 IRichEditOle_fnGetObject
,
446 IRichEditOle_fnInsertObject
,
447 IRichEditOle_fnConvertObject
,
448 IRichEditOle_fnActivateAs
,
449 IRichEditOle_fnSetHostNames
,
450 IRichEditOle_fnSetLinkAvailable
,
451 IRichEditOle_fnSetDvaspect
,
452 IRichEditOle_fnHandsOffStorage
,
453 IRichEditOle_fnSaveCompleted
,
454 IRichEditOle_fnInPlaceDeactivate
,
455 IRichEditOle_fnContextSensitiveHelp
,
456 IRichEditOle_fnGetClipboardData
,
457 IRichEditOle_fnImportDataObject
460 /* ITextRange interface */
461 static inline ITextRangeImpl
*impl_from_ITextRange(ITextRange
*iface
)
463 return CONTAINING_RECORD(iface
, ITextRangeImpl
, ITextRange_iface
);
466 static HRESULT WINAPI
ITextRange_fnQueryInterface(ITextRange
*me
, REFIID riid
, void **ppvObj
)
469 if (IsEqualGUID(riid
, &IID_IUnknown
)
470 || IsEqualGUID(riid
, &IID_IDispatch
)
471 || IsEqualGUID(riid
, &IID_ITextRange
))
474 ITextRange_AddRef(me
);
478 return E_NOINTERFACE
;
481 static ULONG WINAPI
ITextRange_fnAddRef(ITextRange
*me
)
483 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
484 return InterlockedIncrement(&This
->ref
);
487 static ULONG WINAPI
ITextRange_fnRelease(ITextRange
*me
)
489 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
490 ULONG ref
= InterlockedDecrement(&This
->ref
);
492 TRACE ("%p ref=%u\n", This
, ref
);
497 list_remove(&This
->entry
);
505 static HRESULT WINAPI
ITextRange_fnGetTypeInfoCount(ITextRange
*me
, UINT
*pctinfo
)
507 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
509 return CO_E_RELEASED
;
511 FIXME("not implemented %p\n", This
);
515 static HRESULT WINAPI
ITextRange_fnGetTypeInfo(ITextRange
*me
, UINT iTInfo
, LCID lcid
,
518 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
520 return CO_E_RELEASED
;
522 FIXME("not implemented %p\n", This
);
526 static HRESULT WINAPI
ITextRange_fnGetIDsOfNames(ITextRange
*me
, REFIID riid
, LPOLESTR
*rgszNames
,
527 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
529 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
531 return CO_E_RELEASED
;
533 FIXME("not implemented %p\n", This
);
537 static HRESULT WINAPI
ITextRange_fnInvoke(ITextRange
*me
, DISPID dispIdMember
, REFIID riid
,
538 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
539 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
,
542 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
544 return CO_E_RELEASED
;
546 FIXME("not implemented %p\n", This
);
550 static HRESULT WINAPI
ITextRange_fnGetText(ITextRange
*me
, BSTR
*pbstr
)
552 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
554 return CO_E_RELEASED
;
556 FIXME("not implemented %p\n", This
);
560 static HRESULT WINAPI
ITextRange_fnSetText(ITextRange
*me
, BSTR bstr
)
562 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
564 return CO_E_RELEASED
;
566 FIXME("not implemented %p\n", This
);
570 static HRESULT
range_GetChar(ME_TextEditor
*editor
, ME_Cursor
*cursor
, LONG
*pch
)
574 ME_GetTextW(editor
, wch
, 1, cursor
, 1, FALSE
, cursor
->pRun
->next
->type
== diTextEnd
);
580 static HRESULT WINAPI
ITextRange_fnGetChar(ITextRange
*me
, LONG
*pch
)
582 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
586 return CO_E_RELEASED
;
591 ME_CursorFromCharOfs(This
->reOle
->editor
, This
->start
, &cursor
);
592 return range_GetChar(This
->reOle
->editor
, &cursor
, pch
);
595 static HRESULT WINAPI
ITextRange_fnSetChar(ITextRange
*me
, LONG ch
)
597 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
599 return CO_E_RELEASED
;
601 FIXME("not implemented %p\n", This
);
605 static HRESULT
CreateITextRange(IRichEditOleImpl
*reOle
, LONG start
, LONG end
, ITextRange
** ppRange
);
607 static HRESULT WINAPI
ITextRange_fnGetDuplicate(ITextRange
*me
, ITextRange
**ppRange
)
609 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
611 return CO_E_RELEASED
;
613 TRACE("%p %p\n", This
, ppRange
);
617 return CreateITextRange(This
->reOle
, This
->start
, This
->end
, ppRange
);
620 static HRESULT WINAPI
ITextRange_fnGetFormattedText(ITextRange
*me
, ITextRange
**ppRange
)
622 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
624 return CO_E_RELEASED
;
626 FIXME("not implemented %p\n", This
);
630 static HRESULT WINAPI
ITextRange_fnSetFormattedText(ITextRange
*me
, ITextRange
*pRange
)
632 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
634 return CO_E_RELEASED
;
636 FIXME("not implemented %p\n", This
);
640 static HRESULT WINAPI
ITextRange_fnGetStart(ITextRange
*me
, LONG
*pcpFirst
)
642 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
644 return CO_E_RELEASED
;
648 *pcpFirst
= This
->start
;
649 TRACE("%d\n", *pcpFirst
);
653 static HRESULT WINAPI
ITextRange_fnSetStart(ITextRange
*me
, LONG cpFirst
)
655 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
657 return CO_E_RELEASED
;
659 FIXME("not implemented %p\n", This
);
663 static HRESULT WINAPI
ITextRange_fnGetEnd(ITextRange
*me
, LONG
*pcpLim
)
665 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
667 return CO_E_RELEASED
;
672 TRACE("%d\n", *pcpLim
);
676 static HRESULT WINAPI
ITextRange_fnSetEnd(ITextRange
*me
, LONG cpLim
)
678 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
680 return CO_E_RELEASED
;
682 FIXME("not implemented %p\n", This
);
686 static HRESULT WINAPI
ITextRange_fnGetFont(ITextRange
*me
, ITextFont
**pFont
)
688 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
690 return CO_E_RELEASED
;
692 FIXME("not implemented %p\n", This
);
696 static HRESULT WINAPI
ITextRange_fnSetFont(ITextRange
*me
, ITextFont
*pFont
)
698 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
700 return CO_E_RELEASED
;
702 FIXME("not implemented %p\n", This
);
706 static HRESULT WINAPI
ITextRange_fnGetPara(ITextRange
*me
, ITextPara
**ppPara
)
708 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
710 return CO_E_RELEASED
;
712 FIXME("not implemented %p\n", This
);
716 static HRESULT WINAPI
ITextRange_fnSetPara(ITextRange
*me
, ITextPara
*pPara
)
718 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
720 return CO_E_RELEASED
;
722 FIXME("not implemented %p\n", This
);
726 static HRESULT WINAPI
ITextRange_fnGetStoryLength(ITextRange
*me
, LONG
*pcch
)
728 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
730 return CO_E_RELEASED
;
732 FIXME("not implemented %p\n", This
);
736 static HRESULT WINAPI
ITextRange_fnGetStoryType(ITextRange
*me
, LONG
*pValue
)
738 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
740 return CO_E_RELEASED
;
742 FIXME("not implemented %p\n", This
);
746 static HRESULT
range_Collapse(LONG bStart
, LONG
*start
, LONG
*end
)
751 if (bStart
== tomEnd
|| bStart
== tomFalse
)
758 static HRESULT WINAPI
ITextRange_fnCollapse(ITextRange
*me
, LONG bStart
)
760 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
762 return CO_E_RELEASED
;
764 return range_Collapse(bStart
, &This
->start
, &This
->end
);
767 static HRESULT WINAPI
ITextRange_fnExpand(ITextRange
*me
, LONG Unit
, LONG
*pDelta
)
769 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
771 return CO_E_RELEASED
;
773 FIXME("not implemented %p\n", This
);
777 static HRESULT WINAPI
ITextRange_fnGetIndex(ITextRange
*me
, LONG Unit
, LONG
*pIndex
)
779 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
781 return CO_E_RELEASED
;
783 FIXME("not implemented %p\n", This
);
787 static HRESULT WINAPI
ITextRange_fnSetIndex(ITextRange
*me
, LONG Unit
, LONG Index
,
790 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
792 return CO_E_RELEASED
;
794 FIXME("not implemented %p\n", This
);
798 static HRESULT WINAPI
ITextRange_fnSetRange(ITextRange
*me
, LONG cpActive
, LONG cpOther
)
800 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
802 return CO_E_RELEASED
;
804 FIXME("not implemented %p\n", This
);
808 static HRESULT WINAPI
ITextRange_fnInRange(ITextRange
*me
, ITextRange
*pRange
, LONG
*pb
)
810 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
812 return CO_E_RELEASED
;
814 FIXME("not implemented %p\n", This
);
818 static HRESULT WINAPI
ITextRange_fnInStory(ITextRange
*me
, ITextRange
*pRange
, LONG
*pb
)
820 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
822 return CO_E_RELEASED
;
824 FIXME("not implemented %p\n", This
);
828 static HRESULT WINAPI
ITextRange_fnIsEqual(ITextRange
*me
, ITextRange
*pRange
, LONG
*pb
)
830 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
832 return CO_E_RELEASED
;
834 FIXME("not implemented %p\n", This
);
838 static HRESULT WINAPI
ITextRange_fnSelect(ITextRange
*me
)
840 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
842 return CO_E_RELEASED
;
844 FIXME("not implemented %p\n", This
);
848 static HRESULT WINAPI
ITextRange_fnStartOf(ITextRange
*me
, LONG Unit
, LONG Extend
,
851 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
853 return CO_E_RELEASED
;
855 FIXME("not implemented %p\n", This
);
859 static HRESULT WINAPI
ITextRange_fnEndOf(ITextRange
*me
, LONG Unit
, LONG Extend
,
862 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
864 return CO_E_RELEASED
;
866 FIXME("not implemented %p\n", This
);
870 static HRESULT WINAPI
ITextRange_fnMove(ITextRange
*me
, LONG Unit
, LONG Count
, LONG
*pDelta
)
872 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
874 return CO_E_RELEASED
;
876 FIXME("not implemented %p\n", This
);
880 static HRESULT WINAPI
ITextRange_fnMoveStart(ITextRange
*me
, LONG Unit
, LONG Count
,
883 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
885 return CO_E_RELEASED
;
887 FIXME("not implemented %p\n", This
);
891 static HRESULT WINAPI
ITextRange_fnMoveEnd(ITextRange
*me
, LONG Unit
, LONG Count
,
894 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
896 return CO_E_RELEASED
;
898 FIXME("not implemented %p\n", This
);
902 static HRESULT WINAPI
ITextRange_fnMoveWhile(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
905 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
907 return CO_E_RELEASED
;
909 FIXME("not implemented %p\n", This
);
913 static HRESULT WINAPI
ITextRange_fnMoveStartWhile(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
916 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
918 return CO_E_RELEASED
;
920 FIXME("not implemented %p\n", This
);
924 static HRESULT WINAPI
ITextRange_fnMoveEndWhile(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
927 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
929 return CO_E_RELEASED
;
931 FIXME("not implemented %p\n", This
);
935 static HRESULT WINAPI
ITextRange_fnMoveUntil(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
938 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
940 return CO_E_RELEASED
;
942 FIXME("not implemented %p\n", This
);
946 static HRESULT WINAPI
ITextRange_fnMoveStartUntil(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
949 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
951 return CO_E_RELEASED
;
953 FIXME("not implemented %p\n", This
);
957 static HRESULT WINAPI
ITextRange_fnMoveEndUntil(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
960 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
962 return CO_E_RELEASED
;
964 FIXME("not implemented %p\n", This
);
968 static HRESULT WINAPI
ITextRange_fnFindText(ITextRange
*me
, BSTR bstr
, LONG cch
, LONG Flags
,
971 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
973 return CO_E_RELEASED
;
975 FIXME("not implemented %p\n", This
);
979 static HRESULT WINAPI
ITextRange_fnFindTextStart(ITextRange
*me
, BSTR bstr
, LONG cch
,
980 LONG Flags
, LONG
*pLength
)
982 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
984 return CO_E_RELEASED
;
986 FIXME("not implemented %p\n", This
);
990 static HRESULT WINAPI
ITextRange_fnFindTextEnd(ITextRange
*me
, BSTR bstr
, LONG cch
,
991 LONG Flags
, LONG
*pLength
)
993 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
995 return CO_E_RELEASED
;
997 FIXME("not implemented %p\n", This
);
1001 static HRESULT WINAPI
ITextRange_fnDelete(ITextRange
*me
, LONG Unit
, LONG Count
,
1004 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1006 return CO_E_RELEASED
;
1008 FIXME("not implemented %p\n", This
);
1012 static HRESULT WINAPI
ITextRange_fnCut(ITextRange
*me
, VARIANT
*pVar
)
1014 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1016 return CO_E_RELEASED
;
1018 FIXME("not implemented %p\n", This
);
1022 static HRESULT WINAPI
ITextRange_fnCopy(ITextRange
*me
, VARIANT
*pVar
)
1024 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1026 return CO_E_RELEASED
;
1028 FIXME("not implemented %p\n", This
);
1032 static HRESULT WINAPI
ITextRange_fnPaste(ITextRange
*me
, VARIANT
*pVar
, LONG Format
)
1034 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1036 return CO_E_RELEASED
;
1038 FIXME("not implemented %p\n", This
);
1042 static HRESULT WINAPI
ITextRange_fnCanPaste(ITextRange
*me
, VARIANT
*pVar
, LONG Format
,
1045 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1047 return CO_E_RELEASED
;
1049 FIXME("not implemented %p\n", This
);
1053 static HRESULT WINAPI
ITextRange_fnCanEdit(ITextRange
*me
, LONG
*pb
)
1055 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1057 return CO_E_RELEASED
;
1059 FIXME("not implemented %p\n", This
);
1063 static HRESULT WINAPI
ITextRange_fnChangeCase(ITextRange
*me
, LONG Type
)
1065 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1067 return CO_E_RELEASED
;
1069 FIXME("not implemented %p\n", This
);
1073 static HRESULT WINAPI
ITextRange_fnGetPoint(ITextRange
*me
, LONG Type
, LONG
*cx
, LONG
*cy
)
1075 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1077 return CO_E_RELEASED
;
1079 FIXME("not implemented %p\n", This
);
1083 static HRESULT WINAPI
ITextRange_fnSetPoint(ITextRange
*me
, LONG x
, LONG y
, LONG Type
,
1086 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1088 return CO_E_RELEASED
;
1090 FIXME("not implemented %p\n", This
);
1094 static HRESULT WINAPI
ITextRange_fnScrollIntoView(ITextRange
*me
, LONG Value
)
1096 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1098 return CO_E_RELEASED
;
1100 FIXME("not implemented %p\n", This
);
1104 static HRESULT WINAPI
ITextRange_fnGetEmbeddedObject(ITextRange
*me
, IUnknown
**ppv
)
1106 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1108 return CO_E_RELEASED
;
1110 FIXME("not implemented %p\n", This
);
1114 static const ITextRangeVtbl trvt
= {
1115 ITextRange_fnQueryInterface
,
1116 ITextRange_fnAddRef
,
1117 ITextRange_fnRelease
,
1118 ITextRange_fnGetTypeInfoCount
,
1119 ITextRange_fnGetTypeInfo
,
1120 ITextRange_fnGetIDsOfNames
,
1121 ITextRange_fnInvoke
,
1122 ITextRange_fnGetText
,
1123 ITextRange_fnSetText
,
1124 ITextRange_fnGetChar
,
1125 ITextRange_fnSetChar
,
1126 ITextRange_fnGetDuplicate
,
1127 ITextRange_fnGetFormattedText
,
1128 ITextRange_fnSetFormattedText
,
1129 ITextRange_fnGetStart
,
1130 ITextRange_fnSetStart
,
1131 ITextRange_fnGetEnd
,
1132 ITextRange_fnSetEnd
,
1133 ITextRange_fnGetFont
,
1134 ITextRange_fnSetFont
,
1135 ITextRange_fnGetPara
,
1136 ITextRange_fnSetPara
,
1137 ITextRange_fnGetStoryLength
,
1138 ITextRange_fnGetStoryType
,
1139 ITextRange_fnCollapse
,
1140 ITextRange_fnExpand
,
1141 ITextRange_fnGetIndex
,
1142 ITextRange_fnSetIndex
,
1143 ITextRange_fnSetRange
,
1144 ITextRange_fnInRange
,
1145 ITextRange_fnInStory
,
1146 ITextRange_fnIsEqual
,
1147 ITextRange_fnSelect
,
1148 ITextRange_fnStartOf
,
1151 ITextRange_fnMoveStart
,
1152 ITextRange_fnMoveEnd
,
1153 ITextRange_fnMoveWhile
,
1154 ITextRange_fnMoveStartWhile
,
1155 ITextRange_fnMoveEndWhile
,
1156 ITextRange_fnMoveUntil
,
1157 ITextRange_fnMoveStartUntil
,
1158 ITextRange_fnMoveEndUntil
,
1159 ITextRange_fnFindText
,
1160 ITextRange_fnFindTextStart
,
1161 ITextRange_fnFindTextEnd
,
1162 ITextRange_fnDelete
,
1166 ITextRange_fnCanPaste
,
1167 ITextRange_fnCanEdit
,
1168 ITextRange_fnChangeCase
,
1169 ITextRange_fnGetPoint
,
1170 ITextRange_fnSetPoint
,
1171 ITextRange_fnScrollIntoView
,
1172 ITextRange_fnGetEmbeddedObject
1174 /* ITextRange interface */
1176 static HRESULT WINAPI
1177 ITextDocument_fnQueryInterface(ITextDocument
* me
, REFIID riid
,
1180 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1181 return IRichEditOle_QueryInterface(&This
->IRichEditOle_iface
, riid
, ppvObject
);
1185 ITextDocument_fnAddRef(ITextDocument
* me
)
1187 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1188 return IRichEditOle_AddRef(&This
->IRichEditOle_iface
);
1192 ITextDocument_fnRelease(ITextDocument
* me
)
1194 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1195 return IRichEditOle_Release(&This
->IRichEditOle_iface
);
1198 static HRESULT WINAPI
1199 ITextDocument_fnGetTypeInfoCount(ITextDocument
* me
,
1202 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1203 FIXME("stub %p\n",This
);
1207 static HRESULT WINAPI
1208 ITextDocument_fnGetTypeInfo(ITextDocument
* me
, UINT iTInfo
, LCID lcid
,
1209 ITypeInfo
** ppTInfo
)
1211 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1212 FIXME("stub %p\n",This
);
1216 static HRESULT WINAPI
1217 ITextDocument_fnGetIDsOfNames(ITextDocument
* me
, REFIID riid
,
1218 LPOLESTR
* rgszNames
, UINT cNames
, LCID lcid
, DISPID
* rgDispId
)
1220 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1221 FIXME("stub %p\n",This
);
1225 static HRESULT WINAPI
1226 ITextDocument_fnInvoke(ITextDocument
* me
, DISPID dispIdMember
,
1227 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
* pDispParams
,
1228 VARIANT
* pVarResult
, EXCEPINFO
* pExcepInfo
, UINT
* puArgErr
)
1230 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1231 FIXME("stub %p\n",This
);
1235 static HRESULT WINAPI
1236 ITextDocument_fnGetName(ITextDocument
* me
, BSTR
* pName
)
1238 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1239 FIXME("stub %p\n",This
);
1243 static HRESULT WINAPI
1244 ITextDocument_fnGetSelection(ITextDocument
* me
, ITextSelection
** ppSel
)
1246 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1247 TRACE("(%p)\n", me
);
1250 return E_INVALIDARG
;
1251 *ppSel
= &This
->txtSel
->ITextSelection_iface
;
1252 ITextSelection_AddRef(*ppSel
);
1256 static HRESULT WINAPI
1257 ITextDocument_fnGetStoryCount(ITextDocument
* me
, LONG
* pCount
)
1259 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1260 FIXME("stub %p\n",This
);
1264 static HRESULT WINAPI
1265 ITextDocument_fnGetStoryRanges(ITextDocument
* me
,
1266 ITextStoryRanges
** ppStories
)
1268 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1269 FIXME("stub %p\n",This
);
1273 static HRESULT WINAPI
1274 ITextDocument_fnGetSaved(ITextDocument
* me
, LONG
* pValue
)
1276 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1277 FIXME("stub %p\n",This
);
1281 static HRESULT WINAPI
1282 ITextDocument_fnSetSaved(ITextDocument
* me
, LONG Value
)
1284 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1285 FIXME("stub %p\n",This
);
1289 static HRESULT WINAPI
1290 ITextDocument_fnGetDefaultTabStop(ITextDocument
* me
, float* pValue
)
1292 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1293 FIXME("stub %p\n",This
);
1297 static HRESULT WINAPI
1298 ITextDocument_fnSetDefaultTabStop(ITextDocument
* me
, float Value
)
1300 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1301 FIXME("stub %p\n",This
);
1305 static HRESULT WINAPI
1306 ITextDocument_fnNew(ITextDocument
* me
)
1308 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1309 FIXME("stub %p\n",This
);
1313 static HRESULT WINAPI
1314 ITextDocument_fnOpen(ITextDocument
* me
, VARIANT
* pVar
, LONG Flags
,
1317 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1318 FIXME("stub %p\n",This
);
1322 static HRESULT WINAPI
1323 ITextDocument_fnSave(ITextDocument
* me
, VARIANT
* pVar
, LONG Flags
,
1326 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1327 FIXME("stub %p\n",This
);
1331 static HRESULT WINAPI
1332 ITextDocument_fnFreeze(ITextDocument
* me
, LONG
* pCount
)
1334 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1335 FIXME("stub %p\n",This
);
1339 static HRESULT WINAPI
1340 ITextDocument_fnUnfreeze(ITextDocument
* me
, LONG
* pCount
)
1342 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1343 FIXME("stub %p\n",This
);
1347 static HRESULT WINAPI
1348 ITextDocument_fnBeginEditCollection(ITextDocument
* me
)
1350 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1351 FIXME("stub %p\n",This
);
1355 static HRESULT WINAPI
1356 ITextDocument_fnEndEditCollection(ITextDocument
* me
)
1358 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1359 FIXME("stub %p\n",This
);
1363 static HRESULT WINAPI
1364 ITextDocument_fnUndo(ITextDocument
* me
, LONG Count
, LONG
* prop
)
1366 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1367 FIXME("stub %p\n",This
);
1371 static HRESULT WINAPI
1372 ITextDocument_fnRedo(ITextDocument
* me
, LONG Count
, LONG
* prop
)
1374 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1375 FIXME("stub %p\n",This
);
1379 static HRESULT
CreateITextRange(IRichEditOleImpl
*reOle
, LONG start
, LONG end
, ITextRange
** ppRange
)
1381 ITextRangeImpl
*txtRge
= heap_alloc(sizeof(ITextRangeImpl
));
1384 return E_OUTOFMEMORY
;
1385 txtRge
->ITextRange_iface
.lpVtbl
= &trvt
;
1387 txtRge
->reOle
= reOle
;
1388 txtRge
->start
= start
;
1390 list_add_head(&reOle
->rangelist
, &txtRge
->entry
);
1391 *ppRange
= &txtRge
->ITextRange_iface
;
1395 static HRESULT WINAPI
1396 ITextDocument_fnRange(ITextDocument
* me
, LONG cp1
, LONG cp2
,
1397 ITextRange
** ppRange
)
1399 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1400 const int len
= ME_GetTextLength(This
->editor
) + 1;
1402 TRACE("%p %p %d %d\n", This
, ppRange
, cp1
, cp2
);
1404 return E_INVALIDARG
;
1408 cp1
= min(cp1
, len
);
1409 cp2
= min(cp2
, len
);
1418 cp1
= cp2
= len
- 1;
1420 return CreateITextRange(This
, cp1
, cp2
, ppRange
);
1423 static HRESULT WINAPI
1424 ITextDocument_fnRangeFromPoint(ITextDocument
* me
, LONG x
, LONG y
,
1425 ITextRange
** ppRange
)
1427 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1428 FIXME("stub %p\n",This
);
1432 static const ITextDocumentVtbl tdvt
= {
1433 ITextDocument_fnQueryInterface
,
1434 ITextDocument_fnAddRef
,
1435 ITextDocument_fnRelease
,
1436 ITextDocument_fnGetTypeInfoCount
,
1437 ITextDocument_fnGetTypeInfo
,
1438 ITextDocument_fnGetIDsOfNames
,
1439 ITextDocument_fnInvoke
,
1440 ITextDocument_fnGetName
,
1441 ITextDocument_fnGetSelection
,
1442 ITextDocument_fnGetStoryCount
,
1443 ITextDocument_fnGetStoryRanges
,
1444 ITextDocument_fnGetSaved
,
1445 ITextDocument_fnSetSaved
,
1446 ITextDocument_fnGetDefaultTabStop
,
1447 ITextDocument_fnSetDefaultTabStop
,
1448 ITextDocument_fnNew
,
1449 ITextDocument_fnOpen
,
1450 ITextDocument_fnSave
,
1451 ITextDocument_fnFreeze
,
1452 ITextDocument_fnUnfreeze
,
1453 ITextDocument_fnBeginEditCollection
,
1454 ITextDocument_fnEndEditCollection
,
1455 ITextDocument_fnUndo
,
1456 ITextDocument_fnRedo
,
1457 ITextDocument_fnRange
,
1458 ITextDocument_fnRangeFromPoint
1461 static inline ITextSelectionImpl
*impl_from_ITextSelection(ITextSelection
*iface
)
1463 return CONTAINING_RECORD(iface
, ITextSelectionImpl
, ITextSelection_iface
);
1466 static HRESULT WINAPI
ITextSelection_fnQueryInterface(
1472 if (IsEqualGUID(riid
, &IID_IUnknown
)
1473 || IsEqualGUID(riid
, &IID_IDispatch
)
1474 || IsEqualGUID(riid
, &IID_ITextRange
)
1475 || IsEqualGUID(riid
, &IID_ITextSelection
))
1478 ITextSelection_AddRef(me
);
1482 return E_NOINTERFACE
;
1485 static ULONG WINAPI
ITextSelection_fnAddRef(ITextSelection
*me
)
1487 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1488 return InterlockedIncrement(&This
->ref
);
1491 static ULONG WINAPI
ITextSelection_fnRelease(ITextSelection
*me
)
1493 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1494 ULONG ref
= InterlockedDecrement(&This
->ref
);
1500 static HRESULT WINAPI
ITextSelection_fnGetTypeInfoCount(ITextSelection
*me
, UINT
*pctinfo
)
1502 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1504 return CO_E_RELEASED
;
1506 FIXME("not implemented\n");
1510 static HRESULT WINAPI
ITextSelection_fnGetTypeInfo(ITextSelection
*me
, UINT iTInfo
, LCID lcid
,
1511 ITypeInfo
**ppTInfo
)
1513 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1515 return CO_E_RELEASED
;
1517 FIXME("not implemented\n");
1521 static HRESULT WINAPI
ITextSelection_fnGetIDsOfNames(ITextSelection
*me
, REFIID riid
,
1522 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
1524 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1526 return CO_E_RELEASED
;
1528 FIXME("not implemented\n");
1532 static HRESULT WINAPI
ITextSelection_fnInvoke(
1534 DISPID dispIdMember
,
1538 DISPPARAMS
*pDispParams
,
1539 VARIANT
*pVarResult
,
1540 EXCEPINFO
*pExcepInfo
,
1543 FIXME("not implemented\n");
1547 /*** ITextRange methods ***/
1548 static HRESULT WINAPI
ITextSelection_fnGetText(ITextSelection
*me
, BSTR
*pbstr
)
1550 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1551 ME_Cursor
*start
= NULL
, *end
= NULL
;
1556 return CO_E_RELEASED
;
1557 TRACE("%p\n", pbstr
);
1559 return E_INVALIDARG
;
1561 ME_GetSelection(This
->reOle
->editor
, &start
, &end
);
1562 endOfs
= ME_GetCursorOfs(end
);
1563 nChars
= endOfs
- ME_GetCursorOfs(start
);
1570 *pbstr
= SysAllocStringLen(NULL
, nChars
);
1572 return E_OUTOFMEMORY
;
1574 bEOP
= (end
->pRun
->next
->type
== diTextEnd
&& endOfs
> ME_GetTextLength(This
->reOle
->editor
));
1575 ME_GetTextW(This
->reOle
->editor
, *pbstr
, nChars
, start
, nChars
, FALSE
, bEOP
);
1576 TRACE("%s\n", wine_dbgstr_w(*pbstr
));
1581 static HRESULT WINAPI
ITextSelection_fnSetText(ITextSelection
*me
, BSTR bstr
)
1583 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1585 return CO_E_RELEASED
;
1587 FIXME("not implemented\n");
1591 static HRESULT WINAPI
ITextSelection_fnGetChar(ITextSelection
*me
, LONG
*pch
)
1593 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1594 ME_Cursor
*start
= NULL
, *end
= NULL
;
1597 return CO_E_RELEASED
;
1600 return E_INVALIDARG
;
1602 ME_GetSelection(This
->reOle
->editor
, &start
, &end
);
1603 return range_GetChar(This
->reOle
->editor
, start
, pch
);
1606 static HRESULT WINAPI
ITextSelection_fnSetChar(ITextSelection
*me
, LONG ch
)
1608 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1610 return CO_E_RELEASED
;
1612 FIXME("not implemented\n");
1616 static HRESULT WINAPI
ITextSelection_fnGetDuplicate(ITextSelection
*me
, ITextRange
**ppRange
)
1618 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1620 return CO_E_RELEASED
;
1622 FIXME("not implemented\n");
1626 static HRESULT WINAPI
ITextSelection_fnGetFormattedText(ITextSelection
*me
, ITextRange
**ppRange
)
1628 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1630 return CO_E_RELEASED
;
1632 FIXME("not implemented\n");
1636 static HRESULT WINAPI
ITextSelection_fnSetFormattedText(ITextSelection
*me
, ITextRange
*pRange
)
1638 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1640 return CO_E_RELEASED
;
1642 FIXME("not implemented\n");
1646 static HRESULT WINAPI
ITextSelection_fnGetStart(ITextSelection
*me
, LONG
*pcpFirst
)
1648 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1651 return CO_E_RELEASED
;
1654 return E_INVALIDARG
;
1655 ME_GetSelectionOfs(This
->reOle
->editor
, pcpFirst
, &lim
);
1656 TRACE("%d\n", *pcpFirst
);
1660 static HRESULT WINAPI
ITextSelection_fnSetStart(ITextSelection
*me
, LONG cpFirst
)
1662 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1664 return CO_E_RELEASED
;
1666 FIXME("not implemented\n");
1670 static HRESULT WINAPI
ITextSelection_fnGetEnd(ITextSelection
*me
, LONG
*pcpLim
)
1672 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1675 return CO_E_RELEASED
;
1678 return E_INVALIDARG
;
1679 ME_GetSelectionOfs(This
->reOle
->editor
, &first
, pcpLim
);
1680 TRACE("%d\n", *pcpLim
);
1684 static HRESULT WINAPI
ITextSelection_fnSetEnd(ITextSelection
*me
, LONG cpLim
)
1686 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1688 return CO_E_RELEASED
;
1690 FIXME("not implemented\n");
1694 static HRESULT WINAPI
ITextSelection_fnGetFont(ITextSelection
*me
, ITextFont
**pFont
)
1696 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1698 return CO_E_RELEASED
;
1700 FIXME("not implemented\n");
1704 static HRESULT WINAPI
ITextSelection_fnSetFont(ITextSelection
*me
, ITextFont
*pFont
)
1706 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1708 return CO_E_RELEASED
;
1710 FIXME("not implemented\n");
1714 static HRESULT WINAPI
ITextSelection_fnGetPara(ITextSelection
*me
, ITextPara
**ppPara
)
1716 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1718 return CO_E_RELEASED
;
1720 FIXME("not implemented\n");
1724 static HRESULT WINAPI
ITextSelection_fnSetPara(ITextSelection
*me
, ITextPara
*pPara
)
1726 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1728 return CO_E_RELEASED
;
1730 FIXME("not implemented\n");
1734 static HRESULT WINAPI
ITextSelection_fnGetStoryLength(ITextSelection
*me
, LONG
*pcch
)
1736 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1738 return CO_E_RELEASED
;
1740 FIXME("not implemented\n");
1744 static HRESULT WINAPI
ITextSelection_fnGetStoryType(ITextSelection
*me
, LONG
*pValue
)
1746 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1748 return CO_E_RELEASED
;
1750 FIXME("not implemented\n");
1754 static HRESULT WINAPI
ITextSelection_fnCollapse(ITextSelection
*me
, LONG bStart
)
1756 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1760 return CO_E_RELEASED
;
1762 ME_GetSelectionOfs(This
->reOle
->editor
, &start
, &end
);
1763 hres
= range_Collapse(bStart
, &start
, &end
);
1764 if (SUCCEEDED(hres
))
1765 ME_SetSelection(This
->reOle
->editor
, start
, end
);
1769 static HRESULT WINAPI
ITextSelection_fnExpand(ITextSelection
*me
, LONG Unit
, LONG
*pDelta
)
1771 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1773 return CO_E_RELEASED
;
1775 FIXME("not implemented\n");
1779 static HRESULT WINAPI
ITextSelection_fnGetIndex(ITextSelection
*me
, LONG Unit
, LONG
*pIndex
)
1781 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1783 return CO_E_RELEASED
;
1785 FIXME("not implemented\n");
1789 static HRESULT WINAPI
ITextSelection_fnSetIndex(ITextSelection
*me
, LONG Unit
, LONG Index
,
1792 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1794 return CO_E_RELEASED
;
1796 FIXME("not implemented\n");
1800 static HRESULT WINAPI
ITextSelection_fnSetRange(ITextSelection
*me
, LONG cpActive
, LONG cpOther
)
1802 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1804 return CO_E_RELEASED
;
1806 FIXME("not implemented\n");
1810 static HRESULT WINAPI
ITextSelection_fnInRange(ITextSelection
*me
, ITextRange
*pRange
, LONG
*pb
)
1812 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1814 return CO_E_RELEASED
;
1816 FIXME("not implemented\n");
1820 static HRESULT WINAPI
ITextSelection_fnInStory(ITextSelection
*me
, ITextRange
*pRange
, LONG
*pb
)
1822 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1824 return CO_E_RELEASED
;
1826 FIXME("not implemented\n");
1830 static HRESULT WINAPI
ITextSelection_fnIsEqual(ITextSelection
*me
, ITextRange
*pRange
, LONG
*pb
)
1832 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1834 return CO_E_RELEASED
;
1836 FIXME("not implemented\n");
1840 static HRESULT WINAPI
ITextSelection_fnSelect(ITextSelection
*me
)
1842 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1844 return CO_E_RELEASED
;
1846 FIXME("not implemented\n");
1850 static HRESULT WINAPI
ITextSelection_fnStartOf(ITextSelection
*me
, LONG Unit
, LONG Extend
,
1853 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1855 return CO_E_RELEASED
;
1857 FIXME("not implemented\n");
1861 static HRESULT WINAPI
ITextSelection_fnEndOf(ITextSelection
*me
, LONG Unit
, LONG Extend
,
1864 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1866 return CO_E_RELEASED
;
1868 FIXME("not implemented\n");
1872 static HRESULT WINAPI
ITextSelection_fnMove(ITextSelection
*me
, LONG Unit
, LONG Count
, LONG
*pDelta
)
1874 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1876 return CO_E_RELEASED
;
1878 FIXME("not implemented\n");
1882 static HRESULT WINAPI
ITextSelection_fnMoveStart(ITextSelection
*me
, LONG Unit
, LONG Count
,
1885 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1887 return CO_E_RELEASED
;
1889 FIXME("not implemented\n");
1893 static HRESULT WINAPI
ITextSelection_fnMoveEnd(ITextSelection
*me
, LONG Unit
, LONG Count
,
1896 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1898 return CO_E_RELEASED
;
1900 FIXME("not implemented\n");
1904 static HRESULT WINAPI
ITextSelection_fnMoveWhile(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1907 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1909 return CO_E_RELEASED
;
1911 FIXME("not implemented\n");
1915 static HRESULT WINAPI
ITextSelection_fnMoveStartWhile(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1918 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1920 return CO_E_RELEASED
;
1922 FIXME("not implemented\n");
1926 static HRESULT WINAPI
ITextSelection_fnMoveEndWhile(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1929 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1931 return CO_E_RELEASED
;
1933 FIXME("not implemented\n");
1937 static HRESULT WINAPI
ITextSelection_fnMoveUntil(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1940 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1942 return CO_E_RELEASED
;
1944 FIXME("not implemented\n");
1948 static HRESULT WINAPI
ITextSelection_fnMoveStartUntil(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1951 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1953 return CO_E_RELEASED
;
1955 FIXME("not implemented\n");
1959 static HRESULT WINAPI
ITextSelection_fnMoveEndUntil(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1962 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1964 return CO_E_RELEASED
;
1966 FIXME("not implemented\n");
1970 static HRESULT WINAPI
ITextSelection_fnFindText(ITextSelection
*me
, BSTR bstr
, LONG cch
, LONG Flags
,
1973 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1975 return CO_E_RELEASED
;
1977 FIXME("not implemented\n");
1981 static HRESULT WINAPI
ITextSelection_fnFindTextStart(ITextSelection
*me
, BSTR bstr
, LONG cch
,
1982 LONG Flags
, LONG
*pLength
)
1984 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1986 return CO_E_RELEASED
;
1988 FIXME("not implemented\n");
1992 static HRESULT WINAPI
ITextSelection_fnFindTextEnd(ITextSelection
*me
, BSTR bstr
, LONG cch
,
1993 LONG Flags
, LONG
*pLength
)
1995 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1997 return CO_E_RELEASED
;
1999 FIXME("not implemented\n");
2003 static HRESULT WINAPI
ITextSelection_fnDelete(ITextSelection
*me
, LONG Unit
, LONG Count
,
2006 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2008 return CO_E_RELEASED
;
2010 FIXME("not implemented\n");
2014 static HRESULT WINAPI
ITextSelection_fnCut(ITextSelection
*me
, VARIANT
*pVar
)
2016 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2018 return CO_E_RELEASED
;
2020 FIXME("not implemented\n");
2024 static HRESULT WINAPI
ITextSelection_fnCopy(ITextSelection
*me
, VARIANT
*pVar
)
2026 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2028 return CO_E_RELEASED
;
2030 FIXME("not implemented\n");
2034 static HRESULT WINAPI
ITextSelection_fnPaste(ITextSelection
*me
, VARIANT
*pVar
, LONG Format
)
2036 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2038 return CO_E_RELEASED
;
2040 FIXME("not implemented\n");
2044 static HRESULT WINAPI
ITextSelection_fnCanPaste(ITextSelection
*me
, VARIANT
*pVar
, LONG Format
,
2047 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2049 return CO_E_RELEASED
;
2051 FIXME("not implemented\n");
2055 static HRESULT WINAPI
ITextSelection_fnCanEdit(ITextSelection
*me
, LONG
*pb
)
2057 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2059 return CO_E_RELEASED
;
2061 FIXME("not implemented\n");
2065 static HRESULT WINAPI
ITextSelection_fnChangeCase(ITextSelection
*me
, LONG Type
)
2067 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2069 return CO_E_RELEASED
;
2071 FIXME("not implemented\n");
2075 static HRESULT WINAPI
ITextSelection_fnGetPoint(ITextSelection
*me
, LONG Type
, LONG
*cx
, LONG
*cy
)
2077 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2079 return CO_E_RELEASED
;
2081 FIXME("not implemented\n");
2085 static HRESULT WINAPI
ITextSelection_fnSetPoint(ITextSelection
*me
, LONG x
, LONG y
, LONG Type
,
2088 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2090 return CO_E_RELEASED
;
2092 FIXME("not implemented\n");
2096 static HRESULT WINAPI
ITextSelection_fnScrollIntoView(ITextSelection
*me
, LONG Value
)
2098 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2100 return CO_E_RELEASED
;
2102 FIXME("not implemented\n");
2106 static HRESULT WINAPI
ITextSelection_fnGetEmbeddedObject(ITextSelection
*me
, IUnknown
**ppv
)
2108 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2110 return CO_E_RELEASED
;
2112 FIXME("not implemented\n");
2116 /*** ITextSelection methods ***/
2117 static HRESULT WINAPI
ITextSelection_fnGetFlags(ITextSelection
*me
, LONG
*pFlags
)
2119 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2121 return CO_E_RELEASED
;
2123 FIXME("not implemented\n");
2127 static HRESULT WINAPI
ITextSelection_fnSetFlags(ITextSelection
*me
, LONG Flags
)
2129 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2131 return CO_E_RELEASED
;
2133 FIXME("not implemented\n");
2137 static HRESULT WINAPI
ITextSelection_fnGetType(ITextSelection
*me
, LONG
*pType
)
2139 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2141 return CO_E_RELEASED
;
2143 FIXME("not implemented\n");
2147 static HRESULT WINAPI
ITextSelection_fnMoveLeft(ITextSelection
*me
, LONG Unit
, LONG Count
,
2148 LONG Extend
, LONG
*pDelta
)
2150 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2152 return CO_E_RELEASED
;
2154 FIXME("not implemented\n");
2158 static HRESULT WINAPI
ITextSelection_fnMoveRight(ITextSelection
*me
, LONG Unit
, LONG Count
,
2159 LONG Extend
, LONG
*pDelta
)
2161 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2163 return CO_E_RELEASED
;
2165 FIXME("not implemented\n");
2169 static HRESULT WINAPI
ITextSelection_fnMoveUp(ITextSelection
*me
, LONG Unit
, LONG Count
,
2170 LONG Extend
, LONG
*pDelta
)
2172 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2174 return CO_E_RELEASED
;
2176 FIXME("not implemented\n");
2180 static HRESULT WINAPI
ITextSelection_fnMoveDown(ITextSelection
*me
, LONG Unit
, LONG Count
,
2181 LONG Extend
, LONG
*pDelta
)
2183 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2185 return CO_E_RELEASED
;
2187 FIXME("not implemented\n");
2191 static HRESULT WINAPI
ITextSelection_fnHomeKey(ITextSelection
*me
, LONG Unit
, LONG Extend
,
2194 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2196 return CO_E_RELEASED
;
2198 FIXME("not implemented\n");
2202 static HRESULT WINAPI
ITextSelection_fnEndKey(ITextSelection
*me
, LONG Unit
, LONG Extend
,
2205 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2207 return CO_E_RELEASED
;
2209 FIXME("not implemented\n");
2213 static HRESULT WINAPI
ITextSelection_fnTypeText(ITextSelection
*me
, BSTR bstr
)
2215 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2217 return CO_E_RELEASED
;
2219 FIXME("not implemented\n");
2223 static const ITextSelectionVtbl tsvt
= {
2224 ITextSelection_fnQueryInterface
,
2225 ITextSelection_fnAddRef
,
2226 ITextSelection_fnRelease
,
2227 ITextSelection_fnGetTypeInfoCount
,
2228 ITextSelection_fnGetTypeInfo
,
2229 ITextSelection_fnGetIDsOfNames
,
2230 ITextSelection_fnInvoke
,
2231 ITextSelection_fnGetText
,
2232 ITextSelection_fnSetText
,
2233 ITextSelection_fnGetChar
,
2234 ITextSelection_fnSetChar
,
2235 ITextSelection_fnGetDuplicate
,
2236 ITextSelection_fnGetFormattedText
,
2237 ITextSelection_fnSetFormattedText
,
2238 ITextSelection_fnGetStart
,
2239 ITextSelection_fnSetStart
,
2240 ITextSelection_fnGetEnd
,
2241 ITextSelection_fnSetEnd
,
2242 ITextSelection_fnGetFont
,
2243 ITextSelection_fnSetFont
,
2244 ITextSelection_fnGetPara
,
2245 ITextSelection_fnSetPara
,
2246 ITextSelection_fnGetStoryLength
,
2247 ITextSelection_fnGetStoryType
,
2248 ITextSelection_fnCollapse
,
2249 ITextSelection_fnExpand
,
2250 ITextSelection_fnGetIndex
,
2251 ITextSelection_fnSetIndex
,
2252 ITextSelection_fnSetRange
,
2253 ITextSelection_fnInRange
,
2254 ITextSelection_fnInStory
,
2255 ITextSelection_fnIsEqual
,
2256 ITextSelection_fnSelect
,
2257 ITextSelection_fnStartOf
,
2258 ITextSelection_fnEndOf
,
2259 ITextSelection_fnMove
,
2260 ITextSelection_fnMoveStart
,
2261 ITextSelection_fnMoveEnd
,
2262 ITextSelection_fnMoveWhile
,
2263 ITextSelection_fnMoveStartWhile
,
2264 ITextSelection_fnMoveEndWhile
,
2265 ITextSelection_fnMoveUntil
,
2266 ITextSelection_fnMoveStartUntil
,
2267 ITextSelection_fnMoveEndUntil
,
2268 ITextSelection_fnFindText
,
2269 ITextSelection_fnFindTextStart
,
2270 ITextSelection_fnFindTextEnd
,
2271 ITextSelection_fnDelete
,
2272 ITextSelection_fnCut
,
2273 ITextSelection_fnCopy
,
2274 ITextSelection_fnPaste
,
2275 ITextSelection_fnCanPaste
,
2276 ITextSelection_fnCanEdit
,
2277 ITextSelection_fnChangeCase
,
2278 ITextSelection_fnGetPoint
,
2279 ITextSelection_fnSetPoint
,
2280 ITextSelection_fnScrollIntoView
,
2281 ITextSelection_fnGetEmbeddedObject
,
2282 ITextSelection_fnGetFlags
,
2283 ITextSelection_fnSetFlags
,
2284 ITextSelection_fnGetType
,
2285 ITextSelection_fnMoveLeft
,
2286 ITextSelection_fnMoveRight
,
2287 ITextSelection_fnMoveUp
,
2288 ITextSelection_fnMoveDown
,
2289 ITextSelection_fnHomeKey
,
2290 ITextSelection_fnEndKey
,
2291 ITextSelection_fnTypeText
2294 static ITextSelectionImpl
*
2295 CreateTextSelection(IRichEditOleImpl
*reOle
)
2297 ITextSelectionImpl
*txtSel
= heap_alloc(sizeof *txtSel
);
2301 txtSel
->ITextSelection_iface
.lpVtbl
= &tsvt
;
2303 txtSel
->reOle
= reOle
;
2307 LRESULT
CreateIRichEditOle(ME_TextEditor
*editor
, LPVOID
*ppObj
)
2309 IRichEditOleImpl
*reo
;
2311 reo
= heap_alloc(sizeof(IRichEditOleImpl
));
2315 reo
->IRichEditOle_iface
.lpVtbl
= &revt
;
2316 reo
->ITextDocument_iface
.lpVtbl
= &tdvt
;
2318 reo
->editor
= editor
;
2319 reo
->txtSel
= CreateTextSelection(reo
);
2325 reo
->clientSite
= CreateOleClientSite(reo
);
2326 if (!reo
->clientSite
)
2328 ITextSelection_Release(&reo
->txtSel
->ITextSelection_iface
);
2332 TRACE("Created %p\n",reo
);
2334 list_init(&reo
->rangelist
);
2339 static void convert_sizel(const ME_Context
*c
, const SIZEL
* szl
, SIZE
* sz
)
2341 /* sizel is in .01 millimeters, sz in pixels */
2342 sz
->cx
= MulDiv(szl
->cx
, c
->dpi
.cx
, 2540);
2343 sz
->cy
= MulDiv(szl
->cy
, c
->dpi
.cy
, 2540);
2346 /******************************************************************************
2347 * ME_GetOLEObjectSize
2349 * Sets run extent for OLE objects.
2351 void ME_GetOLEObjectSize(const ME_Context
*c
, ME_Run
*run
, SIZE
*pSize
)
2359 assert(run
->nFlags
& MERF_GRAPHICS
);
2360 assert(run
->ole_obj
);
2362 if (run
->ole_obj
->sizel
.cx
!= 0 || run
->ole_obj
->sizel
.cy
!= 0)
2364 convert_sizel(c
, &run
->ole_obj
->sizel
, pSize
);
2365 if (c
->editor
->nZoomNumerator
!= 0)
2367 pSize
->cx
= MulDiv(pSize
->cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2368 pSize
->cy
= MulDiv(pSize
->cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2373 if (IOleObject_QueryInterface(run
->ole_obj
->poleobj
, &IID_IDataObject
, (void**)&ido
) != S_OK
)
2375 FIXME("Query Interface IID_IDataObject failed!\n");
2376 pSize
->cx
= pSize
->cy
= 0;
2379 fmt
.cfFormat
= CF_BITMAP
;
2381 fmt
.dwAspect
= DVASPECT_CONTENT
;
2383 fmt
.tymed
= TYMED_GDI
;
2384 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
2386 fmt
.cfFormat
= CF_ENHMETAFILE
;
2387 fmt
.tymed
= TYMED_ENHMF
;
2388 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
2390 FIXME("unsupported format\n");
2391 pSize
->cx
= pSize
->cy
= 0;
2392 IDataObject_Release(ido
);
2400 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
2401 pSize
->cx
= dibsect
.dsBm
.bmWidth
;
2402 pSize
->cy
= dibsect
.dsBm
.bmHeight
;
2403 if (!stgm
.pUnkForRelease
) DeleteObject(stgm
.u
.hBitmap
);
2406 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
2407 pSize
->cx
= emh
.rclBounds
.right
- emh
.rclBounds
.left
;
2408 pSize
->cy
= emh
.rclBounds
.bottom
- emh
.rclBounds
.top
;
2409 if (!stgm
.pUnkForRelease
) DeleteEnhMetaFile(stgm
.u
.hEnhMetaFile
);
2412 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
2415 IDataObject_Release(ido
);
2416 if (c
->editor
->nZoomNumerator
!= 0)
2418 pSize
->cx
= MulDiv(pSize
->cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2419 pSize
->cy
= MulDiv(pSize
->cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2423 void ME_DrawOLE(ME_Context
*c
, int x
, int y
, ME_Run
*run
,
2424 ME_Paragraph
*para
, BOOL selected
)
2435 assert(run
->nFlags
& MERF_GRAPHICS
);
2436 assert(run
->ole_obj
);
2437 if (IOleObject_QueryInterface(run
->ole_obj
->poleobj
, &IID_IDataObject
, (void**)&ido
) != S_OK
)
2439 FIXME("Couldn't get interface\n");
2442 has_size
= run
->ole_obj
->sizel
.cx
!= 0 || run
->ole_obj
->sizel
.cy
!= 0;
2443 fmt
.cfFormat
= CF_BITMAP
;
2445 fmt
.dwAspect
= DVASPECT_CONTENT
;
2447 fmt
.tymed
= TYMED_GDI
;
2448 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
2450 fmt
.cfFormat
= CF_ENHMETAFILE
;
2451 fmt
.tymed
= TYMED_ENHMF
;
2452 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
2454 FIXME("Couldn't get storage medium\n");
2455 IDataObject_Release(ido
);
2462 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
2463 hMemDC
= CreateCompatibleDC(c
->hDC
);
2464 SelectObject(hMemDC
, stgm
.u
.hBitmap
);
2467 convert_sizel(c
, &run
->ole_obj
->sizel
, &sz
);
2469 sz
.cx
= MulDiv(dibsect
.dsBm
.bmWidth
, c
->dpi
.cx
, 96);
2470 sz
.cy
= MulDiv(dibsect
.dsBm
.bmHeight
, c
->dpi
.cy
, 96);
2472 if (c
->editor
->nZoomNumerator
!= 0)
2474 sz
.cx
= MulDiv(sz
.cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2475 sz
.cy
= MulDiv(sz
.cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2477 if (sz
.cx
== dibsect
.dsBm
.bmWidth
&& sz
.cy
== dibsect
.dsBm
.bmHeight
)
2479 BitBlt(c
->hDC
, x
, y
- sz
.cy
,
2480 dibsect
.dsBm
.bmWidth
, dibsect
.dsBm
.bmHeight
,
2481 hMemDC
, 0, 0, SRCCOPY
);
2483 StretchBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
,
2484 hMemDC
, 0, 0, dibsect
.dsBm
.bmWidth
,
2485 dibsect
.dsBm
.bmHeight
, SRCCOPY
);
2488 if (!stgm
.pUnkForRelease
) DeleteObject(stgm
.u
.hBitmap
);
2491 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
2494 convert_sizel(c
, &run
->ole_obj
->sizel
, &sz
);
2496 sz
.cy
= MulDiv(emh
.rclBounds
.bottom
- emh
.rclBounds
.top
, c
->dpi
.cx
, 96);
2497 sz
.cx
= MulDiv(emh
.rclBounds
.right
- emh
.rclBounds
.left
, c
->dpi
.cy
, 96);
2499 if (c
->editor
->nZoomNumerator
!= 0)
2501 sz
.cx
= MulDiv(sz
.cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2502 sz
.cy
= MulDiv(sz
.cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2510 rc
.right
= x
+ sz
.cx
;
2512 PlayEnhMetaFile(c
->hDC
, stgm
.u
.hEnhMetaFile
, &rc
);
2514 if (!stgm
.pUnkForRelease
) DeleteEnhMetaFile(stgm
.u
.hEnhMetaFile
);
2517 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
2521 if (selected
&& !c
->editor
->bHideSelection
)
2522 PatBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
, DSTINVERT
);
2523 IDataObject_Release(ido
);
2526 void ME_DeleteReObject(REOBJECT
* reo
)
2528 if (reo
->poleobj
) IOleObject_Release(reo
->poleobj
);
2529 if (reo
->pstg
) IStorage_Release(reo
->pstg
);
2530 if (reo
->polesite
) IOleClientSite_Release(reo
->polesite
);
2534 void ME_CopyReObject(REOBJECT
* dst
, const REOBJECT
* src
)
2538 if (dst
->poleobj
) IOleObject_AddRef(dst
->poleobj
);
2539 if (dst
->pstg
) IStorage_AddRef(dst
->pstg
);
2540 if (dst
->polesite
) IOleClientSite_AddRef(dst
->polesite
);