mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[IMM32] Rewrite ImmGetRegisterWordStyleA/W (#3901)
- Rewrite ImmGetRegisterWordStyleA and ImmGetRegisterWordStyleW functions. - Modify win32ss/include/imetable.h. CORE-11700
This commit is contained in:
parent
1da5d7a305
commit
19d24143e9
2 changed files with 98 additions and 35 deletions
|
@ -3087,26 +3087,58 @@ DWORD WINAPI ImmGetProperty(HKL hKL, DWORD fdwIndex)
|
||||||
UINT WINAPI ImmGetRegisterWordStyleA(
|
UINT WINAPI ImmGetRegisterWordStyleA(
|
||||||
HKL hKL, UINT nItem, LPSTYLEBUFA lpStyleBuf)
|
HKL hKL, UINT nItem, LPSTYLEBUFA lpStyleBuf)
|
||||||
{
|
{
|
||||||
ImmHkl *immHkl = IMM_GetImmHkl(hKL);
|
UINT iItem, ret = 0;
|
||||||
TRACE("(%p, %d, %p):\n", hKL, nItem, lpStyleBuf);
|
PIMEDPI pImeDpi;
|
||||||
if (immHkl->hIME && immHkl->pImeGetRegisterWordStyle)
|
LPSTYLEBUFA pDestA;
|
||||||
{
|
LPSTYLEBUFW pSrcW, pNewStylesW = NULL;
|
||||||
if (!is_kbd_ime_unicode(immHkl))
|
size_t cchW;
|
||||||
return immHkl->pImeGetRegisterWordStyle(nItem,(LPSTYLEBUFW)lpStyleBuf);
|
INT cchA;
|
||||||
else
|
|
||||||
{
|
|
||||||
STYLEBUFW sbw;
|
|
||||||
UINT rc;
|
|
||||||
|
|
||||||
rc = immHkl->pImeGetRegisterWordStyle(nItem,&sbw);
|
TRACE("(%p, %u, %p)\n", hKL, nItem, lpStyleBuf);
|
||||||
WideCharToMultiByte(CP_ACP, 0, sbw.szDescription, -1,
|
|
||||||
lpStyleBuf->szDescription, 32, NULL, NULL);
|
pImeDpi = ImmLockOrLoadImeDpi(hKL);
|
||||||
lpStyleBuf->dwStyle = sbw.dwStyle;
|
if (!pImeDpi)
|
||||||
return rc;
|
return 0;
|
||||||
|
|
||||||
|
if (!(pImeDpi->ImeInfo.fdwProperty & IME_PROP_UNICODE))
|
||||||
|
{
|
||||||
|
ret = pImeDpi->ImeGetRegisterWordStyle(nItem, lpStyleBuf);
|
||||||
|
goto Quit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nItem > 0)
|
||||||
|
{
|
||||||
|
pNewStylesW = Imm32HeapAlloc(0, nItem * sizeof(STYLEBUFW));
|
||||||
|
if (!pNewStylesW)
|
||||||
|
goto Quit;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = pImeDpi->ImeGetRegisterWordStyle(nItem, pNewStylesW);
|
||||||
|
|
||||||
|
if (nItem > 0)
|
||||||
|
{
|
||||||
|
/* lpStyleBuf <-- pNewStylesW */
|
||||||
|
for (iItem = 0; iItem < ret; ++iItem)
|
||||||
|
{
|
||||||
|
pSrcW = &pNewStylesW[iItem];
|
||||||
|
pDestA = &lpStyleBuf[iItem];
|
||||||
|
pDestA->dwStyle = pSrcW->dwStyle;
|
||||||
|
StringCchLengthW(pSrcW->szDescription, _countof(pSrcW->szDescription), &cchW);
|
||||||
|
cchA = WideCharToMultiByte(CP_ACP, MB_PRECOMPOSED,
|
||||||
|
pSrcW->szDescription, (INT)cchW,
|
||||||
|
pDestA->szDescription, _countof(pDestA->szDescription),
|
||||||
|
NULL, NULL);
|
||||||
|
if (cchA > _countof(pDestA->szDescription) - 1)
|
||||||
|
cchA = _countof(pDestA->szDescription) - 1;
|
||||||
|
pDestA->szDescription[cchA] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return 0;
|
Quit:
|
||||||
|
if (pNewStylesW)
|
||||||
|
HeapFree(g_hImm32Heap, 0, pNewStylesW);
|
||||||
|
ImmUnlockImeDpi(pImeDpi);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -3115,26 +3147,57 @@ UINT WINAPI ImmGetRegisterWordStyleA(
|
||||||
UINT WINAPI ImmGetRegisterWordStyleW(
|
UINT WINAPI ImmGetRegisterWordStyleW(
|
||||||
HKL hKL, UINT nItem, LPSTYLEBUFW lpStyleBuf)
|
HKL hKL, UINT nItem, LPSTYLEBUFW lpStyleBuf)
|
||||||
{
|
{
|
||||||
ImmHkl *immHkl = IMM_GetImmHkl(hKL);
|
UINT iItem, ret = 0;
|
||||||
TRACE("(%p, %d, %p):\n", hKL, nItem, lpStyleBuf);
|
PIMEDPI pImeDpi;
|
||||||
if (immHkl->hIME && immHkl->pImeGetRegisterWordStyle)
|
LPSTYLEBUFA pSrcA, pNewStylesA = NULL;
|
||||||
{
|
LPSTYLEBUFW pDestW;
|
||||||
if (is_kbd_ime_unicode(immHkl))
|
size_t cchA;
|
||||||
return immHkl->pImeGetRegisterWordStyle(nItem,lpStyleBuf);
|
INT cchW;
|
||||||
else
|
|
||||||
{
|
|
||||||
STYLEBUFA sba;
|
|
||||||
UINT rc;
|
|
||||||
|
|
||||||
rc = immHkl->pImeGetRegisterWordStyle(nItem,(LPSTYLEBUFW)&sba);
|
TRACE("(%p, %u, %p)\n", hKL, nItem, lpStyleBuf);
|
||||||
MultiByteToWideChar(CP_ACP, 0, sba.szDescription, -1,
|
|
||||||
lpStyleBuf->szDescription, 32);
|
pImeDpi = ImmLockOrLoadImeDpi(hKL);
|
||||||
lpStyleBuf->dwStyle = sba.dwStyle;
|
if (!pImeDpi)
|
||||||
return rc;
|
return 0;
|
||||||
|
|
||||||
|
if (pImeDpi->ImeInfo.fdwProperty & IME_PROP_UNICODE)
|
||||||
|
{
|
||||||
|
ret = pImeDpi->ImeGetRegisterWordStyle(nItem, lpStyleBuf);
|
||||||
|
goto Quit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nItem > 0)
|
||||||
|
{
|
||||||
|
pNewStylesA = Imm32HeapAlloc(0, nItem * sizeof(STYLEBUFA));
|
||||||
|
if (!pNewStylesA)
|
||||||
|
goto Quit;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = pImeDpi->ImeGetRegisterWordStyle(nItem, pNewStylesA);
|
||||||
|
|
||||||
|
if (nItem > 0)
|
||||||
|
{
|
||||||
|
/* lpStyleBuf <-- pNewStylesA */
|
||||||
|
for (iItem = 0; iItem < ret; ++iItem)
|
||||||
|
{
|
||||||
|
pSrcA = &pNewStylesA[iItem];
|
||||||
|
pDestW = &lpStyleBuf[iItem];
|
||||||
|
pDestW->dwStyle = pSrcA->dwStyle;
|
||||||
|
StringCchLengthA(pSrcA->szDescription, _countof(pSrcA->szDescription), &cchA);
|
||||||
|
cchW = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED,
|
||||||
|
pSrcA->szDescription, (INT)cchA,
|
||||||
|
pDestW->szDescription, _countof(pDestW->szDescription));
|
||||||
|
if (cchW > _countof(pDestW->szDescription) - 1)
|
||||||
|
cchW = _countof(pDestW->szDescription) - 1;
|
||||||
|
pDestW->szDescription[cchW] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return 0;
|
Quit:
|
||||||
|
if (pNewStylesA)
|
||||||
|
HeapFree(g_hImm32Heap, 0, pNewStylesA);
|
||||||
|
ImmUnlockImeDpi(pImeDpi);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
|
|
@ -3,7 +3,7 @@ DEFINE_IME_ENTRY(BOOL, ImeInquire, (LPIMEINFO lpIMEInfo, LPVOID lpszWndClass, DW
|
||||||
DEFINE_IME_ENTRY(DWORD, ImeConversionList, (HIMC hIMC, LPCVOID lpSrc, LPCANDIDATELIST lpDst, DWORD dwBufLen, UINT uFlag), FALSE)
|
DEFINE_IME_ENTRY(DWORD, ImeConversionList, (HIMC hIMC, LPCVOID lpSrc, LPCANDIDATELIST lpDst, DWORD dwBufLen, UINT uFlag), FALSE)
|
||||||
DEFINE_IME_ENTRY(BOOL, ImeRegisterWord, (LPCVOID lpszReading, DWORD dwStyle, LPCVOID lpszString), FALSE)
|
DEFINE_IME_ENTRY(BOOL, ImeRegisterWord, (LPCVOID lpszReading, DWORD dwStyle, LPCVOID lpszString), FALSE)
|
||||||
DEFINE_IME_ENTRY(BOOL, ImeUnregisterWord, (LPCVOID lpszReading, DWORD dwStyle, LPCVOID lpszString), FALSE)
|
DEFINE_IME_ENTRY(BOOL, ImeUnregisterWord, (LPCVOID lpszReading, DWORD dwStyle, LPCVOID lpszString), FALSE)
|
||||||
DEFINE_IME_ENTRY(UINT, ImeGetRegisterWordStyle, (UINT nItem, LPSTYLEBUFW lpStyleBuf), FALSE)
|
DEFINE_IME_ENTRY(UINT, ImeGetRegisterWordStyle, (UINT nItem, LPVOID lpStyleBuf), FALSE)
|
||||||
DEFINE_IME_ENTRY(UINT, ImeEnumRegisterWord, (HKL hKL, REGISTERWORDENUMPROCW lpfnEnumProc, LPCVOID lpszReading, DWORD dwStyle, LPCVOID lpszString, LPVOID lpData), FALSE)
|
DEFINE_IME_ENTRY(UINT, ImeEnumRegisterWord, (HKL hKL, REGISTERWORDENUMPROCW lpfnEnumProc, LPCVOID lpszReading, DWORD dwStyle, LPCVOID lpszString, LPVOID lpData), FALSE)
|
||||||
DEFINE_IME_ENTRY(BOOL, ImeConfigure, (HKL hKL, HWND hWnd, DWORD dwMode, LPVOID lpData), FALSE)
|
DEFINE_IME_ENTRY(BOOL, ImeConfigure, (HKL hKL, HWND hWnd, DWORD dwMode, LPVOID lpData), FALSE)
|
||||||
DEFINE_IME_ENTRY(BOOL, ImeDestroy, (UINT uReserved), FALSE)
|
DEFINE_IME_ENTRY(BOOL, ImeDestroy, (UINT uReserved), FALSE)
|
||||||
|
|
Loading…
Reference in a new issue