ReactOS 0.4.15-dev-8339-g4028de8
msctf_internal.h File Reference
#include "wine/list.h"
Include dependency graph for msctf_internal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Sink
 

Macros

#define COOKIE_MAGIC_TMSINK   0x0010
 
#define COOKIE_MAGIC_CONTEXTSINK   0x0020
 
#define COOKIE_MAGIC_GUIDATOM   0x0030
 
#define COOKIE_MAGIC_IPPSINK   0x0040
 
#define COOKIE_MAGIC_EDITCOOKIE   0x0050
 
#define COOKIE_MAGIC_COMPARTMENTSINK   0x0060
 
#define COOKIE_MAGIC_DMSINK   0x0070
 
#define COOKIE_MAGIC_THREADFOCUSSINK   0x0080
 
#define COOKIE_MAGIC_KEYTRACESINK   0x0090
 
#define COOKIE_MAGIC_UIELEMENTSINK   0x00a0
 
#define COOKIE_MAGIC_INPUTPROCESSORPROFILEACTIVATIONSINK   0x00b0
 
#define COOKIE_MAGIC_ACTIVELANGSINK   0x00c0
 
#define SINK_ENTRY(cursor, type)   (LIST_ENTRY(cursor,Sink,entry)->interfaces.p##type)
 
#define SINK_FOR_EACH(cursor, list, type, elem)
 

Functions

HRESULT ThreadMgr_Constructor (IUnknown *pUnkOuter, IUnknown **ppOut) DECLSPEC_HIDDEN
 
HRESULT DocumentMgr_Constructor (ITfThreadMgrEventSink *, ITfDocumentMgr **ppOut) DECLSPEC_HIDDEN
 
HRESULT Context_Constructor (TfClientId tidOwner, IUnknown *punk, ITfDocumentMgr *mgr, ITfContext **ppOut, TfEditCookie *pecTextStore) DECLSPEC_HIDDEN
 
HRESULT InputProcessorProfiles_Constructor (IUnknown *pUnkOuter, IUnknown **ppOut) DECLSPEC_HIDDEN
 
HRESULT CategoryMgr_Constructor (IUnknown *pUnkOuter, IUnknown **ppOut) DECLSPEC_HIDDEN
 
HRESULT Range_Constructor (ITfContext *context, ITextStoreACP *textstore, DWORD lockType, DWORD anchorStart, DWORD anchorEnd, ITfRange **ppOut) DECLSPEC_HIDDEN
 
HRESULT CompartmentMgr_Constructor (IUnknown *pUnkOuter, REFIID riid, IUnknown **ppOut) DECLSPEC_HIDDEN
 
HRESULT CompartmentMgr_Destructor (ITfCompartmentMgr *This) DECLSPEC_HIDDEN
 
HRESULT LangBarMgr_Constructor (IUnknown *pUnkOuter, IUnknown **ppOut) DECLSPEC_HIDDEN
 
HRESULT DisplayAttributeMgr_Constructor (IUnknown *pUnkOuter, IUnknown **ppOut) DECLSPEC_HIDDEN
 
HRESULT Context_Initialize (ITfContext *cxt, ITfDocumentMgr *manager) DECLSPEC_HIDDEN
 
HRESULT Context_Uninitialize (ITfContext *cxt) DECLSPEC_HIDDEN
 
void ThreadMgr_OnDocumentMgrDestruction (ITfThreadMgr *tm, ITfDocumentMgr *mgr) DECLSPEC_HIDDEN
 
HRESULT TF_SELECTION_to_TS_SELECTION_ACP (const TF_SELECTION *tf, TS_SELECTION_ACP *tsAcp) DECLSPEC_HIDDEN
 
DWORD generate_Cookie (DWORD magic, LPVOID data) DECLSPEC_HIDDEN
 
DWORD get_Cookie_magic (DWORD id) DECLSPEC_HIDDEN
 
LPVOID get_Cookie_data (DWORD id) DECLSPEC_HIDDEN
 
LPVOID remove_Cookie (DWORD id) DECLSPEC_HIDDEN
 
DWORD enumerate_Cookie (DWORD magic, DWORD *index) DECLSPEC_HIDDEN
 
HRESULT add_active_textservice (TF_LANGUAGEPROFILE *lp) DECLSPEC_HIDDEN
 
BOOL get_active_textservice (REFCLSID rclsid, TF_LANGUAGEPROFILE *lp) DECLSPEC_HIDDEN
 
HRESULT activate_textservices (ITfThreadMgrEx *tm) DECLSPEC_HIDDEN
 
HRESULT deactivate_textservices (void) DECLSPEC_HIDDEN
 
CLSID get_textservice_clsid (TfClientId tid) DECLSPEC_HIDDEN
 
HRESULT get_textservice_sink (TfClientId tid, REFCLSID iid, IUnknown **sink) DECLSPEC_HIDDEN
 
HRESULT set_textservice_sink (TfClientId tid, REFCLSID iid, IUnknown *sink) DECLSPEC_HIDDEN
 
HRESULT advise_sink (struct list *sink_list, REFIID riid, DWORD cookie_magic, IUnknown *unk, DWORD *cookie) DECLSPEC_HIDDEN
 
HRESULT unadvise_sink (DWORD cookie) DECLSPEC_HIDDEN
 
