diff options
author | th <th@openoffice.org> | 2001-06-15 12:28:19 +0000 |
---|---|---|
committer | th <th@openoffice.org> | 2001-06-15 12:28:19 +0000 |
commit | 06a51ab010d628103ce1bcf52a1b0c9c41bf1f67 (patch) | |
tree | 2254c221a3e7214c2c65663824b2a213610b034c /vcl | |
parent | 165004844768ff226cf58efcd6fbc5b066ef59d8 (diff) |
#87257# - Loacle/UILocale/Language/UILanguage
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/app/settings.cxx | 152 | ||||
-rw-r--r-- | vcl/source/window/dlgctrl.cxx | 7 | ||||
-rw-r--r-- | vcl/source/window/mnemonic.cxx | 8 | ||||
-rw-r--r-- | vcl/source/window/window2.cxx | 6 |
4 files changed, 128 insertions, 45 deletions
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index b6c7d077204b..57fad624fbda 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -2,9 +2,9 @@ * * $RCSfile: settings.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: th $ $Date: 2001-06-07 16:45:44 $ + * last change: $Author: th $ $Date: 2001-06-15 13:24:46 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1521,7 +1521,7 @@ SvStream& operator<<( SvStream& rOStream, const HelpSettings& rSet ) // ======================================================================= -BOOL ImplCompareLocales( const ::com::sun::star::lang::Locale& L1, const ::com::sun::star::lang::Locale& L2 ) +static BOOL ImplCompareLocales( const ::com::sun::star::lang::Locale& L1, const ::com::sun::star::lang::Locale& L2 ) { return ( ( L1.Language == L2.Language ) && ( L1.Country == L2.Country ) && @@ -1717,33 +1717,26 @@ ULONG AllSettings::Update( ULONG nFlags, const AllSettings& rSet ) { if ( mpData->maInternational != rSet.mpData->maInternational ) { - CopyData(); - mpData->maInternational = rSet.mpData->maInternational; + SetInternational( rSet.mpData->maInternational ); nChangeFlags |= SETTINGS_INTERNATIONAL; - // Will be calculated in GetLocale(); - mpData->maLocale = ::com::sun::star::lang::Locale(); } + } - // Da System-International-Klassen intern in der - // International-Klasse automatisch bei Systemaenderungen geaendert - // werden, wird der Status innerhalb einer System-International- - // Aenderung anders ermittelt, da ansonsten die App nicht - // mitbekommt, das sich etwas geaendert hat - if ( (mpData->maInternational.GetLanguage() == LANGUAGE_SYSTEM) || - (mpData->maInternational.GetFormatLanguage() == LANGUAGE_SYSTEM) ) + if ( nFlags & SETTINGS_LOCALE ) + { + if ( mpData->meLanguage || rSet.mpData->meLanguage ) { - if ( ImplGetSVData()->maAppData.mbIntnChanged ) - nChangeFlags |= SETTINGS_INTERNATIONAL; + SetLanguage( rSet.mpData->meLanguage ); + nChangeFlags |= SETTINGS_LOCALE; } } - if ( nFlags & SETTINGS_LOCALE ) + if ( nFlags & SETTINGS_UILOCALE ) { - if ( !ImplCompareLocales( mpData->maLocale, rSet.mpData->maLocale ) ) + if ( mpData->meUILanguage || rSet.mpData->meUILanguage ) { - CopyData(); - mpData->maLocale = rSet.mpData->maLocale; - nChangeFlags |= SETTINGS_LOCALE; + SetUILanguage( rSet.mpData->meUILanguage ); + nChangeFlags |= SETTINGS_UILOCALE; } } @@ -1786,17 +1779,11 @@ ULONG AllSettings::GetChangeFlags( const AllSettings& rSet ) const if ( mpData->maInternational != rSet.mpData->maInternational ) nChangeFlags |= SETTINGS_INTERNATIONAL; - // Da System-International-Klassen intern in der - // International-Klasse automatisch bei Systemaenderungen geaendert - // werden, wird der Status innerhalb einer System-International- - // Aenderung anders ermittelt, da ansonsten die App nicht - // mitbekommt, das sich etwas geaendert hat - if ( (mpData->maInternational.GetLanguage() == LANGUAGE_SYSTEM) || - (mpData->maInternational.GetFormatLanguage() == LANGUAGE_SYSTEM) ) - { - if ( ImplGetSVData()->maAppData.mbIntnChanged ) - nChangeFlags |= SETTINGS_INTERNATIONAL; - } + if ( mpData->meLanguage || rSet.mpData->meLanguage ) + nChangeFlags |= SETTINGS_LOCALE; + + if ( mpData->meUILanguage || rSet.mpData->meUILanguage ) + nChangeFlags |= SETTINGS_UILOCALE; return nChangeFlags; } @@ -1837,20 +1824,117 @@ BOOL AllSettings::operator ==( const AllSettings& rSet ) const // ----------------------------------------------------------------------- +void AllSettings::SetInternational( const International& rIntn ) +{ + CopyData(); + + mpData->maInternational = rIntn; + + mpData->meLanguage = rIntn.GetFormatLanguage(); + mpData->meUILanguage = rIntn.GetLanguage(); + // Will be calculated in GetLocale()/GetUILocale() + mpData->maLocale = ::com::sun::star::lang::Locale(); + mpData->maUILocale = ::com::sun::star::lang::Locale(); +} + +// ----------------------------------------------------------------------- + +void AllSettings::SetLocale( const ::com::sun::star::lang::Locale& rLocale ) +{ + CopyData(); + + mpData->maLocale = rLocale; + + mpData->meLanguage = ConvertIsoNamesToLanguage( rLocale.Language, rLocale.Country ); + mpData->maInternational = International( mpData->meUILanguage, mpData->meLanguage ); +} + +// ----------------------------------------------------------------------- + +void AllSettings::SeUILocale( const ::com::sun::star::lang::Locale& rLocale ) +{ + CopyData(); + + mpData->maLocale = rLocale; + + mpData->meUILanguage = ConvertIsoNamesToLanguage( rLocale.Language, rLocale.Country ); + mpData->maInternational = International( mpData->meUILanguage, mpData->meLanguage ); +} + +// ----------------------------------------------------------------------- + +void AllSettings::SetLanguage( LanguageType eLang ) +{ + CopyData(); + + mpData->meLanguage = eLang; + + // Will be calculated in GetLocale() + mpData->maLocale = ::com::sun::star::lang::Locale(); + mpData->maInternational = International( mpData->meUILanguage, mpData->meLanguage ); +} + +// ----------------------------------------------------------------------- + +void AllSettings::SetUILanguage( LanguageType eLang ) +{ + CopyData(); + + mpData->meUILanguage = eLang; + + // Will be calculated in GetUILocale() + mpData->maUILocale = ::com::sun::star::lang::Locale(); + mpData->maInternational = International( mpData->meUILanguage, mpData->meLanguage ); +} + +// ----------------------------------------------------------------------- + const ::com::sun::star::lang::Locale& AllSettings::GetLocale() const { if ( !mpData->maLocale.Language.getLength() ) { - String aLanguage, aCountry; - ConvertLanguageToIsoNames( mpData->maInternational.GetLanguage(), aLanguage, aCountry ); + String aLanguage; + String aCountry; + ConvertLanguageToIsoNames( mpData->meLanguage, aLanguage, aCountry ); ((AllSettings*)this)->mpData->maLocale.Language = aLanguage; ((AllSettings*)this)->mpData->maLocale.Country = aCountry; } + return mpData->maLocale; } // ----------------------------------------------------------------------- +const ::com::sun::star::lang::Locale& AllSettings::GetUILocale() const +{ + if ( !mpData->maLocale.Language.getLength() ) + { + String aLanguage; + String aCountry; + ConvertLanguageToIsoNames( mpData->meUILanguage, aLanguage, aCountry ); + ((AllSettings*)this)->mpData->maLocale.Language = aLanguage; + ((AllSettings*)this)->mpData->maLocale.Country = aCountry; + } + + return mpData->maUILocale; +} + +// ----------------------------------------------------------------------- + +LanguageType AllSettings::GetLanguage() const +{ + return mpData->meLanguage; +} + +// ----------------------------------------------------------------------- + +LanguageType AllSettings::GetUILanguage() const +{ + return mpData->meUILanguage; +} + +// ----------------------------------------------------------------------- + SvStream& operator>>( SvStream& rIStream, AllSettings& rSet ) { return rIStream; diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx index 780f2cf15416..66fc96bbaaed 100644 --- a/vcl/source/window/dlgctrl.cxx +++ b/vcl/source/window/dlgctrl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: dlgctrl.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: er $ $Date: 2000-10-29 17:21:28 $ + * last change: $Author: th $ $Date: 2001-06-15 13:26:49 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -332,8 +332,7 @@ static Window* ImplFindAccelWindow( Window* pParent, USHORT& rIndex, xub_Unicode if ( !xCharClass.is() ) xCharClass = vcl::unohelper::CreateCharacterClassification(); - const ::com::sun::star::lang::Locale& rLocale = Application::GetSettings().GetLocale(); - + const ::com::sun::star::lang::Locale& rLocale = Application::GetSettings().GetUILocale(); cCharCode = xCharClass->toUpper( String(cCharCode), 0, 1, rLocale )[0]; if ( i < nFormEnd ) diff --git a/vcl/source/window/mnemonic.cxx b/vcl/source/window/mnemonic.cxx index 1fa3e8d41fd5..d13d8c4eeb9c 100644 --- a/vcl/source/window/mnemonic.cxx +++ b/vcl/source/window/mnemonic.cxx @@ -2,9 +2,9 @@ * * $RCSfile: mnemonic.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: th $ $Date: 2001-06-11 09:56:51 $ + * last change: $Author: th $ $Date: 2001-06-15 13:28:19 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -127,7 +127,7 @@ sal_Unicode ImplMnemonicGenerator::ImplFindMnemonic( const XubString& rKey ) void ImplMnemonicGenerator::RegisterMnemonic( const XubString& rKey ) { - const ::com::sun::star::lang::Locale& rLocale = Application::GetSettings().GetLocale(); + const ::com::sun::star::lang::Locale& rLocale = Application::GetSettings().GetUILocale(); uno::Reference < i18n::XCharacterClassification > xCharClass = GetCharClass(); XubString aKey = xCharClass->toUpper( rKey, 0, rKey.Len(), rLocale ); @@ -169,7 +169,7 @@ BOOL ImplMnemonicGenerator::CreateMnemonic( XubString& rKey ) if ( !rKey.Len() || ImplFindMnemonic( rKey ) ) return FALSE; - const ::com::sun::star::lang::Locale& rLocale = Application::GetSettings().GetLocale(); + const ::com::sun::star::lang::Locale& rLocale = Application::GetSettings().GetUILocale(); uno::Reference < i18n::XCharacterClassification > xCharClass = GetCharClass(); XubString aKey = xCharClass->toUpper( rKey, 0, rKey.Len(), rLocale ); diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index 5df0288cfbf0..4bb13ea941b9 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -2,9 +2,9 @@ * * $RCSfile: window2.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: th $ $Date: 2001-04-06 12:48:42 $ + * last change: $Author: th $ $Date: 2001-06-15 13:27:00 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1014,7 +1014,7 @@ void Window::SetZoomedPointFont( const Font& rFont ) nType = FONT_DEFAULT_FIXED; else nType = FONT_DEFAULT_UI_SANS; - Font aTempFont = GetDefaultFont( nType, GetSettings().GetInternational().GetLanguage(), FALSE ); + Font aTempFont = GetDefaultFont( nType, GetSettings().GetLanguage(), FALSE ); aFont.SetName( aTempFont.GetName() ); SetPointFont( aFont ); } |