[Libreoffice-commits] core.git: 2 commits - editeng/source filter/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Jul 28 15:23:28 UTC 2018


 editeng/source/accessibility/AccessibleStaticTextBase.cxx |   22 ++---
 editeng/source/editeng/editdoc.cxx                        |   12 +--
 editeng/source/editeng/impedit2.cxx                       |    8 +-
 editeng/source/editeng/impedit4.cxx                       |    6 -
 editeng/source/items/numitem.cxx                          |   31 ++++---
 editeng/source/misc/svxacorr.cxx                          |   12 +--
 editeng/source/outliner/outliner.cxx                      |    8 +-
 filter/source/msfilter/msocximex.cxx                      |    3 
 filter/source/msfilter/svdfppt.cxx                        |    6 -
 filter/source/svg/svgexport.cxx                           |   29 +++----
 filter/source/svg/svgwriter.cxx                           |   56 ++++++--------
 filter/source/xsltdialog/xmlfiltertabpagebasic.cxx        |    8 +-
 12 files changed, 95 insertions(+), 106 deletions(-)

New commits:
commit 8d344ea12cfe50dd0c3ccc24252acee3290903e7
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Sat Jul 28 11:30:23 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Jul 28 17:23:19 2018 +0200

    loplugin:stringloop in editeng
    
    Change-Id: Ie0bff59cbb3ef4e79b1923ddebec979a135dd000
    Reviewed-on: https://gerrit.libreoffice.org/58213
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/editeng/source/accessibility/AccessibleStaticTextBase.cxx b/editeng/source/accessibility/AccessibleStaticTextBase.cxx
index f44d1482bb6d..6dac619d4e49 100644
--- a/editeng/source/accessibility/AccessibleStaticTextBase.cxx
+++ b/editeng/source/accessibility/AccessibleStaticTextBase.cxx
@@ -655,11 +655,11 @@ namespace accessibility
         SolarMutexGuard aGuard;
 
         sal_Int32 i, nParas;
-        OUString aRes;
+        OUStringBuffer aRes;
         for( i=0, nParas=mpImpl->GetParagraphCount(); i<nParas; ++i )
-            aRes += mpImpl->GetParagraph(i).getText();
+            aRes.append(mpImpl->GetParagraph(i).getText());
 
-        return aRes;
+        return aRes.makeStringAndClear();
     }
 
     OUString SAL_CALL AccessibleStaticTextBase::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex )
@@ -697,7 +697,7 @@ namespace accessibility
         {
             nEndIndex++;
         }
-        OUString aRes;
+        OUStringBuffer aRes;
         EPosition aStartIndex( mpImpl->Range2Internal(nStartIndex) );
         EPosition aEndIndex( mpImpl->Range2Internal(nEndIndex) );
 
@@ -717,8 +717,8 @@ namespace accessibility
             // paragraphs inbetween are fully included
             for( ; i<aEndIndex.nPara; ++i )
             {
-                aRes += OUStringLiteral1(cNewLine);
-                aRes += mpImpl->GetParagraph(i).getText();
+                aRes.append(cNewLine);
+                aRes.append(mpImpl->GetParagraph(i).getText());
             }
 
             if( i<=aEndIndex.nPara )
@@ -727,22 +727,22 @@ namespace accessibility
                 //we need to add a "\n" before we add the last part of the string.
                 if ( !bEnd && aEndIndex.nIndex )
                 {
-                    aRes += OUStringLiteral1(cNewLine);
+                    aRes.append(cNewLine);
                 }
-                aRes += mpImpl->GetParagraph(i).getTextRange( 0, aEndIndex.nIndex );
+                aRes.append(mpImpl->GetParagraph(i).getTextRange( 0, aEndIndex.nIndex ));
             }
         }
         //According to the flag we marked before, we have to add "\n" at the beginning
         //or at the end of the result string.
         if ( bStart )
         {
-            aRes = OUStringLiteral1(cNewLine) + aRes;
+            aRes.insert(0, OUStringLiteral1(cNewLine));
         }
         if ( bEnd )
         {
-            aRes += OUStringLiteral1(cNewLine);
+            aRes.append(OUStringLiteral1(cNewLine));
         }
