tdf#100726 - Improve readability of OUString concatanations

Improved readability of OUString concatanations. Also removed unused
OUStrings "sColor" and "sEntry" from the code.

Change-Id: Ie9792f499cd880be72229f8a8c71f05ff8e258b6
Reviewed-on: https://gerrit.libreoffice.org/28375
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
This commit is contained in:
Gökhan Gurbetoğlu
2016-08-24 17:41:12 +03:00
committed by Michael Stahl
parent 4d6dc9b84b
commit b7bf1ba213
8 changed files with 58 additions and 72 deletions

View File

@@ -280,10 +280,8 @@ static const char aResourceResolverPropName[] = "ResourceResolver";
uriRef.set( xFac->parse( aURL ), UNO_QUERY ); uriRef.set( xFac->parse( aURL ), UNO_QUERY );
if ( !uriRef.is() ) if ( !uriRef.is() )
{ {
OUString errorMsg("DialogProviderImpl::getDialogModel: failed to parse URI: "); OUString errorMsg = "DialogProviderImpl::getDialogModel: failed to parse URI: " + aURL;
errorMsg += aURL; throw IllegalArgumentException( errorMsg, Reference< XInterface >(), 1 );
throw IllegalArgumentException( errorMsg,
Reference< XInterface >(), 1 );
} }
Reference < uri::XVndSunStarExpandUrl > sxUri( uriRef, UNO_QUERY ); Reference < uri::XVndSunStarExpandUrl > sxUri( uriRef, UNO_QUERY );
if( !sxUri.is() ) if( !sxUri.is() )

View File

@@ -1429,23 +1429,23 @@ Any AnimationExporter::convertAnimateValue( const Any& rSourceValue, const OUStr
OUString aP( "," ); OUString aP( "," );
if ( rSourceValue >>= aHSL ) if ( rSourceValue >>= aHSL )
{ {
aDest += "hsl("; aDest += "hsl("
aDest += OUString::number( (sal_Int32)( aHSL[ 0 ] / ( 360.0 / 255 ) ) ); + OUString::number( (sal_Int32)( aHSL[ 0 ] / ( 360.0 / 255 ) ) )
aDest += aP; + aP
aDest += OUString::number( (sal_Int32)( aHSL[ 1 ] * 255.0 ) ); + OUString::number( (sal_Int32)( aHSL[ 1 ] * 255.0 ) )
aDest += aP; + aP
aDest += OUString::number( (sal_Int32)( aHSL[ 2 ] * 255.0 ) ); + OUString::number( (sal_Int32)( aHSL[ 2 ] * 255.0 ) )
aDest += ")"; + ")";
} }
else if ( rSourceValue >>= nColor ) else if ( rSourceValue >>= nColor )
{ {
aDest += "rgb("; aDest += "rgb("
aDest += OUString::number( ( (sal_Int8)nColor ) ); + OUString::number( ( (sal_Int8)nColor ) )
aDest += aP; + aP
aDest += OUString::number( ( (sal_Int8)( nColor >> 8 ) ) ); + OUString::number( ( (sal_Int8)( nColor >> 8 ) ) )
aDest += aP; + aP
aDest += OUString::number( ( (sal_Int8)( nColor >> 16 ) ) ); + OUString::number( ( (sal_Int8)( nColor >> 16 ) ) )
aDest += ")"; + ")";
} }
} }
else if ( rAttributeName == "FillStyle" ) else if ( rAttributeName == "FillStyle" )

View File

