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 This
->editor
->reOle
= NULL
;
146 ITextSelection_Release(&This
->txtSel
->ITextSelection_iface
);
147 IOleClientSite_Release(&This
->clientSite
->IOleClientSite_iface
);
148 LIST_FOR_EACH_ENTRY(txtRge
, &This
->rangelist
, ITextRangeImpl
, entry
)
149 txtRge
->reOle
= NULL
;
155 static HRESULT WINAPI
156 IRichEditOle_fnActivateAs(IRichEditOle
*me
, REFCLSID rclsid
, REFCLSID rclsidAs
)
158 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
159 FIXME("stub %p\n",This
);
163 static HRESULT WINAPI
164 IRichEditOle_fnContextSensitiveHelp(IRichEditOle
*me
, BOOL fEnterMode
)
166 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
167 FIXME("stub %p\n",This
);
171 static HRESULT WINAPI
172 IRichEditOle_fnConvertObject(IRichEditOle
*me
, LONG iob
,
173 REFCLSID rclsidNew
, LPCSTR lpstrUserTypeNew
)
175 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
176 FIXME("stub %p\n",This
);
180 static inline IOleClientSiteImpl
*impl_from_IOleClientSite(IOleClientSite
*iface
)
182 return CONTAINING_RECORD(iface
, IOleClientSiteImpl
, IOleClientSite_iface
);
185 static HRESULT WINAPI
186 IOleClientSite_fnQueryInterface(IOleClientSite
*me
, REFIID riid
, LPVOID
*ppvObj
)
188 TRACE("%p %s\n", me
, debugstr_guid(riid
) );
191 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
192 IsEqualGUID(riid
, &IID_IOleClientSite
))
196 IOleClientSite_AddRef(me
);
199 FIXME("%p: unhandled interface %s\n", me
, debugstr_guid(riid
) );
201 return E_NOINTERFACE
;
204 static ULONG WINAPI
IOleClientSite_fnAddRef(IOleClientSite
*iface
)
206 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
207 return InterlockedIncrement(&This
->ref
);
210 static ULONG WINAPI
IOleClientSite_fnRelease(IOleClientSite
*iface
)
212 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
213 ULONG ref
= InterlockedDecrement(&This
->ref
);
219 static HRESULT WINAPI
IOleClientSite_fnSaveObject(IOleClientSite
*iface
)
221 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
223 return CO_E_RELEASED
;
225 FIXME("stub %p\n", iface
);
230 static HRESULT WINAPI
IOleClientSite_fnGetMoniker(IOleClientSite
*iface
, DWORD dwAssign
,
231 DWORD dwWhichMoniker
, IMoniker
**ppmk
)
233 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
235 return CO_E_RELEASED
;
237 FIXME("stub %p\n", iface
);
241 static HRESULT WINAPI
IOleClientSite_fnGetContainer(IOleClientSite
*iface
,
242 IOleContainer
**ppContainer
)
244 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
246 return CO_E_RELEASED
;
248 FIXME("stub %p\n", iface
);
252 static HRESULT WINAPI
IOleClientSite_fnShowObject(IOleClientSite
*iface
)
254 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
256 return CO_E_RELEASED
;
258 FIXME("stub %p\n", iface
);
262 static HRESULT WINAPI
IOleClientSite_fnOnShowWindow(IOleClientSite
*iface
, BOOL fShow
)
264 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
266 return CO_E_RELEASED
;
268 FIXME("stub %p\n", iface
);
272 static HRESULT WINAPI
IOleClientSite_fnRequestNewObjectLayout(IOleClientSite
*iface
)
274 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
276 return CO_E_RELEASED
;
278 FIXME("stub %p\n", iface
);
282 static const IOleClientSiteVtbl ocst
= {
283 IOleClientSite_fnQueryInterface
,
284 IOleClientSite_fnAddRef
,
285 IOleClientSite_fnRelease
,
286 IOleClientSite_fnSaveObject
,
287 IOleClientSite_fnGetMoniker
,
288 IOleClientSite_fnGetContainer
,
289 IOleClientSite_fnShowObject
,
290 IOleClientSite_fnOnShowWindow
,
291 IOleClientSite_fnRequestNewObjectLayout
294 static IOleClientSiteImpl
*
295 CreateOleClientSite(IRichEditOleImpl
*reOle
)
297 IOleClientSiteImpl
*clientSite
= heap_alloc(sizeof *clientSite
);
301 clientSite
->IOleClientSite_iface
.lpVtbl
= &ocst
;
303 clientSite
->reOle
= reOle
;
307 static HRESULT WINAPI
308 IRichEditOle_fnGetClientSite(IRichEditOle
*me
,
309 LPOLECLIENTSITE
*lplpolesite
)
311 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
313 TRACE("%p,%p\n",This
, lplpolesite
);
317 *lplpolesite
= &This
->clientSite
->IOleClientSite_iface
;
318 IOleClientSite_AddRef(*lplpolesite
);
322 static HRESULT WINAPI
323 IRichEditOle_fnGetClipboardData(IRichEditOle
*me
, CHARRANGE
*lpchrg
,
324 DWORD reco
, LPDATAOBJECT
*lplpdataobj
)
326 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
330 TRACE("(%p,%p,%d)\n",This
, lpchrg
, reco
);
334 int nFrom
, nTo
, nStartCur
= ME_GetSelectionOfs(This
->editor
, &nFrom
, &nTo
);
335 start
= This
->editor
->pCursors
[nStartCur
];
336 nChars
= nTo
- nFrom
;
338 ME_CursorFromCharOfs(This
->editor
, lpchrg
->cpMin
, &start
);
339 nChars
= lpchrg
->cpMax
- lpchrg
->cpMin
;
341 return ME_GetDataObject(This
->editor
, &start
, nChars
, lplpdataobj
);
344 static LONG WINAPI
IRichEditOle_fnGetLinkCount(IRichEditOle
*me
)
346 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
347 FIXME("stub %p\n",This
);
351 static HRESULT WINAPI
352 IRichEditOle_fnGetObject(IRichEditOle
*me
, LONG iob
,
353 REOBJECT
*lpreobject
, DWORD dwFlags
)
355 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
356 FIXME("stub %p\n",This
);
361 IRichEditOle_fnGetObjectCount(IRichEditOle
*me
)
363 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
364 FIXME("stub %p\n",This
);
368 static HRESULT WINAPI
369 IRichEditOle_fnHandsOffStorage(IRichEditOle
*me
, LONG iob
)
371 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
372 FIXME("stub %p\n",This
);
376 static HRESULT WINAPI
377 IRichEditOle_fnImportDataObject(IRichEditOle
*me
, LPDATAOBJECT lpdataobj
,
378 CLIPFORMAT cf
, HGLOBAL hMetaPict
)
380 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
381 FIXME("stub %p\n",This
);
385 static HRESULT WINAPI
386 IRichEditOle_fnInPlaceDeactivate(IRichEditOle
*me
)
388 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
389 FIXME("stub %p\n",This
);
393 static HRESULT WINAPI
394 IRichEditOle_fnInsertObject(IRichEditOle
*me
, REOBJECT
*reo
)
396 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
397 TRACE("(%p,%p)\n", This
, reo
);
399 if (reo
->cbStruct
< sizeof(*reo
)) return STG_E_INVALIDPARAMETER
;
401 ME_InsertOLEFromCursor(This
->editor
, reo
, 0);
402 ME_CommitUndo(This
->editor
);
403 ME_UpdateRepaint(This
->editor
, FALSE
);
407 static HRESULT WINAPI
IRichEditOle_fnSaveCompleted(IRichEditOle
*me
, LONG iob
,
410 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
411 FIXME("stub %p\n",This
);
415 static HRESULT WINAPI
416 IRichEditOle_fnSetDvaspect(IRichEditOle
*me
, LONG iob
, DWORD dvaspect
)
418 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
419 FIXME("stub %p\n",This
);
423 static HRESULT WINAPI
IRichEditOle_fnSetHostNames(IRichEditOle
*me
,
424 LPCSTR lpstrContainerApp
, LPCSTR lpstrContainerObj
)
426 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
427 FIXME("stub %p %s %s\n",This
, lpstrContainerApp
, lpstrContainerObj
);
431 static HRESULT WINAPI
432 IRichEditOle_fnSetLinkAvailable(IRichEditOle
*me
, LONG iob
, BOOL fAvailable
)
434 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
435 FIXME("stub %p\n",This
);
439 static const IRichEditOleVtbl revt
= {
440 IRichEditOle_fnQueryInterface
,
441 IRichEditOle_fnAddRef
,
442 IRichEditOle_fnRelease
,
443 IRichEditOle_fnGetClientSite
,
444 IRichEditOle_fnGetObjectCount
,
445 IRichEditOle_fnGetLinkCount
,
446 IRichEditOle_fnGetObject
,
447 IRichEditOle_fnInsertObject
,
448 IRichEditOle_fnConvertObject
,
449 IRichEditOle_fnActivateAs
,
450 IRichEditOle_fnSetHostNames
,
451 IRichEditOle_fnSetLinkAvailable
,
452 IRichEditOle_fnSetDvaspect
,
453 IRichEditOle_fnHandsOffStorage
,
454 IRichEditOle_fnSaveCompleted
,
455 IRichEditOle_fnInPlaceDeactivate
,
456 IRichEditOle_fnContextSensitiveHelp
,
457 IRichEditOle_fnGetClipboardData
,
458 IRichEditOle_fnImportDataObject
461 /* ITextRange interface */
462 static inline ITextRangeImpl
*impl_from_ITextRange(ITextRange
*iface
)
464 return CONTAINING_RECORD(iface
, ITextRangeImpl
, ITextRange_iface
);
467 static HRESULT WINAPI
ITextRange_fnQueryInterface(ITextRange
*me
, REFIID riid
, void **ppvObj
)
470 if (IsEqualGUID(riid
, &IID_IUnknown
)
471 || IsEqualGUID(riid
, &IID_IDispatch
)
472 || IsEqualGUID(riid
, &IID_ITextRange
))
475 ITextRange_AddRef(me
);
479 return E_NOINTERFACE
;
482 static ULONG WINAPI
ITextRange_fnAddRef(ITextRange
*me
)
484 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
485 return InterlockedIncrement(&This
->ref
);
488 static ULONG WINAPI
ITextRange_fnRelease(ITextRange
*me
)
490 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
491 ULONG ref
= InterlockedDecrement(&This
->ref
);
493 TRACE ("%p ref=%u\n", This
, ref
);
498 list_remove(&This
->entry
);
506 static HRESULT WINAPI
ITextRange_fnGetTypeInfoCount(ITextRange
*me
, UINT
*pctinfo
)
508 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
510 return CO_E_RELEASED
;
512 FIXME("not implemented %p\n", This
);
516 static HRESULT WINAPI
ITextRange_fnGetTypeInfo(ITextRange
*me
, UINT iTInfo
, LCID lcid
,
519 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
521 return CO_E_RELEASED
;
523 FIXME("not implemented %p\n", This
);
527 static HRESULT WINAPI
ITextRange_fnGetIDsOfNames(ITextRange
*me
, REFIID riid
, LPOLESTR
*rgszNames
,
528 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
530 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
532 return CO_E_RELEASED
;
534 FIXME("not implemented %p\n", This
);
538 static HRESULT WINAPI
ITextRange_fnInvoke(ITextRange
*me
, DISPID dispIdMember
, REFIID riid
,
539 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
540 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
,
543 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
545 return CO_E_RELEASED
;
547 FIXME("not implemented %p\n", This
);
551 static HRESULT WINAPI
ITextRange_fnGetText(ITextRange
*me
, BSTR
*pbstr
)
553 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
555 return CO_E_RELEASED
;
557 FIXME("not implemented %p\n", This
);
561 static HRESULT WINAPI
ITextRange_fnSetText(ITextRange
*me
, BSTR bstr
)
563 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
565 return CO_E_RELEASED
;
567 FIXME("not implemented %p\n", This
);
571 static HRESULT
range_GetChar(ME_TextEditor
*editor
, ME_Cursor
*cursor
, LONG
*pch
)
575 ME_GetTextW(editor
, wch
, 1, cursor
, 1, FALSE
, cursor
->pRun
->next
->type
== diTextEnd
);
581 static HRESULT WINAPI
ITextRange_fnGetChar(ITextRange
*me
, LONG
*pch
)
583 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
587 return CO_E_RELEASED
;
592 ME_CursorFromCharOfs(This
->reOle
->editor
, This
->start
, &cursor
);
593 return range_GetChar(This
->reOle
->editor
, &cursor
, pch
);
596 static HRESULT WINAPI
ITextRange_fnSetChar(ITextRange
*me
, LONG ch
)
598 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
600 return CO_E_RELEASED
;
602 FIXME("not implemented %p\n", This
);
606 static HRESULT
CreateITextRange(IRichEditOleImpl
*reOle
, LONG start
, LONG end
, ITextRange
** ppRange
);
608 static HRESULT WINAPI
ITextRange_fnGetDuplicate(ITextRange
*me
, ITextRange
**ppRange
)
610 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
612 return CO_E_RELEASED
;
614 TRACE("%p %p\n", This
, ppRange
);
618 return CreateITextRange(This
->reOle
, This
->start
, This
->end
, ppRange
);
621 static HRESULT WINAPI
ITextRange_fnGetFormattedText(ITextRange
*me
, ITextRange
**ppRange
)
623 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
625 return CO_E_RELEASED
;
627 FIXME("not implemented %p\n", This
);
631 static HRESULT WINAPI
ITextRange_fnSetFormattedText(ITextRange
*me
, ITextRange
*pRange
)
633 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
635 return CO_E_RELEASED
;
637 FIXME("not implemented %p\n", This
);
641 static HRESULT WINAPI
ITextRange_fnGetStart(ITextRange
*me
, LONG
*pcpFirst
)
643 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
645 return CO_E_RELEASED
;
649 *pcpFirst
= This
->start
;
650 TRACE("%d\n", *pcpFirst
);
654 static HRESULT WINAPI
ITextRange_fnSetStart(ITextRange
*me
, LONG cpFirst
)
656 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
658 return CO_E_RELEASED
;
660 FIXME("not implemented %p\n", This
);
664 static HRESULT WINAPI
ITextRange_fnGetEnd(ITextRange
*me
, LONG
*pcpLim
)
666 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
668 return CO_E_RELEASED
;
673 TRACE("%d\n", *pcpLim
);
677 static HRESULT WINAPI
ITextRange_fnSetEnd(ITextRange
*me
, LONG cpLim
)
679 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
681 return CO_E_RELEASED
;
683 FIXME("not implemented %p\n", This
);
687 static HRESULT WINAPI
ITextRange_fnGetFont(ITextRange
*me
, ITextFont
**pFont
)
689 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
691 return CO_E_RELEASED
;
693 FIXME("not implemented %p\n", This
);
697 static HRESULT WINAPI
ITextRange_fnSetFont(ITextRange
*me
, ITextFont
*pFont
)
699 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
701 return CO_E_RELEASED
;
703 FIXME("not implemented %p\n", This
);
707 static HRESULT WINAPI
ITextRange_fnGetPara(ITextRange
*me
, ITextPara
**ppPara
)
709 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
711 return CO_E_RELEASED
;
713 FIXME("not implemented %p\n", This
);
717 static HRESULT WINAPI
ITextRange_fnSetPara(ITextRange
*me
, ITextPara
*pPara
)
719 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
721 return CO_E_RELEASED
;
723 FIXME("not implemented %p\n", This
);
727 static HRESULT WINAPI
ITextRange_fnGetStoryLength(ITextRange
*me
, LONG
*pcch
)
729 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
731 return CO_E_RELEASED
;
733 FIXME("not implemented %p\n", This
);
737 static HRESULT WINAPI
ITextRange_fnGetStoryType(ITextRange
*me
, LONG
*pValue
)
739 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
741 return CO_E_RELEASED
;
743 FIXME("not implemented %p\n", This
);
747 static HRESULT
range_Collapse(LONG bStart
, LONG
*start
, LONG
*end
)
752 if (bStart
== tomEnd
|| bStart
== tomFalse
)
759 static HRESULT WINAPI
ITextRange_fnCollapse(ITextRange
*me
, LONG bStart
)
761 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
763 return CO_E_RELEASED
;
765 return range_Collapse(bStart
, &This
->start
, &This
->end
);
768 static HRESULT WINAPI
ITextRange_fnExpand(ITextRange
*me
, LONG Unit
, LONG
*pDelta
)
770 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
772 return CO_E_RELEASED
;
774 FIXME("not implemented %p\n", This
);
778 static HRESULT WINAPI
ITextRange_fnGetIndex(ITextRange
*me
, LONG Unit
, LONG
*pIndex
)
780 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
782 return CO_E_RELEASED
;
784 FIXME("not implemented %p\n", This
);
788 static HRESULT WINAPI
ITextRange_fnSetIndex(ITextRange
*me
, LONG Unit
, LONG Index
,
791 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
793 return CO_E_RELEASED
;
795 FIXME("not implemented %p\n", This
);
799 static HRESULT WINAPI
ITextRange_fnSetRange(ITextRange
*me
, LONG cpActive
, LONG cpOther
)
801 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
803 return CO_E_RELEASED
;
805 FIXME("not implemented %p\n", This
);
809 static HRESULT WINAPI
ITextRange_fnInRange(ITextRange
*me
, ITextRange
*pRange
, LONG
*pb
)
811 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
813 return CO_E_RELEASED
;
815 FIXME("not implemented %p\n", This
);
819 static HRESULT WINAPI
ITextRange_fnInStory(ITextRange
*me
, ITextRange
*pRange
, LONG
*pb
)
821 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
823 return CO_E_RELEASED
;
825 FIXME("not implemented %p\n", This
);
829 static HRESULT WINAPI
ITextRange_fnIsEqual(ITextRange
*me
, ITextRange
*pRange
, LONG
*pb
)
831 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
833 return CO_E_RELEASED
;
835 FIXME("not implemented %p\n", This
);
839 static HRESULT WINAPI
ITextRange_fnSelect(ITextRange
*me
)
841 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
843 return CO_E_RELEASED
;
845 FIXME("not implemented %p\n", This
);
849 static HRESULT WINAPI
ITextRange_fnStartOf(ITextRange
*me
, LONG Unit
, LONG Extend
,
852 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
854 return CO_E_RELEASED
;
856 FIXME("not implemented %p\n", This
);
860 static HRESULT WINAPI
ITextRange_fnEndOf(ITextRange
*me
, LONG Unit
, LONG Extend
,
863 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
865 return CO_E_RELEASED
;
867 FIXME("not implemented %p\n", This
);
871 static HRESULT WINAPI
ITextRange_fnMove(ITextRange
*me
, LONG Unit
, LONG Count
, LONG
*pDelta
)
873 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
875 return CO_E_RELEASED
;
877 FIXME("not implemented %p\n", This
);
881 static HRESULT WINAPI
ITextRange_fnMoveStart(ITextRange
*me
, LONG Unit
, LONG Count
,
884 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
886 return CO_E_RELEASED
;
888 FIXME("not implemented %p\n", This
);
892 static HRESULT WINAPI
ITextRange_fnMoveEnd(ITextRange
*me
, LONG Unit
, LONG Count
,
895 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
897 return CO_E_RELEASED
;
899 FIXME("not implemented %p\n", This
);
903 static HRESULT WINAPI
ITextRange_fnMoveWhile(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
906 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
908 return CO_E_RELEASED
;
910 FIXME("not implemented %p\n", This
);
914 static HRESULT WINAPI
ITextRange_fnMoveStartWhile(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
917 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
919 return CO_E_RELEASED
;
921 FIXME("not implemented %p\n", This
);
925 static HRESULT WINAPI
ITextRange_fnMoveEndWhile(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
928 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
930 return CO_E_RELEASED
;
932 FIXME("not implemented %p\n", This
);
936 static HRESULT WINAPI
ITextRange_fnMoveUntil(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
939 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
941 return CO_E_RELEASED
;
943 FIXME("not implemented %p\n", This
);
947 static HRESULT WINAPI
ITextRange_fnMoveStartUntil(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
950 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
952 return CO_E_RELEASED
;
954 FIXME("not implemented %p\n", This
);
958 static HRESULT WINAPI
ITextRange_fnMoveEndUntil(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
961 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
963 return CO_E_RELEASED
;
965 FIXME("not implemented %p\n", This
);
969 static HRESULT WINAPI
ITextRange_fnFindText(ITextRange
*me
, BSTR bstr
, LONG cch
, LONG Flags
,
972 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
974 return CO_E_RELEASED
;
976 FIXME("not implemented %p\n", This
);
980 static HRESULT WINAPI
ITextRange_fnFindTextStart(ITextRange
*me
, BSTR bstr
, LONG cch
,
981 LONG Flags
, LONG
*pLength
)
983 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
985 return CO_E_RELEASED
;
987 FIXME("not implemented %p\n", This
);
991 static HRESULT WINAPI
ITextRange_fnFindTextEnd(ITextRange
*me
, BSTR bstr
, LONG cch
,
992 LONG Flags
, LONG
*pLength
)
994 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
996 return CO_E_RELEASED
;
998 FIXME("not implemented %p\n", This
);
1002 static HRESULT WINAPI
ITextRange_fnDelete(ITextRange
*me
, LONG Unit
, LONG Count
,
1005 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1007 return CO_E_RELEASED
;
1009 FIXME("not implemented %p\n", This
);
1013 static HRESULT WINAPI
ITextRange_fnCut(ITextRange
*me
, VARIANT
*pVar
)
1015 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1017 return CO_E_RELEASED
;
1019 FIXME("not implemented %p\n", This
);
1023 static HRESULT WINAPI
ITextRange_fnCopy(ITextRange
*me
, VARIANT
*pVar
)
1025 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1027 return CO_E_RELEASED
;
1029 FIXME("not implemented %p\n", This
);
1033 static HRESULT WINAPI
ITextRange_fnPaste(ITextRange
*me
, VARIANT
*pVar
, LONG Format
)
1035 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1037 return CO_E_RELEASED
;
1039 FIXME("not implemented %p\n", This
);
1043 static HRESULT WINAPI
ITextRange_fnCanPaste(ITextRange
*me
, VARIANT
*pVar
, LONG Format
,
1046 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1048 return CO_E_RELEASED
;
1050 FIXME("not implemented %p\n", This
);
1054 static HRESULT WINAPI
ITextRange_fnCanEdit(ITextRange
*me
, LONG
*pb
)
1056 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1058 return CO_E_RELEASED
;
1060 FIXME("not implemented %p\n", This
);
1064 static HRESULT WINAPI
ITextRange_fnChangeCase(ITextRange
*me
, LONG Type
)
1066 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1068 return CO_E_RELEASED
;
1070 FIXME("not implemented %p\n", This
);
1074 static HRESULT WINAPI
ITextRange_fnGetPoint(ITextRange
*me
, LONG Type
, LONG
*cx
, LONG
*cy
)
1076 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1078 return CO_E_RELEASED
;
1080 FIXME("not implemented %p\n", This
);
1084 static HRESULT WINAPI
ITextRange_fnSetPoint(ITextRange
*me
, LONG x
, LONG y
, LONG Type
,
1087 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1089 return CO_E_RELEASED
;
1091 FIXME("not implemented %p\n", This
);
1095 static HRESULT WINAPI
ITextRange_fnScrollIntoView(ITextRange
*me
, LONG Value
)
1097 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1099 return CO_E_RELEASED
;
1101 FIXME("not implemented %p\n", This
);
1105 static HRESULT WINAPI
ITextRange_fnGetEmbeddedObject(ITextRange
*me
, IUnknown
**ppv
)
1107 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1109 return CO_E_RELEASED
;
1111 FIXME("not implemented %p\n", This
);
1115 static const ITextRangeVtbl trvt
= {
1116 ITextRange_fnQueryInterface
,
1117 ITextRange_fnAddRef
,
1118 ITextRange_fnRelease
,
1119 ITextRange_fnGetTypeInfoCount
,
1120 ITextRange_fnGetTypeInfo
,
1121 ITextRange_fnGetIDsOfNames
,
1122 ITextRange_fnInvoke
,
1123 ITextRange_fnGetText
,
1124 ITextRange_fnSetText
,
1125 ITextRange_fnGetChar
,
1126 ITextRange_fnSetChar
,
1127 ITextRange_fnGetDuplicate
,
1128 ITextRange_fnGetFormattedText
,
1129 ITextRange_fnSetFormattedText
,
1130 ITextRange_fnGetStart
,
1131 ITextRange_fnSetStart
,
1132 ITextRange_fnGetEnd
,
1133 ITextRange_fnSetEnd
,
1134 ITextRange_fnGetFont
,
1135 ITextRange_fnSetFont
,
1136 ITextRange_fnGetPara
,
1137 ITextRange_fnSetPara
,
1138 ITextRange_fnGetStoryLength
,
1139 ITextRange_fnGetStoryType
,
1140 ITextRange_fnCollapse
,
1141 ITextRange_fnExpand
,
1142 ITextRange_fnGetIndex
,
1143 ITextRange_fnSetIndex
,
1144 ITextRange_fnSetRange
,
1145 ITextRange_fnInRange
,
1146 ITextRange_fnInStory
,
1147 ITextRange_fnIsEqual
,
1148 ITextRange_fnSelect
,
1149 ITextRange_fnStartOf
,
1152 ITextRange_fnMoveStart
,
1153 ITextRange_fnMoveEnd
,
1154 ITextRange_fnMoveWhile
,
1155 ITextRange_fnMoveStartWhile
,
1156 ITextRange_fnMoveEndWhile
,
1157 ITextRange_fnMoveUntil
,
1158 ITextRange_fnMoveStartUntil
,
1159 ITextRange_fnMoveEndUntil
,
1160 ITextRange_fnFindText
,
1161 ITextRange_fnFindTextStart
,
1162 ITextRange_fnFindTextEnd
,
1163 ITextRange_fnDelete
,
1167 ITextRange_fnCanPaste
,
1168 ITextRange_fnCanEdit
,
1169 ITextRange_fnChangeCase
,
1170 ITextRange_fnGetPoint
,
1171 ITextRange_fnSetPoint
,
1172 ITextRange_fnScrollIntoView
,
1173 ITextRange_fnGetEmbeddedObject
1175 /* ITextRange interface */
1177 static HRESULT WINAPI
1178 ITextDocument_fnQueryInterface(ITextDocument
* me
, REFIID riid
,
1181 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1182 return IRichEditOle_QueryInterface(&This
->IRichEditOle_iface
, riid
, ppvObject
);
1186 ITextDocument_fnAddRef(ITextDocument
* me
)
1188 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1189 return IRichEditOle_AddRef(&This
->IRichEditOle_iface
);
1193 ITextDocument_fnRelease(ITextDocument
* me
)
1195 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1196 return IRichEditOle_Release(&This
->IRichEditOle_iface
);
1199 static HRESULT WINAPI
1200 ITextDocument_fnGetTypeInfoCount(ITextDocument
* me
,
1203 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1204 FIXME("stub %p\n",This
);
1208 static HRESULT WINAPI
1209 ITextDocument_fnGetTypeInfo(ITextDocument
* me
, UINT iTInfo
, LCID lcid
,
1210 ITypeInfo
** ppTInfo
)
1212 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1213 FIXME("stub %p\n",This
);
1217 static HRESULT WINAPI
1218 ITextDocument_fnGetIDsOfNames(ITextDocument
* me
, REFIID riid
,
1219 LPOLESTR
* rgszNames
, UINT cNames
, LCID lcid
, DISPID
* rgDispId
)
1221 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1222 FIXME("stub %p\n",This
);
1226 static HRESULT WINAPI
1227 ITextDocument_fnInvoke(ITextDocument
* me
, DISPID dispIdMember
,
1228 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
* pDispParams
,
1229 VARIANT
* pVarResult
, EXCEPINFO
* pExcepInfo
, UINT
* puArgErr
)
1231 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1232 FIXME("stub %p\n",This
);
1236 static HRESULT WINAPI
1237 ITextDocument_fnGetName(ITextDocument
* me
, BSTR
* pName
)
1239 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1240 FIXME("stub %p\n",This
);
1244 static HRESULT WINAPI
1245 ITextDocument_fnGetSelection(ITextDocument
* me
, ITextSelection
** ppSel
)
1247 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1248 TRACE("(%p)\n", me
);
1251 return E_INVALIDARG
;
1252 *ppSel
= &This
->txtSel
->ITextSelection_iface
;
1253 ITextSelection_AddRef(*ppSel
);
1257 static HRESULT WINAPI
1258 ITextDocument_fnGetStoryCount(ITextDocument
* me
, LONG
* pCount
)
1260 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1261 FIXME("stub %p\n",This
);
1265 static HRESULT WINAPI
1266 ITextDocument_fnGetStoryRanges(ITextDocument
* me
,
1267 ITextStoryRanges
** ppStories
)
1269 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1270 FIXME("stub %p\n",This
);
1274 static HRESULT WINAPI
1275 ITextDocument_fnGetSaved(ITextDocument
* me
, LONG
* pValue
)
1277 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1278 FIXME("stub %p\n",This
);
1282 static HRESULT WINAPI
1283 ITextDocument_fnSetSaved(ITextDocument
* me
, LONG Value
)
1285 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1286 FIXME("stub %p\n",This
);
1290 static HRESULT WINAPI
1291 ITextDocument_fnGetDefaultTabStop(ITextDocument
* me
, float* pValue
)
1293 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1294 FIXME("stub %p\n",This
);
1298 static HRESULT WINAPI
1299 ITextDocument_fnSetDefaultTabStop(ITextDocument
* me
, float Value
)
1301 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1302 FIXME("stub %p\n",This
);
1306 static HRESULT WINAPI
1307 ITextDocument_fnNew(ITextDocument
* me
)
1309 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1310 FIXME("stub %p\n",This
);
1314 static HRESULT WINAPI
1315 ITextDocument_fnOpen(ITextDocument
* me
, VARIANT
* pVar
, LONG Flags
,
1318 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1319 FIXME("stub %p\n",This
);
1323 static HRESULT WINAPI
1324 ITextDocument_fnSave(ITextDocument
* me
, VARIANT
* pVar
, LONG Flags
,
1327 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1328 FIXME("stub %p\n",This
);
1332 static HRESULT WINAPI
1333 ITextDocument_fnFreeze(ITextDocument
* me
, LONG
* pCount
)
1335 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1336 FIXME("stub %p\n",This
);
1340 static HRESULT WINAPI
1341 ITextDocument_fnUnfreeze(ITextDocument
* me
, LONG
* pCount
)
1343 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1344 FIXME("stub %p\n",This
);
1348 static HRESULT WINAPI
1349 ITextDocument_fnBeginEditCollection(ITextDocument
* me
)
1351 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1352 FIXME("stub %p\n",This
);
1356 static HRESULT WINAPI
1357 ITextDocument_fnEndEditCollection(ITextDocument
* me
)
1359 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1360 FIXME("stub %p\n",This
);
1364 static HRESULT WINAPI
1365 ITextDocument_fnUndo(ITextDocument
* me
, LONG Count
, LONG
* prop
)
1367 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1368 FIXME("stub %p\n",This
);
1372 static HRESULT WINAPI
1373 ITextDocument_fnRedo(ITextDocument
* me
, LONG Count
, LONG
* prop
)
1375 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1376 FIXME("stub %p\n",This
);
1380 static HRESULT
CreateITextRange(IRichEditOleImpl
*reOle
, LONG start
, LONG end
, ITextRange
** ppRange
)
1382 ITextRangeImpl
*txtRge
= heap_alloc(sizeof(ITextRangeImpl
));
1385 return E_OUTOFMEMORY
;
1386 txtRge
->ITextRange_iface
.lpVtbl
= &trvt
;
1388 txtRge
->reOle
= reOle
;
1389 txtRge
->start
= start
;
1391 list_add_head(&reOle
->rangelist
, &txtRge
->entry
);
1392 *ppRange
= &txtRge
->ITextRange_iface
;
1396 static HRESULT WINAPI
1397 ITextDocument_fnRange(ITextDocument
* me
, LONG cp1
, LONG cp2
,
1398 ITextRange
** ppRange
)
1400 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1401 const int len
= ME_GetTextLength(This
->editor
) + 1;
1403 TRACE("%p %p %d %d\n", This
, ppRange
, cp1
, cp2
);
1405 return E_INVALIDARG
;
1409 cp1
= min(cp1
, len
);
1410 cp2
= min(cp2
, len
);
1419 cp1
= cp2
= len
- 1;
1421 return CreateITextRange(This
, cp1
, cp2
, ppRange
);
1424 static HRESULT WINAPI
1425 ITextDocument_fnRangeFromPoint(ITextDocument
* me
, LONG x
, LONG y
,
1426 ITextRange
** ppRange
)
1428 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1429 FIXME("stub %p\n",This
);
1433 static const ITextDocumentVtbl tdvt
= {
1434 ITextDocument_fnQueryInterface
,
1435 ITextDocument_fnAddRef
,
1436 ITextDocument_fnRelease
,
1437 ITextDocument_fnGetTypeInfoCount
,
1438 ITextDocument_fnGetTypeInfo
,
1439 ITextDocument_fnGetIDsOfNames
,
1440 ITextDocument_fnInvoke
,
1441 ITextDocument_fnGetName
,
1442 ITextDocument_fnGetSelection
,
1443 ITextDocument_fnGetStoryCount
,
1444 ITextDocument_fnGetStoryRanges
,
1445 ITextDocument_fnGetSaved
,
1446 ITextDocument_fnSetSaved
,
1447 ITextDocument_fnGetDefaultTabStop
,
1448 ITextDocument_fnSetDefaultTabStop
,
1449 ITextDocument_fnNew
,
1450 ITextDocument_fnOpen
,
1451 ITextDocument_fnSave
,
1452 ITextDocument_fnFreeze
,
1453 ITextDocument_fnUnfreeze
,
1454 ITextDocument_fnBeginEditCollection
,
1455 ITextDocument_fnEndEditCollection
,
1456 ITextDocument_fnUndo
,
1457 ITextDocument_fnRedo
,
1458 ITextDocument_fnRange
,
1459 ITextDocument_fnRangeFromPoint
1462 static inline ITextSelectionImpl
*impl_from_ITextSelection(ITextSelection
*iface
)
1464 return CONTAINING_RECORD(iface
, ITextSelectionImpl
, ITextSelection_iface
);
1467 static HRESULT WINAPI
ITextSelection_fnQueryInterface(
1473 if (IsEqualGUID(riid
, &IID_IUnknown
)
1474 || IsEqualGUID(riid
, &IID_IDispatch
)
1475 || IsEqualGUID(riid
, &IID_ITextRange
)
1476 || IsEqualGUID(riid
, &IID_ITextSelection
))
1479 ITextSelection_AddRef(me
);
1483 return E_NOINTERFACE
;
1486 static ULONG WINAPI
ITextSelection_fnAddRef(ITextSelection
*me
)
1488 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1489 return InterlockedIncrement(&This
->ref
);
1492 static ULONG WINAPI
ITextSelection_fnRelease(ITextSelection
*me
)
1494 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1495 ULONG ref
= InterlockedDecrement(&This
->ref
);
1501 static HRESULT WINAPI
ITextSelection_fnGetTypeInfoCount(ITextSelection
*me
, UINT
*pctinfo
)
1503 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1505 return CO_E_RELEASED
;
1507 FIXME("not implemented\n");
1511 static HRESULT WINAPI
ITextSelection_fnGetTypeInfo(ITextSelection
*me
, UINT iTInfo
, LCID lcid
,
1512 ITypeInfo
**ppTInfo
)
1514 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1516 return CO_E_RELEASED
;
1518 FIXME("not implemented\n");
1522 static HRESULT WINAPI
ITextSelection_fnGetIDsOfNames(ITextSelection
*me
, REFIID riid
,
1523 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
1525 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1527 return CO_E_RELEASED
;
1529 FIXME("not implemented\n");
1533 static HRESULT WINAPI
ITextSelection_fnInvoke(
1535 DISPID dispIdMember
,
1539 DISPPARAMS
*pDispParams
,
1540 VARIANT
*pVarResult
,
1541 EXCEPINFO
*pExcepInfo
,
1544 FIXME("not implemented\n");
1548 /*** ITextRange methods ***/
1549 static HRESULT WINAPI
ITextSelection_fnGetText(ITextSelection
*me
, BSTR
*pbstr
)
1551 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1552 ME_Cursor
*start
= NULL
, *end
= NULL
;
1557 return CO_E_RELEASED
;
1558 TRACE("%p\n", pbstr
);
1560 return E_INVALIDARG
;
1562 ME_GetSelection(This
->reOle
->editor
, &start
, &end
);
1563 endOfs
= ME_GetCursorOfs(end
);
1564 nChars
= endOfs
- ME_GetCursorOfs(start
);
1571 *pbstr
= SysAllocStringLen(NULL
, nChars
);
1573 return E_OUTOFMEMORY
;
1575 bEOP
= (end
->pRun
->next
->type
== diTextEnd
&& endOfs
> ME_GetTextLength(This
->reOle
->editor
));
1576 ME_GetTextW(This
->reOle
->editor
, *pbstr
, nChars
, start
, nChars
, FALSE
, bEOP
);
1577 TRACE("%s\n", wine_dbgstr_w(*pbstr
));
1582 static HRESULT WINAPI
ITextSelection_fnSetText(ITextSelection
*me
, BSTR bstr
)
1584 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1586 return CO_E_RELEASED
;
1588 FIXME("not implemented\n");
1592 static HRESULT WINAPI
ITextSelection_fnGetChar(ITextSelection
*me
, LONG
*pch
)
1594 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1595 ME_Cursor
*start
= NULL
, *end
= NULL
;
1598 return CO_E_RELEASED
;
1601 return E_INVALIDARG
;
1603 ME_GetSelection(This
->reOle
->editor
, &start
, &end
);
1604 return range_GetChar(This
->reOle
->editor
, start
, pch
);
1607 static HRESULT WINAPI
ITextSelection_fnSetChar(ITextSelection
*me
, LONG ch
)
1609 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1611 return CO_E_RELEASED
;
1613 FIXME("not implemented\n");
1617 static HRESULT WINAPI
ITextSelection_fnGetDuplicate(ITextSelection
*me
, ITextRange
**ppRange
)
1619 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1621 return CO_E_RELEASED
;
1623 FIXME("not implemented\n");
1627 static HRESULT WINAPI
ITextSelection_fnGetFormattedText(ITextSelection
*me
, ITextRange
**ppRange
)
1629 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1631 return CO_E_RELEASED
;
1633 FIXME("not implemented\n");
1637 static HRESULT WINAPI
ITextSelection_fnSetFormattedText(ITextSelection
*me
, ITextRange
*pRange
)
1639 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1641 return CO_E_RELEASED
;
1643 FIXME("not implemented\n");
1647 static HRESULT WINAPI
ITextSelection_fnGetStart(ITextSelection
*me
, LONG
*pcpFirst
)
1649 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1652 return CO_E_RELEASED
;
1655 return E_INVALIDARG
;
1656 ME_GetSelectionOfs(This
->reOle
->editor
, pcpFirst
, &lim
);
1657 TRACE("%d\n", *pcpFirst
);
1661 static HRESULT WINAPI
ITextSelection_fnSetStart(ITextSelection
*me
, LONG cpFirst
)
1663 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1665 return CO_E_RELEASED
;
1667 FIXME("not implemented\n");
1671 static HRESULT WINAPI
ITextSelection_fnGetEnd(ITextSelection
*me
, LONG
*pcpLim
)
1673 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1676 return CO_E_RELEASED
;
1679 return E_INVALIDARG
;
1680 ME_GetSelectionOfs(This
->reOle
->editor
, &first
, pcpLim
);
1681 TRACE("%d\n", *pcpLim
);
1685 static HRESULT WINAPI
ITextSelection_fnSetEnd(ITextSelection
*me
, LONG cpLim
)
1687 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1689 return CO_E_RELEASED
;
1691 FIXME("not implemented\n");
1695 static HRESULT WINAPI
ITextSelection_fnGetFont(ITextSelection
*me
, ITextFont
**pFont
)
1697 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1699 return CO_E_RELEASED
;
1701 FIXME("not implemented\n");
1705 static HRESULT WINAPI
ITextSelection_fnSetFont(ITextSelection
*me
, ITextFont
*pFont
)
1707 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1709 return CO_E_RELEASED
;
1711 FIXME("not implemented\n");
1715 static HRESULT WINAPI
ITextSelection_fnGetPara(ITextSelection
*me
, ITextPara
**ppPara
)
1717 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1719 return CO_E_RELEASED
;
1721 FIXME("not implemented\n");
1725 static HRESULT WINAPI
ITextSelection_fnSetPara(ITextSelection
*me
, ITextPara
*pPara
)
1727 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1729 return CO_E_RELEASED
;
1731 FIXME("not implemented\n");
1735 static HRESULT WINAPI
ITextSelection_fnGetStoryLength(ITextSelection
*me
, LONG
*pcch
)
1737 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1739 return CO_E_RELEASED
;
1741 FIXME("not implemented\n");
1745 static HRESULT WINAPI
ITextSelection_fnGetStoryType(ITextSelection
*me
, LONG
*pValue
)
1747 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1749 return CO_E_RELEASED
;
1751 FIXME("not implemented\n");
1755 static HRESULT WINAPI
ITextSelection_fnCollapse(ITextSelection
*me
, LONG bStart
)
1757 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1761 return CO_E_RELEASED
;
1763 ME_GetSelectionOfs(This
->reOle
->editor
, &start
, &end
);
1764 hres
= range_Collapse(bStart
, &start
, &end
);
1765 if (SUCCEEDED(hres
))
1766 ME_SetSelection(This
->reOle
->editor
, start
, end
);
1770 static HRESULT WINAPI
ITextSelection_fnExpand(ITextSelection
*me
, LONG Unit
, LONG
*pDelta
)
1772 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1774 return CO_E_RELEASED
;
1776 FIXME("not implemented\n");
1780 static HRESULT WINAPI
ITextSelection_fnGetIndex(ITextSelection
*me
, LONG Unit
, LONG
*pIndex
)
1782 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1784 return CO_E_RELEASED
;
1786 FIXME("not implemented\n");
1790 static HRESULT WINAPI
ITextSelection_fnSetIndex(ITextSelection
*me
, LONG Unit
, LONG Index
,
1793 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1795 return CO_E_RELEASED
;
1797 FIXME("not implemented\n");
1801 static HRESULT WINAPI
ITextSelection_fnSetRange(ITextSelection
*me
, LONG cpActive
, LONG cpOther
)
1803 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1805 return CO_E_RELEASED
;
1807 FIXME("not implemented\n");
1811 static HRESULT WINAPI
ITextSelection_fnInRange(ITextSelection
*me
, ITextRange
*pRange
, LONG
*pb
)
1813 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1815 return CO_E_RELEASED
;
1817 FIXME("not implemented\n");
1821 static HRESULT WINAPI
ITextSelection_fnInStory(ITextSelection
*me
, ITextRange
*pRange
, LONG
*pb
)
1823 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1825 return CO_E_RELEASED
;
1827 FIXME("not implemented\n");
1831 static HRESULT WINAPI
ITextSelection_fnIsEqual(ITextSelection
*me
, ITextRange
*pRange
, LONG
*pb
)
1833 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1835 return CO_E_RELEASED
;
1837 FIXME("not implemented\n");
1841 static HRESULT WINAPI
ITextSelection_fnSelect(ITextSelection
*me
)
1843 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1845 return CO_E_RELEASED
;
1847 FIXME("not implemented\n");
1851 static HRESULT WINAPI
ITextSelection_fnStartOf(ITextSelection
*me
, LONG Unit
, LONG Extend
,
1854 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1856 return CO_E_RELEASED
;
1858 FIXME("not implemented\n");
1862 static HRESULT WINAPI
ITextSelection_fnEndOf(ITextSelection
*me
, LONG Unit
, LONG Extend
,
1865 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1867 return CO_E_RELEASED
;
1869 FIXME("not implemented\n");
1873 static HRESULT WINAPI
ITextSelection_fnMove(ITextSelection
*me
, LONG Unit
, LONG Count
, LONG
*pDelta
)
1875 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1877 return CO_E_RELEASED
;
1879 FIXME("not implemented\n");
1883 static HRESULT WINAPI
ITextSelection_fnMoveStart(ITextSelection
*me
, LONG Unit
, LONG Count
,
1886 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1888 return CO_E_RELEASED
;
1890 FIXME("not implemented\n");
1894 static HRESULT WINAPI
ITextSelection_fnMoveEnd(ITextSelection
*me
, LONG Unit
, LONG Count
,
1897 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1899 return CO_E_RELEASED
;
1901 FIXME("not implemented\n");
1905 static HRESULT WINAPI
ITextSelection_fnMoveWhile(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1908 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1910 return CO_E_RELEASED
;
1912 FIXME("not implemented\n");
1916 static HRESULT WINAPI
ITextSelection_fnMoveStartWhile(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1919 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1921 return CO_E_RELEASED
;
1923 FIXME("not implemented\n");
1927 static HRESULT WINAPI
ITextSelection_fnMoveEndWhile(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1930 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1932 return CO_E_RELEASED
;
1934 FIXME("not implemented\n");
1938 static HRESULT WINAPI
ITextSelection_fnMoveUntil(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1941 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1943 return CO_E_RELEASED
;
1945 FIXME("not implemented\n");
1949 static HRESULT WINAPI
ITextSelection_fnMoveStartUntil(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1952 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1954 return CO_E_RELEASED
;
1956 FIXME("not implemented\n");
1960 static HRESULT WINAPI
ITextSelection_fnMoveEndUntil(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1963 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1965 return CO_E_RELEASED
;
1967 FIXME("not implemented\n");
1971 static HRESULT WINAPI
ITextSelection_fnFindText(ITextSelection
*me
, BSTR bstr
, LONG cch
, LONG Flags
,
1974 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1976 return CO_E_RELEASED
;
1978 FIXME("not implemented\n");
1982 static HRESULT WINAPI
ITextSelection_fnFindTextStart(ITextSelection
*me
, BSTR bstr
, LONG cch
,
1983 LONG Flags
, LONG
*pLength
)
1985 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1987 return CO_E_RELEASED
;
1989 FIXME("not implemented\n");
1993 static HRESULT WINAPI
ITextSelection_fnFindTextEnd(ITextSelection
*me
, BSTR bstr
, LONG cch
,
1994 LONG Flags
, LONG
*pLength
)
1996 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1998 return CO_E_RELEASED
;
2000 FIXME("not implemented\n");
2004 static HRESULT WINAPI
ITextSelection_fnDelete(ITextSelection
*me
, LONG Unit
, LONG Count
,
2007 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2009 return CO_E_RELEASED
;
2011 FIXME("not implemented\n");
2015 static HRESULT WINAPI
ITextSelection_fnCut(ITextSelection
*me
, VARIANT
*pVar
)
2017 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2019 return CO_E_RELEASED
;
2021 FIXME("not implemented\n");
2025 static HRESULT WINAPI
ITextSelection_fnCopy(ITextSelection
*me
, VARIANT
*pVar
)
2027 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2029 return CO_E_RELEASED
;
2031 FIXME("not implemented\n");
2035 static HRESULT WINAPI
ITextSelection_fnPaste(ITextSelection
*me
, VARIANT
*pVar
, LONG Format
)
2037 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2039 return CO_E_RELEASED
;
2041 FIXME("not implemented\n");
2045 static HRESULT WINAPI
ITextSelection_fnCanPaste(ITextSelection
*me
, VARIANT
*pVar
, LONG Format
,
2048 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2050 return CO_E_RELEASED
;
2052 FIXME("not implemented\n");
2056 static HRESULT WINAPI
ITextSelection_fnCanEdit(ITextSelection
*me
, LONG
*pb
)
2058 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2060 return CO_E_RELEASED
;
2062 FIXME("not implemented\n");
2066 static HRESULT WINAPI
ITextSelection_fnChangeCase(ITextSelection
*me
, LONG Type
)
2068 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2070 return CO_E_RELEASED
;
2072 FIXME("not implemented\n");
2076 static HRESULT WINAPI
ITextSelection_fnGetPoint(ITextSelection
*me
, LONG Type
, LONG
*cx
, LONG
*cy
)
2078 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2080 return CO_E_RELEASED
;
2082 FIXME("not implemented\n");
2086 static HRESULT WINAPI
ITextSelection_fnSetPoint(ITextSelection
*me
, LONG x
, LONG y
, LONG Type
,
2089 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2091 return CO_E_RELEASED
;
2093 FIXME("not implemented\n");
2097 static HRESULT WINAPI
ITextSelection_fnScrollIntoView(ITextSelection
*me
, LONG Value
)
2099 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2101 return CO_E_RELEASED
;
2103 FIXME("not implemented\n");
2107 static HRESULT WINAPI
ITextSelection_fnGetEmbeddedObject(ITextSelection
*me
, IUnknown
**ppv
)
2109 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2111 return CO_E_RELEASED
;
2113 FIXME("not implemented\n");
2117 /*** ITextSelection methods ***/
2118 static HRESULT WINAPI
ITextSelection_fnGetFlags(ITextSelection
*me
, LONG
*pFlags
)
2120 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2122 return CO_E_RELEASED
;
2124 FIXME("not implemented\n");
2128 static HRESULT WINAPI
ITextSelection_fnSetFlags(ITextSelection
*me
, LONG Flags
)
2130 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2132 return CO_E_RELEASED
;
2134 FIXME("not implemented\n");
2138 static HRESULT WINAPI
ITextSelection_fnGetType(ITextSelection
*me
, LONG
*pType
)
2140 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2142 return CO_E_RELEASED
;
2144 FIXME("not implemented\n");
2148 static HRESULT WINAPI
ITextSelection_fnMoveLeft(ITextSelection
*me
, LONG Unit
, LONG Count
,
2149 LONG Extend
, LONG
*pDelta
)
2151 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2153 return CO_E_RELEASED
;
2155 FIXME("not implemented\n");
2159 static HRESULT WINAPI
ITextSelection_fnMoveRight(ITextSelection
*me
, LONG Unit
, LONG Count
,
2160 LONG Extend
, LONG
*pDelta
)
2162 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2164 return CO_E_RELEASED
;
2166 FIXME("not implemented\n");
2170 static HRESULT WINAPI
ITextSelection_fnMoveUp(ITextSelection
*me
, LONG Unit
, LONG Count
,
2171 LONG Extend
, LONG
*pDelta
)
2173 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2175 return CO_E_RELEASED
;
2177 FIXME("not implemented\n");
2181 static HRESULT WINAPI
ITextSelection_fnMoveDown(ITextSelection
*me
, LONG Unit
, LONG Count
,
2182 LONG Extend
, LONG
*pDelta
)
2184 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2186 return CO_E_RELEASED
;
2188 FIXME("not implemented\n");
2192 static HRESULT WINAPI
ITextSelection_fnHomeKey(ITextSelection
*me
, LONG Unit
, LONG Extend
,
2195 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2197 return CO_E_RELEASED
;
2199 FIXME("not implemented\n");
2203 static HRESULT WINAPI
ITextSelection_fnEndKey(ITextSelection
*me
, LONG Unit
, LONG Extend
,
2206 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2208 return CO_E_RELEASED
;
2210 FIXME("not implemented\n");
2214 static HRESULT WINAPI
ITextSelection_fnTypeText(ITextSelection
*me
, BSTR bstr
)
2216 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2218 return CO_E_RELEASED
;
2220 FIXME("not implemented\n");
2224 static const ITextSelectionVtbl tsvt
= {
2225 ITextSelection_fnQueryInterface
,
2226 ITextSelection_fnAddRef
,
2227 ITextSelection_fnRelease
,
2228 ITextSelection_fnGetTypeInfoCount
,
2229 ITextSelection_fnGetTypeInfo
,
2230 ITextSelection_fnGetIDsOfNames
,
2231 ITextSelection_fnInvoke
,
2232 ITextSelection_fnGetText
,
2233 ITextSelection_fnSetText
,
2234 ITextSelection_fnGetChar
,
2235 ITextSelection_fnSetChar
,
2236 ITextSelection_fnGetDuplicate
,
2237 ITextSelection_fnGetFormattedText
,
2238 ITextSelection_fnSetFormattedText
,
2239 ITextSelection_fnGetStart
,
2240 ITextSelection_fnSetStart
,
2241 ITextSelection_fnGetEnd
,
2242 ITextSelection_fnSetEnd
,
2243 ITextSelection_fnGetFont
,
2244 ITextSelection_fnSetFont
,
2245 ITextSelection_fnGetPara
,
2246 ITextSelection_fnSetPara
,
2247 ITextSelection_fnGetStoryLength
,
2248 ITextSelection_fnGetStoryType
,
2249 ITextSelection_fnCollapse
,
2250 ITextSelection_fnExpand
,
2251 ITextSelection_fnGetIndex
,
2252 ITextSelection_fnSetIndex
,
2253 ITextSelection_fnSetRange
,
2254 ITextSelection_fnInRange
,
2255 ITextSelection_fnInStory
,
2256 ITextSelection_fnIsEqual
,
2257 ITextSelection_fnSelect
,
2258 ITextSelection_fnStartOf
,
2259 ITextSelection_fnEndOf
,
2260 ITextSelection_fnMove
,
2261 ITextSelection_fnMoveStart
,
2262 ITextSelection_fnMoveEnd
,
2263 ITextSelection_fnMoveWhile
,
2264 ITextSelection_fnMoveStartWhile
,
2265 ITextSelection_fnMoveEndWhile
,
2266 ITextSelection_fnMoveUntil
,
2267 ITextSelection_fnMoveStartUntil
,
2268 ITextSelection_fnMoveEndUntil
,
2269 ITextSelection_fnFindText
,
2270 ITextSelection_fnFindTextStart
,
2271 ITextSelection_fnFindTextEnd
,
2272 ITextSelection_fnDelete
,
2273 ITextSelection_fnCut
,
2274 ITextSelection_fnCopy
,
2275 ITextSelection_fnPaste
,
2276 ITextSelection_fnCanPaste
,
2277 ITextSelection_fnCanEdit
,
2278 ITextSelection_fnChangeCase
,
2279 ITextSelection_fnGetPoint
,
2280 ITextSelection_fnSetPoint
,
2281 ITextSelection_fnScrollIntoView
,
2282 ITextSelection_fnGetEmbeddedObject
,
2283 ITextSelection_fnGetFlags
,
2284 ITextSelection_fnSetFlags
,
2285 ITextSelection_fnGetType
,
2286 ITextSelection_fnMoveLeft
,
2287 ITextSelection_fnMoveRight
,
2288 ITextSelection_fnMoveUp
,
2289 ITextSelection_fnMoveDown
,
2290 ITextSelection_fnHomeKey
,
2291 ITextSelection_fnEndKey
,
2292 ITextSelection_fnTypeText
2295 static ITextSelectionImpl
*
2296 CreateTextSelection(IRichEditOleImpl
*reOle
)
2298 ITextSelectionImpl
*txtSel
= heap_alloc(sizeof *txtSel
);
2302 txtSel
->ITextSelection_iface
.lpVtbl
= &tsvt
;
2304 txtSel
->reOle
= reOle
;
2308 LRESULT
CreateIRichEditOle(ME_TextEditor
*editor
, LPVOID
*ppObj
)
2310 IRichEditOleImpl
*reo
;
2312 reo
= heap_alloc(sizeof(IRichEditOleImpl
));
2316 reo
->IRichEditOle_iface
.lpVtbl
= &revt
;
2317 reo
->ITextDocument_iface
.lpVtbl
= &tdvt
;
2319 reo
->editor
= editor
;
2320 reo
->txtSel
= CreateTextSelection(reo
);
2326 reo
->clientSite
= CreateOleClientSite(reo
);
2327 if (!reo
->clientSite
)
2329 ITextSelection_Release(&reo
->txtSel
->ITextSelection_iface
);
2333 TRACE("Created %p\n",reo
);
2335 list_init(&reo
->rangelist
);
2340 static void convert_sizel(const ME_Context
*c
, const SIZEL
* szl
, SIZE
* sz
)
2342 /* sizel is in .01 millimeters, sz in pixels */
2343 sz
->cx
= MulDiv(szl
->cx
, c
->dpi
.cx
, 2540);
2344 sz
->cy
= MulDiv(szl
->cy
, c
->dpi
.cy
, 2540);
2347 /******************************************************************************
2348 * ME_GetOLEObjectSize
2350 * Sets run extent for OLE objects.
2352 void ME_GetOLEObjectSize(const ME_Context
*c
, ME_Run
*run
, SIZE
*pSize
)
2360 assert(run
->nFlags
& MERF_GRAPHICS
);
2361 assert(run
->ole_obj
);
2363 if (run
->ole_obj
->sizel
.cx
!= 0 || run
->ole_obj
->sizel
.cy
!= 0)
2365 convert_sizel(c
, &run
->ole_obj
->sizel
, pSize
);
2366 if (c
->editor
->nZoomNumerator
!= 0)
2368 pSize
->cx
= MulDiv(pSize
->cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2369 pSize
->cy
= MulDiv(pSize
->cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2374 if (IOleObject_QueryInterface(run
->ole_obj
->poleobj
, &IID_IDataObject
, (void**)&ido
) != S_OK
)
2376 FIXME("Query Interface IID_IDataObject failed!\n");
2377 pSize
->cx
= pSize
->cy
= 0;
2380 fmt
.cfFormat
= CF_BITMAP
;
2382 fmt
.dwAspect
= DVASPECT_CONTENT
;
2384 fmt
.tymed
= TYMED_GDI
;
2385 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
2387 fmt
.cfFormat
= CF_ENHMETAFILE
;
2388 fmt
.tymed
= TYMED_ENHMF
;
2389 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
2391 FIXME("unsupported format\n");
2392 pSize
->cx
= pSize
->cy
= 0;
2393 IDataObject_Release(ido
);
2401 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
2402 pSize
->cx
= dibsect
.dsBm
.bmWidth
;
2403 pSize
->cy
= dibsect
.dsBm
.bmHeight
;
2404 if (!stgm
.pUnkForRelease
) DeleteObject(stgm
.u
.hBitmap
);
2407 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
2408 pSize
->cx
= emh
.rclBounds
.right
- emh
.rclBounds
.left
;
2409 pSize
->cy
= emh
.rclBounds
.bottom
- emh
.rclBounds
.top
;
2410 if (!stgm
.pUnkForRelease
) DeleteEnhMetaFile(stgm
.u
.hEnhMetaFile
);
2413 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
2416 IDataObject_Release(ido
);
2417 if (c
->editor
->nZoomNumerator
!= 0)
2419 pSize
->cx
= MulDiv(pSize
->cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2420 pSize
->cy
= MulDiv(pSize
->cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2424 void ME_DrawOLE(ME_Context
*c
, int x
, int y
, ME_Run
*run
,
2425 ME_Paragraph
*para
, BOOL selected
)
2436 assert(run
->nFlags
& MERF_GRAPHICS
);
2437 assert(run
->ole_obj
);
2438 if (IOleObject_QueryInterface(run
->ole_obj
->poleobj
, &IID_IDataObject
, (void**)&ido
) != S_OK
)
2440 FIXME("Couldn't get interface\n");
2443 has_size
= run
->ole_obj
->sizel
.cx
!= 0 || run
->ole_obj
->sizel
.cy
!= 0;
2444 fmt
.cfFormat
= CF_BITMAP
;
2446 fmt
.dwAspect
= DVASPECT_CONTENT
;
2448 fmt
.tymed
= TYMED_GDI
;
2449 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
2451 fmt
.cfFormat
= CF_ENHMETAFILE
;
2452 fmt
.tymed
= TYMED_ENHMF
;
2453 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
2455 FIXME("Couldn't get storage medium\n");
2456 IDataObject_Release(ido
);
2463 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
2464 hMemDC
= CreateCompatibleDC(c
->hDC
);
2465 SelectObject(hMemDC
, stgm
.u
.hBitmap
);
2468 convert_sizel(c
, &run
->ole_obj
->sizel
, &sz
);
2470 sz
.cx
= MulDiv(dibsect
.dsBm
.bmWidth
, c
->dpi
.cx
, 96);
2471 sz
.cy
= MulDiv(dibsect
.dsBm
.bmHeight
, c
->dpi
.cy
, 96);
2473 if (c
->editor
->nZoomNumerator
!= 0)
2475 sz
.cx
= MulDiv(sz
.cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2476 sz
.cy
= MulDiv(sz
.cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2478 if (sz
.cx
== dibsect
.dsBm
.bmWidth
&& sz
.cy
== dibsect
.dsBm
.bmHeight
)
2480 BitBlt(c
->hDC
, x
, y
- sz
.cy
,
2481 dibsect
.dsBm
.bmWidth
, dibsect
.dsBm
.bmHeight
,
2482 hMemDC
, 0, 0, SRCCOPY
);
2484 StretchBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
,
2485 hMemDC
, 0, 0, dibsect
.dsBm
.bmWidth
,
2486 dibsect
.dsBm
.bmHeight
, SRCCOPY
);
2489 if (!stgm
.pUnkForRelease
) DeleteObject(stgm
.u
.hBitmap
);
2492 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
2495 convert_sizel(c
, &run
->ole_obj
->sizel
, &sz
);
2497 sz
.cy
= MulDiv(emh
.rclBounds
.bottom
- emh
.rclBounds
.top
, c
->dpi
.cx
, 96);
2498 sz
.cx
= MulDiv(emh
.rclBounds
.right
- emh
.rclBounds
.left
, c
->dpi
.cy
, 96);
2500 if (c
->editor
->nZoomNumerator
!= 0)
2502 sz
.cx
= MulDiv(sz
.cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2503 sz
.cy
= MulDiv(sz
.cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2511 rc
.right
= x
+ sz
.cx
;
2513 PlayEnhMetaFile(c
->hDC
, stgm
.u
.hEnhMetaFile
, &rc
);
2515 if (!stgm
.pUnkForRelease
) DeleteEnhMetaFile(stgm
.u
.hEnhMetaFile
);
2518 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
2522 if (selected
&& !c
->editor
->bHideSelection
)
2523 PatBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
, DSTINVERT
);
2524 IDataObject_Release(ido
);
2527 void ME_DeleteReObject(REOBJECT
* reo
)
2529 if (reo
->poleobj
) IOleObject_Release(reo
->poleobj
);
2530 if (reo
->pstg
) IStorage_Release(reo
->pstg
);
2531 if (reo
->polesite
) IOleClientSite_Release(reo
->polesite
);
2535 void ME_CopyReObject(REOBJECT
* dst
, const REOBJECT
* src
)
2539 if (dst
->poleobj
) IOleObject_AddRef(dst
->poleobj
);
2540 if (dst
->pstg
) IStorage_AddRef(dst
->pstg
);
2541 if (dst
->polesite
) IOleClientSite_AddRef(dst
->polesite
);