riched20: Allow to insert OLE object at specified offset.
Signed-off-by: Jactry Zeng <jzeng@codeweavers.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
ff4d7edc33
commit
8c894382dd
|
@ -455,15 +455,23 @@ static struct re_object* create_re_object(const REOBJECT *reo)
|
|||
return reobj;
|
||||
}
|
||||
|
||||
void ME_InsertOLEFromCursor(ME_TextEditor *editor, const REOBJECT* reo, int nCursor)
|
||||
void editor_insert_oleobj(ME_TextEditor *editor, const REOBJECT *reo)
|
||||
{
|
||||
ME_Run *run, *prev;
|
||||
const WCHAR space = ' ';
|
||||
struct re_object *reobj_prev = NULL;
|
||||
ME_Cursor *cursor = editor->pCursors + nCursor;
|
||||
ME_Style *style = style_get_insert_style( editor, cursor );
|
||||
ME_Cursor *cursor, cursor_from_ofs;
|
||||
ME_Style *style;
|
||||
|
||||
if (reo->cp == REO_CP_SELECTION)
|
||||
cursor = editor->pCursors;
|
||||
else
|
||||
{
|
||||
cursor_from_char_ofs( editor, reo->cp, &cursor_from_ofs );
|
||||
cursor = &cursor_from_ofs;
|
||||
}
|
||||
style = style_get_insert_style( editor, cursor );
|
||||
|
||||
/* FIXME no no no */
|
||||
if (ME_IsSelection(editor))
|
||||
ME_DeleteSelection(editor);
|
||||
|
||||
|
|
|
@ -1172,7 +1172,7 @@ static HRESULT insert_static_object(ME_TextEditor *editor, HENHMETAFILE hemf, HB
|
|||
reobject.dwFlags = 0; /* FIXME */
|
||||
reobject.dwUser = 0;
|
||||
|
||||
ME_InsertOLEFromCursor(editor, &reobject, 0);
|
||||
editor_insert_oleobj(editor, &reobject);
|
||||
hr = S_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -188,7 +188,7 @@ int ME_GetSelection(ME_TextEditor *editor, ME_Cursor **from, ME_Cursor **to) DEC
|
|||
BOOL ME_IsSelection(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||
void ME_DeleteSelection(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||
void ME_SendSelChange(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||
void ME_InsertOLEFromCursor(ME_TextEditor *editor, const REOBJECT* reo, int nCursor) DECLSPEC_HIDDEN;
|
||||
void 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;
|
||||
int ME_GetTextLength(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||
int ME_GetTextLengthEx(ME_TextEditor *editor, const GETTEXTLENGTHEX *how) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -1367,7 +1367,7 @@ IRichEditOle_fnInsertObject(IRichEditOle *iface, REOBJECT *reo)
|
|||
|
||||
if (reo->cbStruct < sizeof(*reo)) return STG_E_INVALIDPARAMETER;
|
||||
|
||||
ME_InsertOLEFromCursor(services->editor, reo, 0);
|
||||
editor_insert_oleobj(services->editor, reo);
|
||||
ME_CommitUndo(services->editor);
|
||||
ME_UpdateRepaint(services->editor, FALSE);
|
||||
return S_OK;
|
||||
|
|
|
@ -3377,15 +3377,15 @@ static void test_InsertObject(void)
|
|||
|
||||
SendMessageW(hwnd, EM_SETSEL, 3, 4);
|
||||
result = SendMessageW(hwnd, EM_SELECTIONTYPE, 0, 0);
|
||||
todo_wine ok(result == SEL_OBJECT, "Got selection type: %x.\n", result);
|
||||
todo_wine CHECK_REOBJECT_STRUCT(reole, REO_IOB_SELECTION, REO_GETOBJ_ALL_INTERFACES, 1, NULL, NULL, reo1.polesite, 1);
|
||||
ok(result == SEL_OBJECT, "Got selection type: %x.\n", result);
|
||||
CHECK_REOBJECT_STRUCT(reole, REO_IOB_SELECTION, REO_GETOBJ_ALL_INTERFACES, 1, NULL, NULL, reo1.polesite, 1);
|
||||
|
||||
SendMessageW(hwnd, EM_SETSEL, 2, 4);
|
||||
result = SendMessageW(hwnd, EM_SELECTIONTYPE, 0, 0);
|
||||
todo_wine ok(result == (SEL_TEXT | SEL_OBJECT), "Got selection type: %x.\n", result);
|
||||
ok(result == (SEL_TEXT | SEL_OBJECT), "Got selection type: %x.\n", result);
|
||||
|
||||
SendMessageW(hwnd, EM_SETSEL, 5, 6);
|
||||
todo_wine CHECK_REOBJECT_STRUCT(reole, REO_IOB_SELECTION, REO_GETOBJ_ALL_INTERFACES, 1, NULL, NULL, reo2.polesite, 2);
|
||||
CHECK_REOBJECT_STRUCT(reole, REO_IOB_SELECTION, REO_GETOBJ_ALL_INTERFACES, 1, NULL, NULL, reo2.polesite, 2);
|
||||
|
||||
expected_string = L"abc\xfffc""d\xfffc""efg";
|
||||
gettextex.cb = sizeof(buffer);
|
||||
|
@ -3408,7 +3408,7 @@ static void test_InsertObject(void)
|
|||
SendMessageA(hwnd, EM_SETSEL, 0, -1);
|
||||
result = SendMessageA(hwnd, EM_GETSELTEXT, (WPARAM)sizeof(bufferA), (LPARAM)bufferA);
|
||||
ok(result == strlen(expected_stringA), "Got wrong length: %d.\n", result);
|
||||
todo_wine ok(!strcmp(bufferA, expected_stringA), "Got wrong content: %s.\n", bufferA);
|
||||
ok(!strcmp(bufferA, expected_stringA), "Got wrong content: %s.\n", bufferA);
|
||||
|
||||
memset(bufferA, 0, sizeof(bufferA));
|
||||
textrange.lpstrText = bufferA;
|
||||
|
@ -3416,7 +3416,7 @@ static void test_InsertObject(void)
|
|||
textrange.chrg.cpMax = 11;
|
||||
result = SendMessageA(hwnd, EM_GETTEXTRANGE, 0, (LPARAM)&textrange);
|
||||
ok(result == strlen(expected_stringA), "Got wrong length: %d.\n", result);
|
||||
todo_wine ok(!strcmp(bufferA, expected_stringA), "Got wrong content: %s.\n", bufferA);
|
||||
ok(!strcmp(bufferA, expected_stringA), "Got wrong content: %s.\n", bufferA);
|
||||
|
||||
expected_string = L"abc\xfffc""d\xfffc""efg\r";
|
||||
hr = ITextDocument_Range(doc, 0, 11, &range);
|
||||
|
@ -3467,7 +3467,7 @@ static void test_InsertObject(void)
|
|||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
string = GlobalLock(stgmedium.hGlobal);
|
||||
ok(lstrlenW(string) == lstrlenW(expected_string), "Got wrong length: %d.\n", lstrlenW(string));
|
||||
todo_wine ok(!lstrcmpW(string, expected_string), "Got wrong content: %s.\n", debugstr_w(string));
|
||||
ok(!lstrcmpW(string, expected_string), "Got wrong content: %s.\n", debugstr_w(string));
|
||||
GlobalUnlock(stgmedium.hGlobal);
|
||||
|
||||
expected_string = L"abc\xfffc""d\xfffc""efg";
|
||||
|
@ -3491,7 +3491,7 @@ static void test_InsertObject(void)
|
|||
SendMessageA(hwnd, EM_SETSEL, 0, -1);
|
||||
result = SendMessageA(hwnd, EM_GETSELTEXT, (WPARAM)sizeof(bufferA), (LPARAM)bufferA);
|
||||
ok(result == strlen(expected_stringA), "Got wrong length: %d.\n", result);
|
||||
todo_wine ok(!strcmp(bufferA, expected_stringA), "Got wrong content: %s.\n", bufferA);
|
||||
ok(!strcmp(bufferA, expected_stringA), "Got wrong content: %s.\n", bufferA);
|
||||
|
||||
memset(bufferA, 0, sizeof(bufferA));
|
||||
textrange.lpstrText = bufferA;
|
||||
|
@ -3499,7 +3499,7 @@ static void test_InsertObject(void)
|
|||
textrange.chrg.cpMax = 11;
|
||||
result = SendMessageA(hwnd, EM_GETTEXTRANGE, 0, (LPARAM)&textrange);
|
||||
ok(result == strlen(expected_stringA), "Got wrong length: %d.\n", result);
|
||||
todo_wine ok(!strcmp(bufferA, expected_stringA), "Got wrong content: %s.\n", bufferA);
|
||||
ok(!strcmp(bufferA, expected_stringA), "Got wrong content: %s.\n", bufferA);
|
||||
|
||||
expected_string = L"abc\xfffc""d\xfffc""efg";
|
||||
hr = ITextDocument_Range(doc, 0, 11, &range);
|
||||
|
|
Loading…
Reference in New Issue