Aric Stewart : msctf: Beginning implementation of ITfContext::GetStart.

Alexandre Julliard julliard at winehq.org
Fri May 22 08:25:32 CDT 2009


Module: wine
Branch: master
Commit: 6772a07a94fdc3fee7b99af5cae37e0727debc61
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=6772a07a94fdc3fee7b99af5cae37e0727debc61

Author: Aric Stewart <aric at codeweavers.com>
Date:   Thu May 21 13:45:26 2009 -0500

msctf: Beginning implementation of ITfContext::GetStart.

---

 dlls/msctf/context.c              |   18 ++++++++++++++++--
 dlls/msctf/tests/inputprocessor.c |   24 ++++++++++++++++++++++++
 include/msctf.idl                 |    3 +++
 3 files changed, 43 insertions(+), 2 deletions(-)

diff --git a/dlls/msctf/context.c b/dlls/msctf/context.c
index 1438d09..ce5463f 100644
--- a/dlls/msctf/context.c
+++ b/dlls/msctf/context.c
@@ -299,8 +299,22 @@ static HRESULT WINAPI Context_GetStart (ITfContext *iface,
         TfEditCookie ec, ITfRange **ppStart)
 {
     Context *This = (Context *)iface;
-    FIXME("STUB:(%p)\n",This);
-    return E_NOTIMPL;
+    EditCookie *cookie;
+    TRACE("(%p) %i %p\n",This,ec,ppStart);
+
+    if (!ppStart)
+        return E_INVALIDARG;
+
+    *ppStart = NULL;
+
+    if (!This->connected)
+        return TF_E_DISCONNECTED;
+
+    if (get_Cookie_magic(ec)!=COOKIE_MAGIC_EDITCOOKIE)
+        return TF_E_NOLOCK;
+
+    cookie = get_Cookie_data(ec);
+    return Range_Constructor(iface, This->pITextStoreACP, cookie->lockType, 0, 0, ppStart);
 }
 
 static HRESULT WINAPI Context_GetEnd (ITfContext *iface,
diff --git a/dlls/msctf/tests/inputprocessor.c b/dlls/msctf/tests/inputprocessor.c
index 11e7233..2fff504 100644
--- a/dlls/msctf/tests/inputprocessor.c
+++ b/dlls/msctf/tests/inputprocessor.c
@@ -1373,9 +1373,33 @@ static ULONG WINAPI EditSession_Release(ITfEditSession *iface)
 static HRESULT WINAPI EditSession_DoEditSession(ITfEditSession *iface,
 TfEditCookie ec)
 {
+    ITfContext *cxt;
+    ITfDocumentMgr *dm;
+    ITfRange *range;
+    HRESULT hr;
+
     ok(test_DoEditSession == SINK_EXPECTED, "Unexpected DoEditSession\n");
     ok(test_ACP_RequestLock == SINK_FIRED,"Expected RequestLock not fired\n");
     test_DoEditSession = SINK_FIRED;
+
+    ITfThreadMgr_GetFocus(g_tm, &dm);
+    ITfDocumentMgr_GetTop(dm,&cxt);
+
+    hr = ITfContext_GetStart(cxt,ec,NULL);
+    ok(hr == E_INVALIDARG,"Unexpected return code %x\n",hr);
+
+    range = (ITfRange*)0xdeaddead;
+    hr = ITfContext_GetStart(cxt,0xdeadcafe,&range);
+    ok(hr == TF_E_NOLOCK,"Unexpected return code %x\n",hr);
+    ok(range == NULL,"Range not set to NULL\n");
+
+    hr = ITfContext_GetStart(cxt,ec,&range);
+    ok(SUCCEEDED(hr),"Unexpected return code %x\n",hr);
+    ok(range != NULL,"Range set to NULL\n");
+
+    ITfRange_Release(range);
+    ITfContext_Release(cxt);
+    ITfDocumentMgr_Release(dm);
     return 0xdeadcafe;
 }
 
diff --git a/include/msctf.idl b/include/msctf.idl
index 24be332..93f70c1 100644
--- a/include/msctf.idl
+++ b/include/msctf.idl
@@ -25,7 +25,10 @@ import "textstor.idl";
 cpp_quote("#include <winuser.h>")
 
 cpp_quote("#define TF_E_STACKFULL MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0501)")
+cpp_quote("#define TF_E_DISCONNECTED    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0504)")
 cpp_quote("#define TF_E_ALREADY_EXISTS  MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0506)")
+cpp_quote("#define TF_E_NOLOCK          MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0201)")
+
 cpp_quote("EXTERN_C const CLSID CLSID_TF_ThreadMgr;")
 cpp_quote("EXTERN_C const CLSID CLSID_TF_InputProcessorProfiles;")
 cpp_quote("EXTERN_C const CLSID CLSID_TF_CategoryMgr;")




More information about the wine-cvs mailing list