void free_sinks (struct list *sink_list) DECLSPEC_HIDDEN
 

Variables

DWORD tlsIndex DECLSPEC_HIDDEN
 

Macro Definition Documentation

◆ COOKIE_MAGIC_ACTIVELANGSINK

#define COOKIE_MAGIC_ACTIVELANGSINK   0x00c0

Definition at line 37 of file msctf_internal.h.

◆ COOKIE_MAGIC_COMPARTMENTSINK

#define COOKIE_MAGIC_COMPARTMENTSINK   0x0060

Definition at line 31 of file msctf_internal.h.

◆ COOKIE_MAGIC_CONTEXTSINK

#define COOKIE_MAGIC_CONTEXTSINK   0x0020

Definition at line 27 of file msctf_internal.h.

◆ COOKIE_MAGIC_DMSINK

#define COOKIE_MAGIC_DMSINK   0x0070

Definition at line 32 of file msctf_internal.h.

◆ COOKIE_MAGIC_EDITCOOKIE

#define COOKIE_MAGIC_EDITCOOKIE   0x0050

Definition at line 30 of file msctf_internal.h.

◆ COOKIE_MAGIC_GUIDATOM

#define COOKIE_MAGIC_GUIDATOM   0x0030

Definition at line 28 of file msctf_internal.h.

◆ COOKIE_MAGIC_INPUTPROCESSORPROFILEACTIVATIONSINK

#define COOKIE_MAGIC_INPUTPROCESSORPROFILEACTIVATIONSINK   0x00b0

Definition at line 36 of file msctf_internal.h.

◆ COOKIE_MAGIC_IPPSINK

#define COOKIE_MAGIC_IPPSINK   0x0040

Definition at line 29 of file msctf_internal.h.

◆ COOKIE_MAGIC_KEYTRACESINK

#define COOKIE_MAGIC_KEYTRACESINK   0x0090

Definition at line 34 of file msctf_internal.h.

◆ COOKIE_MAGIC_THREADFOCUSSINK

#define COOKIE_MAGIC_THREADFOCUSSINK   0x0080

Definition at line 33 of file msctf_internal.h.

◆ COOKIE_MAGIC_TMSINK

#define COOKIE_MAGIC_TMSINK   0x0010

Definition at line 26 of file msctf_internal.h.

◆ COOKIE_MAGIC_UIELEMENTSINK

#define COOKIE_MAGIC_UIELEMENTSINK   0x00a0

Definition at line 35 of file msctf_internal.h.

◆ SINK_ENTRY

