sw/qa/extras/layout/layout.cxx                            |    6 +-
 sw/qa/extras/layout/layout3.cxx                           |    6 +-
 sw/qa/extras/ooxmlexport/ooxmlexport12.cxx                |    2 
 sw/qa/extras/ooxmlexport/ooxmlexport21.cxx                |    6 +-
 sw/qa/extras/ooxmlexport/ooxmlexport7.cxx                 |    2 
 sw/qa/extras/ooxmlexport/ooxmlexport8.cxx                 |    4 -
 sw/qa/extras/uiwriter/uiwriter4.cxx                       |    4 -
 sw/qa/extras/ww8export/ww8export3.cxx                     |    2 
 sw/qa/extras/ww8export/ww8export4.cxx                     |    4 -
 sw/source/core/access/AccessibilityCheck.cxx              |    2 
 sw/source/core/access/acctable.cxx                        |   12 ++--
 sw/source/core/doc/DocumentFieldsManager.cxx              |   26 +++++-----
 sw/source/core/doc/DocumentLinksAdministrationManager.cxx |    2 
 sw/source/core/doc/DocumentRedlineManager.cxx             |    4 -
 sw/source/core/doc/doc.cxx                                |    4 -
 sw/source/core/doc/docredln.cxx                           |    2 
 sw/source/core/doc/rdfhelper.cxx                          |    2 
 sw/source/core/doc/textboxhelper.cxx                      |   12 ++--
 sw/source/core/edit/edattr.cxx                            |    2 
 sw/source/core/layout/flowfrm.cxx                         |    4 -
 sw/source/core/layout/paintfrm.cxx                        |   16 +++---
 sw/source/core/layout/wsfrm.cxx                           |    2 
 sw/source/core/text/EnhancedPDFExportHelper.cxx           |   12 ++--
 sw/source/core/text/guess.cxx                             |    6 +-
 sw/source/core/text/itrform2.cxx                          |    2 
 sw/source/core/text/portxt.cxx                            |    4 -
 sw/source/core/txtnode/attrcontentcontrol.cxx             |    4 -
 sw/source/core/txtnode/ndtxt.cxx                          |    8 +--
 sw/source/core/unocore/unofield.cxx                       |    2 
 sw/source/core/view/viewsh.cxx                            |   10 ++--
 sw/source/filter/html/htmlfld.cxx                         |   10 ++--
 sw/source/filter/html/htmlfldw.cxx                        |   34 +++++++-------
 sw/source/filter/indexing/IndexingExport.cxx              |    6 +-
 sw/source/filter/ww8/docxattributeoutput.cxx              |    8 +--
 sw/source/filter/ww8/writerhelper.cxx                     |   14 ++---
 sw/source/filter/ww8/ww8atr.cxx                           |    6 +-
 sw/source/filter/ww8/ww8graf.cxx                          |   10 ++--
 sw/source/filter/xml/xmlfonte.cxx                         |    2 
 sw/source/filter/xml/xmlimpit.cxx                         |   10 ++--
 sw/source/ui/config/mailconfigpage.cxx                    |    6 +-
 sw/source/ui/config/optcomp.cxx                           |    8 +--
 sw/source/ui/config/optload.cxx                           |   10 ++--
 sw/source/ui/config/optpage.cxx                           |   32 ++++++-------
 sw/source/ui/frmdlg/frmpage.cxx                           |    4 -
 sw/source/ui/index/cnttab.cxx                             |    8 +--
 sw/source/uibase/docvw/edtwin.cxx                         |    2 
 sw/source/uibase/docvw/edtwin2.cxx                        |    4 -
 sw/source/uibase/envelp/labelcfg.cxx                      |    4 -
 sw/source/uibase/misc/redlndlg.cxx                        |    2 
 sw/source/uibase/ribbar/inputwin.cxx                      |    6 +-
 sw/source/uibase/shells/annotsh.cxx                       |   12 ++--
 sw/source/uibase/shells/drwbassh.cxx                      |    4 -
 sw/source/uibase/shells/drwtxtex.cxx                      |   12 ++--
 sw/source/uibase/shells/textsh1.cxx                       |    8 +--
 sw/source/uibase/sidebar/PageMarginControl.cxx            |    4 -
 sw/source/uibase/sidebar/PageOrientationControl.cxx       |    4 -
 sw/source/uibase/sidebar/QuickFindPanel.cxx               |    6 +-
 sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx     |    2 
 sw/source/uibase/uiview/pview.cxx                         |   10 ++--
 sw/source/uibase/uiview/view2.cxx                         |    4 -
 sw/source/uibase/uiview/viewdraw.cxx                      |   12 ++--
 sw/source/uibase/uiview/viewtab.cxx                       |    6 +-
 sw/source/uibase/utlui/content.cxx                        |   30 ++++++------
 sw/source/uibase/utlui/glbltree.cxx                       |    8 +--
 sw/source/uibase/utlui/gloslst.cxx                        |    2 
 sw/source/uibase/wrtsh/wrtsh2.cxx                         |   14 ++---
 sw/source/writerfilter/dmapper/DomainMapper.cxx           |    2 
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx      |   14 ++---
 sw/source/writerfilter/dmapper/NumberingManager.cxx       |   10 ++--
 sw/source/writerfilter/dmapper/SdtHelper.cxx              |    2 
 sw/source/writerfilter/dmapper/StyleSheetTable.cxx        |    2 
 sw/source/writerfilter/ooxml/OOXMLFastContextHandler.cxx  |    2 
 72 files changed, 265 insertions(+), 265 deletions(-)

New commits:
commit 56e0bd7f4280c52111ba211fee618a412b2b7e9c
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Tue Nov 12 17:09:38 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Nov 12 19:59:33 2024 +0100

    loplugin:reftotemp in sw
    
    Change-Id: I370d18643b0c83c60846a0b6f051440a043c647a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176486
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 739607e7db6e..f54d38504b36 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -832,11 +832,11 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf136613)
     for (auto pFlyFormat : vFlyFormats)
     {
         //...the rectangle of the fly location...
-        const SwRect& rRect = pFlyFormat->FindLayoutRect();
-        CPPUNIT_ASSERT(!rRect.IsEmpty());
+        const SwRect aRect = pFlyFormat->FindLayoutRect();
+        CPPUNIT_ASSERT(!aRect.IsEmpty());
 
         //...if it is on the page. This will fail if not.
-        CPPUNIT_ASSERT_MESSAGE("The pictures are outside the page!", 
rPageRect.Contains(rRect));
+        CPPUNIT_ASSERT_MESSAGE("The pictures are outside the page!", 
rPageRect.Contains(aRect));
     }
 }
 
diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx
index 49c04eecbaab..a7e5428abf89 100644
--- a/sw/qa/extras/layout/layout3.cxx
+++ b/sw/qa/extras/layout/layout3.cxx
@@ -1298,9 +1298,9 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testImageComment)
     SwSortedObjs& rDrawObjs = *pTextFrame->GetDrawObjs();
     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rDrawObjs.size());
     SwAnchoredObject* pDrawObj = rDrawObjs[0];
-    const SwRect& rDrawObjRect = pDrawObj->GetObjRect();
-    Point aPoint = rDrawObjRect.Center();
-    aPoint.setX(aPoint.getX() + rDrawObjRect.Width() / 2);
+    const SwRect aDrawObjRect = pDrawObj->GetObjRect();
+    Point aPoint = aDrawObjRect.Center();
+    aPoint.setX(aPoint.getX() + aDrawObjRect.Width() / 2);
 
     // Ask for the doc model pos of this layout point.
     SwPosition aPosition(*pTextFrame->GetTextNodeForFirstText());
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
index eac7320aa568..902d2f5f33eb 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
@@ -817,7 +817,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf120224_textControlCrossRef, 
"tdf120224_textContr
         uno::UNO_QUERY);
 
     // Critical test: does TextField's bookmark name match cross-reference?
-    const OUString& sTextFieldName(xBookmark->getName());
+    const OUString sTextFieldName(xBookmark->getName());
     uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, 
uno::UNO_QUERY);
     uno::Reference<container::XEnumerationAccess> xFieldsAccess(
         xTextFieldsSupplier->getTextFields());
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
index 7cee3e4a714e..2f874f79ecc6 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -560,7 +560,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf160077_layoutInCellB, 
"tdf160077_layoutInCellB.d
     // correct ShapeTop: 888 TWIPS, while incorrect value was -480. Cell top 
is 1148, PageTop is 284
     CPPUNIT_ASSERT_DOUBLES_EQUAL(888, nShapeTop, 50);
 
-    const auto& xShape = getShapeByName(u"Group 1");
+    const auto xShape = getShapeByName(u"Group 1");
     CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::PAGE_PRINT_AREA,
                          getProperty<sal_Int16>(xShape, 
u"VertOrientRelation"_ustr));
 
@@ -624,7 +624,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf160077_layoutInCellD, 
"tdf160077_layoutInCellD.d
 
     // In the file it is specified as "page" (PAGE_FRAME), but implemented as 
if it were "margin"
     // so on import we intentionally changed it to match the closest setting 
to the implementation.
-    const auto& xShape = getShapeByName(u"logo");
+    const auto xShape = getShapeByName(u"logo");
     CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::PAGE_PRINT_AREA,
                          getProperty<sal_Int16>(xShape, 
u"VertOrientRelation"_ustr));
 
@@ -647,7 +647,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf160077_layoutInCellD, 
"tdf160077_layoutInCellD.d
     CPPUNIT_ASSERT_EQUAL(nShapeTop, nPara1Top);
     CPPUNIT_ASSERT(nPara5Top > nShapeBottom); // ShapeBottom is higher than 
Para5Top
 
-    const auto& xShape2 = getShapeByName(u"logoInverted");
+    const auto xShape2 = getShapeByName(u"logoInverted");
     CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::PAGE_PRINT_AREA,
                          getProperty<sal_Int16>(xShape2, 
u"VertOrientRelation"_ustr));
 
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx
index fbea0d4816f7..f17a6fa1b827 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx
@@ -105,7 +105,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTextWatermark)
     assertXPath(pXmlHeader2, 
"/w:hdr[1]/w:p[1]/w:r[1]/w:pict[1]/v:shape[1]","id",u"PowerPlusWaterMarkObject93701316");
 
     //The second problem was that Word uses also "o:spid"
-    const OUString& sSpid = getXPath(pXmlHeader2, 
"/w:hdr[1]/w:p[1]/w:r[1]/w:pict[1]/v:shape[1]","spid");
+    const OUString sSpid = getXPath(pXmlHeader2, 
"/w:hdr[1]/w:p[1]/w:r[1]/w:pict[1]/v:shape[1]","spid");
     CPPUNIT_ASSERT(!sSpid.isEmpty());
 }
 
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
index 284cf4a1dd94..384551f3f806 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
@@ -1076,10 +1076,10 @@ DECLARE_OOXMLEXPORT_TEST(testFdo46361, "fdo46361.docx")
                                      u"CharColor"_ustr));
     // Count the paragraphs
     xTextBox.set(xGroupShape->getByIndex(1), uno::UNO_QUERY_THROW);
-    const auto& sText1 = xTextBox->getString();
+    const auto sText1 = xTextBox->getString();
 
     xTextBox.set(xGroupShape->getByIndex(2), uno::UNO_QUERY_THROW);
-    const auto& sText2 = xTextBox->getString();
+    const auto sText2 = xTextBox->getString();
 
     sal_Int32 nCount1 = 0;
     sal_Int32 nCount2 = 0;
diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx 
b/sw/qa/extras/uiwriter/uiwriter4.cxx
index 7df258900c9f..aeb226ec595f 100644
--- a/sw/qa/extras/uiwriter/uiwriter4.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter4.cxx
@@ -141,8 +141,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf146449)
     uno::Reference<beans::XPropertySet> xFrameProps(
         xShapeProps->getPropertyValue(u"TextBoxContent"_ustr), uno::UNO_QUERY);
 
-    const auto& nShapeZOrder = pObject->GetOrdNum();
-    const auto& nFrameZOrder = xFrameProps->getPropertyValue(u"ZOrder"_ustr);
+    const auto nShapeZOrder = pObject->GetOrdNum();
+    const auto nFrameZOrder = xFrameProps->getPropertyValue(u"ZOrder"_ustr);
 
     CPPUNIT_ASSERT_MESSAGE("Wrong Zorder!", nShapeZOrder < 
nFrameZOrder.get<sal_uInt32>());
 }
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx 
b/sw/qa/extras/ww8export/ww8export3.cxx
index 445c9981ad1f..a8263d7fd73c 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -483,7 +483,7 @@ DECLARE_WW8EXPORT_TEST(testTdf120225_textControlCrossRef, 
"tdf120225_textControl
     uno::Reference<container::XNamed> xBookmark(getProperty< 
uno::Reference<beans::XPropertySet> >(xPropertySet, u"Bookmark"_ustr), 
uno::UNO_QUERY_THROW);
 
     // Critical test: does TextField's bookmark name match cross-reference?
-    const OUString& sTextFieldName( xBookmark->getName() );
+    const OUString sTextFieldName( xBookmark->getName() );
     uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, 
uno::UNO_QUERY);
     uno::Reference<container::XEnumerationAccess> 
