xref: /reactos/dll/ime/msctfime/misc.h (revision 32d615fc)
1 /*
2  * PROJECT:     ReactOS msctfime.ime
3  * LICENSE:     LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
4  * PURPOSE:     Miscellaneous of msctfime.ime
5  * COPYRIGHT:   Copyright 2024 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
6  */
7 
8 #pragma once
9 
10 BOOLEAN DllShutdownInProgress(VOID);
11 BOOL IsEALang(_In_opt_ LANGID LangID);
12 BOOL IsInteractiveUserLogon(VOID);
13 BYTE GetCharsetFromLangId(_In_ DWORD dwValue);
14 HIMC GetActiveContext(VOID);
15 BOOL MsimtfIsGuidMapEnable(_In_ HIMC hIMC, _Out_opt_ LPBOOL pbValue);
16 BOOL IsVKDBEKey(_In_ UINT uVirtKey);
17 
18 ITfCategoryMgr *GetUIMCat(PCIC_LIBTHREAD pLibThread);
19 HRESULT InitDisplayAttrbuteLib(PCIC_LIBTHREAD pLibThread);
20 HRESULT UninitDisplayAttrbuteLib(PCIC_LIBTHREAD pLibThread);
21 
22 /***********************************************************************/
23 
24 HRESULT
25 GetCompartment(
26     IUnknown *pUnknown,
27     REFGUID rguid,
28     ITfCompartment **ppComp,
29     BOOL bThread);
30 
31 HRESULT
32 SetCompartmentDWORD(
33     TfEditCookie cookie,
34     IUnknown *pUnknown,
35     REFGUID rguid,
36     DWORD dwValue,
37     BOOL bThread);
38 
39 HRESULT
40 GetCompartmentDWORD(
41     IUnknown *pUnknown,
42     REFGUID rguid,
43     LPDWORD pdwValue,
44     BOOL bThread);
45 
46 HRESULT
47 SetCompartmentUnknown(
48     TfEditCookie cookie,
49     IUnknown *pUnknown,
50     REFGUID rguid,
51     IUnknown *punkValue);
52 
53 HRESULT
54 ClearCompartment(
55     TfClientId tid,
56     IUnknown *pUnknown,
57     REFGUID rguid,
58     BOOL bThread);
59 
60 /***********************************************************************/
61 
62 class CModeBias
63 {
64 public:
65     GUID m_guid;
66 
67     CModeBias() : m_guid(GUID_NULL) { }
68 
69     GUID ConvertModeBias(LONG bias);
70     LONG ConvertModeBias(REFGUID guid);
71     void SetModeBias(REFGUID rguid);
72 };
73 
74 /***********************************************************************/
75 
76 class CFunctionProviderBase : public ITfFunctionProvider
77 {
78 protected:
79     TfClientId m_clientId;
80     GUID m_guid;
81     BSTR m_bstr;
82     LONG m_cRefs;
83 
84 public:
85     CFunctionProviderBase(_In_ TfClientId clientId);
86     virtual ~CFunctionProviderBase();
87 
88     // IUnknown interface
89     STDMETHODIMP QueryInterface(_In_ REFIID riid, _Out_ LPVOID* ppvObj) override;
90     STDMETHODIMP_(ULONG) AddRef() override;
91     STDMETHODIMP_(ULONG) Release() override;
92 
93     // ITfFunctionProvider interface
94     STDMETHODIMP GetType(_Out_ GUID *guid) override;
95     STDMETHODIMP GetDescription(_Out_ BSTR *desc) override;
96     //STDMETHODIMP GetFunction(_In_ REFGUID guid, _In_ REFIID riid, _Out_ IUnknown **func) = 0;
97 
98     BOOL Init(_In_ REFGUID rguid, _In_ LPCWSTR psz);
99 };
100 
101 /***********************************************************************/
102 
103 class CFunctionProvider : public CFunctionProviderBase
104 {
105 public:
106     CFunctionProvider(_In_ TfClientId clientId);
107 
108     STDMETHODIMP GetFunction(_In_ REFGUID guid, _In_ REFIID riid, _Out_ IUnknown **func) override;
109 };
110 
111 /***********************************************************************/
112 
113 class CFnDocFeed : public IAImmFnDocFeed
114 {
115     LONG m_cRefs;
116 
117 public:
118     CFnDocFeed();
119     virtual ~CFnDocFeed();
120 
121     // IUnknown interface
122     STDMETHODIMP QueryInterface(_In_ REFIID riid, _Out_ LPVOID* ppvObj) override;
123     STDMETHODIMP_(ULONG) AddRef() override;
124     STDMETHODIMP_(ULONG) Release() override;
125 
126     // IAImmFnDocFeed interface
127     STDMETHODIMP DocFeed() override;
128     STDMETHODIMP ClearDocFeedBuffer() override;
129     STDMETHODIMP StartReconvert() override;
130     STDMETHODIMP StartUndoCompositionString() override;
131 };
132