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