Bug 276727 Implement disable/enable IME API r=roc, timeless, pinkerton, amardare and katakai, sr=roc

This commit is contained in:
masayuki%d-toybox.com 2005-08-18 04:09:13 +00:00
parent 3c64b87604
commit fcc8138442
13 changed files with 793 additions and 380 deletions

View File

@ -85,6 +85,20 @@ class nsIKBStateControl : public nsISupports {
*/
NS_IMETHOD GetIMEOpenState(PRBool* aState) = 0;
/*
* Set the state to 'Enabled' or 'Disabled'.
* If aState is TRUE, IME enable state is set to 'Enabled'.
* If aState is FALSE, set to 'Disabled'.
*/
NS_IMETHOD SetIMEEnabled(PRBool aState) = 0;
/*
* Get IME is 'Enabled' or 'Disabled'.
* If IME is 'Enabled', aState is set PR_TRUE.
* If IME is 'Disabled', aState is set PR_FALSE.
*/
NS_IMETHOD GetIMEEnabled(PRBool* aState) = 0;
/*
* Destruct and don't commit the IME composition string.
*/

View File

@ -252,6 +252,8 @@ public:
NS_IMETHOD ResetInputState();
NS_IMETHOD SetIMEOpenState(PRBool aState);
NS_IMETHOD GetIMEOpenState(PRBool* aState);
NS_IMETHOD SetIMEEnabled(PRBool aState);
NS_IMETHOD GetIMEEnabled(PRBool* aState);
NS_IMETHOD CancelIMEComposition();
protected:

View File

@ -2000,6 +2000,16 @@ NS_IMETHODIMP nsChildView::GetIMEOpenState(PRBool* aState)
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsChildView::SetIMEEnabled(PRBool aState)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsChildView::GetIMEEnabled(PRBool* aState)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
//
// Destruct and don't commit the IME composition string.
//

View File

@ -2394,6 +2394,14 @@ NS_IMETHODIMP nsWidget::GetIMEOpenState(PRBool* aState) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsWidget::SetIMEEnabled(PRBool aState) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsWidget::GetIMEEnabled(PRBool* aState) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsWidget::CancelIMEComposition() {
return NS_ERROR_NOT_IMPLEMENTED;
}

View File

@ -174,6 +174,8 @@ public:
NS_IMETHOD ResetInputState();
NS_IMETHOD SetIMEOpenState(PRBool aState);
NS_IMETHOD GetIMEOpenState(PRBool* aState);
NS_IMETHOD SetIMEEnabled(PRBool aState);
NS_IMETHOD GetIMEEnabled(PRBool* aState);
NS_IMETHOD CancelIMEComposition();
void InitEvent(nsGUIEvent& event, nsPoint* aPoint = nsnull);

View File

@ -2442,6 +2442,14 @@ NS_IMETHODIMP nsWindow::GetIMEOpenState(PRBool* aState) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsWindow::SetIMEEnabled(PRBool aState) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsWindow::GetIMEEnabled(PRBool* aState) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsWindow::CancelIMEComposition() {
return NS_ERROR_NOT_IMPLEMENTED;
}

View File

@ -229,6 +229,8 @@ public:
NS_IMETHOD ResetInputState();
NS_IMETHOD SetIMEOpenState(PRBool aState);
NS_IMETHOD GetIMEOpenState(PRBool* aState);
NS_IMETHOD SetIMEEnabled(PRBool aState);
NS_IMETHOD GetIMEEnabled(PRBool* aState);
NS_IMETHOD CancelIMEComposition();
protected:

View File

@ -240,6 +240,14 @@ NS_IMETHODIMP nsWidget::GetIMEOpenState(PRBool* aState) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsWidget::SetIMEEnabled(PRBool aState) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsWidget::GetIMEEnabled(PRBool* aState) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsWidget::CancelIMEComposition() {
return NS_ERROR_NOT_IMPLEMENTED;
}

View File

@ -216,6 +216,8 @@ public:
NS_IMETHOD ResetInputState();
NS_IMETHOD SetIMEOpenState(PRBool aState);
NS_IMETHOD GetIMEOpenState(PRBool* aState);
NS_IMETHOD SetIMEEnabled(PRBool aState);
NS_IMETHOD GetIMEEnabled(PRBool* aState);
NS_IMETHOD CancelIMEComposition();
inline void InitEvent(nsGUIEvent& event, PRUint32 aEventType, nsPoint* aPoint = nsnull)

View File

@ -20,6 +20,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Masayuki Nakano <masayuki@d-toybox.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -45,10 +46,6 @@
#include "nsIEventQueueService.h"
#include "nsIEventQueue.h"
#include "nsComponentManagerUtils.h"
// objbase.h must be declared before initguid.h to use the |DEFINE_GUID|'s in aimm.h
#include <objbase.h>
#include <initguid.h>
#include "aimm.h"
// unknwn.h is needed to build with WIN32_LEAN_AND_MEAN
#include <unknwn.h>
@ -1050,3 +1047,395 @@ void MouseTrailer::TimerProc(nsITimer* aTimer, void* aClosure)
}
}
//-------------------------------------------------------------------------
//
// nsIMM class(Native IMM wrapper)
//
//-------------------------------------------------------------------------
nsIMM&
nsIMM::LoadModule()
{
static nsIMM gIMM;
return gIMM;
}
//-------------------------------------------------------------------------
//
//
//-------------------------------------------------------------------------
nsIMM::nsIMM(const char* aModuleName /* = "IMM32.DLL" */)
{
#ifndef WINCE
mInstance=::LoadLibrary(aModuleName);
if (mInstance) {
mGetCompositionStringA =
(GetCompStrPtr)GetProcAddress(mInstance, "ImmGetCompositionStringA");
NS_ASSERTION(mGetCompositionStringA != NULL,
"nsIMM.ImmGetCompositionStringA failed.");
mGetCompositionStringW =
(GetCompStrPtr)GetProcAddress(mInstance, "ImmGetCompositionStringW");
NS_ASSERTION(mGetCompositionStringW != NULL,
"nsIMM.ImmGetCompositionStringW failed.");
mGetContext =
(GetContextPtr)GetProcAddress(mInstance, "ImmGetContext");
NS_ASSERTION(mGetContext != NULL,
"nsIMM.ImmGetContext failed.");
mReleaseContext =
(RelContextPtr)GetProcAddress(mInstance, "ImmReleaseContext");
NS_ASSERTION(mReleaseContext != NULL,
"nsIMM.ImmReleaseContext failed.");
mNotifyIME =
(NotifyIMEPtr)GetProcAddress(mInstance, "ImmNotifyIME");
NS_ASSERTION(mNotifyIME != NULL,
"nsIMM.ImmNotifyIME failed.");
mSetCandiateWindow =
(SetCandWindowPtr)GetProcAddress(mInstance, "ImmSetCandidateWindow");
NS_ASSERTION(mSetCandiateWindow != NULL,
"nsIMM.ImmSetCandidateWindow failed.");
mGetCompositionWindow =
(GetCompWindowPtr)GetProcAddress(mInstance, "ImmGetCompositionWindow");
NS_ASSERTION(mGetCompositionWindow != NULL,
"nsIMM.ImmGetCompositionWindow failed.");
mSetCompositionWindow =
(SetCompWindowPtr)GetProcAddress(mInstance, "ImmSetCompositionWindow");
NS_ASSERTION(mSetCompositionWindow != NULL,
"nsIMM.ImmSetCompositionWindow failed.");
mGetProperty =
(GetPropertyPtr)GetProcAddress(mInstance, "ImmGetProperty");
NS_ASSERTION(mGetProperty != NULL,
"nsIMM.ImmGetProperty failed.");
mGetDefaultIMEWnd =
(GetDefaultIMEWndPtr)GetProcAddress(mInstance, "ImmGetDefaultIMEWnd");
NS_ASSERTION(mGetDefaultIMEWnd != NULL,
"nsIMM.ImmGetDefaultIMEWnd failed.");
mGetOpenStatus =
(GetOpenStatusPtr)GetProcAddress(mInstance,"ImmGetOpenStatus");
NS_ASSERTION(mGetOpenStatus != NULL,
"nsIMM.ImmGetOpenStatus failed.");
mSetOpenStatus =
(SetOpenStatusPtr)GetProcAddress(mInstance,"ImmSetOpenStatus");
NS_ASSERTION(mSetOpenStatus != NULL,
"nsIMM.ImmSetOpenStatus failed.");
} else {
mGetCompositionStringA=NULL;
mGetCompositionStringW=NULL;
mGetContext=NULL;
mReleaseContext=NULL;
mNotifyIME=NULL;
mSetCandiateWindow=NULL;
mGetCompositionWindow=NULL;
mSetCompositionWindow=NULL;
mGetProperty=NULL;
mGetDefaultIMEWnd=NULL;
mGetOpenStatus=NULL;
mSetOpenStatus=NULL;
}
#elif WINCE_EMULATOR
mInstance=NULL;
mGetCompositionStringA=NULL;
mGetCompositionStringW=NULL;
mGetContext=NULL;
mReleaseContext=NULL;
mNotifyIME=NULL;
mSetCandiateWindow=NULL;
mGetCompositionWindow=NULL;
mSetCompositionWindow=NULL;
mGetProperty=NULL;
mGetDefaultIMEWnd=NULL;
mGetOpenStatus=NULL;
mSetOpenStatus=NULL;
#else // WinCE
mInstance=NULL;
mGetCompositionStringA=NULL;
mGetCompositionStringW=(GetCompStrPtr)ImmGetCompositionStringW;
mGetContext=(GetContextPtr)ImmGetContext;
mReleaseContext=(RelContextPtr)ImmReleaseContext;
mNotifyIME=(NotifyIMEPtr)ImmNotifyIME;
mSetCandiateWindow=(SetCandWindowPtr)ImmSetCandidateWindow;
mGetCompositionWindow=(GetCompWindowPtr)ImmGetCompositionWindow;
mSetCompositionWindow=(SetCompWindowPtr)ImmSetCompositionWindow;
mGetProperty=(GetPropertyPtr)ImmGetProperty;
mGetDefaultIMEWnd=(GetDefaultIMEWndPtr)ImmGetDefaultIMEWnd;
mGetOpenStatus=(GetOpenStatusPtr)ImmGetOpenStatus;
mSetOpenStatus=(SetOpenStatusPtr)ImmSetOpenStatus;
#endif
}
//-------------------------------------------------------------------------
//
//
//-------------------------------------------------------------------------
nsIMM::~nsIMM()
{
if(mInstance)
::FreeLibrary(mInstance);
mGetCompositionStringA=NULL;
mGetCompositionStringW=NULL;
mGetContext=NULL;
mReleaseContext=NULL;
mNotifyIME=NULL;
mSetCandiateWindow=NULL;
mGetCompositionWindow=NULL;
mSetCompositionWindow=NULL;
mGetProperty=NULL;
mGetDefaultIMEWnd=NULL;
mGetOpenStatus=NULL;
mSetOpenStatus=NULL;
}
//-------------------------------------------------------------------------
//
//
//-------------------------------------------------------------------------
LONG
nsIMM::GetCompositionStringA(HIMC aIMC, DWORD aIndex,
LPVOID aBuf, DWORD aBufLen)
{
return (mGetCompositionStringA) ?
mGetCompositionStringA(aIMC, aIndex, aBuf, aBufLen) : 0L;
}
//-------------------------------------------------------------------------
//
//
//-------------------------------------------------------------------------
LONG
nsIMM::GetCompositionStringW(HIMC aIMC, DWORD aIndex,
LPVOID aBuf, DWORD aBufLen)
{
return (mGetCompositionStringW) ?
mGetCompositionStringW(aIMC, aIndex, aBuf, aBufLen) : 0L;
}
//-------------------------------------------------------------------------
//
//
//-------------------------------------------------------------------------
LONG
nsIMM::GetContext(HWND aWnd)
{
return (mGetContext) ? mGetContext(aWnd) : 0L;
}
//-------------------------------------------------------------------------
//
//
//-------------------------------------------------------------------------
LONG
nsIMM::ReleaseContext(HWND aWnd, HIMC aIMC)
{
return (mReleaseContext) ? mReleaseContext(aWnd, aIMC) : 0L;
}
//-------------------------------------------------------------------------
//
//
//-------------------------------------------------------------------------
LONG
nsIMM::NotifyIME(HIMC aIMC, DWORD aAction, DWORD aIndex, DWORD aValue)
{
return (mNotifyIME) ? mNotifyIME(aIMC, aAction, aIndex, aValue) : 0L;
}
//-------------------------------------------------------------------------
//
//
//-------------------------------------------------------------------------
LONG
nsIMM::SetCandidateWindow(HIMC aIMC, LPCANDIDATEFORM aCandidateForm)
{
return (mSetCandiateWindow) ?
mSetCandiateWindow(aIMC, aCandidateForm) : 0L;
}
//-------------------------------------------------------------------------
//
//
//-------------------------------------------------------------------------
LONG
nsIMM::SetCompositionWindow(HIMC aIMC, LPCOMPOSITIONFORM aCompositionForm)
{
return (mSetCompositionWindow) ?
mSetCompositionWindow(aIMC, aCompositionForm) : 0L;
}
//-------------------------------------------------------------------------
//
//
//-------------------------------------------------------------------------
LONG
nsIMM::GetCompositionWindow(HIMC aIMC, LPCOMPOSITIONFORM aCompositionForm)
{
return (mGetCompositionWindow) ?
mGetCompositionWindow(aIMC, aCompositionForm) : 0L;
}
//-------------------------------------------------------------------------
//
//
//-------------------------------------------------------------------------
LONG
nsIMM::GetProperty(HKL aKL, DWORD aIndex)
{
return (mGetProperty) ? mGetProperty(aKL, aIndex) : 0L;
}
//-------------------------------------------------------------------------
//
//
//-------------------------------------------------------------------------
LONG
nsIMM::GetDefaultIMEWnd(HWND aWnd)
{
return (mGetDefaultIMEWnd) ? mGetDefaultIMEWnd(aWnd) : 0L;
}
//-------------------------------------------------------------------------
//
//
//-------------------------------------------------------------------------
BOOL
nsIMM::GetOpenStatus(HIMC aIMC)
{
return (mGetOpenStatus) ? mGetOpenStatus(aIMC) : FALSE;
}
//-------------------------------------------------------------------------
//
//
//-------------------------------------------------------------------------
BOOL
nsIMM::SetOpenStatus(HIMC aIMC, BOOL aStatus)
{
return (mSetOpenStatus) ? mSetOpenStatus(aIMC, aStatus) : FALSE;
}
//-------------------------------------------------------------------------
//
// nsWinNLS class(Native WinNLS wrapper)
//
//-------------------------------------------------------------------------
nsWinNLS&
nsWinNLS::LoadModule()
{
static nsWinNLS gWinNLS;
return gWinNLS;
}
//-------------------------------------------------------------------------
//
//
//-------------------------------------------------------------------------
nsWinNLS::nsWinNLS(const char* aModuleName /* = "USER32.DLL" */)
{
#ifndef WINCE
mInstance=::LoadLibrary(aModuleName);
if (mInstance) {
mWINNLSEnableIME =
(WINNLSEnableIMEPtr)GetProcAddress(mInstance, "WINNLSEnableIME");
NS_ASSERTION(mWINNLSEnableIME != NULL,
"nsWinNLS.WINNLSEnableIME failed.");
mWINNLSGetEnableStatus =
(WINNLSGetEnableStatusPtr)GetProcAddress(mInstance,
"WINNLSGetEnableStatus");
NS_ASSERTION(mWINNLSGetEnableStatus != NULL,
"nsWinNLS.WINNLSGetEnableStatus failed.");
} else {
mWINNLSEnableIME = NULL;
mWINNLSGetEnableStatus = NULL;
}
#elif WINCE_EMULATOR
mInstance = NULL;
mWINNLSEnableIME = NULL;
mWINNLSGetEnableStatus = NULL;
#else // WinCE
mInstance = NULL;
mWINNLSEnableIME = NULL;
mWINNLSGetEnableStatus = NULL;
// XXX If WINNLSEnableIME and WINNLSGetEnableStatus can be used on WinCE,
// Should use these.
// mWINNLSEnableIME = (WINNLSEnableIMEPtr)WINNLSEnableIME;
// mWINNLSGetEnableStatus = (WINNLSGetEnableStatusPtr)WINNLSGetEnableStatus;
#endif
}
//-------------------------------------------------------------------------
//
//
//-------------------------------------------------------------------------
nsWinNLS::~nsWinNLS()
{
if(mInstance)
::FreeLibrary(mInstance);
mWINNLSEnableIME = NULL;
mWINNLSGetEnableStatus = NULL;
}
//-------------------------------------------------------------------------
//
//
//-------------------------------------------------------------------------
PRBool
nsWinNLS::SetIMEEnableStatus(HWND aWnd, PRBool aState)
{
// If mWINNLSEnableIME wasn't loaded, we should return PR_TRUE.
// If we cannot load it, we cannot disable the IME. So, the IME enable state
// is *always* TRUE.
return (mWINNLSEnableIME) ? !!mWINNLSEnableIME(aWnd, aState) : PR_TRUE;
}
//-------------------------------------------------------------------------
//
//
//-------------------------------------------------------------------------
PRBool
nsWinNLS::GetIMEEnableStatus(HWND aWnd)
{
// If mWINNLSGetEnableStatus wasn't loaded, we should return PR_TRUE.
// If we cannot load it, maybe we cannot load mWINNLSEnableIME too.
// So, if mWINNLSEnableIME wasn't loaded, the IME enable state is always TRUE.
return (mWINNLSGetEnableStatus) ? !!mWINNLSGetEnableStatus(aWnd) : PR_TRUE;
}
//-------------------------------------------------------------------------
//
//
//-------------------------------------------------------------------------
PRBool
nsWinNLS::CanUseSetIMEEnableStatus()
{
return (mWINNLSEnableIME) ? PR_TRUE : PR_FALSE;
}
//-------------------------------------------------------------------------
//
//
//-------------------------------------------------------------------------
PRBool
nsWinNLS::CanUseGetIMEEnableStatus()
{
return (mWINNLSGetEnableStatus) ? PR_TRUE : PR_FALSE;
}

