riched20: Implement GetText() for regular range.
This commit is contained in:
parent
c230b32777
commit
b2e13bc6e7
|
@ -1563,20 +1563,38 @@ static HRESULT WINAPI ITextRange_fnInvoke(ITextRange *me, DISPID dispIdMember, R
|
|||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ITextRange_fnGetText(ITextRange *me, BSTR *pbstr)
|
||||
static HRESULT WINAPI ITextRange_fnGetText(ITextRange *me, BSTR *str)
|
||||
{
|
||||
ITextRangeImpl *This = impl_from_ITextRange(me);
|
||||
ME_Cursor start, end;
|
||||
int length;
|
||||
BOOL bEOP;
|
||||
|
||||
FIXME("(%p)->(%p): stub\n", This, pbstr);
|
||||
TRACE("(%p)->(%p)\n", This, str);
|
||||
|
||||
if (!This->reOle)
|
||||
return CO_E_RELEASED;
|
||||
|
||||
if (!pbstr)
|
||||
if (!str)
|
||||
return E_INVALIDARG;
|
||||
|
||||
*pbstr = NULL;
|
||||
return E_NOTIMPL;
|
||||
/* return early for degenerate range */
|
||||
if (This->start == This->end) {
|
||||
*str = NULL;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
ME_CursorFromCharOfs(This->reOle->editor, This->start, &start);
|
||||
ME_CursorFromCharOfs(This->reOle->editor, This->end, &end);
|
||||
|
||||
length = This->end - This->start;
|
||||
*str = SysAllocStringLen(NULL, length);
|
||||
if (!*str)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
bEOP = (end.pRun->next->type == diTextEnd && This->end > ME_GetTextLength(This->reOle->editor));
|
||||
ME_GetTextW(This->reOle->editor, *str, length, &start, length, FALSE, bEOP);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ITextRange_fnSetText(ITextRange *me, BSTR str)
|
||||
|
|
|
@ -544,27 +544,24 @@ static void test_GetText(void)
|
|||
hres = ITextDocument_Range(txtDoc, 0, 4, &range);
|
||||
ok(hres == S_OK, "got 0x%08x\n", hres);
|
||||
hres = ITextRange_GetText(range, &bstr);
|
||||
todo_wine {
|
||||
ok(hres == S_OK, "got 0x%08x\n", hres);
|
||||
ok(!lstrcmpW(bstr, bufW1), "got wrong text: %s\n", wine_dbgstr_w(bstr));
|
||||
}
|
||||
|
||||
SysFreeString(bstr);
|
||||
ITextRange_Release(range);
|
||||
|
||||
hres = ITextDocument_Range(txtDoc, 4, 0, &range);
|
||||
ok(hres == S_OK, "got 0x%08x\n", hres);
|
||||
hres = ITextRange_GetText(range, &bstr);
|
||||
todo_wine {
|
||||
ok(hres == S_OK, "got 0x%08x\n", hres);
|
||||
ok(!lstrcmpW(bstr, bufW1), "got wrong text: %s\n", wine_dbgstr_w(bstr));
|
||||
}
|
||||
|
||||
SysFreeString(bstr);
|
||||
ITextRange_Release(range);
|
||||
|
||||
hres = ITextDocument_Range(txtDoc, 1, 1, &range);
|
||||
ok(hres == S_OK, "got 0x%08x\n", hres);
|
||||
hres = ITextRange_GetText(range, &bstr);
|
||||
todo_wine
|
||||
ok(hres == S_OK, "got 0x%08x\n", hres);
|
||||
ok(!bstr, "got wrong text: %s\n", wine_dbgstr_w(bstr));
|
||||
if (!is64bit)
|
||||
|
@ -577,37 +574,33 @@ todo_wine
|
|||
hres = ITextDocument_Range(txtDoc, 8, 12, &range);
|
||||
ok(hres == S_OK, "got 0x%08x\n", hres);
|
||||
hres = ITextRange_GetText(range, &bstr);
|
||||
todo_wine {
|
||||
ok(hres == S_OK, "got 0x%08x\n", hres);
|
||||
ok(!lstrcmpW(bstr, bufW3), "got wrong text: %s\n", wine_dbgstr_w(bstr));
|
||||
}
|
||||
|
||||
SysFreeString(bstr);
|
||||
ITextRange_Release(range);
|
||||
|
||||
hres = ITextDocument_Range(txtDoc, 8, 13, &range);
|
||||
ok(hres == S_OK, "got 0x%08x\n", hres);
|
||||
hres = ITextRange_GetText(range, &bstr);
|
||||
todo_wine {
|
||||
ok(hres == S_OK, "got 0x%08x\n", hres);
|
||||
ok(!lstrcmpW(bstr, bufW2), "got wrong text: %s\n", wine_dbgstr_w(bstr));
|
||||
}
|
||||
|
||||
SysFreeString(bstr);
|
||||
ITextRange_Release(range);
|
||||
|
||||
hres = ITextDocument_Range(txtDoc, 12, 13, &range);
|
||||
ok(hres == S_OK, "got 0x%08x\n", hres);
|
||||
hres = ITextRange_GetText(range, &bstr);
|
||||
todo_wine {
|
||||
ok(hres == S_OK, "got 0x%08x\n", hres);
|
||||
ok(!lstrcmpW(bstr, bufW5), "got wrong text: %s\n", wine_dbgstr_w(bstr));
|
||||
}
|
||||
|
||||
SysFreeString(bstr);
|
||||
ITextRange_Release(range);
|
||||
|
||||
hres = ITextDocument_Range(txtDoc, 0, -1, &range);
|
||||
ok(hres == S_OK, "got 0x%08x\n", hres);
|
||||
hres = ITextRange_GetText(range, &bstr);
|
||||
todo_wine
|
||||
ok(hres == S_OK, "got 0x%08x\n", hres);
|
||||
ok(!bstr, "got wrong text: %s\n", wine_dbgstr_w(bstr));
|
||||
ITextRange_Release(range);
|
||||
|
@ -615,10 +608,9 @@ todo_wine
|
|||
hres = ITextDocument_Range(txtDoc, -1, 9, &range);
|
||||
ok(hres == S_OK, "got 0x%08x\n", hres);
|
||||
hres = ITextRange_GetText(range, &bstr);
|
||||
todo_wine {
|
||||
ok(hres == S_OK, "got 0x%08x\n", hres);
|
||||
ok(!lstrcmpW(bstr, bufW6), "got wrong text: %s\n", wine_dbgstr_w(bstr));
|
||||
}
|
||||
|
||||
SysFreeString(bstr);
|
||||
|
||||
release_interfaces(&w, &reOle, &txtDoc, NULL);
|
||||
|
|
Loading…
Reference in New Issue