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;
|
||||
LPDATAOBJECT lpDataObject = NULL;
|
||||
LPOLECACHE lpOleCache = NULL;
|
||||
LPRICHEDITOLE lpReOle = NULL;
|
||||
STGMEDIUM stgm;
|
||||
FORMATETC fm;
|
||||
CLSID clsid;
|
||||
|
@ -1149,15 +1148,8 @@ static HRESULT insert_static_object(ME_TextEditor *editor, HENHMETAFILE hemf, HB
|
|||
fm.lindex = -1;
|
||||
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 &&
|
||||
IUnknown_QueryInterface(editor->reOle, &IID_IRichEditOle, (void**)&lpReOle) == S_OK &&
|
||||
IRichEditOle_GetClientSite(lpReOle, &lpClientSite) == S_OK &&
|
||||
IRichEditOle_GetClientSite(editor->richole, &lpClientSite) == S_OK &&
|
||||
IOleObject_SetClientSite(lpObject, lpClientSite) == S_OK &&
|
||||
IOleObject_GetUserClassID(lpObject, &clsid) == 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 (lpDataObject) IDataObject_Release(lpDataObject);
|
||||
if (lpOleCache) IOleCache_Release(lpOleCache);
|
||||
if (lpReOle) IRichEditOle_Release(lpReOle);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
@ -2950,7 +2941,6 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10)
|
|||
ed->have_texthost2 = FALSE;
|
||||
}
|
||||
|
||||
ed->reOle = NULL;
|
||||
ed->bEmulateVersion10 = bEmulateVersion10;
|
||||
ed->in_place_active = FALSE;
|
||||
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->bHideSelection = FALSE;
|
||||
ed->pfnWordBreak = NULL;
|
||||
ed->richole = NULL;
|
||||
ed->lpOleCallback = NULL;
|
||||
ed->mode = TM_MULTILEVELUNDO | TM_MULTICODEPAGE;
|
||||
ed->mode |= (ed->props & TXTBIT_RICHTEXT) ? TM_RICHTEXT : TM_PLAINTEXT;
|
||||
|
@ -3094,11 +3085,7 @@ void ME_DestroyEditor(ME_TextEditor *editor)
|
|||
}
|
||||
if(editor->lpOleCallback)
|
||||
IRichEditOleCallback_Release(editor->lpOleCallback);
|
||||
if (editor->reOle)
|
||||
{
|
||||
IUnknown_Release(editor->reOle);
|
||||
editor->reOle = NULL;
|
||||
}
|
||||
|
||||
OleUninitialize();
|
||||
|
||||
heap_free(editor->pBuffer);
|
||||
|
@ -4159,14 +4146,10 @@ LRESULT editor_handle_message( ME_TextEditor *editor, UINT msg, WPARAM wParam,
|
|||
return 0;
|
||||
}
|
||||
case EM_GETOLEINTERFACE:
|
||||
{
|
||||
if (!editor->reOle)
|
||||
if (!CreateIRichEditOle(NULL, editor, (LPVOID *)&editor->reOle))
|
||||
return 0;
|
||||
if (IUnknown_QueryInterface(editor->reOle, &IID_IRichEditOle, (LPVOID *)lParam) == S_OK)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
IRichEditOle_AddRef( editor->richole );
|
||||
*(IRichEditOle **)lParam = editor->richole;
|
||||
return 1;
|
||||
|
||||
case EM_SETOLECALLBACK:
|
||||
if(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;
|
||||
|
||||
/* 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 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_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 */
|
||||
ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include <richole.h>
|
||||
#include "imm.h"
|
||||
#include <textserv.h>
|
||||
#include <tom.h>
|
||||
#include "usp10.h"
|
||||
|
||||
#include "wine/asm.h"
|
||||
|
@ -378,7 +379,6 @@ typedef struct tagME_InStream ME_InStream;
|
|||
typedef struct tagME_TextEditor
|
||||
{
|
||||
ITextHost2 *texthost;
|
||||
IUnknown *reOle;
|
||||
unsigned int bEmulateVersion10 : 1;
|
||||
unsigned int in_place_active : 1;
|
||||
unsigned int have_texthost2 : 1;
|
||||
|
@ -409,6 +409,7 @@ typedef struct tagME_TextEditor
|
|||
BOOL bWordWrap;
|
||||
int nTextLimit;
|
||||
EDITWORDBREAKPROCW pfnWordBreak;
|
||||
IRichEditOle *richole;
|
||||
LPRICHEDITOLECALLBACK lpOleCallback;
|
||||
/*TEXTMODE variable; contains only one of each of the following options:
|
||||
*TM_RICHTEXT or TM_PLAINTEXT
|
||||
|
@ -456,4 +457,27 @@ typedef struct tagME_Context
|
|||
ME_TextEditor *editor;
|
||||
} 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
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -32,16 +32,6 @@
|
|||
|
||||
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 )
|
||||
{
|
||||
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;
|
||||
else if (IsEqualIID( iid, &IID_ITextServices )) *obj = &services->ITextServices_iface;
|
||||
else if (IsEqualIID( iid, &IID_IRichEditOle ) || IsEqualIID( iid, &IID_ITextDocument ) ||
|
||||
IsEqualIID( iid, &IID_ITextDocument2Old ))
|
||||
{
|
||||
if (!services->editor->reOle && !CreateIRichEditOle( services->outer_unk, services->editor, (void **)&services->editor->reOle ))
|
||||
return E_OUTOFMEMORY;
|
||||
return IUnknown_QueryInterface( services->editor->reOle, iid, obj );
|
||||
}
|
||||
else if (IsEqualIID( iid, &IID_IRichEditOle )) *obj= &services->IRichEditOle_iface;
|
||||
else if (IsEqualIID( iid, &IID_IDispatch ) ||
|
||||
IsEqualIID( iid, &IID_ITextDocument ) ||
|
||||
IsEqualIID( iid, &IID_ITextDocument2Old )) *obj = &services->ITextDocument2Old_iface;
|
||||
else
|
||||
{
|
||||
*obj = NULL;
|
||||
|
@ -92,6 +79,7 @@ static ULONG WINAPI ITextServicesImpl_Release(IUnknown *iface)
|
|||
|
||||
if (!ref)
|
||||
{
|
||||
richole_release_children( services );
|
||||
ME_DestroyEditor( services->editor );
|
||||
CoTaskMemFree( services );
|
||||
}
|
||||
|
@ -597,11 +585,18 @@ HRESULT create_text_services( IUnknown *outer, ITextHost *text_host, IUnknown **
|
|||
services->ref = 1;
|
||||
services->IUnknown_inner.lpVtbl = &textservices_inner_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->richole = &services->IRichEditOle_iface;
|
||||
|
||||
if (outer) services->outer_unk = outer;
|
||||
else services->outer_unk = &services->IUnknown_inner;
|
||||
|
||||
services->text_selection = NULL;
|
||||
list_init( &services->rangelist );
|
||||
list_init( &services->clientsites );
|
||||
|
||||
*unk = &services->IUnknown_inner;
|
||||
return S_OK;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue