[MSIMTF]
[reactos.git] / reactos / dll / win32 / msimtf / activeimmapp.c
1 /*
2 * ActiveIMMApp Interface
3 *
4 * Copyright 2008 CodeWeavers, Aric Stewart
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21 #include "precomp.h"
22
23 typedef struct tagActiveIMMApp {
24 IActiveIMMApp IActiveIMMApp_iface;
25 IActiveIMMMessagePumpOwner IActiveIMMMessagePumpOwner_iface;
26 LONG refCount;
27 } ActiveIMMApp;
28
29 static inline ActiveIMMApp *impl_from_IActiveIMMApp(IActiveIMMApp *iface)
30 {
31 return CONTAINING_RECORD(iface, ActiveIMMApp, IActiveIMMApp_iface);
32 }
33
34 static void ActiveIMMApp_Destructor(ActiveIMMApp* This)
35 {
36 TRACE("\n");
37 HeapFree(GetProcessHeap(),0,This);
38 }
39
40 static HRESULT WINAPI ActiveIMMApp_QueryInterface (IActiveIMMApp* iface,
41 REFIID iid, LPVOID *ppvOut)
42 {
43 ActiveIMMApp *This = impl_from_IActiveIMMApp(iface);
44 *ppvOut = NULL;
45
46 if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IActiveIMMApp))
47 {
48 *ppvOut = This;
49 }
50 else if (IsEqualIID(iid, &IID_IActiveIMMMessagePumpOwner))
51 {
52 *ppvOut = &This->IActiveIMMMessagePumpOwner_iface;
53 }
54
55 if (*ppvOut)
56 {
57 IUnknown_AddRef(iface);
58 return S_OK;
59 }
60
61 WARN("unsupported interface: %s\n", debugstr_guid(iid));
62 return E_NOINTERFACE;
63 }
64
65 static ULONG WINAPI ActiveIMMApp_AddRef(IActiveIMMApp* iface)
66 {
67 ActiveIMMApp *This = impl_from_IActiveIMMApp(iface);
68 return InterlockedIncrement(&This->refCount);
69 }
70
71 static ULONG WINAPI ActiveIMMApp_Release(IActiveIMMApp* iface)
72 {
73 ActiveIMMApp *This = impl_from_IActiveIMMApp(iface);
74 ULONG ret;
75
76 ret = InterlockedDecrement(&This->refCount);
77 if (ret == 0)
78 ActiveIMMApp_Destructor(This);
79 return ret;
80 }
81
82 static HRESULT WINAPI ActiveIMMApp_AssociateContext(IActiveIMMApp* iface,
83 HWND hWnd, HIMC hIME, HIMC *phPrev)
84 {
85 *phPrev = ImmAssociateContext(hWnd,hIME);
86 return S_OK;
87 }
88
89 static HRESULT WINAPI ActiveIMMApp_ConfigureIMEA(IActiveIMMApp* This,
90 HKL hKL, HWND hwnd, DWORD dwMode, REGISTERWORDA *pData)
91 {
92 BOOL rc;
93
94 rc = ImmConfigureIMEA(hKL, hwnd, dwMode, pData);
95 if (rc)
96 return E_FAIL;
97 else
98 return S_OK;
99 }
100
101 static HRESULT WINAPI ActiveIMMApp_ConfigureIMEW(IActiveIMMApp* This,
102 HKL hKL, HWND hWnd, DWORD dwMode, REGISTERWORDW *pData)
103 {
104 BOOL rc;
105
106 rc = ImmConfigureIMEW(hKL, hWnd, dwMode, pData);
107 if (rc)
108 return E_FAIL;
109 else
110 return S_OK;
111 }
112
113 static HRESULT WINAPI ActiveIMMApp_CreateContext(IActiveIMMApp* This,
114 HIMC *phIMC)
115 {
116 *phIMC = ImmCreateContext();
117 if (*phIMC)
118 return S_OK;
119 else
120 return E_FAIL;
121 }
122
123 static HRESULT WINAPI ActiveIMMApp_DestroyContext(IActiveIMMApp* This,
124 HIMC hIME)
125 {
126 BOOL rc;
127
128 rc = ImmDestroyContext(hIME);
129 if (rc)
130 return S_OK;
131 else
132 return E_FAIL;
133 }
134
135 static HRESULT WINAPI ActiveIMMApp_EnumRegisterWordA(IActiveIMMApp* This,
136 HKL hKL, LPSTR szReading, DWORD dwStyle, LPSTR szRegister,
137 LPVOID pData, IEnumRegisterWordA **pEnum)
138 {
139 FIXME("Stub\n");
140 return E_NOTIMPL;
141 }
142
143 static HRESULT WINAPI ActiveIMMApp_EnumRegisterWordW(IActiveIMMApp* This,
144 HKL hKL, LPWSTR szReading, DWORD dwStyle, LPWSTR szRegister,
145 LPVOID pData, IEnumRegisterWordW **pEnum)
146 {
147 FIXME("Stub\n");
148 return E_NOTIMPL;
149 }
150
151 static HRESULT WINAPI ActiveIMMApp_EscapeA(IActiveIMMApp* This,
152 HKL hKL, HIMC hIMC, UINT uEscape, LPVOID pData, LRESULT *plResult)
153 {
154 *plResult = ImmEscapeA(hKL, hIMC, uEscape, pData);
155 return S_OK;
156 }
157
158 static HRESULT WINAPI ActiveIMMApp_EscapeW(IActiveIMMApp* This,
159 HKL hKL, HIMC hIMC, UINT uEscape, LPVOID pData, LRESULT *plResult)
160 {
161 *plResult = ImmEscapeW(hKL, hIMC, uEscape, pData);
162 return S_OK;
163 }
164
165 static HRESULT WINAPI ActiveIMMApp_GetCandidateListA(IActiveIMMApp* This,
166 HIMC hIMC, DWORD dwIndex, UINT uBufLen, CANDIDATELIST *pCandList,
167 UINT *puCopied)
168 {
169 *puCopied = ImmGetCandidateListA(hIMC, dwIndex, pCandList, uBufLen);
170 return S_OK;
171 }
172
173 static HRESULT WINAPI ActiveIMMApp_GetCandidateListW(IActiveIMMApp* This,
174 HIMC hIMC, DWORD dwIndex, UINT uBufLen, CANDIDATELIST *pCandList,
175 UINT *puCopied)
176 {
177 *puCopied = ImmGetCandidateListW(hIMC, dwIndex, pCandList, uBufLen);
178 return S_OK;
179 }
180
181 static HRESULT WINAPI ActiveIMMApp_GetCandidateListCountA(IActiveIMMApp* This,
182 HIMC hIMC, DWORD *pdwListSize, DWORD *pdwBufLen)
183 {
184 *pdwBufLen = ImmGetCandidateListCountA(hIMC, pdwListSize);
185 return S_OK;
186 }
187
188 static HRESULT WINAPI ActiveIMMApp_GetCandidateListCountW(IActiveIMMApp* This,
189 HIMC hIMC, DWORD *pdwListSize, DWORD *pdwBufLen)
190 {
191 *pdwBufLen = ImmGetCandidateListCountA(hIMC, pdwListSize);
192 return S_OK;
193 }
194
195 static HRESULT WINAPI ActiveIMMApp_GetCandidateWindow(IActiveIMMApp* This,
196 HIMC hIMC, DWORD dwIndex, CANDIDATEFORM *pCandidate)
197 {
198 BOOL rc;
199 rc = ImmGetCandidateWindow(hIMC,dwIndex,pCandidate);
200 if (rc)
201 return S_OK;
202 else
203 return E_FAIL;
204 }
205
206 static HRESULT WINAPI ActiveIMMApp_GetCompositionFontA(IActiveIMMApp* This,
207 HIMC hIMC, LOGFONTA *plf)
208 {
209 BOOL rc;
210 rc = ImmGetCompositionFontA(hIMC,plf);
211 if (rc)
212 return S_OK;
213 else
214 return E_FAIL;
215 }
216
217 static HRESULT WINAPI ActiveIMMApp_GetCompositionFontW(IActiveIMMApp* This,
218 HIMC hIMC, LOGFONTW *plf)
219 {
220 BOOL rc;
221 rc = ImmGetCompositionFontW(hIMC,plf);
222 if (rc)
223 return S_OK;
224 else
225 return E_FAIL;
226 }
227
228 static HRESULT WINAPI ActiveIMMApp_GetCompositionStringA(IActiveIMMApp* This,
229 HIMC hIMC, DWORD dwIndex, DWORD dwBufLen, LONG *plCopied, LPVOID pBuf)
230 {
231 *plCopied = ImmGetCompositionStringA(hIMC, dwIndex, pBuf, dwBufLen);
232 return S_OK;
233 }
234
235 static HRESULT WINAPI ActiveIMMApp_GetCompositionStringW(IActiveIMMApp* This,
236 HIMC hIMC, DWORD dwIndex, DWORD dwBufLen, LONG *plCopied, LPVOID pBuf)
237 {
238 *plCopied = ImmGetCompositionStringW(hIMC, dwIndex, pBuf, dwBufLen);
239 return S_OK;
240 }
241
242 static HRESULT WINAPI ActiveIMMApp_GetCompositionWindow(IActiveIMMApp* This,
243 HIMC hIMC, COMPOSITIONFORM *pCompForm)
244 {
245 BOOL rc;
246
247 rc = ImmGetCompositionWindow(hIMC,pCompForm);
248
249 if (rc)
250 return S_OK;
251 else
252 return E_FAIL;
253 }
254
255 static HRESULT WINAPI ActiveIMMApp_GetContext(IActiveIMMApp* This,
256 HWND hwnd, HIMC *phIMC)
257 {
258 *phIMC = ImmGetContext(hwnd);
259 return S_OK;
260 }
261
262 static HRESULT WINAPI ActiveIMMApp_GetConversionListA(IActiveIMMApp* This,
263 HKL hKL, HIMC hIMC, LPSTR pSrc, UINT uBufLen, UINT uFlag,
264 CANDIDATELIST *pDst, UINT *puCopied)
265 {
266 *puCopied = ImmGetConversionListA(hKL, hIMC, pSrc, pDst, uBufLen, uFlag);
267 return S_OK;
268 }
269
270 static HRESULT WINAPI ActiveIMMApp_GetConversionListW(IActiveIMMApp* This,
271 HKL hKL, HIMC hIMC, LPWSTR pSrc, UINT uBufLen, UINT uFlag,
272 CANDIDATELIST *pDst, UINT *puCopied)
273 {
274 *puCopied = ImmGetConversionListW(hKL, hIMC, pSrc, pDst, uBufLen, uFlag);
275 return S_OK;
276 }
277
278 static HRESULT WINAPI ActiveIMMApp_GetConversionStatus(IActiveIMMApp* This,
279 HIMC hIMC, DWORD *pfdwConversion, DWORD *pfdwSentence)
280 {
281 BOOL rc;
282
283 rc = ImmGetConversionStatus(hIMC, pfdwConversion, pfdwSentence);
284
285 if (rc)
286 return S_OK;
287 else
288 return E_FAIL;
289 }
290
291 static HRESULT WINAPI ActiveIMMApp_GetDefaultIMEWnd(IActiveIMMApp* This,
292 HWND hWnd, HWND *phDefWnd)
293 {
294 *phDefWnd = ImmGetDefaultIMEWnd(hWnd);
295 return S_OK;
296 }
297
298 static HRESULT WINAPI ActiveIMMApp_GetDescriptionA(IActiveIMMApp* This,
299 HKL hKL, UINT uBufLen, LPSTR szDescription, UINT *puCopied)
300 {
301 *puCopied = ImmGetDescriptionA(hKL, szDescription, uBufLen);
302 return S_OK;
303 }
304
305 static HRESULT WINAPI ActiveIMMApp_GetDescriptionW(IActiveIMMApp* This,
306 HKL hKL, UINT uBufLen, LPWSTR szDescription, UINT *puCopied)
307 {
308 *puCopied = ImmGetDescriptionW(hKL, szDescription, uBufLen);
309 return S_OK;
310 }
311
312 static HRESULT WINAPI ActiveIMMApp_GetGuideLineA(IActiveIMMApp* This,
313 HIMC hIMC, DWORD dwIndex, DWORD dwBufLen, LPSTR pBuf,
314 DWORD *pdwResult)
315 {
316 *pdwResult = ImmGetGuideLineA(hIMC, dwIndex, pBuf, dwBufLen);
317 return S_OK;
318 }
319
320 static HRESULT WINAPI ActiveIMMApp_GetGuideLineW(IActiveIMMApp* This,
321 HIMC hIMC, DWORD dwIndex, DWORD dwBufLen, LPWSTR pBuf,
322 DWORD *pdwResult)
323 {
324 *pdwResult = ImmGetGuideLineW(hIMC, dwIndex, pBuf, dwBufLen);
325 return S_OK;
326 }
327
328 static HRESULT WINAPI ActiveIMMApp_GetIMEFileNameA(IActiveIMMApp* This,
329 HKL hKL, UINT uBufLen, LPSTR szFileName, UINT *puCopied)
330 {
331 *puCopied = ImmGetIMEFileNameA(hKL, szFileName, uBufLen);
332 return S_OK;
333 }
334
335 static HRESULT WINAPI ActiveIMMApp_GetIMEFileNameW(IActiveIMMApp* This,
336 HKL hKL, UINT uBufLen, LPWSTR szFileName, UINT *puCopied)
337 {
338 *puCopied = ImmGetIMEFileNameW(hKL, szFileName, uBufLen);
339 return S_OK;
340 }
341
342 static HRESULT WINAPI ActiveIMMApp_GetOpenStatus(IActiveIMMApp* This,
343 HIMC hIMC)
344 {
345 return ImmGetOpenStatus(hIMC);
346 }
347
348 static HRESULT WINAPI ActiveIMMApp_GetProperty(IActiveIMMApp* This,
349 HKL hKL, DWORD fdwIndex, DWORD *pdwProperty)
350 {
351 *pdwProperty = ImmGetProperty(hKL, fdwIndex);
352 return S_OK;
353 }
354
355 static HRESULT WINAPI ActiveIMMApp_GetRegisterWordStyleA(IActiveIMMApp* This,
356 HKL hKL, UINT nItem, STYLEBUFA *pStyleBuf, UINT *puCopied)
357 {
358 *puCopied = ImmGetRegisterWordStyleA(hKL, nItem, pStyleBuf);
359 return S_OK;
360 }
361
362 static HRESULT WINAPI ActiveIMMApp_GetRegisterWordStyleW(IActiveIMMApp* This,
363 HKL hKL, UINT nItem, STYLEBUFW *pStyleBuf, UINT *puCopied)
364 {
365 *puCopied = ImmGetRegisterWordStyleW(hKL, nItem, pStyleBuf);
366 return S_OK;
367 }
368
369 static HRESULT WINAPI ActiveIMMApp_GetStatusWindowPos(IActiveIMMApp* This,
370 HIMC hIMC, POINT *pptPos)
371 {
372 BOOL rc;
373 rc = ImmGetStatusWindowPos(hIMC, pptPos);
374
375 if (rc)
376 return S_OK;
377 else
378 return E_FAIL;
379 }
380
381 static HRESULT WINAPI ActiveIMMApp_GetVirtualKey(IActiveIMMApp* This,
382 HWND hWnd, UINT *puVirtualKey)
383 {
384 *puVirtualKey = ImmGetVirtualKey(hWnd);
385 return S_OK;
386 }
387
388 static HRESULT WINAPI ActiveIMMApp_InstallIMEA(IActiveIMMApp* This,
389 LPSTR szIMEFileName, LPSTR szLayoutText, HKL *phKL)
390 {
391 *phKL = ImmInstallIMEA(szIMEFileName,szLayoutText);
392 return S_OK;
393 }
394
395 static HRESULT WINAPI ActiveIMMApp_InstallIMEW(IActiveIMMApp* This,
396 LPWSTR szIMEFileName, LPWSTR szLayoutText, HKL *phKL)
397 {
398 *phKL = ImmInstallIMEW(szIMEFileName,szLayoutText);
399 return S_OK;
400 }
401
402 static HRESULT WINAPI ActiveIMMApp_IsIME(IActiveIMMApp* This,
403 HKL hKL)
404 {
405 return ImmIsIME(hKL);
406 }
407
408 static HRESULT WINAPI ActiveIMMApp_IsUIMessageA(IActiveIMMApp* This,
409 HWND hWndIME, UINT msg, WPARAM wParam, LPARAM lParam)
410 {
411 return ImmIsUIMessageA(hWndIME,msg,wParam,lParam);
412 }
413
414 static HRESULT WINAPI ActiveIMMApp_IsUIMessageW(IActiveIMMApp* This,
415 HWND hWndIME, UINT msg, WPARAM wParam, LPARAM lParam)
416 {
417 return ImmIsUIMessageW(hWndIME,msg,wParam,lParam);
418 }
419
420 static HRESULT WINAPI ActiveIMMApp_NotifyIME(IActiveIMMApp* This,
421 HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue)
422 {
423 BOOL rc;
424
425 rc = ImmNotifyIME(hIMC,dwAction,dwIndex,dwValue);
426
427 if (rc)
428 return S_OK;
429 else
430 return E_FAIL;
431 }
432
433 static HRESULT WINAPI ActiveIMMApp_RegisterWordA(IActiveIMMApp* This,
434 HKL hKL, LPSTR szReading, DWORD dwStyle, LPSTR szRegister)
435 {
436 BOOL rc;
437
438 rc = ImmRegisterWordA(hKL,szReading,dwStyle,szRegister);
439
440 if (rc)
441 return S_OK;
442 else
443 return E_FAIL;
444 }
445
446 static HRESULT WINAPI ActiveIMMApp_RegisterWordW(IActiveIMMApp* This,
447 HKL hKL, LPWSTR szReading, DWORD dwStyle, LPWSTR szRegister)
448 {
449 BOOL rc;
450
451 rc = ImmRegisterWordW(hKL,szReading,dwStyle,szRegister);
452
453 if (rc)
454 return S_OK;
455 else
456 return E_FAIL;
457 }
458
459 static HRESULT WINAPI ActiveIMMApp_ReleaseContext(IActiveIMMApp* This,
460 HWND hWnd, HIMC hIMC)
461 {
462 BOOL rc;
463
464 rc = ImmReleaseContext(hWnd,hIMC);
465
466 if (rc)
467 return S_OK;
468 else
469 return E_FAIL;
470 }
471
472 static HRESULT WINAPI ActiveIMMApp_SetCandidateWindow(IActiveIMMApp* This,
473 HIMC hIMC, CANDIDATEFORM *pCandidate)
474 {
475 BOOL rc;
476
477 rc = ImmSetCandidateWindow(hIMC,pCandidate);
478
479 if (rc)
480 return S_OK;
481 else
482 return E_FAIL;
483 }
484
485 static HRESULT WINAPI ActiveIMMApp_SetCompositionFontA(IActiveIMMApp* This,
486 HIMC hIMC, LOGFONTA *plf)
487 {
488 BOOL rc;
489
490 rc = ImmSetCompositionFontA(hIMC,plf);
491
492 if (rc)
493 return S_OK;
494 else
495 return E_FAIL;
496 }
497
498 static HRESULT WINAPI ActiveIMMApp_SetCompositionFontW(IActiveIMMApp* This,
499 HIMC hIMC, LOGFONTW *plf)
500 {
501 BOOL rc;
502
503 rc = ImmSetCompositionFontW(hIMC,plf);
504
505 if (rc)
506 return S_OK;
507 else
508 return E_FAIL;
509 }
510
511 static HRESULT WINAPI ActiveIMMApp_SetCompositionStringA(IActiveIMMApp* This,
512 HIMC hIMC, DWORD dwIndex, LPVOID pComp, DWORD dwCompLen,
513 LPVOID pRead, DWORD dwReadLen)
514 {
515 BOOL rc;
516
517 rc = ImmSetCompositionStringA(hIMC,dwIndex,pComp,dwCompLen,pRead,dwReadLen);
518
519 if (rc)
520 return S_OK;
521 else
522 return E_FAIL;
523 }
524
525 static HRESULT WINAPI ActiveIMMApp_SetCompositionStringW(IActiveIMMApp* This,
526 HIMC hIMC, DWORD dwIndex, LPVOID pComp, DWORD dwCompLen,
527 LPVOID pRead, DWORD dwReadLen)
528 {
529 BOOL rc;
530
531 rc = ImmSetCompositionStringW(hIMC,dwIndex,pComp,dwCompLen,pRead,dwReadLen);
532
533 if (rc)
534 return S_OK;
535 else
536 return E_FAIL;
537 }
538
539 static HRESULT WINAPI ActiveIMMApp_SetCompositionWindow(IActiveIMMApp* This,
540 HIMC hIMC, COMPOSITIONFORM *pCompForm)
541 {
542 BOOL rc;
543
544 rc = ImmSetCompositionWindow(hIMC,pCompForm);
545
546 if (rc)
547 return S_OK;
548 else
549 return E_FAIL;
550 }
551
552 static HRESULT WINAPI ActiveIMMApp_SetConversionStatus(IActiveIMMApp* This,
553 HIMC hIMC, DWORD fdwConversion, DWORD fdwSentence)
554 {
555 BOOL rc;
556
557 rc = ImmSetConversionStatus(hIMC,fdwConversion,fdwSentence);
558
559 if (rc)
560 return S_OK;
561 else
562 return E_FAIL;
563 }
564
565 static HRESULT WINAPI ActiveIMMApp_SetOpenStatus(IActiveIMMApp* This,
566 HIMC hIMC, BOOL fOpen)
567 {
568 BOOL rc;
569
570 rc = ImmSetOpenStatus(hIMC,fOpen);
571
572 if (rc)
573 return S_OK;
574 else
575 return E_FAIL;
576 }
577
578 static HRESULT WINAPI ActiveIMMApp_SetStatusWindowPos(IActiveIMMApp* This,
579 HIMC hIMC, POINT *pptPos)
580 {
581 BOOL rc;
582
583 rc = ImmSetStatusWindowPos(hIMC,pptPos);
584
585 if (rc)
586 return S_OK;
587 else
588 return E_FAIL;
589 }
590
591 static HRESULT WINAPI ActiveIMMApp_SimulateHotKey(IActiveIMMApp* This,
592 HWND hwnd, DWORD dwHotKeyID)
593 {
594 BOOL rc;
595
596 rc = ImmSimulateHotKey(hwnd,dwHotKeyID);
597
598 if (rc)
599 return S_OK;
600 else
601 return E_FAIL;
602 }
603
604 static HRESULT WINAPI ActiveIMMApp_UnregisterWordA(IActiveIMMApp* This,
605 HKL hKL, LPSTR szReading, DWORD dwStyle, LPSTR szUnregister)
606 {
607 BOOL rc;
608
609 rc = ImmUnregisterWordA(hKL,szReading,dwStyle,szUnregister);
610
611 if (rc)
612 return S_OK;
613 else
614 return E_FAIL;
615
616 }
617
618 static HRESULT WINAPI ActiveIMMApp_UnregisterWordW(IActiveIMMApp* This,
619 HKL hKL, LPWSTR szReading, DWORD dwStyle, LPWSTR szUnregister)
620 {
621 BOOL rc;
622
623 rc = ImmUnregisterWordW(hKL,szReading,dwStyle,szUnregister);
624
625 if (rc)
626 return S_OK;
627 else
628 return E_FAIL;
629 }
630
631 static HRESULT WINAPI ActiveIMMApp_Activate(IActiveIMMApp* This,
632 BOOL fRestoreLayout)
633 {
634 FIXME("Stub\n");
635 return S_OK;
636 }
637
638 static HRESULT WINAPI ActiveIMMApp_Deactivate(IActiveIMMApp* This)
639 {
640 FIXME("Stub\n");
641 return S_OK;
642 }
643
644 static HRESULT WINAPI ActiveIMMApp_OnDefWindowProc(IActiveIMMApp* This,
645 HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT *plResult)
646 {
647 #ifndef __REACTOS__
648 FIXME("Stub (%p %x %lx %lx)\n",hWnd,Msg,wParam,lParam);
649 #endif
650 return E_FAIL;
651 }
652
653 static HRESULT WINAPI ActiveIMMApp_FilterClientWindows(IActiveIMMApp* This,
654 ATOM *aaClassList, UINT uSize)
655 {
656 FIXME("Stub\n");
657 return S_OK;
658 }
659
660 static HRESULT WINAPI ActiveIMMApp_GetCodePageA(IActiveIMMApp* This,
661 HKL hKL, UINT *uCodePage)
662 {
663 FIXME("Stub\n");
664 return E_NOTIMPL;
665 }
666
667 static HRESULT WINAPI ActiveIMMApp_GetLangId(IActiveIMMApp* This,
668 HKL hKL, LANGID *plid)
669 {
670 FIXME("Stub\n");
671 return E_NOTIMPL;
672 }
673
674 static HRESULT WINAPI ActiveIMMApp_AssociateContextEx(IActiveIMMApp* This,
675 HWND hWnd, HIMC hIMC, DWORD dwFlags)
676 {
677 BOOL rc;
678
679 rc = ImmAssociateContextEx(hWnd,hIMC,dwFlags);
680
681 if (rc)
682 return S_OK;
683 else
684 return E_FAIL;
685 }
686
687 static HRESULT WINAPI ActiveIMMApp_DisableIME(IActiveIMMApp* This,
688 DWORD idThread)
689 {
690 BOOL rc;
691
692 rc = ImmDisableIME(idThread);
693
694 if (rc)
695 return S_OK;
696 else
697 return E_FAIL;
698 }
699
700 static HRESULT WINAPI ActiveIMMApp_GetImeMenuItemsA(IActiveIMMApp* This,
701 HIMC hIMC, DWORD dwFlags, DWORD dwType,
702 IMEMENUITEMINFOA *pImeParentMenu, IMEMENUITEMINFOA *pImeMenu,
703 DWORD dwSize, DWORD *pdwResult)
704 {
705 *pdwResult = ImmGetImeMenuItemsA(hIMC,dwFlags,dwType,pImeParentMenu,pImeMenu,dwSize);
706 return S_OK;
707 }
708
709 static HRESULT WINAPI ActiveIMMApp_GetImeMenuItemsW(IActiveIMMApp* This,
710 HIMC hIMC, DWORD dwFlags, DWORD dwType,
711 IMEMENUITEMINFOW *pImeParentMenu, IMEMENUITEMINFOW *pImeMenu,
712 DWORD dwSize, DWORD *pdwResult)
713 {
714 *pdwResult = ImmGetImeMenuItemsW(hIMC,dwFlags,dwType,pImeParentMenu,pImeMenu,dwSize);
715 return S_OK;
716 }
717
718 static HRESULT WINAPI ActiveIMMApp_EnumInputContext(IActiveIMMApp* This,
719 DWORD idThread, IEnumInputContext **ppEnum)
720 {
721 FIXME("Stub\n");
722 return E_NOTIMPL;
723 }
724
725 static const IActiveIMMAppVtbl ActiveIMMAppVtbl =
726 {
727 ActiveIMMApp_QueryInterface,
728 ActiveIMMApp_AddRef,
729 ActiveIMMApp_Release,
730
731 ActiveIMMApp_AssociateContext,
732 ActiveIMMApp_ConfigureIMEA,
733 ActiveIMMApp_ConfigureIMEW,
734 ActiveIMMApp_CreateContext,
735 ActiveIMMApp_DestroyContext,
736 ActiveIMMApp_EnumRegisterWordA,
737 ActiveIMMApp_EnumRegisterWordW,
738 ActiveIMMApp_EscapeA,
739 ActiveIMMApp_EscapeW,
740 ActiveIMMApp_GetCandidateListA,
741 ActiveIMMApp_GetCandidateListW,
742 ActiveIMMApp_GetCandidateListCountA,
743 ActiveIMMApp_GetCandidateListCountW,
744 ActiveIMMApp_GetCandidateWindow,
745 ActiveIMMApp_GetCompositionFontA,
746 ActiveIMMApp_GetCompositionFontW,
747 ActiveIMMApp_GetCompositionStringA,
748 ActiveIMMApp_GetCompositionStringW,
749 ActiveIMMApp_GetCompositionWindow,
750 ActiveIMMApp_GetContext,
751 ActiveIMMApp_GetConversionListA,
752 ActiveIMMApp_GetConversionListW,
753 ActiveIMMApp_GetConversionStatus,
754 ActiveIMMApp_GetDefaultIMEWnd,
755 ActiveIMMApp_GetDescriptionA,
756 ActiveIMMApp_GetDescriptionW,
757 ActiveIMMApp_GetGuideLineA,
758 ActiveIMMApp_GetGuideLineW,
759 ActiveIMMApp_GetIMEFileNameA,
760 ActiveIMMApp_GetIMEFileNameW,
761 ActiveIMMApp_GetOpenStatus,
762 ActiveIMMApp_GetProperty,
763 ActiveIMMApp_GetRegisterWordStyleA,
764 ActiveIMMApp_GetRegisterWordStyleW,
765 ActiveIMMApp_GetStatusWindowPos,
766 ActiveIMMApp_GetVirtualKey,
767 ActiveIMMApp_InstallIMEA,
768 ActiveIMMApp_InstallIMEW,
769 ActiveIMMApp_IsIME,
770 ActiveIMMApp_IsUIMessageA,
771 ActiveIMMApp_IsUIMessageW,
772 ActiveIMMApp_NotifyIME,
773 ActiveIMMApp_RegisterWordA,
774 ActiveIMMApp_RegisterWordW,
775 ActiveIMMApp_ReleaseContext,
776 ActiveIMMApp_SetCandidateWindow,
777 ActiveIMMApp_SetCompositionFontA,
778 ActiveIMMApp_SetCompositionFontW,
779 ActiveIMMApp_SetCompositionStringA,
780 ActiveIMMApp_SetCompositionStringW,
781 ActiveIMMApp_SetCompositionWindow,
782 ActiveIMMApp_SetConversionStatus,
783 ActiveIMMApp_SetOpenStatus,
784 ActiveIMMApp_SetStatusWindowPos,
785 ActiveIMMApp_SimulateHotKey,
786 ActiveIMMApp_UnregisterWordA,
787 ActiveIMMApp_UnregisterWordW,
788
789 ActiveIMMApp_Activate,
790 ActiveIMMApp_Deactivate,
791 ActiveIMMApp_OnDefWindowProc,
792 ActiveIMMApp_FilterClientWindows,
793 ActiveIMMApp_GetCodePageA,
794 ActiveIMMApp_GetLangId,
795 ActiveIMMApp_AssociateContextEx,
796 ActiveIMMApp_DisableIME,
797 ActiveIMMApp_GetImeMenuItemsA,
798 ActiveIMMApp_GetImeMenuItemsW,
799 ActiveIMMApp_EnumInputContext
800 };
801
802 static inline ActiveIMMApp *impl_from_IActiveIMMMessagePumpOwner(IActiveIMMMessagePumpOwner *iface)
803 {
804 return CONTAINING_RECORD(iface, ActiveIMMApp, IActiveIMMMessagePumpOwner_iface);
805 }
806
807 static HRESULT WINAPI ActiveIMMMessagePumpOwner_QueryInterface(IActiveIMMMessagePumpOwner* iface,
808 REFIID iid, LPVOID *ppvOut)
809 {
810 ActiveIMMApp *This = impl_from_IActiveIMMMessagePumpOwner(iface);
811 return IActiveIMMApp_QueryInterface(&This->IActiveIMMApp_iface, iid, ppvOut);
812 }
813
814 static ULONG WINAPI ActiveIMMMessagePumpOwner_AddRef(IActiveIMMMessagePumpOwner* iface)
815 {
816 ActiveIMMApp *This = impl_from_IActiveIMMMessagePumpOwner(iface);
817 return IActiveIMMApp_AddRef(&This->IActiveIMMApp_iface);
818 }
819
820 static ULONG WINAPI ActiveIMMMessagePumpOwner_Release(IActiveIMMMessagePumpOwner* iface)
821 {
822 ActiveIMMApp *This = impl_from_IActiveIMMMessagePumpOwner(iface);
823 return IActiveIMMApp_Release(&This->IActiveIMMApp_iface);
824 }
825
826 static HRESULT WINAPI ActiveIMMMessagePumpOwner_Start(IActiveIMMMessagePumpOwner* iface)
827 {
828 ActiveIMMApp *This = impl_from_IActiveIMMMessagePumpOwner(iface);
829 FIXME("(%p)->(): stub\n", This);
830 return E_NOTIMPL;
831 }
832
833 static HRESULT WINAPI ActiveIMMMessagePumpOwner_End(IActiveIMMMessagePumpOwner* iface)
834 {
835 ActiveIMMApp *This = impl_from_IActiveIMMMessagePumpOwner(iface);
836 FIXME("(%p)->(): stub\n", This);
837 return E_NOTIMPL;
838 }
839
840 static HRESULT WINAPI ActiveIMMMessagePumpOwner_OnTranslateMessage(IActiveIMMMessagePumpOwner* iface,
841 const MSG *msg)
842 {
843 ActiveIMMApp *This = impl_from_IActiveIMMMessagePumpOwner(iface);
844 FIXME("(%p)->(%p): stub\n", This, msg);
845 return E_NOTIMPL;
846 }
847
848 static HRESULT WINAPI ActiveIMMMessagePumpOwner_Pause(IActiveIMMMessagePumpOwner* iface,
849 DWORD *cookie)
850 {
851 ActiveIMMApp *This = impl_from_IActiveIMMMessagePumpOwner(iface);
852 FIXME("(%p)->(%p): stub\n", This, cookie);
853 return E_NOTIMPL;
854 }
855
856 static HRESULT WINAPI ActiveIMMMessagePumpOwner_Resume(IActiveIMMMessagePumpOwner* iface,
857 DWORD cookie)
858 {
859 ActiveIMMApp *This = impl_from_IActiveIMMMessagePumpOwner(iface);
860 FIXME("(%p)->(%u): stub\n", This, cookie);
861 return E_NOTIMPL;
862 }
863
864 static const IActiveIMMMessagePumpOwnerVtbl ActiveIMMMessagePumpOwnerVtbl =
865 {
866 ActiveIMMMessagePumpOwner_QueryInterface,
867 ActiveIMMMessagePumpOwner_AddRef,
868 ActiveIMMMessagePumpOwner_Release,
869 ActiveIMMMessagePumpOwner_Start,
870 ActiveIMMMessagePumpOwner_End,
871 ActiveIMMMessagePumpOwner_OnTranslateMessage,
872 ActiveIMMMessagePumpOwner_Pause,
873 ActiveIMMMessagePumpOwner_Resume,
874 };
875
876 DECLSPEC_HIDDEN HRESULT ActiveIMMApp_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
877 {
878 ActiveIMMApp *This;
879 if (pUnkOuter)
880 return CLASS_E_NOAGGREGATION;
881
882 This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(ActiveIMMApp));
883 if (This == NULL)
884 return E_OUTOFMEMORY;
885
886 This->IActiveIMMApp_iface.lpVtbl = &ActiveIMMAppVtbl;
887 This->IActiveIMMMessagePumpOwner_iface.lpVtbl = &ActiveIMMMessagePumpOwnerVtbl;
888 This->refCount = 1;
889
890 TRACE("returning %p\n",This);
891 *ppOut = (IUnknown *)This;
892 return S_OK;
893 }