-        return aRes;
+        return aRes.makeStringAndClear();
     }
 
     css::accessibility::TextSegment SAL_CALL AccessibleStaticTextBase::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType )
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index 40f4a8619cfd..9c70eff997ec 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -1633,7 +1633,7 @@ OUString ContentNode::GetExpandedText(sal_Int32 nStartPos, sal_Int32 nEndPos) co
     DBG_ASSERT( nStartPos <= nEndPos, "Start and End reversed?" );
 
     sal_Int32 nIndex = nStartPos;
-    OUString aStr;
+    OUStringBuffer aStr;
     const EditCharAttrib* pNextFeature = GetCharAttribs().FindFeature( nIndex );
     while ( nIndex < nEndPos )
     {
@@ -1646,18 +1646,18 @@ OUString ContentNode::GetExpandedText(sal_Int32 nStartPos, sal_Int32 nEndPos) co
         DBG_ASSERT( nEnd >= nIndex, "End in front of the index?" );
         //!! beware of sub string length  of -1
         if (nEnd > nIndex)
-            aStr += GetString().copy(nIndex, nEnd - nIndex);
+            aStr.append( GetString().copy(nIndex, nEnd - nIndex) );
 
         if ( pNextFeature )
         {
             switch ( pNextFeature->GetItem()->Which() )
             {
-                case EE_FEATURE_TAB:    aStr += "\t";
+                case EE_FEATURE_TAB:    aStr.append( "\t" );
                 break;
-                case EE_FEATURE_LINEBR: aStr += "\x0A";
+                case EE_FEATURE_LINEBR: aStr.append( "\x0A" );
                 break;
                 case EE_FEATURE_FIELD:
-                    aStr += static_cast<const EditCharAttribField*>(pNextFeature)->GetFieldValue();
+                    aStr.append( static_cast<const EditCharAttribField*>(pNextFeature)->GetFieldValue() );
                 break;
                 default:    OSL_FAIL( "What feature?" );
             }
@@ -1665,7 +1665,7 @@ OUString ContentNode::GetExpandedText(sal_Int32 nStartPos, sal_Int32 nEndPos) co
         }
         nIndex = nEnd;
     }
-    return aStr;
+    return aStr.makeStringAndClear();
 }
 
 void ContentNode::UnExpandPosition( sal_Int32 &rPos, bool bBiasStart )
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index bd641ce70b7b..af0565f76df5 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -286,7 +286,7 @@ OUString ImpEditEngine::GetSelected( const EditSelection& rSel  ) const
 
     OSL_ENSURE( nStartNode <= nEndNode, "Selection not sorted ?" );
 
-    OUString aText;
+    OUStringBuffer aText;
     const OUString aSep = EditDoc::GetSepStr( LINEEND_LF );
 
     // iterate over the paragraphs ...
@@ -298,11 +298,11 @@ OUString ImpEditEngine::GetSelected( const EditSelection& rSel  ) const
         const sal_Int32 nStartPos = nNode==nStartNode ? aSel.Min().GetIndex() : 0;
         const sal_Int32 nEndPos = nNode==nEndNode ? aSel.Max().GetIndex() : pNode->Len(); // can also be == nStart!
 
-        aText += EditDoc::GetParaAsString( pNode, nStartPos, nEndPos );
+        aText.append(EditDoc::GetParaAsString( pNode, nStartPos, nEndPos ));
         if ( nNode < nEndNode )
-            aText += aSep;
+            aText.append(aSep);
     }
-    return aText;
+    return aText.makeStringAndClear();
 }
 
 bool ImpEditEngine::MouseButtonDown( const MouseEvent& rMEvt, EditView* pView )
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index a19876928bb4..e619351963f9 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -1810,7 +1810,6 @@ Reference< XSpellAlternatives > ImpEditEngine::ImpSpell( EditView* pEditView )
     EditSelection aCurSel( pEditView->pImpEditView->GetEditSelection() );
     aCurSel.Min() = aCurSel.Max();
 
-    OUString aWord;
     Reference< XSpellAlternatives > xSpellAlt;
     Sequence< PropertyValue > aEmptySeq;
     while (!xSpellAlt.is())
@@ -1834,7 +1833,7 @@ Reference< XSpellAlternatives > ImpEditEngine::ImpSpell( EditView* pEditView )
         }
 
         aCurSel = SelectWord( aCurSel, css::i18n::WordType::DICTIONARY_WORD );
-        aWord = GetSelected( aCurSel );
+        OUString aWord = GetSelected( aCurSel );
 
         // If afterwards a dot, this must be handed over!
         // If an abbreviation ...
@@ -1872,7 +1871,6 @@ Reference< XSpellAlternatives > ImpEditEngine::ImpFindNextError(EditSelection& r
 {
     EditSelection aCurSel( rSelection.Min() );
 
-    OUString aWord;
     Reference< XSpellAlternatives > xSpellAlt;
     Sequence< PropertyValue > aEmptySeq;
     while (!xSpellAlt.is())
@@ -1885,7 +1883,7 @@ Reference< XSpellAlternatives > ImpEditEngine::ImpFindNextError(EditSelection& r
         }
 
         aCurSel = SelectWord( aCurSel, css::i18n::WordType::DICTIONARY_WORD );
-        aWord = GetSelected( aCurSel );
+        OUString aWord = GetSelected( aCurSel );
 
         // If afterwards a dot, this must be handed over!
         // If an abbreviation ...
diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index 1efd88c84026..8e483d66ca51 100644
--- a/editeng/source/items/numitem.cxx
+++ b/editeng/source/items/numitem.cxx
@@ -501,7 +501,7 @@ OUString SvxNumberFormat::CreateRomanString( sal_uLong nNo, bool bUpper )
                         ? "MDCLXVI--"   // +2 Dummy entries!
                         : "mdclxvi--";  // +2 Dummy entries!
 
-    OUString sRet;
+    OUStringBuffer sRet;
     sal_uInt16 nMask = 1000;
     while( nMask )
     {
@@ -512,30 +512,30 @@ OUString SvxNumberFormat::CreateRomanString( sal_uLong nNo, bool bUpper )
         if( 5 < nNumber )
         {
             if( nNumber < 9 )
-                sRet += OUString(*(cRomanArr-1));
+                sRet.append(*(cRomanArr-1));
             ++nDiff;
             nNumber -= 5;
         }
         switch( nNumber )
         {
-        case 3:     { sRet += OUString(*cRomanArr); SAL_FALLTHROUGH; }
-        case 2:     { sRet += OUString(*cRomanArr); SAL_FALLTHROUGH; }
-        case 1:     { sRet += OUString(*cRomanArr); }
+        case 3:     { sRet.append(*cRomanArr); SAL_FALLTHROUGH; }
+        case 2:     { sRet.append(*cRomanArr); SAL_FALLTHROUGH; }
+        case 1:     { sRet.append(*cRomanArr); }
                     break;
 
         case 4:     {
-                        sRet += OUString(*cRomanArr);
-                        sRet += OUString(*(cRomanArr-nDiff));
+                        sRet.append(*cRomanArr);
+                        sRet.append(*(cRomanArr-nDiff));
                     }
                     break;
-        case 5:     { sRet += OUString(*(cRomanArr-nDiff)); }
+        case 5:     { sRet.append(*(cRomanArr-nDiff)); }
                     break;
         }
 
         nMask /= 10;            // for the next decade
         cRomanArr += 2;
     }
-    return sRet;
+    return sRet.makeStringAndClear();
 }
 
 OUString SvxNumberFormat::GetCharFormatName()const
@@ -812,10 +812,11 @@ void SvxNumRule::SetLevel(sal_uInt16 nLevel, const SvxNumberFormat* pFmt)
 
 OUString SvxNumRule::MakeNumString( const SvxNodeNum& rNum ) const
 {
-    OUString aStr;
+    OUStringBuffer aStr;
     if( SVX_NO_NUM > rNum.GetLevel() && !( SVX_NO_NUMLEVEL & rNum.GetLevel() ) )
     {
         const SvxNumberFormat& rMyNFmt = GetLevel( rNum.GetLevel() );
+        aStr.append(rMyNFmt.GetPrefix());
         if( SVX_NUM_NUMBER_NONE != rMyNFmt.GetNumberingType() )
         {
             sal_uInt8 i = rNum.GetLevel();
@@ -847,21 +848,21 @@ OUString SvxNumRule::MakeNumString( const SvxNodeNum& rNum ) const
                     if(SVX_NUM_BITMAP != rNFmt.GetNumberingType())
                     {
                         const LanguageTag& rLang = Application::GetSettings().GetLanguageTag();
-                        aStr += rNFmt.GetNumStr( rNum.GetLevelVal()[ i ], rLang.getLocale()  );
+                        aStr.append(rNFmt.GetNumStr( rNum.GetLevelVal()[ i ], rLang.getLocale()  ));
                     }
                     else
                         bDot = false;
                 }
                 else
-                    aStr += "0";       // all 0-levels are a 0
+                    aStr.append("0");       // all 0-levels are a 0
                 if( i != rNum.GetLevel() && bDot)
-                    aStr += ".";
+                    aStr.append(".");
             }
         }
 
-        aStr = rMyNFmt.GetPrefix() + aStr + rMyNFmt.GetSuffix();
+        aStr.append(rMyNFmt.GetSuffix());
     }
-    return aStr;
+    return aStr.makeStringAndClear();
 }
 
 // changes linked to embedded bitmaps
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index b890b5cd0984..cf56f2a4552f 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -1110,9 +1110,9 @@ bool SvxAutoCorrect::FnCorrectCapsLock( SvxAutoCorrDoc& rDoc, const OUString& rT
     if ( !IsUpperLetter(rCC.getCharacterType(rTxt, nSttPos+1)) )
         return false;
 
-    OUString aConverted;
-    aConverted += rCC.uppercase(OUString(rTxt[nSttPos]));
-    aConverted += rCC.lowercase(OUString(rTxt[nSttPos+1]));
+    OUStringBuffer aConverted;
+    aConverted.append( rCC.uppercase(OUString(rTxt[nSttPos])) );
+    aConverted.append( rCC.lowercase(OUString(rTxt[nSttPos+1])) );
 
     for( sal_Int32 i = nSttPos+2; i < nEndPos; ++i )
     {
@@ -1122,15 +1122,15 @@ bool SvxAutoCorrect::FnCorrectCapsLock( SvxAutoCorrDoc& rDoc, const OUString& rT
 
         if ( IsUpperLetter(rCC.getCharacterType(rTxt, i)) )
             // Another uppercase letter.  Convert it.
-            aConverted += rCC.lowercase(OUString(rTxt[i]));
+            aConverted.append( rCC.lowercase(OUString(rTxt[i])) );
         else
             // This is not an alphabetic letter.  Leave it as-is.
-            aConverted += OUStringLiteral1( rTxt[i] );
+            aConverted.append( rTxt[i] );
     }
 
     // Replace the word.
     rDoc.Delete(nSttPos, nEndPos);
-    rDoc.Insert(nSttPos, aConverted);
+    rDoc.Insert(nSttPos, aConverted.makeStringAndClear());
 
     return true;
 }
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index 294f000d3796..374fa86025f9 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -1638,15 +1638,15 @@ EBulletInfo Outliner::GetBulletInfo( sal_Int32 nPara )
 OUString Outliner::GetText( Paragraph const * pParagraph, sal_Int32 nCount ) const
 {
 
-    OUString aText;
+    OUStringBuffer aText;
     sal_Int32 nStartPara = pParaList->GetAbsPos( pParagraph );
     for ( sal_Int32 n = 0; n < nCount; n++ )
     {
-        aText += pEditEngine->GetText( nStartPara + n );
+        aText.append(pEditEngine->GetText( nStartPara + n ));
         if ( (n+1) < nCount )
-            aText += "\n";
+            aText.append("\n");
     }
-    return aText;
+    return aText.makeStringAndClear();
 }
 
 void Outliner::Remove( Paragraph const * pPara, sal_Int32 nParaCount )
commit 4d20ec5ad75e8268cbc753f5bf86e3ef7c0be557
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Sat Jul 28 11:29:37 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Jul 28 17:23:06 2018 +0200

    loplugin:stringloop in filter
    
    Change-Id: Icb2df9854975544ae3e164b5d25a6628824027e5
    Reviewed-on: https://gerrit.libreoffice.org/58212
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/filter/source/msfilter/msocximex.cxx b/filter/source/msfilter/msocximex.cxx
index 58c8266a514a..09217fb8346d 100644
--- a/filter/source/msfilter/msocximex.cxx
+++ b/filter/source/msfilter/msocximex.cxx
@@ -105,8 +105,7 @@ const uno::Reference< container::XIndexContainer >&
 
             while( xNameCont->hasByName( sName ) )
             {
-                sName = sWW8_form;
-                sName += OUString::number( ++n );
+                sName = sWW8_form + OUString::number( ++n );
             }
 
             const uno::Reference< lang::XMultiServiceFactory > &rServiceFactory
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index a7f5cd0fab9d..2aa27ae4aaac 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -6813,7 +6813,7 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
                                                     // idea.
                                                     if (nVal == 0)
                                                     {
-                                                        OUString aStr;
+                                                        OUStringBuffer aStr;
                                                         bool inquote = false;
                                                         for (int nLen = 0; nLen < 64; ++nLen)
                                                         {
@@ -6826,7 +6826,7 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
                                                             else if (!n)
                                                             {
                                                                 // End of format string
-                                                                xEntry->xString = aStr;
+                                                                xEntry->xString = aStr.makeStringAndClear();
                                                                 break;
                                                             }
                                                             else if (!inquote)
@@ -6838,7 +6838,7 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
                                                             }
                                                             else
                                                             {
-                                                                aStr += OUStringLiteral1(n);
+                                                                aStr.append(OUStringLiteral1(n));
                                                             }
                                                         }
                                                     }
diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
index f959563de94d..fa0958decc10 100644
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@ -2123,12 +2123,11 @@ IMPL_LINK( SVGFilter, CalcFieldHdl, EditFieldInfo*, pInfo, void )
     if( pInfo && mbPresentation )
     {
         bFieldProcessed = true;
-        OUString   aRepresentation;
         if( mpSVGExport->IsEmbedFonts() && mpSVGExport->IsUsePositionedCharacters() )
         {
             // to notify to the SVGActionWriter::ImplWriteText method
             // that we are dealing with a placeholder shape
-            aRepresentation = sPlaceholderTag;
+            OUStringBuffer aRepresentation = sPlaceholderTag;
 
             if( !mCreateOjectsCurrentMasterPage.is() )
             {
@@ -2208,17 +2207,17 @@ IMPL_LINK( SVGFilter, CalcFieldHdl, EditFieldInfo*, pInfo, void )
                     }
                     // Independently of the date format, we always put all these characters by default.
                     // They should be enough to cover every time format.
-                    aRepresentation += "0123456789.:/-APM";
+                    aRepresentation.append( "0123456789.:/-APM" );
 
                     if( eDateFormat != SvxDateFormat::AppDefault )
                     {
-                        OUString sDate;
+                        OUStringBuffer sDate;
                         LanguageType eLang = pInfo->GetOutliner()->GetLanguage( pInfo->GetPara(), pInfo->GetPos() );
                         SvNumberFormatter * pNumberFormatter = new SvNumberFormatter( ::comphelper::getProcessComponentContext(), LANGUAGE_SYSTEM );
                         // We always collect the characters obtained by using the SvxDateFormat::B (as: 13.02.1996)
                         // so we are sure to include any unusual day|month|year separator.
                         Date aDate( 1, 1, 1996 );
-                        sDate += SvxDateField::GetFormatted( aDate, SvxDateFormat::B, *pNumberFormatter, eLang );
+                        sDate.append( SvxDateField::GetFormatted( aDate, SvxDateFormat::B, *pNumberFormatter, eLang ) );
                         switch( eDateFormat )
                         {
                             case SvxDateFormat::E:       // Tue, 13.February 1996
@@ -2227,7 +2226,7 @@ IMPL_LINK( SVGFilter, CalcFieldHdl, EditFieldInfo*, pInfo, void )
                                 for( sal_uInt16 i = 1; i <= 7; ++i )  // we get all days in a week
                                 {
                                     aDate.SetDay( i );
-                                    sDate += SvxDateField::GetFormatted( aDate, eDateFormat, *pNumberFormatter, eLang );
+                                    sDate.append( SvxDateField::GetFormatted( aDate, eDateFormat, *pNumberFormatter, eLang ) );
                                 }
                                 SAL_FALLTHROUGH; // We need months too!
                             case SvxDateFormat::C:       // 13.Feb 1996
@@ -2235,7 +2234,7 @@ IMPL_LINK( SVGFilter, CalcFieldHdl, EditFieldInfo*, pInfo, void )
                                 for( sal_uInt16 i = 1; i <= 12; ++i ) // we get all months in a year
                                 {
                                     aDate.SetMonth( i );
-                                    sDate += SvxDateField::GetFormatted( aDate, eDateFormat, *pNumberFormatter, eLang );
+                                    sDate.append( SvxDateField::GetFormatted( aDate, eDateFormat, *pNumberFormatter, eLang ) );
                                 }
                                 break;
                             // coverity[dead_error_begin] - following conditions exist to avoid compiler warning
@@ -2246,7 +2245,7 @@ IMPL_LINK( SVGFilter, CalcFieldHdl, EditFieldInfo*, pInfo, void )
                                 // nothing to do here, we always collect the characters needed for these cases.
                                 break;
                         }
-                        aRepresentation += sDate;
+                        aRepresentation.append( sDate.makeStringAndClear() );
                     }
                 }
             }
