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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 20 16:38:32 UTC 2019


 sc/source/core/data/drwlayer.cxx                |    6 ++++--
 sw/qa/extras/tiledrendering/tiledrendering.cxx  |    2 +-
 sw/qa/extras/uiwriter/uiwriter.cxx              |    2 +-
 sw/qa/extras/uiwriter/uiwriter2.cxx             |    2 +-
 sw/source/core/crsr/crsrsh.cxx                  |    2 +-
 sw/source/core/doc/DocumentDrawModelManager.cxx |    2 +-
 sw/source/core/doc/DocumentTimerManager.cxx     |    2 +-
 sw/source/core/doc/docbm.cxx                    |    2 +-
 sw/source/core/doc/docedt.cxx                   |    2 +-
 sw/source/core/doc/doclay.cxx                   |    2 +-
 sw/source/core/doc/docredln.cxx                 |    2 +-
 sw/source/core/doc/list.cxx                     |    2 +-
 sw/source/core/doc/tblafmt.cxx                  |    2 +-
 sw/source/core/doc/tblrwcl.cxx                  |    4 ++--
 sw/source/core/docnode/ndtbl1.cxx               |    2 +-
 sw/source/core/draw/dcontact.cxx                |    4 ++--
 sw/source/core/edit/edatmisc.cxx                |    2 +-
 sw/source/core/edit/edattr.cxx                  |    2 +-
 sw/source/core/edit/edfld.cxx                   |    2 +-
 sw/source/core/edit/editsh.cxx                  |    4 ++--
 sw/source/core/edit/edredln.cxx                 |    2 +-
 sw/source/core/edit/edsect.cxx                  |    2 +-
 sw/source/core/edit/edtab.cxx                   |    2 +-
 sw/source/core/frmedt/fedesc.cxx                |    2 +-
 sw/source/core/frmedt/fefly1.cxx                |    2 +-
 sw/source/core/layout/paintfrm.cxx              |    2 +-
 sw/source/core/undo/unsort.cxx                  |    6 +++---
 sw/source/core/unocore/unochart.cxx             |    2 +-
 sw/source/core/unocore/unostyle.cxx             |    3 ++-
 sw/source/core/unocore/unotbl.cxx               |    4 ++--
 sw/source/core/view/viewsh.cxx                  |    2 +-
 sw/source/filter/html/htmlgrin.cxx              |    2 +-
 sw/source/filter/html/svxcss1.cxx               |    4 ++--
 sw/source/filter/html/swhtml.cxx                |    2 +-
 sw/source/filter/ww8/docxattributeoutput.cxx    |    2 +-
 sw/source/filter/ww8/docxsdrexport.cxx          |    2 +-
 sw/source/filter/ww8/docxtablestyleexport.cxx   |    2 +-
 sw/source/filter/ww8/rtfattributeoutput.cxx     |    4 ++--
 sw/source/filter/ww8/rtfexport.cxx              |    2 +-
 sw/source/filter/ww8/wrtw8sty.cxx               |    2 +-
 sw/source/filter/ww8/ww8par5.cxx                |    2 +-
 sw/source/filter/ww8/ww8toolbar.cxx             |    2 +-
 sw/source/filter/xml/XMLRedlineImportHelper.cxx |    2 +-
 sw/source/ui/envelp/label1.cxx                  |    2 +-
 sw/source/ui/index/cnttab.cxx                   |    6 +++---
 sw/source/uibase/app/mainwn.cxx                 |    2 +-
 sw/source/uibase/dbui/dbmgr.cxx                 |    8 ++++----
 sw/source/uibase/dochdl/gloshdl.cxx             |    2 +-
 sw/source/uibase/docvw/AnnotationWin2.cxx       |    2 +-
 sw/source/uibase/docvw/PostItMgr.cxx            |    6 +++---
 sw/source/uibase/sidebar/ThemePanel.cxx         |    4 ++--
 sw/source/uibase/uno/unotxdoc.cxx               |    2 +-
 sw/source/uibase/utlui/glbltree.cxx             |    2 +-
 sw/source/uibase/utlui/gloslst.cxx              |    2 +-
 54 files changed, 74 insertions(+), 71 deletions(-)

New commits:
commit 102a94c9de3c8c4d1326022dd14a300d6b72e222
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Aug 20 15:53:25 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Aug 20 18:37:27 2019 +0200

    loplugin:constvars in sw
    
    Change-Id: Ic1f11240561ba8fffc51710c9a49933c3ab3849d
    Reviewed-on: https://gerrit.libreoffice.org/77826
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 5851faa56534..fe2d1e510cab 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -298,7 +298,7 @@ void SwTiledRenderingTest::callbackImpl(int nType, const char* pPayload)
         boost::property_tree::ptree aTree;
         std::stringstream aStream(pPayload);
         boost::property_tree::read_json(aStream, aTree);
-        for (boost::property_tree::ptree::value_type& rValue : aTree.get_child("searchResultSelection"))
+        for (const boost::property_tree::ptree::value_type& rValue : aTree.get_child("searchResultSelection"))
         {
             m_aSearchResultSelection.emplace_back(rValue.second.get<std::string>("rectangles").c_str());
             m_aSearchResultPart.push_back(std::atoi(rValue.second.get<std::string>("part").c_str()));
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 959a5990744c..b4665cd17b3d 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -4403,7 +4403,7 @@ void SwUiWriterTest::testTdf77014()
     {
         printf ("Portions:\n");
 
-        for (auto& rPortionItem : aHandler.mPortionItems)
+        for (const auto& rPortionItem : aHandler.mPortionItems)
         {
             printf ("-- Type: %s length: %" SAL_PRIdINT32 " text type: %d\n",
                         rPortionItem.msItemType.toUtf8().getStr(),
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index e59f84a68c68..4693139a207a 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -1653,7 +1653,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testImageComment)
     std::stringstream aStream(aPostits.toUtf8().getStr());
     boost::property_tree::ptree aTree;
     boost::property_tree::read_json(aStream, aTree);
-    for (boost::property_tree::ptree::value_type& rValue : aTree.get_child("comments"))
+    for (const boost::property_tree::ptree::value_type& rValue : aTree.get_child("comments"))
     {
         const boost::property_tree::ptree& rComment = rValue.second;
         OString aAnchorPos(rComment.get<std::string>("anchorPos").c_str());
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 68d877a00617..a7e8c7b93025 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -3615,7 +3615,7 @@ void SwCursorShell::dumpAsXml(xmlTextWriterPtr pWriter) const
     SwViewShell::dumpAsXml(pWriter);
 
     xmlTextWriterStartElement(pWriter, BAD_CAST("m_pCurrentCursor"));
-    for (SwPaM& rPaM : m_pCurrentCursor->GetRingContainer())
+    for (const SwPaM& rPaM : m_pCurrentCursor->GetRingContainer())
         rPaM.dumpAsXml(pWriter);
     xmlTextWriterEndElement(pWriter);
 
diff --git a/sw/source/core/doc/DocumentDrawModelManager.cxx b/sw/source/core/doc/DocumentDrawModelManager.cxx
index f09b387ec920..9c26da3d53c9 100644
--- a/sw/source/core/doc/DocumentDrawModelManager.cxx
+++ b/sw/source/core/doc/DocumentDrawModelManager.cxx
@@ -137,7 +137,7 @@ void DocumentDrawModelManager::InitDrawModel()
     SwViewShell* const pSh = m_rDoc.getIDocumentLayoutAccess().GetCurrentViewShell();
     if ( pSh )
     {
-        for(SwViewShell& rViewSh : pSh->GetRingContainer())
+        for(const SwViewShell& rViewSh : pSh->GetRingContainer())
         {
             SwRootFrame* pRoot =  rViewSh.GetLayout();
             if( pRoot && !pRoot->GetDrawPage() )
diff --git a/sw/source/core/doc/DocumentTimerManager.cxx b/sw/source/core/doc/DocumentTimerManager.cxx
index f13a25559f1f..842c1262dc0f 100644
--- a/sw/source/core/doc/DocumentTimerManager.cxx
+++ b/sw/source/core/doc/DocumentTimerManager.cxx
@@ -116,7 +116,7 @@ DocumentTimerManager::IdleJob DocumentTimerManager::GetNextIdleJob() const
         !SfxProgress::GetActiveProgress( m_rDoc.GetDocShell() ) )
     {
         SwViewShell* pShell(m_rDoc.getIDocumentLayoutAccess().GetCurrentViewShell());
-        for(SwViewShell& rSh : pShell->GetRingContainer())
+        for(const SwViewShell& rSh : pShell->GetRingContainer())
             if( rSh.ActionPend() )
                 return IdleJob::Busy;
 
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 01a0927587c8..46b1d0ffb372 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1208,7 +1208,7 @@ namespace sw { namespace mark
         m_vFieldmarks.clear();
         m_vBookmarks.clear();
         m_vAnnotationMarks.clear();
-        for (auto & p : m_vAllMarks)
+        for (const auto & p : m_vAllMarks)
             delete p;
         m_vAllMarks.clear();
     }
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index fad87aec561f..5006eeefdae3 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -59,7 +59,7 @@ void RestFlyInRange( SaveFlyArr & rArr, const SwPosition& rStartPos,
                       const SwNodeIndex* pInsertPos )
 {
     SwPosition aPos(rStartPos);
-    for(SaveFly & rSave : rArr)
+    for(const SaveFly & rSave : rArr)
     {
         // create new anchor
         SwFrameFormat* pFormat = rSave.pFrameFormat;
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index c5f10bdee692..4b228ae5d85d 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -1676,7 +1676,7 @@ std::set<SwRootFrame*> SwDoc::GetAllLayouts()
     SwViewShell *pStart = getIDocumentLayoutAccess().GetCurrentViewShell();
     if(pStart)
     {
-        for(SwViewShell& rShell : pStart->GetRingContainer())
+        for(const SwViewShell& rShell : pStart->GetRingContainer())
         {
             if(rShell.GetLayout())
                 aAllLayouts.insert(rShell.GetLayout());
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 4bbfb6da14df..08bfa9e51c77 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -383,7 +383,7 @@ void SwRedlineTable::LOKRedlineNotification(RedlineNotification nType, SwRangeRe
 
         SwRects* pRects(&aCursor);
         std::vector<OString> aRects;
-        for(SwRect& rNextRect : *pRects)
+        for(const SwRect& rNextRect : *pRects)
             aRects.push_back(rNextRect.SVRect().toString());
 
         const OString sRects = comphelper::string::join("; ", aRects);
diff --git a/sw/source/core/doc/list.cxx b/sw/source/core/doc/list.cxx
index b1d055b22d99..c81eef636ff1 100644
--- a/sw/source/core/doc/list.cxx
+++ b/sw/source/core/doc/list.cxx
@@ -153,7 +153,7 @@ void SwListImpl::RemoveListItem( SwNodeNum& rNodeNum )
 
 void SwListImpl::InvalidateListTree()
 {
-    for ( auto& rNumberTree : maListTrees )
+    for ( const auto& rNumberTree : maListTrees )
     {
         rNumberTree.pRoot->InvalidateTree();
         rNumberTree.pRootRLHidden->InvalidateTree();
diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
index 3b187eac9fe2..26fc7db4256f 100644
--- a/sw/source/core/doc/tblafmt.cxx
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -981,7 +981,7 @@ std::unique_ptr<SwTableAutoFormat> SwTableAutoFormatTable::ReleaseAutoFormat(con
 
 SwTableAutoFormat* SwTableAutoFormatTable::FindAutoFormat(const OUString& rName) const
 {
-    for (auto &rFormat : m_pImpl->m_AutoFormats)
+    for (const auto &rFormat : m_pImpl->m_AutoFormats)
     {
         if (rFormat->GetName() == rName)
             return rFormat.get();
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index 36c2324708ef..f6a42078861e 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -2011,7 +2011,7 @@ void SwTable::CopyHeadlineIntoTable( SwTableNode& rTableNd )
     // Copy
     if( IsNewModel() )
         lcl_CalcNewWidths( aFndBox.GetLines(), aPara );
-    for (auto & rpFndLine : aFndBox.GetLines())
+    for (const auto & rpFndLine : aFndBox.GetLines())
     {
          lcl_CopyLineToDoc( *rpFndLine, &aPara );
     }
@@ -2105,7 +2105,7 @@ bool SwTable::MakeCopy( SwDoc* pInsDoc, const SwPosition& rPos,
     if( IsNewModel() )
         lcl_CalcNewWidths( aFndBox.GetLines(), aPara );
     // Copy
-    for (auto & rpFndLine : aFndBox.GetLines())
+    for (const auto & rpFndLine : aFndBox.GetLines())
     {
          lcl_CopyLineToDoc( *rpFndLine, &aPara );
     }
diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx
index 33832c265ef4..564fd5d25972 100644
--- a/sw/source/core/docnode/ndtbl1.cxx
+++ b/sw/source/core/docnode/ndtbl1.cxx
@@ -99,7 +99,7 @@ SwTableFormatCmp::~SwTableFormatCmp()
 SwFrameFormat* SwTableFormatCmp::FindNewFormat(std::vector<std::unique_ptr<SwTableFormatCmp>>& rArr,
                                                SwFrameFormat const* pOld, sal_Int16 nType)
 {
-    for (auto& pCmp : rArr)
+    for (const auto& pCmp : rArr)
     {
         if ( pCmp->pOld == pOld && pCmp->nType == nType )
             return pCmp->pNew;
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index 6acc1c342a20..1e5e2723772f 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -882,7 +882,7 @@ SdrObject* SwDrawContact::GetDrawObjectByAnchorFrame( const SwFrame& _rAnchorFra
 
 void SwDrawContact::NotifyBackgrdOfAllVirtObjs(const tools::Rectangle* pOldBoundRect)
 {
-    for(auto& rpDrawVirtObj : maDrawVirtObjs)
+    for(const auto& rpDrawVirtObj : maDrawVirtObjs)
     {
         SwDrawVirtObj* pDrawVirtObj(rpDrawVirtObj.get());
         if ( pDrawVirtObj->GetAnchorFrame() )
@@ -1568,7 +1568,7 @@ void SwDrawContact::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
 // #i28701# - added parameter <_bUpdateSortedObjsList>
 void SwDrawContact::InvalidateObjs_( const bool _bUpdateSortedObjsList )
 {
-    for(auto& rpDrawVirtObj : maDrawVirtObjs)
+    for(const auto& rpDrawVirtObj : maDrawVirtObjs)
     // invalidate position of existing 'virtual' drawing objects
     {
         SwDrawVirtObj* pDrawVirtObj(rpDrawVirtObj.get());
diff --git a/sw/source/core/edit/edatmisc.cxx b/sw/source/core/edit/edatmisc.cxx
index 8375bddaf445..e8f82956106f 100644
--- a/sw/source/core/edit/edatmisc.cxx
+++ b/sw/source/core/edit/edatmisc.cxx
@@ -42,7 +42,7 @@ void SwEditShell::ResetAttr( const std::set<sal_uInt16> &attrs, SwPaM* pPaM )
         GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::RESETATTR, nullptr);
     }
 
-    for(SwPaM& rCurrentCursor : pCursor->GetRingContainer())
+    for(const SwPaM& rCurrentCursor : pCursor->GetRingContainer())
         GetDoc()->ResetAttrs(rCurrentCursor, true, attrs, true, GetLayout());
 
     if( bUndoGroup )
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index 5b61dbe0ed86..13304fb3ad03 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -432,7 +432,7 @@ bool SwEditShell::SetCurFootnote( const SwFormatFootnote& rFillFootnote )
     bool bChgd = false;
     StartAllAction();
 
-    for(SwPaM& rCursor : GetCursor()->GetRingContainer())
+    for(const SwPaM& rCursor : GetCursor()->GetRingContainer())
     {
         bChgd |=
             mxDoc->SetCurFootnote(rCursor, rFillFootnote.GetNumStr(), rFillFootnote.IsEndNote());
diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx
index 41a69ac6c9e1..7525a9af80af 100644
--- a/sw/source/core/edit/edfld.cxx
+++ b/sw/source/core/edit/edfld.cxx
@@ -159,7 +159,7 @@ void SwEditShell::Insert2(SwField const & rField, const bool bForceExpandHints)
         ? SetAttrMode::FORCEHINTEXPAND
         : SetAttrMode::DEFAULT;
 
-    for(SwPaM& rPaM : GetCursor()->GetRingContainer()) // for each PaM
+    for(const SwPaM& rPaM : GetCursor()->GetRingContainer()) // for each PaM
     {
         const bool bSuccess(GetDoc()->getIDocumentContentOperations().InsertPoolItem(rPaM, aField, nInsertFlags));
         OSL_ENSURE( bSuccess, "Doc->Insert(Field) failed");
diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx
index 603932d9ce10..df141dd389c3 100644
--- a/sw/source/core/edit/editsh.cxx
+++ b/sw/source/core/edit/editsh.cxx
@@ -1029,7 +1029,7 @@ void SwEditShell::TransliterateText( TransliterationFlags nType )
     if( pCursor->GetNext() != pCursor )
     {
         GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::EMPTY, nullptr);
-        for(SwPaM& rPaM : GetCursor()->GetRingContainer())
+        for(const SwPaM& rPaM : GetCursor()->GetRingContainer())
         {
             if( rPaM.HasMark() )
                 GetDoc()->getIDocumentContentOperations().TransliterateText( rPaM, aTrans );
@@ -1044,7 +1044,7 @@ void SwEditShell::TransliterateText( TransliterationFlags nType )
 
 void SwEditShell::CountWords( SwDocStat& rStat ) const
 {
-    for(SwPaM& rPaM : GetCursor()->GetRingContainer())
+    for(const SwPaM& rPaM : GetCursor()->GetRingContainer())
     {
         if( rPaM.HasMark() )
             SwDoc::CountWords( rPaM, rStat );
diff --git a/sw/source/core/edit/edredln.cxx b/sw/source/core/edit/edredln.cxx
index f75b58b4fb7c..1baf94bcf46e 100644
--- a/sw/source/core/edit/edredln.cxx
+++ b/sw/source/core/edit/edredln.cxx
@@ -109,7 +109,7 @@ bool SwEditShell::RejectRedlinesInSelection()
 bool SwEditShell::SetRedlineComment( const OUString& rS )
 {
     bool bRet = false;
-    for(SwPaM& rPaM : GetCursor()->GetRingContainer())
+    for(const SwPaM& rPaM : GetCursor()->GetRingContainer())
     {
         bRet = bRet || GetDoc()->getIDocumentRedlineAccess().SetRedlineComment( rPaM, rS );
     }
diff --git a/sw/source/core/edit/edsect.cxx b/sw/source/core/edit/edsect.cxx
index 9e6a1a731260..deafce2a7286 100644
--- a/sw/source/core/edit/edsect.cxx
+++ b/sw/source/core/edit/edsect.cxx
@@ -41,7 +41,7 @@ SwEditShell::InsertSection(
         StartAllAction();
         GetDoc()->GetIDocumentUndoRedo().StartUndo( SwUndoId::INSSECTION, nullptr );
 
-        for(SwPaM& rPaM : GetCursor()->GetRingContainer())
+        for(const SwPaM& rPaM : GetCursor()->GetRingContainer())
         {
             SwSection const*const pNew =
                 GetDoc()->InsertSwSection( rPaM, rNewData, nullptr, pAttr );
diff --git a/sw/source/core/edit/edtab.cxx b/sw/source/core/edit/edtab.cxx
index c60aed7af194..5c8e50cf1254 100644
--- a/sw/source/core/edit/edtab.cxx
+++ b/sw/source/core/edit/edtab.cxx
@@ -143,7 +143,7 @@ bool SwEditShell::TextToTable( const SwInsertTableOptions& rInsTableOpts,
     SwWait aWait( *GetDoc()->GetDocShell(), true );
     bool bRet = false;
     StartAllAction();
-    for(SwPaM& rPaM : GetCursor()->GetRingContainer())
+    for(const SwPaM& rPaM : GetCursor()->GetRingContainer())
     {
         if( rPaM.HasMark() )
             bRet |= nullptr != GetDoc()->TextToTable( rInsTableOpts, rPaM, cCh,
diff --git a/sw/source/core/frmedt/fedesc.cxx b/sw/source/core/frmedt/fedesc.cxx
index 8ab4e1edab98..aa0c44d9d64b 100644
--- a/sw/source/core/frmedt/fedesc.cxx
+++ b/sw/source/core/frmedt/fedesc.cxx
@@ -191,7 +191,7 @@ const SwPageDesc* SwFEShell::GetSelectedPageDescs() const
     const Point aNulPt;
     std::pair<Point, bool> const tmp(aNulPt, false);
 
-    for(SwPaM& rPaM : GetCursor()->GetRingContainer())
+    for(const SwPaM& rPaM : GetCursor()->GetRingContainer())
     {
 
         if( nullptr != (pCNd = rPaM.GetContentNode() ) &&
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index bd6b66a5dabe..35931eb5cd8f 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -895,7 +895,7 @@ SwFlyFrameFormat* SwFEShell::InsertObject( const svt::EmbeddedObjectRef&  xObj,
     SET_CURR_SHELL( this );
     StartAllAction();
     {
-        for(SwPaM& rPaM : GetCursor()->GetRingContainer())
+        for(const SwPaM& rPaM : GetCursor()->GetRingContainer())
         {
             pFormat = GetDoc()->getIDocumentContentOperations().InsertEmbObject(
                             rPaM, xObj, pFlyAttrSet );
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index a0a6f50db291..8a99e9961360 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -4380,7 +4380,7 @@ static void lcl_PaintShadow( const SwRect& rRect, SwRect& rOutRect,
 
     pOut->SetDrawMode( nOldDrawMode );
 
-    for (SwRect & rOut : aRegion)
+    for (const SwRect & rOut : aRegion)
     {
         aOut = rOut;
         if ( rRect.IsOver( aOut ) && aOut.Height() > 0 && aOut.Width() > 0 )
diff --git a/sw/source/core/undo/unsort.cxx b/sw/source/core/undo/unsort.cxx
index f0ffbaeb454e..a34a5975b317 100644
--- a/sw/source/core/undo/unsort.cxx
+++ b/sw/source/core/undo/unsort.cxx
@@ -92,7 +92,7 @@ void SwUndoSort::UndoImpl(::sw::UndoRedoContext & rContext)
         const SwTable& rTable = pTableNd->GetTable();
 
         SwMovedBoxes aMovedList;
-        for (std::unique_ptr<SwSortUndoElement> & i : m_SortList)
+        for (const std::unique_ptr<SwSortUndoElement> & i : m_SortList)
         {
             const SwTableBox* pSource = rTable.GetTableBox(
                     *i->SORT_TXT_TBL.TBL.pSource );
@@ -126,7 +126,7 @@ void SwUndoSort::UndoImpl(::sw::UndoRedoContext & rContext)
 
         for (size_t i = 0; i < m_SortList.size(); ++i)
         {
-            for (std::unique_ptr<SwSortUndoElement> & j : m_SortList)
+            for (const std::unique_ptr<SwSortUndoElement> & j : m_SortList)
             {
                 if (j->SORT_TXT_TBL.TXT.nSource == m_nSttNode + i)
                 {
@@ -169,7 +169,7 @@ void SwUndoSort::RedoImpl(::sw::UndoRedoContext & rContext)
         const SwTable& rTable = pTableNd->GetTable();
 
         SwMovedBoxes aMovedList;
-        for (std::unique_ptr<SwSortUndoElement> & i : m_SortList)
+        for (const std::unique_ptr<SwSortUndoElement> & i : m_SortList)
         {
             const SwTableBox* pSource = rTable.GetTableBox(
                     *i->SORT_TXT_TBL.TBL.pSource );
diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx
index f0ad74a61bb5..db84c2e13a2c 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -1378,7 +1378,7 @@ void SAL_CALL SwChartDataProvider::dispose(  )
     if (bMustDispose)
     {
         // dispose all data-sequences
-        for (auto& rEntry : aDataSequences)
+        for (const auto& rEntry : aDataSequences)
         {
             DisposeAllDataSequences( rEntry.first );
         }
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 0808994413c2..34060acf60e1 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -1856,7 +1856,8 @@ void SwXStyle::SetPropertyValue<FN_UNO_PARA_STYLE_CONDITIONS>(const SfxItemPrope
     if(!rValue.has<expectedarg_t>() || !m_pBasePool)
         throw lang::IllegalArgumentException();
     SwCondCollItem aCondItem;
-    for(auto& rNamedValue : rValue.get<expectedarg_t>())
+    const auto aNamedValues = rValue.get<expectedarg_t>();
+    for(const auto& rNamedValue : aNamedValues)
     {
         if(!rNamedValue.Value.has<OUString>())
             throw lang::IllegalArgumentException();
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index c8c7782fecea..57d645baf495 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -1454,7 +1454,7 @@ void SwXTextTableRow::Notify(const SfxHint& rHint)
 
 SwTableLine* SwXTextTableRow::FindLine(SwTable* pTable, SwTableLine const * pLine)
 {
-    for(auto& pCurrentLine : pTable->GetTabLines())
+    for(const auto& pCurrentLine : pTable->GetTabLines())
         if(pCurrentLine == pLine)
             return pCurrentLine;
     return nullptr;
@@ -1835,7 +1835,7 @@ void SwTableProperties_Impl::AddItemToSet(SfxItemSet& rSet, std::function<Tpooli
     if(!vMemberAndAny.empty())
     {
         Tpoolitem aItem = aItemFactory();
-        for(auto& aMemberAndAny : vMemberAndAny)
+        for(const auto& aMemberAndAny : vMemberAndAny)
             aItem->PutValue(*aMemberAndAny.second, aMemberAndAny.first | (bAddTwips ? CONVERT_TWIPS : 0) );
         rSet.Put(*aItem);
     }
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 56ef0c92c128..d886c0642e0e 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -696,7 +696,7 @@ void SwViewShell::LayoutIdle()
         return;
 
     //No idle when printing is going on.
-    for(SwViewShell& rSh : GetRingContainer())
+    for(const SwViewShell& rSh : GetRingContainer())
     {
         if ( !rSh.GetWin() )
             return;
diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx
index 85991d6e0888..041be4358951 100644
--- a/sw/source/filter/html/htmlgrin.cxx
+++ b/sw/source/filter/html/htmlgrin.cxx
@@ -103,7 +103,7 @@ ImageMap *SwHTMLParser::FindImageMap( const OUString& rName ) const
 
     if (m_pImageMaps)
     {
-        for (auto &rpIMap : *m_pImageMaps)
+        for (const auto &rpIMap : *m_pImageMaps)
         {
             if (rName.equalsIgnoreAsciiCase(rpIMap->GetName()))
             {
diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx
index c1ecd4315b16..17f6d5750128 100644
--- a/sw/source/filter/html/svxcss1.cxx
+++ b/sw/source/filter/html/svxcss1.cxx
@@ -674,7 +674,7 @@ void SvxCSS1Parser::SelectorParsed( std::unique_ptr<CSS1Selector> pSelector, boo
     {
         OSL_ENSURE( pSheetItemSet, "Where is the Item-Set for Style-Sheets?" );
 
-        for (std::unique_ptr<CSS1Selector> & rpSelection : m_Selectors)
+        for (const std::unique_ptr<CSS1Selector> & rpSelection : m_Selectors)
         {
             StyleParsed(rpSelection.get(), *pSheetItemSet, *pSheetPropInfo);
         }
@@ -817,7 +817,7 @@ bool SvxCSS1Parser::ParseStyleSheet( const OUString& rIn )
 
     CSS1Parser::ParseStyleSheet( rIn );
 
-    for (std::unique_ptr<CSS1Selector> & rpSelector : m_Selectors)
+    for (const std::unique_ptr<CSS1Selector> & rpSelector : m_Selectors)
     {
         StyleParsed(rpSelector.get(), *pSheetItemSet, *pSheetPropInfo);
     }
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index 546040c6dcb1..0584da04d08b 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -480,7 +480,7 @@ SwHTMLParser::~SwHTMLParser()
     if( !m_aSetAttrTab.empty() )
     {
         OSL_ENSURE( m_aSetAttrTab.empty(),"There are still attributes on the stack" );
-        for ( auto& rpAttr : m_aSetAttrTab )
+        for ( const auto& rpAttr : m_aSetAttrTab )
             delete rpAttr;
         m_aSetAttrTab.clear();
     }
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index af6301741cf6..8746deaa6397 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2555,7 +2555,7 @@ void DocxAttributeOutput::WriteCollectedRunProperties()
         m_pSerializer->singleElementNS( XML_w, XML_lang, xAttrList );
     }
 
-    for (beans::PropertyValue & i : m_aTextEffectsGrabBag)
+    for (const beans::PropertyValue & i : m_aTextEffectsGrabBag)
     {
         boost::optional<sal_Int32> aElementId = lclGetElementIdForName(i.Name);
         if(aElementId)
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index 8fa71a663bc9..d250b4747bdd 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -406,7 +406,7 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons
         if (it != aGrabBag.end())
         {
             comphelper::SequenceAsHashMap aEffectExtent(it->second);
-            for (std::pair<const OUString, uno::Any>& rDirection : aEffectExtent)
+            for (const std::pair<const OUString, uno::Any>& rDirection : aEffectExtent)
             {
                 if (rDirection.first == "l" && rDirection.second.has<sal_Int32>())
                     nLeftExt = rDirection.second.get<sal_Int32>();
diff --git a/sw/source/filter/ww8/docxtablestyleexport.cxx b/sw/source/filter/ww8/docxtablestyleexport.cxx
index 930888444528..050da668447c 100644
--- a/sw/source/filter/ww8/docxtablestyleexport.cxx
+++ b/sw/source/filter/ww8/docxtablestyleexport.cxx
@@ -705,7 +705,7 @@ void DocxTableStyleExport::Impl::TableStyle(const uno::Sequence<beans::PropertyV
     tableStyleRPr(aRPr);
     tableStyleTablePr(aTablePr);
     tableStyleTcPr(aTcPr);
-    for (uno::Sequence<beans::PropertyValue>& i : aTableStylePrs)
+    for (const uno::Sequence<beans::PropertyValue>& i : std::as_const(aTableStylePrs))
         tableStyleTableStylePr(i);
 
     m_pSerializer->endElementNS(XML_w, XML_style);
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 2c4a01bc0ed7..a073df08cb18 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -1925,7 +1925,7 @@ void RtfAttributeOutput::OutputFlyFrame_Impl(const ww8::Frame& rFrame, const Poi
             lcl_TextFrameShadow(m_aFlyProperties, rFrameFormat);
             lcl_TextFrameRelativeSize(m_aFlyProperties, rFrameFormat);
 
-            for (std::pair<OString, OString>& rPair : m_aFlyProperties)
+            for (const std::pair<OString, OString>& rPair : m_aFlyProperties)
             {
                 m_rExport.Strm().WriteCharPtr("{" OOO_STRING_SVTOOLS_RTF_SP "{");
                 m_rExport.Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_SN " ");
@@ -4144,7 +4144,7 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrameFormat* pFlyFrameFormat
             }
         }
 
-        for (std::pair<OString, OString>& rPair : aFlyProperties)
+        for (const std::pair<OString, OString>& rPair : aFlyProperties)
         {
             m_rExport.Strm().WriteCharPtr("{" OOO_STRING_SVTOOLS_RTF_SP "{");
             m_rExport.Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_SN " ");
diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx
index 5176f9a06664..d76d52cb7608 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -433,7 +433,7 @@ void RtfExport::WriteMainText()
         aProperties.push_back(std::make_pair<OString, OString>("shapeType", "1"));
         aProperties.push_back(std::make_pair<OString, OString>(
             "fillColor", OString::number(wwUtility::RGBToBGR(oBrush->GetColor()))));
-        for (std::pair<OString, OString>& rPair : aProperties)
+        for (const std::pair<OString, OString>& rPair : aProperties)
         {
             Strm().WriteCharPtr("{" OOO_STRING_SVTOOLS_RTF_SP "{");
             Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_SN " ");
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index 97d94280e922..c8715e0be9d3 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -1786,7 +1786,7 @@ bool WW8_WrPlcSepx::WriteKFText( WW8Export& rWrt )
     unsigned int nOldIndex = rWrt.GetHdFtIndex();
     rWrt.SetHdFtIndex( 0 );
 
-    for (WW8_SepInfo & rSepInfo : aSects)
+    for (const WW8_SepInfo & rSepInfo : aSects)
     {
         std::shared_ptr<WW8_PdAttrDesc> const pAttrDesc(new WW8_PdAttrDesc);
         m_SectionAttributes.push_back(pAttrDesc);
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index 2d708ff1128e..0c7888717662 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -3273,7 +3273,7 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, OUString& rStr )
                             // the entry correctly, but I currently have no clue how to obtain
                             // the tab stop position. It is _not_ set at the paragraph style.
                             std::unique_ptr<SwForm> pForm;
-                            for (SwWW8StyInf & rSI : m_vColl)
+                            for (const SwWW8StyInf & rSI : m_vColl)
                             {
                                 if (rSI.IsOutlineNumbered())
                                 {
diff --git a/sw/source/filter/ww8/ww8toolbar.cxx b/sw/source/filter/ww8/ww8toolbar.cxx
index a2406cf34d11..1d7be7fd86cc 100644
--- a/sw/source/filter/ww8/ww8toolbar.cxx
+++ b/sw/source/filter/ww8/ww8toolbar.cxx
@@ -703,7 +703,7 @@ bool Tcg255::processSubStruct( sal_uInt8 nId, SvStream &rS )
 bool Tcg255::ImportCustomToolBar( SfxObjectShell& rDocSh )
 {
     // Find the SwCTBWrapper
-    for ( auto & rSubStruct : rgtcgData )
+    for ( const auto & rSubStruct : rgtcgData )
     {
         if ( rSubStruct->id() == 0x12 )
         {
diff --git a/sw/source/filter/xml/XMLRedlineImportHelper.cxx b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
index d093c607ae57..748df90325ef 100644
--- a/sw/source/filter/xml/XMLRedlineImportHelper.cxx
+++ b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
@@ -287,7 +287,7 @@ XMLRedlineImportHelper::XMLRedlineImportHelper(
 XMLRedlineImportHelper::~XMLRedlineImportHelper()
 {
     // delete all left over (and obviously incomplete) RedlineInfos (and map)
-    for( auto& rEntry : m_aRedlineMap )
+    for( const auto& rEntry : m_aRedlineMap )
     {
         RedlineInfo* pInfo = rEntry.second;
 
diff --git a/sw/source/ui/envelp/label1.cxx b/sw/source/ui/envelp/label1.cxx
index 3be424ca0aa2..9908ab6a8477 100644
--- a/sw/source/ui/envelp/label1.cxx
+++ b/sw/source/ui/envelp/label1.cxx
@@ -111,7 +111,7 @@ SwLabDlg::SwLabDlg(weld::Window* pParent, const SfxItemSet& rSet,
 
     bool bDouble = false;
 
-    for (std::unique_ptr<SwLabRec> & i : *m_pRecs)
+    for (const std::unique_ptr<SwLabRec> & i : *m_pRecs)
     {
         if (pRec->m_aMake == i->m_aMake &&
             pRec->m_aType == i->m_aType)
diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index 72ae0aab4399..dbaa2c0d2243 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -3278,7 +3278,7 @@ IMPL_LINK(SwTokenWindow, NextItemHdl, SwTOXEdit&, rEdit, void)
 IMPL_LINK(SwTokenWindow, TbxFocusHdl, SwTOXWidget&, rControl, void)
 {
     SwTOXEdit* pEdit = static_cast<SwTOXEdit*>(&rControl);
-    for (auto& aControl : m_aControlList)
+    for (const auto& aControl : m_aControlList)
     {
         SwTOXWidget* pCtrl = aControl.get();
         if (pCtrl && pCtrl->GetType() != WindowType::EDIT)
@@ -3333,7 +3333,7 @@ IMPL_LINK(SwTokenWindow, NextItemBtnHdl, SwTOXButton&, rBtn, void )
 IMPL_LINK(SwTokenWindow, TbxFocusBtnHdl, SwTOXWidget&, rControl, void)
 {
     SwTOXButton* pBtn = static_cast<SwTOXButton*>(&rControl);
-    for (auto& aControl : m_aControlList)
+    for (const auto& aControl : m_aControlList)
     {
         SwTOXWidget* pControl = aControl.get();
 
@@ -3877,7 +3877,7 @@ void SwEntryBrowseBox::WriteEntries(SvStream& rOutStr)
         GoToColumnId(nCol + (nCol < ITEM_CASE ? 1 : -1 ));
 
     rtl_TextEncoding  eTEnc = osl_getThreadTextEncoding();
-    for(std::unique_ptr<AutoMarkEntry> & rpEntry : m_Entries)
+    for(const std::unique_ptr<AutoMarkEntry> & rpEntry : m_Entries)
     {
         AutoMarkEntry* pEntry = rpEntry.get();
         if(!pEntry->sComment.isEmpty())
diff --git a/sw/source/uibase/app/mainwn.cxx b/sw/source/uibase/app/mainwn.cxx
index a367b81eef18..2f7c1ba08a25 100644
--- a/sw/source/uibase/app/mainwn.cxx
+++ b/sw/source/uibase/app/mainwn.cxx
@@ -37,7 +37,7 @@ static std::vector<std::unique_ptr<SwProgress>> *pProgressContainer = nullptr;
 
 static SwProgress *lcl_SwFindProgress( SwDocShell const *pDocShell )
 {
-    for (auto& pTmp : *pProgressContainer)
+    for (const auto& pTmp : *pProgressContainer)
     {
         if ( pTmp->pDocShell == pDocShell )
             return pTmp.get();
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 6222a37c51ea..5a0c51b370c6 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -838,14 +838,14 @@ SwDBManager::~SwDBManager() COVERITY_NOEXCEPT_FALSE
 
     // copy required, m_DataSourceParams can be modified while disposing components
     std::vector<uno::Reference<sdbc::XConnection>> aCopiedConnections;
-    for (auto & pParam : m_DataSourceParams)
+    for (const auto & pParam : m_DataSourceParams)
     {
         if(pParam->xConnection.is())
         {
             aCopiedConnections.push_back(pParam->xConnection);
         }
     }
-    for (auto & xConnection : aCopiedConnections)
+    for (const auto & xConnection : aCopiedConnections)
     {
         try
         {
@@ -2568,7 +2568,7 @@ SwDSParam*  SwDBManager::FindDSConnection(const OUString& rDataSource, bool bCre
         return m_pImpl->pMergeData.get();
     }
     SwDSParam* pFound = nullptr;
-    for (auto & pParam : m_DataSourceParams)
+    for (const auto & pParam : m_DataSourceParams)
     {
         if(rDataSource == pParam->sDataSource)
         {
@@ -3085,7 +3085,7 @@ void SwDBManager::ExecuteFormLetter( SwWrtShell& rSh,
     }
     if(pFound)
     {
-        for (auto & pParam : m_DataSourceParams)
+        for (const auto & pParam : m_DataSourceParams)
         {
             if (pParam.get() == pFound)
             {
diff --git a/sw/source/uibase/dochdl/gloshdl.cxx b/sw/source/uibase/dochdl/gloshdl.cxx
index 784a6933ad98..f6f44b872945 100644
--- a/sw/source/uibase/dochdl/gloshdl.cxx
+++ b/sw/source/uibase/dochdl/gloshdl.cxx
@@ -411,7 +411,7 @@ bool SwGlossaryHdl::Expand(weld::Window* pParent, const OUString& rShortName,
             {
                 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
                 ScopedVclPtr<AbstractSwSelGlossaryDlg> pDlg(pFact->CreateSwSelGlossaryDlg(pParent, aShortName));
-                for(TextBlockInfo_Impl & i : aFoundArr)
+                for(const TextBlockInfo_Impl & i : aFoundArr)
                 {
                     pDlg->InsertGlos(i.sTitle, i.sLongName);
                 }
diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx
index 202512ab255d..70f900cc5516 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -836,7 +836,7 @@ void SwAnnotationWin::SetPosAndSize()
                 EditWin().EnableMapMode();
 
             SwRects* pRects(pTmpCursorForAnnotationTextRange.get());
-            for(SwRect & rNextRect : *pRects)
+            for(const SwRect & rNextRect : *pRects)
             {
                 const tools::Rectangle aPntRect(rNextRect.SVRect());
                 maAnnotationTextRanges.emplace_back(
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index a763e2c56ead..4734d0df9cad 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -981,7 +981,7 @@ void SwPostItMgr::DrawNotesForPage(OutputDevice *pOutDev, sal_uInt32 nPage)
 
 void SwPostItMgr::PaintTile(OutputDevice& rRenderContext)
 {
-    for (std::unique_ptr<SwSidebarItem>& pItem : mvPostItFields)
+    for (const std::unique_ptr<SwSidebarItem>& pItem : mvPostItFields)
     {
         SwAnnotationWin* pPostIt = pItem->pPostIt;
         if (!pPostIt)
@@ -1937,7 +1937,7 @@ vcl::Window* SwPostItMgr::IsHitSidebarWindow(const Point& rPointLogic)
         if (bEnableMapMode)
             mpEditWin->EnableMapMode();
 
-        for (std::unique_ptr<SwSidebarItem>& pItem : mvPostItFields)
+        for (const std::unique_ptr<SwSidebarItem>& pItem : mvPostItFields)
         {
             SwAnnotationWin* pPostIt = pItem->pPostIt;
             if (!pPostIt)
@@ -2041,7 +2041,7 @@ void SwPostItMgr::CorrectPositions()
     {
         long aAnchorPosX = 0;
         long aAnchorPosY = 0;
-        for (std::unique_ptr<SwPostItPageItem>& pPage : mPages)
+        for (const std::unique_ptr<SwPostItPageItem>& pPage : mPages)
         {
             for (auto const& item : pPage->mvSidebarItems)
             {
diff --git a/sw/source/uibase/sidebar/ThemePanel.cxx b/sw/source/uibase/sidebar/ThemePanel.cxx
index e0823d0f5782..e70bdd93afb2 100644
--- a/sw/source/uibase/sidebar/ThemePanel.cxx
+++ b/sw/source/uibase/sidebar/ThemePanel.cxx
@@ -329,7 +329,7 @@ std::vector<FontSet> initFontSets()
 
 FontSet getFontSet(const OUString& rFontVariant, std::vector<FontSet>& aFontSets)
 {
-    for (FontSet & rFontSet : aFontSets)
+    for (const FontSet & rFontSet : aFontSets)
     {
         if (rFontSet.maName == rFontVariant)
             return rFontSet;
@@ -441,7 +441,7 @@ ThemePanel::ThemePanel(vcl::Window* pParent,
     mpValueSetColors->SetDoubleClickHdl(LINK(this, ThemePanel, DoubleClickValueSetHdl));
 
     std::vector<FontSet> aFontSets = initFontSets();
-    for (FontSet & rFontSet : aFontSets)
+    for (const FontSet & rFontSet : aFontSets)
     {
         mpListBoxFonts->InsertEntry(rFontSet.maName);
     }
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 19d88c7e018b..3299a6f043e9 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3306,7 +3306,7 @@ OUString SwXTextDocument::getTrackedChanges()
 
                 SwRects* pRects(&aCursor);
                 std::vector<OString> aRects;
-                for (SwRect& rNextRect : *pRects)
+                for (const SwRect& rNextRect : *pRects)
                     aRects.push_back(rNextRect.SVRect().toString());
 
                 const OString sRects = comphelper::string::join("; ", aRects);
diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx
index 0e7fad751d2a..9dce946dc90b 100644
--- a/sw/source/uibase/utlui/glbltree.cxx
+++ b/sw/source/uibase/utlui/glbltree.cxx
@@ -1365,7 +1365,7 @@ IMPL_LINK( SwGlobalTree, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg, vo
         Sequence< OUString >aFileNames( aMedList.size() );
         OUString* pFileNames = aFileNames.getArray();
         sal_Int32 nPos = 0;
-        for (std::unique_ptr<SfxMedium>& pMed : aMedList)
+        for (const std::unique_ptr<SfxMedium>& pMed : aMedList)
         {
             OUString sFileName = pMed->GetURLObject().GetMainURL( INetURLObject::DecodeMechanism::NONE )
                 + OUStringLiteral1(sfx2::cTokenSeparator)
diff --git a/sw/source/uibase/utlui/gloslst.cxx b/sw/source/uibase/utlui/gloslst.cxx
index 6041dbd881d8..c58498166cb4 100644
--- a/sw/source/uibase/utlui/gloslst.cxx
+++ b/sw/source/uibase/utlui/gloslst.cxx
@@ -334,7 +334,7 @@ void SwGlossaryList::Invoke()
 
 AutoTextGroup* SwGlossaryList::FindGroup(const OUString& rGroupName)
 {
-    for(auto & pRet : aGroupArr)
+    for(const auto & pRet : aGroupArr)
     {
         if(pRet->sName == rGroupName)
             return pRet.get();
commit 80d8fda9c092ea77869c7c162d0acac854a0738d
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Aug 20 14:40:59 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Aug 20 18:37:21 2019 +0200

    tdf#119388 don't broadcast when locked
    
    takes the delete time for a column from 41s to 21s
    
    Change-Id: I11f438dd3ed0787309b150a0cb3dde6447f07e5b
    Reviewed-on: https://gerrit.libreoffice.org/77825
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index a402fb3b32fc..0f9214eb78a4 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -937,6 +937,7 @@ void ScDrawLayer::RecalcPos( SdrObject* pObj, ScDrawObjData& rData, bool bNegati
     else
     {
         // Prevent multiple broadcasts during the series of changes.
+        bool bWasLocked = pObj->getSdrModelFromSdrObject().isLocked();
         pObj->getSdrModelFromSdrObject().setLock(true);
         bool bCanResize = bValid2 && !pObj->IsResizeProtect() && rData.mbResizeWithCell;
 
@@ -1068,8 +1069,9 @@ void ScDrawLayer::RecalcPos( SdrObject* pObj, ScDrawObjData& rData, bool bNegati
         }
 
         // End prevent multiple broadcasts during the series of changes.
-        pObj->getSdrModelFromSdrObject().setLock(false);
-        pObj->BroadcastObjectChange();
+        pObj->getSdrModelFromSdrObject().setLock(bWasLocked);
+        if (!bWasLocked)
+            pObj->BroadcastObjectChange();
     }
 }
 


More information about the Libreoffice-commits mailing list