From 97ccaeed4795f751c92d4b86747c4605b9cdf535 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Fri, 15 Dec 2000 09:21:30 +0000 Subject: [PATCH] Locale <-> LanguageType functions adapted to change in ConvertLanguageToIsoNames --- linguistic/source/misc.cxx | 39 ++++++++++++++------------------- svx/source/editeng/unolingu.cxx | 31 ++++++++++---------------- 2 files changed, 29 insertions(+), 41 deletions(-) diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx index c2bde6c86175..d7caae39b197 100644 --- a/linguistic/source/misc.cxx +++ b/linguistic/source/misc.cxx @@ -2,9 +2,9 @@ * * $RCSfile: misc.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: tl $ $Date: 2000-11-21 18:29:14 $ + * last change: $Author: tl $ $Date: 2000-12-15 10:21:30 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -214,44 +214,39 @@ Reference< XDictionaryEntry > SearchDicList( /////////////////////////////////////////////////////////////////////////// -Locale CreateLocale( LanguageType eLang ) -{ - if ( eLang == LANGUAGE_NONE ) - eLang = LANGUAGE_SYSTEM; - String aLangStr, aCtryStr; - ConvertLanguageToIsoNames( eLang, aLangStr, aCtryStr ); - - return Locale( aLangStr, aCtryStr, OUString() ); -} - LanguageType LocaleToLanguage( const Locale& rLocale ) { - // empty language -> LANGUAGE_NONE + // empty Locale -> LANGUAGE_NONE if ( rLocale.Language.getLength() == 0 ) return LANGUAGE_NONE; // Variant of Locale is ignored - LanguageType eRet = - ConvertIsoNamesToLanguage( rLocale.Language, rLocale.Country ); - if ( eRet == LANGUAGE_SYSTEM ) - eRet = LANGUAGE_NONE; - - return eRet; + return ConvertIsoNamesToLanguage( rLocale.Language, rLocale.Country ); } Locale& LanguageToLocale( Locale& rLocale, LanguageType eLang ) { String aLangStr, aCtryStr; - if ( eLang == LANGUAGE_NONE ) - eLang = LANGUAGE_SYSTEM; - ConvertLanguageToIsoNames( eLang, aLangStr, aCtryStr ); + if ( eLang != LANGUAGE_NONE /* && eLang != LANGUAGE_SYSTEM */) + ConvertLanguageToIsoNames( eLang, aLangStr, aCtryStr ); + rLocale.Language = aLangStr; rLocale.Country = aCtryStr; + rLocale.Variant = OUString(); return rLocale; } +Locale CreateLocale( LanguageType eLang ) +{ + String aLangStr, aCtryStr; + if ( eLang != LANGUAGE_NONE /* && eLang != LANGUAGE_SYSTEM */) + ConvertLanguageToIsoNames( eLang, aLangStr, aCtryStr ); + + return Locale( aLangStr, aCtryStr, OUString() ); +} + uno::Sequence< Locale > LangSeqToLocaleSeq( const uno::Sequence< INT16 > &rLangSeq ) { const INT16 *pLang = rLangSeq.getConstArray(); diff --git a/svx/source/editeng/unolingu.cxx b/svx/source/editeng/unolingu.cxx index 5b26f3e78b28..c9fbe79df9f2 100644 --- a/svx/source/editeng/unolingu.cxx +++ b/svx/source/editeng/unolingu.cxx @@ -2,9 +2,9 @@ * * $RCSfile: unolingu.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: tl $ $Date: 2000-11-27 07:37:52 $ + * last change: $Author: tl $ $Date: 2000-12-15 10:19:05 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -741,41 +741,34 @@ sal_Bool SvxSaveDictionaries( const Reference< XDictionaryList > &xDicList ) LanguageType SvxLocaleToLanguage( const Locale& rLocale ) { - // empty language -> LANGUAGE_NONE + // empty Locale -> LANGUAGE_NONE if ( rLocale.Language.getLength() == 0 ) return LANGUAGE_NONE; - String aLangStr = rLocale.Language; - String aCtryStr = rLocale.Country; - // Variant is ignored - - LanguageType eRet = ConvertIsoNamesToLanguage( aLangStr, aCtryStr ); - if ( eRet == LANGUAGE_SYSTEM ) - eRet = LANGUAGE_NONE; - - return eRet; + // Variant of Locale is ignored + return ConvertIsoNamesToLanguage( rLocale.Language, rLocale.Country ); } Locale& SvxLanguageToLocale( Locale& rLocale, LanguageType eLang ) { String aLangStr, aCtryStr; - if ( eLang == LANGUAGE_NONE ) - eLang = LANGUAGE_SYSTEM; - ConvertLanguageToIsoNames( eLang, aLangStr, aCtryStr ); + if ( eLang != LANGUAGE_NONE /* && eLang != LANGUAGE_SYSTEM */) + ConvertLanguageToIsoNames( eLang, aLangStr, aCtryStr ); + rLocale.Language = aLangStr; rLocale.Country = aCtryStr; + rLocale.Variant = OUString(); return rLocale; } Locale SvxCreateLocale( LanguageType eLang ) { - if ( eLang == LANGUAGE_NONE ) - eLang = LANGUAGE_SYSTEM; String aLangStr, aCtryStr; - ConvertLanguageToIsoNames( eLang, aLangStr, aCtryStr ); + if ( eLang != LANGUAGE_NONE /* && eLang != LANGUAGE_SYSTEM */) + ConvertLanguageToIsoNames( eLang, aLangStr, aCtryStr ); - return Locale( aLangStr, aCtryStr, String() ); + return Locale( aLangStr, aCtryStr, OUString() ); }