diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-07-12 14:49:02 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-07-12 15:08:29 +0100 |
commit | d75dd80abb28cdb126a12840597d0384dd43897e (patch) | |
tree | c32000fed556e0ed7b9655d21c278767bc11e6e4 /svl | |
parent | Related: fdo#54493 determine if a CJK/CTL keyboard is installed (diff) | |
download | core-d75dd80abb28cdb126a12840597d0384dd43897e.tar.gz core-d75dd80abb28cdb126a12840597d0384dd43897e.zip |
Resolves: fdo#54493 autoenable CJK/CTL ui based on installed keyboards
Change-Id: I66d3c57c88ff64fc3e3a7fa50fb5a173e709e3bf
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/config/cjkoptions.cxx | 36 | ||||
-rw-r--r-- | svl/source/config/ctloptions.cxx | 51 |
2 files changed, 66 insertions, 21 deletions
diff --git a/svl/source/config/cjkoptions.cxx b/svl/source/config/cjkoptions.cxx index ed152c198e09..d69880aad0ab 100644 --- a/svl/source/config/cjkoptions.cxx +++ b/svl/source/config/cjkoptions.cxx @@ -197,15 +197,35 @@ void SvtCJKOptions_Impl::Load() } } - SvtSystemLanguageOptions aSystemLocaleSettings; - LanguageType eSystemLanguage = aSystemLocaleSettings.GetWin16SystemLanguage(); - sal_uInt16 nWinScript = SvtLanguageOptions::GetScriptTypeOfLanguage( eSystemLanguage ); - - sal_uInt16 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage(LANGUAGE_SYSTEM); - if ( !bCJKFont && (( nScriptType & SCRIPTTYPE_ASIAN )|| - ((eSystemLanguage != LANGUAGE_SYSTEM) && ( nWinScript & SCRIPTTYPE_ASIAN )))) + if (!bCJKFont) { - SetAll(sal_True); + bool bAutoEnableCJK = false; + + sal_uInt16 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage(LANGUAGE_SYSTEM); + //system locale is CJK + bAutoEnableCJK = (nScriptType & SCRIPTTYPE_ASIAN); + + if (!bAutoEnableCJK) + { + SvtSystemLanguageOptions aSystemLocaleSettings; + + //windows secondary system locale is CJK + LanguageType eSystemLanguage = aSystemLocaleSettings.GetWin16SystemLanguage(); + if (eSystemLanguage != LANGUAGE_SYSTEM) + { + sal_uInt16 nWinScript = SvtLanguageOptions::GetScriptTypeOfLanguage( eSystemLanguage ); + bAutoEnableCJK = (nWinScript & SCRIPTTYPE_ASIAN); + } + + //CJK keyboard is installed + if (!bAutoEnableCJK) + bAutoEnableCJK = aSystemLocaleSettings.isCJKKeyboardLayoutInstalled(); + } + + if (bAutoEnableCJK) + { + SetAll(sal_True); + } } bIsLoaded = sal_True; } diff --git a/svl/source/config/ctloptions.cxx b/svl/source/config/ctloptions.cxx index 7e2cb356b1ff..70c4f477453c 100644 --- a/svl/source/config/ctloptions.cxx +++ b/svl/source/config/ctloptions.cxx @@ -287,21 +287,46 @@ void SvtCTLOptions_Impl::Load() } } } - sal_uInt16 nType = SvtLanguageOptions::GetScriptTypeOfLanguage(LANGUAGE_SYSTEM); - SvtSystemLanguageOptions aSystemLocaleSettings; - LanguageType eSystemLanguage = aSystemLocaleSettings.GetWin16SystemLanguage(); - sal_uInt16 nWinScript = SvtLanguageOptions::GetScriptTypeOfLanguage( eSystemLanguage ); - if( !m_bCTLFontEnabled && (( nType & SCRIPTTYPE_COMPLEX ) || - ((eSystemLanguage != LANGUAGE_SYSTEM) && ( nWinScript & SCRIPTTYPE_COMPLEX ))) ) + + if (!m_bCTLFontEnabled) { - m_bCTLFontEnabled = sal_True; - sal_uInt16 nLanguage = SvtSysLocale().GetLanguageTag().getLanguageType(); - //enable sequence checking for the appropriate languages - m_bCTLSequenceChecking = m_bCTLRestricted = m_bCTLTypeAndReplace = - (MsLangId::needsSequenceChecking( nLanguage) || - MsLangId::needsSequenceChecking( eSystemLanguage)); - Commit(); + bool bAutoEnableCTL = false; + + sal_uInt16 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage(LANGUAGE_SYSTEM); + //system locale is CTL + bAutoEnableCTL = (nScriptType & SCRIPTTYPE_COMPLEX); + + LanguageType eSystemLanguage = LANGUAGE_SYSTEM; + + if (!bAutoEnableCTL) + { + SvtSystemLanguageOptions aSystemLocaleSettings; + + //windows secondary system locale is CTL + eSystemLanguage = aSystemLocaleSettings.GetWin16SystemLanguage(); + if (eSystemLanguage != LANGUAGE_SYSTEM) + { + sal_uInt16 nWinScript = SvtLanguageOptions::GetScriptTypeOfLanguage( eSystemLanguage ); + bAutoEnableCTL = (nWinScript & SCRIPTTYPE_COMPLEX); + } + + //CTL keyboard is installed + if (!bAutoEnableCTL) + bAutoEnableCTL = aSystemLocaleSettings.isCTLKeyboardLayoutInstalled(); + } + + if (bAutoEnableCTL) + { + m_bCTLFontEnabled = sal_True; + sal_uInt16 nLanguage = SvtSysLocale().GetLanguageTag().getLanguageType(); + //enable sequence checking for the appropriate languages + m_bCTLSequenceChecking = m_bCTLRestricted = m_bCTLTypeAndReplace = + (MsLangId::needsSequenceChecking( nLanguage) || + MsLangId::needsSequenceChecking( eSystemLanguage)); + Commit(); + } } + m_bIsLoaded = sal_True; } //------------------------------------------------------------------------------ |