msctf: Beginning implementation of ITfContext::GetSelection.
This commit is contained in:
parent
7fa47cd3f5
commit
13d6aa2bb7
|
@ -283,10 +283,61 @@ static HRESULT WINAPI Context_GetSelection (ITfContext *iface,
|
||||||
TF_SELECTION *pSelection, ULONG *pcFetched)
|
TF_SELECTION *pSelection, ULONG *pcFetched)
|
||||||
{
|
{
|
||||||
Context *This = (Context *)iface;
|
Context *This = (Context *)iface;
|
||||||
FIXME("STUB:(%p)\n",This);
|
EditCookie *cookie;
|
||||||
|
ULONG count, i;
|
||||||
|
ULONG totalFetched = 0;
|
||||||
|
HRESULT hr = S_OK;
|
||||||
|
|
||||||
|
if (!pSelection || !pcFetched)
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
|
*pcFetched = 0;
|
||||||
|
|
||||||
|
if (!This->connected)
|
||||||
|
return TF_E_DISCONNECTED;
|
||||||
|
|
||||||
|
if (get_Cookie_magic(ec)!=COOKIE_MAGIC_EDITCOOKIE)
|
||||||
|
return TF_E_NOLOCK;
|
||||||
|
|
||||||
|
if (!This->pITextStoreACP)
|
||||||
|
{
|
||||||
|
FIXME("Context does not have a ITextStoreACP\n");
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cookie = get_Cookie_data(ec);
|
||||||
|
|
||||||
|
if (ulIndex == TF_DEFAULT_SELECTION)
|
||||||
|
count = 1;
|
||||||
|
else
|
||||||
|
count = ulCount;
|
||||||
|
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
DWORD fetched;
|
||||||
|
TS_SELECTION_ACP acps;
|
||||||
|
|
||||||
|
hr = ITextStoreACP_GetSelection(This->pITextStoreACP, ulIndex + i,
|
||||||
|
1, &acps, &fetched);
|
||||||
|
|
||||||
|
if (hr == TS_E_NOLOCK)
|
||||||
|
return TF_E_NOLOCK;
|
||||||
|
else if (SUCCEEDED(hr))
|
||||||
|
{
|
||||||
|
pSelection[totalFetched].style.ase = acps.style.ase;
|
||||||
|
pSelection[totalFetched].style.fInterimChar = acps.style.fInterimChar;
|
||||||
|
Range_Constructor(iface, This->pITextStoreACP, cookie->lockType, acps.acpStart, acps.acpEnd, &pSelection[totalFetched].range);
|
||||||
|
totalFetched ++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
*pcFetched = totalFetched;
|
||||||
|
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI Context_SetSelection (ITfContext *iface,
|
static HRESULT WINAPI Context_SetSelection (ITfContext *iface,
|
||||||
TfEditCookie ec, ULONG ulCount, const TF_SELECTION *pSelection)
|
TfEditCookie ec, ULONG ulCount, const TF_SELECTION *pSelection)
|
||||||
{
|
{
|
||||||
|
|
|
@ -58,6 +58,7 @@ static INT test_ACP_AdviseSink = SINK_UNEXPECTED;
|
||||||
static INT test_ACP_GetStatus = SINK_UNEXPECTED;
|
static INT test_ACP_GetStatus = SINK_UNEXPECTED;
|
||||||
static INT test_ACP_RequestLock = SINK_UNEXPECTED;
|
static INT test_ACP_RequestLock = SINK_UNEXPECTED;
|
||||||
static INT test_ACP_GetEndACP = SINK_UNEXPECTED;
|
static INT test_ACP_GetEndACP = SINK_UNEXPECTED;
|
||||||
|
static INT test_ACP_GetSelection = SINK_UNEXPECTED;
|
||||||
static INT test_DoEditSession = SINK_UNEXPECTED;
|
static INT test_DoEditSession = SINK_UNEXPECTED;
|
||||||
|
|
||||||
|
|
||||||
|
@ -171,7 +172,15 @@ static HRESULT WINAPI TextStoreACP_QueryInsert(ITextStoreACP *iface,
|
||||||
static HRESULT WINAPI TextStoreACP_GetSelection(ITextStoreACP *iface,
|
static HRESULT WINAPI TextStoreACP_GetSelection(ITextStoreACP *iface,
|
||||||
ULONG ulIndex, ULONG ulCount, TS_SELECTION_ACP *pSelection, ULONG *pcFetched)
|
ULONG ulIndex, ULONG ulCount, TS_SELECTION_ACP *pSelection, ULONG *pcFetched)
|
||||||
{
|
{
|
||||||
trace("\n");
|
ok(test_ACP_GetSelection == SINK_EXPECTED, "Unexpected TextStoreACP_GetSelection\n");
|
||||||
|
test_ACP_GetSelection = SINK_FIRED;
|
||||||
|
|
||||||
|
pSelection->acpStart = 10;
|
||||||
|
pSelection->acpEnd = 20;
|
||||||
|
pSelection->style.fInterimChar = 0;
|
||||||
|
pSelection->style.ase = TS_AE_NONE;
|
||||||
|
*pcFetched = 1;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
static HRESULT WINAPI TextStoreACP_SetSelection(ITextStoreACP *iface,
|
static HRESULT WINAPI TextStoreACP_SetSelection(ITextStoreACP *iface,
|
||||||
|
@ -1378,6 +1387,8 @@ TfEditCookie ec)
|
||||||
ITfContext *cxt;
|
ITfContext *cxt;
|
||||||
ITfDocumentMgr *dm;
|
ITfDocumentMgr *dm;
|
||||||
ITfRange *range;
|
ITfRange *range;
|
||||||
|
TF_SELECTION selection;
|
||||||
|
ULONG fetched;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
ok(test_DoEditSession == SINK_EXPECTED, "Unexpected DoEditSession\n");
|
ok(test_DoEditSession == SINK_EXPECTED, "Unexpected DoEditSession\n");
|
||||||
|
@ -1416,6 +1427,16 @@ TfEditCookie ec)
|
||||||
ok(test_ACP_GetEndACP == SINK_FIRED, "GetEndACP not fired as expected\n");
|
ok(test_ACP_GetEndACP == SINK_FIRED, "GetEndACP not fired as expected\n");
|
||||||
|
|
||||||
ITfRange_Release(range);
|
ITfRange_Release(range);
|
||||||
|
|
||||||
|
selection.range = NULL;
|
||||||
|
test_ACP_GetSelection = SINK_EXPECTED;
|
||||||
|
hr = ITfContext_GetSelection(cxt, ec, TF_DEFAULT_SELECTION, 1, &selection, &fetched);
|
||||||
|
ok(SUCCEEDED(hr),"ITfContext_GetSelection failed\n");
|
||||||
|
ok(fetched == 1,"fetched incorrect\n");
|
||||||
|
ok(selection.range != NULL,"NULL range\n");
|
||||||
|
ok(test_ACP_GetSelection == SINK_FIRED," expected ACP_GetSepection not fired\n");
|
||||||
|
ITfRange_Release(selection.range);
|
||||||
|
|
||||||
ITfContext_Release(cxt);
|
ITfContext_Release(cxt);
|
||||||
ITfDocumentMgr_Release(dm);
|
ITfDocumentMgr_Release(dm);
|
||||||
return 0xdeadcafe;
|
return 0xdeadcafe;
|
||||||
|
|
|
@ -21,6 +21,8 @@ import "oaidl.idl";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
cpp_quote("#define TS_E_READONLY MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0209)")
|
cpp_quote("#define TS_E_READONLY MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0209)")
|
||||||
|
cpp_quote("#define TS_E_NOLOCK MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0201)")
|
||||||
|
|
||||||
|
|
||||||
const ULONG TS_DEFAULT_SELECTION = ~0u;
|
const ULONG TS_DEFAULT_SELECTION = ~0u;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue