include/oox/dump/dumperbase.hxx                |    4 +--
 oox/source/core/xmlfilterbase.cxx              |    6 ++---
 oox/source/drawingml/fillproperties.cxx        |    2 -
 oox/source/drawingml/fontworkhelpers.cxx       |    2 -
 oox/source/drawingml/shape.cxx                 |    6 ++---
 oox/source/drawingml/textbody.cxx              |    4 ---
 oox/source/export/ThemeExport.cxx              |    4 +--
 oox/source/export/drawingml.cxx                |    4 +--
 oox/source/export/shapes.cxx                   |    2 -
 sc/qa/unit/ucalc_sparkline.cxx                 |    4 +--
 sc/source/core/data/bcaslot.cxx                |    6 ++---
 sc/source/core/data/documen4.cxx               |    4 +--
 sc/source/core/data/document10.cxx             |    2 -
 sc/source/core/tool/charthelper.cxx            |    6 ++---
 sc/source/core/tool/chartlis.cxx               |   16 ++++++-------
 sc/source/core/tool/compiler.cxx               |    2 -
 sc/source/core/tool/dbdata.cxx                 |    6 ++---
 sc/source/core/tool/interpr2.cxx               |   12 +++++-----
 sc/source/filter/excel/export/SparklineExt.cxx |    8 +++---
 sc/source/filter/excel/xeescher.cxx            |    4 +--
 sc/source/filter/excel/xeformula.cxx           |   16 ++++++-------
 sc/source/filter/excel/xelink.cxx              |   30 ++++++++++++-------------
 sc/source/filter/excel/xipivot.cxx             |   12 +++++-----
 sc/source/filter/html/htmlimp.cxx              |    2 -
 sc/source/filter/xml/SparklineGroupsExport.cxx |    4 +--
 sc/source/filter/xml/xmlbodyi.cxx              |    2 -
 sc/source/filter/xml/xmldrani.cxx              |    2 -
 sc/source/filter/xml/xmlexprt.cxx              |    8 +++---
 sc/source/filter/xml/xmltransformationi.cxx    |    6 +----
 sc/source/ui/app/inputhdl.cxx                  |    4 +--
 sc/source/ui/dbgui/pvfundlg.cxx                |    4 +--
 sc/source/ui/drawfunc/drawsh.cxx               |    4 +--
 sc/source/ui/drawfunc/drtxtob.cxx              |    6 ++---
 sc/source/ui/formdlg/dwfunctr.cxx              |    2 -
 sc/source/ui/miscdlgs/tabbgcolordlg.cxx        |    2 -
 sc/source/ui/optdlg/opredlin.cxx               |    2 -
 sc/source/ui/optdlg/tpcalc.cxx                 |    6 ++---
 sc/source/ui/optdlg/tpcompatibility.cxx        |    2 -
 sc/source/ui/optdlg/tpdefaults.cxx             |    2 -
 sc/source/ui/optdlg/tpformula.cxx              |    6 ++---
 sc/source/ui/optdlg/tpprint.cxx                |    4 +--
 sc/source/ui/optdlg/tpusrlst.cxx               |    4 +--
 sc/source/ui/optdlg/tpview.cxx                 |   10 ++++----
 sc/source/ui/pagedlg/areasdlg.cxx              |    4 +--
 sc/source/ui/theme/ThemeColorChanger.cxx       |    4 +--
 sc/source/ui/unoobj/chart2uno.cxx              |    4 +--
 sc/source/ui/unoobj/chartuno.cxx               |    8 +++---
 sc/source/ui/view/cellsh1.cxx                  |    2 -
 sc/source/ui/view/editsh.cxx                   |    6 ++---
 sc/source/ui/view/gridwin.cxx                  |    4 +--
 sc/source/ui/view/olinewin.cxx                 |    6 ++---
 sc/source/ui/view/output2.cxx                  |    6 ++---
 sc/source/ui/view/tabvwsha.cxx                 |    6 ++---
 sc/source/ui/view/viewfun3.cxx                 |   18 +++++++--------
 54 files changed, 154 insertions(+), 158 deletions(-)

New commits:
commit e27fd62bd83e5d78f544f661e8aa7e86d3a53c4d
Author:     Noel Grandin <[email protected]>
AuthorDate: Mon Nov 11 19:33:26 2024 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Tue Nov 12 07:26:07 2024 +0100

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

diff --git a/include/oox/dump/dumperbase.hxx b/include/oox/dump/dumperbase.hxx
index f80b2f4d93f0..64ec991b04fa 100644
--- a/include/oox/dump/dumperbase.hxx
+++ b/include/oox/dump/dumperbase.hxx
@@ -911,14 +911,14 @@ std::shared_ptr< ListType > Config::createNameList( const 
String& rListName )
 template< typename Type >
 OUString Config::getName( const NameListWrapper& rListWrp, Type nKey ) const
 {
-    NameListRef xList = rListWrp.getNameList( *this );
+    const NameListRef& xList = rListWrp.getNameList( *this );
     return xList ? xList->getName( *this, nKey ) : OOX_DUMP_ERR_NOMAP;
 }
 
 template< typename Type >
 bool Config::hasName( const NameListWrapper& rListWrp, Type nKey ) const
 {
-    NameListRef xList = rListWrp.getNameList( *this );
+    const NameListRef& xList = rListWrp.getNameList( *this );
     return xList.get() && xList->hasName( nKey );
 }
 
diff --git a/oox/source/core/xmlfilterbase.cxx 
b/oox/source/core/xmlfilterbase.cxx
index ac00c12d2b8f..2f5c7a84d72a 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -1212,8 +1212,8 @@ void XmlFilterBase::exportCustomFragments()
     // Expect customXmlDomPropslist.getLength() == 
