Commit 10667b39 authored by Jinoh Kang's avatar Jinoh Kang Committed by Alexandre Julliard

riched20: Implement callback to IRichEditOleCallback_QueryInsertObject.

parent 95b4072c
...@@ -456,13 +456,21 @@ static struct re_object* create_re_object(const REOBJECT *reo, ME_Run *run) ...@@ -456,13 +456,21 @@ static struct re_object* create_re_object(const REOBJECT *reo, ME_Run *run)
return reobj; return reobj;
} }
void editor_insert_oleobj(ME_TextEditor *editor, const REOBJECT *reo) HRESULT editor_insert_oleobj(ME_TextEditor *editor, const REOBJECT *reo)
{ {
ME_Run *run, *prev; ME_Run *run, *prev;
const WCHAR space = ' '; const WCHAR space = ' ';
struct re_object *reobj_prev = NULL; struct re_object *reobj_prev = NULL;
ME_Cursor *cursor, cursor_from_ofs; ME_Cursor *cursor, cursor_from_ofs;
ME_Style *style; ME_Style *style;
HRESULT hr;
if (editor->lpOleCallback)
{
hr = IRichEditOleCallback_QueryInsertObject(editor->lpOleCallback, (LPCLSID)&reo->clsid, reo->pstg, REO_CP_SELECTION);
if (hr != S_OK)
return hr;
}
if (reo->cp == REO_CP_SELECTION) if (reo->cp == REO_CP_SELECTION)
cursor = editor->pCursors; cursor = editor->pCursors;
...@@ -495,6 +503,7 @@ void editor_insert_oleobj(ME_TextEditor *editor, const REOBJECT *reo) ...@@ -495,6 +503,7 @@ void editor_insert_oleobj(ME_TextEditor *editor, const REOBJECT *reo)
list_add_head(&editor->reobj_list, &run->reobj->entry); list_add_head(&editor->reobj_list, &run->reobj->entry);
ME_ReleaseStyle( style ); ME_ReleaseStyle( style );
return S_OK;
} }
......
...@@ -1171,8 +1171,7 @@ static HRESULT insert_static_object(ME_TextEditor *editor, HENHMETAFILE hemf, HB ...@@ -1171,8 +1171,7 @@ static HRESULT insert_static_object(ME_TextEditor *editor, HENHMETAFILE hemf, HB
reobject.dwFlags = 0; /* FIXME */ reobject.dwFlags = 0; /* FIXME */
reobject.dwUser = 0; reobject.dwUser = 0;
editor_insert_oleobj(editor, &reobject); hr = editor_insert_oleobj(editor, &reobject);
hr = S_OK;
} }
if (lpObject) IOleObject_Release(lpObject); if (lpObject) IOleObject_Release(lpObject);
......
...@@ -187,7 +187,7 @@ int ME_GetSelection(ME_TextEditor *editor, ME_Cursor **from, ME_Cursor **to) DEC ...@@ -187,7 +187,7 @@ int ME_GetSelection(ME_TextEditor *editor, ME_Cursor **from, ME_Cursor **to) DEC
BOOL ME_IsSelection(ME_TextEditor *editor) DECLSPEC_HIDDEN; BOOL ME_IsSelection(ME_TextEditor *editor) DECLSPEC_HIDDEN;
void ME_DeleteSelection(ME_TextEditor *editor) DECLSPEC_HIDDEN; void ME_DeleteSelection(ME_TextEditor *editor) DECLSPEC_HIDDEN;
void ME_SendSelChange(ME_TextEditor *editor) DECLSPEC_HIDDEN; void ME_SendSelChange(ME_TextEditor *editor) DECLSPEC_HIDDEN;
void editor_insert_oleobj( ME_TextEditor *editor, const REOBJECT *reo ) DECLSPEC_HIDDEN; HRESULT editor_insert_oleobj( ME_TextEditor *editor, const REOBJECT *reo ) DECLSPEC_HIDDEN;
BOOL ME_InternalDeleteText(ME_TextEditor *editor, ME_Cursor *start, int nChars, BOOL bForce) DECLSPEC_HIDDEN; BOOL ME_InternalDeleteText(ME_TextEditor *editor, ME_Cursor *start, int nChars, BOOL bForce) DECLSPEC_HIDDEN;
int ME_GetTextLength(ME_TextEditor *editor) DECLSPEC_HIDDEN; int ME_GetTextLength(ME_TextEditor *editor) DECLSPEC_HIDDEN;
int ME_GetTextLengthEx(ME_TextEditor *editor, const GETTEXTLENGTHEX *how) DECLSPEC_HIDDEN; int ME_GetTextLengthEx(ME_TextEditor *editor, const GETTEXTLENGTHEX *how) DECLSPEC_HIDDEN;
......
...@@ -1361,6 +1361,7 @@ static HRESULT WINAPI ...@@ -1361,6 +1361,7 @@ static HRESULT WINAPI
IRichEditOle_fnInsertObject(IRichEditOle *iface, REOBJECT *reo) IRichEditOle_fnInsertObject(IRichEditOle *iface, REOBJECT *reo)
{ {
struct text_services *services = impl_from_IRichEditOle( iface ); struct text_services *services = impl_from_IRichEditOle( iface );
HRESULT hr;
TRACE("(%p,%p)\n", services, reo); TRACE("(%p,%p)\n", services, reo);
...@@ -1369,7 +1370,10 @@ IRichEditOle_fnInsertObject(IRichEditOle *iface, REOBJECT *reo) ...@@ -1369,7 +1370,10 @@ IRichEditOle_fnInsertObject(IRichEditOle *iface, REOBJECT *reo)
if (reo->cbStruct < sizeof(*reo)) return STG_E_INVALIDPARAMETER; if (reo->cbStruct < sizeof(*reo)) return STG_E_INVALIDPARAMETER;
editor_insert_oleobj(services->editor, reo); hr = editor_insert_oleobj(services->editor, reo);
if (hr != S_OK)
return hr;
ME_CommitUndo(services->editor); ME_CommitUndo(services->editor);
ME_UpdateRepaint(services->editor, FALSE); ME_UpdateRepaint(services->editor, FALSE);
return S_OK; return S_OK;
......
...@@ -3420,7 +3420,7 @@ static void _insert_reobject(struct reolecb_obj *callback, IRichEditOle *reole, ...@@ -3420,7 +3420,7 @@ static void _insert_reobject(struct reolecb_obj *callback, IRichEditOle *reole,
IOleClientSite *clientsite; IOleClientSite *clientsite;
HRESULT hr; HRESULT hr;
olecb_expect_QueryInsertObject(callback, line, EXPECT_TODO_WINE | 1, olecb_expect_QueryInsertObject(callback, line, 1,
&CLSID_NULL, NULL, REO_CP_SELECTION /* cp overriden */, S_OK); &CLSID_NULL, NULL, REO_CP_SELECTION /* cp overriden */, S_OK);
hr = IRichEditOle_GetClientSite(reole, &clientsite); hr = IRichEditOle_GetClientSite(reole, &clientsite);
ok_(__FILE__,line)(hr == S_OK, "IRichEditOle_GetClientSite got hr %#lx.\n", hr); ok_(__FILE__,line)(hr == S_OK, "IRichEditOle_GetClientSite got hr %#lx.\n", hr);
...@@ -3495,18 +3495,16 @@ static void subtest_InsertObject(struct reolecb_obj *callback) ...@@ -3495,18 +3495,16 @@ static void subtest_InsertObject(struct reolecb_obj *callback)
hr = IRichEditOle_GetClientSite(reole, &clientsite); hr = IRichEditOle_GetClientSite(reole, &clientsite);
ok(hr == S_OK, "IRichEditOle_GetClientSite got hr %#lx.\n", hr); ok(hr == S_OK, "IRichEditOle_GetClientSite got hr %#lx.\n", hr);
olecb_expect_QueryInsertObject(callback, __LINE__, EXPECT_TODO_WINE | 1, olecb_expect_QueryInsertObject(callback, __LINE__, 1,
&CLSID_NULL, NULL, REO_CP_SELECTION, S_FALSE); &CLSID_NULL, NULL, REO_CP_SELECTION, S_FALSE);
fill_reobject_struct(&reobj, REO_CP_SELECTION, NULL, NULL, clientsite, 10, 10, DVASPECT_CONTENT, 0, 0); fill_reobject_struct(&reobj, REO_CP_SELECTION, NULL, NULL, clientsite, 10, 10, DVASPECT_CONTENT, 0, 0);
hr = IRichEditOle_InsertObject(reole, &reobj); hr = IRichEditOle_InsertObject(reole, &reobj);
todo_wine
ok(hr == S_FALSE, "IRichEditOle_InsertObject got hr %#lx.\n", hr); ok(hr == S_FALSE, "IRichEditOle_InsertObject got hr %#lx.\n", hr);
olecb_check_QueryInsertObject(callback, __LINE__); olecb_check_QueryInsertObject(callback, __LINE__);
IOleClientSite_Release(clientsite); IOleClientSite_Release(clientsite);
count = IRichEditOle_GetObjectCount(reole); count = IRichEditOle_GetObjectCount(reole);
todo_wine
ok(count == 3, "got wrong object count: %ld\n", count); ok(count == 3, "got wrong object count: %ld\n", count);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment