diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2009-09-17 11:26:03 +0000 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2009-09-17 11:26:03 +0000 |
commit | 79a0747e1d7bd867e5cad9ce76fd98669489c9db (patch) | |
tree | e28daf01db34250b67d4057cf630f4ee1e52203d /desktop/source/app | |
parent | 762181f6f1168e0eb54009990222d7cb4cebebd5 (diff) |
CWS-TOOLING: integrate CWS defaultdoclang
2009-08-21 14:44:21 +0200 cmc r275260 : CWS-TOOLING: rebase CWS defaultdoclang to trunk@275001 (milestone: DEV300:m55)
2009-08-10 17:43:32 +0200 cmc r274833 : CWS-TOOLING: rebase CWS defaultdoclang to trunk@274622 (milestone: DEV300:m54)
2009-07-24 11:46:58 +0200 cmc r274297 : CWS-TOOLING: rebase CWS defaultdoclang to trunk@274203 (milestone: DEV300:m53)
2009-07-10 12:22:16 +0200 cmc r273884 : #i99577# tweak the widths a bit
2009-07-08 15:17:58 +0200 cmc r273834 : #i99577 tidy up indentation
2009-07-04 16:09:18 +0200 cmc r273721 : #i99577# a "default" document language that reflects what the locale language is
Diffstat (limited to 'desktop/source/app')
-rw-r--r-- | desktop/source/app/langselect.cxx | 97 | ||||
-rw-r--r-- | desktop/source/app/langselect.hxx | 2 |
2 files changed, 21 insertions, 78 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); |