[Libreoffice-commits] core.git: 3 commits - include/sfx2 include/xmloff sfx2/source sw/inc sw/source xmloff/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Jul 30 17:00:24 UTC 2018


 include/sfx2/docfile.hxx                      |    2 
 include/sfx2/frame.hxx                        |    4 
 include/sfx2/objsh.hxx                        |    2 
 include/sfx2/sfxbasemodel.hxx                 |    2 
 include/sfx2/viewfrm.hxx                      |    2 
 include/xmloff/styleexp.hxx                   |    2 
 sfx2/source/doc/docfile.cxx                   |    3 
 sfx2/source/doc/doctemplates.cxx              |   18 ---
 sfx2/source/doc/objstor.cxx                   |   14 +-
 sfx2/source/doc/sfxbasemodel.cxx              |   39 +++----
 sfx2/source/view/frame.cxx                    |    8 -
 sfx2/source/view/frame2.cxx                   |    3 
 sfx2/source/view/viewfrm.cxx                  |    4 
 sw/inc/calc.hxx                               |    4 
 sw/inc/cellfml.hxx                            |   20 +--
 sw/inc/dbgoutsw.hxx                           |   11 +-
 sw/source/core/bastyp/calc.cxx                |   14 +-
 sw/source/core/crsr/crstrvl.cxx               |    8 -
 sw/source/core/crsr/pam.cxx                   |    8 -
 sw/source/core/doc/DocumentFieldsManager.cxx  |    7 -
 sw/source/core/doc/DocumentListsManager.cxx   |    3 
 sw/source/core/doc/dbgoutsw.cxx               |   98 +++++++++---------
 sw/source/core/doc/docsort.cxx                |    6 -
 sw/source/core/doc/number.cxx                 |   15 +-
 sw/source/core/edit/edfcol.cxx                |    8 -
 sw/source/core/edit/editsh.cxx                |   13 +-
 sw/source/core/fields/cellfml.cxx             |  138 +++++++++++++-------------
 sw/source/core/fields/ddefld.cxx              |    8 -
 sw/source/core/tox/ToxTextGenerator.cxx       |   14 +-
 sw/source/core/undo/undel.cxx                 |    8 -
 sw/source/core/unocore/unochart.cxx           |   16 +--
 sw/source/core/unocore/unoidx.cxx             |   14 +-
 sw/source/filter/docx/swdocxreader.cxx        |    4 
 sw/source/filter/html/htmlbas.cxx             |    3 
 sw/source/filter/html/htmlftn.cxx             |    8 -
 sw/source/filter/html/svxcss1.cxx             |    8 -
 sw/source/filter/ww8/writerwordglue.cxx       |    3 
 sw/source/filter/ww8/ww8glsy.cxx              |    4 
 sw/source/filter/ww8/ww8par.cxx               |    8 -
 sw/source/filter/ww8/ww8par2.cxx              |   10 -
 sw/source/ui/chrdlg/drpcps.cxx                |    6 -
 sw/source/ui/dbui/createaddresslistdialog.cxx |    8 -
 sw/source/ui/dbui/mmresultdialogs.cxx         |   10 -
 sw/source/ui/index/cnttab.cxx                 |    6 -
 sw/source/ui/index/swuiidxmrk.cxx             |    8 -
 sw/source/ui/misc/bookmark.cxx                |    8 -
 sw/source/ui/misc/glossary.cxx                |    7 -
 sw/source/ui/vba/vbatemplate.cxx              |    7 -
 sw/source/uibase/app/docstyle.cxx             |   26 ++--
 sw/source/uibase/config/modcfg.cxx            |   26 ++--
 sw/source/uibase/dbui/dbmgr.cxx               |   22 ++--
 sw/source/uibase/dbui/mailmergehelper.cxx     |    9 -
 sw/source/uibase/dbui/mmconfigitem.cxx        |   18 +--
 sw/source/uibase/envelp/envimg.cxx            |   24 ++--
 sw/source/uibase/envelp/labelcfg.cxx          |    3 
 sw/source/uibase/shells/annotsh.cxx           |    8 -
 sw/source/uibase/shells/drwtxtsh.cxx          |    6 -
 sw/source/uibase/shells/frmsh.cxx             |    4 
 sw/source/uibase/uno/unotxdoc.cxx             |   12 +-
 sw/source/uibase/wrtsh/wrtundo.cxx            |    6 -
 xmloff/source/style/styleexp.cxx              |    3 
 xmloff/source/transform/ChartOOoTContext.cxx  |    6 -
 xmloff/source/transform/EventOOoTContext.cxx  |    6 -
 xmloff/source/transform/TransformerBase.cxx   |   11 --
 xmloff/source/transform/TransformerBase.hxx   |    2 
 65 files changed, 393 insertions(+), 423 deletions(-)

New commits:
commit c90da566ed1026a70217ac8a52a90e5df5c3026e
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Jul 30 15:34:35 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Jul 30 18:54:44 2018 +0200

    loplugin:returnconstant in xmloff
    
    Change-Id: Ia837a93ae817df282096abb80efcbd6922867b25
    Reviewed-on: https://gerrit.libreoffice.org/58335
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/xmloff/styleexp.hxx b/include/xmloff/styleexp.hxx
index fb48166e14df..0418aaebc8e5 100644
--- a/include/xmloff/styleexp.hxx
+++ b/include/xmloff/styleexp.hxx
@@ -93,7 +93,7 @@ public:
 //      bool bUsed, sal_uInt16 nFamily = 0,
 //      const OUString* pPrefix = 0);
 