View File

@ -20,6 +20,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Masayuki Nakano <masayuki@d-toybox.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -47,6 +48,12 @@ struct IActiveIMMApp;
#include "nsITimer.h"
#include "nsCOMPtr.h"
// objbase.h must be declared before initguid.h to use the |DEFINE_GUID|'s in aimm.h
#include <objbase.h>
#include <initguid.h>
#include "aimm.h"
#include <imm.h>
struct MethodInfo;
class nsIEventQueue;
@ -190,4 +197,306 @@ private:
};
//-------------------------------------------------------------------------
//
// Native IMM wrapper
//
//-------------------------------------------------------------------------
class nsIMM
{
//prototypes for DLL function calls...
typedef LONG (CALLBACK *GetCompStrPtr) (HIMC, DWORD, LPVOID, DWORD);
typedef LONG (CALLBACK *GetContextPtr) (HWND);
typedef LONG (CALLBACK *RelContextPtr) (HWND, HIMC);
typedef LONG (CALLBACK *NotifyIMEPtr) (HIMC, DWORD, DWORD, DWORD);
typedef LONG (CALLBACK *SetCandWindowPtr) (HIMC, LPCANDIDATEFORM);
typedef LONG (CALLBACK *SetCompWindowPtr) (HIMC, LPCOMPOSITIONFORM);
typedef LONG (CALLBACK *GetCompWindowPtr) (HIMC, LPCOMPOSITIONFORM);
typedef LONG (CALLBACK *GetPropertyPtr) (HKL, DWORD);
typedef LONG (CALLBACK *GetDefaultIMEWndPtr) (HWND);
typedef BOOL (CALLBACK *GetOpenStatusPtr) (HIMC);
typedef BOOL (CALLBACK *SetOpenStatusPtr) (HIMC, BOOL);
public:
static nsIMM& LoadModule();
nsIMM(const char* aModuleName="IMM32.DLL");
~nsIMM();
LONG GetCompositionStringA(HIMC aIMC, DWORD aIndex,
LPVOID aBuf, DWORD aBufLen);
LONG GetCompositionStringW(HIMC aIMC, DWORD aIndex,
LPVOID aBuf, DWORD aBufLen);
LONG GetContext(HWND aWnd);
LONG ReleaseContext(HWND aWnd, HIMC aIMC);
LONG NotifyIME(HIMC aIMC, DWORD aAction, DWORD aIndex, DWORD aValue);
LONG SetCandidateWindow(HIMC aIMC, LPCANDIDATEFORM aCandidateForm);
LONG SetCompositionWindow(HIMC aIMC, LPCOMPOSITIONFORM aCompositionForm);
LONG GetCompositionWindow(HIMC aIMC,LPCOMPOSITIONFORM aCompositionForm);
LONG GetProperty(HKL aKL, DWORD aIndex);
LONG GetDefaultIMEWnd(HWND aWnd);
BOOL GetOpenStatus(HIMC aIMC);
BOOL SetOpenStatus(HIMC aIMC, BOOL aStatus);
private:
HINSTANCE mInstance;
GetCompStrPtr mGetCompositionStringA;
GetCompStrPtr mGetCompositionStringW;
GetContextPtr mGetContext;
RelContextPtr mReleaseContext;
NotifyIMEPtr mNotifyIME;
SetCandWindowPtr mSetCandiateWindow;
SetCompWindowPtr mSetCompositionWindow;
GetCompWindowPtr mGetCompositionWindow;
GetPropertyPtr mGetProperty;
GetDefaultIMEWndPtr mGetDefaultIMEWnd;
GetOpenStatusPtr mGetOpenStatus;
SetOpenStatusPtr mSetOpenStatus;
};
//-------------------------------------------------------------------------
//
// Native WinNLS wrapper
//
//-------------------------------------------------------------------------
class nsWinNLS
{
//prototypes for DLL function calls...
typedef LONG (CALLBACK *WINNLSEnableIMEPtr) (HWND, BOOL);
typedef LONG (CALLBACK *WINNLSGetEnableStatusPtr) (HWND);
public:
static nsWinNLS& LoadModule();
nsWinNLS(const char* aModuleName = "USER32.DLL");
~nsWinNLS();
PRBool SetIMEEnableStatus(HWND aWnd, PRBool aState);
PRBool GetIMEEnableStatus(HWND aWnd);
PRBool CanUseSetIMEEnableStatus();
PRBool CanUseGetIMEEnableStatus();
private:
HINSTANCE mInstance;
WINNLSEnableIMEPtr mWINNLSEnableIME;
WINNLSGetEnableStatusPtr mWINNLSGetEnableStatus;
};
//-------------------------------------------------------------------------
//
// Macro for Active Input Method Manager (AIMM) support.
// Use AIMM method instead of Win32 Imm APIs.
//
//-------------------------------------------------------------------------
#define NS_IMM_GETCOMPOSITIONSTRINGA(hIMC, dwIndex, pBuf, \
dwBufLen, compStrLen) \
{ \
compStrLen = 0; \
if (nsToolkit::gAIMMApp) \
nsToolkit::gAIMMApp->GetCompositionStringA(hIMC, dwIndex, \
dwBufLen, &(compStrLen), \
pBuf); \
else { \
nsIMM &theIMM = nsIMM::LoadModule(); \
compStrLen = \
theIMM.GetCompositionStringA(hIMC, dwIndex, pBuf, dwBufLen); \
} \
}
#define NS_IMM_GETCOMPOSITIONSTRINGW(hIMC, dwIndex, pBuf, \
dwBufLen, compStrLen) \
{ \
compStrLen = 0; \
if (nsToolkit::gAIMMApp) \
nsToolkit::gAIMMApp->GetCompositionStringW(hIMC, dwIndex, \
dwBufLen, &(compStrLen), \
pBuf); \
else { \
nsIMM &theIMM = nsIMM::LoadModule(); \
compStrLen = \
theIMM.GetCompositionStringW(hIMC, dwIndex, pBuf, dwBufLen); \
} \
}
#define NS_IMM_GETCONTEXT(hWnd, hIMC) \
{ \
hIMC = NULL; \
if (nsToolkit::gAIMMApp) \
nsToolkit::gAIMMApp->GetContext(hWnd, &(hIMC)); \
else { \
nsIMM& theIMM = nsIMM::LoadModule(); \
hIMC = (HIMC)theIMM.GetContext(hWnd); \
} \
}
#define NS_IMM_RELEASECONTEXT(hWnd, hIMC) \
{ \
if (nsToolkit::gAIMMApp) \
nsToolkit::gAIMMApp->ReleaseContext(hWnd, hIMC); \
else { \
nsIMM &theIMM = nsIMM::LoadModule(); \
theIMM.ReleaseContext(hWnd, hIMC); \
} \
}
#define NS_IMM_NOTIFYIME(hIMC, dwAction, dwIndex, dwValue, bRtn) \
{ \
bRtn = TRUE; \
if (nsToolkit::gAIMMApp) { \
bRtn = (nsToolkit::gAIMMApp->NotifyIME(hIMC, dwAction, \
dwIndex, dwValue) == S_OK); \
}\
else { \
nsIMM &theIMM = nsIMM::LoadModule(); \
(theIMM.NotifyIME(hIMC, dwAction, dwIndex, dwValue)); \
} \
}
#define NS_IMM_SETCANDIDATEWINDOW(hIMC, candForm) \
{ \
if (nsToolkit::gAIMMApp) \
nsToolkit::gAIMMApp->SetCandidateWindow(hIMC, candForm); \
else { \
nsIMM &theIMM = nsIMM::LoadModule(); \
theIMM.SetCandidateWindow(hIMC, candForm); \
} \
}
#define NS_IMM_SETCOMPOSITIONWINDOW(hIMC, compForm) \
{ \
if (nsToolkit::gAIMMApp) \
nsToolkit::gAIMMApp->SetCompositionWindow(hIMC, compForm); \
else { \
nsIMM &theIMM = nsIMM::LoadModule(); \
theIMM.SetCompositionWindow(hIMC, compForm); \
} \
}
#define NS_IMM_GETCOMPOSITIONWINDOW(hIMC, compForm) \
{ \
if (nsToolkit::gAIMMApp) \
nsToolkit::gAIMMApp->GetCompositionWindow(hIMC, compForm); \
else { \
nsIMM &theIMM = nsIMM::LoadModule(); \
theIMM.GetCompositionWindow(hIMC, compForm); \
} \
}
#define NS_IMM_GETPROPERTY(hKL, dwIndex, dwProp) \
{ \
if (nsToolkit::gAIMMApp) \
nsToolkit::gAIMMApp->GetProperty(hKL, dwIndex, &(dwProp)); \
else { \
nsIMM& theIMM = nsIMM::LoadModule(); \
dwProp = (DWORD)theIMM.GetProperty(hKL, dwIndex); \
} \
}
#define NS_IMM_GETDEFAULTIMEWND(hWnd, phDefWnd) \
{ \
if (nsToolkit::gAIMMApp) \
return nsToolkit::gAIMMApp->GetDefaultIMEWnd(hWnd, phDefWnd); \
else { \
nsIMM& theIMM = nsIMM::LoadModule(); \
*(phDefWnd) = (HWND)theIMM.GetDefaultIMEWnd(hWnd); \
} \
}
#define NS_IMM_GETOPENSTATUS(hIMC, bRtn) \
{ \
if (nsToolkit::gAIMMApp) \
bRtn = nsToolkit::gAIMMApp->GetOpenStatus(hIMC); \
else { \
nsIMM& theIMM = nsIMM::LoadModule(); \
bRtn = theIMM.GetOpenStatus(hIMC); \
} \
}
#define NS_IMM_SETOPENSTATUS(hIMC, bOpen) \
{ \
if (nsToolkit::gAIMMApp) \
nsToolkit::gAIMMApp->SetOpenStatus(hIMC, bOpen); \
else { \
nsIMM& theIMM = nsIMM::LoadModule(); \
theIMM.SetOpenStatus(hIMC, bOpen); \
} \
}
//-------------------------------------------------------------------------
//
// Macro for Input Method A/W conversion.
//
// On Windows 2000, ImmGetCompositionStringA() doesn't work well using IME of
// different code page. (See BUG # 29606)
// And ImmGetCompositionStringW() doesn't work on Windows 9x.
//
//-------------------------------------------------------------------------
#define NS_IMM_GETCOMPOSITIONSTRING(hIMC, dwIndex, cBuf, dwBufLen, lRtn) \
{ \
if (nsToolkit::mUseImeApiW) { \
NS_IMM_GETCOMPOSITIONSTRINGW(hIMC, dwIndex, cBuf, dwBufLen, lRtn); \
} else { \
NS_IMM_GETCOMPOSITIONSTRINGA(hIMC, dwIndex, cBuf, dwBufLen, lRtn); \
} \
}
//-------------------------------------------------------------------------
//
// related WM_IME_REQUEST definition.
// VC++5.0 header doesn't have reconversion structure and message.
//
//-------------------------------------------------------------------------
#ifndef WM_IME_REQUEST
typedef struct tagRECONVERTSTRING {
DWORD dwSize;
DWORD dwVersion;
DWORD dwStrLen;
DWORD dwStrOffset;
DWORD dwCompStrLen;
DWORD dwCompStrOffset;
DWORD dwTargetStrLen;
DWORD dwTargetStrOffset;
} RECONVERTSTRING, FAR * LPRECONVERTSTRING;
typedef struct tagIMECHARPOSITION {
DWORD dwSize;
DWORD dwCharPos;
POINT pt;
UINT cLineHeight;
RECT rcDocument;
} IMECHARPOSITION, *PIMECHARPOSITION;
#define IMR_RECONVERTSTRING 0x0004
#define IMR_QUERYCHARPOSITION 0x0006
#define WM_IME_REQUEST 0x0288
#endif // #ifndef WM_IME_REQUEST
//-------------------------------------------------------------------------
//
// from http://msdn.microsoft.com/library/specs/msime.h
//
//-------------------------------------------------------------------------
#define RWM_RECONVERT TEXT("MSIMEReconvert")
#define RWM_MOUSE TEXT("MSIMEMouseOperation")
#define IMEMOUSE_NONE 0x00 // no mouse button was pushed
#define IMEMOUSE_LDOWN 0x01
#define IMEMOUSE_RDOWN 0x02
#define IMEMOUSE_MDOWN 0x04
#define IMEMOUSE_WUP 0x10 // wheel up
#define IMEMOUSE_WDOWN 0x20 // wheel down
//-------------------------------------------------------------------------
//
// from http://www.justsystem.co.jp/tech/atok/api12_04.html#4_11
//
//-------------------------------------------------------------------------
#define MSGNAME_ATOK_RECONVERT TEXT("Atok Message for ReconvertString")
#endif // TOOLKIT_H