@@ -2255,22 +2254,22 @@ IMPL_LINK( SVGFilter, CalcFieldHdl, EditFieldInfo*, pInfo, void )
                 switch( mVisiblePagePropSet.nPageNumberingType )
                 {
                     case css::style::NumberingType::CHARS_UPPER_LETTER:
-                        aRepresentation += "QWERTYUIOPASDFGHJKLZXCVBNM";
+                        aRepresentation.append( "QWERTYUIOPASDFGHJKLZXCVBNM" );
                         break;
                     case css::style::NumberingType::CHARS_LOWER_LETTER:
-                        aRepresentation += "qwertyuiopasdfghjklzxcvbnm";
+                        aRepresentation.append( "qwertyuiopasdfghjklzxcvbnm" );
                         break;
                     case css::style::NumberingType::ROMAN_UPPER:
-                        aRepresentation += "IVXLCDM";
+                        aRepresentation.append( "IVXLCDM" );
                         break;
                     case css::style::NumberingType::ROMAN_LOWER:
-                        aRepresentation += "ivxlcdm";
+                        aRepresentation.append( "ivxlcdm" );
                         break;
                     // arabic numbering type is the default
                     case css::style::NumberingType::ARABIC:
                     // in case the numbering type is not handled we fall back on arabic numbering
                     default:
-                        aRepresentation += "0123456789";
+                        aRepresentation.append( "0123456789" );
                         break;
                 }
             }
