Mercurial > sdl-ios-xcode
annotate EXCLUDE/GLTSF/src/TSF.cpp @ 4754:2072fed2f583
Added SDL_utf8strlcpy to copy at UTF-8 character boundaries.
Changed SDL_SendKeyboardText and SDL_SendEditingText to use SDL_utf8strlcpy.
author | dewyatt |
---|---|
date | Tue, 13 Jul 2010 15:05:45 -0400 |
parents | abf528de6d2e |
children |
rev | line source |
---|---|
4731 | 1 #include "TSF.hpp" |
4732 | 2 #include <stdexcept> |
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 | 6 TfClientId TSF::Client_Id; |
7 TSF::TSF_Text_Store *TSF::Text_Store = NULL; | |
4732 | 8 |
9 void TSF::Initialize() | |
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 | 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 | 23 |
4739 | 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 | 26 |
27 Text_Store = new TSF_Text_Store; | |
28 Text_Store->Initialize(); | |
4734
0c7c67d4e6ee
Added On_Char method to Window_Listener for WM_CHAR messages.
dewyatt
parents:
4732
diff
changeset
|
29 } |
4732 | 30 } |
31 | |
32 void TSF::Finalize() | |
33 { | |
4734
0c7c67d4e6ee
Added On_Char method to Window_Listener for WM_CHAR messages.
dewyatt
parents:
4732
diff
changeset
|
34 if (Thread_Manager) |
4732 | 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 | 38 } |
4734
0c7c67d4e6ee
Added On_Char method to Window_Listener for WM_CHAR messages.
dewyatt
parents:
4732
diff
changeset
|
39 if (COM_Initialized) |
4732 | 40 { |
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 | 43 } |
44 } | |
4739 | 45 |
46 STDMETHODIMP TSF::TSF_Text_Store::QueryInterface(REFIID riid, void **ppvObject) | |
47 { | |
48 *ppvObject = NULL; | |
49 if (IID_IUnknown == riid || IID_ITextStoreACP == riid) | |
50 *ppvObject = static_cast<ITextStoreACP *>(this); | |
51 else if (IID_ITfContextOwnerCompositionSink == riid) | |
52 *ppvObject = static_cast<ITfContextOwnerCompositionSink *>(this); | |
53 | |
54 if (*ppvObject) | |
55 { | |
56 AddRef(); | |
57 return S_OK; | |
58 } | |
59 return E_NOINTERFACE; | |
60 } | |
61 | |
62 STDMETHODIMP_(ULONG) TSF::TSF_Text_Store::AddRef() | |
63 { | |
64 return ++my_Reference_Count; | |
65 } | |
66 | |
67 STDMETHODIMP_(ULONG) TSF::TSF_Text_Store::Release() | |
68 { | |
69 --my_Reference_Count; | |
70 if (0 != my_Reference_Count) | |
71 return my_Reference_Count; | |
72 | |
73 delete this; | |
74 return 0; | |
75 } | |
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 | 85 STDMETHODIMP TSF::TSF_Text_Store::AdviseSink(REFIID riid, IUnknown *punk, DWORD dwMask) |
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 | 88 |
89 if (!my_Sink) | |
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 | 93 } |
94 else | |
95 { | |
96 CComPtr<IUnknown> Unknown_1, Unknown_2; | |
97 punk->QueryInterface(&Unknown_1); | |
98 my_Sink->QueryInterface(&Unknown_2); | |
99 if (Unknown_1 != Unknown_2) | |
100 return CONNECT_E_ADVISELIMIT; | |
101 } | |
102 my_Sink_Mask = dwMask; | |
103 return S_OK; | |
104 } | |
105 | |
106 STDMETHODIMP TSF::TSF_Text_Store::UnadviseSink(IUnknown *punk) | |
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 | 110 |
111 CComPtr<IUnknown> Unknown_1, Unknown_2; | |
112 punk->QueryInterface(&Unknown_1); | |
113 my_Sink->QueryInterface(&Unknown_2); | |
114 | |
115 if (Unknown_1 != Unknown_2) | |
116 return CONNECT_E_NOCONNECTION; | |
117 | |
118 my_Sink = NULL; | |
119 my_Sink_Mask = 0; | |
120 return S_OK; | |
121 } | |
122 | |
123 STDMETHODIMP TSF::TSF_Text_Store::RequestLock(DWORD dwLockFlags, HRESULT *phrSession) | |
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 | 127 if (my_Lock) |
128 { | |
129 if (TS_LF_READ == (my_Lock & TS_LF_READWRITE) | |
130 && TS_LF_READWRITE == (dwLockFlags & TS_LF_READWRITE) | |
131 && !(dwLockFlags & TS_LF_SYNC)) | |
132 { | |
133 *phrSession = TS_S_ASYNC; | |
134 my_Lock_Queued = dwLockFlags & (~TS_LF_SYNC); | |
135 } | |
136 else | |
137 { | |
138 *phrSession = TS_E_SYNCHRONOUS; | |
139 return E_FAIL; | |
140 } | |
141 } | |
142 else | |
143 { | |
144 my_Lock = dwLockFlags & (~TS_LF_SYNC); | |
145 *phrSession = my_Sink->OnLockGranted(my_Lock); | |
146 while (my_Lock_Queued) | |
147 { | |
148 my_Lock = my_Lock_Queued; | |
149 my_Lock_Queued = 0; | |
150 my_Sink->OnLockGranted(my_Lock); | |
151 } | |
152 my_Lock = 0; | |
153 } | |
154 return S_OK; | |
155 } | |
156 | |
157 STDMETHODIMP TSF::TSF_Text_Store::GetStatus(TS_STATUS *pdcs) | |
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 | 160 pdcs->dwDynamicFlags = 0; |
161 pdcs->dwStaticFlags = TS_SS_NOHIDDENTEXT; | |
162 return S_OK; | |
163 } | |
164 | |
165 STDMETHODIMP TSF::TSF_Text_Store::QueryInsert(LONG acpTestStart, LONG acpTestEnd, ULONG cch, LONG *pacpResultStart, LONG *pacpResultEnd) | |
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 | 168 |
169 *pacpResultStart = acpTestStart; | |
170 *pacpResultEnd = acpTestStart + cch; | |
171 return S_OK; | |
172 } | |
173 | |
174 STDMETHODIMP TSF::TSF_Text_Store::GetSelection(ULONG ulIndex, ULONG ulCount, TS_SELECTION_ACP *pSelection, ULONG *pcFetched) | |
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 | 178 |
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 | 181 if (my_Composition_View) |
182 { | |
183 *pSelection = my_Composition_Selection; | |
184 } | |
185 else | |
186 { | |
187 //TODO | |
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 | 190 return S_OK; |
191 } | |
192 | |
193 STDMETHODIMP TSF::TSF_Text_Store::SetSelection(ULONG ulCount, const TS_SELECTION_ACP *pSelection) | |
194 { | |
195 return E_NOTIMPL; | |
196 } | |
197 | |
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) | |
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 | 212 } |
213 | |
214 STDMETHODIMP TSF::TSF_Text_Store::SetText(DWORD dwFlags, LONG acpStart, LONG acpEnd, const WCHAR *pchText, ULONG cch, TS_TEXTCHANGE *pChange) | |
215 { | |
216 return E_NOTIMPL; | |
217 } | |
218 | |
219 STDMETHODIMP TSF::TSF_Text_Store::GetFormattedText(LONG acpStart, LONG acpEnd, IDataObject **ppDataObject) | |
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 | 222 return E_NOTIMPL; |
223 } | |
224 | |
225 STDMETHODIMP TSF::TSF_Text_Store::GetEmbedded(LONG acpPos, REFGUID rguidService, REFIID riid, IUnknown **ppunk) | |
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 | 228 return E_NOTIMPL; |
229 } | |
230 | |
231 STDMETHODIMP TSF::TSF_Text_Store::QueryInsertEmbedded(const GUID *pguidService, const FORMATETC *pFormatEtc, BOOL *pfInsertable) | |
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 | 238 return E_NOTIMPL; |
239 } | |
240 | |
241 STDMETHODIMP TSF::TSF_Text_Store::InsertEmbedded(DWORD dwFlags, LONG acpStart, LONG acpEnd, IDataObject *pDataObject, TS_TEXTCHANGE *pChange) | |
242 { | |
243 return E_NOTIMPL; | |
244 } | |
245 | |
246 STDMETHODIMP TSF::TSF_Text_Store::InsertTextAtSelection(DWORD dwFlags, const WCHAR *pchText, ULONG cch, LONG *pacpStart, LONG *pacpEnd, TS_TEXTCHANGE *pChange) | |
247 { | |
248 return E_NOTIMPL; | |
249 } | |
250 | |
251 STDMETHODIMP TSF::TSF_Text_Store::InsertEmbeddedAtSelection(DWORD dwFlags, IDataObject *pDataObject, LONG *pacpStart, LONG *pacpEnd, TS_TEXTCHANGE *pChange) | |
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 | 254 return E_NOTIMPL; |
255 } | |
256 | |
257 STDMETHODIMP TSF::TSF_Text_Store::RequestSupportedAttrs(DWORD dwFlags, ULONG cFilterAttrs, const TS_ATTRID *paFilterAttrs) | |
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 | 260 return E_NOTIMPL; |
261 } | |
262 | |
263 STDMETHODIMP TSF::TSF_Text_Store::RequestAttrsAtPosition(LONG acpPos, ULONG cFilterAttrs, const TS_ATTRID *paFilterAttrs, DWORD dwFlags) | |
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 | 266 return E_NOTIMPL; |
267 } | |
268 | |
269 STDMETHODIMP TSF::TSF_Text_Store::RequestAttrsTransitioningAtPosition(LONG acpPos, ULONG cFilterAttrs, const TS_ATTRID *paFilterAttrs, DWORD dwFlags) | |
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 | 272 return E_NOTIMPL; |
273 } | |
274 | |
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) | |
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 | 278 return E_NOTIMPL; |
279 } | |
280 | |
281 STDMETHODIMP TSF::TSF_Text_Store::RetrieveRequestedAttrs(ULONG ulCount, TS_ATTRVAL *paAttrVals, ULONG *pcFetched) | |
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 | 284 return E_NOTIMPL; |
285 } | |
286 | |
287 STDMETHODIMP TSF::TSF_Text_Store::GetEndACP(LONG *pacp) | |
288 { | |
289 return E_NOTIMPL; | |
290 } | |
291 | |
292 STDMETHODIMP TSF::TSF_Text_Store::GetActiveView(TsViewCookie *pvcView) | |
293 { | |
294 return E_NOTIMPL; | |
295 } | |
296 | |
297 STDMETHODIMP TSF::TSF_Text_Store::GetACPFromPoint(TsViewCookie vcView, const POINT *ptScreen, DWORD dwFlags, LONG *pacp) | |
298 { | |
299 return E_NOTIMPL; | |
300 } | |
301 | |
302 STDMETHODIMP TSF::TSF_Text_Store::GetTextExt(TsViewCookie vcView, LONG acpStart, LONG acpEnd, RECT *prc, BOOL *pfClipped) | |
303 { | |
304 return E_NOTIMPL; | |
305 } | |
306 | |
307 STDMETHODIMP TSF::TSF_Text_Store::GetScreenExt(TsViewCookie vcView, RECT *prc) | |
308 { | |
309 return E_NOTIMPL; | |
310 } | |
311 | |
312 STDMETHODIMP TSF::TSF_Text_Store::GetWnd(TsViewCookie vcView, HWND *phwnd) | |
313 { | |
314 return E_NOTIMPL; | |
315 } | |
316 | |
317 STDMETHODIMP TSF::TSF_Text_Store::OnStartComposition(ITfCompositionView *pComposition, BOOL *pfOk) | |
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 | 320 } |
321 | |
322 STDMETHODIMP TSF::TSF_Text_Store::OnUpdateComposition(ITfCompositionView *pComposition, ITfRange *pRangeNew) | |
323 { | |
324 return E_NOTIMPL; | |
325 } | |
326 | |
327 STDMETHODIMP TSF::TSF_Text_Store::OnEndComposition(ITfCompositionView *pComposition) | |
328 { | |
329 return E_NOTIMPL; | |
330 } | |
331 | |
332 TSF::TSF_Text_Store::TSF_Text_Store() : my_Reference_Count(1), | |
333 my_Edit_Cookie(0), | |
334 my_Lock(0), | |
335 my_Lock_Queued(0) | |
336 { | |
337 | |
338 } | |
339 | |
340 TSF::TSF_Text_Store::~TSF_Text_Store() | |
341 { | |
342 | |
343 } | |
344 | |
345 void TSF::TSF_Text_Store::Initialize() | |
346 { | |
347 if (FAILED(Thread_Manager->CreateDocumentMgr(&my_Document_Manager))) | |
348 throw std::runtime_error("Failed to create document manager"); | |
349 | |
350 if (FAILED(my_Document_Manager->CreateContext(Client_Id, 0, static_cast<ITextStoreACP *>(this), &my_Context, &my_Edit_Cookie))) | |
351 throw std::runtime_error("Failed to create document context"); | |
352 | |
353 if (FAILED(my_Document_Manager->Push(my_Context))) | |
354 throw std::runtime_error("Failed to push context"); | |
355 } | |
356 | |
357 void TSF::TSF_Text_Store::Finalize() | |
358 { | |
359 | |
360 } |