diff options
Diffstat (limited to 'svx/source/cui/optgdlg.cxx')
-rw-r--r-- | svx/source/cui/optgdlg.cxx | 74 |
1 files changed, 54 insertions, 20 deletions
diff --git a/svx/source/cui/optgdlg.cxx b/svx/source/cui/optgdlg.cxx index 31fcff220f8a..9a53de6bea72 100644 --- a/svx/source/cui/optgdlg.cxx +++ b/svx/source/cui/optgdlg.cxx @@ -103,6 +103,7 @@ #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/container/XContentEnumerationAccess.hpp> #include <com/sun/star/container/XSet.hpp> +#include <com/sun/star/i18n/ScriptType.hpp> #include <vcl/svapp.hxx> @@ -1277,8 +1278,13 @@ OfaLanguagesTabPage::OfaLanguagesTabPage( Window* pParent, const SfxItemSet& rSe // initialize user interface language selection SvtLanguageTable* pLanguageTable = new SvtLanguageTable; - String aStr( pLanguageTable->GetString( LANGUAGE_SYSTEM ) ); - aUserInterfaceLB.InsertEntry(aStr); + const String aStr( pLanguageTable->GetString( LANGUAGE_SYSTEM ) ); + + String aUILang(aStr); + aUILang += String::CreateFromAscii(" - "); + aUILang += pLanguageTable->GetString( Application::GetSettings().GetUILanguage() ); + + aUserInterfaceLB.InsertEntry(aUILang); aUserInterfaceLB.SetEntryData(0, 0); aUserInterfaceLB.SelectEntryPos(0); try @@ -1340,16 +1346,24 @@ OfaLanguagesTabPage::OfaLanguagesTabPage( Window* pParent, const SfxItemSet& rSe } aWesternLanguageLB.SetLanguageList( LANG_LIST_WESTERN | LANG_LIST_ONLY_KNOWN, TRUE, FALSE, TRUE ); - aAsianLanguageLB .SetLanguageList( LANG_LIST_CJK | LANG_LIST_ONLY_KNOWN, TRUE, FALSE, TRUE ); + aWesternLanguageLB.InsertDefaultLanguage( ::com::sun::star::i18n::ScriptType::LATIN ); + aAsianLanguageLB.SetLanguageList( LANG_LIST_CJK | LANG_LIST_ONLY_KNOWN, TRUE, FALSE, TRUE ); + aAsianLanguageLB.InsertDefaultLanguage( ::com::sun::star::i18n::ScriptType::ASIAN ); aComplexLanguageLB.SetLanguageList( LANG_LIST_CTL | LANG_LIST_ONLY_KNOWN, TRUE, FALSE, TRUE ); - aLocaleSettingLB .SetLanguageList( LANG_LIST_ALL | LANG_LIST_ONLY_KNOWN, FALSE, FALSE, FALSE); - aLocaleSettingLB.InsertLanguage( LANGUAGE_SYSTEM ); + aComplexLanguageLB.InsertDefaultLanguage( ::com::sun::star::i18n::ScriptType::COMPLEX ); - // insert SYSTEM entry, no specific currency - aCurrencyLB.InsertEntry( aStr ); + aLocaleSettingLB.SetLanguageList( LANG_LIST_ALL | LANG_LIST_ONLY_KNOWN, FALSE, FALSE, FALSE); + aLocaleSettingLB.InsertDefaultLanguage( ::com::sun::star::i18n::ScriptType::WEAK ); + + const NfCurrencyTable& rCurrTab = SvNumberFormatter::GetTheCurrencyTable(); + const NfCurrencyEntry& rCurr = SvNumberFormatter::GetCurrencyEntry( LANGUAGE_SYSTEM ); + // insert SYSTEM entry + String aDefaultCurr(aStr); + aDefaultCurr += String::CreateFromAscii(" - "); + aDefaultCurr += rCurr.GetBankSymbol(); + aCurrencyLB.InsertEntry( aDefaultCurr ); // all currencies String aTwoSpace( RTL_CONSTASCII_USTRINGPARAM( " " ) ); - const NfCurrencyTable& rCurrTab = SvNumberFormatter::GetTheCurrencyTable(); USHORT nCurrCount = rCurrTab.Count(); // first entry is SYSTEM, skip it for ( USHORT j=1; j < nCurrCount; ++j ) @@ -1572,7 +1586,7 @@ BOOL OfaLanguagesTabPage::FillItemSet( SfxItemSet& rSet ) if(!bCurrentDocCBChecked) { Any aValue; - Locale aLocale = SvxCreateLocale( eSelectLang ); + Locale aLocale = MsLangId::convertLanguageToLocale( eSelectLang, false ); aValue <<= aLocale; OUString aPropName( C2U("DefaultLocale") ); pLangConfig->aLinguConfig.SetProperty( aPropName, aValue ); @@ -1581,7 +1595,8 @@ BOOL OfaLanguagesTabPage::FillItemSet( SfxItemSet& rSet ) } if(pCurrentDocShell) { - rSet.Put(SvxLanguageItem(eSelectLang, SID_ATTR_LANGUAGE)); + rSet.Put(SvxLanguageItem(MsLangId::resolveSystemLanguageByScriptType(eSelectLang, ::com::sun::star::i18n::ScriptType::LATIN), + SID_ATTR_LANGUAGE)); bRet = TRUE; } } @@ -1592,7 +1607,7 @@ BOOL OfaLanguagesTabPage::FillItemSet( SfxItemSet& rSet ) if(!bCurrentDocCBChecked) { Any aValue; - Locale aLocale = SvxCreateLocale( eSelectLang ); + Locale aLocale = MsLangId::convertLanguageToLocale( eSelectLang, false ); aValue <<= aLocale; OUString aPropName( C2U("DefaultLocale_CJK") ); pLangConfig->aLinguConfig.SetProperty( aPropName, aValue ); @@ -1601,7 +1616,8 @@ BOOL OfaLanguagesTabPage::FillItemSet( SfxItemSet& rSet ) } if(pCurrentDocShell) { - rSet.Put(SvxLanguageItem(eSelectLang, SID_ATTR_CHAR_CJK_LANGUAGE)); + rSet.Put(SvxLanguageItem(MsLangId::resolveSystemLanguageByScriptType(eSelectLang, ::com::sun::star::i18n::ScriptType::ASIAN), + SID_ATTR_CHAR_CJK_LANGUAGE)); bRet = TRUE; } } @@ -1612,7 +1628,7 @@ BOOL OfaLanguagesTabPage::FillItemSet( SfxItemSet& rSet ) if(!bCurrentDocCBChecked) { Any aValue; - Locale aLocale = SvxCreateLocale( eSelectLang ); + Locale aLocale = MsLangId::convertLanguageToLocale( eSelectLang, false ); aValue <<= aLocale; OUString aPropName( C2U("DefaultLocale_CTL") ); pLangConfig->aLinguConfig.SetProperty( aPropName, aValue ); @@ -1621,7 +1637,8 @@ BOOL OfaLanguagesTabPage::FillItemSet( SfxItemSet& rSet ) } if(pCurrentDocShell) { - rSet.Put(SvxLanguageItem(eSelectLang, SID_ATTR_CHAR_CTL_LANGUAGE)); + rSet.Put(SvxLanguageItem(MsLangId::resolveSystemLanguageByScriptType(eSelectLang, ::com::sun::star::i18n::ScriptType::COMPLEX), + SID_ATTR_CHAR_CTL_LANGUAGE)); bRet = TRUE; } } @@ -1721,13 +1738,18 @@ void OfaLanguagesTabPage::Reset( const SfxItemSet& rSet ) aWestLang = pLangConfig->aLinguConfig.GetProperty(C2U("DefaultLocale")); Locale aLocale; aWestLang >>= aLocale; - eCurLang = SvxLocaleToLanguage( aLocale ); + + eCurLang = MsLangId::convertLocaleToLanguage( aLocale ); + aCJKLang = pLangConfig->aLinguConfig.GetProperty(C2U("DefaultLocale_CJK")); + aLocale = Locale(); aCJKLang >>= aLocale; - eCurLangCJK = SvxLocaleToLanguage( aLocale ); + eCurLangCJK = MsLangId::convertLocaleToLanguage( aLocale ); + aCTLLang = pLangConfig->aLinguConfig.GetProperty(C2U("DefaultLocale_CTL")); + aLocale = Locale(); aCTLLang >>= aLocale; - eCurLangCTL = SvxLocaleToLanguage( aLocale ); + eCurLangCTL = MsLangId::convertLocaleToLanguage( aLocale ); } catch(Exception&) { @@ -1739,13 +1761,25 @@ void OfaLanguagesTabPage::Reset( const SfxItemSet& rSet ) aCurrentDocCB.Check(bLanguageCurrentDoc_Impl); const SfxPoolItem* pLang; if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_LANGUAGE, FALSE, &pLang)) - eCurLang = ((const SvxLanguageItem*)pLang)->GetValue(); + { + LanguageType eTempCurLang = ((const SvxLanguageItem*)pLang)->GetValue(); + if (MsLangId::resolveSystemLanguageByScriptType(eCurLang, ::com::sun::star::i18n::ScriptType::LATIN) != eTempCurLang) + eCurLang = eTempCurLang; + } if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_CHAR_CJK_LANGUAGE, FALSE, &pLang)) - eCurLangCJK = ((const SvxLanguageItem*)pLang)->GetValue(); + { + LanguageType eTempCurLang = ((const SvxLanguageItem*)pLang)->GetValue(); + if (MsLangId::resolveSystemLanguageByScriptType(eCurLangCJK, ::com::sun::star::i18n::ScriptType::ASIAN) != eTempCurLang) + eCurLangCJK = eTempCurLang; + } if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_CHAR_CTL_LANGUAGE, FALSE, &pLang)) - eCurLangCTL = ((const SvxLanguageItem*)pLang)->GetValue(); + { + LanguageType eTempCurLang = ((const SvxLanguageItem*)pLang)->GetValue(); + if (MsLangId::resolveSystemLanguageByScriptType(eCurLangCTL, ::com::sun::star::i18n::ScriptType::COMPLEX) != eTempCurLang) + eCurLangCTL = eTempCurLang; + } } if(LANGUAGE_NONE == eCurLang || LANGUAGE_DONTKNOW == eCurLang) aWesternLanguageLB.SelectLanguage(LANGUAGE_NONE); |