xFieldsAccess(xTextFieldsSupplier->getTextFields());
     uno::Reference<container::XEnumeration> 
xFields(xFieldsAccess->createEnumeration());
diff --git a/sw/qa/extras/ww8export/ww8export4.cxx 
b/sw/qa/extras/ww8export/ww8export4.cxx
index 957941f388ab..2a8f5d939b36 100644
--- a/sw/qa/extras/ww8export/ww8export4.cxx
+++ b/sw/qa/extras/ww8export/ww8export4.cxx
@@ -156,7 +156,7 @@ DECLARE_WW8EXPORT_TEST(testTdf91632_layoutInCellD, 
"tdf91632_layoutInCellD.doc")
 
     // In the file it is specified as "page" (PAGE_FRAME), but implemented as 
if it were "margin"
     // so on import we intentionally changed it to match the closest setting 
to the implementation.
-    const auto& xShape = getShape(1);
+    const auto xShape = getShape(1);
     CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::PAGE_PRINT_AREA,
                          getProperty<sal_Int16>(xShape, 
u"VertOrientRelation"_ustr));
 
@@ -181,7 +181,7 @@ DECLARE_WW8EXPORT_TEST(testTdf91632_layoutInCellD, 
"tdf91632_layoutInCellD.doc")
     CPPUNIT_ASSERT_EQUAL(nShapeTop, nPara1Top);
     CPPUNIT_ASSERT(nPara5Top > nShapeBottom); // ShapeBottom is higher than 
Para5Top
 
-    const auto& xShape2 = getShape(2);
+    const auto xShape2 = getShape(2);
     CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::PAGE_PRINT_AREA,
                          getProperty<sal_Int16>(xShape2, 
u"VertOrientRelation"_ustr));
 
diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index d5942666487c..bf54b7a3ea4d 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -2412,7 +2412,7 @@ public:
             xStyleFamilies->getByName(u"PageStyles"_ustr), uno::UNO_QUERY);
         if (!xStyleFamily.is())
             return;
