[Libreoffice-commits] core.git: sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Oct 24 06:36:56 UTC 2018


 sw/source/core/attr/swatrset.cxx                |    2 +-
 sw/source/core/crsr/pam.cxx                     |    2 +-
 sw/source/core/crsr/swcrsr.cxx                  |    4 ++--
 sw/source/core/crsr/viscrs.cxx                  |    4 ++--
 sw/source/core/doc/doclay.cxx                   |    2 +-
 sw/source/core/doc/doctxm.cxx                   |   10 +++++-----
 sw/source/core/doc/fmtcol.cxx                   |    4 ++--
 sw/source/core/edit/edfcol.cxx                  |    2 +-
 sw/source/core/fields/authfld.cxx               |    2 +-
 sw/source/core/layout/paintfrm.cxx              |    4 ++--
 sw/source/core/text/EnhancedPDFExportHelper.cxx |    2 +-
 sw/source/core/text/txtfly.cxx                  |   12 ++++++------
 sw/source/core/text/txthyph.cxx                 |    2 +-
 sw/source/core/txtnode/ndtxt.cxx                |    8 ++++----
 sw/source/core/unocore/unofield.cxx             |    2 +-
 sw/source/core/unocore/unoframe.cxx             |    8 ++++----
 sw/source/core/unocore/unosect.cxx              |    2 +-
 sw/source/core/unocore/unotbl.cxx               |    3 +--
 sw/source/core/view/viewsh.cxx                  |    2 +-
 sw/source/filter/html/css1atr.cxx               |    2 +-
 sw/source/filter/html/htmldrawwriter.cxx        |    2 +-
 sw/source/filter/html/htmlplug.cxx              |    4 ++--
 sw/source/filter/ww8/docxattributeoutput.cxx    |    2 +-
 sw/source/filter/ww8/wrtw8esh.cxx               |    4 ++--
 sw/source/filter/ww8/wrtw8num.cxx               |    2 +-
 sw/source/filter/ww8/wrtww8.cxx                 |    2 +-
 sw/source/filter/ww8/ww8atr.cxx                 |    8 ++++----
 sw/source/filter/ww8/ww8par.cxx                 |    4 ++--
 sw/source/filter/xml/xmltble.cxx                |    6 +++---
 sw/source/ui/chrdlg/chardlg.cxx                 |    2 +-
 sw/source/ui/dbui/mmresultdialogs.cxx           |    8 ++++----
 sw/source/ui/index/cnttab.cxx                   |    4 ++--
 sw/source/ui/misc/bookmark.cxx                  |    6 +++---
 sw/source/ui/misc/glossary.cxx                  |    2 +-
 sw/source/ui/misc/num.cxx                       |    2 +-
 sw/source/ui/vba/vbaaddins.cxx                  |    2 +-
 sw/source/uibase/app/apphdl.cxx                 |    2 +-
 sw/source/uibase/app/docsh.cxx                  |    2 +-
 sw/source/uibase/app/docsh2.cxx                 |    2 +-
 sw/source/uibase/app/docshdrw.cxx               |    2 +-
 sw/source/uibase/dbui/dbmgr.cxx                 |    4 ++--
 sw/source/uibase/dialog/watermarkdialog.cxx     |    2 +-
 sw/source/uibase/docvw/AnchorOverlayObject.cxx  |    2 +-
 sw/source/uibase/docvw/OverlayRanges.cxx        |    2 +-
 sw/source/uibase/docvw/ShadowOverlayObject.cxx  |    2 +-
 sw/source/uibase/docvw/SidebarTxtControl.cxx    |    4 ++--
 sw/source/uibase/docvw/edtwin.cxx               |    8 ++++----
 sw/source/uibase/misc/glosdoc.cxx               |    2 +-
 sw/source/uibase/shells/annotsh.cxx             |    4 ++--
 sw/source/uibase/shells/basesh.cxx              |    2 +-
 sw/source/uibase/shells/drformsh.cxx            |    4 ++--
 sw/source/uibase/shells/drwtxtex.cxx            |    2 +-
 sw/source/uibase/shells/drwtxtsh.cxx            |    2 +-
 sw/source/uibase/shells/frmsh.cxx               |    2 +-
 sw/source/uibase/shells/tabsh.cxx               |    2 +-
 sw/source/uibase/shells/textsh.cxx              |    2 +-
 sw/source/uibase/shells/textsh1.cxx             |    2 +-
 sw/source/uibase/uiview/view2.cxx               |    2 +-
 sw/source/uibase/uiview/viewdraw.cxx            |    2 +-
 sw/source/uibase/uiview/viewprt.cxx             |    2 +-
 sw/source/uibase/uiview/viewsrch.cxx            |    2 +-
 sw/source/uibase/uiview/viewtab.cxx             |    4 ++--
 sw/source/uibase/utlui/content.cxx              |    2 +-
 sw/source/uibase/utlui/gloslst.cxx              |    2 +-
 sw/source/uibase/wrtsh/wrtsh1.cxx               |    2 +-
 sw/source/uibase/wrtsh/wrtsh3.cxx               |    2 +-
 66 files changed, 107 insertions(+), 108 deletions(-)