@@ -2284,10 +2283,10 @@ IMPL_LINK( SVGFilter, CalcFieldHdl, EditFieldInfo*, pInfo, void )
                 {
                     for (auto const& elem : *pCharSet)
                     {
-                        aRepresentation += OUStringLiteral1(elem);
+                        aRepresentation.append(elem);
                     }
                 }
-                pInfo->SetRepresentation( aRepresentation );
+                pInfo->SetRepresentation( aRepresentation.makeStringAndClear() );
             }
         }
         else
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index c1512f58ecb2..56aada391e91 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -1427,7 +1427,6 @@ void SVGTextWriter::implWriteEmbeddedBitmaps()
 
         const GDIMetaFile& rMtf = *mpTextEmbeddedBitmapMtf;
 
-        OUString sId, sRefId;
         BitmapChecksum nId, nChecksum = 0;
         Point aPt;
         Size  aSz;
@@ -1463,11 +1462,7 @@ void SVGTextWriter::implWriteEmbeddedBitmaps()
             {
                 // embedded bitmap id
                 nId = SVGActionWriter::GetChecksum( pAction );
-                sId = "embedded-bitmap(";
-                sId += msShapeId;
-                sId += ".";
-                sId += OUString::number( nId );
-                sId += ")";
+                OUString sId = "embedded-bitmap(" + msShapeId + "." + OUString::number( nId ) + ")";
                 mrExport.AddAttribute( XML_NAMESPACE_NONE, "id", sId );
                 mrExport.AddAttribute( XML_NAMESPACE_NONE, "class", "EmbeddedBitmap" );
 
@@ -1476,9 +1471,7 @@ void SVGTextWriter::implWriteEmbeddedBitmaps()
                 // <use x="?" y="?" xlink:ref="?" >
                 {
                     // referenced bitmap template
-                    sRefId = "#bitmap(";
-                    sRefId += OUString::number( nChecksum );
-                    sRefId += ")";
+                    OUString sRefId = "#bitmap(" + OUString::number( nChecksum ) + ")";
 
                     Point aPoint;
                     Size  aSize;
@@ -1778,7 +1771,7 @@ tools::PolyPolygon& SVGActionWriter::ImplMap( const tools::PolyPolygon& rPolyPol
 
 OUString SVGActionWriter::GetPathString( const tools::PolyPolygon& rPolyPoly, bool bLine )
 {
-    OUString         aPathData;
+    OUStringBuffer   aPathData;
     const OUString   aBlank( " " );
     const OUString   aComma( "," );
     Point                      aPolyPoint;
@@ -1791,33 +1784,33 @@ OUString SVGActionWriter::GetPathString( const tools::PolyPolygon& rPolyPoly, bo
         if( nSize > 1 )
         {
             aPolyPoint = rPoly[ 0 ];
-            aPathData += "M "
-                        + OUString::number( aPolyPoint.X() )
-                        + aComma
-                        + OUString::number( aPolyPoint.Y() );
+            aPathData.append("M ")
+                     .append(OUString::number( aPolyPoint.X() ))
+                     .append(aComma)
+                     .append(OUString::number( aPolyPoint.Y() ));
 
             sal_Char nCurrentMode = 0;
             const bool bClose(!bLine || rPoly[0] == rPoly[nSize - 1]);
             while( n < nSize )
             {
-                aPathData += aBlank;
+                aPathData.append(aBlank);
 
                 if ( ( rPoly.GetFlags( n ) == PolyFlags::Control ) && ( ( n + 2 ) < nSize ) )
                 {
                     if ( nCurrentMode != 'C' )
                     {
                         nCurrentMode = 'C';
-                        aPathData += "C ";
+                        aPathData.append("C ");
                     }
                     for ( int j = 0; j < 3; j++ )
                     {
                         if ( j )
-                            aPathData += aBlank;
+                            aPathData.append(aBlank);
 
                         aPolyPoint = rPoly[ n++ ];
-                        aPathData += OUString::number( aPolyPoint.X() )
-                                    + aComma
-                                    + OUString::number( aPolyPoint.Y() );
+                        aPathData.append(OUString::number( aPolyPoint.X() ))
+                                 .append(aComma)
+                                 .append(OUString::number( aPolyPoint.Y() ));
                     }
                 }
                 else
@@ -1825,25 +1818,25 @@ OUString SVGActionWriter::GetPathString( const tools::PolyPolygon& rPolyPoly, bo
                     if ( nCurrentMode != 'L' )
                     {
                         nCurrentMode = 'L';
-                        aPathData += "L ";
+                        aPathData.append("L ");
                     }
 
                     aPolyPoint = rPoly[ n++ ];
-                    aPathData += OUString::number( aPolyPoint.X() )
-                                + aComma
-                                + OUString::number( aPolyPoint.Y() );
+                    aPathData.append(OUString::number( aPolyPoint.X() ))
+                             .append(aComma)
+                             .append(OUString::number( aPolyPoint.Y() ));
                 }
             }
 
             if(bClose)
-                aPathData += " Z";
+                aPathData.append(" Z");
 
             if( i < ( nCount - 1 ) )
-                aPathData += aBlank;
+                aPathData.append(aBlank);
         }
     }
 
-     return aPathData;
+     return aPathData.makeStringAndClear();
 }
 
 
@@ -2061,20 +2054,19 @@ void SVGActionWriter::ImplWriteShape( const SVGShapeDescriptor& rShape )
 
     if( rShape.maDashArray.size() )
     {
-        const OUString   aComma( "," );
-        OUString         aDashArrayStr;
+        OUStringBuffer   aDashArrayStr;
 
         for( size_t k = 0; k < rShape.maDashArray.size(); ++k )
         {
             const sal_Int32 nDash = ImplMap( FRound( rShape.maDashArray[ k ] ) );
 
             if( k )
-                aDashArrayStr += aComma;
+                aDashArrayStr.append(",");
 
-            aDashArrayStr += OUString::number( nDash );
+            aDashArrayStr.append(OUString::number( nDash ));
         }
 
-        mrExport.AddAttribute( XML_NAMESPACE_NONE, "stroke-dasharray", aDashArrayStr );
+        mrExport.AddAttribute( XML_NAMESPACE_NONE, "stroke-dasharray", aDashArrayStr.makeStringAndClear() );
     }
 
     ImplWritePolyPolygon( aPolyPoly, bLineOnly, false );
diff --git a/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx b/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx
index 3db0c58ac267..69bb87882fa6 100644
--- a/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx
+++ b/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx
@@ -51,25 +51,25 @@ static OUString checkExtensions( const OUString& rExtensions )
     const sal_Unicode* pSource = rExtensions.getStr();
     sal_Int32 nCount = rExtensions.getLength();
 
-    OUString aRet;
+    OUStringBuffer aRet;
     while( nCount-- )
     {
         switch(*pSource)
         {
         case u',':
-            aRet += ";";
+            aRet.append(";");
             break;
         case u'.':
         case u'*':
             break;
         default:
-            aRet += OUStringLiteral1( *pSource );
+            aRet.append( *pSource );
         }
 
         pSource++;
     }
 
-    return aRet;
+    return aRet.makeStringAndClear();
 }
 
 void XMLFilterTabPageBasic::FillInfo( filter_info_impl* pInfo )


More information about the Libreoffice-commits mailing list