2 * RichEdit GUIDs and OLE interface
4 * Copyright 2004 by Krzysztof Foltman
5 * Copyright 2004 Aric Stewart
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #define NONAMELESSUNION
25 #define NONAMELESSSTRUCT
36 #include "wine/debug.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(richedit);
40 /* there is no way to be consistent across different sets of headers - mingw, Wine, Win32 SDK*/
42 /* FIXME: the next 6 lines should be in textserv.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;
61 ME_TextEditor *editor;
62 ITextSelectionImpl *txtSel;
65 struct ITextSelectionImpl {
66 const ITextSelectionVtbl *lpVtbl;
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));
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) );
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;
97 IRichEditOle_AddRef(me);
100 FIXME("%p: unhandled interface %s\n", This, debugstr_guid(riid) );
102 return E_NOINTERFACE;
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);
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);
126 TRACE ("Destroying %p\n", This);
127 This->txtSel->reOle = NULL;
128 ITextSelection_Release((ITextSelection *) This->txtSel);
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);
142 static HRESULT WINAPI
143 IRichEditOle_fnContextSensitiveHelp(IRichEditOle *me, BOOL fEnterMode)
145 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
146 FIXME("stub %p\n",This);
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);
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);
168 static HRESULT WINAPI
169 IRichEditOle_fnGetClipboardData(IRichEditOle *me, CHARRANGE *lpchrg,
170 DWORD reco, LPDATAOBJECT *lplpdataobj)
172 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
175 TRACE("(%p,%p,%d)\n",This, lpchrg, reco);
179 ME_GetSelection(This->editor, &tmpchrg.cpMin, &tmpchrg.cpMax);
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);
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);
202 IRichEditOle_fnGetObjectCount(IRichEditOle *me)
204 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
205 FIXME("stub %p\n",This);
209 static HRESULT WINAPI
210 IRichEditOle_fnHandsOffStorage(IRichEditOle *me, LONG iob)
212 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
213 FIXME("stub %p\n",This);
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);
226 static HRESULT WINAPI
227 IRichEditOle_fnInPlaceDeactivate(IRichEditOle *me)
229 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
230 FIXME("stub %p\n",This);
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);
249 static HRESULT WINAPI IRichEditOle_fnSaveCompleted(IRichEditOle *me, LONG iob,
252 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
253 FIXME("stub %p\n",This);
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);
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);
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);
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,
307 IRichEditOleImpl *This = impl_from_ITextDocument(me);
308 return IRichEditOle_fnQueryInterface((IRichEditOle*)&This->lpRichEditOleVtbl,
313 ITextDocument_fnAddRef(ITextDocument* me)
315 IRichEditOleImpl *This = impl_from_ITextDocument(me);
316 return IRichEditOle_fnAddRef((IRichEditOle*)&This->lpRichEditOleVtbl);
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,
330 IRichEditOleImpl *This = impl_from_ITextDocument(me);
331 FIXME("stub %p\n",This);
335 static HRESULT WINAPI
336 ITextDocument_fnGetTypeInfo(ITextDocument* me, UINT iTInfo, LCID lcid,
339 IRichEditOleImpl *This = impl_from_ITextDocument(me);
340 FIXME("stub %p\n",This);
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);
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);
363 static HRESULT WINAPI
364 ITextDocument_fnGetName(ITextDocument* me, BSTR* pName)
366 IRichEditOleImpl *This = impl_from_ITextDocument(me);
367 FIXME("stub %p\n",This);
371 static HRESULT WINAPI
372 ITextDocument_fnGetSelection(ITextDocument* me, ITextSelection** ppSel)
374 IRichEditOleImpl *This = impl_from_ITextDocument(me);
376 *ppSel = (ITextSelection *) This->txtSel;
377 ITextSelection_AddRef(*ppSel);
381 static HRESULT WINAPI
382 ITextDocument_fnGetStoryCount(ITextDocument* me, long* pCount)
384 IRichEditOleImpl *This = impl_from_ITextDocument(me);
385 FIXME("stub %p\n",This);
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);
398 static HRESULT WINAPI
399 ITextDocument_fnGetSaved(ITextDocument* me, long* pValue)
401 IRichEditOleImpl *This = impl_from_ITextDocument(me);
402 FIXME("stub %p\n",This);
406 static HRESULT WINAPI
407 ITextDocument_fnSetSaved(ITextDocument* me, long Value)
409 IRichEditOleImpl *This = impl_from_ITextDocument(me);
410 FIXME("stub %p\n",This);
414 static HRESULT WINAPI
415 ITextDocument_fnGetDefaultTabStop(ITextDocument* me, float* pValue)
417 IRichEditOleImpl *This = impl_from_ITextDocument(me);
418 FIXME("stub %p\n",This);
422 static HRESULT WINAPI
423 ITextDocument_fnSetDefaultTabStop(ITextDocument* me, float Value)
425 IRichEditOleImpl *This = impl_from_ITextDocument(me);
426 FIXME("stub %p\n",This);
430 static HRESULT WINAPI
431 ITextDocument_fnNew(ITextDocument* me)
433 IRichEditOleImpl *This = impl_from_ITextDocument(me);
434 FIXME("stub %p\n",This);
438 static HRESULT WINAPI
439 ITextDocument_fnOpen(ITextDocument* me, VARIANT* pVar, long Flags,
442 IRichEditOleImpl *This = impl_from_ITextDocument(me);
443 FIXME("stub %p\n",This);
447 static HRESULT WINAPI
448 ITextDocument_fnSave(ITextDocument* me, VARIANT* pVar, long Flags,
451 IRichEditOleImpl *This = impl_from_ITextDocument(me);
452 FIXME("stub %p\n",This);
456 static HRESULT WINAPI
457 ITextDocument_fnFreeze(ITextDocument* me, long* pCount)
459 IRichEditOleImpl *This = impl_from_ITextDocument(me);
460 FIXME("stub %p\n",This);
464 static HRESULT WINAPI
465 ITextDocument_fnUnfreeze(ITextDocument* me, long* pCount)
467 IRichEditOleImpl *This = impl_from_ITextDocument(me);
468 FIXME("stub %p\n",This);
472 static HRESULT WINAPI
473 ITextDocument_fnBeginEditCollection(ITextDocument* me)
475 IRichEditOleImpl *This = impl_from_ITextDocument(me);
476 FIXME("stub %p\n",This);
480 static HRESULT WINAPI
481 ITextDocument_fnEndEditCollection(ITextDocument* me)
483 IRichEditOleImpl *This = impl_from_ITextDocument(me);
484 FIXME("stub %p\n",This);
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);
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);
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);
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);
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,
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(
557 if (IsEqualGUID(riid, &IID_IUnknown)
558 || IsEqualGUID(riid, &IID_IDispatch)
559 || IsEqualGUID(riid, &IID_ITextRange)
560 || IsEqualGUID(riid, &IID_ITextSelection))
563 ITextSelection_AddRef(me);
567 return E_NOINTERFACE;
570 static ULONG WINAPI ITextSelection_fnAddRef(
573 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
574 return InterlockedIncrement(&This->ref);
577 static ULONG WINAPI ITextSelection_fnRelease(
580 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
581 ULONG ref = InterlockedDecrement(&This->ref);
587 static HRESULT WINAPI ITextSelection_fnGetTypeInfoCount(
591 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
593 return CO_E_RELEASED;
595 FIXME("not implemented\n");
599 static HRESULT WINAPI ITextSelection_fnGetTypeInfo(
605 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
607 return CO_E_RELEASED;
609 FIXME("not implemented\n");
613 static HRESULT WINAPI ITextSelection_fnGetIDsOfNames(
621 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
623 return CO_E_RELEASED;
625 FIXME("not implemented\n");
629 static HRESULT WINAPI ITextSelection_fnInvoke(
635 DISPPARAMS *pDispParams,
637 EXCEPINFO *pExcepInfo,
640 FIXME("not implemented\n");
644 /*** ITextRange methods ***/
645 static HRESULT WINAPI ITextSelection_fnGetText(
649 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
651 return CO_E_RELEASED;
653 FIXME("not implemented\n");
657 static HRESULT WINAPI ITextSelection_fnSetText(
661 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
663 return CO_E_RELEASED;
665 FIXME("not implemented\n");
669 static HRESULT WINAPI ITextSelection_fnGetChar(
673 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
675 return CO_E_RELEASED;
677 FIXME("not implemented\n");
681 static HRESULT WINAPI ITextSelection_fnSetChar(
685 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
687 return CO_E_RELEASED;
689 FIXME("not implemented\n");
693 static HRESULT WINAPI ITextSelection_fnGetDuplicate(
695 ITextRange **ppRange)
697 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
699 return CO_E_RELEASED;
701 FIXME("not implemented\n");
705 static HRESULT WINAPI ITextSelection_fnGetFormattedText(
707 ITextRange **ppRange)
709 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
711 return CO_E_RELEASED;
713 FIXME("not implemented\n");
717 static HRESULT WINAPI ITextSelection_fnSetFormattedText(
721 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
723 return CO_E_RELEASED;
725 FIXME("not implemented\n");
729 static HRESULT WINAPI ITextSelection_fnGetStart(
733 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
735 return CO_E_RELEASED;
737 FIXME("not implemented\n");
741 static HRESULT WINAPI ITextSelection_fnSetStart(
745 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
747 return CO_E_RELEASED;
749 FIXME("not implemented\n");
753 static HRESULT WINAPI ITextSelection_fnGetEnd(
757 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
759 return CO_E_RELEASED;
761 FIXME("not implemented\n");
765 static HRESULT WINAPI ITextSelection_fnSetEnd(
769 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
771 return CO_E_RELEASED;
773 FIXME("not implemented\n");
777 static HRESULT WINAPI ITextSelection_fnGetFont(
781 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
783 return CO_E_RELEASED;
785 FIXME("not implemented\n");
789 static HRESULT WINAPI ITextSelection_fnSetFont(
793 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
795 return CO_E_RELEASED;
797 FIXME("not implemented\n");
801 static HRESULT WINAPI ITextSelection_fnGetPara(
805 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
807 return CO_E_RELEASED;
809 FIXME("not implemented\n");
813 static HRESULT WINAPI ITextSelection_fnSetPara(
817 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
819 return CO_E_RELEASED;
821 FIXME("not implemented\n");
825 static HRESULT WINAPI ITextSelection_fnGetStoryLength(
829 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
831 return CO_E_RELEASED;
833 FIXME("not implemented\n");
837 static HRESULT WINAPI ITextSelection_fnGetStoryType(
841 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
843 return CO_E_RELEASED;
845 FIXME("not implemented\n");
849 static HRESULT WINAPI ITextSelection_fnCollapse(
853 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
855 return CO_E_RELEASED;
857 FIXME("not implemented\n");
861 static HRESULT WINAPI ITextSelection_fnExpand(
866 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
868 return CO_E_RELEASED;
870 FIXME("not implemented\n");
874 static HRESULT WINAPI ITextSelection_fnGetIndex(
879 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
881 return CO_E_RELEASED;
883 FIXME("not implemented\n");
887 static HRESULT WINAPI ITextSelection_fnSetIndex(
893 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
895 return CO_E_RELEASED;
897 FIXME("not implemented\n");
901 static HRESULT WINAPI ITextSelection_fnSetRange(
906 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
908 return CO_E_RELEASED;
910 FIXME("not implemented\n");
914 static HRESULT WINAPI ITextSelection_fnInRange(
919 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
921 return CO_E_RELEASED;
923 FIXME("not implemented\n");
927 static HRESULT WINAPI ITextSelection_fnInStory(
932 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
934 return CO_E_RELEASED;
936 FIXME("not implemented\n");
940 static HRESULT WINAPI ITextSelection_fnIsEqual(
945 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
947 return CO_E_RELEASED;
949 FIXME("not implemented\n");
953 static HRESULT WINAPI ITextSelection_fnSelect(
956 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
958 return CO_E_RELEASED;
960 FIXME("not implemented\n");
964 static HRESULT WINAPI ITextSelection_fnStartOf(
970 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
972 return CO_E_RELEASED;
974 FIXME("not implemented\n");
978 static HRESULT WINAPI ITextSelection_fnEndOf(
984 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
986 return CO_E_RELEASED;
988 FIXME("not implemented\n");
992 static HRESULT WINAPI ITextSelection_fnMove(
998 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1000 return CO_E_RELEASED;
1002 FIXME("not implemented\n");
1006 static HRESULT WINAPI ITextSelection_fnMoveStart(
1012 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1014 return CO_E_RELEASED;
1016 FIXME("not implemented\n");
1020 static HRESULT WINAPI ITextSelection_fnMoveEnd(
1026 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1028 return CO_E_RELEASED;
1030 FIXME("not implemented\n");
1034 static HRESULT WINAPI ITextSelection_fnMoveWhile(
1040 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1042 return CO_E_RELEASED;
1044 FIXME("not implemented\n");
1048 static HRESULT WINAPI ITextSelection_fnMoveStartWhile(
1054 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1056 return CO_E_RELEASED;
1058 FIXME("not implemented\n");
1062 static HRESULT WINAPI ITextSelection_fnMoveEndWhile(
1068 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1070 return CO_E_RELEASED;
1072 FIXME("not implemented\n");
1076 static HRESULT WINAPI ITextSelection_fnMoveUntil(
1082 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1084 return CO_E_RELEASED;
1086 FIXME("not implemented\n");
1090 static HRESULT WINAPI ITextSelection_fnMoveStartUntil(
1096 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1098 return CO_E_RELEASED;
1100 FIXME("not implemented\n");
1104 static HRESULT WINAPI ITextSelection_fnMoveEndUntil(
1110 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1112 return CO_E_RELEASED;
1114 FIXME("not implemented\n");
1118 static HRESULT WINAPI ITextSelection_fnFindText(
1125 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1127 return CO_E_RELEASED;
1129 FIXME("not implemented\n");
1133 static HRESULT WINAPI ITextSelection_fnFindTextStart(
1140 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1142 return CO_E_RELEASED;
1144 FIXME("not implemented\n");
1148 static HRESULT WINAPI ITextSelection_fnFindTextEnd(
1155 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1157 return CO_E_RELEASED;
1159 FIXME("not implemented\n");
1163 static HRESULT WINAPI ITextSelection_fnDelete(
1169 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1171 return CO_E_RELEASED;
1173 FIXME("not implemented\n");
1177 static HRESULT WINAPI ITextSelection_fnCut(
1181 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1183 return CO_E_RELEASED;
1185 FIXME("not implemented\n");
1189 static HRESULT WINAPI ITextSelection_fnCopy(
1193 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1195 return CO_E_RELEASED;
1197 FIXME("not implemented\n");
1201 static HRESULT WINAPI ITextSelection_fnPaste(
1206 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1208 return CO_E_RELEASED;
1210 FIXME("not implemented\n");
1214 static HRESULT WINAPI ITextSelection_fnCanPaste(
1220 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1222 return CO_E_RELEASED;
1224 FIXME("not implemented\n");
1228 static HRESULT WINAPI ITextSelection_fnCanEdit(
1232 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1234 return CO_E_RELEASED;
1236 FIXME("not implemented\n");
1240 static HRESULT WINAPI ITextSelection_fnChangeCase(
1244 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1246 return CO_E_RELEASED;
1248 FIXME("not implemented\n");
1252 static HRESULT WINAPI ITextSelection_fnGetPoint(
1258 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1260 return CO_E_RELEASED;
1262 FIXME("not implemented\n");
1266 static HRESULT WINAPI ITextSelection_fnSetPoint(
1273 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1275 return CO_E_RELEASED;
1277 FIXME("not implemented\n");
1281 static HRESULT WINAPI ITextSelection_fnScrollIntoView(
1285 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1287 return CO_E_RELEASED;
1289 FIXME("not implemented\n");
1293 static HRESULT WINAPI ITextSelection_fnGetEmbeddedObject(
1297 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1299 return CO_E_RELEASED;
1301 FIXME("not implemented\n");
1305 /*** ITextSelection methods ***/
1306 static HRESULT WINAPI ITextSelection_fnGetFlags(
1310 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1312 return CO_E_RELEASED;
1314 FIXME("not implemented\n");
1318 static HRESULT WINAPI ITextSelection_fnSetFlags(
1322 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1324 return CO_E_RELEASED;
1326 FIXME("not implemented\n");
1330 static HRESULT WINAPI ITextSelection_fnGetType(
1334 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1336 return CO_E_RELEASED;
1338 FIXME("not implemented\n");
1342 static HRESULT WINAPI ITextSelection_fnMoveLeft(
1349 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1351 return CO_E_RELEASED;
1353 FIXME("not implemented\n");
1357 static HRESULT WINAPI ITextSelection_fnMoveRight(
1364 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1366 return CO_E_RELEASED;
1368 FIXME("not implemented\n");
1372 static HRESULT WINAPI ITextSelection_fnMoveUp(
1379 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1381 return CO_E_RELEASED;
1383 FIXME("not implemented\n");
1387 static HRESULT WINAPI ITextSelection_fnMoveDown(
1394 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1396 return CO_E_RELEASED;
1398 FIXME("not implemented\n");
1402 static HRESULT WINAPI ITextSelection_fnHomeKey(
1408 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1410 return CO_E_RELEASED;
1412 FIXME("not implemented\n");
1416 static HRESULT WINAPI ITextSelection_fnEndKey(
1422 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1424 return CO_E_RELEASED;
1426 FIXME("not implemented\n");
1430 static HRESULT WINAPI ITextSelection_fnTypeText(
1434 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1436 return CO_E_RELEASED;
1438 FIXME("not implemented\n");
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);
1520 txtSel->lpVtbl = &tsvt;
1522 txtSel->reOle = reOle;
1526 LRESULT CreateIRichEditOle(ME_TextEditor *editor, LPVOID *ppObj)
1528 IRichEditOleImpl *reo;
1530 reo = heap_alloc(sizeof(IRichEditOleImpl));
1534 reo->lpRichEditOleVtbl = &revt;
1535 reo->lpTextDocumentVtbl = &tdvt;
1537 reo->editor = editor;
1538 reo->txtSel = CreateTextSelection(reo);
1544 TRACE("Created %p\n",reo);
1545 *ppObj = (LPVOID) reo;
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)
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);
1579 IOleObject_QueryInterface(run->ole_obj->poleobj, &IID_IDataObject, (void**)&ido);
1580 fmt.cfFormat = CF_BITMAP;
1582 fmt.dwAspect = DVASPECT_CONTENT;
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);
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);
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);
1613 FIXME("Unsupported tymed %d\n", stgm.tymed);
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)
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");
1643 has_size = run->ole_obj->sizel.cx != 0 || run->ole_obj->sizel.cy != 0;
1644 fmt.cfFormat = CF_BITMAP;
1646 fmt.dwAspect = DVASPECT_CONTENT;
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);
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);
1678 convert_sizel(c, &run->ole_obj->sizel, &sz);
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);
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;
1703 convert_sizel(c, &run->ole_obj->sizel, &sz);
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);
1718 rc.right = x + sz.cx;
1720 PlayEnhMetaFile(c->hDC, stgm.u.hEnhMetaFile, &rc);
1722 if (!stgm.pUnkForRelease) DeleteEnhMetaFile(stgm.u.hEnhMetaFile);
1725 FIXME("Unsupported tymed %d\n", stgm.tymed);
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);
1742 void ME_CopyReObject(REOBJECT* dst, const REOBJECT* 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);