#define SINK_ENTRY (   cursor,
  type 
)    (LIST_ENTRY(cursor,Sink,entry)->interfaces.p##type)

Definition at line 88 of file msctf_internal.h.

◆ SINK_FOR_EACH

#define SINK_FOR_EACH (   cursor,
  list,
  type,
  elem 
)
Value:
for ((cursor) = (list)->next, elem = SINK_ENTRY(cursor,type); \
(cursor) != (list); \
Definition: list.h:37
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
const char cursor[]
Definition: icontest.c:13
static size_t elem
Definition: string.c:68
#define SINK_ENTRY(cursor, type)
static unsigned __int64 next
Definition: rand_nt.c:6
struct define * next
Definition: compiler.c:65

Definition at line 89 of file msctf_internal.h.

Function Documentation

◆ activate_textservices()

HRESULT activate_textservices ( ITfThreadMgrEx tm)

Definition at line 475 of file msctf.c.

476{
477 HRESULT hr = S_OK;
478 AtsEntry *ats;
479
480 activated ++;
481 if (activated > 1)
482 return S_OK;
483
485 {
486 hr = activate_given_ts(ats->ats, tm);
487 if (FAILED(hr))
488 FIXME("Failed to activate text service\n");
489 }
490 return hr;
491}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
uint32_t entry
Definition: isohybrid.c:63
static UINT activated
Definition: msctf.c:70
static struct list AtsList
Definition: msctf.c:69
static HRESULT activate_given_ts(ActivatedTextService *actsvr, ITfThreadMgrEx *tm)
Definition: msctf.c:336
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
HRESULT hr
Definition: shlfolder.c:183
Definition: msctf.c:60
ActivatedTextService * ats
Definition: msctf.c:62
Definition: time.h:68

Referenced by ThreadMgr_ActivateEx().

◆ add_active_textservice()

HRESULT add_active_textservice ( TF_LANGUAGEPROFILE lp)

Definition at line 395 of file msctf.c.

396{
397 ActivatedTextService *actsvr;
398 ITfCategoryMgr *catmgr;
401 ITfClientId *clientid;
402
403 if (!tm) return E_UNEXPECTED;
404
405 actsvr = HeapAlloc(GetProcessHeap(),0,sizeof(ActivatedTextService));
406 if (!actsvr) return E_OUTOFMEMORY;
407
408 ITfThreadMgrEx_QueryInterface(tm, &IID_ITfClientId, (void **)&clientid);
409 ITfClientId_GetClientId(clientid, &lp->clsid, &actsvr->tid);
410 ITfClientId_Release(clientid);
411
412 if (!actsvr->tid)
413 {
414 HeapFree(GetProcessHeap(),0,actsvr);
415 return E_OUTOFMEMORY;
416 }
417
419 actsvr->LanguageProfile = *lp;
420 actsvr->pITfKeyEventSink = NULL;
421
422 /* get TIP category */
424 {
426
427 ITfCategoryMgr_FindClosestCategory(catmgr,
428 &actsvr->LanguageProfile.clsid, &actsvr->LanguageProfile.catid,
429 list, 3);
430
431 ITfCategoryMgr_Release(catmgr);
432 }
433 else
434 {
435 ERR("CategoryMgr construction failed\n");
437 }
438
441
442 if (activated > 0)
443 activate_given_ts(actsvr, tm);
444
445 entry = HeapAlloc(GetProcessHeap(),0,sizeof(AtsEntry));
446
447 if (!entry)
448 {
449 HeapFree(GetProcessHeap(),0,actsvr);
450 return E_OUTOFMEMORY;
451 }
452
453 entry->ats = actsvr;
454 list_add_head(&AtsList, &entry->entry);
455
456 return S_OK;
457}
static void list_add_head(struct list_entry *head, struct list_entry *entry)
Definition: list.h:76
#define ERR(fmt,...)
Definition: precomp.h:57
HRESULT CategoryMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
Definition: categorymgr.c:413
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
LPVOID WINAPI TlsGetValue(IN DWORD Index)
Definition: thread.c:1240
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define GUID_NULL
Definition: ks.h:106
DWORD tlsIndex
Definition: msctf.c:72
static void deactivate_remove_conflicting_ts(REFCLSID catid)
Definition: msctf.c:377
EXTERN_C const GUID GUID_TFCAT_TIP_KEYBOARD
Definition: msctf.idl:99
EXTERN_C const GUID GUID_TFCAT_TIP_SPEECH
Definition: msctf.idl:100
EXTERN_C const GUID GUID_TFCAT_TIP_HANDWRITING
Definition: msctf.idl:101
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
TF_LANGUAGEPROFILE LanguageProfile
Definition: msctf.c:52
ITfTextInputProcessor * pITfTextInputProcessor
Definition: msctf.c:53
ITfKeyEventSink * pITfKeyEventSink
Definition: msctf.c:55
TfClientId tid
Definition: msctf.c:56
#define E_UNEXPECTED
Definition: winerror.h:2456

Referenced by InputProcessorProfiles_ActivateLanguageProfile().

◆ advise_sink()

HRESULT advise_sink ( struct list sink_list,
REFIID  riid,
DWORD  cookie_magic,
IUnknown unk,
DWORD cookie 
)

Definition at line 285 of file msctf.c.

286{
287 Sink *sink;
288
289 sink = HeapAlloc(GetProcessHeap(), 0, sizeof(*sink));
290 if (!sink)
291 return E_OUTOFMEMORY;
292
293 if (FAILED(IUnknown_QueryInterface(unk, riid, (void**)&sink->interfaces.pIUnknown)))
294 {
297 }
298
299 list_add_head(sink_list, &sink->entry);
300 *cookie = generate_Cookie(cookie_magic, sink);
301 TRACE("cookie %x\n", *cookie);
302 return S_OK;
303}
GLsizei GLenum GLboolean sink
Definition: glext.h:5672
REFIID riid
Definition: atlbase.h:39
DWORD generate_Cookie(DWORD magic, LPVOID data)
Definition: msctf.c:189
#define CONNECT_E_CANNOTCONNECT
Definition: olectl.h:253
#define TRACE(s)
Definition: solgame.cpp:4
Definition: cookie.c:34

Referenced by CompartmentSource_AdviseSink(), ContextSource_AdviseSink(), DocumentMgrSource_AdviseSink(), IPPSource_AdviseSink(), and ThreadMgrSource_AdviseSink().

◆ CategoryMgr_Constructor()

HRESULT CategoryMgr_Constructor ( IUnknown pUnkOuter,
IUnknown **  ppOut 
)

Definition at line 413 of file categorymgr.c.

414{
416 if (pUnkOuter)
418
420 if (This == NULL)
421 return E_OUTOFMEMORY;
422
423 This->ITfCategoryMgr_iface.lpVtbl = &CategoryMgrVtbl;
424 This->refCount = 1;
425
426 *ppOut = (IUnknown *)&This->ITfCategoryMgr_iface;
427 TRACE("returning %p\n", *ppOut);
428 return S_OK;
429}
static const ITfCategoryMgrVtbl CategoryMgrVtbl
Definition: categorymgr.c:392
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:2662

Referenced by add_active_textservice(), ClientId_GetClientId(), EnumTfLanguageProfiles_Constructor(), and InputProcessorProfiles_SetDefaultLanguageProfile().

◆ CompartmentMgr_Constructor()

HRESULT CompartmentMgr_Constructor ( IUnknown pUnkOuter,
REFIID  riid,
IUnknown **  ppOut 
)

Definition at line 254 of file compartmentmgr.c.

255{
257
258 if (!ppOut)
259 return E_POINTER;
260
261 if (pUnkOuter && !IsEqualIID (riid, &IID_IUnknown))
263
265 if (This == NULL)
266 return E_OUTOFMEMORY;
267
268 This->ITfCompartmentMgr_iface.lpVtbl = &CompartmentMgrVtbl;
269 This->pUnkOuter = pUnkOuter;
270 list_init(&This->values);
271
272 if (pUnkOuter)
273 {
274 *ppOut = (IUnknown*)&This->ITfCompartmentMgr_iface;
275 TRACE("returning %p\n", *ppOut);
276 return S_OK;
277 }
278 else
279 {
280 HRESULT hr;
281 hr = ITfCompartmentMgr_QueryInterface(&This->ITfCompartmentMgr_iface, riid, (void**)ppOut);
282 if (FAILED(hr))
284 return hr;
285 }
286}
static void list_init(struct list_entry *head)
Definition: list.h:51
const GUID IID_IUnknown
static const ITfCompartmentMgrVtbl CompartmentMgrVtbl
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define E_POINTER
Definition: winerror.h:2365

Referenced by Context_Constructor(), DocumentMgr_Constructor(), ThreadMgr_Constructor(), and ThreadMgr_GetGlobalCompartment().

◆ CompartmentMgr_Destructor()

HRESULT CompartmentMgr_Destructor ( ITfCompartmentMgr This)

Definition at line 99 of file compartmentmgr.c.

100{
102 struct list *cursor, *cursor2;
103
104 LIST_FOR_EACH_SAFE(cursor, cursor2, &This->values)
105 {
108 ITfCompartment_Release(value->compartment);
110 }
111
113 return S_OK;
114}
static void list_remove(struct list_entry *entry)
Definition: list.h:90
static CompartmentMgr * impl_from_ITfCompartmentMgr(ITfCompartmentMgr *iface)
#define LIST_FOR_EACH_SAFE(cursor, cursor2, list)
Definition: list.h:192
#define LIST_ENTRY(type)
Definition: queue.h:175
Definition: pdh_main.c:94

Referenced by CompartmentMgr_Release(), Context_Destructor(), DocumentMgr_Destructor(), and ThreadMgr_Destructor().

◆ Context_Constructor()

HRESULT Context_Constructor ( TfClientId  tidOwner,
IUnknown punk,
ITfDocumentMgr mgr,
ITfContext **  ppOut,
TfEditCookie pecTextStore 
)

Definition at line 1047 of file context.c.

1048{
1049 Context *This;
1051
1053 if (This == NULL)
1054 return E_OUTOFMEMORY;
1055
1057 if (cookie == NULL)
1058 {
1060 return E_OUTOFMEMORY;
1061 }
1062
1063 TRACE("(%p) %x %p %p %p\n",This, tidOwner, punk, ppOut, pecTextStore);
1064
1065 This->ITfContext_iface.lpVtbl= &ContextVtbl;
1066 This->ITfSource_iface.lpVtbl = &ContextSourceVtbl;
1067 This->ITfContextOwnerCompositionServices_iface.lpVtbl = &ContextOwnerCompositionServicesVtbl;
1068 This->ITfInsertAtSelection_iface.lpVtbl = &InsertAtSelectionVtbl;
1069 This->ITfSourceSingle_iface.lpVtbl = &ContextSourceSingleVtbl;
1070 This->ITextStoreACPSink_iface.lpVtbl = &TextStoreACPSinkVtbl;
1071 This->ITextStoreACPServices_iface.lpVtbl = &TextStoreACPServicesVtbl;
1072 This->refCount = 1;
1073 This->tidOwner = tidOwner;
1074 This->connected = FALSE;
1075 This->manager = mgr;
1076
1077 CompartmentMgr_Constructor((IUnknown*)&This->ITfContext_iface, &IID_IUnknown, (IUnknown**)&This->CompartmentMgr);
1078
1079 cookie->lockType = TF_ES_READ;
1080 cookie->pOwningContext = This;
1081
1082 if (punk)
1083 {
1084 IUnknown_QueryInterface(punk, &IID_ITextStoreACP,
1085 (LPVOID*)&This->pITextStoreACP);
1086
1087 IUnknown_QueryInterface(punk, &IID_ITfContextOwnerCompositionSink,
1088 (LPVOID*)&This->pITfContextOwnerCompositionSink);
1089
1090 if (!This->pITextStoreACP && !This->pITfContextOwnerCompositionSink)
1091 FIXME("Unhandled pUnk\n");
1092 }
1093
1095 *pecTextStore = This->defaultCookie;
1096
1097 list_init(&This->pContextKeyEventSink);
1098 list_init(&This->pEditTransactionSink);
1099 list_init(&This->pStatusSink);
1100 list_init(&This->pTextEditSink);
1101 list_init(&This->pTextLayoutSink);
1102
1103 *ppOut = &This->ITfContext_iface;
1104 TRACE("returning %p\n", *ppOut);
1105
1106 return S_OK;
1107}
HRESULT CompartmentMgr_Constructor(IUnknown *pUnkOuter, REFIID riid, IUnknown **ppOut)
#define FALSE
Definition: types.h:117
static const ITfContextVtbl ContextVtbl
Definition: context.c:516
static const ITextStoreACPSinkVtbl TextStoreACPSinkVtbl
Definition: context.c:964
static const ITextStoreACPServicesVtbl TextStoreACPServicesVtbl
Definition: context.c:1036
static const ITfSourceSingleVtbl ContextSourceSingleVtbl
Definition: context.c:783
static const ITfInsertAtSelectionVtbl InsertAtSelectionVtbl
Definition: context.c:737
static const ITfSourceVtbl ContextSourceVtbl
Definition: context.c:588
static const ITfContextOwnerCompositionServicesVtbl ContextOwnerCompositionServicesVtbl
Definition: context.c:659
#define COOKIE_MAGIC_EDITCOOKIE

Referenced by DocumentMgr_CreateContext().

◆ Context_Initialize()

HRESULT Context_Initialize ( ITfContext cxt,
ITfDocumentMgr manager 
)

Definition at line 1109 of file context.c.

1110{
1112
1113 if (This->pITextStoreACP)
1114 ITextStoreACP_AdviseSink(This->pITextStoreACP, &IID_ITextStoreACPSink,
1115 (IUnknown*)&This->ITextStoreACPSink_iface, TS_AS_ALL_SINKS);
1116 This->connected = TRUE;
1117 This->manager = manager;
1118 return S_OK;
1119}
#define TRUE
Definition: types.h:120
static Context * impl_from_ITfContext(ITfContext *iface)
Definition: context.c:82
const DWORD TS_AS_ALL_SINKS
Definition: textstor.idl:54

Referenced by DocumentMgr_Push().

◆ Context_Uninitialize()

HRESULT Context_Uninitialize ( ITfContext cxt)

Definition at line 1121 of file context.c.

1122{
1124
1125 if (This->pITextStoreACP)
1126 ITextStoreACP_UnadviseSink(This->pITextStoreACP, (IUnknown*)&This->ITextStoreACPSink_iface);
1127 This->connected = FALSE;
1128 This->manager = NULL;
1129 return S_OK;
1130}

Referenced by DocumentMgr_Pop().

◆ deactivate_textservices()

HRESULT deactivate_textservices ( void  )

Definition at line 493 of file msctf.c.

494{
495 AtsEntry *ats;
496
497 if (activated > 0)
498 activated --;
499
500 if (activated == 0)
503
504 return S_OK;
505}
static HRESULT deactivate_given_ts(ActivatedTextService *actsvr)
Definition: msctf.c:361

Referenced by ThreadMgr_Deactivate().

◆ DisplayAttributeMgr_Constructor()

HRESULT DisplayAttributeMgr_Constructor ( IUnknown pUnkOuter,
IUnknown **  ppOut 
)

Definition at line 127 of file displayattributemgr.c.

128{
130 if (pUnkOuter)
132
134 if (This == NULL)
135 return E_OUTOFMEMORY;
136
137 This->ITfDisplayAttributeMgr_iface.lpVtbl = &DisplayAttributeMgrVtbl;
138 This->refCount = 1;
139
140 *ppOut = (IUnknown *)&This->ITfDisplayAttributeMgr_iface;
141 TRACE("returning %p\n", *ppOut);
142 return S_OK;
143}
static const ITfDisplayAttributeMgrVtbl DisplayAttributeMgrVtbl

◆ DocumentMgr_Constructor()

HRESULT DocumentMgr_Constructor ( ITfThreadMgrEventSink ThreadMgrSink,
ITfDocumentMgr **  ppOut 
)

Definition at line 342 of file documentmgr.c.

343{
345
347 if (This == NULL)
348 return E_OUTOFMEMORY;
349
350 This->ITfDocumentMgr_iface.lpVtbl = &DocumentMgrVtbl;
351 This->ITfSource_iface.lpVtbl = &DocumentMgrSourceVtbl;
352 This->refCount = 1;
353 This->ThreadMgrSink = ThreadMgrSink;
354 list_init(&This->TransitoryExtensionSink);
355
356 CompartmentMgr_Constructor((IUnknown*)&This->ITfDocumentMgr_iface, &IID_IUnknown, (IUnknown**)&This->CompartmentMgr);
357
358 *ppOut = &This->ITfDocumentMgr_iface;
359 TRACE("returning %p\n", *ppOut);
360 return S_OK;
361}
static const ITfSourceVtbl DocumentMgrSourceVtbl
Definition: documentmgr.c:333
static const ITfDocumentMgrVtbl DocumentMgrVtbl
Definition: documentmgr.c:266

Referenced by ThreadMgr_CreateDocumentMgr().

◆ enumerate_Cookie()

DWORD enumerate_Cookie ( DWORD  magic,
DWORD index 
)

Definition at line 273 of file msctf.c.

274{
275 unsigned int i;
276 for (i = *index; i < id_last; i++)
277 if (cookies[i].id != 0 && cookies[i].magic == magic)
278 {
279 *index = (i+1);
280 return cookies[i].id;
281 }
282 return 0x0;
283}
GLuint index
Definition: glext.h:6031
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static UINT id_last
Definition: msctf.c:66
static CookieInternal * cookies
Definition: msctf.c:65
u32_t magic(void)
DWORD id
Definition: msctf.c:46

Referenced by CategoryMgr_RegisterGUID().

◆ free_sinks()

void free_sinks ( struct list sink_list)

Definition at line 324 of file msctf.c.

325{
326 while(!list_empty(sink_list))
327 {
328 Sink* sink = LIST_ENTRY(sink_list->next, Sink, entry);
330 }
331}
static int list_empty(struct list_entry *head)
Definition: list.h:58
struct list * next
Definition: list.h:38
static void free_sink(Sink *sink)
Definition: msctf.c:305

Referenced by Compartment_Destructor(), Context_Destructor(), DocumentMgr_Destructor(), InputProcessorProfiles_Destructor(), and ThreadMgr_Destructor().

◆ generate_Cookie()

DWORD generate_Cookie ( DWORD  magic,
LPVOID  data 
)

Definition at line 189 of file msctf.c.

190{
191 UINT i;
192
193 /* try to reuse IDs if possible */
194 for (i = 0; i < id_last; i++)
195 if (cookies[i].id == 0) break;
196
197 if (i == array_size)
198 {
199 if (!array_size)
200 {
202 if (!cookies)
203 {
204 ERR("Out of memory, Unable to alloc cookies array\n");
205 return 0;
206 }
207 array_size = 10;
208 }
209 else
210 {
212 sizeof(CookieInternal) * (array_size * 2));
213 if (!new_cookies)
214 {
215 ERR("Out of memory, Unable to realloc cookies array\n");
216 return 0;
217 }
218 cookies = new_cookies;
219 array_size *= 2;
220 }
221 }
222
223 cookies[i].id = i + 1; /* a return of 0 is used for failure */
224 cookies[i].magic = magic;
225 cookies[i].data = data;
226
227 if (i == id_last)
228 id_last++;
229
230 return cookies[i].id;
231}
#define HeapReAlloc
Definition: compat.h:734
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static UINT array_size
Definition: msctf.c:67
unsigned int UINT
Definition: ndis.h:50
LPVOID data
Definition: msctf.c:48
DWORD magic
Definition: msctf.c:47

