mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[MSCTFIME][CICERO] Implement CFnDocFeed (#6513)
Supporting TIPs... JIRA issue: CORE-19360 - Add missing CicInputContext methods. - Implement CFnDocFeed class.
This commit is contained in:
parent
0086d05007
commit
f53f1334ed
8 changed files with 156 additions and 58 deletions
|
@ -87,11 +87,8 @@ CicBridge::CreateInputContext(
|
|||
_In_ HIMC hIMC)
|
||||
{
|
||||
CicIMCLock imcLock(hIMC);
|
||||
HRESULT hr = imcLock.m_hr;
|
||||
if (!imcLock)
|
||||
hr = E_FAIL;
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
if (FAILED(imcLock.m_hr))
|
||||
return imcLock.m_hr;
|
||||
|
||||
if (!imcLock.get().hCtfImeContext)
|
||||
{
|
||||
|
@ -126,7 +123,7 @@ CicBridge::CreateInputContext(
|
|||
imeContext.get().m_pCicIC = pCicIC;
|
||||
}
|
||||
|
||||
hr = pCicIC->CreateInputContext(pTLS->m_pThreadMgr, imcLock);
|
||||
HRESULT hr = pCicIC->CreateInputContext(pTLS->m_pThreadMgr, imcLock);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
pCicIC->Release();
|
||||
|
@ -149,8 +146,6 @@ HRESULT CicBridge::DestroyInputContext(TLS *pTLS, HIMC hIMC)
|
|||
{
|
||||
CicIMCLock imcLock(hIMC);
|
||||
HRESULT hr = imcLock.m_hr;
|
||||
if (!imcLock)
|
||||
hr = E_FAIL;
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
|
@ -217,8 +212,6 @@ CicBridge::SelectEx(
|
|||
return imcLock.m_hr;
|
||||
|
||||
CicIMCCLock<CTFIMECONTEXT> imeContext(imcLock.get().hCtfImeContext);
|
||||
if (!imeContext)
|
||||
imeContext.m_hr = E_FAIL;
|
||||
if (FAILED(imeContext.m_hr))
|
||||
return imeContext.m_hr;
|
||||
|
||||
|
|
|
@ -150,26 +150,112 @@ STDMETHODIMP_(ULONG) CFnDocFeed::Release()
|
|||
return m_cRefs;
|
||||
}
|
||||
|
||||
/// @unimplemented
|
||||
/// @implemented
|
||||
STDMETHODIMP CFnDocFeed::DocFeed()
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
TLS *pTLS = TLS::GetTLS();
|
||||
if (!pTLS)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
HIMC hIMC = GetActiveContext();
|
||||
CicIMCLock imcLock(hIMC);
|
||||
if (FAILED(imcLock.m_hr))
|
||||
return imcLock.m_hr;
|
||||
|
||||
CicIMCCLock<CTFIMECONTEXT> imeContext(imcLock.get().hCtfImeContext);
|
||||
if (FAILED(imeContext.m_hr))
|
||||
return imeContext.m_hr;
|
||||
CicInputContext *pCicIC = imeContext.get().m_pCicIC;
|
||||
if (!pCicIC)
|
||||
return E_FAIL;
|
||||
|
||||
UINT uCodePage = CP_ACP;
|
||||
pTLS->m_pProfile->GetCodePageA(&uCodePage);
|
||||
pCicIC->SetupDocFeedString(imcLock, uCodePage);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/// @unimplemented
|
||||
/// @implemented
|
||||
STDMETHODIMP CFnDocFeed::ClearDocFeedBuffer()
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
if (!TLS::GetTLS())
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
HIMC hIMC = GetActiveContext();
|
||||
CicIMCLock imcLock(hIMC);
|
||||
if (FAILED(imcLock.m_hr))
|
||||
return imcLock.m_hr;
|
||||
|
||||
CicIMCCLock<CTFIMECONTEXT> imeContext(imcLock.get().hCtfImeContext);
|
||||
if (FAILED(imeContext.m_hr))
|
||||
return imeContext.m_hr;
|
||||
|
||||
CicInputContext *pCicIC = imeContext.get().m_pCicIC;
|
||||
if (!pCicIC)
|
||||
return E_FAIL;
|
||||
|
||||
pCicIC->EscbClearDocFeedBuffer(imcLock, TRUE);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/// @unimplemented
|
||||
STDMETHODIMP CFnDocFeed::StartReconvert()
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
TLS *pTLS = TLS::GetTLS();
|
||||
if (!pTLS)
|
||||
return E_OUTOFMEMORY;
|
||||
auto *pThreadMgr = pTLS->m_pThreadMgr;
|
||||
if (!pThreadMgr)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
HIMC hIMC = GetActiveContext();
|
||||
CicIMCLock imcLock(hIMC);
|
||||
if (FAILED(imcLock.m_hr))
|
||||
return imcLock.m_hr;
|
||||
|
||||
CicIMCCLock<CTFIMECONTEXT> imeContext(imcLock.get().hCtfImeContext);
|
||||
if (FAILED(imeContext.m_hr))
|
||||
return imeContext.m_hr;
|
||||
CicInputContext *pCicIC = imeContext.get().m_pCicIC;
|
||||
if (!pCicIC)
|
||||
return E_FAIL;
|
||||
|
||||
UINT uCodePage = CP_ACP;
|
||||
pTLS->m_pProfile->GetCodePageA(&uCodePage);
|
||||
|
||||
pCicIC->m_bReconverting = TRUE;
|
||||
pCicIC->SetupReconvertString(imcLock, pThreadMgr, uCodePage, 0, 0);
|
||||
pCicIC->EndReconvertString(imcLock);
|
||||
pCicIC->m_bReconverting = FALSE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/// @unimplemented
|
||||
/// @implemented
|
||||
STDMETHODIMP CFnDocFeed::StartUndoCompositionString()
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
TLS *pTLS = TLS::GetTLS();
|
||||
if (!pTLS)
|
||||
return E_OUTOFMEMORY;
|
||||
auto *pThreadMgr = pTLS->m_pThreadMgr;
|
||||
if (!pThreadMgr)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
HIMC hIMC = GetActiveContext();
|
||||
CicIMCLock imcLock(hIMC);
|
||||
if (FAILED(imcLock.m_hr))
|
||||
return imcLock.m_hr;
|
||||
|
||||
CicIMCCLock<CTFIMECONTEXT> imeContext(imcLock.get().hCtfImeContext);
|
||||
if (FAILED(imeContext.m_hr))
|
||||
return imeContext.m_hr;
|
||||
CicInputContext *pCicIC = imeContext.get().m_pCicIC;
|
||||
if (!pCicIC)
|
||||
return E_FAIL;
|
||||
|
||||
UINT uCodePage = CP_ACP;
|
||||
pTLS->m_pProfile->GetCodePageA(&uCodePage);
|
||||
|
||||
pCicIC->SetupReconvertString(imcLock, pThreadMgr, uCodePage, 0, TRUE);
|
||||
pCicIC->EndReconvertString(imcLock);
|
||||
return S_OK;
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ CicInputContext::OnStartComposition(
|
|||
ITfCompositionView *pComposition,
|
||||
BOOL *pfOk)
|
||||
{
|
||||
if ((m_cCompLocks <= 0) || m_dwUnknown6_5)
|
||||
if ((m_cCompLocks <= 0) || m_bReconverting)
|
||||
{
|
||||
*pfOk = TRUE;
|
||||
++m_cCompLocks;
|
||||
|
@ -103,13 +103,10 @@ CicInputContext::GetGuidAtom(
|
|||
_Out_opt_ LPDWORD pdwGuidAtom)
|
||||
{
|
||||
CicIMCCLock<CTFIMECONTEXT> imeContext(imcLock.get().hCompStr);
|
||||
HRESULT hr = imeContext.m_hr;
|
||||
if (!imeContext)
|
||||
hr = E_FAIL;
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
if (FAILED(imeContext.m_hr))
|
||||
return imeContext.m_hr;
|
||||
|
||||
hr = E_FAIL;
|
||||
HRESULT hr = E_FAIL;
|
||||
if (iAtom < m_cGuidAtoms)
|
||||
{
|
||||
*pdwGuidAtom = m_adwGuidAtoms[iAtom];
|
||||
|
@ -251,6 +248,36 @@ CicInputContext::OnCleanupContext(
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
/// @unimplemented
|
||||
HRESULT CicInputContext::SetupDocFeedString(CicIMCLock& imcLock, UINT uCodePage)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
/// @unimplemented
|
||||
HRESULT CicInputContext::EscbClearDocFeedBuffer(CicIMCLock& imcLock, BOOL bFlag)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
/// @unimplemented
|
||||
HRESULT
|
||||
CicInputContext::SetupReconvertString(
|
||||
CicIMCLock& imcLock,
|
||||
ITfThreadMgr_P *pThreadMgr,
|
||||
UINT uCodePage,
|
||||
DWORD dwUnknown61,
|
||||
BOOL bUndo)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
/// @unimplemented
|
||||
HRESULT CicInputContext::EndReconvertString(CicIMCLock& imcLock)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
/// Retrieves the IME information.
|
||||
/// @implemented
|
||||
HRESULT
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
GUID m_guid;
|
||||
DWORD m_dwUnknown6[11];
|
||||
BOOL m_bSelecting;
|
||||
DWORD m_dwUnknown6_5;
|
||||
BOOL m_bReconverting;
|
||||
LONG m_cCompLocks;
|
||||
DWORD m_dwUnknown7[5];
|
||||
WORD m_cGuidAtoms;
|
||||
|
@ -88,4 +88,14 @@ public:
|
|||
|
||||
HRESULT CreateInputContext(_Inout_ ITfThreadMgr *pThreadMgr, _Inout_ CicIMCLock& imcLock);
|
||||
HRESULT DestroyInputContext();
|
||||
|
||||
HRESULT SetupDocFeedString(CicIMCLock& imcLock, UINT uCodePage);
|
||||
HRESULT EscbClearDocFeedBuffer(CicIMCLock& imcLock, BOOL bFlag);
|
||||
HRESULT SetupReconvertString(
|
||||
CicIMCLock& imcLock,
|
||||
ITfThreadMgr_P *pThreadMgr,
|
||||
UINT uCodePage,
|
||||
DWORD dwUnknown61,
|
||||
BOOL bUndo);
|
||||
HRESULT EndReconvertString(CicIMCLock& imcLock);
|
||||
};
|
||||
|
|
|
@ -142,14 +142,6 @@ HRESULT InitDisplayAttrbuteLib(PCIC_LIBTHREAD pLibThread)
|
|||
return hr;
|
||||
}
|
||||
|
||||
HIMC GetActiveContext(VOID)
|
||||
{
|
||||
HWND hwndFocus = ::GetFocus();
|
||||
if (!hwndFocus)
|
||||
hwndFocus = ::GetActiveWindow();
|
||||
return ::ImmGetContext(hwndFocus);
|
||||
}
|
||||
|
||||
/// @implemented
|
||||
HRESULT UninitDisplayAttrbuteLib(PCIC_LIBTHREAD pLibThread)
|
||||
{
|
||||
|
@ -184,8 +176,6 @@ InternalSelectEx(
|
|||
_In_ LANGID LangID)
|
||||
{
|
||||
CicIMCLock imcLock(hIMC);
|
||||
if (!imcLock)
|
||||
imcLock.m_hr = E_FAIL;
|
||||
if (FAILED(imcLock.m_hr))
|
||||
return imcLock.m_hr;
|
||||
|
||||
|
@ -608,25 +598,17 @@ CtfImeGetGuidAtom(
|
|||
TRACE("(%p, 0x%lX, %p)\n", hIMC, dwUnknown, pdwGuidAtom);
|
||||
|
||||
CicIMCLock imcLock(hIMC);
|
||||
|
||||
HRESULT hr = imcLock.m_hr;
|
||||
if (!imcLock)
|
||||
hr = E_FAIL;
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
if (FAILED(imcLock.m_hr))
|
||||
return imcLock.m_hr;
|
||||
|
||||
CicIMCCLock<CTFIMECONTEXT> imccLock(imcLock.get().hCtfImeContext);
|
||||
hr = imccLock.m_hr;
|
||||
if (!imccLock)
|
||||
hr = E_FAIL;
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
if (FAILED(imccLock.m_hr))
|
||||
return imccLock.m_hr;
|
||||
|
||||
if (!imccLock.get().m_pCicIC)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
hr = imccLock.get().m_pCicIC->GetGuidAtom(imcLock, dwUnknown, pdwGuidAtom);
|
||||
return hr;
|
||||
return imccLock.get().m_pCicIC->GetGuidAtom(imcLock, dwUnknown, pdwGuidAtom);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -641,13 +623,8 @@ CtfImeIsGuidMapEnable(
|
|||
TRACE("(%p)\n", hIMC);
|
||||
|
||||
BOOL ret = FALSE;
|
||||
HRESULT hr;
|
||||
CicIMCLock imcLock(hIMC);
|
||||
|
||||
hr = imcLock.m_hr;
|
||||
if (!imcLock)
|
||||
hr = E_FAIL;
|
||||
if (SUCCEEDED(hr))
|
||||
if (SUCCEEDED(imcLock.m_hr))
|
||||
ret = !!(imcLock.get().fdwInit & INIT_GUIDMAP);
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -40,6 +40,14 @@ EXTERN_C BOOLEAN WINAPI DllShutdownInProgress(VOID);
|
|||
HRESULT InitDisplayAttrbuteLib(PCIC_LIBTHREAD pLibThread);
|
||||
HRESULT UninitDisplayAttrbuteLib(PCIC_LIBTHREAD pLibThread);
|
||||
|
||||
static inline HIMC GetActiveContext(VOID)
|
||||
{
|
||||
HWND hwndFocus = ::GetFocus();
|
||||
if (!hwndFocus)
|
||||
hwndFocus = ::GetActiveWindow();
|
||||
return ::ImmGetContext(hwndFocus);
|
||||
}
|
||||
|
||||
DEFINE_GUID(GUID_COMPARTMENT_CTFIME_DIMFLAGS, 0xA94C5FD2, 0xC471, 0x4031, 0x95, 0x46, 0x70, 0x9C, 0x17, 0x30, 0x0C, 0xB9);
|
||||
DEFINE_GUID(GUID_COMPARTMENT_CTFIME_CICINPUTCONTEXT, 0x85A688F7, 0x6DC8, 0x4F17, 0xA8, 0x3A, 0xB1, 0x1C, 0x09, 0xCD, 0xD7, 0xBF);
|
||||
|
||||
|
|
|
@ -357,8 +357,6 @@ STDMETHODIMP_(LRESULT)
|
|||
CDefCompFrameWindow::OnWindowPosChanged(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
CicIMCLock imcLock(m_hIMC);
|
||||
if (!imcLock)
|
||||
imcLock.m_hr = E_FAIL;
|
||||
if (SUCCEEDED(imcLock.m_hr))
|
||||
::SendMessage(imcLock.get().hWnd, WM_IME_NOTIFY, 0xF, (LPARAM)m_hIMC);
|
||||
return ::DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
|
|
|
@ -45,8 +45,7 @@ class CicIMCCLock : public CIC_IMCC_LOCK<T_DATA>
|
|||
public:
|
||||
CicIMCCLock(HIMCC hIMCC) : CIC_IMCC_LOCK<T_DATA>(hIMCC)
|
||||
{
|
||||
if (hIMCC)
|
||||
_LockIMCC(this->m_hIMCC, &this->m_pIMCC);
|
||||
this->m_hr = _LockIMCC(this->m_hIMCC, &this->m_pIMCC);
|
||||
}
|
||||
~CicIMCCLock()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue