summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-07-26 12:04:33 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-07-26 20:51:02 +0200
commitf2b3256297241da458a471d591e582c14d6ab73c (patch)
treebaeafe50b0508e557468f97c82cbd6a2b42ead01
parent78adf246d5e99d0f5d91d2e03c1379b154289d8d (diff)
use officecfg for SvtSystemLanguageOptions
Change-Id: Icf5cf974e4235d9a961e08bfc5689ec58930236e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119515 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--include/svl/languageoptions.hxx19
-rw-r--r--svl/source/config/cjkoptions.cxx11
-rw-r--r--svl/source/config/languageoptions.cxx40
3 files changed, 15 insertions, 55 deletions
diff --git a/include/svl/languageoptions.hxx b/include/svl/languageoptions.hxx
index 5fc9c8624dc4..9ae8475dd9eb 100644
--- a/include/svl/languageoptions.hxx
+++ b/include/svl/languageoptions.hxx
@@ -112,24 +112,9 @@ public:
/** #i42730# Gives access to the Windows 16bit system locale
*/
-class SvtSystemLanguageOptions final : public utl::ConfigItem
+namespace SvtSystemLanguageOptions
{
-private:
- OUString m_sWin16SystemLocale;
-
- bool isKeyboardLayoutTypeInstalled(sal_Int16 scriptType) const;
-
- virtual void ImplCommit() override;
-
-public:
- SvtSystemLanguageOptions();
- virtual ~SvtSystemLanguageOptions() override;
-
- virtual void Notify( const css::uno::Sequence< OUString >& rPropertyNames ) override;
-
- LanguageType GetWin16SystemLanguage() const;
-
- bool isCJKKeyboardLayoutInstalled() const;
+ bool isCJKKeyboardLayoutInstalled();
};
#endif // INCLUDED_SVL_LANGUAGEOPTIONS_HXX
diff --git a/svl/source/config/cjkoptions.cxx b/svl/source/config/cjkoptions.cxx
index 71054f564de4..84c972875f3a 100644
--- a/svl/source/config/cjkoptions.cxx
+++ b/svl/source/config/cjkoptions.cxx
@@ -22,11 +22,13 @@
#include <o3tl/any.hxx>
#include <svl/languageoptions.hxx>
#include <i18nlangtag/lang.h>
+#include <i18nlangtag/languagetag.hxx>
#include <unotools/configitem.hxx>
#include <com/sun/star/uno/Any.h>
#include <com/sun/star/uno/Sequence.hxx>
#include <osl/mutex.hxx>
#include <rtl/instance.hxx>
+#include <officecfg/System.hxx>
#include "itemholder2.hxx"
@@ -199,10 +201,11 @@ void SvtCJKOptions_Impl::Load()
if (!bAutoEnableCJK)
{
- SvtSystemLanguageOptions aSystemLocaleSettings;
-
//windows secondary system locale is CJK
- LanguageType eSystemLanguage = aSystemLocaleSettings.GetWin16SystemLanguage();
+ OUString sWin16SystemLocale = officecfg::System::L10N::SystemLocale::get();
+ LanguageType eSystemLanguage = LANGUAGE_NONE;
+ if( !sWin16SystemLocale.isEmpty() )
+ eSystemLanguage = LanguageTag::convertToLanguageTypeWithFallback( sWin16SystemLocale );
if (eSystemLanguage != LANGUAGE_SYSTEM)
{
SvtScriptType nWinScript = SvtLanguageOptions::GetScriptTypeOfLanguage( eSystemLanguage );
@@ -211,7 +214,7 @@ void SvtCJKOptions_Impl::Load()
//CJK keyboard is installed
if (!bAutoEnableCJK)
- bAutoEnableCJK = aSystemLocaleSettings.isCJKKeyboardLayoutInstalled();
+ bAutoEnableCJK = SvtSystemLanguageOptions::isCJKKeyboardLayoutInstalled();
}
if (bAutoEnableCJK)
diff --git a/svl/source/config/languageoptions.cxx b/svl/source/config/languageoptions.cxx
index 4f3f7671eda7..faaa93e2ddba 100644
--- a/svl/source/config/languageoptions.cxx
+++ b/svl/source/config/languageoptions.cxx
@@ -193,40 +193,9 @@ sal_Int16 SvtLanguageOptions::GetI18NScriptTypeOfLanguage( LanguageType nLang )
return FromSvtScriptTypeToI18N( GetScriptTypeOfLanguage( nLang ) );
}
-SvtSystemLanguageOptions::SvtSystemLanguageOptions() :
- utl::ConfigItem( "System/L10N")
-{
- uno::Sequence< OUString > aPropertyNames { "SystemLocale" };
- uno::Sequence< uno::Any > aValues = GetProperties( aPropertyNames );
-
- if ( aValues.hasElements() )
- {
- aValues[0]>>= m_sWin16SystemLocale;
- }
-}
-
-SvtSystemLanguageOptions::~SvtSystemLanguageOptions()
-{
-}
-
-void SvtSystemLanguageOptions::ImplCommit()
-{
- //does nothing
-}
-void SvtSystemLanguageOptions::Notify( const css::uno::Sequence< OUString >& )
-{
- // no listeners supported yet
-}
-LanguageType SvtSystemLanguageOptions::GetWin16SystemLanguage() const
-{
- if( m_sWin16SystemLocale.isEmpty() )
- return LANGUAGE_NONE;
- return LanguageTag::convertToLanguageTypeWithFallback( m_sWin16SystemLocale );
-}
-
-bool SvtSystemLanguageOptions::isKeyboardLayoutTypeInstalled(sal_Int16 scriptType) const
+static bool isKeyboardLayoutTypeInstalled(sal_Int16 scriptType)
{
bool isInstalled = false;
#ifdef _WIN32
@@ -257,9 +226,12 @@ bool SvtSystemLanguageOptions::isKeyboardLayoutTypeInstalled(sal_Int16 scriptTyp
return isInstalled;
}
-bool SvtSystemLanguageOptions::isCJKKeyboardLayoutInstalled() const
+namespace SvtSystemLanguageOptions
{
- return isKeyboardLayoutTypeInstalled(css::i18n::ScriptType::ASIAN);
+ bool isCJKKeyboardLayoutInstalled()
+ {
+ return isKeyboardLayoutTypeInstalled(css::i18n::ScriptType::ASIAN);
+ }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */