From 8d54827762e2a6702a16b67724a6a5f393d72598 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 20 Aug 2019 14:01:10 +0200 Subject: [PATCH] loplugin:constvars in sdext..sfx2 Change-Id: Id9b05387b7b87d3af5e646e867e6ca9fda0711ce Reviewed-on: https://gerrit.libreoffice.org/77806 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sdext/source/pdfimport/tree/drawtreevisiting.cxx | 2 +- sdext/source/pdfimport/tree/genericelements.cxx | 2 +- sdext/source/pdfimport/tree/writertreevisiting.cxx | 6 +++--- sfx2/source/appl/appserv.cxx | 4 ++-- sfx2/source/appl/linkmgr2.cxx | 2 +- sfx2/source/appl/newhelp.cxx | 4 ++-- sfx2/source/appl/workwin.cxx | 10 +++++----- sfx2/source/bastyp/fltfnc.cxx | 22 +++++++++++----------- sfx2/source/control/templatelocalview.cxx | 4 ++-- sfx2/source/dialog/dinfdlg.cxx | 10 +++++----- sfx2/source/doc/Metadatable.cxx | 2 +- sfx2/source/doc/doctemplates.cxx | 4 ++-- sfx2/source/doc/templatedlg.cxx | 2 +- sfx2/source/sidebar/Deck.cxx | 2 +- sfx2/source/sidebar/ResourceManager.cxx | 4 ++-- 15 files changed, 40 insertions(+), 40 deletions(-) diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx b/sdext/source/pdfimport/tree/drawtreevisiting.cxx index 07e615f693b1..3985d07fdeb8 100644 --- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx +++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx @@ -490,7 +490,7 @@ void DrawXmlOptimizer::visit( PageElement& elem, const std::list< std::unique_pt // adjust line height and text items fCurLineHeight = 0.0; nCurLineElements = 0; - for( auto& rxChild : pCurPara->Children ) + for( const auto& rxChild : pCurPara->Children ) { TextElement* pTestText = dynamic_cast(rxChild.get()); if( pTestText ) diff --git a/sdext/source/pdfimport/tree/genericelements.cxx b/sdext/source/pdfimport/tree/genericelements.cxx index 152366d6b4bf..c26f0f816222 100644 --- a/sdext/source/pdfimport/tree/genericelements.cxx +++ b/sdext/source/pdfimport/tree/genericelements.cxx @@ -375,7 +375,7 @@ void PageElement::resolveUnderlines( PDFIProcessor const & rProc ) u_y = r_x; r_x = l_x; l_x = u_y; } u_y = aPoly.getB2DPoint(0).getY(); - for( auto& rxChild : Children ) + for( const auto& rxChild : Children ) { Element* pEle = rxChild.get(); if( pEle->y <= u_y && pEle->y + pEle->h*1.1 >= u_y ) diff --git a/sdext/source/pdfimport/tree/writertreevisiting.cxx b/sdext/source/pdfimport/tree/writertreevisiting.cxx index 1025d3fb74c0..4d089b3d3230 100644 --- a/sdext/source/pdfimport/tree/writertreevisiting.cxx +++ b/sdext/source/pdfimport/tree/writertreevisiting.cxx @@ -321,7 +321,7 @@ void WriterXmlEmitter::visit( DocumentElement& elem, const std::list< std::uniqu m_rEmitContext.rEmitter.beginTag( "office:body", PropertyMap() ); m_rEmitContext.rEmitter.beginTag( "office:text", PropertyMap() ); - for( auto& rxChild : elem.Children ) + for( const auto& rxChild : elem.Children ) { PageElement* pPage = dynamic_cast(rxChild.get()); if( pPage ) @@ -505,7 +505,7 @@ void WriterXmlOptimizer::visit( PageElement& elem, const std::list< std::unique_ // adjust line height and text items fCurLineHeight = 0.0; nCurLineElements = 0; - for( auto& rxChild : pCurPara->Children ) + for( const auto& rxChild : pCurPara->Children ) { TextElement* pTestText = dynamic_cast(rxChild.get()); if( pTestText ) @@ -1085,7 +1085,7 @@ void WriterXmlFinalizer::visit( PageElement& elem, const std::list< std::unique_ elem.RightMargin = 0; // first element should be a paragraph ParagraphElement* pFirstPara = nullptr; - for( auto& rxChild : elem.Children ) + for( const auto& rxChild : elem.Children ) { if( dynamic_cast( rxChild.get() ) ) { diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index fc936519f8a5..423518605fee 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -925,13 +925,13 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) } // Show toolbars - for ( OUString& rName : aMandatoryToolbars ) + for ( const OUString& rName : std::as_const(aMandatoryToolbars) ) { xLayoutManager->createElement( rName ); xLayoutManager->showElement( rName ); } - for ( OUString& rName : aUserToolbars ) + for ( const OUString& rName : std::as_const(aUserToolbars) ) { xLayoutManager->createElement( rName ); xLayoutManager->showElement( rName ); diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx index f3b24cb66032..fa242e0c34e3 100644 --- a/sfx2/source/appl/linkmgr2.cxx +++ b/sfx2/source/appl/linkmgr2.cxx @@ -294,7 +294,7 @@ void LinkManager::UpdateAllLinks( { // search first in the array after the entry bool bFound = false; - for(tools::SvRef & i : aLinkTbl) + for(const tools::SvRef & i : aLinkTbl) if( pLink == i.get() ) { bFound = true; diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index 54a4e4bb664e..bc99149df834 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -1273,12 +1273,12 @@ BookmarksTabPage_Impl::BookmarksTabPage_Impl(vcl::Window* pParent, SfxHelpIndexW m_pBookmarksPB->SetClickHdl( LINK( this, BookmarksTabPage_Impl, OpenHdl ) ); // load bookmarks from configuration - Sequence< Sequence< PropertyValue > > aBookmarkSeq = SvtHistoryOptions().GetList( eHELPBOOKMARKS ); + const Sequence< Sequence< PropertyValue > > aBookmarkSeq = SvtHistoryOptions().GetList( eHELPBOOKMARKS ); OUString aTitle; OUString aURL; - for ( auto& rBookmark : aBookmarkSeq ) + for ( const auto& rBookmark : aBookmarkSeq ) { GetBookmarkEntry_Impl( rBookmark, aTitle, aURL ); AddBookmarks( aTitle, aURL ); diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx index 1f40902b9a77..0cb1deb7e945 100644 --- a/sfx2/source/appl/workwin.cxx +++ b/sfx2/source/appl/workwin.cxx @@ -869,7 +869,7 @@ SvBorder SfxWorkWindow::Arrange_Impl() bool SfxWorkWindow::PrepareClose_Impl() { - for (std::unique_ptr &pCW : aChildWins) + for (const std::unique_ptr &pCW : aChildWins) { SfxChildWindow *pChild = pCW->pWin; if ( pChild && !pChild->QueryClose() ) @@ -980,7 +980,7 @@ void SfxWorkWindow::ShowChildren_Impl() { // We have to find the SfxChildWin_Impl to retrieve the // SFX_CHILDWIN flags that can influence visibility. - for (std::unique_ptr& pCWin : aChildWins) + for (const std::unique_ptr& pCWin : aChildWins) { SfxChild_Impl* pChild = pCWin->pCli; if ( pChild == pCli.get() ) @@ -1503,7 +1503,7 @@ void SfxWorkWindow::HidePopups_Impl(bool bHide, sal_uInt16 nId ) if (comphelper::LibreOfficeKit::isActive() && bHide) return; - for (std::unique_ptr& i : aChildWins) + for (const std::unique_ptr& i : aChildWins) { SfxChildWindow *pCW = i->pWin; if (pCW && pCW->GetAlignment() == SfxChildAlignment::NOALIGNMENT && pCW->GetType() != nId) @@ -1541,7 +1541,7 @@ void SfxWorkWindow::ConfigChild_Impl(SfxChildIdentifier eChild, SfxChildWin_Impl *pCW = nullptr; // configure direct childwindow - for (std::unique_ptr& i : aChildWins) + for (const std::unique_ptr& i : aChildWins) { pCW = i.get(); SfxChildWindow *pChild = pCW->pWin; @@ -2257,7 +2257,7 @@ void SfxWorkWindow::MakeChildrenVisible_Impl( bool bVis ) bool SfxWorkWindow::IsAutoHideMode( const SfxSplitWindow *pSplitWin ) { - for (VclPtr & pWin : pSplit) + for (const VclPtr & pWin : pSplit) { if ( pWin.get() != pSplitWin && pWin->IsAutoHide( true ) ) return true; diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx index 1fec7f92d379..e8aabfda8fdb 100644 --- a/sfx2/source/bastyp/fltfnc.cxx +++ b/sfx2/source/bastyp/fltfnc.cxx @@ -219,7 +219,7 @@ std::shared_ptr SfxFilterContainer::GetDefaultFilter_Impl( cons if ( bFirstRead ) ReadFilters_Impl(); - for (std::shared_ptr& pCheckFilter : *pFilterArr) + for (const std::shared_ptr& pCheckFilter : *pFilterArr) { if ( pCheckFilter->GetServiceName().equalsIgnoreAsciiCase(sServiceName) ) { @@ -308,7 +308,7 @@ void SfxFilterMatcher_Impl::Update() const { // this List was already used pList->clear(); - for (std::shared_ptr& pFilter : *pFilterArr) + for (const std::shared_ptr& pFilter : *pFilterArr) { if ( pFilter->GetServiceName() == aName ) pList->push_back( pFilter ); @@ -341,7 +341,7 @@ void SfxFilterMatcher_Impl::InitForIterating() const std::shared_ptr SfxFilterMatcher::GetAnyFilter( SfxFilterFlags nMust, SfxFilterFlags nDont ) const { m_rImpl.InitForIterating(); - for (std::shared_ptr& pFilter : *m_rImpl.pList) + for (const std::shared_ptr& pFilter : *m_rImpl.pList) { SfxFilterFlags nFlags = pFilter->GetFilterFlags(); if ( (nFlags & nMust) == nMust && !(nFlags & nDont ) ) @@ -651,7 +651,7 @@ std::shared_ptr SfxFilterMatcher::GetFilter4Mime( const OUStrin { if ( m_rImpl.pList ) { - for (std::shared_ptr& pFilter : *m_rImpl.pList) + for (const std::shared_ptr& pFilter : *m_rImpl.pList) { SfxFilterFlags nFlags = pFilter->GetFilterFlags(); if ( (nFlags & nMust) == nMust && !(nFlags & nDont ) && pFilter->GetMimeType() == rMediaType ) @@ -670,7 +670,7 @@ std::shared_ptr SfxFilterMatcher::GetFilter4EA( const OUString& if ( m_rImpl.pList ) { std::shared_ptr pFirst; - for (std::shared_ptr& pFilter : *m_rImpl.pList) + for (const std::shared_ptr& pFilter : *m_rImpl.pList) { SfxFilterFlags nFlags = pFilter->GetFilterFlags(); if ( (nFlags & nMust) == nMust && !(nFlags & nDont ) && pFilter->GetTypeName() == rType ) @@ -695,7 +695,7 @@ std::shared_ptr SfxFilterMatcher::GetFilter4Extension( const OU { if ( m_rImpl.pList ) { - for (std::shared_ptr& pFilter : *m_rImpl.pList) + for (const std::shared_ptr& pFilter : *m_rImpl.pList) { SfxFilterFlags nFlags = pFilter->GetFilterFlags(); if ( (nFlags & nMust) == nMust && !(nFlags & nDont ) ) @@ -742,7 +742,7 @@ std::shared_ptr SfxFilterMatcher::GetFilter4UIName( const OUStr { m_rImpl.InitForIterating(); std::shared_ptr pFirstFilter; - for (std::shared_ptr& pFilter : *m_rImpl.pList) + for (const std::shared_ptr& pFilter : *m_rImpl.pList) { SfxFilterFlags nFlags = pFilter->GetFilterFlags(); if ( (nFlags & nMust) == nMust && @@ -784,7 +784,7 @@ std::shared_ptr SfxFilterMatcher::GetFilter4FilterName( const O CreateFilterArr(); else { - for (std::shared_ptr& pFilter : *pFilterArr) + for (const std::shared_ptr& pFilter : *pFilterArr) { SfxFilterFlags nFlags = pFilter->GetFilterFlags(); if ((nFlags & nMust) == nMust && !(nFlags & nDont) && pFilter->GetFilterName().equalsIgnoreAsciiCase(aName)) @@ -800,7 +800,7 @@ std::shared_ptr SfxFilterMatcher::GetFilter4FilterName( const O if ( !pList ) pList = pFilterArr; - for (std::shared_ptr& pFilter : *pList) + for (const std::shared_ptr& pFilter : *pList) { SfxFilterFlags nFlags = pFilter->GetFilterFlags(); if ( (nFlags & nMust) == nMust && !(nFlags & nDont ) && pFilter->GetFilterName().equalsIgnoreAsciiCase(aName)) @@ -1114,7 +1114,7 @@ void SfxFilterContainer::ReadFilters_Impl( bool bUpdate ) if( !rList.empty() ) { bUpdate = true; - for (std::shared_ptr& pFilter : rList) + for (const std::shared_ptr& pFilter : rList) { SfxFilter* pNonConstFilter = const_cast(pFilter.get()); pNonConstFilter->nFormatType |= SFX_FILTER_NOTINSTALLED; @@ -1140,7 +1140,7 @@ void SfxFilterContainer::ReadFilters_Impl( bool bUpdate ) { // global filter array was modified, factory specific ones might need an // update too - for (auto& aImpl : aImplArr) + for (const auto& aImpl : aImplArr) aImpl->Update(); } } diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx index 500bacca768d..4ba55dead866 100644 --- a/sfx2/source/control/templatelocalview.cxx +++ b/sfx2/source/control/templatelocalview.cxx @@ -704,7 +704,7 @@ SfxTemplateLocalView::getFilteredItems(const std::functionmaTemplates) + for (const TemplateItemProperties & rItemProps : pFolderItem->maTemplates) { if (rFunc(rItemProps)) aItems.push_back(rItemProps); @@ -1301,7 +1301,7 @@ bool SfxTemplateLocalView::IsDefaultTemplate(const OUString& rPath) void SfxTemplateLocalView::RemoveDefaultTemplateIcon(const OUString& rPath) { - for (std::unique_ptr& pItem : mItemList) + for (const std::unique_ptr& pItem : mItemList) { TemplateViewItem* pViewItem = dynamic_cast(pItem.get()); if (pViewItem && pViewItem->getPath().match(rPath)) diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index ec6f145054a1..01d7b4228936 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -2140,7 +2140,7 @@ Sequence< document::CmisProperty > CmisPropertiesWindow::GetCmisProperties() con m_aNumberFormatter ).GetFormatIndex( NF_NUMBER_SYSTEM ); Sequence< double > seqValue( pLine->m_aValues.size( ) ); sal_Int32 k = 0; - for ( auto& rxValue : pLine->m_aValues ) + for ( const auto& rxValue : pLine->m_aValues ) { double dValue = 0.0; OUString sValue( rxValue->m_xValueEdit->get_text() ); @@ -2158,7 +2158,7 @@ Sequence< document::CmisProperty > CmisPropertiesWindow::GetCmisProperties() con m_aNumberFormatter ).GetFormatIndex( NF_NUMBER_SYSTEM ); Sequence< sal_Int64 > seqValue( pLine->m_aValues.size( ) ); sal_Int32 k = 0; - for ( auto& rxValue : pLine->m_aValues ) + for ( const auto& rxValue : pLine->m_aValues ) { double dValue = 0; OUString sValue( rxValue->m_xValueEdit->get_text() ); @@ -2174,7 +2174,7 @@ Sequence< document::CmisProperty > CmisPropertiesWindow::GetCmisProperties() con { Sequence seqValue( pLine->m_aYesNos.size( ) ); sal_Int32 k = 0; - for ( auto& rxYesNo : pLine->m_aYesNos ) + for ( const auto& rxYesNo : pLine->m_aYesNos ) { bool bValue = rxYesNo->m_xYesButton->get_active(); seqValue[k] = bValue; @@ -2187,7 +2187,7 @@ Sequence< document::CmisProperty > CmisPropertiesWindow::GetCmisProperties() con { Sequence< util::DateTime > seqValue( pLine->m_aDateTimes.size( ) ); sal_Int32 k = 0; - for ( auto& rxDateTime : pLine->m_aDateTimes ) + for ( const auto& rxDateTime : pLine->m_aDateTimes ) { Date aTmpDate = rxDateTime->m_xDateField->get_date(); tools::Time aTmpTime = rxDateTime->m_xTimeField->get_value(); @@ -2204,7 +2204,7 @@ Sequence< document::CmisProperty > CmisPropertiesWindow::GetCmisProperties() con { Sequence< OUString > seqValue( pLine->m_aValues.size( ) ); sal_Int32 k = 0; - for ( auto& rxValue : pLine->m_aValues ) + for ( const auto& rxValue : pLine->m_aValues ) { OUString sValue( rxValue->m_xValueEdit->get_text() ); seqValue[k] = sValue; diff --git a/sfx2/source/doc/Metadatable.cxx b/sfx2/source/doc/Metadatable.cxx index 4570cec72cc2..ea221535863c 100644 --- a/sfx2/source/doc/Metadatable.cxx +++ b/sfx2/source/doc/Metadatable.cxx @@ -628,7 +628,7 @@ removeLink(Metadatable* i_pObject) XmlIdRegistryDocument::~XmlIdRegistryDocument() { // notify all list elements that are actually in the clipboard - for (auto& aXmlId : m_pImpl->m_XmlIdMap) { + for (const auto& aXmlId : m_pImpl->m_XmlIdMap) { for (auto aLink : aXmlId.second.first) removeLink(aLink); for (auto aLink : aXmlId.second.second) diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index 8ebe36e07cd5..b7c8f7e43905 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -2388,7 +2388,7 @@ void SfxDocTplService_Impl::addFsysGroup( GroupList_Impl& rList, return; GroupData_Impl* pGroup = nullptr; - for (std::unique_ptr& i : rList) + for (const std::unique_ptr& i : rList) { if ( i->getTitle() == aTitle ) { @@ -2500,7 +2500,7 @@ void SfxDocTplService_Impl::createFromContent( GroupList_Impl& rList, else { OUString aUITitle; - for (beans::StringPair & rUIName : aUINames) + for (const beans::StringPair & rUIName : aUINames) if ( rUIName.First == aTitle ) { aUITitle = rUIName.Second; diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index 300af208d924..6c9b479cb17a 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -759,7 +759,7 @@ void SfxTemplateManagerDlg::SearchUpdate() std::vector aItems = mxLocalView->getFilteredItems(SearchView_Keyword(aKeyword, getCurrentApplicationFilter())); - for (TemplateItemProperties& rItem : aItems) + for (const TemplateItemProperties& rItem : aItems) { OUString aFolderName = mxLocalView->getRegionName(rItem.nRegionId); diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx index cfef7c774db0..7e451035af34 100644 --- a/sfx2/source/sidebar/Deck.cxx +++ b/sfx2/source/sidebar/Deck.cxx @@ -284,7 +284,7 @@ vcl::Window* Deck::GetPanelParentWindow() Panel* Deck::GetPanel(const OUString & panelId) { - for (VclPtr & pPanel : maPanels) + for (const VclPtr & pPanel : maPanels) { if(pPanel->GetId() == panelId) { diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx index 587d260ebd5a..eb169ee43c0f 100644 --- a/sfx2/source/sidebar/ResourceManager.cxx +++ b/sfx2/source/sidebar/ResourceManager.cxx @@ -453,9 +453,9 @@ void ResourceManager::ReadPanelList() void ResourceManager::ReadLastActive() { - Sequence aLastActive (officecfg::Office::UI::Sidebar::Content::LastActiveDeck::get()); + const Sequence aLastActive (officecfg::Office::UI::Sidebar::Content::LastActiveDeck::get()); - for (auto& rDeckInfo : aLastActive) + for (const auto& rDeckInfo : aLastActive) { sal_Int32 nCharIdx = rDeckInfo.lastIndexOf(','); if ( nCharIdx <= 0 || (nCharIdx == rDeckInfo.getLength() - 1) ) -- 2.11.4.GIT