Kaydet (Commit) dcf67b25 authored tarafından Caolán McNamara's avatar Caolán McNamara

micro optimization

üst 6a679931
...@@ -70,7 +70,7 @@ sal_Bool LanguageSelection::bFoundLanguage = sal_False; ...@@ -70,7 +70,7 @@ sal_Bool LanguageSelection::bFoundLanguage = sal_False;
OUString LanguageSelection::aFoundLanguage; OUString LanguageSelection::aFoundLanguage;
LanguageSelection::LanguageSelectionStatus LanguageSelection::m_eStatus = LS_STATUS_OK; LanguageSelection::LanguageSelectionStatus LanguageSelection::m_eStatus = LS_STATUS_OK;
const OUString LanguageSelection::usFallbackLanguage = OUString::createFromAscii("en-US"); const OUString LanguageSelection::usFallbackLanguage(RTL_CONSTASCII_USTRINGPARAM("en-US"));
static sal_Bool existsURL( OUString const& sURL ) static sal_Bool existsURL( OUString const& sURL )
{ {
...@@ -126,7 +126,7 @@ Locale LanguageSelection::IsoStringToLocale(const OUString& str) ...@@ -126,7 +126,7 @@ Locale LanguageSelection::IsoStringToLocale(const OUString& str)
bool LanguageSelection::prepareLanguage() bool LanguageSelection::prepareLanguage()
{ {
m_eStatus = LS_STATUS_OK; m_eStatus = LS_STATUS_OK;
OUString sConfigSrvc = OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider"); OUString sConfigSrvc = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationProvider"));
Reference< XMultiServiceFactory > theMSF = comphelper::getProcessServiceFactory(); Reference< XMultiServiceFactory > theMSF = comphelper::getProcessServiceFactory();
Reference< XLocalizable > theConfigProvider; Reference< XLocalizable > theConfigProvider;
try try
...@@ -147,7 +147,7 @@ bool LanguageSelection::prepareLanguage() ...@@ -147,7 +147,7 @@ bool LanguageSelection::prepareLanguage()
try try
{ {
Reference< XPropertySet > xProp(getConfigAccess("org.openoffice.System/L10N/", sal_False), UNO_QUERY_THROW); Reference< XPropertySet > xProp(getConfigAccess("org.openoffice.System/L10N/", sal_False), UNO_QUERY_THROW);
Any aWin16SysLocale = xProp->getPropertyValue(OUString::createFromAscii("SystemLocale")); Any aWin16SysLocale = xProp->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("SystemLocale")));
::rtl::OUString sWin16SysLocale; ::rtl::OUString sWin16SysLocale;
aWin16SysLocale >>= sWin16SysLocale; aWin16SysLocale >>= sWin16SysLocale;
if( sWin16SysLocale.getLength()) if( sWin16SysLocale.getLength())
...@@ -164,7 +164,7 @@ bool LanguageSelection::prepareLanguage() ...@@ -164,7 +164,7 @@ bool LanguageSelection::prepareLanguage()
OUString usLocale; OUString usLocale;
Reference< XPropertySet > xLocaleProp(getConfigAccess( Reference< XPropertySet > xLocaleProp(getConfigAccess(
"org.openoffice.System/L10N", sal_True), UNO_QUERY_THROW); "org.openoffice.System/L10N", sal_True), UNO_QUERY_THROW);
xLocaleProp->getPropertyValue(OUString::createFromAscii("Locale")) >>= usLocale; xLocaleProp->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Locale"))) >>= usLocale;
setDefaultLanguage(usLocale); setDefaultLanguage(usLocale);
} }
catch (Exception&) catch (Exception&)
...@@ -235,7 +235,7 @@ bool LanguageSelection::prepareLanguage() ...@@ -235,7 +235,7 @@ bool LanguageSelection::prepareLanguage()
if ( !bCmdLanguage ) if ( !bCmdLanguage )
{ {
// Store language only // Store language only
xProp->setPropertyValue(OUString::createFromAscii("ooLocale"), makeAny(aLocaleString)); xProp->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("ooLocale")), makeAny(aLocaleString));
Reference< XChangesBatch >(xProp, UNO_QUERY_THROW)->commitChanges(); Reference< XChangesBatch >(xProp, UNO_QUERY_THROW)->commitChanges();
} }
...@@ -243,14 +243,14 @@ bool LanguageSelection::prepareLanguage() ...@@ -243,14 +243,14 @@ bool LanguageSelection::prepareLanguage()
{ {
// Store language only // Store language only
Reference< XPropertySet > xProp2(getConfigAccess("org.openoffice.Office.Linguistic/General/", sal_True), UNO_QUERY_THROW); Reference< XPropertySet > xProp2(getConfigAccess("org.openoffice.Office.Linguistic/General/", sal_True), UNO_QUERY_THROW);
xProp2->setPropertyValue(OUString::createFromAscii("UILocale"), makeAny(aLocaleString)); xProp2->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("UILocale")), makeAny(aLocaleString));
Reference< XChangesBatch >(xProp2, UNO_QUERY_THROW)->commitChanges(); Reference< XChangesBatch >(xProp2, UNO_QUERY_THROW)->commitChanges();
} }
MsLangId::setConfiguredSystemUILanguage( MsLangId::convertLocaleToLanguage(loc) ); MsLangId::setConfiguredSystemUILanguage( MsLangId::convertLocaleToLanguage(loc) );
OUString sLocale; OUString sLocale;
xProp->getPropertyValue(OUString::createFromAscii("ooSetupSystemLocale")) >>= sLocale; xProp->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupSystemLocale"))) >>= sLocale;
if ( sLocale.getLength() ) if ( sLocale.getLength() )
{ {
loc = LanguageSelection::IsoStringToLocale(sLocale); loc = LanguageSelection::IsoStringToLocale(sLocale);
...@@ -371,12 +371,12 @@ Reference< XNameAccess > LanguageSelection::getConfigAccess(const sal_Char* pPat ...@@ -371,12 +371,12 @@ Reference< XNameAccess > LanguageSelection::getConfigAccess(const sal_Char* pPat
{ {
Reference< XNameAccess > xNameAccess; Reference< XNameAccess > xNameAccess;
try{ try{
OUString sConfigSrvc = OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider"); OUString sConfigSrvc(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationProvider"));
OUString sAccessSrvc; OUString sAccessSrvc;
if (bUpdate) if (bUpdate)
sAccessSrvc = OUString::createFromAscii("com.sun.star.configuration.ConfigurationUpdateAccess"); sAccessSrvc = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationUpdateAccess"));
else else
sAccessSrvc = OUString::createFromAscii("com.sun.star.configuration.ConfigurationAccess"); sAccessSrvc = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationAccess"));
OUString sConfigURL = OUString::createFromAscii(pPath); OUString sConfigURL = OUString::createFromAscii(pPath);
...@@ -418,7 +418,7 @@ static Sequence< OUString > _getFallbackLocales(const OUString& aIsoLang) ...@@ -418,7 +418,7 @@ static Sequence< OUString > _getFallbackLocales(const OUString& aIsoLang)
Sequence< OUString > seqFallbacks; Sequence< OUString > seqFallbacks;
if (aIsoLang.equalsAscii("zh-HK")) { if (aIsoLang.equalsAscii("zh-HK")) {
seqFallbacks = Sequence< OUString >(1); seqFallbacks = Sequence< OUString >(1);
seqFallbacks[0] = OUString::createFromAscii("zh-TW"); seqFallbacks[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("zh-TW"));
} }
return seqFallbacks; return seqFallbacks;
} }
...@@ -490,7 +490,7 @@ OUString LanguageSelection::getUserLanguage() ...@@ -490,7 +490,7 @@ OUString LanguageSelection::getUserLanguage()
{ {
try try
{ {
xAccess->getByName(OUString::createFromAscii("UILocale")) >>= aUserLanguage; xAccess->getByName(OUString(RTL_CONSTASCII_USTRINGPARAM("UILocale"))) >>= aUserLanguage;
} }
catch ( NoSuchElementException const & ) catch ( NoSuchElementException const & )
{ {
...@@ -514,7 +514,7 @@ OUString LanguageSelection::getSystemLanguage() ...@@ -514,7 +514,7 @@ OUString LanguageSelection::getSystemLanguage()
{ {
try try
{ {
xAccess->getByName(OUString::createFromAscii("UILocale")) >>= aUserLanguage; xAccess->getByName(OUString(RTL_CONSTASCII_USTRINGPARAM("UILocale"))) >>= aUserLanguage;
} }
catch ( NoSuchElementException const & ) catch ( NoSuchElementException const & )
{ {
...@@ -536,7 +536,7 @@ void LanguageSelection::resetUserLanguage() ...@@ -536,7 +536,7 @@ void LanguageSelection::resetUserLanguage()
try try
{ {
Reference< XPropertySet > xProp(getConfigAccess("org.openoffice.Office.Linguistic/General", sal_True), UNO_QUERY_THROW); Reference< XPropertySet > xProp(getConfigAccess("org.openoffice.Office.Linguistic/General", sal_True), UNO_QUERY_THROW);
xProp->setPropertyValue(OUString::createFromAscii("UILocale"), makeAny(OUString::createFromAscii(""))); xProp->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("UILocale")), makeAny(OUString::createFromAscii("")));
Reference< XChangesBatch >(xProp, UNO_QUERY_THROW)->commitChanges(); Reference< XChangesBatch >(xProp, UNO_QUERY_THROW)->commitChanges();
} }
catch ( PropertyVetoException& ) catch ( PropertyVetoException& )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment