[Libreoffice-commits] core.git: 2 commits - sc/source test/source tools/source ucbhelper/source ucb/source unodevtools/source unotools/source unoxml/source vbahelper/source vcl/source vcl/unx writerfilter/source xmloff/source xmlscript/source

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


 sc/source/core/data/column4.cxx                        |    2 -
 sc/source/core/data/documen4.cxx                       |    2 -
 sc/source/core/data/dpobject.cxx                       |    5 +-
 sc/source/core/data/globalx.cxx                        |    2 -
 sc/source/core/data/table3.cxx                         |    2 -
 sc/source/core/tool/addincol.cxx                       |    2 -
 sc/source/core/tool/charthelper.cxx                    |    8 ++--
 sc/source/core/tool/detfunc.cxx                        |    2 -
 sc/source/core/tool/interpr4.cxx                       |    6 +--
 sc/source/core/tool/sharedformula.cxx                  |    4 +-
 sc/source/core/tool/token.cxx                          |    2 -
 sc/source/filter/excel/xiescher.cxx                    |    4 +-
 sc/source/filter/excel/xilink.cxx                      |    3 -
 sc/source/filter/oox/unitconverter.cxx                 |    2 -
 sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx |    5 +-
 sc/source/filter/xml/xmlbodyi.cxx                      |    2 -
 sc/source/filter/xml/xmlexprt.cxx                      |   18 ++++-----
 sc/source/ui/app/drwtrans.cxx                          |    2 -
 sc/source/ui/app/scmod.cxx                             |    2 -
 sc/source/ui/app/seltrans.cxx                          |    2 -
 sc/source/ui/cctrl/tbzoomsliderctrl.cxx                |    2 -
 sc/source/ui/condformat/condformatdlgentry.cxx         |   11 ++---
 sc/source/ui/dbgui/scuiasciiopt.cxx                    |    4 --
 sc/source/ui/dialogs/searchresults.cxx                 |    2 -
 sc/source/ui/docshell/docsh4.cxx                       |    8 ++--
 sc/source/ui/docshell/documentlinkmgr.cxx              |    6 +--
 sc/source/ui/docshell/servobj.cxx                      |    2 -
 sc/source/ui/drawfunc/drawsh.cxx                       |    2 -
 sc/source/ui/drawfunc/drawsh5.cxx                      |    4 +-
 sc/source/ui/drawfunc/drtxtob.cxx                      |    2 -
 sc/source/ui/drawfunc/fuins1.cxx                       |    2 -
 sc/source/ui/drawfunc/fuins2.cxx                       |    2 -
 sc/source/ui/drawfunc/graphsh.cxx                      |    2 -
 sc/source/ui/navipi/content.cxx                        |    2 -
 sc/source/ui/navipi/navcitem.cxx                       |    2 -
 sc/source/ui/navipi/scenwnd.cxx                        |    2 -
 sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx     |    2 -
 sc/source/ui/unoobj/ChartTools.cxx                     |    2 -
 sc/source/ui/unoobj/dapiuno.cxx                        |    5 +-
 sc/source/ui/unoobj/docuno.cxx                         |    3 -
 sc/source/ui/unoobj/styleuno.cxx                       |    2 -
 sc/source/ui/vba/vbaapplication.cxx                    |    4 +-
 sc/source/ui/vba/vbarange.cxx                          |   12 +++---
 sc/source/ui/vba/vbaworksheets.cxx                     |    2 -
 sc/source/ui/view/cellsh1.cxx                          |    2 -
 sc/source/ui/view/cellsh3.cxx                          |    4 +-
 sc/source/ui/view/drawvie4.cxx                         |    2 -
 sc/source/ui/view/drawview.cxx                         |    2 -
 sc/source/ui/view/editsh.cxx                           |    4 +-
 sc/source/ui/view/formatsh.cxx                         |    2 -
 sc/source/ui/view/gridwin.cxx                          |    2 -
 sc/source/ui/view/output2.cxx                          |    2 -
 sc/source/ui/view/viewfun2.cxx                         |    2 -
 sc/source/ui/view/viewfun3.cxx                         |    2 -
 sc/source/ui/view/viewfun4.cxx                         |    2 -
 test/source/beans/xpropertyset.cxx                     |    2 -
 test/source/mtfxmldump.cxx                             |    1 
 test/source/primitive2dxmldump.cxx                     |    6 +--
 tools/source/generic/poly2.cxx                         |    2 -
 ucb/source/ucp/file/bc.cxx                             |    2 -
 ucb/source/ucp/ftp/ftpcontent.cxx                      |    2 -
 ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx       |    2 -
 ucb/source/ucp/webdav-neon/NeonSession.cxx             |    2 -
 ucb/source/ucp/webdav-neon/webdavcontent.cxx           |    2 -
 ucbhelper/source/client/interceptedinteraction.cxx     |    2 -
 unodevtools/source/skeletonmaker/javacompskeleton.cxx  |    3 -
 unotools/source/config/fontcfg.cxx                     |    2 -
 unotools/source/i18n/localedatawrapper.cxx             |    2 -
 unotools/source/misc/ZipPackageHelper.cxx              |   13 +-----
 unoxml/source/dom/document.cxx                         |    6 +--
 vbahelper/source/vbahelper/vbashapes.cxx               |    2 -
 vcl/source/control/button.cxx                          |    3 -
 vcl/source/control/notebookbar.cxx                     |    2 -
 vcl/source/filter/wmf/emfwr.cxx                        |    4 +-
 vcl/source/filter/wmf/wmfwr.cxx                        |    4 +-
 vcl/source/gdi/CommonSalLayout.cxx                     |    2 -
 vcl/source/gdi/bmpacc.cxx                              |    2 -
 vcl/source/gdi/pdfwriter_impl2.cxx                     |   10 ++---
 vcl/source/gdi/textlayout.cxx                          |    2 -
 vcl/source/outdev/polygon.cxx                          |    2 -
 vcl/source/window/brdwin.cxx                           |    2 -
 vcl/source/window/dlgctrl.cxx                          |    2 -
 vcl/unx/gtk/a11y/atkutil.cxx                           |    4 +-
 writerfilter/source/dmapper/DomainMapper.cxx           |    2 -
 xmloff/source/chart/SchXMLSeriesHelper.cxx             |    3 -
 xmloff/source/core/SettingsExportHelper.cxx            |    2 -
 xmloff/source/draw/sdxmlexp.cxx                        |    6 +--
 xmloff/source/draw/shapeexport.cxx                     |    2 -
 xmloff/source/table/XMLTableImport.cxx                 |    4 --
 xmloff/source/text/XMLTextListBlockContext.cxx         |    2 -
 xmloff/source/text/txtparai.cxx                        |    2 -
 xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx     |   32 ++++++++---------
 92 files changed, 154 insertions(+), 181 deletions(-)

New commits:
commit 87c06415cebd707ae359cb2f1b06d468cb6afb08
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Oct 23 08:20:34 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Oct 24 08:38:02 2018 +0200

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

diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index 7e9eb0b63e23..a37aa9274f2d 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -1729,7 +1729,7 @@ public:
                     const ScFormulaCell* pCell = *it;
                     OUString aFormula;
                     pCell->GetFormula(aFormula, formula::FormulaGrammar::GRAM_ENGLISH_XL_R1C1);
