mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
[MSCTFIME][SDK] Implement CFunctionProvider (#6269)
Supporting TIPs... JIRA issue: CORE-19360 Define CFunctionProviderBase class. Define CFunctionProvider class. Strengthen <cicero/cictf.h>.
This commit is contained in:
parent
e5548aa501
commit
88107adc92
2 changed files with 235 additions and 11 deletions
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
#include "msctfime.h"
|
||||
#include <ndk/ldrfuncs.h> /* for RtlDllShutdownInProgress */
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(msctfime);
|
||||
|
||||
|
@ -1071,24 +1072,132 @@ HRESULT CThreadMgrEventSink::_Unadvise()
|
|||
return hr;
|
||||
}
|
||||
|
||||
/* FIXME */
|
||||
class CFunctionProvider : public IUnknown
|
||||
class CFunctionProviderBase : public ITfFunctionProvider
|
||||
{
|
||||
protected:
|
||||
TfClientId m_clientId;
|
||||
GUID m_guid;
|
||||
BSTR m_bstr;
|
||||
LONG m_cRefs;
|
||||
|
||||
public:
|
||||
CFunctionProvider(_In_ TfClientId clientId)
|
||||
{
|
||||
}
|
||||
CFunctionProviderBase(_In_ TfClientId clientId);
|
||||
virtual ~CFunctionProviderBase();
|
||||
|
||||
// IUnknown interface
|
||||
STDMETHODIMP QueryInterface(REFIID riid, LPVOID* ppvObj) override;
|
||||
STDMETHODIMP QueryInterface(_In_ REFIID riid, _Out_ LPVOID* ppvObj) override;
|
||||
STDMETHODIMP_(ULONG) AddRef() override;
|
||||
STDMETHODIMP_(ULONG) Release() override;
|
||||
|
||||
// ITfFunctionProvider interface
|
||||
STDMETHODIMP GetType(_Out_ GUID *guid) override;
|
||||
STDMETHODIMP GetDescription(_Out_ BSTR *desc) override;
|
||||
//STDMETHODIMP GetFunction(_In_ REFGUID guid, _In_ REFIID riid, _Out_ IUnknown **func) = 0;
|
||||
|
||||
BOOL Init(_In_ REFGUID rguid, _In_ LPCWSTR psz);
|
||||
};
|
||||
|
||||
/**
|
||||
* @implemented
|
||||
*/
|
||||
CFunctionProviderBase::CFunctionProviderBase(_In_ TfClientId clientId)
|
||||
{
|
||||
m_clientId = clientId;
|
||||
m_guid = GUID_NULL;
|
||||
m_bstr = NULL;
|
||||
m_cRefs = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @implemented
|
||||
*/
|
||||
CFunctionProviderBase::~CFunctionProviderBase()
|
||||
{
|
||||
if (!RtlDllShutdownInProgress())
|
||||
::SysFreeString(m_bstr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @implemented
|
||||
*/
|
||||
BOOL
|
||||
CFunctionProviderBase::Init(
|
||||
_In_ REFGUID rguid,
|
||||
_In_ LPCWSTR psz)
|
||||
{
|
||||
m_bstr = ::SysAllocString(psz);
|
||||
m_guid = rguid;
|
||||
return (m_bstr != NULL);
|
||||
}
|
||||
|
||||
class CFnDocFeed : public IAImmFnDocFeed
|
||||
{
|
||||
LONG m_cRefs;
|
||||
|
||||
public:
|
||||
CFnDocFeed();
|
||||
virtual ~CFnDocFeed();
|
||||
|
||||
// IUnknown interface
|
||||
STDMETHODIMP QueryInterface(_In_ REFIID riid, _Out_ LPVOID* ppvObj) override;
|
||||
STDMETHODIMP_(ULONG) AddRef() override;
|
||||
STDMETHODIMP_(ULONG) Release() override;
|
||||
|
||||
// IAImmFnDocFeed interface
|
||||
STDMETHODIMP DocFeed() override;
|
||||
STDMETHODIMP ClearDocFeedBuffer() override;
|
||||
STDMETHODIMP StartReconvert() override;
|
||||
STDMETHODIMP StartUndoCompositionString() override;
|
||||
};
|
||||
|
||||
CFnDocFeed::CFnDocFeed()
|
||||
{
|
||||
m_cRefs = 1;
|
||||
}
|
||||
|
||||
CFnDocFeed::~CFnDocFeed()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @implemented
|
||||
*/
|
||||
STDMETHODIMP CFnDocFeed::QueryInterface(_In_ REFIID riid, _Out_ LPVOID* ppvObj)
|
||||
{
|
||||
if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_IAImmFnDocFeed))
|
||||
{
|
||||
*ppvObj = this;
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @implemented
|
||||
*/
|
||||
STDMETHODIMP_(ULONG) CFnDocFeed::AddRef()
|
||||
{
|
||||
return ::InterlockedIncrement(&m_cRefs);
|
||||
}
|
||||
|
||||
/**
|
||||
* @implemented
|
||||
*/
|
||||
STDMETHODIMP_(ULONG) CFnDocFeed::Release()
|
||||
{
|
||||
if (::InterlockedDecrement(&m_cRefs) == 0)
|
||||
{
|
||||
delete this;
|
||||
return 0;
|
||||
}
|
||||
return m_cRefs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @unimplemented
|
||||
*/
|
||||
STDMETHODIMP CFunctionProvider::QueryInterface(REFIID riid, LPVOID* ppvObj)
|
||||
STDMETHODIMP CFnDocFeed::DocFeed()
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
@ -1096,17 +1205,119 @@ STDMETHODIMP CFunctionProvider::QueryInterface(REFIID riid, LPVOID* ppvObj)
|
|||
/**
|
||||
* @unimplemented
|
||||
*/
|
||||
STDMETHODIMP_(ULONG) CFunctionProvider::AddRef()
|
||||
STDMETHODIMP CFnDocFeed::ClearDocFeedBuffer()
|
||||
{
|
||||
return 1;
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @unimplemented
|
||||
*/
|
||||
STDMETHODIMP_(ULONG) CFunctionProvider::Release()
|
||||
STDMETHODIMP CFnDocFeed::StartReconvert()
|
||||
{
|
||||
return 0;
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @unimplemented
|
||||
*/
|
||||
STDMETHODIMP CFnDocFeed::StartUndoCompositionString()
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @implemented
|
||||
*/
|
||||
STDMETHODIMP
|
||||
CFunctionProviderBase::QueryInterface(
|
||||
_In_ REFIID riid,
|
||||
_Out_ LPVOID* ppvObj)
|
||||
{
|
||||
if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_ITfFunctionProvider))
|
||||
{
|
||||
*ppvObj = this;
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @implemented
|
||||
*/
|
||||
STDMETHODIMP_(ULONG) CFunctionProviderBase::AddRef()
|
||||
{
|
||||
return ::InterlockedIncrement(&m_cRefs);
|
||||
}
|
||||
|
||||
/**
|
||||
* @implemented
|
||||
*/
|
||||
STDMETHODIMP_(ULONG) CFunctionProviderBase::Release()
|
||||
{
|
||||
if (::InterlockedDecrement(&m_cRefs) == 0)
|
||||
{
|
||||
delete this;
|
||||
return 0;
|
||||
}
|
||||
return m_cRefs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @implemented
|
||||
*/
|
||||
STDMETHODIMP CFunctionProviderBase::GetType(_Out_ GUID *guid)
|
||||
{
|
||||
*guid = m_guid;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @implemented
|
||||
*/
|
||||
STDMETHODIMP CFunctionProviderBase::GetDescription(_Out_ BSTR *desc)
|
||||
{
|
||||
*desc = ::SysAllocString(m_bstr);
|
||||
return (*desc ? S_OK : E_OUTOFMEMORY);
|
||||
}
|
||||
|
||||
class CFunctionProvider : public CFunctionProviderBase
|
||||
{
|
||||
public:
|
||||
CFunctionProvider(_In_ TfClientId clientId);
|
||||
|
||||
STDMETHODIMP GetFunction(_In_ REFGUID guid, _In_ REFIID riid, _Out_ IUnknown **func) override;
|
||||
};
|
||||
|
||||
/**
|
||||
* @implemented
|
||||
*/
|
||||
CFunctionProvider::CFunctionProvider(_In_ TfClientId clientId) : CFunctionProviderBase(clientId)
|
||||
{
|
||||
Init(CLSID_CAImmLayer, L"MSCTFIME::Function Provider");
|
||||
}
|
||||
|
||||
/**
|
||||
* @implemented
|
||||
*/
|
||||
STDMETHODIMP
|
||||
CFunctionProvider::GetFunction(
|
||||
_In_ REFGUID guid,
|
||||
_In_ REFIID riid,
|
||||
_Out_ IUnknown **func)
|
||||
{
|
||||
*func = NULL;
|
||||
|
||||
if (IsEqualGUID(guid, GUID_NULL) &&
|
||||
IsEqualIID(riid, IID_IAImmFnDocFeed))
|
||||
{
|
||||
*func = new CFnDocFeed();
|
||||
if (*func)
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
/* FIXME */
|
||||
|
|
|
@ -29,3 +29,16 @@ struct ITfThreadMgr_P : ITfThreadMgr
|
|||
};
|
||||
|
||||
DEFINE_GUID(IID_ITfKeystrokeMgr_P, 0x53FA1BEC, 0x5BE1, 0x458E, 0xAE, 0x70, 0xA9, 0xF1, 0xDC, 0x84, 0x3E, 0x81);
|
||||
|
||||
// FIXME: ITfKeystrokeMgr_P
|
||||
|
||||
DEFINE_GUID(IID_IAImmFnDocFeed, 0x6E098993, 0x9577, 0x499A, 0xA8, 0x30, 0x52, 0x34, 0x4F, 0x3E, 0x20, 0x0D);
|
||||
DEFINE_GUID(CLSID_CAImmLayer, 0xB676DB87, 0x64DC, 0x4651, 0x99, 0xEC, 0x91, 0x07, 0x0E, 0xA4, 0x87, 0x90);
|
||||
|
||||
struct IAImmFnDocFeed : IUnknown
|
||||
{
|
||||
STDMETHOD(DocFeed)() = 0;
|
||||
STDMETHOD(ClearDocFeedBuffer)() = 0;
|
||||
STDMETHOD(StartReconvert)() = 0;
|
||||
STDMETHOD(StartUndoCompositionString)() = 0;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue