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
26 WINE_DEFAULT_DEBUG_CHANNEL(richedit
);
28 /* there is no way to be consistent across different sets of headers - mingw, Wine, Win32 SDK*/
31 DEFINE_GUID(IID_ITextServices
, 0x8d33f740, 0xcf58, 0x11ce, 0xa8, 0x9d, 0x00, 0xaa, 0x00, 0x6c, 0xad, 0xc5);
32 DEFINE_GUID(IID_ITextHost
, 0x13e670f4,0x1a5a,0x11cf,0xab,0xeb,0x00,0xaa,0x00,0xb6,0x5e,0xa1);
33 DEFINE_GUID(IID_ITextHost2
, 0x13e670f5,0x1a5a,0x11cf,0xab,0xeb,0x00,0xaa,0x00,0xb6,0x5e,0xa1);
34 DEFINE_GUID(IID_ITextDocument
, 0x8cc497c0, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
35 DEFINE_GUID(IID_ITextRange
, 0x8cc497c2, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
36 DEFINE_GUID(IID_ITextSelection
, 0x8cc497c1, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
38 typedef struct ITextSelectionImpl ITextSelectionImpl
;
39 typedef struct IOleClientSiteImpl IOleClientSiteImpl
;
40 typedef struct ITextRangeImpl ITextRangeImpl
;
42 typedef struct IRichEditOleImpl
{
43 IRichEditOle IRichEditOle_iface
;
44 ITextDocument ITextDocument_iface
;
47 ME_TextEditor
*editor
;
48 ITextSelectionImpl
*txtSel
;
49 IOleClientSiteImpl
*clientSite
;
50 struct list rangelist
;
53 struct ITextRangeImpl
{
54 ITextRange ITextRange_iface
;
59 IRichEditOleImpl
*reOle
;
62 struct ITextSelectionImpl
{
63 ITextSelection ITextSelection_iface
;
66 IRichEditOleImpl
*reOle
;
69 struct IOleClientSiteImpl
{
70 IOleClientSite IOleClientSite_iface
;
73 IRichEditOleImpl
*reOle
;
76 static inline IRichEditOleImpl
*impl_from_IRichEditOle(IRichEditOle
*iface
)
78 return CONTAINING_RECORD(iface
, IRichEditOleImpl
, IRichEditOle_iface
);
81 static inline IRichEditOleImpl
*impl_from_ITextDocument(ITextDocument
*iface
)
83 return CONTAINING_RECORD(iface
, IRichEditOleImpl
, ITextDocument_iface
);
87 IRichEditOle_fnQueryInterface(IRichEditOle
*me
, REFIID riid
, LPVOID
*ppvObj
)
89 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
91 TRACE("%p %s\n", This
, debugstr_guid(riid
) );
94 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
95 IsEqualGUID(riid
, &IID_IRichEditOle
))
96 *ppvObj
= &This
->IRichEditOle_iface
;
97 else if (IsEqualGUID(riid
, &IID_ITextDocument
))
98 *ppvObj
= &This
->ITextDocument_iface
;
101 IRichEditOle_AddRef(me
);
104 FIXME("%p: unhandled interface %s\n", This
, debugstr_guid(riid
) );
106 return E_NOINTERFACE
;
110 IRichEditOle_fnAddRef(IRichEditOle
*me
)
112 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
113 ULONG ref
= InterlockedIncrement( &This
->ref
);
115 TRACE("%p ref = %u\n", This
, ref
);
121 IRichEditOle_fnRelease(IRichEditOle
*me
)
123 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
124 ULONG ref
= InterlockedDecrement(&This
->ref
);
126 TRACE ("%p ref=%u\n", This
, ref
);
130 ITextRangeImpl
*txtRge
;
131 TRACE ("Destroying %p\n", This
);
132 This
->txtSel
->reOle
= NULL
;
133 ITextSelection_Release(&This
->txtSel
->ITextSelection_iface
);
134 IOleClientSite_Release(&This
->clientSite
->IOleClientSite_iface
);
135 LIST_FOR_EACH_ENTRY(txtRge
, &This
->rangelist
, ITextRangeImpl
, entry
)
136 txtRge
->reOle
= NULL
;
142 static HRESULT WINAPI
143 IRichEditOle_fnActivateAs(IRichEditOle
*me
, REFCLSID rclsid
, REFCLSID rclsidAs
)
145 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
146 FIXME("stub %p\n",This
);
150 static HRESULT WINAPI
151 IRichEditOle_fnContextSensitiveHelp(IRichEditOle
*me
, BOOL fEnterMode
)
153 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
154 FIXME("stub %p\n",This
);
158 static HRESULT WINAPI
159 IRichEditOle_fnConvertObject(IRichEditOle
*me
, LONG iob
,
160 REFCLSID rclsidNew
, LPCSTR lpstrUserTypeNew
)
162 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
163 FIXME("stub %p\n",This
);
167 static inline IOleClientSiteImpl
*impl_from_IOleClientSite(IOleClientSite
*iface
)
169 return CONTAINING_RECORD(iface
, IOleClientSiteImpl
, IOleClientSite_iface
);
172 static HRESULT WINAPI
173 IOleClientSite_fnQueryInterface(IOleClientSite
*me
, REFIID riid
, LPVOID
*ppvObj
)
175 TRACE("%p %s\n", me
, debugstr_guid(riid
) );
178 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
179 IsEqualGUID(riid
, &IID_IOleClientSite
))
183 IOleClientSite_AddRef(me
);
186 FIXME("%p: unhandled interface %s\n", me
, debugstr_guid(riid
) );
188 return E_NOINTERFACE
;
191 static ULONG WINAPI
IOleClientSite_fnAddRef(IOleClientSite
*iface
)
193 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
194 return InterlockedIncrement(&This
->ref
);
197 static ULONG WINAPI
IOleClientSite_fnRelease(IOleClientSite
*iface
)
199 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
200 ULONG ref
= InterlockedDecrement(&This
->ref
);
206 static HRESULT WINAPI
IOleClientSite_fnSaveObject(IOleClientSite
*iface
)
208 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
210 return CO_E_RELEASED
;
212 FIXME("stub %p\n", iface
);
217 static HRESULT WINAPI
IOleClientSite_fnGetMoniker(IOleClientSite
*iface
, DWORD dwAssign
,
218 DWORD dwWhichMoniker
, IMoniker
**ppmk
)
220 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
222 return CO_E_RELEASED
;
224 FIXME("stub %p\n", iface
);
228 static HRESULT WINAPI
IOleClientSite_fnGetContainer(IOleClientSite
*iface
,
229 IOleContainer
**ppContainer
)
231 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
233 return CO_E_RELEASED
;
235 FIXME("stub %p\n", iface
);
239 static HRESULT WINAPI
IOleClientSite_fnShowObject(IOleClientSite
*iface
)
241 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
243 return CO_E_RELEASED
;
245 FIXME("stub %p\n", iface
);
249 static HRESULT WINAPI
IOleClientSite_fnOnShowWindow(IOleClientSite
*iface
, BOOL fShow
)
251 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
253 return CO_E_RELEASED
;
255 FIXME("stub %p\n", iface
);
259 static HRESULT WINAPI
IOleClientSite_fnRequestNewObjectLayout(IOleClientSite
*iface
)
261 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
263 return CO_E_RELEASED
;
265 FIXME("stub %p\n", iface
);
269 static const IOleClientSiteVtbl ocst
= {
270 IOleClientSite_fnQueryInterface
,
271 IOleClientSite_fnAddRef
,
272 IOleClientSite_fnRelease
,
273 IOleClientSite_fnSaveObject
,
274 IOleClientSite_fnGetMoniker
,
275 IOleClientSite_fnGetContainer
,
276 IOleClientSite_fnShowObject
,
277 IOleClientSite_fnOnShowWindow
,
278 IOleClientSite_fnRequestNewObjectLayout
281 static IOleClientSiteImpl
*
282 CreateOleClientSite(IRichEditOleImpl
*reOle
)
284 IOleClientSiteImpl
*clientSite
= heap_alloc(sizeof *clientSite
);
288 clientSite
->IOleClientSite_iface
.lpVtbl
= &ocst
;
290 clientSite
->reOle
= reOle
;
294 static HRESULT WINAPI
295 IRichEditOle_fnGetClientSite(IRichEditOle
*me
,
296 LPOLECLIENTSITE
*lplpolesite
)
298 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
300 TRACE("%p,%p\n",This
, lplpolesite
);
304 *lplpolesite
= &This
->clientSite
->IOleClientSite_iface
;
305 IOleClientSite_AddRef(*lplpolesite
);
309 static HRESULT WINAPI
310 IRichEditOle_fnGetClipboardData(IRichEditOle
*me
, CHARRANGE
*lpchrg
,
311 DWORD reco
, LPDATAOBJECT
*lplpdataobj
)
313 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
317 TRACE("(%p,%p,%d)\n",This
, lpchrg
, reco
);
321 int nFrom
, nTo
, nStartCur
= ME_GetSelectionOfs(This
->editor
, &nFrom
, &nTo
);
322 start
= This
->editor
->pCursors
[nStartCur
];
323 nChars
= nTo
- nFrom
;
325 ME_CursorFromCharOfs(This
->editor
, lpchrg
->cpMin
, &start
);
326 nChars
= lpchrg
->cpMax
- lpchrg
->cpMin
;
328 return ME_GetDataObject(This
->editor
, &start
, nChars
, lplpdataobj
);
331 static LONG WINAPI
IRichEditOle_fnGetLinkCount(IRichEditOle
*me
)
333 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
334 FIXME("stub %p\n",This
);
338 static HRESULT WINAPI
339 IRichEditOle_fnGetObject(IRichEditOle
*me
, LONG iob
,
340 REOBJECT
*lpreobject
, DWORD dwFlags
)
342 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
343 FIXME("stub %p\n",This
);
348 IRichEditOle_fnGetObjectCount(IRichEditOle
*me
)
350 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
351 FIXME("stub %p\n",This
);
355 static HRESULT WINAPI
356 IRichEditOle_fnHandsOffStorage(IRichEditOle
*me
, LONG iob
)
358 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
359 FIXME("stub %p\n",This
);
363 static HRESULT WINAPI
364 IRichEditOle_fnImportDataObject(IRichEditOle
*me
, LPDATAOBJECT lpdataobj
,
365 CLIPFORMAT cf
, HGLOBAL hMetaPict
)
367 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
368 FIXME("stub %p\n",This
);
372 static HRESULT WINAPI
373 IRichEditOle_fnInPlaceDeactivate(IRichEditOle
*me
)
375 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
376 FIXME("stub %p\n",This
);
380 static HRESULT WINAPI
381 IRichEditOle_fnInsertObject(IRichEditOle
*me
, REOBJECT
*reo
)
383 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
384 TRACE("(%p,%p)\n", This
, reo
);
386 if (reo
->cbStruct
< sizeof(*reo
)) return STG_E_INVALIDPARAMETER
;
388 ME_InsertOLEFromCursor(This
->editor
, reo
, 0);
389 ME_CommitUndo(This
->editor
);
390 ME_UpdateRepaint(This
->editor
, FALSE
);
394 static HRESULT WINAPI
IRichEditOle_fnSaveCompleted(IRichEditOle
*me
, LONG iob
,
397 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
398 FIXME("stub %p\n",This
);
402 static HRESULT WINAPI
403 IRichEditOle_fnSetDvaspect(IRichEditOle
*me
, LONG iob
, DWORD dvaspect
)
405 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
406 FIXME("stub %p\n",This
);
410 static HRESULT WINAPI
IRichEditOle_fnSetHostNames(IRichEditOle
*me
,
411 LPCSTR lpstrContainerApp
, LPCSTR lpstrContainerObj
)
413 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
414 FIXME("stub %p %s %s\n",This
, lpstrContainerApp
, lpstrContainerObj
);
418 static HRESULT WINAPI
419 IRichEditOle_fnSetLinkAvailable(IRichEditOle
*me
, LONG iob
, BOOL fAvailable
)
421 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
422 FIXME("stub %p\n",This
);
426 static const IRichEditOleVtbl revt
= {
427 IRichEditOle_fnQueryInterface
,
428 IRichEditOle_fnAddRef
,
429 IRichEditOle_fnRelease
,
430 IRichEditOle_fnGetClientSite
,
431 IRichEditOle_fnGetObjectCount
,
432 IRichEditOle_fnGetLinkCount
,
433 IRichEditOle_fnGetObject
,
434 IRichEditOle_fnInsertObject
,
435 IRichEditOle_fnConvertObject
,
436 IRichEditOle_fnActivateAs
,
437 IRichEditOle_fnSetHostNames
,
438 IRichEditOle_fnSetLinkAvailable
,
439 IRichEditOle_fnSetDvaspect
,
440 IRichEditOle_fnHandsOffStorage
,
441 IRichEditOle_fnSaveCompleted
,
442 IRichEditOle_fnInPlaceDeactivate
,
443 IRichEditOle_fnContextSensitiveHelp
,
444 IRichEditOle_fnGetClipboardData
,
445 IRichEditOle_fnImportDataObject
448 /* ITextRange interface */
449 static inline ITextRangeImpl
*impl_from_ITextRange(ITextRange
*iface
)
451 return CONTAINING_RECORD(iface
, ITextRangeImpl
, ITextRange_iface
);
454 static HRESULT WINAPI
ITextRange_fnQueryInterface(ITextRange
*me
, REFIID riid
, void **ppvObj
)
457 if (IsEqualGUID(riid
, &IID_IUnknown
)
458 || IsEqualGUID(riid
, &IID_IDispatch
)
459 || IsEqualGUID(riid
, &IID_ITextRange
))
462 ITextRange_AddRef(me
);
466 return E_NOINTERFACE
;
469 static ULONG WINAPI
ITextRange_fnAddRef(ITextRange
*me
)
471 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
472 return InterlockedIncrement(&This
->ref
);
475 static ULONG WINAPI
ITextRange_fnRelease(ITextRange
*me
)
477 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
478 ULONG ref
= InterlockedDecrement(&This
->ref
);
480 TRACE ("%p ref=%u\n", This
, ref
);
485 list_remove(&This
->entry
);
493 static HRESULT WINAPI
ITextRange_fnGetTypeInfoCount(ITextRange
*me
, UINT
*pctinfo
)
495 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
497 return CO_E_RELEASED
;
499 FIXME("not implemented %p\n", This
);
503 static HRESULT WINAPI
ITextRange_fnGetTypeInfo(ITextRange
*me
, UINT iTInfo
, LCID lcid
,
506 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
508 return CO_E_RELEASED
;
510 FIXME("not implemented %p\n", This
);
514 static HRESULT WINAPI
ITextRange_fnGetIDsOfNames(ITextRange
*me
, REFIID riid
, LPOLESTR
*rgszNames
,
515 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
517 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
519 return CO_E_RELEASED
;
521 FIXME("not implemented %p\n", This
);
525 static HRESULT WINAPI
ITextRange_fnInvoke(ITextRange
*me
, DISPID dispIdMember
, REFIID riid
,
526 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
527 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
,
530 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
532 return CO_E_RELEASED
;
534 FIXME("not implemented %p\n", This
);
538 static HRESULT WINAPI
ITextRange_fnGetText(ITextRange
*me
, BSTR
*pbstr
)
540 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
542 return CO_E_RELEASED
;
544 FIXME("not implemented %p\n", This
);
548 static HRESULT WINAPI
ITextRange_fnSetText(ITextRange
*me
, BSTR bstr
)
550 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
552 return CO_E_RELEASED
;
554 FIXME("not implemented %p\n", This
);
558 static HRESULT
range_GetChar(ME_TextEditor
*editor
, ME_Cursor
*cursor
, LONG
*pch
)
562 ME_GetTextW(editor
, wch
, 1, cursor
, 1, FALSE
, cursor
->pRun
->next
->type
== diTextEnd
);
568 static HRESULT WINAPI
ITextRange_fnGetChar(ITextRange
*me
, LONG
*pch
)
570 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
574 return CO_E_RELEASED
;
579 ME_CursorFromCharOfs(This
->reOle
->editor
, This
->start
, &cursor
);
580 return range_GetChar(This
->reOle
->editor
, &cursor
, pch
);
583 static HRESULT WINAPI
ITextRange_fnSetChar(ITextRange
*me
, LONG ch
)
585 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
587 return CO_E_RELEASED
;
589 FIXME("not implemented %p\n", This
);
593 static HRESULT
CreateITextRange(IRichEditOleImpl
*reOle
, LONG start
, LONG end
, ITextRange
** ppRange
);
595 static HRESULT WINAPI
ITextRange_fnGetDuplicate(ITextRange
*me
, ITextRange
**ppRange
)
597 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
599 return CO_E_RELEASED
;
601 TRACE("%p %p\n", This
, ppRange
);
605 return CreateITextRange(This
->reOle
, This
->start
, This
->end
, ppRange
);
608 static HRESULT WINAPI
ITextRange_fnGetFormattedText(ITextRange
*me
, ITextRange
**ppRange
)
610 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
612 return CO_E_RELEASED
;
614 FIXME("not implemented %p\n", This
);
618 static HRESULT WINAPI
ITextRange_fnSetFormattedText(ITextRange
*me
, ITextRange
*pRange
)
620 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
622 return CO_E_RELEASED
;
624 FIXME("not implemented %p\n", This
);
628 static HRESULT WINAPI
ITextRange_fnGetStart(ITextRange
*me
, LONG
*pcpFirst
)
630 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
632 return CO_E_RELEASED
;
636 *pcpFirst
= This
->start
;
637 TRACE("%d\n", *pcpFirst
);
641 static HRESULT WINAPI
ITextRange_fnSetStart(ITextRange
*me
, LONG cpFirst
)
643 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
645 return CO_E_RELEASED
;
647 FIXME("not implemented %p\n", This
);
651 static HRESULT WINAPI
ITextRange_fnGetEnd(ITextRange
*me
, LONG
*pcpLim
)
653 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
655 return CO_E_RELEASED
;
660 TRACE("%d\n", *pcpLim
);
664 static HRESULT WINAPI
ITextRange_fnSetEnd(ITextRange
*me
, LONG cpLim
)
666 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
668 return CO_E_RELEASED
;
670 FIXME("not implemented %p\n", This
);
674 static HRESULT WINAPI
ITextRange_fnGetFont(ITextRange
*me
, ITextFont
**pFont
)
676 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
678 return CO_E_RELEASED
;
680 FIXME("not implemented %p\n", This
);
684 static HRESULT WINAPI
ITextRange_fnSetFont(ITextRange
*me
, ITextFont
*pFont
)
686 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
688 return CO_E_RELEASED
;
690 FIXME("not implemented %p\n", This
);
694 static HRESULT WINAPI
ITextRange_fnGetPara(ITextRange
*me
, ITextPara
**ppPara
)
696 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
698 return CO_E_RELEASED
;
700 FIXME("not implemented %p\n", This
);
704 static HRESULT WINAPI
ITextRange_fnSetPara(ITextRange
*me
, ITextPara
*pPara
)
706 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
708 return CO_E_RELEASED
;
710 FIXME("not implemented %p\n", This
);
714 static HRESULT WINAPI
ITextRange_fnGetStoryLength(ITextRange
*me
, LONG
*pcch
)
716 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
718 return CO_E_RELEASED
;
720 FIXME("not implemented %p\n", This
);
724 static HRESULT WINAPI
ITextRange_fnGetStoryType(ITextRange
*me
, LONG
*pValue
)
726 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
728 return CO_E_RELEASED
;
730 FIXME("not implemented %p\n", This
);
734 static HRESULT
range_Collapse(LONG bStart
, LONG
*start
, LONG
*end
)
739 if (bStart
== tomEnd
|| bStart
== tomFalse
)
746 static HRESULT WINAPI
ITextRange_fnCollapse(ITextRange
*me
, LONG bStart
)
748 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
750 return CO_E_RELEASED
;
752 return range_Collapse(bStart
, &This
->start
, &This
->end
);
755 static HRESULT WINAPI
ITextRange_fnExpand(ITextRange
*me
, LONG Unit
, LONG
*pDelta
)
757 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
759 return CO_E_RELEASED
;
761 FIXME("not implemented %p\n", This
);
765 static HRESULT WINAPI
ITextRange_fnGetIndex(ITextRange
*me
, LONG Unit
, LONG
*pIndex
)
767 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
769 return CO_E_RELEASED
;
771 FIXME("not implemented %p\n", This
);
775 static HRESULT WINAPI
ITextRange_fnSetIndex(ITextRange
*me
, LONG Unit
, LONG Index
,
778 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
780 return CO_E_RELEASED
;
782 FIXME("not implemented %p\n", This
);
786 static HRESULT WINAPI
ITextRange_fnSetRange(ITextRange
*me
, LONG cpActive
, LONG cpOther
)
788 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
790 return CO_E_RELEASED
;
792 FIXME("not implemented %p\n", This
);
796 static HRESULT WINAPI
ITextRange_fnInRange(ITextRange
*me
, ITextRange
*pRange
, LONG
*pb
)
798 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
800 return CO_E_RELEASED
;
802 FIXME("not implemented %p\n", This
);
806 static HRESULT WINAPI
ITextRange_fnInStory(ITextRange
*me
, ITextRange
*pRange
, LONG
*pb
)
808 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
810 return CO_E_RELEASED
;
812 FIXME("not implemented %p\n", This
);
816 static HRESULT WINAPI
ITextRange_fnIsEqual(ITextRange
*me
, ITextRange
*pRange
, LONG
*pb
)
818 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
820 return CO_E_RELEASED
;
822 FIXME("not implemented %p\n", This
);
826 static HRESULT WINAPI
ITextRange_fnSelect(ITextRange
*me
)
828 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
830 return CO_E_RELEASED
;
832 FIXME("not implemented %p\n", This
);
836 static HRESULT WINAPI
ITextRange_fnStartOf(ITextRange
*me
, LONG Unit
, LONG Extend
,
839 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
841 return CO_E_RELEASED
;
843 FIXME("not implemented %p\n", This
);
847 static HRESULT WINAPI
ITextRange_fnEndOf(ITextRange
*me
, LONG Unit
, LONG Extend
,
850 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
852 return CO_E_RELEASED
;
854 FIXME("not implemented %p\n", This
);
858 static HRESULT WINAPI
ITextRange_fnMove(ITextRange
*me
, LONG Unit
, LONG Count
, LONG
*pDelta
)
860 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
862 return CO_E_RELEASED
;
864 FIXME("not implemented %p\n", This
);
868 static HRESULT WINAPI
ITextRange_fnMoveStart(ITextRange
*me
, LONG Unit
, LONG Count
,
871 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
873 return CO_E_RELEASED
;
875 FIXME("not implemented %p\n", This
);
879 static HRESULT WINAPI
ITextRange_fnMoveEnd(ITextRange
*me
, LONG Unit
, LONG Count
,
882 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
884 return CO_E_RELEASED
;
886 FIXME("not implemented %p\n", This
);
890 static HRESULT WINAPI
ITextRange_fnMoveWhile(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
893 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
895 return CO_E_RELEASED
;
897 FIXME("not implemented %p\n", This
);
901 static HRESULT WINAPI
ITextRange_fnMoveStartWhile(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
904 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
906 return CO_E_RELEASED
;
908 FIXME("not implemented %p\n", This
);
912 static HRESULT WINAPI
ITextRange_fnMoveEndWhile(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
915 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
917 return CO_E_RELEASED
;
919 FIXME("not implemented %p\n", This
);
923 static HRESULT WINAPI
ITextRange_fnMoveUntil(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
926 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
928 return CO_E_RELEASED
;
930 FIXME("not implemented %p\n", This
);
934 static HRESULT WINAPI
ITextRange_fnMoveStartUntil(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
937 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
939 return CO_E_RELEASED
;
941 FIXME("not implemented %p\n", This
);
945 static HRESULT WINAPI
ITextRange_fnMoveEndUntil(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
948 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
950 return CO_E_RELEASED
;
952 FIXME("not implemented %p\n", This
);
956 static HRESULT WINAPI
ITextRange_fnFindText(ITextRange
*me
, BSTR bstr
, LONG cch
, LONG Flags
,
959 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
961 return CO_E_RELEASED
;
963 FIXME("not implemented %p\n", This
);
967 static HRESULT WINAPI
ITextRange_fnFindTextStart(ITextRange
*me
, BSTR bstr
, LONG cch
,
968 LONG Flags
, LONG
*pLength
)
970 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
972 return CO_E_RELEASED
;
974 FIXME("not implemented %p\n", This
);
978 static HRESULT WINAPI
ITextRange_fnFindTextEnd(ITextRange
*me
, BSTR bstr
, LONG cch
,
979 LONG Flags
, LONG
*pLength
)
981 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
983 return CO_E_RELEASED
;
985 FIXME("not implemented %p\n", This
);
989 static HRESULT WINAPI
ITextRange_fnDelete(ITextRange
*me
, LONG Unit
, LONG Count
,
992 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
994 return CO_E_RELEASED
;
996 FIXME("not implemented %p\n", This
);
1000 static HRESULT WINAPI
ITextRange_fnCut(ITextRange
*me
, VARIANT
*pVar
)
1002 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1004 return CO_E_RELEASED
;
1006 FIXME("not implemented %p\n", This
);
1010 static HRESULT WINAPI
ITextRange_fnCopy(ITextRange
*me
, VARIANT
*pVar
)
1012 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1014 return CO_E_RELEASED
;
1016 FIXME("not implemented %p\n", This
);
1020 static HRESULT WINAPI
ITextRange_fnPaste(ITextRange
*me
, VARIANT
*pVar
, LONG Format
)
1022 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1024 return CO_E_RELEASED
;
1026 FIXME("not implemented %p\n", This
);
1030 static HRESULT WINAPI
ITextRange_fnCanPaste(ITextRange
*me
, VARIANT
*pVar
, LONG Format
,
1033 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1035 return CO_E_RELEASED
;
1037 FIXME("not implemented %p\n", This
);
1041 static HRESULT WINAPI
ITextRange_fnCanEdit(ITextRange
*me
, LONG
*pb
)
1043 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1045 return CO_E_RELEASED
;
1047 FIXME("not implemented %p\n", This
);
1051 static HRESULT WINAPI
ITextRange_fnChangeCase(ITextRange
*me
, LONG Type
)
1053 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1055 return CO_E_RELEASED
;
1057 FIXME("not implemented %p\n", This
);
1061 static HRESULT WINAPI
ITextRange_fnGetPoint(ITextRange
*me
, LONG Type
, LONG
*cx
, LONG
*cy
)
1063 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1065 return CO_E_RELEASED
;
1067 FIXME("not implemented %p\n", This
);
1071 static HRESULT WINAPI
ITextRange_fnSetPoint(ITextRange
*me
, LONG x
, LONG y
, LONG Type
,
1074 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1076 return CO_E_RELEASED
;
1078 FIXME("not implemented %p\n", This
);
1082 static HRESULT WINAPI
ITextRange_fnScrollIntoView(ITextRange
*me
, LONG Value
)
1084 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1086 return CO_E_RELEASED
;
1088 FIXME("not implemented %p\n", This
);
1092 static HRESULT WINAPI
ITextRange_fnGetEmbeddedObject(ITextRange
*me
, IUnknown
**ppv
)
1094 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1096 return CO_E_RELEASED
;
1098 FIXME("not implemented %p\n", This
);
1102 static const ITextRangeVtbl trvt
= {
1103 ITextRange_fnQueryInterface
,
1104 ITextRange_fnAddRef
,
1105 ITextRange_fnRelease
,
1106 ITextRange_fnGetTypeInfoCount
,
1107 ITextRange_fnGetTypeInfo
,
1108 ITextRange_fnGetIDsOfNames
,
1109 ITextRange_fnInvoke
,
1110 ITextRange_fnGetText
,
1111 ITextRange_fnSetText
,
1112 ITextRange_fnGetChar
,
1113 ITextRange_fnSetChar
,
1114 ITextRange_fnGetDuplicate
,
1115 ITextRange_fnGetFormattedText
,
1116 ITextRange_fnSetFormattedText
,
1117 ITextRange_fnGetStart
,
1118 ITextRange_fnSetStart
,
1119 ITextRange_fnGetEnd
,
1120 ITextRange_fnSetEnd
,
1121 ITextRange_fnGetFont
,
1122 ITextRange_fnSetFont
,
1123 ITextRange_fnGetPara
,
1124 ITextRange_fnSetPara
,
1125 ITextRange_fnGetStoryLength
,
1126 ITextRange_fnGetStoryType
,
1127 ITextRange_fnCollapse
,
1128 ITextRange_fnExpand
,
1129 ITextRange_fnGetIndex
,
1130 ITextRange_fnSetIndex
,
1131 ITextRange_fnSetRange
,
1132 ITextRange_fnInRange
,
1133 ITextRange_fnInStory
,
1134 ITextRange_fnIsEqual
,
1135 ITextRange_fnSelect
,
1136 ITextRange_fnStartOf
,
1139 ITextRange_fnMoveStart
,
1140 ITextRange_fnMoveEnd
,
1141 ITextRange_fnMoveWhile
,
1142 ITextRange_fnMoveStartWhile
,
1143 ITextRange_fnMoveEndWhile
,
1144 ITextRange_fnMoveUntil
,
1145 ITextRange_fnMoveStartUntil
,
1146 ITextRange_fnMoveEndUntil
,
1147 ITextRange_fnFindText
,
1148 ITextRange_fnFindTextStart
,
1149 ITextRange_fnFindTextEnd
,
1150 ITextRange_fnDelete
,
1154 ITextRange_fnCanPaste
,
1155 ITextRange_fnCanEdit
,
1156 ITextRange_fnChangeCase
,
1157 ITextRange_fnGetPoint
,
1158 ITextRange_fnSetPoint
,
1159 ITextRange_fnScrollIntoView
,
1160 ITextRange_fnGetEmbeddedObject
1162 /* ITextRange interface */
1164 static HRESULT WINAPI
1165 ITextDocument_fnQueryInterface(ITextDocument
* me
, REFIID riid
,
1168 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1169 return IRichEditOle_QueryInterface(&This
->IRichEditOle_iface
, riid
, ppvObject
);
1173 ITextDocument_fnAddRef(ITextDocument
* me
)
1175 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1176 return IRichEditOle_AddRef(&This
->IRichEditOle_iface
);
1180 ITextDocument_fnRelease(ITextDocument
* me
)
1182 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1183 return IRichEditOle_Release(&This
->IRichEditOle_iface
);
1186 static HRESULT WINAPI
1187 ITextDocument_fnGetTypeInfoCount(ITextDocument
* me
,
1190 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1191 FIXME("stub %p\n",This
);
1195 static HRESULT WINAPI
1196 ITextDocument_fnGetTypeInfo(ITextDocument
* me
, UINT iTInfo
, LCID lcid
,
1197 ITypeInfo
** ppTInfo
)
1199 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1200 FIXME("stub %p\n",This
);
1204 static HRESULT WINAPI
1205 ITextDocument_fnGetIDsOfNames(ITextDocument
* me
, REFIID riid
,
1206 LPOLESTR
* rgszNames
, UINT cNames
, LCID lcid
, DISPID
* rgDispId
)
1208 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1209 FIXME("stub %p\n",This
);
1213 static HRESULT WINAPI
1214 ITextDocument_fnInvoke(ITextDocument
* me
, DISPID dispIdMember
,
1215 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
* pDispParams
,
1216 VARIANT
* pVarResult
, EXCEPINFO
* pExcepInfo
, UINT
* puArgErr
)
1218 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1219 FIXME("stub %p\n",This
);
1223 static HRESULT WINAPI
1224 ITextDocument_fnGetName(ITextDocument
* me
, BSTR
* pName
)
1226 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1227 FIXME("stub %p\n",This
);
1231 static HRESULT WINAPI
1232 ITextDocument_fnGetSelection(ITextDocument
* me
, ITextSelection
** ppSel
)
1234 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1235 TRACE("(%p)\n", me
);
1238 return E_INVALIDARG
;
1239 *ppSel
= &This
->txtSel
->ITextSelection_iface
;
1240 ITextSelection_AddRef(*ppSel
);
1244 static HRESULT WINAPI
1245 ITextDocument_fnGetStoryCount(ITextDocument
* me
, LONG
* pCount
)
1247 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1248 FIXME("stub %p\n",This
);
1252 static HRESULT WINAPI
1253 ITextDocument_fnGetStoryRanges(ITextDocument
* me
,
1254 ITextStoryRanges
** ppStories
)
1256 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1257 FIXME("stub %p\n",This
);
1261 static HRESULT WINAPI
1262 ITextDocument_fnGetSaved(ITextDocument
* me
, LONG
* pValue
)
1264 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1265 FIXME("stub %p\n",This
);
1269 static HRESULT WINAPI
1270 ITextDocument_fnSetSaved(ITextDocument
* me
, LONG Value
)
1272 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1273 FIXME("stub %p\n",This
);
1277 static HRESULT WINAPI
1278 ITextDocument_fnGetDefaultTabStop(ITextDocument
* me
, float* pValue
)
1280 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1281 FIXME("stub %p\n",This
);
1285 static HRESULT WINAPI
1286 ITextDocument_fnSetDefaultTabStop(ITextDocument
* me
, float Value
)
1288 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1289 FIXME("stub %p\n",This
);
1293 static HRESULT WINAPI
1294 ITextDocument_fnNew(ITextDocument
* me
)
1296 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1297 FIXME("stub %p\n",This
);
1301 static HRESULT WINAPI
1302 ITextDocument_fnOpen(ITextDocument
* me
, VARIANT
* pVar
, LONG Flags
,
1305 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1306 FIXME("stub %p\n",This
);
1310 static HRESULT WINAPI
1311 ITextDocument_fnSave(ITextDocument
* me
, VARIANT
* pVar
, LONG Flags
,
1314 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1315 FIXME("stub %p\n",This
);
1319 static HRESULT WINAPI
1320 ITextDocument_fnFreeze(ITextDocument
* me
, LONG
* pCount
)
1322 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1323 FIXME("stub %p\n",This
);
1327 static HRESULT WINAPI
1328 ITextDocument_fnUnfreeze(ITextDocument
* me
, LONG
* pCount
)
1330 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1331 FIXME("stub %p\n",This
);
1335 static HRESULT WINAPI
1336 ITextDocument_fnBeginEditCollection(ITextDocument
* me
)
1338 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1339 FIXME("stub %p\n",This
);
1343 static HRESULT WINAPI
1344 ITextDocument_fnEndEditCollection(ITextDocument
* me
)
1346 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1347 FIXME("stub %p\n",This
);
1351 static HRESULT WINAPI
1352 ITextDocument_fnUndo(ITextDocument
* me
, LONG Count
, LONG
* prop
)
1354 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1355 FIXME("stub %p\n",This
);
1359 static HRESULT WINAPI
1360 ITextDocument_fnRedo(ITextDocument
* me
, LONG Count
, LONG
* prop
)
1362 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1363 FIXME("stub %p\n",This
);
1367 static HRESULT
CreateITextRange(IRichEditOleImpl
*reOle
, LONG start
, LONG end
, ITextRange
** ppRange
)
1369 ITextRangeImpl
*txtRge
= heap_alloc(sizeof(ITextRangeImpl
));
1372 return E_OUTOFMEMORY
;
1373 txtRge
->ITextRange_iface
.lpVtbl
= &trvt
;
1375 txtRge
->reOle
= reOle
;
1376 txtRge
->start
= start
;
1378 list_add_head(&reOle
->rangelist
, &txtRge
->entry
);
1379 *ppRange
= &txtRge
->ITextRange_iface
;
1383 static HRESULT WINAPI
1384 ITextDocument_fnRange(ITextDocument
* me
, LONG cp1
, LONG cp2
,
1385 ITextRange
** ppRange
)
1387 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1388 const int len
= ME_GetTextLength(This
->editor
) + 1;
1390 TRACE("%p %p %d %d\n", This
, ppRange
, cp1
, cp2
);
1392 return E_INVALIDARG
;
1396 cp1
= min(cp1
, len
);
1397 cp2
= min(cp2
, len
);
1406 cp1
= cp2
= len
- 1;
1408 return CreateITextRange(This
, cp1
, cp2
, ppRange
);
1411 static HRESULT WINAPI
1412 ITextDocument_fnRangeFromPoint(ITextDocument
* me
, LONG x
, LONG y
,
1413 ITextRange
** ppRange
)
1415 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1416 FIXME("stub %p\n",This
);
1420 static const ITextDocumentVtbl tdvt
= {
1421 ITextDocument_fnQueryInterface
,
1422 ITextDocument_fnAddRef
,
1423 ITextDocument_fnRelease
,
1424 ITextDocument_fnGetTypeInfoCount
,
1425 ITextDocument_fnGetTypeInfo
,
1426 ITextDocument_fnGetIDsOfNames
,
1427 ITextDocument_fnInvoke
,
1428 ITextDocument_fnGetName
,
1429 ITextDocument_fnGetSelection
,
1430 ITextDocument_fnGetStoryCount
,
1431 ITextDocument_fnGetStoryRanges
,
1432 ITextDocument_fnGetSaved
,
1433 ITextDocument_fnSetSaved
,
1434 ITextDocument_fnGetDefaultTabStop
,
1435 ITextDocument_fnSetDefaultTabStop
,
1436 ITextDocument_fnNew
,
1437 ITextDocument_fnOpen
,
1438 ITextDocument_fnSave
,
1439 ITextDocument_fnFreeze
,
1440 ITextDocument_fnUnfreeze
,
1441 ITextDocument_fnBeginEditCollection
,
1442 ITextDocument_fnEndEditCollection
,
1443 ITextDocument_fnUndo
,
1444 ITextDocument_fnRedo
,
1445 ITextDocument_fnRange
,
1446 ITextDocument_fnRangeFromPoint
1449 static inline ITextSelectionImpl
*impl_from_ITextSelection(ITextSelection
*iface
)
1451 return CONTAINING_RECORD(iface
, ITextSelectionImpl
, ITextSelection_iface
);
1454 static HRESULT WINAPI
ITextSelection_fnQueryInterface(
1460 if (IsEqualGUID(riid
, &IID_IUnknown
)
1461 || IsEqualGUID(riid
, &IID_IDispatch
)
1462 || IsEqualGUID(riid
, &IID_ITextRange
)
1463 || IsEqualGUID(riid
, &IID_ITextSelection
))
1466 ITextSelection_AddRef(me
);
1470 return E_NOINTERFACE
;
1473 static ULONG WINAPI
ITextSelection_fnAddRef(ITextSelection
*me
)
1475 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1476 return InterlockedIncrement(&This
->ref
);
1479 static ULONG WINAPI
ITextSelection_fnRelease(ITextSelection
*me
)
1481 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1482 ULONG ref
= InterlockedDecrement(&This
->ref
);
1488 static HRESULT WINAPI
ITextSelection_fnGetTypeInfoCount(ITextSelection
*me
, UINT
*pctinfo
)
1490 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1492 return CO_E_RELEASED
;
1494 FIXME("not implemented\n");
1498 static HRESULT WINAPI
ITextSelection_fnGetTypeInfo(ITextSelection
*me
, UINT iTInfo
, LCID lcid
,
1499 ITypeInfo
**ppTInfo
)
1501 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1503 return CO_E_RELEASED
;
1505 FIXME("not implemented\n");
1509 static HRESULT WINAPI
ITextSelection_fnGetIDsOfNames(ITextSelection
*me
, REFIID riid
,
1510 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
1512 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1514 return CO_E_RELEASED
;
1516 FIXME("not implemented\n");
1520 static HRESULT WINAPI
ITextSelection_fnInvoke(
1522 DISPID dispIdMember
,
1526 DISPPARAMS
*pDispParams
,
1527 VARIANT
*pVarResult
,
1528 EXCEPINFO
*pExcepInfo
,
1531 FIXME("not implemented\n");
1535 /*** ITextRange methods ***/
1536 static HRESULT WINAPI
ITextSelection_fnGetText(ITextSelection
*me
, BSTR
*pbstr
)
1538 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1539 ME_Cursor
*start
= NULL
, *end
= NULL
;
1544 return CO_E_RELEASED
;
1545 TRACE("%p\n", pbstr
);
1547 return E_INVALIDARG
;
1549 ME_GetSelection(This
->reOle
->editor
, &start
, &end
);
1550 endOfs
= ME_GetCursorOfs(end
);
1551 nChars
= endOfs
- ME_GetCursorOfs(start
);
1558 *pbstr
= SysAllocStringLen(NULL
, nChars
);
1560 return E_OUTOFMEMORY
;
1562 bEOP
= (end
->pRun
->next
->type
== diTextEnd
&& endOfs
> ME_GetTextLength(This
->reOle
->editor
));
1563 ME_GetTextW(This
->reOle
->editor
, *pbstr
, nChars
, start
, nChars
, FALSE
, bEOP
);
1564 TRACE("%s\n", wine_dbgstr_w(*pbstr
));
1569 static HRESULT WINAPI
ITextSelection_fnSetText(ITextSelection
*me
, BSTR bstr
)
1571 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1573 return CO_E_RELEASED
;
1575 FIXME("not implemented\n");
1579 static HRESULT WINAPI
ITextSelection_fnGetChar(ITextSelection
*me
, LONG
*pch
)
1581 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1582 ME_Cursor
*start
= NULL
, *end
= NULL
;
1585 return CO_E_RELEASED
;
1588 return E_INVALIDARG
;
1590 ME_GetSelection(This
->reOle
->editor
, &start
, &end
);
1591 return range_GetChar(This
->reOle
->editor
, start
, pch
);
1594 static HRESULT WINAPI
ITextSelection_fnSetChar(ITextSelection
*me
, LONG ch
)
1596 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1598 return CO_E_RELEASED
;
1600 FIXME("not implemented\n");
1604 static HRESULT WINAPI
ITextSelection_fnGetDuplicate(ITextSelection
*me
, ITextRange
**ppRange
)
1606 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1608 return CO_E_RELEASED
;
1610 FIXME("not implemented\n");
1614 static HRESULT WINAPI
ITextSelection_fnGetFormattedText(ITextSelection
*me
, ITextRange
**ppRange
)
1616 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1618 return CO_E_RELEASED
;
1620 FIXME("not implemented\n");
1624 static HRESULT WINAPI
ITextSelection_fnSetFormattedText(ITextSelection
*me
, ITextRange
*pRange
)
1626 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1628 return CO_E_RELEASED
;
1630 FIXME("not implemented\n");
1634 static HRESULT WINAPI
ITextSelection_fnGetStart(ITextSelection
*me
, LONG
*pcpFirst
)
1636 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1639 return CO_E_RELEASED
;
1642 return E_INVALIDARG
;
1643 ME_GetSelectionOfs(This
->reOle
->editor
, pcpFirst
, &lim
);
1644 TRACE("%d\n", *pcpFirst
);
1648 static HRESULT WINAPI
ITextSelection_fnSetStart(ITextSelection
*me
, LONG cpFirst
)
1650 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1652 return CO_E_RELEASED
;
1654 FIXME("not implemented\n");
1658 static HRESULT WINAPI
ITextSelection_fnGetEnd(ITextSelection
*me
, LONG
*pcpLim
)
1660 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1663 return CO_E_RELEASED
;
1666 return E_INVALIDARG
;
1667 ME_GetSelectionOfs(This
->reOle
->editor
, &first
, pcpLim
);
1668 TRACE("%d\n", *pcpLim
);
1672 static HRESULT WINAPI
ITextSelection_fnSetEnd(ITextSelection
*me
, LONG cpLim
)
1674 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1676 return CO_E_RELEASED
;
1678 FIXME("not implemented\n");
1682 static HRESULT WINAPI
ITextSelection_fnGetFont(ITextSelection
*me
, ITextFont
**pFont
)
1684 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1686 return CO_E_RELEASED
;
1688 FIXME("not implemented\n");
1692 static HRESULT WINAPI
ITextSelection_fnSetFont(ITextSelection
*me
, ITextFont
*pFont
)
1694 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1696 return CO_E_RELEASED
;
1698 FIXME("not implemented\n");
1702 static HRESULT WINAPI
ITextSelection_fnGetPara(ITextSelection
*me
, ITextPara
**ppPara
)
1704 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1706 return CO_E_RELEASED
;
1708 FIXME("not implemented\n");
1712 static HRESULT WINAPI
ITextSelection_fnSetPara(ITextSelection
*me
, ITextPara
*pPara
)
1714 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1716 return CO_E_RELEASED
;
1718 FIXME("not implemented\n");
1722 static HRESULT WINAPI
ITextSelection_fnGetStoryLength(ITextSelection
*me
, LONG
*pcch
)
1724 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1726 return CO_E_RELEASED
;
1728 FIXME("not implemented\n");
1732 static HRESULT WINAPI
ITextSelection_fnGetStoryType(ITextSelection
*me
, LONG
*pValue
)
1734 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1736 return CO_E_RELEASED
;
1738 FIXME("not implemented\n");
1742 static HRESULT WINAPI
ITextSelection_fnCollapse(ITextSelection
*me
, LONG bStart
)
1744 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1748 return CO_E_RELEASED
;
1750 ME_GetSelectionOfs(This
->reOle
->editor
, &start
, &end
);
1751 hres
= range_Collapse(bStart
, &start
, &end
);
1752 if (SUCCEEDED(hres
))
1753 ME_SetSelection(This
->reOle
->editor
, start
, end
);
1757 static HRESULT WINAPI
ITextSelection_fnExpand(ITextSelection
*me
, LONG Unit
, LONG
*pDelta
)
1759 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1761 return CO_E_RELEASED
;
1763 FIXME("not implemented\n");
1767 static HRESULT WINAPI
ITextSelection_fnGetIndex(ITextSelection
*me
, LONG Unit
, LONG
*pIndex
)
1769 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1771 return CO_E_RELEASED
;
1773 FIXME("not implemented\n");
1777 static HRESULT WINAPI
ITextSelection_fnSetIndex(ITextSelection
*me
, LONG Unit
, LONG Index
,
1780 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1782 return CO_E_RELEASED
;
1784 FIXME("not implemented\n");
1788 static HRESULT WINAPI
ITextSelection_fnSetRange(ITextSelection
*me
, LONG cpActive
, LONG cpOther
)
1790 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1792 return CO_E_RELEASED
;
1794 FIXME("not implemented\n");
1798 static HRESULT WINAPI
ITextSelection_fnInRange(ITextSelection
*me
, ITextRange
*pRange
, LONG
*pb
)
1800 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1802 return CO_E_RELEASED
;
1804 FIXME("not implemented\n");
1808 static HRESULT WINAPI
ITextSelection_fnInStory(ITextSelection
*me
, ITextRange
*pRange
, LONG
*pb
)
1810 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1812 return CO_E_RELEASED
;
1814 FIXME("not implemented\n");
1818 static HRESULT WINAPI
ITextSelection_fnIsEqual(ITextSelection
*me
, ITextRange
*pRange
, LONG
*pb
)
1820 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1822 return CO_E_RELEASED
;
1824 FIXME("not implemented\n");
1828 static HRESULT WINAPI
ITextSelection_fnSelect(ITextSelection
*me
)
1830 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1832 return CO_E_RELEASED
;
1834 FIXME("not implemented\n");
1838 static HRESULT WINAPI
ITextSelection_fnStartOf(ITextSelection
*me
, LONG Unit
, LONG Extend
,
1841 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1843 return CO_E_RELEASED
;
1845 FIXME("not implemented\n");
1849 static HRESULT WINAPI
ITextSelection_fnEndOf(ITextSelection
*me
, LONG Unit
, LONG Extend
,
1852 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1854 return CO_E_RELEASED
;
1856 FIXME("not implemented\n");
1860 static HRESULT WINAPI
ITextSelection_fnMove(ITextSelection
*me
, LONG Unit
, LONG Count
, LONG
*pDelta
)
1862 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1864 return CO_E_RELEASED
;
1866 FIXME("not implemented\n");
1870 static HRESULT WINAPI
ITextSelection_fnMoveStart(ITextSelection
*me
, LONG Unit
, LONG Count
,
1873 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1875 return CO_E_RELEASED
;
1877 FIXME("not implemented\n");
1881 static HRESULT WINAPI
ITextSelection_fnMoveEnd(ITextSelection
*me
, LONG Unit
, LONG Count
,
1884 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1886 return CO_E_RELEASED
;
1888 FIXME("not implemented\n");
1892 static HRESULT WINAPI
ITextSelection_fnMoveWhile(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1895 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1897 return CO_E_RELEASED
;
1899 FIXME("not implemented\n");
1903 static HRESULT WINAPI
ITextSelection_fnMoveStartWhile(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1906 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1908 return CO_E_RELEASED
;
1910 FIXME("not implemented\n");
1914 static HRESULT WINAPI
ITextSelection_fnMoveEndWhile(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1917 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1919 return CO_E_RELEASED
;
1921 FIXME("not implemented\n");
1925 static HRESULT WINAPI
ITextSelection_fnMoveUntil(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1928 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1930 return CO_E_RELEASED
;
1932 FIXME("not implemented\n");
1936 static HRESULT WINAPI
ITextSelection_fnMoveStartUntil(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1939 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1941 return CO_E_RELEASED
;
1943 FIXME("not implemented\n");
1947 static HRESULT WINAPI
ITextSelection_fnMoveEndUntil(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1950 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1952 return CO_E_RELEASED
;
1954 FIXME("not implemented\n");
1958 static HRESULT WINAPI
ITextSelection_fnFindText(ITextSelection
*me
, BSTR bstr
, LONG cch
, LONG Flags
,
1961 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1963 return CO_E_RELEASED
;
1965 FIXME("not implemented\n");
1969 static HRESULT WINAPI
ITextSelection_fnFindTextStart(ITextSelection
*me
, BSTR bstr
, LONG cch
,
1970 LONG Flags
, LONG
*pLength
)
1972 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1974 return CO_E_RELEASED
;
1976 FIXME("not implemented\n");
1980 static HRESULT WINAPI
ITextSelection_fnFindTextEnd(ITextSelection
*me
, BSTR bstr
, LONG cch
,
1981 LONG Flags
, LONG
*pLength
)
1983 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1985 return CO_E_RELEASED
;
1987 FIXME("not implemented\n");
1991 static HRESULT WINAPI
ITextSelection_fnDelete(ITextSelection
*me
, LONG Unit
, LONG Count
,
1994 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1996 return CO_E_RELEASED
;
1998 FIXME("not implemented\n");
2002 static HRESULT WINAPI
ITextSelection_fnCut(ITextSelection
*me
, VARIANT
*pVar
)
2004 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2006 return CO_E_RELEASED
;
2008 FIXME("not implemented\n");
2012 static HRESULT WINAPI
ITextSelection_fnCopy(ITextSelection
*me
, VARIANT
*pVar
)
2014 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2016 return CO_E_RELEASED
;
2018 FIXME("not implemented\n");
2022 static HRESULT WINAPI
ITextSelection_fnPaste(ITextSelection
*me
, VARIANT
*pVar
, LONG Format
)
2024 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2026 return CO_E_RELEASED
;
2028 FIXME("not implemented\n");
2032 static HRESULT WINAPI
ITextSelection_fnCanPaste(ITextSelection
*me
, VARIANT
*pVar
, LONG Format
,
2035 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2037 return CO_E_RELEASED
;
2039 FIXME("not implemented\n");
2043 static HRESULT WINAPI
ITextSelection_fnCanEdit(ITextSelection
*me
, LONG
*pb
)
2045 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2047 return CO_E_RELEASED
;
2049 FIXME("not implemented\n");
2053 static HRESULT WINAPI
ITextSelection_fnChangeCase(ITextSelection
*me
, LONG Type
)
2055 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2057 return CO_E_RELEASED
;
2059 FIXME("not implemented\n");
2063 static HRESULT WINAPI
ITextSelection_fnGetPoint(ITextSelection
*me
, LONG Type
, LONG
*cx
, LONG
*cy
)
2065 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2067 return CO_E_RELEASED
;
2069 FIXME("not implemented\n");
2073 static HRESULT WINAPI
ITextSelection_fnSetPoint(ITextSelection
*me
, LONG x
, LONG y
, LONG Type
,
2076 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2078 return CO_E_RELEASED
;
2080 FIXME("not implemented\n");
2084 static HRESULT WINAPI
ITextSelection_fnScrollIntoView(ITextSelection
*me
, LONG Value
)
2086 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2088 return CO_E_RELEASED
;
2090 FIXME("not implemented\n");
2094 static HRESULT WINAPI
ITextSelection_fnGetEmbeddedObject(ITextSelection
*me
, IUnknown
**ppv
)
2096 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2098 return CO_E_RELEASED
;
2100 FIXME("not implemented\n");
2104 /*** ITextSelection methods ***/
2105 static HRESULT WINAPI
ITextSelection_fnGetFlags(ITextSelection
*me
, LONG
*pFlags
)
2107 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2109 return CO_E_RELEASED
;
2111 FIXME("not implemented\n");
2115 static HRESULT WINAPI
ITextSelection_fnSetFlags(ITextSelection
*me
, LONG Flags
)
2117 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2119 return CO_E_RELEASED
;
2121 FIXME("not implemented\n");
2125 static HRESULT WINAPI
ITextSelection_fnGetType(ITextSelection
*me
, LONG
*pType
)
2127 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2129 return CO_E_RELEASED
;
2131 FIXME("not implemented\n");
2135 static HRESULT WINAPI
ITextSelection_fnMoveLeft(ITextSelection
*me
, LONG Unit
, LONG Count
,
2136 LONG Extend
, LONG
*pDelta
)
2138 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2140 return CO_E_RELEASED
;
2142 FIXME("not implemented\n");
2146 static HRESULT WINAPI
ITextSelection_fnMoveRight(ITextSelection
*me
, LONG Unit
, LONG Count
,
2147 LONG Extend
, LONG
*pDelta
)
2149 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2151 return CO_E_RELEASED
;
2153 FIXME("not implemented\n");
2157 static HRESULT WINAPI
ITextSelection_fnMoveUp(ITextSelection
*me
, LONG Unit
, LONG Count
,
2158 LONG Extend
, LONG
*pDelta
)
2160 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2162 return CO_E_RELEASED
;
2164 FIXME("not implemented\n");
2168 static HRESULT WINAPI
ITextSelection_fnMoveDown(ITextSelection
*me
, LONG Unit
, LONG Count
,
2169 LONG Extend
, LONG
*pDelta
)
2171 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2173 return CO_E_RELEASED
;
2175 FIXME("not implemented\n");
2179 static HRESULT WINAPI
ITextSelection_fnHomeKey(ITextSelection
*me
, LONG Unit
, LONG Extend
,
2182 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2184 return CO_E_RELEASED
;
2186 FIXME("not implemented\n");
2190 static HRESULT WINAPI
ITextSelection_fnEndKey(ITextSelection
*me
, LONG Unit
, LONG Extend
,
2193 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2195 return CO_E_RELEASED
;
2197 FIXME("not implemented\n");
2201 static HRESULT WINAPI
ITextSelection_fnTypeText(ITextSelection
*me
, BSTR bstr
)
2203 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2205 return CO_E_RELEASED
;
2207 FIXME("not implemented\n");
2211 static const ITextSelectionVtbl tsvt
= {
2212 ITextSelection_fnQueryInterface
,
2213 ITextSelection_fnAddRef
,
2214 ITextSelection_fnRelease
,
2215 ITextSelection_fnGetTypeInfoCount
,
2216 ITextSelection_fnGetTypeInfo
,
2217 ITextSelection_fnGetIDsOfNames
,
2218 ITextSelection_fnInvoke
,
2219 ITextSelection_fnGetText
,
2220 ITextSelection_fnSetText
,
2221 ITextSelection_fnGetChar
,
2222 ITextSelection_fnSetChar
,
2223 ITextSelection_fnGetDuplicate
,
2224 ITextSelection_fnGetFormattedText
,
2225 ITextSelection_fnSetFormattedText
,
2226 ITextSelection_fnGetStart
,
2227 ITextSelection_fnSetStart
,
2228 ITextSelection_fnGetEnd
,
2229 ITextSelection_fnSetEnd
,
2230 ITextSelection_fnGetFont
,
2231 ITextSelection_fnSetFont
,
2232 ITextSelection_fnGetPara
,
2233 ITextSelection_fnSetPara
,
2234 ITextSelection_fnGetStoryLength
,
2235 ITextSelection_fnGetStoryType
,
2236 ITextSelection_fnCollapse
,
2237 ITextSelection_fnExpand
,
2238 ITextSelection_fnGetIndex
,
2239 ITextSelection_fnSetIndex
,
2240 ITextSelection_fnSetRange
,
2241 ITextSelection_fnInRange
,
2242 ITextSelection_fnInStory
,
2243 ITextSelection_fnIsEqual
,
2244 ITextSelection_fnSelect
,
2245 ITextSelection_fnStartOf
,
2246 ITextSelection_fnEndOf
,
2247 ITextSelection_fnMove
,
2248 ITextSelection_fnMoveStart
,
2249 ITextSelection_fnMoveEnd
,
2250 ITextSelection_fnMoveWhile
,
2251 ITextSelection_fnMoveStartWhile
,
2252 ITextSelection_fnMoveEndWhile
,
2253 ITextSelection_fnMoveUntil
,
2254 ITextSelection_fnMoveStartUntil
,
2255 ITextSelection_fnMoveEndUntil
,
2256 ITextSelection_fnFindText
,
2257 ITextSelection_fnFindTextStart
,
2258 ITextSelection_fnFindTextEnd
,
2259 ITextSelection_fnDelete
,
2260 ITextSelection_fnCut
,
2261 ITextSelection_fnCopy
,
2262 ITextSelection_fnPaste
,
2263 ITextSelection_fnCanPaste
,
2264 ITextSelection_fnCanEdit
,
2265 ITextSelection_fnChangeCase
,
2266 ITextSelection_fnGetPoint
,
2267 ITextSelection_fnSetPoint
,
2268 ITextSelection_fnScrollIntoView
,
2269 ITextSelection_fnGetEmbeddedObject
,
2270 ITextSelection_fnGetFlags
,
2271 ITextSelection_fnSetFlags
,
2272 ITextSelection_fnGetType
,
2273 ITextSelection_fnMoveLeft
,
2274 ITextSelection_fnMoveRight
,
2275 ITextSelection_fnMoveUp
,
2276 ITextSelection_fnMoveDown
,
2277 ITextSelection_fnHomeKey
,
2278 ITextSelection_fnEndKey
,
2279 ITextSelection_fnTypeText
2282 static ITextSelectionImpl
*
2283 CreateTextSelection(IRichEditOleImpl
*reOle
)
2285 ITextSelectionImpl
*txtSel
= heap_alloc(sizeof *txtSel
);
2289 txtSel
->ITextSelection_iface
.lpVtbl
= &tsvt
;
2291 txtSel
->reOle
= reOle
;
2295 LRESULT
CreateIRichEditOle(ME_TextEditor
*editor
, LPVOID
*ppObj
)
2297 IRichEditOleImpl
*reo
;
2299 reo
= heap_alloc(sizeof(IRichEditOleImpl
));
2303 reo
->IRichEditOle_iface
.lpVtbl
= &revt
;
2304 reo
->ITextDocument_iface
.lpVtbl
= &tdvt
;
2306 reo
->editor
= editor
;
2307 reo
->txtSel
= CreateTextSelection(reo
);
2313 reo
->clientSite
= CreateOleClientSite(reo
);
2314 if (!reo
->clientSite
)
2316 ITextSelection_Release(&reo
->txtSel
->ITextSelection_iface
);
2320 TRACE("Created %p\n",reo
);
2322 list_init(&reo
->rangelist
);
2327 static void convert_sizel(const ME_Context
*c
, const SIZEL
* szl
, SIZE
* sz
)
2329 /* sizel is in .01 millimeters, sz in pixels */
2330 sz
->cx
= MulDiv(szl
->cx
, c
->dpi
.cx
, 2540);
2331 sz
->cy
= MulDiv(szl
->cy
, c
->dpi
.cy
, 2540);
2334 /******************************************************************************
2335 * ME_GetOLEObjectSize
2337 * Sets run extent for OLE objects.
2339 void ME_GetOLEObjectSize(const ME_Context
*c
, ME_Run
*run
, SIZE
*pSize
)
2347 assert(run
->nFlags
& MERF_GRAPHICS
);
2348 assert(run
->ole_obj
);
2350 if (run
->ole_obj
->sizel
.cx
!= 0 || run
->ole_obj
->sizel
.cy
!= 0)
2352 convert_sizel(c
, &run
->ole_obj
->sizel
, pSize
);
2353 if (c
->editor
->nZoomNumerator
!= 0)
2355 pSize
->cx
= MulDiv(pSize
->cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2356 pSize
->cy
= MulDiv(pSize
->cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2361 if (IOleObject_QueryInterface(run
->ole_obj
->poleobj
, &IID_IDataObject
, (void**)&ido
) != S_OK
)
2363 FIXME("Query Interface IID_IDataObject failed!\n");
2364 pSize
->cx
= pSize
->cy
= 0;
2367 fmt
.cfFormat
= CF_BITMAP
;
2369 fmt
.dwAspect
= DVASPECT_CONTENT
;
2371 fmt
.tymed
= TYMED_GDI
;
2372 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
2374 fmt
.cfFormat
= CF_ENHMETAFILE
;
2375 fmt
.tymed
= TYMED_ENHMF
;
2376 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
2378 FIXME("unsupported format\n");
2379 pSize
->cx
= pSize
->cy
= 0;
2380 IDataObject_Release(ido
);
2388 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
2389 pSize
->cx
= dibsect
.dsBm
.bmWidth
;
2390 pSize
->cy
= dibsect
.dsBm
.bmHeight
;
2391 if (!stgm
.pUnkForRelease
) DeleteObject(stgm
.u
.hBitmap
);
2394 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
2395 pSize
->cx
= emh
.rclBounds
.right
- emh
.rclBounds
.left
;
2396 pSize
->cy
= emh
.rclBounds
.bottom
- emh
.rclBounds
.top
;
2397 if (!stgm
.pUnkForRelease
) DeleteEnhMetaFile(stgm
.u
.hEnhMetaFile
);
2400 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
2403 IDataObject_Release(ido
);
2404 if (c
->editor
->nZoomNumerator
!= 0)
2406 pSize
->cx
= MulDiv(pSize
->cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2407 pSize
->cy
= MulDiv(pSize
->cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2411 void ME_DrawOLE(ME_Context
*c
, int x
, int y
, ME_Run
*run
,
2412 ME_Paragraph
*para
, BOOL selected
)
2423 assert(run
->nFlags
& MERF_GRAPHICS
);
2424 assert(run
->ole_obj
);
2425 if (IOleObject_QueryInterface(run
->ole_obj
->poleobj
, &IID_IDataObject
, (void**)&ido
) != S_OK
)
2427 FIXME("Couldn't get interface\n");
2430 has_size
= run
->ole_obj
->sizel
.cx
!= 0 || run
->ole_obj
->sizel
.cy
!= 0;
2431 fmt
.cfFormat
= CF_BITMAP
;
2433 fmt
.dwAspect
= DVASPECT_CONTENT
;
2435 fmt
.tymed
= TYMED_GDI
;
2436 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
2438 fmt
.cfFormat
= CF_ENHMETAFILE
;
2439 fmt
.tymed
= TYMED_ENHMF
;
2440 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
2442 FIXME("Couldn't get storage medium\n");
2443 IDataObject_Release(ido
);
2450 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
2451 hMemDC
= CreateCompatibleDC(c
->hDC
);
2452 SelectObject(hMemDC
, stgm
.u
.hBitmap
);
2455 convert_sizel(c
, &run
->ole_obj
->sizel
, &sz
);
2457 sz
.cx
= MulDiv(dibsect
.dsBm
.bmWidth
, c
->dpi
.cx
, 96);
2458 sz
.cy
= MulDiv(dibsect
.dsBm
.bmHeight
, c
->dpi
.cy
, 96);
2460 if (c
->editor
->nZoomNumerator
!= 0)
2462 sz
.cx
= MulDiv(sz
.cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2463 sz
.cy
= MulDiv(sz
.cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2465 if (sz
.cx
== dibsect
.dsBm
.bmWidth
&& sz
.cy
== dibsect
.dsBm
.bmHeight
)
2467 BitBlt(c
->hDC
, x
, y
- sz
.cy
,
2468 dibsect
.dsBm
.bmWidth
, dibsect
.dsBm
.bmHeight
,
2469 hMemDC
, 0, 0, SRCCOPY
);
2471 StretchBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
,
2472 hMemDC
, 0, 0, dibsect
.dsBm
.bmWidth
,
2473 dibsect
.dsBm
.bmHeight
, SRCCOPY
);
2476 if (!stgm
.pUnkForRelease
) DeleteObject(stgm
.u
.hBitmap
);
2479 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
2482 convert_sizel(c
, &run
->ole_obj
->sizel
, &sz
);
2484 sz
.cy
= MulDiv(emh
.rclBounds
.bottom
- emh
.rclBounds
.top
, c
->dpi
.cx
, 96);
2485 sz
.cx
= MulDiv(emh
.rclBounds
.right
- emh
.rclBounds
.left
, c
->dpi
.cy
, 96);
2487 if (c
->editor
->nZoomNumerator
!= 0)
2489 sz
.cx
= MulDiv(sz
.cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2490 sz
.cy
= MulDiv(sz
.cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2498 rc
.right
= x
+ sz
.cx
;
2500 PlayEnhMetaFile(c
->hDC
, stgm
.u
.hEnhMetaFile
, &rc
);
2502 if (!stgm
.pUnkForRelease
) DeleteEnhMetaFile(stgm
.u
.hEnhMetaFile
);
2505 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
2509 if (selected
&& !c
->editor
->bHideSelection
)
2510 PatBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
, DSTINVERT
);
2511 IDataObject_Release(ido
);
2514 void ME_DeleteReObject(REOBJECT
* reo
)
2516 if (reo
->poleobj
) IOleObject_Release(reo
->poleobj
);
2517 if (reo
->pstg
) IStorage_Release(reo
->pstg
);
2518 if (reo
->polesite
) IOleClientSite_Release(reo
->polesite
);
2522 void ME_CopyReObject(REOBJECT
* dst
, const REOBJECT
* src
)
2526 if (dst
->poleobj
) IOleObject_AddRef(dst
->poleobj
);
2527 if (dst
->pstg
) IStorage_AddRef(dst
->pstg
);
2528 if (dst
->polesite
) IOleClientSite_AddRef(dst
->polesite
);