[PATCH 4/4] riched20: Use ReTxtDoc in IRichEditOle

Caibin Chen tigersoldi at gmail.com
Wed Jul 31 02:01:07 CDT 2013


---
 dlls/riched20/richole.c | 1104 +----------------------------------------------
 1 file changed, 19 insertions(+), 1085 deletions(-)
-------------- next part --------------
From ffbf8f4cf4f6b0448e0c8b81e2c81ef2263ff553 Mon Sep 17 00:00:00 2001
From: Caibin Chen <tigersoldi at gmail.com>
Date: Wed, 17 Jul 2013 21:51:42 -0700
Subject: [PATCH 4/4] riched20: Use ReTxtDoc in IRichEditOle

---
 dlls/riched20/richole.c | 1104 +----------------------------------------------
 1 file changed, 19 insertions(+), 1085 deletions(-)

diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c
index 6805873..ed9c32f 100644
--- a/dlls/riched20/richole.c
+++ b/dlls/riched20/richole.c
@@ -33,8 +33,10 @@
 #include "richole.h"
 #include "editor.h"
 #include "tom.h"
+#include "txtdoc.h"
 #include "wine/debug.h"
 
+
 WINE_DEFAULT_DEBUG_CHANNEL(richedit);
 
 /* there is no way to be consistent across different sets of headers - mingw, Wine, Win32 SDK*/