@@ -1912,8 +1912,8 @@ void SfxCommonTemplateDialog_Impl::DeleteHdl()
SvTreeListEntry* pEntry = pTreeBox ? pTreeBox->FirstSelected() : aFmtLb->FirstSelected(); SvTreeListEntry* pEntry = pTreeBox ? pTreeBox->FirstSelected() : aFmtLb->FirstSelected();
const SfxStyleFamilyItem* pItem = GetFamilyItem_Impl(); const SfxStyleFamilyItem* pItem = GetFamilyItem_Impl();
OUString aMsg = SfxResId(STR_DELETE_STYLE_USED).toString(); OUString aMsg = SfxResId(STR_DELETE_STYLE_USED).toString()
aMsg += SfxResId(STR_DELETE_STYLE).toString(); + SfxResId(STR_DELETE_STYLE).toString();
while (pEntry) while (pEntry)
{ {

View File

@@ -286,14 +286,12 @@ void getINetPropsFromConfig(stoc_javavm::JVM * pjvm,
// read ftp proxy name // read ftp proxy name
css::uno::Reference<css::registry::XRegistryKey> ftpProxy_name = xRegistryRootKey->openKey("Settings/ooInetFTPProxyName"); css::uno::Reference<css::registry::XRegistryKey> ftpProxy_name = xRegistryRootKey->openKey("Settings/ooInetFTPProxyName");
if(ftpProxy_name.is() && !ftpProxy_name->getStringValue().isEmpty()) { if(ftpProxy_name.is() && !ftpProxy_name->getStringValue().isEmpty()) {
OUString ftpHost = "ftp.proxyHost="; OUString ftpHost = "ftp.proxyHost=" + ftpProxy_name->getStringValue();
ftpHost += ftpProxy_name->getStringValue();
// read ftp proxy port // read ftp proxy port
css::uno::Reference<css::registry::XRegistryKey> ftpProxy_port = xRegistryRootKey->openKey("Settings/ooInetFTPProxyPort"); css::uno::Reference<css::registry::XRegistryKey> ftpProxy_port = xRegistryRootKey->openKey("Settings/ooInetFTPProxyPort");
if(ftpProxy_port.is() && ftpProxy_port->getLongValue()) { if(ftpProxy_port.is() && ftpProxy_port->getLongValue()) {
OUString ftpPort = "ftp.proxyPort="; OUString ftpPort = "ftp.proxyPort=" + OUString::number(ftpProxy_port->getLongValue());
ftpPort += OUString::number(ftpProxy_port->getLongValue());
pjvm->pushProp(ftpHost); pjvm->pushProp(ftpHost);
pjvm->pushProp(ftpPort); pjvm->pushProp(ftpPort);
@@ -303,14 +301,12 @@ void getINetPropsFromConfig(stoc_javavm::JVM * pjvm,
// read http proxy name // read http proxy name
css::uno::Reference<css::registry::XRegistryKey> httpProxy_name = xRegistryRootKey->openKey("Settings/ooInetHTTPProxyName"); css::uno::Reference<css::registry::XRegistryKey> httpProxy_name = xRegistryRootKey->openKey("Settings/ooInetHTTPProxyName");
if(httpProxy_name.is() && !httpProxy_name->getStringValue().isEmpty()) { if(httpProxy_name.is() && !httpProxy_name->getStringValue().isEmpty()) {
OUString httpHost = "http.proxyHost="; OUString httpHost = "http.proxyHost=" + httpProxy_name->getStringValue();
httpHost += httpProxy_name->getStringValue();
// read http proxy port // read http proxy port
css::uno::Reference<css::registry::XRegistryKey> httpProxy_port = xRegistryRootKey->openKey("Settings/ooInetHTTPProxyPort"); css::uno::Reference<css::registry::XRegistryKey> httpProxy_port = xRegistryRootKey->openKey("Settings/ooInetHTTPProxyPort");
if(httpProxy_port.is() && httpProxy_port->getLongValue()) { if(httpProxy_port.is() && httpProxy_port->getLongValue()) {
OUString httpPort = "http.proxyPort="; OUString httpPort = "http.proxyPort=" + OUString::number(httpProxy_port->getLongValue());
httpPort += OUString::number(httpProxy_port->getLongValue());
pjvm->pushProp(httpHost); pjvm->pushProp(httpHost);
pjvm->pushProp(httpPort); pjvm->pushProp(httpPort);
@@ -320,14 +316,12 @@ void getINetPropsFromConfig(stoc_javavm::JVM * pjvm,
// read https proxy name // read https proxy name
css::uno::Reference<css::registry::XRegistryKey> httpsProxy_name = xRegistryRootKey->openKey("Settings/ooInetHTTPSProxyName"); css::uno::Reference<css::registry::XRegistryKey> httpsProxy_name = xRegistryRootKey->openKey("Settings/ooInetHTTPSProxyName");
if(httpsProxy_name.is() && !httpsProxy_name->getStringValue().isEmpty()) { if(httpsProxy_name.is() && !httpsProxy_name->getStringValue().isEmpty()) {
OUString httpsHost = "https.proxyHost="; OUString httpsHost = "https.proxyHost=" + httpsProxy_name->getStringValue();
httpsHost += httpsProxy_name->getStringValue();
// read https proxy port // read https proxy port
css::uno::Reference<css::registry::XRegistryKey> httpsProxy_port = xRegistryRootKey->openKey("Settings/ooInetHTTPSProxyPort"); css::uno::Reference<css::registry::XRegistryKey> httpsProxy_port = xRegistryRootKey->openKey("Settings/ooInetHTTPSProxyPort");
if(httpsProxy_port.is() && httpsProxy_port->getLongValue()) { if(httpsProxy_port.is() && httpsProxy_port->getLongValue()) {
OUString httpsPort = "https.proxyPort="; OUString httpsPort = "https.proxyPort=" + OUString::number(httpsProxy_port->getLongValue());
httpsPort += OUString::number(httpsProxy_port->getLongValue());
pjvm->pushProp(httpsHost); pjvm->pushProp(httpsHost);
pjvm->pushProp(httpsPort); pjvm->pushProp(httpsPort);
@@ -337,14 +331,12 @@ void getINetPropsFromConfig(stoc_javavm::JVM * pjvm,
// read nonProxyHosts // read nonProxyHosts
css::uno::Reference<css::registry::XRegistryKey> nonProxies_name = xRegistryRootKey->openKey("Settings/ooInetNoProxy"); css::uno::Reference<css::registry::XRegistryKey> nonProxies_name = xRegistryRootKey->openKey("Settings/ooInetNoProxy");
if(nonProxies_name.is() && !nonProxies_name->getStringValue().isEmpty()) { if(nonProxies_name.is() && !nonProxies_name->getStringValue().isEmpty()) {
OUString httpNonProxyHosts = "http.nonProxyHosts="; OUString value = nonProxies_name->getStringValue();
OUString ftpNonProxyHosts = "ftp.nonProxyHosts=";
OUString value= nonProxies_name->getStringValue();
// replace the separator ";" by "|" // replace the separator ";" by "|"
value= value.replace((sal_Unicode)';', (sal_Unicode)'|'); value = value.replace((sal_Unicode)';', (sal_Unicode)'|');
httpNonProxyHosts += value; OUString httpNonProxyHosts = "http.nonProxyHosts=" + value;
ftpNonProxyHosts += value; OUString ftpNonProxyHosts = "ftp.nonProxyHosts=" + value;
pjvm->pushProp(httpNonProxyHosts); pjvm->pushProp(httpNonProxyHosts);
pjvm->pushProp(ftpNonProxyHosts); pjvm->pushProp(ftpNonProxyHosts);
@@ -386,15 +378,15 @@ void getDefaultLocaleFromConfig(
country = locale->getStringValue().copy(index + 1); country = locale->getStringValue().copy(index + 1);
if(!language.isEmpty()) { if(!language.isEmpty()) {
OUString prop("user.language="); OUString prop = "user.language="
prop += language; + language;
pjvm->pushProp(prop); pjvm->pushProp(prop);
} }
if(!country.isEmpty()) { if(!country.isEmpty()) {
OUString prop("user.country="); OUString prop = "user.country="
prop += country; + country;
pjvm->pushProp(prop); pjvm->pushProp(prop);
} }

View File

@@ -50,10 +50,10 @@ ItemHolder2::ItemHolder2()
if(bMessage) if(bMessage)
{ {
bMessage = false; bMessage = false;
OString sMsg("CreateInstance with arguments exception: "); OString sMsg = "CreateInstance with arguments exception: "
sMsg += OString(rEx.Message.getStr(), + OString(rEx.Message.getStr(),
rEx.Message.getLength(), rEx.Message.getLength(),
RTL_TEXTENCODING_ASCII_US); RTL_TEXTENCODING_ASCII_US);
OSL_FAIL(sMsg.getStr()); OSL_FAIL(sMsg.getStr());
} }
} }

View File

@@ -166,17 +166,16 @@ uno::Sequence< OUString> GetPropertyNames(const OUString& rScheme)
{ RTL_CONSTASCII_USTRINGPARAM("/SQLComment"), false } { RTL_CONSTASCII_USTRINGPARAM("/SQLComment"), false }
}; };
int nIndex = 0; int nIndex = 0;
OUString sColor = cColor; OUString sBase = cColorSchemes
OUString sBase(cColorSchemes); + utl::wrapConfigurationElementName(rScheme);
sBase += utl::wrapConfigurationElementName(rScheme);
const int nCount = ColorConfigEntryCount; const int nCount = ColorConfigEntryCount;
for(sal_Int32 i = 0; i < 4 * nCount; i+= 4) for(sal_Int32 i = 0; i < 4 * nCount; i+= 4)
{ {
OUString sBaseName(sBase);
sal_Int32 nPos = i / 4; sal_Int32 nPos = i / 4;
sBaseName += OUString(cNames[nPos].cName, cNames[nPos].nLength, cNames[nPos].eEncoding); OUString sBaseName = sBase
+ OUString(cNames[nPos].cName, cNames[nPos].nLength, cNames[nPos].eEncoding);
pNames[nIndex] += sBaseName; pNames[nIndex] += sBaseName;
pNames[nIndex++] += sColor; pNames[nIndex++] += cColor;
if(cNames[nPos].bCanBeVisible) if(cNames[nPos].bCanBeVisible)
{ {
pNames[nIndex] += sBaseName; pNames[nIndex] += sBaseName;

View File

@@ -253,8 +253,8 @@ void ExtendedColorConfig_Impl::Load(const OUString& rScheme)
for(sal_Int32 i = 0;pIter != pEnd;++pIter,++i) for(sal_Int32 i = 0;pIter != pEnd;++pIter,++i)
{ {
uno::Sequence < OUString > aComponentDisplayNames(1); uno::Sequence < OUString > aComponentDisplayNames(1);
aComponentDisplayNames[0] = *pIter; aComponentDisplayNames[0] = *pIter
aComponentDisplayNames[0] += sDisplayName; + sDisplayName;
uno::Sequence< uno::Any > aComponentDisplayNamesValue = GetProperties( aComponentDisplayNames ); uno::Sequence< uno::Any > aComponentDisplayNamesValue = GetProperties( aComponentDisplayNames );
OUString sComponentDisplayName; OUString sComponentDisplayName;
if ( aComponentDisplayNamesValue.getLength() && (aComponentDisplayNamesValue[0] >>= sComponentDisplayName) ) if ( aComponentDisplayNamesValue.getLength() && (aComponentDisplayNamesValue[0] >>= sComponentDisplayName) )
@@ -295,8 +295,8 @@ void ExtendedColorConfig_Impl::Load(const OUString& rScheme)
} // if(!sScheme.getLength()) } // if(!sScheme.getLength())
m_sLoadedScheme = sScheme; m_sLoadedScheme = sScheme;
OUString sBase("ExtendedColorScheme/ColorSchemes/"); OUString sBase = "ExtendedColorScheme/ColorSchemes/"
sBase += sScheme; + sScheme;
bool bFound = ExistsScheme(sScheme); bool bFound = ExistsScheme(sScheme);
if ( bFound ) if ( bFound )
@@ -335,8 +335,8 @@ void ExtendedColorConfig_Impl::FillComponentColors(uno::Sequence < OUString >& _
OUString sComponentName = pIter->copy(pIter->lastIndexOf('/')+1); OUString sComponentName = pIter->copy(pIter->lastIndexOf('/')+1);
if ( m_aConfigValues.find(sComponentName) == m_aConfigValues.end() ) if ( m_aConfigValues.find(sComponentName) == m_aConfigValues.end() )
{ {
OUString sEntry = *pIter; OUString sEntry = *pIter
sEntry += sColorEntries; + sColorEntries;
uno::Sequence < OUString > aColorNames = GetPropertyNames(sEntry); uno::Sequence < OUString > aColorNames = GetPropertyNames(sEntry);
uno::Sequence < OUString > aDefaultColorNames = aColorNames; uno::Sequence < OUString > aDefaultColorNames = aColorNames;
@@ -411,25 +411,22 @@ void ExtendedColorConfig_Impl::ImplCommit()
return; return;
const OUString sColorEntries("Entries"); const OUString sColorEntries("Entries");
const OUString sColor("/Color"); const OUString sColor("/Color");
OUString sBase("ExtendedColorScheme/ColorSchemes/"); OUString sBase = "ExtendedColorScheme/ColorSchemes/"
+ m_sLoadedScheme;
const OUString s_sSep("/"); const OUString s_sSep("/");
sBase += m_sLoadedScheme;
TComponents::iterator aIter = m_aConfigValues.begin(); TComponents::iterator aIter = m_aConfigValues.begin();
TComponents::iterator aEnd = m_aConfigValues.end(); TComponents::iterator aEnd = m_aConfigValues.end();
for( ;aIter != aEnd;++aIter ) for( ;aIter != aEnd;++aIter )
{ {
OUString sEntry = aIter->first;
sEntry += sColorEntries;
if ( ConfigItem::AddNode(sBase, aIter->first) ) if ( ConfigItem::AddNode(sBase, aIter->first) )
{ {
OUString sNode = sBase; OUString sNode = sBase
sNode += s_sSep; + s_sSep
sNode += aIter->first; + aIter->first
//ConfigItem::AddNode(sNode, sColorEntries); //ConfigItem::AddNode(sNode, sColorEntries);
sNode += s_sSep; + s_sSep
sNode += sColorEntries; + sColorEntries;
uno::Sequence < beans::PropertyValue > aPropValues(aIter->second.first.size()); uno::Sequence < beans::PropertyValue > aPropValues(aIter->second.first.size());
beans::PropertyValue* pPropValues = aPropValues.getArray(); beans::PropertyValue* pPropValues = aPropValues.getArray();

View File

@@ -59,10 +59,10 @@ ItemHolder2::ItemHolder2()
if(bMessage) if(bMessage)
{ {
bMessage = false; bMessage = false;
OString sMsg("CreateInstance with arguments exception: "); OString sMsg = "CreateInstance with arguments exception: "
sMsg += OString(rEx.Message.getStr(), + OString(rEx.Message.getStr(),
rEx.Message.getLength(), rEx.Message.getLength(),
RTL_TEXTENCODING_ASCII_US); RTL_TEXTENCODING_ASCII_US);
OSL_FAIL(sMsg.getStr()); OSL_FAIL(sMsg.getStr());
} }
} }