diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-03-30 10:57:25 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-03-30 13:53:28 +0000 |
commit | 5988a3cf91e2cb5bf1628b88965e3652932e4eb6 (patch) | |
tree | e1b0d898b60b570bd7ec9ad2f7e866232cdccaf2 /xmloff/source/style | |
parent | a5084d15e1b72e303e1628fbff84432036b014a9 (diff) |
loplugin:stringadd in xmloff
when applying my upcoming patch to also consider O[U]StringBuffer
Change-Id: Id38d983e59386554c61e9bdcd9333554bbf4665c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149756
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff/source/style')
-rw-r--r-- | xmloff/source/style/XMLBitmapRepeatOffsetPropertyHandler.cxx | 3 | ||||
-rw-r--r-- | xmloff/source/style/XMLClipPropertyHandler.cxx | 3 | ||||
-rw-r--r-- | xmloff/source/style/bordrhdl.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/style/chrhghdl.cxx | 3 | ||||
-rw-r--r-- | xmloff/source/style/fonthdl.cxx | 5 | ||||
-rw-r--r-- | xmloff/source/style/impastpl.cxx | 40 | ||||
-rw-r--r-- | xmloff/source/style/xmlnumfe.cxx | 13 |
7 files changed, 25 insertions, 46 deletions
diff --git a/xmloff/source/style/XMLBitmapRepeatOffsetPropertyHandler.cxx b/xmloff/source/style/XMLBitmapRepeatOffsetPropertyHandler.cxx index 29e743dfa3f0..c4a9384bfd1e 100644 --- a/xmloff/source/style/XMLBitmapRepeatOffsetPropertyHandler.cxx +++ b/xmloff/source/style/XMLBitmapRepeatOffsetPropertyHandler.cxx @@ -81,8 +81,7 @@ bool XMLBitmapRepeatOffsetPropertyHandler::exportXML( { OUStringBuffer aOut; ::sax::Converter::convertPercent( aOut, nValue ); - aOut.append( ' ' ); - aOut.append( mbX ? msHorizontal : msVertical ); + aOut.append( " " + ( mbX ? msHorizontal : msVertical ) ); rStrExpValue = aOut.makeStringAndClear(); return true; diff --git a/xmloff/source/style/XMLClipPropertyHandler.cxx b/xmloff/source/style/XMLClipPropertyHandler.cxx index 4bfa563d2ade..7a4d01cd99df 100644 --- a/xmloff/source/style/XMLClipPropertyHandler.cxx +++ b/xmloff/source/style/XMLClipPropertyHandler.cxx @@ -114,8 +114,7 @@ bool XMLClipPropertyHandler::exportXML( OUString& rStrExpValue, const uno::Any& if( rValue >>= aCrop ) { - aOut.append( GetXMLToken(XML_RECT) ); - aOut.append( '(' ); + aOut.append( GetXMLToken(XML_RECT) + "(" ); rUnitConverter.convertMeasureToXML( aOut, aCrop.Top ); if( !m_bODF11 ) aOut.append( ',' ); diff --git a/xmloff/source/style/bordrhdl.cxx b/xmloff/source/style/bordrhdl.cxx index 4b3a7b666cd2..d04d3f2f85c9 100644 --- a/xmloff/source/style/bordrhdl.cxx +++ b/xmloff/source/style/bordrhdl.cxx @@ -336,9 +336,7 @@ bool XMLBorderHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, co default: break; } - aOut.append( GetXMLToken( eStyleToken ) ); - - aOut.append( ' ' ); + aOut.append( GetXMLToken( eStyleToken ) + " " ); ::sax::Converter::convertColor( aOut, aBorderLine.Color ); } diff --git a/xmloff/source/style/chrhghdl.cxx b/xmloff/source/style/chrhghdl.cxx index 5417800c6d18..53048812726b 100644 --- a/xmloff/source/style/chrhghdl.cxx +++ b/xmloff/source/style/chrhghdl.cxx @@ -66,8 +66,7 @@ bool XMLCharHeightHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue fSize = ::std::max<float>(fSize, 1.0f); // fdo#49876: 0pt is invalid ::sax::Converter::convertDouble(aOut, static_cast<double>(fSize), true, util::MeasureUnit::POINT, util::MeasureUnit::POINT); - aOut.append( 'p'); - aOut.append( 't'); + aOut.append( "pt" ); } rStrExpValue = aOut.makeStringAndClear(); diff --git a/xmloff/source/style/fonthdl.cxx b/xmloff/source/style/fonthdl.cxx index 3d736a1f1a75..d85f425ae662 100644 --- a/xmloff/source/style/fonthdl.cxx +++ b/xmloff/source/style/fonthdl.cxx @@ -155,10 +155,7 @@ bool XMLFontFamilyNamePropHdl::exportXML( OUString& rStrExpValue, const uno::Any if( nFirst <= nLast ) { if( !sValue.isEmpty() ) - { - sValue.append( ',' ); - sValue.append( ' ' ); - } + sValue.append( ", " ); sal_Int32 nLen = nLast-nFirst+1; std::u16string_view sFamily( aStrFamilyName.subView( nFirst, nLen ) ); bool bQuote = false; diff --git a/xmloff/source/style/impastpl.cxx b/xmloff/source/style/impastpl.cxx index 948c1dde3b8e..14507b4ea69d 100644 --- a/xmloff/source/style/impastpl.cxx +++ b/xmloff/source/style/impastpl.cxx @@ -70,9 +70,7 @@ struct2string(void *data, { assert(type->eTypeClass == typelib_TypeClass_STRUCT); - OUStringBuffer result; - - result.append("{"); + OUStringBuffer result("{"); const typelib_CompoundTypeDescription *compoundType = &reinterpret_cast<const typelib_StructTypeDescription*>(type)->aBase; @@ -81,9 +79,10 @@ struct2string(void *data, { if (i > 0) result.append(":"); - result.append(compoundType->ppMemberNames[i]); - result.append("="); - result.append(data2string(static_cast<char *>(data)+compoundType->pMemberOffsets[i], + result.append( + OUString::unacquired(&compoundType->ppMemberNames[i]) + + "=" + + data2string(static_cast<char *>(data)+compoundType->pMemberOffsets[i], compoundType->ppTypeRefs[i])); } @@ -161,8 +160,7 @@ XMLAutoStylePoolProperties::XMLAutoStylePoolProperties( XMLAutoStyleFamily& rFam if (!rParentName.isEmpty()) { - aStemBuffer.append("-"); - aStemBuffer.append(rParentName); + aStemBuffer.append("-" + rParentName); } // Create a name based on the properties used @@ -173,12 +171,13 @@ XMLAutoStylePoolProperties::XMLAutoStylePoolProperties( XMLAutoStyleFamily& rFam OUString sXMLName(rFamilyData.mxMapper->getPropertySetMapper()->GetEntryXMLName(rState.mnIndex)); if (sXMLName.isEmpty()) continue; - aStemBuffer.append("-"); - aStemBuffer.append(static_cast<sal_Int32>(rFamilyData.mxMapper->getPropertySetMapper()->GetEntryNameSpace(rState.mnIndex))); - aStemBuffer.append(":"); - aStemBuffer.append(sXMLName); - aStemBuffer.append("="); - aStemBuffer.append(any2string(rState.maValue)); + aStemBuffer.append( + "-" + + OUString::number(static_cast<sal_Int32>(rFamilyData.mxMapper->getPropertySetMapper()->GetEntryNameSpace(rState.mnIndex))) + + ":" + + sXMLName + + "=" + + any2string(rState.maValue)); } #if 0 @@ -191,9 +190,8 @@ XMLAutoStylePoolProperties::XMLAutoStylePoolProperties( XMLAutoStyleFamily& rFam // create a name that hasn't been used before. The created name has not // to be added to the array, because it will never tried again - OUStringBuffer aTry( aStemBuffer ); - msName = aTry.makeStringAndClear(); + msName = aStemBuffer; bool bWarned = false; while (rFamilyData.maNameSet.find(msName) != rFamilyData.maNameSet.end()) @@ -202,10 +200,7 @@ XMLAutoStylePoolProperties::XMLAutoStylePoolProperties( XMLAutoStyleFamily& rFam SAL_WARN("xmloff", "Overlapping style name for " << msName); bWarned = true; rFamilyData.mnName++; - aTry.append( aStemBuffer ); - aTry.append( "-" ); - aTry.append( static_cast<sal_Int64>(rFamilyData.mnName) ); - msName = aTry.makeStringAndClear(); + msName = aStemBuffer + "-" + OUString::number( static_cast<sal_Int64>(rFamilyData.mnName) ); } rFamilyData.maNameSet.insert(msName); } @@ -213,13 +208,10 @@ XMLAutoStylePoolProperties::XMLAutoStylePoolProperties( XMLAutoStyleFamily& rFam { // create a name that hasn't been used before. The created name has not // to be added to the array, because it will never tried again - OUStringBuffer sBuffer( 7 ); do { rFamilyData.mnName++; - sBuffer.append( rFamilyData.maStrPrefix ); - sBuffer.append( static_cast<sal_Int64>(rFamilyData.mnName) ); - msName = sBuffer.makeStringAndClear(); + msName = rFamilyData.maStrPrefix + OUString::number( static_cast<sal_Int64>(rFamilyData.mnName) ); } while (rFamilyData.maNameSet.find(msName) != rFamilyData.maNameSet.end() || rFamilyData.maReservedNameSet.find(msName) != rFamilyData.maReservedNameSet.end()); } diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx index 7d44f43342ef..a335f79ae23a 100644 --- a/xmloff/source/style/xmlnumfe.cxx +++ b/xmloff/source/style/xmlnumfe.cxx @@ -274,15 +274,10 @@ SvXMLNumFmtExport::~SvXMLNumFmtExport() static OUString lcl_CreateStyleName( sal_Int32 nKey, sal_Int32 nPart, bool bDefPart, std::u16string_view rPrefix ) { - OUStringBuffer aFmtName(10); - aFmtName.append( rPrefix ); - aFmtName.append( nKey ); - if (!bDefPart) - { - aFmtName.append( 'P' ); - aFmtName.append( nPart ); - } - return aFmtName.makeStringAndClear(); + if (bDefPart) + return rPrefix + OUString::number(nKey); + else + return rPrefix + OUString::number(nKey) + "P" + OUString::number( nPart ); } void SvXMLNumFmtExport::AddCalendarAttr_Impl( const OUString& rCalendar ) |