View File

@ -105,9 +105,6 @@
#endif
#endif
#include <imm.h>
#include "aimm.h"
#include "nsNativeDragTarget.h"
#include "nsIRollupListener.h"
#include "nsIMenuRollup.h"
@ -427,200 +424,8 @@ static PRBool is_vk_down(int vk)
#define IME_X_OFFSET 0
#define IME_Y_OFFSET 0
#define IS_IME_CODEPAGE(cp) ((932==(cp))||(936==(cp))||(949==(cp))||(950==(cp)))
//
// Macro for Active Input Method Manager (AIMM) support.
// Use AIMM method instead of Win32 Imm APIs.
//
#define NS_IMM_GETCOMPOSITIONSTRINGA(hIMC, dwIndex, pBuf, dwBufLen, compStrLen) \
{ \
compStrLen = 0; \
if (nsToolkit::gAIMMApp) \
nsToolkit::gAIMMApp->GetCompositionStringA(hIMC, dwIndex, dwBufLen, &(compStrLen), pBuf); \
else { \
nsIMM &theIMM = nsIMM::LoadModule(); \
compStrLen = theIMM.GetCompositionStringA(hIMC, dwIndex, pBuf, dwBufLen); \
} \
}
#define NS_IMM_GETCOMPOSITIONSTRINGW(hIMC, dwIndex, pBuf, dwBufLen, compStrLen) \
{ \
compStrLen = 0; \
if (nsToolkit::gAIMMApp) \
nsToolkit::gAIMMApp->GetCompositionStringW(hIMC, dwIndex, dwBufLen, &(compStrLen), pBuf); \
else { \
nsIMM &theIMM = nsIMM::LoadModule(); \
compStrLen = theIMM.GetCompositionStringW(hIMC, dwIndex, pBuf, dwBufLen); \
} \
}
#define NS_IMM_GETCONTEXT(hWnd, hIMC) \
{ \
hIMC = NULL; \
if (nsToolkit::gAIMMApp) \
nsToolkit::gAIMMApp->GetContext(hWnd, &(hIMC)); \
else { \
nsIMM& theIMM = nsIMM::LoadModule(); \
hIMC = (HIMC)theIMM.GetContext(hWnd); \
} \
}
#define NS_IMM_RELEASECONTEXT(hWnd, hIMC) \
{ \
if (nsToolkit::gAIMMApp) \
nsToolkit::gAIMMApp->ReleaseContext(hWnd, hIMC); \
else { \
nsIMM &theIMM = nsIMM::LoadModule(); \
theIMM.ReleaseContext(hWnd, hIMC); \
} \
}
#define NS_IMM_NOTIFYIME(hIMC, dwAction, dwIndex, dwValue, bRtn) \
{ \
bRtn = TRUE; \
if (nsToolkit::gAIMMApp) { \
bRtn = (nsToolkit::gAIMMApp->NotifyIME(hIMC, dwAction, dwIndex, dwValue) == S_OK); \
}\
else { \
nsIMM &theIMM = nsIMM::LoadModule(); \
(theIMM.NotifyIME(hIMC, dwAction, dwIndex, dwValue)); \
} \
}
#define NS_IMM_SETCANDIDATEWINDOW(hIMC, candForm) \
{ \
if (nsToolkit::gAIMMApp) \
nsToolkit::gAIMMApp->SetCandidateWindow(hIMC, candForm); \
else { \
nsIMM &theIMM = nsIMM::LoadModule(); \
theIMM.SetCandidateWindow(hIMC, candForm); \
} \
}
#define NS_IMM_SETCOMPOSITIONWINDOW(hIMC, compForm) \
{ \
if (nsToolkit::gAIMMApp) \
nsToolkit::gAIMMApp->SetCompositionWindow(hIMC, compForm); \
else { \
nsIMM &theIMM = nsIMM::LoadModule(); \
theIMM.SetCompositionWindow(hIMC, compForm); \
} \
}
#define NS_IMM_GETCOMPOSITIONWINDOW(hIMC, compForm) \
{ \
if (nsToolkit::gAIMMApp) \
nsToolkit::gAIMMApp->GetCompositionWindow(hIMC, compForm); \
else { \
nsIMM &theIMM = nsIMM::LoadModule(); \
theIMM.GetCompositionWindow(hIMC, compForm); \
} \
}
#define NS_IMM_GETPROPERTY(hKL, dwIndex, dwProp) \
{ \
if (nsToolkit::gAIMMApp) \
nsToolkit::gAIMMApp->GetProperty(hKL, dwIndex, &(dwProp)); \
else { \
nsIMM& theIMM = nsIMM::LoadModule(); \
dwProp = (DWORD)theIMM.GetProperty(hKL, dwIndex); \
} \
}
#define NS_IMM_GETDEFAULTIMEWND(hWnd, phDefWnd) \
{ \
if (nsToolkit::gAIMMApp) \
return nsToolkit::gAIMMApp->GetDefaultIMEWnd(hWnd, phDefWnd); \
else { \
nsIMM& theIMM = nsIMM::LoadModule(); \
*(phDefWnd) = (HWND)theIMM.GetDefaultIMEWnd(hWnd); \
} \
}
#define NS_IMM_GETOPENSTATUS(hIMC, bRtn) \
{ \
if (nsToolkit::gAIMMApp) \
bRtn = nsToolkit::gAIMMApp->GetOpenStatus(hIMC); \
else { \
nsIMM& theIMM = nsIMM::LoadModule(); \
bRtn = theIMM.GetOpenStatus(hIMC); \
} \
}
#define NS_IMM_SETOPENSTATUS(hIMC, bOpen) \
{ \
if (nsToolkit::gAIMMApp) \
nsToolkit::gAIMMApp->SetOpenStatus(hIMC, bOpen); \
else { \
nsIMM& theIMM = nsIMM::LoadModule(); \
theIMM.SetOpenStatus(hIMC, bOpen); \
} \
}
//
// Macro for Input Method A/W conversion.
//
// On Windows 2000, ImmGetCompositionStringA() doesn't work well using IME of
// different code page. (See BUG # 29606)
// And ImmGetCompositionStringW() doesn't work on Windows 9x.
//
#define NS_IMM_GETCOMPOSITIONSTRING(hIMC, dwIndex, cBuf, dwBufLen, lRtn) \
{ \
if (nsToolkit::mUseImeApiW) { \
NS_IMM_GETCOMPOSITIONSTRINGW(hIMC, dwIndex, cBuf, dwBufLen, lRtn); \
} else { \
NS_IMM_GETCOMPOSITIONSTRINGA(hIMC, dwIndex, cBuf, dwBufLen, lRtn); \
} \
}
//
// for reconversion define
//
// VC++5.0 header doesn't have reconvertion structure and message.
#ifndef WM_IME_REQUEST
typedef struct tagRECONVERTSTRING {
DWORD dwSize;
DWORD dwVersion;
DWORD dwStrLen;
DWORD dwStrOffset;
DWORD dwCompStrLen;
DWORD dwCompStrOffset;
DWORD dwTargetStrLen;
DWORD dwTargetStrOffset;
} RECONVERTSTRING, FAR * LPRECONVERTSTRING;
typedef struct tagIMECHARPOSITION {
DWORD dwSize;
DWORD dwCharPos;
POINT pt;
UINT cLineHeight;
RECT rcDocument;
} IMECHARPOSITION, *PIMECHARPOSITION;
#define IMR_RECONVERTSTRING 0x0004
#define IMR_QUERYCHARPOSITION 0x0006
#define WM_IME_REQUEST 0x0288
#endif
// from http://msdn.microsoft.com/library/specs/msime.h
#define RWM_RECONVERT TEXT("MSIMEReconvert")
#define RWM_MOUSE TEXT("MSIMEMouseOperation")
#define IMEMOUSE_NONE 0x00 // no mouse button was pushed
#define IMEMOUSE_LDOWN 0x01
#define IMEMOUSE_RDOWN 0x02
#define IMEMOUSE_MDOWN 0x04
#define IMEMOUSE_WUP 0x10 // wheel up
#define IMEMOUSE_WDOWN 0x20 // wheel down
// from http://www.justsystem.co.jp/tech/atok/api12_04.html#4_11
#define MSGNAME_ATOK_RECONVERT TEXT("Atok Message for ReconvertString")
//
// App Command messages for IntelliMouse and Natural Keyboard Pro
//
@ -7385,6 +7190,39 @@ NS_IMETHODIMP nsWindow::GetIMEOpenState(PRBool* aState)
return NS_OK;
}
//==========================================================================
NS_IMETHODIMP nsWindow::SetIMEEnabled(PRBool aState)
{
if (sIMEIsComposing)
ResetInputState();
nsWinNLS &theWinNLS = nsWinNLS::LoadModule();
if (!theWinNLS.CanUseSetIMEEnableStatus()) {
#ifndef WINCE
NS_WARNING("WINNLSEnableIME API is not loaded.");
#endif
return NS_ERROR_FAILURE;
}
PRBool lastStatus = theWinNLS.SetIMEEnableStatus(mWnd, aState);
if (aState && !lastStatus)
::SendMessage(mWnd, WM_IME_NOTIFY, IMN_OPENSTATUSWINDOW, 0L);
return NS_OK;
}
//==========================================================================
NS_IMETHODIMP nsWindow::GetIMEEnabled(PRBool* aState)
{
nsWinNLS &theWinNLS = nsWinNLS::LoadModule();
if (!theWinNLS.CanUseGetIMEEnableStatus()) {
#ifndef WINCE
NS_WARNING("WINNLSGetEnableStatus API is not loaded.");
#endif
return NS_ERROR_FAILURE;
}
*aState = !!theWinNLS.GetIMEEnableStatus(mWnd);
return NS_OK;
}
//==========================================================================
NS_IMETHODIMP nsWindow::CancelIMEComposition()
{

View File

@ -57,8 +57,6 @@
#include "nsVoidArray.h"
#include <imm.h>
class nsNativeDragTarget;
class nsIRollupListener;
@ -97,185 +95,6 @@ const LPCSTR kClassNameContent = "MozillaContentWindowClass";
const LPCSTR kClassNameContentFrame = "MozillaContentFrameWindowClass";
const LPCSTR kClassNameGeneral = "MozillaWindowClass";
/**
* Native IMM wrapper
*/
class nsIMM
{
//prototypes for DLL function calls...
typedef LONG (CALLBACK *GetCompStrPtr) (HIMC, DWORD, LPVOID, DWORD);
typedef LONG (CALLBACK *GetContextPtr) (HWND);
typedef LONG (CALLBACK *RelContextPtr) (HWND, HIMC);
typedef LONG (CALLBACK *NotifyIMEPtr) (HIMC, DWORD, DWORD, DWORD);
typedef LONG (CALLBACK *SetCandWindowPtr)(HIMC, LPCANDIDATEFORM);
typedef LONG (CALLBACK *SetCompWindowPtr)(HIMC, LPCOMPOSITIONFORM);
typedef LONG (CALLBACK *GetCompWindowPtr)(HIMC, LPCOMPOSITIONFORM);
typedef LONG (CALLBACK *GetPropertyPtr) (HKL, DWORD);
typedef LONG (CALLBACK *GetDefaultIMEWndPtr) (HWND);
typedef BOOL (CALLBACK *GetOpenStatusPtr) (HIMC);
typedef BOOL (CALLBACK *SetOpenStatusPtr) (HIMC, BOOL);
public:
static nsIMM& LoadModule() {
static nsIMM gIMM;
return gIMM;
}
nsIMM(const char* aModuleName="IMM32.DLL") {
#ifndef WINCE
mInstance=::LoadLibrary(aModuleName);
NS_ASSERTION(mInstance!=NULL, "nsIMM.LoadLibrary failed.");
mGetCompositionStringA=(mInstance) ? (GetCompStrPtr)GetProcAddress(mInstance, "ImmGetCompositionStringA") : 0;
NS_ASSERTION(mGetCompositionStringA!=NULL, "nsIMM.ImmGetCompositionStringA failed.");
mGetCompositionStringW=(mInstance) ? (GetCompStrPtr)GetProcAddress(mInstance, "ImmGetCompositionStringW") : 0;
NS_ASSERTION(mGetCompositionStringW!=NULL, "nsIMM.ImmGetCompositionStringW failed.");
mGetContext=(mInstance) ? (GetContextPtr)GetProcAddress(mInstance, "ImmGetContext") : 0;
NS_ASSERTION(mGetContext!=NULL, "nsIMM.ImmGetContext failed.");
mReleaseContext=(mInstance) ? (RelContextPtr)GetProcAddress(mInstance, "ImmReleaseContext") : 0;
NS_ASSERTION(mReleaseContext!=NULL, "nsIMM.ImmReleaseContext failed.");
mNotifyIME=(mInstance) ? (NotifyIMEPtr)GetProcAddress(mInstance, "ImmNotifyIME") : 0;
NS_ASSERTION(mNotifyIME!=NULL, "nsIMM.ImmNotifyIME failed.");
mSetCandiateWindow=(mInstance) ? (SetCandWindowPtr)GetProcAddress(mInstance, "ImmSetCandidateWindow") : 0;
NS_ASSERTION(mSetCandiateWindow!=NULL, "nsIMM.ImmSetCandidateWindow failed.");
mGetCompositionWindow=(mInstance) ? (GetCompWindowPtr)GetProcAddress(mInstance, "ImmGetCompositionWindow") : 0;
NS_ASSERTION(mGetCompositionWindow!=NULL, "nsIMM.ImmGetCompositionWindow failed.");
mSetCompositionWindow=(mInstance) ? (SetCompWindowPtr)GetProcAddress(mInstance, "ImmSetCompositionWindow") : 0;
NS_ASSERTION(mSetCompositionWindow!=NULL, "nsIMM.ImmSetCompositionWindow failed.");
mGetProperty=(mInstance) ? (GetPropertyPtr)GetProcAddress(mInstance, "ImmGetProperty") : 0;
NS_ASSERTION(mGetProperty!=NULL, "nsIMM.ImmGetProperty failed.");
mGetDefaultIMEWnd=(mInstance) ? (GetDefaultIMEWndPtr)GetProcAddress(mInstance, "ImmGetDefaultIMEWnd") : 0;
NS_ASSERTION(mGetDefaultIMEWnd!=NULL, "nsIMM.ImmGetDefaultIMEWnd failed.");
mGetOpenStatus=(mInstance) ? (GetOpenStatusPtr)GetProcAddress(mInstance,"ImmGetOpenStatus") : 0;
NS_ASSERTION(mGetOpenStatus!=NULL, "nsIMM.ImmGetOpenStatus failed.");
mSetOpenStatus=(mInstance) ? (SetOpenStatusPtr)GetProcAddress(mInstance,"ImmSetOpenStatus") : 0;
NS_ASSERTION(mSetOpenStatus!=NULL, "nsIMM.ImmSetOpenStatus failed.");
#elif WINCE_EMULATOR
mInstance=NULL;
mGetCompositionStringA=NULL;
mGetCompositionStringW=NULL;
mGetContext=NULL;
mReleaseContext=NULL;
mNotifyIME=NULL;
mSetCandiateWindow=NULL;
mGetCompositionWindow=NULL;
mSetCompositionWindow=NULL;
mGetProperty=NULL;
mGetDefaultIMEWnd=NULL;
mGetOpenStatus=NULL;
mSetOpenStatus=NULL;
#else // WinCE
mInstance=NULL;
mGetCompositionStringA=NULL;
mGetCompositionStringW=(GetCompStrPtr)ImmGetCompositionStringW;
mGetContext=(GetContextPtr)ImmGetContext;
mReleaseContext=(RelContextPtr)ImmReleaseContext;
mNotifyIME=(NotifyIMEPtr)ImmNotifyIME;
mSetCandiateWindow=(SetCandWindowPtr)ImmSetCandidateWindow;
mGetCompositionWindow=(GetCompWindowPtr)ImmGetCompositionWindow;
mSetCompositionWindow=(SetCompWindowPtr)ImmSetCompositionWindow;
mGetProperty=(GetPropertyPtr)ImmGetProperty;
mGetDefaultIMEWnd=(GetDefaultIMEWndPtr)ImmGetDefaultIMEWnd;
mGetOpenStatus=(GetOpenStatusPtr)ImmGetOpenStatus;
mSetOpenStatus=(SetOpenStatusPtr)ImmSetOpenStatus;
#endif
}
~nsIMM() {
if(mInstance) {
::FreeLibrary(mInstance);
}
mGetCompositionStringA=0;
mGetCompositionStringW=0;
mGetContext=0;
mReleaseContext=0;
mNotifyIME=0;
mSetCandiateWindow=0;
mGetCompositionWindow=0;
mSetCompositionWindow=0;
mGetProperty=0;
mGetDefaultIMEWnd=0;
mGetOpenStatus=0;
mSetOpenStatus=0;
}
LONG GetCompositionStringA(HIMC h, DWORD d1, LPVOID v, DWORD d2) {
return (mGetCompositionStringA) ? mGetCompositionStringA(h, d1, v, d2) : 0L;
}
LONG GetCompositionStringW(HIMC h, DWORD d1, LPVOID v, DWORD d2) {
return (mGetCompositionStringW) ? mGetCompositionStringW(h, d1, v, d2) : 0L;
}
LONG GetContext(HWND anHWND) {
return (mGetContext) ? mGetContext(anHWND) : 0L;
}
LONG ReleaseContext(HWND anHWND, HIMC anIMC) {
return (mReleaseContext) ? mReleaseContext(anHWND, anIMC) : 0L;
}
LONG NotifyIME(HIMC h, DWORD d1, DWORD d2, DWORD d3) {
return (mNotifyIME) ? mNotifyIME(h, d1, d2, d3) : 0L;
}
LONG SetCandidateWindow(HIMC h, LPCANDIDATEFORM l) {
return (mSetCandiateWindow) ? mSetCandiateWindow(h, l) : 0L;
}
LONG SetCompositionWindow(HIMC h, LPCOMPOSITIONFORM l) {
return (mSetCompositionWindow) ? mSetCompositionWindow(h, l) : 0L;
}
LONG GetCompositionWindow(HIMC h,LPCOMPOSITIONFORM l) {
return (mGetCompositionWindow) ? mGetCompositionWindow(h, l) : 0L;
}
LONG GetProperty(HKL hKL, DWORD dwIndex) {
return (mGetProperty) ? mGetProperty(hKL, dwIndex) : 0L;
}
LONG GetDefaultIMEWnd(HWND hWnd) {
return (mGetDefaultIMEWnd) ? mGetDefaultIMEWnd(hWnd) : 0L;
}
BOOL GetOpenStatus(HIMC h) {
return (mGetOpenStatus) ? mGetOpenStatus(h) : FALSE;
}
BOOL SetOpenStatus(HIMC h, BOOL b) {
return (mSetOpenStatus) ? mSetOpenStatus(h,b) : FALSE;
}
private:
HINSTANCE mInstance;
GetCompStrPtr mGetCompositionStringA;
GetCompStrPtr mGetCompositionStringW;
GetContextPtr mGetContext;
RelContextPtr mReleaseContext;
NotifyIMEPtr mNotifyIME;
SetCandWindowPtr mSetCandiateWindow;
SetCompWindowPtr mSetCompositionWindow;
GetCompWindowPtr mGetCompositionWindow;
GetPropertyPtr mGetProperty;
GetDefaultIMEWndPtr mGetDefaultIMEWnd;
GetOpenStatusPtr mGetOpenStatus;
SetOpenStatusPtr mSetOpenStatus;
};
/**
* Native WIN32 window wrapper.
*/
@ -401,6 +220,8 @@ public:
NS_IMETHOD ResetInputState();
NS_IMETHOD SetIMEOpenState(PRBool aState);
NS_IMETHOD GetIMEOpenState(PRBool* aState);
NS_IMETHOD SetIMEEnabled(PRBool aState);
NS_IMETHOD GetIMEEnabled(PRBool* aState);
NS_IMETHOD CancelIMEComposition();
PRBool IMEMouseHandling(PRUint32 aEventType, PRInt32 aAction, LPARAM lParam);