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