tdf#100726 - Improve readability of OUString concatanations

Change-Id: I3ba75dbe6754b8138f61e223387832a6fb53c1c5
Reviewed-on: https://gerrit.libreoffice.org/52752
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Gökhan Gurbetoğlu
2018-04-12 02:08:51 +03:00
committed by Noel Grandin
parent 821371fb45
commit 3772961802
5 changed files with 105 additions and 110 deletions

View File

@@ -119,12 +119,10 @@ rtl_TextEncoding ScfTools::GetSystemTextEncoding()
OUString ScfTools::GetHexStr( sal_uInt16 nValue ) OUString ScfTools::GetHexStr( sal_uInt16 nValue )
{ {
const sal_Char pHex[] = "0123456789ABCDEF"; const sal_Char pHex[] = "0123456789ABCDEF";
OUString aStr; OUString aStr = OUString( pHex[ nValue >> 12 ] )
+ OUString( pHex[ (nValue >> 8) & 0x000F ] )
aStr += OUString( pHex[ nValue >> 12 ] ); + OUString( pHex[ (nValue >> 4) & 0x000F ] )
aStr += OUString( pHex[ (nValue >> 8) & 0x000F ] ); + OUString( pHex[ nValue & 0x000F ] );
aStr += OUString( pHex[ (nValue >> 4) & 0x000F ] );
aStr += OUString( pHex[ nValue & 0x000F ] );
return aStr; return aStr;
} }

View File

@@ -2100,12 +2100,12 @@ bool ScImportExport::Doc2Sylk( SvStream& rStrm )
rtl_math_StringFormat_Automatic, rtl_math_StringFormat_Automatic,
rtl_math_DecimalPlaces_Max, '.', true ); rtl_math_DecimalPlaces_Max, '.', true );
aBufStr = "C;X"; aBufStr = "C;X"
aBufStr += OUString::number( c ); + OUString::number( c )
aBufStr += ";Y"; + ";Y"
aBufStr += OUString::number( r ); + OUString::number( r )
aBufStr += ";K"; + ";K"
aBufStr += aValStr; + aValStr;
lcl_WriteSimpleString( rStrm, aBufStr ); lcl_WriteSimpleString( rStrm, aBufStr );
goto checkformula; goto checkformula;
@@ -2115,11 +2115,11 @@ bool ScImportExport::Doc2Sylk( SvStream& rStrm )
aCellStr = pDoc->GetString(nCol, nRow, aRange.aStart.Tab()); aCellStr = pDoc->GetString(nCol, nRow, aRange.aStart.Tab());
aCellStr = aCellStr.replaceAll("\n", SYLK_LF); aCellStr = aCellStr.replaceAll("\n", SYLK_LF);
aBufStr = "C;X"; aBufStr = "C;X"
aBufStr += OUString::number( c ); + OUString::number( c )
aBufStr += ";Y"; + ";Y"
aBufStr += OUString::number( r ); + OUString::number( r )
aBufStr += ";K"; + ";K";
lcl_WriteSimpleString( rStrm, aBufStr ); lcl_WriteSimpleString( rStrm, aBufStr );
lcl_WriteString( rStrm, aCellStr, '"', ';' ); lcl_WriteString( rStrm, aCellStr, '"', ';' );
@@ -2160,21 +2160,21 @@ bool ScImportExport::Doc2Sylk( SvStream& rStrm )
pFCell->GetMatColsRows( nC, nR ); pFCell->GetMatColsRows( nC, nR );
nC += c - 1; nC += c - 1;
nR += r - 1; nR += r - 1;
aPrefix = ";R"; aPrefix = ";R"
aPrefix += OUString::number( nR ); + OUString::number( nR )
aPrefix += ";C"; + ";C"
aPrefix += OUString::number( nC ); + OUString::number( nC )
aPrefix += ";M"; + ";M";
} }
break; break;
case ScMatrixMode::Reference : case ScMatrixMode::Reference :
{ // diff expression with 'I' M$-extension { // diff expression with 'I' M$-extension
ScAddress aPos; ScAddress aPos;
(void)pFCell->GetMatrixOrigin( aPos ); (void)pFCell->GetMatrixOrigin( aPos );
aPrefix = ";I;R"; aPrefix = ";I;R"
aPrefix += OUString::number( aPos.Row() - nStartRow + 1 ); + OUString::number( aPos.Row() - nStartRow + 1 )
aPrefix += ";C"; + ";C"
aPrefix += OUString::number( aPos.Col() - nStartCol + 1 ); + OUString::number( aPos.Col() - nStartCol + 1 );
} }
break; break;
default: default:

View File