Referenced by advise_sink(), CategoryMgr_RegisterGUID(), Context_Constructor(), and TextStoreACPSink_OnLockGranted().

◆ get_active_textservice()

BOOL get_active_textservice ( REFCLSID  rclsid,
TF_LANGUAGEPROFILE lp 
)

Definition at line 459 of file msctf.c.

460{
461 AtsEntry *ats;
462
464 {
465 if (IsEqualCLSID(rclsid,&ats->ats->LanguageProfile.clsid))
466 {
467 if (profile)
468 *profile = ats->ats->LanguageProfile;
469 return TRUE;
470 }
471 }
472 return FALSE;
473}
#define profile
Definition: kernel32.h:12
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:96

Referenced by InputProcessorProfiles_ActivateLanguageProfile(), InputProcessorProfiles_GetActiveLanguageProfile(), and next_LanguageProfile().

◆ get_Cookie_data()

LPVOID get_Cookie_data ( DWORD  id)

Definition at line 246 of file msctf.c.

247{
248 UINT index = id - 1;
249
250 if (index >= id_last)
251 return NULL;
252
253 if (cookies[index].id == 0)
254 return NULL;
255
256 return cookies[index].data;
257}
#define index(s, c)
Definition: various.h:29

Referenced by CategoryMgr_GetGUID(), CategoryMgr_IsEqualTfGuidAtom(), CategoryMgr_RegisterGUID(), Context_GetEnd(), Context_GetSelection(), Context_GetStart(), and InsertAtSelection_InsertTextAtSelection().

