diff options
-rw-r--r-- | desktop/source/app/langselect.cxx | 97 | ||||
-rw-r--r-- | desktop/source/app/langselect.hxx | 2 | ||||
-rw-r--r-- | linguistic/source/lngopt.cxx | 18 | ||||
-rw-r--r-- | linguistic/source/lngopt.hxx | 2 | ||||
-rw-r--r-- | svx/inc/svx/langbox.hxx | 2 | ||||
-rw-r--r-- | svx/source/cui/optgdlg.cxx | 74 | ||||
-rw-r--r-- | svx/source/cui/optgdlg.src | 46 | ||||
-rw-r--r-- | svx/source/dialog/langbox.cxx | 28 |
8 files changed, 137 insertions, 132 deletions
diff --git a/desktop/source/app/langselect.cxx b/desktop/source/app/langselect.cxx index 3c6d6124d178..e9a39207cb50 100644 --- a/desktop/source/app/langselect.cxx +++ b/desktop/source/app/langselect.cxx @@ -104,7 +104,7 @@ bool LanguageSelection::prepareLanguage() ::rtl::OUString sWin16SysLocale; aWin16SysLocale >>= sWin16SysLocale; if( sWin16SysLocale.getLength()) - setDefaultLocale(sWin16SysLocale); + setDefaultLanguage(sWin16SysLocale); } catch(const Exception&) { @@ -116,9 +116,8 @@ bool LanguageSelection::prepareLanguage() OUString usLocale; Reference< XPropertySet > xLocaleProp(getConfigAccess( "org.openoffice.System/L10N", sal_True), UNO_QUERY_THROW); - // "org.openoffice.Office.Linguistic/General", sal_True), UNO_QUERY_THROW); xLocaleProp->getPropertyValue(OUString::createFromAscii("Locale")) >>= usLocale; - setDefaultLocale(usLocale); + setDefaultLanguage(usLocale); } catch (Exception&) { @@ -160,88 +159,32 @@ bool LanguageSelection::prepareLanguage() // #i32939# setting of default document locale // #i32939# this should not be based on the UI language - setDefaultLocale(aLocaleString); - - // fallback: set en-US as default Western locale if no Western locale is set - OUString usWesternName = OUString::createFromAscii("DefaultLocale"); - try - { - Reference< XPropertySet > xProp(getConfigAccess( - "org.openoffice.Office.Linguistic/General/", sal_True), UNO_QUERY_THROW); - OUString usValue; - xProp->getPropertyValue(usWesternName) >>= usValue; - if (usValue.getLength() == 0) - { - // there is no western document language selected - // if the selected locale is a western locale, this - // will become the default western docuemnt language - // otherwise, fall back to en-US - OUString usDefault = OUString::createFromAscii("en-US"); - try - { - xProp->setPropertyValue(usWesternName, makeAny(usDefault)); - Reference< XChangesBatch >(xProp,UNO_QUERY_THROW)->commitChanges(); - } - catch ( PropertyVetoException ) - { - // we are not allowed to change this - } - } - } - catch ( Exception& ) - { - } + setDefaultLanguage(aLocaleString); return bSuccess; } -void LanguageSelection::setDefaultLocale(const OUString& usUILocale) +void LanguageSelection::setDefaultLanguage(const OUString& sLocale) { - // #i32939# setting of default document locale - // org.openoffice.Office.Linguistic/General/DefaultLocale - // org.openoffice.Office.Linguistic/General/DefaultLocale_CJK - // org.openoffice.Office.Linguistic/General/DefaultLocale_CTL + // #i32939# setting of default document language + // + // See #i42730# for rules for determining source of settings - // determine script type of UI locale - LanguageType ltUILocale = MsLangId::convertIsoStringToLanguage(usUILocale); - sal_uInt16 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage(ltUILocale); + // determine script type of locale + LanguageType nLang = MsLangId::convertIsoStringToLanguage(sLocale); + sal_uInt16 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage(nLang); - try - { - Reference< XPropertySet > xProp(getConfigAccess( - "org.openoffice.Office.Linguistic/General/", sal_True), UNO_QUERY_THROW); - OUString usName = OUString::createFromAscii("DefaultLocale"); - switch (nScriptType) - { - case SCRIPTTYPE_ASIAN: - usName = OUString::createFromAscii("DefaultLocale_CJK"); - break; - case SCRIPTTYPE_COMPLEX: - usName = OUString::createFromAscii("DefaultLocale_CTL"); - break; - } - OUString usValue; - xProp->getPropertyValue(usName) >>= usValue; - if (usValue.getLength() == 0) - { - // there is no document language set, for the script type selected - // in the UI - // covert the LanguageType we've got from the LanguageTable back to - // an iso string and store it - OUString usDefault = MsLangId::convertLanguageToIsoString(ltUILocale); - try - { - xProp->setPropertyValue(usName, makeAny(usDefault)); - Reference< XChangesBatch >(xProp, UNO_QUERY_THROW)->commitChanges(); - } - catch ( PropertyVetoException ) - { - // we are not allowed to change this - } - } - } - catch ( Exception& ) + switch (nScriptType) { + case SCRIPTTYPE_ASIAN: + MsLangId::setConfiguredAsianFallback( nLang ); + break; + case SCRIPTTYPE_COMPLEX: + MsLangId::setConfiguredComplexFallback( nLang ); + break; + default: + MsLangId::setConfiguredWesternFallback( nLang ); + break; } } diff --git a/desktop/source/app/langselect.hxx b/desktop/source/app/langselect.hxx index 0a112545f38b..d0867529ab1b 100644 --- a/desktop/source/app/langselect.hxx +++ b/desktop/source/app/langselect.hxx @@ -60,7 +60,7 @@ private: static rtl::OUString getUserLanguage(); static rtl::OUString getSystemLanguage(); static void resetUserLanguage(); - static void setDefaultLocale(const rtl::OUString&); + static void setDefaultLanguage(const rtl::OUString&); public: static com::sun::star::lang::Locale IsoStringToLocale(const rtl::OUString& str); diff --git a/linguistic/source/lngopt.cxx b/linguistic/source/lngopt.cxx index bd2473528d81..995b0686e2f8 100644 --- a/linguistic/source/lngopt.cxx +++ b/linguistic/source/lngopt.cxx @@ -46,7 +46,9 @@ #include <com/sun/star/registry/XSimpleRegistry.hpp> #include <com/sun/star/registry/XRegistryKey.hpp> #include <com/sun/star/lang/Locale.hpp> +#include <com/sun/star/i18n/ScriptType.hpp> #include <unotools/processfactory.hxx> +#include <i18npool/mslangid.hxx> using namespace utl; using namespace osl; @@ -100,13 +102,13 @@ LinguOptions::~LinguOptions() } -BOOL LinguOptions::SetLocale_Impl( INT16 &rLanguage, Any &rOld, const Any &rVal) +BOOL LinguOptions::SetLocale_Impl( INT16 &rLanguage, Any &rOld, const Any &rVal, sal_Int16 nType) { BOOL bRes = FALSE; Locale aNew; rVal >>= aNew; - INT16 nNew = LocaleToLanguage( aNew ); + INT16 nNew = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage(aNew), nType); if (nNew != rLanguage) { Locale aLocale( CreateLocale( rLanguage ) ); @@ -149,17 +151,17 @@ BOOL LinguOptions::SetValue( Any &rOld, const Any &rVal, INT32 nWID ) case WID_HYPH_MIN_WORD_LENGTH : pnVal = &pData->nHyphMinWordLength; break; case WID_DEFAULT_LOCALE : { - bRes = SetLocale_Impl( pData->nDefaultLanguage, rOld, rVal ); + bRes = SetLocale_Impl( pData->nDefaultLanguage, rOld, rVal, ::com::sun::star::i18n::ScriptType::LATIN ); break; } case WID_DEFAULT_LOCALE_CJK : { - bRes = SetLocale_Impl( pData->nDefaultLanguage_CJK, rOld, rVal ); + bRes = SetLocale_Impl( pData->nDefaultLanguage_CJK, rOld, rVal, ::com::sun::star::i18n::ScriptType::ASIAN ); break; } case WID_DEFAULT_LOCALE_CTL : { - bRes = SetLocale_Impl( pData->nDefaultLanguage_CTL, rOld, rVal ); + bRes = SetLocale_Impl( pData->nDefaultLanguage_CTL, rOld, rVal, ::com::sun::star::i18n::ScriptType::COMPLEX ); break; } default : @@ -227,19 +229,19 @@ void LinguOptions::GetValue( Any &rVal, INT32 nWID ) const case WID_HYPH_MIN_WORD_LENGTH : pnVal = &pData->nHyphMinWordLength; break; case WID_DEFAULT_LOCALE : { - Locale aLocale( CreateLocale( pData->nDefaultLanguage ) ); + Locale aLocale( MsLangId::convertLanguageToLocale( pData->nDefaultLanguage ) ); rVal.setValue( &aLocale, ::getCppuType((Locale*)0 )); break; } case WID_DEFAULT_LOCALE_CJK : { - Locale aLocale( CreateLocale( pData->nDefaultLanguage_CJK ) ); + Locale aLocale( MsLangId::convertLanguageToLocale( pData->nDefaultLanguage_CJK ) ); rVal.setValue( &aLocale, ::getCppuType((Locale*)0 )); break; } case WID_DEFAULT_LOCALE_CTL : { - Locale aLocale( CreateLocale( pData->nDefaultLanguage_CTL ) ); + Locale aLocale( MsLangId::convertLanguageToLocale( pData->nDefaultLanguage_CTL ) ); rVal.setValue( &aLocale, ::getCppuType((Locale*)0 )); break; } diff --git a/linguistic/source/lngopt.hxx b/linguistic/source/lngopt.hxx index 3a92baa32faf..b424970a929b 100644 --- a/linguistic/source/lngopt.hxx +++ b/linguistic/source/lngopt.hxx @@ -77,7 +77,7 @@ class LinguOptions BOOL SetLocale_Impl( INT16 &rLanguage, ::com::sun::star::uno::Any &rOld, - const ::com::sun::star::uno::Any &rVal); + const ::com::sun::star::uno::Any &rVal, sal_Int16 nType ); public: LinguOptions(); diff --git a/svx/inc/svx/langbox.hxx b/svx/inc/svx/langbox.hxx index 8aebc88e380e..476d78c53d03 100644 --- a/svx/inc/svx/langbox.hxx +++ b/svx/inc/svx/langbox.hxx @@ -78,6 +78,7 @@ private: SVX_DLLPRIVATE void Init(); SVX_DLLPRIVATE USHORT ImplInsertImgEntry( const String& rEntry, USHORT nPos, bool bChecked ); + SVX_DLLPRIVATE USHORT ImplInsertLanguage(LanguageType, USHORT, sal_Int16 ); public: SvxLanguageBox( Window* pParent, WinBits nWinStyle, BOOL bCheck = FALSE); @@ -89,6 +90,7 @@ public: BOOL bCheckSpellAvail = FALSE ); USHORT InsertLanguage( const LanguageType eLangType, USHORT nPos = LISTBOX_APPEND ); + USHORT InsertDefaultLanguage( sal_Int16 nType, USHORT nPos = LISTBOX_APPEND ); USHORT InsertLanguage( const LanguageType eLangType, BOOL bCheckEntry, USHORT nPos = LISTBOX_APPEND ); void RemoveLanguage( const LanguageType eLangType ); 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); diff --git a/svx/source/cui/optgdlg.src b/svx/source/cui/optgdlg.src index a711be6bf0fc..f663a7ed44ef 100644 --- a/svx/source/cui/optgdlg.src +++ b/svx/source/cui/optgdlg.src @@ -460,13 +460,13 @@ TabPage OFA_TP_LANGUAGES FixedText FT_USERINTERFACE { Pos = MAP_APPFONT ( 12 , 16 ) ; - Size = MAP_APPFONT ( 120 , 8 ) ; + Size = MAP_APPFONT ( 108 , 8 ) ; Text [ en-US ] = "~User interface"; }; ListBox LB_USERINTERFACE { - Pos = MAP_APPFONT ( 135 , 14 ) ; - Size = MAP_APPFONT ( 113 , 60 ) ; + Pos = MAP_APPFONT ( 123 , 14 ) ; + Size = MAP_APPFONT ( 125 , 60 ) ; DropDown = TRUE ; Border = TRUE ; TabStop = TRUE ; @@ -481,13 +481,13 @@ TabPage OFA_TP_LANGUAGES FixedText FT_LOCALESETTING { Pos = MAP_APPFONT ( 12 , 31 ) ; - Size = MAP_APPFONT ( 120 , 8 ) ; + Size = MAP_APPFONT ( 108 , 8 ) ; Text [ en-US ] = "Locale setting"; }; ListBox LB_LOCALESETTING { - Pos = MAP_APPFONT ( 135 , 30 ) ; - Size = MAP_APPFONT ( 113 , 60 ) ; + Pos = MAP_APPFONT ( 123 , 30 ) ; + Size = MAP_APPFONT ( 125 , 60 ) ; DropDown = TRUE ; Border = TRUE ; TabStop = TRUE ; @@ -496,13 +496,13 @@ TabPage OFA_TP_LANGUAGES FixedText FT_DECIMALSEPARATOR { Pos = MAP_APPFONT ( 12 , 46 ) ; - Size = MAP_APPFONT ( 120 , 8 ) ; + Size = MAP_APPFONT ( 108 , 8 ) ; Text [ en-US ] = "Decimal separator key"; }; CheckBox CB_DECIMALSEPARATOR { - Pos = MAP_APPFONT ( 135 , 46) ; - Size = MAP_APPFONT ( 119 , RSC_CD_CHECKBOX_HEIGHT ) ; + Pos = MAP_APPFONT ( 123 , 46) ; + Size = MAP_APPFONT ( 125 , RSC_CD_CHECKBOX_HEIGHT ) ; Text [ en-US ] = "~Same as locale setting ( %1 )"; }; FixedImage FI_CURRENCY @@ -514,13 +514,13 @@ TabPage OFA_TP_LANGUAGES FixedText FT_CURRENCY { Pos = MAP_APPFONT ( 12 , 61 ) ; - Size = MAP_APPFONT ( 120 , 8 ) ; + Size = MAP_APPFONT ( 108 , 8 ) ; Text [ en-US ] = "~Default currency"; }; ListBox LB_CURRENCY { - Pos = MAP_APPFONT ( 135 , 59 ) ; - Size = MAP_APPFONT ( 113 , 60 ) ; + Pos = MAP_APPFONT ( 123 , 59 ) ; + Size = MAP_APPFONT ( 125 , 60 ) ; DropDown = TRUE ; Border = TRUE ; TabStop = TRUE ; @@ -541,14 +541,14 @@ TabPage OFA_TP_LANGUAGES FixedText FT_WEST_LANG { Pos = MAP_APPFONT ( 12 , 90 ) ; - Size = MAP_APPFONT ( 120 , 8 ) ; + Size = MAP_APPFONT ( 108 , 8 ) ; Text [ en-US ] = "Western"; }; ListBox LB_WEST_LANG { - Pos = MAP_APPFONT ( 135 , 88 ) ; - Size = MAP_APPFONT ( 113 , 60 ) ; + Pos = MAP_APPFONT ( 123 , 88 ) ; + Size = MAP_APPFONT ( 125 , 60 ) ; DropDown = TRUE ; Border = TRUE ; TabStop = TRUE ; @@ -563,13 +563,13 @@ TabPage OFA_TP_LANGUAGES FixedText FT_ASIAN_LANG { Pos = MAP_APPFONT ( 12 , 106 ) ; - Size = MAP_APPFONT ( 120 , 8 ) ; + Size = MAP_APPFONT ( 108 , 8 ) ; Text [ en-US ] = "Asian"; }; ListBox LB_ASIAN_LANG { - Pos = MAP_APPFONT ( 135 , 104 ) ; - Size = MAP_APPFONT ( 113 , 60 ) ; + Pos = MAP_APPFONT ( 123 , 104 ) ; + Size = MAP_APPFONT ( 125 , 60 ) ; DropDown = TRUE ; Border = TRUE ; TabStop = TRUE ; @@ -584,13 +584,13 @@ TabPage OFA_TP_LANGUAGES FixedText FT_COMPLEX_LANG { Pos = MAP_APPFONT ( 12 , 122 ) ; - Size = MAP_APPFONT ( 120 , 8 ) ; + Size = MAP_APPFONT ( 108 , 8 ) ; Text [ en-US ] = "C~TL"; }; ListBox LB_COMPLEX_LANG { - Pos = MAP_APPFONT ( 135 , 120 ) ; - Size = MAP_APPFONT ( 113 , 60 ) ; + Pos = MAP_APPFONT ( 123 , 120 ) ; + Size = MAP_APPFONT ( 125 , 60 ) ; DropDown = TRUE ; Border = TRUE ; TabStop = TRUE ; @@ -598,8 +598,8 @@ TabPage OFA_TP_LANGUAGES }; CheckBox CB_CURRENT_DOC { - Pos = MAP_APPFONT ( 135 , 135 ) ; - Size = MAP_APPFONT ( 113 , RSC_CD_CHECKBOX_HEIGHT ) ; + Pos = MAP_APPFONT ( 123 , 135 ) ; + Size = MAP_APPFONT ( 125 , RSC_CD_CHECKBOX_HEIGHT ) ; Text [ en-US ] = "For the current document only"; }; FixedLine FL_ENHANCED diff --git a/svx/source/dialog/langbox.cxx b/svx/source/dialog/langbox.cxx index 16e04efeefbe..c196178a4d16 100644 --- a/svx/source/dialog/langbox.cxx +++ b/svx/source/dialog/langbox.cxx @@ -37,8 +37,9 @@ #include <com/sun/star/linguistic2/XLinguServiceManager.hdl> #endif #include <com/sun/star/linguistic2/XAvailableLocales.hpp> +#include <com/sun/star/i18n/ScriptType.hpp> #include <linguistic/misc.hxx> -#include<rtl/ustring.hxx> +#include <rtl/ustring.hxx> #include <unotools/localedatawrapper.hxx> #include <svtools/langtab.hxx> @@ -315,6 +316,13 @@ void SvxLanguageBox::SetLanguageList( INT16 nLangList, USHORT SvxLanguageBox::InsertLanguage( const LanguageType nLangType, USHORT nPos ) { + return ImplInsertLanguage( nLangType, nPos, ::com::sun::star::i18n::ScriptType::WEAK ); +} + +//------------------------------------------------------------------------ + +USHORT SvxLanguageBox::ImplInsertLanguage( const LanguageType nLangType, USHORT nPos, sal_Int16 nType ) +{ LanguageType nLang = MsLangId::getReplacementForObsoleteLanguage( nLangType); // For obsolete and to be replaced languages check whether an entry of the // replacement already exists and if so don't add an entry with identical @@ -329,6 +337,15 @@ USHORT SvxLanguageBox::InsertLanguage( const LanguageType nLangType, USHORT nPos String aStrEntry = m_pLangTable->GetString( nLang ); if (LANGUAGE_NONE == nLang && m_bHasLangNone && m_bLangNoneIsLangAll) aStrEntry = m_aAllString; + + LanguageType nRealLang = nLang; + if (nRealLang == LANGUAGE_SYSTEM) + { + nRealLang = MsLangId::resolveSystemLanguageByScriptType(nRealLang, nType); + aStrEntry.AppendAscii(" - "); + aStrEntry.Append(m_pLangTable->GetString( nRealLang )); + } + aStrEntry = ApplyLreOrRleEmbedding( aStrEntry ); USHORT nAt = 0; @@ -343,7 +360,7 @@ USHORT SvxLanguageBox::InsertLanguage( const LanguageType nLangType, USHORT nPos m_pSpellUsedLang = new Sequence< INT16 >( xSpell->getLanguages() ); } bFound = m_pSpellUsedLang ? - lcl_SeqHasLang( *m_pSpellUsedLang, nLang ) : FALSE; + lcl_SeqHasLang( *m_pSpellUsedLang, nRealLang ) : FALSE; nAt = ImplInsertImgEntry( aStrEntry, nPos, bFound ); } @@ -356,6 +373,13 @@ USHORT SvxLanguageBox::InsertLanguage( const LanguageType nLangType, USHORT nPos //------------------------------------------------------------------------ +USHORT SvxLanguageBox::InsertDefaultLanguage( sal_Int16 nType, USHORT nPos ) +{ + return ImplInsertLanguage( LANGUAGE_SYSTEM, nPos, nType ); +} + +//------------------------------------------------------------------------ + USHORT SvxLanguageBox::InsertLanguage( const LanguageType nLangType, BOOL bCheckEntry, USHORT nPos ) { |