-        const uno::Sequence<OUString>& xStyleFamilyNames = 
xStyleFamily->getElementNames();
+        const uno::Sequence<OUString> xStyleFamilyNames = 
xStyleFamily->getElementNames();
         for (const OUString& rStyleFamilyName : xStyleFamilyNames)
         {
             uno::Reference<beans::XPropertySet> xPropertySet(
diff --git a/sw/source/core/access/acctable.cxx 
b/sw/source/core/access/acctable.cxx
index 61b8ace7b932..dfd78370847b 100644
--- a/sw/source/core/access/acctable.cxx
+++ b/sw/source/core/access/acctable.cxx
@@ -229,8 +229,8 @@ void SwAccessibleTableData_Impl::GetSelection(
         const SwAccessibleChild& rLower = *aIter;
         const SwFrame *pLower = rLower.GetSwFrame();
         OSL_ENSURE( pLower, "child should be a frame" );
-        const SwRect& rBox = rLower.GetBox( mrAccMap );
-        if( pLower && rBox.Overlaps( rArea ) )
+        const SwRect aBox = rLower.GetBox( mrAccMap );
+        if( pLower && aBox.Overlaps( rArea ) )
         {
             if( rLower.IsAccessible( mbIsInPagePreview ) )
             {
@@ -244,16 +244,16 @@ void SwAccessibleTableData_Impl::GetSelection(
                     const Int32Set_Impl rRowsOrCols =
                         bColumns ? maColumns : maRows;
 
-                    sal_Int32 nPos = bColumns ? (rBox.Left() - rTabPos.X())
-                                              : (rBox.Top() - rTabPos.Y());
+                    sal_Int32 nPos = bColumns ? (aBox.Left() - rTabPos.X())
+                                              : (aBox.Top() - rTabPos.Y());
                     Int32Set_Impl::const_iterator aSttRowOrCol(
                         rRowsOrCols.lower_bound( nPos ) );
                     sal_Int32 nRowOrCol =
                         static_cast< sal_Int32 >( std::distance(
                             rRowsOrCols.begin(), aSttRowOrCol ) );
 
-                    nPos = bColumns ? (rBox.Right() - rTabPos.X())
-                                    : (rBox.Bottom() - rTabPos.Y());
+                    nPos = bColumns ? (aBox.Right() - rTabPos.X())
+                                    : (aBox.Bottom() - rTabPos.Y());
                     Int32Set_Impl::const_iterator aEndRowOrCol(
                         rRowsOrCols.upper_bound( nPos ) );
                     sal_Int32 nExt =
diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx 
b/sw/source/core/doc/DocumentFieldsManager.cxx
index 63e85da3be7e..9180ca187767 100644
--- a/sw/source/core/doc/DocumentFieldsManager.cxx
+++ b/sw/source/core/doc/DocumentFieldsManager.cxx
@@ -431,18 +431,18 @@ void DocumentFieldsManager::InsDeletedFieldType( 
SwFieldType& rFieldTyp )
             SwFieldIds::Dde == nFieldWhich, "Wrong FieldType" );
 
     const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore();
-    const OUString& rFieldNm = rFieldTyp.GetName();
+    const OUString aFieldNm = rFieldTyp.GetName();
 
     for( SwFieldTypes::size_type i = INIT_FLDTYPES; i < nSize; ++i )
     {
         SwFieldType* pFnd = (*mpFieldTypes)[i].get();
         if( nFieldWhich == pFnd->Which() &&
-            rSCmp.isEqual( rFieldNm, pFnd->GetName() ) )
+            rSCmp.isEqual( aFieldNm, pFnd->GetName() ) )
         {
             // find new name
             SwFieldTypes::size_type nNum = 1;
             do {
-                OUString sSrch = rFieldNm + OUString::number( nNum );
+                OUString sSrch = aFieldNm + OUString::number( nNum );
                 for( i = INIT_FLDTYPES; i < nSize; ++i )
                 {
                     pFnd = (*mpFieldTypes)[i].get();
@@ -452,7 +452,7 @@ void DocumentFieldsManager::InsDeletedFieldType( 
SwFieldType& rFieldTyp )
                 }
                 if( i >= nSize )        // not found
                 {
-                    const_cast<OUString&>(rFieldNm) = sSrch;
+                    const_cast<OUString&>(aFieldNm) = sSrch;
                     break;      // exit while loop
                 }
                 ++nNum;
@@ -870,15 +870,15 @@ void DocumentFieldsManager::UpdateExpFieldsImpl(
             case SwFieldIds::User:
                 {
                     // Entry present?
-                    const OUString& rNm = pFieldType->GetName();
+                    const OUString aNm = pFieldType->GetName();
                     OUString 
sExpand(const_cast<SwUserFieldType*>(static_cast<const 
SwUserFieldType*>(pFieldType))->Expand(nsSwGetSetExpType::GSE_STRING, 0, 
LANGUAGE_SYSTEM));
-                    auto pFnd = aHashStrTable.find( rNm );
+                    auto pFnd = aHashStrTable.find( aNm );
                     if( pFnd != aHashStrTable.end() )
                         // modify entry in the hash table
                         pFnd->second = sExpand;
                     else
                         // insert the new entry
-                        aHashStrTable.insert( { rNm, sExpand } );
+                        aHashStrTable.insert( { aNm, sExpand } );
                 }
                 break;
             default: break;
@@ -1046,11 +1046,11 @@ void DocumentFieldsManager::UpdateExpFieldsImpl(
             if( pMgr->IsDataSourceOpen(aTmpDBData.sDataSource, 
aTmpDBData.sCommand, false))
                 aCalc.VarChange( sDBNumNm, 
pMgr->GetSelectedRecordId(aTmpDBData.sDataSource, aTmpDBData.sCommand, 
aTmpDBData.nCommandType));
 
-            const OUString& rName = pField->GetTyp()->GetName();
+            const OUString aName = pField->GetTyp()->GetName();
 
             // Add entry to hash table
             // Entry present?
-            auto pFnd = aHashStrTable.find( rName );
+            auto pFnd = aHashStrTable.find( aName );
             OUString const value(pField->ExpandField(m_rDoc.IsClipBoard(), 
nullptr));
             if( pFnd != aHashStrTable.end() )
             {
@@ -1060,7 +1060,7 @@ void DocumentFieldsManager::UpdateExpFieldsImpl(
             else
             {
                 // insert new entry
-               aHashStrTable.insert( { rName, value } );
+               aHashStrTable.insert( { aName, value } );
             }
 #endif
         }
@@ -1602,18 +1602,18 @@ void DocumentFieldsManager::FieldsToExpand( 
std::unordered_map<OUString, OUStrin
             break;
         case SwFieldIds::Database:
             {
-                const OUString& rName = pField->GetTyp()->GetName();
+                const OUString aName = pField->GetTyp()->GetName();
 
                 // Insert entry in the hash table
                 // Entry present?
-                auto pFnd = rHashTable.find( rName );
+                auto pFnd = rHashTable.find( aName );
                 OUString const value(pField->ExpandField(m_rDoc.IsClipBoard(), 
nullptr));
                 if( pFnd != rHashTable.end() )
                     // modify entry in the hash table
                     pFnd->second = value;
                 else
                     // insert the new entry
-                    rHashTable.insert( { rName, value } );
+                    rHashTable.insert( { aName, value } );
             }
             break;
         default: break;
diff --git a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx 
b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx
index be6eb0f17d1b..3c084ad6124f 100644
--- a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx
+++ b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx
@@ -127,7 +127,7 @@ namespace
 
     SwTableNode* lcl_FindTable(const SwDoc& rDoc, const OUString& rItem)
     {
-        const OUString& aItem = GetAppCharClass().lowercase(rItem);
+        const OUString aItem = GetAppCharClass().lowercase(rItem);
         for (const SwFrameFormat* pTableFormat : *rDoc.GetTableFrameFormats())
         {
             OUString sNm(GetAppCharClass().lowercase(pTableFormat->GetName()));
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx 
b/sw/source/core/doc/DocumentRedlineManager.cxx
index fc4b7d6859dc..d55bbd577f93 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -209,7 +209,7 @@ void UpdateFramesForAddDeleteRedline(SwDoc & rDoc, SwPaM 
const& rPam)
             }
             if (frames.empty())
             {
-                auto const& layouts(rDoc.GetAllLayouts());
+                auto const layouts(rDoc.GetAllLayouts());
                 assert(std::none_of(layouts.begin(), layouts.end(),
                     [](SwRootFrame const*const pLayout) { return 
pLayout->IsHideRedlines(); }));
                 (void) layouts;
@@ -313,7 +313,7 @@ void UpdateFramesForRemoveDeleteRedline(SwDoc & rDoc, SwPaM 
const& rPam)
                 // in SwUndoSaveSection::SaveSection(), DelFrames() preceded 
this call
                 if (!pNode->FindTableBoxStartNode() && 
!pNode->FindFlyStartNode())
                 {
-                    auto const& layouts(rDoc.GetAllLayouts());
+                    auto const layouts(rDoc.GetAllLayouts());
                     assert(std::none_of(layouts.begin(), layouts.end(),
                         [](SwRootFrame const*const pLayout) { return 
pLayout->IsHideRedlines(); }));
                     (void) layouts;
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index c70929b65953..2c23d36d6c16 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -1269,8 +1269,8 @@ void SwDoc::ForEachOverlineItem( const 
std::function<bool(const SvxOverlineItem&
     const SwCellStyleTable& rCellStyleTable = GetCellStyles();
     for (size_t i=0; i < rCellStyleTable.size(); ++i)
     {
-        const SwCellStyleDescriptor& rCellStyle = rCellStyleTable[i];
-        const SwBoxAutoFormat& rBoxFormat = rCellStyle.GetAutoFormat();
+        const SwCellStyleDescriptor aCellStyle = rCellStyleTable[i];
+        const SwBoxAutoFormat& rBoxFormat = aCellStyle.GetAutoFormat();
         const SvxOverlineItem rOverlineItem = rBoxFormat.GetOverline();
         if (!rFunc(rOverlineItem))
             return;
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index c1b9d8f9d74a..9ccc8348a561 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -1283,7 +1283,7 @@ SwRedlineData::~SwRedlineData()
 // Check whether the absolute difference between the two dates is no larger 
than one minute (can
 // give inaccurate results if at least one of the dates is not 
valid/normalized):
 static bool deltaOneMinute(DateTime const & t1, DateTime const & t2) {
-    auto const & [min, max] = std::minmax(t1, t2);
+    auto const [min, max] = std::minmax(t1, t2);
     // Avoid overflow of `min + tools::Time(0, 1)` below when min is close to 
the maximum valid
     // DateTime:
     if (min >= DateTime({31, 12, std::numeric_limits<sal_Int16>::max()}, {23, 
59})) {
diff --git a/sw/source/core/doc/rdfhelper.cxx b/sw/source/core/doc/rdfhelper.cxx
index 55bce35496a1..c5374b7b24a6 100644
--- a/sw/source/core/doc/rdfhelper.cxx
+++ b/sw/source/core/doc/rdfhelper.cxx
@@ -69,7 +69,7 @@ SwRDFHelper::getStatements(const 
rtl::Reference<SwXTextDocument>& xModel,
     if (!rGraphNames.hasElements())
         return aRet;
 
-    const uno::Reference<rdf::XRepository>& xRepo = xModel->getRDFRepository();
+    const uno::Reference<rdf::XRepository> xRepo = xModel->getRDFRepository();
     for (const uno::Reference<rdf::XURI>& xGraphName : rGraphNames)
     {
         uno::Reference<rdf::XNamedGraph> xGraph = xRepo->getGraph(xGraphName);
diff --git a/sw/source/core/doc/textboxhelper.cxx 
b/sw/source/core/doc/textboxhelper.cxx
index 222887b51e92..89b51f0d3171 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -1479,7 +1479,7 @@ bool SwTextBoxHelper::doTextBoxPositioning(SwFrameFormat* 
pShape, SdrObject* pOb
                 + aRect.Top());
 
             // Get the distance of the child shape inside its parent
-            const auto& nInshapePos
+            const auto nInshapePos
                 = pObj ? pObj->GetRelativePos() - 
pShape->FindRealSdrObject()->GetRelativePos()
                        : Point();
 
@@ -1573,12 +1573,12 @@ bool SwTextBoxHelper::syncTextBoxSize(SwFrameFormat* 
pShape, SdrObject* pObj)
     if (auto pTextBox = getOtherTextBoxFormat(pShape, RES_DRAWFRMFMT, pObj))
     {
         auto aGuard = SwTextBoxLockGuard(*pShape->GetOtherTextBoxFormats());
-        const auto& rSize = getRelativeTextRectangle(pObj).GetSize();
-        if (!rSize.IsEmpty())
+        const auto aSize = getRelativeTextRectangle(pObj).GetSize();
+        if (!aSize.IsEmpty())
         {
-            SwFormatFrameSize aSize(pTextBox->GetFrameSize());
-            aSize.SetSize(rSize);
-            return pTextBox->SetFormatAttr(aSize);
+            SwFormatFrameSize aFrameSize(pTextBox->GetFrameSize());
+            aFrameSize.SetSize(aSize);
+            return pTextBox->SetFormatAttr(aFrameSize);
         }
     }
 
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index e98dbebd397f..d2ccd73b7bbc 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -92,7 +92,7 @@ bool SwEditShell::GetPaMAttr( SwPaM* pPaM, SfxItemSet& rSet,
                     if (nListLevel >= MAXLEVEL)
                         nListLevel = MAXLEVEL - 1;
 
-                    const OUString & aCharFormatName =
+                    const OUString aCharFormatName =
                         
pNumRule->Get(o3tl::narrowing<sal_uInt16>(nListLevel)).GetCharFormatName();
                     SwCharFormat * pCharFormat =
                         GetDoc()->FindCharFormatByName(aCharFormatName);
diff --git a/sw/source/core/layout/flowfrm.cxx 
b/sw/source/core/layout/flowfrm.cxx
index b45c8d100fcb..982fede3406b 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -1296,7 +1296,7 @@ bool SwFlowFrame::IsPageBreak( bool bAct ) const
                 return true;
             else
             {
-                const SvxBreak &ePrB = pPrev->GetBreakItem().GetBreak();
+                const SvxBreak ePrB = pPrev->GetBreakItem().GetBreak();
                 if ( ePrB == SvxBreak::PageAfter ||
                      ePrB == SvxBreak::PageBoth  ||
                     m_rThis.GetPageDescItem().GetPageDesc())
@@ -1352,7 +1352,7 @@ bool SwFlowFrame::IsColBreak( bool bAct ) const
                     return true;
                 else
                 {
-                    const SvxBreak &ePrB = pPrev->GetBreakItem().GetBreak();
+                    const SvxBreak ePrB = pPrev->GetBreakItem().GetBreak();
                     if ( ePrB == SvxBreak::ColumnAfter ||
                          ePrB == SvxBreak::ColumnBoth )
                         return true;
diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index fb2f6d750b9f..24803baf1c89 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -4627,7 +4627,7 @@ void SwTextFrame::PaintParagraphStylesHighlighting() const
             aFrameAreaRect.Right(aFrameAreaRect.Left() + 300);
         }
 
-        const tools::Rectangle& rRect = aFrameAreaRect.SVRect();
+        const tools::Rectangle aRect = aFrameAreaRect.SVRect();
 
         vcl::Font aFont(OutputDevice::GetDefaultFont(DefaultFontType::UI_SANS, 
GetAppLanguage(),
                                                      
GetDefaultFontFlags::OnlyOne, pRenderContext));
@@ -4643,7 +4643,7 @@ void SwTextFrame::PaintParagraphStylesHighlighting() const
         pRenderContext->SetFillColor(rParaStylesColorMap[sStyleName].first);
         pRenderContext->SetLineColor(rParaStylesColorMap[sStyleName].first);
 
-        pRenderContext->DrawRect(rRect);
+        pRenderContext->DrawRect(aRect);
 
         // draw hatch pattern if paragraph has direct formatting
         if 
(SwDoc::HasParagraphDirectFormatting(SwPosition(*GetTextNodeForParaProps())))
@@ -4652,13 +4652,13 @@ void SwTextFrame::PaintParagraphStylesHighlighting() 
const
             // make hatch line color 41% darker than the fill color
             aHatchColor.ApplyTintOrShade(-4100);
             Hatch aHatch(HatchStyle::Single, aHatchColor, 50, 450_deg10);
-            pRenderContext->DrawHatch(tools::PolyPolygon(rRect), aHatch);
+            pRenderContext->DrawHatch(tools::PolyPolygon(aRect), aHatch);
         }
 
         pRenderContext->SetFont(aFont);
         
pRenderContext->SetLayoutMode(vcl::text::ComplexTextLayoutFlags::Default);
         
pRenderContext->SetTextFillColor(rParaStylesColorMap[sStyleName].first);
-        pRenderContext->DrawText(rRect, 
OUString::number(rParaStylesColorMap[sStyleName].second),
+        pRenderContext->DrawText(aRect, 
OUString::number(rParaStylesColorMap[sStyleName].second),
                                  DrawTextFlags::Center | 
DrawTextFlags::VCenter);
 
         pRenderContext->Pop();
@@ -5661,14 +5661,14 @@ void SwFrame::PaintSwFrameShadowAndBorder(
         {
             const SwFrame* pDirRefFrame(IsCellFrame() ? FindTabFrame() : this);
             const SwRectFnSet aRectFnSet(pDirRefFrame);
-            const SwRectFn& _rRectFn(aRectFnSet.FnRect());
+            const SwRectFn _aRectFn(aRectFnSet.FnRect());
 
             if(rAttrs.JoinedWithPrev(*this))
             {
                 // tdf#115296 re-add adaptation of vert distance to close the 
evtl.
                 // existing gap to previous frame
                 const SwFrame* pPrevFrame(GetPrev());
-                (aRect.*_rRectFn->fnSetTop)( 
(pPrevFrame->*_rRectFn->fnGetPrtBottom)() );
+                (aRect.*_aRectFn->fnSetTop)( 
(pPrevFrame->*_aRectFn->fnGetPrtBottom)() );
 
                 // ...and disable top border paint/creation
                 pTopBorder = nullptr;
@@ -5679,7 +5679,7 @@ void SwFrame::PaintSwFrameShadowAndBorder(
                 // tdf#115296 re-add adaptation of vert distance to close the 
evtl.
                 // existing gap to next frame
                 const SwFrame* pNextFrame(GetNext());
-                (aRect.*_rRectFn->fnSetBottom)( 
(pNextFrame->*_rRectFn->fnGetPrtTop)() );
+                (aRect.*_aRectFn->fnSetBottom)( 
(pNextFrame->*_aRectFn->fnGetPrtTop)() );
 
                 // ...and disable bottom border paint/creation
                 pBottomBorder = nullptr;
@@ -6559,7 +6559,7 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext 
*pOut, const Point& aPoin
         return;
 
     sal_Int32 nScrollerHeight = pMgr->GetSidebarScrollerHeight();
-    const tools::Rectangle &aVisRect = _pViewShell->VisArea().SVRect();
+    const tools::Rectangle aVisRect = _pViewShell->VisArea().SVRect();
     //draw border and sidepane
     _pViewShell->GetOut()->SetLineColor();
     if (!bRight)
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 0e2c5e9e38d3..cef7c0c9d2dc 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -4536,7 +4536,7 @@ static void UnHideRedlines(SwRootFrame & rLayout,
                 }
                 else
                 {
-                    if (auto const& pMergedPara = pFrame->GetMergedPara())
+                    if (auto const pMergedPara = pFrame->GetMergedPara())
                     {
                         // invalidate SwInvalidateFlags::Size
                         pFrame->Prepare(PrepareHint::Clear, nullptr, false);
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx 
b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 2d71b13be8e8..81173d209c3e 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -2762,14 +2762,14 @@ void 
SwEnhancedPDFExportHelper::EnhancedPDFExport(LanguageType const eLanguageDe
                         pPDFExtOutDevData->CreateDest(aRect, nDestPageNum);
 
                     // Outline entry text
-                    const OUString& rEntry = 
mrSh.getIDocumentOutlineNodesAccess()->getOutlineText(
+                    const OUString aEntry = 
mrSh.getIDocumentOutlineNodesAccess()->getOutlineText(
                         i, mrSh.GetLayout(), true, false, false );
 
                     // postpone fly outlines
                     if ( bFlyOutline )
                     {
                         aFlyVector.push_back(
-                                    FlyEntry(nDestPageNum, rDestRect, nLevel, 
rEntry, nDestId) );
+                                    FlyEntry(nDestPageNum, rDestRect, nLevel, 
aEntry, nDestId) );
                         continue;
                     }
 
@@ -2803,7 +2803,7 @@ void 
SwEnhancedPDFExportHelper::EnhancedPDFExport(LanguageType const eLanguageDe
 
                     // Create a new outline item:
                     const sal_Int32 nOutlineId =
-                        pPDFExtOutDevData->CreateOutlineItem( nParent, rEntry, 
nDestId );
+                        pPDFExtOutDevData->CreateOutlineItem( nParent, aEntry, 
nDestId );
 
                     // Push current level and nOutlineId on stack:
                     aOutlineStack.push( StackEntry( nLevel, nOutlineId ) );
@@ -3008,8 +3008,8 @@ void 
SwEnhancedPDFExportHelper::ExportAuthorityEntryLinks()
             || targetType == SwAuthorityField::TargetType::UseTargetURL)
         {
             // Since the target type specifies to use an URL, link to it
-            const OUString& rURL = rAuthorityField.GetAbsoluteURL();
-            if (rURL.getLength() == 0)
+            const OUString aURL = rAuthorityField.GetAbsoluteURL();
+            if (aURL.getLength() == 0)
             {
                 continue;
             }
@@ -3036,7 +3036,7 @@ void 
SwEnhancedPDFExportHelper::ExportAuthorityEntryLinks()
                     sal_Int32 nLinkId = pPDFExtOutDevData->CreateLink(aRect, 
content, rLinkPageNum);
                     IdMapEntry aLinkEntry(rLinkRect, nLinkId);
                     
pPDFExtOutDevData->GetSwPDFState()->m_LinkIdMap.push_back(aLinkEntry);
-                    pPDFExtOutDevData->SetLinkURL(nLinkId, rURL);
+                    pPDFExtOutDevData->SetLinkURL(nLinkId, aURL);
                 }
             }
             mrSh.SwCursorShell::ClearMark();
diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx
index a9bd581a63ad..81ca87b15113 100644
--- a/sw/source/core/text/guess.cxx
+++ b/sw/source/core/text/guess.cxx
@@ -85,7 +85,7 @@ bool 
SwTextGuess::maybeAdjustPositionsForBlockAdjust(tools::Long& rMaxSizeDiff,
                                                      
std::optional<SwLinePortionLayoutContext> nLayoutContext)
 {
     const auto& adjObj = 
rInf.GetTextFrame()->GetTextNodeForParaProps()->GetSwAttrSet().GetAdjust();
-    const SvxAdjust& adjust = adjObj.GetAdjust();
+    const SvxAdjust adjust = adjObj.GetAdjust();
     if (adjust == SvxAdjust::Block)
     {
         if (rInf.DontBlockJustify())
@@ -187,7 +187,7 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, 
SwTextFormatInfo &rInf,
     SwTwips nLineWidth = rInf.GetLineWidth();
     TextFrameIndex nMaxLen = TextFrameIndex(rInf.GetText().getLength()) - 
rInf.GetIdx();
 
-    const SvxAdjust& rAdjust = 
rInf.GetTextFrame()->GetTextNodeForParaProps()->GetSwAttrSet().GetAdjust().GetAdjust();
+    const SvxAdjust aAdjust = 
rInf.GetTextFrame()->GetTextNodeForParaProps()->GetSwAttrSet().GetAdjust().GetAdjust();
 
     // allow up to 20% shrinking of the spaces
     if ( nSpacesInLine )
@@ -693,7 +693,7 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, 
SwTextFormatInfo &rInf,
                 m_nBreakPos = rInf.GetIdx() - TextFrameIndex(1);
             }
 
-            if( rAdjust != SvxAdjust::Left )
+            if( aAdjust != SvxAdjust::Left )
             {
                 // Delete any blanks at the end of a line, but be careful:
                 // If a field has been expanded, we do not want to delete any
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 42fce3f0bb67..678517f029d6 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -1635,7 +1635,7 @@ SwLinePortion 
*SwTextFormatter::WhichFirstPortion(SwTextFormatInfo &rInf)
     // check this *last* so that BuildMultiPortion() can find it!
     if (!pPor && rInf.CheckCurrentPosBookmark())
     {
-        const auto& bookmark = m_pScriptInfo->GetBookmarks(rInf.GetIdx());
+        const auto bookmark = m_pScriptInfo->GetBookmarks(rInf.GetIdx());
         if (!bookmark.empty())
         {
             // only for character width, maybe replaced with ] later
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index 147eeb10064b..8fd5f1c07623 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -328,8 +328,8 @@ bool SwTextPortion::Format_( SwTextFormatInfo &rInf )
 
     // tdf#158776 for the last full text portion, call Guess() again to allow 
more text in the
     // adjusted line by shrinking spaces using the know space count from the 
first Guess() call
-    const SvxAdjust& rAdjust = 
rInf.GetTextFrame()->GetTextNodeForParaProps()->GetSwAttrSet().GetAdjust().GetAdjust();
-    if ( bFull && rAdjust == SvxAdjust::Block &&
+    const SvxAdjust aAdjust = 
rInf.GetTextFrame()->GetTextNodeForParaProps()->GetSwAttrSet().GetAdjust().GetAdjust();
+    if ( bFull && aAdjust == SvxAdjust::Block &&
          pGuess->BreakPos() != TextFrameIndex(COMPLETE_STRING) &&
          rInf.GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(
                     DocumentSettingId::JUSTIFY_LINES_WITH_SHRINKING) &&
diff --git a/sw/source/core/txtnode/attrcontentcontrol.cxx 
b/sw/source/core/txtnode/attrcontentcontrol.cxx
index cfd19b75312f..9c6bd71a7593 100644
--- a/sw/source/core/txtnode/attrcontentcontrol.cxx
+++ b/sw/source/core/txtnode/attrcontentcontrol.cxx
@@ -286,10 +286,10 @@ std::optional<size_t> 
SwContentControl::GetSelectedListItem(bool bCheckDocModel)
     if (GetShowingPlaceHolder() || !nLen || !GetTextAttr())
         return std::nullopt;
 
-    const OUString& rText = GetTextAttr()->ToString();
+    const OUString aText = GetTextAttr()->ToString();
     for (size_t i = 0; i < nLen; ++i)
     {
-        if (GetTextAttr()[i].ToString() == rText)
+        if (GetTextAttr()[i].ToString() == aText)
             return i;
     }
     assert(!GetDropDown() && "DropDowns must always have an associated list 
item");
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index a0ee0b29ae8b..bc965b3ad7fc 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -3412,20 +3412,20 @@ SwTwips 
SwTextNode::GetAdditionalIndentForStartingNewList() const
             // was interpreted as left-margin not text-left-margin unlike every
             // other use of it.
             ::sw::ListLevelIndents const 
indents(AreListLevelIndentsApplicable());
-            SvxFirstLineIndentItem const& rFirst(
+            SvxFirstLineIndentItem const aFirst(
                     indents & ::sw::ListLevelIndents::FirstLine
                     ? SvxFirstLineIndentItem(rFormat.GetFirstLineIndent(), 
RES_MARGIN_FIRSTLINE)
                     : GetSwAttrSet().GetFirstLineIndent());
-            SvxTextLeftMarginItem const& rLeft(
+            SvxTextLeftMarginItem const aLeft(
                     indents & ::sw::ListLevelIndents::LeftMargin
                     ? SvxTextLeftMarginItem(rFormat.GetIndentAt(), 
RES_MARGIN_TEXTLEFT)
                     : GetSwAttrSet().GetTextLeftMargin());
-            nAdditionalIndent = rLeft.GetLeft(rFirst);
+            nAdditionalIndent = aLeft.GetLeft(aFirst);
             if (!(indents & ::sw::ListLevelIndents::FirstLine))
             {
                 if 
(getIDocumentSettingAccess()->get(DocumentSettingId::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING))
                 {
-                    nAdditionalIndent = nAdditionalIndent - 
rFirst.GetTextFirstLineOffset();
+                    nAdditionalIndent = nAdditionalIndent - 
aFirst.GetTextFirstLineOffset();
                 }
             }
         }
diff --git a/sw/source/core/unocore/unofield.cxx 
b/sw/source/core/unocore/unofield.cxx
index f40b7fbbaf2a..81f2b436d081 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -2143,7 +2143,7 @@ SwXTextField::getPropertySetInfo()
     }
     const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(
                     lcl_GetPropertyMapOfService(m_pImpl->m_nServiceId));
-    const uno::Reference<beans::XPropertySetInfo>& xInfo = 
pPropSet->getPropertySetInfo();
+    const uno::Reference<beans::XPropertySetInfo> xInfo = 
pPropSet->getPropertySetInfo();
     // extend PropertySetInfo!
     const uno::Sequence<beans::Property> aPropSeq = xInfo->getProperties();
     aRef = new SfxExtItemPropertySetInfo(
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index eadb0ed8e8c0..124a7d940e15 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -1351,14 +1351,14 @@ void SwViewShell::VisPortChgd( const SwRect &rRect)
                             // ignore objects that are not actually placed on 
the page
                             if (pObj->IsFormatPossible())
                             {
-                                const tools::Rectangle &rBound = 
pObj->GetObjRect().SVRect();
-                                if (rBound.Left() != FAR_AWAY) {
+                                const tools::Rectangle aBound = 
pObj->GetObjRect().SVRect();
+                                if (aBound.Left() != FAR_AWAY) {
                                     // OD 03.03.2003 #107927# - use correct 
datatype
-                                    const SwTwips nL = std::max( SwTwips(0), 
SwTwips(rBound.Left() - nOfst) );
+                                    const SwTwips nL = std::max( SwTwips(0), 
SwTwips(aBound.Left() - nOfst) );
                                     if ( nL < nMinLeft )
                                         nMinLeft = nL;
-                                    if( rBound.Right() + nOfst > nMaxRight )
-                                        nMaxRight = rBound.Right() + nOfst;
+                                    if( aBound.Right() + nOfst > nMaxRight )
+                                        nMaxRight = aBound.Right() + nOfst;
                                 }
                             }
                         }
diff --git a/sw/source/filter/html/htmlfld.cxx 
b/sw/source/filter/html/htmlfld.cxx
index fbb3c3965dc7..353936262e83 100644
--- a/sw/source/filter/html/htmlfld.cxx
+++ b/sw/source/filter/html/htmlfld.cxx
@@ -266,7 +266,7 @@ void SwHTMLParser::NewField()
          SwFieldIds::Author == nType) )
     {
         SvtUserOptions aOpt;
-        const OUString& rUser = aOpt.GetFullName();
+        const OUString aUser = aOpt.GetFullName();
         SwDocShell *pDocShell(m_xDoc->GetDocShell());
         OSL_ENSURE(pDocShell, "no SwDocShell");
         if (pDocShell) {
@@ -275,10 +275,10 @@ void SwHTMLParser::NewField()
             uno::Reference<document::XDocumentProperties> xDocProps(
                 xDPS->getDocumentProperties());
             OSL_ENSURE(xDocProps.is(), "Doc has no DocumentProperties");
-            const OUString& rChanged = xDocProps->getModifiedBy();
-            const OUString& rCreated = xDocProps->getAuthor();
-            if( rUser.isEmpty() ||
-                (!rChanged.isEmpty() ? rUser != rChanged : rUser != rCreated) )
+            const OUString aChanged = xDocProps->getModifiedBy();
+            const OUString aCreated = xDocProps->getAuthor();
+            if( aUser.isEmpty() ||
+                (!aChanged.isEmpty() ? aUser != aChanged : aUser != aCreated) )
                 bFixed = true;
         }
     }
diff --git a/sw/source/filter/html/htmlfldw.cxx 
b/sw/source/filter/html/htmlfldw.cxx
index d0288a3887d0..325cd6aa2bee 100644
--- a/sw/source/filter/html/htmlfldw.cxx
+++ b/sw/source/filter/html/htmlfldw.cxx
@@ -152,13 +152,13 @@ static SwHTMLWriter& OutHTML_SwField( SwHTMLWriter& rWrt, 
const SwField* pField,
                 }
                 else
                 {
-                    const OUString& rValue = pField->GetPar2();
-                    short nValue = static_cast<short>(rValue.toInt32());
+                    const OUString aPar2Value = pField->GetPar2();
+                    short nValue = static_cast<short>(aPar2Value.toInt32());
                     if( (eSubType == PG_NEXT && nValue!=1) ||
                         (eSubType == PG_PREV && nValue!=-1) ||
                         (eSubType == PG_RANDOM && nValue!=0) )
                     {
-                        aValue = rValue;
+                        aValue = aPar2Value;
                     }
                 }
             }
@@ -488,17 +488,17 @@ SwHTMLWriter& OutHTML_SwFormatField( SwHTMLWriter& rWrt, 
const SfxPoolItem& rHt
     {
         // Comments will be written in ANSI character set, but with system
         // line breaks.
-        const OUString& rComment = pField->GetPar2();
+        const OUString aComment = pField->GetPar2();
         bool bWritten = false;
 
-        if( (rComment.getLength() >= 6 && rComment.startsWith("<") && 
rComment.endsWith(">") &&
-             o3tl::equalsIgnoreAsciiCase(rComment.subView( 1, 4 ), u"" 
OOO_STRING_SVTOOLS_HTML_meta) ) ||
-            (rComment.getLength() >= 7 &&
-             rComment.startsWith( "<!--" ) &&
-             rComment.endsWith( "-->" )) )
+        if( (aComment.getLength() >= 6 && aComment.startsWith("<") && 
aComment.endsWith(">") &&
+             o3tl::equalsIgnoreAsciiCase(aComment.subView( 1, 4 ), u"" 
OOO_STRING_SVTOOLS_HTML_meta) ) ||
+            (aComment.getLength() >= 7 &&
+             aComment.startsWith( "<!--" ) &&
+             aComment.endsWith( "-->" )) )
         {
             // directly output META tags
-            OUString sComment(convertLineEnd(rComment, GetSystemLineEnd()));
+            OUString sComment(convertLineEnd(aComment, GetSystemLineEnd()));
             // TODO: HTML-Tags are written without entities, that for,
             // characters not contained in the destination encoding are lost!
             OString sTmp(OUStringToOString(sComment,
@@ -506,11 +506,11 @@ SwHTMLWriter& OutHTML_SwFormatField( SwHTMLWriter& rWrt, 
const SfxPoolItem& rHt
             rWrt.Strm().WriteOString( sTmp );
             bWritten = true;
         }
-        else if( rComment.getLength() >= 7 &&
-                 rComment.endsWith(">") &&
-                 rComment.startsWithIgnoreAsciiCase( "HTML:" ) )
+        else if( aComment.getLength() >= 7 &&
+                 aComment.endsWith(">") &&
+                 aComment.startsWithIgnoreAsciiCase( "HTML:" ) )
         {
-            OUString 
sComment(comphelper::string::stripStart(rComment.subView(5), ' '));
+            OUString 
sComment(comphelper::string::stripStart(aComment.subView(5), ' '));
             if( '<' == sComment[0] )
             {
                 sComment = convertLineEnd(sComment, GetSystemLineEnd());
@@ -527,7 +527,7 @@ SwHTMLWriter& OutHTML_SwFormatField( SwHTMLWriter& rWrt, 
const SfxPoolItem& rHt
 
         if( !bWritten )
         {
-            OUString sComment(convertLineEnd(rComment, GetSystemLineEnd()));
+            OUString sComment(convertLineEnd(aComment, GetSystemLineEnd()));
             // TODO: ???
             OString sOut =
                 "<" OOO_STRING_SVTOOLS_HTML_comment
@@ -543,7 +543,7 @@ SwHTMLWriter& OutHTML_SwFormatField( SwHTMLWriter& rWrt, 
const SfxPoolItem& rHt
             rWrt.OutNewLine( true );
 
         bool bURL = static_cast<const SwScriptField *>(pField)->IsCodeURL();
-        const OUString& rType = pField->GetPar1();
+        const OUString aType = pField->GetPar1();
         OUString aContents, aURL;
         if(bURL)
             aURL = pField->GetPar2();
@@ -552,7 +552,7 @@ SwHTMLWriter& OutHTML_SwFormatField( SwHTMLWriter& rWrt, 
const SfxPoolItem& rHt
 
         // otherwise is the script content itself. Since only JavaScript
         // is in fields, it must be JavaScript ...:)
-        HTMLOutFuncs::OutScript( rWrt.Strm(), rWrt.GetBaseURL(), aContents, 
rType, JAVASCRIPT,
+        HTMLOutFuncs::OutScript( rWrt.Strm(), rWrt.GetBaseURL(), aContents, 
aType, JAVASCRIPT,
                                  aURL, nullptr, nullptr );
 
         if (rWrt.IsLFPossible())
diff --git a/sw/source/filter/indexing/IndexingExport.cxx 
b/sw/source/filter/indexing/IndexingExport.cxx
index acd7aba45b9c..fe8394c0cf74 100644
--- a/sw/source/filter/indexing/IndexingExport.cxx
+++ b/sw/source/filter/indexing/IndexingExport.cxx
@@ -92,16 +92,16 @@ public:
         {
             nParentIndex = maNodeStack.back()->GetIndex();
         }
-        const OUString& rString
+        const OUString aString
             = 
pTextNode->GetText().replaceAll(OUStringChar(CH_TXTATR_BREAKWORD), "");
-        if (rString.isEmpty())
+        if (aString.isEmpty())
             return;
         m_rXmlWriter.startElement("paragraph");
         m_rXmlWriter.attribute("index", sal_Int32(pTextNode->GetIndex()));
         m_rXmlWriter.attribute("node_type", "writer"_ostr);
         if (nParentIndex >= SwNodeOffset(0))
             m_rXmlWriter.attribute("parent_index", sal_Int32(nParentIndex));
-        m_rXmlWriter.content(rString);
+        m_rXmlWriter.content(aString);
         m_rXmlWriter.endElement();
     }
 
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index a60ae8542fe8..e02477836c9c 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -5194,8 +5194,8 @@ void DocxAttributeOutput::WriteSrcRect(
     Size aOriginalSize(aGraphic.GetPrefSize());
 
     const MapMode aMap100mm( MapUnit::Map100thMM );
-    const MapMode& rMapMode = aGraphic.GetPrefMapMode();
-    if (rMapMode.GetMapUnit() == MapUnit::MapPixel)
+    const MapMode aMapMode = aGraphic.GetPrefMapMode();
+    if (aMapMode.GetMapUnit() == MapUnit::MapPixel)
     {
         aOriginalSize = 
Application::GetDefaultDevice()->PixelToLogic(aOriginalSize, aMap100mm);
     }
@@ -6794,9 +6794,9 @@ void DocxAttributeOutput::StartStyle( const OUString& 
rName, StyleType eType,
         const SwNumRule* pRule = m_rExport.m_pStyles->GetSwNumRule(nSlot);
         pRule->GetGrabBagItem(aAny);
     }
-    const uno::Sequence<beans::PropertyValue>& rGrabBag = aAny.get< 
uno::Sequence<beans::PropertyValue> >();
+    const uno::Sequence<beans::PropertyValue> aGrabBag = aAny.get< 
uno::Sequence<beans::PropertyValue> >();
 
-    for (const auto& rProp : rGrabBag)
+    for (const auto& rProp : aGrabBag)
     {
         if (rProp.Name == "uiPriority")
             aUiPriority = rProp.Value.get<OUString>();
diff --git a/sw/source/filter/ww8/writerhelper.cxx 
b/sw/source/filter/ww8/writerhelper.cxx
index 4bc9faf385c1..b8a47b329245 100644
--- a/sw/source/filter/ww8/writerhelper.cxx
+++ b/sw/source/filter/ww8/writerhelper.cxx
@@ -637,7 +637,7 @@ namespace sw
         tools::Polygon CorrectWordWrapPolygonForExport(const 
tools::PolyPolygon& rPolyPoly, const SwNoTextNode* pNd, bool bCorrectCrop)
         {
             tools::Polygon aPoly(PolygonFromPolyPolygon(rPolyPoly));
-            const Size &rOrigSize = pNd->GetGraphic().GetPrefSize();
+            const Size aOrigSize = pNd->GetGraphic().GetPrefSize();
 
             const SwAttrSet* pAttrSet = pNd->GetpSwAttrSet();
             if (bCorrectCrop && pAttrSet)
@@ -653,14 +653,14 @@ namespace sw
                     sal_Int32 nCropBottom = 
convertTwipToMm100(rCrop.GetBottom());
                     aPoly.Move(-nCropLeft, -nCropTop);
 
-                    Fraction aScaleX(rOrigSize.getWidth(), 
rOrigSize.getWidth() - nCropLeft - nCropRight);
-                    Fraction aScaleY(rOrigSize.getHeight(), 
rOrigSize.getHeight() - nCropTop - nCropBottom);
+                    Fraction aScaleX(aOrigSize.getWidth(), 
aOrigSize.getWidth() - nCropLeft - nCropRight);
+                    Fraction aScaleY(aOrigSize.getHeight(), 
aOrigSize.getHeight() - nCropTop - nCropBottom);
                     aPoly.Scale(double(aScaleX), double(aScaleY));
                 }
             }
 
-            Fraction aMapPolyX(ww::nWrap100Percent, rOrigSize.Width());
-            Fraction aMapPolyY(ww::nWrap100Percent, rOrigSize.Height());
+            Fraction aMapPolyX(ww::nWrap100Percent, aOrigSize.Width());
+            Fraction aMapPolyY(ww::nWrap100Percent, aOrigSize.Height());
             aPoly.Scale(double(aMapPolyX), double(aMapPolyY));
 
             /*
@@ -670,8 +670,8 @@ namespace sw
 
              See the import for details
             */
-            const Size &rSize = pNd->GetTwipSize();
-            Fraction aMoveHack(ww::nWrap100Percent, rSize.Width());
+            const Size aSize = pNd->GetTwipSize();
+            Fraction aMoveHack(ww::nWrap100Percent, aSize.Width());
             aMoveHack *= Fraction(15, 1);
             tools::Long nMove(aMoveHack);
 
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index b60759ac0cca..9a2eee82747c 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -2841,7 +2841,7 @@ void WW8AttributeOutput::HiddenField( const SwField& 
rField )
 void WW8AttributeOutput::SetField( const SwField& rField, ww::eField eType, 
const OUString& rCmd )
 {
     const SwSetExpField* pSet = static_cast<const SwSetExpField*>(&rField);
-    const OUString &rVar = pSet->GetPar2();
+    const OUString aVar = pSet->GetPar2();
 
     sal_uLong nFrom = m_rWW8Export.Fc2Cp(m_rWW8Export.Strm().Tell());
 
@@ -2858,9 +2858,9 @@ void WW8AttributeOutput::SetField( const SwField& rField, 
ww::eField eType, cons
     */
     
m_rWW8Export.MoveFieldMarks(nFrom,m_rWW8Export.Fc2Cp(m_rWW8Export.Strm().Tell()));
 
-    if (!rVar.isEmpty())
+    if (!aVar.isEmpty())
     {
-        SwWW8Writer::WriteString16(m_rWW8Export.Strm(), rVar, false);
+        SwWW8Writer::WriteString16(m_rWW8Export.Strm(), aVar, false);
     }
     GetExport().OutputField(&rField, eType, rCmd, FieldFlags::Close);
 }
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 4708b4468329..d0ad7521ee6b 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -2116,14 +2116,14 @@ void SwWW8ImplReader::MapWrapIntoFlyFormat(const 
SvxMSDffImportRec& rRecord,
             */
 
             tools::PolyPolygon aPoly(*rRecord.pWrapPolygon);
-            const Size &rSize = pNd->GetTwipSize();
+            const Size aSize = pNd->GetTwipSize();
             /*
              Move to the left by 15twips, and rescale to
              a) shrink right bound back to orig position
              b) stretch bottom bound to where I think it should have been
              in the first place
             */
-            Fraction aMoveHack(ww::nWrap100Percent, rSize.Width());
+            Fraction aMoveHack(ww::nWrap100Percent, aSize.Width());
             aMoveHack *= Fraction(15, 1);
             tools::Long nMove(aMoveHack);
             aPoly.Move(nMove, 0);
@@ -2133,9 +2133,9 @@ void SwWW8ImplReader::MapWrapIntoFlyFormat(const 
SvxMSDffImportRec& rRecord,
             aPoly.Scale(double(aHackX), double(aHackY));
 
             // Turn polygon back into units that match the graphic's
-            const Size &rOrigSize = pNd->GetGraphic().GetPrefSize();
-            Fraction aMapPolyX(rOrigSize.Width(), ww::nWrap100Percent);
-            Fraction aMapPolyY(rOrigSize.Height(), ww::nWrap100Percent);
+            const Size aOrigSize = pNd->GetGraphic().GetPrefSize();
+            Fraction aMapPolyX(aOrigSize.Width(), ww::nWrap100Percent);
+            Fraction aMapPolyY(aOrigSize.Height(), ww::nWrap100Percent);
             aPoly.Scale(double(aMapPolyX), double(aMapPolyY));
 
             // #i47277# - contour is already in unit of the
diff --git a/sw/source/filter/xml/xmlfonte.cxx 
b/sw/source/filter/xml/xmlfonte.cxx
index d634bbbd5d8b..8c521e5fe293 100644
--- a/sw/source/filter/xml/xmlfonte.cxx
+++ b/sw/source/filter/xml/xmlfonte.cxx
@@ -111,7 +111,7 @@ 
SwXMLFontAutoStylePool_Impl::SwXMLFontAutoStylePool_Impl(SwXMLExport& _rExport,
             pFont->GetCharSet());
     }
 
-    auto const & pDocument = _rExport.getDoc();
+    auto const pDocument = _rExport.getDoc();
 
     m_bEmbedUsedOnly = 
pDocument->getIDocumentSettingAccess().get(DocumentSettingId::EMBED_USED_FONTS);
     m_bEmbedLatinScript = 
pDocument->getIDocumentSettingAccess().get(DocumentSettingId::EMBED_LATIN_SCRIPT_FONTS);
diff --git a/sw/source/filter/xml/xmlimpit.cxx 
b/sw/source/filter/xml/xmlimpit.cxx
index b3d55ce37aa2..081322ca1843 100644
--- a/sw/source/filter/xml/xmlimpit.cxx
+++ b/sw/source/filter/xml/xmlimpit.cxx
@@ -168,15 +168,15 @@ void SvXMLImportItemMapper::importXML( SfxItemSet& rSet,
                     pUnknownItem->AddAttr( SvXMLImport::getNameFromToken( 
nToken ), sValue );
                 else
                 {
-                    const OUString& rAttrNamespacePrefix = 
SvXMLImport::getNamespacePrefixFromToken(nToken, &rNamespaceMap);
+                    const OUString aAttrNamespacePrefix = 
SvXMLImport::getNamespacePrefixFromToken(nToken, &rNamespaceMap);
                     OUString sAttrName = SvXMLImport::getNameFromToken( nToken 
);
-                    if ( !rAttrNamespacePrefix.isEmpty() )
-                        sAttrName = rAttrNamespacePrefix + 
SvXMLImport::aNamespaceSeparator + sAttrName;
+                    if ( !aAttrNamespacePrefix.isEmpty() )
+                        sAttrName = aAttrNamespacePrefix + 
SvXMLImport::aNamespaceSeparator + sAttrName;
                     OUString aLocalName, aPrefix, aNamespace;
                     rNamespaceMap.GetKeyByAttrName( sAttrName, &aPrefix, 
&aLocalName,
                                                         &aNamespace );
-                    if ( !rAttrNamespacePrefix.isEmpty() )
-                        pUnknownItem->AddAttr( rAttrNamespacePrefix, 
aNamespace, aLocalName,
+                    if ( !aAttrNamespacePrefix.isEmpty() )
+                        pUnknownItem->AddAttr( aAttrNamespacePrefix, 
aNamespace, aLocalName,
                                                sValue );
                     else
                         pUnknownItem->AddAttr( aLocalName, sValue );
diff --git a/sw/source/ui/config/mailconfigpage.cxx 
b/sw/source/ui/config/mailconfigpage.cxx
index 1079bdc93c55..77d0850f9c03 100644
--- a/sw/source/ui/config/mailconfigpage.cxx
+++ b/sw/source/ui/config/mailconfigpage.cxx
@@ -152,7 +152,7 @@ OUString SwMailConfigPage::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() + " ";
     }
 
@@ -160,7 +160,7 @@ OUString SwMailConfigPage::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() + " ";
     }
 
@@ -168,7 +168,7 @@ OUString SwMailConfigPage::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/sw/source/ui/config/optcomp.cxx b/sw/source/ui/config/optcomp.cxx
index f296dbc9f6d4..30d698bf6ed6 100644
--- a/sw/source/ui/config/optcomp.cxx
+++ b/sw/source/ui/config/optcomp.cxx
@@ -144,8 +144,8 @@ void SwCompatibilityOptPage::InitControls( const 
SfxItemSet& rSet )
     {
         m_xMain->set_sensitive(false);
     }
-    const OUString& rText = m_xMain->get_label();
-    m_xMain->set_label(rText.replaceAll("%DOCNAME", sDocTitle));
+    const OUString aText = m_xMain->get_label();
+    m_xMain->set_label(aText.replaceAll("%DOCNAME", sDocTitle));
 }
 
 IMPL_LINK_NOARG(SwCompatibilityOptPage, UseAsDefaultHdl, weld::Button&, void)
@@ -196,7 +196,7 @@ void SwCompatibilityOptPage::SetCurrentOptions()
             const bool bReadOnly = 
defaultCompatOptions.getPropertyReadOnly(option);
             if (bReadOnly)
                 hasReadOnly = true;
-            const auto& [docSettingId, shouldNegate] = 
DocumentSettingForOption(option);
+            const auto [docSettingId, shouldNegate] = 
DocumentSettingForOption(option);
             bool bChecked = rIDocumentSettingAccess.get(docSettingId);
             if (shouldNegate)
                 bChecked = !bChecked;
@@ -228,7 +228,7 @@ OUString SwCompatibilityOptPage::GetAllStrings()
 {
     OUString sAllStrings;
 
-    if (const auto& pString = m_xBuilder->weld_label(u"label11"_ustr))
+    if (const auto pString = m_xBuilder->weld_label(u"label11"_ustr))
         sAllStrings += pString->get_label() + " ";
 
     sAllStrings += m_xDefaultPB->get_label() + " ";
diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx
index 6262ad9cfbd8..f3419cb1e968 100644
--- a/sw/source/ui/config/optload.cxx
+++ b/sw/source/ui/config/optload.cxx
@@ -596,7 +596,7 @@ OUString SwLoadOptPage::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() + " ";
     }
 
@@ -605,7 +605,7 @@ OUString SwLoadOptPage::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() + " ";
     }
 
@@ -613,7 +613,7 @@ OUString SwLoadOptPage::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() + " ";
     }
 
@@ -1068,11 +1068,11 @@ OUString SwCaptionOptPage::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() + " ";
     }
 
-    if (const auto& pString = 
m_xBuilder->weld_check_button(u"applyborder"_ustr))
+    if (const auto pString = 
m_xBuilder->weld_check_button(u"applyborder"_ustr))
         sAllStrings += pString->get_label() + " ";
 
     return sAllStrings.replaceAll("_", "");
diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index c202a1d0270a..5cb915d69785 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -369,7 +369,7 @@ OUString SwContentOptPage::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() + " ";
     }
 
@@ -391,7 +391,7 @@ OUString SwContentOptPage::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() + " ";
     }
 
@@ -607,7 +607,7 @@ OUString SwAddPrinterTabPage::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() + " ";
     }
 
@@ -617,7 +617,7 @@ OUString SwAddPrinterTabPage::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() + " ";
     }
 
@@ -625,7 +625,7 @@ OUString SwAddPrinterTabPage::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() + " ";
     }
 
@@ -942,7 +942,7 @@ OUString SwStdFontTabPage::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() + " ";
     }
 
@@ -1448,7 +1448,7 @@ OUString SwTableOptionsTabPage::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() + " ";
     }
 
@@ -1457,7 +1457,7 @@ OUString SwTableOptionsTabPage::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() + " ";
     }
 
@@ -1465,7 +1465,7 @@ OUString SwTableOptionsTabPage::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() + " ";
     }
 
@@ -1810,7 +1810,7 @@ OUString SwShdwCursorOptionsTabPage::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() + " ";
     }
 
@@ -1821,7 +1821,7 @@ OUString SwShdwCursorOptionsTabPage::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() + " ";
     }
 
@@ -2292,7 +2292,7 @@ OUString SwRedlineOptionsTabPage::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() + " ";
     }
 
@@ -2707,7 +2707,7 @@ OUString SwCompareOptionsTabPage::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() + " ";
     }
 
@@ -2715,7 +2715,7 @@ OUString SwCompareOptionsTabPage::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() + " ";
     }
 
@@ -2851,11 +2851,11 @@ OUString SwTestTabPage::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() + " ";
     }
 
-    if (const auto& pString = m_xBuilder->weld_label(u"label1"_ustr))
+    if (const auto pString = m_xBuilder->weld_label(u"label1"_ustr))
         sAllStrings += pString->get_label() + " ";
 
     return sAllStrings.replaceAll("_", "");
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index e6bb4eb1097b..4b530ab8ce05 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -2261,7 +2261,7 @@ void SwFramePage::Init(const SfxItemSet& rSet)
         if ( m_sDlgType == "ObjectDialog" && ! m_bNew )
         {
             // disable width and height for math objects
-            const SvGlobalName& rFactNm( pSh->GetOLEObject()->getClassID() );
+            const SvGlobalName aFactNm( pSh->GetOLEObject()->getClassID() );
 
             static struct GlobalNameId {
                 sal_uInt32 n1;
@@ -2275,7 +2275,7 @@ void SwFramePage::Init(const SfxItemSet& rSet)
                                      rId.b8, rId.b9, rId.b10, rId.b11,
                                      rId.b12, rId.b13, rId.b14, rId.b15 );
 
-                if( rFactNm == aGlbNm )
+                if( aFactNm == aGlbNm )
                 {
                     // disable size controls for math OLE objects
                     m_xWidthFT->set_sensitive(false);
diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index 905b4aeaa984..e2773bd6d363 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -1097,8 +1097,8 @@ void SwTOXSelectTabPage::ApplyTOXDescription()
     LanguageHdl(nullptr);
     for (int nCnt = 0, nEntryCount = m_xSortAlgorithmLB->get_count(); nCnt < 
nEntryCount; ++nCnt)
     {
-        const OUString& rEntryData = m_xSortAlgorithmLB->get_id(nCnt);
-        if (rEntryData == rDesc.GetSortAlgorithm())
+        const OUString aEntryData = m_xSortAlgorithmLB->get_id(nCnt);
+        if (aEntryData == rDesc.GetSortAlgorithm())
         {
             m_xSortAlgorithmLB->set_active(nCnt);
             break;
@@ -1240,8 +1240,8 @@ void SwTOXSelectTabPage::FillTOXDescription()
         rDesc.SetStyleNames(m_aStyleArr[i], i);
 
     rDesc.SetLanguage(m_xLanguageLB->get_active_id());
-    const OUString& rEntryData = m_xSortAlgorithmLB->get_active_id();
-    rDesc.SetSortAlgorithm(rEntryData);
+    const OUString aEntryData = m_xSortAlgorithmLB->get_active_id();
+    rDesc.SetSortAlgorithm(aEntryData);
 }
 
 void SwTOXSelectTabPage::Reset( const SfxItemSet* )
diff --git a/sw/source/uibase/docvw/edtwin.cxx 
b/sw/source/uibase/docvw/edtwin.cxx
index 520f2951bddb..4736ef280a51 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -6692,7 +6692,7 @@ void QuickHelpData::SortAndFilter(const OUString 
&rOrigWord)
                m_aHelpStrings.end(),
                CompareIgnoreCaseAsciiFavorExact(rOrigWord) );
 
-    const auto& it
+    const auto it
         = std::unique(m_aHelpStrings.begin(), m_aHelpStrings.end(), 
EqualIgnoreCaseAscii());
     m_aHelpStrings.erase( it, m_aHelpStrings.end() );
 
diff --git a/sw/source/uibase/docvw/edtwin2.cxx 
b/sw/source/uibase/docvw/edtwin2.cxx
index ff9732e5a7ba..d8d7f7ec2057 100644
--- a/sw/source/uibase/docvw/edtwin2.cxx
+++ b/sw/source/uibase/docvw/edtwin2.cxx
@@ -623,8 +623,8 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt)
                                 t == 
SwAuthorityField::TargetType::UseDisplayURL
                                 || t == 
SwAuthorityField::TargetType::UseTargetURL)
                             {
-                                const OUString& rURL = 
pAuthorityField->GetAbsoluteURL();
-                                sText += "
" + SfxHelp::GetURLHelpText(rURL);
+                                const OUString aURL = 
pAuthorityField->GetAbsoluteURL();
+                                sText += "
" + SfxHelp::GetURLHelpText(aURL);
                             }
 
                             break;
diff --git a/sw/source/uibase/envelp/labelcfg.cxx 
b/sw/source/uibase/envelp/labelcfg.cxx
index c103439bc674..064e308e9cec 100644
--- a/sw/source/uibase/envelp/labelcfg.cxx
+++ b/sw/source/uibase/envelp/labelcfg.cxx
@@ -131,8 +131,8 @@ SwLabelConfig::SwLabelConfig() :
     assert(res == xmlreader::XmlReader::Result::Done);
 
     // add to m_aLabels and m_aManufacturers the custom labels
-    const Sequence<OUString>& rMan = GetNodeNames( OUString() );
-    for ( const OUString& rManufacturer : rMan )
+    const Sequence<OUString> aMan = GetNodeNames( OUString() );
+    for ( const OUString& rManufacturer : aMan )
     {
         const Sequence<OUString> aLabels = GetNodeNames( rManufacturer );
         for( const OUString& rLabel : aLabels )
diff --git a/sw/source/uibase/misc/redlndlg.cxx 
b/sw/source/uibase/misc/redlndlg.cxx
index ab6078a4e976..f34998c04176 100644
--- a/sw/source/uibase/misc/redlndlg.cxx
+++ b/sw/source/uibase/misc/redlndlg.cxx
@@ -1020,7 +1020,7 @@ void 
SwRedlineAcceptDlg::InsertParents(SwRedlineTable::size_type nStart, SwRedli
 
         bool bShowDeletedTextAsComment = bIsShowChangesInMargin &&
                 RedlineType::Delete == rRedln.GetType() && 
rRedln.GetComment().isEmpty();
-        const OUString& sComment = bShowDeletedTextAsComment
+        const OUString sComment = bShowDeletedTextAsComment
                     ? const_cast<SwRangeRedline&>(rRedln).GetDescr()
                     : rRedln.GetComment();
         pRedlineParent->sComment = sComment.replace('
', ' ');
diff --git a/sw/source/uibase/ribbar/inputwin.cxx 
b/sw/source/uibase/ribbar/inputwin.cxx
index 0f01b7724ffc..590b9671d3e6 100644
--- a/sw/source/uibase/ribbar/inputwin.cxx
+++ b/sw/source/uibase/ribbar/inputwin.cxx
@@ -204,12 +204,12 @@ void SwInputWindow::ShowWin()
                                                 SelTableCellsNotify) );
         if( m_bIsTable )
         {
-            const OUString& rPos = m_pWrtShell->GetBoxNms();
+            const OUString aPos = m_pWrtShell->GetBoxNms();
             sal_Int32 nPos = 0;
             short nSrch = -1;
-            while( (nPos = rPos.indexOf( ':',nPos + 1 ) ) != -1 )
+            while( (nPos = aPos.indexOf( ':',nPos + 1 ) ) != -1 )
                 nSrch = static_cast<short>(nPos);
-            mxPos->set_text( rPos.copy( ++nSrch ) );
+            mxPos->set_text( aPos.copy( ++nSrch ) );
             m_aCurrentTableName = m_pWrtShell->GetTableFormat()->GetName();
         }
         else
diff --git a/sw/source/uibase/shells/annotsh.cxx 
b/sw/source/uibase/shells/annotsh.cxx
index cdec53e184e8..4d225dfc8aaa 100644
--- a/sw/source/uibase/shells/annotsh.cxx
+++ b/sw/source/uibase/shells/annotsh.cxx
@@ -255,13 +255,13 @@ void SwAnnotationShell::Exec( SfxRequest &rReq )
         {
             if (!rReq.GetArgs())
             {
-                const std::optional<NamedColor>& oColor
+                const std::optional<NamedColor> oColor
                     = 
m_rView.GetDocShell()->GetRecentColor(SID_ATTR_CHAR_COLOR);
                 if (oColor.has_value())
                 {
                     nEEWhich = 
GetPool().GetWhichIDFromSlotID(SID_ATTR_CHAR_COLOR);
-                    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));
                     rReq.SetArgs(aNewAttr);
                     rReq.SetSlot(SID_ATTR_CHAR_COLOR);
                 }
@@ -273,12 +273,12 @@ void SwAnnotationShell::Exec( SfxRequest &rReq )
             nEEWhich = GetPool().GetWhichIDFromSlotID(nSlot);
             if (!rReq.GetArgs())
             {
-                const std::optional<NamedColor>& oColor
+                const std::optional<NamedColor> oColor
                     = m_rView.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/sw/source/uibase/shells/drwbassh.cxx 
b/sw/source/uibase/shells/drwbassh.cxx
index 26f5c9d127e6..2c59cfe8ffa0 100644
--- a/sw/source/uibase/shells/drwbassh.cxx
+++ b/sw/source/uibase/shells/drwbassh.cxx
@@ -214,8 +214,8 @@ void SwDrawBaseShell::Execute(SfxRequest& rReq)
                         }
                         SfxItemSet aNewAttr(pSdrView->GetGeoAttrFromMarked());
 
-                        const WhichRangesContainer& pRange = 
pDlg->GetInputRanges( *aNewAttr.GetPool() );
-                        SfxItemSet aSet( *aNewAttr.GetPool(), pRange );
+                        const WhichRangesContainer aRange = 
pDlg->GetInputRanges( *aNewAttr.GetPool() );
+                        SfxItemSet aSet( *aNewAttr.GetPool(), aRange );
                         FieldUnit eMetric = ::GetDfltMetric( 
dynamic_cast<SwWebView*>(&GetView()) != nullptr );
                         SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, 
static_cast< sal_uInt16 >(eMetric)) );
 
diff --git a/sw/source/uibase/shells/drwtxtex.cxx 
b/sw/source/uibase/shells/drwtxtex.cxx
index ca666e1b34b7..2148180c9970 100644
--- a/sw/source/uibase/shells/drwtxtex.cxx
+++ b/sw/source/uibase/shells/drwtxtex.cxx
@@ -153,13 +153,13 @@ void SwDrawTextShell::Execute( SfxRequest &rReq )
         {
             if (!rReq.GetArgs())
             {
-                const std::optional<NamedColor>& oColor
+                const std::optional<NamedColor> oColor
                     = 
GetView().GetDocShell()->GetRecentColor(SID_ATTR_CHAR_COLOR);
                 if (oColor.has_value())
                 {
                     nEEWhich = 
GetPool().GetWhichIDFromSlotID(SID_ATTR_CHAR_COLOR);
-                    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));
                     rReq.SetArgs(aNewAttr);
                     rReq.SetSlot(SID_ATTR_CHAR_COLOR);
                 }
@@ -171,12 +171,12 @@ void SwDrawTextShell::Execute( SfxRequest &rReq )
             nEEWhich = GetPool().GetWhichIDFromSlotID(nSlot);
             if (!rReq.GetArgs())
             {
-                const std::optional<NamedColor>& oColor
+                const std::optional<NamedColor> oColor
                     = m_rView.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/sw/source/uibase/shells/textsh1.cxx 
b/sw/source/uibase/shells/textsh1.cxx
index 645d3d3f7d93..3578543a2357 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -1893,13 +1893,13 @@ void SwTextShell::Execute(SfxRequest &rReq)
             if (!pItem)
             {
                 // no color provided: use the pre-selected color shown in the 
toolbar/sidebar
-                const std::optional<NamedColor>& oColor
+                const std::optional<NamedColor> oColor
                     = 
GetView().GetDocShell()->GetRecentColor(SID_ATTR_CHAR_COLOR);
                 if (oColor.has_value())
                 {
-                    const model::ComplexColor& rCol = 
(*oColor).getComplexColor();
+                    const model::ComplexColor aCol = 
(*oColor).getComplexColor();
                     pRecentColor = std::make_unique<const SvxColorItem>(
-                        rCol.getFinalColor(), rCol, RES_CHRATR_COLOR);
+                        aCol.getFinalColor(), aCol, RES_CHRATR_COLOR);
                     pItem = pRecentColor.get();
                 }
             }
@@ -1938,7 +1938,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
             else if (nSlot == SID_ATTR_CHAR_BACK_COLOR)
             {
                 // no color provided: use the pre-selected color shown in the 
toolbar/sidebar
-                const std::optional<NamedColor>& oColor
+                const std::optional<NamedColor> oColor
                     = GetView().GetDocShell()->GetRecentColor(nSlot);
                 if (oColor.has_value())
                 {
diff --git a/sw/source/uibase/sidebar/PageMarginControl.cxx 
b/sw/source/uibase/sidebar/PageMarginControl.cxx
index 6898f73e536b..8e0fa07ae01c 100644
--- a/sw/source/uibase/sidebar/PageMarginControl.cxx
+++ b/sw/source/uibase/sidebar/PageMarginControl.cxx
@@ -73,10 +73,10 @@ namespace
 
     css::uno::Reference< css::document::XUndoManager > getUndoManager( const 
css::uno::Reference< css::frame::XFrame >& rxFrame )
     {
-        const css::uno::Reference< css::frame::XController >& xController = 
rxFrame->getController();
+        const css::uno::Reference< css::frame::XController > xController = 
rxFrame->getController();
         if ( xController.is() )
         {
-            const css::uno::Reference< css::frame::XModel >& xModel = 
xController->getModel();
+            const css::uno::Reference< css::frame::XModel > xModel = 
xController->getModel();
             if ( xModel.is() )
             {
                 const css::uno::Reference< css::document::XUndoManagerSupplier 
> xSuppUndo( xModel, css::uno::UNO_QUERY_THROW );
diff --git a/sw/source/uibase/sidebar/PageOrientationControl.cxx 
b/sw/source/uibase/sidebar/PageOrientationControl.cxx
index 73bdee58a1e6..b7afdcdba6b3 100644
--- a/sw/source/uibase/sidebar/PageOrientationControl.cxx
+++ b/sw/source/uibase/sidebar/PageOrientationControl.cxx
@@ -32,10 +32,10 @@
 namespace {
     css::uno::Reference< css::document::XUndoManager > getUndoManager( const 
css::uno::Reference< css::frame::XFrame >& rxFrame )
     {
-        const css::uno::Reference< css::frame::XController >& xController = 
rxFrame->getController();
+        const css::uno::Reference< css::frame::XController > xController = 
rxFrame->getController();
         if ( xController.is() )
         {
-            const css::uno::Reference< css::frame::XModel >& xModel = 
xController->getModel();
+            const css::uno::Reference< css::frame::XModel > xModel = 
xController->getModel();
             if ( xModel.is() )
             {
                 const css::uno::Reference< css::document::XUndoManagerSupplier 
> xSuppUndo( xModel, css::uno::UNO_QUERY_THROW );
diff --git a/sw/source/uibase/sidebar/QuickFindPanel.cxx 
b/sw/source/uibase/sidebar/QuickFindPanel.cxx
index 016878aa2521..11e5545b52d2 100644
--- a/sw/source/uibase/sidebar/QuickFindPanel.cxx
+++ b/sw/source/uibase/sidebar/QuickFindPanel.cxx
@@ -416,8 +416,8 @@ void QuickFindPanel::FillSearchFindsList()
     m_xSearchFindsList->clear();
     m_xSearchFindFoundTimesLabel->set_label(OUString());
 
-    const OUString& rsFindEntry = m_xSearchFindEntry->get_text();
-    if (rsFindEntry.isEmpty())
+    const OUString sFindEntry = m_xSearchFindEntry->get_text();
+    if (sFindEntry.isEmpty())
         return;
 
     SwWait aWait(*m_pWrtShell->GetDoc()->GetDocShell(), true);
@@ -426,7 +426,7 @@ void QuickFindPanel::FillSearchFindsList()
 
     i18nutil::SearchOptions2 aSearchOptions;
     aSearchOptions.Locale = GetAppLanguageTag().getLocale();
-    aSearchOptions.searchString = rsFindEntry;
+    aSearchOptions.searchString = sFindEntry;
     aSearchOptions.replaceString.clear();
     if (m_bWholeWordsOnly)
         aSearchOptions.searchFlag |= css::util::SearchFlags::NORM_WORD_ONLY;
diff --git a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx 
b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
index eb8424ae92d8..b27de07e9e50 100644
--- a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
+++ b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
@@ -442,7 +442,7 @@ static void MetadataToTreeNode(const 
css::uno::Reference<css::uno::XInterface>&
     if (SwDocShell* pDocSh = 
static_cast<SwDocShell*>(SfxObjectShell::Current()))
     {
         rtl::Reference<SwXTextDocument> 
xDocumentMetadataAccess(pDocSh->GetBaseModel());
-        const uno::Reference<rdf::XRepository>& xRepo = 
xDocumentMetadataAccess->getRDFRepository();
+        const uno::Reference<rdf::XRepository> xRepo = 
xDocumentMetadataAccess->getRDFRepository();
         const css::uno::Reference<css::rdf::XResource> xSubject(rSource, 
uno::UNO_QUERY);
         std::map<OUString, OUString> xStatements
             = SwRDFHelper::getStatements(pDocSh->GetBaseModel(), 
xRepo->getGraphNames(), xSubject);
diff --git a/sw/source/uibase/uiview/pview.cxx 
b/sw/source/uibase/uiview/pview.cxx
index 79d965c4061a..6fb310455a6f 100644
--- a/sw/source/uibase/uiview/pview.cxx
+++ b/sw/source/uibase/uiview/pview.cxx
@@ -1586,9 +1586,9 @@ void SwPagePreview::ScrollViewSzChg()
         else //vertical scrolling by pixel
         {
             const tools::Rectangle& rDocRect = 
m_pViewWin->GetPaintedPreviewDocRect();
-            const Size& rPreviewSize =
+            const Size aPreviewSize =
                     GetViewShell()->PagePreviewLayout()->GetPreviewDocSize();
-            m_pVScrollbar->SetRangeMax(rPreviewSize.Height()) ;
+            m_pVScrollbar->SetRangeMax(aPreviewSize.Height()) ;
             tools::Long nVisHeight = rDocRect.GetHeight();
             m_pVScrollbar->SetVisibleSize( nVisHeight );
             m_pVScrollbar->SetThumbPos( rDocRect.Top() );
@@ -1606,17 +1606,17 @@ void SwPagePreview::ScrollViewSzChg()
     if(m_pHScrollbar)
     {
         const tools::Rectangle& rDocRect = 
m_pViewWin->GetPaintedPreviewDocRect();
-        const Size& rPreviewSize =
+        const Size aPreviewSize =
                 GetViewShell()->PagePreviewLayout()->GetPreviewDocSize();
         Range aRange(0,0);
 
-        if(rDocRect.GetWidth() < rPreviewSize.Width())
+        if(rDocRect.GetWidth() < aPreviewSize.Width())
         {
             bShowHScrollbar = true;
 
             tools::Long nVisWidth = rDocRect.GetWidth();
             tools::Long nThumb = rDocRect.Left();
-            aRange = Range(0, rPreviewSize.Width());
+            aRange = Range(0, aPreviewSize.Width());
 
             m_pHScrollbar->SetRange( aRange );
             m_pHScrollbar->SetVisibleSize( nVisWidth );
diff --git a/sw/source/uibase/uiview/view2.cxx 
b/sw/source/uibase/uiview/view2.cxx
index e630fc1c8325..393ca160feca 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -1975,8 +1975,8 @@ void SwView::StateStatusLine(SfxItemSet &rSet)
                         Size aRootSize( aRootRect.SSize() );
 
                         const MapMode aTmpMap( MapUnit::MapTwip );
-                        const Size& rEditSize = 
GetEditWin().GetOutputSizePixel();
-                        const Size aWindowSize( GetEditWin().PixelToLogic( 
rEditSize, aTmpMap ) );
+                        const Size aEditSize = 
GetEditWin().GetOutputSizePixel();
+                        const Size aWindowSize( GetEditWin().PixelToLogic( 
aEditSize, aTmpMap ) );
 
                         const tools::Long nOf = pVOpt->GetDocumentBorder() * 2;
                         tools::Long nTmpWidth = bAutomaticViewLayout ? 
aPageSize.Width() : aRootSize.Width();
diff --git a/sw/source/uibase/uiview/viewdraw.cxx 
b/sw/source/uibase/uiview/viewdraw.cxx
index b6bd92579188..952f6f89244a 100644
--- a/sw/source/uibase/uiview/viewdraw.cxx
+++ b/sw/source/uibase/uiview/viewdraw.cxx
@@ -160,18 +160,18 @@ void SwView::ExecDraw(const SfxRequest& rReq)
                 if ( pObj )
                 {
                     Size            aDocSize( m_pWrtShell->GetDocSize() );
-                    const SwRect&   rVisArea = 
comphelper::LibreOfficeKit::isActive() ?
+                    const SwRect    aVisArea = 
comphelper::LibreOfficeKit::isActive() ?
                                                 
SwRect(m_pWrtShell->getLOKVisibleArea()) : m_pWrtShell->VisArea();
-                    Point           aPos( rVisArea.Center() );
+                    Point           aPos( aVisArea.Center() );
                     tools::Rectangle aObjRect( pObj->GetLogicRect() );
 
-                    if ( rVisArea.Width() > aDocSize.Width())
-                        aPos.setX( aDocSize.Width() / 2 + rVisArea.Left() );
+                    if ( aVisArea.Width() > aDocSize.Width())
+                        aPos.setX( aDocSize.Width() / 2 + aVisArea.Left() );
                     else if (aPos.getX() > aObjRect.GetWidth() / 2)
                          aPos.AdjustX( -(aObjRect.GetWidth() / 2) );
 
-                    if (rVisArea.Height() > aDocSize.Height())
-                        aPos.setY( aDocSize.Height() / 2 + rVisArea.Top() );
+                    if (aVisArea.Height() > aDocSize.Height())
+                        aPos.setY( aDocSize.Height() / 2 + aVisArea.Top() );
                     else if (aPos.getY() > aObjRect.GetHeight() / 2)
                          aPos.AdjustY( -(aObjRect.GetHeight() / 2) );
 
diff --git a/sw/source/uibase/uiview/viewtab.cxx 
b/sw/source/uibase/uiview/viewtab.cxx
index 761df9d72f59..66927459d019 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -1558,9 +1558,9 @@ void SwView::StateTabWin(SfxItemSet& rSet)
             }
             else if( nFrameType & FrameTypeFlags::DRAWOBJ)
             {
-                const SwRect &rRect = rSh.GetObjRect();
-                aLongUL.SetUpper(rRect.Top() - rPageRect.Top());
-                aLongUL.SetLower(rPageRect.Bottom() - rRect.Bottom());
+                const SwRect aRect = rSh.GetObjRect();
+                aLongUL.SetUpper(aRect.Top() - rPageRect.Top());
+                aLongUL.SetLower(rPageRect.Bottom() - aRect.Bottom());
             }
             else if(bBrowse)
             {
diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 59927e931a4c..8f43e6cc8186 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -796,7 +796,7 @@ void SwContentType::FillMemberList(bool* pbContentChanged)
                         && m_nContentType == ContentTypeId::ENDNOTE))
                 {
                     const SwFormatFootnote& rFormatFootnote = 
pTextFootnote->GetFootnote();
-                    const OUString& sText
+                    const OUString sText
                         = rFormatFootnote.GetViewNumStr(*m_pWrtShell->GetDoc(),
                                                         
m_pWrtShell->GetLayout(), true)
                           + " " + lcl_GetFootnoteText(*pTextFootnote);
@@ -2577,13 +2577,13 @@ void SwContentTree::Expand(const weld::TreeIter& 
rParent,
         pNodesToExpand->emplace_back(m_xTreeView->make_iterator(&rParent));
 
     // rParentId is a string representation of a pointer to SwContentType or 
SwContent
-    const OUString& rParentId = m_xTreeView->get_id(rParent);
+    const OUString aParentId = m_xTreeView->get_id(rParent);
     // bParentIsContentType tells if the passed rParent tree entry is a 
content type or content
     const bool bParentIsContentType = lcl_IsContentType(rParent, *m_xTreeView);
     // eParentContentTypeId is the content type of the passed rParent tree 
entry
     const ContentTypeId eParentContentTypeId =
-            bParentIsContentType ? 
weld::fromId<SwContentType*>(rParentId)->GetType() :
-                                   
weld::fromId<SwContent*>(rParentId)->GetParent()->GetType();
+            bParentIsContentType ? 
weld::fromId<SwContentType*>(aParentId)->GetType() :
+                                   
weld::fromId<SwContent*>(aParentId)->GetParent()->GetType();
 
     if (m_nRootType == ContentTypeId::UNKNOWN && bParentIsContentType)
     {
@@ -2644,8 +2644,8 @@ void SwContentTree::Expand(const weld::TreeIter& rParent,
         else // content entry
         {
             SwWrtShell* pShell = GetWrtShell();
-            
assert(dynamic_cast<SwOutlineContent*>(weld::fromId<SwTypeNumber*>(rParentId)));
-            auto const nPos = 
weld::fromId<SwOutlineContent*>(rParentId)->GetOutlinePos();
+            
assert(dynamic_cast<SwOutlineContent*>(weld::fromId<SwTypeNumber*>(aParentId)));
+            auto const nPos = 
weld::fromId<SwOutlineContent*>(aParentId)->GetOutlinePos();
             void* key = 
static_cast<void*>(pShell->getIDocumentOutlineNodesAccess()->getOutlineNode( 
nPos ));
             mOutLineNodeMap[key] = true;
         }
@@ -2685,9 +2685,9 @@ void SwContentTree::Expand(const weld::TreeIter& rParent,
         }
         else // content entry
         {
-            
assert(dynamic_cast<SwRegionContent*>(weld::fromId<SwTypeNumber*>(rParentId)));
+            
assert(dynamic_cast<SwRegionContent*>(weld::fromId<SwTypeNumber*>(aParentId)));
             const void* key = static_cast<const void*>(
-                        
weld::fromId<SwRegionContent*>(rParentId)->GetSectionFormat());
+                        
weld::fromId<SwRegionContent*>(aParentId)->GetSectionFormat());
             m_aRegionNodeExpandMap[key] = true;
         }
     }
@@ -2726,9 +2726,9 @@ void SwContentTree::Expand(const weld::TreeIter& rParent,
         }
         else // content entry
         {
-            
assert(dynamic_cast<SwPostItContent*>(weld::fromId<SwTypeNumber*>(rParentId)));
+            
assert(dynamic_cast<SwPostItContent*>(weld::fromId<SwTypeNumber*>(aParentId)));
             const void* key = static_cast<const void*>(
-                        
weld::fromId<SwPostItContent*>(rParentId)->GetPostIt());
+                        
weld::fromId<SwPostItContent*>(aParentId)->GetPostIt());
             m_aPostItNodeExpandMap[key] = true;
         }
     }
@@ -3298,9 +3298,9 @@ bool 
SwContentTree::FillTransferData(TransferDataContainer& rTransfer)
                 else
                     return false;
 
-                const OUString& rsFieldTypeName = pField->GetTyp()->GetName();
+                const OUString sFieldTypeName = pField->GetTyp()->GetName();
                 sCrossRef = 
OUString::number(static_cast<int>(REFERENCESUBTYPE::REF_SEQUENCEFLD))
-                        + u"|" + rsFieldTypeName + u"|" + sVal;
+                        + u"|" + sFieldTypeName + u"|" + sVal;
             }
             else if (eActType == ContentTypeId::REFERENCE)
             {
@@ -5495,11 +5495,11 @@ void SwContentTree::ExecuteContextMenuAction(const 
OUString& rSelectedPopupEntry
     else if (rSelectedPopupEntry == "sort")
     {
         SwContentType* pCntType;
-        const OUString& rId(m_xTreeView->get_id(*xFirst));
+        const OUString aId(m_xTreeView->get_id(*xFirst));
         if (lcl_IsContentType(*xFirst, *m_xTreeView))
-            pCntType = weld::fromId<SwContentType*>(rId);
+            pCntType = weld::fromId<SwContentType*>(aId);
         else
-            pCntType = 
const_cast<SwContentType*>(weld::fromId<SwContent*>(rId)->GetParent());
+            pCntType = 
const_cast<SwContentType*>(weld::fromId<SwContent*>(aId)->GetParent());
 
         // toggle and persist alphabetical sort setting
 
diff --git a/sw/source/uibase/utlui/glbltree.cxx 
b/sw/source/uibase/utlui/glbltree.cxx
index 771785e1cca0..7fef7e0c7520 100644
--- a/sw/source/uibase/utlui/glbltree.cxx
+++ b/sw/source/uibase/utlui/glbltree.cxx
@@ -813,8 +813,8 @@ void SwGlobalTree::UpdateTracking()
                     || (pSection->GetType() != SectionType::ToxContent
                         && rGlblDocContent->GetSection() == pSection))
             {
-                const OUString& rId(weld::toId(rGlblDocContent.get()));
-                m_xTreeView->select(m_xTreeView->find_id(rId));
+                const OUString aId(weld::toId(rGlblDocContent.get()));
+                m_xTreeView->select(m_xTreeView->find_id(aId));
                 break;
             }
         }
@@ -839,8 +839,8 @@ void SwGlobalTree::UpdateTracking()
                 if (rGlblDocContent->GetType() == 
GlobalDocContentType::GLBLDOC_UNKNOWN
                         && rGlblDocContent->GetDocPos() == aTextNodeIndex)
                 {
-                    const OUString& rId(weld::toId(rGlblDocContent.get()));
-                    m_xTreeView->select(m_xTreeView->find_id(rId));
+                    const OUString aId(weld::toId(rGlblDocContent.get()));
+                    m_xTreeView->select(m_xTreeView->find_id(aId));
                 }
             }
         }
diff --git a/sw/source/uibase/utlui/gloslst.cxx 
b/sw/source/uibase/utlui/gloslst.cxx
index 3d288b6ead1f..1013300daa83 100644
--- a/sw/source/uibase/utlui/gloslst.cxx
+++ b/sw/source/uibase/utlui/gloslst.cxx
@@ -425,7 +425,7 @@ void SwGlossaryList::HasLongName(const 
std::vector<OUString>& rBeginCandidates,
                        });
     }
 
-    const auto& it = std::unique(
+    const auto it = std::unique(
         aAllResults.begin(), aAllResults.end(),
         [](const std::pair<OUString, sal_uInt16>& s1, const 
std::pair<OUString, sal_uInt16>& s2) {
             return s1.first.equalsIgnoreAsciiCase(s2.first);
diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx 
b/sw/source/uibase/wrtsh/wrtsh2.cxx
index 780a7352ac9d..829d7f3b6459 100644
--- a/sw/source/uibase/wrtsh/wrtsh2.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh2.cxx
@@ -424,9 +424,9 @@ void SwWrtShell::ClickToField(const SwField& rField, bool 
bExecHyperlinks)
                 || targetType == SwAuthorityField::TargetType::UseTargetURL)
             {
                 // Since the user selected target type with URL, try to use it 
if not empty
-                if (const OUString& rURL = pField->GetAbsoluteURL();
-                    rURL.getLength() > 0)
-                    ::LoadURL(*this, rURL, LoadUrlFlags::NewView, 
/*rTargetFrameName=*/OUString());
+                if (const OUString aURL = pField->GetAbsoluteURL();
+                    aURL.getLength() > 0)
+                    ::LoadURL(*this, aURL, LoadUrlFlags::NewView, 
/*rTargetFrameName=*/OUString());
             }
             else if (targetType == 
SwAuthorityField::TargetType::BibliographyTableRow)
             {
@@ -774,13 +774,13 @@ void SwWrtShell::NavigatorPaste(const 
NaviContentBookmark& rBkmk)
         const SwDocShell* pDocShell = GetView().GetDocShell();
         if(pDocShell->HasName())
         {
-            const OUString& rName = 
pDocShell->GetMedium()->GetURLObject().GetURLNoMark();
+            const OUString aName = 
pDocShell->GetMedium()->GetURLObject().GetURLNoMark();
 
-            if (sURL.startsWith(rName))
+            if (sURL.startsWith(aName))
             {
-                if (sURL.getLength()>rName.getLength())
+                if (sURL.getLength()>aName.getLength())
                 {
-                    sURL = sURL.copy(rName.getLength());
+                    sURL = sURL.copy(aName.getLength());
                 }
                 else
                 {
diff --git a/sw/source/writerfilter/dmapper/DomainMapper.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper.cxx
index 9d8654c06f4a..86e785a0dd4c 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper.cxx
@@ -3843,7 +3843,7 @@ void DomainMapper::lcl_startParagraphGroup()
     {
         if (m_pImpl->GetTopContext())
         {
-            const OUString& sDefaultParaStyle = 
m_pImpl->GetDefaultParaStyleName();
+            const OUString sDefaultParaStyle = 
m_pImpl->GetDefaultParaStyleName();
             auto pContext = 
static_cast<ParagraphPropertyMap*>(m_pImpl->GetTopContext().get());
             m_pImpl->GetTopContext()->Insert( PROP_PARA_STYLE_NAME, uno::Any( 
sDefaultParaStyle ) );
             m_pImpl->SetCurrentParaStyleName( sDefaultParaStyle );
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
index e1b225ed92dc..211a8c074989 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
@@ -1761,7 +1761,7 @@ static void 
lcl_MoveBorderPropertiesToFrame(std::vector<beans::PropertyValue>& r
 
         for( size_t nProperty = 0; nProperty < SAL_N_ELEMENTS( 
aBorderProperties ); ++nProperty)
         {
-            const OUString & sPropertyName = 
getPropertyName(aBorderProperties[nProperty]);
+            const OUString sPropertyName = 
getPropertyName(aBorderProperties[nProperty]);
             beans::PropertyValue aValue;
             aValue.Name = sPropertyName;
             aValue.Value = 
xTextRangeProperties->getPropertyValue(sPropertyName);
@@ -2820,7 +2820,7 @@ void DomainMapper_Impl::finishParagraph( const 
PropertyMapPtr& pPropertyMap, con
                         (isNumberingViaStyle || isNumberingViaRule))
                     {
                         assert(pParaContext);
-                        if (ListDef::Pointer const& pList = 
m_pListTable->GetList(nListId))
+                        if (ListDef::Pointer const pList = 
m_pListTable->GetList(nListId))
                         {   // styles could refer to non-existing lists...
                             AbstractListDef::Pointer const& pAbsList =
                                     pList->GetAbstractDefinition();
@@ -3081,7 +3081,7 @@ void DomainMapper_Impl::finishParagraph( const 
PropertyMapPtr& pPropertyMap, con
     {
         if (const OUString sParaId = pParaContext->props().GetParaId(); 
!sParaId.isEmpty())
         {
-            if (const auto& item = m_aCommentProps.find(sParaId); item != 
m_aCommentProps.end())
+            if (const auto item = m_aCommentProps.find(sParaId); item != 
m_aCommentProps.end())
             {
                 m_bAnnotationResolved = item->second.bDone;
                 m_sAnnotationParent = item->second.sParaIdParent;
@@ -4756,7 +4756,7 @@ void DomainMapper_Impl::PushShapeContext( const 
uno::Reference< drawing::XShape
                                 if ( bOnlyApplyCharHeight && eId != 
PROP_CHAR_HEIGHT )
                                     continue;
 
-e 
... etc. - the rest is truncated

Reply via email to