diff options
Diffstat (limited to 'svl/source')
-rw-r--r-- | svl/source/config/languageoptions.cxx | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/svl/source/config/languageoptions.cxx b/svl/source/config/languageoptions.cxx index eb7a711d54ff..2124b8fba921 100644 --- a/svl/source/config/languageoptions.cxx +++ b/svl/source/config/languageoptions.cxx @@ -28,6 +28,10 @@ #include <com/sun/star/i18n/ScriptType.hpp> #include <unotools/syslocale.hxx> +#ifdef WNT +#include <windows.h> +#endif + using namespace ::com::sun::star; // global ---------------------------------------------------------------------- @@ -205,4 +209,47 @@ LanguageType SvtSystemLanguageOptions::GetWin16SystemLanguage() } +bool SvtSystemLanguageOptions::isKeyboardLayoutTypeInstalled(sal_Int16 scriptType) +{ + bool isInstalled = false; +#ifdef WNT + int nLayouts = GetKeyboardLayoutList(0, NULL); + if (nLayouts > 0) + { + HKL *lpList = (HKL*)LocalAlloc(LPTR, (nLayouts * sizeof(HKL))); + if (lpList) + { + nLayouts = GetKeyboardLayoutList(nLayouts, lpList); + + for(int i = 0; i < nLayouts; ++i) + { + LCID lang = MAKELCID(((UINT)lpList[i] & 0xffffffff), SORT_DEFAULT); + if (MsLangId::getScriptType(lang) == scriptType) + { + isInstalled = true; + break; + } + } + + LocalFree(lpList); + } + } +#else + (void)scriptType; +#endif + return isInstalled; +} + + +bool SvtSystemLanguageOptions::isCTLKeyboardLayoutInstalled() +{ + return isKeyboardLayoutTypeInstalled(::com::sun::star::i18n::ScriptType::COMPLEX); +} + + +bool SvtSystemLanguageOptions::isCJKKeyboardLayoutInstalled() +{ + return isKeyboardLayoutTypeInstalled(::com::sun::star::i18n::ScriptType::ASIAN); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |