diff options
Diffstat (limited to 'unotools/source/config')
-rw-r--r-- | unotools/source/config/lingucfg.cxx | 29 | ||||
-rw-r--r-- | unotools/source/config/useroptions.cxx | 42 |
2 files changed, 44 insertions, 27 deletions
diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx index 77e46b7881b0..9dfc019b19ac 100644 --- a/unotools/source/config/lingucfg.cxx +++ b/unotools/source/config/lingucfg.cxx @@ -51,14 +51,14 @@ namespace public rtl::Static< osl::Mutex, theSvtLinguConfigItemMutex > {}; } -static bool lcl_SetLocale( sal_Int16 &rLanguage, const uno::Any &rVal ) +static bool lcl_SetLocale( LanguageType &rLanguage, const uno::Any &rVal ) { bool bSucc = false; lang::Locale aNew; if (rVal >>= aNew) // conversion successful? { - sal_Int16 nNew = LanguageTag::convertToLanguageType( aNew, false); + LanguageType nNew = LanguageTag::convertToLanguageType( aNew, false); if (nNew != rLanguage) { rLanguage = nNew; @@ -68,7 +68,7 @@ static bool lcl_SetLocale( sal_Int16 &rLanguage, const uno::Any &rVal ) return bSucc; } -static inline const OUString lcl_LanguageToCfgLocaleStr( sal_Int16 nLanguage ) +static inline const OUString lcl_LanguageToCfgLocaleStr( LanguageType nLanguage ) { OUString aRes; if (LANGUAGE_SYSTEM != nLanguage) @@ -76,7 +76,7 @@ static inline const OUString lcl_LanguageToCfgLocaleStr( sal_Int16 nLanguage ) return aRes; } -static sal_Int16 lcl_CfgAnyToLanguage( const uno::Any &rVal ) +static LanguageType lcl_CfgAnyToLanguage( const uno::Any &rVal ) { OUString aTmp; rVal >>= aTmp; @@ -326,6 +326,7 @@ uno::Any SvtLinguConfigItem::GetProperty( sal_Int32 nPropertyHandle ) const uno::Any aRes; const sal_Int16 *pnVal = nullptr; + const LanguageType *plVal = nullptr; const bool *pbVal = nullptr; const sal_Int32 *pnInt32Val = nullptr; @@ -339,7 +340,7 @@ uno::Any SvtLinguConfigItem::GetProperty( sal_Int32 nPropertyHandle ) const case UPH_IS_SPELL_AUTO : pbVal = &rOpt.bIsSpellAuto; break; case UPH_IS_SPELL_SPECIAL : pbVal = &rOpt.bIsSpellSpecial; break; case UPH_IS_WRAP_REVERSE : pbVal = &rOpt.bIsSpellReverse; break; - case UPH_DEFAULT_LANGUAGE : pnVal = &rOpt.nDefaultLanguage; break; + case UPH_DEFAULT_LANGUAGE : plVal = &rOpt.nDefaultLanguage; break; case UPH_IS_SPELL_CAPITALIZATION : pbVal = &rOpt.bIsSpellCapitalization; break; case UPH_IS_SPELL_WITH_DIGITS : pbVal = &rOpt.bIsSpellWithDigits; break; case UPH_IS_SPELL_UPPER_CASE : pbVal = &rOpt.bIsSpellUpperCase; break; @@ -392,6 +393,8 @@ uno::Any SvtLinguConfigItem::GetProperty( sal_Int32 nPropertyHandle ) const aRes <<= *pbVal; else if (pnVal) aRes <<= *pnVal; + else if (plVal) + aRes <<= (sal_Int16)(sal_uInt16)*plVal; else if (pnInt32Val) aRes <<= *pnInt32Val; @@ -420,6 +423,7 @@ bool SvtLinguConfigItem::SetProperty( sal_Int32 nPropertyHandle, const uno::Any bool bMod = false; sal_Int16 *pnVal = nullptr; + LanguageType *plVal = nullptr; bool *pbVal = nullptr; sal_Int32 *pnInt32Val = nullptr; @@ -433,7 +437,7 @@ bool SvtLinguConfigItem::SetProperty( sal_Int32 nPropertyHandle, const uno::Any case UPH_IS_SPELL_AUTO : pbVal = &rOpt.bIsSpellAuto; break; case UPH_IS_SPELL_SPECIAL : pbVal = &rOpt.bIsSpellSpecial; break; case UPH_IS_WRAP_REVERSE : pbVal = &rOpt.bIsSpellReverse; break; - case UPH_DEFAULT_LANGUAGE : pnVal = &rOpt.nDefaultLanguage; break; + case UPH_DEFAULT_LANGUAGE : plVal = &rOpt.nDefaultLanguage; break; case UPH_IS_SPELL_CAPITALIZATION : pbVal = &rOpt.bIsSpellCapitalization; break; case UPH_IS_SPELL_WITH_DIGITS : pbVal = &rOpt.bIsSpellWithDigits; break; case UPH_IS_SPELL_UPPER_CASE : pbVal = &rOpt.bIsSpellUpperCase; break; @@ -513,6 +517,19 @@ bool SvtLinguConfigItem::SetProperty( sal_Int32 nPropertyHandle, const uno::Any bSucc = true; } } + else if (plVal) + { + sal_Int16 nNew = sal_Int16(); + if (rValue >>= nNew) + { + if (nNew != (sal_uInt16)*plVal) + { + *plVal = LanguageType(nNew); + bMod = true; + } + bSucc = true; + } + } else if (pnInt32Val) { sal_Int32 nNew = sal_Int32(); diff --git a/unotools/source/config/useroptions.cxx b/unotools/source/config/useroptions.cxx index e9c20cfd0abd..625a925b4095 100644 --- a/unotools/source/config/useroptions.cxx +++ b/unotools/source/config/useroptions.cxx @@ -183,33 +183,33 @@ void SvtUserOptions::Impl::SetToken (UserOptToken nToken, OUString const& sToken OUString SvtUserOptions::Impl::GetFullName () const { OUString sFullName; - switch (LanguageType const eLang = SvtSysLocale().GetUILanguageTag().getLanguageType()) + LanguageType const eLang = SvtSysLocale().GetUILanguageTag().getLanguageType(); + if (eLang == LANGUAGE_RUSSIAN) { - case LANGUAGE_RUSSIAN: - sFullName = GetToken(UserOptToken::FirstName).trim(); + sFullName = GetToken(UserOptToken::FirstName).trim(); + if (!sFullName.isEmpty()) + sFullName += " "; + sFullName += GetToken(UserOptToken::FathersName).trim(); + if (!sFullName.isEmpty()) + sFullName += " "; + sFullName += GetToken(UserOptToken::LastName).trim(); + } + else + { + if (MsLangId::isFamilyNameFirst(eLang)) + { + sFullName = GetToken(UserOptToken::LastName).trim(); if (!sFullName.isEmpty()) sFullName += " "; - sFullName += GetToken(UserOptToken::FathersName).trim(); + sFullName += GetToken(UserOptToken::FirstName).trim(); + } + else + { + sFullName = GetToken(UserOptToken::FirstName).trim(); if (!sFullName.isEmpty()) sFullName += " "; sFullName += GetToken(UserOptToken::LastName).trim(); - break; - default: - if (MsLangId::isFamilyNameFirst(eLang)) - { - sFullName = GetToken(UserOptToken::LastName).trim(); - if (!sFullName.isEmpty()) - sFullName += " "; - sFullName += GetToken(UserOptToken::FirstName).trim(); - } - else - { - sFullName = GetToken(UserOptToken::FirstName).trim(); - if (!sFullName.isEmpty()) - sFullName += " "; - sFullName += GetToken(UserOptToken::LastName).trim(); - } - break; + } } return sFullName; |