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