@@ -174,14 +174,12 @@ public:
// close all still open tags // close all still open tags
OUString HtmlState::Flush() OUString HtmlState::Flush()
{ {
OUString aStr; OUString aStr = SetWeight(false)
+ SetItalic(false)
aStr += SetWeight(false); + SetUnderline(false)
aStr += SetItalic(false); + SetStrikeout(false)
aStr += SetUnderline(false); + SetColor(maDefColor)
aStr += SetStrikeout(false); + SetLink("","");
aStr += SetColor(maDefColor);
aStr += SetLink("","");
return aStr; return aStr;
} }

View File

@@ -143,14 +143,13 @@ OUString CreateSizeText( sal_Int64 nSize )
{ {
aSizeStr = ::rtl::math::doubleToUString( fSize, aSizeStr = ::rtl::math::doubleToUString( fSize,
rtl_math_StringFormat_F, nDec, rtl_math_StringFormat_F, nDec,
rLocaleWrapper.getNumDecimalSep()[0] ); rLocaleWrapper.getNumDecimalSep()[0] )
aSizeStr += aUnitStr; + aUnitStr
+ " ("
aSizeStr += " ("; + rLocaleWrapper.getNum( nSize2, 0 )
aSizeStr += rLocaleWrapper.getNum( nSize2, 0 ); + " "
aSizeStr += " "; + SfxResId(STR_BYTES)
aSizeStr += SfxResId(STR_BYTES); + ")";
aSizeStr += ")";
} }
return aSizeStr; return aSizeStr;
} }
@@ -161,9 +160,9 @@ OUString ConvertDateTime_Impl( const OUString& rName,
Date aD(uDT); Date aD(uDT);
tools::Time aT(uDT); tools::Time aT(uDT);
const OUString aDelim( ", " ); const OUString aDelim( ", " );
OUString aStr( rWrapper.getDate( aD ) ); OUString aStr = rWrapper.getDate( aD )
aStr += aDelim; + aDelim
aStr += rWrapper.getTime( aT ); + rWrapper.getTime( aT );
OUString aAuthor = comphelper::string::stripStart(rName, ' '); OUString aAuthor = comphelper::string::stripStart(rName, ' ');
if (!aAuthor.isEmpty()) if (!aAuthor.isEmpty())
{ {
@@ -726,9 +725,9 @@ namespace
Date aDate( _nDate ); Date aDate( _nDate );
tools::Time aTime( _nTime ); tools::Time aTime( _nTime );
OUString aStr( rWrapper.getDate( aDate ) ); OUString aStr = rWrapper.getDate( aDate )
aStr += ", "; + ", "
aStr += rWrapper.getTime( aTime ); + rWrapper.getTime( aTime );
return aStr; return aStr;
} }

View File

@@ -881,10 +881,10 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr,
sal_Int32 nLen = aRetSeq.getLength(); sal_Int32 nLen = aRetSeq.getLength();
aErrorStr = "Expected to find "; aErrorStr = "Expected to find "
aErrorStr += OString::valueOf( nDemandedPropCount ); + OString::valueOf( nDemandedPropCount )
aErrorStr += " properties but found "; + " properties but found "
aErrorStr += OString::valueOf( nLen ); + OString::valueOf( nLen );
OSL_ENSURE( nLen == nDemandedPropCount, aErrorStr.getStr() ); OSL_ENSURE( nLen == nDemandedPropCount, aErrorStr.getStr() );
const Property* pProps = aRetSeq.getConstArray(); const Property* pProps = aRetSeq.getConstArray();
@@ -909,23 +909,23 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr,
OString aNameStr( aPropName.getStr(), aPropName.getLength(), RTL_TEXTENCODING_ASCII_US ); OString aNameStr( aPropName.getStr(), aPropName.getLength(), RTL_TEXTENCODING_ASCII_US );
OString aDemandedName = pPropertyDefs[ iDemanded ].pName; OString aDemandedName = pPropertyDefs[ iDemanded ].pName;
aErrorStr = "Expected property \""; aErrorStr = "Expected property \""
aErrorStr += aDemandedName; + aDemandedName
aErrorStr += "\", found \""; + "\", found \""
aErrorStr += aNameStr; + aNameStr
aErrorStr += "\""; + "\"";
OSL_ENSURE( aNameStr == aDemandedName, aErrorStr.getStr() ); OSL_ENSURE( aNameStr == aDemandedName, aErrorStr.getStr() );
Type aPropType = aProp.Type; Type aPropType = aProp.Type;
OString aTypeNameStr( OUStringToOString(aPropType.getTypeName(), RTL_TEXTENCODING_ASCII_US) ); OString aTypeNameStr( OUStringToOString(aPropType.getTypeName(), RTL_TEXTENCODING_ASCII_US) );
OString aDemandedTypeNameStr = pDemandedPropTypes[ iDemanded ]; OString aDemandedTypeNameStr = pDemandedPropTypes[ iDemanded ];
aErrorStr = "Property \""; aErrorStr = "Property \""
aErrorStr += aDemandedName; + aDemandedName
aErrorStr += "\", expected type >"; + "\", expected type >"
aErrorStr += aDemandedTypeNameStr; + aDemandedTypeNameStr
aErrorStr += "< found type >"; + "< found type >"
aErrorStr += aTypeNameStr; + aTypeNameStr
aErrorStr += "<"; + "<";
OSL_ENSURE( aTypeNameStr == aDemandedTypeNameStr, aErrorStr.getStr() ); OSL_ENSURE( aTypeNameStr == aDemandedTypeNameStr, aErrorStr.getStr() );
// read and report value of property // read and report value of property
@@ -933,13 +933,13 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr,
OString aValStr = OUStringToOString( AnyToString( aPropVal, sal_False, xMgr ), RTL_TEXTENCODING_ASCII_US ); OString aValStr = OUStringToOString( AnyToString( aPropVal, sal_False, xMgr ), RTL_TEXTENCODING_ASCII_US );
OString aDemandedValStr = pDemandedPropVals[ iDemanded ]; OString aDemandedValStr = pDemandedPropVals[ iDemanded ];
aErrorStr = "Property \""; aErrorStr = "Property \""
aErrorStr += aDemandedName; + aDemandedName
aErrorStr += "\", expected val >"; + "\", expected val >"
aErrorStr += aDemandedValStr; + aDemandedValStr
aErrorStr += "< found val >"; + "< found val >"
aErrorStr += aValStr; + aValStr
aErrorStr += "<"; + "<";
OSL_ENSURE( aValStr == aDemandedValStr, aErrorStr.getStr() ); OSL_ENSURE( aValStr == aDemandedValStr, aErrorStr.getStr() );
// check value and modify it according to its type // check value and modify it according to its type
@@ -991,11 +991,11 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr,
OUString aExactName = xExactName->getExactName( aUpperUStr ); OUString aExactName = xExactName->getExactName( aUpperUStr );
if( aExactName != aPropName ) if( aExactName != aPropName )
{ {
aErrorStr = "Property \""; aErrorStr = "Property \""
aErrorStr += OUStringToOString( aPropName, RTL_TEXTENCODING_ASCII_US ); + OUStringToOString( aPropName, RTL_TEXTENCODING_ASCII_US )
aErrorStr += "\", not found as \""; + "\", not found as \""
aErrorStr += OUStringToOString(aUpperUStr, RTL_TEXTENCODING_ASCII_US ); + OUStringToOString(aUpperUStr, RTL_TEXTENCODING_ASCII_US )
aErrorStr += "\" using XExactName"; + "\" using XExactName";
OSL_ENSURE( sal_False, aErrorStr.getStr() ); OSL_ENSURE( sal_False, aErrorStr.getStr() );
} }
} }
@@ -1021,36 +1021,36 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr,
OUString aStr = AnyToString( aPropVal, sal_False, xMgr ); OUString aStr = AnyToString( aPropVal, sal_False, xMgr );
OString aModifiedValStr = OUStringToOString( aStr, RTL_TEXTENCODING_ASCII_US ); OString aModifiedValStr = OUStringToOString( aStr, RTL_TEXTENCODING_ASCII_US );
OString aDemandedModifiedValStr = pDemandedModifiedPropVals[ i ]; OString aDemandedModifiedValStr = pDemandedModifiedPropVals[ i ];
aErrorStr = "Property \""; aErrorStr = "Property \""
aErrorStr += aDemandedName; + aDemandedName
aErrorStr += "\", expected modified val >"; + "\", expected modified val >"
aErrorStr += aDemandedModifiedValStr; + aDemandedModifiedValStr
aErrorStr += "< found val >"; + "< found val >"
aErrorStr += aModifiedValStr; + aModifiedValStr
aErrorStr += "<"; + "<";
OSL_ENSURE( aModifiedValStr == aDemandedModifiedValStr, aErrorStr.getStr() ); OSL_ENSURE( aModifiedValStr == aDemandedModifiedValStr, aErrorStr.getStr() );
} }
// check whether all properties can be found individually // check whether all properties can be found individually
aErrorStr = "property \""; aErrorStr = "property \""
aErrorStr += aDemandedName; + aDemandedName
aErrorStr += "\" not found with hasProperty()"; + "\" not found with hasProperty()";
OUString aWDemandedName = OStringToOUString(aDemandedName, RTL_TEXTENCODING_ASCII_US ); OUString aWDemandedName = OStringToOUString(aDemandedName, RTL_TEXTENCODING_ASCII_US );
sal_Bool bProperty = xAccess->hasProperty( aWDemandedName, nConcepts ); sal_Bool bProperty = xAccess->hasProperty( aWDemandedName, nConcepts );
OSL_ENSURE( bProperty, aErrorStr.getStr() ); OSL_ENSURE( bProperty, aErrorStr.getStr() );
aErrorStr = "property \""; aErrorStr = "property \""
aErrorStr += aDemandedName; + aDemandedName
aErrorStr += "\" not equal to same Property in sequence returned by getProperties()"; + "\" not equal to same Property in sequence returned by getProperties()";
try try
{ {
Property aGetProp = xAccess->getProperty( aWDemandedName, nConcepts ); Property aGetProp = xAccess->getProperty( aWDemandedName, nConcepts );
} }
catch (const RuntimeException &) catch (const RuntimeException &)
{ {
aErrorStr = "property \""; aErrorStr = "property \""
aErrorStr += aDemandedName; + aDemandedName
aErrorStr += "\", exception was thrown when trying getProperty()"; + "\", exception was thrown when trying getProperty()";
OSL_ENSURE( sal_False, aErrorStr.getStr() ); OSL_ENSURE( sal_False, aErrorStr.getStr() );
} }
@@ -1080,10 +1080,10 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr,
Sequence< Reference< XIdlMethod > > aMethodSeq = xAccess->getMethods( nRealConcepts ); Sequence< Reference< XIdlMethod > > aMethodSeq = xAccess->getMethods( nRealConcepts );
sal_Int32 nLen = aMethodSeq.getLength(); sal_Int32 nLen = aMethodSeq.getLength();
aErrorStr = "Expected to find "; aErrorStr = "Expected to find "
aErrorStr += OString::valueOf( nDemandedMethCount ); + OString::valueOf( nDemandedMethCount )
aErrorStr += " methods but found "; + " methods but found "
aErrorStr += OString::valueOf( nLen ); + OString::valueOf( nLen );
OSL_ENSURE( nLen == nDemandedMethCount, aErrorStr.getStr() ); OSL_ENSURE( nLen == nDemandedMethCount, aErrorStr.getStr() );
const Reference< XIdlMethod >* pMethods = aMethodSeq.getConstArray(); const Reference< XIdlMethod >* pMethods = aMethodSeq.getConstArray();
@@ -1107,24 +1107,24 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr,
OString aDemandedName = pMethodDefs[ iList ].pName; OString aDemandedName = pMethodDefs[ iList ].pName;
iList++; iList++;
aErrorStr = "Expected method \""; aErrorStr = "Expected method \""
aErrorStr += aDemandedName; + aDemandedName
aErrorStr += "\", found \""; + "\", found \""
aErrorStr += aNameStr; + aNameStr
aErrorStr += "\""; + "\"";
OSL_ENSURE( aNameStr == aDemandedName, aErrorStr.getStr() ); OSL_ENSURE( aNameStr == aDemandedName, aErrorStr.getStr() );
// Check that the method is really there with hasMethod. // Check that the method is really there with hasMethod.
aErrorStr = "method \""; aErrorStr = "method \""
aErrorStr += aDemandedName; + aDemandedName
aErrorStr += "\" not found with hasMethod()"; + "\" not found with hasMethod()";
OUString aWDemandedName = OStringToOUString(aDemandedName, RTL_TEXTENCODING_ASCII_US ); OUString aWDemandedName = OStringToOUString(aDemandedName, RTL_TEXTENCODING_ASCII_US );
sal_Bool bMethod = xAccess->hasMethod( aWDemandedName, nRealConcepts ); sal_Bool bMethod = xAccess->hasMethod( aWDemandedName, nRealConcepts );
OSL_ENSURE( bMethod, aErrorStr.getStr() ); OSL_ENSURE( bMethod, aErrorStr.getStr() );
aErrorStr = "method \""; aErrorStr = "method \""
aErrorStr += aDemandedName; + aDemandedName
aErrorStr += "\" not equal to same method in sequence returned by getMethods()"; + "\" not equal to same method in sequence returned by getMethods()";
try try
{ {
Reference< XIdlMethod > xGetMethod = xAccess->getMethod( aWDemandedName, nRealConcepts ); Reference< XIdlMethod > xGetMethod = xAccess->getMethod( aWDemandedName, nRealConcepts );
@@ -1132,9 +1132,9 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr,
} }
catch (const RuntimeException &) catch (const RuntimeException &)
{ {
aErrorStr = "method \""; aErrorStr = "method \""
aErrorStr += aDemandedName; + aDemandedName
aErrorStr += "\", exception was thrown when trying getMethod()"; + "\", exception was thrown when trying getMethod()";
OSL_ENSURE( sal_False, aErrorStr.getStr() ); OSL_ENSURE( sal_False, aErrorStr.getStr() );
} }
} }