◆ get_Cookie_magic()

◆ get_textservice_clsid()

CLSID get_textservice_clsid ( TfClientId  tid)

Definition at line 507 of file msctf.c.

508{
509 AtsEntry *ats;
510
512 if (ats->ats->tid == tid)
513 return ats->ats->LanguageProfile.clsid;
514 return GUID_NULL;
515}
static TfClientId tid

Referenced by KeystrokeMgr_AdviseKeyEventSink(), and KeystrokeMgr_UnadviseKeyEventSink().

◆ get_textservice_sink()

HRESULT get_textservice_sink ( TfClientId  tid,
REFCLSID  iid,
IUnknown **  sink 
)

Definition at line 517 of file msctf.c.

518{
519 AtsEntry *ats;
520
521 if (!IsEqualCLSID(iid,&IID_ITfKeyEventSink))
522 return E_NOINTERFACE;
523
525 if (ats->ats->tid == tid)
526 {
528 return S_OK;
529 }
530
531 return E_FAIL;
532}
#define E_FAIL
Definition: ddrawi.h:102
#define E_NOINTERFACE
Definition: winerror.h:2364

Referenced by KeystrokeMgr_AdviseKeyEventSink(), and KeystrokeMgr_UnadviseKeyEventSink().

◆ InputProcessorProfiles_Constructor()