customXmlDomlist.getLength().
     for (sal_Int32 j = 0; j < customXmlDomlist.getLength(); j++)
     {
-        uno::Reference<xml::dom::XDocument> customXmlDom = customXmlDomlist[j];
-        uno::Reference<xml::dom::XDocument> customXmlDomProps = 
customXmlDomPropslist[j];
+        const uno::Reference<xml::dom::XDocument>& customXmlDom = 
customXmlDomlist[j];
+        const uno::Reference<xml::dom::XDocument>& customXmlDomProps = 
customXmlDomPropslist[j];
         const OUString fragmentPath = "customXml/item" + OUString::number(j+1) 
+ ".xml";
         if (customXmlDom.is())
         {
@@ -1246,7 +1246,7 @@ void XmlFilterBase::exportCustomFragments()
     for (sal_Int32 j = 0; j < customFragments.getLength(); j++)
     {
         addRelation(customFragmentTypes[j], customFragmentTargets[j]);
-        const OUString aFilename = customFragmentTargets[j];
+        const OUString& aFilename = customFragmentTargets[j];
         Reference<XOutputStream> xOutStream = openOutputStream(aFilename);
         if (xOutStream.is())
         {
diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index 49a0c9e50bdc..ec2a10da02fe 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -208,7 +208,7 @@ Reference<XGraphic> lclApplyBlackWhiteEffect(const 
BlipFillProperties& aBlipProp
         ::Graphic aReturnGraphic;
 
         BitmapEx aBitmapEx(aGraphic.GetBitmapEx());
-        AlphaMask aMask(aBitmapEx.GetAlphaMask());
+        const AlphaMask& aMask(aBitmapEx.GetAlphaMask());
 
         BitmapEx aTmpBmpEx(aBitmapEx.GetBitmap());
         BitmapFilter::Filter(aTmpBmpEx, BitmapMonochromeFilter{ nThreshold });
diff --git a/oox/source/drawingml/fontworkhelpers.cxx 
b/oox/source/drawingml/fontworkhelpers.cxx
index d9fa4fb8d4d6..565f6b6c7b88 100644
--- a/oox/source/drawingml/fontworkhelpers.cxx
+++ b/oox/source/drawingml/fontworkhelpers.cxx
@@ -1079,7 +1079,7 @@ OUString lcl_getWMarkupStringForThemeColor(const 
model::ComplexColor& rComplexCo
 bool lcl_getThemeColorTransformationValue(const model::ComplexColor& 
rComplexColor,
                                           const model::TransformationType& 
rType, sal_Int16& rValue)
 {
-    const std::vector<model::Transformation> 
aTransVec(rComplexColor.getTransformations());
+    const std::vector<model::Transformation>& 
aTransVec(rComplexColor.getTransformations());
     auto bItemFound
         = [rType](const model::Transformation& rTrans) { return rType == 
rTrans.meType; };
     auto pIt = std::find_if(aTransVec.begin(), aTransVec.end(), bItemFound);
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 8bc71abeb3c7..409b67b58ba2 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -655,7 +655,7 @@ static void lcl_copyCharPropsToShape(const 
uno::Reference<drawing::XShape>& xSha
                                     });
     if (aParaIt != rParagraphs.cend())
     {
-        std::shared_ptr<TextParagraph> pParagraph = *aParaIt;
+        const std::shared_ptr<TextParagraph>& pParagraph = *aParaIt;
         const TextRunVector& rRuns = pParagraph->getRuns();
         auto aRunIt = std::find_if_not(rRuns.cbegin(), rRuns.cend(),
                                        [](const std::shared_ptr<TextRun> pRun)
@@ -666,14 +666,14 @@ static void lcl_copyCharPropsToShape(const 
uno::Reference<drawing::XShape>& xSha
                                        });
         if (aRunIt != rRuns.cend())
         {
-            std::shared_ptr<TextRun> pRun = *aRunIt;
+            const std::shared_ptr<TextRun>& pRun = *aRunIt;
             TextCharacterProperties& rCharProps = 
pRun->getTextCharacterProperties();
 
             // set language
             if (rCharProps.moLang.has_value() && 
!rCharProps.moLang.value().isEmpty())
             {
                 LanguageTag aTag(rCharProps.moLang.value());
-                css::lang::Locale aLocale(aTag.getLocale(false));
+                const css::lang::Locale& aLocale(aTag.getLocale(false));
                 switch (MsLangId::getScriptType(aTag.getLanguageType()))
                 {
                     case css::i18n::ScriptType::LATIN:
diff --git a/oox/source/drawingml/textbody.cxx 
b/oox/source/drawingml/textbody.cxx
index 9d0d2c8d2aac..1d9e45f505f5 100644
--- a/oox/source/drawingml/textbody.cxx
+++ b/oox/source/drawingml/textbody.cxx
@@ -57,14 +57,12 @@ void TextBody::insertAt(
         const TextCharacterProperties& rTextStyleProperties,
         const TextListStylePtr& pMasterTextListStylePtr ) const
 {
-    TextListStyle aMasterTextStyle(*pMasterTextListStylePtr);
-
     Reference<css::beans::XPropertySet> xPropertySet(xAt, UNO_QUERY);
     float nCharHeight = 
xPropertySet->getPropertyValue(u"CharHeight"_ustr).get<float>();
     size_t nIndex = 0;
     for (auto const& paragraph : maParagraphs)
     {
-        paragraph->insertAt(rFilterBase, xText, xAt, rTextStyleProperties, 
aMasterTextStyle,
+        paragraph->insertAt(rFilterBase, xText, xAt, rTextStyleProperties, 
*pMasterTextListStylePtr,
                             maTextListStyle, (nIndex == 0), nCharHeight);
         ++nIndex;
     }
diff --git a/oox/source/export/ThemeExport.cxx 
b/oox/source/export/ThemeExport.cxx
index 533471d9bf9d..400e9a09db39 100644
--- a/oox/source/export/ThemeExport.cxx
+++ b/oox/source/export/ThemeExport.cxx
@@ -57,7 +57,7 @@ void ThemeExport::write(OUString const& rPath, model::Theme 
const& rTheme)
 
     mpFS->startElementNS(XML_a, XML_themeElements);
 
-    const auto pColorSet = rTheme.getColorSet();
+    const auto& pColorSet = rTheme.getColorSet();
 
     mpFS->startElementNS(XML_a, XML_clrScheme, XML_name, pColorSet->getName());
     writeColorSet(rTheme);
@@ -877,7 +877,7 @@ bool ThemeExport::writeColorSet(model::Theme const& rTheme)
         = { XML_dk1,     XML_lt1,     XML_dk2,     XML_lt2,     XML_accent1, 
XML_accent2,
             XML_accent3, XML_accent4, XML_accent5, XML_accent6, XML_hlink,   
XML_folHlink };
 
-    const auto pColorSet = rTheme.getColorSet();
+    const auto& pColorSet = rTheme.getColorSet();
     if (!pColorSet)
         return false;
 
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 9136faa8d609..18334ad0516a 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1799,7 +1799,7 @@ void 
DrawingML::WriteXGraphicBlip(uno::Reference<beans::XPropertySet> const & rX
 
     mpFS->startElementNS(XML_a, XML_blip, FSNS(XML_r, XML_embed), sRelId);
 
-    auto pVectorGraphicDataPtr = aGraphic.getVectorGraphicData();
+    const auto& pVectorGraphicDataPtr = aGraphic.getVectorGraphicData();
 
     if (pVectorGraphicDataPtr && pVectorGraphicDataPtr->getType() == 
VectorGraphicDataType::Svg)
     {
@@ -6567,7 +6567,7 @@ void DrawingML::writeDiagramRels(const 
uno::Sequence<uno::Sequence<uno::Any>>& x
         // diagramDataRelTuple[0] => RID,
         // diagramDataRelTuple[1] => xInputStream
         // diagramDataRelTuple[2] => extension
-        uno::Sequence<uno::Any> diagramDataRelTuple = xRelSeq[j];
+        const uno::Sequence<uno::Any>& diagramDataRelTuple = xRelSeq[j];
 
         OUString sRelId;
         OUString sExtension;
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index a2cac3d42710..38c76ef59952 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1918,7 +1918,7 @@ ShapeExport& ShapeExport::WriteConnectorShape( const 
Reference< XShape >& xShape
         tools::PolyPolygon aPolyPolygon = 
EscherPropertyContainer::GetPolyPolygon(xShape);
         if (aPolyPolygon.Count() > 0)
         {
-            tools::Polygon aPoly = aPolyPolygon.GetObject(0);
+            const tools::Polygon& aPoly = aPolyPolygon.GetObject(0);
             lcl_GetConnectorAdjustValue(xShape, aPoly, eConnectorType, 
aAdjustValueList);
             nAngle = lcl_GetAngle(aPoly);
             lcl_FlipHFlipV(aPoly, nAngle, bFlipH, bFlipV);
commit 22a9cfbc9cc9577b08493828f3192262f76e7ac9
Author:     Noel Grandin <[email protected]>
AuthorDate: Mon Nov 11 19:34:47 2024 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Tue Nov 12 07:25:57 2024 +0100

    loplugin:reftotemp in sc
    
    Change-Id: Ibd0efec208447d0ad3f5d85354cbfc7d276064af
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176420
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/sc/qa/unit/ucalc_sparkline.cxx b/sc/qa/unit/ucalc_sparkline.cxx
index bb423067b699..4d1a8a124bb0 100644
--- a/sc/qa/unit/ucalc_sparkline.cxx
+++ b/sc/qa/unit/ucalc_sparkline.cxx
@@ -74,7 +74,7 @@ CPPUNIT_TEST_FIXTURE(SparklineTest, testAddSparkline)
 
     CPPUNIT_ASSERT_EQUAL(size_t(1), pList->getSparklineGroups().size());
 
-    auto const& aSparklineVector = 
pList->getSparklinesFor(pGetSparkline->getSparklineGroup());
+    auto const aSparklineVector = 
pList->getSparklinesFor(pGetSparkline->getSparklineGroup());
     CPPUNIT_ASSERT_EQUAL(size_t(1), aSparklineVector.size());
     CPPUNIT_ASSERT_EQUAL(aSparklineVector[0].get(), pSparkline);
 
@@ -336,7 +336,7 @@ CPPUNIT_TEST_FIXTURE(SparklineTest, 
testUndoRedoDeleteSparklineGroup)
     CPPUNIT_ASSERT_EQUAL(true, m_pDoc->HasSparkline(ScAddress(3, 6, 0))); // D7
 
     // Check if the sparkline has the input range set
-    auto const& pSparkline = m_pDoc->GetSparkline(ScAddress(3, 6, 0));
+    auto const pSparkline = m_pDoc->GetSparkline(ScAddress(3, 6, 0));
     ScRangeList rRangeList = pSparkline->getInputRange();
     CPPUNIT_ASSERT_EQUAL(size_t(1), rRangeList.size());
     CPPUNIT_ASSERT_EQUAL(ScRange(3, 0, 0, 3, 5, 0), rRangeList[0]);
diff --git a/sc/source/core/data/bcaslot.cxx b/sc/source/core/data/bcaslot.cxx
index c89d44356d8a..92f694c3071b 100644
--- a/sc/source/core/data/bcaslot.cxx
+++ b/sc/source/core/data/bcaslot.cxx
@@ -270,7 +270,7 @@ bool ScBroadcastAreaSlot::AreaBroadcast( const ScHint& 
rHint)
 
     mbHasErasedArea = false;
 
-    const ScRange& rRange = rHint.GetRange();
+    const ScRange aRange = rHint.GetRange();
     for (ScBroadcastAreas::const_iterator aIter( aBroadcastAreaTbl.begin()),
             aIterEnd( aBroadcastAreaTbl.end()); aIter != aIterEnd; ++aIter )
     {
@@ -279,13 +279,13 @@ bool ScBroadcastAreaSlot::AreaBroadcast( const ScHint& 
rHint)
 
         ScBroadcastArea* pArea = (*aIter).mpArea;
         const ScRange& rAreaRange = pArea->GetRange();
-        if (rAreaRange.Intersects( rRange))
+        if (rAreaRange.Intersects( aRange))
         {
             if (pArea->IsGroupListening())
             {
                 if (pBASM->IsInBulkBroadcast())
                 {
-                    pBASM->InsertBulkGroupArea(pArea, rRange);
+                    pBASM->InsertBulkGroupArea(pArea, aRange);
                 }
                 else
                 {
diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx
index fbe2970e3a09..1a2cdeeaf2f4 100644
--- a/sc/source/core/data/documen4.cxx
+++ b/sc/source/core/data/documen4.cxx
@@ -762,7 +762,7 @@ const SfxPoolItem* ScDocument::GetEffItem(
                     {
                         ScAddress aPos(nCol, nRow, nTab);
                         ScRefCellValue aCell(const_cast<ScDocument&>(*this), 
aPos);
-                        const OUString& aStyle = pForm->GetCellStyle(aCell, 
aPos);
+                        const OUString aStyle = pForm->GetCellStyle(aCell, 
aPos);
                         if (!aStyle.isEmpty())
                         {
                             SfxStyleSheetBase* pStyleSheet = 
mxPoolHelper->GetStylePool()->Find(
@@ -812,7 +812,7 @@ const SfxItemSet* ScDocument::GetCondResult(
         if (!pForm)
             continue;
 
-        const OUString& aStyle = pForm->GetCellStyle(rCell, rPos);
+        const OUString aStyle = pForm->GetCellStyle(rCell, rPos);
         if (!aStyle.isEmpty())
         {
             SfxStyleSheetBase* pStyleSheet =
diff --git a/sc/source/core/data/document10.cxx 
b/sc/source/core/data/document10.cxx
index e41a3affd91a..74716ce93dd7 100644
--- a/sc/source/core/data/document10.cxx
+++ b/sc/source/core/data/document10.cxx
@@ -257,7 +257,7 @@ void ScDocument::PreprocessAllRangeNamesUpdate( const 
std::map<OUString, ScRange
         if (!pOldRangeNames)
             continue;
 
-        const auto& itNewTab( rRangeMap.find( itTab.first));
+        const auto itNewTab( rRangeMap.find( itTab.first));
         if (itNewTab == rRangeMap.end())
             continue;
 
diff --git a/sc/source/core/tool/charthelper.cxx 
b/sc/source/core/tool/charthelper.cxx
index 651f2fcdc920..e9d6716693da 100644
--- a/sc/source/core/tool/charthelper.cxx
+++ b/sc/source/core/tool/charthelper.cxx
@@ -301,10 +301,10 @@ void ScChartHelper::AddRangesIfProtectedChart( 
ScRangeListVector& rRangesVector,
             const ScChartListener* pListener = 
pCollection->findByName(aChartName);
             if (pListener)
             {
-                const ScRangeListRef& rRangeList = pListener->GetRangeList();
-                if ( rRangeList.is() )
+                const ScRangeListRef xRangeList = pListener->GetRangeList();
+                if ( xRangeList.is() )
                 {
-                    rRangesVector.push_back( *rRangeList );
+                    rRangesVector.push_back( *xRangeList );
                 }
             }
         }
diff --git a/sc/source/core/tool/chartlis.cxx b/sc/source/core/tool/chartlis.cxx
index 024ff205e1f6..361c3d0d3e7f 100644
--- a/sc/source/core/tool/chartlis.cxx
+++ b/sc/source/core/tool/chartlis.cxx
@@ -550,12 +550,12 @@ void ScChartListenerCollection::SetDiffDirty(
             {
                 if (pCLCmp)
                 {
-                    const ScRangeListRef& rList1 = pCL->GetRangeList();
-                    const ScRangeListRef& rList2 = pCLCmp->GetRangeList();
-                    bool b1 = rList1.is();
-                    bool b2 = rList2.is();
-                    if ( b1 != b2 || (b1 && b2 && (*rList1 != *rList2)) )
-                        rDoc.SetChartRangeList( pCL->GetName(), rList1 );
+                    const ScRangeListRef xList1 = pCL->GetRangeList();
+                    const ScRangeListRef xList2 = pCLCmp->GetRangeList();
+                    bool b1 = xList1.is();
+                    bool b2 = xList2.is();
+                    if ( b1 != b2 || (b1 && b2 && (*xList1 != *xList2)) )
+                        rDoc.SetChartRangeList( pCL->GetName(), xList1 );
                 }
                 else
                     rDoc.SetChartRangeList( pCL->GetName(), 
pCL->GetRangeList() );
@@ -574,8 +574,8 @@ void ScChartListenerCollection::SetRangeDirty( const 
ScRange& rRange )
     for (auto const& it : m_Listeners)
     {
         ScChartListener *const pCL = it.second.get();
-        const ScRangeListRef& rList = pCL->GetRangeList();
-        if ( rList.is() && rList->Intersects( rRange ) )
+        const ScRangeListRef xList = pCL->GetRangeList();
+        if ( xList.is() && xList->Intersects( rRange ) )
         {
             bDirty = true;
             pCL->SetDirty( true );
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index a80671e0b3a5..2425b311844c 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -4452,7 +4452,7 @@ bool ScCompiler::NextNewToken( bool bInArray )
     }
 
     bool bAllowBooleans = bInArray;
-    const std::vector<Whitespace> & vSpaces = NextSymbol(bInArray);
+    const std::vector<Whitespace> vSpaces = NextSymbol(bInArray);
 
     if (!cSymbol[0])
     {
diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index c926983e558f..563ca6058465 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -838,12 +838,12 @@ void ScDBData::RefreshTableColumnNames( ScDocument* pDoc )
         {
             if (pCell->hasString())
             {
-                const OUString& rStr = pCell->getString( pDoc);
-                if (rStr.isEmpty())
+                const OUString aStr = pCell->getString( pDoc);
+                if (aStr.isEmpty())
                     bHaveEmpty = true;
                 else
                 {
-                    SetTableColumnName( aNewNames, nCol-nStartCol, rStr, 0);
+                    SetTableColumnName( aNewNames, nCol-nStartCol, aStr, 0);
                     if (nLastColFilled < nCol-1)
                         bHaveEmpty = true;
                 }
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index d57fbd22b49a..8fa8ffa0f67d 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -2447,12 +2447,12 @@ void ScInterpreter::ScIntersect()
         ScRefList* pRefList = xRes->GetRefList();
         for (const auto& rRef1 : *x1->GetRefList())
         {
-            const ScAddress& r11 = rRef1.Ref1.toAbs(mrDoc, aPos);
-            const ScAddress& r12 = rRef1.Ref2.toAbs(mrDoc, aPos);
+            const ScAddress r11 = rRef1.Ref1.toAbs(mrDoc, aPos);
+            const ScAddress r12 = rRef1.Ref2.toAbs(mrDoc, aPos);
             for (const auto& rRef2 : *x2->GetRefList())
             {
-                const ScAddress& r21 = rRef2.Ref1.toAbs(mrDoc, aPos);
-                const ScAddress& r22 = rRef2.Ref2.toAbs(mrDoc, aPos);
+                const ScAddress r21 = rRef2.Ref1.toAbs(mrDoc, aPos);
+                const ScAddress r22 = rRef2.Ref2.toAbs(mrDoc, aPos);
                 SCCOL nCol1 = ::std::max( r11.Col(), r21.Col());
                 SCROW nRow1 = ::std::max( r11.Row(), r21.Row());
                 SCTAB nTab1 = ::std::max( r11.Tab(), r21.Tab());
@@ -2498,14 +2498,14 @@ void ScInterpreter::ScIntersect()
                 case svDoubleRef:
                 {
                     {
-                        const ScAddress& r = 
pt[i]->GetSingleRef()->toAbs(mrDoc, aPos);
+                        const ScAddress r = 
pt[i]->GetSingleRef()->toAbs(mrDoc, aPos);
                         nC1[i] = r.Col();
                         nR1[i] = r.Row();
                         nT1[i] = r.Tab();
                     }
                     if (sv[i] == svDoubleRef)
                     {
-                        const ScAddress& r = 
pt[i]->GetSingleRef2()->toAbs(mrDoc, aPos);
+                        const ScAddress r = 
pt[i]->GetSingleRef2()->toAbs(mrDoc, aPos);
                         nC2[i] = r.Col();
                         nR2[i] = r.Row();
                         nT2[i] = r.Tab();
diff --git a/sc/source/filter/excel/export/SparklineExt.cxx 
b/sc/source/filter/excel/export/SparklineExt.cxx
index 684e358124e3..e61a16c70f2c 100644
--- a/sc/source/filter/excel/export/SparklineExt.cxx
+++ b/sc/source/filter/excel/export/SparklineExt.cxx
@@ -34,7 +34,7 @@ void SparklineExt::SaveXml(XclExpXmlStream& rStream)
     if (!pSparklineList)
         return;
 
-    auto const& rSparklineGroups = pSparklineList->getSparklineGroups();
+    auto const aSparklineGroups = pSparklineList->getSparklineGroups();
 
     sax_fastparser::FSHelperPtr& rWorksheet = rStream.GetCurrentStream();
     rWorksheet->startElement(XML_ext, FSNS(XML_xmlns, XML_x14),
@@ -43,10 +43,10 @@ void SparklineExt::SaveXml(XclExpXmlStream& rStream)
     rWorksheet->startElementNS(XML_x14, XML_sparklineGroups, FSNS(XML_xmlns, 
XML_xm),
                                rStream.getNamespaceURL(OOX_NS(xm)));
 
-    for (auto const& pSparklineGroup : rSparklineGroups)
+    for (auto const& pSparklineGroup : aSparklineGroups)
     {
-        auto const& rSparklineVector = 
pSparklineList->getSparklinesFor(pSparklineGroup);
-        addSparklineGroup(rStream, *pSparklineGroup, rSparklineVector);
+        auto const aSparklineVector = 
pSparklineList->getSparklinesFor(pSparklineGroup);
+        addSparklineGroup(rStream, *pSparklineGroup, aSparklineVector);
     }
 
     rWorksheet->endElementNS(XML_x14, XML_sparklineGroups);
diff --git a/sc/source/filter/excel/xeescher.cxx 
b/sc/source/filter/excel/xeescher.cxx
index 61d0fc185433..043d78fa8917 100644
--- a/sc/source/filter/excel/xeescher.cxx
+++ b/sc/source/filter/excel/xeescher.cxx
@@ -425,8 +425,8 @@ void XclExpImgData::Save( XclExpStream& rStrm )
         Scanline pScanline = pAccess->GetScanline( nY );
         for( sal_Int32 nX = 0; nX < nWidth; ++nX )
         {
-            const BitmapColor& rBmpColor = pAccess->GetPixelFromData( 
pScanline, nX );
-            rStrm << rBmpColor.GetBlue() << rBmpColor.GetGreen() << 
rBmpColor.GetRed();
+            const BitmapColor aBmpColor = pAccess->GetPixelFromData( 
pScanline, nX );
+            rStrm << aBmpColor.GetBlue() << aBmpColor.GetGreen() << 
aBmpColor.GetRed();
         }
         rStrm.WriteZeroBytes( nPadding );
     }
diff --git a/sc/source/filter/excel/xeformula.cxx 
b/sc/source/filter/excel/xeformula.cxx
index 162f8f2968b7..91b7ec58fa89 100644
--- a/sc/source/filter/excel/xeformula.cxx
+++ b/sc/source/filter/excel/xeformula.cxx
@@ -1294,8 +1294,8 @@ void XclExpFmlaCompImpl::ProcessDdeLink( const 
XclExpScToken& rTokData )
     {
         if ( mxData->mpLinkMgr )
         {
-            if( const auto& rResult = mxData->mpLinkMgr->InsertDde( aApplic, 
aTopic, aItem ) )
-                AppendNameXToken( rResult->mnSupbook, rResult->mnSBTab, 
rTokData.mnSpaces );
+            if( const auto pResult = mxData->mpLinkMgr->InsertDde( aApplic, 
aTopic, aItem ) )
+                AppendNameXToken( pResult->mnSupbook, pResult->mnSBTab, 
rTokData.mnSpaces );
             else
                 AppendErrorToken( EXC_ERR_NA, rTokData.mnSpaces );
         }
@@ -2222,9 +2222,9 @@ void XclExpFmlaCompImpl::ProcessExternalName( const 
XclExpScToken& rTokData )
             const OUString* pFile = rExtRefMgr.getExternalFileName( nFileId );
             if ( pFile )
             {
-                if ( const auto& rResult = mxData->mpLinkMgr->InsertExtName( 
*pFile, aName, xArray ) )
+                if ( const auto pResult = mxData->mpLinkMgr->InsertExtName( 
*pFile, aName, xArray ) )
                 {
-                    AppendNameXToken( rResult->mnSupbook, rResult->mnSBTab, 
rTokData.mnSpaces );
+                    AppendNameXToken( pResult->mnSupbook, pResult->mnSBTab, 
rTokData.mnSpaces );
                     return;
                 }
             }
@@ -2435,9 +2435,9 @@ void XclExpFmlaCompImpl::AppendAddInCallToken( const 
XclExpExtFuncData& rExtFunc
     OUString aXclFuncName;
     if( mxData->mpLinkMgr && ScGlobal::GetAddInCollection()->GetExcelName( 
rExtFuncData.maFuncName, GetUILanguage(), aXclFuncName ) )
     {
-        if ( const auto& rResult = mxData->mpLinkMgr->InsertAddIn( 
aXclFuncName ) )
+        if ( const auto pResult = mxData->mpLinkMgr->InsertAddIn( aXclFuncName 
) )
         {
-            AppendNameXToken( rResult->mnSupbook, rResult->mnSBTab );
+            AppendNameXToken( pResult->mnSupbook, pResult->mnSBTab );
             return;
         }
     }
@@ -2448,8 +2448,8 @@ void XclExpFmlaCompImpl::AppendEuroToolCallToken( const 
XclExpExtFuncData& rExtF
 {
     if ( mxData->mpLinkMgr )
     {
-        if( const auto& rResult = mxData->mpLinkMgr->InsertEuroTool( 
rExtFuncData.maFuncName ) )
-            AppendNameXToken( rResult->mnSupbook, rResult->mnSBTab );
+        if( const auto pResult = mxData->mpLinkMgr->InsertEuroTool( 
rExtFuncData.maFuncName ) )
+            AppendNameXToken( pResult->mnSupbook, pResult->mnSBTab );
         else
             AppendMacroCallToken( rExtFuncData );
     }
diff --git a/sc/source/filter/excel/xelink.cxx 
b/sc/source/filter/excel/xelink.cxx
index 7997e2de48dd..520e06b8ab74 100644
--- a/sc/source/filter/excel/xelink.cxx
+++ b/sc/source/filter/excel/xelink.cxx
@@ -2446,21 +2446,21 @@ void XclExpLinkManagerImpl8::StoreCellRange( sal_uInt16 
nFileId, const OUString&
 
 std::optional<XclExpSBIndex> XclExpLinkManagerImpl8::InsertAddIn( const 
OUString& rName )
 {
-    const auto & rResult = maSBBuffer.InsertAddIn( rName );
-    if( rResult )
+    const auto pResult = maSBBuffer.InsertAddIn( rName );
+    if( pResult )
     {
-        return XclExpSBIndex(InsertXti( XclExpXti( rResult->mnSupbook, 
EXC_TAB_EXTERNAL, EXC_TAB_EXTERNAL ) ), rResult->mnSBTab);
+        return XclExpSBIndex(InsertXti( XclExpXti( pResult->mnSupbook, 
EXC_TAB_EXTERNAL, EXC_TAB_EXTERNAL ) ), pResult->mnSBTab);
     }
     return {};
 }
 
 std::optional<XclExpSBIndex> XclExpLinkManagerImpl8::InsertEuroTool( const 
OUString& rName )
 {
-    const auto & rResult = maSBBuffer.InsertEuroTool( rName );
-    if( rResult )
+    const auto pResult = maSBBuffer.InsertEuroTool( rName );
+    if( pResult )
     {
-        return XclExpSBIndex(InsertXti( XclExpXti( rResult->mnSupbook, 
EXC_TAB_EXTERNAL, EXC_TAB_EXTERNAL ) ),
-                             rResult->mnSBTab);
+        return XclExpSBIndex(InsertXti( XclExpXti( pResult->mnSupbook, 
EXC_TAB_EXTERNAL, EXC_TAB_EXTERNAL ) ),
+                             pResult->mnSBTab);
     }
     return {};
 }
@@ -2468,11 +2468,11 @@ std::optional<XclExpSBIndex> 
XclExpLinkManagerImpl8::InsertEuroTool( const OUStr
 std::optional<XclExpSBIndex> XclExpLinkManagerImpl8::InsertDde(
      const OUString& rApplic, const OUString& rTopic, const OUString& rItem )
 {
-    const auto & rResult = maSBBuffer.InsertDde( rApplic, rTopic, rItem );
-    if( rResult )
+    const auto pResult = maSBBuffer.InsertDde( rApplic, rTopic, rItem );
+    if( pResult )
     {
-        return XclExpSBIndex(InsertXti( XclExpXti( rResult->mnSupbook, 
EXC_TAB_EXTERNAL, EXC_TAB_EXTERNAL ) ),
-                             rResult->mnSBTab);
+        return XclExpSBIndex(InsertXti( XclExpXti( pResult->mnSupbook, 
EXC_TAB_EXTERNAL, EXC_TAB_EXTERNAL ) ),
+                             pResult->mnSBTab);
     }
     return {};
 }
@@ -2480,11 +2480,11 @@ std::optional<XclExpSBIndex> 
XclExpLinkManagerImpl8::InsertDde(
 std::optional<XclExpSBIndex> XclExpLinkManagerImpl8::InsertExtName( const 
OUString& rUrl, const OUString& rName,
 const ScExternalRefCache::TokenArrayRef& rArray )
 {
-    const auto & rResult = maSBBuffer.InsertExtName( rUrl, rName, rArray );
-    if( rResult )
+    const auto pResult = maSBBuffer.InsertExtName( rUrl, rName, rArray );
+    if( pResult )
     {
-        return XclExpSBIndex(InsertXti( XclExpXti( rResult->mnSupbook, 
EXC_TAB_EXTERNAL, EXC_TAB_EXTERNAL ) ),
-                             rResult->mnSBTab);
+        return XclExpSBIndex(InsertXti( XclExpXti( pResult->mnSupbook, 
EXC_TAB_EXTERNAL, EXC_TAB_EXTERNAL ) ),
+                             pResult->mnSBTab);
     }
     return {};
 }
diff --git a/sc/source/filter/excel/xipivot.cxx 
b/sc/source/filter/excel/xipivot.cxx
index 7e67ad4e8ae2..fb14ec4d07eb 100644
--- a/sc/source/filter/excel/xipivot.cxx
+++ b/sc/source/filter/excel/xipivot.cxx
@@ -1110,15 +1110,15 @@ static OUString lcl_convertExcelSubtotalName(const 
OUString& rName)
 
 void XclImpPTField::ConvertRCPField( ScDPSaveData& rSaveData ) const
 {
-    const OUString& rFieldName = GetFieldName();
-    if( rFieldName.isEmpty() )
+    const OUString aFieldName = GetFieldName();
+    if( aFieldName.isEmpty() )
         return;
 
     const XclImpPCField* pCacheField = GetCacheField();
     if( !pCacheField || !pCacheField->IsSupportedField() )
         return;
 
-    ScDPSaveDimension* pTest = rSaveData.GetNewDimensionByName(rFieldName);
+    ScDPSaveDimension* pTest = rSaveData.GetNewDimensionByName(aFieldName);
     if (!pTest)
         return;
 
@@ -1172,15 +1172,15 @@ void XclImpPTField::ConvertRCPField( ScDPSaveData& 
rSaveData ) const
 
 void XclImpPTField::ConvertFieldInfo( const ScDPSaveData& rSaveData, 
ScDPObject* pObj, const XclImpRoot& rRoot, bool bPageField ) const
 {
-    const OUString& rFieldName = GetFieldName();
-    if( rFieldName.isEmpty() )
+    const OUString aFieldName = GetFieldName();
+    if( aFieldName.isEmpty() )
         return;
 
     const XclImpPCField* pCacheField = GetCacheField();
     if( !pCacheField || !pCacheField->IsSupportedField() )
         return;
 
-    ScDPSaveDimension* pSaveDim = 
rSaveData.GetExistingDimensionByName(rFieldName);
+    ScDPSaveDimension* pSaveDim = 
rSaveData.GetExistingDimensionByName(aFieldName);
     if (!pSaveDim)
         return;
 
diff --git a/sc/source/filter/html/htmlimp.cxx 
b/sc/source/filter/html/htmlimp.cxx
index 3168a02fc4eb..724500b7b406 100644
--- a/sc/source/filter/html/htmlimp.cxx
+++ b/sc/source/filter/html/htmlimp.cxx
@@ -65,7 +65,7 @@ ScHTMLImport::ScHTMLImport( ScDocument* pDocP, const 
OUString& rBaseURL, const S
 {
     Size aPageSize;
     OutputDevice* pDefaultDev = Application::GetDefaultDevice();
-    const OUString& aPageStyle = mpDoc->GetPageStyle( rRange.aStart.Tab() );
+    const OUString aPageStyle = mpDoc->GetPageStyle( rRange.aStart.Tab() );
     ScStyleSheet* pStyleSheet = static_cast<ScStyleSheet*>(mpDoc->
         GetStyleSheetPool()->Find( aPageStyle, SfxStyleFamily::Page ));
     if ( pStyleSheet )
diff --git a/sc/source/filter/xml/SparklineGroupsExport.cxx 
b/sc/source/filter/xml/SparklineGroupsExport.cxx
index e4bd3f4e0a18..2048e421cb0d 100644
--- a/sc/source/filter/xml/SparklineGroupsExport.cxx
+++ b/sc/source/filter/xml/SparklineGroupsExport.cxx
@@ -218,7 +218,7 @@ void SparklineGroupsExport::write()
     auto* pDocument = m_rExport.GetDocument();
     if (sc::SparklineList* pSparklineList = 
pDocument->GetSparklineList(m_nTable))
     {
-        auto const& aSparklineGroups = pSparklineList->getSparklineGroups();
+        auto const aSparklineGroups = pSparklineList->getSparklineGroups();
         if (!aSparklineGroups.empty())
         {
             SvXMLElementExport aElement(m_rExport, XML_NAMESPACE_CALC_EXT, 
XML_SPARKLINE_GROUPS,
@@ -226,7 +226,7 @@ void SparklineGroupsExport::write()
 
             for (auto const& pSparklineGroup : aSparklineGroups)
             {
-                auto const& aSparklines = 
pSparklineList->getSparklinesFor(pSparklineGroup);
+                auto const aSparklines = 
pSparklineList->getSparklinesFor(pSparklineGroup);
                 addSparklineGroup(pSparklineGroup, aSparklines);
             }
         }
diff --git a/sc/source/filter/xml/xmlbodyi.cxx 
b/sc/source/filter/xml/xmlbodyi.cxx
index 0b75b50466eb..2eec7feaab0f 100644
--- a/sc/source/filter/xml/xmlbodyi.cxx
+++ b/sc/source/filter/xml/xmlbodyi.cxx
@@ -71,7 +71,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;
-        const 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/xmldrani.cxx 
b/sc/source/filter/xml/xmldrani.cxx
index 99a979319523..cce484918d21 100644
--- a/sc/source/filter/xml/xmldrani.cxx
+++ b/sc/source/filter/xml/xmldrani.cxx
@@ -694,7 +694,7 @@ ScXMLSortGroupsContext::ScXMLSortGroupsContext( 
ScXMLImport& rImport,
         {
             case XML_ELEMENT( TABLE, XML_DATA_TYPE ):
             {
-                const OUString &sValue = aIter.toString();
+                const OUString sValue = aIter.toString();
                 if (sValue.getLength() > 8)
                 {
                     std::u16string_view sTemp = sValue.subView(0, 8);
diff --git a/sc/source/filter/xml/xmlexprt.cxx 
b/sc/source/filter/xml/xmlexprt.cxx
index c30254a9c703..19722fe6bbd8 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -3424,10 +3424,10 @@ void ScXMLExport::ExportShape(const uno::Reference < 
drawing::XShape >& xShape,
                             ScChartListener* pListener = 
pCollection->findByName(aChartName);
                             if (pListener)
                             {
-                                const ScRangeListRef& rRangeList = 
pListener->GetRangeList();
-                                if ( rRangeList.is() )
+                                const ScRangeListRef xRangeList = 
pListener->GetRangeList();
+                                if ( xRangeList.is() )
                                 {
-                                    
ScRangeStringConverter::GetStringFromRangeList( sRanges, rRangeList.get(), 
pDoc, FormulaGrammar::CONV_OOO );
+                                    
ScRangeStringConverter::GetStringFromRangeList( sRanges, xRangeList.get(), 
pDoc, FormulaGrammar::CONV_OOO );
                                     if ( !sRanges.isEmpty() )
                                     {
                                         bIsChart = true;
@@ -3750,7 +3750,7 @@ void ScXMLExport::exportAnnotationMeta( const 
uno::Reference < drawing::XShape >
             : sAuthor );
     }
 
-    const OUString& aDate(bRemovePersonalInfo ? u"1970-01-01"_ustr : 
pNote->GetDate()); // Epoch time
+    const OUString aDate(bRemovePersonalInfo ? u"1970-01-01"_ustr : 
pNote->GetDate()); // Epoch time
     if (pDoc)
     {
         SvNumberFormatter* pNumForm = pDoc->GetFormatTable();
diff --git a/sc/source/filter/xml/xmltransformationi.cxx 
b/sc/source/filter/xml/xmltransformationi.cxx
index 4c53f30f8e9f..238d4bde2a5b 100644
--- a/sc/source/filter/xml/xmltransformationi.cxx
+++ b/sc/source/filter/xml/xmltransformationi.cxx
@@ -105,15 +105,13 @@ uno::Reference<xml::sax::XFastContextHandler>
     sax_fastparser::FastAttributeList* pAttribList
         = &sax_fastparser::castToFastAttributeList(xAttrList);
 
-    const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList = 
pAttribList;
-
     switch (nElement)
     {
         case XML_ELEMENT(CALC_EXT, XML_COLUMN):
         {
-            if (rAttrList.is())
+            if (pAttribList)
             {
-                for (auto& aIter : *rAttrList)
+                for (auto& aIter : *pAttribList)
                 {
                     switch (aIter.getToken())
                     {
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index deb6166bfbd5..10a60ac067aa 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -2874,8 +2874,8 @@ void ScInputHandler::UpdateFormulaMode()
     bool bIsFormula = !bProtected;
     if (bIsFormula)
     {
-        const OUString& rText = mpEditEngine->GetText(0);
-        bIsFormula = StartsLikeFormula(rText);
+        const OUString aText = mpEditEngine->GetText(0);
+        bIsFormula = StartsLikeFormula(aText);
     }
 
     if ( bIsFormula )
diff --git a/sc/source/ui/dbgui/pvfundlg.cxx b/sc/source/ui/dbgui/pvfundlg.cxx
index 7c19279945ab..d62aff05b79c 100644
--- a/sc/source/ui/dbgui/pvfundlg.cxx
+++ b/sc/source/ui/dbgui/pvfundlg.cxx
@@ -375,8 +375,8 @@ sal_Int32 ScDPFunctionDlg::FindBaseItemPos( 
std::u16string_view rEntry, sal_Int3
     while (nPos < mxLbBaseItem->get_count())
     {
         // translate the displayed field name back to its original field name.
-        const OUString& rInName = mxLbBaseItem->get_text(nPos);
-        const OUString& rName = GetBaseItemName(rInName);
+        const OUString aInName = mxLbBaseItem->get_text(nPos);
+        const OUString& rName = GetBaseItemName(aInName);
         if (rName == rEntry)
         {
             bFound = true;
diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx
index b0728829cf49..01c65a4ed446 100644
--- a/sc/source/ui/drawfunc/drawsh.cxx
+++ b/sc/source/ui/drawfunc/drawsh.cxx
@@ -349,8 +349,8 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq )
                                 SvxAbstractDialogFactory* pFact = 
SvxAbstractDialogFactory::Create();
                                 VclPtr<SfxAbstractTabDialog> 
pDlg(pFact->CreateCaptionDialog(pWin ? pWin->GetFrameWeld() : nullptr, pView));
 
-                                const WhichRangesContainer& pRange = 
pDlg->GetInputRanges( *aNewAttr.GetPool() );
-                                SfxItemSet aCombSet( *aNewAttr.GetPool(), 
pRange );
+                                const WhichRangesContainer aRange = 
pDlg->GetInputRanges( *aNewAttr.GetPool() );
+                                SfxItemSet aCombSet( *aNewAttr.GetPool(), 
aRange );
                                 aCombSet.Put( aNewAttr );
                                 aCombSet.Put( aNewGeoAttr );
                                 pDlg->SetInputSet( &aCombSet );
diff --git a/sc/source/ui/drawfunc/drtxtob.cxx 
b/sc/source/ui/drawfunc/drtxtob.cxx
index 8eba19057411..48f0c0df135d 100644
--- a/sc/source/ui/drawfunc/drtxtob.cxx
+++ b/sc/source/ui/drawfunc/drtxtob.cxx
@@ -924,12 +924,12 @@ void ScDrawTextObjectBar::ExecuteAttr( SfxRequest &rReq )
             case SID_ATTR_CHAR_BACK_COLOR:
             {
                 const sal_uInt16 nEEWhich = 
GetPool().GetWhichIDFromSlotID(nSlot);
-                const std::optional<NamedColor>& oColor
+                const std::optional<NamedColor> oColor
                     = mrViewData.GetDocShell()->GetRecentColor(nSlot);
                 if (oColor.has_value())
                 {
-                    const model::ComplexColor& rCol = 
(*oColor).getComplexColor();
-                    aNewAttr.Put(SvxColorItem(rCol.getFinalColor(), rCol, 
nEEWhich));
+                    const model::ComplexColor aCol = 
(*oColor).getComplexColor();
+                    aNewAttr.Put(SvxColorItem(aCol.getFinalColor(), aCol, 
nEEWhich));
                 }
                 break;
             }
diff --git a/sc/source/ui/formdlg/dwfunctr.cxx 
b/sc/source/ui/formdlg/dwfunctr.cxx
index 3ca34e1cc118..f88bab70740c 100644
--- a/sc/source/ui/formdlg/dwfunctr.cxx
+++ b/sc/source/ui/formdlg/dwfunctr.cxx
@@ -646,7 +646,7 @@ IMPL_LINK_NOARG( ScFunctionWin, SetHelpClickHdl, 
weld::Button&, void )
     {
         if (Help* pHelp = Application::GetHelp())
         {
-            const OUString& sHelpId = pDesc->getHelpId();
+            const OUString sHelpId = pDesc->getHelpId();
             if (!sHelpId.isEmpty())
             {
                 pHelp->Start(sHelpId);
diff --git a/sc/source/ui/miscdlgs/tabbgcolordlg.cxx 
b/sc/source/ui/miscdlgs/tabbgcolordlg.cxx
index d87a7bdacd2f..f319c1d8b005 100644
--- a/sc/source/ui/miscdlgs/tabbgcolordlg.cxx
+++ b/sc/source/ui/miscdlgs/tabbgcolordlg.cxx
@@ -128,7 +128,7 @@ bool ScTabBgColorDlg::ScTabBgColorValueSet::KeyInput( const 
KeyEvent& rKEvt )
         case KEY_RETURN:
         {
             sal_uInt16 nItemId = GetSelectedItemId();
-            const Color& aColor = nItemId ? ( GetItemColor( nItemId ) ) : 
COL_AUTO;
+            const Color aColor = nItemId ? ( GetItemColor( nItemId ) ) : 
COL_AUTO;
             m_pTabBgColorDlg->m_aTabBgColor = aColor;
             m_pTabBgColorDlg->response(RET_OK);
             return true;
diff --git a/sc/source/ui/optdlg/opredlin.cxx b/sc/source/ui/optdlg/opredlin.cxx
index a5613649ddc0..dd2045a4b67b 100644
--- a/sc/source/ui/optdlg/opredlin.cxx
+++ b/sc/source/ui/optdlg/opredlin.cxx
@@ -70,7 +70,7 @@ OUString ScRedlineOptionsTabPage::GetAllStrings()
 
     for (const auto& label : labels)
     {
-        if (const auto& pString = m_xBuilder->weld_label(label))
+        if (const auto pString = m_xBuilder->weld_label(label))
             sAllStrings += pString->get_label() + " ";
     }
 
diff --git a/sc/source/ui/optdlg/tpcalc.cxx b/sc/source/ui/optdlg/tpcalc.cxx
index f5f49989e537..f55038d9d232 100644
--- a/sc/source/ui/optdlg/tpcalc.cxx
+++ b/sc/source/ui/optdlg/tpcalc.cxx
@@ -253,7 +253,7 @@ OUString ScTpCalcOptions::GetAllStrings()
 
     for (const auto& label : labels)
     {
-        if (const auto& pString = m_xBuilder->weld_label(label))
+        if (const auto pString = m_xBuilder->weld_label(label))
             sAllStrings += pString->get_label() + " ";
     }
 
@@ -262,7 +262,7 @@ OUString ScTpCalcOptions::GetAllStrings()
 
     for (const auto& check : checkButton)
     {
-        if (const auto& pString = m_xBuilder->weld_check_button(check))
+        if (const auto pString = m_xBuilder->weld_check_button(check))
             sAllStrings += pString->get_label() + " ";
     }
 
@@ -271,7 +271,7 @@ OUString ScTpCalcOptions::GetAllStrings()
 
     for (const auto& radio : radioButton)
     {
-        if (const auto& pString = m_xBuilder->weld_radio_button(radio))
+        if (const auto pString = m_xBuilder->weld_radio_button(radio))
             sAllStrings += pString->get_label() + " ";
     }
 
diff --git a/sc/source/ui/optdlg/tpcompatibility.cxx 
b/sc/source/ui/optdlg/tpcompatibility.cxx
index 48e8a08b21ef..7df3547b53eb 100644
--- a/sc/source/ui/optdlg/tpcompatibility.cxx
+++ b/sc/source/ui/optdlg/tpcompatibility.cxx
@@ -42,7 +42,7 @@ OUString ScTpCompatOptions::GetAllStrings()
 
     for (const auto& label : labels)
     {
-        if (const auto& pString = m_xBuilder->weld_label(label))
+        if (const auto pString = m_xBuilder->weld_label(label))
             sAllStrings += pString->get_label() + " ";
     }
 
diff --git a/sc/source/ui/optdlg/tpdefaults.cxx 
b/sc/source/ui/optdlg/tpdefaults.cxx
index 29bdd9a9a0d8..8cb4c4609405 100644
--- a/sc/source/ui/optdlg/tpdefaults.cxx
+++ b/sc/source/ui/optdlg/tpdefaults.cxx
@@ -51,7 +51,7 @@ OUString ScTpDefaultsOptions::GetAllStrings()
 
     for (const auto& label : labels)
     {
-        if (const auto& pString = m_xBuilder->weld_label(label))
+        if (const auto pString = m_xBuilder->weld_label(label))
             sAllStrings += pString->get_label() + " ";
     }
 
diff --git a/sc/source/ui/optdlg/tpformula.cxx 
b/sc/source/ui/optdlg/tpformula.cxx
index 11d3f7189cd1..877ca4381cb1 100644
--- a/sc/source/ui/optdlg/tpformula.cxx
+++ b/sc/source/ui/optdlg/tpformula.cxx
@@ -270,7 +270,7 @@ OUString ScTpFormulaOptions::GetAllStrings()
 
     for (const auto& label : labels)
     {
-        if (const auto& pString = m_xBuilder->weld_label(label))
+        if (const auto pString = m_xBuilder->weld_label(label))
             sAllStrings += pString->get_label() + " ";
     }
 
@@ -278,7 +278,7 @@ OUString ScTpFormulaOptions::GetAllStrings()
 
     for (const auto& radio : radioButton)
     {
-        if (const auto& pString = m_xBuilder->weld_radio_button(radio))
+        if (const auto pString = m_xBuilder->weld_radio_button(radio))
             sAllStrings += pString->get_label() + " ";
     }
 
@@ -286,7 +286,7 @@ OUString ScTpFormulaOptions::GetAllStrings()
 
     for (const auto& btn : buttons)
     {
-        if (const auto& pString = m_xBuilder->weld_button(btn))
+        if (const auto pString = m_xBuilder->weld_button(btn))
             sAllStrings += pString->get_label() + " ";
     }
 
diff --git a/sc/source/ui/optdlg/tpprint.cxx b/sc/source/ui/optdlg/tpprint.cxx
index 75ad6cc7cab0..80facba4ae9c 100644
--- a/sc/source/ui/optdlg/tpprint.cxx
+++ b/sc/source/ui/optdlg/tpprint.cxx
@@ -100,7 +100,7 @@ OUString ScTpPrintOptions::GetAllStrings()
 
     for (const auto& label : labels)
     {
-        if (const auto& pString = m_xBuilder->weld_label(label))
+        if (const auto pString = m_xBuilder->weld_label(label))
             sAllStrings += pString->get_label() + " ";
     }
 
@@ -108,7 +108,7 @@ OUString ScTpPrintOptions::GetAllStrings()
 
     for (const auto& check : checkButton)
     {
-        if (const auto& pString = m_xBuilder->weld_check_button(check))
+        if (const auto pString = m_xBuilder->weld_check_button(check))
             sAllStrings += pString->get_label() + " ";
     }
 
diff --git a/sc/source/ui/optdlg/tpusrlst.cxx b/sc/source/ui/optdlg/tpusrlst.cxx
index 3e7a19a7d8d3..3ee897edc2fd 100644
--- a/sc/source/ui/optdlg/tpusrlst.cxx
+++ b/sc/source/ui/optdlg/tpusrlst.cxx
@@ -194,7 +194,7 @@ OUString ScTpUserLists::GetAllStrings()
 
     for (const auto& label : labels)
     {
-        if (const auto& pString = m_xBuilder->weld_label(label))
+        if (const auto pString = m_xBuilder->weld_label(label))
             sAllStrings += pString->get_label() + " ";
     }
 
@@ -202,7 +202,7 @@ OUString ScTpUserLists::GetAllStrings()
 
     for (const auto& btn : buttons)
     {
-        if (const auto& pString = m_xBuilder->weld_button(btn))
+        if (const auto pString = m_xBuilder->weld_button(btn))
             sAllStrings += pString->get_label() + " ";
     }
 
diff --git a/sc/source/ui/optdlg/tpview.cxx b/sc/source/ui/optdlg/tpview.cxx
index db7a921811e2..c105b5bfd194 100644
--- a/sc/source/ui/optdlg/tpview.cxx
+++ b/sc/source/ui/optdlg/tpview.cxx
@@ -134,7 +134,7 @@ OUString ScTpContentOptions::GetAllStrings()
 
     for (const auto& label : labels)
     {
-        if (const auto& pString = m_xBuilder->weld_label(label))
+        if (const auto pString = m_xBuilder->weld_label(label))
             sAllStrings += pString->get_label() + " ";
     }
 
@@ -145,7 +145,7 @@ OUString ScTpContentOptions::GetAllStrings()
 
     for (const auto& check : checkButton)
     {
-        if (const auto& pString = m_xBuilder->weld_check_button(check))
+        if (const auto pString = m_xBuilder->weld_check_button(check))
             sAllStrings += pString->get_label() + " ";
     }
 
@@ -539,7 +539,7 @@ OUString ScTpLayoutOptions::GetAllStrings()
 
     for (const auto& label : labels)
     {
-        if (const auto& pString = m_xBuilder->weld_label(label))
+        if (const auto pString = m_xBuilder->weld_label(label))
             sAllStrings += pString->get_label() + " ";
     }
 
@@ -550,7 +550,7 @@ OUString ScTpLayoutOptions::GetAllStrings()
 
     for (const auto& check : checkButton)
     {
-        if (const auto& pString = m_xBuilder->weld_check_button(check))
+        if (const auto pString = m_xBuilder->weld_check_button(check))
             sAllStrings += pString->get_label() + " ";
     }
 
@@ -558,7 +558,7 @@ OUString ScTpLayoutOptions::GetAllStrings()
 
     for (const auto& radio : radioButton)
     {
-        if (const auto& pString = m_xBuilder->weld_radio_button(radio))
+        if (const auto pString = m_xBuilder->weld_radio_button(radio))
             sAllStrings += pString->get_label() + " ";
     }
 
diff --git a/sc/source/ui/pagedlg/areasdlg.cxx 
b/sc/source/ui/pagedlg/areasdlg.cxx
index 27f9d114d1b9..57a93d4cd5f3 100644
--- a/sc/source/ui/pagedlg/areasdlg.cxx
+++ b/sc/source/ui/pagedlg/areasdlg.cxx
@@ -568,8 +568,8 @@ IMPL_LINK( ScPrintAreasDlg, Impl_ModifyHdl, 
formula::RefEdit&, rEd, void )
 
         for ( i=nFirstCustomPos; i<nEntryCount && !bFound; i++ )
         {
-            const OUString& rSymbol = pLb->get_id(i);
-            bFound = (rSymbol == aStrEd || rSymbol == aEdUpper);
+            const OUString aSymbol = pLb->get_id(i);
+            bFound = (aSymbol == aStrEd || aSymbol == aEdUpper);
         }
 
         pLb->set_active( bFound ? i-1 : nUserDefPos );
diff --git a/sc/source/ui/theme/ThemeColorChanger.cxx 
b/sc/source/ui/theme/ThemeColorChanger.cxx
index a8a6583ddd6e..0654f9bc498e 100644
--- a/sc/source/ui/theme/ThemeColorChanger.cxx
+++ b/sc/source/ui/theme/ThemeColorChanger.cxx
@@ -254,8 +254,8 @@ void changeSparklines(ScDocShell& rDocShell, 
model::ColorSet const& rColorSet)
         auto* pSparklineList = rDocument.GetSparklineList(nTab);
         if (pSparklineList && !pSparklineList->getSparklineGroups().empty())
         {
-            auto const& rSparklineGroups = 
pSparklineList->getSparklineGroups();
-            for (auto const& rSparklineGroup : rSparklineGroups)
+            auto const aSparklineGroups = pSparklineList->getSparklineGroups();
+            for (auto const& rSparklineGroup : aSparklineGroups)
             {
                 auto aAttributes = rSparklineGroup->getAttributes();
 
diff --git a/sc/source/ui/unoobj/chart2uno.cxx 
b/sc/source/ui/unoobj/chart2uno.cxx
index 8c4a0c5efa00..d98a372ced1b 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -1988,9 +1988,9 @@ uno::Sequence< beans::PropertyValue > SAL_CALL 
ScChart2DataProvider::detectArgum
 
         if( xDataSource.is() && xCompareDataSource.is() )
         {
-            const uno::Sequence< uno::Reference< 
chart2::data::XLabeledDataSequence> >& aOldSequences =
+            const uno::Sequence< uno::Reference< 
chart2::data::XLabeledDataSequence> > aOldSequences =
                 xCompareDataSource->getDataSequences();
-            const uno::Sequence< uno::Reference< 
chart2::data::XLabeledDataSequence> >& aNewSequences =
+            const uno::Sequence< uno::Reference< 
chart2::data::XLabeledDataSequence> > aNewSequences =
                 xDataSource->getDataSequences();
 
             std::map<std::pair<OUString, OUString>,sal_Int32> aOldEntryToIndex;
diff --git a/sc/source/ui/unoobj/chartuno.cxx b/sc/source/ui/unoobj/chartuno.cxx
index 4449b57d3c64..ab5bcb19a12c 100644
--- a/sc/source/ui/unoobj/chartuno.cxx
+++ b/sc/source/ui/unoobj/chartuno.cxx
@@ -567,16 +567,16 @@ void ScChartObj::getFastPropertyValue( 
std::unique_lock<std::mutex>& /*rGuard*/,
             if (!pListener)
                 break;
 
-            const ScRangeListRef& rRangeList = pListener->GetRangeList();
-            if (!rRangeList.is())
+            const ScRangeListRef xRangeList = pListener->GetRangeList();
+            if (!xRangeList.is())
                 break;
 
-            size_t nCount = rRangeList->size();
+            size_t nCount = xRangeList->size();
             uno::Sequence<table::CellRangeAddress> aCellRanges(nCount);
             table::CellRangeAddress* pCellRanges = aCellRanges.getArray();
             for (size_t i = 0; i < nCount; ++i)
             {
-                ScRange const & rRange = (*rRangeList)[i];
+                ScRange const & rRange = (*xRangeList)[i];
                 table::CellRangeAddress aCellRange;
                 ScUnoConversion::FillApiRange(aCellRange, rRange);
                 pCellRanges[i] = aCellRange;
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 498694644922..4b2fc7b99203 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -163,7 +163,7 @@ void SetTabNoAndCursor( const ScViewData& rViewData, 
std::u16string_view rCellId
     sal_uInt32 nId = o3tl::toUInt32(rCellId);
     auto lComp = [nId](const sc::NoteEntry& rNote) { return 
rNote.mpNote->GetId() == nId; };
 
-    const auto& aFoundNoteIt = std::find_if(aNotes.begin(), aNotes.end(), 
lComp);
+    const auto aFoundNoteIt = std::find_if(aNotes.begin(), aNotes.end(), 
lComp);
     if (aFoundNoteIt != aNotes.end())
     {
         ScAddress aFoundPos = aFoundNoteIt->maPos;
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index e5396188f418..ce39cd33d9a9 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -1039,12 +1039,12 @@ void ScEditShell::ExecuteAttr(SfxRequest& rReq)
                 else
                 {
                     const sal_uInt16 nEEWhich = 
GetPool().GetWhichIDFromSlotID(nSlot);
-                    const std::optional<NamedColor>& oColor
+                    const std::optional<NamedColor> oColor
                         = rViewData.GetDocShell()->GetRecentColor(nSlot);
                     if (oColor.has_value())
                     {
-                        const model::ComplexColor& rCol = 
(*oColor).getComplexColor();
-                        aSet.Put(SvxColorItem(rCol.getFinalColor(), rCol, 
nEEWhich));
+                        const model::ComplexColor aCol = 
(*oColor).getComplexColor();
+                        aSet.Put(SvxColorItem(aCol.getFinalColor(), aCol, 
nEEWhich));
                     }
                 }
             }
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index c2e21c2aebbb..fa75d629a871 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -7365,14 +7365,14 @@ void ScGridWindow::UpdateSparklineGroupOverlay()
             auto* pList = rDocument.GetSparklineList(aCurrentAddress.Tab());
             if (pList)
             {
-                auto const& pSparklines = 
pList->getSparklinesFor(pSparkline->getSparklineGroup());
+                auto const aSparklines = 
pList->getSparklinesFor(pSparkline->getSparklineGroup());
 
                 Color aColor = SvtOptionsDrawinglayer::getHilightColor();
 
                 std::vector<basegfx::B2DRange> aRanges;
                 const basegfx::B2DHomMatrix 
aTransform(GetOutDev()->GetInverseViewTransformation());
 
-                for (auto const& pCurrentSparkline : pSparklines)
+                for (auto const& pCurrentSparkline : aSparklines)
                 {
                     SCCOL nColumn = pCurrentSparkline->getColumn();
                     SCROW nRow = pCurrentSparkline->getRow();
diff --git a/sc/source/ui/view/olinewin.cxx b/sc/source/ui/view/olinewin.cxx
index 1cc55a9f3f46..6298f5db3687 100644
--- a/sc/source/ui/view/olinewin.cxx
+++ b/sc/source/ui/view/olinewin.cxx
@@ -539,12 +539,12 @@ namespace
 
 void ScOutlineWindow::DrawImageRel(tools::Long nLevelPos, tools::Long 
nEntryPos, const OUString& rId)
 {
-    const Image& rImage = GetImage(rId);
+    const Image aImage = GetImage(rId);
     GetOutDev()->SetLineColor();
     GetOutDev()->SetFillColor( GetBackground().GetColor() );
     Point aPos( GetPoint( nLevelPos, nEntryPos ) );
-    GetOutDev()->DrawRect( tools::Rectangle( aPos, rImage.GetSizePixel() ) );
-    GetOutDev()->DrawImage( aPos, rImage );
+    GetOutDev()->DrawRect( tools::Rectangle( aPos, aImage.GetSizePixel() ) );
+    GetOutDev()->DrawImage( aPos, aImage );
 }
 
 void ScOutlineWindow::DrawBorderRel( size_t nLevel, size_t nEntry, bool 
bPressed )
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 0f6302b5ba3b..7ecfb387ab7a 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -3390,7 +3390,7 @@ ClearableClipRegionPtr ScOutputData::Clip( DrawEditParam& 
rParam, const Size& aC
     bool bClip = AdjustAreaParamClipRect(aAreaParam) || aAreaParam.mbLeftClip 
|| aAreaParam.mbRightClip || bWrapFields;
     bool bSimClip = false;
 
-    const Size& aRefOne = mpRefDevice->PixelToLogic(Size(1,1));
+    const Size aRefOne = mpRefDevice->PixelToLogic(Size(1,1));
     if ( nEngineWidth >= aCellSize.Width() + aRefOne.Width() )
     {
         const ScMergeAttr* pMerge = &rParam.mpPattern->GetItem(ATTR_MERGE);
@@ -3582,7 +3582,7 @@ void ScOutputData::DrawEditBottomTop(DrawEditParam& 
rParam)
         return;
 
     // output area, excluding margins, in logical units
-    const Size& aCellSize = rParam.mbPixelToLogic
+    const Size aCellSize = rParam.mbPixelToLogic
         ? mpRefDevice->PixelToLogic( Size( nOutWidth, nOutHeight ) )
         : Size( nOutWidth, nOutHeight );
 
@@ -3828,7 +3828,7 @@ void ScOutputData::DrawEditTopBottom(DrawEditParam& 
rParam)
         return;
 
     // output area, excluding margins, in logical units
-    const Size& aCellSize = rParam.mbPixelToLogic
+    const Size aCellSize = rParam.mbPixelToLogic
         ? mpRefDevice->PixelToLogic( Size( nOutWidth, nOutHeight ) )
         : Size( nOutWidth, nOutHeight );
 
diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index a01da9d50b3f..0437ca0d6da8 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -1340,11 +1340,11 @@ void ScTabViewShell::ExecStyle( SfxRequest& rReq )
 
                 case SID_STYLE_NEW_BY_EXAMPLE:
                 {
-                    const OUString& rStrCurStyle = rDoc.GetPageStyle( nCurTab 
);
+                    const OUString aStrCurStyle = rDoc.GetPageStyle( nCurTab );
 
-                    if ( rStrCurStyle != aStyleName )
+                    if ( aStrCurStyle != aStyleName )
                     {
-                        SfxStyleSheetBase*  pCurStyle = pStylePool->Find( 
rStrCurStyle, eFamily );
+                        SfxStyleSheetBase*  pCurStyle = pStylePool->Find( 
aStrCurStyle, eFamily );
                         SfxItemSet          aAttrSet  = 
pCurStyle->GetItemSet();
                         SCTAB               nInTab;
                         bool                bUsed = rDoc.IsPageStyleInUse( 
aStyleName, &nInTab );
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index d3e40076187a..3100441093b7 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -1506,14 +1506,14 @@ bool 
ScViewFunc::PasteMultiRangesFromClip(InsertDeleteFlags nFlags, ScDocument*
     ScDocument& rDoc = rViewData.GetDocument();
     ScDocShell* pDocSh = rViewData.GetDocShell();
     ScMarkData aMark(rViewData.GetMarkData());
-    const ScAddress& rCurPos = rViewData.GetCurPos();
+    const ScAddress aCurPos = rViewData.GetCurPos();
     ScClipParam& rClipParam = pClipDoc->GetClipParam();
     SCCOL nColSize = rClipParam.getPasteColSize();
     SCROW nRowSize = rClipParam.getPasteRowSize(*pClipDoc, 
/*bIncludeFiltered*/false);
 
     if (bTranspose)
     {
-        if (static_cast<SCROW>(rCurPos.Col()) + nRowSize-1 > 
static_cast<SCROW>(pClipDoc->MaxCol()))
+        if (static_cast<SCROW>(aCurPos.Col()) + nRowSize-1 > 
static_cast<SCROW>(pClipDoc->MaxCol()))
         {
             ErrorMessage(STR_PASTE_FULL);
             return false;
@@ -1527,7 +1527,7 @@ bool 
ScViewFunc::PasteMultiRangesFromClip(InsertDeleteFlags nFlags, ScDocument*
         nRowSize = static_cast<SCROW>(nTempColSize);
     }
 
-    if (!rDoc.ValidCol(rCurPos.Col()+nColSize-1) || 
!rDoc.ValidRow(rCurPos.Row()+nRowSize-1))
+    if (!rDoc.ValidCol(aCurPos.Col()+nColSize-1) || 
!rDoc.ValidRow(aCurPos.Row()+nRowSize-1))
     {
         ErrorMessage(STR_PASTE_FULL);
         return false;
@@ -1542,8 +1542,8 @@ bool 
ScViewFunc::PasteMultiRangesFromClip(InsertDeleteFlags nFlags, ScDocument*
     // For multi-selection paste, we don't support cell duplication for larger
     // destination range.  In case the destination is marked, we reset it to
     // the clip size.
-    ScRange aMarkedRange(rCurPos.Col(), rCurPos.Row(), nTab1,
-                         rCurPos.Col()+nColSize-1, rCurPos.Row()+nRowSize-1, 
nTab2);
+    ScRange aMarkedRange(aCurPos.Col(), aCurPos.Row(), nTab1,
+                         aCurPos.Col()+nColSize-1, aCurPos.Row()+nRowSize-1, 
nTab2);
 
     // Extend the marked range to account for filtered rows in the destination
     // area.
@@ -1610,7 +1610,7 @@ bool 
ScViewFunc::PasteMultiRangesFromClip(InsertDeleteFlags nFlags, ScDocument*
     // in case of transpose, links were added in TransposeClip()
     if (bAsLink && bTranspose)
         nCopyFlags |= InsertDeleteFlags::FORMULA;
-    rDoc.CopyMultiRangeFromClip(rCurPos, aMark, nCopyFlags, pClipDoc, true, 
bAsLink && !bTranspose,
+    rDoc.CopyMultiRangeFromClip(aCurPos, aMark, nCopyFlags, pClipDoc, true, 
bAsLink && !bTranspose,
                                 /*bIncludeFiltered*/false, bSkipEmptyCells);
 
     if (pMixDoc)
@@ -1621,7 +1621,7 @@ bool 
ScViewFunc::PasteMultiRangesFromClip(InsertDeleteFlags nFlags, ScDocument*
     if (nFlags & InsertDeleteFlags::OBJECTS)
     {
         //  Paste the drawing objects after the row heights have been updated.
-        rDoc.CopyMultiRangeFromClip(rCurPos, aMark, 
InsertDeleteFlags::OBJECTS, pClipDoc, true,
+        rDoc.CopyMultiRangeFromClip(aCurPos, aMark, 
InsertDeleteFlags::OBJECTS, pClipDoc, true,
                                     false, /*bIncludeFiltered*/false, true);
     }
 
@@ -1693,14 +1693,14 @@ bool ScViewFunc::PasteFromClipToMultiRanges(
         return false;
     }
 
-    const ScAddress& rCurPos = rViewData.GetCurPos();
+    const ScAddress aCurPos = rViewData.GetCurPos();
     ScDocument& rDoc = rViewData.GetDocument();
 
     ScRange aSrcRange = rClipParam.getWholeRange();
     SCROW nRowSize = aSrcRange.aEnd.Row() - aSrcRange.aStart.Row() + 1;
     SCCOL nColSize = aSrcRange.aEnd.Col() - aSrcRange.aStart.Col() + 1;
 
-    if (!rDoc.ValidCol(rCurPos.Col()+nColSize-1) || 
!rDoc.ValidRow(rCurPos.Row()+nRowSize-1))
+    if (!rDoc.ValidCol(aCurPos.Col()+nColSize-1) || 
!rDoc.ValidRow(aCurPos.Row()+nRowSize-1))
     {
         ErrorMessage(STR_PASTE_FULL);
         return false;

Reply via email to