wininet: lpwhr cannot be NULL (Coverity 927).
[wine] / include / msctf.idl
1 /*
2  * Copyright 2008 Aric Stewart, CodeWeavers
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18
19 #ifndef DO_NO_IMPORTS
20 import "oaidl.idl";
21 import "comcat.idl";
22 import "textstor.idl";
23 /* import "ctfutb.idl"; */
24 #endif
25 cpp_quote("#include <winuser.h>")
26
27 cpp_quote("#define TF_E_STACKFULL MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0501)")
28 cpp_quote("#define TF_E_ALREADY_EXISTS  MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0506)")
29 cpp_quote("EXTERN_C const CLSID CLSID_TF_ThreadMgr;")
30 cpp_quote("EXTERN_C const CLSID CLSID_TF_InputProcessorProfiles;")
31 cpp_quote("EXTERN_C const CLSID CLSID_TF_CategoryMgr;")
32
33 /* GUIDs for Categories */
34 cpp_quote("EXTERN_C const GUID GUID_TFCAT_TIP_KEYBOARD;")
35 cpp_quote("EXTERN_C const GUID GUID_TFCAT_TIP_SPEECH;")
36 cpp_quote("EXTERN_C const GUID GUID_TFCAT_TIP_HANDWRITING;")
37 cpp_quote("EXTERN_C const GUID GUID_TFCAT_DISPLAYATTRIBUTEPROVIDER;")
38
39 typedef [uuid(7213778c-7bb0-4270-b050-6189ee594e97)]  DWORD TfEditCookie;
40 typedef [uuid(de403c21-89fd-4f85-8b87-64584d063fbc)] DWORD TfClientId;
41 typedef [uuid(88a9c478-f3ec-4763-8345-cd9250443f8d)] DWORD TfGuidAtom;
42
43 cpp_quote("#define TF_MOD_ALT                   0x0001")
44 cpp_quote("#define TF_MOD_CONTROL               0x0002")
45 cpp_quote("#define TF_MOD_SHIFT                 0x0004")
46 cpp_quote("#define TF_MOD_RALT                  0x0008")
47 cpp_quote("#define TF_MOD_RCONTROL              0x0010")
48 cpp_quote("#define TF_MOD_RSHIFT                0x0020")
49 cpp_quote("#define TF_MOD_LALT                  0x0040")
50 cpp_quote("#define TF_MOD_LCONTROL              0x0080")
51 cpp_quote("#define TF_MOD_LSHIFT                0x0100")
52 cpp_quote("#define TF_MOD_ON_KEYUP              0x0200")
53 cpp_quote("#define TF_MOD_IGNORE_ALL_MODIFIER   0x0400")
54
55 interface ITfDocumentMgr;
56 interface ITfContext;
57 interface IEnumTfDocumentMgrs;
58 interface IEnumTfContexts;
59 interface ITfFunctionProvider;
60 interface IEnumTfFunctionProviders;
61 interface ITfCompartmentMgr;
62 interface ITfEditSession;
63 interface ITfRange;
64 interface ITfContextView;
65 interface IEnumTfContextViews;
66 interface ITfProperty;
67 interface ITfReadOnlyProperty;
68 interface IEnumTfProperties;
69 interface ITfRangeBackup;
70 interface IEnumTfLanguageProfiles;
71 interface ITfEditRecord;
72 interface ITfCompositionView;
73 interface ITfKeyEventSink;
74
75 typedef [uuid(e1b5808d-1e46-4c19-84dc-68c5f5978cc8)] struct TF_LANGUAGEPROFILE
76 {
77     CLSID clsid;
78     LANGID langid;
79     GUID catid;
80     BOOL fActive;
81     GUID guidProfile;
82 } TF_LANGUAGEPROFILE;
83
84 typedef [uuid(77c12f95-b783-450d-879f-1cd2362c6521)] struct TF_PRESERVEDKEY
85 {
86     UINT uVKey;
87     UINT uModifiers;
88 } TF_PRESERVEDKEY;
89
90 typedef [uuid(5a886226-ae9a-489b-b991-2b1e25ee59a9)]  enum { TF_ANCHOR_START = 0, TF_ANCHOR_END = 1 } TfAnchor;
91
92 [
93     object,
94     uuid(aa80e801-2021-11d2-93e0-0060b067b86e),
95     pointer_default(unique)
96 ]
97 interface ITfThreadMgr: IUnknown
98 {
99     HRESULT Activate(
100         [out] TfClientId *ptid);
101
102     HRESULT Deactivate();
103
104     HRESULT CreateDocumentMgr(
105         [out] ITfDocumentMgr **ppdim);
106
107     HRESULT EnumDocumentMgrs(
108         [out] IEnumTfDocumentMgrs **ppEnum);
109
110     HRESULT GetFocus(
111         [out] ITfDocumentMgr **ppdimFocus);
112
113     HRESULT SetFocus(
114         [in] ITfDocumentMgr *pdimFocus);
115
116     HRESULT AssociateFocus(
117         [in] HWND hwnd,
118         [in, unique] ITfDocumentMgr *pdimNew,
119         [out] ITfDocumentMgr **ppdimPrev);
120
121     HRESULT IsThreadFocus(
122         [out] BOOL *pfThreadFocus);
123
124     HRESULT GetFunctionProvider(
125         [in] REFCLSID clsid,
126         [out] ITfFunctionProvider **ppFuncProv);
127
128     HRESULT EnumFunctionProviders(
129         [out] IEnumTfFunctionProviders **ppEnum);
130
131     HRESULT GetGlobalCompartment(
132         [out] ITfCompartmentMgr **ppCompMgr);
133 };
134
135
136 [
137     object,
138     uuid(aa80e7f4-2021-11d2-93e0-0060b067b86e),
139     pointer_default(unique)
140 ]
141 interface ITfDocumentMgr: IUnknown
142 {
143     HRESULT CreateContext(
144         [in] TfClientId tidOwner,
145         [in] DWORD dwFlags,
146         [in, unique] IUnknown *punk,
147         [out] ITfContext **ppic,
148         [out] TfEditCookie *pecTextStore);
149
150     HRESULT Push(
151         [in] ITfContext *pic);
152
153     const DWORD TF_POPF_ALL = 0x0001;
154
155     HRESULT Pop(
156         [in] DWORD dwFlags);
157
158     HRESULT GetTop(
159         [out] ITfContext **ppic);
160
161     HRESULT GetBase(
162         [out] ITfContext **ppic);
163
164     HRESULT EnumContexts(
165         [out] IEnumTfContexts **ppEnum);
166 };
167
168 [
169     object,
170     uuid(aa80e7fd-2021-11d2-93e0-0060b067b86e),
171     pointer_default(unique)
172 ]
173 interface ITfContext : IUnknown
174 {
175     const DWORD TF_ES_ASYNCDONTCARE = 0x0;
176     const DWORD TF_ES_SYNC          = 0x1;
177     const DWORD TF_ES_READ          = 0x2;
178     const DWORD TF_ES_READWRITE     = 0x6;
179     const DWORD TF_ES_ASYNC         = 0x8;
180
181     HRESULT RequestEditSession(
182         [in] TfClientId tid,
183         [in] ITfEditSession *pes,
184         [in] DWORD dwFlags,
185         [out] HRESULT *phrSession);
186
187     HRESULT InWriteSession(
188         [in] TfClientId tid,
189         [out] BOOL *pfWriteSession);
190
191     typedef [uuid(1690be9b-d3e9-49f6-8d8b-51b905af4c43)] enum { TF_AE_NONE, TF_AE_START, TF_AE_END } TfActiveSelEnd;
192
193     typedef [uuid(36ae42a4-6989-4bdc-b48a-6137b7bf2e42)] struct TF_SELECTIONSTYLE
194     {
195         TfActiveSelEnd ase;
196         BOOL fInterimChar;
197     } TF_SELECTIONSTYLE;
198
199     typedef [uuid(75eb22f2-b0bf-46a8-8006-975a3b6efcf1)] struct TF_SELECTION
200     {
201         ITfRange *range;
202         TF_SELECTIONSTYLE style;
203     } TF_SELECTION;
204
205     const ULONG TF_DEFAULT_SELECTION =  TS_DEFAULT_SELECTION;
206
207     HRESULT GetSelection(
208         [in] TfEditCookie ec,
209         [in] ULONG ulIndex,
210         [in] ULONG ulCount,
211         [out, size_is(ulCount), length_is(*pcFetched)] TF_SELECTION *pSelection,
212         [out] ULONG *pcFetched);
213
214     HRESULT SetSelection(
215         [in] TfEditCookie ec,
216         [in] ULONG ulCount,
217         [in, size_is(ulCount)] const TF_SELECTION *pSelection);
218
219     HRESULT GetStart(
220         [in] TfEditCookie ec,
221         [out] ITfRange **ppStart);
222
223     HRESULT GetEnd(
224         [in] TfEditCookie ec,
225         [out] ITfRange **ppEnd);
226
227     typedef [uuid(bc7d979a-846a-444d-afef-0a9bfa82b961)] TS_STATUS TF_STATUS;
228     const DWORD TF_SD_READONLY    = TS_SD_READONLY;
229     const DWORD TF_SD_LOADING     = TS_SD_LOADING;
230     const DWORD TF_SS_DISJOINTSEL = TS_SS_DISJOINTSEL;
231     const DWORD TF_SS_REGIONS     = TS_SS_REGIONS;
232     const DWORD TF_SS_TRANSITORY  = TS_SS_TRANSITORY;
233
234
235     HRESULT GetActiveView(
236         [out] ITfContextView **ppView);
237
238     HRESULT EnumViews(
239         [out] IEnumTfContextViews **ppEnum);
240
241     HRESULT GetStatus(
242         [out] TF_STATUS *pdcs);
243
244     HRESULT GetProperty(
245         [in] REFGUID guidProp,
246         [out] ITfProperty **ppProp);
247
248     HRESULT GetAppProperty(
249         [in] REFGUID guidProp,
250         [out] ITfReadOnlyProperty **ppProp);
251
252     HRESULT TrackProperties(
253         [in, size_is(cProp)] const GUID **prgProp,
254         [in] ULONG cProp,
255         [in, size_is(cAppProp)] const GUID **prgAppProp,
256         [in] ULONG cAppProp,
257         [out] ITfReadOnlyProperty **ppProperty);
258
259     HRESULT EnumProperties(
260         [out] IEnumTfProperties **ppEnum);
261
262     HRESULT GetDocumentMgr(
263         [out] ITfDocumentMgr **ppDm);
264
265     HRESULT CreateRangeBackup(
266         [in] TfEditCookie ec,
267         [in] ITfRange *pRange,
268         [out] ITfRangeBackup **ppBackup);
269
270 };
271
272 [
273   object,
274   uuid(4ea48a35-60ae-446f-8fd6-e6a8d82459f7),
275   pointer_default(unique)
276 ]
277 interface ITfSource : IUnknown
278 {
279     HRESULT AdviseSink(
280         [in] REFIID riid,
281         [in, iid_is(riid)] IUnknown *punk,
282         [out] DWORD *pdwCookie);
283
284     HRESULT UnadviseSink(
285         [in] DWORD dwCookie);
286 };
287
288 [
289   object,
290   local,
291   uuid(1F02B6C5-7842-4EE6-8A0B-9A24183A95CA),
292   pointer_default(unique)
293 ]
294 interface ITfInputProcessorProfiles : IUnknown
295 {
296     HRESULT Register(
297         [in] REFCLSID rclsid);
298
299     HRESULT Unregister(
300         [in] REFCLSID rclsid);
301
302     HRESULT AddLanguageProfile(
303         [in] REFCLSID rclsid,
304         [in] LANGID langid,
305         [in] REFGUID guidProfile,
306         [in, size_is(cchDesc)] const WCHAR *pchDesc,
307         [in] ULONG cchDesc,
308         [in, size_is(cchFile)] const WCHAR *pchIconFile,
309         [in] ULONG cchFile,
310         [in] ULONG uIconIndex);
311
312     HRESULT RemoveLanguageProfile(
313         [in] REFCLSID rclsid,
314         [in] LANGID langid,
315         [in] REFGUID guidProfile);
316
317     HRESULT EnumInputProcessorInfo(
318         [out] IEnumGUID **ppEnum);
319
320     HRESULT GetDefaultLanguageProfile(
321         [in] LANGID langid,
322         [in] REFGUID catid,
323         [out] CLSID *pclsid,
324         [out] GUID *pguidProfile);
325
326     HRESULT SetDefaultLanguageProfile(
327         [in] LANGID langid,
328         [in] REFCLSID rclsid,
329         [in] REFGUID guidProfiles);
330
331     HRESULT ActivateLanguageProfile(
332         [in] REFCLSID rclsid,
333         [in] LANGID langid,
334         [in] REFGUID guidProfiles);
335
336     HRESULT GetActiveLanguageProfile(
337         [in] REFCLSID rclsid,
338         [out] LANGID *plangid,
339         [out] GUID *pguidProfile);
340
341     HRESULT GetLanguageProfileDescription(
342         [in] REFCLSID rclsid,
343         [in] LANGID langid,
344         [in] REFGUID guidProfile,
345         [out] BSTR *pbstrProfile);
346
347     HRESULT GetCurrentLanguage(
348         [out] LANGID *plangid);
349
350     HRESULT ChangeCurrentLanguage(
351         [in] LANGID langid);
352
353     HRESULT GetLanguageList(
354         [out] LANGID **ppLangId,
355         [out] ULONG *pulCount);
356
357     HRESULT EnumLanguageProfiles(
358         [in] LANGID langid,
359         [out] IEnumTfLanguageProfiles **ppEnum);
360
361     HRESULT EnableLanguageProfile(
362         [in] REFCLSID rclsid,
363         [in] LANGID langid,
364         [in] REFGUID guidProfile,
365         [in] BOOL fEnable);
366
367     HRESULT IsEnabledLanguageProfile(
368         [in] REFCLSID rclsid,
369         [in] LANGID langid,
370         [in] REFGUID guidProfile,
371         [out] BOOL *pfEnable);
372
373     HRESULT EnableLanguageProfileByDefault(
374         [in] REFCLSID rclsid,
375         [in] LANGID langid,
376         [in] REFGUID guidProfile,
377         [in] BOOL fEnable);
378
379     HRESULT SubstituteKeyboardLayout(
380         [in] REFCLSID rclsid,
381         [in] LANGID langid,
382         [in] REFGUID guidProfile,
383         [in] HKL hKL);
384 };
385
386 [
387   object,
388   local,
389   uuid(c3acefb5-f69d-4905-938f-fcadcf4be830),
390   pointer_default(unique)
391 ]
392 interface ITfCategoryMgr : IUnknown
393 {
394     HRESULT RegisterCategory([in] REFCLSID rclsid,
395                              [in] REFGUID rcatid,
396                              [in] REFGUID rguid);
397
398     HRESULT UnregisterCategory([in] REFCLSID rclsid,
399                                [in] REFGUID rcatid,
400                                [in] REFGUID rguid);
401
402     HRESULT EnumCategoriesInItem([in] REFGUID rguid,
403                                  [out] IEnumGUID **ppEnum);
404
405     HRESULT EnumItemsInCategory([in] REFGUID rcatid,
406                                 [out] IEnumGUID **ppEnum);
407
408     HRESULT FindClosestCategory([in] REFGUID rguid,
409                                 [out] GUID *pcatid,
410                                 [in, size_is(ulCount)] const GUID **ppcatidList,
411                                 [in] ULONG ulCount);
412
413     HRESULT RegisterGUIDDescription([in] REFCLSID rclsid,
414                                     [in] REFGUID rguid,
415                                     [in, size_is(cch)] const WCHAR *pchDesc,
416                                     [in] ULONG cch);
417
418     HRESULT UnregisterGUIDDescription([in] REFCLSID rclsid,
419                                       [in] REFGUID rguid);
420
421     HRESULT GetGUIDDescription([in] REFGUID rguid,
422                                [out] BSTR *pbstrDesc);
423
424     HRESULT RegisterGUIDDWORD([in] REFCLSID rclsid,
425                               [in] REFGUID rguid,
426                               [in] DWORD dw);
427
428     HRESULT UnregisterGUIDDWORD([in] REFCLSID rclsid,
429                                 [in] REFGUID rguid);
430
431     HRESULT GetGUIDDWORD([in] REFGUID rguid,
432                          [out] DWORD *pdw);
433
434     HRESULT RegisterGUID([in] REFGUID rguid,
435                          [out] TfGuidAtom *pguidatom);
436
437     HRESULT GetGUID([in] TfGuidAtom guidatom,
438                     [out] GUID *pguid);
439
440     HRESULT IsEqualTfGuidAtom([in] TfGuidAtom guidatom,
441                               [in] REFGUID rguid,
442                               [out] BOOL *pfEqual);
443 };
444
445 [
446   object,
447   uuid(8127d409-ccd3-4683-967a-b43d5b482bf7),
448   pointer_default(unique)
449 ]
450 interface ITfTextEditSink : IUnknown
451 {
452     HRESULT OnEndEdit(
453         [in] ITfContext *pic,
454         [in] TfEditCookie ecReadOnly,
455         [in] ITfEditRecord *pEditRecord);
456 };
457
458 [
459     object,
460     uuid(5F20AA40-B57A-4F34-96AB-3576F377CC79),
461     pointer_default(unique)
462 ]
463 interface ITfContextOwnerCompositionSink : IUnknown
464 {
465     HRESULT OnStartComposition(
466         [in] ITfCompositionView *pComposition,
467         [out] BOOL *pfOk);
468
469     HRESULT OnUpdateComposition(
470         [in] ITfCompositionView *pComposition,
471         [in] ITfRange *pRangeNew);
472
473     HRESULT OnEndComposition(
474         [in] ITfCompositionView *pComposition);
475 };
476
477 [
478   object,
479   uuid(3d61bf11-ac5f-42c8-a4cb-931bcc28c744),
480   pointer_default(unique)
481 ]
482 interface IEnumTfLanguageProfiles : IUnknown
483 {
484     HRESULT Clone(
485         [out] IEnumTfLanguageProfiles **ppEnum);
486
487     HRESULT Next(
488         [in] ULONG ulCount,
489         [out, size_is(ulCount), length_is(*pcFetch)] TF_LANGUAGEPROFILE *pProfile,
490         [out] ULONG *pcFetch);
491
492     HRESULT Reset();
493
494     HRESULT Skip(
495         [in] ULONG ulCount);
496 };
497
498 [
499   object,
500   local,
501   uuid(aa80e7f7-2021-11d2-93e0-0060b067b86e),
502   pointer_default(unique)
503 ]
504 interface ITfTextInputProcessor : IUnknown
505 {
506     HRESULT Activate(
507         [in] ITfThreadMgr *ptim,
508         [in] TfClientId tid);
509
510     HRESULT Deactivate();
511 };
512
513 [
514   object,
515   uuid(aa80e80e-2021-11d2-93e0-0060b067b86e),
516   pointer_default(unique)
517 ]
518 interface ITfThreadMgrEventSink : IUnknown
519 {
520     HRESULT OnInitDocumentMgr(
521         [in] ITfDocumentMgr *pdim);
522
523     HRESULT OnUninitDocumentMgr(
524         [in] ITfDocumentMgr *pdim);
525
526     HRESULT OnSetFocus(
527         [in] ITfDocumentMgr *pdimFocus,
528         [in] ITfDocumentMgr *pdimPrevFocus);
529
530     HRESULT OnPushContext(
531         [in] ITfContext *pic);
532
533     HRESULT OnPopContext(
534         [in] ITfContext *pic);
535 };
536
537 [
538   object,
539   local,
540   uuid(aa80e7f0-2021-11d2-93e0-0060b067b86e),
541   pointer_default(unique)
542 ]
543 interface ITfKeystrokeMgr : IUnknown
544 {
545     HRESULT AdviseKeyEventSink(
546         [in] TfClientId tid,
547         [in] ITfKeyEventSink *pSink,
548         [in] BOOL fForeground);
549
550     HRESULT UnadviseKeyEventSink(
551         [in] TfClientId tid);
552
553     HRESULT GetForeground(
554         [out] CLSID *pclsid);
555
556     HRESULT TestKeyDown(
557         [in] WPARAM wParam,
558         [in] LPARAM lParam,
559         [out] BOOL *pfEaten);
560
561     HRESULT TestKeyUp(
562         [in] WPARAM wParam,
563         [in] LPARAM lParam,
564         [out] BOOL *pfEaten);
565
566     HRESULT KeyDown(
567         [in] WPARAM wParam,
568         [in] LPARAM lParam,
569         [out] BOOL *pfEaten);
570
571     HRESULT KeyUp(
572         [in] WPARAM wParam,
573         [in] LPARAM lParam,
574         [out] BOOL *pfEaten);
575
576     HRESULT GetPreservedKey(
577         [in] ITfContext *pic,
578         [in] const TF_PRESERVEDKEY *pprekey,
579         [out] GUID *pguid);
580
581     HRESULT IsPreservedKey(
582         [in] REFGUID rguid,
583         [in] const TF_PRESERVEDKEY *pprekey,
584         [out] BOOL *pfRegistered);
585
586     HRESULT PreserveKey(
587         [in] TfClientId tid,
588         [in] REFGUID rguid,
589         [in] const TF_PRESERVEDKEY *prekey,
590         [in, size_is(cchDesc)] const WCHAR *pchDesc,
591         [in] ULONG cchDesc);
592
593     HRESULT UnpreserveKey(
594         [in] REFGUID rguid,
595         [in] const TF_PRESERVEDKEY *pprekey);
596
597     HRESULT SetPreservedKeyDescription(
598         [in] REFGUID rguid,
599         [in, size_is(cchDesc)] const WCHAR *pchDesc,
600         [in] ULONG cchDesc);
601
602     HRESULT GetPreservedKeyDescription(
603         [in] REFGUID rguid,
604         [out] BSTR *pbstrDesc);
605
606     HRESULT SimulatePreservedKey(
607         [in] ITfContext *pic,
608         [in] REFGUID rguid,
609         [out] BOOL *pfEaten);
610 };
611
612 [
613   object,
614   local,
615   uuid(aa80e7f5-2021-11d2-93e0-0060b067b86e),
616   pointer_default(unique)
617 ]
618 interface ITfKeyEventSink : IUnknown
619 {
620     HRESULT OnSetFocus(
621         [in] BOOL fForeground);
622
623     HRESULT OnTestKeyDown(
624         [in] ITfContext *pic,
625         [in] WPARAM wParam,
626         [in] LPARAM lParam,
627         [out] BOOL *pfEaten);
628
629     HRESULT OnTestKeyUp(
630         [in] ITfContext *pic,
631         [in] WPARAM wParam,
632         [in] LPARAM lParam,
633         [out] BOOL *pfEaten);
634
635     HRESULT OnKeyDown(
636         [in] ITfContext *pic,
637         [in] WPARAM wParam,
638         [in] LPARAM lParam,
639         [out] BOOL *pfEaten);
640
641     HRESULT OnKeyUp(
642         [in] ITfContext *pic,
643         [in] WPARAM wParam,
644         [in] LPARAM lParam,
645         [out] BOOL *pfEaten);
646
647     HRESULT OnPreservedKey(
648         [in] ITfContext *pic,
649         [in] REFGUID rguid,
650         [out] BOOL *pfEaten);
651 };
652
653 [
654   object,
655   local,
656   uuid(8f1b8ad8-0b6b-4874-90c5-bd76011e8f7c),
657   pointer_default(unique)
658 ]
659 interface ITfMessagePump : IUnknown
660 {
661     HRESULT PeekMessageA(
662         [out] LPMSG pMsg,
663         [in] HWND hwnd,
664         [in] UINT wMsgFilterMin,
665         [in] UINT wMsgFilterMax,
666         [in] UINT wRemoveMsg,
667         [out] BOOL *pfResult);
668
669     HRESULT GetMessageA(
670         [out] LPMSG pMsg,
671         [in] HWND hwnd,
672         [in] UINT wMsgFilterMin,
673         [in] UINT wMsgFilterMax,
674         [out] BOOL *pfResult);
675
676     HRESULT PeekMessageW(
677         [out] LPMSG pMsg,
678         [in] HWND hwnd,
679         [in] UINT wMsgFilterMin,
680         [in] UINT wMsgFilterMax,
681         [in] UINT wRemoveMsg,
682         [out] BOOL *pfResult);
683
684     HRESULT GetMessageW(
685         [out] LPMSG pMsg,
686         [in] HWND hwnd,
687         [in] UINT wMsgFilterMin,
688         [in] UINT wMsgFilterMax,
689         [out] BOOL *pfResult);
690 };
691
692 [
693   object,
694   local,
695   uuid(d60a7b49-1b9f-4be2-b702-47e9dc05dec3),
696   pointer_default(unique)
697 ]
698 interface ITfClientId : IUnknown
699 {
700     HRESULT GetClientId(
701         [in] REFCLSID rclsid,
702         [out] TfClientId *ptid);
703 };
704
705 [
706   object,
707   uuid(43c9fe15-f494-4c17-9de2-b8a4ac350aa8),
708   pointer_default(unique)
709 ]
710 interface ITfLanguageProfileNotifySink : IUnknown
711 {
712     HRESULT OnLanguageChange(
713         [in] LANGID langid,
714         [out] BOOL *pfAccept);
715
716     HRESULT OnLanguageChanged();
717 }
718
719 [
720   object,
721   uuid(aa80e803-2021-11d2-93e0-0060b067b86e),
722   pointer_default(unique)
723 ]
724 interface ITfEditSession : IUnknown
725 {
726     HRESULT DoEditSession(
727         [in] TfEditCookie ec);
728 }
729
730 [
731   object,
732   uuid(aa80e7ff-2021-11d2-93e0-0060b067b86e),
733   pointer_default(unique)
734 ]
735 interface ITfRange : IUnknown
736 {
737     const WCHAR TF_CHAR_EMBEDDED     = TS_CHAR_EMBEDDED;
738
739     typedef [uuid(cf610f06-2882-46f6-abe5-298568b664c4)] enum { TF_GRAVITY_BACKWARD = 0, TF_GRAVITY_FORWARD = 1 } TfGravity;
740
741     typedef [uuid(1e512533-bbdc-4530-9a8e-a1dc0af67468)] enum { TF_SD_BACKWARD = 0, TF_SD_FORWARD = 1 } TfShiftDir;
742
743     const DWORD TF_HF_OBJECT         = 1;
744     const DWORD TF_TF_MOVESTART      = 1;
745     const DWORD TF_TF_IGNOREEND      = 2;
746     const DWORD TF_ST_CORRECTION     = 1;
747     const DWORD TF_IE_CORRECTION     = 1;
748
749     typedef [uuid(49930d51-7d93-448c-a48c-fea5dac192b1)] struct  TF_HALTCOND
750     {
751         ITfRange *pHaltRange;
752         TfAnchor aHaltPos;
753         DWORD dwFlags;
754     } TF_HALTCOND;
755
756     HRESULT GetText(
757         [in] TfEditCookie ec,
758         [in] DWORD dwFlags,
759         [out, size_is(cchMax), length_is(*pcch)] WCHAR *pchText,
760         [in] ULONG cchMax,
761         [out] ULONG *pcch);
762
763     HRESULT SetText(
764         [in] TfEditCookie ec,
765         [in] DWORD dwFlags,
766         [in, size_is(cch), unique] const WCHAR *pchText,
767         [in] LONG cch);
768
769     HRESULT GetFormattedText(
770         [in] TfEditCookie ec,
771         [out] IDataObject **ppDataObject);
772
773     HRESULT GetEmbedded(
774         [in] TfEditCookie ec,
775         [in] REFGUID rguidService,
776         [in] REFIID riid,
777         [out, iid_is(riid)] IUnknown **ppunk);
778
779     HRESULT InsertEmbedded(
780         [in] TfEditCookie ec,
781         [in] DWORD dwFlags,
782         [in] IDataObject *pDataObject);
783
784     HRESULT ShiftStart(
785         [in] TfEditCookie ec,
786         [in] LONG cchReq,
787         [out] LONG *pcch,
788         [in, unique] const TF_HALTCOND *pHalt);
789
790     HRESULT ShiftEnd(
791         [in] TfEditCookie ec,
792         [in] LONG cchReq,
793         [out] LONG *pcch,
794         [in, unique] const TF_HALTCOND *pHalt);
795
796     HRESULT ShiftStartToRange(
797         [in] TfEditCookie ec,
798         [in] ITfRange *pRange,
799         [in] TfAnchor aPos);
800
801     HRESULT ShiftEndToRange(
802         [in] TfEditCookie ec,
803         [in] ITfRange *pRange,
804         [in] TfAnchor aPos);
805
806     HRESULT ShiftStartRegion(
807         [in] TfEditCookie ec,
808         [in] TfShiftDir dir,
809         [out] BOOL *pfNoRegion);
810
811     HRESULT ShiftEndRegion(
812         [in] TfEditCookie ec,
813         [in] TfShiftDir dir,
814         [out] BOOL *pfNoRegion);
815
816     HRESULT IsEmpty(
817         [in] TfEditCookie ec,
818         [out] BOOL *pfEmpty);
819
820     HRESULT Collapse(
821         [in] TfEditCookie ec,
822         [in] TfAnchor aPos);
823
824     HRESULT IsEqualStart(
825         [in] TfEditCookie ec,
826         [in] ITfRange *pWith,
827         [in] TfAnchor aPos,
828         [out] BOOL *pfEqual);
829
830     HRESULT IsEqualEnd(
831         [in] TfEditCookie ec,
832         [in] ITfRange *pWith,
833         [in] TfAnchor aPos,
834         [out] BOOL *pfEqual);
835
836     HRESULT CompareStart(
837         [in] TfEditCookie ec,
838         [in] ITfRange *pWith,
839         [in] TfAnchor aPos,
840         [out] LONG *plResult);
841
842     HRESULT CompareEnd(
843         [in] TfEditCookie ec,
844         [in] ITfRange *pWith,
845         [in] TfAnchor aPos,
846         [out] LONG *plResult);
847
848     HRESULT AdjustForInsert(
849         [in] TfEditCookie ec,
850         [in] ULONG cchInsert,
851         [out] BOOL *pfInsertOk);
852
853     HRESULT GetGravity(
854         [out] TfGravity *pgStart,
855         [out] TfGravity *pgEnd);
856
857     HRESULT SetGravity(
858         [in] TfEditCookie ec,
859         [in] TfGravity gStart,
860         [in] TfGravity gEnd);
861
862     HRESULT Clone(
863         [out] ITfRange **ppClone);
864
865     HRESULT GetContext(
866         [out] ITfContext **ppContext);
867 };