@@ -47,26 +49,17 @@ DEFINE_GUID(IID_ITextDocument, 0x8cc497c0, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xa
 DEFINE_GUID(IID_ITextRange, 0x8cc497c2, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
 DEFINE_GUID(IID_ITextSelection, 0x8cc497c1, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
 
-typedef struct ITextSelectionImpl ITextSelectionImpl;
 typedef struct IOleClientSiteImpl IOleClientSiteImpl;
 
 typedef struct IRichEditOleImpl {
     IRichEditOle IRichEditOle_iface;
-    ITextDocument ITextDocument_iface;
+    ReTxtDoc *txtDoc;
     LONG ref;
 
     ME_TextEditor *editor;
-    ITextSelectionImpl *txtSel;
     IOleClientSiteImpl *clientSite;
 } IRichEditOleImpl;
 
-struct ITextSelectionImpl {
-    ITextSelection ITextSelection_iface;
-    LONG ref;
-
-    IRichEditOleImpl *reOle;
-};
-
 struct IOleClientSiteImpl {
     IOleClientSite IOleClientSite_iface;
     LONG ref;
@@ -79,11 +72,6 @@ static inline IRichEditOleImpl *impl_from_IRichEditOle(IRichEditOle *iface)
     return CONTAINING_RECORD(iface, IRichEditOleImpl, IRichEditOle_iface);
 }
 
-static inline IRichEditOleImpl *impl_from_ITextDocument(ITextDocument *iface)
-{
-    return CONTAINING_RECORD(iface, IRichEditOleImpl, ITextDocument_iface);
-}
-
 static HRESULT WINAPI
 IRichEditOle_fnQueryInterface(IRichEditOle *me, REFIID riid, LPVOID *ppvObj)
 {
@@ -96,15 +84,15 @@ IRichEditOle_fnQueryInterface(IRichEditOle *me, REFIID riid, LPVOID *ppvObj)
         IsEqualGUID(riid, &IID_IRichEditOle))
         *ppvObj = &This->IRichEditOle_iface;
     else if (IsEqualGUID(riid, &IID_ITextDocument))
-        *ppvObj = &This->ITextDocument_iface;
+        *ppvObj = &This->txtDoc->ITextDocument_iface;
     if (*ppvObj)
     {
         IRichEditOle_AddRef(me);
         return S_OK;
     }
     FIXME("%p: unhandled interface %s\n", This, debugstr_guid(riid) );
- 
-    return E_NOINTERFACE;   
+
+    return E_NOINTERFACE;
 }
 
 static ULONG WINAPI
@@ -129,9 +117,8 @@ IRichEditOle_fnRelease(IRichEditOle *me)
     if (!ref)
     {
         TRACE ("Destroying %p\n", This);
-        This->txtSel->reOle = NULL;
-        ITextSelection_Release(&This->txtSel->ITextSelection_iface);
         IOleClientSite_Release(&This->clientSite->IOleClientSite_iface);
+        ReTxtDoc_destroy(This->txtDoc);
         heap_free(This);
     }
     return ref;
@@ -443,1080 +430,27 @@ static const IRichEditOleVtbl revt = {
     IRichEditOle_fnImportDataObject
 };
 
-static HRESULT WINAPI
-ITextDocument_fnQueryInterface(ITextDocument* me, REFIID riid,
-    void** ppvObject)
-{
-    IRichEditOleImpl *This = impl_from_ITextDocument(me);
-    return IRichEditOle_QueryInterface(&This->IRichEditOle_iface, riid, ppvObject);
-}
-
-static ULONG WINAPI
-ITextDocument_fnAddRef(ITextDocument* me)
-{
-    IRichEditOleImpl *This = impl_from_ITextDocument(me);
-    return IRichEditOle_AddRef(&This->IRichEditOle_iface);
-}
-
-static ULONG WINAPI
-ITextDocument_fnRelease(ITextDocument* me)
-{
-    IRichEditOleImpl *This = impl_from_ITextDocument(me);
-    return IRichEditOle_Release(&This->IRichEditOle_iface);
-}
-
-static HRESULT WINAPI
-ITextDocument_fnGetTypeInfoCount(ITextDocument* me,
-    UINT* pctinfo)
-{
-    IRichEditOleImpl *This = impl_from_ITextDocument(me);
-    FIXME("stub %p\n",This);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI
-ITextDocument_fnGetTypeInfo(ITextDocument* me, UINT iTInfo, LCID lcid,
-    ITypeInfo** ppTInfo)
-{
-    IRichEditOleImpl *This = impl_from_ITextDocument(me);
-    FIXME("stub %p\n",This);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI
-ITextDocument_fnGetIDsOfNames(ITextDocument* me, REFIID riid,
-    LPOLESTR* rgszNames, UINT cNames, LCID lcid, DISPID* rgDispId)
-{
-    IRichEditOleImpl *This = impl_from_ITextDocument(me);
-    FIXME("stub %p\n",This);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI
-ITextDocument_fnInvoke(ITextDocument* me, DISPID dispIdMember,
-    REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams,
-    VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr)
-{
-    IRichEditOleImpl *This = impl_from_ITextDocument(me);
-    FIXME("stub %p\n",This);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI
-ITextDocument_fnGetName(ITextDocument* me, BSTR* pName)
-{
-    IRichEditOleImpl *This = impl_from_ITextDocument(me);
-    FIXME("stub %p\n",This);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI
-ITextDocument_fnGetSelection(ITextDocument* me, ITextSelection** ppSel)
-{
-    IRichEditOleImpl *This = impl_from_ITextDocument(me);
-    TRACE("(%p)\n", me);
-    *ppSel = &This->txtSel->ITextSelection_iface;
-    ITextSelection_AddRef(*ppSel);
-    return S_OK;
-}
-
-static HRESULT WINAPI
-ITextDocument_fnGetStoryCount(ITextDocument* me, LONG* pCount)
-{
-    IRichEditOleImpl *This = impl_from_ITextDocument(me);
-    FIXME("stub %p\n",This);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI
-ITextDocument_fnGetStoryRanges(ITextDocument* me,
-    ITextStoryRanges** ppStories)
-{
-    IRichEditOleImpl *This = impl_from_ITextDocument(me);
-    FIXME("stub %p\n",This);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI
-ITextDocument_fnGetSaved(ITextDocument* me, LONG* pValue)
-{
-    IRichEditOleImpl *This = impl_from_ITextDocument(me);
-    FIXME("stub %p\n",This);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI
-ITextDocument_fnSetSaved(ITextDocument* me, LONG Value)
-{
-    IRichEditOleImpl *This = impl_from_ITextDocument(me);
-    FIXME("stub %p\n",This);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI
-ITextDocument_fnGetDefaultTabStop(ITextDocument* me, float* pValue)
-{
-    IRichEditOleImpl *This = impl_from_ITextDocument(me);
-    FIXME("stub %p\n",This);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI
-ITextDocument_fnSetDefaultTabStop(ITextDocument* me, float Value)
-{
-    IRichEditOleImpl *This = impl_from_ITextDocument(me);
-    FIXME("stub %p\n",This);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI
-ITextDocument_fnNew(ITextDocument* me)
-{
-    IRichEditOleImpl *This = impl_from_ITextDocument(me);
-    FIXME("stub %p\n",This);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI
-ITextDocument_fnOpen(ITextDocument* me, VARIANT* pVar, LONG Flags,
-    LONG CodePage)
-{
-    IRichEditOleImpl *This = impl_from_ITextDocument(me);
-    FIXME("stub %p\n",This);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI
-ITextDocument_fnSave(ITextDocument* me, VARIANT* pVar, LONG Flags,
-    LONG CodePage)
-{
-    IRichEditOleImpl *This = impl_from_ITextDocument(me);
-    FIXME("stub %p\n",This);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI
-ITextDocument_fnFreeze(ITextDocument* me, LONG* pCount)
-{
-    IRichEditOleImpl *This = impl_from_ITextDocument(me);
-    FIXME("stub %p\n",This);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI
-ITextDocument_fnUnfreeze(ITextDocument* me, LONG* pCount)
-{
-    IRichEditOleImpl *This = impl_from_ITextDocument(me);
-    FIXME("stub %p\n",This);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI
-ITextDocument_fnBeginEditCollection(ITextDocument* me)
-{
-    IRichEditOleImpl *This = impl_from_ITextDocument(me);
-    FIXME("stub %p\n",This);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI
-ITextDocument_fnEndEditCollection(ITextDocument* me)
-{
-    IRichEditOleImpl *This = impl_from_ITextDocument(me);
-    FIXME("stub %p\n",This);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI
-ITextDocument_fnUndo(ITextDocument* me, LONG Count, LONG* prop)
-{
-    IRichEditOleImpl *This = impl_from_ITextDocument(me);
-    FIXME("stub %p\n",This);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI
-ITextDocument_fnRedo(ITextDocument* me, LONG Count, LONG* prop)
-{
-    IRichEditOleImpl *This = impl_from_ITextDocument(me);
-    FIXME("stub %p\n",This);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI
-ITextDocument_fnRange(ITextDocument* me, LONG cp1, LONG cp2,
-    ITextRange** ppRange)
-{
-    IRichEditOleImpl *This = impl_from_ITextDocument(me);
-    FIXME("stub %p\n",This);
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI
-ITextDocument_fnRangeFromPoint(ITextDocument* me, LONG x, LONG y,
-    ITextRange** ppRange)
+LRESULT CreateIRichEditOle(ME_TextEditor *editor, LPVOID *ppObj)
 {
-    IRichEditOleImpl *This = impl_from_ITextDocument(me);
-    FIXME("stub %p\n",This);
-    return E_NOTIMPL;
-}
-
-static const ITextDocumentVtbl tdvt = {
-    ITextDocument_fnQueryInterface,
-    ITextDocument_fnAddRef,
-    ITextDocument_fnRelease,
-    ITextDocument_fnGetTypeInfoCount,
-    ITextDocument_fnGetTypeInfo,
-    ITextDocument_fnGetIDsOfNames,
-    ITextDocument_fnInvoke,
-    ITextDocument_fnGetName,
-    ITextDocument_fnGetSelection,
-    ITextDocument_fnGetStoryCount,
-    ITextDocument_fnGetStoryRanges,
-    ITextDocument_fnGetSaved,
-    ITextDocument_fnSetSaved,
-    ITextDocument_fnGetDefaultTabStop,
-    ITextDocument_fnSetDefaultTabStop,
-    ITextDocument_fnNew,
-    ITextDocument_fnOpen,
-    ITextDocument_fnSave,
-    ITextDocument_fnFreeze,
-    ITextDocument_fnUnfreeze,
-    ITextDocument_fnBeginEditCollection,
-    ITextDocument_fnEndEditCollection,
-    ITextDocument_fnUndo,
-    ITextDocument_fnRedo,
-    ITextDocument_fnRange,
-    ITextDocument_fnRangeFromPoint
-};
+    IRichEditOleImpl *reo;
 
-static inline ITextSelectionImpl *impl_from_ITextSelection(ITextSelection *iface)
-{
-    return CONTAINING_RECORD(iface, ITextSelectionImpl, ITextSelection_iface);
-}
+    reo = heap_alloc(sizeof(IRichEditOleImpl));
+    if (!reo)
+        return 0;
 
-static HRESULT WINAPI ITextSelection_fnQueryInterface(
-    ITextSelection *me,
-    REFIID riid,
-    void **ppvObj)
-{
-    *ppvObj = NULL;
-    if (IsEqualGUID(riid, &IID_IUnknown)
-        || IsEqualGUID(riid, &IID_IDispatch)
-        || IsEqualGUID(riid, &IID_ITextRange)
-        || IsEqualGUID(riid, &IID_ITextSelection))
+    reo->IRichEditOle_iface.lpVtbl = &revt;
+    reo->txtDoc = ReTxtDoc_create((IUnknown*) &reo->IRichEditOle_iface, editor);
+    if (!reo->txtDoc)
     {
-        *ppvObj = me;
-        ITextSelection_AddRef(me);
-        return S_OK;
+        heap_free(reo);
+        return 0;
     }
-
-    return E_NOINTERFACE;
-}
-
-static ULONG WINAPI ITextSelection_fnAddRef(ITextSelection *me)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    return InterlockedIncrement(&This->ref);
-}
-
-static ULONG WINAPI ITextSelection_fnRelease(ITextSelection *me)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    ULONG ref = InterlockedDecrement(&This->ref);
-    if (ref == 0)
-        heap_free(This);
-    return ref;
-}
-
-static HRESULT WINAPI ITextSelection_fnGetTypeInfoCount(ITextSelection *me, UINT *pctinfo)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnGetTypeInfo(ITextSelection *me, UINT iTInfo, LCID lcid,
-    ITypeInfo **ppTInfo)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnGetIDsOfNames(ITextSelection *me, REFIID riid,
-    LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnInvoke(
-    ITextSelection *me,
-    DISPID dispIdMember,
-    REFIID riid,
-    LCID lcid,
-    WORD wFlags,
-    DISPPARAMS *pDispParams,
-    VARIANT *pVarResult,
-    EXCEPINFO *pExcepInfo,
-    UINT *puArgErr)
-{
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-/*** ITextRange methods ***/
-static HRESULT WINAPI ITextSelection_fnGetText(ITextSelection *me, BSTR *pbstr)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnSetText(ITextSelection *me, BSTR bstr)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnGetChar(ITextSelection *me, LONG *pch)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnSetChar(ITextSelection *me, LONG ch)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnGetDuplicate(ITextSelection *me, ITextRange **ppRange)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnGetFormattedText(ITextSelection *me, ITextRange **ppRange)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnSetFormattedText(ITextSelection *me, ITextRange *pRange)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnGetStart(ITextSelection *me, LONG *pcpFirst)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnSetStart(ITextSelection *me, LONG cpFirst)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnGetEnd(ITextSelection *me, LONG *pcpLim)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnSetEnd(ITextSelection *me, LONG cpLim)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnGetFont(ITextSelection *me, ITextFont **pFont)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnSetFont(ITextSelection *me, ITextFont *pFont)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnGetPara(ITextSelection *me, ITextPara **ppPara)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnSetPara(ITextSelection *me, ITextPara *pPara)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnGetStoryLength(ITextSelection *me, LONG *pcch)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnGetStoryType(ITextSelection *me, LONG *pValue)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnCollapse(ITextSelection *me, LONG bStart)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnExpand(ITextSelection *me, LONG Unit, LONG *pDelta)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnGetIndex(ITextSelection *me, LONG Unit, LONG *pIndex)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnSetIndex(ITextSelection *me, LONG Unit, LONG Index,
-    LONG Extend)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnSetRange(ITextSelection *me, LONG cpActive, LONG cpOther)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnInRange(ITextSelection *me, ITextRange *pRange, LONG *pb)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnInStory(ITextSelection *me, ITextRange *pRange, LONG *pb)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnIsEqual(ITextSelection *me, ITextRange *pRange, LONG *pb)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnSelect(ITextSelection *me)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnStartOf(ITextSelection *me, LONG Unit, LONG Extend,
-    LONG *pDelta)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnEndOf(ITextSelection *me, LONG Unit, LONG Extend,
-    LONG *pDelta)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnMove(ITextSelection *me, LONG Unit, LONG Count, LONG *pDelta)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnMoveStart(ITextSelection *me, LONG Unit, LONG Count,
-    LONG *pDelta)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnMoveEnd(ITextSelection *me, LONG Unit, LONG Count,
-    LONG *pDelta)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnMoveWhile(ITextSelection *me, VARIANT *Cset, LONG Count,
-    LONG *pDelta)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnMoveStartWhile(ITextSelection *me, VARIANT *Cset, LONG Count,
-    LONG *pDelta)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnMoveEndWhile(ITextSelection *me, VARIANT *Cset, LONG Count,
-    LONG *pDelta)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnMoveUntil(ITextSelection *me, VARIANT *Cset, LONG Count,
-    LONG *pDelta)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnMoveStartUntil(ITextSelection *me, VARIANT *Cset, LONG Count,
-    LONG *pDelta)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnMoveEndUntil(ITextSelection *me, VARIANT *Cset, LONG Count,
-    LONG *pDelta)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnFindText(ITextSelection *me, BSTR bstr, LONG cch, LONG Flags,
-    LONG *pLength)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnFindTextStart(ITextSelection *me, BSTR bstr, LONG cch,
-    LONG Flags, LONG *pLength)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnFindTextEnd(ITextSelection *me, BSTR bstr, LONG cch,
-    LONG Flags, LONG *pLength)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnDelete(ITextSelection *me, LONG Unit, LONG Count,
-    LONG *pDelta)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnCut(ITextSelection *me, VARIANT *pVar)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnCopy(ITextSelection *me, VARIANT *pVar)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnPaste(ITextSelection *me, VARIANT *pVar, LONG Format)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnCanPaste(ITextSelection *me, VARIANT *pVar, LONG Format,
-    LONG *pb)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnCanEdit(ITextSelection *me, LONG *pb)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnChangeCase(ITextSelection *me, LONG Type)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnGetPoint(ITextSelection *me, LONG Type, LONG *cx, LONG *cy)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnSetPoint(ITextSelection *me, LONG x, LONG y, LONG Type,
-    LONG Extend)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnScrollIntoView(ITextSelection *me, LONG Value)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnGetEmbeddedObject(ITextSelection *me, IUnknown **ppv)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-/*** ITextSelection methods ***/
-static HRESULT WINAPI ITextSelection_fnGetFlags(ITextSelection *me, LONG *pFlags)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnSetFlags(ITextSelection *me, LONG Flags)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnGetType(ITextSelection *me, LONG *pType)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnMoveLeft(ITextSelection *me, LONG Unit, LONG Count,
-    LONG Extend, LONG *pDelta)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnMoveRight(ITextSelection *me, LONG Unit, LONG Count,
-    LONG Extend, LONG *pDelta)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnMoveUp(ITextSelection *me, LONG Unit, LONG Count,
-    LONG Extend, LONG *pDelta)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnMoveDown(ITextSelection *me, LONG Unit, LONG Count,
-    LONG Extend, LONG *pDelta)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnHomeKey(ITextSelection *me, LONG Unit, LONG Extend,
-    LONG *pDelta)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnEndKey(ITextSelection *me, LONG Unit, LONG Extend,
-    LONG *pDelta)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ITextSelection_fnTypeText(ITextSelection *me, BSTR bstr)
-{
-    ITextSelectionImpl *This = impl_from_ITextSelection(me);
-    if (!This->reOle)
-        return CO_E_RELEASED;
-
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
-}
-
-static const ITextSelectionVtbl tsvt = {
-    ITextSelection_fnQueryInterface,
-    ITextSelection_fnAddRef,
-    ITextSelection_fnRelease,
-    ITextSelection_fnGetTypeInfoCount,
-    ITextSelection_fnGetTypeInfo,
-    ITextSelection_fnGetIDsOfNames,
-    ITextSelection_fnInvoke,
-    ITextSelection_fnGetText,
-    ITextSelection_fnSetText,
-    ITextSelection_fnGetChar,
-    ITextSelection_fnSetChar,
-    ITextSelection_fnGetDuplicate,
-    ITextSelection_fnGetFormattedText,
-    ITextSelection_fnSetFormattedText,
-    ITextSelection_fnGetStart,
-    ITextSelection_fnSetStart,
-    ITextSelection_fnGetEnd,
-    ITextSelection_fnSetEnd,
-    ITextSelection_fnGetFont,
-    ITextSelection_fnSetFont,
-    ITextSelection_fnGetPara,
-    ITextSelection_fnSetPara,
-    ITextSelection_fnGetStoryLength,
-    ITextSelection_fnGetStoryType,
-    ITextSelection_fnCollapse,
-    ITextSelection_fnExpand,
-    ITextSelection_fnGetIndex,
-    ITextSelection_fnSetIndex,
-    ITextSelection_fnSetRange,
-    ITextSelection_fnInRange,
-    ITextSelection_fnInStory,
-    ITextSelection_fnIsEqual,
-    ITextSelection_fnSelect,
-    ITextSelection_fnStartOf,
-    ITextSelection_fnEndOf,
-    ITextSelection_fnMove,
-    ITextSelection_fnMoveStart,
-    ITextSelection_fnMoveEnd,
-    ITextSelection_fnMoveWhile,
-    ITextSelection_fnMoveStartWhile,
-    ITextSelection_fnMoveEndWhile,
-    ITextSelection_fnMoveUntil,
-    ITextSelection_fnMoveStartUntil,
-    ITextSelection_fnMoveEndUntil,
-    ITextSelection_fnFindText,
-    ITextSelection_fnFindTextStart,
-    ITextSelection_fnFindTextEnd,
-    ITextSelection_fnDelete,
-    ITextSelection_fnCut,
-    ITextSelection_fnCopy,
-    ITextSelection_fnPaste,
-    ITextSelection_fnCanPaste,
-    ITextSelection_fnCanEdit,
-    ITextSelection_fnChangeCase,
-    ITextSelection_fnGetPoint,
-    ITextSelection_fnSetPoint,
-    ITextSelection_fnScrollIntoView,
-    ITextSelection_fnGetEmbeddedObject,
-    ITextSelection_fnGetFlags,
-    ITextSelection_fnSetFlags,
-    ITextSelection_fnGetType,
-    ITextSelection_fnMoveLeft,
-    ITextSelection_fnMoveRight,
-    ITextSelection_fnMoveUp,
-    ITextSelection_fnMoveDown,
-    ITextSelection_fnHomeKey,
-    ITextSelection_fnEndKey,
-    ITextSelection_fnTypeText
-};
-
-static ITextSelectionImpl *
-CreateTextSelection(IRichEditOleImpl *reOle)
-{
-    ITextSelectionImpl *txtSel = heap_alloc(sizeof *txtSel);
-    if (!txtSel)
-        return NULL;
-
-    txtSel->ITextSelection_iface.lpVtbl = &tsvt;
-    txtSel->ref = 1;
-    txtSel->reOle = reOle;
-    return txtSel;
-}
-
-LRESULT CreateIRichEditOle(ME_TextEditor *editor, LPVOID *ppObj)
-{
-    IRichEditOleImpl *reo;
-
-    reo = heap_alloc(sizeof(IRichEditOleImpl));
-    if (!reo)
-        return 0;
-
-    reo->IRichEditOle_iface.lpVtbl = &revt;
-    reo->ITextDocument_iface.lpVtbl = &tdvt;
     reo->ref = 1;
     reo->editor = editor;
-    reo->txtSel = CreateTextSelection(reo);
-    if (!reo->txtSel)
-    {
-        heap_free(reo);
-        return 0;
-    }
     reo->clientSite = CreateOleClientSite(reo);
-    if (!reo->txtSel)
+    if (!reo->clientSite)
     {
-        ITextSelection_Release(&reo->txtSel->ITextSelection_iface);
+        ITextDocument_Release(&reo->txtDoc->ITextDocument_iface);
         heap_free(reo);
         return 0;
     }
-- 
1.8.3.4


More information about the wine-patches mailing list