-    bool exportDefaultStyle(
+    void exportDefaultStyle(
         const css::uno::Reference< css::beans::XPropertySet > & xPropSet,
         const OUString& rXMLFamily,
         const rtl::Reference < SvXMLExportPropertyMapper >& rPropMapper );
diff --git a/xmloff/source/style/styleexp.cxx b/xmloff/source/style/styleexp.cxx
index fa8ff9c8a46a..40334fc30be1 100644
--- a/xmloff/source/style/styleexp.cxx
+++ b/xmloff/source/style/styleexp.cxx
@@ -381,7 +381,7 @@ bool XMLStyleExport::exportStyle(
     return true;
 }
 
-bool XMLStyleExport::exportDefaultStyle(
+void XMLStyleExport::exportDefaultStyle(
         const Reference< XPropertySet >& xPropSet,
           const OUString& rXMLFamily,
         const rtl::Reference < SvXMLExportPropertyMapper >& rPropMapper )
@@ -404,7 +404,6 @@ bool XMLStyleExport::exportDefaultStyle(
         rPropMapper->exportXML( GetExport(), aPropStates,
                                      SvXmlExportFlags::IGN_WS );
     }
-    return true;
 }
 
 void XMLStyleExport::exportStyleFamily(
diff --git a/xmloff/source/transform/ChartOOoTContext.cxx b/xmloff/source/transform/ChartOOoTContext.cxx
index 86d3e4841c7f..b6de37a48d46 100644
--- a/xmloff/source/transform/ChartOOoTContext.cxx
+++ b/xmloff/source/transform/ChartOOoTContext.cxx
@@ -101,9 +101,9 @@ void XMLChartOOoTransformerContext::StartElement(
                     OUString aAttrValue( rAttrValue );
                     sal_uInt16 nValPrefix =
                         static_cast<sal_uInt16>((*aIter).second.m_nParam1);
-                    if( GetTransformer().AddNamespacePrefix( aAttrValue,
-                                                             nValPrefix ) )
-                        pMutableAttrList->SetValueByIndex( i, aAttrValue );
+                    GetTransformer().AddNamespacePrefix( aAttrValue,
+                                                             nValPrefix );
+                    pMutableAttrList->SetValueByIndex( i, aAttrValue );
                 }
                 break;
             case XML_ATACTION_REMOVE:
diff --git a/xmloff/source/transform/EventOOoTContext.cxx b/xmloff/source/transform/EventOOoTContext.cxx
index 7b0af9b7fd8b..bc9b70b3019f 100644
--- a/xmloff/source/transform/EventOOoTContext.cxx
+++ b/xmloff/source/transform/EventOOoTContext.cxx
@@ -170,9 +170,9 @@ void XMLEventOOoTransformerContext::StartElement(
                     OUString aAttrValue( rAttrValue );
                     sal_uInt16 nValPrefix =
                         static_cast<sal_uInt16>((*aIter).second.m_nParam1);
-                    if( GetTransformer().AddNamespacePrefix( aAttrValue,
-                                                             nValPrefix ) )
-                        pMutableAttrList->SetValueByIndex( i, aAttrValue );
+                    GetTransformer().AddNamespacePrefix( aAttrValue,
+                                                             nValPrefix );
+                    pMutableAttrList->SetValueByIndex( i, aAttrValue );
                 }
                 break;
             case XML_ATACTION_MACRO_LOCATION:
diff --git a/xmloff/source/transform/TransformerBase.cxx b/xmloff/source/transform/TransformerBase.cxx
index fd0f3ea903e6..148230a179b1 100644
--- a/xmloff/source/transform/TransformerBase.cxx
+++ b/xmloff/source/transform/TransformerBase.cxx
@@ -633,8 +633,8 @@ XMLMutableAttributeList *XMLTransformerBase::ProcessAttrList(
                             static_cast<sal_uInt16>(
                                     bRename ? (*aIter).second.m_nParam2
                                             : (*aIter).second.m_nParam1);
-                        if( AddNamespacePrefix( aAttrValue, nValPrefix ) )
-                            pMutableAttrList->SetValueByIndex( i, aAttrValue );
+                        AddNamespacePrefix( aAttrValue, nValPrefix );
+                        pMutableAttrList->SetValueByIndex( i, aAttrValue );
                     }
                     break;
                 case XML_ATACTION_ADD_APP_NAMESPACE_PREFIX:
@@ -646,8 +646,8 @@ XMLMutableAttributeList *XMLTransformerBase::ProcessAttrList(
                             nValPrefix = XML_NAMESPACE_OOOC;
                         else if( IsXMLToken( GetClass(), XML_TEXT  ) )
                             nValPrefix = XML_NAMESPACE_OOOW;
-                        if( AddNamespacePrefix( aAttrValue, nValPrefix ) )
-                            pMutableAttrList->SetValueByIndex( i, aAttrValue );
+                        AddNamespacePrefix( aAttrValue, nValPrefix );
+                        pMutableAttrList->SetValueByIndex( i, aAttrValue );
                     }
                     break;
                 case XML_ATACTION_RENAME_REMOVE_NAMESPACE_PREFIX:
@@ -1200,11 +1200,10 @@ bool XMLTransformerBase::NegPercent( OUString& rValue )
     return bRet;
 }
 
-bool XMLTransformerBase::AddNamespacePrefix( OUString& rName,
+void XMLTransformerBase::AddNamespacePrefix( OUString& rName,
                              sal_uInt16 nPrefix ) const
 {
     rName = GetNamespaceMap().GetQNameByKey( nPrefix, rName, false );
-    return true;
 }
 
 bool XMLTransformerBase::RemoveNamespacePrefix( OUString& rName,
diff --git a/xmloff/source/transform/TransformerBase.hxx b/xmloff/source/transform/TransformerBase.hxx
index 429d27a06fd4..7aded1f949d1 100644
--- a/xmloff/source/transform/TransformerBase.hxx
+++ b/xmloff/source/transform/TransformerBase.hxx
@@ -138,7 +138,7 @@ public:
     static bool DecodeStyleName( OUString& rName );
     static bool NegPercent( OUString& rValue );
 
-    bool AddNamespacePrefix( OUString& rName,
+    void AddNamespacePrefix( OUString& rName,
                                  sal_uInt16 nPrefix ) const;
     bool RemoveNamespacePrefix( OUString& rName,
                                     sal_uInt16 nPrefixOnly=0xffffU ) const;
commit 4bef6511332073fbe3899fa2003caf88d9f2ac49
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Jul 30 15:24:04 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Jul 30 18:54:15 2018 +0200

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

diff --git a/sw/inc/calc.hxx b/sw/inc/calc.hxx
index 75112605f492..3396c506ab18 100644
--- a/sw/inc/calc.hxx
+++ b/sw/inc/calc.hxx
@@ -24,6 +24,7 @@
 #include <vector>
 #include <basic/sbxvar.hxx>
 #include <unotools/syslocale.hxx>
+#include <rtl/ustrbuf.hxx>
 #include "swdllapi.h"
 
 class CharClass;
@@ -182,7 +183,8 @@ extern "C" typedef double (*pfCalc)(double);
 class SwCalc
 {
     SwHashTable<SwCalcExp> m_aVarTable;
-    OUString    m_aVarName, m_sCurrSym;
+    OUStringBuffer m_aVarName;
+    OUString    m_sCurrSym;
     OUString    m_sCommand;
     std::vector<const SwUserFieldType*> m_aRekurStack;
     SwSbxValue  m_nLastLeft;
diff --git a/sw/inc/cellfml.hxx b/sw/inc/cellfml.hxx
index 2d6a64b4d3ec..3aa83b22d8ef 100644
--- a/sw/inc/cellfml.hxx
+++ b/sw/inc/cellfml.hxx
@@ -54,26 +54,26 @@ public:
 
 class SwTableFormula
 {
-typedef void (SwTableFormula:: *FnScanFormula)( const SwTable&, OUString&,
+typedef void (SwTableFormula:: *FnScanFormula)( const SwTable&, OUStringBuffer&,
                                                 OUString&, OUString*, void* ) const;
 
-    void BoxNmsToPtr( const SwTable&, OUString&, OUString&, OUString*,
+    void BoxNmsToPtr( const SwTable&, OUStringBuffer&, OUString&, OUString*,
                         void* pPara ) const;
-    void PtrToBoxNms( const SwTable&, OUString&, OUString&, OUString*,
+    void PtrToBoxNms( const SwTable&, OUStringBuffer&, OUString&, OUString*,
                         void* pPara ) const;
-    void RelNmsToBoxNms( const SwTable&, OUString&, OUString&, OUString*,
+    void RelNmsToBoxNms( const SwTable&, OUStringBuffer&, OUString&, OUString*,
                         void* pPara ) const;
-    void RelBoxNmsToPtr( const SwTable&, OUString&, OUString&, OUString*,
+    void RelBoxNmsToPtr( const SwTable&, OUStringBuffer&, OUString&, OUString*,
                         void* pPara ) const;
-    void BoxNmsToRelNm( const SwTable&, OUString&, OUString&, OUString*,
+    void BoxNmsToRelNm( const SwTable&, OUStringBuffer&, OUString&, OUString*,
                         void* pPara ) const;
-    void MakeFormula_( const SwTable&, OUString&, OUString&, OUString*,
+    void MakeFormula_( const SwTable&, OUStringBuffer&, OUString&, OUString*,
                         void* pPara ) const;
-    void GetFormulaBoxes( const SwTable&, OUString&, OUString&, OUString*,
+    void GetFormulaBoxes( const SwTable&, OUStringBuffer&, OUString&, OUString*,
                         void* pPara ) const;
-    void HasValidBoxes_( const SwTable&, OUString&, OUString&, OUString*,
+    void HasValidBoxes_( const SwTable&, OUStringBuffer&, OUString&, OUString*,
                         void* pPara ) const;
-    void SplitMergeBoxNm_( const SwTable&, OUString&, OUString&, OUString*,
+    void SplitMergeBoxNm_( const SwTable&, OUStringBuffer&, OUString&, OUString*,
                         void* pPara ) const;
 
     static void GetBoxes( const SwTableBox& rStt, const SwTableBox& rEnd,
diff --git a/sw/inc/dbgoutsw.hxx b/sw/inc/dbgoutsw.hxx
index 44dc0b2ab6ce..bc1d93f6c159 100644
--- a/sw/inc/dbgoutsw.hxx
+++ b/sw/inc/dbgoutsw.hxx
@@ -22,6 +22,7 @@
 #ifdef DBG_UTIL
 
 #include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
 #include "tox.hxx"
 #include <cstdio>
 #include <unordered_map>
@@ -78,25 +79,25 @@ SW_DLLPUBLIC const char * dbg_out(const SwNodeRange & rRange);
 template<typename tKey, typename tMember, typename fHashFunction>
 OUString lcl_dbg_out(const std::unordered_map<tKey, tMember, fHashFunction> & rMap)
 {
-    OUString aResult("[");
+    OUStringBuffer aResult("[");
 
     typename std::unordered_map<tKey, tMember, fHashFunction>::const_iterator aIt;
 
     for (aIt = rMap.begin(); aIt != rMap.end(); ++aIt)
     {
         if (aIt != rMap.begin())
-            aResult += ", ";
+            aResult.append(", ");
 
         aResult += aIt->first;
 
         char sBuffer[256];
         sprintf(sBuffer, "(%p)", aIt->second);
-        aResult += OUString(sBuffer, strlen(sBuffer), RTL_TEXTENCODING_ASCII_US);
+        aResult.appendAscii(sBuffer);
     }
 
-    aResult += "]";
+    aResult.append("]");
 
-    return aResult;
+    return aResult.makeStringAndClear();
 }
 
 template<typename tKey, typename tMember, typename fHashFunction>
diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx
index 1e407f8a0225..d9c3f682ed5b 100644
--- a/sw/source/core/bastyp/calc.cxx
+++ b/sw/source/core/bastyp/calc.cxx
@@ -742,7 +742,7 @@ SwCalcOper SwCalc::GetToken()
                 case '[':
                     if( aRes.EndPos < m_sCommand.getLength() )
                     {
-                        m_aVarName.clear();
+                        m_aVarName.setLength(0);
                         sal_Int32 nFndPos = aRes.EndPos,
                                   nSttPos = nFndPos;
 
@@ -753,8 +753,8 @@ SwCalcOper SwCalc::GetToken()
                                 // ignore the ]
                                 if ('\\' == m_sCommand[nFndPos-1])
                                 {
-                                    m_aVarName += m_sCommand.copy( nSttPos,
-                                                    nFndPos - nSttPos - 1 );
+                                    m_aVarName.append(m_sCommand.copy( nSttPos,
+                                                    nFndPos - nSttPos - 1 ));
                                     nSttPos = ++nFndPos;
                                 }
                                 else
@@ -765,8 +765,8 @@ SwCalcOper SwCalc::GetToken()
                         if( nFndPos != -1 )
                         {
                             if( nSttPos != nFndPos )
-                                m_aVarName += m_sCommand.copy( nSttPos,
-                                                    nFndPos - nSttPos );
+                                m_aVarName.append(m_sCommand.copy( nSttPos,
+                                                    nFndPos - nSttPos ));
                             aRes.EndPos = nFndPos + 1;
                             m_eCurrOper = CALC_NAME;
                         }
@@ -1098,13 +1098,13 @@ SwSbxValue SwCalc::PrimFunc(bool &rChkPow)
             {
                 case CALC_ASSIGN:
                 {
-                    SwCalcExp* n = VarInsert(m_aVarName);
+                    SwCalcExp* n = VarInsert(m_aVarName.toString());
                     GetToken();
                     nErg = n->nValue = Expr();
                     break;
                 }
                 default:
-                    nErg = VarLook(m_aVarName)->nValue;
+                    nErg = VarLook(m_aVarName.toString())->nValue;
                     // Explicitly disallow unknown function names (followed by "("),
                     // allow unknown variable names (equal to zero)
                     if (nErg.IsVoidValue() && (eOper == CALC_LP))
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index fe822fc0a7d9..31488c20ee71 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -1716,7 +1716,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
 
                 if( aSet.Count() )
                 {
-                    OUString sAttrs;
+                    OUStringBuffer sAttrs;
                     SfxItemIter aIter( aSet );
                     const SfxPoolItem* pItem = aIter.FirstItem();
                     const IntlWrapper aInt(SvtSysLocale().GetUILanguageTag());
@@ -1728,8 +1728,8 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
                             GetDoc()->GetAttrPool().GetPresentation(*pItem,
                                 MapUnit::MapCM, aStr, aInt);
                             if (!sAttrs.isEmpty())
-                                sAttrs += ", ";
-                            sAttrs += aStr;
+                                sAttrs.append(", ");
+                            sAttrs.append(aStr);
                         }
                         if( aIter.IsAtEnd() )
                             break;
@@ -1739,7 +1739,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
                     {
                         if( !rContentAtPos.sStr.isEmpty() )
                             rContentAtPos.sStr += "\n";
-                        rContentAtPos.sStr += "Attr: " + sAttrs;
+                        rContentAtPos.sStr += "Attr: " + sAttrs.toString();
                     }
                 }
                 bRet = true;
diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index 4e762bfcf218..a2684095b51a 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -973,7 +973,7 @@ bool GoCurrSection( SwPaM & rPam, SwMoveFnCollection const & fnMove )
 
 OUString SwPaM::GetText() const
 {
-    OUString aResult;
+    OUStringBuffer aResult;
 
     SwNodeIndex aNodeIndex = Start()->nNode;
 
@@ -1000,11 +1000,11 @@ OUString SwPaM::GetText() const
                     ? End()->nContent.GetIndex()
                     : aTmpStr.getLength();
 
-                aResult += aTmpStr.copy(nStart, nEnd-nStart);
+                aResult.append(aTmpStr.getStr() + nStart, nEnd-nStart);
             }
             else
             {
-                aResult += aTmpStr;
+                aResult.append(aTmpStr);
             }
         }
 
@@ -1017,7 +1017,7 @@ OUString SwPaM::GetText() const
         bIsStartNode = false;
     }
 
-    return aResult;
+    return aResult.makeStringAndClear();
 }
 
 void SwPaM::InvalidatePaM()
diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx
index a37d713fd105..6834616865fa 100644
--- a/sw/source/core/doc/DocumentFieldsManager.cxx
+++ b/sw/source/core/doc/DocumentFieldsManager.cxx
@@ -923,7 +923,6 @@ void DocumentFieldsManager::UpdateExpFields( SwTextField* pUpdateField, bool bUp
         }
     }
 
-    OUString aNew;
     for( SetGetExpFields::const_iterator it = mpUpdateFields->GetSortLst()->begin(); it != mpUpdateFields->GetSortLst()->end(); ++it )
     {
         SwSection* pSect = const_cast<SwSection*>((*it)->GetSection());
@@ -1054,7 +1053,7 @@ void DocumentFieldsManager::UpdateExpFields( SwTextField* pUpdateField, bool bUp
                     if( (!pUpdateField || pUpdateField == pTextField )
                         && pGField->IsInBodyText() )
                     {
-                        aNew = LookString( aHashStrTable, pGField->GetFormula() );
+                        OUString aNew = LookString( aHashStrTable, pGField->GetFormula() );
                         pGField->ChgExpStr( aNew );
                     }
                 }
@@ -1062,7 +1061,7 @@ void DocumentFieldsManager::UpdateExpFields( SwTextField* pUpdateField, bool bUp
                 {
                     SwSetExpField* pSField = const_cast<SwSetExpField*>(static_cast<const SwSetExpField*>(pField));
                     // is the "formula" a field?
-                    aNew = LookString( aHashStrTable, pSField->GetFormula() );
+                    OUString aNew = LookString( aHashStrTable, pSField->GetFormula() );
 
                     if( aNew.isEmpty() )               // nothing found then the formula is the new value
                         aNew = pSField->GetFormula();
@@ -1113,7 +1112,7 @@ void DocumentFieldsManager::UpdateExpFields( SwTextField* pUpdateField, bool bUp
                 {
                     SwSetExpField* pSField = const_cast<SwSetExpField*>(static_cast<const SwSetExpField*>(pField));
                     SwSetExpFieldType* pSFieldTyp = static_cast<SwSetExpFieldType*>(pField->GetTyp());
-                    aNew = pSFieldTyp->GetName();
+                    OUString aNew = pSFieldTyp->GetName();
 
                     SwNode* pSeqNd = nullptr;
 
diff --git a/sw/source/core/doc/DocumentListsManager.cxx b/sw/source/core/doc/DocumentListsManager.cxx
index bed767732dec..1fedbff2cc45 100644
--- a/sw/source/core/doc/DocumentListsManager.cxx
+++ b/sw/source/core/doc/DocumentListsManager.cxx
@@ -214,8 +214,7 @@ const OUString DocumentListsManager::MakeListIdUnique( const OUString& aSuggeste
     while ( getListByName( aTmpStr ) )
     {
         ++nHitCount;
-        aTmpStr = aSuggestedUniqueListId;
-        aTmpStr += OUString::number( nHitCount );
+        aTmpStr = aSuggestedUniqueListId + OUString::number( nHitCount );
     }
 
     return aTmpStr;
diff --git a/sw/source/core/doc/dbgoutsw.cxx b/sw/source/core/doc/dbgoutsw.cxx
index c8cb14436e2e..bf51116f14c6 100644
--- a/sw/source/core/doc/dbgoutsw.cxx
+++ b/sw/source/core/doc/dbgoutsw.cxx
@@ -53,22 +53,22 @@ bool bDbgOutPrintAttrSet = false;
 template<class T>
 static OUString lcl_dbg_out_SvPtrArr(const T & rArr)
 {
-    OUString aStr("[ ");
+    OUStringBuffer aStr("[ ");
 
     for (typename T::const_iterator i(rArr.begin()); i != rArr.end(); ++i)
     {
         if (i != rArr.begin())
-            aStr += ", ";
+            aStr.append(", ");
 
         if (*i)
-            aStr += lcl_dbg_out(**i);
+            aStr.append(lcl_dbg_out(**i));
         else
-            aStr += "(null)";
+            aStr.append("(null)");
     }
 
-    aStr += " ]";
+    aStr.append(" ]");
 
-    return aStr;
+    return aStr.makeStringAndClear();
 }
 
 const char * dbg_out(const void * pVoid)
@@ -257,28 +257,28 @@ static const OUString lcl_dbg_out(const SfxItemSet & rSet)
     SfxItemIter aIter(rSet);
     const SfxPoolItem * pItem;
     bool bFirst = true;
-    OUString aStr = "[ ";
+    OUStringBuffer aStr = "[ ";
 
     pItem = aIter.FirstItem();
 
     while (pItem )
     {
         if (!bFirst)
-            aStr += ", ";
+            aStr.append(", ");
 
         if (reinterpret_cast<sal_uIntPtr>(pItem) != SAL_MAX_SIZE)
-            aStr += lcl_dbg_out(*pItem);
+            aStr.append(lcl_dbg_out(*pItem));
         else
-            aStr += "invalid";
+            aStr.append("invalid");
 
         bFirst = false;
 
         pItem = aIter.NextItem();
     }
 
-    aStr += " ]";
+    aStr.append(" ]");
 
-    return aStr;
+    return aStr.makeStringAndClear();
 }
 
 const char * dbg_out(const SfxItemSet & rSet)
@@ -308,18 +308,18 @@ const char * dbg_out(const SwTextAttr & rAttr)
 
 static const OUString lcl_dbg_out(const SwpHints & rHints)
 {
-    OUString aStr("[ SwpHints\n");
+    OUStringBuffer aStr("[ SwpHints\n");
 
     for (size_t i = 0; i < rHints.Count(); ++i)
     {
-        aStr += "  ";
-        aStr += lcl_dbg_out(*rHints.Get(i));
-        aStr += "\n";
+        aStr.append("  ");
+        aStr.append(lcl_dbg_out(*rHints.Get(i)));
+        aStr.append("\n");
     }
 
-    aStr += "]\n";
+    aStr.append("]\n");
 
-    return aStr;
+    return aStr.makeStringAndClear();
 }
 
 const char * dbg_out(const SwpHints &rHints)
@@ -431,7 +431,7 @@ const char * dbg_out(const SwFrameFormat & rFrameFormat)
 
 static const OUString lcl_AnchoredFrames(const SwNode & rNode)
 {
-    OUString aResult("[");
+    OUStringBuffer aResult("[");
 
     const SwDoc * pDoc = rNode.GetDoc();
     if (pDoc)
@@ -450,19 +450,19 @@ static const OUString lcl_AnchoredFrames(const SwNode & rNode)
                 if (pPos && &pPos->nNode.GetNode() == &rNode)
                 {
                     if (! bFirst)
-                        aResult += ", ";
+                        aResult.append(", ");
 
                     if (*i)
-                        aResult += lcl_dbg_out(**i);
+                        aResult.append(lcl_dbg_out(**i));
                     bFirst = false;
                 }
             }
         }
     }
 
-    aResult += "]";
+    aResult.append("]");
 
-    return aResult;
+    return aResult.makeStringAndClear();
 }
 
 static OUString lcl_dbg_out_NumType(sal_Int16 nType)
@@ -775,17 +775,17 @@ const char * dbg_out(const SwUndo & rUndo)
 
 static OUString lcl_dbg_out(SwOutlineNodes const & rNodes)
 {
-    OUString aStr("[\n");
+    OUStringBuffer aStr("[\n");
 
     for (size_t i = 0; i < rNodes.size(); i++)
     {
-        aStr += lcl_dbg_out(*rNodes[i]);
-        aStr += "\n";
+        aStr.append(lcl_dbg_out(*rNodes[i]));
+        aStr.append("\n");
     }
 
-    aStr += "]\n";
+    aStr.append("]\n");
 
-    return aStr;
+    return aStr.makeStringAndClear();
 }
 
 const char * dbg_out( SwOutlineNodes const & rNodes)
@@ -804,24 +804,24 @@ static OUString lcl_dbg_out(const SvxNumberFormat & rFormat)
 
 static OUString lcl_dbg_out(const SwNumRule & rRule)
 {
-    OUString aResult("[ ");
+    OUStringBuffer aResult("[ ");
 
-    aResult += rRule.GetName();
-    aResult += " [";
+    aResult.append(rRule.GetName());
+    aResult.append(" [");
 
     for (sal_uInt8 n = 0; n < MAXLEVEL; n++)
     {
         if (n > 0)
-            aResult += ", ";
+            aResult.append(", ");
 
-        aResult += lcl_dbg_out(rRule.Get(n));
+        aResult.append(lcl_dbg_out(rRule.Get(n)));
     }
 
-    aResult += "]";
+    aResult.append("]");
 
-    aResult += "]";
+    aResult.append("]");
 
-    return aResult;
+    return aResult.makeStringAndClear();
 }
 
 const char * dbg_out(const SwNumRule & rRule)
@@ -857,23 +857,23 @@ const char * dbg_out(const SwFrameFormats & rFrameFormats)
 
 static OUString lcl_dbg_out(const SwNumRuleTable & rTable)
 {
-    OUString aResult("[");
+    OUStringBuffer aResult("[");
 
     for (size_t n = 0; n < rTable.size(); n++)
     {
         if (n > 0)
-            aResult += ", ";
+            aResult.append(", ");
 
-        aResult += rTable[n]->GetName();
+        aResult.append(rTable[n]->GetName());
 
         char sBuffer[256];
         sprintf(sBuffer, "(%p)", rTable[n]);
-        aResult += OUString(sBuffer, strlen(sBuffer), RTL_TEXTENCODING_ASCII_US);
+        aResult.appendAscii(sBuffer);
     }
 
-    aResult += "]";
+    aResult.append("]");
 
-    return aResult;
+    return aResult.makeStringAndClear();
 }
 
 const char * dbg_out(const SwNumRuleTable & rTable)
@@ -925,23 +925,23 @@ const char * dbg_out(const SwFormToken & rToken)
 
 static OUString lcl_dbg_out(const SwFormTokens & rTokens)
 {
-    OUString aStr("[");
+    OUStringBuffer aStr("[");
 
     SwFormTokens::const_iterator aIt;
 
     for (aIt = rTokens.begin(); aIt != rTokens.end(); ++aIt)
     {
         if (aIt != rTokens.begin())
-            aStr += ", ";
+            aStr.append(", ");
 
-        aStr += lcl_TokenType2Str(aIt->eTokenType);
-        aStr += ": ";
-        aStr += lcl_dbg_out(*aIt);
+        aStr.append(lcl_TokenType2Str(aIt->eTokenType));
+        aStr.append(": ");
+        aStr.append(lcl_dbg_out(*aIt));
     }
 
-    aStr += "]";
+    aStr.append("]");
 
-    return aStr;
+    return aStr.makeStringAndClear();
 }
 
 const char * dbg_out(const SwFormTokens & rTokens)
diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx
index 0541b19c0d33..7d7fb055798e 100644
--- a/sw/source/core/doc/docsort.cxx
+++ b/sw/source/core/doc/docsort.cxx
@@ -245,7 +245,7 @@ OUString SwSortBoxElement::GetKey(sal_uInt16 nKey) const
         pFndBox = pBox->GetBox(nRow, nCol);         // Sort columns
 
     // Extract the Text
-    OUString aRetStr;
+    OUStringBuffer aRetStr;
     if( pFndBox )
     {   // Get StartNode and skip it
         const SwTableBox* pMyBox = pFndBox->GetBox();
@@ -257,10 +257,10 @@ OUString SwSortBoxElement::GetKey(sal_uInt16 nKey) const
             const SwNode *pNd = nullptr, *pEndNd = pMyBox->GetSttNd()->EndOfSectionNode();
             for( sal_uLong nIdx = pMyBox->GetSttIdx() + 1; pNd != pEndNd; ++nIdx )
                 if( ( pNd = pDoc->GetNodes()[ nIdx ])->IsTextNode() )
-                    aRetStr += pNd->GetTextNode()->GetText();
+                    aRetStr.append(pNd->GetTextNode()->GetText());
         }
     }
-    return aRetStr;
+    return aRetStr.makeStringAndClear();
 }
 
 double SwSortBoxElement::GetValue( sal_uInt16 nKey ) const
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index a4bb0ab1e7eb..9f33fda5d738 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -624,7 +624,7 @@ OUString SwNumRule::MakeNumString( const SwNumberTree::tNumberVector & rNumVecto
                                  SwNumRule::Extremities* pExtremities,
                                  LanguageType nLang ) const
 {
-    OUString aStr;
+    OUStringBuffer aStr;
 
     SwNumberTree::tNumberVector::size_type nLevel = rNumVector.size() - 1;
 
@@ -674,14 +674,14 @@ OUString SwNumRule::MakeNumString( const SwNumberTree::tNumberVector & rNumVecto
                 if( rNumVector[ i ] )
                 {
                     if( bOnlyArabic )
-                        aStr += OUString::number( rNumVector[ i ] );
+                        aStr.append(OUString::number( rNumVector[ i ] ));
                     else
-                        aStr += rNFormat.GetNumStr( rNumVector[ i ], aLocale );
+                        aStr.append(rNFormat.GetNumStr( rNumVector[ i ], aLocale ));
                 }
                 else
-                    aStr += "0";        // all 0 level are a 0
+                    aStr.append("0");        // all 0 level are a 0
                 if( i != nLevel && !aStr.isEmpty() )
-                    aStr += ".";
+                    aStr.append(".");
             }
 
             // The type doesn't have any number, so don't append
@@ -693,7 +693,8 @@ OUString SwNumRule::MakeNumString( const SwNumberTree::tNumberVector & rNumVecto
                 const OUString& sPrefix = rMyNFormat.GetPrefix();
                 const OUString& sSuffix = rMyNFormat.GetSuffix();
 
-                aStr = sPrefix + aStr + sSuffix;
+                aStr.insert(0, sPrefix);
+                aStr.append(sSuffix);
                 if ( pExtremities )
                 {
                     pExtremities->nPrefixChars = sPrefix.getLength();
@@ -703,7 +704,7 @@ OUString SwNumRule::MakeNumString( const SwNumberTree::tNumberVector & rNumVecto
         }
     }
 
-    return aStr;
+    return aStr.makeStringAndClear();
 }
 
 OUString SwNumRule::MakeRefNumString( const SwNodeNum& rNodeNum,
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index a9e7d1d05ad1..7a59d2fe7c9b 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -1236,19 +1236,19 @@ void lcl_ApplyParagraphClassification(SwDoc* pDoc,
 
     // Correct the order
     std::reverse(aFieldNames.begin(), aFieldNames.end());
-    OUString sFieldNames;
+    OUStringBuffer sFieldNames;
     bool first = true;
     for (const OUString& rFieldName : aFieldNames)
     {
         if (!first)
-            sFieldNames += "/";
-        sFieldNames += rFieldName;
+            sFieldNames.append("/");
+        sFieldNames.append(rFieldName);
         first = false;
     }
 
     const OUString sOldFieldNames = lcl_getRDF(xModel, xNodeSubject, ParagraphClassificationFieldNamesRDFName).second;
     SwRDFHelper::removeStatement(xModel, MetaNS, xNodeSubject, ParagraphClassificationFieldNamesRDFName, sOldFieldNames);
-    SwRDFHelper::addStatement(xModel, MetaNS, MetaFilename, xNodeSubject, ParagraphClassificationFieldNamesRDFName, sFieldNames);
+    SwRDFHelper::addStatement(xModel, MetaNS, MetaFilename, xNodeSubject, ParagraphClassificationFieldNamesRDFName, sFieldNames.makeStringAndClear());
 }
 
 void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationResult> aResults)
diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx
index 1971989d93eb..04bd08bb8f6f 100644
--- a/sw/source/core/edit/editsh.cxx
+++ b/sw/source/core/edit/editsh.cxx
@@ -515,7 +515,7 @@ void SwEditShell::ReplaceDropText( const OUString &rStr, SwPaM* pPaM )
 
 OUString SwEditShell::Calculate()
 {
-    OUString  aFormel;                    // the final formula
+    OUStringBuffer aFormel;                    // the final formula
     SwCalc    aCalc( *GetDoc() );
     const CharClass& rCC = GetAppCharClass();
 
@@ -531,13 +531,12 @@ OUString SwEditShell::Calculate()
 
             aStr = rCC.lowercase( aStr );
 
-            sal_Unicode ch;
             bool bValidFields = false;
             sal_Int32 nPos = 0;
 
             while( nPos < aStr.getLength() )
             {
-                ch = aStr[ nPos++ ];
+                sal_Unicode ch = aStr[ nPos++ ];
                 if( rCC.isLetter( aStr, nPos-1 ) || ch == '_' )
                 {
                     sal_Int32 nTmpStt = nPos-1;
@@ -562,18 +561,18 @@ OUString SwEditShell::Calculate()
                                                   pStart->nContent.GetIndex() );
                             bValidFields = true;
                         }
-                        aFormel += "(" + aCalc.GetStrResult( aCalc.VarLook( sVar )->nValue ) + ")";
+                        aFormel.append("(").append(aCalc.GetStrResult( aCalc.VarLook( sVar )->nValue )).append(")");
                     }
                     else
-                        aFormel += sVar;
+                        aFormel.append(sVar);
                 }
                 else
-                    aFormel += OUStringLiteral1(ch);
+                    aFormel.append(ch);
             }
         }
     }
 
-    return aCalc.GetStrResult( aCalc.Calculate(aFormel) );
+    return aCalc.GetStrResult( aCalc.Calculate(aFormel.makeStringAndClear()) );
 }
 
 sfx2::LinkManager& SwEditShell::GetLinkManager()
diff --git a/sw/source/core/fields/cellfml.cxx b/sw/source/core/fields/cellfml.cxx
index f32b330b3413..a67cf9c2b397 100644
--- a/sw/source/core/fields/cellfml.cxx
+++ b/sw/source/core/fields/cellfml.cxx
@@ -310,7 +310,7 @@ SwTableFormula::~SwTableFormula()
 {
 }
 
-void SwTableFormula::MakeFormula_( const SwTable& rTable, OUString& rNewStr,
+void SwTableFormula::MakeFormula_( const SwTable& rTable, OUStringBuffer& rNewStr,
                     OUString& rFirstBox, OUString* pLastBox, void* pPara ) const
 {
     SwTableCalcPara* pCalcPara = static_cast<SwTableCalcPara*>(pPara);
@@ -336,14 +336,14 @@ void SwTableFormula::MakeFormula_( const SwTable& rTable, OUString& rNewStr,
     if( rTable.GetTabSortBoxes().find( pSttBox ) == rTable.GetTabSortBoxes().end() )
         pSttBox = nullptr;
 
-    rNewStr += " ";
+    rNewStr.append(" ");
     if( pEndBox && pSttBox )    // area?
     {
         // get all selected boxes via layout and calculate their values
         SwSelBoxes aBoxes;
         GetBoxes( *pSttBox, *pEndBox, aBoxes );
 
-        rNewStr += "(";
+        rNewStr.append("(");
         bool bDelim = false;
         for (size_t n = 0; n < aBoxes.size() &&
                            !pCalcPara->m_rCalc.IsCalcError(); ++n)
@@ -352,13 +352,13 @@ void SwTableFormula::MakeFormula_( const SwTable& rTable, OUString& rNewStr,
             if ( pTableBox->getRowSpan() >= 1 )
             {
                 if( bDelim )
-                    rNewStr += OUStringLiteral1(cListDelim);
+                    rNewStr.append(cListDelim);
                 bDelim = true;
-                rNewStr += pCalcPara->m_rCalc.GetStrResult(
-                            pTableBox->GetValue( *pCalcPara ) );
+                rNewStr.append(pCalcPara->m_rCalc.GetStrResult(
+                            pTableBox->GetValue( *pCalcPara ) ));
             }
         }
-        rNewStr += ")";
+        rNewStr.append(")");
     }
     else if( pSttBox && !pLastBox ) // only the StartBox?
     {
@@ -366,18 +366,18 @@ void SwTableFormula::MakeFormula_( const SwTable& rTable, OUString& rNewStr,
         // calculate the value of the box
         if ( pSttBox->getRowSpan() >= 1 )
         {
-            rNewStr += "(";
-            rNewStr += pCalcPara->m_rCalc.GetStrResult(
-                            pSttBox->GetValue( *pCalcPara ) );
-            rNewStr += ")";
+            rNewStr.append("(");
+            rNewStr.append(pCalcPara->m_rCalc.GetStrResult(
+                            pSttBox->GetValue( *pCalcPara ) ));
+            rNewStr.append(")");
         }
     }
     else
         pCalcPara->m_rCalc.SetCalcError( SwCalcError::Syntax );   // set error
-    rNewStr += " ";
+    rNewStr.append(" ");
 }
 
-void SwTableFormula::RelNmsToBoxNms( const SwTable& rTable, OUString& rNewStr,
+void SwTableFormula::RelNmsToBoxNms( const SwTable& rTable, OUStringBuffer& rNewStr,
             OUString& rFirstBox, OUString* pLastBox, void* pPara ) const
 {
     // relative name w.r.t. box name (external presentation)
@@ -386,31 +386,31 @@ void SwTableFormula::RelNmsToBoxNms( const SwTable& rTable, OUString& rNewStr,
     const SwTableBox *pBox = rTable.GetTableBox(
                     pNd->FindTableBoxStartNode()->GetIndex() );
 
-    rNewStr += OUStringLiteral1(rFirstBox[0]); // get label for the box
+    rNewStr.append(rFirstBox[0]); // get label for the box
     rFirstBox = rFirstBox.copy(1);
     if( pLastBox )
     {
         const SwTableBox *pRelLastBox = lcl_RelToBox( rTable, pBox, *pLastBox );
         if ( pRelLastBox )
-            rNewStr += pRelLastBox->GetName();
+            rNewStr.append(pRelLastBox->GetName());
         else
-            rNewStr += "A1";
-        rNewStr += ":";
+            rNewStr.append("A1");
+        rNewStr.append(":");
         rFirstBox = rFirstBox.copy( pLastBox->getLength()+1 );
     }
 
     const SwTableBox *pRelFirstBox = lcl_RelToBox( rTable, pBox, rFirstBox );
 
     if (pRelFirstBox)
-        rNewStr += pRelFirstBox->GetName();
+        rNewStr.append(pRelFirstBox->GetName());
     else
-        rNewStr += "A1";
+        rNewStr.append("A1");
 
     // get label for the box
-    rNewStr += OUStringLiteral1(rFirstBox[ rFirstBox.getLength()-1 ]);
+    rNewStr.append(rFirstBox[ rFirstBox.getLength()-1 ]);
 }
 
-void SwTableFormula::RelBoxNmsToPtr( const SwTable& rTable, OUString& rNewStr,
+void SwTableFormula::RelBoxNmsToPtr( const SwTable& rTable, OUStringBuffer& rNewStr,
             OUString& rFirstBox, OUString* pLastBox, void* pPara ) const
 {
     // relative name w.r.t. box name (internal presentation)
@@ -419,30 +419,30 @@ void SwTableFormula::RelBoxNmsToPtr( const SwTable& rTable, OUString& rNewStr,
     const SwTableBox *pBox = rTable.GetTableBox(
                     pNd->FindTableBoxStartNode()->GetIndex() );
 
-    rNewStr += OUStringLiteral1(rFirstBox[0]); // get label for the box
+    rNewStr.append(rFirstBox[0]); // get label for the box
     rFirstBox = rFirstBox.copy(1);
     if( pLastBox )
     {
         const SwTableBox *pRelLastBox = lcl_RelToBox( rTable, pBox, *pLastBox );
         if ( pRelLastBox )
-            rNewStr += OUString::number(reinterpret_cast<sal_PtrDiff>(pRelLastBox));
+            rNewStr.append(OUString::number(reinterpret_cast<sal_PtrDiff>(pRelLastBox)));
         else
-            rNewStr += "0";
-        rNewStr += ":";
+            rNewStr.append("0");
+        rNewStr.append(":");
         rFirstBox = rFirstBox.copy( pLastBox->getLength()+1 );
     }
 
     const SwTableBox *pRelFirstBox = lcl_RelToBox( rTable, pBox, rFirstBox );
     if ( pRelFirstBox )
-        rNewStr += OUString::number(reinterpret_cast<sal_PtrDiff>(pRelFirstBox));
+        rNewStr.append(OUString::number(reinterpret_cast<sal_PtrDiff>(pRelFirstBox)));
     else
-        rNewStr += "0";
+        rNewStr.append("0");
 
     // get label for the box
-    rNewStr += OUStringLiteral1(rFirstBox[ rFirstBox.getLength()-1 ]);
+    rNewStr.append(rFirstBox[ rFirstBox.getLength()-1 ]);
 }
 
-void SwTableFormula::BoxNmsToRelNm( const SwTable& rTable, OUString& rNewStr,
+void SwTableFormula::BoxNmsToRelNm( const SwTable& rTable, OUStringBuffer& rNewStr,
                     OUString& rFirstBox, OUString* pLastBox, void* pPara ) const
 {
     // box name (external presentation) w.r.t. relative name
@@ -459,30 +459,30 @@ void SwTableFormula::BoxNmsToRelNm( const SwTable& rTable, OUString& rNewStr,
         sRefBoxNm = pBox->GetName();
     }
 
-    rNewStr += OUStringLiteral1(rFirstBox[0]); // get label for the box
+    rNewStr.append(rFirstBox[0]); // get label for the box
     rFirstBox = rFirstBox.copy(1);
     if( pLastBox )
     {
-        rNewStr += lcl_BoxNmToRel( rTable, *pTableNd, sRefBoxNm, *pLastBox,
-                                m_eNmType == EXTRNL_NAME );
-        rNewStr += ":";
+        rNewStr.append(lcl_BoxNmToRel( rTable, *pTableNd, sRefBoxNm, *pLastBox,
+                                m_eNmType == EXTRNL_NAME ));
+        rNewStr.append(":");
         rFirstBox = rFirstBox.copy( pLastBox->getLength()+1 );
     }
 
-    rNewStr += lcl_BoxNmToRel( rTable, *pTableNd, sRefBoxNm, rFirstBox,
-                            m_eNmType == EXTRNL_NAME );
+    rNewStr.append(lcl_BoxNmToRel( rTable, *pTableNd, sRefBoxNm, rFirstBox,
+                            m_eNmType == EXTRNL_NAME ));
 
     // get label for the box
-    rNewStr += OUStringLiteral1(rFirstBox[ rFirstBox.getLength()-1 ]);
+    rNewStr.append(rFirstBox[ rFirstBox.getLength()-1 ]);
 }
 
-void SwTableFormula::PtrToBoxNms( const SwTable& rTable, OUString& rNewStr,
+void SwTableFormula::PtrToBoxNms( const SwTable& rTable, OUStringBuffer& rNewStr,
                         OUString& rFirstBox, OUString* pLastBox, void* ) const
 {
     // area in these parentheses?
     SwTableBox* pBox;
 
-    rNewStr += OUStringLiteral1(rFirstBox[0]); // get label for the box
+    rNewStr.append(rFirstBox[0]); // get label for the box
     rFirstBox = rFirstBox.copy(1);
     if( pLastBox )
     {
@@ -490,43 +490,43 @@ void SwTableFormula::PtrToBoxNms( const SwTable& rTable, OUString& rNewStr,
 
         // Is it actually a valid pointer?
         if( rTable.GetTabSortBoxes().find( pBox ) != rTable.GetTabSortBoxes().end() )
-            rNewStr += pBox->GetName();
+            rNewStr.append(pBox->GetName());
         else
-            rNewStr += "?";
-        rNewStr += ":";
+            rNewStr.append("?");
+        rNewStr.append(":");
         rFirstBox = rFirstBox.copy( pLastBox->getLength()+1 );
     }
 
     pBox = reinterpret_cast<SwTableBox*>(sal::static_int_cast<sal_IntPtr>(rFirstBox.toInt64()));
     // Is it actually a valid pointer?
     if( rTable.GetTabSortBoxes().find( pBox ) != rTable.GetTabSortBoxes().end() )
-        rNewStr += pBox->GetName();
+        rNewStr.append(pBox->GetName());
     else
-        rNewStr += "?";
+        rNewStr.append("?");
 
     // get label for the box
-    rNewStr += OUStringLiteral1(rFirstBox[ rFirstBox.getLength()-1 ]);
+    rNewStr.append(rFirstBox[ rFirstBox.getLength()-1 ]);
 }
 
-void SwTableFormula::BoxNmsToPtr( const SwTable& rTable, OUString& rNewStr,
+void SwTableFormula::BoxNmsToPtr( const SwTable& rTable, OUStringBuffer& rNewStr,
                         OUString& rFirstBox, OUString* pLastBox, void* ) const
 {
     // area in these parentheses?
     const SwTableBox* pBox;
 
-    rNewStr += OUStringLiteral1(rFirstBox[0]); // get label for the box
+    rNewStr.append(rFirstBox[0]); // get label for the box
     rFirstBox = rFirstBox.copy(1);
     if( pLastBox )
     {
         pBox = rTable.GetTableBox( *pLastBox );
-        rNewStr += OUString::number(reinterpret_cast<sal_PtrDiff>(pBox))
-                +  ":";
+        rNewStr.append(OUString::number(reinterpret_cast<sal_PtrDiff>(pBox)))
+                .append(":");
         rFirstBox = rFirstBox.copy( pLastBox->getLength()+1 );
     }
 
     pBox = rTable.GetTableBox( rFirstBox );
-    rNewStr += OUString::number(reinterpret_cast<sal_PtrDiff>(pBox))
-            +  OUStringLiteral1(rFirstBox[ rFirstBox.getLength()-1 ]); // get label for the box
+    rNewStr.append(OUString::number(reinterpret_cast<sal_PtrDiff>(pBox)))
+            .append(rFirstBox[ rFirstBox.getLength()-1 ]); // get label for the box
 }
 
 /// create external formula (for UI)
@@ -604,7 +604,7 @@ void SwTableFormula::ToRelBoxNm( const SwTable* pTable )
 OUString SwTableFormula::ScanString( FnScanFormula fnFormula, const SwTable& rTable,
                                      void* pPara ) const
 {
-    OUString aStr;
+    OUStringBuffer aStr;
     sal_Int32 nFormula = 0;
     sal_Int32 nEnd = 0;
 
@@ -635,12 +635,12 @@ OUString SwTableFormula::ScanString( FnScanFormula fnFormula, const SwTable& rTa
         if (nStt<0 || nEnd<0 )
         {
             // set the rest and finish
-            aStr += m_sFormula.copy(nFormula);
+            aStr.append(m_sFormula.copy(nFormula));
             break;
         }
 
         // write beginning
-        aStr += m_sFormula.copy(nFormula, nStt - nFormula);
+        aStr.append(m_sFormula.copy(nFormula, nStt - nFormula));
 
         if (fnFormula)
         {
@@ -663,7 +663,7 @@ OUString SwTableFormula::ScanString( FnScanFormula fnFormula, const SwTable& rTa
 
                     // when creating a formula the table name is unwanted
                     if( fnFormula != &SwTableFormula::MakeFormula_ )
-                        aStr += sTableNm;
+                        aStr.append(sTableNm);
                     nStt = nSeparator;
 
                     sTableNm = sTableNm.copy( 1 );   // delete separator
@@ -696,7 +696,7 @@ OUString SwTableFormula::ScanString( FnScanFormula fnFormula, const SwTable& rTa
 
         nFormula = nEnd+1;
     } while( true );
-    return aStr;
+    return aStr.makeStringAndClear();
 }
 
 const SwTable* SwTableFormula::FindTable( SwDoc& rDoc, const OUString& rNm )
@@ -882,7 +882,7 @@ void SwTableFormula::GetBoxesOfFormula( const SwTable& rTable,
     ScanString( &SwTableFormula::GetFormulaBoxes, rTable, &rBoxes );
 }
 
-void SwTableFormula::GetFormulaBoxes( const SwTable& rTable, OUString& ,
+void SwTableFormula::GetFormulaBoxes( const SwTable& rTable, OUStringBuffer& ,
                     OUString& rFirstBox, OUString* pLastBox, void* pPara ) const
 {
     SwSelBoxes* pBoxes = static_cast<SwSelBoxes*>(pPara);
@@ -972,7 +972,7 @@ void SwTableFormula::GetBoxes( const SwTableBox& rSttBox,
 }
 
 /// Are all boxes valid that are referenced by the formula?
-void SwTableFormula::HasValidBoxes_( const SwTable& rTable, OUString& ,
+void SwTableFormula::HasValidBoxes_( const SwTable& rTable, OUStringBuffer& ,
                     OUString& rFirstBox, OUString* pLastBox, void* pPara ) const
 {
     bool* pBValid = static_cast<bool*>(pPara);
@@ -1043,12 +1043,12 @@ sal_uInt16 SwTableFormula::GetLnPosInTable( const SwTable& rTable, const SwTable
     return nRet;
 }
 
-void SwTableFormula::SplitMergeBoxNm_( const SwTable& rTable, OUString& rNewStr,
+void SwTableFormula::SplitMergeBoxNm_( const SwTable& rTable, OUStringBuffer& rNewStr,
                     OUString& rFirstBox, OUString* pLastBox, void* pPara ) const
 {
     SwTableFormulaUpdate& rTableUpd = *static_cast<SwTableFormulaUpdate*>(pPara);
 
-    rNewStr += OUStringLiteral1(rFirstBox[0]);     // get label for the box
+    rNewStr.append(rFirstBox[0]);     // get label for the box
     rFirstBox = rFirstBox.copy(1);
 
     OUString sTableNm;
@@ -1075,17 +1075,17 @@ void SwTableFormula::SplitMergeBoxNm_( const SwTable& rTable, OUString& rNewStr,
                 if( pFnd == rTableUpd.m_aData.pDelTable )
                 {
                     if( rTableUpd.m_pTable != &rTable ) // not the current one
-                        rNewStr += rTableUpd.m_pTable->GetFrameFormat()->GetName() + "."; // set new table name
+                        rNewStr.append(rTableUpd.m_pTable->GetFrameFormat()->GetName()).append("."); // set new table name
                     rTableUpd.m_bModified = true;
                 }
                 else if( pFnd != rTableUpd.m_pTable ||
                     ( rTableUpd.m_pTable != &rTable && &rTable != rTableUpd.m_aData.pDelTable))
-                    rNewStr += sTableNm + "."; // keep table name
+                    rNewStr.append(sTableNm).append("."); // keep table name
                 else
                     rTableUpd.m_bModified = true;
             }
             else
-                rNewStr += sTableNm + ".";     // keep table name
+                rNewStr.append(sTableNm).append(".");     // keep table name
         }
     }
     if( pTableNmBox == pLastBox )
@@ -1167,25 +1167,25 @@ void SwTableFormula::SplitMergeBoxNm_( const SwTable& rTable, OUString& rNewStr,
             if( !bInNewTable )
             {
                 rTableUpd.m_bModified = true;
-                rNewStr += rTableUpd.m_pTable->GetFrameFormat()->GetName() + ".";
+                rNewStr.append(rTableUpd.m_pTable->GetFrameFormat()->GetName()).append(".");
             }
             else if( !sTableNm.isEmpty() )
-                rNewStr += sTableNm + ".";
+                rNewStr.append(sTableNm).append(".");
         }
         else if( bInNewTable )
         {
             rTableUpd.m_bModified = true;
-            rNewStr += *rTableUpd.m_aData.pNewTableNm + ".";
+            rNewStr.append(*rTableUpd.m_aData.pNewTableNm).append(".");
         }
         else if( !sTableNm.isEmpty() )
-            rNewStr += sTableNm + ".";
+            rNewStr.append(sTableNm).append(".");
     }
 
     if( pLastBox )
-        rNewStr += OUString::number(reinterpret_cast<sal_PtrDiff>(pEndBox)) + ":";
+        rNewStr.append(OUString::number(reinterpret_cast<sal_PtrDiff>(pEndBox))).append(":");
 
-    rNewStr += OUString::number(reinterpret_cast<sal_PtrDiff>(pSttBox))
-            +  OUStringLiteral1(rFirstBox[ rFirstBox.getLength()-1] );
+    rNewStr.append(OUString::number(reinterpret_cast<sal_PtrDiff>(pSttBox)))
+            .append(rFirstBox[ rFirstBox.getLength()-1] );
 }
 
 /// Create external formula but remember that the formula is placed in a split/merged table
diff --git a/sw/source/core/fields/ddefld.cxx b/sw/source/core/fields/ddefld.cxx
index a552ffecc131..f5aacede9507 100644
--- a/sw/source/core/fields/ddefld.cxx
+++ b/sw/source/core/fields/ddefld.cxx
@@ -315,7 +315,7 @@ void SwDDEFieldType::PutValue( const uno::Any& rVal, sal_uInt16 nWhichId )
     if( nPart>=0 )
     {
         const OUString sOldCmd( GetCmd() );
-        OUString sNewCmd;
+        OUStringBuffer sNewCmd;
         sal_Int32 nIndex = 0;
         for (sal_Int32 i=0; i<3; ++i)
         {
@@ -324,10 +324,10 @@ void SwDDEFieldType::PutValue( const uno::Any& rVal, sal_uInt16 nWhichId )
             {
                 rVal >>= sToken;
             }
-            sNewCmd += (i < 2)
-                ? sToken + OUStringLiteral1(sfx2::cTokenSeparator) : sToken;
+            sNewCmd.append((i < 2)
+                ? sToken + OUStringLiteral1(sfx2::cTokenSeparator) : sToken);
         }
-        SetCmd( sNewCmd );
+        SetCmd( sNewCmd.makeStringAndClear() );
     }
 }
 
diff --git a/sw/source/core/tox/ToxTextGenerator.cxx b/sw/source/core/tox/ToxTextGenerator.cxx
index 2cd0d5306e61..ae3bc73cfbef 100644
--- a/sw/source/core/tox/ToxTextGenerator.cxx
+++ b/sw/source/core/tox/ToxTextGenerator.cxx
@@ -347,18 +347,18 @@ ToxTextGenerator::ApplyHandledTextToken(const HandledTextToken& htt, SwTextNode&
 /*static*/ OUString
 ToxTextGenerator::ConstructPageNumberPlaceholder(size_t numberOfToxSources)
 {
-    OUString retval;
     if (numberOfToxSources == 0) {
-        return retval;
+        return OUString();
     }
+    OUStringBuffer retval;
     // Place holder for the PageNumber; we only respect the first one
-    retval += OUStringLiteral1(C_NUM_REPL);
+    retval.append(C_NUM_REPL);
     for (size_t i = 1; i < numberOfToxSources; ++i) {
-        retval += S_PAGE_DELI;
-        retval += OUStringLiteral1(C_NUM_REPL);
+        retval.append(S_PAGE_DELI);
+        retval.append(C_NUM_REPL);
     }
-    retval += OUStringLiteral1(C_END_PAGE_NUM);
-    return retval;
+    retval.append(C_END_PAGE_NUM);
+    return retval.makeStringAndClear();
 }
 
 /*virtual*/ SwChapterField
diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx
index c76ee1c90ac7..7e942b427ecb 100644
--- a/sw/source/core/undo/undel.cxx
+++ b/sw/source/core/undo/undel.cxx
@@ -625,7 +625,7 @@ static OUString lcl_DenotedPortion(const OUString& rStr, sal_Int32 nStart, sal_I
 
 OUString DenoteSpecialCharacters(const OUString & rStr)
 {
-    OUString aResult;
+    OUStringBuffer aResult;
 
     if (!rStr.isEmpty())
     {
@@ -649,7 +649,7 @@ OUString DenoteSpecialCharacters(const OUString & rStr)
 
             if (bStart)
             {
-                aResult += lcl_DenotedPortion(rStr, nStart, i);
+                aResult.append(lcl_DenotedPortion(rStr, nStart, i));
 
                 nStart = i;
                 bStart = false;
@@ -658,12 +658,12 @@ OUString DenoteSpecialCharacters(const OUString & rStr)
             cLast = rStr[i];
         }
 
-        aResult += lcl_DenotedPortion(rStr, nStart, rStr.getLength());
+        aResult.append(lcl_DenotedPortion(rStr, nStart, rStr.getLength()));
     }
     else
         aResult = SwRewriter::GetPlaceHolder(UndoArg2);
 
-    return aResult;
+    return aResult.makeStringAndClear();
 }
 
 SwRewriter SwUndoDelete::GetRewriter() const
diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx
index c76d85fb1a45..7858cf0d64be 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -1688,7 +1688,7 @@ OUString SAL_CALL SwChartDataProvider::convertRangeToXML( const OUString& rRange
     if (rRangeRepresentation.isEmpty())
         return OUString();
 
-    OUString aRes;
+    OUStringBuffer aRes;
 
     // multiple ranges are delimited by a ';' like in
     // "Table1.A1:A4;Table1.C2:C5" the same table must be used in all ranges!
@@ -1741,12 +1741,12 @@ OUString SAL_CALL SwChartDataProvider::convertRangeToXML( const OUString& rRange
         }
         OUString aTmp( XMLRangeHelper::getXMLStringFromCellRange( aCellRange ) );
         if (!aRes.isEmpty()) // in case of multiple ranges add delimiter
-            aRes += " ";
-        aRes += aTmp;
+            aRes.append(" ");
+        aRes.append(aTmp);
     }
     while (nPos>0);
 
-    return aRes;
+    return aRes.makeStringAndClear();
 }
 
 OUString SAL_CALL SwChartDataProvider::convertRangeFromXML( const OUString& rXMLRange )
@@ -1758,7 +1758,7 @@ OUString SAL_CALL SwChartDataProvider::convertRangeFromXML( const OUString& rXML
     if (rXMLRange.isEmpty())
         return OUString();
 
-    OUString aRes;
+    OUStringBuffer aRes;
 
     // multiple ranges are delimited by a ' ' like in
     // "Table1.$A$1:.$A$4 Table1.$C$2:.$C$5" the same table must be used in all ranges!
@@ -1790,12 +1790,12 @@ OUString SAL_CALL SwChartDataProvider::convertRangeFromXML( const OUString& rXML
         }
 
         if (!aRes.isEmpty()) // in case of multiple ranges add delimiter
-            aRes += ";";
-        aRes += aTmp;
+            aRes.append(";");
+        aRes.append(aTmp);
     }
     while (nPos>0);
 
-    return aRes;
+    return aRes.makeStringAndClear();
 }
 
 SwChartDataSource::SwChartDataSource(
diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx
index f2550b36fa23..aded66619adf 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -2606,19 +2606,19 @@ SwXDocumentIndex::StyleAccess_Impl::replaceByIndex(
 
     const sal_Int32 nStyles = aSeq.getLength();
     const OUString* pStyles = aSeq.getConstArray();
-    OUString sSetStyles;
+    OUStringBuffer sSetStyles;
     OUString aString;
     for(sal_Int32 i = 0; i < nStyles; i++)
     {
         if(i)
         {
-            sSetStyles += OUStringLiteral1(TOX_STYLE_DELIMITER);
+            sSetStyles.append(TOX_STYLE_DELIMITER);
         }
         SwStyleNameMapper::FillUIName(pStyles[i], aString,
                 SwGetPoolIdFromName::TxtColl);
-        sSetStyles +=  aString;
+        sSetStyles.append(aString);
     }
-    rTOXBase.SetStyleNames(sSetStyles, static_cast<sal_uInt16>(nIndex));
+    rTOXBase.SetStyleNames(sSetStyles.makeStringAndClear(), static_cast<sal_uInt16>(nIndex));
 }
 
 sal_Int32 SAL_CALL
@@ -2743,7 +2743,7 @@ SwXDocumentIndex::TokenAccess_Impl::replaceByIndex(
         throw lang::IllegalArgumentException();
     }
 
-    OUString sPattern;
+    OUStringBuffer sPattern;
     const sal_Int32 nTokens = aSeq.getLength();
     const beans::PropertyValues* pTokens = aSeq.getConstArray();
     for(sal_Int32 i = 0; i < nTokens; i++)
@@ -2896,10 +2896,10 @@ SwXDocumentIndex::TokenAccess_Impl::replaceByIndex(
                 throw lang::IllegalArgumentException();
             }
         }
-        sPattern += aToken.GetString();
+        sPattern.append(aToken.GetString());
     }
     SwForm aForm(rTOXBase.GetTOXForm());
-    aForm.SetPattern(static_cast<sal_uInt16>(nIndex), sPattern);
+    aForm.SetPattern(static_cast<sal_uInt16>(nIndex), sPattern.makeStringAndClear());
     rTOXBase.SetTOXForm(aForm);
 }
 
diff --git a/sw/source/filter/docx/swdocxreader.cxx b/sw/source/filter/docx/swdocxreader.cxx
index 90a6a9f1224f..97f06733cd9e 100644
--- a/sw/source/filter/docx/swdocxreader.cxx
+++ b/sw/source/filter/docx/swdocxreader.cxx
@@ -217,13 +217,11 @@ bool SwDOCXReader::MakeEntries( SwDoc *pD, SwTextBlocks &rBlocks )
                 // Need to check make sure the shortcut is not already being used
                 sal_Int32 nStart = 0;
                 sal_uInt16 nCurPos = rBlocks.GetIndex( sShortcut );
-                sal_Int32 nLen = sShortcut.getLength();
 
                 while( sal_uInt16(-1) != nCurPos )
                 {
-                    sShortcut = sShortcut.copy( 0, nLen );
                     // add an Number to it
-                    sShortcut += OUString::number( ++nStart );
+                    sShortcut = aLNm + OUString::number( ++nStart );
                     nCurPos = rBlocks.GetIndex( sShortcut );
                 }
 
diff --git a/sw/source/filter/html/htmlbas.cxx b/sw/source/filter/html/htmlbas.cxx
index f9b273d55501..be5daed030d2 100644
--- a/sw/source/filter/html/htmlbas.cxx
+++ b/sw/source/filter/html/htmlbas.cxx
@@ -141,8 +141,7 @@ void SwHTMLParser::EndScript()
                     bool bFound = true;
                     while( bFound )
                     {
-                        m_aBasicModule = "Modul";
-                        m_aBasicModule += OUString::number( static_cast<sal_Int32>(++m_nSBModuleCnt) );
+                        m_aBasicModule = "Modul" + OUString::number( static_cast<sal_Int32>(++m_nSBModuleCnt) );
                         bFound = xModLib->hasByName( m_aBasicModule );
                     }
                 }
diff --git a/sw/source/filter/html/htmlftn.cxx b/sw/source/filter/html/htmlftn.cxx
index c8a50ae1f42d..2655f2756709 100644
--- a/sw/source/filter/html/htmlftn.cxx
+++ b/sw/source/filter/html/htmlftn.cxx
@@ -497,15 +497,15 @@ static void lcl_html_outFootEndNoteInfo( Writer& rWrt, OUString const *pParts,
 {
     SwHTMLWriter& rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
 
-    OUString aContent;
+    OUStringBuffer aContent;
     for( int i=0; i<nParts; ++i )
     {
         OUString aTmp( pParts[i] );
         aTmp = aTmp.replaceAll( "\\", "\\\\" );
         aTmp = aTmp.replaceAll( ";", "\\;" );
         if( i > 0 )
-            aContent += ";";
-        aContent += aTmp;
+            aContent.append(";");
+        aContent.append(aTmp);
     }
 
     rHTMLWrt.OutNewLine();
@@ -514,7 +514,7 @@ static void lcl_html_outFootEndNoteInfo( Writer& rWrt, OUString const *pParts,
         .append(OOO_STRING_SVTOOLS_HTML_O_name).append("=\"").append(pName)
         .append("\" ").append(OOO_STRING_SVTOOLS_HTML_O_content).append("=\"");
     rWrt.Strm().WriteCharPtr( sOut.makeStringAndClear().getStr() );
-    HTMLOutFuncs::Out_String( rWrt.Strm(), aContent, rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters );
+    HTMLOutFuncs::Out_String( rWrt.Strm(), aContent.makeStringAndClear(), rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters );
     rWrt.Strm().WriteCharPtr( "\">" );
 }
 
diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx
index aa6298da1a55..db0bc5e666e9 100644
--- a/sw/source/filter/html/svxcss1.cxx
+++ b/sw/source/filter/html/svxcss1.cxx
@@ -1060,7 +1060,7 @@ static void ParseCSS1_font_family( const CSS1Expression *pExpr,
 {
     OSL_ENSURE( pExpr, "no expression" );
 
-    OUString aName;
+    OUStringBuffer aName;
     rtl_TextEncoding eEnc = rParser.GetDfltEncoding();
     const FontList *pFList = rParser.GetFontList();
     bool bFirst = true;
@@ -1101,8 +1101,8 @@ static void ParseCSS1_font_family( const CSS1Expression *pExpr,
                     }
                 }
                 if( !bFirst )
-                    aName += ";";
-                aName += aIdent;
+                    aName.append(";");
+                aName.append(aIdent);
             }
         }
 
@@ -1112,7 +1112,7 @@ static void ParseCSS1_font_family( const CSS1Expression *pExpr,
 
     if( !aName.isEmpty() && !rParser.IsIgnoreFontFamily() )
     {
-        SvxFontItem aFont( FAMILY_DONTKNOW, aName, OUString(), PITCH_DONTKNOW,
+        SvxFontItem aFont( FAMILY_DONTKNOW, aName.makeStringAndClear(), OUString(), PITCH_DONTKNOW,
                             eEnc, aItemIds.nFont );
         rItemSet.Put( aFont );
         aFont.SetWhich( aItemIds.nFontCJK );
diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx
index 16d0336fbb55..9f27faa311e0 100644
--- a/sw/source/filter/ww8/writerwordglue.cxx
+++ b/sw/source/filter/ww8/writerwordglue.cxx
@@ -305,8 +305,7 @@ namespace myImplHelpers
                     (nI < SAL_MAX_INT32)
                   )
             {
-                aName = aBaseName;
-                aName += OUString::number(nI++);
+                aName = aBaseName + OUString::number(nI++);
             }
         }
 
diff --git a/sw/source/filter/ww8/ww8glsy.cxx b/sw/source/filter/ww8/ww8glsy.cxx
index cd1c54459341..811b554c15a7 100644
--- a/sw/source/filter/ww8/ww8glsy.cxx
+++ b/sw/source/filter/ww8/ww8glsy.cxx
@@ -155,11 +155,9 @@ bool WW8Glossary::MakeEntries(SwDoc *pD, SwTextBlocks &rBlocks,
                 // Need to check make sure the shortcut is not already being used
                 sal_Int32 nStart = 0;
                 sal_uInt16 nCurPos = rBlocks.GetIndex( sShortcut );
-                sal_Int32 nLen = sShortcut.getLength();
                 while( sal_uInt16(-1) != nCurPos )
                 {
-                    sShortcut = sShortcut.copy( 0, nLen );
-                    sShortcut += OUString::number(++nStart);    // add an Number to it
+                    sShortcut = rLNm + OUString::number(++nStart);    // add an Number to it
                     nCurPos = rBlocks.GetIndex( sShortcut );
                 }
 
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 8492427b7315..e4436e1c9049 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -177,21 +177,21 @@ static SwMacroInfo* GetMacroInfo( SdrObject* pObj )
 
 void lclGetAbsPath(OUString& rPath, sal_uInt16 nLevel, SwDocShell const * pDocShell)
 {
-    OUString aTmpStr;
+    OUStringBuffer aTmpStr;
     while( nLevel )
     {
-        aTmpStr += "../";
+        aTmpStr.append("../");
         --nLevel;
     }
     if (!aTmpStr.isEmpty())
-        aTmpStr += rPath;
+        aTmpStr.append(rPath);
     else
         aTmpStr = rPath;
 
     if (!aTmpStr.isEmpty())
     {
         bool bWasAbs = false;
-        rPath = pDocShell->GetMedium()->GetURLObject().smartRel2Abs( aTmpStr, bWasAbs ).GetMainURL( INetURLObject::DecodeMechanism::NONE );
+        rPath = pDocShell->GetMedium()->GetURLObject().smartRel2Abs( aTmpStr.makeStringAndClear(), bWasAbs ).GetMainURL( INetURLObject::DecodeMechanism::NONE );
         // full path as stored in SvxURLField must be encoded
     }
 }
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 7fb6ee18862f..416264981e82 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -596,7 +596,7 @@ void SwWW8ImplReader::SetAnlvStrings(SwNumFormat &rNum, WW8_ANLV const &rAV,
     const WW8_FFN* pF = m_xFonts->GetFont(SVBT16ToShort(rAV.ftc)); // FontInfo
     bool bListSymbol = pF && ( pF->aFFNBase.chs == 2 );      // Symbol/WingDings/...
 
-    OUString sText;
+    OUStringBuffer sText;
     sal_uInt32 nLen = rAV.cbTextBefore + rAV.cbTextAfter;
     if (m_bVer67)
     {
@@ -618,7 +618,7 @@ void SwWW8ImplReader::SetAnlvStrings(SwNumFormat &rNum, WW8_ANLV const &rAV,
         }
         for(sal_uInt32 i = 0; i < nLen; ++i, pText += 2)
         {
-            sText += OUStringLiteral1(SVBT16ToShort(*reinterpret_cast<SVBT16 const *>(pText)));
+            sText.append(static_cast<sal_Unicode>(SVBT16ToShort(*reinterpret_cast<SVBT16 const *>(pText))));
         }
     }
 
@@ -637,7 +637,7 @@ void SwWW8ImplReader::SetAnlvStrings(SwNumFormat &rNum, WW8_ANLV const &rAV,
                 OUStringBuffer aBuf;
                 comphelper::string::padToLength(aBuf, rAV.cbTextBefore
                     + rAV.cbTextAfter, cBulletChar);
-                sText = aBuf.makeStringAndClear();
+                sText = aBuf;
             }
         }
     }
@@ -674,13 +674,13 @@ void SwWW8ImplReader::SetAnlvStrings(SwNumFormat &rNum, WW8_ANLV const &rAV,
     {
         if (rAV.cbTextBefore)
         {
-            OUString sP( sText.copy( 0, rAV.cbTextBefore ) );
+            OUString sP( sText.copy( 0, rAV.cbTextBefore ).makeStringAndClear() );
             rNum.SetPrefix( sP );
         }
         if( rAV.cbTextAfter )
         {
             OUString sP( rNum.GetSuffix() );
-            sP += sText.copy( rAV.cbTextBefore, rAV.cbTextAfter);
+            sP += sText.copy( rAV.cbTextBefore, rAV.cbTextAfter).makeStringAndClear();
             rNum.SetSuffix( sP );
         }
 // The characters before and after multiple digits do not apply because
diff --git a/sw/source/ui/chrdlg/drpcps.cxx b/sw/source/ui/chrdlg/drpcps.cxx
index 854e3f29fcf3..fafe26d3ca07 100644
--- a/sw/source/ui/chrdlg/drpcps.cxx
+++ b/sw/source/ui/chrdlg/drpcps.cxx
@@ -107,10 +107,10 @@ void SwDropCapsPict::InitPrinter()
 // Create Default-String from character-count (A, AB, ABC, ...)
 OUString GetDefaultString(sal_Int32 nChars)
 {
-    OUString aStr;
+    OUStringBuffer aStr(nChars);
     for (sal_Int32 i = 0; i < nChars; i++)
-        aStr += OUString(static_cast<char>(i + 65));
-    return aStr;
+        aStr.append(static_cast<sal_Unicode>(i + 65));
+    return aStr.makeStringAndClear();
 }
 
 static void calcFontHeightAnyAscent(vcl::RenderContext& rWin, vcl::Font const & _rFont, long& _nHeight, long& _nAscent)
diff --git a/sw/source/ui/dbui/createaddresslistdialog.cxx b/sw/source/ui/dbui/createaddresslistdialog.cxx
index 0e3d04664e5a..b024cd71c264 100644
--- a/sw/source/ui/dbui/createaddresslistdialog.cxx
+++ b/sw/source/ui/dbui/createaddresslistdialog.cxx
@@ -594,21 +594,21 @@ namespace
 
 void lcl_WriteValues(const std::vector<OUString> *pFields, SvStream* pStream)
 {
-    OUString sLine;
+    OUStringBuffer sLine;
     const std::vector< OUString >::const_iterator aBegin = pFields->begin();
     const std::vector< OUString >::const_iterator aEnd = pFields->end();
     for(std::vector< OUString >::const_iterator aIter = aBegin; aIter != aEnd; ++aIter)
     {
         if (aIter==aBegin)
         {
-            sLine += "\"" + *aIter + "\"";
+            sLine.append("\"").append(*aIter).append("\"");
         }
         else
         {
-            sLine += "\t\"" + *aIter + "\"";
+            sLine.append("\t\"").append(*aIter).append("\"");
         }
     }
-    pStream->WriteByteStringLine( sLine, RTL_TEXTENCODING_UTF8 );
+    pStream->WriteByteStringLine( sLine.makeStringAndClear(), RTL_TEXTENCODING_UTF8 );
 }
 
 }
diff --git a/sw/source/ui/dbui/mmresultdialogs.cxx b/sw/source/ui/dbui/mmresultdialogs.cxx
index 1b3c4f237772..f5680b980040 100644
--- a/sw/source/ui/dbui/mmresultdialogs.cxx
+++ b/sw/source/ui/dbui/mmresultdialogs.cxx
@@ -1114,7 +1114,7 @@ IMPL_LINK(SwMMResultEmailDialog, SendDocumentsHdl_Impl, Button*, pButton, void)
         OUString sEMail = lcl_GetColumnValueOf(sEMailColumn, xColAccess);
         SwMailDescriptor aDesc;
         aDesc.sEMail = sEMail;
-        OUString sBody;
+        OUStringBuffer sBody;
         if(bAsBody)
         {
             {
@@ -1132,8 +1132,8 @@ IMPL_LINK(SwMMResultEmailDialog, SendDocumentsHdl_Impl, Button*, pButton, void)
                 bool bDone = pInStream->ReadLine( sLine );
                 while ( bDone )
                 {
-                    sBody += OStringToOUString(sLine, eEncoding);
-                    sBody += "\n";
+                    sBody.append( OStringToOUString(sLine, eEncoding) );
+                    sBody.append("\n");
                     bDone = pInStream->ReadLine( sLine );
                 }
             }
@@ -1183,10 +1183,10 @@ IMPL_LINK(SwMMResultEmailDialog, SendDocumentsHdl_Impl, Button*, pButton, void)
 
                 }
                 sGreeting += "\n";
-                sBody = sGreeting + sBody;
+                sBody.insert(0, sGreeting);
             }
         }
-        aDesc.sBodyContent = sBody;
+        aDesc.sBodyContent = sBody.makeStringAndClear();
         if(MM_DOCTYPE_HTML == nDocType)
         {
             aDesc.sBodyMimeType = "text/html; charset=" +
diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index a791bf0d341d..2b42694961da 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -3392,7 +3392,7 @@ IMPL_LINK(SwTokenWindow, ScrollHdl, Button*, pBtn, void )
 
 OUString SwTokenWindow::GetPattern() const
 {
-    OUString sRet;
+    OUStringBuffer sRet;
 
     for (auto it = m_aControlList.cbegin(); it != m_aControlList.cend(); ++it)
     {
@@ -3403,10 +3403,10 @@ OUString SwTokenWindow::GetPattern() const
                 : static_cast<const SwTOXButton*>(pCtrl)->GetFormToken();
 
         //TODO: prevent input of TOX_STYLE_DELIMITER in KeyInput
-        sRet += rNewToken.GetString();
+        sRet.append(rNewToken.GetString());
     }
 
-    return sRet;
+    return sRet.makeStringAndClear();
 }
 
 // Check if a control of the specified TokenType is already contained in the list
diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx
index aa813f77fefd..81a76489fb10 100644
--- a/sw/source/ui/index/swuiidxmrk.cxx
+++ b/sw/source/ui/index/swuiidxmrk.cxx
@@ -1222,10 +1222,10 @@ IMPL_LINK_NOARG(SwAuthorMarkPane, InsertHdl, Button*, void)
         }
 
         SwFieldMgr aMgr(pSh);
-        OUString sFields;
+        OUStringBuffer sFields;
         for(OUString & s : m_sFields)
         {
-            sFields += s + OUStringLiteral1(TOX_STYLE_DELIMITER);
+            sFields.append(s).append(TOX_STYLE_DELIMITER);
         }
         if(bNewEntry)
         {
@@ -1236,12 +1236,12 @@ IMPL_LINK_NOARG(SwAuthorMarkPane, InsertHdl, Button*, void)
                     aNewData.SetAuthorField(static_cast<ToxAuthorityField>(i), m_sFields[i]);
                 pSh->ChangeAuthorityData(&aNewData);
             }
-            SwInsertField_Data aData(TYP_AUTHORITY, 0, sFields, OUString(), 0 );
+            SwInsertField_Data aData(TYP_AUTHORITY, 0, sFields.makeStringAndClear(), OUString(), 0 );
             aMgr.InsertField( aData );
         }
         else if(aMgr.GetCurField())
         {
-            aMgr.UpdateCurField(0, sFields, OUString());
+            aMgr.UpdateCurField(0, sFields.makeStringAndClear(), OUString());
         }
     }
     if(!bNewEntry)
diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx
index f2eb26d68384..61182dae5e04 100644
--- a/sw/source/ui/misc/bookmark.cxx
+++ b/sw/source/ui/misc/bookmark.cxx
@@ -145,15 +145,15 @@ IMPL_LINK_NOARG(SwInsertBookmarkDlg, SelectionChangedHdl, SvTreeListBox*, void)
     if (!m_pBookmarksBox->HasFocus())
         return;
 
-    OUString sEditBoxText;
+    OUStringBuffer sEditBoxText;
     SvTreeListEntry* pSelected = m_pBookmarksBox->FirstSelected();
     for (sal_Int32 i = m_pBookmarksBox->GetSelectionCount(); i; i--)
     {
         sw::mark::IMark* pBookmark = static_cast<sw::mark::IMark*>(pSelected->GetUserData());
         OUString sEntryName = pBookmark->GetName();
-        sEditBoxText = sEditBoxText + sEntryName;
+        sEditBoxText.append(sEntryName);
         if (i > 1)
-            sEditBoxText += ";";
+            sEditBoxText.append(";");
         pSelected = m_pBookmarksBox->NextSelected(pSelected);
     }
     if (m_pBookmarksBox->GetSelectionCount() > 0)
@@ -162,7 +162,7 @@ IMPL_LINK_NOARG(SwInsertBookmarkDlg, SelectionChangedHdl, SvTreeListBox*, void)
         m_pGotoBtn->Enable(m_pBookmarksBox->GetSelectionCount() == 1);
         m_pRenameBtn->Enable(m_pBookmarksBox->GetSelectionCount() == 1);
         m_pDeleteBtn->Enable();
-        m_pEditBox->SetText(sEditBoxText);
+        m_pEditBox->SetText(sEditBoxText.makeStringAndClear());
     }
     else
     {
diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx
index 386377e6c476..1d991e7ab272 100644
--- a/sw/source/ui/misc/glossary.cxx
+++ b/sw/source/ui/misc/glossary.cxx
@@ -92,14 +92,15 @@ static OUString lcl_GetValidShortCut( const OUString& rName )
     while( rName[nStart-1]==' ' && nStart < nSz )
         nStart++;
 
-    OUString aBuf = OUString(rName[nStart-1]);
+    OUStringBuffer aBuf;
+    aBuf.append(rName[nStart-1]);
 
     for( ; nStart < nSz; ++nStart )
     {
         if( rName[nStart-1]==' ' && rName[nStart]!=' ')
-            aBuf += OUStringLiteral1(rName[nStart]);
+            aBuf.append(rName[nStart]);
     }
-    return aBuf;
+    return aBuf.makeStringAndClear();
 }
 
 struct GroupUserData
diff --git a/sw/source/ui/vba/vbatemplate.cxx b/sw/source/ui/vba/vbatemplate.cxx
index 27af69f99148..c33cdb000b8d 100644
--- a/sw/source/ui/vba/vbatemplate.cxx
+++ b/sw/source/ui/vba/vbatemplate.cxx
@@ -32,7 +32,7 @@ using namespace ::com::sun::star;
 
 static OUString lcl_CheckGroupName( const OUString& rGroupName )
 {
-    OUString sRet;
+    OUStringBuffer sRet;
     //group name should contain only A-Z and a-z and spaces
     for( sal_Int32 i = 0; i < rGroupName.getLength(); i++ )
     {
@@ -40,10 +40,11 @@ static OUString lcl_CheckGroupName( const OUString& rGroupName )
         if (rtl::isAsciiAlphanumeric(cChar) ||
             cChar == '_' || cChar == 0x20)
         {
-            sRet += OUStringLiteral1(cChar);
+            sRet.append(cChar);
         }
     }
-    return comphelper::string::strip(sRet, ' ');
+    sRet.strip(' ');
+    return sRet.makeStringAndClear();
 }
 
 SwVbaTemplate::SwVbaTemplate( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const OUString& rFullUrl )
diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx
index 260ad592eaa8..71c44a770290 100644
--- a/sw/source/uibase/app/docstyle.cxx
+++ b/sw/source/uibase/app/docstyle.cxx
@@ -828,7 +828,7 @@ OUString  SwDocStyleSheet::GetDescription(MapUnit eUnit)
             GetItemSet();
 
         SfxItemIter aIter( *pSet );
-        OUString aDesc;
+        OUStringBuffer aDesc;
 
         for (const SfxPoolItem* pItem = aIter.FirstItem(); pItem; pItem = aIter.NextItem())
         {
@@ -850,14 +850,14 @@ OUString  SwDocStyleSheet::GetDescription(MapUnit eUnit)
                                 *pItem, eUnit, aItemPresentation, aIntlWrapper ) )
                         {
                             if ( !aDesc.isEmpty() && !aItemPresentation.isEmpty() )
-                                aDesc += sPlus;
-                            aDesc += aItemPresentation;
+                                aDesc.append(sPlus);
+                            aDesc.append(aItemPresentation);
                         }
                     }
                 }
             }
         }
-        return aDesc;
+        return aDesc.makeStringAndClear();
     }
 
     if ( SfxStyleFamily::Frame == nFamily || SfxStyleFamily::Para == nFamily || SfxStyleFamily::Char == nFamily )
@@ -866,7 +866,7 @@ OUString  SwDocStyleSheet::GetDescription(MapUnit eUnit)
             GetItemSet();
 
         SfxItemIter aIter( *pSet );
-        OUString aDesc;
+        OUStringBuffer aDesc;
         OUString sPageNum;
         OUString sModel;
         OUString sBreak;
@@ -989,8 +989,8 @@ OUString  SwDocStyleSheet::GetDescription(MapUnit eUnit)
                             if(bIsDefault)
                             {
                                 if ( !aDesc.isEmpty() && !aItemPresentation.isEmpty() )
-                                    aDesc += sPlus;
-                                aDesc += aItemPresentation;
+                                    aDesc.append(sPlus);
+                                aDesc.append(aItemPresentation);
                             }
                         }
                     }
@@ -1001,20 +1001,20 @@ OUString  SwDocStyleSheet::GetDescription(MapUnit eUnit)
         if (!sModel.isEmpty())
         {
             if (!aDesc.isEmpty())
-                aDesc += sPlus;
-            aDesc += SwResId(STR_PAGEBREAK) + sPlus + sModel;
+                aDesc.append(sPlus);
+            aDesc.append(SwResId(STR_PAGEBREAK)).append(sPlus).append(sModel);
             if (sPageNum != "0")
             {
-                aDesc += sPlus + SwResId(STR_PAGEOFFSET) + sPageNum;
+                aDesc.append(sPlus).append(SwResId(STR_PAGEOFFSET)).append(sPageNum);
             }
         }
         else if (!sBreak.isEmpty()) // Break can be valid only when NO Model
         {
             if (!aDesc.isEmpty())
-                aDesc += sPlus;
-            aDesc += sBreak;
+                aDesc.append(sPlus);
+            aDesc.append(sBreak);
         }
-        return aDesc;
+        return aDesc.makeStringAndClear();
     }
 
     if( SfxStyleFamily::Pseudo == nFamily )
diff --git a/sw/source/uibase/config/modcfg.cxx b/sw/source/uibase/config/modcfg.cxx
index 3a0b41f3a1b9..5f9e44d15475 100644
--- a/sw/source/uibase/config/modcfg.cxx
+++ b/sw/source/uibase/config/modcfg.cxx
@@ -135,7 +135,7 @@ SwModuleOptions::SwModuleOptions() :
 
 OUString SwModuleOptions::ConvertWordDelimiter(const OUString& rDelim, bool bFromUI)
 {
-    OUString sReturn;
+    OUStringBuffer sReturn;
     const sal_Int32 nDelimLen = rDelim.getLength();
     if(bFromUI)
     {
@@ -147,9 +147,9 @@ OUString SwModuleOptions::ConvertWordDelimiter(const OUString& rDelim, bool bFro
             {
                 switch (rDelim[i++])
                 {
-                    case 'n':   sReturn += "\n";    break;
-                    case 't':   sReturn += "\t";    break;
-                    case '\\':  sReturn += "\\";    break;
+                    case 'n':   sReturn.append("\n");    break;
+                    case 't':   sReturn.append("\t");    break;
+                    case '\\':  sReturn.append("\\");    break;
 
                     case 'x':
                     {
@@ -175,18 +175,18 @@ OUString SwModuleOptions::ConvertWordDelimiter(const OUString& rDelim, bool bFro
                             nChar += nVal;
                         }
                         if( bValidData )
-                            sReturn += OUStringLiteral1(nChar);
+                            sReturn.append(nChar);
                         break;
                     }
 
                     default:    // Unknown, so insert backslash
-                        sReturn += "\\";
+                        sReturn.append("\\");
                         i--;
                         break;
                 }
             }
             else
-                sReturn += OUStringLiteral1(c);
+                sReturn.append(c);
         }
     }
     else
@@ -197,23 +197,23 @@ OUString SwModuleOptions::ConvertWordDelimiter(const OUString& rDelim, bool bFro
 
             switch (c)
             {
-                case '\n':  sReturn += "\\n"; break;
-                case '\t':  sReturn += "\\t"; break;
-                case '\\':  sReturn += "\\\\"; break;
+                case '\n':  sReturn.append("\\n"); break;
+                case '\t':  sReturn.append("\\t"); break;
+                case '\\':  sReturn.append("\\\\"); break;
 
                 default:
                     if( c <= 0x1f || c >= 0x7f )
                     {
-                        sReturn += "\\x" + OUString::number( c, 16 );
+                        sReturn.append("\\x").append(OUString::number( c, 16 ));
                     }
                     else
                     {
-                        sReturn += OUStringLiteral1(c);
+                        sReturn.append(c);
                     }
             }
         }
     }
-    return sReturn;
+    return sReturn.makeStringAndClear();
 }
 
 const Sequence<OUString>& SwRevisionConfig::GetPropertyNames()
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 3ce9d2c14156..14ad312e916d 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -609,7 +609,7 @@ void SwDBManager::ImportFromConnection(  SwWrtShell* pSh )
 
 static OUString  lcl_FindColumn(const OUString& sFormatStr,sal_uInt16  &nUsedPos, sal_uInt8 &nSeparator)
 {
-    OUString sReturn;
+    OUStringBuffer sReturn;
     sal_uInt16 nLen = sFormatStr.getLength();
     nSeparator = 0xff;
     while(nUsedPos < nLen && nSeparator == 0xff)
@@ -630,12 +630,12 @@ static OUString  lcl_FindColumn(const OUString& sFormatStr,sal_uInt16  &nUsedPos
                 nSeparator = DB_SEP_NEWLINE;
             break;
             default:
-                sReturn += OUStringLiteral1(cCurrent);
+                sReturn.append(cCurrent);
         }
         nUsedPos++;
 
     }
-    return sReturn;
+    return sReturn.makeStringAndClear();
 }
 
 void SwDBManager::ImportDBEntry(SwWrtShell* pSh)
@@ -687,7 +687,7 @@ void SwDBManager::ImportDBEntry(SwWrtShell* pSh)
         }
         else
         {
-            OUString sStr;
+            OUStringBuffer sStr;
             uno::Sequence<OUString> aColNames = xCols->getElementNames();
             const OUString* pColNames = aColNames.getConstArray();
             long nLength = aColNames.getLength();
@@ -697,11 +697,11 @@ void SwDBManager::ImportDBEntry(SwWrtShell* pSh)
                 uno::Reference< beans::XPropertySet > xColumnProp;
                 aCol >>= xColumnProp;
                 SwDBFormatData aDBFormat;
-                sStr += GetDBField( xColumnProp, aDBFormat);
+                sStr.append(GetDBField( xColumnProp, aDBFormat));
                 if (i < nLength - 1)
-                    sStr += "\t";
+                    sStr.append("\t");
             }
-            pSh->SwEditShell::Insert2(sStr);
+            pSh->SwEditShell::Insert2(sStr.makeStringAndClear());
             pSh->SwFEShell::SplitNode();    // line feed
         }
     }
@@ -1063,7 +1063,7 @@ static SwMailMessage* lcl_CreateMailFromDoc(
     pMessage->addRecipient( sMailRecipient );
     pMessage->SetSenderAddress( rMergeDescriptor.pMailMergeConfigItem->GetMailAddress() );
 
-    OUString sBody;
+    OUStringBuffer sBody;
     if( rMergeDescriptor.bSendAsAttachment )
     {
         sBody = rMergeDescriptor.sMailBody;
@@ -1086,13 +1086,13 @@ static SwMailMessage* lcl_CreateMailFromDoc(
         OString sLine;
         while ( pInStream->ReadLine( sLine ) )
         {
-            sBody += OStringToOUString( sLine, sMailEncoding );
-            sBody += "\n";
+            sBody.append(OStringToOUString( sLine, sMailEncoding ));
+            sBody.append("\n");
         }
     }
     pMessage->setSubject( rMergeDescriptor.sSubject );
     uno::Reference< datatransfer::XTransferable> xBody =
-                new SwMailTransferable( sBody, sMailBodyMimeType );
+                new SwMailTransferable( sBody.makeStringAndClear(), sMailBodyMimeType );
     pMessage->setBody( xBody );
 
     for( const OUString& sCcRecipient : rMergeDescriptor.aCopiesTo )
diff --git a/sw/source/uibase/dbui/mailmergehelper.cxx b/sw/source/uibase/dbui/mailmergehelper.cxx
index 7345797b1d67..e742e88b8583 100644
--- a/sw/source/uibase/dbui/mailmergehelper.cxx
+++ b/sw/source/uibase/dbui/mailmergehelper.cxx
@@ -464,7 +464,6 @@ OUString SwAddressPreview::FillData(
                                                 rConfigItem.GetCurrentDBData() );
     const OUString* pAssignment = aAssignment.getConstArray();
     const std::vector<std::pair<OUString, int>>& rDefHeaders = rConfigItem.GetDefaultAddressHeaders();
-    OUString sAddress(rAddress);
     OUString sNotAssigned = "<" + SwResId(STR_NOTASSIGNED) + ">";
 
     bool bIncludeCountry = rConfigItem.IsIncludeCountry();
@@ -480,8 +479,8 @@ OUString SwAddressPreview::FillData(
             sCountryColumn = aSpecialAssignment[MM_PART_COUNTRY];
     }
 
-    SwAddressIterator aIter(sAddress);
-    sAddress.clear();
+    SwAddressIterator aIter(rAddress);
+    OUStringBuffer sAddress;
     while(aIter.HasMore())
     {
         SwMergeAddressItem aItem = aIter.Next();
@@ -540,9 +539,9 @@ OUString SwAddressPreview::FillData(
             }
 
         }
-        sAddress += aItem.sText;
+        sAddress.append(aItem.sText);
     }
-    return sAddress;
+    return sAddress.makeStringAndClear();
 }
 
 SwMergeAddressItem   SwAddressIterator::Next()
diff --git a/sw/source/uibase/dbui/mmconfigitem.cxx b/sw/source/uibase/dbui/mmconfigitem.cxx
index e1a66d04a86e..7c46b9aa45ea 100644
--- a/sw/source/uibase/dbui/mmconfigitem.cxx
+++ b/sw/source/uibase/dbui/mmconfigitem.cxx
@@ -363,8 +363,7 @@ static OUString lcl_CreateNodeName(Sequence<OUString>& rAssignments )
     do
     {
         bFound = false;
-        sNewName = "_";
-        sNewName += OUString::number(nStart);
+        sNewName = "_" + OUString::number(nStart);
         //search if the name exists
         for(sal_Int32 nAssign = 0; nAssign < rAssignments.getLength(); ++nAssign)
         {
@@ -400,9 +399,8 @@ static void lcl_ConvertFromNumbers(OUString& rBlock, const std::vector<std::pair
 {
     //convert the numbers used for the configuration to strings used for UI to numbers
     //doesn't use ReplaceAll to prevent expansion of numbers inside of the headers
-    OUString sBlock(rBlock.replaceAll("\\n", "\n"));
-    SwAddressIterator aGreetingIter(sBlock);
-    sBlock.clear();
+    SwAddressIterator aGreetingIter(rBlock.replaceAll("\\n", "\n"));
+    OUStringBuffer sBlock;
     while(aGreetingIter.HasMore())
     {
         SwMergeAddressItem aNext = aGreetingIter.Next();
@@ -412,11 +410,11 @@ static void lcl_ConvertFromNumbers(OUString& rBlock, const std::vector<std::pair
             sal_Unicode cChar = aNext.sText[0];
             if(cChar >= '0' && cChar <= 'c')
             {
-                sBlock += "<";
+                sBlock.append("<");
                 sal_uInt16 nHeader = cChar - '0';
                 if(nHeader < rHeaders.size())
-                    sBlock += rHeaders[nHeader].first;
-                sBlock += ">";
+                    sBlock.append(rHeaders[nHeader].first);
+                sBlock.append(">");
             }
             else
             {
@@ -424,9 +422,9 @@ static void lcl_ConvertFromNumbers(OUString& rBlock, const std::vector<std::pair
             }
         }
         else
-            sBlock += aNext.sText;
+            sBlock.append(aNext.sText);
     }
-    rBlock = sBlock;
+    rBlock = sBlock.makeStringAndClear();
 }
 
 const Sequence<OUString>& SwMailMergeConfigItem_Impl::GetPropertyNames()
diff --git a/sw/source/uibase/envelp/envimg.cxx b/sw/source/uibase/envelp/envimg.cxx
index f3b50063ec75..14bf687ef258 100644
--- a/sw/source/uibase/envelp/envimg.cxx
+++ b/sw/source/uibase/envelp/envimg.cxx
@@ -53,7 +53,7 @@ OUString MakeSender()
     if (sSenderToken.isEmpty())
         return OUString();
 
-    OUString sRet;
+    OUStringBuffer sRet;
     sal_Int32 nSttPos = 0;
     bool bLastLength = true;
     do {
@@ -61,33 +61,33 @@ OUString MakeSender()
         if (sToken == "COMPANY")
         {
             sal_Int32 nOldLen = sRet.getLength();
-            sRet += rUserOpt.GetCompany();
+            sRet.append(rUserOpt.GetCompany());
             bLastLength = sRet.getLength() != nOldLen;
         }
         else if (sToken == "CR")
         {
             if(bLastLength)
-                sRet += NEXTLINE;
+                sRet.append(NEXTLINE);
             bLastLength = true;
         }
         else if (sToken == "FIRSTNAME")
-            sRet += rUserOpt.GetFirstName();
+            sRet.append(rUserOpt.GetFirstName());
         else if (sToken == "LASTNAME")
-            sRet += rUserOpt.GetLastName();
+            sRet.append(rUserOpt.GetLastName());
         else if (sToken == "ADDRESS")
-            sRet += rUserOpt.GetStreet();
+            sRet.append(rUserOpt.GetStreet());
         else if (sToken == "COUNTRY")
-            sRet += rUserOpt.GetCountry();
+            sRet.append(rUserOpt.GetCountry());
         else if (sToken == "POSTALCODE")
-            sRet += rUserOpt.GetZip();
+            sRet.append(rUserOpt.GetZip());
         else if (sToken == "CITY")
-            sRet += rUserOpt.GetCity();
+            sRet.append(rUserOpt.GetCity());
         else if (sToken == "STATEPROV")
-            sRet += rUserOpt.GetState();
+            sRet.append(rUserOpt.GetState());
         else if (!sToken.isEmpty()) //spaces
-            sRet += sToken;
+            sRet.append(sToken);
     } while (nSttPos>=0);
-    return sRet;
+    return sRet.makeStringAndClear();
 }
 
 SwEnvItem::SwEnvItem() :
diff --git a/sw/source/uibase/envelp/labelcfg.cxx b/sw/source/uibase/envelp/labelcfg.cxx
index 6c6ec6127efc..838789b4b6af 100644
--- a/sw/source/uibase/envelp/labelcfg.cxx
+++ b/sw/source/uibase/envelp/labelcfg.cxx
@@ -307,8 +307,7 @@ void SwLabelConfig::SaveLabel( const OUString& rManufacturer,
         sFoundNode += OUString::number( nIndex );
         while ( lcl_Exists( sFoundNode, aLabels ) )
         {
-            sFoundNode = sPrefix;
-            sFoundNode += OUString::number(nIndex++);
+            sFoundNode = sPrefix + OUString::number(nIndex++);
         }
     }
     else
diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx
index 0c8004d58d0c..021d23f62971 100644
--- a/sw/source/uibase/shells/annotsh.cxx
+++ b/sw/source/uibase/shells/annotsh.cxx
@@ -1631,11 +1631,11 @@ void SwAnnotationShell::StateUndo(SfxItemSet &rSet)
                         fnGetComment = &SfxUndoManager::GetRedoActionComment;
                     }
 
-                    OUString sList;
+                    OUStringBuffer sList;
                     if( nCount )
                     {
                         for( sal_uInt16 n = 0; n < nCount; ++n )
-                            sList += (pUndoManager->*fnGetComment)( n, SfxUndoManager::TopLevel ) + "\n";
+                            sList.append( (pUndoManager->*fnGetComment)( n, SfxUndoManager::TopLevel ) ).append("\n");
                     }
 
                     SfxStringListItem aItem( nWhich );
@@ -1650,8 +1650,8 @@ void SwAnnotationShell::StateUndo(SfxItemSet &rSet)
                         rSh.GetDoStrings( SwWrtShell::UNDO, aItem );
                     }
 
-                    sList += aItem.GetString();
-                    aItem.SetString( sList );
+                    sList.append(aItem.GetString());
+                    aItem.SetString( sList.makeStringAndClear() );
                     rSet.Put( aItem );
                 }
                 else
diff --git a/sw/source/uibase/shells/drwtxtsh.cxx b/sw/source/uibase/shells/drwtxtsh.cxx
index 017c293cb673..71334558fe68 100644
--- a/sw/source/uibase/shells/drwtxtsh.cxx
+++ b/sw/source/uibase/shells/drwtxtsh.cxx
@@ -565,12 +565,12 @@ void SwDrawTextShell::StateUndo(SfxItemSet &rSet)
                     }
                     if( nCount )
                     {
-                        OUString sList;
+                        OUStringBuffer sList;
                         for( sal_uInt16 n = 0; n < nCount; ++n )
-                            sList += (pUndoManager->*fnGetComment)( n, SfxUndoManager::TopLevel ) + "\n";
+                            sList.append( (pUndoManager->*fnGetComment)( n, SfxUndoManager::TopLevel ) ).append("\n");
 
                         SfxStringListItem aItem( nWhich );
-                        aItem.SetString( sList );
+                        aItem.SetString( sList.makeStringAndClear() );
                         rSet.Put( aItem );
                     }
                 }
diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx
index b9c0cdf624fd..c9544baccb5a 100644
--- a/sw/source/uibase/shells/frmsh.cxx
+++ b/sw/source/uibase/shells/frmsh.cxx
@@ -212,9 +212,7 @@ void SwFrameShell::Execute(SfxRequest &rReq)
                     sal_uInt16 i = 1;
                     while (rSh.FindFlyByName(sName))
                     {
-                        sName = sOldName;
-                        sName += "_";
-                        sName += OUString::number(i++);
+                        sName = sOldName + "_" + OUString::number(i++);
                     }
                     rSh.SetFlyName(sName);
                 }
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index e2a33df53430..328f3c209502 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -1071,7 +1071,7 @@ static sal_uInt32 lcl_Any_To_ULONG(const Any& rValue, bool& bException)
 static OUString lcl_CreateOutlineString( size_t nIndex,
             const SwOutlineNodes& rOutlineNodes, const SwNumRule* pOutlRule)
 {
-    OUString sEntry;
+    OUStringBuffer sEntry;
     const SwTextNode * pTextNd = rOutlineNodes[ nIndex ]->GetTextNode();
     SwNumberTree::tNumberVector aNumVector = pTextNd->GetNumberVector();
     if( pOutlRule && pTextNd->GetNumRule())
@@ -1082,12 +1082,12 @@ static OUString lcl_CreateOutlineString( size_t nIndex,
             long nVal = aNumVector[nLevel];
             nVal ++;
             nVal -= pOutlRule->Get(nLevel).GetStart();
-            sEntry += OUString::number( nVal );
-            sEntry += ".";
+            sEntry.append(OUString::number( nVal ));
+            sEntry.append(".");
         }
-    sEntry += rOutlineNodes[ nIndex ]->
-                    GetTextNode()->GetExpandText();
-    return sEntry;
+    sEntry.append( rOutlineNodes[ nIndex ]->
+                    GetTextNode()->GetExpandText() );
+    return sEntry.makeStringAndClear();
 }
 
 void SwXTextDocument::setPagePrintSettings(const Sequence< beans::PropertyValue >& aSettings)
diff --git a/sw/source/uibase/wrtsh/wrtundo.cxx b/sw/source/uibase/wrtsh/wrtundo.cxx
index 27c7f0e34ed6..2cc9e54ba232 100644
--- a/sw/source/uibase/wrtsh/wrtundo.cxx
+++ b/sw/source/uibase/wrtsh/wrtundo.cxx
@@ -125,13 +125,13 @@ void SwWrtShell::GetDoStrings( DoType eDoType, SfxStringListItem& rStrs ) const
     default:;//prevent warning
     }
 
-    OUString buf;
+    OUStringBuffer buf;
     for (const OUString & comment : comments)
     {
         OSL_ENSURE(!comment.isEmpty(), "no Undo/Redo Text set");
-        buf += comment + "\n";
+        buf.append(comment).append("\n");
     }
-    rStrs.SetString(buf);
+    rStrs.SetString(buf.makeStringAndClear());
 }
 
 OUString SwWrtShell::GetRepeatString() const
commit c9dcd0a6197160fdc8bf086ae4d8a78558e7d078
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Jul 30 14:20:43 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Jul 30 18:53:57 2018 +0200

    loplugin:returnconstant in sfx2
    
    Change-Id: I9a41a2b53669bebfca573fef8d0d755e4621ce37
    Reviewed-on: https://gerrit.libreoffice.org/58333
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/sfx2/docfile.hxx b/include/sfx2/docfile.hxx
index 6e9f38241f2a..d136aa85e6e0 100644
--- a/include/sfx2/docfile.hxx
+++ b/include/sfx2/docfile.hxx
@@ -151,7 +151,7 @@ public:
     void                SetError(ErrCode nError);
 
     void                CloseInStream();
-    bool                CloseOutStream();
+    void                CloseOutStream();
 
     void                CloseStorage();
 
diff --git a/include/sfx2/frame.hxx b/include/sfx2/frame.hxx
index 151f728adc11..9a3a96a91520 100644
--- a/include/sfx2/frame.hxx
+++ b/include/sfx2/frame.hxx
@@ -97,7 +97,7 @@ private:
     VclPtr<vcl::Window> pWindow;
 
 protected:
-    bool                Close();
+    void                Close();
     virtual             ~SfxFrame();
 
     SAL_DLLPRIVATE      SfxFrame( vcl::Window& i_rContainerWindow );
@@ -134,7 +134,7 @@ public:
 
     bool                IsInPlace() const;
 
-    SAL_DLLPRIVATE bool DoClose_Impl();
+    SAL_DLLPRIVATE void DoClose_Impl();
     SAL_DLLPRIVATE void SetFrameInterface_Impl( const css::uno::Reference< css::frame::XFrame >& rFrame );
     SAL_DLLPRIVATE void ReleasingComponent_Impl();
     SAL_DLLPRIVATE void GetViewData_Impl();
diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx
index a6bff464d369..382e4c692e87 100644
--- a/include/sfx2/objsh.hxx
+++ b/include/sfx2/objsh.hxx
@@ -339,7 +339,7 @@ public:
     // called for a few slots like SID_SAVE[AS]DOC, SID_PRINTDOC[DIRECT], derived classes may abort the action
     virtual bool                QuerySlotExecutable( sal_uInt16 nSlotId );
 
-    bool                        SaveChildren(bool bObjectsOnly=false);
+    void                        SaveChildren(bool bObjectsOnly=false);
     bool                        SaveAsChildren( SfxMedium &rMedium );
     bool                        SwitchChildrenPersistance(
                                     const css::uno::Reference< css::embed::XStorage >& xStorage,
diff --git a/include/sfx2/sfxbasemodel.hxx b/include/sfx2/sfxbasemodel.hxx
index 33c8b4b1e3c2..8c513d515f3f 100644
--- a/include/sfx2/sfxbasemodel.hxx
+++ b/include/sfx2/sfxbasemodel.hxx
@@ -709,7 +709,7 @@ protected:
 private:
     /// @throws css::uno::RuntimeException
     css::uno::Reference< css::ui::XUIConfigurationManager2 > getUIConfigurationManager2();
-    bool impl_getPrintHelper();
+    void impl_getPrintHelper();
     SAL_DLLPRIVATE void ListenForStorage_Impl( const css::uno::Reference< css::embed::XStorage >& xStorage );
     SAL_DLLPRIVATE OUString GetMediumFilterName_Impl();
 
diff --git a/include/sfx2/viewfrm.hxx b/include/sfx2/viewfrm.hxx
index e0a7db3c2c6e..e8deab4891a6 100644
--- a/include/sfx2/viewfrm.hxx
+++ b/include/sfx2/viewfrm.hxx
@@ -130,7 +130,7 @@ public:
     bool                    IsVisible() const;
     void                    ToTop();
     void                    Enable( bool bEnable );
-    bool                    Close();
+    void                    Close();
     virtual void            Activate( bool bUI ) override;
     virtual void            Deactivate( bool bUI ) override;
 
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 4426c889af82..a7ff1009de71 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -638,10 +638,9 @@ SvStream* SfxMedium::GetOutStream()
 }
 
 
-bool SfxMedium::CloseOutStream()
+void SfxMedium::CloseOutStream()
 {
     CloseOutStream_Impl();
-    return true;
 }
 
 void SfxMedium::CloseOutStream_Impl()
diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx
index 4db2cd02e2fe..fe2cea50168b 100644
--- a/sfx2/source/doc/doctemplates.cxx
+++ b/sfx2/source/doc/doctemplates.cxx
@@ -200,7 +200,7 @@ class SfxDocTplService_Impl
     bool                        needsUpdate();
     OUString                    getLongName( const OUString& rShortName );
     bool                    setTitleForURL( const OUString& rURL, const OUString& aTitle );
-    bool                    getTitleFromURL( const OUString& rURL, OUString& aTitle, OUString& aType, bool& bDocHasTitle );
+    void                    getTitleFromURL( const OUString& rURL, OUString& aTitle, OUString& aType, bool& bDocHasTitle );
 
     bool                    addEntry( Content& rParentFolder,
                                           const OUString& rTitle,
@@ -641,7 +641,7 @@ bool SfxDocTplService_Impl::setTitleForURL( const OUString& rURL, const OUString
 }
 
 
-bool SfxDocTplService_Impl::getTitleFromURL( const OUString& rURL, OUString& aTitle, OUString& aType, bool& bDocHasTitle )
+void SfxDocTplService_Impl::getTitleFromURL( const OUString& rURL, OUString& aTitle, OUString& aType, bool& bDocHasTitle )
 {
     bDocHasTitle = false;
 
@@ -682,8 +682,6 @@ bool SfxDocTplService_Impl::getTitleFromURL( const OUString& rURL, OUString& aTi
     }
     else
         bDocHasTitle = true;
-
-    return true;
 }
 
 
@@ -1908,8 +1906,7 @@ bool SfxDocTplService_Impl::addTemplate( const OUString& rGroupName,
     OUString aTitle, aType;
 
     bool bDocHasTitle = false;
-    if( !getTitleFromURL( rSourceURL, aTitle, aType, bDocHasTitle ) )
-        return false;
+    getTitleFromURL( rSourceURL, aTitle, aType, bDocHasTitle );
 
     INetURLObject   aSourceObj( rSourceURL );

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list