diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-28 11:31:19 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-28 17:23:49 +0200 |
commit | f74281a026a1b231292c928acd2c6f1aa0ba1552 (patch) | |
tree | c26750944ab6023b914446be06754a214ea5314b /xmloff | |
parent | 0c64757b574f8dcffe76087db34310786029e625 (diff) |
loplugin:stringloop in xmloff
Change-Id: I33a24e08b7359a75c41b88c21ee31c22b8c62d05
Reviewed-on: https://gerrit.libreoffice.org/58215
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/draw/shapeexport.cxx | 17 | ||||
-rw-r--r-- | xmloff/source/draw/xexptran.cxx | 108 | ||||
-rw-r--r-- | xmloff/source/forms/elementimport.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/forms/eventexport.cxx | 7 | ||||
-rw-r--r-- | xmloff/source/forms/layerimport.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/forms/propertyexport.cxx | 12 | ||||
-rw-r--r-- | xmloff/source/style/XMLFontAutoStylePool.cxx | 5 | ||||
-rw-r--r-- | xmloff/source/style/xmlnumfe.cxx | 6 | ||||
-rw-r--r-- | xmloff/source/text/XMLTextFrameContext.cxx | 3 | ||||
-rw-r--r-- | xmloff/source/text/txtlists.cxx | 3 |
10 files changed, 77 insertions, 92 deletions
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index 7c443b2b8b06..88af6541c444 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -3694,18 +3694,15 @@ void XMLShapeExport::export3DLamps( const css::uno::Reference< css::beans::XProp const OUString aDirectionPropName("D3DSceneLightDirection"); const OUString aLightOnPropName("D3DSceneLightOn"); - OUString aPropName; - OUString aIndexStr; ::basegfx::B3DVector aLightDirection; drawing::Direction3D aLightDir; bool bLightOnOff = false; for(sal_Int32 nLamp = 1; nLamp <= 8; nLamp++) { - aIndexStr = OUString::number( nLamp ); + OUString aIndexStr = OUString::number( nLamp ); // lightcolor - aPropName = aColorPropName; - aPropName += aIndexStr; + OUString aPropName = aColorPropName + aIndexStr; sal_Int32 nLightColor = 0; xPropSet->getPropertyValue( aPropName ) >>= nLightColor; ::sax::Converter::convertColor(sStringBuffer, nLightColor); @@ -3713,8 +3710,7 @@ void XMLShapeExport::export3DLamps( const css::uno::Reference< css::beans::XProp mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_DIFFUSE_COLOR, aStr); // lightdirection - aPropName = aDirectionPropName; - aPropName += aIndexStr; + aPropName = aDirectionPropName + aIndexStr; xPropSet->getPropertyValue(aPropName) >>= aLightDir; aLightDirection = ::basegfx::B3DVector(aLightDir.DirectionX, aLightDir.DirectionY, aLightDir.DirectionZ); SvXMLUnitConverter::convertB3DVector(sStringBuffer, aLightDirection); @@ -3722,8 +3718,7 @@ void XMLShapeExport::export3DLamps( const css::uno::Reference< css::beans::XProp mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_DIRECTION, aStr); // lighton - aPropName = aLightOnPropName; - aPropName += aIndexStr; + aPropName = aLightOnPropName + aIndexStr; xPropSet->getPropertyValue(aPropName) >>= bLightOnOff; ::sax::Converter::convertBool(sStringBuffer, bLightOnOff); aStr = sStringBuffer.makeStringAndClear(); @@ -4915,9 +4910,7 @@ void XMLShapeExport::ImpExportTableShape( const uno::Reference< drawing::XShape sal_Int32 nIndex = 0; do { - sPictureName = "TablePreview"; - sPictureName += OUString::number( ++nIndex ); - sPictureName += ".svm"; + sPictureName = "TablePreview" + OUString::number( ++nIndex ) + ".svm"; } while( xPictureStorage->hasByName( sPictureName ) ); diff --git a/xmloff/source/draw/xexptran.cxx b/xmloff/source/draw/xexptran.cxx index fc4a4a30fc38..a771f0da7599 100644 --- a/xmloff/source/draw/xexptran.cxx +++ b/xmloff/source/draw/xexptran.cxx @@ -148,7 +148,7 @@ void Imp_PutDoubleChar(OUString& rStr, double fValue) rStr += sStringBuffer.makeStringAndClear(); } -void Imp_PutDoubleChar(OUString& rStr, const SvXMLUnitConverter& rConv, double fValue, +void Imp_PutDoubleChar(OUStringBuffer& rStr, const SvXMLUnitConverter& rConv, double fValue, bool bConvertUnits = false) { OUStringBuffer sStringBuffer; @@ -160,7 +160,7 @@ void Imp_PutDoubleChar(OUString& rStr, const SvXMLUnitConverter& rConv, double f ::sax::Converter::convertDouble(sStringBuffer, fValue); } - rStr += sStringBuffer.makeStringAndClear(); + rStr.append(sStringBuffer); } // base class of all 2D transform objects @@ -243,7 +243,7 @@ void SdXMLImExTransform2D::AddSkewX(double fNew) // gen string for export const OUString& SdXMLImExTransform2D::GetExportString(const SvXMLUnitConverter& rConv) { - OUString aNewString; + OUStringBuffer aNewString; OUString aClosingBrace(")"); OUString aEmptySpace(" "); @@ -255,71 +255,71 @@ const OUString& SdXMLImExTransform2D::GetExportString(const SvXMLUnitConverter& { case IMP_SDXMLEXP_TRANSOBJ2D_ROTATE : { - aNewString += "rotate ("; + aNewString.append("rotate ("); Imp_PutDoubleChar(aNewString, rConv, static_cast<ImpSdXMLExpTransObj2DRotate*>(pObj)->mfRotate); - aNewString += aClosingBrace; + aNewString.append(aClosingBrace); break; } case IMP_SDXMLEXP_TRANSOBJ2D_SCALE : { - aNewString += "scale ("; + aNewString.append("scale ("); Imp_PutDoubleChar(aNewString, rConv, static_cast<ImpSdXMLExpTransObj2DScale*>(pObj)->maScale.getX()); - aNewString += aEmptySpace; + aNewString.append(aEmptySpace); Imp_PutDoubleChar(aNewString, rConv, static_cast<ImpSdXMLExpTransObj2DScale*>(pObj)->maScale.getY()); - aNewString += aClosingBrace; + aNewString.append(aClosingBrace); break; } case IMP_SDXMLEXP_TRANSOBJ2D_TRANSLATE : { - aNewString += "translate ("; + aNewString.append("translate ("); Imp_PutDoubleChar(aNewString, rConv, static_cast<ImpSdXMLExpTransObj2DTranslate*>(pObj)->maTranslate.getX(), true); - aNewString += aEmptySpace; + aNewString.append(aEmptySpace); Imp_PutDoubleChar(aNewString, rConv, static_cast<ImpSdXMLExpTransObj2DTranslate*>(pObj)->maTranslate.getY(), true); - aNewString += aClosingBrace; + aNewString.append(aClosingBrace); break; } case IMP_SDXMLEXP_TRANSOBJ2D_SKEWX : { - aNewString += "skewX ("; + aNewString.append("skewX ("); Imp_PutDoubleChar(aNewString, rConv, static_cast<ImpSdXMLExpTransObj2DSkewX*>(pObj)->mfSkewX); - aNewString += aClosingBrace; + aNewString.append(aClosingBrace); break; } case IMP_SDXMLEXP_TRANSOBJ2D_SKEWY : { - aNewString += "skewY ("; + aNewString.append("skewY ("); Imp_PutDoubleChar(aNewString, rConv, static_cast<ImpSdXMLExpTransObj2DSkewY*>(pObj)->mfSkewY); - aNewString += aClosingBrace; + aNewString.append(aClosingBrace); break; } case IMP_SDXMLEXP_TRANSOBJ2D_MATRIX : { - aNewString += "matrix ("; + aNewString.append("matrix ("); // a Imp_PutDoubleChar(aNewString, rConv, static_cast<ImpSdXMLExpTransObj2DMatrix*>(pObj)->maMatrix.get(0, 0)); - aNewString += aEmptySpace; + aNewString.append(aEmptySpace); // b Imp_PutDoubleChar(aNewString, rConv, static_cast<ImpSdXMLExpTransObj2DMatrix*>(pObj)->maMatrix.get(1, 0)); - aNewString += aEmptySpace; + aNewString.append(aEmptySpace); // c Imp_PutDoubleChar(aNewString, rConv, static_cast<ImpSdXMLExpTransObj2DMatrix*>(pObj)->maMatrix.get(0, 1)); - aNewString += aEmptySpace; + aNewString.append(aEmptySpace); // d Imp_PutDoubleChar(aNewString, rConv, static_cast<ImpSdXMLExpTransObj2DMatrix*>(pObj)->maMatrix.get(1, 1)); - aNewString += aEmptySpace; + aNewString.append(aEmptySpace); // e Imp_PutDoubleChar(aNewString, rConv, static_cast<ImpSdXMLExpTransObj2DMatrix*>(pObj)->maMatrix.get(0, 2), true); - aNewString += aEmptySpace; + aNewString.append(aEmptySpace); // f Imp_PutDoubleChar(aNewString, rConv, static_cast<ImpSdXMLExpTransObj2DMatrix*>(pObj)->maMatrix.get(1, 2), true); - aNewString += aClosingBrace; + aNewString.append(aClosingBrace); break; } default : @@ -332,12 +332,12 @@ const OUString& SdXMLImExTransform2D::GetExportString(const SvXMLUnitConverter& // if not the last entry, add one space to next tag if(a + 1 != maList.size()) { - aNewString += aEmptySpace; + aNewString.append(aEmptySpace); } } // fill string form OUString - msString = aNewString; + msString = aNewString.makeStringAndClear(); return msString; } @@ -606,7 +606,7 @@ void SdXMLImExTransform3D::AddHomogenMatrix(const drawing::HomogenMatrix& xHomMa // gen string for export const OUString& SdXMLImExTransform3D::GetExportString(const SvXMLUnitConverter& rConv) { - OUString aNewString; + OUStringBuffer aNewString; OUString aClosingBrace(")"); OUString aEmptySpace(" "); @@ -618,99 +618,99 @@ const OUString& SdXMLImExTransform3D::GetExportString(const SvXMLUnitConverter& { case IMP_SDXMLEXP_TRANSOBJ3D_ROTATE_X : { - aNewString += "rotatex ("; + aNewString.append("rotatex ("); Imp_PutDoubleChar(aNewString, rConv, basegfx::rad2deg( static_cast<ImpSdXMLExpTransObj3DRotateX*>(pObj)->mfRotateX) ); - aNewString += aClosingBrace; + aNewString.append(aClosingBrace); break; } case IMP_SDXMLEXP_TRANSOBJ3D_ROTATE_Y : { - aNewString += "rotatey ("; + aNewString.append("rotatey ("); Imp_PutDoubleChar(aNewString, rConv, basegfx::rad2deg( static_cast<ImpSdXMLExpTransObj3DRotateY*>(pObj)->mfRotateY) ); - aNewString += aClosingBrace; + aNewString.append(aClosingBrace); break; } case IMP_SDXMLEXP_TRANSOBJ3D_ROTATE_Z : { - aNewString += "rotatez ("; + aNewString.append("rotatez ("); Imp_PutDoubleChar(aNewString, rConv, basegfx::rad2deg( static_cast<ImpSdXMLExpTransObj3DRotateZ*>(pObj)->mfRotateZ) ); - aNewString += aClosingBrace; + aNewString.append(aClosingBrace); break; } case IMP_SDXMLEXP_TRANSOBJ3D_SCALE : { - aNewString += "scale ("; + aNewString.append("scale ("); Imp_PutDoubleChar(aNewString, rConv, static_cast<ImpSdXMLExpTransObj3DScale*>(pObj)->maScale.getX()); - aNewString += aEmptySpace; + aNewString.append(aEmptySpace); Imp_PutDoubleChar(aNewString, rConv, static_cast<ImpSdXMLExpTransObj3DScale*>(pObj)->maScale.getY()); - aNewString += aEmptySpace; + aNewString.append(aEmptySpace); Imp_PutDoubleChar(aNewString, rConv, static_cast<ImpSdXMLExpTransObj3DScale*>(pObj)->maScale.getZ()); - aNewString += aClosingBrace; + aNewString.append(aClosingBrace); break; } case IMP_SDXMLEXP_TRANSOBJ3D_TRANSLATE : { - aNewString += "translate ("; + aNewString.append("translate ("); Imp_PutDoubleChar(aNewString, rConv, static_cast<ImpSdXMLExpTransObj3DTranslate*>(pObj)->maTranslate.getX(), true); - aNewString += aEmptySpace; + aNewString.append(aEmptySpace); Imp_PutDoubleChar(aNewString, rConv, static_cast<ImpSdXMLExpTransObj3DTranslate*>(pObj)->maTranslate.getY(), true); - aNewString += aEmptySpace; + aNewString.append(aEmptySpace); Imp_PutDoubleChar(aNewString, rConv, static_cast<ImpSdXMLExpTransObj3DTranslate*>(pObj)->maTranslate.getZ(), true); - aNewString += aClosingBrace; + aNewString.append(aClosingBrace); break; } case IMP_SDXMLEXP_TRANSOBJ3D_MATRIX : { - aNewString += "matrix ("; + aNewString.append("matrix ("); // a Imp_PutDoubleChar(aNewString, rConv, static_cast<ImpSdXMLExpTransObj3DMatrix*>(pObj)->maMatrix.get(0, 0)); - aNewString += aEmptySpace; + aNewString.append(aEmptySpace); // b Imp_PutDoubleChar(aNewString, rConv, static_cast<ImpSdXMLExpTransObj3DMatrix*>(pObj)->maMatrix.get(1, 0)); - aNewString += aEmptySpace; + aNewString.append(aEmptySpace); // c Imp_PutDoubleChar(aNewString, rConv, static_cast<ImpSdXMLExpTransObj3DMatrix*>(pObj)->maMatrix.get(2, 0)); - aNewString += aEmptySpace; + aNewString.append(aEmptySpace); // d Imp_PutDoubleChar(aNewString, rConv, static_cast<ImpSdXMLExpTransObj3DMatrix*>(pObj)->maMatrix.get(0, 1)); - aNewString += aEmptySpace; + aNewString.append(aEmptySpace); // e Imp_PutDoubleChar(aNewString, rConv, static_cast<ImpSdXMLExpTransObj3DMatrix*>(pObj)->maMatrix.get(1, 1)); - aNewString += aEmptySpace; + aNewString.append(aEmptySpace); // f Imp_PutDoubleChar(aNewString, rConv, static_cast<ImpSdXMLExpTransObj3DMatrix*>(pObj)->maMatrix.get(2, 1)); - aNewString += aEmptySpace; + aNewString.append(aEmptySpace); // g Imp_PutDoubleChar(aNewString, rConv, static_cast<ImpSdXMLExpTransObj3DMatrix*>(pObj)->maMatrix.get(0, 2)); - aNewString += aEmptySpace; + aNewString.append(aEmptySpace); // h Imp_PutDoubleChar(aNewString, rConv, static_cast<ImpSdXMLExpTransObj3DMatrix*>(pObj)->maMatrix.get(1, 2)); - aNewString += aEmptySpace; + aNewString.append(aEmptySpace); // i Imp_PutDoubleChar(aNewString, rConv, static_cast<ImpSdXMLExpTransObj3DMatrix*>(pObj)->maMatrix.get(2, 2)); - aNewString += aEmptySpace; + aNewString.append(aEmptySpace); // j Imp_PutDoubleChar(aNewString, rConv, static_cast<ImpSdXMLExpTransObj3DMatrix*>(pObj)->maMatrix.get(0, 3), true); - aNewString += aEmptySpace; + aNewString.append(aEmptySpace); // k Imp_PutDoubleChar(aNewString, rConv, static_cast<ImpSdXMLExpTransObj3DMatrix*>(pObj)->maMatrix.get(1, 3), true); - aNewString += aEmptySpace; + aNewString.append(aEmptySpace); // l Imp_PutDoubleChar(aNewString, rConv, static_cast<ImpSdXMLExpTransObj3DMatrix*>(pObj)->maMatrix.get(2, 3), true); - aNewString += aClosingBrace; + aNewString.append(aClosingBrace); break; } default : @@ -723,12 +723,12 @@ const OUString& SdXMLImExTransform3D::GetExportString(const SvXMLUnitConverter& // if not the last entry, add one space to next tag if(a + 1 != maList.size()) { - aNewString += aEmptySpace; + aNewString.append(aEmptySpace); } } // fill string form OUString - msString = aNewString; + msString = aNewString.makeStringAndClear(); return msString; } diff --git a/xmloff/source/forms/elementimport.cxx b/xmloff/source/forms/elementimport.cxx index 4850289e346f..2d63175aa17e 100644 --- a/xmloff/source/forms/elementimport.cxx +++ b/xmloff/source/forms/elementimport.cxx @@ -454,14 +454,12 @@ namespace xmloff return OUString(sUnnamedName); Sequence< OUString > aNames = m_xParentContainer->getElementNames(); - OUString sReturn; const OUString* pNames = nullptr; const OUString* pNamesEnd = aNames.getConstArray() + aNames.getLength(); for (sal_Int32 i=0; i<32768; ++i) // the limit is nearly arbitrary ... { // assemble the new name (suggestion) - sReturn = sUnnamedName; - sReturn += OUString::number(i); + OUString sReturn = sUnnamedName + OUString::number(i); // check the existence (this is the bad performance part ....) for (pNames = aNames.getConstArray(); pNames<pNamesEnd; ++pNames) { diff --git a/xmloff/source/forms/eventexport.cxx b/xmloff/source/forms/eventexport.cxx index 24c6d6cd3bda..9d27751a6c6a 100644 --- a/xmloff/source/forms/eventexport.cxx +++ b/xmloff/source/forms/eventexport.cxx @@ -38,14 +38,13 @@ namespace xmloff // translate the events const ScriptEventDescriptor* pEvents = _rEvents.getConstArray(); - OUString sName; OUString sLibrary, sLocalMacroName; for (sal_Int32 i=0; i<nEvents; ++i, ++pEvents) { // the name of the event is build from listener interface and listener method name - sName = pEvents->ListenerType; - sName += EVENT_NAME_SEPARATOR; - sName += pEvents->EventMethod; + OUString sName = pEvents->ListenerType + + EVENT_NAME_SEPARATOR + + pEvents->EventMethod; Sequence< PropertyValue >& rMappedEvent = m_aMappedEvents[sName]; diff --git a/xmloff/source/forms/layerimport.cxx b/xmloff/source/forms/layerimport.cxx index c4b5ecec73aa..d08060356e6d 100644 --- a/xmloff/source/forms/layerimport.cxx +++ b/xmloff/source/forms/layerimport.cxx @@ -390,7 +390,6 @@ void OFormLayerXMLImport_Impl::endPage() try { static const sal_Unicode s_nSeparator = ','; - OUString sReferring; OUString sCurrentReferring; OUString sSeparator(&s_nSeparator, 1); Reference< XPropertySet > xCurrentReferring; @@ -405,8 +404,7 @@ void OFormLayerXMLImport_Impl::endPage() // in a list of n ids there are only n-1 separators ... have to catch this last id // -> normalize the list - sReferring = aReferences->second; - sReferring += sSeparator; + OUString sReferring = aReferences->second + sSeparator; nPrevSep = -1; while (-1 != (nSeparator = sReferring.indexOf(s_nSeparator, nPrevSep + 1))) diff --git a/xmloff/source/forms/propertyexport.cxx b/xmloff/source/forms/propertyexport.cxx index 2fad2f4c98d4..c2f168917c04 100644 --- a/xmloff/source/forms/propertyexport.cxx +++ b/xmloff/source/forms/propertyexport.cxx @@ -484,7 +484,7 @@ namespace xmloff Sequence< OUString > aItems; m_xProps->getPropertyValue( _rPropertyName ) >>= aItems; - OUString sFinalList; + OUStringBuffer sFinalList; // unfortunately the OUString can't append single sal_Unicode characters ... const OUString sQuote(&_aQuoteCharacter, 1); @@ -504,17 +504,17 @@ namespace xmloff "OPropertyExport::exportStringSequenceAttribute: there is an item which contains the quote character!"); if (bQuote) - sFinalList += sQuote; - sFinalList += *pItems; + sFinalList.append(sQuote); + sFinalList.append(*pItems); if (bQuote) - sFinalList += sQuote; + sFinalList.append(sQuote); if (pItems != pLastElement) - sFinalList += sSeparator; + sFinalList.append(sSeparator); } if (!sFinalList.isEmpty()) - AddAttribute(_nAttributeNamespaceKey, _pAttributeName, sFinalList); + AddAttribute(_nAttributeNamespaceKey, _pAttributeName, sFinalList.makeStringAndClear()); exportedProperty( _rPropertyName ); } diff --git a/xmloff/source/style/XMLFontAutoStylePool.cxx b/xmloff/source/style/XMLFontAutoStylePool.cxx index 8c2fa0ce9e23..454293c49df7 100644 --- a/xmloff/source/style/XMLFontAutoStylePool.cxx +++ b/xmloff/source/style/XMLFontAutoStylePool.cxx @@ -194,11 +194,10 @@ OUString XMLFontAutoStylePool::Add( { sal_Int32 nCount = 1; OUString sPrefix( sName ); - sName += OUString::number( nCount ); + sName = sPrefix + OUString::number( nCount ); while( m_aNames.find(sName) != m_aNames.end() ) { - sName = sPrefix; - sName += OUString::number( ++nCount ); + sName = sPrefix + OUString::number( ++nCount ); } } diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx index d7ea12df1106..5a26312d6a49 100644 --- a/xmloff/source/style/xmlnumfe.cxx +++ b/xmloff/source/style/xmlnumfe.cxx @@ -619,16 +619,16 @@ void SvXMLNumFmtExport::WriteNumberElement_Impl( true, false ); // text as element content - OUString aContent( pObj->aText ); + OUStringBuffer aContent( pObj->aText ); while ( nEntry+1 < nEntryCount && rEmbeddedEntries[nEntry+1].nFormatPos == pObj->nFormatPos ) { // The array can contain several elements for the same position in the number // (for example, literal text and space from underscores). They must be merged // into a single embedded-text element. - aContent += rEmbeddedEntries[nEntry+1].aText; + aContent.append(rEmbeddedEntries[nEntry+1].aText); ++nEntry; } - rExport.Characters( aContent ); + rExport.Characters( aContent.makeStringAndClear() ); } } diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx index 6de748478a98..a0a071bbde80 100644 --- a/xmloff/source/text/XMLTextFrameContext.cxx +++ b/xmloff/source/text/XMLTextFrameContext.cxx @@ -547,8 +547,7 @@ void XMLTextFrameContext_Impl::Create() sal_Int32 i = 0; while( xTextImportHelper->HasFrameByName( sName ) ) { - sName = sOldName; - sName += OUString::number( ++i ); + sName = sOldName + OUString::number( ++i ); } xNamed->setName( sName ); if( sName != sOldName ) diff --git a/xmloff/source/text/txtlists.cxx b/xmloff/source/text/txtlists.cxx index 85aff05614e1..bd6593717df4 100644 --- a/xmloff/source/text/txtlists.cxx +++ b/xmloff/source/text/txtlists.cxx @@ -213,8 +213,7 @@ OUString XMLTextListsHelper::GenerateNewListId() const while ( mpProcessedLists->find( sNewListId ) != mpProcessedLists->end() ) { ++nHitCount; - sNewListId = sTmpStr; - sNewListId += OUString::number( nHitCount ); + sNewListId = sTmpStr + OUString::number( nHitCount ); } } |