mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-03 04:13:31 +00:00
[MSCTFIME] Implement CTextEventSink::_Advise and _Unadvise (#6284)
Supporting TIPs... JIRA issue: CORE-19360
This commit is contained in:
@@ -609,7 +609,11 @@ protected:
|
||||
IUnknown *m_pUnknown;
|
||||
DWORD m_dwEditSinkCookie;
|
||||
DWORD m_dwLayoutSinkCookie;
|
||||
FN_LAYOUTCHANGE m_fnLayoutChange;
|
||||
union
|
||||
{
|
||||
UINT m_uFlags;
|
||||
FN_LAYOUTCHANGE m_fnLayoutChange;
|
||||
};
|
||||
FN_ENDEDIT m_fnEndEdit;
|
||||
LPVOID m_pCallbackPV;
|
||||
|
||||
@@ -742,18 +746,63 @@ STDMETHODIMP CTextEventSink::OnLayoutChange(
|
||||
}
|
||||
|
||||
/**
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
HRESULT CTextEventSink::_Advise(IUnknown *pUnknown, UINT uFlags)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
m_pUnknown = NULL;
|
||||
m_uFlags = uFlags;
|
||||
|
||||
ITfSource *pSource = NULL;
|
||||
HRESULT hr = pUnknown->QueryInterface(IID_ITfSource, (void**)&pSource);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
ITfTextEditSink *pSink = static_cast<ITfTextEditSink*>(this);
|
||||
if (uFlags & 1)
|
||||
hr = pSource->AdviseSink(IID_ITfTextEditSink, pSink, &m_dwEditSinkCookie);
|
||||
if (SUCCEEDED(hr) && (uFlags & 2))
|
||||
hr = pSource->AdviseSink(IID_ITfTextLayoutSink, pSink, &m_dwLayoutSinkCookie);
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
m_pUnknown = pUnknown;
|
||||
pUnknown->AddRef();
|
||||
}
|
||||
else
|
||||
{
|
||||
pSource->UnadviseSink(m_dwEditSinkCookie);
|
||||
}
|
||||
}
|
||||
|
||||
if (pSource)
|
||||
pSource->Release();
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
HRESULT CTextEventSink::_Unadvise()
|
||||
{
|
||||
if (!m_pUnknown)
|
||||
return E_FAIL;
|
||||
|
||||
ITfSource *pSource = NULL;
|
||||
HRESULT hr = m_pUnknown->QueryInterface(IID_ITfSource, (void**)&pSource);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
if (m_uFlags & 1)
|
||||
hr = pSource->UnadviseSink(m_dwEditSinkCookie);
|
||||
if (m_uFlags & 2)
|
||||
hr = pSource->UnadviseSink(m_dwLayoutSinkCookie);
|
||||
|
||||
pSource->Release();
|
||||
}
|
||||
|
||||
m_pUnknown->Release();
|
||||
m_pUnknown = NULL;
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
@@ -772,7 +821,7 @@ public:
|
||||
HIMC m_hIMC;
|
||||
ITfDocumentMgr *m_pDocumentMgr;
|
||||
ITfContext *m_pContext;
|
||||
IUnknown *m_pUnknown1;
|
||||
ITfContextOwnerServices *m_pContextOwnerServices;
|
||||
CInputContextOwnerCallBack *m_pICOwnerCallback;
|
||||
CTextEventSink *m_pTextEventSink;
|
||||
CCompartmentEventSink *m_pCompEventSink1;
|
||||
@@ -988,14 +1037,14 @@ CicInputContext::DestroyInputContext()
|
||||
|
||||
if (m_pCompEventSink2)
|
||||
{
|
||||
//FIXME: m_pCompEventSink2->_Unadvise();
|
||||
m_pCompEventSink2->_Unadvise();
|
||||
m_pCompEventSink2->Release();
|
||||
m_pCompEventSink2 = NULL;
|
||||
}
|
||||
|
||||
if (m_pCompEventSink1)
|
||||
{
|
||||
//FIXME: m_pCompEventSink1->_Unadvise();
|
||||
m_pCompEventSink1->_Unadvise();
|
||||
m_pCompEventSink1->Release();
|
||||
m_pCompEventSink1 = NULL;
|
||||
}
|
||||
@@ -1012,10 +1061,10 @@ CicInputContext::DestroyInputContext()
|
||||
m_pContext = NULL;
|
||||
}
|
||||
|
||||
if (m_pUnknown1)
|
||||
if (m_pContextOwnerServices)
|
||||
{
|
||||
m_pUnknown1->Release();
|
||||
m_pUnknown1 = NULL;
|
||||
m_pContextOwnerServices->Release();
|
||||
m_pContextOwnerServices = NULL;
|
||||
}
|
||||
|
||||
// FIXME: m_pICOwnerCallback
|
||||
|
||||
Reference in New Issue
Block a user