msctf.idl
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:60k
源码类别:

模拟服务器

开发平台:

C/C++

  1. //+-------------------------------------------------------------------------
  2. //
  3. //  Microsoft Windows
  4. //  Copyright (C) Microsoft Corporation, 1992-2001.
  5. //
  6. //  File: msctf.idl
  7. //
  8. //  Contents: Text Framework declarations.
  9. //
  10. //
  11. //--------------------------------------------------------------------------
  12. cpp_quote("//=--------------------------------------------------------------------------=")
  13. cpp_quote("// msctf.h")
  14. cpp_quote("")
  15. cpp_quote("")
  16. cpp_quote("// Text Framework declarations.")
  17. cpp_quote("")
  18. cpp_quote("//=--------------------------------------------------------------------------=")
  19. cpp_quote("// (C) Copyright 1995-2001 Microsoft Corporation.  All Rights Reserved.")
  20. cpp_quote("//")
  21. cpp_quote("// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF")
  22. cpp_quote("// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO")
  23. cpp_quote("// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A")
  24. cpp_quote("// PARTICULAR PURPOSE.")
  25. cpp_quote("//=--------------------------------------------------------------------------=")
  26. cpp_quote("")
  27. cpp_quote("#ifndef MSCTF_DEFINED")
  28. cpp_quote("#define MSCTF_DEFINED")
  29. cpp_quote("")
  30. cpp_quote("#include <windows.h>")
  31. cpp_quote("")
  32. cpp_quote("#ifdef __cplusplus")
  33. cpp_quote("extern "C" {")
  34. cpp_quote("#endif /* __cplusplus */")
  35. cpp_quote("")
  36. //
  37. // error codes
  38. //
  39. cpp_quote("#define TF_E_LOCKED          MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0500)")
  40. cpp_quote("#define TF_E_STACKFULL       MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0501)")
  41. cpp_quote("#define TF_E_NOTOWNEDRANGE   MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0502)")
  42. cpp_quote("#define TF_E_NOPROVIDER      MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0503)")
  43. cpp_quote("#define TF_E_DISCONNECTED    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0504)")
  44. cpp_quote("#define TF_E_INVALIDVIEW     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0505)")
  45. cpp_quote("#define TF_E_ALREADY_EXISTS  MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0506)")
  46. cpp_quote("#define TF_E_RANGE_NOT_COVERED MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0507)")
  47. cpp_quote("#define TF_E_COMPOSITION_REJECTED MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0508)")
  48. cpp_quote("#define TF_E_EMPTYCONTEXT    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0509)")
  49. // the following must match their TS_E_ counter parts!
  50. cpp_quote("#define TF_E_INVALIDPOS      MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0200)")
  51. cpp_quote("#define TF_E_NOLOCK          MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0201)")
  52. cpp_quote("#define TF_E_NOOBJECT        MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0202)")
  53. cpp_quote("#define TF_E_NOSERVICE       MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0203)")
  54. cpp_quote("#define TF_E_NOINTERFACE     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0204)")
  55. cpp_quote("#define TF_E_NOSELECTION     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0205)")
  56. cpp_quote("#define TF_E_NOLAYOUT        MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0206)")
  57. cpp_quote("#define TF_E_INVALIDPOINT    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0207)")
  58. cpp_quote("#define TF_E_SYNCHRONOUS     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0208)")
  59. cpp_quote("#define TF_E_READONLY        MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0209)")
  60. cpp_quote("#define TF_E_FORMAT          MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x020a)")
  61. // TF_S_ASYNC is only used as an [out] param for RequestEditSession
  62. cpp_quote("#define TF_S_ASYNC           MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_ITF, 0x0300)")
  63. cpp_quote("")
  64. cpp_quote("HRESULT WINAPI TF_CreateThreadMgr(ITfThreadMgr **pptim);")
  65. cpp_quote("HRESULT WINAPI TF_GetThreadMgr(ITfThreadMgr **pptim);")
  66. cpp_quote("HRESULT WINAPI TF_CreateInputProcessorProfiles(ITfInputProcessorProfiles **ppipr);")
  67. cpp_quote("HRESULT WINAPI TF_CreateDisplayAttributeMgr(ITfDisplayAttributeMgr **ppdam);")
  68. cpp_quote("HRESULT WINAPI TF_CreateLangBarMgr(ITfLangBarMgr **pppbm);")
  69. cpp_quote("HRESULT WINAPI TF_CreateLangBarItemMgr(ITfLangBarItemMgr **pplbim);")
  70. cpp_quote("")
  71. cpp_quote("EXTERN_C const GUID GUID_PROP_TEXTOWNER;")
  72. cpp_quote("EXTERN_C const GUID GUID_PROP_ATTRIBUTE;")
  73. cpp_quote("EXTERN_C const GUID GUID_PROP_LANGID;")
  74. cpp_quote("EXTERN_C const GUID GUID_PROP_READING;")
  75. cpp_quote("EXTERN_C const GUID GUID_PROP_COMPOSING;")
  76. cpp_quote("")
  77. cpp_quote("EXTERN_C const CLSID CLSID_TF_ThreadMgr;")
  78. cpp_quote("EXTERN_C const CLSID CLSID_TF_InputProcessorProfiles;")
  79. cpp_quote("EXTERN_C const CLSID CLSID_TF_LangBarMgr;")
  80. cpp_quote("EXTERN_C const CLSID CLSID_TF_DisplayAttributeMgr;")
  81. cpp_quote("EXTERN_C const CLSID CLSID_TF_CategoryMgr;")
  82. cpp_quote("EXTERN_C const CLSID CLSID_TF_LangBarItemMgr;")
  83. cpp_quote("EXTERN_C const GUID GUID_SYSTEM_FUNCTIONPROVIDER;")
  84. cpp_quote("EXTERN_C const GUID GUID_APP_FUNCTIONPROVIDER;")
  85. cpp_quote("")
  86. cpp_quote("")
  87. //
  88. // GUIDs for system predefined compartment
  89. //
  90. cpp_quote("EXTERN_C const GUID GUID_COMPARTMENT_KEYBOARD_DISABLED;")
  91. cpp_quote("EXTERN_C const GUID GUID_COMPARTMENT_KEYBOARD_OPENCLOSE;")
  92. cpp_quote("EXTERN_C const GUID GUID_COMPARTMENT_HANDWRITING_OPENCLOSE;")
  93. cpp_quote("EXTERN_C const GUID GUID_COMPARTMENT_SPEECH_DISABLED;")
  94. cpp_quote("EXTERN_C const GUID GUID_COMPARTMENT_SPEECH_OPENCLOSE;")
  95. cpp_quote("EXTERN_C const GUID GUID_COMPARTMENT_PERSISTMENUENABLED;")
  96. cpp_quote("EXTERN_C const GUID GUID_COMPARTMENT_EMPTYCONTEXT;")
  97. cpp_quote("EXTERN_C const GUID GUID_COMPARTMENT_TIPUISTATUS;")
  98. cpp_quote("")
  99. //
  100. // Conversion Mode Bias Compartment
  101. //
  102. cpp_quote("EXTERN_C const GUID GUID_PROP_MODEBIAS;")
  103. cpp_quote("")
  104. //
  105. // GUIDs for system predefined conversion mode bias
  106. //
  107. cpp_quote("EXTERN_C const GUID GUID_MODEBIAS_NONE;")
  108. cpp_quote("EXTERN_C const GUID GUID_MODEBIAS_FILENAME;")
  109. cpp_quote("EXTERN_C const GUID GUID_MODEBIAS_READING;")
  110. cpp_quote("EXTERN_C const GUID GUID_MODEBIAS_DATETIME;")
  111. cpp_quote("EXTERN_C const GUID GUID_MODEBIAS_NAME;")
  112. cpp_quote("EXTERN_C const GUID GUID_MODEBIAS_CONVERSATION;")
  113. cpp_quote("EXTERN_C const GUID GUID_MODEBIAS_NUMERIC;")
  114. //
  115. // These are FE language specific mode bias.
  116. //
  117. cpp_quote("EXTERN_C const GUID GUID_MODEBIAS_HIRAGANA;")
  118. cpp_quote("EXTERN_C const GUID GUID_MODEBIAS_KATAKANA;")
  119. cpp_quote("EXTERN_C const GUID GUID_MODEBIAS_HANGUL;")
  120. cpp_quote("EXTERN_C const GUID GUID_MODEBIAS_CHINESE;")
  121. cpp_quote("EXTERN_C const GUID GUID_MODEBIAS_HALFWIDTHKATAKANA;")
  122. cpp_quote("EXTERN_C const GUID GUID_MODEBIAS_FULLWIDTHALPHANUMERIC;")
  123. cpp_quote("EXTERN_C const GUID GUID_MODEBIAS_HALFWIDTHALPHANUMERIC;")
  124. cpp_quote("EXTERN_C const GUID GUID_MODEBIAS_FULLWIDTHHANGUL;")
  125. //
  126. // GUID_TFCAT_CATEGORY_OF_TIP categrorize the types of tips.
  127. //   by default, this category contains the following guids.
  128. //                           GUID_TFCAT_TIP_KEYBOARD
  129. //                           GUID_TFCAT_TIP_SPEECH
  130. //                           GUID_TFCAT_TIP_HANDWRITING
  131. //
  132. cpp_quote("EXTERN_C const GUID GUID_TFCAT_CATEGORY_OF_TIP;")
  133. //
  134. // GUIDs for the Tips category. Each category contains Tips classes.
  135. //
  136. cpp_quote("EXTERN_C const GUID GUID_TFCAT_TIP_KEYBOARD;")
  137. cpp_quote("EXTERN_C const GUID GUID_TFCAT_TIP_SPEECH;")
  138. cpp_quote("EXTERN_C const GUID GUID_TFCAT_TIP_HANDWRITING;")
  139. //
  140. // GUIDs for the property category. Each category contains Property GUID.
  141. //
  142. cpp_quote("EXTERN_C const GUID GUID_TFCAT_PROP_AUDIODATA;")
  143. cpp_quote("EXTERN_C const GUID GUID_TFCAT_PROP_INKDATA;")
  144. cpp_quote("")
  145. //
  146. // GUIDs for the property style.
  147. //
  148. cpp_quote("EXTERN_C const GUID GUID_TFCAT_PROPSTYLE_CUSTOM;")
  149. cpp_quote("EXTERN_C const GUID GUID_TFCAT_PROPSTYLE_STATIC;")
  150. cpp_quote("EXTERN_C const GUID GUID_TFCAT_PROPSTYLE_STATICCOMPACT;")
  151. cpp_quote("")
  152. //
  153. // GUIDs for the display attribute provider category.
  154. //
  155. cpp_quote("EXTERN_C const GUID GUID_TFCAT_DISPLAYATTRIBUTEPROVIDER;")
  156. cpp_quote("EXTERN_C const GUID GUID_TFCAT_DISPLAYATTRIBUTEPROPERTY;")
  157. cpp_quote("")
  158. cpp_quote("#define TF_INVALID_GUIDATOM ((TfGuidAtom)0)")
  159. cpp_quote("#define TF_CLIENTID_NULL    ((TfClientId)0)")
  160. cpp_quote("")
  161. cpp_quote("#define TF_MOD_ALT                         0x0001")
  162. cpp_quote("#define TF_MOD_CONTROL                     0x0002")
  163. cpp_quote("#define TF_MOD_SHIFT                       0x0004")
  164. cpp_quote("#define TF_MOD_RALT                        0x0008")
  165. cpp_quote("#define TF_MOD_RCONTROL                    0x0010")
  166. cpp_quote("#define TF_MOD_RSHIFT                      0x0020")
  167. cpp_quote("#define TF_MOD_LALT                        0x0040")
  168. cpp_quote("#define TF_MOD_LCONTROL                    0x0080")
  169. cpp_quote("#define TF_MOD_LSHIFT                      0x0100")
  170. cpp_quote("#define TF_MOD_ON_KEYUP                    0x0200")
  171. cpp_quote("#define TF_MOD_IGNORE_ALL_MODIFIER         0x0400")
  172. cpp_quote("")
  173. //
  174. // flags for GUID_COMPARTMENT_TIPUISTATUS
  175. //
  176. cpp_quote("#define TF_US_HIDETIPUI         0x00000001")
  177. cpp_quote("")
  178. //
  179. //  flags for GUID GUID_COMPARTMENT_SPEECH_DISABLED
  180. //
  181. cpp_quote("#define TF_DISABLE_SPEECH         0x00000001")
  182. cpp_quote("#define TF_DISABLE_DICTATION      0x00000002")
  183. cpp_quote("#define TF_DISABLE_COMMANDING     0x00000004")
  184. cpp_quote("")
  185. cpp_quote("#define TF_PROCESS_ATOM             TEXT("_CTF_PROCESS_ATOM_")")
  186. cpp_quote("#define TF_ENABLE_PROCESS_ATOM      TEXT("_CTF_ENABLE_PROCESS_ATOM_")")
  187. cpp_quote("#ifdef __cplusplus")
  188. cpp_quote("}")
  189. cpp_quote("#endif  /* __cplusplus */")
  190. import "oaidl.idl";
  191. import "comcat.idl";
  192. import "textstor.idl";
  193. import "ctfutb.idl";
  194. cpp_quote("")
  195. cpp_quote("#if 0")
  196. typedef [uuid(4f5d560f-5ab5-4dde-8c4d-404592857ab0)] UINT_PTR   HKL;
  197. cpp_quote("#endif")
  198. cpp_quote("")
  199. interface ITfThreadMgrEventSink;
  200. interface ITfTextInputProcessor;
  201. interface ITfRange;
  202. interface ITfRangeACP;
  203. interface ITfDocumentMgr;
  204. interface ITfContext;
  205. interface ITfKeyFocusNotifySink;
  206. interface ITfEditSession;
  207. interface ITfProperty;
  208. interface ITfPersistentPropertyLoaderACP;
  209. interface IEnumTfProperties;
  210. interface ITfKeyEventSink;
  211. interface IEnumTfTextDeltas;
  212. interface ITfFunctionProvider;
  213. interface IEnumTfFunctionProviders;
  214. interface IEnumTfDocumentMgrs;
  215. interface IEnumTfContexts;
  216. interface ITfSource;
  217. interface ITfCompartmentMgr;
  218. interface ITfRangeBackup;
  219. interface IEnumTfRanges;
  220. interface ITfMouseSink;
  221. interface ITfReadOnlyProperty;
  222. interface IEnumTfLanguageProfiles;
  223. typedef [uuid(7213778c-7bb0-4270-b050-6189ee594e97)]  DWORD TfEditCookie;
  224. const TfEditCookie TF_INVALID_EDIT_COOKIE = 0;
  225. typedef [uuid(88a9c478-f3ec-4763-8345-cd9250443f8d)] DWORD TfGuidAtom;
  226. typedef [uuid(de403c21-89fd-4f85-8b87-64584d063fbc)] DWORD TfClientId;
  227. typedef [uuid(e26d9e1d-691e-4f29-90d7-338dcf1f8cef)] struct TF_PERSISTENT_PROPERTY_HEADER_ACP
  228. {
  229.     GUID guidType;      // property type
  230.     LONG ichStart;      // range information of this property data
  231.     LONG cch;           // range information of this property data
  232.     ULONG cb;           // the data size of pStream in BYTE count
  233.     DWORD dwPrivate;    // private data
  234.     CLSID clsidTIP;     // the original owner of the property data
  235. } TF_PERSISTENT_PROPERTY_HEADER_ACP;
  236. typedef [uuid(e1b5808d-1e46-4c19-84dc-68c5f5978cc8)] struct TF_LANGUAGEPROFILE
  237. {
  238.     CLSID clsid;        // CLSID of tip
  239.     LANGID langid;      // language id
  240.     GUID catid;         // category of tip
  241.     BOOL fActive;       // activated profile
  242.     GUID guidProfile;   // profile description
  243. } TF_LANGUAGEPROFILE;
  244. typedef [uuid(5a886226-ae9a-489b-b991-2b1e25ee59a9)]  enum { TF_ANCHOR_START = 0, TF_ANCHOR_END = 1 } TfAnchor;
  245. //
  246. // ITfThreadMgr
  247. //
  248. [
  249.   object,
  250.   local,
  251.   uuid(aa80e801-2021-11d2-93e0-0060b067b86e),
  252.   pointer_default(unique)
  253. ]
  254. interface ITfThreadMgr : IUnknown
  255. {
  256.     HRESULT Activate([out] TfClientId *ptid);
  257.     HRESULT Deactivate();
  258.     HRESULT CreateDocumentMgr([out] ITfDocumentMgr **ppdim);
  259.     HRESULT EnumDocumentMgrs([out] IEnumTfDocumentMgrs **ppEnum);
  260.     HRESULT GetFocus([out] ITfDocumentMgr **ppdimFocus);
  261.     HRESULT SetFocus([in] ITfDocumentMgr *pdimFocus);
  262.     HRESULT AssociateFocus([in] HWND hwnd,
  263.                            [in, unique] ITfDocumentMgr *pdimNew,
  264.                            [out] ITfDocumentMgr **ppdimPrev);
  265.     HRESULT IsThreadFocus([out] BOOL *pfThreadFocus);
  266.     HRESULT GetFunctionProvider([in] REFCLSID clsid,
  267.                                 [out] ITfFunctionProvider **ppFuncProv);
  268.     HRESULT EnumFunctionProviders([out] IEnumTfFunctionProviders **ppEnum);
  269.     HRESULT GetGlobalCompartment([out] ITfCompartmentMgr **ppCompMgr);
  270. };
  271. //
  272. // ITfThreadMgrEventSink
  273. //
  274. [
  275.   object,
  276.   uuid(aa80e80e-2021-11d2-93e0-0060b067b86e),
  277.   pointer_default(unique)
  278. ]
  279. interface ITfThreadMgrEventSink : IUnknown
  280. {
  281.     HRESULT OnInitDocumentMgr([in] ITfDocumentMgr *pdim);
  282.     HRESULT OnUninitDocumentMgr([in] ITfDocumentMgr *pdim);
  283.     HRESULT OnSetFocus([in] ITfDocumentMgr *pdimFocus, [in] ITfDocumentMgr *pdimPrevFocus);
  284.     HRESULT OnPushContext([in] ITfContext *pic);
  285.     HRESULT OnPopContext([in] ITfContext *pic);
  286. };
  287. //
  288. // ITfConfigureSystemKeystrokeFeed
  289. //
  290. [
  291.   object,
  292.   local,
  293.   uuid(0d2c969a-bc9c-437c-84ee-951c49b1a764),
  294.   pointer_default(unique)
  295. ]
  296. interface ITfConfigureSystemKeystrokeFeed : IUnknown
  297. {
  298.     HRESULT DisableSystemKeystrokeFeed();
  299.     HRESULT EnableSystemKeystrokeFeed();
  300. };
  301. //
  302. // IEnumTfDocumentMgrs
  303. //
  304. [
  305.   object,
  306.   uuid(aa80e808-2021-11d2-93e0-0060b067b86e),
  307.   pointer_default(unique)
  308. ]
  309. interface IEnumTfDocumentMgrs : IUnknown
  310. {
  311.     HRESULT Clone([out] IEnumTfDocumentMgrs **ppEnum);
  312.     HRESULT Next([in] ULONG ulCount,
  313.                  [out, size_is(ulCount), length_is(*pcFetched)] ITfDocumentMgr **rgDocumentMgr,
  314.                  [out] ULONG *pcFetched);
  315.     HRESULT Reset();
  316.     HRESULT Skip([in] ULONG ulCount);
  317. };
  318. //
  319. // ITfDocumentMgr
  320. //
  321. [
  322.     object,
  323.     uuid(aa80e7f4-2021-11d2-93e0-0060b067b86e),
  324.     pointer_default(unique)
  325. ]
  326. interface ITfDocumentMgr : IUnknown
  327. {
  328.     HRESULT CreateContext([in] TfClientId tidOwner,
  329.                           [in] DWORD dwFlags,
  330.                           [in, unique] IUnknown *punk,
  331.                           [out] ITfContext **ppic,
  332.                           [out] TfEditCookie *pecTextStore);
  333.     HRESULT Push([in] ITfContext *pic);
  334.     const DWORD TF_POPF_ALL = 0x0001;
  335.     HRESULT Pop([in] DWORD dwFlags);
  336.     HRESULT GetTop([out] ITfContext **ppic);
  337.     HRESULT GetBase([out] ITfContext **ppic);
  338.     HRESULT EnumContexts([out] IEnumTfContexts **ppEnum);
  339. };
  340. //
  341. // IEnumTfContexts
  342. //
  343. [
  344.   object,
  345.   uuid(8f1a7ea6-1654-4502-a86e-b2902344d507),
  346.   pointer_default(unique)
  347. ]
  348. interface IEnumTfContexts : IUnknown
  349. {
  350.     HRESULT Clone([out] IEnumTfContexts **ppEnum);
  351.     HRESULT Next([in] ULONG ulCount,
  352.                  [out, size_is(ulCount), length_is(*pcFetched)] ITfContext **rgContext,
  353.                  [out] ULONG *pcFetched);
  354.     HRESULT Reset();
  355.     HRESULT Skip([in] ULONG ulCount);
  356. };
  357. //
  358. // ITfCompositionView
  359. //
  360. [
  361.     object,
  362.     uuid(D7540241-F9A1-4364-BEFC-DBCD2C4395B7),
  363.     pointer_default(unique)
  364. ]
  365. interface ITfCompositionView : IUnknown
  366. {
  367.     HRESULT GetOwnerClsid([out] CLSID *pclsid);
  368.     HRESULT GetRange([out] ITfRange **ppRange);
  369. };
  370. //
  371. // IEnumITfCompositionView
  372. //
  373. [
  374.     object,
  375.     uuid(5EFD22BA-7838-46CB-88E2-CADB14124F8F),
  376.     pointer_default(unique)
  377. ]
  378. interface IEnumITfCompositionView : IUnknown
  379. {
  380.     HRESULT Clone([out] IEnumITfCompositionView **ppEnum);
  381.     HRESULT Next([in] ULONG ulCount,
  382.                  [out, size_is(ulCount), length_is(*pcFetched)] ITfCompositionView **rgCompositionView,
  383.                  [out] ULONG *pcFetched);
  384.     HRESULT Reset();
  385.     HRESULT Skip([in] ULONG ulCount);
  386. };
  387. //
  388. // ITfComposition
  389. //
  390. [
  391.     object,
  392.     uuid(20168D64-5A8F-4A5A-B7BD-CFA29F4D0FD9),
  393.     pointer_default(unique)
  394. ]
  395. interface ITfComposition : IUnknown
  396. {
  397.     HRESULT GetRange([out] ITfRange **ppRange);
  398.     HRESULT ShiftStart([in] TfEditCookie ecWrite,
  399.                        [in] ITfRange *pNewStart);
  400.     HRESULT ShiftEnd([in] TfEditCookie ecWrite,
  401.                      [in] ITfRange *pNewEnd);
  402.     HRESULT EndComposition([in] TfEditCookie ecWrite);
  403. };
  404. //
  405. // ITfCompositionSink
  406. //
  407. [
  408.     object,
  409.     uuid(A781718C-579A-4B15-A280-32B8577ACC5E),
  410.     pointer_default(unique)
  411. ]
  412. interface ITfCompositionSink : IUnknown
  413. {
  414.     HRESULT OnCompositionTerminated([in] TfEditCookie ecWrite, [in] ITfComposition *pComposition);
  415. };
  416. //
  417. // ITfContextComposition
  418. //
  419. [
  420.     object,
  421.     uuid(D40C8AAE-AC92-4FC7-9A11-0EE0E23AA39B),
  422.     pointer_default(unique)
  423. ]
  424. interface ITfContextComposition : IUnknown
  425. {
  426.     HRESULT StartComposition([in] TfEditCookie ecWrite,
  427.                              [in] ITfRange *pCompositionRange,
  428.                              [in] ITfCompositionSink *pSink,
  429.                              [out] ITfComposition **ppComposition);
  430.     HRESULT EnumCompositions([out] IEnumITfCompositionView **ppEnum);
  431.     HRESULT FindComposition([in] TfEditCookie ecRead,
  432.                             [in] ITfRange *pTestRange,
  433.                             [out] IEnumITfCompositionView **ppEnum);
  434.     HRESULT TakeOwnership([in] TfEditCookie ecWrite,
  435.                           [in] ITfCompositionView *pComposition,
  436.                           [in] ITfCompositionSink *pSink,
  437.                           [out] ITfComposition **ppComposition);
  438. };
  439. //
  440. // ITfContextOwnerCompositionServices
  441. //
  442. [
  443.     object,
  444.     uuid(86462810-593B-4916-9764-19C08E9CE110),
  445.     pointer_default(unique)
  446. ]
  447. interface ITfContextOwnerCompositionServices : ITfContextComposition
  448. {
  449.     HRESULT TerminateComposition([in] ITfCompositionView *pComposition);
  450. };
  451. //
  452. // ITfContextOwnerCompositionSink
  453. //
  454. [
  455.     object,
  456.     uuid(5F20AA40-B57A-4F34-96AB-3576F377CC79),
  457.     pointer_default(unique)
  458. ]
  459. interface ITfContextOwnerCompositionSink : IUnknown
  460. {
  461.     HRESULT OnStartComposition([in] ITfCompositionView *pComposition,
  462.                                [out] BOOL *pfOk);
  463.     HRESULT OnUpdateComposition([in] ITfCompositionView *pComposition,
  464.                                 [in] ITfRange *pRangeNew);
  465.     HRESULT OnEndComposition([in] ITfCompositionView *pComposition);
  466. };
  467. //
  468. // ITfContextView
  469. //
  470. [
  471.     object,
  472.     uuid(2433bf8e-0f9b-435c-ba2c-180611978c30),
  473.     pointer_default(unique)
  474. ]
  475. interface ITfContextView : IUnknown
  476. {
  477.     HRESULT GetRangeFromPoint([in] TfEditCookie ec,
  478.                               [in] const POINT *ppt,
  479.                               [in] DWORD dwFlags,
  480.                               [out] ITfRange **ppRange);
  481.     HRESULT GetTextExt([in] TfEditCookie ec,
  482.                        [in] ITfRange *pRange,
  483.                        [out] RECT *prc,
  484.                        [out] BOOL *pfClipped);
  485.     HRESULT GetScreenExt([out] RECT *prc);
  486.     HRESULT GetWnd([out] HWND *phwnd);
  487. };
  488. //
  489. // IEnumTfContextView
  490. //
  491. [
  492.     object,
  493.     uuid(F0C0F8DD-CF38-44E1-BB0F-68CF0D551C78),
  494.     pointer_default(unique)
  495. ]
  496. interface IEnumTfContextViews : IUnknown
  497. {
  498.     HRESULT Clone([out] IEnumTfContextViews **ppEnum);
  499.     HRESULT Next([in] ULONG ulCount,
  500.                  [out, size_is(ulCount), length_is(*pcFetched)] ITfContextView **rgViews,
  501.                  [out] ULONG *pcFetched);
  502.     HRESULT Reset();
  503.     HRESULT Skip([in] ULONG ulCount);
  504. };
  505. //
  506. // ITfContext
  507. //
  508. [
  509.     object,
  510.     uuid(aa80e7fd-2021-11d2-93e0-0060b067b86e),
  511.     pointer_default(unique)
  512. ]
  513. interface ITfContext : IUnknown
  514. {
  515.     const DWORD TF_ES_ASYNCDONTCARE   = 0x0;
  516.     const DWORD TF_ES_SYNC            = 0x1;
  517.     const DWORD TF_ES_READ            = 0x2;
  518.     const DWORD TF_ES_READWRITE       = 0x6;
  519.     const DWORD TF_ES_ASYNC           = 0x8;
  520.     HRESULT RequestEditSession([in] TfClientId tid,
  521.                                [in] ITfEditSession *pes,
  522.                                [in] DWORD dwFlags,
  523.                                [out] HRESULT *phrSession);
  524.     HRESULT InWriteSession([in] TfClientId tid,
  525.                            [out] BOOL *pfWriteSession);
  526.     typedef [uuid(1690be9b-d3e9-49f6-8d8b-51b905af4c43)] enum { TF_AE_NONE = 0, TF_AE_START = 1, TF_AE_END = 2 } TfActiveSelEnd;
  527.     typedef [uuid(36ae42a4-6989-4bdc-b48a-6137b7bf2e42)] struct TF_SELECTIONSTYLE
  528.     {
  529.         TfActiveSelEnd ase;
  530.         BOOL fInterimChar;
  531.     } TF_SELECTIONSTYLE;
  532.     typedef [uuid(75eb22f2-b0bf-46a8-8006-975a3b6efcf1)] struct TF_SELECTION
  533.     {
  534.         ITfRange *range;
  535.         TF_SELECTIONSTYLE style;
  536.     } TF_SELECTION;
  537.     const ULONG TF_DEFAULT_SELECTION = TS_DEFAULT_SELECTION;
  538.     HRESULT GetSelection([in] TfEditCookie ec,
  539.                          [in] ULONG ulIndex,
  540.                          [in] ULONG ulCount,
  541.                          [out, size_is(ulCount), length_is(*pcFetched)] TF_SELECTION *pSelection,
  542.                          [out] ULONG *pcFetched);
  543.     HRESULT SetSelection([in] TfEditCookie ec, 
  544.                          [in] ULONG ulCount,
  545.                          [in, size_is(ulCount)] const TF_SELECTION *pSelection);
  546.     HRESULT GetStart([in] TfEditCookie ec,
  547.                      [out] ITfRange **ppStart);
  548.     HRESULT GetEnd([in] TfEditCookie ec,
  549.                    [out] ITfRange **ppEnd);
  550.     // bit values for TF_STATUS's dwDynamicFlags field
  551.     const DWORD TF_SD_READONLY        = TS_SD_READONLY;       // if set, document is read only; writes will fail
  552.     const DWORD TF_SD_LOADING         = TS_SD_LOADING;        // if set, document is loading, expect additional inserts
  553.     // bit values for TF_STATUS's dwStaticFlags field
  554.     const DWORD TF_SS_DISJOINTSEL     = TS_SS_DISJOINTSEL;    // if set, the document supports multiple selections
  555.     const DWORD TF_SS_REGIONS         = TS_SS_REGIONS;        // if clear, the document will never contain multiple regions
  556.     const DWORD TF_SS_TRANSITORY      = TS_SS_TRANSITORY;     // if set, the document is expected to have a short lifespan
  557.     typedef [uuid(bc7d979a-846a-444d-afef-0a9bfa82b961)] TS_STATUS TF_STATUS;
  558.     HRESULT GetActiveView([out] ITfContextView **ppView);
  559.     HRESULT EnumViews([out] IEnumTfContextViews **ppEnum);
  560.     
  561.     HRESULT GetStatus([out] TF_STATUS *pdcs);
  562.     HRESULT GetProperty([in] REFGUID guidProp,
  563.                         [out] ITfProperty **ppProp);
  564.     HRESULT GetAppProperty([in] REFGUID guidProp,
  565.                            [out] ITfReadOnlyProperty **ppProp);
  566.     HRESULT TrackProperties([in, size_is(cProp)] const GUID **prgProp,
  567.                             [in] ULONG cProp,
  568.                             [in, size_is(cAppProp)] const GUID **prgAppProp,
  569.                             [in] ULONG cAppProp,   
  570.                             [out] ITfReadOnlyProperty **ppProperty);
  571.     HRESULT EnumProperties([out] IEnumTfProperties **ppEnum);
  572.     HRESULT GetDocumentMgr([out] ITfDocumentMgr **ppDm);
  573.     HRESULT CreateRangeBackup([in] TfEditCookie ec,
  574.                               [in] ITfRange *pRange,
  575.                               [out] ITfRangeBackup **ppBackup);
  576. };
  577. [
  578.     object,
  579.     uuid(0fab9bdb-d250-4169-84e5-6be118fdd7a8),
  580.     pointer_default(unique)
  581. ]
  582. interface ITfQueryEmbedded : IUnknown
  583. {
  584.     HRESULT QueryInsertEmbedded([in] const GUID *pguidService,
  585.                                 [in] const FORMATETC *pFormatEtc,
  586.                                 [out] BOOL *pfInsertable);
  587. };
  588. //
  589. // ITfInsertAtSelection
  590. //
  591. [
  592.     object,
  593.     uuid(55ce16ba-3014-41c1-9ceb-fade1446ac6c),
  594.     pointer_default(unique)
  595. ]
  596. interface ITfInsertAtSelection : IUnknown
  597. {
  598.     const DWORD TF_IAS_NOQUERY   = 0x1; // ppRange will be NULL at exit.
  599.     const DWORD TF_IAS_QUERYONLY = 0x2; // Don't do the actual insert, caller only interested in ppRange.  Exclusive with TF_IAS_NOQUERY.
  600.     const DWORD TF_IAS_NO_DEFAULT_COMPOSITION = 0x80000000; // caller takes responsibility for starting a composition over the range
  601.     HRESULT InsertTextAtSelection([in] TfEditCookie ec,
  602.                                   [in] DWORD dwFlags,
  603.                                   [in, size_is(cch)] const WCHAR *pchText,
  604.                                   [in] LONG cch,
  605.                                   [out] ITfRange **ppRange);
  606.     HRESULT InsertEmbeddedAtSelection([in] TfEditCookie ec,
  607.                                       [in] DWORD dwFlags,
  608.                                       [in] IDataObject *pDataObject,
  609.                                       [out] ITfRange **ppRange);
  610. };
  611. //
  612. // ITfCleanupContextSink
  613. //
  614. [
  615.   object,
  616.   uuid(01689689-7acb-4e9b-ab7c-7ea46b12b522),
  617.   pointer_default(unique)
  618. ]
  619. interface ITfCleanupContextSink : IUnknown
  620. {
  621.     HRESULT OnCleanupContext([in] TfEditCookie ecWrite, [in] ITfContext *pic);
  622. };
  623. //
  624. // ITfCleanupContextDurationSink
  625. //
  626. [
  627.   object,
  628.   uuid(45c35144-154e-4797-bed8-d33ae7bf8794),
  629.   pointer_default(unique)
  630. ]
  631. interface ITfCleanupContextDurationSink : IUnknown
  632. {
  633.     HRESULT OnStartCleanupContext();
  634.     HRESULT OnEndCleanupContext();
  635. };
  636. //
  637. // ITfReadOnlyProperty
  638. //
  639. [
  640.   object,
  641.   uuid(17d49a3d-f8b8-4b2f-b254-52319dd64c53),
  642.   pointer_default(unique)
  643. ]
  644. interface ITfReadOnlyProperty : IUnknown
  645. {
  646.     HRESULT GetType([out] GUID *pguid);
  647.     HRESULT EnumRanges([in] TfEditCookie ec,
  648.                        [out] IEnumTfRanges **ppEnum,
  649.                        [in] ITfRange *pTargetRange);
  650.     HRESULT GetValue([in] TfEditCookie ec,
  651.                      [in] ITfRange *pRange,
  652.                      [out] VARIANT *pvarValue);
  653.     HRESULT GetContext([out] ITfContext **ppContext);
  654. };
  655. typedef [uuid(d678c645-eb6a-45c9-b4ee-0f3e3a991348)] struct TF_PROPERTYVAL
  656. {
  657.     GUID guidId;
  658.     VARIANT varValue;
  659. } TF_PROPERTYVAL;
  660. //
  661. // IEnumTfPropertyValue
  662. //
  663. [
  664.   object,
  665.   uuid(8ed8981b-7c10-4d7d-9fb3-ab72e9c75f72),
  666.   pointer_default(unique)
  667. ]
  668. interface IEnumTfPropertyValue : IUnknown
  669. {
  670.     HRESULT Clone([out] IEnumTfPropertyValue **ppEnum);
  671.     HRESULT Next([in] ULONG ulCount,
  672.                  [out, size_is(ulCount), length_is(*pcFetched)] TF_PROPERTYVAL *rgValues,
  673.                  [out] ULONG *pcFetched);
  674.     HRESULT Reset();
  675.     HRESULT Skip([in] ULONG ulCount);
  676. };
  677. //
  678. // ITfMouseTracker
  679. //
  680. [
  681.     object,
  682.     uuid(09d146cd-a544-4132-925b-7afa8ef322d0),
  683.     pointer_default(unique)
  684. ]
  685. interface ITfMouseTracker : IUnknown
  686. {
  687.     HRESULT AdviseMouseSink([in] ITfRange *range,
  688.                             [in] ITfMouseSink *pSink,
  689.                             [out] DWORD *pdwCookie);
  690.     HRESULT UnadviseMouseSink([in] DWORD dwCookie);
  691. };
  692. //
  693. // ITfMouseTracker
  694. //
  695. [
  696.     object,
  697.     uuid(3bdd78e2-c16e-47fd-b883-ce6facc1a208),
  698.     pointer_default(unique)
  699. ]
  700. interface ITfMouseTrackerACP : IUnknown
  701. {
  702.     HRESULT AdviseMouseSink([in] ITfRangeACP *range,
  703.                             [in] ITfMouseSink *pSink,
  704.                             [out] DWORD *pdwCookie);
  705.     HRESULT UnadviseMouseSink([in] DWORD dwCookie);
  706. };
  707. //
  708. // ITfMouseSink
  709. //
  710. [
  711.     object,
  712.     local,
  713.     uuid(a1adaaa2-3a24-449d-ac96-5183e7f5c217),
  714.     pointer_default(unique)
  715. ]
  716. interface ITfMouseSink : IUnknown
  717. {
  718.     HRESULT OnMouseEvent([in] ULONG uEdge,
  719.                          [in] ULONG uQuadrant,
  720.                          [in] DWORD dwBtnStatus,
  721.                          [out] BOOL *pfEaten);
  722. };
  723. //
  724. // ITfEditRecord
  725. //
  726. [
  727.   object,
  728.   uuid(42d4d099-7c1a-4a89-b836-6c6f22160df0),
  729.   pointer_default(unique)
  730. ]
  731. interface ITfEditRecord : IUnknown
  732. {
  733.     const DWORD TF_GTP_INCL_TEXT = 0x1;
  734.     HRESULT GetSelectionStatus([out] BOOL *pfChanged);
  735.     HRESULT GetTextAndPropertyUpdates([in] DWORD dwFlags,
  736.                                       [in, size_is(cProperties)] const GUID **prgProperties,
  737.                                       [in] ULONG cProperties,
  738.                                       [out] IEnumTfRanges **ppEnum);
  739. };
  740. //
  741. // ITfTextEditSink
  742. //
  743. [
  744.   object,
  745.   uuid(8127d409-ccd3-4683-967a-b43d5b482bf7),
  746.   pointer_default(unique)
  747. ]
  748. interface ITfTextEditSink : IUnknown
  749. {
  750.     HRESULT OnEndEdit([in] ITfContext *pic, [in] TfEditCookie ecReadOnly, [in] ITfEditRecord *pEditRecord);
  751. };
  752. //
  753. // ITfTextLayoutSink
  754. //
  755. [
  756.   object,
  757.   uuid(2af2d06a-dd5b-4927-a0b4-54f19c91fade),
  758.   pointer_default(unique)
  759. ]
  760. interface ITfTextLayoutSink : IUnknown
  761. {
  762.     typedef [uuid(603553cf-9edd-4cc1-9ecc-069e4a427734)] enum { TF_LC_CREATE = 0, TF_LC_CHANGE = 1, TF_LC_DESTROY = 2, } TfLayoutCode;
  763.     HRESULT OnLayoutChange([in] ITfContext *pic, [in] TfLayoutCode lcode, [in] ITfContextView *pView);
  764. };
  765. //
  766. // ITfStatusSink
  767. //
  768. [
  769.   object,
  770.   uuid(6b7d8d73-b267-4f69-b32e-1ca321ce4f45),
  771.   pointer_default(unique)
  772. ]
  773. interface ITfStatusSink : IUnknown
  774. {
  775.     HRESULT OnStatusChange([in] ITfContext *pic, [in] DWORD dwFlags);
  776. };
  777. //
  778. // ITfEditTransactionSink
  779. //
  780. [
  781.   object,
  782.   uuid(708fbf70-b520-416b-b06c-2c41ab44f8ba),
  783.   pointer_default(unique)
  784. ]
  785. interface ITfEditTransactionSink : IUnknown
  786. {
  787.     HRESULT OnStartEditTransaction([in] ITfContext *pic);
  788.     HRESULT OnEndEditTransaction([in] ITfContext *pic);
  789. };
  790. //
  791. // ITfContextOwner
  792. //
  793. [
  794.   object,
  795.   uuid(aa80e80c-2021-11d2-93e0-0060b067b86e),
  796.   pointer_default(unique)
  797. ]
  798. interface ITfContextOwner : IUnknown
  799. {
  800.     HRESULT GetACPFromPoint([in] const POINT *ptScreen,
  801.                             [in] DWORD dwFlags,
  802.                             [out] LONG *pacp);
  803.     HRESULT GetTextExt([in] LONG acpStart,
  804.                        [in] LONG acpEnd,
  805.                        [out] RECT *prc,
  806.                        [out] BOOL *pfClipped);
  807.     HRESULT GetScreenExt([out] RECT *prc);
  808.     HRESULT GetStatus([out] TF_STATUS *pdcs);
  809.     HRESULT GetWnd([out] HWND *phwnd);
  810.     HRESULT GetAttribute([in] REFGUID rguidAttribute, [out] VARIANT *pvarValue);
  811. };
  812. //
  813. // ITfContextOwnerServices
  814. //
  815. [
  816.   object,
  817.   uuid(b23eb630-3e1c-11d3-a745-0050040ab407),
  818.   pointer_default(unique)
  819. ]
  820. interface ITfContextOwnerServices : IUnknown
  821. {
  822.     HRESULT OnLayoutChange();
  823.     HRESULT OnStatusChange([in] DWORD dwFlags);
  824.     HRESULT OnAttributeChange([in] REFGUID rguidAttribute);
  825.     HRESULT Serialize([in] ITfProperty *pProp,
  826.                       [in] ITfRange *pRange,
  827.                       [out] TF_PERSISTENT_PROPERTY_HEADER_ACP *pHdr,
  828.                       [in] IStream *pStream);
  829.     HRESULT Unserialize([in] ITfProperty *pProp,
  830.                         [in] const TF_PERSISTENT_PROPERTY_HEADER_ACP *pHdr,
  831.                         [in] IStream *pStream,
  832.                         [in] ITfPersistentPropertyLoaderACP *pLoader);
  833.     HRESULT ForceLoadProperty([in] ITfProperty *pProp);
  834.     HRESULT CreateRange([in] LONG acpStart,
  835.                         [in] LONG acpEnd,
  836.                         [out] ITfRangeACP **ppRange);
  837. }
  838. //
  839. // ITfContextKeyEventSink
  840. //
  841. [
  842.   object,
  843.   local,
  844.   uuid(0552ba5d-c835-4934-bf50-846aaa67432f),
  845.   pointer_default(unique)
  846. ]
  847. interface ITfContextKeyEventSink : IUnknown
  848. {
  849.     HRESULT OnKeyDown([in] WPARAM wParam,
  850.                       [in] LPARAM lParam,
  851.                       [out] BOOL *pfEaten);
  852.     HRESULT OnKeyUp([in] WPARAM wParam,
  853.                     [in] LPARAM lParam,
  854.                     [out] BOOL *pfEaten);
  855.     HRESULT OnTestKeyDown([in] WPARAM wParam,
  856.                           [in] LPARAM lParam,
  857.                           [out] BOOL *pfEaten);
  858.     HRESULT OnTestKeyUp([in] WPARAM wParam,
  859.                         [in] LPARAM lParam,
  860.                         [out] BOOL *pfEaten);
  861. };
  862. //
  863. // ITfEditSession
  864. //
  865. [
  866.   object,
  867.   uuid(aa80e803-2021-11d2-93e0-0060b067b86e),
  868.   pointer_default(unique)
  869. ]
  870. interface ITfEditSession : IUnknown
  871. {
  872.     HRESULT DoEditSession([in] TfEditCookie ec);
  873. }
  874. //
  875. // ITfRange
  876. //
  877. [
  878.   object,
  879.   uuid(aa80e7ff-2021-11d2-93e0-0060b067b86e),
  880.   pointer_default(unique)
  881. ]
  882. interface ITfRange : IUnknown
  883. {
  884.     const WCHAR TF_CHAR_EMBEDDED     = TS_CHAR_EMBEDDED; // unicode 2.1 object replacement character
  885.     typedef [uuid(cf610f06-2882-46f6-abe5-298568b664c4)] enum { TF_GRAVITY_BACKWARD = 0, TF_GRAVITY_FORWARD = 1 } TfGravity;
  886.     typedef [uuid(1e512533-bbdc-4530-9a8e-a1dc0af67468)] enum { TF_SD_BACKWARD = 0, TF_SD_FORWARD = 1 } TfShiftDir;
  887.     const DWORD TF_HF_OBJECT         = 1; // halt shift for TF_CHAR_EMBEDDED
  888.     const DWORD TF_TF_MOVESTART      = 1; // update start anchor
  889.     const DWORD TF_TF_IGNOREEND      = 2; // ignore the end anchor
  890.     const DWORD TF_ST_CORRECTION     = 1; // the replacement is a transform of existing content (correction), not new content
  891.     const DWORD TF_IE_CORRECTION     = 1;
  892.     typedef [uuid(49930d51-7d93-448c-a48c-fea5dac192b1)] struct  TF_HALTCOND
  893.     {
  894.         ITfRange *pHaltRange; // halt shift if anchor encountered
  895.         TfAnchor aHaltPos;    // ignored if pHaltRange == NULL
  896.         DWORD dwFlags;        // TF_HF_*
  897.     } TF_HALTCOND;
  898.     HRESULT GetText([in] TfEditCookie ec,
  899.                     [in] DWORD dwFlags,
  900.                     [out, size_is(cchMax), length_is(*pcch)] WCHAR *pchText,
  901.                     [in] ULONG cchMax,
  902.                     [out] ULONG *pcch);
  903.     HRESULT SetText([in] TfEditCookie ec,
  904.                     [in] DWORD dwFlags,
  905.                     [in, size_is(cch), unique] const WCHAR *pchText,
  906.                     [in] LONG cch);
  907.     HRESULT GetFormattedText([in] TfEditCookie ec,
  908.                              [out] IDataObject **ppDataObject);
  909.     HRESULT GetEmbedded([in] TfEditCookie ec,
  910.                         [in] REFGUID rguidService,
  911.                         [in] REFIID riid,
  912.                         [out, iid_is(riid)] IUnknown **ppunk);
  913.     HRESULT InsertEmbedded([in] TfEditCookie ec,
  914.                            [in] DWORD dwFlags,
  915.                            [in] IDataObject *pDataObject);
  916.     HRESULT ShiftStart([in] TfEditCookie ec,
  917.                        [in] LONG cchReq,
  918.                        [out] LONG *pcch,
  919.                        [in, unique] const TF_HALTCOND *pHalt);
  920.     HRESULT ShiftEnd([in] TfEditCookie ec,
  921.                      [in] LONG cchReq,
  922.                      [out] LONG *pcch,
  923.                      [in, unique] const TF_HALTCOND *pHalt);
  924.     HRESULT ShiftStartToRange([in] TfEditCookie ec,
  925.                               [in] ITfRange *pRange,
  926.                               [in] TfAnchor aPos);
  927.     HRESULT ShiftEndToRange([in] TfEditCookie ec,
  928.                             [in] ITfRange *pRange,
  929.                             [in] TfAnchor aPos);
  930.     HRESULT ShiftStartRegion([in] TfEditCookie ec,
  931.                              [in] TfShiftDir dir,
  932.                              [out] BOOL *pfNoRegion);
  933.     HRESULT ShiftEndRegion([in] TfEditCookie ec,
  934.                            [in] TfShiftDir dir,
  935.                            [out] BOOL *pfNoRegion);
  936.     HRESULT IsEmpty([in] TfEditCookie ec,
  937.                     [out] BOOL *pfEmpty);
  938.     HRESULT Collapse([in] TfEditCookie ec,
  939.                      [in] TfAnchor aPos);
  940.     HRESULT IsEqualStart([in] TfEditCookie ec,
  941.                          [in] ITfRange *pWith,
  942.                          [in] TfAnchor aPos,
  943.                          [out] BOOL *pfEqual);
  944.     HRESULT IsEqualEnd([in] TfEditCookie ec,
  945.                        [in] ITfRange *pWith,
  946.                        [in] TfAnchor aPos,
  947.                        [out] BOOL *pfEqual);
  948.     HRESULT CompareStart([in] TfEditCookie ec,
  949.                          [in] ITfRange *pWith,
  950.                          [in] TfAnchor aPos,
  951.                          [out] LONG *plResult);
  952.     HRESULT CompareEnd([in] TfEditCookie ec,
  953.                        [in] ITfRange *pWith,
  954.                        [in] TfAnchor aPos,
  955.                        [out] LONG *plResult);
  956.     HRESULT AdjustForInsert([in] TfEditCookie ec,
  957.                             [in] ULONG cchInsert,
  958.                             [out] BOOL *pfInsertOk);
  959.     HRESULT GetGravity([out] TfGravity *pgStart,
  960.                        [out] TfGravity *pgEnd);
  961.     HRESULT SetGravity([in] TfEditCookie ec,
  962.                        [in] TfGravity gStart,
  963.                        [in] TfGravity gEnd);
  964.     HRESULT Clone([out] ITfRange **ppClone);
  965.     HRESULT GetContext([out] ITfContext **ppContext);
  966. };
  967. //
  968. // ITfRangeACP
  969. //
  970. [
  971.   object,
  972.   uuid(057a6296-029b-4154-b79a-0d461d4ea94c),
  973.   pointer_default(unique)
  974. ]
  975. interface ITfRangeACP : ITfRange
  976. {
  977.     HRESULT GetExtent([out] LONG *pacpAnchor,
  978.                       [out] LONG *pcch);
  979.     HRESULT SetExtent([in] LONG acpAnchor,
  980.                       [in] LONG cch);
  981. }
  982. //
  983. // ITextStoreACPServices
  984. //
  985. [
  986.   object,
  987.   uuid(aa80e901-2021-11d2-93e0-0060b067b86e),
  988.   pointer_default(unique)
  989. ]
  990. interface ITextStoreACPServices : IUnknown
  991. {
  992.     HRESULT Serialize([in] ITfProperty *pProp, 
  993.                       [in] ITfRange *pRange, 
  994.                       [out] TF_PERSISTENT_PROPERTY_HEADER_ACP *pHdr, 
  995.                       [in] IStream *pStream);
  996.     HRESULT Unserialize([in] ITfProperty *pProp, 
  997.                         [in] const TF_PERSISTENT_PROPERTY_HEADER_ACP *pHdr, 
  998.                         [in] IStream *pStream, 
  999.                         [in] ITfPersistentPropertyLoaderACP *pLoader);
  1000.     HRESULT ForceLoadProperty([in] ITfProperty *pProp);
  1001.     HRESULT CreateRange([in] LONG acpStart, 
  1002.                         [in] LONG acpEnd, 
  1003.                         [out] ITfRangeACP **ppRange);
  1004. };
  1005. //
  1006. // ITfRangeBackup
  1007. //
  1008. [
  1009.   object,
  1010.   uuid(463a506d-6992-49d2-9b88-93d55e70bb16),
  1011.   pointer_default(unique)
  1012. ]
  1013. interface ITfRangeBackup : IUnknown
  1014. {
  1015.     HRESULT Restore([in] TfEditCookie ec,
  1016.                     [in] ITfRange *pRange);
  1017. };
  1018. //
  1019. // ITfPropertyStore
  1020. //
  1021. [
  1022.     object,
  1023.     uuid(6834b120-88cb-11d2-bf45-00105a2799b5),
  1024.     pointer_default(unique)
  1025. ]
  1026. interface ITfPropertyStore : IUnknown
  1027. {
  1028.     // OnTextUpdated flags
  1029.     const DWORD TF_TU_CORRECTION = 0x1;
  1030.     HRESULT GetType([out] GUID *pguid);
  1031.     HRESULT GetDataType([out] DWORD *pdwReserved);
  1032.     HRESULT GetData([out] VARIANT *pvarValue);
  1033.     HRESULT OnTextUpdated([in] DWORD dwFlags,
  1034.                           [in] ITfRange *pRangeNew,
  1035.                           [out] BOOL *pfAccept);
  1036.     HRESULT Shrink([in] ITfRange *pRangeNew,
  1037.                    [out] BOOL *pfFree);
  1038.     HRESULT Divide([in] ITfRange *pRangeThis,
  1039.                    [in] ITfRange *pRangeNew,
  1040.                    [out] ITfPropertyStore **ppPropStore);
  1041.     HRESULT Clone([out] ITfPropertyStore **pPropStore);
  1042.     HRESULT GetPropertyRangeCreator([out] CLSID *pclsid);
  1043.     HRESULT Serialize([in] IStream *pStream,
  1044.                       [out] ULONG *pcb);
  1045. }
  1046. //
  1047. // IEnumTfRanges
  1048. //
  1049. [
  1050.   object,
  1051.   uuid(f99d3f40-8e32-11d2-bf46-00105a2799b5),
  1052.   pointer_default(unique)
  1053. ]
  1054. interface IEnumTfRanges : IUnknown
  1055. {
  1056.     HRESULT Clone([out] IEnumTfRanges **ppEnum);
  1057.     HRESULT Next([in] ULONG ulCount,
  1058.                  [out, size_is(ulCount), length_is(*pcFetched)] ITfRange **ppRange,
  1059.                  [out] ULONG *pcFetched);
  1060.     HRESULT Reset();
  1061.     HRESULT Skip(ULONG ulCount);
  1062. };
  1063. //
  1064. // ITfCreatePropertyStore
  1065. //
  1066. [
  1067.   object,
  1068.   uuid(2463fbf0-b0af-11d2-afc5-00105a2799b5),
  1069.   pointer_default(unique)
  1070. ]
  1071. interface ITfCreatePropertyStore : IUnknown
  1072. {
  1073.     HRESULT IsStoreSerializable([in] REFGUID guidProp,
  1074.                                 [in] ITfRange *pRange,
  1075.                                 [in] ITfPropertyStore *pPropStore,
  1076.                                 [out] BOOL *pfSerializable);
  1077.     HRESULT CreatePropertyStore([in] REFGUID guidProp,
  1078.                                 [in] ITfRange *pRange,
  1079.                                 [in] ULONG cb,
  1080.                                 [in] IStream *pStream,
  1081.                                 [out] ITfPropertyStore **ppStore);
  1082. }
  1083. //
  1084. // ITfPersistentPropertyLoaderACP
  1085. //
  1086. [
  1087.   object,
  1088.   uuid(4ef89150-0807-11d3-8df0-00105a2799b5),
  1089.   pointer_default(unique)
  1090. ]
  1091. interface ITfPersistentPropertyLoaderACP : IUnknown
  1092. {
  1093.     HRESULT LoadProperty([in] const TF_PERSISTENT_PROPERTY_HEADER_ACP *pHdr,
  1094.                          [out] IStream **ppStream);
  1095. }
  1096. //
  1097. // ITfProperty
  1098. //
  1099. [
  1100.   object,
  1101.   uuid(e2449660-9542-11d2-bf46-00105a2799b5),
  1102.   pointer_default(unique)
  1103. ]
  1104. interface ITfProperty : ITfReadOnlyProperty
  1105. {
  1106.     HRESULT FindRange([in] TfEditCookie ec,
  1107.                       [in] ITfRange *pRange,
  1108.                       [out] ITfRange **ppRange,
  1109.                       [in] TfAnchor aPos);
  1110.     HRESULT SetValueStore([in] TfEditCookie ec,
  1111.                           [in] ITfRange *pRange,
  1112.                           [in] ITfPropertyStore *pPropStore);
  1113.     HRESULT SetValue([in] TfEditCookie ec,
  1114.                      [in] ITfRange *pRange,
  1115.                      [in] const VARIANT *pvarValue);
  1116.     HRESULT Clear([in] TfEditCookie ec,
  1117.                   [in] ITfRange *pRange);
  1118. }
  1119. //
  1120. // IEnumTfProperties
  1121. //
  1122. [
  1123.   object,
  1124.   uuid(19188cb0-aca9-11d2-afc5-00105a2799b5),
  1125.   pointer_default(unique)
  1126. ]
  1127. interface IEnumTfProperties : IUnknown
  1128. {
  1129.     HRESULT Clone([out] IEnumTfProperties **ppEnum);
  1130.     HRESULT Next([in] ULONG ulCount,
  1131.                  [out, size_is(ulCount), length_is(*pcFetched)] ITfProperty **ppProp,
  1132.                  [out] ULONG *pcFetched);
  1133.     HRESULT Reset();
  1134.     HRESULT Skip([in] ULONG ulCount);
  1135. }
  1136. //
  1137. // ITfCompartment
  1138. //
  1139. [
  1140.   object,
  1141.   uuid(bb08f7a9-607a-4384-8623-056892b64371),
  1142.   pointer_default(unique)
  1143. ]
  1144. interface ITfCompartment : IUnknown
  1145. {
  1146.     HRESULT SetValue([in] TfClientId tid,
  1147.                      [in] const VARIANT *pvarValue);
  1148.     HRESULT GetValue([out] VARIANT *pvarValue);
  1149. }
  1150. //
  1151. // ITfCompartmentEventSink
  1152. //
  1153. [
  1154.   object,
  1155.   uuid(743abd5f-f26d-48df-8cc5-238492419b64),
  1156.   pointer_default(unique)
  1157. ]
  1158. interface ITfCompartmentEventSink : IUnknown
  1159. {
  1160.     HRESULT OnChange([in] REFGUID rguid);
  1161. }
  1162. //
  1163. // ITfCompartmentMgr
  1164. //
  1165. [
  1166.   object,
  1167.   uuid(7dcf57ac-18ad-438b-824d-979bffb74b7c),
  1168.   pointer_default(unique)
  1169. ]
  1170. interface ITfCompartmentMgr : IUnknown
  1171. {
  1172.     HRESULT GetCompartment([in] REFGUID rguid,
  1173.                            [out] ITfCompartment **ppcomp);
  1174.     HRESULT ClearCompartment([in] TfClientId tid, 
  1175.                              [in] REFGUID rguid);
  1176.     HRESULT EnumCompartments([out] IEnumGUID **ppEnum);
  1177. }
  1178. //
  1179. // ITfFunction
  1180. //
  1181. [
  1182.   object,
  1183.   uuid(db593490-098f-11d3-8df0-00105a2799b5),
  1184.   pointer_default(unique)
  1185. ]
  1186. interface ITfFunction : IUnknown
  1187. {
  1188.     HRESULT GetDisplayName([out] BSTR *pbstrName);
  1189. }
  1190. //
  1191. // ITfFunctionProvider
  1192. //
  1193. [
  1194.   object,
  1195.   uuid(101d6610-0990-11d3-8df0-00105a2799b5),
  1196.   pointer_default(unique)
  1197. ]
  1198. interface ITfFunctionProvider : IUnknown
  1199. {
  1200.     HRESULT GetType([out] GUID *pguid);
  1201.     HRESULT GetDescription([out] BSTR *pbstrDesc);
  1202.     HRESULT GetFunction([in] REFGUID rguid,
  1203.                         [in] REFIID riid,
  1204.                         [out, iid_is(riid)] IUnknown **ppunk);
  1205. }
  1206. //
  1207. // IEnumTfFunctionProviders
  1208. //
  1209. [
  1210.   object,
  1211.   uuid(e4b24db0-0990-11d3-8df0-00105a2799b5),
  1212.   pointer_default(unique)
  1213. ]
  1214. interface IEnumTfFunctionProviders : IUnknown
  1215. {
  1216.     HRESULT Clone([out] IEnumTfFunctionProviders **ppEnum);
  1217.     HRESULT Next([in] ULONG ulCount,
  1218.                  [out, size_is(ulCount), length_is(*pcFetch)] ITfFunctionProvider **ppCmdobj,
  1219.                  [out] ULONG *pcFetch);
  1220.     HRESULT Reset();
  1221.     HRESULT Skip([in] ULONG ulCount);
  1222. };
  1223. //
  1224. // ITfInputProcessorProfiles
  1225. //
  1226. [
  1227.   object,
  1228.   local,
  1229.   uuid(1F02B6C5-7842-4EE6-8A0B-9A24183A95CA),
  1230.   pointer_default(unique)
  1231. ]
  1232. interface ITfInputProcessorProfiles : IUnknown
  1233. {
  1234.     HRESULT Register([in] REFCLSID rclsid);
  1235.     HRESULT Unregister([in] REFCLSID rclsid);
  1236.     HRESULT AddLanguageProfile([in] REFCLSID rclsid,
  1237.                                [in] LANGID langid,
  1238.                                [in] REFGUID guidProfile,
  1239.                                [in, size_is(cchDesc)] const WCHAR *pchDesc,
  1240.                                [in] ULONG cchDesc,
  1241.                                [in, size_is(cchFile)] const WCHAR *pchIconFile,
  1242.                                [in] ULONG cchFile,
  1243.                                [in] ULONG uIconIndex);
  1244.     HRESULT RemoveLanguageProfile([in] REFCLSID rclsid,
  1245.                                   [in] LANGID langid,
  1246.                                   [in] REFGUID guidProfile);
  1247.     HRESULT EnumInputProcessorInfo([out] IEnumGUID **ppEnum);
  1248.     HRESULT GetDefaultLanguageProfile([in] LANGID langid,
  1249.                                       [in] REFGUID catid,
  1250.                                       [out] CLSID *pclsid,
  1251.                                       [out] GUID *pguidProfile);
  1252.     HRESULT SetDefaultLanguageProfile([in] LANGID langid,
  1253.                                       [in] REFCLSID rclsid,
  1254.                                       [in] REFGUID guidProfiles);
  1255.     HRESULT ActivateLanguageProfile([in] REFCLSID rclsid, 
  1256.                                     [in] LANGID langid, 
  1257.                                     [in] REFGUID guidProfiles);
  1258.     HRESULT GetActiveLanguageProfile([in] REFCLSID rclsid, 
  1259.                                      [out] LANGID *plangid, 
  1260.                                      [out] GUID *pguidProfile);
  1261.     HRESULT GetLanguageProfileDescription([in] REFCLSID rclsid, 
  1262.                                           [in] LANGID langid, 
  1263.                                           [in] REFGUID guidProfile,
  1264.                                           [out] BSTR *pbstrProfile);
  1265.     HRESULT GetCurrentLanguage([out] LANGID *plangid);
  1266.     HRESULT ChangeCurrentLanguage([in] LANGID langid);
  1267.     HRESULT GetLanguageList([out] LANGID **ppLangId,
  1268.                             [out] ULONG *pulCount);
  1269.     HRESULT EnumLanguageProfiles([in] LANGID langid, 
  1270.                                  [out] IEnumTfLanguageProfiles **ppEnum);
  1271.     HRESULT EnableLanguageProfile([in] REFCLSID rclsid,
  1272.                                   [in] LANGID langid,
  1273.                                   [in] REFGUID guidProfile,
  1274.                                   [in] BOOL fEnable);
  1275.     HRESULT IsEnabledLanguageProfile([in] REFCLSID rclsid,
  1276.                                      [in] LANGID langid,
  1277.                                      [in] REFGUID guidProfile,
  1278.                                      [out] BOOL *pfEnable);
  1279.     HRESULT EnableLanguageProfileByDefault([in] REFCLSID rclsid,
  1280.                                            [in] LANGID langid,
  1281.                                            [in] REFGUID guidProfile,
  1282.                                            [in] BOOL fEnable);
  1283.     HRESULT SubstituteKeyboardLayout([in] REFCLSID rclsid,
  1284.                                      [in] LANGID langid,
  1285.                                      [in] REFGUID guidProfile,
  1286.                                      [in] HKL hKL);
  1287. }
  1288. //
  1289. // ITfInputProcessorProfilesEx
  1290. //
  1291. // Implemented by Cicero
  1292. //
  1293. [
  1294.   object,
  1295.   uuid(892f230f-fe00-4a41-a98e-fcd6de0d35ef),
  1296.   pointer_default(unique)
  1297. ]
  1298. interface ITfInputProcessorProfilesEx : ITfInputProcessorProfiles
  1299. {
  1300.     HRESULT SetLanguageProfileDisplayName([in] REFCLSID rclsid,
  1301.                                    [in] LANGID langid,
  1302.                                    [in] REFGUID guidProfile,
  1303.                                    [in, size_is(cchFile)] const WCHAR *pchFile,
  1304.                                    [in] ULONG cchFile,
  1305.                                    [in] ULONG uResId);
  1306. };
  1307. //
  1308. // ITfActiveLanguageProfileNotifySink
  1309. //
  1310. [
  1311.   object,
  1312.   uuid(b246cb75-a93e-4652-bf8c-b3fe0cfd7e57),
  1313.   pointer_default(unique)
  1314. ]
  1315. interface ITfActiveLanguageProfileNotifySink : IUnknown
  1316. {
  1317.     HRESULT OnActivated([in] REFCLSID clsid,
  1318.                         [in] REFGUID guidProfile,
  1319.                         [in] BOOL fActivated);
  1320. }
  1321. //
  1322. // IEnumTfLanguageProfiles
  1323. //
  1324. [
  1325.   object,
  1326.   uuid(3d61bf11-ac5f-42c8-a4cb-931bcc28c744),
  1327.   pointer_default(unique)
  1328. ]
  1329. interface IEnumTfLanguageProfiles : IUnknown
  1330. {
  1331.     HRESULT Clone([out] IEnumTfLanguageProfiles **ppEnum);
  1332.     HRESULT Next([in] ULONG ulCount,
  1333.                  [out, size_is(ulCount), length_is(*pcFetch)] TF_LANGUAGEPROFILE *pProfile,
  1334.                  [out] ULONG *pcFetch);
  1335.     HRESULT Reset();
  1336.     HRESULT Skip([in] ULONG ulCount);
  1337. };
  1338. //
  1339. // ITfLanguageProfileNotifySink
  1340. //
  1341. [
  1342.   object,
  1343.   uuid(43c9fe15-f494-4c17-9de2-b8a4ac350aa8),
  1344.   pointer_default(unique)
  1345. ]
  1346. interface ITfLanguageProfileNotifySink : IUnknown
  1347. {
  1348.     HRESULT OnLanguageChange([in] LANGID langid,
  1349.                              [out] BOOL *pfAccept);
  1350.     HRESULT OnLanguageChanged();
  1351. }
  1352. typedef [uuid(77c12f95-b783-450d-879f-1cd2362c6521)] struct TF_PRESERVEDKEY
  1353. {
  1354.     UINT uVKey;
  1355.     UINT uModifiers;
  1356. } TF_PRESERVEDKEY;
  1357. //
  1358. // ITfKeystrokeMgr
  1359. //
  1360. [
  1361.   object,
  1362.   local,
  1363.   uuid(aa80e7f0-2021-11d2-93e0-0060b067b86e),
  1364.   pointer_default(unique)
  1365. ]
  1366. interface ITfKeystrokeMgr : IUnknown
  1367. {
  1368.     HRESULT AdviseKeyEventSink([in] TfClientId tid,
  1369.                                [in] ITfKeyEventSink *pSink,
  1370.                                [in] BOOL fForeground);
  1371.     HRESULT UnadviseKeyEventSink([in] TfClientId tid);
  1372.     HRESULT GetForeground([out] CLSID *pclsid);
  1373.     HRESULT TestKeyDown([in] WPARAM wParam,
  1374.                         [in] LPARAM lParam,
  1375.                         [out] BOOL *pfEaten);
  1376.     HRESULT TestKeyUp([in] WPARAM wParam,
  1377.                       [in] LPARAM lParam,
  1378.                       [out] BOOL *pfEaten);
  1379.     HRESULT KeyDown([in] WPARAM wParam,
  1380.                     [in] LPARAM lParam,
  1381.                     [out] BOOL *pfEaten);
  1382.     HRESULT KeyUp([in] WPARAM wParam,
  1383.                   [in] LPARAM lParam,
  1384.                   [out] BOOL *pfEaten);
  1385.     HRESULT GetPreservedKey([in] ITfContext *pic,
  1386.                             [in] const TF_PRESERVEDKEY *pprekey,
  1387.                             [out] GUID *pguid);
  1388.     HRESULT IsPreservedKey([in] REFGUID rguid,
  1389.                            [in] const TF_PRESERVEDKEY *pprekey,
  1390.                            [out] BOOL *pfRegistered);
  1391.     HRESULT PreserveKey([in] TfClientId tid,
  1392.                         [in] REFGUID rguid,
  1393.                         [in] const TF_PRESERVEDKEY *prekey,
  1394.                         [in, size_is(cchDesc)] const WCHAR *pchDesc,
  1395.                         [in] ULONG cchDesc);
  1396.     HRESULT UnpreserveKey([in] REFGUID rguid, 
  1397.                           [in] const TF_PRESERVEDKEY *pprekey);
  1398.     HRESULT SetPreservedKeyDescription([in] REFGUID rguid,
  1399.                                        [in, size_is(cchDesc)] const WCHAR *pchDesc,
  1400.                                        [in] ULONG cchDesc);
  1401.     HRESULT GetPreservedKeyDescription([in] REFGUID rguid,
  1402.                                        [out] BSTR *pbstrDesc);
  1403.     HRESULT SimulatePreservedKey([in] ITfContext *pic,
  1404.                                  [in] REFGUID rguid,
  1405.                                  [out] BOOL *pfEaten);
  1406. };
  1407. //
  1408. // ITfKeyEventSink
  1409. //
  1410. [
  1411.   object,
  1412.   local,
  1413.   uuid(aa80e7f5-2021-11d2-93e0-0060b067b86e),
  1414.   pointer_default(unique)
  1415. ]
  1416. interface ITfKeyEventSink : IUnknown
  1417. {
  1418.     HRESULT OnSetFocus([in] BOOL fForeground);
  1419.     HRESULT OnTestKeyDown([in] ITfContext *pic,
  1420.                           [in] WPARAM wParam,
  1421.                           [in] LPARAM lParam,
  1422.                           [out] BOOL *pfEaten);
  1423.     HRESULT OnTestKeyUp([in] ITfContext *pic,
  1424.                         [in] WPARAM wParam,
  1425.                         [in] LPARAM lParam,
  1426.                         [out] BOOL *pfEaten);
  1427.     HRESULT OnKeyDown([in] ITfContext *pic,
  1428.                       [in] WPARAM wParam,
  1429.                       [in] LPARAM lParam,
  1430.                       [out] BOOL *pfEaten);
  1431.     HRESULT OnKeyUp([in] ITfContext *pic,
  1432.                     [in] WPARAM wParam,
  1433.                     [in] LPARAM lParam,
  1434.                     [out] BOOL *pfEaten);
  1435.     HRESULT OnPreservedKey([in] ITfContext *pic,
  1436.                            [in] REFGUID rguid,
  1437.                            [out] BOOL *pfEaten);
  1438. };
  1439. //
  1440. // ITfKeyTraceEventSink
  1441. //
  1442. [
  1443.   object,
  1444.   local,
  1445.   uuid(1cd4c13b-1c36-4191-a70a-7f3e611f367d),
  1446.   pointer_default(unique)
  1447. ]
  1448. interface ITfKeyTraceEventSink : IUnknown
  1449. {
  1450.     HRESULT OnKeyTraceDown([in] WPARAM wParam,
  1451.                            [in] LPARAM lParam);
  1452.     HRESULT OnKeyTraceUp([in] WPARAM wParam,
  1453.                          [in] LPARAM lParam);
  1454. };
  1455. //
  1456. // ITfPreservedKeyNotifySink
  1457. //
  1458. [
  1459.   object,
  1460.   uuid(6f77c993-d2b1-446e-853e-5912efc8a286),
  1461.   pointer_default(unique)
  1462. ]
  1463. interface ITfPreservedKeyNotifySink : IUnknown
  1464. {
  1465.     HRESULT OnUpdated([in] const TF_PRESERVEDKEY *pprekey);
  1466. }
  1467. //
  1468. // ITfMessagePump
  1469. //
  1470. [
  1471.   object,
  1472.   local,
  1473.   uuid(8f1b8ad8-0b6b-4874-90c5-bd76011e8f7c),
  1474.   pointer_default(unique)
  1475. ]
  1476. interface ITfMessagePump : IUnknown
  1477. {
  1478.     HRESULT PeekMessageA([out] LPMSG pMsg,
  1479.                          [in] HWND hwnd,
  1480.                          [in] UINT wMsgFilterMin,
  1481.                          [in] UINT wMsgFilterMax,
  1482.                          [in] UINT wRemoveMsg,
  1483.                          [out] BOOL *pfResult);
  1484.     HRESULT GetMessageA([out] LPMSG pMsg,
  1485.                         [in] HWND hwnd,
  1486.                         [in] UINT wMsgFilterMin,
  1487.                         [in] UINT wMsgFilterMax,
  1488.                         [out] BOOL *pfResult);
  1489.     HRESULT PeekMessageW([out] LPMSG pMsg,
  1490.                          [in] HWND hwnd,
  1491.                          [in] UINT wMsgFilterMin,
  1492.                          [in] UINT wMsgFilterMax,
  1493.                          [in] UINT wRemoveMsg,
  1494.                          [out] BOOL *pfResult);
  1495.     HRESULT GetMessageW([out] LPMSG pMsg,
  1496.                         [in] HWND hwnd,
  1497.                         [in] UINT wMsgFilterMin,
  1498.                         [in] UINT wMsgFilterMax,
  1499.                         [out] BOOL *pfResult);
  1500. };
  1501. //
  1502. // ITfUIFocusSink
  1503. //
  1504. [
  1505.   object,
  1506.   local,
  1507.   uuid(c0f1db0c-3a20-405c-a303-96b6010a885f),
  1508.   pointer_default(unique)
  1509. ]
  1510. interface ITfThreadFocusSink : IUnknown
  1511. {
  1512.     HRESULT OnSetThreadFocus();
  1513.     HRESULT OnKillThreadFocus();
  1514. };
  1515. //
  1516. // ITfTextInputProcessor
  1517. //
  1518. [
  1519.   object,
  1520.   local,
  1521.   uuid(aa80e7f7-2021-11d2-93e0-0060b067b86e),
  1522.   pointer_default(unique)
  1523. ]
  1524. interface ITfTextInputProcessor : IUnknown
  1525. {
  1526.     HRESULT Activate([in] ITfThreadMgr *ptim,
  1527.                      [in] TfClientId tid);
  1528.     HRESULT Deactivate();
  1529. };
  1530. //
  1531. // ITfClientId
  1532. //
  1533. [
  1534.   object,
  1535.   local,
  1536.   uuid(d60a7b49-1b9f-4be2-b702-47e9dc05dec3),
  1537.   pointer_default(unique)
  1538. ]
  1539. interface ITfClientId : IUnknown
  1540. {
  1541.     HRESULT GetClientId([in] REFCLSID rclsid,
  1542.                         [out] TfClientId *ptid);
  1543. };
  1544. typedef [uuid(c4cc07f1-80cc-4a7b-bc54-98512782cbe3)] enum {
  1545.             TF_LS_NONE     = 0,
  1546.             TF_LS_SOLID    = 1,
  1547.             TF_LS_DOT      = 2,
  1548.             TF_LS_DASH     = 3,
  1549.             TF_LS_SQUIGGLE = 4
  1550. } TF_DA_LINESTYLE;
  1551. typedef [uuid(d9b92e21-084a-401b-9c64-1e6dad91a1ab)] enum {
  1552.             TF_CT_NONE     = 0,
  1553.             TF_CT_SYSCOLOR = 1,
  1554.             TF_CT_COLORREF = 2
  1555. } TF_DA_COLORTYPE;
  1556. typedef [uuid(90d0cb5e-6520-4a0f-b47c-c39bd955f0d6)] struct TF_DA_COLOR
  1557. {
  1558.     TF_DA_COLORTYPE type;
  1559.     [switch_type(TF_DA_COLORTYPE), switch_is(type)] union {
  1560.         [case(TF_CT_SYSCOLOR)] int      nIndex;
  1561.         [case(TF_CT_COLORREF)] COLORREF cr;
  1562.     };
  1563. } TF_DA_COLOR;
  1564. typedef [uuid(33d2fe4b-6c24-4f67-8d75-3bc1819e4126)] enum {
  1565.     TF_ATTR_INPUT                 =  0,
  1566.     TF_ATTR_TARGET_CONVERTED      =  1,
  1567.     TF_ATTR_CONVERTED             =  2,
  1568.     TF_ATTR_TARGET_NOTCONVERTED   =  3,
  1569.     TF_ATTR_INPUT_ERROR           =  4,
  1570.     TF_ATTR_FIXEDCONVERTED        =  5,
  1571.     TF_ATTR_OTHER                 =  -1
  1572. } TF_DA_ATTR_INFO;
  1573. typedef [uuid(1bf1c305-419b-4182-a4d2-9bfadc3f021f)] struct TF_DISPLAYATTRIBUTE
  1574. {
  1575.     TF_DA_COLOR     crText;
  1576.     TF_DA_COLOR     crBk;
  1577.     TF_DA_LINESTYLE lsStyle;
  1578.     BOOL            fBoldLine;
  1579.     TF_DA_COLOR     crLine;
  1580.     TF_DA_ATTR_INFO  bAttr;     
  1581. } TF_DISPLAYATTRIBUTE;
  1582. //
  1583. // ITfDisplayAttributeInfo
  1584. //
  1585. [
  1586.   object,
  1587.   uuid(70528852-2f26-4aea-8c96-215150578932),
  1588.   pointer_default(unique)
  1589. ]
  1590. interface ITfDisplayAttributeInfo : IUnknown
  1591. {
  1592.     HRESULT GetGUID([out] GUID *pguid);
  1593.     HRESULT GetDescription([out] BSTR *pbstrDesc);
  1594.     HRESULT GetAttributeInfo([out] TF_DISPLAYATTRIBUTE *pda);
  1595.     HRESULT SetAttributeInfo([in] const TF_DISPLAYATTRIBUTE *pda);
  1596.     HRESULT Reset();
  1597. }
  1598. //
  1599. // IEnumTfDisplayAttributeInfo interface
  1600. //
  1601. [
  1602.   object,
  1603.   uuid(7cef04d7-cb75-4e80-a7ab-5f5bc7d332de),
  1604.   pointer_default(unique)
  1605. ]
  1606. interface IEnumTfDisplayAttributeInfo : IUnknown
  1607. {
  1608.     HRESULT Clone([out] IEnumTfDisplayAttributeInfo **ppEnum);
  1609.     HRESULT Next([in] ULONG ulCount, 
  1610.                  [out, size_is(ulCount), length_is(*pcFetched)] ITfDisplayAttributeInfo **rgInfo, 
  1611.                  [out] ULONG *pcFetched);
  1612.     HRESULT Reset();
  1613.     HRESULT Skip([in] ULONG ulCount);
  1614. }
  1615. //
  1616. // ITfDisplayAttributeProvider interface
  1617. //
  1618. [
  1619.   object,
  1620.   uuid(fee47777-163c-4769-996a-6e9c50ad8f54),
  1621.   pointer_default(unique)
  1622. ]
  1623. interface ITfDisplayAttributeProvider : IUnknown
  1624. {
  1625.     HRESULT EnumDisplayAttributeInfo([out] IEnumTfDisplayAttributeInfo **ppEnum);
  1626.     HRESULT GetDisplayAttributeInfo([in] REFGUID guid,
  1627.                                     [out] ITfDisplayAttributeInfo **ppInfo);
  1628. }
  1629.     
  1630. // 
  1631. // ITfDisplayAttributeMgr interface
  1632. // 
  1633. [
  1634.   object,
  1635.   local,
  1636.   uuid(8ded7393-5db1-475c-9e71-a39111b0ff67),
  1637.   pointer_default(unique)
  1638. ]
  1639. interface ITfDisplayAttributeMgr : IUnknown
  1640. {
  1641.     HRESULT OnUpdateInfo();
  1642.     HRESULT EnumDisplayAttributeInfo([out] IEnumTfDisplayAttributeInfo **ppEnum);
  1643.     HRESULT GetDisplayAttributeInfo([in] REFGUID guid, 
  1644.                                     [out] ITfDisplayAttributeInfo **ppInfo,
  1645.                                     [out] CLSID *pclsidOwner);
  1646. }
  1647. //
  1648. // ITfDisplayAttributeNotifySink interface
  1649. // 
  1650. [
  1651.   object,
  1652.   uuid(ad56f402-e162-4f25-908f-7d577cf9bda9),
  1653.   pointer_default(unique)
  1654. ]
  1655. interface ITfDisplayAttributeNotifySink : IUnknown
  1656. {
  1657.     HRESULT OnUpdateInfo();
  1658. }
  1659. // 
  1660. // ITfCategoryMgr interface
  1661. // 
  1662. [
  1663.   object,
  1664.   local,
  1665.   uuid(c3acefb5-f69d-4905-938f-fcadcf4be830),
  1666.   pointer_default(unique)
  1667. ]
  1668. interface ITfCategoryMgr : IUnknown
  1669. {
  1670.     HRESULT RegisterCategory([in] REFCLSID rclsid,
  1671.                              [in] REFGUID rcatid,
  1672.                              [in] REFGUID rguid);
  1673.     HRESULT UnregisterCategory([in] REFCLSID rclsid,
  1674.                                [in] REFGUID rcatid,
  1675.                                [in] REFGUID rguid);
  1676.     HRESULT EnumCategoriesInItem([in] REFGUID rguid,
  1677.                                  [out] IEnumGUID **ppEnum);
  1678.     HRESULT EnumItemsInCategory([in] REFGUID rcatid,
  1679.                                 [out] IEnumGUID **ppEnum);
  1680.     HRESULT FindClosestCategory([in] REFGUID rguid,
  1681.                                 [out] GUID *pcatid,
  1682.                                 [in, size_is(ulCount)] const GUID **ppcatidList,
  1683.                                 [in] ULONG ulCount);
  1684.     HRESULT RegisterGUIDDescription([in] REFCLSID rclsid,
  1685.                                     [in] REFGUID rguid,
  1686.                                     [in, size_is(cch)] const WCHAR *pchDesc,
  1687.                                     [in] ULONG cch);
  1688.     HRESULT UnregisterGUIDDescription([in] REFCLSID rclsid,
  1689.                                       [in] REFGUID rguid);
  1690.     HRESULT GetGUIDDescription([in] REFGUID rguid,
  1691.                                [out] BSTR *pbstrDesc);
  1692.     HRESULT RegisterGUIDDWORD([in] REFCLSID rclsid,
  1693.                               [in] REFGUID rguid,
  1694.                               [in] DWORD dw);
  1695.     HRESULT UnregisterGUIDDWORD([in] REFCLSID rclsid,
  1696.                                 [in] REFGUID rguid);
  1697.     HRESULT GetGUIDDWORD([in] REFGUID rguid,
  1698.                          [out] DWORD *pdw);
  1699.     HRESULT RegisterGUID([in] REFGUID rguid,
  1700.                          [out] TfGuidAtom *pguidatom);
  1701.     HRESULT GetGUID([in] TfGuidAtom guidatom,
  1702.                     [out] GUID *pguid);
  1703.     HRESULT IsEqualTfGuidAtom([in] TfGuidAtom guidatom,
  1704.                               [in] REFGUID rguid,
  1705.                               [out] BOOL *pfEqual);
  1706. }
  1707. // value guarenteed never to be returned by ITfSource/Single::AdviseSink
  1708. const DWORD TF_INVALID_COOKIE = 0xffffffff;
  1709. // 
  1710. // ITfSource
  1711. // 
  1712. [
  1713.   object,
  1714.   uuid(4ea48a35-60ae-446f-8fd6-e6a8d82459f7),
  1715.   pointer_default(unique)
  1716. ]
  1717. interface ITfSource : IUnknown
  1718. {
  1719.     HRESULT AdviseSink([in] REFIID riid,
  1720.                        [in, iid_is(riid)] IUnknown *punk,
  1721.                        [out] DWORD *pdwCookie);
  1722.     HRESULT UnadviseSink([in] DWORD dwCookie);
  1723. };
  1724. // 
  1725. // ITfSourceSingle
  1726. // 
  1727. [
  1728.   object,
  1729.   uuid(73131f9c-56a9-49dd-b0ee-d046633f7528),
  1730.   pointer_default(unique)
  1731. ]
  1732. interface ITfSourceSingle : IUnknown
  1733. {
  1734.     HRESULT AdviseSingleSink([in] TfClientId tid,
  1735.                              [in] REFIID riid,
  1736.                              [in, iid_is(riid)] IUnknown *punk);
  1737.     HRESULT UnadviseSingleSink([in] TfClientId tid,
  1738.                                [in] REFIID riid);
  1739. };
  1740. cpp_quote("#endif // MSCTF_DEFINED")