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
35 #include "wine/debug.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(richedit
);
39 /* there is no way to be consistent across different sets of headers - mingw, Wine, Win32 SDK*/
42 DEFINE_GUID(IID_ITextServices
, 0x8d33f740, 0xcf58, 0x11ce, 0xa8, 0x9d, 0x00, 0xaa, 0x00, 0x6c, 0xad, 0xc5);
43 DEFINE_GUID(IID_ITextHost
, 0x13e670f4,0x1a5a,0x11cf,0xab,0xeb,0x00,0xaa,0x00,0xb6,0x5e,0xa1);
44 DEFINE_GUID(IID_ITextHost2
, 0x13e670f5,0x1a5a,0x11cf,0xab,0xeb,0x00,0xaa,0x00,0xb6,0x5e,0xa1);
45 DEFINE_GUID(IID_ITextDocument
, 0x8cc497c0, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
46 DEFINE_GUID(IID_ITextRange
, 0x8cc497c2, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
47 DEFINE_GUID(IID_ITextSelection
, 0x8cc497c1, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
49 typedef struct ITextSelectionImpl ITextSelectionImpl
;
50 typedef struct IOleClientSiteImpl IOleClientSiteImpl
;
51 typedef struct ITextRangeImpl ITextRangeImpl
;
53 typedef struct IRichEditOleImpl
{
54 IUnknown IUnknown_inner
;
55 IRichEditOle IRichEditOle_iface
;
56 ITextDocument ITextDocument_iface
;
60 ME_TextEditor
*editor
;
61 ITextSelectionImpl
*txtSel
;
62 IOleClientSiteImpl
*clientSite
;
63 struct list rangelist
;
66 struct ITextRangeImpl
{
67 ITextRange ITextRange_iface
;
72 IRichEditOleImpl
*reOle
;
75 struct ITextSelectionImpl
{
76 ITextSelection ITextSelection_iface
;
79 IRichEditOleImpl
*reOle
;
82 struct IOleClientSiteImpl
{
83 IOleClientSite IOleClientSite_iface
;
84 IOleWindow IOleWindow_iface
;
85 IOleInPlaceSite IOleInPlaceSite_iface
;
88 IRichEditOleImpl
*reOle
;
91 static inline IRichEditOleImpl
*impl_from_IRichEditOle(IRichEditOle
*iface
)
93 return CONTAINING_RECORD(iface
, IRichEditOleImpl
, IRichEditOle_iface
);
96 static inline IRichEditOleImpl
*impl_from_ITextDocument(ITextDocument
*iface
)
98 return CONTAINING_RECORD(iface
, IRichEditOleImpl
, ITextDocument_iface
);
101 static inline IRichEditOleImpl
*impl_from_IUnknown(IUnknown
*iface
)
103 return CONTAINING_RECORD(iface
, IRichEditOleImpl
, IUnknown_inner
);
106 static HRESULT WINAPI
IRichEditOleImpl_inner_fnQueryInterface(IUnknown
*iface
, REFIID riid
, LPVOID
*ppvObj
)
108 IRichEditOleImpl
*This
= impl_from_IUnknown(iface
);
110 TRACE("%p %s\n", This
, debugstr_guid(riid
));
113 if (IsEqualGUID(riid
, &IID_IUnknown
))
114 *ppvObj
= &This
->IUnknown_inner
;
115 else if (IsEqualGUID(riid
, &IID_IRichEditOle
))
116 *ppvObj
= &This
->IRichEditOle_iface
;
117 else if (IsEqualGUID(riid
, &IID_ITextDocument
))
118 *ppvObj
= &This
->ITextDocument_iface
;
121 IUnknown_AddRef((IUnknown
*)*ppvObj
);
124 FIXME("%p: unhandled interface %s\n", This
, debugstr_guid(riid
));
126 return E_NOINTERFACE
;
129 static ULONG WINAPI
IRichEditOleImpl_inner_fnAddRef(IUnknown
*iface
)
131 IRichEditOleImpl
*This
= impl_from_IUnknown(iface
);
132 ULONG ref
= InterlockedIncrement(&This
->ref
);
134 TRACE("%p ref = %u\n", This
, ref
);
139 static ULONG WINAPI
IRichEditOleImpl_inner_fnRelease(IUnknown
*iface
)
141 IRichEditOleImpl
*This
= impl_from_IUnknown(iface
);
142 ULONG ref
= InterlockedDecrement(&This
->ref
);
144 TRACE ("%p ref=%u\n", This
, ref
);
148 ITextRangeImpl
*txtRge
;
150 TRACE("Destroying %p\n", This
);
151 This
->txtSel
->reOle
= NULL
;
152 This
->editor
->reOle
= NULL
;
153 ITextSelection_Release(&This
->txtSel
->ITextSelection_iface
);
154 IOleClientSite_Release(&This
->clientSite
->IOleClientSite_iface
);
155 LIST_FOR_EACH_ENTRY(txtRge
, &This
->rangelist
, ITextRangeImpl
, entry
)
156 txtRge
->reOle
= NULL
;
162 static const IUnknownVtbl reo_unk_vtbl
=
164 IRichEditOleImpl_inner_fnQueryInterface
,
165 IRichEditOleImpl_inner_fnAddRef
,
166 IRichEditOleImpl_inner_fnRelease
169 static HRESULT WINAPI
170 IRichEditOle_fnQueryInterface(IRichEditOle
*me
, REFIID riid
, LPVOID
*ppvObj
)
172 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
173 return IUnknown_QueryInterface(This
->outer_unk
, riid
, ppvObj
);
177 IRichEditOle_fnAddRef(IRichEditOle
*me
)
179 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
180 return IUnknown_AddRef(This
->outer_unk
);
184 IRichEditOle_fnRelease(IRichEditOle
*me
)
186 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
187 return IUnknown_Release(This
->outer_unk
);
190 static HRESULT WINAPI
191 IRichEditOle_fnActivateAs(IRichEditOle
*me
, REFCLSID rclsid
, REFCLSID rclsidAs
)
193 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
194 FIXME("stub %p\n",This
);
198 static HRESULT WINAPI
199 IRichEditOle_fnContextSensitiveHelp(IRichEditOle
*me
, BOOL fEnterMode
)
201 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
202 FIXME("stub %p\n",This
);
206 static HRESULT WINAPI
207 IRichEditOle_fnConvertObject(IRichEditOle
*me
, LONG iob
,
208 REFCLSID rclsidNew
, LPCSTR lpstrUserTypeNew
)
210 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
211 FIXME("stub %p\n",This
);
215 static inline IOleClientSiteImpl
*impl_from_IOleClientSite(IOleClientSite
*iface
)
217 return CONTAINING_RECORD(iface
, IOleClientSiteImpl
, IOleClientSite_iface
);
220 static HRESULT WINAPI
221 IOleClientSite_fnQueryInterface(IOleClientSite
*me
, REFIID riid
, LPVOID
*ppvObj
)
223 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(me
);
224 TRACE("%p %s\n", me
, debugstr_guid(riid
) );
227 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
228 IsEqualGUID(riid
, &IID_IOleClientSite
))
230 else if (IsEqualGUID(riid
, &IID_IOleWindow
))
231 *ppvObj
= &This
->IOleWindow_iface
;
232 else if (IsEqualGUID(riid
, &IID_IOleInPlaceSite
))
233 *ppvObj
= &This
->IOleInPlaceSite_iface
;
236 IOleClientSite_AddRef(me
);
239 FIXME("%p: unhandled interface %s\n", me
, debugstr_guid(riid
) );
241 return E_NOINTERFACE
;
244 static ULONG WINAPI
IOleClientSite_fnAddRef(IOleClientSite
*iface
)
246 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
247 return InterlockedIncrement(&This
->ref
);
250 static ULONG WINAPI
IOleClientSite_fnRelease(IOleClientSite
*iface
)
252 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
253 ULONG ref
= InterlockedDecrement(&This
->ref
);
259 static HRESULT WINAPI
IOleClientSite_fnSaveObject(IOleClientSite
*iface
)
261 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
263 return CO_E_RELEASED
;
265 FIXME("stub %p\n", iface
);
270 static HRESULT WINAPI
IOleClientSite_fnGetMoniker(IOleClientSite
*iface
, DWORD dwAssign
,
271 DWORD dwWhichMoniker
, IMoniker
**ppmk
)
273 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
275 return CO_E_RELEASED
;
277 FIXME("stub %p\n", iface
);
281 static HRESULT WINAPI
IOleClientSite_fnGetContainer(IOleClientSite
*iface
,
282 IOleContainer
**ppContainer
)
284 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
286 return CO_E_RELEASED
;
288 FIXME("stub %p\n", iface
);
292 static HRESULT WINAPI
IOleClientSite_fnShowObject(IOleClientSite
*iface
)
294 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
296 return CO_E_RELEASED
;
298 FIXME("stub %p\n", iface
);
302 static HRESULT WINAPI
IOleClientSite_fnOnShowWindow(IOleClientSite
*iface
, BOOL fShow
)
304 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
306 return CO_E_RELEASED
;
308 FIXME("stub %p\n", iface
);
312 static HRESULT WINAPI
IOleClientSite_fnRequestNewObjectLayout(IOleClientSite
*iface
)
314 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
316 return CO_E_RELEASED
;
318 FIXME("stub %p\n", iface
);
322 static const IOleClientSiteVtbl ocst
= {
323 IOleClientSite_fnQueryInterface
,
324 IOleClientSite_fnAddRef
,
325 IOleClientSite_fnRelease
,
326 IOleClientSite_fnSaveObject
,
327 IOleClientSite_fnGetMoniker
,
328 IOleClientSite_fnGetContainer
,
329 IOleClientSite_fnShowObject
,
330 IOleClientSite_fnOnShowWindow
,
331 IOleClientSite_fnRequestNewObjectLayout
334 /* IOleWindow interface */
335 static inline IOleClientSiteImpl
*impl_from_IOleWindow(IOleWindow
*iface
)
337 return CONTAINING_RECORD(iface
, IOleClientSiteImpl
, IOleWindow_iface
);
340 static HRESULT WINAPI
IOleWindow_fnQueryInterface(IOleWindow
*iface
, REFIID riid
, void **ppvObj
)
342 IOleClientSiteImpl
*This
= impl_from_IOleWindow(iface
);
343 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppvObj
);
346 static ULONG WINAPI
IOleWindow_fnAddRef(IOleWindow
*iface
)
348 IOleClientSiteImpl
*This
= impl_from_IOleWindow(iface
);
349 return IOleClientSite_AddRef(&This
->IOleClientSite_iface
);
352 static ULONG WINAPI
IOleWindow_fnRelease(IOleWindow
*iface
)
354 IOleClientSiteImpl
*This
= impl_from_IOleWindow(iface
);
355 return IOleClientSite_Release(&This
->IOleClientSite_iface
);
358 static HRESULT WINAPI
IOleWindow_fnContextSensitiveHelp(IOleWindow
*iface
, BOOL fEnterMode
)
360 IOleClientSiteImpl
*This
= impl_from_IOleWindow(iface
);
361 FIXME("not implemented: (%p)->(%d)\n", This
, fEnterMode
);
365 static HRESULT WINAPI
IOleWindow_fnGetWindow(IOleWindow
*iface
, HWND
*phwnd
)
367 IOleClientSiteImpl
*This
= impl_from_IOleWindow(iface
);
368 TRACE("(%p)->(%p)\n", This
, phwnd
);
373 *phwnd
= This
->reOle
->editor
->hWnd
;
377 static const IOleWindowVtbl olewinvt
= {
378 IOleWindow_fnQueryInterface
,
380 IOleWindow_fnRelease
,
381 IOleWindow_fnGetWindow
,
382 IOleWindow_fnContextSensitiveHelp
385 /* IOleInPlaceSite interface */
386 static inline IOleClientSiteImpl
*impl_from_IOleInPlaceSite(IOleInPlaceSite
*iface
)
388 return CONTAINING_RECORD(iface
, IOleClientSiteImpl
, IOleInPlaceSite_iface
);
391 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnQueryInterface(IOleInPlaceSite
*iface
, REFIID riid
, void **ppvObj
)
393 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
394 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppvObj
);
397 static ULONG STDMETHODCALLTYPE
IOleInPlaceSite_fnAddRef(IOleInPlaceSite
*iface
)
399 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
400 return IOleClientSite_AddRef(&This
->IOleClientSite_iface
);
403 static ULONG STDMETHODCALLTYPE
IOleInPlaceSite_fnRelease(IOleInPlaceSite
*iface
)
405 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
406 return IOleClientSite_Release(&This
->IOleClientSite_iface
);
409 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnGetWindow(IOleInPlaceSite
*iface
, HWND
*phwnd
)
411 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
412 return IOleWindow_GetWindow(&This
->IOleWindow_iface
, phwnd
);
415 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnContextSensitiveHelp(IOleInPlaceSite
*iface
, BOOL fEnterMode
)
417 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
418 return IOleWindow_ContextSensitiveHelp(&This
->IOleWindow_iface
, fEnterMode
);
421 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnCanInPlaceActivate(IOleInPlaceSite
*iface
)
423 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
424 FIXME("not implemented: (%p)\n", This
);
428 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnOnInPlaceActivate(IOleInPlaceSite
*iface
)
430 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
431 FIXME("not implemented: (%p)\n", This
);
435 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnOnUIActivate(IOleInPlaceSite
*iface
)
437 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
438 FIXME("not implemented: (%p)\n", This
);
442 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnGetWindowContext(IOleInPlaceSite
*iface
, IOleInPlaceFrame
**ppFrame
,
443 IOleInPlaceUIWindow
**ppDoc
, LPRECT lprcPosRect
,
444 LPRECT lprcClipRect
, LPOLEINPLACEFRAMEINFO lpFrameInfo
)
446 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
447 FIXME("not implemented: (%p)->(%p %p %p %p %p)\n", This
, ppFrame
, ppDoc
, lprcPosRect
, lprcClipRect
, lpFrameInfo
);
451 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnScroll(IOleInPlaceSite
*iface
, SIZE scrollExtent
)
453 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
454 FIXME("not implemented: (%p)\n", This
);
458 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnOnUIDeactivate(IOleInPlaceSite
*iface
, BOOL fUndoable
)
460 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
461 FIXME("not implemented: (%p)->(%d)\n", This
, fUndoable
);
465 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnOnInPlaceDeactivate(IOleInPlaceSite
*iface
)
467 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
468 FIXME("not implemented: (%p)\n", This
);
472 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnDiscardUndoState(IOleInPlaceSite
*iface
)
474 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
475 FIXME("not implemented: (%p)\n", This
);
479 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnDeactivateAndUndo(IOleInPlaceSite
*iface
)
481 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
482 FIXME("not implemented: (%p)\n", This
);
486 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnOnPosRectChange(IOleInPlaceSite
*iface
, LPCRECT lprcPosRect
)
488 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
489 FIXME("not implemented: (%p)->(%p)\n", This
, lprcPosRect
);
493 static const IOleInPlaceSiteVtbl olestvt
=
495 IOleInPlaceSite_fnQueryInterface
,
496 IOleInPlaceSite_fnAddRef
,
497 IOleInPlaceSite_fnRelease
,
498 IOleInPlaceSite_fnGetWindow
,
499 IOleInPlaceSite_fnContextSensitiveHelp
,
500 IOleInPlaceSite_fnCanInPlaceActivate
,
501 IOleInPlaceSite_fnOnInPlaceActivate
,
502 IOleInPlaceSite_fnOnUIActivate
,
503 IOleInPlaceSite_fnGetWindowContext
,
504 IOleInPlaceSite_fnScroll
,
505 IOleInPlaceSite_fnOnUIDeactivate
,
506 IOleInPlaceSite_fnOnInPlaceDeactivate
,
507 IOleInPlaceSite_fnDiscardUndoState
,
508 IOleInPlaceSite_fnDeactivateAndUndo
,
509 IOleInPlaceSite_fnOnPosRectChange
512 static IOleClientSiteImpl
*
513 CreateOleClientSite(IRichEditOleImpl
*reOle
)
515 IOleClientSiteImpl
*clientSite
= heap_alloc(sizeof *clientSite
);
519 clientSite
->IOleClientSite_iface
.lpVtbl
= &ocst
;
520 clientSite
->IOleWindow_iface
.lpVtbl
= &olewinvt
;
521 clientSite
->IOleInPlaceSite_iface
.lpVtbl
= &olestvt
;
523 clientSite
->reOle
= reOle
;
527 static HRESULT WINAPI
528 IRichEditOle_fnGetClientSite(IRichEditOle
*me
,
529 LPOLECLIENTSITE
*lplpolesite
)
531 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
533 TRACE("%p,%p\n",This
, lplpolesite
);
537 *lplpolesite
= &This
->clientSite
->IOleClientSite_iface
;
538 IOleClientSite_AddRef(*lplpolesite
);
542 static HRESULT WINAPI
543 IRichEditOle_fnGetClipboardData(IRichEditOle
*me
, CHARRANGE
*lpchrg
,
544 DWORD reco
, LPDATAOBJECT
*lplpdataobj
)
546 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
550 TRACE("(%p,%p,%d)\n",This
, lpchrg
, reco
);
554 int nFrom
, nTo
, nStartCur
= ME_GetSelectionOfs(This
->editor
, &nFrom
, &nTo
);
555 start
= This
->editor
->pCursors
[nStartCur
];
556 nChars
= nTo
- nFrom
;
558 ME_CursorFromCharOfs(This
->editor
, lpchrg
->cpMin
, &start
);
559 nChars
= lpchrg
->cpMax
- lpchrg
->cpMin
;
561 return ME_GetDataObject(This
->editor
, &start
, nChars
, lplpdataobj
);
564 static LONG WINAPI
IRichEditOle_fnGetLinkCount(IRichEditOle
*me
)
566 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
567 FIXME("stub %p\n",This
);
571 static HRESULT WINAPI
572 IRichEditOle_fnGetObject(IRichEditOle
*me
, LONG iob
,
573 REOBJECT
*lpreobject
, DWORD dwFlags
)
575 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
576 FIXME("stub %p\n",This
);
581 IRichEditOle_fnGetObjectCount(IRichEditOle
*me
)
583 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
584 FIXME("stub %p\n",This
);
588 static HRESULT WINAPI
589 IRichEditOle_fnHandsOffStorage(IRichEditOle
*me
, LONG iob
)
591 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
592 FIXME("stub %p\n",This
);
596 static HRESULT WINAPI
597 IRichEditOle_fnImportDataObject(IRichEditOle
*me
, LPDATAOBJECT lpdataobj
,
598 CLIPFORMAT cf
, HGLOBAL hMetaPict
)
600 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
601 FIXME("stub %p\n",This
);
605 static HRESULT WINAPI
606 IRichEditOle_fnInPlaceDeactivate(IRichEditOle
*me
)
608 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
609 FIXME("stub %p\n",This
);
613 static HRESULT WINAPI
614 IRichEditOle_fnInsertObject(IRichEditOle
*me
, REOBJECT
*reo
)
616 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
617 TRACE("(%p,%p)\n", This
, reo
);
619 if (reo
->cbStruct
< sizeof(*reo
)) return STG_E_INVALIDPARAMETER
;
621 ME_InsertOLEFromCursor(This
->editor
, reo
, 0);
622 ME_CommitUndo(This
->editor
);
623 ME_UpdateRepaint(This
->editor
, FALSE
);
627 static HRESULT WINAPI
IRichEditOle_fnSaveCompleted(IRichEditOle
*me
, LONG iob
,
630 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
631 FIXME("stub %p\n",This
);
635 static HRESULT WINAPI
636 IRichEditOle_fnSetDvaspect(IRichEditOle
*me
, LONG iob
, DWORD dvaspect
)
638 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
639 FIXME("stub %p\n",This
);
643 static HRESULT WINAPI
IRichEditOle_fnSetHostNames(IRichEditOle
*me
,
644 LPCSTR lpstrContainerApp
, LPCSTR lpstrContainerObj
)
646 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
647 FIXME("stub %p %s %s\n",This
, lpstrContainerApp
, lpstrContainerObj
);
651 static HRESULT WINAPI
652 IRichEditOle_fnSetLinkAvailable(IRichEditOle
*me
, LONG iob
, BOOL fAvailable
)
654 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
655 FIXME("stub %p\n",This
);
659 static const IRichEditOleVtbl revt
= {
660 IRichEditOle_fnQueryInterface
,
661 IRichEditOle_fnAddRef
,
662 IRichEditOle_fnRelease
,
663 IRichEditOle_fnGetClientSite
,
664 IRichEditOle_fnGetObjectCount
,
665 IRichEditOle_fnGetLinkCount
,
666 IRichEditOle_fnGetObject
,
667 IRichEditOle_fnInsertObject
,
668 IRichEditOle_fnConvertObject
,
669 IRichEditOle_fnActivateAs
,
670 IRichEditOle_fnSetHostNames
,
671 IRichEditOle_fnSetLinkAvailable
,
672 IRichEditOle_fnSetDvaspect
,
673 IRichEditOle_fnHandsOffStorage
,
674 IRichEditOle_fnSaveCompleted
,
675 IRichEditOle_fnInPlaceDeactivate
,
676 IRichEditOle_fnContextSensitiveHelp
,
677 IRichEditOle_fnGetClipboardData
,
678 IRichEditOle_fnImportDataObject
681 /* ITextRange interface */
682 static inline ITextRangeImpl
*impl_from_ITextRange(ITextRange
*iface
)
684 return CONTAINING_RECORD(iface
, ITextRangeImpl
, ITextRange_iface
);
687 static HRESULT WINAPI
ITextRange_fnQueryInterface(ITextRange
*me
, REFIID riid
, void **ppvObj
)
690 if (IsEqualGUID(riid
, &IID_IUnknown
)
691 || IsEqualGUID(riid
, &IID_IDispatch
)
692 || IsEqualGUID(riid
, &IID_ITextRange
))
695 ITextRange_AddRef(me
);
699 return E_NOINTERFACE
;
702 static ULONG WINAPI
ITextRange_fnAddRef(ITextRange
*me
)
704 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
705 return InterlockedIncrement(&This
->ref
);
708 static ULONG WINAPI
ITextRange_fnRelease(ITextRange
*me
)
710 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
711 ULONG ref
= InterlockedDecrement(&This
->ref
);
713 TRACE ("%p ref=%u\n", This
, ref
);
718 list_remove(&This
->entry
);
726 static HRESULT WINAPI
ITextRange_fnGetTypeInfoCount(ITextRange
*me
, UINT
*pctinfo
)
728 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
730 return CO_E_RELEASED
;
732 FIXME("not implemented %p\n", This
);
736 static HRESULT WINAPI
ITextRange_fnGetTypeInfo(ITextRange
*me
, UINT iTInfo
, LCID lcid
,
739 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
741 return CO_E_RELEASED
;
743 FIXME("not implemented %p\n", This
);
747 static HRESULT WINAPI
ITextRange_fnGetIDsOfNames(ITextRange
*me
, REFIID riid
, LPOLESTR
*rgszNames
,
748 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
750 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
752 return CO_E_RELEASED
;
754 FIXME("not implemented %p\n", This
);
758 static HRESULT WINAPI
ITextRange_fnInvoke(ITextRange
*me
, DISPID dispIdMember
, REFIID riid
,
759 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
760 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
,
763 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
765 return CO_E_RELEASED
;
767 FIXME("not implemented %p\n", This
);
771 static HRESULT WINAPI
ITextRange_fnGetText(ITextRange
*me
, BSTR
*pbstr
)
773 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
775 return CO_E_RELEASED
;
777 FIXME("not implemented %p\n", This
);
781 static HRESULT WINAPI
ITextRange_fnSetText(ITextRange
*me
, BSTR bstr
)
783 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
785 return CO_E_RELEASED
;
787 FIXME("not implemented %p\n", This
);
791 static HRESULT
range_GetChar(ME_TextEditor
*editor
, ME_Cursor
*cursor
, LONG
*pch
)
795 ME_GetTextW(editor
, wch
, 1, cursor
, 1, FALSE
, cursor
->pRun
->next
->type
== diTextEnd
);
801 static HRESULT WINAPI
ITextRange_fnGetChar(ITextRange
*me
, LONG
*pch
)
803 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
807 return CO_E_RELEASED
;
812 ME_CursorFromCharOfs(This
->reOle
->editor
, This
->start
, &cursor
);
813 return range_GetChar(This
->reOle
->editor
, &cursor
, pch
);
816 static HRESULT WINAPI
ITextRange_fnSetChar(ITextRange
*me
, LONG ch
)
818 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
820 return CO_E_RELEASED
;
822 FIXME("not implemented %p\n", This
);
826 static HRESULT
CreateITextRange(IRichEditOleImpl
*reOle
, LONG start
, LONG end
, ITextRange
** ppRange
);
828 static HRESULT WINAPI
ITextRange_fnGetDuplicate(ITextRange
*me
, ITextRange
**ppRange
)
830 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
832 return CO_E_RELEASED
;
834 TRACE("%p %p\n", This
, ppRange
);
838 return CreateITextRange(This
->reOle
, This
->start
, This
->end
, ppRange
);
841 static HRESULT WINAPI
ITextRange_fnGetFormattedText(ITextRange
*me
, ITextRange
**ppRange
)
843 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
845 return CO_E_RELEASED
;
847 FIXME("not implemented %p\n", This
);
851 static HRESULT WINAPI
ITextRange_fnSetFormattedText(ITextRange
*me
, ITextRange
*pRange
)
853 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
855 return CO_E_RELEASED
;
857 FIXME("not implemented %p\n", This
);
861 static HRESULT WINAPI
ITextRange_fnGetStart(ITextRange
*me
, LONG
*pcpFirst
)
863 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
865 return CO_E_RELEASED
;
869 *pcpFirst
= This
->start
;
870 TRACE("%d\n", *pcpFirst
);
874 static HRESULT WINAPI
ITextRange_fnSetStart(ITextRange
*me
, LONG cpFirst
)
876 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
878 return CO_E_RELEASED
;
880 FIXME("not implemented %p\n", This
);
884 static HRESULT WINAPI
ITextRange_fnGetEnd(ITextRange
*me
, LONG
*pcpLim
)
886 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
888 return CO_E_RELEASED
;
893 TRACE("%d\n", *pcpLim
);
897 static HRESULT WINAPI
ITextRange_fnSetEnd(ITextRange
*me
, LONG cpLim
)
899 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
901 return CO_E_RELEASED
;
903 FIXME("not implemented %p\n", This
);
907 static HRESULT WINAPI
ITextRange_fnGetFont(ITextRange
*me
, ITextFont
**pFont
)
909 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
911 return CO_E_RELEASED
;
913 FIXME("not implemented %p\n", This
);
917 static HRESULT WINAPI
ITextRange_fnSetFont(ITextRange
*me
, ITextFont
*pFont
)
919 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
921 return CO_E_RELEASED
;
923 FIXME("not implemented %p\n", This
);
927 static HRESULT WINAPI
ITextRange_fnGetPara(ITextRange
*me
, ITextPara
**ppPara
)
929 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
931 return CO_E_RELEASED
;
933 FIXME("not implemented %p\n", This
);
937 static HRESULT WINAPI
ITextRange_fnSetPara(ITextRange
*me
, ITextPara
*pPara
)
939 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
941 return CO_E_RELEASED
;
943 FIXME("not implemented %p\n", This
);
947 static HRESULT WINAPI
ITextRange_fnGetStoryLength(ITextRange
*me
, LONG
*pcch
)
949 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
951 return CO_E_RELEASED
;
953 FIXME("not implemented %p\n", This
);
957 static HRESULT WINAPI
ITextRange_fnGetStoryType(ITextRange
*me
, LONG
*pValue
)
959 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
961 return CO_E_RELEASED
;
963 FIXME("not implemented %p\n", This
);
967 static HRESULT
range_Collapse(LONG bStart
, LONG
*start
, LONG
*end
)
972 if (bStart
== tomEnd
|| bStart
== tomFalse
)
979 static HRESULT WINAPI
ITextRange_fnCollapse(ITextRange
*me
, LONG bStart
)
981 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
983 return CO_E_RELEASED
;
985 return range_Collapse(bStart
, &This
->start
, &This
->end
);
988 static HRESULT WINAPI
ITextRange_fnExpand(ITextRange
*me
, LONG Unit
, LONG
*pDelta
)
990 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
992 return CO_E_RELEASED
;
994 FIXME("not implemented %p\n", This
);
998 static HRESULT WINAPI
ITextRange_fnGetIndex(ITextRange
*me
, LONG Unit
, LONG
*pIndex
)
1000 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1002 return CO_E_RELEASED
;
1004 FIXME("not implemented %p\n", This
);
1008 static HRESULT WINAPI
ITextRange_fnSetIndex(ITextRange
*me
, LONG Unit
, LONG Index
,
1011 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1013 return CO_E_RELEASED
;
1015 FIXME("not implemented %p\n", This
);
1019 static HRESULT WINAPI
ITextRange_fnSetRange(ITextRange
*me
, LONG cpActive
, LONG cpOther
)
1021 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1023 return CO_E_RELEASED
;
1025 FIXME("not implemented %p\n", This
);
1029 static HRESULT WINAPI
ITextRange_fnInRange(ITextRange
*me
, ITextRange
*pRange
, LONG
*pb
)
1031 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1033 return CO_E_RELEASED
;
1035 FIXME("not implemented %p\n", This
);
1039 static HRESULT WINAPI
ITextRange_fnInStory(ITextRange
*me
, ITextRange
*pRange
, LONG
*pb
)
1041 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1043 return CO_E_RELEASED
;
1045 FIXME("not implemented %p\n", This
);
1049 static HRESULT WINAPI
ITextRange_fnIsEqual(ITextRange
*me
, ITextRange
*pRange
, LONG
*pb
)
1051 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1053 return CO_E_RELEASED
;
1055 FIXME("not implemented %p\n", This
);
1059 static HRESULT WINAPI
ITextRange_fnSelect(ITextRange
*me
)
1061 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1063 return CO_E_RELEASED
;
1065 FIXME("not implemented %p\n", This
);
1069 static HRESULT WINAPI
ITextRange_fnStartOf(ITextRange
*me
, LONG Unit
, LONG Extend
,
1072 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1074 return CO_E_RELEASED
;
1076 FIXME("not implemented %p\n", This
);
1080 static HRESULT WINAPI
ITextRange_fnEndOf(ITextRange
*me
, LONG Unit
, LONG Extend
,
1083 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1085 return CO_E_RELEASED
;
1087 FIXME("not implemented %p\n", This
);
1091 static HRESULT WINAPI
ITextRange_fnMove(ITextRange
*me
, LONG Unit
, LONG Count
, LONG
*pDelta
)
1093 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1095 return CO_E_RELEASED
;
1097 FIXME("not implemented %p\n", This
);
1101 static HRESULT WINAPI
ITextRange_fnMoveStart(ITextRange
*me
, LONG Unit
, LONG Count
,
1104 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1106 return CO_E_RELEASED
;
1108 FIXME("not implemented %p\n", This
);
1112 static HRESULT WINAPI
ITextRange_fnMoveEnd(ITextRange
*me
, LONG Unit
, LONG Count
,
1115 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1117 return CO_E_RELEASED
;
1119 FIXME("not implemented %p\n", This
);
1123 static HRESULT WINAPI
ITextRange_fnMoveWhile(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
1126 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1128 return CO_E_RELEASED
;
1130 FIXME("not implemented %p\n", This
);
1134 static HRESULT WINAPI
ITextRange_fnMoveStartWhile(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
1137 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1139 return CO_E_RELEASED
;
1141 FIXME("not implemented %p\n", This
);
1145 static HRESULT WINAPI
ITextRange_fnMoveEndWhile(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
1148 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1150 return CO_E_RELEASED
;
1152 FIXME("not implemented %p\n", This
);
1156 static HRESULT WINAPI
ITextRange_fnMoveUntil(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
1159 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1161 return CO_E_RELEASED
;
1163 FIXME("not implemented %p\n", This
);
1167 static HRESULT WINAPI
ITextRange_fnMoveStartUntil(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
1170 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1172 return CO_E_RELEASED
;
1174 FIXME("not implemented %p\n", This
);
1178 static HRESULT WINAPI
ITextRange_fnMoveEndUntil(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
1181 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1183 return CO_E_RELEASED
;
1185 FIXME("not implemented %p\n", This
);
1189 static HRESULT WINAPI
ITextRange_fnFindText(ITextRange
*me
, BSTR bstr
, LONG cch
, LONG Flags
,
1192 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1194 return CO_E_RELEASED
;
1196 FIXME("not implemented %p\n", This
);
1200 static HRESULT WINAPI
ITextRange_fnFindTextStart(ITextRange
*me
, BSTR bstr
, LONG cch
,
1201 LONG Flags
, LONG
*pLength
)
1203 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1205 return CO_E_RELEASED
;
1207 FIXME("not implemented %p\n", This
);
1211 static HRESULT WINAPI
ITextRange_fnFindTextEnd(ITextRange
*me
, BSTR bstr
, LONG cch
,
1212 LONG Flags
, LONG
*pLength
)
1214 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1216 return CO_E_RELEASED
;
1218 FIXME("not implemented %p\n", This
);
1222 static HRESULT WINAPI
ITextRange_fnDelete(ITextRange
*me
, LONG Unit
, LONG Count
,
1225 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1227 return CO_E_RELEASED
;
1229 FIXME("not implemented %p\n", This
);
1233 static HRESULT WINAPI
ITextRange_fnCut(ITextRange
*me
, VARIANT
*pVar
)
1235 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1237 return CO_E_RELEASED
;
1239 FIXME("not implemented %p\n", This
);
1243 static HRESULT WINAPI
ITextRange_fnCopy(ITextRange
*me
, VARIANT
*pVar
)
1245 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1247 return CO_E_RELEASED
;
1249 FIXME("not implemented %p\n", This
);
1253 static HRESULT WINAPI
ITextRange_fnPaste(ITextRange
*me
, VARIANT
*pVar
, LONG Format
)
1255 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1257 return CO_E_RELEASED
;
1259 FIXME("not implemented %p\n", This
);
1263 static HRESULT WINAPI
ITextRange_fnCanPaste(ITextRange
*me
, VARIANT
*pVar
, LONG Format
,
1266 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1268 return CO_E_RELEASED
;
1270 FIXME("not implemented %p\n", This
);
1274 static HRESULT WINAPI
ITextRange_fnCanEdit(ITextRange
*me
, LONG
*pb
)
1276 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1278 return CO_E_RELEASED
;
1280 FIXME("not implemented %p\n", This
);
1284 static HRESULT WINAPI
ITextRange_fnChangeCase(ITextRange
*me
, LONG Type
)
1286 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1288 return CO_E_RELEASED
;
1290 FIXME("not implemented %p\n", This
);
1294 static HRESULT WINAPI
ITextRange_fnGetPoint(ITextRange
*me
, LONG Type
, LONG
*cx
, LONG
*cy
)
1296 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1298 return CO_E_RELEASED
;
1300 FIXME("not implemented %p\n", This
);
1304 static HRESULT WINAPI
ITextRange_fnSetPoint(ITextRange
*me
, LONG x
, LONG y
, LONG Type
,
1307 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1309 return CO_E_RELEASED
;
1311 FIXME("not implemented %p\n", This
);
1315 static HRESULT WINAPI
ITextRange_fnScrollIntoView(ITextRange
*me
, LONG Value
)
1317 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1319 return CO_E_RELEASED
;
1321 FIXME("not implemented %p\n", This
);
1325 static HRESULT WINAPI
ITextRange_fnGetEmbeddedObject(ITextRange
*me
, IUnknown
**ppv
)
1327 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1329 return CO_E_RELEASED
;
1331 FIXME("not implemented %p\n", This
);
1335 static const ITextRangeVtbl trvt
= {
1336 ITextRange_fnQueryInterface
,
1337 ITextRange_fnAddRef
,
1338 ITextRange_fnRelease
,
1339 ITextRange_fnGetTypeInfoCount
,
1340 ITextRange_fnGetTypeInfo
,
1341 ITextRange_fnGetIDsOfNames
,
1342 ITextRange_fnInvoke
,
1343 ITextRange_fnGetText
,
1344 ITextRange_fnSetText
,
1345 ITextRange_fnGetChar
,
1346 ITextRange_fnSetChar
,
1347 ITextRange_fnGetDuplicate
,
1348 ITextRange_fnGetFormattedText
,
1349 ITextRange_fnSetFormattedText
,
1350 ITextRange_fnGetStart
,
1351 ITextRange_fnSetStart
,
1352 ITextRange_fnGetEnd
,
1353 ITextRange_fnSetEnd
,
1354 ITextRange_fnGetFont
,
1355 ITextRange_fnSetFont
,
1356 ITextRange_fnGetPara
,
1357 ITextRange_fnSetPara
,
1358 ITextRange_fnGetStoryLength
,
1359 ITextRange_fnGetStoryType
,
1360 ITextRange_fnCollapse
,
1361 ITextRange_fnExpand
,
1362 ITextRange_fnGetIndex
,
1363 ITextRange_fnSetIndex
,
1364 ITextRange_fnSetRange
,
1365 ITextRange_fnInRange
,
1366 ITextRange_fnInStory
,
1367 ITextRange_fnIsEqual
,
1368 ITextRange_fnSelect
,
1369 ITextRange_fnStartOf
,
1372 ITextRange_fnMoveStart
,
1373 ITextRange_fnMoveEnd
,
1374 ITextRange_fnMoveWhile
,
1375 ITextRange_fnMoveStartWhile
,
1376 ITextRange_fnMoveEndWhile
,
1377 ITextRange_fnMoveUntil
,
1378 ITextRange_fnMoveStartUntil
,
1379 ITextRange_fnMoveEndUntil
,
1380 ITextRange_fnFindText
,
1381 ITextRange_fnFindTextStart
,
1382 ITextRange_fnFindTextEnd
,
1383 ITextRange_fnDelete
,
1387 ITextRange_fnCanPaste
,
1388 ITextRange_fnCanEdit
,
1389 ITextRange_fnChangeCase
,
1390 ITextRange_fnGetPoint
,
1391 ITextRange_fnSetPoint
,
1392 ITextRange_fnScrollIntoView
,
1393 ITextRange_fnGetEmbeddedObject
1395 /* ITextRange interface */
1397 static HRESULT WINAPI
1398 ITextDocument_fnQueryInterface(ITextDocument
* me
, REFIID riid
,
1401 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1402 return IRichEditOle_QueryInterface(&This
->IRichEditOle_iface
, riid
, ppvObject
);
1406 ITextDocument_fnAddRef(ITextDocument
* me
)
1408 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1409 return IRichEditOle_AddRef(&This
->IRichEditOle_iface
);
1413 ITextDocument_fnRelease(ITextDocument
* me
)
1415 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1416 return IRichEditOle_Release(&This
->IRichEditOle_iface
);
1419 static HRESULT WINAPI
1420 ITextDocument_fnGetTypeInfoCount(ITextDocument
* me
,
1423 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1424 FIXME("stub %p\n",This
);
1428 static HRESULT WINAPI
1429 ITextDocument_fnGetTypeInfo(ITextDocument
* me
, UINT iTInfo
, LCID lcid
,
1430 ITypeInfo
** ppTInfo
)
1432 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1433 FIXME("stub %p\n",This
);
1437 static HRESULT WINAPI
1438 ITextDocument_fnGetIDsOfNames(ITextDocument
* me
, REFIID riid
,
1439 LPOLESTR
* rgszNames
, UINT cNames
, LCID lcid
, DISPID
* rgDispId
)
1441 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1442 FIXME("stub %p\n",This
);
1446 static HRESULT WINAPI
1447 ITextDocument_fnInvoke(ITextDocument
* me
, DISPID dispIdMember
,
1448 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
* pDispParams
,
1449 VARIANT
* pVarResult
, EXCEPINFO
* pExcepInfo
, UINT
* puArgErr
)
1451 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1452 FIXME("stub %p\n",This
);
1456 static HRESULT WINAPI
1457 ITextDocument_fnGetName(ITextDocument
* me
, BSTR
* pName
)
1459 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1460 FIXME("stub %p\n",This
);
1464 static HRESULT WINAPI
1465 ITextDocument_fnGetSelection(ITextDocument
* me
, ITextSelection
** ppSel
)
1467 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1468 TRACE("(%p)\n", me
);
1471 return E_INVALIDARG
;
1472 *ppSel
= &This
->txtSel
->ITextSelection_iface
;
1473 ITextSelection_AddRef(*ppSel
);
1477 static HRESULT WINAPI
1478 ITextDocument_fnGetStoryCount(ITextDocument
* me
, LONG
* pCount
)
1480 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1481 FIXME("stub %p\n",This
);
1485 static HRESULT WINAPI
1486 ITextDocument_fnGetStoryRanges(ITextDocument
* me
,
1487 ITextStoryRanges
** ppStories
)
1489 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1490 FIXME("stub %p\n",This
);
1494 static HRESULT WINAPI
1495 ITextDocument_fnGetSaved(ITextDocument
* me
, LONG
* pValue
)
1497 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1498 FIXME("stub %p\n",This
);
1502 static HRESULT WINAPI
1503 ITextDocument_fnSetSaved(ITextDocument
* me
, LONG Value
)
1505 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1506 FIXME("stub %p\n",This
);
1510 static HRESULT WINAPI
1511 ITextDocument_fnGetDefaultTabStop(ITextDocument
* me
, float* pValue
)
1513 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1514 FIXME("stub %p\n",This
);
1518 static HRESULT WINAPI
1519 ITextDocument_fnSetDefaultTabStop(ITextDocument
* me
, float Value
)
1521 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1522 FIXME("stub %p\n",This
);
1526 static HRESULT WINAPI
1527 ITextDocument_fnNew(ITextDocument
* me
)
1529 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1530 FIXME("stub %p\n",This
);
1534 static HRESULT WINAPI
1535 ITextDocument_fnOpen(ITextDocument
* me
, VARIANT
* pVar
, LONG Flags
,
1538 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1539 FIXME("stub %p\n",This
);
1543 static HRESULT WINAPI
1544 ITextDocument_fnSave(ITextDocument
* me
, VARIANT
* pVar
, LONG Flags
,
1547 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1548 FIXME("stub %p\n",This
);
1552 static HRESULT WINAPI
1553 ITextDocument_fnFreeze(ITextDocument
* me
, LONG
* pCount
)
1555 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1556 FIXME("stub %p\n",This
);
1560 static HRESULT WINAPI
1561 ITextDocument_fnUnfreeze(ITextDocument
* me
, LONG
* pCount
)
1563 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1564 FIXME("stub %p\n",This
);
1568 static HRESULT WINAPI
1569 ITextDocument_fnBeginEditCollection(ITextDocument
* me
)
1571 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1572 FIXME("stub %p\n",This
);
1576 static HRESULT WINAPI
1577 ITextDocument_fnEndEditCollection(ITextDocument
* me
)
1579 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1580 FIXME("stub %p\n",This
);
1584 static HRESULT WINAPI
1585 ITextDocument_fnUndo(ITextDocument
* me
, LONG Count
, LONG
* prop
)
1587 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1588 FIXME("stub %p\n",This
);
1592 static HRESULT WINAPI
1593 ITextDocument_fnRedo(ITextDocument
* me
, LONG Count
, LONG
* prop
)
1595 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1596 FIXME("stub %p\n",This
);
1600 static HRESULT
CreateITextRange(IRichEditOleImpl
*reOle
, LONG start
, LONG end
, ITextRange
** ppRange
)
1602 ITextRangeImpl
*txtRge
= heap_alloc(sizeof(ITextRangeImpl
));
1605 return E_OUTOFMEMORY
;
1606 txtRge
->ITextRange_iface
.lpVtbl
= &trvt
;
1608 txtRge
->reOle
= reOle
;
1609 txtRge
->start
= start
;
1611 list_add_head(&reOle
->rangelist
, &txtRge
->entry
);
1612 *ppRange
= &txtRge
->ITextRange_iface
;
1616 static HRESULT WINAPI
1617 ITextDocument_fnRange(ITextDocument
* me
, LONG cp1
, LONG cp2
,
1618 ITextRange
** ppRange
)
1620 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1621 const int len
= ME_GetTextLength(This
->editor
) + 1;
1623 TRACE("%p %p %d %d\n", This
, ppRange
, cp1
, cp2
);
1625 return E_INVALIDARG
;
1629 cp1
= min(cp1
, len
);
1630 cp2
= min(cp2
, len
);
1639 cp1
= cp2
= len
- 1;
1641 return CreateITextRange(This
, cp1
, cp2
, ppRange
);
1644 static HRESULT WINAPI
1645 ITextDocument_fnRangeFromPoint(ITextDocument
* me
, LONG x
, LONG y
,
1646 ITextRange
** ppRange
)
1648 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
1649 FIXME("stub %p\n",This
);
1653 static const ITextDocumentVtbl tdvt
= {
1654 ITextDocument_fnQueryInterface
,
1655 ITextDocument_fnAddRef
,
1656 ITextDocument_fnRelease
,
1657 ITextDocument_fnGetTypeInfoCount
,
1658 ITextDocument_fnGetTypeInfo
,
1659 ITextDocument_fnGetIDsOfNames
,
1660 ITextDocument_fnInvoke
,
1661 ITextDocument_fnGetName
,
1662 ITextDocument_fnGetSelection
,
1663 ITextDocument_fnGetStoryCount
,
1664 ITextDocument_fnGetStoryRanges
,
1665 ITextDocument_fnGetSaved
,
1666 ITextDocument_fnSetSaved
,
1667 ITextDocument_fnGetDefaultTabStop
,
1668 ITextDocument_fnSetDefaultTabStop
,
1669 ITextDocument_fnNew
,
1670 ITextDocument_fnOpen
,
1671 ITextDocument_fnSave
,
1672 ITextDocument_fnFreeze
,
1673 ITextDocument_fnUnfreeze
,
1674 ITextDocument_fnBeginEditCollection
,
1675 ITextDocument_fnEndEditCollection
,
1676 ITextDocument_fnUndo
,
1677 ITextDocument_fnRedo
,
1678 ITextDocument_fnRange
,
1679 ITextDocument_fnRangeFromPoint
1682 static inline ITextSelectionImpl
*impl_from_ITextSelection(ITextSelection
*iface
)
1684 return CONTAINING_RECORD(iface
, ITextSelectionImpl
, ITextSelection_iface
);
1687 static HRESULT WINAPI
ITextSelection_fnQueryInterface(
1693 if (IsEqualGUID(riid
, &IID_IUnknown
)
1694 || IsEqualGUID(riid
, &IID_IDispatch
)
1695 || IsEqualGUID(riid
, &IID_ITextRange
)
1696 || IsEqualGUID(riid
, &IID_ITextSelection
))
1699 ITextSelection_AddRef(me
);
1703 return E_NOINTERFACE
;
1706 static ULONG WINAPI
ITextSelection_fnAddRef(ITextSelection
*me
)
1708 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1709 return InterlockedIncrement(&This
->ref
);
1712 static ULONG WINAPI
ITextSelection_fnRelease(ITextSelection
*me
)
1714 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1715 ULONG ref
= InterlockedDecrement(&This
->ref
);
1721 static HRESULT WINAPI
ITextSelection_fnGetTypeInfoCount(ITextSelection
*me
, UINT
*pctinfo
)
1723 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1725 return CO_E_RELEASED
;
1727 FIXME("not implemented\n");
1731 static HRESULT WINAPI
ITextSelection_fnGetTypeInfo(ITextSelection
*me
, UINT iTInfo
, LCID lcid
,
1732 ITypeInfo
**ppTInfo
)
1734 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1736 return CO_E_RELEASED
;
1738 FIXME("not implemented\n");
1742 static HRESULT WINAPI
ITextSelection_fnGetIDsOfNames(ITextSelection
*me
, REFIID riid
,
1743 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
1745 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1747 return CO_E_RELEASED
;
1749 FIXME("not implemented\n");
1753 static HRESULT WINAPI
ITextSelection_fnInvoke(
1755 DISPID dispIdMember
,
1759 DISPPARAMS
*pDispParams
,
1760 VARIANT
*pVarResult
,
1761 EXCEPINFO
*pExcepInfo
,
1764 FIXME("not implemented\n");
1768 /*** ITextRange methods ***/
1769 static HRESULT WINAPI
ITextSelection_fnGetText(ITextSelection
*me
, BSTR
*pbstr
)
1771 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1772 ME_Cursor
*start
= NULL
, *end
= NULL
;
1777 return CO_E_RELEASED
;
1778 TRACE("%p\n", pbstr
);
1780 return E_INVALIDARG
;
1782 ME_GetSelection(This
->reOle
->editor
, &start
, &end
);
1783 endOfs
= ME_GetCursorOfs(end
);
1784 nChars
= endOfs
- ME_GetCursorOfs(start
);
1791 *pbstr
= SysAllocStringLen(NULL
, nChars
);
1793 return E_OUTOFMEMORY
;
1795 bEOP
= (end
->pRun
->next
->type
== diTextEnd
&& endOfs
> ME_GetTextLength(This
->reOle
->editor
));
1796 ME_GetTextW(This
->reOle
->editor
, *pbstr
, nChars
, start
, nChars
, FALSE
, bEOP
);
1797 TRACE("%s\n", wine_dbgstr_w(*pbstr
));
1802 static HRESULT WINAPI
ITextSelection_fnSetText(ITextSelection
*me
, BSTR bstr
)
1804 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1806 return CO_E_RELEASED
;
1808 FIXME("not implemented\n");
1812 static HRESULT WINAPI
ITextSelection_fnGetChar(ITextSelection
*me
, LONG
*pch
)
1814 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1815 ME_Cursor
*start
= NULL
, *end
= NULL
;
1818 return CO_E_RELEASED
;
1821 return E_INVALIDARG
;
1823 ME_GetSelection(This
->reOle
->editor
, &start
, &end
);
1824 return range_GetChar(This
->reOle
->editor
, start
, pch
);
1827 static HRESULT WINAPI
ITextSelection_fnSetChar(ITextSelection
*me
, LONG ch
)
1829 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1831 return CO_E_RELEASED
;
1833 FIXME("not implemented\n");
1837 static HRESULT WINAPI
ITextSelection_fnGetDuplicate(ITextSelection
*me
, ITextRange
**ppRange
)
1839 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1841 return CO_E_RELEASED
;
1843 FIXME("not implemented\n");
1847 static HRESULT WINAPI
ITextSelection_fnGetFormattedText(ITextSelection
*me
, ITextRange
**ppRange
)
1849 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1851 return CO_E_RELEASED
;
1853 FIXME("not implemented\n");
1857 static HRESULT WINAPI
ITextSelection_fnSetFormattedText(ITextSelection
*me
, ITextRange
*pRange
)
1859 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1861 return CO_E_RELEASED
;
1863 FIXME("not implemented\n");
1867 static HRESULT WINAPI
ITextSelection_fnGetStart(ITextSelection
*me
, LONG
*pcpFirst
)
1869 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1872 return CO_E_RELEASED
;
1875 return E_INVALIDARG
;
1876 ME_GetSelectionOfs(This
->reOle
->editor
, pcpFirst
, &lim
);
1877 TRACE("%d\n", *pcpFirst
);
1881 static HRESULT WINAPI
ITextSelection_fnSetStart(ITextSelection
*me
, LONG cpFirst
)
1883 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1885 return CO_E_RELEASED
;
1887 FIXME("not implemented\n");
1891 static HRESULT WINAPI
ITextSelection_fnGetEnd(ITextSelection
*me
, LONG
*pcpLim
)
1893 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1896 return CO_E_RELEASED
;
1899 return E_INVALIDARG
;
1900 ME_GetSelectionOfs(This
->reOle
->editor
, &first
, pcpLim
);
1901 TRACE("%d\n", *pcpLim
);
1905 static HRESULT WINAPI
ITextSelection_fnSetEnd(ITextSelection
*me
, LONG cpLim
)
1907 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1909 return CO_E_RELEASED
;
1911 FIXME("not implemented\n");
1915 static HRESULT WINAPI
ITextSelection_fnGetFont(ITextSelection
*me
, ITextFont
**pFont
)
1917 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1919 return CO_E_RELEASED
;
1921 FIXME("not implemented\n");
1925 static HRESULT WINAPI
ITextSelection_fnSetFont(ITextSelection
*me
, ITextFont
*pFont
)
1927 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1929 return CO_E_RELEASED
;
1931 FIXME("not implemented\n");
1935 static HRESULT WINAPI
ITextSelection_fnGetPara(ITextSelection
*me
, ITextPara
**ppPara
)
1937 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1939 return CO_E_RELEASED
;
1941 FIXME("not implemented\n");
1945 static HRESULT WINAPI
ITextSelection_fnSetPara(ITextSelection
*me
, ITextPara
*pPara
)
1947 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1949 return CO_E_RELEASED
;
1951 FIXME("not implemented\n");
1955 static HRESULT WINAPI
ITextSelection_fnGetStoryLength(ITextSelection
*me
, LONG
*pcch
)
1957 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1959 return CO_E_RELEASED
;
1961 FIXME("not implemented\n");
1965 static HRESULT WINAPI
ITextSelection_fnGetStoryType(ITextSelection
*me
, LONG
*pValue
)
1967 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1969 return CO_E_RELEASED
;
1971 FIXME("not implemented\n");
1975 static HRESULT WINAPI
ITextSelection_fnCollapse(ITextSelection
*me
, LONG bStart
)
1977 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1981 return CO_E_RELEASED
;
1983 ME_GetSelectionOfs(This
->reOle
->editor
, &start
, &end
);
1984 hres
= range_Collapse(bStart
, &start
, &end
);
1985 if (SUCCEEDED(hres
))
1986 ME_SetSelection(This
->reOle
->editor
, start
, end
);
1990 static HRESULT WINAPI
ITextSelection_fnExpand(ITextSelection
*me
, LONG Unit
, LONG
*pDelta
)
1992 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1994 return CO_E_RELEASED
;
1996 FIXME("not implemented\n");
2000 static HRESULT WINAPI
ITextSelection_fnGetIndex(ITextSelection
*me
, LONG Unit
, LONG
*pIndex
)
2002 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2004 return CO_E_RELEASED
;
2006 FIXME("not implemented\n");
2010 static HRESULT WINAPI
ITextSelection_fnSetIndex(ITextSelection
*me
, LONG Unit
, LONG Index
,
2013 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2015 return CO_E_RELEASED
;
2017 FIXME("not implemented\n");
2021 static HRESULT WINAPI
ITextSelection_fnSetRange(ITextSelection
*me
, LONG cpActive
, LONG cpOther
)
2023 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2025 return CO_E_RELEASED
;
2027 FIXME("not implemented\n");
2031 static HRESULT WINAPI
ITextSelection_fnInRange(ITextSelection
*me
, ITextRange
*pRange
, LONG
*pb
)
2033 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2035 return CO_E_RELEASED
;
2037 FIXME("not implemented\n");
2041 static HRESULT WINAPI
ITextSelection_fnInStory(ITextSelection
*me
, ITextRange
*pRange
, LONG
*pb
)
2043 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2045 return CO_E_RELEASED
;
2047 FIXME("not implemented\n");
2051 static HRESULT WINAPI
ITextSelection_fnIsEqual(ITextSelection
*me
, ITextRange
*pRange
, LONG
*pb
)
2053 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2055 return CO_E_RELEASED
;
2057 FIXME("not implemented\n");
2061 static HRESULT WINAPI
ITextSelection_fnSelect(ITextSelection
*me
)
2063 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2065 return CO_E_RELEASED
;
2067 FIXME("not implemented\n");
2071 static HRESULT WINAPI
ITextSelection_fnStartOf(ITextSelection
*me
, LONG Unit
, LONG Extend
,
2074 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2076 return CO_E_RELEASED
;
2078 FIXME("not implemented\n");
2082 static HRESULT WINAPI
ITextSelection_fnEndOf(ITextSelection
*me
, LONG Unit
, LONG Extend
,
2085 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2087 return CO_E_RELEASED
;
2089 FIXME("not implemented\n");
2093 static HRESULT WINAPI
ITextSelection_fnMove(ITextSelection
*me
, LONG Unit
, LONG Count
, LONG
*pDelta
)
2095 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2097 return CO_E_RELEASED
;
2099 FIXME("not implemented\n");
2103 static HRESULT WINAPI
ITextSelection_fnMoveStart(ITextSelection
*me
, LONG Unit
, LONG Count
,
2106 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2108 return CO_E_RELEASED
;
2110 FIXME("not implemented\n");
2114 static HRESULT WINAPI
ITextSelection_fnMoveEnd(ITextSelection
*me
, LONG Unit
, LONG Count
,
2117 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2119 return CO_E_RELEASED
;
2121 FIXME("not implemented\n");
2125 static HRESULT WINAPI
ITextSelection_fnMoveWhile(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
2128 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2130 return CO_E_RELEASED
;
2132 FIXME("not implemented\n");
2136 static HRESULT WINAPI
ITextSelection_fnMoveStartWhile(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
2139 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2141 return CO_E_RELEASED
;
2143 FIXME("not implemented\n");
2147 static HRESULT WINAPI
ITextSelection_fnMoveEndWhile(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
2150 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2152 return CO_E_RELEASED
;
2154 FIXME("not implemented\n");
2158 static HRESULT WINAPI
ITextSelection_fnMoveUntil(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
2161 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2163 return CO_E_RELEASED
;
2165 FIXME("not implemented\n");
2169 static HRESULT WINAPI
ITextSelection_fnMoveStartUntil(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
2172 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2174 return CO_E_RELEASED
;
2176 FIXME("not implemented\n");
2180 static HRESULT WINAPI
ITextSelection_fnMoveEndUntil(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
2183 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2185 return CO_E_RELEASED
;
2187 FIXME("not implemented\n");
2191 static HRESULT WINAPI
ITextSelection_fnFindText(ITextSelection
*me
, BSTR bstr
, LONG cch
, LONG Flags
,
2194 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2196 return CO_E_RELEASED
;
2198 FIXME("not implemented\n");
2202 static HRESULT WINAPI
ITextSelection_fnFindTextStart(ITextSelection
*me
, BSTR bstr
, LONG cch
,
2203 LONG Flags
, LONG
*pLength
)
2205 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2207 return CO_E_RELEASED
;
2209 FIXME("not implemented\n");
2213 static HRESULT WINAPI
ITextSelection_fnFindTextEnd(ITextSelection
*me
, BSTR bstr
, LONG cch
,
2214 LONG Flags
, LONG
*pLength
)
2216 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2218 return CO_E_RELEASED
;
2220 FIXME("not implemented\n");
2224 static HRESULT WINAPI
ITextSelection_fnDelete(ITextSelection
*me
, LONG Unit
, LONG Count
,
2227 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2229 return CO_E_RELEASED
;
2231 FIXME("not implemented\n");
2235 static HRESULT WINAPI
ITextSelection_fnCut(ITextSelection
*me
, VARIANT
*pVar
)
2237 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2239 return CO_E_RELEASED
;
2241 FIXME("not implemented\n");
2245 static HRESULT WINAPI
ITextSelection_fnCopy(ITextSelection
*me
, VARIANT
*pVar
)
2247 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2249 return CO_E_RELEASED
;
2251 FIXME("not implemented\n");
2255 static HRESULT WINAPI
ITextSelection_fnPaste(ITextSelection
*me
, VARIANT
*pVar
, LONG Format
)
2257 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2259 return CO_E_RELEASED
;
2261 FIXME("not implemented\n");
2265 static HRESULT WINAPI
ITextSelection_fnCanPaste(ITextSelection
*me
, VARIANT
*pVar
, LONG Format
,
2268 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2270 return CO_E_RELEASED
;
2272 FIXME("not implemented\n");
2276 static HRESULT WINAPI
ITextSelection_fnCanEdit(ITextSelection
*me
, LONG
*pb
)
2278 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2280 return CO_E_RELEASED
;
2282 FIXME("not implemented\n");
2286 static HRESULT WINAPI
ITextSelection_fnChangeCase(ITextSelection
*me
, LONG Type
)
2288 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2290 return CO_E_RELEASED
;
2292 FIXME("not implemented\n");
2296 static HRESULT WINAPI
ITextSelection_fnGetPoint(ITextSelection
*me
, LONG Type
, LONG
*cx
, LONG
*cy
)
2298 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2300 return CO_E_RELEASED
;
2302 FIXME("not implemented\n");
2306 static HRESULT WINAPI
ITextSelection_fnSetPoint(ITextSelection
*me
, LONG x
, LONG y
, LONG Type
,
2309 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2311 return CO_E_RELEASED
;
2313 FIXME("not implemented\n");
2317 static HRESULT WINAPI
ITextSelection_fnScrollIntoView(ITextSelection
*me
, LONG Value
)
2319 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2321 return CO_E_RELEASED
;
2323 FIXME("not implemented\n");
2327 static HRESULT WINAPI
ITextSelection_fnGetEmbeddedObject(ITextSelection
*me
, IUnknown
**ppv
)
2329 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2331 return CO_E_RELEASED
;
2333 FIXME("not implemented\n");
2337 /*** ITextSelection methods ***/
2338 static HRESULT WINAPI
ITextSelection_fnGetFlags(ITextSelection
*me
, LONG
*pFlags
)
2340 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2342 return CO_E_RELEASED
;
2344 FIXME("not implemented\n");
2348 static HRESULT WINAPI
ITextSelection_fnSetFlags(ITextSelection
*me
, LONG Flags
)
2350 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2352 return CO_E_RELEASED
;
2354 FIXME("not implemented\n");
2358 static HRESULT WINAPI
ITextSelection_fnGetType(ITextSelection
*me
, LONG
*pType
)
2360 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2362 return CO_E_RELEASED
;
2364 FIXME("not implemented\n");
2368 static HRESULT WINAPI
ITextSelection_fnMoveLeft(ITextSelection
*me
, LONG Unit
, LONG Count
,
2369 LONG Extend
, LONG
*pDelta
)
2371 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2373 return CO_E_RELEASED
;
2375 FIXME("not implemented\n");
2379 static HRESULT WINAPI
ITextSelection_fnMoveRight(ITextSelection
*me
, LONG Unit
, LONG Count
,
2380 LONG Extend
, LONG
*pDelta
)
2382 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2384 return CO_E_RELEASED
;
2386 FIXME("not implemented\n");
2390 static HRESULT WINAPI
ITextSelection_fnMoveUp(ITextSelection
*me
, LONG Unit
, LONG Count
,
2391 LONG Extend
, LONG
*pDelta
)
2393 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2395 return CO_E_RELEASED
;
2397 FIXME("not implemented\n");
2401 static HRESULT WINAPI
ITextSelection_fnMoveDown(ITextSelection
*me
, LONG Unit
, LONG Count
,
2402 LONG Extend
, LONG
*pDelta
)
2404 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2406 return CO_E_RELEASED
;
2408 FIXME("not implemented\n");
2412 static HRESULT WINAPI
ITextSelection_fnHomeKey(ITextSelection
*me
, LONG Unit
, LONG Extend
,
2415 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2417 return CO_E_RELEASED
;
2419 FIXME("not implemented\n");
2423 static HRESULT WINAPI
ITextSelection_fnEndKey(ITextSelection
*me
, LONG Unit
, LONG Extend
,
2426 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2428 return CO_E_RELEASED
;
2430 FIXME("not implemented\n");
2434 static HRESULT WINAPI
ITextSelection_fnTypeText(ITextSelection
*me
, BSTR bstr
)
2436 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
2438 return CO_E_RELEASED
;
2440 FIXME("not implemented\n");
2444 static const ITextSelectionVtbl tsvt
= {
2445 ITextSelection_fnQueryInterface
,
2446 ITextSelection_fnAddRef
,
2447 ITextSelection_fnRelease
,
2448 ITextSelection_fnGetTypeInfoCount
,
2449 ITextSelection_fnGetTypeInfo
,
2450 ITextSelection_fnGetIDsOfNames
,
2451 ITextSelection_fnInvoke
,
2452 ITextSelection_fnGetText
,
2453 ITextSelection_fnSetText
,
2454 ITextSelection_fnGetChar
,
2455 ITextSelection_fnSetChar
,
2456 ITextSelection_fnGetDuplicate
,
2457 ITextSelection_fnGetFormattedText
,
2458 ITextSelection_fnSetFormattedText
,
2459 ITextSelection_fnGetStart
,
2460 ITextSelection_fnSetStart
,
2461 ITextSelection_fnGetEnd
,
2462 ITextSelection_fnSetEnd
,
2463 ITextSelection_fnGetFont
,
2464 ITextSelection_fnSetFont
,
2465 ITextSelection_fnGetPara
,
2466 ITextSelection_fnSetPara
,
2467 ITextSelection_fnGetStoryLength
,
2468 ITextSelection_fnGetStoryType
,
2469 ITextSelection_fnCollapse
,
2470 ITextSelection_fnExpand
,
2471 ITextSelection_fnGetIndex
,
2472 ITextSelection_fnSetIndex
,
2473 ITextSelection_fnSetRange
,
2474 ITextSelection_fnInRange
,
2475 ITextSelection_fnInStory
,
2476 ITextSelection_fnIsEqual
,
2477 ITextSelection_fnSelect
,
2478 ITextSelection_fnStartOf
,
2479 ITextSelection_fnEndOf
,
2480 ITextSelection_fnMove
,
2481 ITextSelection_fnMoveStart
,
2482 ITextSelection_fnMoveEnd
,
2483 ITextSelection_fnMoveWhile
,
2484 ITextSelection_fnMoveStartWhile
,
2485 ITextSelection_fnMoveEndWhile
,
2486 ITextSelection_fnMoveUntil
,
2487 ITextSelection_fnMoveStartUntil
,
2488 ITextSelection_fnMoveEndUntil
,
2489 ITextSelection_fnFindText
,
2490 ITextSelection_fnFindTextStart
,
2491 ITextSelection_fnFindTextEnd
,
2492 ITextSelection_fnDelete
,
2493 ITextSelection_fnCut
,
2494 ITextSelection_fnCopy
,
2495 ITextSelection_fnPaste
,
2496 ITextSelection_fnCanPaste
,
2497 ITextSelection_fnCanEdit
,
2498 ITextSelection_fnChangeCase
,
2499 ITextSelection_fnGetPoint
,
2500 ITextSelection_fnSetPoint
,
2501 ITextSelection_fnScrollIntoView
,
2502 ITextSelection_fnGetEmbeddedObject
,
2503 ITextSelection_fnGetFlags
,
2504 ITextSelection_fnSetFlags
,
2505 ITextSelection_fnGetType
,
2506 ITextSelection_fnMoveLeft
,
2507 ITextSelection_fnMoveRight
,
2508 ITextSelection_fnMoveUp
,
2509 ITextSelection_fnMoveDown
,
2510 ITextSelection_fnHomeKey
,
2511 ITextSelection_fnEndKey
,
2512 ITextSelection_fnTypeText
2515 static ITextSelectionImpl
*
2516 CreateTextSelection(IRichEditOleImpl
*reOle
)
2518 ITextSelectionImpl
*txtSel
= heap_alloc(sizeof *txtSel
);
2522 txtSel
->ITextSelection_iface
.lpVtbl
= &tsvt
;
2524 txtSel
->reOle
= reOle
;
2528 LRESULT
CreateIRichEditOle(IUnknown
*outer_unk
, ME_TextEditor
*editor
, LPVOID
*ppvObj
)
2530 IRichEditOleImpl
*reo
;
2532 reo
= heap_alloc(sizeof(IRichEditOleImpl
));
2536 reo
->IUnknown_inner
.lpVtbl
= &reo_unk_vtbl
;
2537 reo
->IRichEditOle_iface
.lpVtbl
= &revt
;
2538 reo
->ITextDocument_iface
.lpVtbl
= &tdvt
;
2540 reo
->editor
= editor
;
2541 reo
->txtSel
= CreateTextSelection(reo
);
2547 reo
->clientSite
= CreateOleClientSite(reo
);
2548 if (!reo
->clientSite
)
2550 ITextSelection_Release(&reo
->txtSel
->ITextSelection_iface
);
2554 TRACE("Created %p\n",reo
);
2555 list_init(&reo
->rangelist
);
2557 reo
->outer_unk
= outer_unk
;
2559 reo
->outer_unk
= &reo
->IUnknown_inner
;
2560 *ppvObj
= &reo
->IRichEditOle_iface
;
2565 static void convert_sizel(const ME_Context
*c
, const SIZEL
* szl
, SIZE
* sz
)
2567 /* sizel is in .01 millimeters, sz in pixels */
2568 sz
->cx
= MulDiv(szl
->cx
, c
->dpi
.cx
, 2540);
2569 sz
->cy
= MulDiv(szl
->cy
, c
->dpi
.cy
, 2540);
2572 /******************************************************************************
2573 * ME_GetOLEObjectSize
2575 * Sets run extent for OLE objects.
2577 void ME_GetOLEObjectSize(const ME_Context
*c
, ME_Run
*run
, SIZE
*pSize
)
2585 assert(run
->nFlags
& MERF_GRAPHICS
);
2586 assert(run
->ole_obj
);
2588 if (run
->ole_obj
->sizel
.cx
!= 0 || run
->ole_obj
->sizel
.cy
!= 0)
2590 convert_sizel(c
, &run
->ole_obj
->sizel
, pSize
);
2591 if (c
->editor
->nZoomNumerator
!= 0)
2593 pSize
->cx
= MulDiv(pSize
->cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2594 pSize
->cy
= MulDiv(pSize
->cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2599 if (IOleObject_QueryInterface(run
->ole_obj
->poleobj
, &IID_IDataObject
, (void**)&ido
) != S_OK
)
2601 FIXME("Query Interface IID_IDataObject failed!\n");
2602 pSize
->cx
= pSize
->cy
= 0;
2605 fmt
.cfFormat
= CF_BITMAP
;
2607 fmt
.dwAspect
= DVASPECT_CONTENT
;
2609 fmt
.tymed
= TYMED_GDI
;
2610 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
2612 fmt
.cfFormat
= CF_ENHMETAFILE
;
2613 fmt
.tymed
= TYMED_ENHMF
;
2614 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
2616 FIXME("unsupported format\n");
2617 pSize
->cx
= pSize
->cy
= 0;
2618 IDataObject_Release(ido
);
2626 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
2627 pSize
->cx
= dibsect
.dsBm
.bmWidth
;
2628 pSize
->cy
= dibsect
.dsBm
.bmHeight
;
2629 if (!stgm
.pUnkForRelease
) DeleteObject(stgm
.u
.hBitmap
);
2632 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
2633 pSize
->cx
= emh
.rclBounds
.right
- emh
.rclBounds
.left
;
2634 pSize
->cy
= emh
.rclBounds
.bottom
- emh
.rclBounds
.top
;
2635 if (!stgm
.pUnkForRelease
) DeleteEnhMetaFile(stgm
.u
.hEnhMetaFile
);
2638 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
2641 IDataObject_Release(ido
);
2642 if (c
->editor
->nZoomNumerator
!= 0)
2644 pSize
->cx
= MulDiv(pSize
->cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2645 pSize
->cy
= MulDiv(pSize
->cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2649 void ME_DrawOLE(ME_Context
*c
, int x
, int y
, ME_Run
*run
,
2650 ME_Paragraph
*para
, BOOL selected
)
2661 assert(run
->nFlags
& MERF_GRAPHICS
);
2662 assert(run
->ole_obj
);
2663 if (IOleObject_QueryInterface(run
->ole_obj
->poleobj
, &IID_IDataObject
, (void**)&ido
) != S_OK
)
2665 FIXME("Couldn't get interface\n");
2668 has_size
= run
->ole_obj
->sizel
.cx
!= 0 || run
->ole_obj
->sizel
.cy
!= 0;
2669 fmt
.cfFormat
= CF_BITMAP
;
2671 fmt
.dwAspect
= DVASPECT_CONTENT
;
2673 fmt
.tymed
= TYMED_GDI
;
2674 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
2676 fmt
.cfFormat
= CF_ENHMETAFILE
;
2677 fmt
.tymed
= TYMED_ENHMF
;
2678 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
2680 FIXME("Couldn't get storage medium\n");
2681 IDataObject_Release(ido
);
2688 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
2689 hMemDC
= CreateCompatibleDC(c
->hDC
);
2690 SelectObject(hMemDC
, stgm
.u
.hBitmap
);
2693 convert_sizel(c
, &run
->ole_obj
->sizel
, &sz
);
2695 sz
.cx
= MulDiv(dibsect
.dsBm
.bmWidth
, c
->dpi
.cx
, 96);
2696 sz
.cy
= MulDiv(dibsect
.dsBm
.bmHeight
, c
->dpi
.cy
, 96);
2698 if (c
->editor
->nZoomNumerator
!= 0)
2700 sz
.cx
= MulDiv(sz
.cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2701 sz
.cy
= MulDiv(sz
.cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2703 if (sz
.cx
== dibsect
.dsBm
.bmWidth
&& sz
.cy
== dibsect
.dsBm
.bmHeight
)
2705 BitBlt(c
->hDC
, x
, y
- sz
.cy
,
2706 dibsect
.dsBm
.bmWidth
, dibsect
.dsBm
.bmHeight
,
2707 hMemDC
, 0, 0, SRCCOPY
);
2709 StretchBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
,
2710 hMemDC
, 0, 0, dibsect
.dsBm
.bmWidth
,
2711 dibsect
.dsBm
.bmHeight
, SRCCOPY
);
2714 if (!stgm
.pUnkForRelease
) DeleteObject(stgm
.u
.hBitmap
);
2717 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
2720 convert_sizel(c
, &run
->ole_obj
->sizel
, &sz
);
2722 sz
.cy
= MulDiv(emh
.rclBounds
.bottom
- emh
.rclBounds
.top
, c
->dpi
.cx
, 96);
2723 sz
.cx
= MulDiv(emh
.rclBounds
.right
- emh
.rclBounds
.left
, c
->dpi
.cy
, 96);
2725 if (c
->editor
->nZoomNumerator
!= 0)
2727 sz
.cx
= MulDiv(sz
.cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2728 sz
.cy
= MulDiv(sz
.cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
2736 rc
.right
= x
+ sz
.cx
;
2738 PlayEnhMetaFile(c
->hDC
, stgm
.u
.hEnhMetaFile
, &rc
);
2740 if (!stgm
.pUnkForRelease
) DeleteEnhMetaFile(stgm
.u
.hEnhMetaFile
);
2743 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
2747 if (selected
&& !c
->editor
->bHideSelection
)
2748 PatBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
, DSTINVERT
);
2749 IDataObject_Release(ido
);
2752 void ME_DeleteReObject(REOBJECT
* reo
)
2754 if (reo
->poleobj
) IOleObject_Release(reo
->poleobj
);
2755 if (reo
->pstg
) IStorage_Release(reo
->pstg
);
2756 if (reo
->polesite
) IOleClientSite_Release(reo
->polesite
);
2760 void ME_CopyReObject(REOBJECT
* dst
, const REOBJECT
* src
)
2764 if (dst
->poleobj
) IOleObject_AddRef(dst
->poleobj
);
2765 if (dst
->pstg
) IStorage_AddRef(dst
->pstg
);
2766 if (dst
->polesite
) IOleClientSite_AddRef(dst
->polesite
);
2769 void ME_GetITextDocumentInterface(IRichEditOle
*iface
, LPVOID
*ppvObj
)
2771 IRichEditOleImpl
*This
= impl_from_IRichEditOle(iface
);
2772 *ppvObj
= &This
->ITextDocument_iface
;