HRESULT InputProcessorProfiles_Constructor ( IUnknown pUnkOuter,
IUnknown **  ppOut 
)

Definition at line 952 of file inputprocessor.c.

953{
955 if (pUnkOuter)
957
959 if (This == NULL)
960 return E_OUTOFMEMORY;
961
962 This->ITfInputProcessorProfiles_iface.lpVtbl= &InputProcessorProfilesVtbl;
963 This->ITfSource_iface.lpVtbl = &InputProcessorProfilesSourceVtbl;
964 This->ITfInputProcessorProfileMgr_iface.lpVtbl = &InputProcessorProfileMgrVtbl;
965 This->refCount = 1;
966 This->currentLanguage = GetUserDefaultLCID();
967
968 list_init(&This->LanguageProfileNotifySink);
969
970 *ppOut = (IUnknown *)&This->ITfInputProcessorProfiles_iface;
971 TRACE("returning %p\n", *ppOut);
972 return S_OK;
973}
LCID WINAPI GetUserDefaultLCID(void)
Definition: locale.c:1210
static const ITfInputProcessorProfilesVtbl InputProcessorProfilesVtbl
static const ITfSourceVtbl InputProcessorProfilesSourceVtbl
static const ITfInputProcessorProfileMgrVtbl InputProcessorProfileMgrVtbl

