riched20: Merge the richole object with the text services object.
Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
ac6ddbc954
commit
43d377c260
|
@ -1121,7 +1121,6 @@ static HRESULT insert_static_object(ME_TextEditor *editor, HENHMETAFILE hemf, HB
|
||||||
LPOLECLIENTSITE lpClientSite = NULL;
|
LPOLECLIENTSITE lpClientSite = NULL;
|
||||||
LPDATAOBJECT lpDataObject = NULL;
|
LPDATAOBJECT lpDataObject = NULL;
|
||||||
LPOLECACHE lpOleCache = NULL;
|
LPOLECACHE lpOleCache = NULL;
|
||||||
LPRICHEDITOLE lpReOle = NULL;
|
|
||||||
STGMEDIUM stgm;
|
STGMEDIUM stgm;
|
||||||
FORMATETC fm;
|
FORMATETC fm;
|
||||||
CLSID clsid;
|
CLSID clsid;
|
||||||
|
@ -1149,15 +1148,8 @@ static HRESULT insert_static_object(ME_TextEditor *editor, HENHMETAFILE hemf, HB
|
||||||
fm.lindex = -1;
|
fm.lindex = -1;
|
||||||
fm.tymed = stgm.tymed;
|
fm.tymed = stgm.tymed;
|
||||||
|
|
||||||
if (!editor->reOle)
|
|
||||||
{
|
|
||||||
if (!CreateIRichEditOle(NULL, editor, (LPVOID *)&editor->reOle))
|
|
||||||
return hr;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (OleCreateDefaultHandler(&CLSID_NULL, NULL, &IID_IOleObject, (void**)&lpObject) == S_OK &&
|
if (OleCreateDefaultHandler(&CLSID_NULL, NULL, &IID_IOleObject, (void**)&lpObject) == S_OK &&
|
||||||
IUnknown_QueryInterface(editor->reOle, &IID_IRichEditOle, (void**)&lpReOle) == S_OK &&
|
IRichEditOle_GetClientSite(editor->richole, &lpClientSite) == S_OK &&
|
||||||
IRichEditOle_GetClientSite(lpReOle, &lpClientSite) == S_OK &&
|
|
||||||
IOleObject_SetClientSite(lpObject, lpClientSite) == S_OK &&
|
IOleObject_SetClientSite(lpObject, lpClientSite) == S_OK &&
|
||||||
IOleObject_GetUserClassID(lpObject, &clsid) == S_OK &&
|
IOleObject_GetUserClassID(lpObject, &clsid) == S_OK &&
|
||||||
IOleObject_QueryInterface(lpObject, &IID_IOleCache, (void**)&lpOleCache) == S_OK &&
|
IOleObject_QueryInterface(lpObject, &IID_IOleCache, (void**)&lpOleCache) == S_OK &&
|
||||||
|
@ -1189,7 +1181,6 @@ static HRESULT insert_static_object(ME_TextEditor *editor, HENHMETAFILE hemf, HB
|
||||||
if (lpStorage) IStorage_Release(lpStorage);
|
if (lpStorage) IStorage_Release(lpStorage);
|
||||||
if (lpDataObject) IDataObject_Release(lpDataObject);
|
if (lpDataObject) IDataObject_Release(lpDataObject);
|
||||||
if (lpOleCache) IOleCache_Release(lpOleCache);
|
if (lpOleCache) IOleCache_Release(lpOleCache);
|
||||||
if (lpReOle) IRichEditOle_Release(lpReOle);
|
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
@ -2950,7 +2941,6 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10)
|
||||||
ed->have_texthost2 = FALSE;
|
ed->have_texthost2 = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ed->reOle = NULL;
|
|
||||||
ed->bEmulateVersion10 = bEmulateVersion10;
|
ed->bEmulateVersion10 = bEmulateVersion10;
|
||||||
ed->in_place_active = FALSE;
|
ed->in_place_active = FALSE;
|
||||||
ed->total_rows = 0;
|
ed->total_rows = 0;
|
||||||
|
@ -2993,6 +2983,7 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10)
|
||||||
ed->last_sel_start_para = ed->last_sel_end_para = ed->pCursors[0].para;
|
ed->last_sel_start_para = ed->last_sel_end_para = ed->pCursors[0].para;
|
||||||
ed->bHideSelection = FALSE;
|
ed->bHideSelection = FALSE;
|
||||||
ed->pfnWordBreak = NULL;
|
ed->pfnWordBreak = NULL;
|
||||||
|
ed->richole = NULL;
|
||||||
ed->lpOleCallback = NULL;
|
ed->lpOleCallback = NULL;
|
||||||
ed->mode = TM_MULTILEVELUNDO | TM_MULTICODEPAGE;
|
ed->mode = TM_MULTILEVELUNDO | TM_MULTICODEPAGE;
|
||||||
ed->mode |= (ed->props & TXTBIT_RICHTEXT) ? TM_RICHTEXT : TM_PLAINTEXT;
|
ed->mode |= (ed->props & TXTBIT_RICHTEXT) ? TM_RICHTEXT : TM_PLAINTEXT;
|
||||||
|
@ -3094,11 +3085,7 @@ void ME_DestroyEditor(ME_TextEditor *editor)
|
||||||
}
|
}
|
||||||
if(editor->lpOleCallback)
|
if(editor->lpOleCallback)
|
||||||
IRichEditOleCallback_Release(editor->lpOleCallback);
|
IRichEditOleCallback_Release(editor->lpOleCallback);
|
||||||
if (editor->reOle)
|
|
||||||
{
|
|
||||||
IUnknown_Release(editor->reOle);
|
|
||||||
editor->reOle = NULL;
|
|
||||||
}
|
|
||||||
OleUninitialize();
|
OleUninitialize();
|
||||||
|
|
||||||
heap_free(editor->pBuffer);
|
heap_free(editor->pBuffer);
|
||||||
|
@ -4159,14 +4146,10 @@ LRESULT editor_handle_message( ME_TextEditor *editor, UINT msg, WPARAM wParam,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case EM_GETOLEINTERFACE:
|
case EM_GETOLEINTERFACE:
|
||||||
{
|
IRichEditOle_AddRef( editor->richole );
|
||||||
if (!editor->reOle)
|
*(IRichEditOle **)lParam = editor->richole;
|
||||||
if (!CreateIRichEditOle(NULL, editor, (LPVOID *)&editor->reOle))
|
|
||||||
return 0;
|
|
||||||
if (IUnknown_QueryInterface(editor->reOle, &IID_IRichEditOle, (LPVOID *)lParam) == S_OK)
|
|
||||||
return 1;
|
return 1;
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
case EM_SETOLECALLBACK:
|
case EM_SETOLECALLBACK:
|
||||||
if(editor->lpOleCallback)
|
if(editor->lpOleCallback)
|
||||||
IRichEditOleCallback_Release(editor->lpOleCallback);
|
IRichEditOleCallback_Release(editor->lpOleCallback);
|
||||||
|
|
|
@ -263,11 +263,13 @@ void ME_UpdateScrollBar(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||||
int ME_GetParaBorderWidth(const ME_Context *c, int flags) DECLSPEC_HIDDEN;
|
int ME_GetParaBorderWidth(const ME_Context *c, int flags) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
/* richole.c */
|
/* richole.c */
|
||||||
LRESULT CreateIRichEditOle(IUnknown *outer_unk, ME_TextEditor *editor, LPVOID *ppvObj) DECLSPEC_HIDDEN;
|
|
||||||
void draw_ole( ME_Context *c, int x, int y, ME_Run* run, BOOL selected ) DECLSPEC_HIDDEN;
|
void draw_ole( ME_Context *c, int x, int y, ME_Run* run, BOOL selected ) DECLSPEC_HIDDEN;
|
||||||
void ME_GetOLEObjectSize(const ME_Context *c, ME_Run *run, SIZE *pSize) DECLSPEC_HIDDEN;
|
void ME_GetOLEObjectSize(const ME_Context *c, ME_Run *run, SIZE *pSize) DECLSPEC_HIDDEN;
|
||||||
void ME_CopyReObject(REOBJECT *dst, const REOBJECT *src, DWORD flags) DECLSPEC_HIDDEN;
|
void ME_CopyReObject(REOBJECT *dst, const REOBJECT *src, DWORD flags) DECLSPEC_HIDDEN;
|
||||||
void ME_DeleteReObject(struct re_object *re_object) DECLSPEC_HIDDEN;
|
void ME_DeleteReObject(struct re_object *re_object) DECLSPEC_HIDDEN;
|
||||||
|
void richole_release_children( struct text_services *services ) DECLSPEC_HIDDEN;
|
||||||
|
extern const IRichEditOleVtbl re_ole_vtbl DECLSPEC_HIDDEN;
|
||||||
|
extern const ITextDocument2OldVtbl text_doc2old_vtbl DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
/* editor.c */
|
/* editor.c */
|
||||||
ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10) DECLSPEC_HIDDEN;
|
ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10) DECLSPEC_HIDDEN;
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include <richole.h>
|
#include <richole.h>
|
||||||
#include "imm.h"
|
#include "imm.h"
|
||||||
#include <textserv.h>
|
#include <textserv.h>
|
||||||
|
#include <tom.h>
|
||||||
#include "usp10.h"
|
#include "usp10.h"
|
||||||
|
|
||||||
#include "wine/asm.h"
|
#include "wine/asm.h"
|
||||||
|
@ -378,7 +379,6 @@ typedef struct tagME_InStream ME_InStream;
|
||||||
typedef struct tagME_TextEditor
|
typedef struct tagME_TextEditor
|
||||||
{
|
{
|
||||||
ITextHost2 *texthost;
|
ITextHost2 *texthost;
|
||||||
IUnknown *reOle;
|
|
||||||
unsigned int bEmulateVersion10 : 1;
|
unsigned int bEmulateVersion10 : 1;
|
||||||
unsigned int in_place_active : 1;
|
unsigned int in_place_active : 1;
|
||||||
unsigned int have_texthost2 : 1;
|
unsigned int have_texthost2 : 1;
|
||||||
|
@ -409,6 +409,7 @@ typedef struct tagME_TextEditor
|
||||||
BOOL bWordWrap;
|
BOOL bWordWrap;
|
||||||
int nTextLimit;
|
int nTextLimit;
|
||||||
EDITWORDBREAKPROCW pfnWordBreak;
|
EDITWORDBREAKPROCW pfnWordBreak;
|
||||||
|
IRichEditOle *richole;
|
||||||
LPRICHEDITOLECALLBACK lpOleCallback;
|
LPRICHEDITOLECALLBACK lpOleCallback;
|
||||||
/*TEXTMODE variable; contains only one of each of the following options:
|
/*TEXTMODE variable; contains only one of each of the following options:
|
||||||
*TM_RICHTEXT or TM_PLAINTEXT
|
*TM_RICHTEXT or TM_PLAINTEXT
|
||||||
|
@ -456,4 +457,27 @@ typedef struct tagME_Context
|
||||||
ME_TextEditor *editor;
|
ME_TextEditor *editor;
|
||||||
} ME_Context;
|
} ME_Context;
|
||||||
|
|
||||||
|
struct text_selection
|
||||||
|
{
|
||||||
|
ITextSelection ITextSelection_iface;
|
||||||
|
LONG ref;
|
||||||
|
|
||||||
|
struct text_services *services;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct text_services
|
||||||
|
{
|
||||||
|
IUnknown IUnknown_inner;
|
||||||
|
ITextServices ITextServices_iface;
|
||||||
|
IRichEditOle IRichEditOle_iface;
|
||||||
|
ITextDocument2Old ITextDocument2Old_iface;
|
||||||
|
IUnknown *outer_unk;
|
||||||
|
LONG ref;
|
||||||
|
ME_TextEditor *editor;
|
||||||
|
struct text_selection *text_selection;
|
||||||
|
struct list rangelist;
|
||||||
|
struct list clientsites;
|
||||||
|
char spare[256]; /* for bug #12179 */
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -32,16 +32,6 @@
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(richedit);
|
WINE_DEFAULT_DEBUG_CHANNEL(richedit);
|
||||||
|
|
||||||
struct text_services
|
|
||||||
{
|
|
||||||
IUnknown IUnknown_inner;
|
|
||||||
ITextServices ITextServices_iface;
|
|
||||||
IUnknown *outer_unk;
|
|
||||||
LONG ref;
|
|
||||||
ME_TextEditor *editor;
|
|
||||||
char spare[256]; /* for bug #12179 */
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline struct text_services *impl_from_IUnknown( IUnknown *iface )
|
static inline struct text_services *impl_from_IUnknown( IUnknown *iface )
|
||||||
{
|
{
|
||||||
return CONTAINING_RECORD( iface, struct text_services, IUnknown_inner );
|
return CONTAINING_RECORD( iface, struct text_services, IUnknown_inner );
|
||||||
|
@ -55,13 +45,10 @@ static HRESULT WINAPI ITextServicesImpl_QueryInterface( IUnknown *iface, REFIID
|
||||||
|
|
||||||
if (IsEqualIID( iid, &IID_IUnknown )) *obj = &services->IUnknown_inner;
|
if (IsEqualIID( iid, &IID_IUnknown )) *obj = &services->IUnknown_inner;
|
||||||
else if (IsEqualIID( iid, &IID_ITextServices )) *obj = &services->ITextServices_iface;
|
else if (IsEqualIID( iid, &IID_ITextServices )) *obj = &services->ITextServices_iface;
|
||||||
else if (IsEqualIID( iid, &IID_IRichEditOle ) || IsEqualIID( iid, &IID_ITextDocument ) ||
|
else if (IsEqualIID( iid, &IID_IRichEditOle )) *obj= &services->IRichEditOle_iface;
|
||||||
IsEqualIID( iid, &IID_ITextDocument2Old ))
|
else if (IsEqualIID( iid, &IID_IDispatch ) ||
|
||||||
{
|
IsEqualIID( iid, &IID_ITextDocument ) ||
|
||||||
if (!services->editor->reOle && !CreateIRichEditOle( services->outer_unk, services->editor, (void **)&services->editor->reOle ))
|
IsEqualIID( iid, &IID_ITextDocument2Old )) *obj = &services->ITextDocument2Old_iface;
|
||||||
return E_OUTOFMEMORY;
|
|
||||||
return IUnknown_QueryInterface( services->editor->reOle, iid, obj );
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*obj = NULL;
|
*obj = NULL;
|
||||||
|
@ -92,6 +79,7 @@ static ULONG WINAPI ITextServicesImpl_Release(IUnknown *iface)
|
||||||
|
|
||||||
if (!ref)
|
if (!ref)
|
||||||
{
|
{
|
||||||
|
richole_release_children( services );
|
||||||
ME_DestroyEditor( services->editor );
|
ME_DestroyEditor( services->editor );
|
||||||
CoTaskMemFree( services );
|
CoTaskMemFree( services );
|
||||||
}
|
}
|
||||||
|
@ -597,11 +585,18 @@ HRESULT create_text_services( IUnknown *outer, ITextHost *text_host, IUnknown **
|
||||||
services->ref = 1;
|
services->ref = 1;
|
||||||
services->IUnknown_inner.lpVtbl = &textservices_inner_vtbl;
|
services->IUnknown_inner.lpVtbl = &textservices_inner_vtbl;
|
||||||
services->ITextServices_iface.lpVtbl = &textservices_vtbl;
|
services->ITextServices_iface.lpVtbl = &textservices_vtbl;
|
||||||
|
services->IRichEditOle_iface.lpVtbl = &re_ole_vtbl;
|
||||||
|
services->ITextDocument2Old_iface.lpVtbl = &text_doc2old_vtbl;
|
||||||
services->editor = ME_MakeEditor( text_host, emulate_10 );
|
services->editor = ME_MakeEditor( text_host, emulate_10 );
|
||||||
|
services->editor->richole = &services->IRichEditOle_iface;
|
||||||
|
|
||||||
if (outer) services->outer_unk = outer;
|
if (outer) services->outer_unk = outer;
|
||||||
else services->outer_unk = &services->IUnknown_inner;
|
else services->outer_unk = &services->IUnknown_inner;
|
||||||
|
|
||||||
|
services->text_selection = NULL;
|
||||||
|
list_init( &services->rangelist );
|
||||||
|
list_init( &services->clientsites );
|
||||||
|
|
||||||
*unk = &services->IUnknown_inner;
|
*unk = &services->IUnknown_inner;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue