annotate EXCLUDE/GLTSF/src/TSF.cpp @ 4740:abf528de6d2e

Added condition check macros to make the code clear and easier to debug. Updated code to use macros.
author dewyatt
date Sun, 27 Jun 2010 22:03:08 -0400
parents f51a9f01b508
children
rev   line source
4731
bfc8ad7234b6 Adding some initial TSF code
dewyatt
parents:
diff changeset
1 #include "TSF.hpp"
4732
e1307be6cb9e Implementing base parts of TSF
dewyatt
parents: 4731
diff changeset
2 #include <stdexcept>
e1307be6cb9e Implementing base parts of TSF
dewyatt
parents: 4731
diff changeset
3
4734
0c7c67d4e6ee Added On_Char method to Window_Listener for WM_CHAR messages.
dewyatt
parents: 4732
diff changeset
4 bool TSF::COM_Initialized = false;
0c7c67d4e6ee Added On_Char method to Window_Listener for WM_CHAR messages.
dewyatt
parents: 4732
diff changeset
5 CComPtr<ITfThreadMgr> TSF::Thread_Manager;
4739
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
6 TfClientId TSF::Client_Id;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
7 TSF::TSF_Text_Store *TSF::Text_Store = NULL;
4732
e1307be6cb9e Implementing base parts of TSF
dewyatt
parents: 4731
diff changeset
8
e1307be6cb9e Implementing base parts of TSF
dewyatt
parents: 4731
diff changeset
9 void TSF::Initialize()
e1307be6cb9e Implementing base parts of TSF
dewyatt
parents: 4731
diff changeset
10 {
4734
0c7c67d4e6ee Added On_Char method to Window_Listener for WM_CHAR messages.
dewyatt
parents: 4732
diff changeset
11 if (!COM_Initialized)
0c7c67d4e6ee Added On_Char method to Window_Listener for WM_CHAR messages.
dewyatt
parents: 4732
diff changeset
12 {
0c7c67d4e6ee Added On_Char method to Window_Listener for WM_CHAR messages.
dewyatt
parents: 4732
diff changeset
13 HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
0c7c67d4e6ee Added On_Char method to Window_Listener for WM_CHAR messages.
dewyatt
parents: 4732
diff changeset
14 if (S_OK != hr && S_FALSE != hr)
0c7c67d4e6ee Added On_Char method to Window_Listener for WM_CHAR messages.
dewyatt
parents: 4732
diff changeset
15 throw std::runtime_error("Failed to initialize COM");
4732
e1307be6cb9e Implementing base parts of TSF
dewyatt
parents: 4731
diff changeset
16
4734
0c7c67d4e6ee Added On_Char method to Window_Listener for WM_CHAR messages.
dewyatt
parents: 4732
diff changeset
17 COM_Initialized = true;
0c7c67d4e6ee Added On_Char method to Window_Listener for WM_CHAR messages.
dewyatt
parents: 4732
diff changeset
18 }
0c7c67d4e6ee Added On_Char method to Window_Listener for WM_CHAR messages.
dewyatt
parents: 4732
diff changeset
19 if (!Thread_Manager)
0c7c67d4e6ee Added On_Char method to Window_Listener for WM_CHAR messages.
dewyatt
parents: 4732
diff changeset
20 {
0c7c67d4e6ee Added On_Char method to Window_Listener for WM_CHAR messages.
dewyatt
parents: 4732
diff changeset
21 if (FAILED(CoCreateInstance(CLSID_TF_ThreadMgr, NULL, CLSCTX_INPROC_SERVER, IID_ITfThreadMgr, reinterpret_cast<void **>(&Thread_Manager))))
0c7c67d4e6ee Added On_Char method to Window_Listener for WM_CHAR messages.
dewyatt
parents: 4732
diff changeset
22 throw std::runtime_error("Failed to create ITfThreadMgr instance");
4732
e1307be6cb9e Implementing base parts of TSF
dewyatt
parents: 4731
diff changeset
23
4739
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
24 if (FAILED(Thread_Manager->Activate(&Client_Id)))
4734
0c7c67d4e6ee Added On_Char method to Window_Listener for WM_CHAR messages.
dewyatt
parents: 4732
diff changeset
25 throw std::runtime_error("ITfThreadMgr::Activate failed");
4739
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
26
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
27 Text_Store = new TSF_Text_Store;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
28 Text_Store->Initialize();
4734
0c7c67d4e6ee Added On_Char method to Window_Listener for WM_CHAR messages.
dewyatt
parents: 4732
diff changeset
29 }
4732
e1307be6cb9e Implementing base parts of TSF
dewyatt
parents: 4731
diff changeset
30 }
e1307be6cb9e Implementing base parts of TSF
dewyatt
parents: 4731
diff changeset
31
e1307be6cb9e Implementing base parts of TSF
dewyatt
parents: 4731
diff changeset
32 void TSF::Finalize()
e1307be6cb9e Implementing base parts of TSF
dewyatt
parents: 4731
diff changeset
33 {
4734
0c7c67d4e6ee Added On_Char method to Window_Listener for WM_CHAR messages.
dewyatt
parents: 4732
diff changeset
34 if (Thread_Manager)
4732
e1307be6cb9e Implementing base parts of TSF
dewyatt
parents: 4731
diff changeset
35 {
4734
0c7c67d4e6ee Added On_Char method to Window_Listener for WM_CHAR messages.
dewyatt
parents: 4732
diff changeset
36 Thread_Manager->Deactivate();
0c7c67d4e6ee Added On_Char method to Window_Listener for WM_CHAR messages.
dewyatt
parents: 4732
diff changeset
37 Thread_Manager = NULL;
4732
e1307be6cb9e Implementing base parts of TSF
dewyatt
parents: 4731
diff changeset
38 }
4734
0c7c67d4e6ee Added On_Char method to Window_Listener for WM_CHAR messages.
dewyatt
parents: 4732
diff changeset
39 if (COM_Initialized)
4732
e1307be6cb9e Implementing base parts of TSF
dewyatt
parents: 4731
diff changeset
40 {
e1307be6cb9e Implementing base parts of TSF
dewyatt
parents: 4731
diff changeset
41 CoUninitialize();
4734
0c7c67d4e6ee Added On_Char method to Window_Listener for WM_CHAR messages.
dewyatt
parents: 4732
diff changeset
42 COM_Initialized = false;
4732
e1307be6cb9e Implementing base parts of TSF
dewyatt
parents: 4731
diff changeset
43 }
e1307be6cb9e Implementing base parts of TSF
dewyatt
parents: 4731
diff changeset
44 }
4739
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
45
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
46 STDMETHODIMP TSF::TSF_Text_Store::QueryInterface(REFIID riid, void **ppvObject)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
47 {
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
48 *ppvObject = NULL;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
49 if (IID_IUnknown == riid || IID_ITextStoreACP == riid)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
50 *ppvObject = static_cast<ITextStoreACP *>(this);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
51 else if (IID_ITfContextOwnerCompositionSink == riid)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
52 *ppvObject = static_cast<ITfContextOwnerCompositionSink *>(this);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
53
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
54 if (*ppvObject)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
55 {
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
56 AddRef();
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
57 return S_OK;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
58 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
59 return E_NOINTERFACE;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
60 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
61
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
62 STDMETHODIMP_(ULONG) TSF::TSF_Text_Store::AddRef()
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
63 {
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
64 return ++my_Reference_Count;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
65 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
66
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
67 STDMETHODIMP_(ULONG) TSF::TSF_Text_Store::Release()
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
68 {
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
69 --my_Reference_Count;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
70 if (0 != my_Reference_Count)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
71 return my_Reference_Count;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
72
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
73 delete this;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
74 return 0;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
75 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
76
4740
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
77 #define CHECK_CONDITION(condition, retval, function, line) \
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
78 if (!condition) \
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
79 { \
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
80 printf("%s:%d: Condition failure: %s\n", function, line, #condition); \
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
81 }
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
82
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
83 #define ENSURE(condition, retval) CHECK_CONDITION(condition, retval, __FUNCTION__, __LINE__)
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
84
4739
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
85 STDMETHODIMP TSF::TSF_Text_Store::AdviseSink(REFIID riid, IUnknown *punk, DWORD dwMask)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
86 {
4740
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
87 ENSURE(punk && IID_ITextStoreACP == riid, E_INVALIDARG);
4739
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
88
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
89 if (!my_Sink)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
90 {
4740
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
91 HRESULT hr = punk->QueryInterface(&my_Sink);
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
92 ENSURE(SUCCEEDED(hr) && my_Sink, E_UNEXPECTED);
4739
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
93 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
94 else
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
95 {
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
96 CComPtr<IUnknown> Unknown_1, Unknown_2;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
97 punk->QueryInterface(&Unknown_1);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
98 my_Sink->QueryInterface(&Unknown_2);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
99 if (Unknown_1 != Unknown_2)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
100 return CONNECT_E_ADVISELIMIT;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
101 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
102 my_Sink_Mask = dwMask;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
103 return S_OK;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
104 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
105
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
106 STDMETHODIMP TSF::TSF_Text_Store::UnadviseSink(IUnknown *punk)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
107 {
4740
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
108 ENSURE(punk, E_INVALIDARG);
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
109 ENSURE(my_Sink, CONNECT_E_NOCONNECTION);
4739
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
110
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
111 CComPtr<IUnknown> Unknown_1, Unknown_2;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
112 punk->QueryInterface(&Unknown_1);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
113 my_Sink->QueryInterface(&Unknown_2);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
114
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
115 if (Unknown_1 != Unknown_2)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
116 return CONNECT_E_NOCONNECTION;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
117
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
118 my_Sink = NULL;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
119 my_Sink_Mask = 0;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
120 return S_OK;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
121 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
122
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
123 STDMETHODIMP TSF::TSF_Text_Store::RequestLock(DWORD dwLockFlags, HRESULT *phrSession)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
124 {
4740
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
125 ENSURE(my_Sink, E_FAIL);
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
126 ENSURE(phrSession, E_INVALIDARG);
4739
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
127 if (my_Lock)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
128 {
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
129 if (TS_LF_READ == (my_Lock & TS_LF_READWRITE)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
130 && TS_LF_READWRITE == (dwLockFlags & TS_LF_READWRITE)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
131 && !(dwLockFlags & TS_LF_SYNC))
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
132 {
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
133 *phrSession = TS_S_ASYNC;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
134 my_Lock_Queued = dwLockFlags & (~TS_LF_SYNC);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
135 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
136 else
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
137 {
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
138 *phrSession = TS_E_SYNCHRONOUS;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
139 return E_FAIL;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
140 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
141 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
142 else
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
143 {
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
144 my_Lock = dwLockFlags & (~TS_LF_SYNC);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
145 *phrSession = my_Sink->OnLockGranted(my_Lock);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
146 while (my_Lock_Queued)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
147 {
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
148 my_Lock = my_Lock_Queued;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
149 my_Lock_Queued = 0;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
150 my_Sink->OnLockGranted(my_Lock);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
151 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
152 my_Lock = 0;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
153 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
154 return S_OK;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
155 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
156
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
157 STDMETHODIMP TSF::TSF_Text_Store::GetStatus(TS_STATUS *pdcs)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
158 {
4740
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
159 ENSURE(pdcs, E_INVALIDARG);
4739
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
160 pdcs->dwDynamicFlags = 0;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
161 pdcs->dwStaticFlags = TS_SS_NOHIDDENTEXT;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
162 return S_OK;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
163 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
164
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
165 STDMETHODIMP TSF::TSF_Text_Store::QueryInsert(LONG acpTestStart, LONG acpTestEnd, ULONG cch, LONG *pacpResultStart, LONG *pacpResultEnd)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
166 {
4740
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
167 ENSURE(0 <= acpTestStart && acpTestStart <= acpTestEnd && pacpResultStart && pacpResultEnd, E_INVALIDARG);
4739
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
168
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
169 *pacpResultStart = acpTestStart;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
170 *pacpResultEnd = acpTestStart + cch;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
171 return S_OK;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
172 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
173
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
174 STDMETHODIMP TSF::TSF_Text_Store::GetSelection(ULONG ulIndex, ULONG ulCount, TS_SELECTION_ACP *pSelection, ULONG *pcFetched)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
175 {
4740
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
176 ENSURE(TS_LF_READ == (my_Lock && TS_LF_READ), TS_E_NOLOCK);
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
177 ENSURE(ulCount && pSelection && pcFetched, E_INVALIDARG);
4739
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
178
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
179 *pcFetched = 0;
4740
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
180 ENSURE(TS_DEFAULT_SELECTION == ulIndex || 0 == ulIndex, TS_E_NOSELECTION);
4739
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
181 if (my_Composition_View)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
182 {
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
183 *pSelection = my_Composition_Selection;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
184 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
185 else
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
186 {
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
187 //TODO
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
188 }
4740
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
189 *pcFetched = 1;
4739
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
190 return S_OK;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
191 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
192
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
193 STDMETHODIMP TSF::TSF_Text_Store::SetSelection(ULONG ulCount, const TS_SELECTION_ACP *pSelection)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
194 {
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
195 return E_NOTIMPL;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
196 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
197
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
198 STDMETHODIMP TSF::TSF_Text_Store::GetText(LONG acpStart, LONG acpEnd, WCHAR *pchPlain, ULONG cchPlainReq, ULONG *pcchPlainRet, TS_RUNINFO *prgRunInfo, ULONG cRunInfoReq, ULONG *pcRunInfoRet, LONG *pacpNext)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
199 {
4740
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
200 ENSURE(TS_LF_READ == (my_Lock & TS_LF_READ), TS_E_NOLOCK);
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
201 ENSURE(pcchPlainRet && (pchPlain || prgRunInfo)
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
202 && (!cchPlainReq == !pchPlain)
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
203 && (!cRunInfoReq == !prgRunInfo), E_INVALIDARG);
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
204 ENSURE(0 <= acpStart && -1 <= acpEnd
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
205 && (-1 == acpEnd || acpStart <= acpEnd), TS_E_INVALIDPOS);
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
206
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
207 *pcchPlainRet = 0;
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
208 if (pchPlain && cchPlainReq) *pchPlain = 0;
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
209 if (pcRunInfoRet) *pcRunInfoRet = 0;
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
210 //TODO
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
211 return S_OK;
4739
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
212 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
213
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
214 STDMETHODIMP TSF::TSF_Text_Store::SetText(DWORD dwFlags, LONG acpStart, LONG acpEnd, const WCHAR *pchText, ULONG cch, TS_TEXTCHANGE *pChange)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
215 {
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
216 return E_NOTIMPL;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
217 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
218
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
219 STDMETHODIMP TSF::TSF_Text_Store::GetFormattedText(LONG acpStart, LONG acpEnd, IDataObject **ppDataObject)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
220 {
4740
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
221 //not needed
4739
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
222 return E_NOTIMPL;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
223 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
224
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
225 STDMETHODIMP TSF::TSF_Text_Store::GetEmbedded(LONG acpPos, REFGUID rguidService, REFIID riid, IUnknown **ppunk)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
226 {
4740
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
227 //not needed
4739
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
228 return E_NOTIMPL;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
229 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
230
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
231 STDMETHODIMP TSF::TSF_Text_Store::QueryInsertEmbedded(const GUID *pguidService, const FORMATETC *pFormatEtc, BOOL *pfInsertable)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
232 {
4740
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
233 if (!pfInsertable)
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
234 return E_INVALIDARG;
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
235
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
236 //Not supported
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
237 *pfInsertable = FALSE;
4739
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
238 return E_NOTIMPL;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
239 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
240
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
241 STDMETHODIMP TSF::TSF_Text_Store::InsertEmbedded(DWORD dwFlags, LONG acpStart, LONG acpEnd, IDataObject *pDataObject, TS_TEXTCHANGE *pChange)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
242 {
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
243 return E_NOTIMPL;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
244 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
245
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
246 STDMETHODIMP TSF::TSF_Text_Store::InsertTextAtSelection(DWORD dwFlags, const WCHAR *pchText, ULONG cch, LONG *pacpStart, LONG *pacpEnd, TS_TEXTCHANGE *pChange)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
247 {
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
248 return E_NOTIMPL;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
249 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
250
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
251 STDMETHODIMP TSF::TSF_Text_Store::InsertEmbeddedAtSelection(DWORD dwFlags, IDataObject *pDataObject, LONG *pacpStart, LONG *pacpEnd, TS_TEXTCHANGE *pChange)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
252 {
4740
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
253 //not needed
4739
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
254 return E_NOTIMPL;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
255 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
256
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
257 STDMETHODIMP TSF::TSF_Text_Store::RequestSupportedAttrs(DWORD dwFlags, ULONG cFilterAttrs, const TS_ATTRID *paFilterAttrs)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
258 {
4740
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
259 //not needed
4739
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
260 return E_NOTIMPL;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
261 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
262
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
263 STDMETHODIMP TSF::TSF_Text_Store::RequestAttrsAtPosition(LONG acpPos, ULONG cFilterAttrs, const TS_ATTRID *paFilterAttrs, DWORD dwFlags)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
264 {
4740
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
265 //not needed
4739
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
266 return E_NOTIMPL;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
267 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
268
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
269 STDMETHODIMP TSF::TSF_Text_Store::RequestAttrsTransitioningAtPosition(LONG acpPos, ULONG cFilterAttrs, const TS_ATTRID *paFilterAttrs, DWORD dwFlags)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
270 {
4740
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
271 //not needed
4739
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
272 return E_NOTIMPL;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
273 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
274
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
275 STDMETHODIMP TSF::TSF_Text_Store::FindNextAttrTransition(LONG acpStart, LONG acpHalt, ULONG cFilterAttrs, const TS_ATTRID *paFilterAttrs, DWORD dwFlags, LONG *pacpNext, BOOL *pfFound, LONG *plFoundOffset)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
276 {
4740
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
277 //not needed
4739
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
278 return E_NOTIMPL;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
279 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
280
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
281 STDMETHODIMP TSF::TSF_Text_Store::RetrieveRequestedAttrs(ULONG ulCount, TS_ATTRVAL *paAttrVals, ULONG *pcFetched)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
282 {
4740
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
283 //not needed
4739
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
284 return E_NOTIMPL;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
285 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
286
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
287 STDMETHODIMP TSF::TSF_Text_Store::GetEndACP(LONG *pacp)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
288 {
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
289 return E_NOTIMPL;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
290 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
291
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
292 STDMETHODIMP TSF::TSF_Text_Store::GetActiveView(TsViewCookie *pvcView)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
293 {
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
294 return E_NOTIMPL;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
295 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
296
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
297 STDMETHODIMP TSF::TSF_Text_Store::GetACPFromPoint(TsViewCookie vcView, const POINT *ptScreen, DWORD dwFlags, LONG *pacp)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
298 {
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
299 return E_NOTIMPL;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
300 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
301
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
302 STDMETHODIMP TSF::TSF_Text_Store::GetTextExt(TsViewCookie vcView, LONG acpStart, LONG acpEnd, RECT *prc, BOOL *pfClipped)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
303 {
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
304 return E_NOTIMPL;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
305 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
306
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
307 STDMETHODIMP TSF::TSF_Text_Store::GetScreenExt(TsViewCookie vcView, RECT *prc)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
308 {
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
309 return E_NOTIMPL;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
310 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
311
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
312 STDMETHODIMP TSF::TSF_Text_Store::GetWnd(TsViewCookie vcView, HWND *phwnd)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
313 {
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
314 return E_NOTIMPL;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
315 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
316
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
317 STDMETHODIMP TSF::TSF_Text_Store::OnStartComposition(ITfCompositionView *pComposition, BOOL *pfOk)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
318 {
4740
abf528de6d2e Added condition check macros to make the code clear and easier to debug.
dewyatt
parents: 4739
diff changeset
319 return E_NOTIMPL;
4739
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
320 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
321
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
322 STDMETHODIMP TSF::TSF_Text_Store::OnUpdateComposition(ITfCompositionView *pComposition, ITfRange *pRangeNew)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
323 {
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
324 return E_NOTIMPL;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
325 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
326
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
327 STDMETHODIMP TSF::TSF_Text_Store::OnEndComposition(ITfCompositionView *pComposition)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
328 {
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
329 return E_NOTIMPL;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
330 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
331
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
332 TSF::TSF_Text_Store::TSF_Text_Store() : my_Reference_Count(1),
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
333 my_Edit_Cookie(0),
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
334 my_Lock(0),
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
335 my_Lock_Queued(0)
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
336 {
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
337
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
338 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
339
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
340 TSF::TSF_Text_Store::~TSF_Text_Store()
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
341 {
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
342
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
343 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
344
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
345 void TSF::TSF_Text_Store::Initialize()
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
346 {
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
347 if (FAILED(Thread_Manager->CreateDocumentMgr(&my_Document_Manager)))
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
348 throw std::runtime_error("Failed to create document manager");
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
349
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
350 if (FAILED(my_Document_Manager->CreateContext(Client_Id, 0, static_cast<ITextStoreACP *>(this), &my_Context, &my_Edit_Cookie)))
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
351 throw std::runtime_error("Failed to create document context");
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
352
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
353 if (FAILED(my_Document_Manager->Push(my_Context)))
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
354 throw std::runtime_error("Failed to push context");
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
355 }
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
356
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
357 void TSF::TSF_Text_Store::Finalize()
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
358 {
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
359
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
360 }