Referenced by TF_CreateInputProcessorProfiles().

◆ LangBarMgr_Constructor()

HRESULT LangBarMgr_Constructor ( IUnknown pUnkOuter,
IUnknown **  ppOut 
)

Definition at line 182 of file langbarmgr.c.

183{
185 if (pUnkOuter)
187
189 if (This == NULL)
190 return E_OUTOFMEMORY;
191
192 This->ITfLangBarMgr_iface.lpVtbl = &LangBarMgr_LangBarMgrVtbl;
193 This->refCount = 1;
194
195 *ppOut = (IUnknown *)&This->ITfLangBarMgr_iface;
196 TRACE("returning %p\n", *ppOut);
197 return S_OK;
198}
static const ITfLangBarMgrVtbl LangBarMgr_LangBarMgrVtbl
Definition: langbarmgr.c:165

Referenced by TF_CreateLangBarMgr().

◆ Range_Constructor()

HRESULT Range_Constructor ( ITfContext context,
ITextStoreACP textstore,
DWORD  lockType,
DWORD  anchorStart,
DWORD  anchorEnd,
ITfRange **  ppOut 
)

Definition at line 325 of file range.c.

326{
327 Range *This;
328
330 if (This == NULL)
331 return E_OUTOFMEMORY;
332
333 TRACE("(%p) %p %p\n",This, context, textstore);
334
335 This->ITfRange_iface.lpVtbl = &Range_RangeVtbl;
336 This->refCount = 1;
337 This->pITfContext = context;
338 This->pITextStoreACP = textstore;
339 This->lockType = lockType;
340 This->anchorStart = anchorStart;
341 This->anchorEnd = anchorEnd;
342
343 *ppOut = &This->ITfRange_iface;
344 TRACE("returning %p\n", *ppOut);
345
346 return S_OK;
347}
static const ITfRangeVtbl Range_RangeVtbl
Definition: range.c:295
Definition: http.c:7252
Definition: range.c:39

Referenced by Context_GetEnd(), Context_GetSelection(), Context_GetStart(), and InsertAtSelection_InsertTextAtSelection().

◆ remove_Cookie()

LPVOID remove_Cookie ( DWORD  id)

Definition at line 259 of file msctf.c.

260{
261 UINT index = id - 1;
262
263 if (index >= id_last)
264 return NULL;
265
266 if (cookies[index].id == 0)
267 return NULL;
268
269 cookies[index].id = 0;
270 return cookies[index].data;
271}

Referenced by Context_Destructor(), TextStoreACPSink_OnLockGranted(), and unadvise_sink().

◆ set_textservice_sink()

HRESULT set_textservice_sink ( TfClientId  tid,
REFCLSID  iid,
IUnknown sink 
)

Definition at line 534 of file msctf.c.

535{
536 AtsEntry *ats;
537
538 if (!IsEqualCLSID(iid,&IID_ITfKeyEventSink))
539 return E_NOINTERFACE;
540
542 if (ats->ats->tid == tid)
543 {
545 return S_OK;
546 }
547
548 return E_FAIL;
549}

Referenced by KeystrokeMgr_AdviseKeyEventSink(), and KeystrokeMgr_UnadviseKeyEventSink().

◆ TF_SELECTION_to_TS_SELECTION_ACP()

HRESULT TF_SELECTION_to_TS_SELECTION_ACP ( const TF_SELECTION *  tf,
TS_SELECTION_ACP tsAcp 
)

Definition at line 351 of file range.c.

352{
353 Range *This;
354
355 if (!tf || !tsAcp || !tf->range)
356 return E_INVALIDARG;
357
358 This = impl_from_ITfRange(tf->range);
359
360 tsAcp->acpStart = This->anchorStart;
361 tsAcp->acpEnd = This->anchorEnd;
362 tsAcp->style.ase = tf->style.ase;
363 tsAcp->style.fInterimChar = tf->style.fInterimChar;
364 return S_OK;
365}
#define E_INVALIDARG
Definition: ddrawi.h:101
HFONT tf
Definition: icontest.c:17
static Range * impl_from_ITfRange(ITfRange *iface)
Definition: range.c:53
TsActiveSelEnd ase
Definition: textstor.idl:86
TS_SELECTIONSTYLE style
Definition: textstor.idl:94

Referenced by Context_SetSelection().

◆ ThreadMgr_Constructor()

HRESULT ThreadMgr_Constructor ( IUnknown pUnkOuter,
IUnknown **  ppOut 
)

Definition at line 1342 of file threadmgr.c.

