xref: /reactos/sdk/include/psdk/msctf.idl (revision 8a978a17)
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
20import "oaidl.idl";
21import "comcat.idl";
22import "textstor.idl";
23import "ctfutb.idl";
24#endif
25
26cpp_quote("#define TF_E_STACKFULL MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0501)")
27cpp_quote("#define TF_E_DISCONNECTED    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0504)")
28cpp_quote("#define TF_E_ALREADY_EXISTS  MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0506)")
29cpp_quote("#define TF_E_NOLOCK          MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0201)")
30
31cpp_quote("HRESULT WINAPI TF_CreateThreadMgr(ITfThreadMgr **pptim);")
32cpp_quote("HRESULT WINAPI TF_GetThreadMgr(ITfThreadMgr **pptim);")
33cpp_quote("HRESULT WINAPI TF_CreateInputProcessorProfiles(ITfInputProcessorProfiles **ppipr);")
34cpp_quote("HRESULT WINAPI TF_CreateLangBarMgr(ITfLangBarMgr **pppbm);")
35cpp_quote("HRESULT WINAPI TF_CreateLangBarItemMgr(ITfLangBarItemMgr **pplbim);")
36cpp_quote("HRESULT WINAPI TF_InvalidAssemblyListCacheIfExist(void);")
37
38cpp_quote("EXTERN_C const GUID GUID_PROP_TEXTOWNER;")
39cpp_quote("DEFINE_GUID(GUID_PROP_ATTRIBUTE,0x34b45670,0x7526,0x11d2,0xa1,0x47,0x00,0x10,0x5a,0x27,0x99,0xb5);")
40cpp_quote("EXTERN_C const GUID GUID_PROP_LANGID;")
41cpp_quote("EXTERN_C const GUID GUID_PROP_READING;")
42cpp_quote("EXTERN_C const GUID GUID_PROP_COMPOSING;")
43
44cpp_quote("EXTERN_C const CLSID CLSID_TF_ThreadMgr;")
45cpp_quote("EXTERN_C const CLSID CLSID_TF_InputProcessorProfiles;")
46cpp_quote("EXTERN_C const CLSID CLSID_TF_LangBarMgr;")
47cpp_quote("EXTERN_C const CLSID CLSID_TF_CategoryMgr;")
48cpp_quote("EXTERN_C const CLSID CLSID_TF_DisplayAttributeMgr;")
49
50/* GUIDs for Compartments */
51cpp_quote("EXTERN_C const GUID GUID_COMPARTMENT_KEYBOARD_DISABLED;")
52cpp_quote("EXTERN_C const GUID GUID_COMPARTMENT_KEYBOARD_OPENCLOSE;")
53cpp_quote("EXTERN_C const GUID GUID_COMPARTMENT_HANDWRITING_OPENCLOSE;")
54cpp_quote("EXTERN_C const GUID GUID_COMPARTMENT_SPEECH_DISABLED;")
55cpp_quote("EXTERN_C const GUID GUID_COMPARTMENT_SPEECH_OPENCLOSE;")
56cpp_quote("EXTERN_C const GUID GUID_COMPARTMENT_SPEECH_GLOBALSTATE;")
57cpp_quote("EXTERN_C const GUID GUID_COMPARTMENT_PERSISTMENUENABLED;")
58cpp_quote("EXTERN_C const GUID GUID_COMPARTMENT_EMPTYCONTEXT;")
59cpp_quote("EXTERN_C const GUID GUID_COMPARTMENT_TIPUISTATUS;")
60
61/* GUIDs for Categories */
62cpp_quote("EXTERN_C const GUID GUID_TFCAT_TIP_KEYBOARD;")
63cpp_quote("EXTERN_C const GUID GUID_TFCAT_TIP_SPEECH;")
64cpp_quote("EXTERN_C const GUID GUID_TFCAT_TIP_HANDWRITING;")
65cpp_quote("EXTERN_C const GUID GUID_TFCAT_DISPLAYATTRIBUTEPROVIDER;")
66
67typedef [uuid(7213778c-7bb0-4270-b050-6189ee594e97)]  DWORD TfEditCookie;
68typedef [uuid(de403c21-89fd-4f85-8b87-64584d063fbc)] DWORD TfClientId;
69typedef [uuid(88a9c478-f3ec-4763-8345-cd9250443f8d)] DWORD TfGuidAtom;
70
71cpp_quote("#define TF_MOD_ALT                   0x0001")
72cpp_quote("#define TF_MOD_CONTROL               0x0002")
73cpp_quote("#define TF_MOD_SHIFT                 0x0004")
74cpp_quote("#define TF_MOD_RALT                  0x0008")
75cpp_quote("#define TF_MOD_RCONTROL              0x0010")
76cpp_quote("#define TF_MOD_RSHIFT                0x0020")
77cpp_quote("#define TF_MOD_LALT                  0x0040")
78cpp_quote("#define TF_MOD_LCONTROL              0x0080")
79cpp_quote("#define TF_MOD_LSHIFT                0x0100")
80cpp_quote("#define TF_MOD_ON_KEYUP              0x0200")
81cpp_quote("#define TF_MOD_IGNORE_ALL_MODIFIER   0x0400")
82
83cpp_quote("#define TF_PROFILETYPE_INPUTPROCESSOR  0x0001")
84cpp_quote("#define TF_PROFILETYPE_KEYBOARDLAYOUT  0x0002")
85
86cpp_quote("#define TF_IPSINK_FLAG_ACTIVE 0x0001")
87
88interface ITfDocumentMgr;
89interface ITfContext;
90interface IEnumTfDocumentMgrs;
91interface IEnumTfContexts;
92interface ITfCompartmentMgr;
93interface ITfEditSession;
94interface ITfRange;
95interface ITfProperty;
96interface ITfReadOnlyProperty;
97interface IEnumTfLanguageProfiles;
98interface ITfCompositionView;
99interface ITfKeyEventSink;
100interface ITfPersistentPropertyLoaderACP;
101interface ITfRangeACP;
102
103cpp_quote("#if 0")
104typedef [uuid(4f5d560f-5ab5-4dde-8c4d-404592857ab0)] UINT_PTR HKL;
105cpp_quote("#endif")
106
107typedef [uuid(e26d9e1d-691e-4f29-90d7-338dcf1f8cef)] struct TF_PERSISTENT_PROPERTY_HEADER_ACP
108{
109    GUID guidType;
110    LONG ichStart;
111    LONG cch;
112    ULONG cb;
113    DWORD dwPrivate;
114    CLSID clsidTIP;
115} TF_PERSISTENT_PROPERTY_HEADER_ACP;
116
117typedef [uuid(e1b5808d-1e46-4c19-84dc-68c5f5978cc8)] struct TF_LANGUAGEPROFILE
118{
119    CLSID clsid;
120    LANGID langid;
121    GUID catid;
122    BOOL fActive;
123    GUID guidProfile;
124} TF_LANGUAGEPROFILE;
125
126typedef [uuid(77c12f95-b783-450d-879f-1cd2362c6521)] struct TF_PRESERVEDKEY
127{
128    UINT uVKey;
129    UINT uModifiers;
130} TF_PRESERVEDKEY;
131
132typedef [uuid(5a886226-ae9a-489b-b991-2b1e25ee59a9)]  enum { TF_ANCHOR_START = 0, TF_ANCHOR_END = 1 } TfAnchor;
133
134[
135    object,
136    uuid(101d6610-0990-11d3-8df0-00105a2799b5),
137    pointer_default(unique)
138]
139interface ITfFunctionProvider : IUnknown
140{
141    HRESULT GetType(
142        [out] GUID *guid);
143
144    HRESULT GetDescription(
145        [out] BSTR *desc);
146
147    HRESULT GetFunction(
148        [in] REFGUID guid,
149        [in] REFIID riid,
150        [out, iid_is(riid)] IUnknown **func);
151}
152
153[
154    object,
155    uuid(e4b24db0-0990-11d3-8df0-00105a2799b5),
156    pointer_default(unique)
157]
158interface IEnumTfFunctionProviders : IUnknown
159{
160    HRESULT Clone(
161        [out] IEnumTfFunctionProviders **ret);
162
163    HRESULT Next(
164        [in] ULONG count,
165        [out, size_is(count), length_is(*fetched)] ITfFunctionProvider **prov,
166        [out] ULONG *fetched);
167
168    HRESULT Reset();
169
170    HRESULT Skip(
171        [in] ULONG count);
172}
173
174[
175    object,
176    uuid(aa80e801-2021-11d2-93e0-0060b067b86e),
177    pointer_default(unique)
178]
179interface ITfThreadMgr: IUnknown
180{
181    HRESULT Activate(
182        [out] TfClientId *ptid);
183
184    HRESULT Deactivate();
185
186    HRESULT CreateDocumentMgr(
187        [out] ITfDocumentMgr **ppdim);
188
189    HRESULT EnumDocumentMgrs(
190        [out] IEnumTfDocumentMgrs **ppEnum);
191
192    HRESULT GetFocus(
193        [out] ITfDocumentMgr **ppdimFocus);
194
195    HRESULT SetFocus(
196        [in] ITfDocumentMgr *pdimFocus);
197
198    HRESULT AssociateFocus(
199        [in] HWND hwnd,
200        [in, unique] ITfDocumentMgr *pdimNew,
201        [out] ITfDocumentMgr **ppdimPrev);
202
203    HRESULT IsThreadFocus(
204        [out] BOOL *pfThreadFocus);
205
206    HRESULT GetFunctionProvider(
207        [in] REFCLSID clsid,
208        [out] ITfFunctionProvider **ppFuncProv);
209
210    HRESULT EnumFunctionProviders(
211        [out] IEnumTfFunctionProviders **ppEnum);
212
213    HRESULT GetGlobalCompartment(
214        [out] ITfCompartmentMgr **ppCompMgr);
215}
216
217[
218    object,
219    uuid(3e90ade3-7594-4cb0-bb58-69628f5f458c),
220    pointer_default(unique)
221]
222interface ITfThreadMgrEx : ITfThreadMgr
223{
224    HRESULT ActivateEx(
225        [out] TfClientId *id,
226        [in] DWORD flags);
227    HRESULT GetActiveFlags(
228        [out] DWORD *flags);
229}
230
231[
232    object,
233    uuid(d7540241-f9a1-4364-befc-dbcd2c4395b7),
234    pointer_default(unique)
235]
236interface ITfCompositionView : IUnknown
237{
238    HRESULT GetOwnerClsid([out] CLSID *pclsid);
239
240    HRESULT GetRange([out] ITfRange **ppRange);
241}
242
243[
244    object,
245    uuid(aa80e7f4-2021-11d2-93e0-0060b067b86e),
246    pointer_default(unique)
247]
248interface ITfDocumentMgr: IUnknown
249{
250    HRESULT CreateContext(
251        [in] TfClientId tidOwner,
252        [in] DWORD dwFlags,
253        [in, unique] IUnknown *punk,
254        [out] ITfContext **ppic,
255        [out] TfEditCookie *pecTextStore);
256
257    HRESULT Push(
258        [in] ITfContext *pic);
259
260    const DWORD TF_POPF_ALL = 0x0001;
261
262    HRESULT Pop(
263        [in] DWORD dwFlags);
264
265    HRESULT GetTop(
266        [out] ITfContext **ppic);
267
268    HRESULT GetBase(
269        [out] ITfContext **ppic);
270
271    HRESULT EnumContexts(
272        [out] IEnumTfContexts **ppEnum);
273}
274
275[
276    object,
277    uuid(2433bf8e-0f9b-435c-ba2c-180611978c30),
278    pointer_default(unique)
279]
280interface ITfContextView : IUnknown
281{
282    HRESULT GetRangeFromPoint(
283        [in] TfEditCookie cookie,
284        [in] const POINT *pt,
285        [in] DWORD flags,
286        [out] ITfRange **range);
287
288    HRESULT GetTextExt(
289        [in] TfEditCookie cookie,
290        [in] ITfRange *range,
291        [out] RECT *rect,
292        [out] BOOL *clipped);
293
294    HRESULT GetScreenExt(
295        [out] RECT *rect);
296
297    HRESULT GetWnd(
298        [out] HWND *hwnd);
299}
300
301[
302    object,
303    uuid(f0c0f8dd-cf38-44e1-bb0f-68cf0d551c78),
304    pointer_default(unique)
305]
306interface IEnumTfContextViews : IUnknown
307{
308    HRESULT Clone(
309        [out] IEnumTfContextViews **ret);
310
311    HRESULT Next(
312        [in] ULONG count,
313        [out, size_is(count), length_is(*fetched)] ITfContextView **views,
314        [out] ULONG *fetched);
315
316    HRESULT Reset();
317
318    HRESULT Skip(
319        [in] ULONG count);
320}
321
322[
323    object,
324    uuid(19188cb0-aca9-11d2-afc5-00105a2799b5),
325    pointer_default(unique)
326]
327interface IEnumTfProperties : IUnknown
328{
329    HRESULT Clone(
330        [out] IEnumTfProperties **ret);
331
332    HRESULT Next(
333        [in] ULONG count,
334        [out, size_is(count), length_is(*fetched)] ITfProperty **props,
335        [out] ULONG *fetched);
336
337    HRESULT Reset();
338
339    HRESULT Skip(
340        [in] ULONG count);
341}
342
343[
344    object,
345    uuid(463a506d-6992-49d2-9b88-93d55e70bb16),
346    pointer_default(unique)
347]
348interface ITfRangeBackup : IUnknown
349{
350    HRESULT Restore(
351        [in] TfEditCookie cookie,
352        [in] ITfRange *range);
353}
354
355[
356    object,
357    uuid(aa80e901-2021-11d2-93e0-0060b067b86e),
358    pointer_default(unique)
359]
360interface ITextStoreACPServices : IUnknown
361{
362    HRESULT Serialize(
363        [in] ITfProperty *prop,
364        [in] ITfRange *range,
365        [out] TF_PERSISTENT_PROPERTY_HEADER_ACP *header,
366        [in] IStream *stream);
367
368    HRESULT Unserialize(
369        [in] ITfProperty *prop,
370        [in] const TF_PERSISTENT_PROPERTY_HEADER_ACP *header,
371        [in] IStream *stream,
372        [in] ITfPersistentPropertyLoaderACP *loader);
373
374    HRESULT ForceLoadProperty(
375        [in] ITfProperty *prop);
376
377    HRESULT CreateRange(
378        [in] LONG start,
379        [in] LONG end,
380        [out] ITfRangeACP **range);
381}
382
383[
384    object,
385    uuid(aa80e7fd-2021-11d2-93e0-0060b067b86e),
386    pointer_default(unique)
387]
388interface ITfContext : IUnknown
389{
390    const DWORD TF_ES_ASYNCDONTCARE = 0x0;
391    const DWORD TF_ES_SYNC          = 0x1;
392    const DWORD TF_ES_READ          = 0x2;
393    const DWORD TF_ES_READWRITE     = 0x6;
394    const DWORD TF_ES_ASYNC         = 0x8;
395
396    HRESULT RequestEditSession(
397        [in] TfClientId tid,
398        [in] ITfEditSession *pes,
399        [in] DWORD dwFlags,
400        [out] HRESULT *phrSession);
401
402    HRESULT InWriteSession(
403        [in] TfClientId tid,
404        [out] BOOL *pfWriteSession);
405
406    typedef [uuid(1690be9b-d3e9-49f6-8d8b-51b905af4c43)] enum { TF_AE_NONE, TF_AE_START, TF_AE_END } TfActiveSelEnd;
407
408    typedef [uuid(36ae42a4-6989-4bdc-b48a-6137b7bf2e42)] struct TF_SELECTIONSTYLE
409    {
410        TfActiveSelEnd ase;
411        BOOL fInterimChar;
412    } TF_SELECTIONSTYLE;
413
414    typedef [uuid(75eb22f2-b0bf-46a8-8006-975a3b6efcf1)] struct TF_SELECTION
415    {
416        ITfRange *range;
417        TF_SELECTIONSTYLE style;
418    } TF_SELECTION;
419
420    const ULONG TF_DEFAULT_SELECTION =  TS_DEFAULT_SELECTION;
421
422    HRESULT GetSelection(
423        [in] TfEditCookie ec,
424        [in] ULONG ulIndex,
425        [in] ULONG ulCount,
426        [out, size_is(ulCount), length_is(*pcFetched)] TF_SELECTION *pSelection,
427        [out] ULONG *pcFetched);
428
429    HRESULT SetSelection(
430        [in] TfEditCookie ec,
431        [in] ULONG ulCount,
432        [in, size_is(ulCount)] const TF_SELECTION *pSelection);
433
434    HRESULT GetStart(
435        [in] TfEditCookie ec,
436        [out] ITfRange **ppStart);
437
438    HRESULT GetEnd(
439        [in] TfEditCookie ec,
440        [out] ITfRange **ppEnd);
441
442    typedef [uuid(bc7d979a-846a-444d-afef-0a9bfa82b961)] TS_STATUS TF_STATUS;
443    const DWORD TF_SD_READONLY    = TS_SD_READONLY;
444    const DWORD TF_SD_LOADING     = TS_SD_LOADING;
445    const DWORD TF_SS_DISJOINTSEL = TS_SS_DISJOINTSEL;
446    const DWORD TF_SS_REGIONS     = TS_SS_REGIONS;
447    const DWORD TF_SS_TRANSITORY  = TS_SS_TRANSITORY;
448
449
450    HRESULT GetActiveView(
451        [out] ITfContextView **ppView);
452
453    HRESULT EnumViews(
454        [out] IEnumTfContextViews **ppEnum);
455
456    HRESULT GetStatus(
457        [out] TF_STATUS *pdcs);
458
459    HRESULT GetProperty(
460        [in] REFGUID guidProp,
461        [out] ITfProperty **ppProp);
462
463    HRESULT GetAppProperty(
464        [in] REFGUID guidProp,
465        [out] ITfReadOnlyProperty **ppProp);
466
467    HRESULT TrackProperties(
468        [in, size_is(cProp)] const GUID **prgProp,
469        [in] ULONG cProp,
470        [in, size_is(cAppProp)] const GUID **prgAppProp,
471        [in] ULONG cAppProp,
472        [out] ITfReadOnlyProperty **ppProperty);
473
474    HRESULT EnumProperties(
475        [out] IEnumTfProperties **ppEnum);
476
477    HRESULT GetDocumentMgr(
478        [out] ITfDocumentMgr **ppDm);
479
480    HRESULT CreateRangeBackup(
481        [in] TfEditCookie ec,
482        [in] ITfRange *pRange,
483        [out] ITfRangeBackup **ppBackup);
484}
485
486const DWORD TF_INVALID_COOKIE = 0xffffffff;
487
488[
489  object,
490  uuid(4ea48a35-60ae-446f-8fd6-e6a8d82459f7),
491  pointer_default(unique)
492]
493interface ITfSource : IUnknown
494{
495    HRESULT AdviseSink(
496        [in] REFIID riid,
497        [in, iid_is(riid)] IUnknown *punk,
498        [out] DWORD *pdwCookie);
499
500    HRESULT UnadviseSink(
501        [in] DWORD dwCookie);
502}
503
504[
505  object,
506  local,
507  uuid(1F02B6C5-7842-4EE6-8A0B-9A24183A95CA),
508  pointer_default(unique)
509]
510interface ITfInputProcessorProfiles : IUnknown
511{
512    HRESULT Register(
513        [in] REFCLSID rclsid);
514
515    HRESULT Unregister(
516        [in] REFCLSID rclsid);
517
518    HRESULT AddLanguageProfile(
519        [in] REFCLSID rclsid,
520        [in] LANGID langid,
521        [in] REFGUID guidProfile,
522        [in, size_is(cchDesc)] const WCHAR *pchDesc,
523        [in] ULONG cchDesc,
524        [in, size_is(cchFile)] const WCHAR *pchIconFile,
525        [in] ULONG cchFile,
526        [in] ULONG uIconIndex);
527
528    HRESULT RemoveLanguageProfile(
529        [in] REFCLSID rclsid,
530        [in] LANGID langid,
531        [in] REFGUID guidProfile);
532
533    HRESULT EnumInputProcessorInfo(
534        [out] IEnumGUID **ppEnum);
535
536    HRESULT GetDefaultLanguageProfile(
537        [in] LANGID langid,
538        [in] REFGUID catid,
539        [out] CLSID *pclsid,
540        [out] GUID *pguidProfile);
541
542    HRESULT SetDefaultLanguageProfile(
543        [in] LANGID langid,
544        [in] REFCLSID rclsid,
545        [in] REFGUID guidProfiles);
546
547    HRESULT ActivateLanguageProfile(
548        [in] REFCLSID rclsid,
549        [in] LANGID langid,
550        [in] REFGUID guidProfiles);
551
552    HRESULT GetActiveLanguageProfile(
553        [in] REFCLSID rclsid,
554        [out] LANGID *plangid,
555        [out] GUID *pguidProfile);
556
557    HRESULT GetLanguageProfileDescription(
558        [in] REFCLSID rclsid,
559        [in] LANGID langid,
560        [in] REFGUID guidProfile,
561        [out] BSTR *pbstrProfile);
562
563    HRESULT GetCurrentLanguage(
564        [out] LANGID *plangid);
565
566    HRESULT ChangeCurrentLanguage(
567        [in] LANGID langid);
568
569    HRESULT GetLanguageList(
570        [out] LANGID **ppLangId,
571        [out] ULONG *pulCount);
572
573    HRESULT EnumLanguageProfiles(
574        [in] LANGID langid,
575        [out] IEnumTfLanguageProfiles **ppEnum);
576
577    HRESULT EnableLanguageProfile(
578        [in] REFCLSID rclsid,
579        [in] LANGID langid,
580        [in] REFGUID guidProfile,
581        [in] BOOL fEnable);
582
583    HRESULT IsEnabledLanguageProfile(
584        [in] REFCLSID rclsid,
585        [in] LANGID langid,
586        [in] REFGUID guidProfile,
587        [out] BOOL *pfEnable);
588
589    HRESULT EnableLanguageProfileByDefault(
590        [in] REFCLSID rclsid,
591        [in] LANGID langid,
592        [in] REFGUID guidProfile,
593        [in] BOOL fEnable);
594
595    HRESULT SubstituteKeyboardLayout(
596        [in] REFCLSID rclsid,
597        [in] LANGID langid,
598        [in] REFGUID guidProfile,
599        [in] HKL hKL);
600}
601
602typedef [uuid(44d2825a-10e5-43b2-877f-6cb2f43b7e7e)]
603struct TF_INPUTPROCESSORPROFILE {
604    DWORD dwProfileType;
605    LANGID langid;
606    CLSID clsid;
607    GUID guidProfile;
608    GUID catid;
609    HKL hklSubstitute;
610    DWORD dwCaps;
611    HKL hkl;
612    DWORD dwFlags;
613} TF_INPUTPROCESSORPROFILE;
614
615[
616    object,
617    uuid(71c6e74d-0f28-11d8-a82a-00065b84435c),
618    pointer_default(unique)
619]
620interface IEnumTfInputProcessorProfiles : IUnknown
621{
622    HRESULT Clone(
623        [out] IEnumTfInputProcessorProfiles **ppEnum);
624
625    HRESULT Next(
626        [in] ULONG ulCount,
627        [out, size_is(ulCount), length_is(*pcFetch)] TF_INPUTPROCESSORPROFILE *pProfile,
628        [out] ULONG *pcFetch);
629
630    HRESULT Reset();
631
632    HRESULT Skip(
633        [in] ULONG ulCount);
634}
635
636[
637    object,
638    uuid(71c6e74c-0f28-11d8-a82a-00065b84435c),
639    pointer_default(unique)
640]
641interface ITfInputProcessorProfileMgr : IUnknown
642{
643    HRESULT ActivateProfile(
644        [in] DWORD dwProfileType,
645        [in] LANGID langid,
646        [in] REFCLSID clsid,
647        [in] REFGUID guidProfile,
648        [in] HKL hkl,
649        [in] DWORD dwFlags);
650
651    HRESULT DeactivateProfile(
652        [in] DWORD dwProfileType,
653        [in] LANGID langid,
654        [in] REFCLSID clsid,
655        [in] REFGUID guidProfile,
656        [in] HKL hkl,
657        [in] DWORD dwFlags);
658
659    HRESULT GetProfile(
660        [in] DWORD dwProfileType,
661        [in] LANGID langid,
662        [in] REFCLSID clsid,
663        [in] REFGUID guidProfile,
664        [in] HKL hkl,
665        [out] TF_INPUTPROCESSORPROFILE *pProfile);
666
667
668    HRESULT EnumProfiles(
669        [in] LANGID langid,
670        [out] IEnumTfInputProcessorProfiles **ppEnum);
671
672    HRESULT ReleaseInputProcessor(
673        [in] REFCLSID rclsid,
674        [in] DWORD dwFlags);
675
676    HRESULT RegisterProfile(
677        [in] REFCLSID rclsid,
678        [in] LANGID langid,
679        [in] REFGUID guidProfile,
680        [in, size_is(cchDesc)] const WCHAR *pchDesc,
681        [in] ULONG cchDesc,
682        [in, size_is(cchFile)] const WCHAR *pchIconFile,
683        [in] ULONG cchFile,
684        [in] ULONG uIconIndex,
685        [in] HKL hklsubstitute,
686        [in] DWORD dwPreferredLayout,
687        [in] BOOL bEnabledByDefault,
688        [in] DWORD dwFlags);
689
690    HRESULT UnregisterProfile(
691        [in] REFCLSID rclsid,
692        [in] LANGID langid,
693        [in] REFGUID guidProfile,
694        [in] DWORD dwFlags);
695
696    HRESULT GetActiveProfile(
697        [in] REFGUID catid,
698        [out] TF_INPUTPROCESSORPROFILE *pProfile);
699}
700
701typedef [uuid(c4cc07f1-80cc-4a7b-bc54-98512782cbe3)]
702enum {
703    TF_LS_NONE      = 0,
704    TF_LS_SOLID     = 1,
705    TF_LS_DOT       = 2,
706    TF_LS_DASH      = 3,
707    TF_LS_SQUIGGLE  = 4
708} TF_DA_LINESTYLE;
709
710typedef [uuid(d9b92e21-084a-401b-9c64-1e6dad91a1ab)]
711enum {
712    TF_CT_NONE      = 0,
713    TF_CT_SYSCOLOR  = 1,
714    TF_CT_COLORREF  = 2
715} TF_DA_COLORTYPE;
716
717typedef [uuid(90d0cb5e-6520-4a0f-b47c-c39bd955f0d6)]
718struct TF_DA_COLOR {
719    TF_DA_COLORTYPE type;
720    [switch_type(TF_DA_COLORTYPE), switch_is(type)]
721    union {
722        [case(TF_CT_SYSCOLOR)] int nIndex;
723        [case(TF_CT_COLORREF)] COLORREF cr;
724    };
725} TF_DA_COLOR;
726
727typedef [uuid(33d2fe4b-6c24-4f67-8d75-3bc1819e4126)]
728enum {
729    TF_ATTR_INPUT                = 0,
730    TF_ATTR_TARGET_CONVERTED     = 1,
731    TF_ATTR_CONVERTED            = 2,
732    TF_ATTR_TARGET_NOTCONVERTED  = 3,
733    TF_ATTR_INPUT_ERROR          = 4,
734    TF_ATTR_FIXEDCONVERTED       = 5,
735    TF_ATTR_OTHER                = -1
736} TF_DA_ATTR_INFO;
737
738typedef [uuid(1bf1c305-419b-4182-a4d2-9bfadc3f021f)]
739struct TF_DISPLAYATTRIBUTE {
740    TF_DA_COLOR      crText;
741    TF_DA_COLOR      crBk;
742    TF_DA_LINESTYLE  lsStyle;
743    BOOL             fBoldLine;
744    TF_DA_COLOR      crLine;
745    TF_DA_ATTR_INFO  bAttr;
746} TF_DISPLAYATTRIBUTE;
747
748[
749    object,
750    uuid(70528852-2f26-4aea-8c96-215150578932),
751    pointer_default(unique)
752]
753interface ITfDisplayAttributeInfo : IUnknown
754{
755    HRESULT GetGUID([out] GUID *pguid);
756
757    HRESULT GetDescription([out] BSTR *pbstrDesc);
758
759    HRESULT GetAttributeInfo([out] TF_DISPLAYATTRIBUTE *pda);
760
761    HRESULT SetAttributeInfo([in] const TF_DISPLAYATTRIBUTE *pda);
762
763    HRESULT Reset();
764}
765
766[
767    object,
768    uuid(7cef04d7-cb75-4e80-a7ab-5f5bc7d332de),
769    pointer_default(unique)
770]
771interface IEnumTfDisplayAttributeInfo : IUnknown
772{
773    HRESULT Clone([out] IEnumTfDisplayAttributeInfo **ppEnum);
774
775    HRESULT Next(
776            [in] ULONG ulCount,
777            [out, size_is(ulCount), length_is(*pcFetched)] ITfDisplayAttributeInfo **rgInfo,
778            [out] ULONG *pcFetched);
779
780    HRESULT Reset();
781
782    HRESULT Skip([in] ULONG ulCount);
783}
784
785[
786    object,
787    local,
788    uuid(8ded7393-5db1-475c-9e71-a39111b0ff67),
789    pointer_default(unique)
790]
791interface ITfDisplayAttributeMgr : IUnknown
792{
793    HRESULT OnUpdateInfo();
794
795    HRESULT EnumDisplayAttributeInfo([out] IEnumTfDisplayAttributeInfo **ppEnum);
796
797    HRESULT GetDisplayAttributeInfo(
798            [in] REFGUID guid,
799            [out] ITfDisplayAttributeInfo **ppInfo,
800            [out] CLSID *pclsidOwner);
801
802}
803
804[
805  object,
806  local,
807  uuid(c3acefb5-f69d-4905-938f-fcadcf4be830),
808  pointer_default(unique)
809]
810interface ITfCategoryMgr : IUnknown
811{
812    HRESULT RegisterCategory([in] REFCLSID rclsid,
813                             [in] REFGUID rcatid,
814                             [in] REFGUID rguid);
815
816    HRESULT UnregisterCategory([in] REFCLSID rclsid,
817                               [in] REFGUID rcatid,
818                               [in] REFGUID rguid);
819
820    HRESULT EnumCategoriesInItem([in] REFGUID rguid,
821                                 [out] IEnumGUID **ppEnum);
822
823    HRESULT EnumItemsInCategory([in] REFGUID rcatid,
824                                [out] IEnumGUID **ppEnum);
825
826    HRESULT FindClosestCategory([in] REFGUID rguid,
827                                [out] GUID *pcatid,
828                                [in, size_is(ulCount)] const GUID **ppcatidList,
829                                [in] ULONG ulCount);
830
831    HRESULT RegisterGUIDDescription([in] REFCLSID rclsid,
832                                    [in] REFGUID rguid,
833                                    [in, size_is(cch)] const WCHAR *pchDesc,
834                                    [in] ULONG cch);
835
836    HRESULT UnregisterGUIDDescription([in] REFCLSID rclsid,
837                                      [in] REFGUID rguid);
838
839    HRESULT GetGUIDDescription([in] REFGUID rguid,
840                               [out] BSTR *pbstrDesc);
841
842    HRESULT RegisterGUIDDWORD([in] REFCLSID rclsid,
843                              [in] REFGUID rguid,
844                              [in] DWORD dw);
845
846    HRESULT UnregisterGUIDDWORD([in] REFCLSID rclsid,
847                                [in] REFGUID rguid);
848
849    HRESULT GetGUIDDWORD([in] REFGUID rguid,
850                         [out] DWORD *pdw);
851
852    HRESULT RegisterGUID([in] REFGUID rguid,
853                         [out] TfGuidAtom *pguidatom);
854
855    HRESULT GetGUID([in] TfGuidAtom guidatom,
856                    [out] GUID *pguid);
857
858    HRESULT IsEqualTfGuidAtom([in] TfGuidAtom guidatom,
859                              [in] REFGUID rguid,
860                              [out] BOOL *pfEqual);
861}
862
863[
864    object,
865    uuid(f99d3f40-8e32-11d2-bf46-00105a2799b5),
866    pointer_default(unique)
867]
868interface IEnumTfRanges : IUnknown
869{
870    HRESULT Clone([out] IEnumTfRanges **ppEnum);
871
872    HRESULT Next(
873            [in] ULONG ulCount,
874            [out, size_is(ulCount), length_is(*pcFetched)] ITfRange **ppRange,
875            [out] ULONG *pcFetched);
876
877    HRESULT Reset();
878
879    HRESULT Skip(ULONG ulCount);
880}
881
882[
883    object,
884    uuid(42d4d099-7c1a-4a89-b836-6c6f22160df0),
885    pointer_default(unique)
886]
887interface ITfEditRecord : IUnknown
888{
889    const DWORD TF_GTP_INCL_TEXT = 0x1;
890
891    HRESULT GetSelectionStatus(
892        [out] BOOL *changed);
893
894    HRESULT GetTextAndPropertyUpdates(
895        [in] DWORD flags,
896        [in, size_is(count)] const GUID **props,
897        [in] ULONG count,
898        [out] IEnumTfRanges **ret);
899}
900
901[
902  object,
903  uuid(8127d409-ccd3-4683-967a-b43d5b482bf7),
904  pointer_default(unique)
905]
906interface ITfTextEditSink : IUnknown
907{
908    HRESULT OnEndEdit(
909        [in] ITfContext *pic,
910        [in] TfEditCookie ecReadOnly,
911        [in] ITfEditRecord *pEditRecord);
912}
913
914[
915    object,
916    uuid(5F20AA40-B57A-4F34-96AB-3576F377CC79),
917    pointer_default(unique)
918]
919interface ITfContextOwnerCompositionSink : IUnknown
920{
921    HRESULT OnStartComposition(
922        [in] ITfCompositionView *pComposition,
923        [out] BOOL *pfOk);
924
925    HRESULT OnUpdateComposition(
926        [in] ITfCompositionView *pComposition,
927        [in] ITfRange *pRangeNew);
928
929    HRESULT OnEndComposition(
930        [in] ITfCompositionView *pComposition);
931}
932
933[
934    object,
935    uuid(b246cb75-a93e-4652-bf8c-b3fe0cfd7e57),
936    pointer_default(unique)
937]
938interface ITfActiveLanguageProfileNotifySink : IUnknown
939{
940    HRESULT OnActivated(
941        [in] REFCLSID clsid,
942        [in] REFGUID guidProfile,
943        [in] BOOL fActivated);
944}
945
946[
947  object,
948  uuid(3d61bf11-ac5f-42c8-a4cb-931bcc28c744),
949  pointer_default(unique)
950]
951interface IEnumTfLanguageProfiles : IUnknown
952{
953    HRESULT Clone(
954        [out] IEnumTfLanguageProfiles **ppEnum);
955
956    HRESULT Next(
957        [in] ULONG ulCount,
958        [out, size_is(ulCount), length_is(*pcFetch)] TF_LANGUAGEPROFILE *pProfile,
959        [out] ULONG *pcFetch);
960
961    HRESULT Reset();
962
963    HRESULT Skip(
964        [in] ULONG ulCount);
965}
966
967[
968  object,
969  local,
970  uuid(aa80e7f7-2021-11d2-93e0-0060b067b86e),
971  pointer_default(unique)
972]
973interface ITfTextInputProcessor : IUnknown
974{
975    HRESULT Activate(
976        [in] ITfThreadMgr *ptim,
977        [in] TfClientId tid);
978
979    HRESULT Deactivate();
980}
981
982[
983  object,
984  uuid(aa80e80e-2021-11d2-93e0-0060b067b86e),
985  pointer_default(unique)
986]
987interface ITfThreadMgrEventSink : IUnknown
988{
989    HRESULT OnInitDocumentMgr(
990        [in] ITfDocumentMgr *pdim);
991
992    HRESULT OnUninitDocumentMgr(
993        [in] ITfDocumentMgr *pdim);
994
995    HRESULT OnSetFocus(
996        [in] ITfDocumentMgr *pdimFocus,
997        [in] ITfDocumentMgr *pdimPrevFocus);
998
999    HRESULT OnPushContext(
1000        [in] ITfContext *pic);
1001
1002    HRESULT OnPopContext(
1003        [in] ITfContext *pic);
1004}
1005
1006[
1007  object,
1008  local,
1009  uuid(aa80e7f0-2021-11d2-93e0-0060b067b86e),
1010  pointer_default(unique)
1011]
1012interface ITfKeystrokeMgr : IUnknown
1013{
1014    HRESULT AdviseKeyEventSink(
1015        [in] TfClientId tid,
1016        [in] ITfKeyEventSink *pSink,
1017        [in] BOOL fForeground);
1018
1019    HRESULT UnadviseKeyEventSink(
1020        [in] TfClientId tid);
1021
1022    HRESULT GetForeground(
1023        [out] CLSID *pclsid);
1024
1025    HRESULT TestKeyDown(
1026        [in] WPARAM wParam,
1027        [in] LPARAM lParam,
1028        [out] BOOL *pfEaten);
1029
1030    HRESULT TestKeyUp(
1031        [in] WPARAM wParam,
1032        [in] LPARAM lParam,
1033        [out] BOOL *pfEaten);
1034
1035    HRESULT KeyDown(
1036        [in] WPARAM wParam,
1037        [in] LPARAM lParam,
1038        [out] BOOL *pfEaten);
1039
1040    HRESULT KeyUp(
1041        [in] WPARAM wParam,
1042        [in] LPARAM lParam,
1043        [out] BOOL *pfEaten);
1044
1045    HRESULT GetPreservedKey(
1046        [in] ITfContext *pic,
1047        [in] const TF_PRESERVEDKEY *pprekey,
1048        [out] GUID *pguid);
1049
1050    HRESULT IsPreservedKey(
1051        [in] REFGUID rguid,
1052        [in] const TF_PRESERVEDKEY *pprekey,
1053        [out] BOOL *pfRegistered);
1054
1055    HRESULT PreserveKey(
1056        [in] TfClientId tid,
1057        [in] REFGUID rguid,
1058        [in] const TF_PRESERVEDKEY *prekey,
1059        [in, size_is(cchDesc)] const WCHAR *pchDesc,
1060        [in] ULONG cchDesc);
1061
1062    HRESULT UnpreserveKey(
1063        [in] REFGUID rguid,
1064        [in] const TF_PRESERVEDKEY *pprekey);
1065
1066    HRESULT SetPreservedKeyDescription(
1067        [in] REFGUID rguid,
1068        [in, size_is(cchDesc)] const WCHAR *pchDesc,
1069        [in] ULONG cchDesc);
1070
1071    HRESULT GetPreservedKeyDescription(
1072        [in] REFGUID rguid,
1073        [out] BSTR *pbstrDesc);
1074
1075    HRESULT SimulatePreservedKey(
1076        [in] ITfContext *pic,
1077        [in] REFGUID rguid,
1078        [out] BOOL *pfEaten);
1079}
1080
1081[
1082  object,
1083  local,
1084  uuid(aa80e7f5-2021-11d2-93e0-0060b067b86e),
1085  pointer_default(unique)
1086]
1087interface ITfKeyEventSink : IUnknown
1088{
1089    HRESULT OnSetFocus(
1090        [in] BOOL fForeground);
1091
1092    HRESULT OnTestKeyDown(
1093        [in] ITfContext *pic,
1094        [in] WPARAM wParam,
1095        [in] LPARAM lParam,
1096        [out] BOOL *pfEaten);
1097
1098    HRESULT OnTestKeyUp(
1099        [in] ITfContext *pic,
1100        [in] WPARAM wParam,
1101        [in] LPARAM lParam,
1102        [out] BOOL *pfEaten);
1103
1104    HRESULT OnKeyDown(
1105        [in] ITfContext *pic,
1106        [in] WPARAM wParam,
1107        [in] LPARAM lParam,
1108        [out] BOOL *pfEaten);
1109
1110    HRESULT OnKeyUp(
1111        [in] ITfContext *pic,
1112        [in] WPARAM wParam,
1113        [in] LPARAM lParam,
1114        [out] BOOL *pfEaten);
1115
1116    HRESULT OnPreservedKey(
1117        [in] ITfContext *pic,
1118        [in] REFGUID rguid,
1119        [out] BOOL *pfEaten);
1120}
1121
1122[
1123  object,
1124  local,
1125  uuid(1cd4c13b-1c36-4191-a70a-7f3e611f367d),
1126  pointer_default(unique)
1127]
1128interface ITfKeyTraceEventSink : IUnknown
1129{
1130    HRESULT OnKeyTraceDown(
1131        [in] WPARAM wParam,
1132        [in] LPARAM lParam);
1133
1134    HRESULT OnKeyTraceUp(
1135        [in] WPARAM wParam,
1136        [in] LPARAM lParam);
1137}
1138
1139[
1140  object,
1141  local,
1142  uuid(ea1ea136-19df-11d7-a6d2-00065b84435c),
1143  pointer_default(unique)
1144]
1145interface ITfUIElementSink : IUnknown
1146{
1147    HRESULT BeginUIElement(
1148        [in] DWORD id,
1149        [in, out] BOOL *show);
1150
1151    HRESULT UpdateUIElement(
1152        [in] DWORD id);
1153
1154    HRESULT EndUIElement(
1155        [in] DWORD id);
1156}
1157
1158[
1159  object,
1160  local,
1161  uuid(8f1b8ad8-0b6b-4874-90c5-bd76011e8f7c),
1162  pointer_default(unique)
1163]
1164interface ITfMessagePump : IUnknown
1165{
1166    HRESULT PeekMessageA(
1167        [out] LPMSG pMsg,
1168        [in] HWND hwnd,
1169        [in] UINT wMsgFilterMin,
1170        [in] UINT wMsgFilterMax,
1171        [in] UINT wRemoveMsg,
1172        [out] BOOL *pfResult);
1173
1174    HRESULT GetMessageA(
1175        [out] LPMSG pMsg,
1176        [in] HWND hwnd,
1177        [in] UINT wMsgFilterMin,
1178        [in] UINT wMsgFilterMax,
1179        [out] BOOL *pfResult);
1180
1181    HRESULT PeekMessageW(
1182        [out] LPMSG pMsg,
1183        [in] HWND hwnd,
1184        [in] UINT wMsgFilterMin,
1185        [in] UINT wMsgFilterMax,
1186        [in] UINT wRemoveMsg,
1187        [out] BOOL *pfResult);
1188
1189    HRESULT GetMessageW(
1190        [out] LPMSG pMsg,
1191        [in] HWND hwnd,
1192        [in] UINT wMsgFilterMin,
1193        [in] UINT wMsgFilterMax,
1194        [out] BOOL *pfResult);
1195}
1196
1197[
1198  object,
1199  local,
1200  uuid(d60a7b49-1b9f-4be2-b702-47e9dc05dec3),
1201  pointer_default(unique)
1202]
1203interface ITfClientId : IUnknown
1204{
1205    HRESULT GetClientId(
1206        [in] REFCLSID rclsid,
1207        [out] TfClientId *ptid);
1208}
1209
1210[
1211  object,
1212  uuid(43c9fe15-f494-4c17-9de2-b8a4ac350aa8),
1213  pointer_default(unique)
1214]
1215interface ITfLanguageProfileNotifySink : IUnknown
1216{
1217    HRESULT OnLanguageChange(
1218        [in] LANGID langid,
1219        [out] BOOL *pfAccept);
1220
1221    HRESULT OnLanguageChanged();
1222}
1223
1224[
1225  object,
1226  uuid(aa80e803-2021-11d2-93e0-0060b067b86e),
1227  pointer_default(unique)
1228]
1229interface ITfEditSession : IUnknown
1230{
1231    HRESULT DoEditSession(
1232        [in] TfEditCookie ec);
1233}
1234
1235[
1236  object,
1237  uuid(aa80e7ff-2021-11d2-93e0-0060b067b86e),
1238  pointer_default(unique)
1239]
1240interface ITfRange : IUnknown
1241{
1242    const WCHAR TF_CHAR_EMBEDDED     = TS_CHAR_EMBEDDED;
1243
1244    typedef [uuid(cf610f06-2882-46f6-abe5-298568b664c4)] enum { TF_GRAVITY_BACKWARD = 0, TF_GRAVITY_FORWARD = 1 } TfGravity;
1245
1246    typedef [uuid(1e512533-bbdc-4530-9a8e-a1dc0af67468)] enum { TF_SD_BACKWARD = 0, TF_SD_FORWARD = 1 } TfShiftDir;
1247
1248    const DWORD TF_HF_OBJECT         = 1;
1249    const DWORD TF_TF_MOVESTART      = 1;
1250    const DWORD TF_TF_IGNOREEND      = 2;
1251    const DWORD TF_ST_CORRECTION     = 1;
1252    const DWORD TF_IE_CORRECTION     = 1;
1253
1254    typedef [uuid(49930d51-7d93-448c-a48c-fea5dac192b1)] struct  TF_HALTCOND
1255    {
1256        ITfRange *pHaltRange;
1257        TfAnchor aHaltPos;
1258        DWORD dwFlags;
1259    } TF_HALTCOND;
1260
1261    HRESULT GetText(
1262        [in] TfEditCookie ec,
1263        [in] DWORD dwFlags,
1264        [out, size_is(cchMax), length_is(*pcch)] WCHAR *pchText,
1265        [in] ULONG cchMax,
1266        [out] ULONG *pcch);
1267
1268    HRESULT SetText(
1269        [in] TfEditCookie ec,
1270        [in] DWORD dwFlags,
1271        [in, size_is(cch), unique] const WCHAR *pchText,
1272        [in] LONG cch);
1273
1274    HRESULT GetFormattedText(
1275        [in] TfEditCookie ec,
1276        [out] IDataObject **ppDataObject);
1277
1278    HRESULT GetEmbedded(
1279        [in] TfEditCookie ec,
1280        [in] REFGUID rguidService,
1281        [in] REFIID riid,
1282        [out, iid_is(riid)] IUnknown **ppunk);
1283
1284    HRESULT InsertEmbedded(
1285        [in] TfEditCookie ec,
1286        [in] DWORD dwFlags,
1287        [in] IDataObject *pDataObject);
1288
1289    HRESULT ShiftStart(
1290        [in] TfEditCookie ec,
1291        [in] LONG cchReq,
1292        [out] LONG *pcch,
1293        [in, unique] const TF_HALTCOND *pHalt);
1294
1295    HRESULT ShiftEnd(
1296        [in] TfEditCookie ec,
1297        [in] LONG cchReq,
1298        [out] LONG *pcch,
1299        [in, unique] const TF_HALTCOND *pHalt);
1300
1301    HRESULT ShiftStartToRange(
1302        [in] TfEditCookie ec,
1303        [in] ITfRange *pRange,
1304        [in] TfAnchor aPos);
1305
1306    HRESULT ShiftEndToRange(
1307        [in] TfEditCookie ec,
1308        [in] ITfRange *pRange,
1309        [in] TfAnchor aPos);
1310
1311    HRESULT ShiftStartRegion(
1312        [in] TfEditCookie ec,
1313        [in] TfShiftDir dir,
1314        [out] BOOL *pfNoRegion);
1315
1316    HRESULT ShiftEndRegion(
1317        [in] TfEditCookie ec,
1318        [in] TfShiftDir dir,
1319        [out] BOOL *pfNoRegion);
1320
1321    HRESULT IsEmpty(
1322        [in] TfEditCookie ec,
1323        [out] BOOL *pfEmpty);
1324
1325    HRESULT Collapse(
1326        [in] TfEditCookie ec,
1327        [in] TfAnchor aPos);
1328
1329    HRESULT IsEqualStart(
1330        [in] TfEditCookie ec,
1331        [in] ITfRange *pWith,
1332        [in] TfAnchor aPos,
1333        [out] BOOL *pfEqual);
1334
1335    HRESULT IsEqualEnd(
1336        [in] TfEditCookie ec,
1337        [in] ITfRange *pWith,
1338        [in] TfAnchor aPos,
1339        [out] BOOL *pfEqual);
1340
1341    HRESULT CompareStart(
1342        [in] TfEditCookie ec,
1343        [in] ITfRange *pWith,
1344        [in] TfAnchor aPos,
1345        [out] LONG *plResult);
1346
1347    HRESULT CompareEnd(
1348        [in] TfEditCookie ec,
1349        [in] ITfRange *pWith,
1350        [in] TfAnchor aPos,
1351        [out] LONG *plResult);
1352
1353    HRESULT AdjustForInsert(
1354        [in] TfEditCookie ec,
1355        [in] ULONG cchInsert,
1356        [out] BOOL *pfInsertOk);
1357
1358    HRESULT GetGravity(
1359        [out] TfGravity *pgStart,
1360        [out] TfGravity *pgEnd);
1361
1362    HRESULT SetGravity(
1363        [in] TfEditCookie ec,
1364        [in] TfGravity gStart,
1365        [in] TfGravity gEnd);
1366
1367    HRESULT Clone(
1368        [out] ITfRange **ppClone);
1369
1370    HRESULT GetContext(
1371        [out] ITfContext **ppContext);
1372}
1373
1374[
1375    object,
1376    uuid(057a6296-029b-4154-b79a-0d461d4ea94c),
1377    pointer_default(unique)
1378]
1379interface ITfRangeACP : ITfRange
1380{
1381    HRESULT GetExtent([out] LONG *pacpAnchor,
1382                      [out] LONG *pcch);
1383
1384    HRESULT SetExtent([in] LONG acpAnchor,
1385                      [in] LONG cch);
1386}
1387
1388[
1389    object,
1390    uuid(55ce16ba-3014-41c1-9ceb-fade1446ac6c),
1391    pointer_default(unique)
1392]
1393interface ITfInsertAtSelection : IUnknown
1394{
1395    const DWORD TF_IAS_NOQUERY   = 0x1;
1396    const DWORD TF_IAS_QUERYONLY = 0x2;
1397    const DWORD TF_IAS_NO_DEFAULT_COMPOSITION = 0x80000000;
1398
1399    HRESULT InsertTextAtSelection(
1400        [in] TfEditCookie ec,
1401        [in] DWORD dwFlags,
1402        [in, size_is(cch)] const WCHAR *pchText,
1403        [in] LONG cch,
1404        [out] ITfRange **ppRange);
1405
1406    HRESULT InsertEmbeddedAtSelection(
1407        [in] TfEditCookie ec,
1408        [in] DWORD dwFlags,
1409        [in] IDataObject *pDataObject,
1410        [out] ITfRange **ppRange);
1411}
1412
1413[
1414    object,
1415    uuid(6834b120-88cb-11d2-bf45-00105a2799b5),
1416    pointer_default(unique)
1417]
1418interface ITfPropertyStore : IUnknown
1419{
1420    const DWORD TF_TU_CORRECTION = 0x1;
1421
1422    HRESULT GetType([out] GUID *pguid);
1423
1424    HRESULT GetDataType([out] DWORD *pdwReserved);
1425
1426    HRESULT GetData([out] VARIANT *pvarValue);
1427
1428    HRESULT OnTextUpdated(
1429            [in] DWORD dwFlags,
1430            [in] ITfRange *pRangeNew,
1431            [out] BOOL *pfAccept);
1432
1433    HRESULT Shrink(
1434            [in] ITfRange *pRangeNew,
1435            [out] BOOL *pfFree);
1436
1437    HRESULT Divide(
1438            [in] ITfRange *pRangeThis,
1439            [in] ITfRange *pRangeNew,
1440            [out] ITfPropertyStore **ppPropStore);
1441
1442    HRESULT Clone(
1443            [out] ITfPropertyStore **pPropStore);
1444
1445    HRESULT GetPropertyRangeCreator(
1446            [out] CLSID *pclsid);
1447
1448    HRESULT Serialize(
1449            [in] IStream *pStream,
1450            [out] ULONG *pcb);
1451}
1452
1453[
1454    object,
1455    uuid(5efd22Ba-7838-46cb-88e2-cadb14124f8f),
1456    pointer_default(unique)
1457]
1458interface IEnumITfCompositionView : IUnknown
1459{
1460    HRESULT Clone([out] IEnumITfCompositionView **ppEnum);
1461
1462    HRESULT Next(
1463            [in] ULONG ulCount,
1464            [out, size_is(ulCount), length_is(*pcFetched)] ITfCompositionView **rgCompositionView,
1465            [out] ULONG *pcFetched);
1466
1467    HRESULT Reset();
1468
1469    HRESULT Skip([in] ULONG ulCount);
1470}
1471
1472[
1473    object,
1474    uuid(20168d64-5a8f-4a5a-b7bd-cfa29f4D0fd9),
1475    pointer_default(unique)
1476]
1477interface ITfComposition : IUnknown
1478{
1479    HRESULT GetRange([out] ITfRange **ppRange);
1480
1481    HRESULT ShiftStart(
1482            [in] TfEditCookie ecWrite,
1483            [in] ITfRange *pNewStart);
1484
1485    HRESULT ShiftEnd(
1486            [in] TfEditCookie ecWrite,
1487            [in] ITfRange *pNewEnd);
1488
1489    HRESULT EndComposition([in] TfEditCookie ecWrite);
1490}
1491
1492[
1493    object,
1494    uuid(a781718c-579a-4b15-a280-32b8577acc5e),
1495    pointer_default(unique)
1496]
1497interface ITfCompositionSink : IUnknown
1498{
1499    HRESULT OnCompositionTerminated(
1500            [in] TfEditCookie ecWrite,
1501            [in] ITfComposition *pComposition);
1502}
1503
1504[
1505    object,
1506    uuid(d40C8aae-aC92-4fc7-9a11-0ee0e23aa39b),
1507    pointer_default(unique)
1508]
1509interface ITfContextComposition : IUnknown
1510{
1511    HRESULT StartComposition(
1512            [in] TfEditCookie ecWrite,
1513            [in] ITfRange *pCompositionRange,
1514            [in] ITfCompositionSink *pSink,
1515            [out] ITfComposition **ppComposition);
1516
1517    HRESULT EnumCompositions([out] IEnumITfCompositionView **ppEnum);
1518
1519    HRESULT FindComposition(
1520            [in] TfEditCookie ecRead,
1521            [in] ITfRange *pTestRange,
1522            [out] IEnumITfCompositionView **ppEnum);
1523
1524    HRESULT TakeOwnership(
1525            [in] TfEditCookie ecWrite,
1526            [in] ITfCompositionView *pComposition,
1527            [in] ITfCompositionSink *pSink,
1528            [out] ITfComposition **ppComposition);
1529}
1530
1531[
1532    object,
1533    uuid(86462810-593b-4916-9764-19c08e9ce110),
1534    pointer_default(unique)
1535]
1536interface ITfContextOwnerCompositionServices : ITfContextComposition
1537{
1538    HRESULT TerminateComposition([in] ITfCompositionView *pComposition);
1539}
1540
1541[
1542    object,
1543    uuid(4ef89150-0807-11d3-8df0-00105a2799b5),
1544    pointer_default(unique)
1545]
1546interface ITfPersistentPropertyLoaderACP : IUnknown
1547{
1548    HRESULT LoadProperty(
1549            [in] const TF_PERSISTENT_PROPERTY_HEADER_ACP *pHdr,
1550            [out] IStream **ppStream);
1551}
1552
1553[
1554    object,
1555    uuid(b23eb630-3e1c-11d3-a745-0050040ab407),
1556    pointer_default(unique)
1557]
1558interface ITfContextOwnerServices : IUnknown
1559{
1560    HRESULT OnLayoutChange();
1561
1562    HRESULT OnStatusChange([in] DWORD dwFlags);
1563
1564    HRESULT OnAttributeChange([in] REFGUID rguidAttribute);
1565
1566    HRESULT Serialize(
1567            [in] ITfProperty *pProp,
1568            [in] ITfRange *pRange,
1569            [out] TF_PERSISTENT_PROPERTY_HEADER_ACP *pHdr,
1570            [in] IStream *pStream);
1571
1572    HRESULT Unserialize(
1573            [in] ITfProperty *pProp,
1574            [in] const TF_PERSISTENT_PROPERTY_HEADER_ACP *pHdr,
1575            [in] IStream *pStream,
1576            [in] ITfPersistentPropertyLoaderACP *pLoader);
1577
1578    HRESULT ForceLoadProperty([in] ITfProperty *pProp);
1579
1580    HRESULT CreateRange(
1581            [in] LONG acpStart,
1582            [in] LONG acpEnd,
1583            [out] ITfRangeACP **ppRange);
1584}
1585
1586[
1587    object,
1588    uuid(17d49a3d-f8b8-4b2f-b254-52319dd64c53),
1589    pointer_default(unique)
1590]
1591interface ITfReadOnlyProperty : IUnknown
1592{
1593    HRESULT GetType([out] GUID *pguid);
1594
1595    HRESULT EnumRanges(
1596            [in] TfEditCookie ec,
1597            [out] IEnumTfRanges **ppEnum,
1598            [in] ITfRange *pTargetRange);
1599
1600    HRESULT GetValue(
1601            [in] TfEditCookie ec,
1602            [in] ITfRange *pRange,
1603            [out] VARIANT *pvarValue);
1604
1605    HRESULT GetContext([out] ITfContext **ppContext);
1606}
1607
1608[
1609    object,
1610    uuid(e2449660-9542-11d2-bf46-00105a2799b5),
1611    pointer_default(unique)
1612]
1613interface ITfProperty : ITfReadOnlyProperty
1614{
1615    HRESULT FindRange(
1616            [in] TfEditCookie ec,
1617            [in] ITfRange *pRange,
1618            [out] ITfRange **ppRange,
1619            [in] TfAnchor aPos);
1620
1621    HRESULT SetValueStore(
1622            [in] TfEditCookie ec,
1623            [in] ITfRange *pRange,
1624            [in] ITfPropertyStore *pPropStore);
1625
1626    HRESULT SetValue(
1627            [in] TfEditCookie ec,
1628            [in] ITfRange *pRange,
1629            [in] const VARIANT *pvarValue);
1630
1631    HRESULT Clear(
1632            [in] TfEditCookie ec,
1633            [in] ITfRange *pRange);
1634}
1635
1636[
1637  object,
1638  uuid(bb08f7a9-607a-4384-8623-056892b64371),
1639  pointer_default(unique)
1640]
1641interface ITfCompartment : IUnknown
1642{
1643    HRESULT SetValue(
1644        [in] TfClientId tid,
1645        [in] const VARIANT *pvarValue);
1646
1647    HRESULT GetValue(
1648        [out] VARIANT *pvarValue);
1649}
1650
1651[
1652  object,
1653  uuid(7dcf57ac-18ad-438b-824d-979bffb74b7c),
1654  pointer_default(unique)
1655]
1656interface ITfCompartmentMgr : IUnknown
1657{
1658    HRESULT GetCompartment(
1659        [in] REFGUID rguid,
1660        [out] ITfCompartment **ppcomp);
1661
1662    HRESULT ClearCompartment(
1663        [in] TfClientId tid,
1664        [in] REFGUID rguid);
1665
1666    HRESULT EnumCompartments(
1667        [out] IEnumGUID **ppEnum);
1668}
1669
1670[
1671  object,
1672  uuid(743abd5f-f26d-48df-8cc5-238492419b64),
1673  pointer_default(unique)
1674]
1675interface ITfCompartmentEventSink : IUnknown
1676{
1677    HRESULT OnChange(
1678        [in] REFGUID rguid);
1679}
1680
1681[
1682  object,
1683  uuid(8f1a7ea6-1654-4502-a86e-b2902344d507),
1684  pointer_default(unique)
1685]
1686interface IEnumTfContexts : IUnknown
1687{
1688    HRESULT Clone(
1689        [out] IEnumTfContexts **ppEnum);
1690
1691    HRESULT Next(
1692        [in] ULONG ulCount,
1693        [out, size_is(ulCount), length_is(*pcFetched)] ITfContext **rgContext,
1694        [out] ULONG *pcFetched);
1695
1696    HRESULT Reset();
1697
1698    HRESULT Skip(
1699        [in] ULONG ulCount);
1700}
1701
1702[
1703  object,
1704  uuid(aa80e808-2021-11d2-93e0-0060b067b86e),
1705  pointer_default(unique)
1706]
1707interface IEnumTfDocumentMgrs : IUnknown
1708{
1709    HRESULT Clone(
1710        [out] IEnumTfDocumentMgrs **ppEnum);
1711
1712    HRESULT Next(
1713        [in] ULONG ulCount,
1714        [out, size_is(ulCount), length_is(*pcFetched)] ITfDocumentMgr **rgDocumentMgr,
1715        [out] ULONG *pcFetched);
1716
1717    HRESULT Reset();
1718
1719    HRESULT Skip(
1720        [in] ULONG ulCount);
1721}
1722
1723[
1724    object,
1725    local,
1726    uuid(ea1ea137-19df-11d7-a6d2-00065b84435c),
1727    pointer_default(unique)
1728]
1729interface ITfUIElement : IUnknown
1730{
1731    HRESULT GetDescription(
1732        [out] BSTR *description);
1733
1734    HRESULT GetGUID(
1735        [out] GUID *guid);
1736
1737    HRESULT Show(
1738        [in] BOOL show);
1739
1740    HRESULT IsShown(
1741        [out] BOOL *show);
1742}
1743
1744[
1745    object,
1746    local,
1747    uuid(887aa91e-acba-4931-84da-3c5208cf543f),
1748    pointer_default(unique)
1749]
1750interface IEnumTfUIElements : IUnknown
1751{
1752    HRESULT Clone(
1753        [out] IEnumTfUIElements **enum_elements);
1754
1755    HRESULT Next(
1756        [in] ULONG count,
1757        [out, size_is(count), length_is(fetched)] ITfUIElement **element,
1758        [out] ULONG fetched);
1759
1760    HRESULT Reset();
1761
1762    HRESULT Skip(
1763        [in] ULONG count);
1764}
1765
1766[
1767    object,
1768    local,
1769    uuid(ea1ea135-19df-11d7-a6d2-00065b84435c),
1770    pointer_default(unique)
1771]
1772interface ITfUIElementMgr : IUnknown
1773{
1774    HRESULT BeginUIElement(
1775        [in] ITfUIElement *element,
1776        [in, out] BOOL *show,
1777        [out] DWORD *id);
1778
1779    HRESULT UpdateUIElement(
1780        [in] DWORD id);
1781
1782    HRESULT EndUIElement(
1783        [in] DWORD id);
1784
1785    HRESULT GetUIElement(
1786        [in] DWORD id,
1787        [out] ITfUIElement **element);
1788
1789    HRESULT EnumUIElements(
1790        [out] IEnumTfUIElements **enum_elements);
1791}
1792
1793[
1794  object,
1795  uuid(73131f9c-56a9-49dd-b0ee-d046633f7528),
1796  pointer_default(unique)
1797]
1798interface ITfSourceSingle : IUnknown
1799{
1800    HRESULT AdviseSingleSink(
1801        [in] TfClientId tid,
1802        [in] REFIID riid,
1803        [in, iid_is(riid)] IUnknown *punk);
1804
1805    HRESULT UnadviseSingleSink(
1806        [in] TfClientId tid,
1807        [in] REFIID riid);
1808}
1809
1810[
1811  object,
1812  local,
1813  uuid(c0f1db0c-3a20-405c-a303-96b6010a885f),
1814  pointer_default(unique)
1815]
1816interface ITfThreadFocusSink : IUnknown
1817{
1818    HRESULT OnSetThreadFocus();
1819
1820    HRESULT OnKillThreadFocus();
1821}
1822
1823[
1824  object,
1825  uuid(71c6e74e-0f28-11d8-a82a-00065b84435c),
1826  pointer_default(unique)
1827]
1828interface ITfInputProcessorProfileActivationSink : IUnknown
1829{
1830    HRESULT OnActivated(
1831        [in] DWORD dwProfileType,
1832        [in] LANGID langid,
1833        [in] REFCLSID clsid,
1834        [in] REFGUID catid,
1835        [in] REFGUID guidProfile,
1836        [in] HKL hkl,
1837        [in] DWORD dwFlags);
1838}
1839
1840[
1841    object,
1842    local,
1843    uuid(a1adaaa2-3a24-449d-ac96-5183e7f5c217),
1844    pointer_default(unique)
1845]
1846interface ITfMouseSink : IUnknown
1847{
1848    HRESULT OnMouseEvent(
1849        [in] ULONG uEdge,
1850        [in] ULONG uQuadrant,
1851        [in] DWORD dwBtnStatus,
1852        [out] BOOL *pfEaten);
1853}
1854
1855[
1856    object,
1857    uuid(09d146cd-a544-4132-925b-7afa8ef322d0),
1858    pointer_default(unique)
1859]
1860interface ITfMouseTracker : IUnknown
1861{
1862    HRESULT AdviseMouseSink(
1863        [in] ITfRange *range,
1864        [in] ITfMouseSink *pSink,
1865        [out] DWORD *pdwCookie);
1866
1867    HRESULT UnadviseMouseSink([in] DWORD dwCookie);
1868}
1869
1870[
1871    object,
1872    uuid(3bdd78e2-c16e-47fd-b883-ce6facc1a208),
1873    pointer_default(unique)
1874]
1875interface ITfMouseTrackerACP : IUnknown
1876{
1877    HRESULT AdviseMouseSink(
1878        [in] ITfRangeACP *range,
1879        [in] ITfMouseSink *pSink,
1880        [out] DWORD *pdwCookie);
1881
1882    HRESULT UnadviseMouseSink([in] DWORD dwCookie);
1883}
1884
1885[
1886    object,
1887    local,
1888    uuid(a615096f-1c57-4813-8a15-55ee6e5a839c),
1889    pointer_default(unique)
1890]
1891interface ITfTransitoryExtensionSink : IUnknown
1892{
1893    HRESULT OnTransitoryExtensionUpdated(
1894        [in] ITfContext *pic,
1895        [in] TfEditCookie ecReadOnly,
1896        [in] ITfRange *pResultRange,
1897        [in] ITfRange *pCompositionRange,
1898        [out] BOOL *pfDeleteResultRange);
1899}
1900