sc/source/core/data/SolverSettings.cxx          |    4 ++--
 sc/source/core/data/column.cxx                  |    5 ++---
 sc/source/core/data/column4.cxx                 |    2 +-
 sc/source/core/data/documen5.cxx                |    2 +-
 sc/source/core/data/documen7.cxx                |    2 +-
 sc/source/core/tool/interpr1.cxx                |    6 +++---
 sc/source/core/tool/sharedformula.cxx           |    2 +-
 sc/source/filter/excel/excform8.cxx             |    4 ++--
 sc/source/filter/excel/xechart.cxx              |    2 +-
 sc/source/filter/html/htmlpars.cxx              |    2 +-
 sc/source/filter/xml/XMLExportDataPilot.cxx     |    2 +-
 sc/source/filter/xml/xmlwrap.cxx                |    3 +--
 sc/source/ui/dbgui/pvfundlg.cxx                 |    2 +-
 sc/source/ui/drawfunc/fuins1.cxx                |    2 +-
 sc/source/ui/miscdlgs/acredlin.cxx              |    4 ++--
 sc/source/ui/miscdlgs/solveroptions.cxx         |    2 +-
 sc/source/ui/unoobj/PivotTableDataProvider.cxx  |    4 ++--
 sc/source/ui/view/tabvwsha.cxx                  |    2 +-
 sc/source/ui/view/tabvwshb.cxx                  |    2 +-
 sc/source/ui/view/viewfun2.cxx                  |    5 ++---
 sc/source/ui/view/viewfun6.cxx                  |    5 ++---
 vcl/headless/CairoCommon.cxx                    |    2 +-
 vcl/qt5/QtFilePicker.cxx                        |    2 +-
 vcl/qt5/QtGraphics_GDI.cxx                      |    2 +-
 vcl/source/bitmap/BitmapDisabledImageFilter.cxx |    2 +-
 vcl/source/bitmap/BitmapFilterStackBlur.cxx     |    2 +-
 vcl/source/bitmap/BitmapLightenFilter.cxx       |    2 +-
 vcl/source/bitmap/BitmapMaskToAlphaFilter.cxx   |    2 +-
 vcl/source/bitmap/BitmapShadowFilter.cxx        |    2 +-
 vcl/source/bitmap/BitmapTools.cxx               |   14 +++++++-------
 vcl/source/filter/eps/eps.cxx                   |    8 ++++----
 vcl/source/filter/graphicfilter.cxx             |    2 +-
 vcl/source/filter/svm/SvmWriter.cxx             |    4 ++--
 vcl/source/filter/webp/writer.cxx               |    2 +-
 vcl/source/gdi/TypeSerializer.cxx               |    2 +-
 vcl/source/gdi/graph.cxx                        |    2 +-
 vcl/source/gdi/impgraph.cxx                     |    2 +-
 vcl/source/gdi/mtfxmldump.cxx                   |    4 ++--
 vcl/source/gdi/pdfwriter_impl2.cxx              |    2 +-
 vcl/source/gdi/print.cxx                        |    6 +++---
 vcl/source/graphic/UnoGraphic.cxx               |    2 +-
 vcl/source/outdev/background.cxx                |    2 +-
 vcl/source/outdev/transparent.cxx               |    4 ++--
 vcl/source/window/NotebookBarAddonsMerger.cxx   |    2 +-
 vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx       |    2 +-
 vcl/unx/gtk3/gtkinst.cxx                        |    2 +-
 vcl/workben/vcldemo.cxx                         |    2 +-
 47 files changed, 70 insertions(+), 74 deletions(-)

