msi: Fix several test failures in win9x.
[wine/multimedia.git] / dlls / riched20 / richole.c
blob9eabb04754d08c73955db8d8d47b80171006071d
1 /*
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
22 #include <stdarg.h>
24 #define NONAMELESSUNION
25 #define NONAMELESSSTRUCT
26 #define COBJMACROS
28 #include "windef.h"
29 #include "winbase.h"
30 #include "wingdi.h"
31 #include "winuser.h"
32 #include "ole2.h"
33 #include "richole.h"
34 #include "editor.h"
35 #include "tom.h"
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*/
42 /* FIXME: the next 6 lines should be in textserv.h */
43 #include "initguid.h"
44 #define TEXTSERV_GUID(name, l, w1, w2, b1, b2) \
45 DEFINE_GUID(name, l, w1, w2, b1, b2, 0x00, 0xaa, 0x00, 0x6c, 0xad, 0xc5)
47 TEXTSERV_GUID(IID_ITextServices, 0x8d33f740, 0xcf58, 0x11ce, 0xa8, 0x9d);
48 TEXTSERV_GUID(IID_ITextHost, 0xc5bdd8d0, 0xd26e, 0x11ce, 0xa8, 0x9e);
49 TEXTSERV_GUID(IID_ITextHost2, 0xc5bdd8d0, 0xd26e, 0x11ce, 0xa8, 0x9e);
50 DEFINE_GUID(IID_ITextDocument, 0x8cc497c0, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
51 DEFINE_GUID(IID_ITextRange, 0x8cc497c2, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
52 DEFINE_GUID(IID_ITextSelection, 0x8cc497c1, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
54 typedef struct ITextSelectionImpl ITextSelectionImpl;
56 typedef struct IRichEditOleImpl {
57 const IRichEditOleVtbl *lpRichEditOleVtbl;
58 const ITextDocumentVtbl *lpTextDocumentVtbl;
59 LONG ref;
61 ME_TextEditor *editor;
62 ITextSelectionImpl *txtSel;
63 } IRichEditOleImpl;
65 struct ITextSelectionImpl {
66 const ITextSelectionVtbl *lpVtbl;
67 LONG ref;
69 IRichEditOleImpl *reOle;
72 static inline IRichEditOleImpl *impl_from_IRichEditOle(IRichEditOle *iface)
74 return (IRichEditOleImpl *)((BYTE*)iface - FIELD_OFFSET(IRichEditOleImpl, lpRichEditOleVtbl));
77 static inline IRichEditOleImpl *impl_from_ITextDocument(ITextDocument *iface)
79 return (IRichEditOleImpl *)((BYTE*)iface - FIELD_OFFSET(IRichEditOleImpl, lpTextDocumentVtbl));
82 static HRESULT WINAPI
83 IRichEditOle_fnQueryInterface(IRichEditOle *me, REFIID riid, LPVOID *ppvObj)
85 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
87 TRACE("%p %s\n", This, debugstr_guid(riid) );
89 *ppvObj = NULL;
90 if (IsEqualGUID(riid, &IID_IUnknown) ||
91 IsEqualGUID(riid, &IID_IRichEditOle))
92 *ppvObj = &This->lpRichEditOleVtbl;
93 else if (IsEqualGUID(riid, &IID_ITextDocument))
94 *ppvObj = &This->lpTextDocumentVtbl;
95 if (*ppvObj)
97 IRichEditOle_AddRef(me);
98 return S_OK;
100 FIXME("%p: unhandled interface %s\n", This, debugstr_guid(riid) );
102 return E_NOINTERFACE;
105 static ULONG WINAPI
106 IRichEditOle_fnAddRef(IRichEditOle *me)
108 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
109 ULONG ref = InterlockedIncrement( &This->ref );
111 TRACE("%p ref = %u\n", This, ref);
113 return ref;
116 static ULONG WINAPI
117 IRichEditOle_fnRelease(IRichEditOle *me)
119 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
120 ULONG ref = InterlockedDecrement(&This->ref);
122 TRACE ("%p ref=%u\n", This, ref);
124 if (!ref)
126 TRACE ("Destroying %p\n", This);
127 This->txtSel->reOle = NULL;
128 ITextSelection_Release((ITextSelection *) This->txtSel);
129 heap_free(This);
131 return ref;
134 static HRESULT WINAPI
135 IRichEditOle_fnActivateAs(IRichEditOle *me, REFCLSID rclsid, REFCLSID rclsidAs)
137 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
138 FIXME("stub %p\n",This);
139 return E_NOTIMPL;
142 static HRESULT WINAPI
143 IRichEditOle_fnContextSensitiveHelp(IRichEditOle *me, BOOL fEnterMode)
145 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
146 FIXME("stub %p\n",This);
147 return E_NOTIMPL;
150 static HRESULT WINAPI
151 IRichEditOle_fnConvertObject(IRichEditOle *me, LONG iob,
152 REFCLSID rclsidNew, LPCSTR lpstrUserTypeNew)
154 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
155 FIXME("stub %p\n",This);
156 return E_NOTIMPL;
159 static HRESULT WINAPI
160 IRichEditOle_fnGetClientSite(IRichEditOle *me,
161 LPOLECLIENTSITE *lplpolesite)
163 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
164 FIXME("stub %p\n",This);
165 return E_NOTIMPL;
168 static HRESULT WINAPI
169 IRichEditOle_fnGetClipboardData(IRichEditOle *me, CHARRANGE *lpchrg,
170 DWORD reco, LPDATAOBJECT *lplpdataobj)
172 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
173 CHARRANGE tmpchrg;
175 TRACE("(%p,%p,%d)\n",This, lpchrg, reco);
176 if(!lplpdataobj)
177 return E_INVALIDARG;
178 if(!lpchrg) {
179 ME_GetSelection(This->editor, &tmpchrg.cpMin, &tmpchrg.cpMax);
180 lpchrg = &tmpchrg;
182 return ME_GetDataObject(This->editor, lpchrg, lplpdataobj);
185 static LONG WINAPI IRichEditOle_fnGetLinkCount(IRichEditOle *me)
187 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
188 FIXME("stub %p\n",This);
189 return E_NOTIMPL;
192 static HRESULT WINAPI
193 IRichEditOle_fnGetObject(IRichEditOle *me, LONG iob,
194 REOBJECT *lpreobject, DWORD dwFlags)
196 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
197 FIXME("stub %p\n",This);
198 return E_NOTIMPL;
201 static LONG WINAPI
202 IRichEditOle_fnGetObjectCount(IRichEditOle *me)
204 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
205 FIXME("stub %p\n",This);
206 return E_NOTIMPL;
209 static HRESULT WINAPI
210 IRichEditOle_fnHandsOffStorage(IRichEditOle *me, LONG iob)
212 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
213 FIXME("stub %p\n",This);
214 return E_NOTIMPL;
217 static HRESULT WINAPI
218 IRichEditOle_fnImportDataObject(IRichEditOle *me, LPDATAOBJECT lpdataobj,
219 CLIPFORMAT cf, HGLOBAL hMetaPict)
221 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
222 FIXME("stub %p\n",This);
223 return E_NOTIMPL;
226 static HRESULT WINAPI
227 IRichEditOle_fnInPlaceDeactivate(IRichEditOle *me)
229 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
230 FIXME("stub %p\n",This);
231 return E_NOTIMPL;
234 static HRESULT WINAPI
235 IRichEditOle_fnInsertObject(IRichEditOle *me, REOBJECT *reo)
237 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
238 TRACE("(%p,%p)\n", This, reo);
240 if (reo->cbStruct < sizeof(*reo)) return STG_E_INVALIDPARAMETER;
241 if (reo->poleobj) IOleObject_AddRef(reo->poleobj);
242 if (reo->pstg) IStorage_AddRef(reo->pstg);
243 if (reo->polesite) IOleClientSite_AddRef(reo->polesite);
245 ME_InsertOLEFromCursor(This->editor, reo, 0);
246 return S_OK;
249 static HRESULT WINAPI IRichEditOle_fnSaveCompleted(IRichEditOle *me, LONG iob,
250 LPSTORAGE lpstg)
252 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
253 FIXME("stub %p\n",This);
254 return E_NOTIMPL;
257 static HRESULT WINAPI
258 IRichEditOle_fnSetDvaspect(IRichEditOle *me, LONG iob, DWORD dvaspect)
260 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
261 FIXME("stub %p\n",This);
262 return E_NOTIMPL;
265 static HRESULT WINAPI IRichEditOle_fnSetHostNames(IRichEditOle *me,
266 LPCSTR lpstrContainerApp, LPCSTR lpstrContainerObj)
268 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
269 FIXME("stub %p %s %s\n",This, lpstrContainerApp, lpstrContainerObj);
270 return E_NOTIMPL;
273 static HRESULT WINAPI
274 IRichEditOle_fnSetLinkAvailable(IRichEditOle *me, LONG iob, BOOL fAvailable)
276 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
277 FIXME("stub %p\n",This);
278 return E_NOTIMPL;
281 static const IRichEditOleVtbl revt = {
282 IRichEditOle_fnQueryInterface,
283 IRichEditOle_fnAddRef,
284 IRichEditOle_fnRelease,
285 IRichEditOle_fnGetClientSite,
286 IRichEditOle_fnGetObjectCount,
287 IRichEditOle_fnGetLinkCount,
288 IRichEditOle_fnGetObject,
289 IRichEditOle_fnInsertObject,
290 IRichEditOle_fnConvertObject,
291 IRichEditOle_fnActivateAs,
292 IRichEditOle_fnSetHostNames,
293 IRichEditOle_fnSetLinkAvailable,
294 IRichEditOle_fnSetDvaspect,
295 IRichEditOle_fnHandsOffStorage,
296 IRichEditOle_fnSaveCompleted,
297 IRichEditOle_fnInPlaceDeactivate,
298 IRichEditOle_fnContextSensitiveHelp,
299 IRichEditOle_fnGetClipboardData,
300 IRichEditOle_fnImportDataObject
303 static HRESULT WINAPI
304 ITextDocument_fnQueryInterface(ITextDocument* me, REFIID riid,
305 void** ppvObject)
307 IRichEditOleImpl *This = impl_from_ITextDocument(me);
308 return IRichEditOle_fnQueryInterface((IRichEditOle*)&This->lpRichEditOleVtbl,
309 riid, ppvObject);
312 static ULONG WINAPI
313 ITextDocument_fnAddRef(ITextDocument* me)
315 IRichEditOleImpl *This = impl_from_ITextDocument(me);
316 return IRichEditOle_fnAddRef((IRichEditOle*)&This->lpRichEditOleVtbl);
319 static ULONG WINAPI
320 ITextDocument_fnRelease(ITextDocument* me)
322 IRichEditOleImpl *This = impl_from_ITextDocument(me);
323 return IRichEditOle_fnRelease((IRichEditOle*)&This->lpRichEditOleVtbl);
326 static HRESULT WINAPI
327 ITextDocument_fnGetTypeInfoCount(ITextDocument* me,
328 UINT* pctinfo)
330 IRichEditOleImpl *This = impl_from_ITextDocument(me);
331 FIXME("stub %p\n",This);
332 return E_NOTIMPL;
335 static HRESULT WINAPI
336 ITextDocument_fnGetTypeInfo(ITextDocument* me, UINT iTInfo, LCID lcid,
337 ITypeInfo** ppTInfo)
339 IRichEditOleImpl *This = impl_from_ITextDocument(me);
340 FIXME("stub %p\n",This);
341 return E_NOTIMPL;
344 static HRESULT WINAPI
345 ITextDocument_fnGetIDsOfNames(ITextDocument* me, REFIID riid,
346 LPOLESTR* rgszNames, UINT cNames, LCID lcid, DISPID* rgDispId)
348 IRichEditOleImpl *This = impl_from_ITextDocument(me);
349 FIXME("stub %p\n",This);
350 return E_NOTIMPL;
353 static HRESULT WINAPI
354 ITextDocument_fnInvoke(ITextDocument* me, DISPID dispIdMember,
355 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams,
356 VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr)
358 IRichEditOleImpl *This = impl_from_ITextDocument(me);
359 FIXME("stub %p\n",This);
360 return E_NOTIMPL;
363 static HRESULT WINAPI
364 ITextDocument_fnGetName(ITextDocument* me, BSTR* pName)
366 IRichEditOleImpl *This = impl_from_ITextDocument(me);
367 FIXME("stub %p\n",This);
368 return E_NOTIMPL;
371 static HRESULT WINAPI
372 ITextDocument_fnGetSelection(ITextDocument* me, ITextSelection** ppSel)
374 IRichEditOleImpl *This = impl_from_ITextDocument(me);
375 TRACE("(%p)\n", me);
376 *ppSel = (ITextSelection *) This->txtSel;
377 ITextSelection_AddRef(*ppSel);
378 return S_OK;
381 static HRESULT WINAPI
382 ITextDocument_fnGetStoryCount(ITextDocument* me, long* pCount)
384 IRichEditOleImpl *This = impl_from_ITextDocument(me);
385 FIXME("stub %p\n",This);
386 return E_NOTIMPL;
389 static HRESULT WINAPI
390 ITextDocument_fnGetStoryRanges(ITextDocument* me,
391 ITextStoryRanges** ppStories)
393 IRichEditOleImpl *This = impl_from_ITextDocument(me);
394 FIXME("stub %p\n",This);
395 return E_NOTIMPL;
398 static HRESULT WINAPI
399 ITextDocument_fnGetSaved(ITextDocument* me, long* pValue)
401 IRichEditOleImpl *This = impl_from_ITextDocument(me);
402 FIXME("stub %p\n",This);
403 return E_NOTIMPL;
406 static HRESULT WINAPI
407 ITextDocument_fnSetSaved(ITextDocument* me, long Value)
409 IRichEditOleImpl *This = impl_from_ITextDocument(me);
410 FIXME("stub %p\n",This);
411 return E_NOTIMPL;
414 static HRESULT WINAPI
415 ITextDocument_fnGetDefaultTabStop(ITextDocument* me, float* pValue)
417 IRichEditOleImpl *This = impl_from_ITextDocument(me);
418 FIXME("stub %p\n",This);
419 return E_NOTIMPL;
422 static HRESULT WINAPI
423 ITextDocument_fnSetDefaultTabStop(ITextDocument* me, float Value)
425 IRichEditOleImpl *This = impl_from_ITextDocument(me);
426 FIXME("stub %p\n",This);
427 return E_NOTIMPL;
430 static HRESULT WINAPI
431 ITextDocument_fnNew(ITextDocument* me)
433 IRichEditOleImpl *This = impl_from_ITextDocument(me);
434 FIXME("stub %p\n",This);
435 return E_NOTIMPL;
438 static HRESULT WINAPI
439 ITextDocument_fnOpen(ITextDocument* me, VARIANT* pVar, long Flags,
440 long CodePage)
442 IRichEditOleImpl *This = impl_from_ITextDocument(me);
443 FIXME("stub %p\n",This);
444 return E_NOTIMPL;
447 static HRESULT WINAPI
448 ITextDocument_fnSave(ITextDocument* me, VARIANT* pVar, long Flags,
449 long CodePage)
451 IRichEditOleImpl *This = impl_from_ITextDocument(me);
452 FIXME("stub %p\n",This);
453 return E_NOTIMPL;
456 static HRESULT WINAPI
457 ITextDocument_fnFreeze(ITextDocument* me, long* pCount)
459 IRichEditOleImpl *This = impl_from_ITextDocument(me);
460 FIXME("stub %p\n",This);
461 return E_NOTIMPL;
464 static HRESULT WINAPI
465 ITextDocument_fnUnfreeze(ITextDocument* me, long* pCount)
467 IRichEditOleImpl *This = impl_from_ITextDocument(me);
468 FIXME("stub %p\n",This);
469 return E_NOTIMPL;
472 static HRESULT WINAPI
473 ITextDocument_fnBeginEditCollection(ITextDocument* me)
475 IRichEditOleImpl *This = impl_from_ITextDocument(me);
476 FIXME("stub %p\n",This);
477 return E_NOTIMPL;
480 static HRESULT WINAPI
481 ITextDocument_fnEndEditCollection(ITextDocument* me)
483 IRichEditOleImpl *This = impl_from_ITextDocument(me);
484 FIXME("stub %p\n",This);
485 return E_NOTIMPL;
488 static HRESULT WINAPI
489 ITextDocument_fnUndo(ITextDocument* me, long Count, long* prop)
491 IRichEditOleImpl *This = impl_from_ITextDocument(me);
492 FIXME("stub %p\n",This);
493 return E_NOTIMPL;
496 static HRESULT WINAPI
497 ITextDocument_fnRedo(ITextDocument* me, long Count, long* prop)
499 IRichEditOleImpl *This = impl_from_ITextDocument(me);
500 FIXME("stub %p\n",This);
501 return E_NOTIMPL;
504 static HRESULT WINAPI
505 ITextDocument_fnRange(ITextDocument* me, long cp1, long cp2,
506 ITextRange** ppRange)
508 IRichEditOleImpl *This = impl_from_ITextDocument(me);
509 FIXME("stub %p\n",This);
510 return E_NOTIMPL;
513 static HRESULT WINAPI
514 ITextDocument_fnRangeFromPoint(ITextDocument* me, long x, long y,
515 ITextRange** ppRange)
517 IRichEditOleImpl *This = impl_from_ITextDocument(me);
518 FIXME("stub %p\n",This);
519 return E_NOTIMPL;
522 static const ITextDocumentVtbl tdvt = {
523 ITextDocument_fnQueryInterface,
524 ITextDocument_fnAddRef,
525 ITextDocument_fnRelease,
526 ITextDocument_fnGetTypeInfoCount,
527 ITextDocument_fnGetTypeInfo,
528 ITextDocument_fnGetIDsOfNames,
529 ITextDocument_fnInvoke,
530 ITextDocument_fnGetName,
531 ITextDocument_fnGetSelection,
532 ITextDocument_fnGetStoryCount,
533 ITextDocument_fnGetStoryRanges,
534 ITextDocument_fnGetSaved,
535 ITextDocument_fnSetSaved,
536 ITextDocument_fnGetDefaultTabStop,
537 ITextDocument_fnSetDefaultTabStop,
538 ITextDocument_fnNew,
539 ITextDocument_fnOpen,
540 ITextDocument_fnSave,
541 ITextDocument_fnFreeze,
542 ITextDocument_fnUnfreeze,
543 ITextDocument_fnBeginEditCollection,
544 ITextDocument_fnEndEditCollection,
545 ITextDocument_fnUndo,
546 ITextDocument_fnRedo,
547 ITextDocument_fnRange,
548 ITextDocument_fnRangeFromPoint
551 static HRESULT WINAPI ITextSelection_fnQueryInterface(
552 ITextSelection *me,
553 REFIID riid,
554 void **ppvObj)
556 *ppvObj = NULL;
557 if (IsEqualGUID(riid, &IID_IUnknown)
558 || IsEqualGUID(riid, &IID_IDispatch)
559 || IsEqualGUID(riid, &IID_ITextRange)
560 || IsEqualGUID(riid, &IID_ITextSelection))
562 *ppvObj = me;
563 ITextSelection_AddRef(me);
564 return S_OK;
567 return E_NOINTERFACE;
570 static ULONG WINAPI ITextSelection_fnAddRef(
571 ITextSelection *me)
573 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
574 return InterlockedIncrement(&This->ref);
577 static ULONG WINAPI ITextSelection_fnRelease(
578 ITextSelection *me)
580 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
581 ULONG ref = InterlockedDecrement(&This->ref);
582 if (ref == 0)
583 heap_free(This);
584 return ref;
587 static HRESULT WINAPI ITextSelection_fnGetTypeInfoCount(
588 ITextSelection *me,
589 UINT *pctinfo)
591 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
592 if (!This->reOle)
593 return CO_E_RELEASED;
595 FIXME("not implemented\n");
596 return E_NOTIMPL;
599 static HRESULT WINAPI ITextSelection_fnGetTypeInfo(
600 ITextSelection *me,
601 UINT iTInfo,
602 LCID lcid,
603 ITypeInfo **ppTInfo)
605 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
606 if (!This->reOle)
607 return CO_E_RELEASED;
609 FIXME("not implemented\n");
610 return E_NOTIMPL;
613 static HRESULT WINAPI ITextSelection_fnGetIDsOfNames(
614 ITextSelection *me,
615 REFIID riid,
616 LPOLESTR *rgszNames,
617 UINT cNames,
618 LCID lcid,
619 DISPID *rgDispId)
621 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
622 if (!This->reOle)
623 return CO_E_RELEASED;
625 FIXME("not implemented\n");
626 return E_NOTIMPL;
629 static HRESULT WINAPI ITextSelection_fnInvoke(
630 ITextSelection *me,
631 DISPID dispIdMember,
632 REFIID riid,
633 LCID lcid,
634 WORD wFlags,
635 DISPPARAMS *pDispParams,
636 VARIANT *pVarResult,
637 EXCEPINFO *pExcepInfo,
638 UINT *puArgErr)
640 FIXME("not implemented\n");
641 return E_NOTIMPL;
644 /*** ITextRange methods ***/
645 static HRESULT WINAPI ITextSelection_fnGetText(
646 ITextSelection *me,
647 BSTR *pbstr)
649 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
650 if (!This->reOle)
651 return CO_E_RELEASED;
653 FIXME("not implemented\n");
654 return E_NOTIMPL;
657 static HRESULT WINAPI ITextSelection_fnSetText(
658 ITextSelection *me,
659 BSTR bstr)
661 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
662 if (!This->reOle)
663 return CO_E_RELEASED;
665 FIXME("not implemented\n");
666 return E_NOTIMPL;
669 static HRESULT WINAPI ITextSelection_fnGetChar(
670 ITextSelection *me,
671 long *pch)
673 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
674 if (!This->reOle)
675 return CO_E_RELEASED;
677 FIXME("not implemented\n");
678 return E_NOTIMPL;
681 static HRESULT WINAPI ITextSelection_fnSetChar(
682 ITextSelection *me,
683 long ch)
685 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
686 if (!This->reOle)
687 return CO_E_RELEASED;
689 FIXME("not implemented\n");
690 return E_NOTIMPL;
693 static HRESULT WINAPI ITextSelection_fnGetDuplicate(
694 ITextSelection *me,
695 ITextRange **ppRange)
697 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
698 if (!This->reOle)
699 return CO_E_RELEASED;
701 FIXME("not implemented\n");
702 return E_NOTIMPL;
705 static HRESULT WINAPI ITextSelection_fnGetFormattedText(
706 ITextSelection *me,
707 ITextRange **ppRange)
709 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
710 if (!This->reOle)
711 return CO_E_RELEASED;
713 FIXME("not implemented\n");
714 return E_NOTIMPL;
717 static HRESULT WINAPI ITextSelection_fnSetFormattedText(
718 ITextSelection *me,
719 ITextRange *pRange)
721 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
722 if (!This->reOle)
723 return CO_E_RELEASED;
725 FIXME("not implemented\n");
726 return E_NOTIMPL;
729 static HRESULT WINAPI ITextSelection_fnGetStart(
730 ITextSelection *me,
731 long *pcpFirst)
733 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
734 if (!This->reOle)
735 return CO_E_RELEASED;
737 FIXME("not implemented\n");
738 return E_NOTIMPL;
741 static HRESULT WINAPI ITextSelection_fnSetStart(
742 ITextSelection *me,
743 long cpFirst)
745 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
746 if (!This->reOle)
747 return CO_E_RELEASED;
749 FIXME("not implemented\n");
750 return E_NOTIMPL;
753 static HRESULT WINAPI ITextSelection_fnGetEnd(
754 ITextSelection *me,
755 long *pcpLim)
757 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
758 if (!This->reOle)
759 return CO_E_RELEASED;
761 FIXME("not implemented\n");
762 return E_NOTIMPL;
765 static HRESULT WINAPI ITextSelection_fnSetEnd(
766 ITextSelection *me,
767 long cpLim)
769 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
770 if (!This->reOle)
771 return CO_E_RELEASED;
773 FIXME("not implemented\n");
774 return E_NOTIMPL;
777 static HRESULT WINAPI ITextSelection_fnGetFont(
778 ITextSelection *me,
779 ITextFont **pFont)
781 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
782 if (!This->reOle)
783 return CO_E_RELEASED;
785 FIXME("not implemented\n");
786 return E_NOTIMPL;
789 static HRESULT WINAPI ITextSelection_fnSetFont(
790 ITextSelection *me,
791 ITextFont *pFont)
793 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
794 if (!This->reOle)
795 return CO_E_RELEASED;
797 FIXME("not implemented\n");
798 return E_NOTIMPL;
801 static HRESULT WINAPI ITextSelection_fnGetPara(
802 ITextSelection *me,
803 ITextPara **ppPara)
805 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
806 if (!This->reOle)
807 return CO_E_RELEASED;
809 FIXME("not implemented\n");
810 return E_NOTIMPL;
813 static HRESULT WINAPI ITextSelection_fnSetPara(
814 ITextSelection *me,
815 ITextPara *pPara)
817 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
818 if (!This->reOle)
819 return CO_E_RELEASED;
821 FIXME("not implemented\n");
822 return E_NOTIMPL;
825 static HRESULT WINAPI ITextSelection_fnGetStoryLength(
826 ITextSelection *me,
827 long *pcch)
829 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
830 if (!This->reOle)
831 return CO_E_RELEASED;
833 FIXME("not implemented\n");
834 return E_NOTIMPL;
837 static HRESULT WINAPI ITextSelection_fnGetStoryType(
838 ITextSelection *me,
839 long *pValue)
841 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
842 if (!This->reOle)
843 return CO_E_RELEASED;
845 FIXME("not implemented\n");
846 return E_NOTIMPL;
849 static HRESULT WINAPI ITextSelection_fnCollapse(
850 ITextSelection *me,
851 long bStart)
853 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
854 if (!This->reOle)
855 return CO_E_RELEASED;
857 FIXME("not implemented\n");
858 return E_NOTIMPL;
861 static HRESULT WINAPI ITextSelection_fnExpand(
862 ITextSelection *me,
863 long Unit,
864 long *pDelta)
866 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
867 if (!This->reOle)
868 return CO_E_RELEASED;
870 FIXME("not implemented\n");
871 return E_NOTIMPL;
874 static HRESULT WINAPI ITextSelection_fnGetIndex(
875 ITextSelection *me,
876 long Unit,
877 long *pIndex)
879 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
880 if (!This->reOle)
881 return CO_E_RELEASED;
883 FIXME("not implemented\n");
884 return E_NOTIMPL;
887 static HRESULT WINAPI ITextSelection_fnSetIndex(
888 ITextSelection *me,
889 long Unit,
890 long Index,
891 long Extend)
893 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
894 if (!This->reOle)
895 return CO_E_RELEASED;
897 FIXME("not implemented\n");
898 return E_NOTIMPL;
901 static HRESULT WINAPI ITextSelection_fnSetRange(
902 ITextSelection *me,
903 long cpActive,
904 long cpOther)
906 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
907 if (!This->reOle)
908 return CO_E_RELEASED;
910 FIXME("not implemented\n");
911 return E_NOTIMPL;
914 static HRESULT WINAPI ITextSelection_fnInRange(
915 ITextSelection *me,
916 ITextRange *pRange,
917 long *pb)
919 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
920 if (!This->reOle)
921 return CO_E_RELEASED;
923 FIXME("not implemented\n");
924 return E_NOTIMPL;
927 static HRESULT WINAPI ITextSelection_fnInStory(
928 ITextSelection *me,
929 ITextRange *pRange,
930 long *pb)
932 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
933 if (!This->reOle)
934 return CO_E_RELEASED;
936 FIXME("not implemented\n");
937 return E_NOTIMPL;
940 static HRESULT WINAPI ITextSelection_fnIsEqual(
941 ITextSelection *me,
942 ITextRange *pRange,
943 long *pb)
945 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
946 if (!This->reOle)
947 return CO_E_RELEASED;
949 FIXME("not implemented\n");
950 return E_NOTIMPL;
953 static HRESULT WINAPI ITextSelection_fnSelect(
954 ITextSelection *me)
956 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
957 if (!This->reOle)
958 return CO_E_RELEASED;
960 FIXME("not implemented\n");
961 return E_NOTIMPL;
964 static HRESULT WINAPI ITextSelection_fnStartOf(
965 ITextSelection *me,
966 long Unit,
967 long Extend,
968 long *pDelta)
970 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
971 if (!This->reOle)
972 return CO_E_RELEASED;
974 FIXME("not implemented\n");
975 return E_NOTIMPL;
978 static HRESULT WINAPI ITextSelection_fnEndOf(
979 ITextSelection *me,
980 long Unit,
981 long Extend,
982 long *pDelta)
984 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
985 if (!This->reOle)
986 return CO_E_RELEASED;
988 FIXME("not implemented\n");
989 return E_NOTIMPL;
992 static HRESULT WINAPI ITextSelection_fnMove(
993 ITextSelection *me,
994 long Unit,
995 long Count,
996 long *pDelta)
998 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
999 if (!This->reOle)
1000 return CO_E_RELEASED;
1002 FIXME("not implemented\n");
1003 return E_NOTIMPL;
1006 static HRESULT WINAPI ITextSelection_fnMoveStart(
1007 ITextSelection *me,
1008 long Unit,
1009 long Count,
1010 long *pDelta)
1012 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1013 if (!This->reOle)
1014 return CO_E_RELEASED;
1016 FIXME("not implemented\n");
1017 return E_NOTIMPL;
1020 static HRESULT WINAPI ITextSelection_fnMoveEnd(
1021 ITextSelection *me,
1022 long Unit,
1023 long Count,
1024 long *pDelta)
1026 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1027 if (!This->reOle)
1028 return CO_E_RELEASED;
1030 FIXME("not implemented\n");
1031 return E_NOTIMPL;
1034 static HRESULT WINAPI ITextSelection_fnMoveWhile(
1035 ITextSelection *me,
1036 VARIANT *Cset,
1037 long Count,
1038 long *pDelta)
1040 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1041 if (!This->reOle)
1042 return CO_E_RELEASED;
1044 FIXME("not implemented\n");
1045 return E_NOTIMPL;
1048 static HRESULT WINAPI ITextSelection_fnMoveStartWhile(
1049 ITextSelection *me,
1050 VARIANT *Cset,
1051 long Count,
1052 long *pDelta)
1054 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1055 if (!This->reOle)
1056 return CO_E_RELEASED;
1058 FIXME("not implemented\n");
1059 return E_NOTIMPL;
1062 static HRESULT WINAPI ITextSelection_fnMoveEndWhile(
1063 ITextSelection *me,
1064 VARIANT *Cset,
1065 long Count,
1066 long *pDelta)
1068 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1069 if (!This->reOle)
1070 return CO_E_RELEASED;
1072 FIXME("not implemented\n");
1073 return E_NOTIMPL;
1076 static HRESULT WINAPI ITextSelection_fnMoveUntil(
1077 ITextSelection *me,
1078 VARIANT *Cset,
1079 long Count,
1080 long *pDelta)
1082 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1083 if (!This->reOle)
1084 return CO_E_RELEASED;
1086 FIXME("not implemented\n");
1087 return E_NOTIMPL;
1090 static HRESULT WINAPI ITextSelection_fnMoveStartUntil(
1091 ITextSelection *me,
1092 VARIANT *Cset,
1093 long Count,
1094 long *pDelta)
1096 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1097 if (!This->reOle)
1098 return CO_E_RELEASED;
1100 FIXME("not implemented\n");
1101 return E_NOTIMPL;
1104 static HRESULT WINAPI ITextSelection_fnMoveEndUntil(
1105 ITextSelection *me,
1106 VARIANT *Cset,
1107 long Count,
1108 long *pDelta)
1110 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1111 if (!This->reOle)
1112 return CO_E_RELEASED;
1114 FIXME("not implemented\n");
1115 return E_NOTIMPL;
1118 static HRESULT WINAPI ITextSelection_fnFindText(
1119 ITextSelection *me,
1120 BSTR bstr,
1121 long cch,
1122 long Flags,
1123 long *pLength)
1125 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1126 if (!This->reOle)
1127 return CO_E_RELEASED;
1129 FIXME("not implemented\n");
1130 return E_NOTIMPL;
1133 static HRESULT WINAPI ITextSelection_fnFindTextStart(
1134 ITextSelection *me,
1135 BSTR bstr,
1136 long cch,
1137 long Flags,
1138 long *pLength)
1140 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1141 if (!This->reOle)
1142 return CO_E_RELEASED;
1144 FIXME("not implemented\n");
1145 return E_NOTIMPL;
1148 static HRESULT WINAPI ITextSelection_fnFindTextEnd(
1149 ITextSelection *me,
1150 BSTR bstr,
1151 long cch,
1152 long Flags,
1153 long *pLength)
1155 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1156 if (!This->reOle)
1157 return CO_E_RELEASED;
1159 FIXME("not implemented\n");
1160 return E_NOTIMPL;
1163 static HRESULT WINAPI ITextSelection_fnDelete(
1164 ITextSelection *me,
1165 long Unit,
1166 long Count,
1167 long *pDelta)
1169 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1170 if (!This->reOle)
1171 return CO_E_RELEASED;
1173 FIXME("not implemented\n");
1174 return E_NOTIMPL;
1177 static HRESULT WINAPI ITextSelection_fnCut(
1178 ITextSelection *me,
1179 VARIANT *pVar)
1181 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1182 if (!This->reOle)
1183 return CO_E_RELEASED;
1185 FIXME("not implemented\n");
1186 return E_NOTIMPL;
1189 static HRESULT WINAPI ITextSelection_fnCopy(
1190 ITextSelection *me,
1191 VARIANT *pVar)
1193 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1194 if (!This->reOle)
1195 return CO_E_RELEASED;
1197 FIXME("not implemented\n");
1198 return E_NOTIMPL;
1201 static HRESULT WINAPI ITextSelection_fnPaste(
1202 ITextSelection *me,
1203 VARIANT *pVar,
1204 long Format)
1206 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1207 if (!This->reOle)
1208 return CO_E_RELEASED;
1210 FIXME("not implemented\n");
1211 return E_NOTIMPL;
1214 static HRESULT WINAPI ITextSelection_fnCanPaste(
1215 ITextSelection *me,
1216 VARIANT *pVar,
1217 long Format,
1218 long *pb)
1220 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1221 if (!This->reOle)
1222 return CO_E_RELEASED;
1224 FIXME("not implemented\n");
1225 return E_NOTIMPL;
1228 static HRESULT WINAPI ITextSelection_fnCanEdit(
1229 ITextSelection *me,
1230 long *pb)
1232 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1233 if (!This->reOle)
1234 return CO_E_RELEASED;
1236 FIXME("not implemented\n");
1237 return E_NOTIMPL;
1240 static HRESULT WINAPI ITextSelection_fnChangeCase(
1241 ITextSelection *me,
1242 long Type)
1244 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1245 if (!This->reOle)
1246 return CO_E_RELEASED;
1248 FIXME("not implemented\n");
1249 return E_NOTIMPL;
1252 static HRESULT WINAPI ITextSelection_fnGetPoint(
1253 ITextSelection *me,
1254 long Type,
1255 long *cx,
1256 long *cy)
1258 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1259 if (!This->reOle)
1260 return CO_E_RELEASED;
1262 FIXME("not implemented\n");
1263 return E_NOTIMPL;
1266 static HRESULT WINAPI ITextSelection_fnSetPoint(
1267 ITextSelection *me,
1268 long x,
1269 long y,
1270 long Type,
1271 long Extend)
1273 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1274 if (!This->reOle)
1275 return CO_E_RELEASED;
1277 FIXME("not implemented\n");
1278 return E_NOTIMPL;
1281 static HRESULT WINAPI ITextSelection_fnScrollIntoView(
1282 ITextSelection *me,
1283 long Value)
1285 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1286 if (!This->reOle)
1287 return CO_E_RELEASED;
1289 FIXME("not implemented\n");
1290 return E_NOTIMPL;
1293 static HRESULT WINAPI ITextSelection_fnGetEmbeddedObject(
1294 ITextSelection *me,
1295 IUnknown **ppv)
1297 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1298 if (!This->reOle)
1299 return CO_E_RELEASED;
1301 FIXME("not implemented\n");
1302 return E_NOTIMPL;
1305 /*** ITextSelection methods ***/
1306 static HRESULT WINAPI ITextSelection_fnGetFlags(
1307 ITextSelection *me,
1308 long *pFlags)
1310 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1311 if (!This->reOle)
1312 return CO_E_RELEASED;
1314 FIXME("not implemented\n");
1315 return E_NOTIMPL;
1318 static HRESULT WINAPI ITextSelection_fnSetFlags(
1319 ITextSelection *me,
1320 long Flags)
1322 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1323 if (!This->reOle)
1324 return CO_E_RELEASED;
1326 FIXME("not implemented\n");
1327 return E_NOTIMPL;
1330 static HRESULT WINAPI ITextSelection_fnGetType(
1331 ITextSelection *me,
1332 long *pType)
1334 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1335 if (!This->reOle)
1336 return CO_E_RELEASED;
1338 FIXME("not implemented\n");
1339 return E_NOTIMPL;
1342 static HRESULT WINAPI ITextSelection_fnMoveLeft(
1343 ITextSelection *me,
1344 long Unit,
1345 long Count,
1346 long Extend,
1347 long *pDelta)
1349 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1350 if (!This->reOle)
1351 return CO_E_RELEASED;
1353 FIXME("not implemented\n");
1354 return E_NOTIMPL;
1357 static HRESULT WINAPI ITextSelection_fnMoveRight(
1358 ITextSelection *me,
1359 long Unit,
1360 long Count,
1361 long Extend,
1362 long *pDelta)
1364 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1365 if (!This->reOle)
1366 return CO_E_RELEASED;
1368 FIXME("not implemented\n");
1369 return E_NOTIMPL;
1372 static HRESULT WINAPI ITextSelection_fnMoveUp(
1373 ITextSelection *me,
1374 long Unit,
1375 long Count,
1376 long Extend,
1377 long *pDelta)
1379 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1380 if (!This->reOle)
1381 return CO_E_RELEASED;
1383 FIXME("not implemented\n");
1384 return E_NOTIMPL;
1387 static HRESULT WINAPI ITextSelection_fnMoveDown(
1388 ITextSelection *me,
1389 long Unit,
1390 long Count,
1391 long Extend,
1392 long *pDelta)
1394 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1395 if (!This->reOle)
1396 return CO_E_RELEASED;
1398 FIXME("not implemented\n");
1399 return E_NOTIMPL;
1402 static HRESULT WINAPI ITextSelection_fnHomeKey(
1403 ITextSelection *me,
1404 long Unit,
1405 long Extend,
1406 long *pDelta)
1408 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1409 if (!This->reOle)
1410 return CO_E_RELEASED;
1412 FIXME("not implemented\n");
1413 return E_NOTIMPL;
1416 static HRESULT WINAPI ITextSelection_fnEndKey(
1417 ITextSelection *me,
1418 long Unit,
1419 long Extend,
1420 long *pDelta)
1422 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1423 if (!This->reOle)
1424 return CO_E_RELEASED;
1426 FIXME("not implemented\n");
1427 return E_NOTIMPL;
1430 static HRESULT WINAPI ITextSelection_fnTypeText(
1431 ITextSelection *me,
1432 BSTR bstr)
1434 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1435 if (!This->reOle)
1436 return CO_E_RELEASED;
1438 FIXME("not implemented\n");
1439 return E_NOTIMPL;
1442 static const ITextSelectionVtbl tsvt = {
1443 ITextSelection_fnQueryInterface,
1444 ITextSelection_fnAddRef,
1445 ITextSelection_fnRelease,
1446 ITextSelection_fnGetTypeInfoCount,
1447 ITextSelection_fnGetTypeInfo,
1448 ITextSelection_fnGetIDsOfNames,
1449 ITextSelection_fnInvoke,
1450 ITextSelection_fnGetText,
1451 ITextSelection_fnSetText,
1452 ITextSelection_fnGetChar,
1453 ITextSelection_fnSetChar,
1454 ITextSelection_fnGetDuplicate,
1455 ITextSelection_fnGetFormattedText,
1456 ITextSelection_fnSetFormattedText,
1457 ITextSelection_fnGetStart,
1458 ITextSelection_fnSetStart,
1459 ITextSelection_fnGetEnd,
1460 ITextSelection_fnSetEnd,
1461 ITextSelection_fnGetFont,
1462 ITextSelection_fnSetFont,
1463 ITextSelection_fnGetPara,
1464 ITextSelection_fnSetPara,
1465 ITextSelection_fnGetStoryLength,
1466 ITextSelection_fnGetStoryType,
1467 ITextSelection_fnCollapse,
1468 ITextSelection_fnExpand,
1469 ITextSelection_fnGetIndex,
1470 ITextSelection_fnSetIndex,
1471 ITextSelection_fnSetRange,
1472 ITextSelection_fnInRange,
1473 ITextSelection_fnInStory,
1474 ITextSelection_fnIsEqual,
1475 ITextSelection_fnSelect,
1476 ITextSelection_fnStartOf,
1477 ITextSelection_fnEndOf,
1478 ITextSelection_fnMove,
1479 ITextSelection_fnMoveStart,
1480 ITextSelection_fnMoveEnd,
1481 ITextSelection_fnMoveWhile,
1482 ITextSelection_fnMoveStartWhile,
1483 ITextSelection_fnMoveEndWhile,
1484 ITextSelection_fnMoveUntil,
1485 ITextSelection_fnMoveStartUntil,
1486 ITextSelection_fnMoveEndUntil,
1487 ITextSelection_fnFindText,
1488 ITextSelection_fnFindTextStart,
1489 ITextSelection_fnFindTextEnd,
1490 ITextSelection_fnDelete,
1491 ITextSelection_fnCut,
1492 ITextSelection_fnCopy,
1493 ITextSelection_fnPaste,
1494 ITextSelection_fnCanPaste,
1495 ITextSelection_fnCanEdit,
1496 ITextSelection_fnChangeCase,
1497 ITextSelection_fnGetPoint,
1498 ITextSelection_fnSetPoint,
1499 ITextSelection_fnScrollIntoView,
1500 ITextSelection_fnGetEmbeddedObject,
1501 ITextSelection_fnGetFlags,
1502 ITextSelection_fnSetFlags,
1503 ITextSelection_fnGetType,
1504 ITextSelection_fnMoveLeft,
1505 ITextSelection_fnMoveRight,
1506 ITextSelection_fnMoveUp,
1507 ITextSelection_fnMoveDown,
1508 ITextSelection_fnHomeKey,
1509 ITextSelection_fnEndKey,
1510 ITextSelection_fnTypeText
1513 static ITextSelectionImpl *
1514 CreateTextSelection(IRichEditOleImpl *reOle)
1516 ITextSelectionImpl *txtSel = heap_alloc(sizeof *txtSel);
1517 if (!txtSel)
1518 return NULL;
1520 txtSel->lpVtbl = &tsvt;
1521 txtSel->ref = 1;
1522 txtSel->reOle = reOle;
1523 return txtSel;
1526 LRESULT CreateIRichEditOle(ME_TextEditor *editor, LPVOID *ppObj)
1528 IRichEditOleImpl *reo;
1530 reo = heap_alloc(sizeof(IRichEditOleImpl));
1531 if (!reo)
1532 return 0;
1534 reo->lpRichEditOleVtbl = &revt;
1535 reo->lpTextDocumentVtbl = &tdvt;
1536 reo->ref = 1;
1537 reo->editor = editor;
1538 reo->txtSel = CreateTextSelection(reo);
1539 if (!reo->txtSel)
1541 heap_free(reo);
1542 return 0;
1544 TRACE("Created %p\n",reo);
1545 *ppObj = (LPVOID) reo;
1547 return 1;
1550 static void convert_sizel(ME_Context *c, const SIZEL* szl, SIZE* sz)
1552 /* sizel is in .01 millimeters, sz in pixels */
1553 sz->cx = MulDiv(szl->cx, c->dpi.cx, 2540);
1554 sz->cy = MulDiv(szl->cy, c->dpi.cy, 2540);
1557 /******************************************************************************
1558 * ME_GetOLEObjectSize
1560 * Sets run extent for OLE objects.
1562 void ME_GetOLEObjectSize(ME_Context *c, ME_Run *run, SIZE *pSize)
1564 IDataObject* ido;
1565 FORMATETC fmt;
1566 STGMEDIUM stgm;
1567 DIBSECTION dibsect;
1568 ENHMETAHEADER emh;
1570 assert(run->nFlags & MERF_GRAPHICS);
1571 assert(run->ole_obj);
1573 if (run->ole_obj->sizel.cx != 0 || run->ole_obj->sizel.cy != 0)
1575 convert_sizel(c, &run->ole_obj->sizel, pSize);
1576 return;
1579 IOleObject_QueryInterface(run->ole_obj->poleobj, &IID_IDataObject, (void**)&ido);
1580 fmt.cfFormat = CF_BITMAP;
1581 fmt.ptd = NULL;
1582 fmt.dwAspect = DVASPECT_CONTENT;
1583 fmt.lindex = -1;
1584 fmt.tymed = TYMED_GDI;
1585 if (IDataObject_GetData(ido, &fmt, &stgm) != S_OK)
1587 fmt.cfFormat = CF_ENHMETAFILE;
1588 fmt.tymed = TYMED_ENHMF;
1589 if (IDataObject_GetData(ido, &fmt, &stgm) != S_OK)
1591 FIXME("unsupported format\n");
1592 pSize->cx = pSize->cy = 0;
1593 IDataObject_Release(ido);
1594 return;
1598 switch (stgm.tymed)
1600 case TYMED_GDI:
1601 GetObjectW(stgm.u.hBitmap, sizeof(dibsect), &dibsect);
1602 pSize->cx = dibsect.dsBm.bmWidth;
1603 pSize->cy = dibsect.dsBm.bmHeight;
1604 if (!stgm.pUnkForRelease) DeleteObject(stgm.u.hBitmap);
1605 break;
1606 case TYMED_ENHMF:
1607 GetEnhMetaFileHeader(stgm.u.hEnhMetaFile, sizeof(emh), &emh);
1608 pSize->cx = emh.rclBounds.right - emh.rclBounds.left;
1609 pSize->cy = emh.rclBounds.bottom - emh.rclBounds.top;
1610 if (!stgm.pUnkForRelease) DeleteEnhMetaFile(stgm.u.hEnhMetaFile);
1611 break;
1612 default:
1613 FIXME("Unsupported tymed %d\n", stgm.tymed);
1614 break;
1616 IDataObject_Release(ido);
1617 if (c->editor->nZoomNumerator != 0)
1619 pSize->cx = MulDiv(pSize->cx, c->editor->nZoomNumerator, c->editor->nZoomDenominator);
1620 pSize->cy = MulDiv(pSize->cy, c->editor->nZoomNumerator, c->editor->nZoomDenominator);
1624 void ME_DrawOLE(ME_Context *c, int x, int y, ME_Run *run,
1625 ME_Paragraph *para, BOOL selected)
1627 IDataObject* ido;
1628 FORMATETC fmt;
1629 STGMEDIUM stgm;
1630 DIBSECTION dibsect;
1631 ENHMETAHEADER emh;
1632 HDC hMemDC;
1633 SIZE sz;
1634 BOOL has_size;
1636 assert(run->nFlags & MERF_GRAPHICS);
1637 assert(run->ole_obj);
1638 if (IOleObject_QueryInterface(run->ole_obj->poleobj, &IID_IDataObject, (void**)&ido) != S_OK)
1640 FIXME("Couldn't get interface\n");
1641 return;
1643 has_size = run->ole_obj->sizel.cx != 0 || run->ole_obj->sizel.cy != 0;
1644 fmt.cfFormat = CF_BITMAP;
1645 fmt.ptd = NULL;
1646 fmt.dwAspect = DVASPECT_CONTENT;
1647 fmt.lindex = -1;
1648 fmt.tymed = TYMED_GDI;
1649 if (IDataObject_GetData(ido, &fmt, &stgm) != S_OK)
1651 fmt.cfFormat = CF_ENHMETAFILE;
1652 fmt.tymed = TYMED_ENHMF;
1653 if (IDataObject_GetData(ido, &fmt, &stgm) != S_OK)
1655 FIXME("Couldn't get storage medium\n");
1656 IDataObject_Release(ido);
1657 return;
1660 switch (stgm.tymed)
1662 case TYMED_GDI:
1663 GetObjectW(stgm.u.hBitmap, sizeof(dibsect), &dibsect);
1664 hMemDC = CreateCompatibleDC(c->hDC);
1665 SelectObject(hMemDC, stgm.u.hBitmap);
1666 if (!has_size && c->editor->nZoomNumerator == 0)
1668 sz.cx = dibsect.dsBm.bmWidth;
1669 sz.cy = dibsect.dsBm.bmHeight;
1670 BitBlt(c->hDC, x, y - dibsect.dsBm.bmHeight,
1671 dibsect.dsBm.bmWidth, dibsect.dsBm.bmHeight,
1672 hMemDC, 0, 0, SRCCOPY);
1674 else
1676 if (has_size)
1678 convert_sizel(c, &run->ole_obj->sizel, &sz);
1680 else
1682 sz.cx = MulDiv(dibsect.dsBm.bmWidth,
1683 c->editor->nZoomNumerator, c->editor->nZoomDenominator);
1684 sz.cy = MulDiv(dibsect.dsBm.bmHeight,
1685 c->editor->nZoomNumerator, c->editor->nZoomDenominator);
1687 StretchBlt(c->hDC, x, y - sz.cy, sz.cx, sz.cy,
1688 hMemDC, 0, 0, dibsect.dsBm.bmWidth, dibsect.dsBm.bmHeight, SRCCOPY);
1690 if (!stgm.pUnkForRelease) DeleteObject(stgm.u.hBitmap);
1691 break;
1692 case TYMED_ENHMF:
1693 GetEnhMetaFileHeader(stgm.u.hEnhMetaFile, sizeof(emh), &emh);
1694 if (!has_size && c->editor->nZoomNumerator == 0)
1696 sz.cy = emh.rclBounds.bottom - emh.rclBounds.top;
1697 sz.cx = emh.rclBounds.right - emh.rclBounds.left;
1699 else
1701 if (has_size)
1703 convert_sizel(c, &run->ole_obj->sizel, &sz);
1705 else
1707 sz.cy = MulDiv(emh.rclBounds.bottom - emh.rclBounds.top,
1708 c->editor->nZoomNumerator, c->editor->nZoomDenominator);
1709 sz.cx = MulDiv(emh.rclBounds.right - emh.rclBounds.left,
1710 c->editor->nZoomNumerator, c->editor->nZoomDenominator);
1714 RECT rc;
1716 rc.left = x;
1717 rc.top = y - sz.cy;
1718 rc.right = x + sz.cx;
1719 rc.bottom = y;
1720 PlayEnhMetaFile(c->hDC, stgm.u.hEnhMetaFile, &rc);
1722 if (!stgm.pUnkForRelease) DeleteEnhMetaFile(stgm.u.hEnhMetaFile);
1723 break;
1724 default:
1725 FIXME("Unsupported tymed %d\n", stgm.tymed);
1726 selected = FALSE;
1727 break;
1729 if (selected && !c->editor->bHideSelection)
1730 PatBlt(c->hDC, x, y - sz.cy, sz.cx, sz.cy, DSTINVERT);
1731 IDataObject_Release(ido);
1734 void ME_DeleteReObject(REOBJECT* reo)
1736 if (reo->poleobj) IOleObject_Release(reo->poleobj);
1737 if (reo->pstg) IStorage_Release(reo->pstg);
1738 if (reo->polesite) IOleClientSite_Release(reo->polesite);
1739 FREE_OBJ(reo);
1742 void ME_CopyReObject(REOBJECT* dst, const REOBJECT* src)
1744 *dst = *src;
1746 if (dst->poleobj) IOleObject_AddRef(dst->poleobj);
1747 if (dst->pstg) IStorage_AddRef(dst->pstg);
1748 if (dst->polesite) IOleClientSite_AddRef(dst->polesite);