-                    auto xCellGroup = pCell->GetCellGroup();
+                    const auto& xCellGroup = pCell->GetCellGroup();
                     sal_uInt64 nGroupLength = 0;
                     if (xCellGroup)
                     {
diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx
index 136e34e27e74..5741264955e6 100644
--- a/sc/source/core/data/documen4.cxx
+++ b/sc/source/core/data/documen4.cxx
@@ -794,7 +794,7 @@ const SfxPoolItem* ScDocument::GetEffItem(
                     {
                         ScAddress aPos(nCol, nRow, nTab);
                         ScRefCellValue aCell(const_cast<ScDocument&>(*this), aPos);
-                        OUString aStyle = pForm->GetCellStyle(aCell, aPos);
+                        const OUString& aStyle = pForm->GetCellStyle(aCell, aPos);
                         if (!aStyle.isEmpty())
                         {
                             SfxStyleSheetBase* pStyleSheet = mxPoolHelper->GetStylePool()->Find(
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index a891b0938259..e20678dd998b 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -828,8 +828,7 @@ void ScDPObject::ReloadGroupTableData()
         if (pData)
         {
             // Replace the existing group table data with the source data.
-            shared_ptr<ScDPTableData> pSource = pData->GetSourceTableData();
-            mpTableData = pSource;
+            mpTableData = pData->GetSourceTableData();
         }
         return;
     }
@@ -839,7 +838,7 @@ void ScDPObject::ReloadGroupTableData()
     {
         // This is already a group table data. Salvage the source data and
         // re-create a new group data.
-        shared_ptr<ScDPTableData> pSource = pData->GetSourceTableData();
+        const shared_ptr<ScDPTableData>& pSource = pData->GetSourceTableData();
         shared_ptr<ScDPGroupTableData> pGroupData(new ScDPGroupTableData(pSource, pDoc));
         pDimData->WriteToData(*pGroupData);
         mpTableData = pGroupData;
diff --git a/sc/source/core/data/globalx.cxx b/sc/source/core/data/globalx.cxx
index a4a328313174..81bd7bf1804a 100644
--- a/sc/source/core/data/globalx.cxx
+++ b/sc/source/core/data/globalx.cxx
@@ -47,7 +47,7 @@ void ScGlobal::InitAddIns()
 
     // multi paths separated by semicolons
     SvtPathOptions aPathOpt;
-    OUString aMultiPath = aPathOpt.GetAddinPath();
+    const OUString& aMultiPath = aPathOpt.GetAddinPath();
     if (aMultiPath.isEmpty())
         return;
 
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 2eaf1ce48e6d..27149c7d1bb9 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -122,7 +122,7 @@ static bool SplitString( const OUString &sWhole,
         return false;
 
     // Get numeral element
-    OUString sUser = ScGlobal::pLocaleData->getNumDecimalSep();
+    const OUString& sUser = ScGlobal::pLocaleData->getNumDecimalSep();
     ParseResult aPRNum = ScGlobal::pCharClass->parsePredefinedToken(
         KParseType::ANY_NUMBER, sWhole, nPos,
         KParseTokens::ANY_NUMBER, "", KParseTokens::ANY_NUMBER, sUser );
diff --git a/sc/source/core/tool/addincol.cxx b/sc/source/core/tool/addincol.cxx
index e00c594a782c..0f6a1795b99c 100644
--- a/sc/source/core/tool/addincol.cxx
+++ b/sc/source/core/tool/addincol.cxx
@@ -146,7 +146,7 @@ bool ScUnoAddInFuncData::GetExcelName( LanguageType eDestLang, OUString& rRetExc
     if ( !rCompNames.empty() )
     {
         LanguageTag aLanguageTag( eDestLang);
-        const OUString aSearch( aLanguageTag.getBcp47());
+        const OUString& aSearch( aLanguageTag.getBcp47());
 
         // First, check exact match without fallback overhead.
         ::std::vector<LocalizedName>::const_iterator itNames( rCompNames.begin());
diff --git a/sc/source/core/tool/charthelper.cxx b/sc/source/core/tool/charthelper.cxx
index eca8d48f3e9b..9b36ea8020b0 100644
--- a/sc/source/core/tool/charthelper.cxx
+++ b/sc/source/core/tool/charthelper.cxx
@@ -292,7 +292,7 @@ void ScChartHelper::AddRangesIfProtectedChart( ScRangeListVector& rRangesVector,
         SdrOle2Obj* pSdrOle2Obj = dynamic_cast< SdrOle2Obj* >( pObject );
         if ( pSdrOle2Obj && pSdrOle2Obj->IsChart() )
         {
-            uno::Reference< embed::XEmbeddedObject > xEmbeddedObj = pSdrOle2Obj->GetObjRef();
+            const uno::Reference< embed::XEmbeddedObject >& xEmbeddedObj = pSdrOle2Obj->GetObjRef();
             if ( xEmbeddedObj.is() )
             {
                 bool bDisableDataTableDialog = false;
@@ -306,7 +306,7 @@ void ScChartHelper::AddRangesIfProtectedChart( ScRangeListVector& rRangesVector,
                     ScChartListenerCollection* pCollection = pDocument->GetChartListenerCollection();
                     if (pCollection)
                     {
-                        OUString aChartName = pSdrOle2Obj->GetPersistName();
+                        const OUString& aChartName = pSdrOle2Obj->GetPersistName();
                         const ScChartListener* pListener = pCollection->findByName(aChartName);
                         if (pListener)
                         {
@@ -378,12 +378,12 @@ void ScChartHelper::CreateProtectedChartListenersAndNotify( ScDocument* pDoc, co
                 SdrOle2Obj* pSdrOle2Obj = dynamic_cast< SdrOle2Obj* >( pObject );
                 if ( pSdrOle2Obj && pSdrOle2Obj->IsChart() )
                 {
-                    OUString aChartName = pSdrOle2Obj->GetPersistName();
+                    const OUString& aChartName = pSdrOle2Obj->GetPersistName();
                     ::std::vector< OUString >::const_iterator aEnd = rExcludedChartNames.end();
                     ::std::vector< OUString >::const_iterator aFound = ::std::find( rExcludedChartNames.begin(), aEnd, aChartName );
                     if ( aFound == aEnd )
                     {
-                        uno::Reference< embed::XEmbeddedObject > xEmbeddedObj = pSdrOle2Obj->GetObjRef();
+                        const uno::Reference< embed::XEmbeddedObject >& xEmbeddedObj = pSdrOle2Obj->GetObjRef();
                         if ( xEmbeddedObj.is() && ( nRangeList < nRangeListCount ) )
                         {
                             bool bDisableDataTableDialog = false;
diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx
index deee7197a277..3123afd5846a 100644
--- a/sc/source/core/tool/detfunc.cxx
+++ b/sc/source/core/tool/detfunc.cxx
@@ -353,7 +353,7 @@ static bool lcl_IsOtherTab( const basegfx::B2DPolyPolygon& rPolyPolygon )
     //  test if rPolygon is the line end for "other table" (rectangle)
     if(1 == rPolyPolygon.count())
     {
-        const basegfx::B2DPolygon aSubPoly(rPolyPolygon.getB2DPolygon(0));
+        const basegfx::B2DPolygon& aSubPoly(rPolyPolygon.getB2DPolygon(0));
 
         // #i73305# circle consists of 4 segments, too, distinguishable from square by
         // the use of control points
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 2cc8bc184b4b..f5ca631979e6 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -1703,8 +1703,7 @@ void ScInterpreter::QueryMatrixType(const ScMatrixRef& xMat, SvNumFormatType& rR
             }
             else
             {
-                svl::SharedString aStr( nMatVal.GetString());
-                FormulaTokenRef xRes = new FormulaStringToken( aStr);
+                FormulaTokenRef xRes = new FormulaStringToken( nMatVal.GetString() );
                 PushTempToken( new ScMatrixFormulaCellToken(nCols, nRows, xMat, xRes.get()));
                 rRetTypeExpr = SvNumFormatType::TEXT;
             }
@@ -3037,8 +3036,7 @@ void ScInterpreter::ScExternal()
             }
             else if ( aCall.HasMatrix() )
             {
-                ScMatrixRef xMat = aCall.GetMatrix();
-                PushMatrix( xMat );
+                PushMatrix( aCall.GetMatrix() );
             }
             else if ( aCall.HasString() )
             {
diff --git a/sc/source/core/tool/sharedformula.cxx b/sc/source/core/tool/sharedformula.cxx
index e18e1adf09b4..913b2fe48bb9 100644
--- a/sc/source/core/tool/sharedformula.cxx
+++ b/sc/source/core/tool/sharedformula.cxx
@@ -216,7 +216,7 @@ void SharedFormulaUtil::unshareFormulaCell(const CellStoreType::position_type& a
     if (rCell.aPos.Row() == rCell.GetSharedTopRow())
     {
         // Top of the shared range.
-        ScFormulaCellGroupRef xGroup = rCell.GetCellGroup();
+        const ScFormulaCellGroupRef& xGroup = rCell.GetCellGroup();
         if (xGroup->mnLength == 2)
         {
             // Group consists of only two cells. Mark the second one non-shared.
@@ -242,7 +242,7 @@ void SharedFormulaUtil::unshareFormulaCell(const CellStoreType::position_type& a
     else if (rCell.aPos.Row() == rCell.GetSharedTopRow() + rCell.GetSharedLength() - 1)
     {
         // Bottom of the shared range.
-        ScFormulaCellGroupRef xGroup = rCell.GetCellGroup();
+        const ScFormulaCellGroupRef& xGroup = rCell.GetCellGroup();
         if (xGroup->mnLength == 2)
         {
             // Mark the top cell non-shared.
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 7f1428daeac2..a7752cf232a2 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -2385,7 +2385,7 @@ namespace {
 
 void GetExternalTableData(const ScDocument* pOldDoc, const ScDocument* pNewDoc, const SCTAB nTab, OUString& rTabName, sal_uInt16& rFileId)
 {
-    OUString aFileName = pOldDoc->GetFileURL();
+    const OUString& aFileName = pOldDoc->GetFileURL();
     rFileId = pNewDoc->GetExternalRefManager()->getExternalFileId(aFileName);
     rTabName = pOldDoc->GetCopyTabName(nTab);
     if (rTabName.isEmpty())
diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx
index be62186586ee..09ff5e63b422 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -453,7 +453,7 @@ SdrObjectUniquePtr XclImpDrawObjBase::CreateSdrObject( XclImpDffConverter& rDffC
             SdrUnoObj* pSdrUnoObj = dynamic_cast< SdrUnoObj* >( xSdrObj.get() );
             if( pSdrUnoObj != nullptr )
             {
-                Reference< XControlModel > xCtrlModel = pSdrUnoObj->GetUnoControlModel();
+                const Reference< XControlModel >& xCtrlModel = pSdrUnoObj->GetUnoControlModel();
                 Reference< XPropertySet > xPropSet(xCtrlModel,UNO_QUERY);
                 const static rtl::OUString sPropertyName("ControlTypeinMSO");
 
@@ -1760,7 +1760,7 @@ void XclImpChartObj::DoPostProcessSdrObj( XclImpDffConverter& rDffConv, SdrObjec
     const SdrOle2Obj* pSdrOleObj = dynamic_cast< const SdrOle2Obj* >( &rSdrObj );
     if( mxChart && pSdrOleObj )
     {
-        Reference< XEmbeddedObject > xEmbObj = pSdrOleObj->GetObjRef();
+        const Reference< XEmbeddedObject >& xEmbObj = pSdrOleObj->GetObjRef();
         if( xEmbObj.is() && ::svt::EmbeddedObjectRef::TryRunningState( xEmbObj ) ) try
         {
             Reference< XEmbedPersist > xPersist( xEmbObj, UNO_QUERY_THROW );
diff --git a/sc/source/filter/excel/xilink.cxx b/sc/source/filter/excel/xilink.cxx
index 48905964378d..d34237115622 100644
--- a/sc/source/filter/excel/xilink.cxx
+++ b/sc/source/filter/excel/xilink.cxx
@@ -527,8 +527,7 @@ bool XclImpExtName::CreateOleData(ScDocument& rDoc, const OUString& rUrl,
                 break;
                 case ScMatValType::String:
                 {
-                    const svl::SharedString aStr( aVal.GetString());
-                    ScExternalRefCache::TokenRef pToken(new formula::FormulaStringToken(aStr));
+                    ScExternalRefCache::TokenRef pToken(new formula::FormulaStringToken(aVal.GetString()));
                     xTab->setCell(nCol, nRow, pToken, 0, false);
                 }
                 break;
diff --git a/sc/source/filter/oox/unitconverter.cxx b/sc/source/filter/oox/unitconverter.cxx
index 02824f90322b..94ab7906a977 100644
--- a/sc/source/filter/oox/unitconverter.cxx
+++ b/sc/source/filter/oox/unitconverter.cxx
@@ -132,7 +132,7 @@ void UnitConverter::finalizeImport()
         if( const oox::xls::Font* pDefFont = getStyles().getDefaultFont().get() )
         {
             // XDevice expects pixels in font descriptor, but font contains twips
-            FontDescriptor aDesc = pDefFont->getFontDescriptor();
+            const FontDescriptor& aDesc = pDefFont->getFontDescriptor();
             Reference< XFont > xFont = xDevice->getFont( aDesc );
             if( xFont.is() )
             {
diff --git a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
index 6e40a5e56340..7adec97f2ca6 100644
--- a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
+++ b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
@@ -104,8 +104,7 @@ void ScChangeTrackingExportHelper::WriteChangeInfo(const ScChangeAction* pAction
         SvXMLElementExport aCreatorElem( rExport, XML_NAMESPACE_DC,
                                             XML_CREATOR, true,
                                             false );
-        OUString sAuthor(pAction->GetUser());
-        rExport.Characters(sAuthor);
+        rExport.Characters(pAction->GetUser());
     }
 
     {
@@ -117,7 +116,7 @@ void ScChangeTrackingExportHelper::WriteChangeInfo(const ScChangeAction* pAction
         rExport.Characters(sDate.makeStringAndClear());
     }
 
-    OUString sComment(pAction->GetComment());
+    const OUString& sComment(pAction->GetComment());
     if (!sComment.isEmpty())
     {
         SvXMLElementExport aElemC(rExport, XML_NAMESPACE_TEXT, XML_P, true, false);
diff --git a/sc/source/filter/xml/xmlbodyi.cxx b/sc/source/filter/xml/xmlbodyi.cxx
index 686630bfc5c0..21b436b23934 100644
--- a/sc/source/filter/xml/xmlbodyi.cxx
+++ b/sc/source/filter/xml/xmlbodyi.cxx
@@ -75,7 +75,7 @@ ScXMLBodyContext::ScXMLBodyContext( ScXMLImport& rImport,
         // ODF 1.1 and earlier => GRAM_PODF; ODF 1.2 and later => GRAM_ODFF;
         // no version => earlier than 1.2 => GRAM_PODF.
         formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_ODFF;
-        OUString aVer( rImport.GetODFVersion());
+        const OUString& aVer( rImport.GetODFVersion());
         sal_Int32 nLen = aVer.getLength();
         SAL_INFO("sc.filter", "ScXMLBodyContext ODFVersion: nLen: " << nLen << " str : " << aVer);
         if (!nLen)
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index bf20e977ffe7..4532b06ee897 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -2394,7 +2394,7 @@ void ScXMLExport::collectAutoStyles()
                     OSL_ENSURE( pNote, "note not found" );
                     if (pNote)
                     {
-                        std::shared_ptr< SdrCaptionObj > pDrawObj = pNote->GetOrCreateCaption( aPos );
+                        const std::shared_ptr< SdrCaptionObj >& pDrawObj = pNote->GetOrCreateCaption( aPos );
                         // all uno shapes are created anyway in CollectSharedData
                         uno::Reference<beans::XPropertySet> xShapeProperties( pDrawObj->getUnoShape(), uno::UNO_QUERY );
                         if (xShapeProperties.is())
@@ -2438,7 +2438,7 @@ void ScXMLExport::collectAutoStyles()
                     OSL_ENSURE( pNote, "note not found" );
                     if (pNote)
                     {
-                        std::shared_ptr< SdrCaptionObj > pDrawObj = pNote->GetOrCreateCaption( aPos );
+                        const std::shared_ptr< SdrCaptionObj >& pDrawObj = pNote->GetOrCreateCaption( aPos );
                         uno::Reference<container::XEnumerationAccess> xCellText(pDrawObj->getUnoShape(), uno::UNO_QUERY);
                         uno::Reference<beans::XPropertySet> xParaProp(
                             lcl_GetEnumerated( xCellText, aNoteParaIter->maSelection.nStartPara ), uno::UNO_QUERY );
@@ -2472,7 +2472,7 @@ void ScXMLExport::collectAutoStyles()
                     OSL_ENSURE( pNote, "note not found" );
                     if (pNote)
                     {
-                        std::shared_ptr< SdrCaptionObj > pDrawObj = pNote->GetOrCreateCaption( aPos );
+                        const std::shared_ptr< SdrCaptionObj >& pDrawObj = pNote->GetOrCreateCaption( aPos );
                         uno::Reference<text::XSimpleText> xCellText(pDrawObj->getUnoShape(), uno::UNO_QUERY);
                         uno::Reference<beans::XPropertySet> xCursorProp(xCellText->createTextCursor(), uno::UNO_QUERY);
                         ScDrawTextCursor* pCursor = ScDrawTextCursor::getImplementation( xCursorProp );
@@ -3072,10 +3072,10 @@ void writeContent(
                 // <text:a xlink:href="url" xlink:type="simple">value</text:a>
 
                 const SvxURLField* pURLField = static_cast<const SvxURLField*>(pField);
-                OUString aURL = pURLField->GetURL();
+                const OUString& aURL = pURLField->GetURL();
                 rExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, rExport.GetRelativeReference(aURL));
                 rExport.AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, "simple");
-                OUString aTargetFrame = pURLField->GetTargetFrame();
+                const OUString& aTargetFrame = pURLField->GetTargetFrame();
                 if (!aTargetFrame.isEmpty())
                     rExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_TARGET_FRAME_NAME, aTargetFrame);
 
@@ -3628,12 +3628,12 @@ void ScXMLExport::exportAnnotationMeta( const uno::Reference < drawing::XShape >
         // TODO : notes
         //is it still useful, as this call back is only called from ScXMLExport::WriteAnnotation
         // and should be in sync with pCurrentCell
-        std::shared_ptr< SdrCaptionObj > pNoteCaption = pNote->GetOrCreateCaption(pCurrentCell->maCellAddress);
+        const std::shared_ptr< SdrCaptionObj >& pNoteCaption = pNote->GetOrCreateCaption(pCurrentCell->maCellAddress);
         uno::Reference<drawing::XShape> xCurrentShape( pNoteCaption->getUnoShape(), uno::UNO_QUERY );
         if (xCurrentShape.get()!=xShape.get())
             return;
 
-        OUString sAuthor(pNote->GetAuthor());
+        const OUString& sAuthor(pNote->GetAuthor());
         if (!sAuthor.isEmpty())
         {
             SvXMLElementExport aCreatorElem( *this, XML_NAMESPACE_DC,
@@ -3642,7 +3642,7 @@ void ScXMLExport::exportAnnotationMeta( const uno::Reference < drawing::XShape >
             Characters(sAuthor);
         }
 
-        OUString aDate(pNote->GetDate());
+        const OUString& aDate(pNote->GetDate());
         if (pDoc)
         {
             SvNumberFormatter* pNumForm = pDoc->GetFormatTable();
@@ -3685,7 +3685,7 @@ void ScXMLExport::WriteAnnotation(ScMyCell& rMyCell)
 
         pCurrentCell = &rMyCell;
 
-        std::shared_ptr< SdrCaptionObj > pNoteCaption = pNote->GetOrCreateCaption(rMyCell.maCellAddress);
+        const std::shared_ptr< SdrCaptionObj >& pNoteCaption = pNote->GetOrCreateCaption(rMyCell.maCellAddress);
         if (pNoteCaption)
         {
             uno::Reference<drawing::XShape> xShape( pNoteCaption->getUnoShape(), uno::UNO_QUERY );
diff --git a/sc/source/ui/app/drwtrans.cxx b/sc/source/ui/app/drwtrans.cxx
index 759f3f9763f2..a73b474ad477 100644
--- a/sc/source/ui/app/drwtrans.cxx
+++ b/sc/source/ui/app/drwtrans.cxx
@@ -125,7 +125,7 @@ ScDrawTransferObj::ScDrawTransferObj( std::unique_ptr<SdrModel> pClipModel, ScDo
             SdrUnoObj* pUnoCtrl = dynamic_cast<SdrUnoObj*>( pObject );
             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/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 4824e0dc8f63..b064c73ead2c 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -2095,7 +2095,7 @@ IMPL_LINK( ScModule, CalcFieldValueHdl, EditFieldInfo*, pInfo, void )
     if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(pField))
     {
         // URLField
-        OUString aURL = pURLField->GetURL();
+        const OUString& aURL = pURLField->GetURL();
 
         switch ( pURLField->GetFormat() )
         {
diff --git a/sc/source/ui/app/seltrans.cxx b/sc/source/ui/app/seltrans.cxx
index 5b5aca2a4a7b..84a0e6b23778 100644
--- a/sc/source/ui/app/seltrans.cxx
+++ b/sc/source/ui/app/seltrans.cxx
@@ -46,7 +46,7 @@ static bool lcl_IsURLButton( SdrObject* pObject )
     SdrUnoObj* pUnoCtrl = dynamic_cast<SdrUnoObj*>( pObject );
     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/sc/source/ui/cctrl/tbzoomsliderctrl.cxx b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
index ecb5622c9319..6c9938bcfc85 100644
--- a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
+++ b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
@@ -342,7 +342,7 @@ void ScZoomSliderWnd::UpdateFromItem( const SvxZoomSliderItem* pZoomSliderItem )
             mpImpl->mnMaxZoom >= mpImpl->mnCurrentZoom &&
             mpImpl->mnMaxZoom > gnSliderCenter,
             "Looks like the zoom slider item is corrupted" );
-       const css::uno::Sequence < sal_Int32 > rSnappingPoints = pZoomSliderItem->GetSnappingPoints();
+       const css::uno::Sequence < sal_Int32 >& rSnappingPoints = pZoomSliderItem->GetSnappingPoints();
        mpImpl->maSnappingPointOffsets.clear();
        mpImpl->maSnappingPointZooms.clear();
 
diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx
index 0916ee4fbda4..0a5d66274437 100644
--- a/sc/source/ui/condformat/condformatdlgentry.cxx
+++ b/sc/source/ui/condformat/condformatdlgentry.cxx
@@ -152,8 +152,7 @@ void FillStyleListBox( const ScDocument* pDoc, ListBox& rLbStyle )
     SfxStyleSheetIterator aStyleIter( pDoc->GetStyleSheetPool(), SfxStyleFamily::Para );
     for ( SfxStyleSheetBase* pStyle = aStyleIter.First(); pStyle; pStyle = aStyleIter.Next() )
     {
-        OUString aName = pStyle->GetName();
-        aStyleNames.insert(aName);
+        aStyleNames.insert(pStyle->GetName());
     }
     for(std::set<OUString>::const_iterator itr = aStyleNames.begin(), itrEnd = aStyleNames.end();
                         itr != itrEnd; ++itr)
@@ -213,8 +212,7 @@ ScConditionFrmtEntry::ScConditionFrmtEntry(vcl::Window* pParent, ScDocument* pDo
 
     if(pFormatEntry)
     {
-        OUString aStyleName = pFormatEntry->GetStyle();
-        maLbStyle->SelectEntry(aStyleName);
+        maLbStyle->SelectEntry(pFormatEntry->GetStyle());
         StyleSelectHdl(*maLbStyle.get());
         ScConditionMode eMode = pFormatEntry->GetOperation();
 
@@ -507,7 +505,7 @@ void StyleSelect( ListBox& rLbStyle, const ScDocument* pDoc, SvxFontPrevWindow&
         bool bFound = false;
         for ( SfxStyleSheetBase* pStyle = aStyleIter.First(); pStyle && !bFound; pStyle = aStyleIter.Next() )
         {
-            OUString aName = pStyle->GetName();
+            const OUString& aName = pStyle->GetName();
             if ( rLbStyle.GetEntryPos(aName) == LISTBOX_ENTRY_NOTFOUND )    // all lists contain the same entries
             {
                 for( sal_Int32 i = 1, n = rLbStyle.GetEntryCount(); i <= n && !bFound; ++i)
@@ -1239,8 +1237,7 @@ ScDateFrmtEntry::ScDateFrmtEntry(vcl::Window* pParent, ScDocument* pDoc, const S
         sal_Int32 nPos = static_cast<sal_Int32>(pFormat->GetDateType());
         maLbDateEntry->SelectEntryPos(nPos);
 
-        OUString aStyleName = pFormat->GetStyleName();
-        maLbStyle->SelectEntry(aStyleName);
+        maLbStyle->SelectEntry(pFormat->GetStyleName());
     }
 
     StyleSelectHdl(*maLbStyle.get());
diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx
index cddaf40e997b..24592e061e6b 100644
--- a/sc/source/ui/dbgui/scuiasciiopt.cxx
+++ b/sc/source/ui/dbgui/scuiasciiopt.cxx
@@ -247,12 +247,10 @@ static void lcl_LoadSeparators( OUString& rFieldSeparators, OUString& rTextSepar
 }
 
 static void lcl_SaveSeparators(
-    const OUString& rSeparators, const OUString& rTxtSep, bool bMergeDelimiters, bool bQuotedAsText,
+    const OUString& sFieldSeparators, const OUString& sTextSeparators, bool bMergeDelimiters, bool bQuotedAsText,
     bool bDetectSpecialNum, bool bFixedWidth, sal_Int32 nFromRow,
     sal_Int32 nCharSet, sal_Int32 nLanguage, bool bSkipEmptyCells, bool bRemoveSpace, ScImportAsciiCall eCall )
 {
-    OUString sFieldSeparators = rSeparators;
-    OUString sTextSeparators = rTxtSep;
     Sequence<Any> aValues;
     Any *pProperties;
     Sequence<OUString> aNames;
diff --git a/sc/source/ui/dialogs/searchresults.cxx b/sc/source/ui/dialogs/searchresults.cxx
index 436e0ec0ab99..3b0a8299d1c1 100644
--- a/sc/source/ui/dialogs/searchresults.cxx
+++ b/sc/source/ui/dialogs/searchresults.cxx
@@ -135,7 +135,7 @@ void SearchResultsDlg::FillResults( ScDocument* pDoc, const ScRangeList &rMatche
             ScCellIterator aIter(pDoc, rMatchedRanges[i]);
             for (bool bHas = aIter.first(); bHas; bHas = aIter.next())
             {
-                ScAddress aPos = aIter.GetPos();
+                const ScAddress& aPos = aIter.GetPos();
                 if (aPos.Tab() >= nTabCount)
                     // Out-of-bound sheet index.
                     continue;
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 480b8d44e8e5..90a24a9294fa 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -596,7 +596,7 @@ void ScDocShell::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;
@@ -863,7 +863,7 @@ void ScDocShell::Execute( SfxRequest& rReq )
                 {
                     if (const SfxStringItem* pStringItem = dynamic_cast<const SfxStringItem*>(pItem))
                     {
-                        OUString aName = pStringItem->GetValue();
+                        const OUString& aName = pStringItem->GetValue();
                         SCTAB nTab;
                         if (m_aDocument.GetTable( aName, nTab ))
                         {
@@ -1445,7 +1445,7 @@ void ScDocShell::NotifyStyle( const SfxStyleSheetHint& rHint )
         {
             ScDocShellModificator aModificator( *this );
 
-            OUString aNewName = pStyle->GetName();
+            const OUString& aNewName = pStyle->GetName();
             OUString aOldName = aNewName;
             const SfxStyleSheetModifiedHint* pExtendedHint = dynamic_cast<const SfxStyleSheetModifiedHint*>(&rHint); // name changed?
             if (pExtendedHint)
@@ -1483,7 +1483,7 @@ void ScDocShell::NotifyStyle( const SfxStyleSheetHint& rHint )
     {
         if ( nId == SfxHintId::StyleSheetModified)
         {
-            OUString aNewName = pStyle->GetName();
+            const OUString& aNewName = pStyle->GetName();
             OUString aOldName = aNewName;
             const SfxStyleSheetModifiedHint* pExtendedHint = dynamic_cast<const SfxStyleSheetModifiedHint*>(&rHint);
             if (pExtendedHint)
diff --git a/sc/source/ui/docshell/documentlinkmgr.cxx b/sc/source/ui/docshell/documentlinkmgr.cxx
index e38ad8ad94e3..7452f87d3ce7 100644
--- a/sc/source/ui/docshell/documentlinkmgr.cxx
+++ b/sc/source/ui/docshell/documentlinkmgr.cxx
@@ -189,9 +189,9 @@ bool DocumentLinkManager::updateDdeOrOleOrWebServiceLinks(weld::Window* pWin)
         else
         {
             // Update failed.  Notify the user.
-            OUString aFile = pDdeLink->GetTopic();
-            OUString aElem = pDdeLink->GetItem();
-            OUString aType = pDdeLink->GetAppl();
+            const OUString& aFile = pDdeLink->GetTopic();
+            const OUString& aElem = pDdeLink->GetItem();
+            const OUString& aType = pDdeLink->GetAppl();
 
             OUStringBuffer aBuf;
             aBuf.append(ScResId(SCSTR_DDEDOC_NOT_LOADED));
diff --git a/sc/source/ui/docshell/servobj.cxx b/sc/source/ui/docshell/servobj.cxx
index 1b4190f95737..2470e3027ed0 100644
--- a/sc/source/ui/docshell/servobj.cxx
+++ b/sc/source/ui/docshell/servobj.cxx
@@ -229,7 +229,7 @@ void ScServerObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
             bDataChanged = true;
         else if (const ScAreaChangedHint *pChgHint = dynamic_cast<const ScAreaChangedHint*>(&rHint))      // position of broadcaster changed
         {
-            ScRange aNewRange = pChgHint->GetRange();
+            const ScRange& aNewRange = pChgHint->GetRange();
             if ( aRange != aNewRange )
             {
                 bRefreshListener = true;
diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx
index 24ccacac7041..41923ef3db05 100644
--- a/sc/source/ui/drawfunc/drawsh.cxx
+++ b/sc/source/ui/drawfunc/drawsh.cxx
@@ -325,7 +325,7 @@ void ScDrawShell::ExecuteMacroAssign( SdrObject* pObj, vcl::Window* pWin )
     if ( !pInfo->GetMacro().isEmpty() )
     {
         SvxMacroTableDtor aTab;
-        OUString sMacro = pInfo->GetMacro();
+        const OUString& sMacro = pInfo->GetMacro();
         aTab.Insert(SvMacroItemId::OnClick, SvxMacro(sMacro, OUString()));
         aItem.SetMacroTable( aTab );
     }
diff --git a/sc/source/ui/drawfunc/drawsh5.cxx b/sc/source/ui/drawfunc/drawsh5.cxx
index cc036a2bd5e4..81b9c310e3d6 100644
--- a/sc/source/ui/drawfunc/drawsh5.cxx
+++ b/sc/source/ui/drawfunc/drawsh5.cxx
@@ -81,7 +81,7 @@ void ScDrawShell::GetHLinkState( SfxItemSet& rSet )             //  Hyperlink
         SdrUnoObj* pUnoCtrl = dynamic_cast<SdrUnoObj*>( pObj );
         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() )
                 return;
@@ -167,7 +167,7 @@ void ScDrawShell::ExecuteHLink( const SfxRequest& rReq )
                             SdrUnoObj* pUnoCtrl = dynamic_cast<SdrUnoObj*>( pObj  );
                             if (pUnoCtrl && SdrInventor::FmForm == pUnoCtrl->GetObjInventor())
                             {
-                                uno::Reference<awt::XControlModel> xControlModel =
+                                const uno::Reference<awt::XControlModel>& xControlModel =
                                                         pUnoCtrl->GetUnoControlModel();
                                 OSL_ENSURE( xControlModel.is(), "UNO-Control without model" );
                                 if( !xControlModel.is() )
diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx
index 466e62ba4b5f..385fbbee115e 100644
--- a/sc/source/ui/drawfunc/drtxtob.cxx
+++ b/sc/source/ui/drawfunc/drtxtob.cxx
@@ -227,7 +227,7 @@ void ScDrawTextObjectBar::Execute( SfxRequest &rReq )
                     const SfxStringItem* pFontItem = dynamic_cast<const SfxStringItem*>( pFtItem  );
                     if ( pFontItem )
                     {
-                        OUString aFontName(pFontItem->GetValue());
+                        const OUString& aFontName(pFontItem->GetValue());
                         vcl::Font aFont(aFontName, Size(1,1)); // Size only because of CTOR
                         aNewItem = SvxFontItem( aFont.GetFamilyType(), aFont.GetFamilyName(),
                                     aFont.GetStyleName(), aFont.GetPitch(),
diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx
index 84551c0df9fc..0bbc619ca1da 100644
--- a/sc/source/ui/drawfunc/fuins1.cxx
+++ b/sc/source/ui/drawfunc/fuins1.cxx
@@ -320,7 +320,7 @@ FuInsertGraphic::FuInsertGraphic( ScTabViewShell&   rViewSh,
             if( nError == ERRCODE_NONE )
             {
                 OUString aFileName = aDlg.GetPath();
-                OUString aFilterName = aDlg.GetDetectedFilter();
+                const OUString& aFilterName = aDlg.GetDetectedFilter();
                 bool bAsLink = aDlg.IsAsLink();
 
                 // really store as link only?
diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx
index 6ac928a06401..cebad75e887f 100644
--- a/sc/source/ui/drawfunc/fuins2.cxx
+++ b/sc/source/ui/drawfunc/fuins2.cxx
@@ -241,7 +241,7 @@ FuInsertOLE::FuInsertOLE(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawView*
     const SfxGlobalNameItem* pNameItem = rReq.GetArg<SfxGlobalNameItem>(SID_INSERT_OBJECT);
     if ( nSlot == SID_INSERT_OBJECT && pNameItem )
     {
-        SvGlobalName aClassName = pNameItem->GetValue();
+        const SvGlobalName& aClassName = pNameItem->GetValue();
         xObj = rViewShell.GetViewFrame()->GetObjectShell()->GetEmbeddedObjectContainer().CreateEmbeddedObject( aClassName.GetByteSequence(), aName );
     }
     else if ( nSlot == SID_INSERT_SMATH )
diff --git a/sc/source/ui/drawfunc/graphsh.cxx b/sc/source/ui/drawfunc/graphsh.cxx
index c0368ee09b80..0cd455499f42 100644
--- a/sc/source/ui/drawfunc/graphsh.cxx
+++ b/sc/source/ui/drawfunc/graphsh.cxx
@@ -286,7 +286,7 @@ void ScGraphicShell::ExecuteSaveGraphic( SAL_UNUSED_PARAMETER SfxRequest& /*rReq
             }
             else if (nState == RET_NO)
             {
-                GraphicObject aGraphicObject(pObj->GetGraphicObject());
+                const GraphicObject& aGraphicObject(pObj->GetGraphicObject());
                 GraphicHelper::ExportGraphic(pWinFrame, aGraphicObject.GetGraphic(), "");
             }
         }
diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index 489a12de9739..7644e148620e 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -426,7 +426,7 @@ IMPL_LINK_NOARG(ScContentTree, ContentDoubleClickHdl, SvTreeListBox*, bool)
                 const ScAreaLink* pLink = GetLink( nChild );
                 if( pLink )
                 {
-                    ScRange aRange = pLink->GetDestArea();
+                    const ScRange& aRange = pLink->GetDestArea();
                     ScDocument* pSrcDoc = GetSourceDocument();
                     OUString aRangeStr(aRange.Format(ScRefFlags::RANGE_ABS_3D, pSrcDoc, pSrcDoc->GetAddressConvention()));
                     pParentWindow->SetCurrentCellStr( aRangeStr );
diff --git a/sc/source/ui/navipi/navcitem.cxx b/sc/source/ui/navipi/navcitem.cxx
index f69e9b8799f5..976fca594264 100644
--- a/sc/source/ui/navipi/navcitem.cxx
+++ b/sc/source/ui/navipi/navcitem.cxx
@@ -47,7 +47,7 @@ void ScNavigatorControllerItem::StateChanged( sal_uInt16 /* nSID */, SfxItemStat
 
                 if ( pCellPosItem )
                 {
-                    OUString  aAddress( pCellPosItem->GetValue() );
+                    const OUString&  aAddress( pCellPosItem->GetValue() );
                     ScAddress aScAddress;
                     aScAddress.Parse( aAddress );
 
diff --git a/sc/source/ui/navipi/scenwnd.cxx b/sc/source/ui/navipi/scenwnd.cxx
index 95adccac53ad..df63657f8e7d 100644
--- a/sc/source/ui/navipi/scenwnd.cxx
+++ b/sc/source/ui/navipi/scenwnd.cxx
@@ -256,7 +256,7 @@ void ScScenarioWindow::NotifyState( const SfxPoolItem* pState )
 
         if ( auto pStringItem = dynamic_cast<const SfxStringItem*>( pState) )
         {
-            OUString aNewEntry( pStringItem->GetValue() );
+            const OUString& aNewEntry( pStringItem->GetValue() );
 
             if ( !aNewEntry.isEmpty() )
                 aLbScenario->SelectEntry( aNewEntry );
diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx
index 47f251e50215..28eb0ab05ffc 100644
--- a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx
+++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx
@@ -246,7 +246,7 @@ void NumberFormatPropertyPanel::NotifyItemUpdate(
             if( eState >= SfxItemState::DEFAULT)
             {
                 const SfxStringItem* pItem = static_cast<const SfxStringItem*>(pState);
-                OUString aCode = pItem->GetValue();
+                const OUString& aCode = pItem->GetValue();
                 sal_Int32 nIndex = 0;
                 sal_Int32 aFormat[4] = {0};
                 for (sal_Int32 & rn : aFormat)
diff --git a/sc/source/ui/unoobj/ChartTools.cxx b/sc/source/ui/unoobj/ChartTools.cxx
index c74263697442..6647e10a2aaa 100644
--- a/sc/source/ui/unoobj/ChartTools.cxx
+++ b/sc/source/ui/unoobj/ChartTools.cxx
@@ -39,7 +39,7 @@ getPivotTableDataProvider(const SdrOle2Obj* pOleObject)
 {
     uno::Reference<chart2::data::XPivotTableDataProvider> xPivotTableDataProvider;
 
-    uno::Reference<embed::XEmbeddedObject> xObject = pOleObject->GetObjRef();
+    const uno::Reference<embed::XEmbeddedObject>& xObject = pOleObject->GetObjRef();
     if (xObject.is())
     {
         uno::Reference<chart2::XChartDocument> xChartDoc(xObject->getComponent(), uno::UNO_QUERY);
diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx
index f7bf1d0cbcf3..3a56fb138e25 100644
--- a/sc/source/ui/unoobj/dapiuno.cxx
+++ b/sc/source/ui/unoobj/dapiuno.cxx
@@ -344,8 +344,7 @@ ScDataPilotTableObj* ScDataPilotTablesObj::GetObjectByIndex_Impl( sal_Int32 nInd
                 {
                     if ( nFound == nIndex )
                     {
-                        OUString aName = rDPObj.GetName();
-                        return new ScDataPilotTableObj( pDocShell, nTab, aName );
+                        return new ScDataPilotTableObj( pDocShell, nTab, rDPObj.GetName() );
                     }
                     ++nFound;
                 }
@@ -2538,7 +2537,7 @@ Reference< XDataPilotField > SAL_CALL ScDataPilotFieldObj::createNameGroup( cons
     ScDPObject* pDPObj = nullptr;
     if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
     {
-        OUString aDimName = pDim->GetName();
+        const OUString& aDimName = pDim->GetName();
 
         ScDPSaveData aSaveData = *pDPObj->GetSaveData();
         ScDPDimensionSaveData* pDimData = aSaveData.GetDimensionData();     // created if not there
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 10c2220c22f1..ef5aca3f7950 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -2591,8 +2591,7 @@ uno::Any SAL_CALL ScModelObj::getPropertyValue( const OUString& aPropertyName )
         }
         else if ( aPropertyName == SC_UNO_CODENAME )
         {
-            OUString sCodeName = rDoc.GetCodeName();
-            aRet <<= sCodeName;
+            aRet <<= rDoc.GetCodeName();
         }
 
         else if ( aPropertyName == SC_UNO_CJK_CLOCAL )
diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx
index 6e5ff6f8a154..08bdca0627fb 100644
--- a/sc/source/ui/unoobj/styleuno.cxx
+++ b/sc/source/ui/unoobj/styleuno.cxx
@@ -1870,7 +1870,7 @@ uno::Any ScStyleObj::getPropertyValue_Impl( const OUString& aPropertyName )
                         break;
                     case ATTR_PAGE_SCALETO:
                         {
-                            ScPageScaleToItem aItem(pItemSet->Get(ATTR_PAGE_SCALETO));
+                            const ScPageScaleToItem& aItem(pItemSet->Get(ATTR_PAGE_SCALETO));
                             if ( aPropertyName == SC_UNO_PAGE_SCALETOX )
                                 aAny <<= static_cast<sal_Int16>(aItem.GetWidth());
                             else
diff --git a/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx
index fb1a4e2401f4..70fca984f82d 100644
--- a/sc/source/ui/vba/vbaapplication.cxx
+++ b/sc/source/ui/vba/vbaapplication.cxx
@@ -927,7 +927,7 @@ static uno::Reference< util::XPathSettings > const & lcl_getPathSettingsService(
 OUString ScVbaApplication::getOfficePath( const OUString& _sPathType )
 {
     OUString sRetPath;
-    uno::Reference< util::XPathSettings > xProps = lcl_getPathSettingsService( mxContext );
+    const uno::Reference< util::XPathSettings >& xProps = lcl_getPathSettingsService( mxContext );
     try
     {
         OUString sUrl;
@@ -949,7 +949,7 @@ OUString ScVbaApplication::getOfficePath( const OUString& _sPathType )
 void SAL_CALL
 ScVbaApplication::setDefaultFilePath( const OUString& DefaultFilePath )
 {
-    uno::Reference< util::XPathSettings > xProps = lcl_getPathSettingsService( mxContext );
+    const uno::Reference< util::XPathSettings >& xProps = lcl_getPathSettingsService( mxContext );
     OUString aURL;
     osl::FileBase::getFileURLFromSystemPath( DefaultFilePath, aURL );
     xProps->setWork( aURL );
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index 2c2fd50ccbab..fafee6815e70 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -278,7 +278,7 @@ void ScVbaRange::fireChangeEvent()
     if( ScVbaApplication::getDocumentEventsEnabled() )
     {
         ScDocument& rDoc = getScDocument();
-        uno::Reference< script::vba::XVBAEventProcessor > xVBAEvents = rDoc.GetVbaEventProcessor();
+        const uno::Reference< script::vba::XVBAEventProcessor >& xVBAEvents = rDoc.GetVbaEventProcessor();
         if( xVBAEvents.is() ) try
         {
             uno::Sequence< uno::Any > aArgs( 1 );
@@ -1532,7 +1532,7 @@ ScVbaRange::setValue( const uno::Any& aValue, ValueSetter& valueSetter )
     uno::TypeClass aClass = aValue.getValueTypeClass();
     if ( aClass == uno::TypeClass_SEQUENCE )
     {
-        uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( mxContext );
+        const uno::Reference< script::XTypeConverter >& xConverter = getTypeConverter( mxContext );
         uno::Any aConverted;
         try
         {
@@ -1957,7 +1957,7 @@ ScVbaRange::getFormulaArray()
         return uno::makeAny( xFormulaArray->getArrayFormula() );
 
     uno::Reference< sheet::XCellRangeFormula> xCellRangeFormula( mxRange, uno::UNO_QUERY_THROW );
-    uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( mxContext );
+    const uno::Reference< script::XTypeConverter >& xConverter = getTypeConverter( mxContext );
     uno::Any aSingleValueOrMatrix;
     // When dealing with a single element ( embedded in the sequence of sequence ) unwrap and return
     // that value
@@ -2167,7 +2167,7 @@ ScVbaRange::CellsHelper( const uno::Reference< ov::XHelperInterface >& xParent,
     // conversion routine e.g. bSuccess = getValueFromAny( nRow, nRowIndex, cppu::UnoType<sal_Int32>::get() )
     if ( nRowIndex.hasValue() && !( nRowIndex >>= nRow ) )
     {
-        uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( xContext );
+        const uno::Reference< script::XTypeConverter >& xConverter = getTypeConverter( xContext );
         uno::Any aConverted;
         try
         {
@@ -2194,7 +2194,7 @@ ScVbaRange::CellsHelper( const uno::Reference< ov::XHelperInterface >& xParent,
         {
             if ( !( nColumnIndex >>= nColumn ) )
             {
-                uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( xContext );
+                const uno::Reference< script::XTypeConverter >& xConverter = getTypeConverter( xContext );
                 uno::Any aConverted;
                 try
                 {
@@ -4463,7 +4463,7 @@ ScVbaRange::AutoFilter( const uno::Any& aField, const uno::Any& Criteria1, const
     uno::Any Field( aField );
     if ( !( Field >>= nField ) )
     {
-        uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( mxContext );
+        const uno::Reference< script::XTypeConverter >& xConverter = getTypeConverter( mxContext );
         try
         {
             Field = xConverter->convertTo( aField, cppu::UnoType<sal_Int32>::get() );
diff --git a/sc/source/ui/vba/vbaworksheets.cxx b/sc/source/ui/vba/vbaworksheets.cxx
index 81870ab6a3a6..681989b05309 100644
--- a/sc/source/ui/vba/vbaworksheets.cxx
+++ b/sc/source/ui/vba/vbaworksheets.cxx
@@ -432,7 +432,7 @@ ScVbaWorksheets::Item(const uno::Any& Index, const uno::Any& Index2)
 {
     if ( Index.getValueTypeClass() == uno::TypeClass_SEQUENCE )
     {
-        uno::Reference< script::XTypeConverter > xConverter = getTypeConverter(mxContext);
+        const uno::Reference< script::XTypeConverter >& xConverter = getTypeConverter(mxContext);
         uno::Any aConverted;
         aConverted = xConverter->convertTo( Index, cppu::UnoType<uno::Sequence< uno::Any >>::get() );
         SheetMap aSheets;
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index c5060b3e5ecd..432469836a38 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -2397,7 +2397,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
             if ( pReqArgs && pReqArgs->HasItem( SID_ATTR_POSTIT_ID, &pId) )
             {
                 const SvxPostItIdItem* pIdItem = static_cast<const SvxPostItIdItem*>(pId);
-                OUString aCellId = pIdItem->GetValue();
+                const OUString& aCellId = pIdItem->GetValue();
                 if (!aCellId.isEmpty())
                 {
                     SetTabNoAndCursor( GetViewData(), aCellId );
diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx
index 2a2956a0fa8d..f62eecd2b881 100644
--- a/sc/source/ui/view/cellsh3.cxx
+++ b/sc/source/ui/view/cellsh3.cxx
@@ -235,8 +235,8 @@ void ScCellShell::Execute( SfxRequest& rReq )
                     = static_cast<const ScInputStatusItem*>(&pReqArgs->
                             Get( FID_INPUTLINE_STATUS ));
 
-                ScAddress aCursorPos = pStatusItem->GetPos();
-                OUString aString = pStatusItem->GetString();
+                const ScAddress& aCursorPos = pStatusItem->GetPos();
+                const OUString& aString = pStatusItem->GetString();
                 const EditTextObject* pData = pStatusItem->GetEditData();
 
                 if (pData)
diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx
index ef904f54b97f..7eb67508d795 100644
--- a/sc/source/ui/view/drawvie4.cxx
+++ b/sc/source/ui/view/drawvie4.cxx
@@ -176,7 +176,7 @@ void getRangeFromOle2Object(const SdrOle2Obj& rObj, std::vector<OUString>& rRang
         // not a chart object.
         return;
 
-    uno::Reference<embed::XEmbeddedObject> xObj = rObj.GetObjRef();
+    const uno::Reference<embed::XEmbeddedObject>& xObj = rObj.GetObjRef();
     if (!xObj.is())
         return;
 
diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx
index dc13c9192493..3882c0d73842 100644
--- a/sc/source/ui/view/drawview.cxx
+++ b/sc/source/ui/view/drawview.cxx
@@ -482,7 +482,7 @@ void ScDrawView::MarkListHasChanged()
     uno::Sequence< embed::VerbDescriptor > aVerbs;
     if ( pOle2Obj && !bOle )
     {
-        uno::Reference < embed::XEmbeddedObject > xObj = pOle2Obj->GetObjRef();
+        const uno::Reference < embed::XEmbeddedObject >& xObj = pOle2Obj->GetObjRef();
         OSL_ENSURE( xObj.is(), "SdrOle2Obj without ObjRef" );
         if (xObj.is())
             aVerbs = xObj->getSupportedVerbs();
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index 8e0cd5593ad2..94bd48e87301 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -406,7 +406,7 @@ void ScEditShell::Execute( SfxRequest& rReq )
                     const SfxStringItem* pFontItem = dynamic_cast<const SfxStringItem*>( pFtItem  );
                     if ( pFontItem )
                     {
-                        OUString aFontName(pFontItem->GetValue());
+                        const OUString& aFontName(pFontItem->GetValue());
                         vcl::Font aFont(aFontName, Size(1,1)); // Size just because CTOR
                         aNewItem = SvxFontItem( aFont.GetFamilyType(), aFont.GetFamilyName(),
                                     aFont.GetStyleName(), aFont.GetPitch(),
@@ -535,7 +535,7 @@ void ScEditShell::Execute( SfxRequest& rReq )
                     aFinder.ToggleRel( aSel.nStartPos, aSel.nEndPos );
                     if (aFinder.GetFound())
                     {
-                        OUString aNew = aFinder.GetText();
+                        const OUString& aNew = aFinder.GetText();
                         ESelection aNewSel( 0,aFinder.GetSelStart(), 0,aFinder.GetSelEnd() );
                         pEngine->SetText( aNew );
                         pTableView->SetSelection( aNewSel );
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index 4b9e14c3c59a..d931d387af3b 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -1965,7 +1965,7 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq )
             // ATTR_BACKGROUND (=SID_ATTR_BRUSH) has to be set to two IDs:
             case SID_BACKGROUND_COLOR:
                 {
-                    const SvxColorItem  rNewColorItem = pNewAttrs->Get( SID_BACKGROUND_COLOR );
+                    const SvxColorItem&  rNewColorItem = pNewAttrs->Get( SID_BACKGROUND_COLOR );
 
                     SvxBrushItem        aBrushItem(
                                             pTabViewShell->GetSelectionPattern()->
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index efabe0d9a64a..00a83cd77b00 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -4448,7 +4448,7 @@ void ScGridWindow::PasteSelection( const Point& rPosPixel )
         //  get selection from system
 
         TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSelection( this ) );
-        uno::Reference<datatransfer::XTransferable> xTransferable = aDataHelper.GetTransferable();
+        const uno::Reference<datatransfer::XTransferable>& xTransferable = aDataHelper.GetTransferable();
         if ( xTransferable.is() )
         {
             SotClipboardFormatId nFormatId = lcl_GetDropFormatId( xTransferable, true );
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index a9023e063411..741e672158bf 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -2007,7 +2007,7 @@ tools::Rectangle ScOutputData::LayoutStrings(bool bPixelToLogic, bool bPaint, co
                         // in Metafiles always use DrawTextArray to ensure that positions are
                         // recorded (for non-proportional resize):
 
-                        OUString aString = aVars.GetString();
+                        const OUString& aString = aVars.GetString();
                         if (!aString.isEmpty())
                         {
                             // If the string is clipped, make it shorter for
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 2fef51b340c7..169198177664 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -3047,7 +3047,7 @@ void ScViewFunc::HideTable( const ScMarkData& rMark )
         ScMarkData::MarkedTabsType::const_iterator it;
         std::vector<SCTAB> undoTabs;
 
-        ScMarkData::MarkedTabsType selectedTabs = rMark.GetSelectedTabs();
+        const ScMarkData::MarkedTabsType& selectedTabs = rMark.GetSelectedTabs();
         for (it=selectedTabs.begin(); it!=selectedTabs.end(); ++it)
         {
             nTab = *it;
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index 28413a8a7c35..7d6411c82e3b 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -461,7 +461,7 @@ void ScViewFunc::PasteDraw()
     const ScDrawTransferObj* pDrawClip = ScDrawTransferObj::GetOwnClipboard(ScTabViewShell::GetClipData(rViewData.GetActiveWin()));
     if (pDrawClip)
     {
-        OUString aSrcShellID = pDrawClip->GetShellID();
+        const OUString& aSrcShellID = pDrawClip->GetShellID();
         OUString aDestShellID = SfxObjectShell::CreateShellID(rViewData.GetDocShell());
         PasteDraw(aPos, pDrawClip->GetModel(), false, aSrcShellID, aDestShellID);
     }
diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx
index 25e8fb0b18cf..4babeeeedc3d 100644
--- a/sc/source/ui/view/viewfun4.cxx
+++ b/sc/source/ui/view/viewfun4.cxx
@@ -268,7 +268,7 @@ void ScViewFunc::DoRefConversion()
                 if (aFinder.GetFound())
                 {
                     ScAddress aPos = pCell->aPos;
-                    OUString aNew = aFinder.GetText();
+                    const OUString& aNew = aFinder.GetText();
                     ScCompiler aComp( pDoc, aPos, pDoc->GetGrammar());
                     std::unique_ptr<ScTokenArray> pArr(aComp.CompileString(aNew));
                     ScFormulaCell* pNewCell =
commit f31c9f16fefd16ea434cdd68721d45bced9b78e1
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Oct 23 09:47:38 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Oct 24 08:37:51 2018 +0200

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

diff --git a/test/source/beans/xpropertyset.cxx b/test/source/beans/xpropertyset.cxx
index 63969e844005..2da14e7cdf6d 100644
--- a/test/source/beans/xpropertyset.cxx
+++ b/test/source/beans/xpropertyset.cxx
@@ -76,7 +76,7 @@ bool XPropertySet::isPropertyValueChangeable(const OUString& rName)
     try
     {
         uno::Any any = xPropSet->getPropertyValue(rName);
-        uno::Type type = any.getValueType();
+        const uno::Type& type = any.getValueType();
         if (type == cppu::UnoType<bool>::get())
         {
             // boolean type
diff --git a/test/source/mtfxmldump.cxx b/test/source/mtfxmldump.cxx
index b298f736f57f..e54c78c5f1d6 100644
--- a/test/source/mtfxmldump.cxx
+++ b/test/source/mtfxmldump.cxx
@@ -541,7 +541,6 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, tools::XmlWriter& r
                 writeStartPoint(rWriter, pMetaLineAction->GetStartPoint());
                 writeEndPoint(rWriter, pMetaLineAction->GetEndPoint());
 
-                LineInfo aLineInfo = pMetaLineAction->GetLineInfo();
                 writeLineInfo(rWriter, pMetaLineAction->GetLineInfo());
                 rWriter.endElement();
             }
diff --git a/test/source/primitive2dxmldump.cxx b/test/source/primitive2dxmldump.cxx
index 4f5c63ed54a9..fa2b02d4e2cf 100644
--- a/test/source/primitive2dxmldump.cxx
+++ b/test/source/primitive2dxmldump.cxx
@@ -127,7 +127,7 @@ void Primitive2dXmlDump::decomposeAndWrite(
 
                 rWriter.startElement("polypolygoncolor");
                 rWriter.attribute("color", convertColorToString(rPolyPolygonColorPrimitive2D.getBColor()));
-                const basegfx::B2DPolyPolygon aB2DPolyPolygon(rPolyPolygonColorPrimitive2D.getB2DPolyPolygon());
+                const basegfx::B2DPolyPolygon& aB2DPolyPolygon(rPolyPolygonColorPrimitive2D.getB2DPolyPolygon());
                 const basegfx::B2DRange aB2DRange(aB2DPolyPolygon.getB2DRange());
                 rWriter.attribute("height", aB2DRange.getHeight());
                 rWriter.attribute("width", aB2DRange.getWidth());
@@ -148,7 +148,7 @@ void Primitive2dXmlDump::decomposeAndWrite(
                 rWriter.startElement("polypolygonstroke");
 
                 rWriter.startElement("line");
-                drawinglayer::attribute::LineAttribute aLineAttribute = rPolyPolygonStrokePrimitive2D.getLineAttribute();
+                const drawinglayer::attribute::LineAttribute& aLineAttribute = rPolyPolygonStrokePrimitive2D.getLineAttribute();
                 rWriter.attribute("color", convertColorToString(aLineAttribute.getColor()));
                 rWriter.attribute("width", aLineAttribute.getWidth());
                 //rWriter.attribute("linejoin", aLineAttribute.getLineJoin());
@@ -197,7 +197,7 @@ void Primitive2dXmlDump::decomposeAndWrite(
                 rWriter.attribute("text", rTextSimplePortionPrimitive2D.getText());
                 rWriter.attribute("fontcolor", convertColorToString(rTextSimplePortionPrimitive2D.getFontColor()));
 
-                drawinglayer::attribute::FontAttribute aFontAttribute = rTextSimplePortionPrimitive2D.getFontAttribute();
+                const drawinglayer::attribute::FontAttribute& aFontAttribute = rTextSimplePortionPrimitive2D.getFontAttribute();
                 rWriter.attribute("familyname", aFontAttribute.getFamilyName());
                 rWriter.endElement();
             }
diff --git a/tools/source/generic/poly2.cxx b/tools/source/generic/poly2.cxx
index 7521af3073c1..12d9cb96907d 100644
--- a/tools/source/generic/poly2.cxx
+++ b/tools/source/generic/poly2.cxx
@@ -480,7 +480,7 @@ ImplPolyPolygon::ImplPolyPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon)
 
         for(sal_uInt16 a(0); a < nCount; a++)
         {
-            basegfx::B2DPolygon aCandidate(rPolyPolygon.getB2DPolygon(sal_uInt32(a)));
+            const basegfx::B2DPolygon& aCandidate(rPolyPolygon.getB2DPolygon(sal_uInt32(a)));
             mvPolyAry[a] = tools::Polygon( aCandidate );
         }
     }
diff --git a/ucb/source/ucp/file/bc.cxx b/ucb/source/ucp/file/bc.cxx
index 579c9c8cd308..3b65f7117850 100644
--- a/ucb/source/ucp/file/bc.cxx
+++ b/ucb/source/ucp/file/bc.cxx
@@ -1127,7 +1127,7 @@ void BaseContent::insert( sal_Int32 nMyCommandIdentifier,
                         RTL_TEXTENCODING_UTF8),
                     static_cast<cppu::OWeakObject*>(this),
                     m_pMyShell,nMyCommandIdentifier);
-            uno::Reference<task::XInteractionRequest> const xReq(aRequestImpl.getRequest());
+            uno::Reference<task::XInteractionRequest> const& xReq(aRequestImpl.getRequest());
 
             m_pMyShell->handleTask( nMyCommandIdentifier, xReq );
             if (aRequestImpl.aborted() || aRequestImpl.newName().isEmpty())
diff --git a/ucb/source/ucp/ftp/ftpcontent.cxx b/ucb/source/ucp/ftp/ftpcontent.cxx
index a07e626edb07..5279a74aa1b2 100644
--- a/ucb/source/ucp/ftp/ftpcontent.cxx
+++ b/ucb/source/ucp/ftp/ftpcontent.cxx
@@ -717,7 +717,7 @@ void FTPContent::insert(const InsertCommandArgument& aInsertCommand,
             }
 
             XInteractionRequestImpl request;
-            Reference<XInteractionRequest> xReq(request.getRequest());
+            const Reference<XInteractionRequest>& xReq(request.getRequest());
             xInt->handle(xReq);
             if (request.approved()) {
                 bReplace = true;
diff --git a/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx b/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx
index bf28bb1b0c41..dcff8c710e77 100644
--- a/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx
+++ b/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx
@@ -1021,7 +1021,7 @@ void DAVResourceAccess::initialize()
     if ( m_aPath.isEmpty() )
     {
         NeonUri aURI( m_aURL );
-        OUString aPath( aURI.GetPath() );
+        const OUString& aPath( aURI.GetPath() );
 
         /* #134089# - Check URI */
         if ( aPath.isEmpty() )
diff --git a/ucb/source/ucp/webdav-neon/NeonSession.cxx b/ucb/source/ucp/webdav-neon/NeonSession.cxx
index 28ed1b17c43b..57ffe1002026 100644
--- a/ucb/source/ucp/webdav-neon/NeonSession.cxx
+++ b/ucb/source/ucp/webdav-neon/NeonSession.cxx
@@ -294,7 +294,7 @@ int NeonSession::NeonAuth(const char* inAuthProtocol, const char* inRealm,
         try
         {
             NeonUri uri( getRequestEnvironment().m_aRequestURI );
-            OUString aUserInfo( uri.GetUserInfo() );
+            const OUString& aUserInfo( uri.GetUserInfo() );
             if ( !aUserInfo.isEmpty() )
             {
                 sal_Int32 nPos = aUserInfo.indexOf( '@' );
diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
index 247b75f990e8..86cac8850bce 100644
--- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
@@ -3849,7 +3849,7 @@ Content::ResourceType Content::getResourceType(
                 {
                     // extract host name and connection port
                     NeonUri   theUri( rURL );
-                    OUString  aHostName  = theUri.GetHost();
+                    const OUString&  aHostName  = theUri.GetHost();
                     sal_Int32 nPort      = theUri.GetPort();
                     throw DAVException( DAVException::DAV_HTTP_TIMEOUT,
                                         NeonUri::makeConnectionEndPointString( aHostName,
diff --git a/ucbhelper/source/client/interceptedinteraction.cxx b/ucbhelper/source/client/interceptedinteraction.cxx
index 69aab5110ab5..afc2f3bf9576 100644
--- a/ucbhelper/source/client/interceptedinteraction.cxx
+++ b/ucbhelper/source/client/interceptedinteraction.cxx
@@ -100,7 +100,7 @@ void InterceptedInteraction::impl_handleDefault(const css::uno::Reference< css::
 InterceptedInteraction::EInterceptionState InterceptedInteraction::impl_interceptRequest(const css::uno::Reference< css::task::XInteractionRequest >& xRequest)
 {
     css::uno::Any                                                                    aRequest       = xRequest->getRequest();
-    css::uno::Type                                                                   aRequestType   = aRequest.getValueType();
+    const css::uno::Type&                                                            aRequestType   = aRequest.getValueType();
     css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > lContinuations = xRequest->getContinuations();
 
     // check against the list of static requests
diff --git a/unodevtools/source/skeletonmaker/javacompskeleton.cxx b/unodevtools/source/skeletonmaker/javacompskeleton.cxx
index f64a341e0d9b..741387cfe120 100644
--- a/unodevtools/source/skeletonmaker/javacompskeleton.cxx
+++ b/unodevtools/source/skeletonmaker/javacompskeleton.cxx
@@ -492,8 +492,7 @@ static void generateMethodBodies(std::ostream& o,
          const OString& indentation, bool usepropertymixin)
 {
     codemaker::GeneratedTypeSet generated;
-    for (const auto& rIface : interfaces) {
-        OUString type(rIface);
+    for (const OUString& type : interfaces) {
         if (type == "com.sun.star.lang.XServiceInfo") {
             generateXServiceInfoBodies(o);
             generated.add(u2b(type));
diff --git a/unotools/source/config/fontcfg.cxx b/unotools/source/config/fontcfg.cxx
index 365cea68450b..89f9ab5094cb 100644
--- a/unotools/source/config/fontcfg.cxx
+++ b/unotools/source/config/fontcfg.cxx
@@ -292,7 +292,7 @@ OUString DefaultFontConfiguration::getUserInterfaceFont( const LanguageTag& rLan
     }
     else
     {
-        Locale aLocale( aLanguageTag.getLocale());
+        const Locale& aLocale( aLanguageTag.getLocale());
         if (MsLangId::isTraditionalChinese(aLocale))
             return OUString(FALLBACKFONT_UI_SANS_CHINTRD);
         else if (MsLangId::isSimplifiedChinese(aLocale))
diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx
index 8b4782730784..b9b4b78a85c2 100644
--- a/unotools/source/i18n/localedatawrapper.cxx
+++ b/unotools/source/i18n/localedatawrapper.cxx
@@ -507,7 +507,7 @@ bool LocaleDataWrapper::doesSecondaryCalendarUseEC( const OUString& rName ) cons
 
     // Check language tag first to avoid loading all calendars of this locale.
     LanguageTag aLoaded( getLoadedLanguageTag());
-    OUString aBcp47( aLoaded.getBcp47());
+    const OUString& aBcp47( aLoaded.getBcp47());
     // So far determine only by locale, we know for a few.
     /* TODO: check date format codes? or add to locale data? */
     if (    aBcp47 != "ja-JP" &&
diff --git a/unotools/source/misc/ZipPackageHelper.cxx b/unotools/source/misc/ZipPackageHelper.cxx
index 4d4720417823..21388015a01b 100644
--- a/unotools/source/misc/ZipPackageHelper.cxx
+++ b/unotools/source/misc/ZipPackageHelper.cxx
@@ -158,19 +158,12 @@ void ZipPackageHelper::addFolderWithContent( Reference< XInterface > const & xRo
 }
 
 void ZipPackageHelper::addFile( css::uno::Reference< css::uno::XInterface > const & xRootFolder,
-                                const OUString& rSourceFile )
+                                const OUString& rSourceFileURL )
 {
-    OUString aFileURL( rSourceFile );
-
-    /*if( !aFileURL.matchIgnoreAsciiCase("file://") )
-    {
-        aFileURL = URIHelper::SmartRel2Abs( aFileURL, Link<OUString *, bool>(), false );
-    }*/
-
-    INetURLObject aURL( aFileURL );
+    INetURLObject aURL( rSourceFileURL );
     OUString aName( aURL.getName() );
 
-    SvFileStream* pStream = new SvFileStream(aFileURL, StreamMode::READ );
+    SvFileStream* pStream = new SvFileStream(rSourceFileURL, StreamMode::READ );
     Reference< XInputStream > xInput(  new utl::OSeekableInputStreamWrapper( pStream, true ) );
     Reference< XActiveDataSink > xSink( mxFactory->createInstance(), UNO_QUERY );
     Reference< XUnoTunnel > xTunnel( xSink, UNO_QUERY );
diff --git a/unoxml/source/dom/document.cxx b/unoxml/source/dom/document.cxx
index 2ba945fb7efa..c05e0a0b6b21 100644
--- a/unoxml/source/dom/document.cxx
+++ b/unoxml/source/dom/document.cxx
@@ -376,8 +376,7 @@ namespace DOM
         }
 
         // notify listeners about start
-        for (const auto& rStreamListener : streamListeners) {
-            Reference< XStreamListener > aListener = rStreamListener;
+        for (const Reference< XStreamListener >& aListener : streamListeners) {
             aListener->started();
         }
 
@@ -395,8 +394,7 @@ namespace DOM
         }
 
         // call listeners
-        for (const auto& rStreamListener : streamListeners) {
-            Reference< XStreamListener > aListener = rStreamListener;
+        for (const Reference< XStreamListener >& aListener : streamListeners) {
             aListener->closed();
         }
     }
diff --git a/vbahelper/source/vbahelper/vbashapes.cxx b/vbahelper/source/vbahelper/vbashapes.cxx
index 6d5849e91251..3a0137bb0656 100644
--- a/vbahelper/source/vbahelper/vbashapes.cxx
+++ b/vbahelper/source/vbahelper/vbashapes.cxx
@@ -140,7 +140,7 @@ ScVbaShapes::getShapesByArrayIndices( const uno::Any& Index  )
     if ( Index.getValueTypeClass() != uno::TypeClass_SEQUENCE )
         throw uno::RuntimeException();
 
-    uno::Reference< script::XTypeConverter > xConverter = getTypeConverter(mxContext);
+    const uno::Reference< script::XTypeConverter >& xConverter = getTypeConverter(mxContext);
     uno::Any aConverted;
     aConverted = xConverter->convertTo( Index, cppu::UnoType<uno::Sequence< uno::Any >>::get() );
 
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 52fe3b483573..170476de444f 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -2256,9 +2256,8 @@ void RadioButton::ImplUncheckAllOther()
 
     std::vector<VclPtr<RadioButton> > aGroup(GetRadioButtonGroup(false));
     // iterate over radio button group and checked buttons
-    for (auto const& elem : aGroup)
+    for (VclPtr<RadioButton>& pWindow : aGroup)
     {
-        VclPtr<RadioButton> pWindow = elem;
         if ( pWindow->IsChecked() )
         {
             pWindow->SetState( false );
diff --git a/vcl/source/control/notebookbar.cxx b/vcl/source/control/notebookbar.cxx
index 5c8fed1fee15..76ebd74c3ad5 100644
--- a/vcl/source/control/notebookbar.cxx
+++ b/vcl/source/control/notebookbar.cxx
@@ -193,7 +193,7 @@ void NotebookBar::StateChanged(const  StateChangedType nStateChange )
 void NotebookBar::UpdateBackground()
 {
     const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
-    const BitmapEx aPersona = rStyleSettings.GetPersonaHeader();
+    const BitmapEx& aPersona = rStyleSettings.GetPersonaHeader();
         Wallpaper aWallpaper(aPersona);
         aWallpaper.SetStyle(WallpaperStyle::TopRight);
     if (!aPersona.IsEmpty())
diff --git a/vcl/source/filter/wmf/emfwr.cxx b/vcl/source/filter/wmf/emfwr.cxx
index 914b8a8c1cd6..d03b6448a249 100644
--- a/vcl/source/filter/wmf/emfwr.cxx
+++ b/vcl/source/filter/wmf/emfwr.cxx
@@ -1206,7 +1206,7 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
             case MetaActionType::EPS:
             {
                 const MetaEPSAction*    pA = static_cast<const MetaEPSAction*>(pAction);
-                const GDIMetaFile       aSubstitute( pA->GetSubstitute() );
+                const GDIMetaFile&      aSubstitute( pA->GetSubstitute() );
 
                 for( size_t i = 0, nCount = aSubstitute.GetActionSize(); i < nCount; i++ )
                 {
@@ -1328,7 +1328,7 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
             case MetaActionType::TEXTRECT:
             {
                 const MetaTextRectAction*   pA = static_cast<const MetaTextRectAction*>(pAction);
-                const OUString              aText( pA->GetText() );
+                const OUString&             aText( pA->GetText() );
 
                 ImplCheckTextAttr();
                 ImplWriteTextRecord( pA->GetRect().TopLeft(), aText, nullptr, 0 );
diff --git a/vcl/source/filter/wmf/wmfwr.cxx b/vcl/source/filter/wmf/wmfwr.cxx
index 9ba9c2b91161..ef3545b5f511 100644
--- a/vcl/source/filter/wmf/wmfwr.cxx
+++ b/vcl/source/filter/wmf/wmfwr.cxx
@@ -1398,7 +1398,7 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
                     {
                         if( pA->GetMapMode().GetMapUnit() == MapUnit::MapRelative )
                         {
-                            MapMode aMM = pA->GetMapMode();
+                            const MapMode& aMM = pA->GetMapMode();
                             Fraction aScaleX = aMM.GetScaleX();
                             Fraction aScaleY = aMM.GetScaleY();
 
@@ -1526,7 +1526,7 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
                 case MetaActionType::EPS :
                 {
                     const MetaEPSAction* pA = static_cast<const MetaEPSAction*>(pMA);
-                    const GDIMetaFile aGDIMetaFile( pA->GetSubstitute() );
+                    const GDIMetaFile& aGDIMetaFile( pA->GetSubstitute() );
 
                     size_t nCount = aGDIMetaFile.GetActionSize();
                     for ( size_t i = 0; i < nCount; i++ )
diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx
index 29c9ac4bbeab..cb9493f45037 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -70,7 +70,7 @@ GenericSalLayout::~GenericSalLayout()
 void GenericSalLayout::ParseFeatures(const OUString& aName)
 {
     vcl::font::FeatureParser aParser(aName);
-    OUString sLanguage = aParser.getLanguage();
+    const OUString& sLanguage = aParser.getLanguage();
     if (!sLanguage.isEmpty())
         msLanguage = OUStringToOString(sLanguage, RTL_TEXTENCODING_ASCII_US);
 
diff --git a/vcl/source/gdi/bmpacc.cxx b/vcl/source/gdi/bmpacc.cxx
index d180d8600d1d..ba7a1923e4ca 100644
--- a/vcl/source/gdi/bmpacc.cxx
+++ b/vcl/source/gdi/bmpacc.cxx
@@ -86,7 +86,7 @@ BitmapReadAccess::BitmapReadAccess( Bitmap& rBitmap, BitmapAccessMode nMode ) :
     if (!mpBuffer)
         return;
 
-    std::shared_ptr<SalBitmap> xImpBmp = rBitmap.ImplGetSalBitmap();
+    const std::shared_ptr<SalBitmap>& xImpBmp = rBitmap.ImplGetSalBitmap();
     if (!xImpBmp)
         return;
 
diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx
index 1572248e8263..660795082c94 100644
--- a/vcl/source/gdi/pdfwriter_impl2.cxx
+++ b/vcl/source/gdi/pdfwriter_impl2.cxx
@@ -265,7 +265,7 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa
         pDummyVDev->EnableOutput( false );
         pDummyVDev->SetMapMode( i_rMtf.GetPrefMapMode() );
     }
-    GDIMetaFile aMtf( i_rMtf );
+    const GDIMetaFile& aMtf( i_rMtf );
 
     for( sal_uInt32 i = 0, nCount = aMtf.GetActionSize(); i < nCount; )
     {
@@ -506,7 +506,7 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa
                 case MetaActionType::EPS:
                 {
                     const MetaEPSAction*    pA = static_cast<const MetaEPSAction*>(pAction);
-                    const GDIMetaFile       aSubstitute( pA->GetSubstitute() );
+                    const GDIMetaFile&      aSubstitute( pA->GetSubstitute() );
 
                     m_rOuterFace.Push();
                     pDummyVDev->Push();
@@ -822,7 +822,7 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa
                 case MetaActionType::BMPEX:
                 {
                     const MetaBmpExAction*  pA = static_cast<const MetaBmpExAction*>(pAction);
-                    BitmapEx aBitmapEx( pA->GetBitmapEx() );
+                    const BitmapEx& aBitmapEx( pA->GetBitmapEx() );
                     Size aSize( OutputDevice::LogicToLogic( aBitmapEx.GetPrefSize(),
                             aBitmapEx.GetPrefMapMode(), pDummyVDev->GetMapMode() ) );
                     Graphic aGraphic = i_pOutDevData ? i_pOutDevData->GetCurrentGraphic() : Graphic();
@@ -902,7 +902,7 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa
                             m_rOuterFace.SetClipRegion( basegfx::B2DPolyPolygon() );
                         else
                         {
-                            vcl::Region aReg( pA->GetRegion() );
+                            const vcl::Region& aReg( pA->GetRegion() );
                             m_rOuterFace.SetClipRegion( aReg.GetAsB2DPolyPolygon() );
                         }
                     }
@@ -921,7 +921,7 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa
                 case MetaActionType::ISECTREGIONCLIPREGION:
                 {
                     const MetaISectRegionClipRegionAction* pA = static_cast<const MetaISectRegionClipRegionAction*>(pAction);
-                    vcl::Region aReg( pA->GetRegion() );
+                    const vcl::Region& aReg( pA->GetRegion() );
                     m_rOuterFace.IntersectClipRegion( aReg.GetAsB2DPolyPolygon() );
                 }
                 break;
diff --git a/vcl/source/gdi/textlayout.cxx b/vcl/source/gdi/textlayout.cxx
index fab85035412c..5338acc2ad5b 100644
--- a/vcl/source/gdi/textlayout.cxx
+++ b/vcl/source/gdi/textlayout.cxx
@@ -106,7 +106,7 @@ namespace vcl
         ,m_aUnzoomedPointFont( _rControl.GetUnzoomedControlPointFont() )
         ,m_bRTLEnabled( _rControl.IsRTLEnabled() )
     {
-        const Fraction aZoom( _rControl.GetZoom() );
+        const Fraction& aZoom( _rControl.GetZoom() );
         m_rTargetDevice.Push( PushFlags::MAPMODE | PushFlags::FONT | PushFlags::TEXTLAYOUTMODE );
 
         MapMode aTargetMapMode( m_rTargetDevice.GetMapMode() );
diff --git a/vcl/source/outdev/polygon.cxx b/vcl/source/outdev/polygon.cxx
index 567c4d58e93b..aacbe00df924 100644
--- a/vcl/source/outdev/polygon.cxx
+++ b/vcl/source/outdev/polygon.cxx
@@ -475,7 +475,7 @@ void OutputDevice::ImplDrawPolyPolygon( const tools::PolyPolygon& rPolyPoly, con
     }
     if( pPolyPoly->Count() == 1 )
     {
-        const tools::Polygon rPoly = pPolyPoly->GetObject( 0 );
+        const tools::Polygon& rPoly = pPolyPoly->GetObject( 0 );
         sal_uInt16 nSize = rPoly.GetSize();
 
         if( nSize >= 2 )
diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx
index 418d99a04520..8e60d8a7bbfc 100644
--- a/vcl/source/window/brdwin.cxx
+++ b/vcl/source/window/brdwin.cxx
@@ -1782,7 +1782,7 @@ void ImplBorderWindow::Resize()
             long nNotebookBarHeight = mpNotebookBar->GetSizePixel().Height();
 
             const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
-            const BitmapEx aPersona = rStyleSettings.GetPersonaHeader();
+            const BitmapEx& aPersona = rStyleSettings.GetPersonaHeader();
             // since size of notebookbar changes, to make common persona for menubar
             // and notebookbar persona should be set again with changed coordinates
             if (!aPersona.IsEmpty())
diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx
index ccfb6a17c840..261cf32b23a6 100644
--- a/vcl/source/window/dlgctrl.cxx
+++ b/vcl/source/window/dlgctrl.cxx
@@ -396,7 +396,7 @@ vcl::Window* ImplFindAccelWindow( vcl::Window* pParent, sal_uInt16& rIndex, sal_
     sal_uInt16  i = rIndex;
     vcl::Window* pWindow;
 
-    uno::Reference<i18n::XCharacterClassification> const xCharClass(ImplGetCharClass());
+    uno::Reference<i18n::XCharacterClassification> const& xCharClass(ImplGetCharClass());
 
     const css::lang::Locale& rLocale = Application::GetSettings().GetUILanguageTag().getLocale();
     cCharCode = xCharClass->toUpper( OUString(cCharCode), 0, 1, rLocale )[0];
diff --git a/vcl/unx/gtk/a11y/atkutil.cxx b/vcl/unx/gtk/a11y/atkutil.cxx
index d714b08f2dde..ed99ba392bba 100644
--- a/vcl/unx/gtk/a11y/atkutil.cxx
+++ b/vcl/unx/gtk/a11y/atkutil.cxx
@@ -320,7 +320,7 @@ void DocumentFocusListener::attachRecursive(
         return;
 
     // If not already done, add the broadcaster to the list and attach as listener.
-    uno::Reference< uno::XInterface > xInterface = xBroadcaster;
+    const uno::Reference< uno::XInterface >& xInterface = xBroadcaster;
     if( m_aRefList.insert(xInterface).second )
     {
         xBroadcaster->addAccessibleEventListener(static_cast< accessibility::XAccessibleEventListener *>(this));
@@ -654,7 +654,7 @@ static void WindowEventHandler(void *, VclSimpleEvent& rEvent)
             }
             else if (const VclAccessibleEvent* pAccEvent = dynamic_cast<const VclAccessibleEvent*>(&rEvent))
             {
-                uno::Reference< accessibility::XAccessible > xAccessible = pAccEvent->GetAccessible();
+                const uno::Reference< accessibility::XAccessible >& xAccessible = pAccEvent->GetAccessible();
                 if (xAccessible.is())
                     atk_wrapper_focus_tracker_notify_when_idle(xAccessible);
             }
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 5310d933ea00..1e942e3ae481 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1126,7 +1126,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
         }
         case NS_ooxml::LN_CT_DocPartGallery_val:
         {
-            OUString sGlossaryEntryGallery = sStringValue;
+            const OUString& sGlossaryEntryGallery = sStringValue;
             if(m_pImpl->GetTopContext().get())
             {
                 OUString sName = sGlossaryEntryGallery + ":" + m_sGlossaryEntryName;
diff --git a/xmloff/source/chart/SchXMLSeriesHelper.cxx b/xmloff/source/chart/SchXMLSeriesHelper.cxx
index c4764a856f89..1a27fff4a1b9 100644
--- a/xmloff/source/chart/SchXMLSeriesHelper.cxx
+++ b/xmloff/source/chart/SchXMLSeriesHelper.cxx
@@ -77,9 +77,8 @@ using ::com::sun::star::uno::Sequence;
     sal_Int32 nIndex=0;
 
     ::std::vector< Reference< chart2::XDataSeries > > aSeriesVector( SchXMLSeriesHelper::getDataSeriesFromDiagram( xDiagram ));
-    for( const auto& rSeries : aSeriesVector )
+    for( const Reference< chart2::XDataSeries >& xSeries : aSeriesVector )
     {
-        Reference< chart2::XDataSeries > xSeries( rSeries );
         if( xSeries.is() )
         {
             if( aRet.end() == aRet.find(xSeries) )
diff --git a/xmloff/source/core/SettingsExportHelper.cxx b/xmloff/source/core/SettingsExportHelper.cxx
index ca5f677dbdd6..c3df15c10ac8 100644
--- a/xmloff/source/core/SettingsExportHelper.cxx
+++ b/xmloff/source/core/SettingsExportHelper.cxx
@@ -129,7 +129,7 @@ void XMLSettingsExportHelper::CallTypeFunction(const uno::Any& rAny,
         break;
         default:
         {
-            uno::Type aType = aAny.getValueType();
+            const uno::Type& aType = aAny.getValueType();
             if (aType.equals(cppu::UnoType<uno::Sequence<beans::PropertyValue>>::get() ) )
             {
                 uno::Sequence< beans::PropertyValue> aProps;
diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx
index 0eb2051d9edb..8163386e13b1 100644
--- a/xmloff/source/draw/sdxmlexp.cxx
+++ b/xmloff/source/draw/sdxmlexp.cxx
@@ -2303,7 +2303,7 @@ void SdXMLExport::ExportMasterStyles_()
                 ImpXMLEXPPageMasterInfo* pInfo = mpHandoutPageMaster;
                 if(pInfo)
                 {
-                    OUString sString = pInfo->GetName();
+                    const OUString& sString = pInfo->GetName();
                     AddAttribute(XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_NAME, sString );
                 }
 
@@ -2348,7 +2348,7 @@ void SdXMLExport::ExportMasterStyles_()
             ImpXMLEXPPageMasterInfo* pInfo = mvPageMasterUsageList.at( nMPageId );
             if(pInfo)
             {
-                OUString sString = pInfo->GetName();
+                const OUString& sString = pInfo->GetName();
                 AddAttribute(XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_NAME, sString );
             }
 
@@ -2383,7 +2383,7 @@ void SdXMLExport::ExportMasterStyles_()
                             ImpXMLEXPPageMasterInfo* pMasterInfo = mvNotesPageMasterUsageList.at( nMPageId );
                             if(pMasterInfo)
                             {
-                                OUString sString = pMasterInfo->GetName();
+                                const OUString& sString = pMasterInfo->GetName();
                                 AddAttribute(XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_NAME, sString);
                             }
 
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx
index b78d6c3b2f89..da1e94b26d49 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -2255,7 +2255,7 @@ void XMLShapeExport::ImpExportPolygonShape(
         if(!aPolyPolygon.areControlPointsUsed() && 1 == aPolyPolygon.count())
         {
             // simple polygon shape, can be written as svg:points sequence
-            const basegfx::B2DPolygon aPolygon(aPolyPolygon.getB2DPolygon(0));
+            const basegfx::B2DPolygon& aPolygon(aPolyPolygon.getB2DPolygon(0));
             const OUString aPointString(basegfx::utils::exportToSvgPoints(aPolygon));
 
             // write point array
diff --git a/xmloff/source/table/XMLTableImport.cxx b/xmloff/source/table/XMLTableImport.cxx
index 9b2c646c3a09..5cc315c73efd 100644
--- a/xmloff/source/table/XMLTableImport.cxx
+++ b/xmloff/source/table/XMLTableImport.cxx
@@ -596,10 +596,8 @@ void XMLTableImportContext::EndElement()
 {
     if( !maMergeInfos.empty() )
     {
-        for( const auto& rMergeInfo : maMergeInfos )
+        for( const std::shared_ptr< MergeInfo >& xInfo : maMergeInfos )
         {
-            std::shared_ptr< MergeInfo > xInfo( rMergeInfo );
-
             if( xInfo.get() ) try
             {
                 Reference< XCellRange > xRange( mxTable->getCellRangeByPosition( xInfo->mnStartColumn, xInfo->mnStartRow, xInfo->mnEndColumn, xInfo->mnEndRow ) );
diff --git a/xmloff/source/text/XMLTextListBlockContext.cxx b/xmloff/source/text/XMLTextListBlockContext.cxx
index 595ffb546985..aeb74de1d951 100644
--- a/xmloff/source/text/XMLTextListBlockContext.cxx
+++ b/xmloff/source/text/XMLTextListBlockContext.cxx
@@ -189,7 +189,7 @@ XMLTextListBlockContext::XMLTextListBlockContext(
         if ( bIsContinueNumberingAttributePresent && !mbRestartNumbering &&
              msContinueListId.isEmpty() )
         {
-            OUString Last( rTextListsHelper.GetLastProcessedListId() );
+            const OUString& Last( rTextListsHelper.GetLastProcessedListId() );
             if ( rTextListsHelper.GetListStyleOfLastProcessedList() == msListStyleName
                  && Last != msListId )
             {
diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx
index 48d28cd1df7c..4b1ed3061456 100644
--- a/xmloff/source/text/txtparai.cxx
+++ b/xmloff/source/text/txtparai.cxx
@@ -2127,7 +2127,7 @@ void XMLParaContext::EndElement()
                     const XMLDrawHint_Impl *pDHint =
                         static_cast<const XMLDrawHint_Impl*>(pHint);
                     // Improvement: hint directly provides the shape. (#i33242#)
-                    Reference < XShape > xShape = pDHint->GetShape();
+                    const Reference < XShape >& xShape = pDHint->GetShape();
                     if ( xShape.is() )
                     {
                         // determine anchor type
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
index 344591d566ae..239f795e426a 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
@@ -232,7 +232,7 @@ void ProgressBarElement::endElement()
     if (xStyle.is())
     {
         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
-        Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
+        const Reference< beans::XPropertySet >& xControlModel( ctx.getControlModel() );
         pStyle->importBackgroundColorStyle( xControlModel );
         pStyle->importBorderStyle( xControlModel );
         pStyle->importFillColorStyle( xControlModel );
@@ -272,7 +272,7 @@ void ScrollBarElement::endElement()
     if (xStyle.is())
     {
         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
-        Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
+        const Reference< beans::XPropertySet >& xControlModel( ctx.getControlModel() );
         pStyle->importBackgroundColorStyle( xControlModel );
         pStyle->importBorderStyle( xControlModel );
     }
@@ -321,7 +321,7 @@ void SpinButtonElement::endElement()
     if (xStyle.is())
     {
         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
-        Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
+        const Reference< beans::XPropertySet >& xControlModel( ctx.getControlModel() );
         pStyle->importBackgroundColorStyle( xControlModel );
         pStyle->importBorderStyle( xControlModel );
     }
@@ -367,7 +367,7 @@ void FixedLineElement::endElement()
     if (xStyle.is())
     {
         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
-        Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
+        const Reference< beans::XPropertySet >& xControlModel( ctx.getControlModel() );
         pStyle->importTextColorStyle( xControlModel );
         pStyle->importTextLineColorStyle( xControlModel );
         pStyle->importFontStyle( xControlModel );
@@ -406,7 +406,7 @@ void PatternFieldElement::endElement()
     if (xStyle.is())
     {
         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
-        Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
+        const Reference< beans::XPropertySet >& xControlModel( ctx.getControlModel() );
         pStyle->importBackgroundColorStyle( xControlModel );
         pStyle->importTextColorStyle( xControlModel );
         pStyle->importTextLineColorStyle( xControlModel );
@@ -453,7 +453,7 @@ void FormattedFieldElement::endElement()
     if (xStyle.is())
     {
         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
-        Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
+        const Reference< beans::XPropertySet >& xControlModel( ctx.getControlModel() );
         pStyle->importBackgroundColorStyle( xControlModel );
         pStyle->importTextColorStyle( xControlModel );
         pStyle->importTextLineColorStyle( xControlModel );
@@ -580,7 +580,7 @@ void TimeFieldElement::endElement()
     if (xStyle.is())
     {
         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
-        Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
+        const Reference< beans::XPropertySet >& xControlModel( ctx.getControlModel() );
         pStyle->importBackgroundColorStyle( xControlModel );
         pStyle->importTextColorStyle( xControlModel );
         pStyle->importTextLineColorStyle( xControlModel );
@@ -633,7 +633,7 @@ void NumericFieldElement::endElement()
     if (xStyle.is())
     {
         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
-        Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
+        const Reference< beans::XPropertySet >& xControlModel( ctx.getControlModel() );
         pStyle->importBackgroundColorStyle( xControlModel );
         pStyle->importTextColorStyle( xControlModel );
         pStyle->importTextLineColorStyle( xControlModel );
@@ -688,7 +688,7 @@ void DateFieldElement::endElement()
     if (xStyle.is())
     {
         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
-        Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
+        const Reference< beans::XPropertySet >& xControlModel( ctx.getControlModel() );
         pStyle->importBackgroundColorStyle( xControlModel );
         pStyle->importTextColorStyle( xControlModel );
         pStyle->importTextLineColorStyle( xControlModel );
@@ -742,7 +742,7 @@ void CurrencyFieldElement::endElement()
     if (xStyle.is())
     {
         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
-        Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
+        const Reference< beans::XPropertySet >& xControlModel( ctx.getControlModel() );
         pStyle->importBackgroundColorStyle( xControlModel );
         pStyle->importTextColorStyle( xControlModel );
         pStyle->importTextLineColorStyle( xControlModel );
@@ -797,7 +797,7 @@ void FileControlElement::endElement()
     if (xStyle.is())
     {
         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
-        Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
+        const Reference< beans::XPropertySet >& xControlModel( ctx.getControlModel() );
         pStyle->importBackgroundColorStyle( xControlModel );
         pStyle->importTextColorStyle( xControlModel );
         pStyle->importTextLineColorStyle( xControlModel );
@@ -840,7 +840,7 @@ void TreeControlElement::endElement()
     if (xStyle.is())
     {
         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
-        Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
+        const Reference< beans::XPropertySet >& xControlModel( ctx.getControlModel() );
         pStyle->importBackgroundColorStyle( xControlModel );
         pStyle->importBorderStyle( xControlModel );
     }
@@ -885,7 +885,7 @@ void ImageControlElement::endElement()
     if (xStyle.is())
     {
         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
-        Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
+        const Reference< beans::XPropertySet >& xControlModel( ctx.getControlModel() );
         pStyle->importBackgroundColorStyle( xControlModel );
         pStyle->importBorderStyle( xControlModel );
     }
@@ -925,7 +925,7 @@ void TextElement::endElement()
     if (xStyle.is())
     {
         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
-        Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
+        const Reference< beans::XPropertySet >& xControlModel( ctx.getControlModel() );
         pStyle->importBackgroundColorStyle( xControlModel );
         pStyle->importTextColorStyle( xControlModel );
         pStyle->importTextLineColorStyle( xControlModel );
@@ -970,7 +970,7 @@ void FixedHyperLinkElement::endElement()
     if (xStyle.is())
     {
         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
-        Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
+        const Reference< beans::XPropertySet >& xControlModel( ctx.getControlModel() );
         pStyle->importBackgroundColorStyle( xControlModel );
         pStyle->importTextColorStyle( xControlModel );
         pStyle->importTextLineColorStyle( xControlModel );
@@ -1543,7 +1543,7 @@ void ButtonElement::endElement()
     if (xStyle.is())
     {
         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
-        Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
+        const Reference< beans::XPropertySet >& xControlModel( ctx.getControlModel() );
         pStyle->importBackgroundColorStyle( xControlModel );
         pStyle->importTextColorStyle( xControlModel );
         pStyle->importTextLineColorStyle( xControlModel );


More information about the Libreoffice-commits mailing list