New commits:
commit 134afb333ace20672531e464f4e21f1d00cf7bee
Author:     Noel Grandin <[email protected]>
AuthorDate: Mon Nov 11 22:04:42 2024 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Tue Nov 12 11:15:45 2024 +0100

    clang-tidy: performance-unnecessary-copy-initialization in sc
    
    Change-Id: I5d4b2190af6373772fcea7c8427454170fde2e6b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176437
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/sc/source/core/data/SolverSettings.cxx 
b/sc/source/core/data/SolverSettings.cxx
index 215a662080f9..97103659b94c 100644
--- a/sc/source/core/data/SolverSettings.cxx
+++ b/sc/source/core/data/SolverSettings.cxx
@@ -644,7 +644,7 @@ void 
SolverSettings::GetEngineOptions(css::uno::Sequence<css::beans::PropertyVal
 
     for (auto i = 0; i < nOptionsSize; i++)
     {
-        css::beans::PropertyValue aProp = aOptions[i];
+        const css::beans::PropertyValue& aProp = aOptions[i];
         OUString sLOParamName = aProp.Name;
         // Only try to get the parameter value if it is an expected parameter 
name
         if (SolverParamNames.count(sLOParamName))
@@ -691,7 +691,7 @@ void SolverSettings::SetEngineOptions(const 
css::uno::Sequence<css::beans::Prope
 
     for (auto i = 0; i < nOptionsSize; i++)
     {
-        css::beans::PropertyValue aProp = aOptions[i];
+        const css::beans::PropertyValue& aProp = aOptions[i];
         OUString sLOParamName = aProp.Name;
         // Only try to set the parameter value if it is an expected parameter 
name
         if (SolverParamNames.count(sLOParamName))
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index fe53ac7325da..15060d98c1b3 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -202,10 +202,9 @@ bool ScColumn::HasSelectionMatrixFragment(const 
ScMarkData& rMark, const ScRange
     ScAddress aCurOrigin = aOrigin;
 
     bool bOpen = false;
-    ScRangeList aRanges = rRangeList; // cached rMark.GetMarkedRanges(), for 
performance reasons (tdf#148147)
-    for (size_t i = 0, n = aRanges.size(); i < n; ++i)
+    for (size_t i = 0, n = rRangeList.size(); i < n; ++i)
     {
-        const ScRange& r = aRanges[i];
+        const ScRange& r = rRangeList[i];
         if (nTab < r.aStart.Tab() || r.aEnd.Tab() < nTab)
             continue;
 
diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index 3b322c73c23f..79ca0357361a 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -374,7 +374,7 @@ void ScColumn::duplicateSparkline(sc::CopyFromClipContext& 
rContext, sc::ColumnB
     if ((rContext.getInsertFlag() & InsertDeleteFlags::SPARKLINES) == 
InsertDeleteFlags::NONE)
         return;
 
-    auto pSparkline = rContext.getSingleSparkline(nColOffset);
+    const auto& pSparkline = rContext.getSingleSparkline(nColOffset);
     if (pSparkline)
     {
         auto const& pSparklineGroup = pSparkline->getSparklineGroup();
diff --git a/sc/source/core/data/documen5.cxx b/sc/source/core/data/documen5.cxx
index 21e21b3ab05e..7e2aa26679ce 100644
--- a/sc/source/core/data/documen5.cxx
+++ b/sc/source/core/data/documen5.cxx
@@ -193,7 +193,7 @@ void ScDocument::SetChartRanges( std::u16string_view 
rChartName, const ::std::ve
     auto aRangeStringsRange = asNonConstRange(aRangeStrings);
     for( sal_Int32 nN=0; nN<nCount; nN++ )
     {
-        ScRangeList aScRangeList( rRangesVector[nN] );
+        const ScRangeList& aScRangeList( rRangesVector[nN] );
         OUString sRangeStr;
         aScRangeList.Format( sRangeStr, ScRefFlags::RANGE_ABS_3D, *this, 
GetAddressConvention() );
         aRangeStringsRange[nN]=sRangeStr;
diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx
index 6ebc5d51ef77..96f9edd7edbc 100644
--- a/sc/source/core/data/documen7.cxx
+++ b/sc/source/core/data/documen7.cxx
@@ -137,7 +137,7 @@ void ScDocument::Broadcast( const ScHint& rHint )
 bool ScDocument::BroadcastHintInternal( const ScHint& rHint )
 {
     bool bIsBroadcasted = false;
-    const ScAddress address(rHint.GetStartAddress());
+    const ScAddress& address(rHint.GetStartAddress());
     SvtBroadcaster* pLastBC = nullptr;
     // Process all broadcasters for the given row range.
     for( SCROW nRow = 0; nRow < rHint.GetRowCount(); ++nRow )
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 2f5656769ced..2116cab1297f 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -9066,7 +9066,7 @@ void ScInterpreter::ScLet()
             }
             else
             {
-                FormulaConstTokenRef xTok(aInt.GetResultToken());
+                const FormulaConstTokenRef& xTok(aInt.GetResultToken());
                 if (!nResultIndexes.insert(std::make_pair(aStrName, 
xTok->Clone())).second)
                 {
                     PushIllegalParameter();
@@ -9100,7 +9100,7 @@ void ScInterpreter::ScLet()
     }
     else
     {
-        formula::FormulaConstTokenRef xLambdaResult(aInt.GetResultToken());
+        const formula::FormulaConstTokenRef& 
xLambdaResult(aInt.GetResultToken());
         if (xLambdaResult)
         {
             nGlobalError = xLambdaResult->GetError();
@@ -11072,7 +11072,7 @@ void ScInterpreter::ScRegex()
         }
         else
         {
-            const OUString aFlags( aFlagsString.getString());
+            const OUString& aFlags( aFlagsString.getString());
             // Empty flags string is valid => no flag set.
             if (aFlags.getLength() > 1)
             {
diff --git a/sc/source/core/tool/sharedformula.cxx 
b/sc/source/core/tool/sharedformula.cxx
index 7680aac405d4..98fa783c07ae 100644
--- a/sc/source/core/tool/sharedformula.cxx
+++ b/sc/source/core/tool/sharedformula.cxx
@@ -276,7 +276,7 @@ void SharedFormulaUtil::unshareFormulaCell(const 
CellStoreType::position_type& a
     else
     {
         // In the middle of the shared range. Split it into two groups.
-        ScFormulaCellGroupRef xGroup = rCell.GetCellGroup();
+        const ScFormulaCellGroupRef& xGroup = rCell.GetCellGroup();
         SCROW nEndRow = xGroup->mpTopCell->aPos.Row() + xGroup->mnLength - 1;
         xGroup->mnLength = rCell.aPos.Row() - xGroup->mpTopCell->aPos.Row(); 
// Shorten the top group.
         if (xGroup->mnLength == 1)
diff --git a/sc/source/filter/excel/excform8.cxx 
b/sc/source/filter/excel/excform8.cxx
index 144b4da1e7d4..48f4d0c3ad97 100644
--- a/sc/source/filter/excel/excform8.cxx
+++ b/sc/source/filter/excel/excform8.cxx
@@ -1341,7 +1341,7 @@ void ExcelToSc8::ConvertExternName( 
std::unique_ptr<ScTokenArray>& rpArray, XclI
                 aSRD.SetFlag3D(true);
                 ExcRelToScRel8(nRow, nGrbitCol, aSRD, true);
                 aCRD.Ref1 = aCRD.Ref2 = aSRD;
-                OUString aTabName = rTabNames[nExtTab1];
+                const OUString& aTabName = rTabNames[nExtTab1];
 
                 if (nExtTab1 == nExtTab2)
                 {
@@ -1384,7 +1384,7 @@ void ExcelToSc8::ConvertExternName( 
std::unique_ptr<ScTokenArray>& rpArray, XclI
                 rR2.SetFlag3D(true);
                 ExcRelToScRel8(nRow2, nGrbitCol2, rR2, true);
 
-                OUString aTabName = rTabNames[nExtTab1];
+                const OUString& aTabName = rTabNames[nExtTab1];
                 aStack << aPool.StoreExtRef(nFileId, aTabName, aCRD);
             }
             break;
diff --git a/sc/source/filter/excel/xechart.cxx 
b/sc/source/filter/excel/xechart.cxx
index d5dd440be239..3bedcb3c60be 100644
--- a/sc/source/filter/excel/xechart.cxx
+++ b/sc/source/filter/excel/xechart.cxx
@@ -3086,7 +3086,7 @@ sal_uInt16 XclExpChAxesSet::Convert( Reference< XDiagram 
> const & xDiagram, sal
         {
             /*  Process first coordinate system only. Import filter puts all
                 chart types into one coordinate system. */
-            Reference< XCoordinateSystem > xCoordSystem = aCoordSysSeq[ 0 ];
+            const Reference< XCoordinateSystem >& xCoordSystem = aCoordSysSeq[ 
0 ];
             sal_Int32 nApiAxesSetIdx = GetApiAxesSetIndex();
 
             // 3d mode
diff --git a/sc/source/filter/html/htmlpars.cxx 
b/sc/source/filter/html/htmlpars.cxx
index 9b825df20f7d..dd2395074bd2 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -2283,7 +2283,7 @@ void ScHTMLTable::DataOn( const HtmlImportInfo& rInfo )
                 {
                     // Pick up the number format associated with this class (if
                     // any).
-                    OUString aClass = rOption.GetString();
+                    const OUString& aClass = rOption.GetString();
                     const ScHTMLStyles& rStyles = mpParser->GetStyles();
                     const OUString& rVal = 
rStyles.getPropertyValue(u"td"_ustr, aClass, u"mso-number-format"_ustr);
                     if (!rVal.isEmpty())
diff --git a/sc/source/filter/xml/XMLExportDataPilot.cxx 
b/sc/source/filter/xml/XMLExportDataPilot.cxx
index 83ea28584e9f..5161dede5137 100644
--- a/sc/source/filter/xml/XMLExportDataPilot.cxx
+++ b/sc/source/filter/xml/XMLExportDataPilot.cxx
@@ -151,7 +151,7 @@ void ScXMLExportDataPilot::WriteDPFilter(const 
ScQueryParam& aQueryParam)
 
     for ( j = 0; (j < nQueryEntryCount) && bHasEntries; ++j)
     {
-        ScQueryEntry aEntry = aQueryParam.GetEntry(j);
+        const ScQueryEntry& aEntry = aQueryParam.GetEntry(j);
         if (aEntry.bDoQuery)
         {
             if (nEntries > 0)
diff --git a/sc/source/filter/xml/xmlwrap.cxx b/sc/source/filter/xml/xmlwrap.cxx
index 86ff69d0ec2d..bf4e055440db 100644
--- a/sc/source/filter/xml/xmlwrap.cxx
+++ b/sc/source/filter/xml/xmlwrap.cxx
@@ -113,7 +113,6 @@ ErrCodeMsg ScXMLImportWrapper::ImportFromComponent(const 
uno::Reference<uno::XCo
         xStorage = pMedium->GetStorage();
 
     bool bEncrypted = false;
-    OUString sStream(sDocName);
     if( xStorage.is() )
     {
         try
@@ -152,7 +151,7 @@ ErrCodeMsg ScXMLImportWrapper::ImportFromComponent(const 
uno::Reference<uno::XCo
     OSL_ENSURE( xInfoSet.is(), "missing property set" );
     if( xInfoSet.is() )
     {
-        xInfoSet->setPropertyValue( u"StreamName"_ustr, uno::Any( sStream ) );
+        xInfoSet->setPropertyValue( u"StreamName"_ustr, uno::Any( sDocName ) );
     }
 
     ErrCodeMsg nReturn = ERRCODE_NONE;
diff --git a/sc/source/ui/dbgui/pvfundlg.cxx b/sc/source/ui/dbgui/pvfundlg.cxx
index d62aff05b79c..27b2e28b44d8 100644
--- a/sc/source/ui/dbgui/pvfundlg.cxx
+++ b/sc/source/ui/dbgui/pvfundlg.cxx
@@ -95,7 +95,7 @@ bool lclFillListBox(weld::TreeView& rLBox, const 
vector<ScDPLabelData::Member>&
         rLBox.append();
         int pos = rLBox.n_children() - 1;
         rLBox.set_toggle(pos, TRISTATE_FALSE);
-        OUString aName = rMember.getDisplayName();
+        const OUString& aName = rMember.getDisplayName();
         if (!aName.isEmpty())
             rLBox.set_text(pos, aName, 0);
         else
diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx
index 83fd3d7227c0..728865a43f4d 100644
--- a/sc/source/ui/drawfunc/fuins1.cxx
+++ b/sc/source/ui/drawfunc/fuins1.cxx
@@ -276,7 +276,7 @@ FuInsertGraphic::FuInsertGraphic( ScTabViewShell&   rViewSh,
     if ( pReqArgs &&
          (pGraphicItem = pReqArgs->GetItemIfSet( SID_INSERT_GRAPHIC, true )) )
     {
-        OUString aFileName = pGraphicItem->GetValue();
+        const OUString& aFileName = pGraphicItem->GetValue();
 
         OUString aFilterName;
         if ( const SfxStringItem* pFilterItem = pReqArgs->GetItemIfSet( 
FN_PARAM_FILTER ) )
diff --git a/sc/source/ui/miscdlgs/acredlin.cxx 
b/sc/source/ui/miscdlgs/acredlin.cxx
index 782b08b87d47..b93d10aec8fc 100644
--- a/sc/source/ui/miscdlgs/acredlin.cxx
+++ b/sc/source/ui/miscdlgs/acredlin.cxx
@@ -317,7 +317,7 @@ bool ScAcceptChgDlg::IsValidAction(const ScChangeAction* 
pScChangeAction)
     bool bFlag = false;
 
     ScRange aRef=pScChangeAction->GetBigRange().MakeRange(*pDoc);
-    OUString aUser=pScChangeAction->GetUser();
+    const OUString& aUser=pScChangeAction->GetUser();
     DateTime aDateTime=pScChangeAction->GetDateTime();
 
     ScChangeActionType eType=pScChangeAction->GetType();
@@ -513,7 +513,7 @@ std::unique_ptr<weld::TreeIter> 
ScAcceptChgDlg::AppendFilteredAction(
     bool bFlag = false;
 
     ScRange aRef=pScChangeAction->GetBigRange().MakeRange(*pDoc);
-    OUString aUser=pScChangeAction->GetUser();
+    const OUString& aUser=pScChangeAction->GetUser();
     DateTime aDateTime=pScChangeAction->GetDateTime();
 
     if (pTheView->IsValidEntry(aUser, aDateTime) || bIsGenerated)
diff --git a/sc/source/ui/miscdlgs/solveroptions.cxx 
b/sc/source/ui/miscdlgs/solveroptions.cxx
index b3cc8e543c3e..014a7632ea49 100644
--- a/sc/source/ui/miscdlgs/solveroptions.cxx
+++ b/sc/source/ui/miscdlgs/solveroptions.cxx
@@ -85,7 +85,7 @@ ScSolverOptionsDialog::ScSolverOptionsDialog(weld::Window* 
pParent,
     for (sal_Int32 nImpl=0; nImpl<nImplCount; ++nImpl)
     {
         OUString aImplName( maImplNames[nImpl] );
-        OUString aDescription( rDescriptions[nImpl] );   // user-visible 
descriptions in list box
+        const OUString& aDescription( rDescriptions[nImpl] );   // 
user-visible descriptions in list box
         m_xLbEngine->append_text(aDescription);
         if ( aImplName == maEngine )
             nSelect = nImpl;
diff --git a/sc/source/ui/unoobj/PivotTableDataProvider.cxx 
b/sc/source/ui/unoobj/PivotTableDataProvider.cxx
index 5dc82b93bff0..cbd7ebbecda5 100644
--- a/sc/source/ui/unoobj/PivotTableDataProvider.cxx
+++ b/sc/source/ui/unoobj/PivotTableDataProvider.cxx
@@ -536,7 +536,7 @@ void PivotTableDataProvider::collectPivotTableData()
             size_t i = 0;
             for (ValueAndFormat & rItem : rDataRow)
             {
-                OUString sName = aDataFieldNamesVectors[i];
+                const OUString& sName = aDataFieldNamesVectors[i];
                 sal_Int32 nNumberFormat = aDataFieldNumberFormatMap[sName];
                 rItem.m_nNumberFormat = nNumberFormat;
                 i++;
@@ -548,7 +548,7 @@ void PivotTableDataProvider::collectPivotTableData()
         size_t i = 0;
         for (std::vector<ValueAndFormat> & rDataRow : m_aDataRowVector)
         {
-            OUString sName = aDataFieldNamesVectors[i];
+            const OUString& sName = aDataFieldNamesVectors[i];
             sal_Int32 nNumberFormat = aDataFieldNumberFormatMap[sName];
             for (ValueAndFormat & rItem : rDataRow)
             {
diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index 0437ca0d6da8..2fc2d2d576d2 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -972,7 +972,7 @@ void ScTabViewShell::ExecStyle( SfxRequest& rReq )
         eFamily = static_cast<SfxStyleFamily>(pFamItem->GetValue());
     else if ( pArgs && (pFamilyNameItem = pArgs->GetItemIfSet( 
SID_STYLE_FAMILYNAME )) )
     {
-        OUString sFamily = pFamilyNameItem->GetValue();
+        const OUString& sFamily = pFamilyNameItem->GetValue();
         if (sFamily == "CellStyles")
             eFamily = SfxStyleFamily::Para;
         else if (sFamily == "PageStyles")
diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx
index a2b5fb9e8873..3b1bf47dc238 100644
--- a/sc/source/ui/view/tabvwshb.cxx
+++ b/sc/source/ui/view/tabvwshb.cxx
@@ -74,7 +74,7 @@ void ScTabViewShell::ConnectObject( const SdrOle2Obj* pObj )
 {
     // is called from paint
 
-    uno::Reference < embed::XEmbeddedObject > xObj = pObj->GetObjRef();
+    const uno::Reference < embed::XEmbeddedObject >& xObj = pObj->GetObjRef();
     vcl::Window* pWin = GetActiveWin();
 
     // when already connected do not execute SetObjArea/SetSizeScale again
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 7e944557856f..1e8a19021c08 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -857,11 +857,10 @@ OUString ScViewFunc::GetAutoSumFormula( const 
ScRangeList& rRangeList, bool bSub
 
     if(!rRangeList.empty())
     {
-        ScRangeList aRangeList = rRangeList;
-        size_t ListSize = aRangeList.size();
+        size_t ListSize = rRangeList.size();
         for ( size_t i = 0; i < ListSize; ++i )
         {
-            const ScRange & r = aRangeList[i];
+            const ScRange & r = rRangeList[i];
             if (i != 0)
                 aArray.AddOpCode(ocSep);
             ScComplexRefData aRef;
diff --git a/sc/source/ui/view/viewfun6.cxx b/sc/source/ui/view/viewfun6.cxx
index ca636813f139..510ab6f0ab51 100644
--- a/sc/source/ui/view/viewfun6.cxx
+++ b/sc/source/ui/view/viewfun6.cxx
@@ -142,13 +142,12 @@ void ScViewFunc::MarkAndJumpToRanges(const ScRangeList& 
rRanges)
     ScViewData& rView = GetViewData();
     ScDocShell* pDocSh = rView.GetDocShell();
 
-    ScRangeList aRanges(rRanges);
     ScRangeList aRangesToMark;
     ScAddress aCurPos = rView.GetCurPos();
-    size_t ListSize = aRanges.size();
+    size_t ListSize = rRanges.size();
     for ( size_t i = 0; i < ListSize; ++i )
     {
-        const ScRange & r = aRanges[i];
+        const ScRange & r = rRanges[i];
         // Collect only those ranges that are on the same sheet as the current
         // cursor.
         if (r.aStart.Tab() == aCurPos.Tab())
commit 33c2a79f141cd20078f82dba5a9292dd6046df6e
Author:     Noel Grandin <[email protected]>
AuthorDate: Mon Nov 11 22:06:41 2024 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Tue Nov 12 11:15:36 2024 +0100

    clang-tidy: performance-unnecessary-copy-initialization in vcl
    
    Change-Id: Idb09d0d256601fb3b9e822404b2f57f41d04d713
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176443
    Reviewed-by: Noel Grandin <[email protected]>
    Tested-by: Jenkins

diff --git a/vcl/headless/CairoCommon.cxx b/vcl/headless/CairoCommon.cxx
index 6a56e343df70..1550f3cd898f 100644
--- a/vcl/headless/CairoCommon.cxx
+++ b/vcl/headless/CairoCommon.cxx
@@ -1214,7 +1214,7 @@ bool CairoCommon::drawPolyLine(const 
basegfx::B2DHomMatrix& rObjectToDevice,
         // MM01 checked/verified for Cairo
         for (sal_uInt32 a(0); a < aPolyPolygonLine.count(); a++)
         {
-            const basegfx::B2DPolygon 
aPolyLine(aPolyPolygonLine.getB2DPolygon(a));
+            const basegfx::B2DPolygon& 
aPolyLine(aPolyPolygonLine.getB2DPolygon(a));
 
             if (!bNoJoin)
             {
diff --git a/vcl/qt5/QtFilePicker.cxx b/vcl/qt5/QtFilePicker.cxx
index 369e26054698..9ab02ccc35cc 100644
--- a/vcl/qt5/QtFilePicker.cxx
+++ b/vcl/qt5/QtFilePicker.cxx
@@ -386,7 +386,7 @@ void SAL_CALL QtFilePicker::appendFilterGroup(const 
OUString& rGroupTitle,
     const sal_uInt16 length = filters.getLength();
     for (sal_uInt16 i = 0; i < length; ++i)
     {
-        beans::StringPair aPair = filters[i];
+        const beans::StringPair& aPair = filters[i];
         appendFilter(aPair.First, aPair.Second);
     }
 }
diff --git a/vcl/qt5/QtGraphics_GDI.cxx b/vcl/qt5/QtGraphics_GDI.cxx
index bbfde8e1f22e..c49d82c53e0d 100644
--- a/vcl/qt5/QtGraphics_GDI.cxx
+++ b/vcl/qt5/QtGraphics_GDI.cxx
@@ -383,7 +383,7 @@ bool QtGraphicsBackend::drawPolyLine(const 
basegfx::B2DHomMatrix& rObjectToDevic
     // but this NEEDS to be checked/verified
     for (sal_uInt32 a(0); a < aPolyPolygonLine.count(); a++)
     {
-        const basegfx::B2DPolygon aPolyLine(aPolyPolygonLine.getB2DPolygon(a));
+        const basegfx::B2DPolygon& 
aPolyLine(aPolyPolygonLine.getB2DPolygon(a));
         AddPolygonToPath(aPath, aPolyLine, aPolyLine.isClosed(), 
!getAntiAlias(), true);
     }
 
diff --git a/vcl/source/bitmap/BitmapDisabledImageFilter.cxx 
b/vcl/source/bitmap/BitmapDisabledImageFilter.cxx
index 396d0e0a2af7..829ddb7c01fa 100644
--- a/vcl/source/bitmap/BitmapDisabledImageFilter.cxx
+++ b/vcl/source/bitmap/BitmapDisabledImageFilter.cxx
@@ -26,7 +26,7 @@ BitmapEx BitmapDisabledImageFilter::execute(BitmapEx const& 
rBitmapEx) const
     Bitmap aGrey(aSize, ePixelFormat, pPal);
     BitmapScopedWriteAccess pGrey(aGrey);
 
-    Bitmap aReadBitmap(rBitmapEx.GetBitmap());
+    const Bitmap& aReadBitmap(rBitmapEx.GetBitmap());
     BitmapScopedReadAccess pRead(aReadBitmap);
     if (pRead && pGrey)
     {
diff --git a/vcl/source/bitmap/BitmapFilterStackBlur.cxx 
b/vcl/source/bitmap/BitmapFilterStackBlur.cxx
index 09a44cafb59c..59aadf971485 100644
--- a/vcl/source/bitmap/BitmapFilterStackBlur.cxx
+++ b/vcl/source/bitmap/BitmapFilterStackBlur.cxx
@@ -603,7 +603,7 @@ BitmapFilterStackBlur::~BitmapFilterStackBlur() {}
 
 BitmapEx BitmapFilterStackBlur::execute(BitmapEx const& rBitmapEx) const
 {
-    Bitmap aBitmap = rBitmapEx.GetBitmap();
+    const Bitmap& aBitmap = rBitmapEx.GetBitmap();
     Bitmap result = filter(aBitmap);
     return BitmapEx(result, rBitmapEx.GetAlphaMask());
 }
diff --git a/vcl/source/bitmap/BitmapLightenFilter.cxx 
b/vcl/source/bitmap/BitmapLightenFilter.cxx
index a5c4f71e6388..19db81dab40d 100644
--- a/vcl/source/bitmap/BitmapLightenFilter.cxx
+++ b/vcl/source/bitmap/BitmapLightenFilter.cxx
@@ -17,7 +17,7 @@ BitmapEx BitmapLightenFilter::execute(BitmapEx const& 
rBitmapEx) const
 {
     const Size aSize(rBitmapEx.GetSizePixel());
 
-    Bitmap aBitmap(rBitmapEx.GetBitmap());
+    const Bitmap& aBitmap(rBitmapEx.GetBitmap());
     Bitmap aDarkBitmap(aSize, vcl::PixelFormat::N24_BPP);
 
     BitmapScopedReadAccess pRead(aBitmap);
diff --git a/vcl/source/bitmap/BitmapMaskToAlphaFilter.cxx 
b/vcl/source/bitmap/BitmapMaskToAlphaFilter.cxx
index acae8f516edf..648394e178f3 100644
--- a/vcl/source/bitmap/BitmapMaskToAlphaFilter.cxx
+++ b/vcl/source/bitmap/BitmapMaskToAlphaFilter.cxx
@@ -20,7 +20,7 @@ BitmapEx BitmapMaskToAlphaFilter::execute(BitmapEx const& 
rBitmapEx) const
 {
     const Size aSize(rBitmapEx.GetSizePixel());
 
-    Bitmap aBitmap(rBitmapEx.GetBitmap());
+    const Bitmap& aBitmap(rBitmapEx.GetBitmap());
     Bitmap aOutBitmap(aSize, vcl::PixelFormat::N8_BPP, 
&Bitmap::GetGreyPalette(256));
 
     BitmapScopedReadAccess pRead(aBitmap);
diff --git a/vcl/source/bitmap/BitmapShadowFilter.cxx 
b/vcl/source/bitmap/BitmapShadowFilter.cxx
index 00174fd67ec1..fd5c7ea45783 100644
--- a/vcl/source/bitmap/BitmapShadowFilter.cxx
+++ b/vcl/source/bitmap/BitmapShadowFilter.cxx
@@ -14,7 +14,7 @@
 
 BitmapEx BitmapShadowFilter::execute(BitmapEx const& rBitmapEx) const
 {
-    BitmapEx aBitmapEx(rBitmapEx);
+    const BitmapEx& aBitmapEx(rBitmapEx);
     BitmapScopedWriteAccess 
pWriteAccess(const_cast<Bitmap&>(aBitmapEx.GetBitmap()));
 
     if (!pWriteAccess)
diff --git a/vcl/source/bitmap/BitmapTools.cxx 
b/vcl/source/bitmap/BitmapTools.cxx
index 01a8ff3385d7..e55575e8b934 100644
--- a/vcl/source/bitmap/BitmapTools.cxx
+++ b/vcl/source/bitmap/BitmapTools.cxx
@@ -289,8 +289,8 @@ BitmapEx CreateFromData( RawBitmap&& rawBitmap )
 
 void fillWithData(sal_uInt8* pData, BitmapEx const& rBitmapEx)
 {
-    Bitmap aBitmap = rBitmapEx.GetBitmap();
-    AlphaMask aAlphaMask = rBitmapEx.GetAlphaMask();
+    const Bitmap& aBitmap = rBitmapEx.GetBitmap();
+    const AlphaMask& aAlphaMask = rBitmapEx.GetAlphaMask();
     BitmapScopedReadAccess aReadAccessBitmap(aBitmap);
     BitmapScopedReadAccess aReadAccessAlpha(aAlphaMask);
 
@@ -413,7 +413,7 @@ BitmapEx CanvasTransformBitmap( const BitmapEx&             
    rBitmap,
         return BitmapEx();
 
     const Size aBmpSize( rBitmap.GetSizePixel() );
-    Bitmap aSrcBitmap( rBitmap.GetBitmap() );
+    const Bitmap& aSrcBitmap( rBitmap.GetBitmap() );
     Bitmap aSrcAlpha;
 
     // differentiate mask and alpha channel (on-off
@@ -731,7 +731,7 @@ static bool readAlpha( BitmapReadAccess const * 
pAlphaReadAcc, tools::Long nY, c
  **/
 void CanvasCairoExtractBitmapData( BitmapEx const & aBmpEx, Bitmap & aBitmap, 
unsigned char*& data, bool& bHasAlpha, tools::Long& rnWidth, tools::Long& 
rnHeight )
 {
-    AlphaMask aAlpha = aBmpEx.GetAlphaMask();
+    const AlphaMask& aAlpha = aBmpEx.GetAlphaMask();
 
     BitmapScopedReadAccess pBitmapReadAcc( aBitmap );
     BitmapScopedReadAccess pAlphaReadAcc;
@@ -1022,7 +1022,7 @@ void CanvasCairoExtractBitmapData( BitmapEx const & 
aBmpEx, Bitmap & aBitmap, un
 
     uno::Sequence< sal_Int8 > CanvasExtractBitmapData(BitmapEx const & 
rBitmapEx, const geometry::IntegerRectangle2D& rect)
     {
-        Bitmap aBitmap( rBitmapEx.GetBitmap() );
+        const Bitmap& aBitmap( rBitmapEx.GetBitmap() );
         Bitmap aAlpha( rBitmapEx.GetAlphaMask().GetBitmap() );
 
         BitmapScopedReadAccess pReadAccess( aBitmap );
@@ -1107,7 +1107,7 @@ void CanvasCairoExtractBitmapData( BitmapEx const & 
aBmpEx, Bitmap & aBitmap, un
 
         if(!rBitmapEx.IsAlpha())
         {
-            Bitmap aBitmap(rBitmapEx.GetBitmap());
+            const Bitmap& aBitmap(rBitmapEx.GetBitmap());
 
             if(8 == aBitmap.GetSizePixel().Width() && 8 == 
aBitmap.GetSizePixel().Height())
             {
@@ -1220,7 +1220,7 @@ void CanvasCairoExtractBitmapData( BitmapEx const & 
aBmpEx, Bitmap & aBitmap, un
 
 bool convertBitmap32To24Plus8(BitmapEx const & rInput, BitmapEx & rResult)
 {
-    Bitmap aBitmap(rInput.GetBitmap());
+    const Bitmap& aBitmap(rInput.GetBitmap());
     if (aBitmap.getPixelFormat() != vcl::PixelFormat::N32_BPP)
         return false;
 
diff --git a/vcl/source/filter/eps/eps.cxx b/vcl/source/filter/eps/eps.cxx
index 22131a80a03e..ccd62939fd56 100644
--- a/vcl/source/filter/eps/eps.cxx
+++ b/vcl/source/filter/eps/eps.cxx
@@ -819,7 +819,7 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, 
VirtualDevice& rVDev )
                 Bitmap aBitmap( aBitmapEx.GetBitmap() );
                 if ( mbGrayScale )
                     aBitmap.Convert( BmpConversion::N8BitGreys );
-                AlphaMask aMask( aBitmapEx.GetAlphaMask() );
+                const AlphaMask& aMask( aBitmapEx.GetAlphaMask() );
                 Point aPoint( static_cast<const 
MetaBmpExAction*>(pMA)->GetPoint() );
                 Size aSize( rVDev.PixelToLogic( aBitmap.GetSizePixel() ) );
                 ImplBmp( &aBitmap, &aMask, aPoint, aSize.Width(), 
aSize.Height() );
@@ -832,7 +832,7 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, 
VirtualDevice& rVDev )
                 Bitmap aBitmap( aBitmapEx.GetBitmap() );
                 if ( mbGrayScale )
                     aBitmap.Convert( BmpConversion::N8BitGreys );
-                AlphaMask aMask( aBitmapEx.GetAlphaMask() );
+                const AlphaMask& aMask( aBitmapEx.GetAlphaMask() );
                 Point aPoint = static_cast<const 
MetaBmpExScaleAction*>(pMA)->GetPoint();
                 Size aSize( static_cast<const 
MetaBmpExScaleAction*>(pMA)->GetSize() );
                 ImplBmp( &aBitmap, &aMask, aPoint, aSize.Width(), 
aSize.Height() );
@@ -898,7 +898,7 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, 
VirtualDevice& rVDev )
                 if ( aWallpaper.IsBitmap() )
                 {
                     BitmapEx aBitmapEx = aWallpaper.GetBitmap();
-                    Bitmap aBitmap( aBitmapEx.GetBitmap() );
+                    const Bitmap& aBitmap( aBitmapEx.GetBitmap() );
                     if ( aBitmapEx.IsAlpha() )
                     {
                         if ( aWallpaper.IsGradient() )
@@ -907,7 +907,7 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, 
VirtualDevice& rVDev )
                         // gradient action
 
                         }
-                        AlphaMask aMask( aBitmapEx.GetAlphaMask() );
+                        const AlphaMask& aMask( aBitmapEx.GetAlphaMask() );
                         ImplBmp( &aBitmap, &aMask, Point( aRect.Left(), 
aRect.Top() ), aRect.GetWidth(), aRect.GetHeight() );
                     }
                     else
diff --git a/vcl/source/filter/graphicfilter.cxx 
b/vcl/source/filter/graphicfilter.cxx
index cab6032d187c..c265c16866af 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -1545,7 +1545,7 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& 
rGraphic, std::u16string_vi
                     rOStm.SetVersion( nVersion );
 
                 // #i119735# just use GetGDIMetaFile, it will create a 
buffered version of contained bitmap now automatically
-                GDIMetaFile aMTF(aGraphic.GetGDIMetaFile());
+                const GDIMetaFile& aMTF(aGraphic.GetGDIMetaFile());
 
                 SvmWriter aWriter( rOStm );
                 aWriter.Write( aMTF );
diff --git a/vcl/source/filter/svm/SvmWriter.cxx 
b/vcl/source/filter/svm/SvmWriter.cxx
index ca0832dc2d63..0720d4b27f9c 100644
--- a/vcl/source/filter/svm/SvmWriter.cxx
+++ b/vcl/source/filter/svm/SvmWriter.cxx
@@ -1380,7 +1380,7 @@ void SvmWriter::FloatTransparentHandler(const 
MetaFloatTransparentAction* pActio
     VersionCompatWrite aCompat(mrStream, bSVG ? 2 : 1);
 
     SvmWriter aWriter(mrStream);
-    GDIMetaFile aMtf = pAction->GetGDIMetaFile();
+    const GDIMetaFile& aMtf = pAction->GetGDIMetaFile();
     aWriter.Write(aMtf);
     TypeSerializer aSerializer(mrStream);
     aSerializer.writePoint(pAction->GetPoint());
@@ -1415,7 +1415,7 @@ void SvmWriter::EPSHandler(const MetaEPSAction* pAction)
     aSerializer.writeSize(pAction->GetSize());
 
     SvmWriter aWriter(mrStream);
-    GDIMetaFile aMtf = pAction->GetSubstitute();
+    const GDIMetaFile& aMtf = pAction->GetSubstitute();
     aWriter.Write(aMtf);
 }
 
diff --git a/vcl/source/filter/webp/writer.cxx 
b/vcl/source/filter/webp/writer.cxx
index da20e2dcc18e..cd63cd2d2786 100644
--- a/vcl/source/filter/webp/writer.cxx
+++ b/vcl/source/filter/webp/writer.cxx
@@ -92,7 +92,7 @@ static bool writeWebp(SvStream& rStream, const BitmapEx& 
bitmapEx, bool lossless
 
     // Apparently libwebp needs the entire image data at once in WebPPicture,
     // so allocate it and copy there.
-    Bitmap bitmap(bitmapEx.GetBitmap());
+    const Bitmap& bitmap(bitmapEx.GetBitmap());
     AlphaMask bitmapAlpha;
     if (bitmapEx.IsAlpha())
         bitmapAlpha = bitmapEx.GetAlphaMask();
diff --git a/vcl/source/gdi/TypeSerializer.cxx 
b/vcl/source/gdi/TypeSerializer.cxx
index 4a0a0bfba118..6c1ae34e9de2 100644
--- a/vcl/source/gdi/TypeSerializer.cxx
+++ b/vcl/source/gdi/TypeSerializer.cxx
@@ -354,7 +354,7 @@ void TypeSerializer::writeGraphic(const Graphic& rGraphic)
 
             case GraphicType::Bitmap:
             {
-                auto pVectorGraphicData = aGraphic.getVectorGraphicData();
+                const auto& pVectorGraphicData = 
aGraphic.getVectorGraphicData();
                 if (pVectorGraphicData)
                 {
                     // stream out Vector Graphic defining data (length, byte 
array and evtl. path)
diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx
index 06b033709941..534a72350f21 100644
--- a/vcl/source/gdi/graph.cxx
+++ b/vcl/source/gdi/graph.cxx
@@ -200,7 +200,7 @@ Graphic::Graphic(const Image& rImage)
     // FIXME: should really defer the BitmapEx load.
     : mxImpGraphic(new ImpGraphic(rImage.GetBitmapEx()))
 {
-    OUString aStock = rImage.GetStock();
+    const OUString& aStock = rImage.GetStock();
     if (aStock.getLength())
         mxImpGraphic->setOriginURL("private:graphicrepository/" + aStock);
 }
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index de1b0492bd28..347dd5dc651b 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -676,7 +676,7 @@ const GDIMetaFile& ImpGraphic::getGDIMetaFile() const
         if (1 == aSequence.size())
         {
             // try to cast to MetafileAccessor implementation
-            const css::uno::Reference< css::graphic::XPrimitive2D > 
xReference(aSequence[0]);
+            const css::uno::Reference< css::graphic::XPrimitive2D >& 
xReference(aSequence[0]);
             auto pUnoPrimitive = static_cast< const 
drawinglayer::primitive2d::UnoPrimitive2D* >(xReference.get());
             if (pUnoPrimitive)
             {
diff --git a/vcl/source/gdi/mtfxmldump.cxx b/vcl/source/gdi/mtfxmldump.cxx
index 3bd60f8ef11f..dee6bb098e5e 100644
--- a/vcl/source/gdi/mtfxmldump.cxx
+++ b/vcl/source/gdi/mtfxmldump.cxx
@@ -594,7 +594,7 @@ OString toHexString(const std::vector<unsigned char>& a)
 
 void writeBitmapContentChecksum(tools::XmlWriter& rWriter, Bitmap const& 
rBitmap)
 {
-    Bitmap aBitmap(rBitmap);
+    const Bitmap& aBitmap(rBitmap);
 
     comphelper::Hash aHashEngine(comphelper::HashType::SHA1);
     BitmapScopedReadAccess pReadAccess(aBitmap);
@@ -659,7 +659,7 @@ void MetafileXmlDump::dump(const GDIMetaFile& rMetaFile, 
SvStream& rStream)
 
 void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, tools::XmlWriter& 
rWriter)
 {
-    MapMode aMtfMapMode = rMetaFile.GetPrefMapMode();
+    const MapMode& aMtfMapMode = rMetaFile.GetPrefMapMode();
     rWriter.attribute("mapunit", 
convertMapUnitToString(aMtfMapMode.GetMapUnit()));
     writePoint(rWriter, aMtfMapMode.GetOrigin());
     rWriter.attribute("scalex", 
convertFractionToString(aMtfMapMode.GetScaleX()));
diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx 
b/vcl/source/gdi/pdfwriter_impl2.cxx
index a06dbdb291d5..5c556d3bc726 100644
--- a/vcl/source/gdi/pdfwriter_impl2.cxx
+++ b/vcl/source/gdi/pdfwriter_impl2.cxx
@@ -497,7 +497,7 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& 
i_rMtf, vcl::PDFExtOutDevDa
                                 xVDev->EnableMapMode( false );
 
                                 AlphaMask aAlpha(xVDev->GetBitmap(Point(), 
xVDev->GetOutputSizePixel()));
-                                AlphaMask aPaintAlpha(aPaint.GetAlphaMask());
+                                const AlphaMask& 
aPaintAlpha(aPaint.GetAlphaMask());
                                 // The alpha mask is inverted from what is
                                 // expected so invert it again. To test this
                                 // code, export to PDF the transparent shapes,
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index ce3e3786a450..9833aa125771 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -203,7 +203,7 @@ void Printer::DrawDeviceBitmapEx( const Point& rDestPt, 
const Size& rDestSize,
     }
     else
     {
-        Bitmap aBmp( rBmpEx.GetBitmap() );
+        const Bitmap& aBmp( rBmpEx.GetBitmap() );
         ImplPrintTransparent( aBmp, rDestPt, rDestSize, rSrcPtPixel, 
rSrcSizePixel );
     }
 }
@@ -842,7 +842,7 @@ Printer::Printer( const JobSetup& rJobSetup )
 {
     ImplInitData();
     const ImplJobSetup& rConstData = rJobSetup.ImplGetConstData();
-    OUString aDriver = rConstData.GetDriver();
+    const OUString& aDriver = rConstData.GetDriver();
     SalPrinterQueueInfo* pInfo = ImplGetQueueInfo( rConstData.GetPrinterName(),
                                                    &aDriver );
     if ( pInfo )
@@ -1086,7 +1086,7 @@ bool Printer::SetPrinterProps( const Printer* pPrinter )
         }
 
         // Construct new printer
-        OUString aDriver = pPrinter->GetDriverName();
+        const OUString& aDriver = pPrinter->GetDriverName();
         SalPrinterQueueInfo* pInfo = ImplGetQueueInfo( pPrinter->GetName(), 
&aDriver );
         if ( pInfo )
         {
diff --git a/vcl/source/graphic/UnoGraphic.cxx 
b/vcl/source/graphic/UnoGraphic.cxx
index b91d6ad9de09..e6d2b6b8f905 100644
--- a/vcl/source/graphic/UnoGraphic.cxx
+++ b/vcl/source/graphic/UnoGraphic.cxx
@@ -232,7 +232,7 @@ uno::Reference< graphic::XGraphic > SAL_CALL 
Graphic::applyDuotone(
     ::Graphic aReturnGraphic;
 
     BitmapEx    aBitmapEx( aGraphic.GetBitmapEx() );
-    AlphaMask   aMask( aBitmapEx.GetAlphaMask() );
+    const AlphaMask&   aMask( aBitmapEx.GetAlphaMask() );
 
     BitmapEx    aTmpBmpEx(aBitmapEx.GetBitmap());
     BitmapFilter::Filter(aTmpBmpEx,
diff --git a/vcl/source/outdev/background.cxx b/vcl/source/outdev/background.cxx
index 7c07367a82b4..d73cb786682d 100644
--- a/vcl/source/outdev/background.cxx
+++ b/vcl/source/outdev/background.cxx
@@ -55,7 +55,7 @@ void OutputDevice::SetBackground( const Wallpaper& 
rBackground )
     }
     else if( rBackground.IsBitmap())
     {
-        BitmapEx bitmap = rBackground.GetBitmap();
+        const BitmapEx& bitmap = rBackground.GetBitmap();
         if( bitmap.IsAlpha())
             mpAlphaVDev->SetBackground( Wallpaper( BitmapEx( 
bitmap.GetAlphaMask().GetBitmap() ) ) );
         else
diff --git a/vcl/source/outdev/transparent.cxx 
b/vcl/source/outdev/transparent.cxx
index c98f84823c67..a1e965f3a177 100644
--- a/vcl/source/outdev/transparent.cxx
+++ b/vcl/source/outdev/transparent.cxx
@@ -663,7 +663,7 @@ void OutputDevice::DrawTransparent( const GDIMetaFile& 
rMtf, const Point& rPos,
                     xVDev->EnableMapMode(false);
 
                     AlphaMask aAlpha(xVDev->GetBitmap(aPoint, 
xVDev->GetOutputSizePixel()));
-                    AlphaMask aPaintAlpha(aPaint.GetAlphaMask());
+                    const AlphaMask& aPaintAlpha(aPaint.GetAlphaMask());
                     // The alpha mask is inverted from what
                     // is expected so invert it again
                     aAlpha.Invert(); // convert to alpha
@@ -700,7 +700,7 @@ void OutputDevice::DrawTransparent( const GDIMetaFile& 
rMtf, const Point& rPos,
                     xVDev->EnableMapMode( false );
 
                     AlphaMask aAlpha(xVDev->GetBitmap(Point(), 
xVDev->GetOutputSizePixel()));
-                    AlphaMask aPaintAlpha(aPaint.GetAlphaMask());
+                    const AlphaMask& aPaintAlpha(aPaint.GetAlphaMask());
                     // The alpha mask is inverted from what
                     // is expected so invert it again
                     aAlpha.Invert(); // convert to alpha
diff --git a/vcl/source/window/NotebookBarAddonsMerger.cxx 
b/vcl/source/window/NotebookBarAddonsMerger.cxx
index b7027d9d468f..df744aeca84b 100644
--- a/vcl/source/window/NotebookBarAddonsMerger.cxx
+++ b/vcl/source/window/NotebookBarAddonsMerger.cxx
@@ -156,7 +156,7 @@ void MergeNotebookBarMenuAddons(Menu* pPopupMenu, sal_Int16 
nItemId, const OUStr
             AddonNotebookBarItem aAddonNotebookBarItem;
             Image sImage;
             MenuItemBits nBits = MenuItemBits::ICON;
-            const css::uno::Sequence<css::beans::PropertyValue> pExtension = 
aExtension[nSecIdx];
+            const css::uno::Sequence<css::beans::PropertyValue>& pExtension = 
aExtension[nSecIdx];
 
             GetAddonNotebookBarItem(pExtension, aAddonNotebookBarItem);
 
diff --git a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx 
b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
index 3dcc32a4c88e..446a2a217a6f 100644
--- a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
+++ b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
@@ -966,7 +966,7 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute()
                     Sequence < OUString > aPathSeq = getFiles();
                     if( aPathSeq.getLength() == 1 )
                     {
-                        OUString sFileName = aPathSeq[0];
+                        const OUString& sFileName = aPathSeq[0];
                         if (::utl::UCBContentHelper::Exists(sFileName))
                         {
                             INetURLObject aFileObj(sFileName);
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 70d595ef3dba..8ae81f64da1b 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -4917,7 +4917,7 @@ namespace
     {
         Image aImage(rImage);
 
-        OUString sStock(aImage.GetStock());
+        const OUString& sStock(aImage.GetStock());
         if (!sStock.isEmpty())
             return load_icon_by_name(sStock);
 
diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx
index 0f89a68c1156..d5094cd9fea6 100644
--- a/vcl/workben/vcldemo.cxx
+++ b/vcl/workben/vcldemo.cxx
@@ -1404,7 +1404,7 @@ public:
                     rDev.DrawBitmap(aBelow, aGrey);
 
                     aBelow.Move(aGrey.GetSizePixel().Width(),0);
-                    BitmapEx aGreyMask(aSrc);
+                    const BitmapEx& aGreyMask(aSrc);
                     rDev.DrawBitmapEx(aBelow, aGreyMask);
 
                     aLocation.Move(aSrc.GetSizePixel().Width()*6,0);

Reply via email to