1343{
1344 ThreadMgr *This;
1345 if (pUnkOuter)
1346 return CLASS_E_NOAGGREGATION;
1347
1348 /* Only 1 ThreadMgr is created per thread */
1350 if (This)
1351 {
1352 ThreadMgr_AddRef(&This->ITfThreadMgrEx_iface);
1353 *ppOut = (IUnknown*)&This->ITfThreadMgrEx_iface;
1354 return S_OK;
1355 }
1356
1358 if (This == NULL)
1359 return E_OUTOFMEMORY;
1360
1361 This->ITfThreadMgrEx_iface.lpVtbl = &ThreadMgrExVtbl;
1362 This->ITfSource_iface.lpVtbl = &ThreadMgrSourceVtbl;
1363 This->ITfKeystrokeMgr_iface.lpVtbl = &KeystrokeMgrVtbl;
1364 This->ITfMessagePump_iface.lpVtbl = &MessagePumpVtbl;
1365 This->ITfClientId_iface.lpVtbl = &ClientIdVtbl;
1366 This->ITfThreadMgrEventSink_iface.lpVtbl = &ThreadMgrEventSinkVtbl;
1367 This->ITfUIElementMgr_iface.lpVtbl = &ThreadMgrUIElementMgrVtbl;
1368 This->ITfSourceSingle_iface.lpVtbl = &SourceSingleVtbl;
1369 This->refCount = 1;
1371
1372 CompartmentMgr_Constructor((IUnknown*)&This->ITfThreadMgrEx_iface, &IID_IUnknown, (IUnknown**)&This->CompartmentMgr);
1373
1374 list_init(&This->CurrentPreservedKeys);
1375 list_init(&This->CreatedDocumentMgrs);
1376 list_init(&This->AssociatedFocusWindows);
1377
1378 list_init(&This->ActiveLanguageProfileNotifySink);
1379 list_init(&This->DisplayAttributeNotifySink);
1380 list_init(&This->KeyTraceEventSink);
1381 list_init(&This->PreservedKeyNotifySink);
1382 list_init(&This->ThreadFocusSink);
1383 list_init(&This->ThreadMgrEventSink);
1384 list_init(&This->UIElementSink);
1385 list_init(&This->InputProcessorProfileActivationSink);
1386
1387 TRACE("returning %p\n", This);
1388 *ppOut = (IUnknown *)&This->ITfThreadMgrEx_iface;
1389 return S_OK;
1390}
BOOL WINAPI TlsSetValue(IN DWORD Index, IN LPVOID Value)
Definition: thread.c:1276
static const ITfSourceVtbl ThreadMgrSourceVtbl
Definition: threadmgr.c:673
static const ITfThreadMgrEventSinkVtbl ThreadMgrEventSinkVtbl
Definition: threadmgr.c:1204
static const ITfUIElementMgrVtbl ThreadMgrUIElementMgrVtbl
Definition: threadmgr.c:1283
static ULONG WINAPI ThreadMgr_AddRef(ITfThreadMgrEx *iface)
Definition: threadmgr.c:257
static const ITfSourceSingleVtbl SourceSingleVtbl
Definition: threadmgr.c:1333
static const ITfThreadMgrExVtbl ThreadMgrExVtbl
Definition: threadmgr.c:563
static const ITfMessagePumpVtbl MessagePumpVtbl
Definition: threadmgr.c:1038
static const ITfClientIdVtbl ClientIdVtbl
Definition: threadmgr.c:1088
static const ITfKeystrokeMgrVtbl KeystrokeMgrVtbl
Definition: threadmgr.c:955

Referenced by TF_CreateThreadMgr().

◆ ThreadMgr_OnDocumentMgrDestruction()

void ThreadMgr_OnDocumentMgrDestruction ( ITfThreadMgr tm,
ITfDocumentMgr mgr 
)

Definition at line 1537 of file threadmgr.c.

1538{
1540 struct list *cursor;
1541 LIST_FOR_EACH(cursor, &This->CreatedDocumentMgrs)
1542 {
1544 if (mgrentry->docmgr == mgr)
1545 {
1547 HeapFree(GetProcessHeap(),0,mgrentry);
1548 return;
1549 }
1550 }
1551 FIXME("ITfDocumentMgr %p not found in this thread\n",mgr);
1552}
#define LIST_FOR_EACH(cursor, list)
Definition: list.h:188
ITfDocumentMgr * docmgr
Definition: threadmgr.c:52
static ThreadMgr * impl_from_ITfThreadMgrEx(ITfThreadMgrEx *iface)
Definition: threadmgr.c:113

Referenced by DocumentMgr_Destructor().

◆ unadvise_sink()

HRESULT unadvise_sink ( DWORD  cookie)

Definition at line 312 of file msctf.c.

313{
314 Sink *sink;
315
317 if (!sink)
319
321 return S_OK;
322}
LPVOID remove_Cookie(DWORD id)
Definition: msctf.c:259
#define CONNECT_E_NOCONNECTION
Definition: olectl.h:251

Referenced by CompartmentSource_UnadviseSink(), ContextSource_UnadviseSink(), DocumentMgrSource_UnadviseSink(), IPPSource_UnadviseSink(), and ThreadMgrSource_UnadviseSink().

Variable Documentation

◆ DECLSPEC_HIDDEN

const WCHAR szwSystemCTFKey [] DECLSPEC_HIDDEN
extern

Definition at line 40 of file msctf_internal.h.