New commits:
commit 645db9a2643832e29dbdf904e1cf7b323d273f86
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Oct 23 09:47:23 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Oct 24 08:36:27 2018 +0200

    clang-tidy performance-unnecessary-copy-init in sw
    
    Change-Id: I515e3e8ddaee3e3ddc4bf3827fb85f3489e84539
    Reviewed-on: https://gerrit.libreoffice.org/62253
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/source/core/attr/swatrset.cxx b/sw/source/core/attr/swatrset.cxx
index bd0e3c5e92bb..ae0ff382b9e7 100644
--- a/sw/source/core/attr/swatrset.cxx
+++ b/sw/source/core/attr/swatrset.cxx
@@ -334,7 +334,7 @@ void SwAttrSet::CopyToModify( SwModify& rMod ) const
                 {
                     const SwList* pList = pSrcDoc->getIDocumentListsAccess().getListByName( sListId );
                     // copy list style, if needed
-                    const OUString sDefaultListStyleName =
+                    const OUString& sDefaultListStyleName =
                                             pList->GetDefaultListStyleName();
                     // #i92811#
                     const SwNumRule* pDstDocNumRule =
diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index 4bd824f67f8b..eff3dad802f1 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -1000,7 +1000,7 @@ OUString SwPaM::GetText() const
 
         if (pTextNode != nullptr)
         {
-            const OUString aTmpStr = pTextNode->GetText();
+            const OUString& aTmpStr = pTextNode->GetText();
 
             if (bIsStartNode || bIsEndNode)
             {
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index 9b5922c62f8f..8dfb8521eb17 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -1407,12 +1407,12 @@ bool SwCursor::SelectWordWT( SwViewShell const * pViewShell, sal_Int16 nWordType
         sw::mark::IMark* pMark = GetPoint() ? pMarksAccess->getFieldmarkFor( *GetPoint( ) ) : nullptr;
         if ( pMark )
         {
-            const SwPosition rStart = pMark->GetMarkStart();
+            const SwPosition& rStart = pMark->GetMarkStart();
             GetPoint()->nNode = rStart.nNode;
             GetPoint()->nContent = rStart.nContent;
             ++GetPoint()->nContent; // Don't select the start delimiter
 
-            const SwPosition rEnd = pMark->GetMarkEnd();
+            const SwPosition& rEnd = pMark->GetMarkEnd();
 
             if ( rStart != rEnd )
             {
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index 9593f326d149..672184d863a6 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -343,7 +343,7 @@ void SwSelPaintRects::Show(std::vector<OString>* pSelectionRectangles)
         else if(!empty())
         {
             SdrPaintWindow* pCandidate = pView->GetPaintWindow(0);
-            rtl::Reference< sdr::overlay::OverlayManager > xTargetOverlay = pCandidate->GetOverlayManager();
+            const rtl::Reference< sdr::overlay::OverlayManager >& xTargetOverlay = pCandidate->GetOverlayManager();
 
             if (xTargetOverlay.is())
             {
@@ -454,7 +454,7 @@ void SwSelPaintRects::HighlightInputField()
         {
             SdrView* pView = const_cast<SdrView*>(GetShell()->GetDrawView());
             SdrPaintWindow* pCandidate = pView->GetPaintWindow(0);
-            rtl::Reference<sdr::overlay::OverlayManager> xTargetOverlay = pCandidate->GetOverlayManager();
+            const rtl::Reference<sdr::overlay::OverlayManager>& xTargetOverlay = pCandidate->GetOverlayManager();
 
             if (xTargetOverlay.is())
             {
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index 6cf904be43dc..e964255f7add 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -1441,7 +1441,7 @@ void SwDoc::SetAllUniqueFlyNames()
     {
         if( RES_FLYFRMFMT == (pFlyFormat = (*GetSpzFrameFormats())[ --n ])->Which() )
         {
-            const OUString aNm = pFlyFormat->GetName();
+            const OUString& aNm = pFlyFormat->GetName();
             if ( !aNm.isEmpty() )
             {
                 sal_Int32 *pNum = nullptr;
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 9544f5ed90ed..fb4a438bdda4 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -640,7 +640,7 @@ OUString SwDoc::GetUniqueTOXBaseName( const SwTOXType& rType,
         const SwSection& rSect = pSectNd->GetSection();
         if (rSect.GetType()==TOX_CONTENT_SECTION)
         {
-            const OUString rNm = rSect.GetSectionName();
+            const OUString& rNm = rSect.GetSectionName();
             if ( rNm.startsWith(aName) )
             {
                 // Calculate number and set the Flag
@@ -966,8 +966,8 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr,
                 aSortArr[nCnt]->GetType() == TOX_SORT_INDEX)
         {
             const SwTOXMark& rMark = aSortArr[nCnt]->pTextMark->GetTOXMark();
-            const OUString sPrimKey = rMark.GetPrimaryKey();
-            const OUString sSecKey = rMark.GetSecondaryKey();
+            const OUString& sPrimKey = rMark.GetPrimaryKey();
+            const OUString& sSecKey = rMark.GetSecondaryKey();
             const SwTOXMark* pNextMark = nullptr;
             while(aSortArr.size() > (nCnt + nRange)&&
                     aSortArr[nCnt + nRange]->GetType() == TOX_SORT_INDEX &&
@@ -1544,8 +1544,8 @@ void SwTOXBaseSection::UpdatePageNum()
                 aSortArr[nCnt]->GetType() == TOX_SORT_INDEX)
         {
             const SwTOXMark& rMark = aSortArr[nCnt]->pTextMark->GetTOXMark();
-            const OUString sPrimKey = rMark.GetPrimaryKey();
-            const OUString sSecKey = rMark.GetSecondaryKey();
+            const OUString& sPrimKey = rMark.GetPrimaryKey();
+            const OUString& sSecKey = rMark.GetSecondaryKey();
             const SwTOXMark* pNextMark = nullptr;
             while(aSortArr.size() > (nCnt + nRange)&&
                     aSortArr[nCnt + nRange]->GetType() == TOX_SORT_INDEX &&
diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx
index 3cfa19ec5ecb..4810980cf551 100644
--- a/sw/source/core/doc/fmtcol.cxx
+++ b/sw/source/core/doc/fmtcol.cxx
@@ -61,7 +61,7 @@ namespace TextFormatCollFunc
             }
             if (pNewNumRuleItem)
             {
-                OUString sNumRuleName = pNewNumRuleItem->GetValue();
+                const OUString& sNumRuleName = pNewNumRuleItem->GetValue();
                 if ( sNumRuleName.isEmpty() ||
                      sNumRuleName != pTextFormatColl->GetDoc()->GetOutlineNumRule()->GetName() )
                 {
@@ -80,7 +80,7 @@ namespace TextFormatCollFunc
         (void)rTextFormatColl.GetItemState(RES_PARATR_NUMRULE, false, reinterpret_cast<const SfxPoolItem**>(&pNumRuleItem));
         if (pNumRuleItem)
         {
-            const OUString sNumRuleName = pNumRuleItem->GetValue();
+            const OUString& sNumRuleName = pNumRuleItem->GetValue();
             if ( !sNumRuleName.isEmpty() )
             {
                 pNumRule = rTextFormatColl.GetDoc()->FindNumRulePtr( sNumRuleName );
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 962c9f6773f4..ca0b7819fd32 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -1476,7 +1476,7 @@ static void lcl_placeWatermarkInHeader(const SfxWatermarkItem& rWatermark,
     if (!bSuccess || xWatermark.is() || bDeleteWatermark)
         return;
 
-    OUString sFont = rWatermark.GetFont();
+    const OUString& sFont = rWatermark.GetFont();
     sal_Int16 nAngle = rWatermark.GetAngle();
     sal_Int16 nTransparency = rWatermark.GetTransparency();
     Color nColor = rWatermark.GetColor();
diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx
index 9f5983b03fca..20ddd1ed7011 100644
--- a/sw/source/core/fields/authfld.cxx
+++ b/sw/source/core/fields/authfld.cxx
@@ -636,7 +636,7 @@ bool    SwAuthorityField::QueryValue( Any& rAny, sal_uInt16 /*nWhichId*/ ) const
     for(int i = 0; i < AUTH_FIELD_END; ++i)
     {
         pValues[i].Name = OUString::createFromAscii(aFieldNames[i]);
-        const OUString sField = pAuthEntry->GetAuthorField(static_cast<ToxAuthorityField>(i));
+        const OUString& sField = pAuthEntry->GetAuthorField(static_cast<ToxAuthorityField>(i));
         if(i == AUTH_FIELD_AUTHORITY_TYPE)
             pValues[i].Value <<= sal_Int16(sField.toInt32());
         else
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index f16cde1fc091..0306a1d0d382 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -1739,7 +1739,7 @@ bool DrawFillAttributes(
                 // tdf#86578 the awful lcl_SubtractFlys hack
                 if (rPaintRegion.size() > 1 || rPaintRegion[0] != rPaintRegion.GetOrigin())
                 {
-                    basegfx::B2DPolyPolygon const maskRegion(rClipState.getClipPoly());
+                    basegfx::B2DPolyPolygon const& maskRegion(rClipState.getClipPoly());
                     primitives.resize(1);
                     primitives[0] = new drawinglayer::primitive2d::MaskPrimitive2D(
                             maskRegion, rSequence);
@@ -3859,7 +3859,7 @@ void SwFlyFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect const&
         bool bInGenerateThumbnail = pShell->GetDoc()->GetDocShell()->IsInGenerateAndStoreThumbnail();
         if (bInGenerateThumbnail)
         {
-            SwRect aVisRect = pShell->VisArea();
+            const SwRect& aVisRect = pShell->VisArea();
             if (!aVisRect.IsOver(getFrameArea()))
                 return;
         }
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index d171a5fbef80..0416f62bcabb 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -2088,7 +2088,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
                 //get the name
                 const ::sw::mark::IMark* pBkmk = ppMark->get();
                 mrSh.SwCursorShell::ClearMark();
-                OUString sBkName = pBkmk->GetName();
+                const OUString& sBkName = pBkmk->GetName();
 
                 //jump to it
                 JumpToSwMark( &mrSh, sBkName );
diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx
index e42173f7ff9e..535c570e0e90 100644
--- a/sw/source/core/text/txtfly.cxx
+++ b/sw/source/core/text/txtfly.cxx
@@ -79,8 +79,8 @@ namespace
         bool operator()( const SwAnchoredObject* pListedAnchoredObj,
                          const SwAnchoredObject* pNewAnchoredObj )
         {
-            const SwRect aBoundRectOfListedObj( pListedAnchoredObj->GetObjRectWithSpaces() );
-            const SwRect aBoundRectOfNewObj( pNewAnchoredObj->GetObjRectWithSpaces() );
+            const SwRect& aBoundRectOfListedObj( pListedAnchoredObj->GetObjRectWithSpaces() );
+            const SwRect& aBoundRectOfNewObj( pNewAnchoredObj->GetObjRectWithSpaces() );
             if ( ( mbR2L &&
                    ( (aBoundRectOfListedObj.*mfnRect->fnGetRight)() ==
                      (aBoundRectOfNewObj.*mfnRect->fnGetRight)() ) ) ||
@@ -740,7 +740,7 @@ bool SwTextFly::GetTop( const SwAnchoredObject* _pAnchoredObj,
             if( bEvade )
             {
                 // #i68520#
-                SwRect aTmp( _pAnchoredObj->GetObjRectWithSpaces() );
+                const SwRect& aTmp( _pAnchoredObj->GetObjRectWithSpaces() );
                 if ( !aTmp.IsOver( mpCurrAnchoredObj->GetObjRectWithSpaces() ) )
                     bEvade = false;
             }
@@ -981,7 +981,7 @@ SwTwips SwTextFly::CalcMinBottom() const
                                     pAnchoredObj->GetFrameFormat().GetVertOrient();
                 if( text::VertOrientation::BOTTOM != rTmpFormat.GetVertOrient() )
                 {
-                    const SwRect aBound( pAnchoredObj->GetObjRectWithSpaces() );
+                    const SwRect& aBound( pAnchoredObj->GetObjRectWithSpaces() );
                     if( aBound.Top() < nEndOfFrame )
                         nRet = std::max( nRet, aBound.Bottom() );
                 }
@@ -1207,7 +1207,7 @@ void SwTextFly::CalcLeftMargin( SwRect &rFly,
     {
         // #i68520#
         const SwAnchoredObject* pNext = (*mpAnchoredObjList)[ nFlyPos ];
-        const SwRect aTmp( pNext->GetObjRectWithSpaces() );
+        const SwRect& aTmp( pNext->GetObjRectWithSpaces() );
         if( aRectFnSet.GetLeft(aTmp) >= nFlyLeft )
             break;
     }
@@ -1343,7 +1343,7 @@ css::text::WrapTextMode SwTextFly::GetSurroundForTextWrap( const SwAnchoredObjec
         SwRectFnSet aRectFnSet(m_pCurrFrame);
         const long nCurrLeft = aRectFnSet.GetPrtLeft(*m_pCurrFrame);
         const long nCurrRight = aRectFnSet.GetPrtRight(*m_pCurrFrame);
-        const SwRect aRect( pAnchoredObj->GetObjRectWithSpaces() );
+        const SwRect& aRect( pAnchoredObj->GetObjRectWithSpaces() );
         long nFlyLeft = aRectFnSet.GetLeft(aRect);
         long nFlyRight = aRectFnSet.GetRight(aRect);
 
diff --git a/sw/source/core/text/txthyph.cxx b/sw/source/core/text/txthyph.cxx
index de99588dcab3..12badb24e92e 100644
--- a/sw/source/core/text/txthyph.cxx
+++ b/sw/source/core/text/txthyph.cxx
@@ -252,7 +252,7 @@ bool SwTextFormatter::Hyphenate(SwInterHyphInfoTextFrame & rHyphInf)
 
 bool SwTextPortion::CreateHyphen( SwTextFormatInfo &rInf, SwTextGuess const &rGuess )
 {
-    Reference< XHyphenatedWord >  xHyphWord = rGuess.HyphWord();
+    const Reference< XHyphenatedWord >&  xHyphWord = rGuess.HyphWord();
 
     OSL_ENSURE( !pPortion, "SwTextPortion::CreateHyphen(): another portion, another planet..." );
     OSL_ENSURE( xHyphWord.is(), "SwTextPortion::CreateHyphen(): You are lucky! The code is robust here." );
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index cb3bfa5686b7..b0e8086a2206 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -3108,7 +3108,7 @@ bool SwTextNode::HasNumber() const
     const SwNumRule* pRule = GetNum() ? GetNum()->GetNumRule() : nullptr;
     if ( pRule )
     {
-        SwNumFormat aFormat(pRule->Get(lcl_BoundListLevel(GetActualListLevel())));
+        const SwNumFormat& aFormat(pRule->Get(lcl_BoundListLevel(GetActualListLevel())));
 
         // #i40041#
         bResult = aFormat.IsEnumeration() &&
@@ -3125,7 +3125,7 @@ bool SwTextNode::HasBullet() const
     const SwNumRule* pRule = GetNum() ? GetNum()->GetNumRule() : nullptr;
     if ( pRule )
     {
-        SwNumFormat aFormat(pRule->Get(lcl_BoundListLevel(GetActualListLevel())));
+        const SwNumFormat& aFormat(pRule->Get(lcl_BoundListLevel(GetActualListLevel())));
 
         bResult = aFormat.IsItemize();
     }
@@ -3400,7 +3400,7 @@ OUString SwTextNode::GetExpandText(  const sal_Int32 nIdx,
     ExpandMode eMode = ExpandMode::ExpandFields | eAdditionalMode;
 
     ModelToViewHelper aConversionMap(*this, eMode);
-    const OUString aExpandText = aConversionMap.getViewText();
+    const OUString& aExpandText = aConversionMap.getViewText();
     const sal_Int32 nExpandBegin = aConversionMap.ConvertToViewPosition( nIdx );
     sal_Int32 nEnd = nLen == -1 ? GetText().getLength() : nIdx + nLen;
     const sal_Int32 nExpandEnd = aConversionMap.ConvertToViewPosition( nEnd );
@@ -4308,7 +4308,7 @@ OUString SwTextNode::GetListId() const
 {
     const SfxStringItem& rListIdItem =
                 dynamic_cast<const SfxStringItem&>(GetAttr( RES_PARATR_LIST_ID ));
-    const OUString sListId {rListIdItem.GetValue()};
+    const OUString& sListId {rListIdItem.GetValue()};
 
     // As long as no explicit list id attribute is set, use the list id of
     // the list, which has been created for the applied list style.
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index 937ec468c5f3..857b577e621e 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -2107,7 +2107,7 @@ SwXTextField::getPropertySetInfo()
     }
     const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(
                     lcl_GetPropertyMapOfService(m_pImpl->m_nServiceId));
-    uno::Reference<beans::XPropertySetInfo> xInfo = pPropSet->getPropertySetInfo();
+    const uno::Reference<beans::XPropertySetInfo>& xInfo = pPropSet->getPropertySetInfo();
     // extend PropertySetInfo!
     const uno::Sequence<beans::Property> aPropSeq = xInfo->getProperties();
     aRef = new SfxExtItemPropertySetInfo(
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 96b7da931ea1..0c04513751a4 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -1667,7 +1667,7 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any&
                     pDoc->Unchain(*pFormat);
                 else
                 {
-                    SwFormatChain aChain( pFormat->GetChain() );
+                    const SwFormatChain& aChain( pFormat->GetChain() );
                     SwFrameFormat *pPrev = aChain.GetPrev();
                     if(pPrev)
                         pDoc->Unchain(*pPrev);
@@ -2022,7 +2022,7 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName)
                 }
                 else
                 {
-                    SfxItemSet aSet(pNoText->GetSwAttrSet());
+                    const SfxItemSet& aSet(pNoText->GetSwAttrSet());
                     m_pPropSet->getPropertyValue(*pEntry, aSet, aAny);
                 }
             }
@@ -2378,7 +2378,7 @@ uno::Sequence< beans::PropertyState > SwXFrame::getPropertyStates(
                     {
                         SwNodeIndex aIdx(*pIdx, 1);
                         SwNoTextNode* pNoText = aIdx.GetNode().GetNoTextNode();
-                        SfxItemSet aSet(pNoText->GetSwAttrSet());
+                        const SfxItemSet& aSet(pNoText->GetSwAttrSet());
                         aSet.GetItemState(pEntry->nWID);
                         if(SfxItemState::SET == aSet.GetItemState( pEntry->nWID, false ))
                             pStates[i] = beans::PropertyState_DIRECT_VALUE;
@@ -2483,7 +2483,7 @@ void SwXFrame::setPropertyToDefault( const OUString& rPropertyName )
                     pDoc->Unchain(*pFormat);
                 else
                 {
-                    SwFormatChain aChain( pFormat->GetChain() );
+                    const SwFormatChain& aChain( pFormat->GetChain() );
                     SwFrameFormat *pPrev = aChain.GetPrev();
                     if(pPrev)
                         pDoc->Unchain(*pPrev);
diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx
index bbbac6aedbba..3014fb905259 100644
--- a/sw/source/core/unocore/unosect.cxx
+++ b/sw/source/core/unocore/unosect.cxx
@@ -1024,7 +1024,7 @@ SwXTextSection::Impl::GetPropertyValues_Impl(
                 }
                 else if (FILE_LINK_SECTION == pSect->GetType())
                 {
-                    const OUString sRet( pSect->GetLinkFileName() );
+                    const OUString& sRet( pSect->GetLinkFileName() );
                     sal_Int32 nIndex(0);
                     aLink.FileURL =
                         sRet.getToken(0, sfx2::cTokenSeparator, nIndex);
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 95a52d7b0ed1..ee8f530abb4e 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -2996,8 +2996,7 @@ uno::Any SwXTextTable::getPropertyValue(const OUString& rPropertyName)
                 case FN_UNO_TABLE_TEMPLATE_NAME:
                 {
                     SwTable* pTable = SwTable::FindTable(pFormat);
-                    OUString sName = pTable->GetTableStyleName();
-                    aRet <<= sName;
+                    aRet <<= pTable->GetTableStyleName();
                 }
                 break;
 
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 587b3bc6b07c..23ef8f436318 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -1748,7 +1748,7 @@ public:
             // Need to explicitly draw the overlay on m_pRef, since by default
             // they would be only drawn for m_pOriginalValue.
             SdrPaintWindow* pOldPaintWindow = m_pShell->Imp()->GetDrawView()->GetPaintWindow(0);
-            rtl::Reference<sdr::overlay::OverlayManager> xOldManager = pOldPaintWindow->GetOverlayManager();
+            const rtl::Reference<sdr::overlay::OverlayManager>& xOldManager = pOldPaintWindow->GetOverlayManager();
             if (xOldManager.is())
             {
                 if (SdrPaintWindow* pNewPaintWindow = m_pShell->Imp()->GetDrawView()->FindPaintWindow(*m_pRef))
diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx
index ef36f1600e6a..9abf90ee5d0e 100644
--- a/sw/source/filter/html/css1atr.cxx
+++ b/sw/source/filter/html/css1atr.cxx
@@ -643,7 +643,7 @@ sal_uInt16 SwHTMLWriter::GetCSS1Selector( const SwFormat *pFormat, OString& rTok
         if( USER_FMT & nPoolId )
         {
             // user templates
-            const OUString aNm(pPFormat->GetName());
+            const OUString& aNm(pPFormat->GetName());
 
             if (!bChrFormat && aNm == OOO_STRING_SVTOOLS_HTML_blockquote)
             {
diff --git a/sw/source/filter/html/htmldrawwriter.cxx b/sw/source/filter/html/htmldrawwriter.cxx
index 8cd1a1d4c7e5..0ba8f7e00767 100644
--- a/sw/source/filter/html/htmldrawwriter.cxx
+++ b/sw/source/filter/html/htmldrawwriter.cxx
@@ -73,7 +73,7 @@ void SwHTMLWriter::GetEEAttrsFromDrwObj( SfxItemSet& rItemSet,
                                          const SdrObject *pObj )
 {
     // get the edit script::Engine attributes from object
-    SfxItemSet rObjItemSet = pObj->GetMergedItemSet();
+    const SfxItemSet& rObjItemSet = pObj->GetMergedItemSet();
 
     // iterate over Edit script::Engine attributes and convert them
     // into SW-Attrs resp. set default
diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx
index cea1a75cacd0..a7725b8f5b59 100644
--- a/sw/source/filter/html/htmlplug.cxx
+++ b/sw/source/filter/html/htmlplug.cxx
@@ -1063,7 +1063,7 @@ void SwHTMLParser::InsertFloatingFrame()
             uno::Reference < beans::XPropertySet > xSet( xObj->getComponent(), uno::UNO_QUERY );
             if ( xSet.is() )
             {
-                OUString aName = aFrameDesc.GetName();
+                const OUString& aName = aFrameDesc.GetName();
                 ScrollingMode eScroll = aFrameDesc.GetScrollingMode();
                 bool bHasBorder = aFrameDesc.HasFrameBorder();
                 Size aMargin = aFrameDesc.GetMargin();
@@ -1543,7 +1543,7 @@ Writer& OutHTML_FrameFormatOLENodeGrf( Writer& rWrt, const SwFrameFormat& rFrame
         else
         {
             // Otherwise the native data is just a grab-bag: ODummyEmbeddedObject.
-            OUString aStreamName = rOLEObj.GetCurrentPersistName();
+            const OUString& aStreamName = rOLEObj.GetCurrentPersistName();
             uno::Reference<embed::XStorage> xStorage = pDocSh->GetStorage();
             uno::Reference<io::XStream> xInStream;
             try
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index a71ab90cc5b3..b5a75c2e8be4 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -6089,7 +6089,7 @@ static OString impl_LevelNFC( sal_uInt16 nNumberingType , const SfxItemSet *pOut
         case style::NumberingType::NUMBER_LOWER_ZH:
             aType="taiwaneseCountingThousand";
             if (pOutSet) {
-                const SvxLanguageItem rLang = pOutSet->Get( RES_CHRATR_CJK_LANGUAGE);
+                const SvxLanguageItem& rLang = pOutSet->Get( RES_CHRATR_CJK_LANGUAGE);
                 const LanguageType eLang = rLang.GetLanguage();
 
                 if (LANGUAGE_CHINESE_SIMPLIFIED == eLang) {
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index ac7815c13a6a..d64917bb54f9 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -1348,7 +1348,7 @@ void WW8Export::WriteOutliner(const OutlinerParaObject& rParaObj, sal_uInt8 nTyp
         sal_Int32 nCurrentPos = 0;
         const sal_Int32 nEnd = aStr.getLength();
 
-        const SfxItemSet aSet(rEditObj.GetParaAttribs(n));
+        const SfxItemSet& aSet(rEditObj.GetParaAttribs(n));
         bool bIsRTLPara = false;
         const SfxPoolItem *pItem;
         if(SfxItemState::SET == aSet.GetItemState(EE_PARA_WRITINGDIR, true, &pItem))
@@ -1634,7 +1634,7 @@ sal_Int32 SwBasicEscherEx::WriteGrfFlyFrame(const SwFrameFormat& rFormat, sal_uI
     }
     else
     {
-        Graphic         aGraphic(pGrfNd->GetGrf());
+        const Graphic&  aGraphic(pGrfNd->GetGrf());
         GraphicObject   aGraphicObject( aGraphic );
         OString aUniqueId = aGraphicObject.GetUniqueID();
 
diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx
index 62ce13405c52..b0b0cde57768 100644
--- a/sw/source/filter/ww8/wrtw8num.cxx
+++ b/sw/source/filter/ww8/wrtw8num.cxx
@@ -204,7 +204,7 @@ static sal_uInt8 GetLevelNFC(  sal_uInt16 eNumType, const SfxItemSet *pOutSet)
     case SVX_NUM_NUMBER_LOWER_ZH:
         nRet = 35;
         if ( pOutSet ) {
-            const SvxLanguageItem rLang = pOutSet->Get( RES_CHRATR_CJK_LANGUAGE);
+            const SvxLanguageItem& rLang = pOutSet->Get( RES_CHRATR_CJK_LANGUAGE);
             const LanguageType eLang = rLang.GetLanguage();
             if (LANGUAGE_CHINESE_SIMPLIFIED ==eLang) {
                 nRet = 39;
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 29259003ab88..5e22e0bb57a3 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -3248,7 +3248,7 @@ bool SwWW8Writer::InitStd97CodecUpdateMedium( ::msfilter::MSCodec_Std97& rCodec
                 sal_uInt16 aPassword[16];
                 memset( aPassword, 0, sizeof( aPassword ) );
 
-                OUString sPassword(pPasswordItem->GetValue());
+                const OUString& sPassword(pPasswordItem->GetValue());
                 for ( sal_Int32 nChar = 0; nChar < sPassword.getLength(); ++nChar )
                     aPassword[nChar] = sPassword[nChar];
 
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 7a92a825ceaf..317a4efc9bcf 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -2030,7 +2030,7 @@ void AttributeOutputBase::GenerateBookmarksForSequenceField(const SwTextNode& rN
                                 {
                                     // Need to create a separate run for separator character
                                     SwWW8AttrIter aLocalAttrIter( GetExport(), rNode ); // We need a local iterator having the right number of runs
-                                    const OUString aText = rNode.GetText();
+                                    const OUString& aText = rNode.GetText();
                                     const sal_Int32 nCategoryStart = aText.indexOf(pRefField->GetSetRefName());
                                     const sal_Int32 nPosBeforeSeparator = std::max(nCategoryStart, pHt->GetStart());
                                     bool bCategoryFirst = nCategoryStart < pHt->GetStart();
@@ -2210,7 +2210,7 @@ void AttributeOutputBase::StartTOX( const SwSection& rSect )
                 if(SwTOXElement::IndexEntryType & pTOX->GetCreateType())
                 {
                     sStr += "\\f ";
-                    OUString sName = pTOX->GetEntryTypeName();
+                    const OUString& sName = pTOX->GetEntryTypeName();
                     if(!sName.isEmpty())
                     {
                        sStr += sName;
@@ -2248,7 +2248,7 @@ void AttributeOutputBase::StartTOX( const SwSection& rSect )
                     sStr = FieldString(eCode);
 
                     sStr += "\\c ";
-                    OUString seqName = pTOX->GetSequenceName();
+                    const OUString& seqName = pTOX->GetSequenceName();
                     if(!seqName.isEmpty())
                     {
                         sStr += "\"";
@@ -2311,7 +2311,7 @@ void AttributeOutputBase::StartTOX( const SwSection& rSect )
                     if(SwTOXElement::Bookmark & pTOX->GetCreateType())
                     {
                         sStr += "\\b \"";
-                        OUString bName = pTOX->GetBookmarkName();
+                        const OUString& bName = pTOX->GetBookmarkName();
                         sStr += bName;
                         sStr += sEntryEnd;
                     }
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 70f3cdf41f6c..b7fa6ed3f00a 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -4748,7 +4748,7 @@ void SwWW8ImplReader::ReadDocInfo()
                 SfxMedium* pMedium = m_pDocShell->GetMedium();
                 if ( pMedium )
                 {
-                    OUString aName = pMedium->GetName();
+                    const OUString& aName = pMedium->GetName();
                     INetURLObject aURL( aName );
                     sTemplateURL = aURL.GetMainURL(INetURLObject::DecodeMechanism::ToIUri);
                     if ( !sTemplateURL.isEmpty() )
@@ -4858,7 +4858,7 @@ void SwWW8ImplReader::ReadGlobalTemplateSettings( const OUString& sCreatedFrom,
         return;
 
     SvtPathOptions aPathOpt;
-    OUString aAddinPath = aPathOpt.GetAddinPath();
+    const OUString& aAddinPath = aPathOpt.GetAddinPath();
     uno::Sequence< OUString > sGlobalTemplates;
 
     // first get the autoload addins in the directory STARTUP
diff --git a/sw/source/filter/xml/xmltble.cxx b/sw/source/filter/xml/xmltble.cxx
index 5930a1cd543f..90501aab95b7 100644
--- a/sw/source/filter/xml/xmltble.cxx
+++ b/sw/source/filter/xml/xmltble.cxx
@@ -763,7 +763,7 @@ void SwXMLExport::ExportTableBox( const SwTableBox& rBox,
         const SwFrameFormat *pFrameFormat = rBox.GetFrameFormat();
         if( pFrameFormat )
         {
-            const OUString sName = pFrameFormat->GetName();
+            const OUString& sName = pFrameFormat->GetName();
             if( !sName.isEmpty() )
             {
                 AddAttribute( XML_NAMESPACE_TABLE, XML_STYLE_NAME, EncodeStyleName(sName) );
@@ -896,7 +896,7 @@ void SwXMLExport::ExportTableLine( const SwTableLine& rLine,
     const SwFrameFormat *pFrameFormat = rLine.GetFrameFormat();
     if( pFrameFormat )
     {
-        const OUString sName = pFrameFormat->GetName();
+        const OUString& sName = pFrameFormat->GetName();
         if( !sName.isEmpty() )
         {
             AddAttribute( XML_NAMESPACE_TABLE, XML_STYLE_NAME, EncodeStyleName(sName) );
@@ -1111,7 +1111,7 @@ void SwXMLExport::ExportTable( const SwTableNode& rTableNd )
                           pDDEFieldType->GetName() );
 
             // DDE command
-            const OUString sCmd = pDDEFieldType->GetCmd();
+            const OUString& sCmd = pDDEFieldType->GetCmd();
             AddAttribute( XML_NAMESPACE_OFFICE, XML_DDE_APPLICATION,
                           sCmd.getToken(0, sfx2::cTokenSeparator) );
             AddAttribute( XML_NAMESPACE_OFFICE, XML_DDE_ITEM,
diff --git a/sw/source/ui/chrdlg/chardlg.cxx b/sw/source/ui/chrdlg/chardlg.cxx
index 6ad98ca3fbf8..b83104256817 100644
--- a/sw/source/ui/chrdlg/chardlg.cxx
+++ b/sw/source/ui/chrdlg/chardlg.cxx
@@ -295,7 +295,7 @@ IMPL_LINK_NOARG(SwCharURLPage, InsertFileHdl, weld::Button&, void)
                                 FileDialogFlags::NONE, GetFrameWeld());
     if( aDlgHelper.Execute() == ERRCODE_NONE )
     {
-        Reference<XFilePicker3> xFP = aDlgHelper.GetFilePicker();
+        const Reference<XFilePicker3>& xFP = aDlgHelper.GetFilePicker();
         m_xURLED->set_text(xFP->getSelectedFiles().getConstArray()[0]);
     }
 }
diff --git a/sw/source/ui/dbui/mmresultdialogs.cxx b/sw/source/ui/dbui/mmresultdialogs.cxx
index fe95b26a54ad..dfde81645aa8 100644
--- a/sw/source/ui/dbui/mmresultdialogs.cxx
+++ b/sw/source/ui/dbui/mmresultdialogs.cxx
@@ -230,7 +230,7 @@ SwMMResultSaveDialog::SwMMResultSaveDialog(weld::Window* pParent)
     // m_pSaveAsOneRB is the default, so disable m_xFromNF and m_xToNF initially.
     aLink.Call(*m_xSaveAsOneRB);
     SwView* pView = ::GetActiveView();
-    std::shared_ptr<SwMailMergeConfigItem> xConfigItem = pView->GetMailMergeConfigItem();
+    const std::shared_ptr<SwMailMergeConfigItem>& xConfigItem = pView->GetMailMergeConfigItem();
     assert(xConfigItem);
     sal_Int32 nCount = xConfigItem->GetMergedDocumentCount();
     m_xFromNF->set_max(nCount);
@@ -319,7 +319,7 @@ void SwMMResultPrintDialog::FillInPrinterSettings()
 {
     //fill printer ListBox
     SwView* pView = ::GetActiveView();
-    std::shared_ptr<SwMailMergeConfigItem> xConfigItem = pView->GetMailMergeConfigItem();
+    const std::shared_ptr<SwMailMergeConfigItem>& xConfigItem = pView->GetMailMergeConfigItem();
     const std::vector<OUString>& rPrinters = Printer::GetPrinterQueues();
     unsigned int nCount = rPrinters.size();
     bool bMergePrinterExists = false;
@@ -352,7 +352,7 @@ void SwMMResultPrintDialog::FillInPrinterSettings()
 void SwMMResultEmailDialog::FillInEmailSettings()
 {
     SwView* pView = ::GetActiveView();
-    std::shared_ptr<SwMailMergeConfigItem> xConfigItem = pView->GetMailMergeConfigItem();
+    const std::shared_ptr<SwMailMergeConfigItem>& xConfigItem = pView->GetMailMergeConfigItem();
     assert(xConfigItem);
 
     SwView* pSourceView = xConfigItem->GetSourceView();
@@ -688,7 +688,7 @@ IMPL_LINK_NOARG(SwMMResultSaveDialog, SaveOutputHdl_Impl, weld::Button&, void)
 IMPL_LINK(SwMMResultPrintDialog, PrinterChangeHdl_Impl, weld::ComboBox&, rBox, void)
 {
     SwView* pView = ::GetActiveView();
-    std::shared_ptr<SwMailMergeConfigItem> xConfigItem = pView->GetMailMergeConfigItem();
+    const std::shared_ptr<SwMailMergeConfigItem>& xConfigItem = pView->GetMailMergeConfigItem();
     assert(xConfigItem);
     if (rBox.get_active() != -1)
     {
diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index 445c83a83006..ca883f1876bd 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -1089,7 +1089,7 @@ void SwTOXSelectTabPage::ApplyTOXDescription()
     }
     else if(TOX_AUTHORITIES == aCurType.eType)
     {
-        const OUString sBrackets(rDesc.GetAuthBrackets());
+        const OUString& sBrackets(rDesc.GetAuthBrackets());
         if(sBrackets.isEmpty() || sBrackets == "  ")
             m_pBracketLB->SelectEntryPos(0);
         else
@@ -2056,7 +2056,7 @@ void SwTOXEntryTabPage::Reset( const SfxItemSet* )
     if(TOX_INDEX == aCurType.eType)
     {
         SwTOXDescription& rDesc = pTOXDlg->GetTOXDescription(aCurType);
-        const OUString sMainEntryCharStyle = rDesc.GetMainEntryCharStyle();
+        const OUString& sMainEntryCharStyle = rDesc.GetMainEntryCharStyle();
         if(!sMainEntryCharStyle.isEmpty())
         {
             if( LISTBOX_ENTRY_NOTFOUND ==
diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx
index 61182dae5e04..03584d8cf387 100644
--- a/sw/source/ui/misc/bookmark.cxx
+++ b/sw/source/ui/misc/bookmark.cxx
@@ -150,7 +150,7 @@ IMPL_LINK_NOARG(SwInsertBookmarkDlg, SelectionChangedHdl, SvTreeListBox*, void)
     for (sal_Int32 i = m_pBookmarksBox->GetSelectionCount(); i; i--)
     {
         sw::mark::IMark* pBookmark = static_cast<sw::mark::IMark*>(pSelected->GetUserData());
-        OUString sEntryName = pBookmark->GetName();
+        const OUString& sEntryName = pBookmark->GetName();
         sEditBoxText.append(sEntryName);
         if (i > 1)
             sEditBoxText.append(";");
@@ -412,7 +412,7 @@ void BookmarkTable::InsertBookmark(sw::mark::IMark* pMark)
     OUString sHidden = "No";
     if (pBookmark->IsHidden())
         sHidden = "Yes";
-    OUString sHideCondition = pBookmark->GetHideCondition();
+    const OUString& sHideCondition = pBookmark->GetHideCondition();
     OUString sPageNum = OUString::number(SwPaM(pMark->GetMarkStart()).GetPageNum());
     OUString sColumnData = sPageNum + "\t" + pBookmark->GetName() + "\t" + sBookmarkNodeText + "\t" + sHidden + "\t" + sHideCondition;
     InsertEntryToColumn(sColumnData, TREELIST_APPEND, 0xffff, pMark);
@@ -459,7 +459,7 @@ OUString BookmarkTable::GetNameProposal()
     while (pEntry)
     {
         sw::mark::IMark* pBookmark = static_cast<sw::mark::IMark*>(pEntry->GetUserData());
-        OUString sName = pBookmark->GetName();
+        const OUString& sName = pBookmark->GetName();
         sal_Int32 nIndex = 0;
         if (sName.getToken(0, ' ', nIndex) == sDefaultBookmarkName)
         {
diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx
index 58ec33857f9c..9572219f7d6c 100644
--- a/sw/source/ui/misc/glossary.cxx
+++ b/sw/source/ui/misc/glossary.cxx
@@ -605,7 +605,7 @@ IMPL_LINK_NOARG(SwGlossaryDlg, BibHdl, Button*, void)
     {
         //check if at least one glossary path is write enabled
         SvtPathOptions aPathOpt;
-        const OUString sGlosPath( aPathOpt.GetAutoTextPath() );
+        const OUString& sGlosPath( aPathOpt.GetAutoTextPath() );
         const sal_Int32 nPaths = comphelper::string::getTokenCount(sGlosPath, ';');
         bool bIsWritable = false;
         for(sal_Int32 nPath = 0; nPath < nPaths; nPath++)
diff --git a/sw/source/ui/misc/num.cxx b/sw/source/ui/misc/num.cxx
index 35e763f326d6..764eec430efa 100644
--- a/sw/source/ui/misc/num.cxx
+++ b/sw/source/ui/misc/num.cxx
@@ -842,7 +842,7 @@ IMPL_LINK_NOARG(SwNumPositionTabPage, StandardHdl, weld::Button&, void)
             SwNumRule aTmpNumRule( pWrtSh->GetUniqueNumRuleName(),
                                    aNumFormat.GetPositionAndSpaceMode(),
                                    pOutlineDlg ? OUTLINE_RULE : NUM_RULE );
-            SwNumFormat aTempFormat(aTmpNumRule.Get( i ));
+            const SwNumFormat& aTempFormat(aTmpNumRule.Get( i ));
             aNumFormat.SetPositionAndSpaceMode( aTempFormat.GetPositionAndSpaceMode() );
             if ( aTempFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
             {
diff --git a/sw/source/ui/vba/vbaaddins.cxx b/sw/source/ui/vba/vbaaddins.cxx
index 265f850206b8..a9c5e355bfc2 100644
--- a/sw/source/ui/vba/vbaaddins.cxx
+++ b/sw/source/ui/vba/vbaaddins.cxx
@@ -35,7 +35,7 @@ static uno::Reference< container::XIndexAccess > lcl_getAddinCollection( const u
     uno::Reference<ucb::XSimpleFileAccess3> xSFA(ucb::SimpleFileAccess::create(xContext));
     SvtPathOptions aPathOpt;
     // FIXME: temporary the STARTUP path is located in $OO/basic3.1/program/addin
-    OUString aAddinPath = aPathOpt.GetAddinPath();
+    const OUString& aAddinPath = aPathOpt.GetAddinPath();
     SAL_INFO("sw.vba", "lcl_getAddinCollection: " << aAddinPath );
     if( xSFA->isFolder( aAddinPath ) )
     {
diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index fb6270a91958..dda0b9143141 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -703,7 +703,7 @@ void SwModule::ExecOther(SfxRequest& rReq)
         case FN_MAILMERGE_CURRENT_ENTRY:
         {
             SwView* pView = ::GetActiveView();
-            std::shared_ptr<SwMailMergeConfigItem> xConfigItem = pView->GetMailMergeConfigItem();
+            const std::shared_ptr<SwMailMergeConfigItem>& xConfigItem = pView->GetMailMergeConfigItem();
             if (!xConfigItem)
                 return;
 
diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx
index b6ec409f14e1..c907b6c17c32 100644
--- a/sw/source/uibase/app/docsh.cxx
+++ b/sw/source/uibase/app/docsh.cxx
@@ -1412,7 +1412,7 @@ bool SwDocShell::GetProtectionHash( /*out*/ css::uno::Sequence< sal_Int8 > &rPas
     const SfxPoolItem*  pItem = nullptr;
 
     IDocumentRedlineAccess& rIDRA = m_pWrtShell->getIDocumentRedlineAccess();
-    Sequence< sal_Int8 > aPasswdHash( rIDRA.GetRedlinePassword() );
+    const Sequence< sal_Int8 >& aPasswdHash( rIDRA.GetRedlinePassword() );
     if (pArgs && SfxItemState::SET == pArgs->GetItemState( FN_REDLINE_PROTECT, false, &pItem )
         && static_cast<const SfxBoolItem*>(pItem)->GetValue() == (aPasswdHash.getLength() != 0))
         return false;
diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index 283406ea6ed0..7e3b049aa0e3 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -755,7 +755,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
             case SID_GET_COLORLIST:
             {
                 const SvxColorListItem* pColItem = GetItem(SID_COLOR_TABLE);
-                XColorListRef pList = pColItem->GetColorList();
+                const XColorListRef& pList = pColItem->GetColorList();
                 rReq.SetReturnValue(OfaRefItem<XColorList>(SID_GET_COLORLIST, pList));
             }
             break;
diff --git a/sw/source/uibase/app/docshdrw.cxx b/sw/source/uibase/app/docshdrw.cxx
index 8541a522dd83..432d27befc43 100644
--- a/sw/source/uibase/app/docshdrw.cxx
+++ b/sw/source/uibase/app/docshdrw.cxx
@@ -57,7 +57,7 @@ void InitDrawModelAndDocShell(SwDocShell* pSwDocShell, SwDrawModel* pSwDrawDocum
                 if(pColItemFromDocShell)
                 {
                     // the DocShell has a ColorTable, use it also in DrawingLayer
-                    XColorListRef xCol(pColItemFromDocShell->GetColorList());
+                    const XColorListRef& xCol(pColItemFromDocShell->GetColorList());
                     pSwDrawDocument->SetPropertyList(static_cast<XPropertyList*>(xCol.get()));
                 }
                 else
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 31548a502b15..3d0c7c5f88ee 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -2823,7 +2823,7 @@ OUString LoadAndRegisterDataSource_Impl(DBConnURIType type, const uno::Reference
                 OUString const sOutputExt = ".odb";
                 OUString sHomePath(SvtPathOptions().GetWorkPath());
                 utl::TempFile aTempFile(sNewName, true, &sOutputExt, pDestDir ? pDestDir : &sHomePath);
-                OUString sTmpName = aTempFile.GetURL();
+                const OUString& sTmpName = aTempFile.GetURL();
                 xStore->storeAsURL(sTmpName, uno::Sequence<beans::PropertyValue>());
             }
             else
@@ -3320,7 +3320,7 @@ void SwDBManager::RevokeLastRegistrations()
         SwView* pView = ( m_pDoc && m_pDoc->GetDocShell() ) ? m_pDoc->GetDocShell()->GetView() : nullptr;
         if (pView)
         {
-            std::shared_ptr<SwMailMergeConfigItem> xConfigItem = pView->GetMailMergeConfigItem();
+            const std::shared_ptr<SwMailMergeConfigItem>& xConfigItem = pView->GetMailMergeConfigItem();
             if (xConfigItem)
             {
                 xConfigItem->DisposeResultSet();
diff --git a/sw/source/uibase/dialog/watermarkdialog.cxx b/sw/source/uibase/dialog/watermarkdialog.cxx
index 2b794e129b8e..e40227abe962 100644
--- a/sw/source/uibase/dialog/watermarkdialog.cxx
+++ b/sw/source/uibase/dialog/watermarkdialog.cxx
@@ -69,7 +69,7 @@ void SwWatermarkDialog::InitFields()
     if( eState >= SfxItemState::DEFAULT && pItem && pItem->Which() == SID_WATERMARK)
     {
         const SfxWatermarkItem* pWatermark = static_cast<const SfxWatermarkItem*>( pItem );
-        OUString sText = pWatermark->GetText();
+        const OUString& sText = pWatermark->GetText();
         m_xTextInput->set_text(sText);
         m_xFont->set_entry_text(pWatermark->GetFont());
         m_xAngle->set_value(pWatermark->GetAngle(), FUNIT_DEGREE);
diff --git a/sw/source/uibase/docvw/AnchorOverlayObject.cxx b/sw/source/uibase/docvw/AnchorOverlayObject.cxx
index 5949d82859cc..73ce30f7a32e 100644
--- a/sw/source/uibase/docvw/AnchorOverlayObject.cxx
+++ b/sw/source/uibase/docvw/AnchorOverlayObject.cxx
@@ -186,7 +186,7 @@ ImplPrimitive2DIDBlock(AnchorPrimitive, PRIMITIVE2D_ID_SWSIDEBARANCHORPRIMITIVE)
         SdrPaintWindow* pPaintWindow = rDocView.GetDrawView()->GetPaintWindow(0);
         if( pPaintWindow )
         {
-            rtl::Reference< sdr::overlay::OverlayManager > xOverlayManager = pPaintWindow->GetOverlayManager();
+            const rtl::Reference< sdr::overlay::OverlayManager >& xOverlayManager = pPaintWindow->GetOverlayManager();
 
             if ( xOverlayManager.is() )
             {
diff --git a/sw/source/uibase/docvw/OverlayRanges.cxx b/sw/source/uibase/docvw/OverlayRanges.cxx
index 9d7cace2bdca..c7394b1bdc32 100644
--- a/sw/source/uibase/docvw/OverlayRanges.cxx
+++ b/sw/source/uibase/docvw/OverlayRanges.cxx
@@ -115,7 +115,7 @@ namespace sw
             if ( pView != nullptr )
             {
                 SdrPaintWindow* pCandidate = pView->GetPaintWindow(0);
-                rtl::Reference<sdr::overlay::OverlayManager> xTargetOverlay = pCandidate->GetOverlayManager();
+                const rtl::Reference<sdr::overlay::OverlayManager>& xTargetOverlay = pCandidate->GetOverlayManager();
 
                 if ( xTargetOverlay.is() )
                 {
diff --git a/sw/source/uibase/docvw/ShadowOverlayObject.cxx b/sw/source/uibase/docvw/ShadowOverlayObject.cxx
index b69ecf481421..374d26231310 100644
--- a/sw/source/uibase/docvw/ShadowOverlayObject.cxx
+++ b/sw/source/uibase/docvw/ShadowOverlayObject.cxx
@@ -165,7 +165,7 @@ ImplPrimitive2DIDBlock(ShadowPrimitive, PRIMITIVE2D_ID_SWSIDEBARSHADOWPRIMITIVE)
         SdrPaintWindow* pPaintWindow = rDocView.GetDrawView()->GetPaintWindow(0);
         if( pPaintWindow )
         {
-            rtl::Reference< sdr::overlay::OverlayManager > xOverlayManager = pPaintWindow->GetOverlayManager();
+            const rtl::Reference< sdr::overlay::OverlayManager >& xOverlayManager = pPaintWindow->GetOverlayManager();
 
             if ( xOverlayManager.is() )
             {
diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx
index dfa24f2239fd..4e4edeff75b6 100644
--- a/sw/source/uibase/docvw/SidebarTxtControl.cxx
+++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx
@@ -337,8 +337,8 @@ void SidebarTextControl::MouseButtonDown( const MouseEvent& rMEvt )
                 {
                     GetTextView()->MouseButtonDown( rMEvt );
                     SwWrtShell &rSh = mrDocView.GetWrtShell();
-                    OUString sURL( pURL->GetURL() );
-                    OUString sTarget( pURL->GetTargetFrame() );
+                    const OUString& sURL( pURL->GetURL() );
+                    const OUString& sTarget( pURL->GetTargetFrame() );
                     ::LoadURL(rSh, sURL, LoadUrlFlags::NONE, sTarget);
                     return;
                 }
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index f9bb7443c3b7..6ce63b23a55d 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -1056,7 +1056,7 @@ void SwEditWin::ChangeFly( sal_uInt8 nDir, bool bWeb )
     // adjustment for allowing vertical position
     // aligned to page for fly frame anchored to paragraph or to character.
     {
-        SwFormatVertOrient aVert( aSet.Get(RES_VERT_ORIENT) );
+        const SwFormatVertOrient& aVert( aSet.Get(RES_VERT_ORIENT) );
         const bool bFollowTextFlow =
                 aSet.Get(RES_FOLLOW_TEXT_FLOW).GetValue();
         const SwPosition* pToCharContentPos = aSet.Get(RES_ANCHOR).GetContentAnchor();
@@ -4647,8 +4647,8 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
                                     const SvxURLField *pField = aVEvt.pURLField;
                                     if (pField)
                                     {
-                                        OUString sURL(pField->GetURL());
-                                        OUString sTarget(pField->GetTargetFrame());
+                                        const OUString& sURL(pField->GetURL());
+                                        const OUString& sTarget(pField->GetTargetFrame());
                                         ::LoadURL(rSh, sURL, nFilter, sTarget);
                                     }
                                     bCallShadowCursor = false;
@@ -5508,7 +5508,7 @@ void SwEditWin::Command( const CommandEvent& rCEvt )
                 if ( nSize == 0 )
                 {
                     // When the composition does not exist, use Caret rect instead.
-                    SwRect aCaretRect ( rSh.GetCharRect() );
+                    const SwRect& aCaretRect ( rSh.GetCharRect() );
                     tools::Rectangle aRect( aCaretRect.Left(), aCaretRect.Top(), aCaretRect.Right(), aCaretRect.Bottom() );
                     rWin.SetCompositionCharRect( &aRect, 1, bVertical );
                 }
diff --git a/sw/source/uibase/misc/glosdoc.cxx b/sw/source/uibase/misc/glosdoc.cxx
index c0286c30dfe8..8ed038e9c590 100644
--- a/sw/source/uibase/misc/glosdoc.cxx
+++ b/sw/source/uibase/misc/glosdoc.cxx
@@ -354,7 +354,7 @@ static OUString lcl_makePath(const std::vector<OUString>& rPaths)
 void SwGlossaries::UpdateGlosPath(bool bFull)
 {
     SvtPathOptions aPathOpt;
-    OUString aNewPath( aPathOpt.GetAutoTextPath() );
+    const OUString& aNewPath( aPathOpt.GetAutoTextPath() );
     bool bPathChanged = m_aPath != aNewPath;
     if (bFull || bPathChanged)
     {
diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx
index 878bed0f36f1..5b14408bf170 100644
--- a/sw/source/uibase/shells/annotsh.cxx
+++ b/sw/source/uibase/shells/annotsh.cxx
@@ -648,7 +648,7 @@ void SwAnnotationShell::GetState(SfxItemSet& rSet)
                 SfxItemState eState = aEditAttr.GetItemState( EE_PARA_SBL );
                 if( eState >= SfxItemState::DEFAULT )
                 {
-                    SvxLineSpacingItem aLR = aEditAttr.Get( EE_PARA_SBL );
+                    const SvxLineSpacingItem& aLR = aEditAttr.Get( EE_PARA_SBL );
                     rSet.Put(aLR);
                 }
                 else
@@ -1741,7 +1741,7 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq)
         aAllSet.Put( SfxBoolItem( FN_PARAM_1, false ) );
 
         SwViewOption aOpt(*rView.GetWrtShell().GetViewOptions());
-        OUString sSymbolFont = aOpt.GetSymbolFont();
+        const OUString& sSymbolFont = aOpt.GetSymbolFont();
         if( !sSymbolFont.isEmpty() )
             aAllSet.Put( SfxStringItem( SID_FONT_NAME, sSymbolFont ) );
         else
diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
index 0a6baea02225..a54eb47a179d 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -1917,7 +1917,7 @@ void SwBaseShell::SetWrapMode( sal_uInt16 nSlot )
             bOpaque = !rSh.GetLayerId();
         else
         {
-            const SvxOpaqueItem aOpaque( aSet.Get(RES_OPAQUE) );
+            const SvxOpaqueItem& aOpaque( aSet.Get(RES_OPAQUE) );
             bOpaque = !aOpaque.GetValue();
         }
     }
diff --git a/sw/source/uibase/shells/drformsh.cxx b/sw/source/uibase/shells/drformsh.cxx
index 196cf2bea46f..b5de83ed9218 100644
--- a/sw/source/uibase/shells/drformsh.cxx
+++ b/sw/source/uibase/shells/drformsh.cxx
@@ -101,7 +101,7 @@ void SwDrawFormShell::Execute(SfxRequest const &rReq)
                     }
                     else
                     {
-                        uno::Reference< awt::XControlModel >  xControlModel = pUnoCtrl->GetUnoControlModel();
+                        const uno::Reference< awt::XControlModel >&  xControlModel = pUnoCtrl->GetUnoControlModel();
 
                         OSL_ENSURE( xControlModel.is(), "UNO-Control without Model" );
                         if( !xControlModel.is() )
@@ -176,7 +176,7 @@ void SwDrawFormShell::GetState(SfxItemSet& rSet)
                     SdrUnoObj* pUnoCtrl = dynamic_cast<SdrUnoObj*>( rMarkList.GetMark(0)->GetMarkedSdrObj() );
                     if (pUnoCtrl && SdrInventor::FmForm == pUnoCtrl->GetObjInventor())
                     {
-                        uno::Reference< awt::XControlModel >  xControlModel = pUnoCtrl->GetUnoControlModel();
+                        const uno::Reference< awt::XControlModel >&  xControlModel = pUnoCtrl->GetUnoControlModel();
 
                         OSL_ENSURE( xControlModel.is(), "UNO-Control without Model" );
                         if( !xControlModel.is() )
diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx
index 5d14a5ae5792..7e0a8c0ead75 100644
--- a/sw/source/uibase/shells/drwtxtex.cxx
+++ b/sw/source/uibase/shells/drwtxtex.cxx
@@ -672,7 +672,7 @@ ASK_ADJUST:
                 SfxItemState eState = aEditAttr.GetItemState(EE_PARA_SBL);
                 if( eState >= SfxItemState::DEFAULT )
                 {
-                    SvxLineSpacingItem aLR = aEditAttr.Get( EE_PARA_SBL );
+                    const SvxLineSpacingItem& aLR = aEditAttr.Get( EE_PARA_SBL );
                     rSet.Put(aLR);
                 }
                 else
diff --git a/sw/source/uibase/shells/drwtxtsh.cxx b/sw/source/uibase/shells/drwtxtsh.cxx
index 71334558fe68..5a13c7a1f5ba 100644
--- a/sw/source/uibase/shells/drwtxtsh.cxx
+++ b/sw/source/uibase/shells/drwtxtsh.cxx
@@ -714,7 +714,7 @@ void SwDrawTextShell::InsertSymbol(SfxRequest& rReq)
         aAllSet.Put( SfxBoolItem( FN_PARAM_1, false ) );
 
         SwViewOption aOpt(*rView.GetWrtShell().GetViewOptions());
-        OUString sSymbolFont = aOpt.GetSymbolFont();
+        const OUString& sSymbolFont = aOpt.GetSymbolFont();
         if( !sSymbolFont.isEmpty() )
             aAllSet.Put( SfxStringItem( SID_FONT_NAME, sSymbolFont ) );
         else
diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx
index 1f3a0d3424ca..1806c0e2fe50 100644
--- a/sw/source/uibase/shells/frmsh.cxx
+++ b/sw/source/uibase/shells/frmsh.cxx
@@ -717,7 +717,7 @@ void SwFrameShell::GetState(SfxItemSet& rSet)
             {
                 case RES_FRM_SIZE:
                 {
-                    SwFormatFrameSize aSz(aMgr.GetFrameSize());
+                    const SwFormatFrameSize& aSz(aMgr.GetFrameSize());
                     rSet.Put(aSz);
                 }
                 break;
diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx
index 336f46d3a7d0..579a35df411b 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -928,7 +928,7 @@ void SwTableShell::Execute(SfxRequest &rReq)
                 // -->after inserting,reset the inner table borders
                 if ( bSetInnerBorders )
                 {
-                    const SvxBoxInfoItem aBoxInfo(aCoreSet.Get(SID_ATTR_BORDER_INNER));
+                    const SvxBoxInfoItem& aBoxInfo(aCoreSet.Get(SID_ATTR_BORDER_INNER));
                     SfxItemSet aSet( GetPool(), svl::Items<SID_ATTR_BORDER_INNER,
                                                 SID_ATTR_BORDER_INNER>{});
                     aSet.Put( aBoxInfo );
diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx
index 35ebe583af3c..8d7681adde1e 100644
--- a/sw/source/uibase/shells/textsh.cxx
+++ b/sw/source/uibase/shells/textsh.cxx
@@ -926,7 +926,7 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq )
         aAllSet.Put( SfxBoolItem( FN_PARAM_1, false ) );
 
         SwViewOption aOpt(*GetShell().GetViewOptions());
-        OUString sSymbolFont = aOpt.GetSymbolFont();
+        const OUString& sSymbolFont = aOpt.GetSymbolFont();
         if( aFontName.isEmpty() && !sSymbolFont.isEmpty() )
             aAllSet.Put( SfxStringItem( SID_FONT_NAME, sSymbolFont ) );
         else
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index ae305812d594..4b0dc1e3ceb4 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -1436,7 +1436,7 @@ void SwTextShell::GetState( SfxItemSet &rSet )
 
             LanguageType nLang = rSh.GetCurLang();
             LanguageTag aLanguageTag( nLang);
-            lang::Locale aLocale( aLanguageTag.getLocale());
+            const lang::Locale& aLocale( aLanguageTag.getLocale());
 
             // disable "Thesaurus" context menu entry if there is nothing to look up
             uno::Reference< linguistic2::XThesaurus >  xThes( ::GetThesaurus() );
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index f54eb93a897a..66c76633d14b 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -1281,7 +1281,7 @@ void SwView::StateStatusLine(SfxItemSet &rSet)
     const SwSection* CurrSect = rShell.GetCurrSection();
     if( CurrSect )
     {
-        OUString sCurrentSectionName = CurrSect->GetSectionName();
+        const OUString& sCurrentSectionName = CurrSect->GetSectionName();
         if(sCurrentSectionName != m_sOldSectionName)
         {
             SwCursorShell::FireSectionChangeEvent(2, 1);
diff --git a/sw/source/uibase/uiview/viewdraw.cxx b/sw/source/uibase/uiview/viewdraw.cxx
index 974add36a258..5a836876255b 100644
--- a/sw/source/uibase/uiview/viewdraw.cxx
+++ b/sw/source/uibase/uiview/viewdraw.cxx
@@ -195,7 +195,7 @@ void SwView::ExecDraw(SfxRequest& rReq)
         {
             ConstCustomShape* pConstCustomShape = static_cast<ConstCustomShape*>(pFuncPtr);
             OUString aNew = ConstCustomShape::GetShapeTypeFromRequest( rReq );
-            OUString aOld = pConstCustomShape->GetShapeType();
+            const OUString& aOld = pConstCustomShape->GetShapeType();
             if( aNew == aOld )
             {
                 bDeselect = true;
diff --git a/sw/source/uibase/uiview/viewprt.cxx b/sw/source/uibase/uiview/viewprt.cxx
index f824291a7518..d55a8d0819cf 100644
--- a/sw/source/uibase/uiview/viewprt.cxx
+++ b/sw/source/uibase/uiview/viewprt.cxx
@@ -187,7 +187,7 @@ void SwView::ExecutePrint(SfxRequest& rReq)
         case FN_FAX:
         {
             SwPrintOptions* pPrintOptions = SW_MOD()->GetPrtOptions(bWeb);
-            OUString sFaxName(pPrintOptions->GetFaxName());
+            const OUString& sFaxName(pPrintOptions->GetFaxName());
             if (!sFaxName.isEmpty())
             {
                 SfxStringItem aPrinterName(SID_PRINTER_NAME, sFaxName);
diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx
index 6bd0cf3d6d82..778404815519 100644
--- a/sw/source/uibase/uiview/viewsrch.cxx
+++ b/sw/source/uibase/uiview/viewsrch.cxx
@@ -848,7 +848,7 @@ sal_uLong SwView::FUNC_Search( const SwSearchOptions& rOptions )
     else if( m_pSrchItem->GetPattern() )
     {
         // Searching (and replacing) templates
-        const OUString sRplStr( m_pSrchItem->GetReplaceString() );
+        const OUString& sRplStr( m_pSrchItem->GetReplaceString() );
         nFound = m_pWrtShell->SearchTempl( m_pSrchItem->GetSearchString(),
             rOptions.eStart,
             rOptions.eEnd,
diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx
index d6ba87cc6598..5fa4446755b4 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -402,7 +402,7 @@ void SwView::ExecTabWin( SfxRequest const & rReq )
     case SID_ATTR_PAGE_LRSPACE:
         if ( pReqArgs )
         {
-            const SvxLongLRSpaceItem aLongLR( pReqArgs->Get( SID_ATTR_PAGE_LRSPACE ) );
+            const SvxLongLRSpaceItem& aLongLR( pReqArgs->Get( SID_ATTR_PAGE_LRSPACE ) );
 
             SwPageDesc aDesc( rDesc );
             {
@@ -543,7 +543,7 @@ void SwView::ExecTabWin( SfxRequest const & rReq )
     case SID_ATTR_PAGE_ULSPACE:
         if ( pReqArgs )
         {
-            SvxLongULSpaceItem aLongULSpace( pReqArgs->Get( SID_ATTR_PAGE_ULSPACE ) );
+            const SvxLongULSpaceItem& aLongULSpace( pReqArgs->Get( SID_ATTR_PAGE_ULSPACE ) );
 
             SwPageDesc aDesc( rDesc );
             {
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index 65e5d0395c40..ef15d5fee11e 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -3485,7 +3485,7 @@ void SwContentTree::GotoContent(SwContent* pCnt)
         break;
         case ContentTypeId::INDEX:
         {
-            const OUString sName(pCnt->GetName());
+            const OUString& sName(pCnt->GetName());
             if (!m_pActiveShell->GotoNextTOXBase(&sName))
                 m_pActiveShell->GotoPrevTOXBase(&sName);
         }
diff --git a/sw/source/uibase/utlui/gloslst.cxx b/sw/source/uibase/utlui/gloslst.cxx
index 9eee09388514..ea41daf985f4 100644
--- a/sw/source/uibase/utlui/gloslst.cxx
+++ b/sw/source/uibase/utlui/gloslst.cxx
@@ -232,7 +232,7 @@ void SwGlossaryList::Update()
         Start();
 
     SvtPathOptions aPathOpt;
-    OUString sTemp( aPathOpt.GetAutoTextPath() );
+    const OUString& sTemp( aPathOpt.GetAutoTextPath() );
     if(sTemp != sPath)
     {
         sPath = sTemp;
diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx
index 8d5bc9902f84..68ae9d997630 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -1272,7 +1272,7 @@ void SwWrtShell::NumOrBulletOn(bool bNum)
                     if (nLevel >= MAXLEVEL)
                         nLevel = MAXLEVEL - 1;
 
-                    const SwNumFormat aFormat( aNumRule.Get( nLevel ) );
+                    const SwNumFormat& aFormat( aNumRule.Get( nLevel ) );
                     if ( aFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
                     {
                         nIndentChange -= aFormat.GetIndentAt() + aFormat.GetFirstLineIndent();
diff --git a/sw/source/uibase/wrtsh/wrtsh3.cxx b/sw/source/uibase/wrtsh/wrtsh3.cxx
index 7fcd2f56aaab..cc6a5684d9f6 100644
--- a/sw/source/uibase/wrtsh/wrtsh3.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh3.cxx
@@ -212,7 +212,7 @@ bool SwWrtShell::GetURLFromButton( OUString& rURL, OUString& rDescr ) const
             SdrUnoObj* pUnoCtrl = dynamic_cast<SdrUnoObj*>( rMarkList.GetMark(0)->GetMarkedSdrObj() );
             if (pUnoCtrl && SdrInventor::FmForm == pUnoCtrl->GetObjInventor())
             {
-                uno::Reference< awt::XControlModel >  xControlModel = pUnoCtrl->GetUnoControlModel();
+                const uno::Reference< awt::XControlModel >&  xControlModel = pUnoCtrl->GetUnoControlModel();
 
                 OSL_ENSURE( xControlModel.is(), "UNO-Control without Model" );
                 if( !xControlModel.is() )


More information about the Libreoffice-commits mailing list