svtools/source/brwbox/brwbox1.cxx | 12 +-- svtools/source/config/extcolorcfg.cxx | 21 ++--- svtools/source/contnr/svtabbx.cxx | 8 +- svtools/source/control/calendar.cxx | 18 ++-- svtools/source/control/ctrlbox.cxx | 8 +- svtools/source/control/inettbc.cxx | 8 -- svtools/source/control/roadmap.cxx | 57 +++++--------- svtools/source/control/toolbarmenuacc.cxx | 37 +++------ svtools/source/control/valueacc.cxx | 38 ++++----- svtools/source/dialogs/addresstemplate.cxx | 50 +++++------- svtools/source/dialogs/roadmapwizard.cxx | 52 +++++-------- svtools/source/edit/editsyntaxhighlighter.cxx | 5 - svtools/source/graphic/grfcache.cxx | 64 ++++++---------- svtools/source/misc/dialogcontrolling.cxx | 7 - svtools/source/misc/openfiledroptargetlistener.cxx | 12 +-- svtools/source/misc/stringtransfer.cxx | 7 - svtools/source/misc/transfer2.cxx | 11 +- svtools/source/table/defaultinputhandler.cxx | 11 +- svtools/source/table/tablecontrol_impl.cxx | 30 ++----- svtools/source/uno/statusbarcontroller.cxx | 29 ++----- svtools/source/uno/toolboxcontroller.cxx | 38 +++------ svtools/source/uno/unocontroltablemodel.cxx | 81 ++++++--------------- svtools/source/uno/unoimap.cxx | 8 -- 23 files changed, 230 insertions(+), 382 deletions(-)
New commits: commit 0fb4ae8767fa5ff791cd42934b4215011a269eb0 Author: Julien Nabet <serval2...@yahoo.fr> Date: Thu Feb 8 11:09:15 2018 +0100 Modernize a bit svtools by using for-range loops + use empty() instead of comparing begin and end iterator Change-Id: I41c3ae0c9032d6349afb113d457cb78862ae9dcf Reviewed-on: https://gerrit.libreoffice.org/49416 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Julien Nabet <serval2...@yahoo.fr> diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx index 8f53a16e506b..519c4ccc1b07 100644 --- a/svtools/source/brwbox/brwbox1.cxx +++ b/svtools/source/brwbox/brwbox1.cxx @@ -220,11 +220,8 @@ void BrowseBox::InsertHandleColumn( sal_uLong nWidth ) #if OSL_DEBUG_LEVEL > 0 OSL_ENSURE( ColCount() == 0 || pCols[0]->GetId() != HandleColumnId , "BrowseBox::InsertHandleColumn: there is already a handle column" ); { - BrowserColumns::iterator iCol = pCols.begin(); - const BrowserColumns::iterator colsEnd = pCols.end(); - if ( iCol != colsEnd ) - for (++iCol; iCol != colsEnd; ++iCol) - OSL_ENSURE( (*iCol)->GetId() != HandleColumnId, "BrowseBox::InsertHandleColumn: there is a non-Handle column with handle ID" ); + for (auto const col : pCols) + OSL_ENSURE( col->GetId() != HandleColumnId, "BrowseBox::InsertHandleColumn: there is a non-Handle column with handle ID" ); } #endif @@ -253,9 +250,8 @@ void BrowseBox::InsertDataColumn( sal_uInt16 nItemId, const OUString& rText, #if OSL_DEBUG_LEVEL > 0 { - const BrowserColumns::iterator colsEnd = pCols.end(); - for (BrowserColumns::iterator iCol = pCols.begin(); iCol != colsEnd; ++iCol) - OSL_ENSURE( (*iCol)->GetId() != nItemId, "BrowseBox::InsertDataColumn: duplicate column Id" ); + for (auto const& col : pCols) + OSL_ENSURE( col->GetId() != nItemId, "BrowseBox::InsertDataColumn: duplicate column Id" ); } #endif diff --git a/svtools/source/config/extcolorcfg.cxx b/svtools/source/config/extcolorcfg.cxx index 6f360bf82aae..945299289555 100644 --- a/svtools/source/config/extcolorcfg.cxx +++ b/svtools/source/config/extcolorcfg.cxx @@ -392,30 +392,27 @@ void ExtendedColorConfig_Impl::ImplCommit() + m_sLoadedScheme; const OUString s_sSep("/"); - TComponents::iterator aIter = m_aConfigValues.begin(); - TComponents::iterator aEnd = m_aConfigValues.end(); - for( ;aIter != aEnd;++aIter ) + for (auto const& configValue : m_aConfigValues) { - if ( ConfigItem::AddNode(sBase, aIter->first) ) + if ( ConfigItem::AddNode(sBase, configValue.first) ) { OUString sNode = sBase + s_sSep - + aIter->first + + configValue.first //ConfigItem::AddNode(sNode, sColorEntries); + s_sSep + sColorEntries; - uno::Sequence < beans::PropertyValue > aPropValues(aIter->second.first.size()); + uno::Sequence < beans::PropertyValue > aPropValues(configValue.second.first.size()); beans::PropertyValue* pPropValues = aPropValues.getArray(); - TConfigValues::iterator aConIter = aIter->second.first.begin(); - TConfigValues::iterator aConEnd = aIter->second.first.end(); - for (; aConIter != aConEnd; ++aConIter,++pPropValues) + for (auto const& elem : configValue.second.first) { - pPropValues->Name = sNode + s_sSep + aConIter->first; - ConfigItem::AddNode(sNode, aConIter->first); + pPropValues->Name = sNode + s_sSep + elem.first; + ConfigItem::AddNode(sNode, elem.first); pPropValues->Name += sColor; - pPropValues->Value <<= aConIter->second.getColor(); + pPropValues->Value <<= elem.second.getColor(); // the default color will never be changed + ++pPropValues; } SetSetProperties("ExtendedColorScheme/ColorSchemes", aPropValues); } diff --git a/svtools/source/contnr/svtabbx.cxx b/svtools/source/contnr/svtabbx.cxx index 8f871e41ea8a..092725983735 100644 --- a/svtools/source/contnr/svtabbx.cxx +++ b/svtools/source/contnr/svtabbx.cxx @@ -1153,10 +1153,12 @@ sal_Int32 SvHeaderTabListBox::GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nC MetricVector aRects; if ( GetGlyphBoundRects(Point(0,0), sText, 0, sText.getLength(), aRects) ) { - for (MetricVector::iterator aIter = aRects.begin(); aIter != aRects.end(); ++aIter) + sal_Int32 nPos = 0; + for (auto const& rectangle : aRects) { - if( aIter->IsInside(_rPoint) ) - return aIter - aRects.begin(); + if( rectangle.IsInside(_rPoint) ) + return nPos; + ++nPos; } } diff --git a/svtools/source/control/calendar.cxx b/svtools/source/control/calendar.cxx index 12a9fb1c3dab..c63e3ecf82de 100644 --- a/svtools/source/control/calendar.cxx +++ b/svtools/source/control/calendar.cxx @@ -824,23 +824,21 @@ void Calendar::ImplUpdateSelection( IntDateSet* pOld ) { IntDateSet* pNew = mpSelectTable; - for ( IntDateSet::const_iterator it = pOld->begin(); it != pOld->end(); ++it ) + for (auto const& nKey : *pOld) { - sal_Int32 nKey = *it; - if ( pNew->find( nKey ) == pNew->end() ) + if ( pNew->find(nKey) == pNew->end() ) { - Date aTempDate( nKey ); - ImplUpdateDate( aTempDate ); + Date aTempDate(nKey); + ImplUpdateDate(aTempDate); } } - for ( IntDateSet::const_iterator it = pNew->begin(); it != pNew->end(); ++it ) + for (auto const& nKey : *pNew) { - sal_Int32 nKey = *it; - if ( pOld->find( nKey ) == pOld->end() ) + if ( pOld->find(nKey) == pOld->end() ) { - Date aTempDate( nKey ); - ImplUpdateDate( aTempDate ); + Date aTempDate(nKey); + ImplUpdateDate(aTempDate); } } } diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index de28bb513ae5..2cceca8fd9a5 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -175,11 +175,11 @@ long BorderWidthImpl::GuessWidth( long nLine1, long nLine2, long nGap ) if ( (!bInvalid) && (!aToCompare.empty()) ) { nWidth = *aToCompare.begin(); - std::vector< double >::iterator pIt = aToCompare.begin(); - while ( pIt != aToCompare.end() && !bInvalid ) + for (auto const& elem : aToCompare) { - bInvalid = ( nWidth != *pIt ); - ++pIt; + bInvalid = ( nWidth != elem ); + if (bInvalid) + break; } nWidth = bInvalid ? 0.0 : nLine1 + nLine2 + nGap; } diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx index b922c4905104..8dab51f2ba1f 100644 --- a/svtools/source/control/inettbc.cxx +++ b/svtools/source/control/inettbc.cxx @@ -227,13 +227,11 @@ IMPL_LINK_NOARG( SvtMatchContext_Impl, Select_Impl, void*, void ) // insert all completed strings into the listbox pBox->Clear(); - for(std::vector<OUString>::iterator i = aCompletions.begin(); i != aCompletions.end(); ++i) + for (auto const& completion : aCompletions) { - OUString sCompletion(*i); - // convert the file into an URL OUString sURL; - osl::FileBase::getFileURLFromSystemPath( sCompletion, sURL ); + osl::FileBase::getFileURLFromSystemPath(completion, sURL); // note: if this doesn't work, we're not interested in: we're checking the // untouched sCompletion then @@ -250,7 +248,7 @@ IMPL_LINK_NOARG( SvtMatchContext_Impl, Select_Impl, void*, void ) } } - pBox->InsertEntry( sCompletion ); + pBox->InsertEntry(completion); } if( !bNoSelection && !aCompletions.empty() && !bValidCompletionsFiltered ) diff --git a/svtools/source/control/roadmap.cxx b/svtools/source/control/roadmap.cxx index e53bf7b70799..89ce106d4eb0 100644 --- a/svtools/source/control/roadmap.cxx +++ b/svtools/source/control/roadmap.cxx @@ -233,9 +233,9 @@ void ORoadmap::dispose() { HL_Vector aItemsCopy = m_pImpl->getHyperLabels(); m_pImpl->getHyperLabels().clear(); - for ( HL_Vector::iterator i = aItemsCopy.begin(); i != aItemsCopy.end(); ++i ) + for (auto const& itemCopy : aItemsCopy) { - delete *i; + delete itemCopy; } if ( ! m_pImpl->isComplete() ) delete m_pImpl->InCompleteHyperLabel; @@ -295,12 +295,9 @@ void ORoadmap::SetRoadmapInteractive(bool _bInteractive) m_pImpl->setInteractive( _bInteractive ); const HL_Vector& rItems = m_pImpl->getHyperLabels(); - for ( HL_Vector::const_iterator i = rItems.begin(); - i != rItems.end(); - ++i - ) + for (auto const& item : rItems) { - (*i)->SetInteractive( _bInteractive ); + item->SetInteractive( _bInteractive ); } } @@ -330,15 +327,11 @@ void ORoadmap::UpdatefollowingHyperLabels(ItemIndex _nIndex) const HL_Vector& rItems = m_pImpl->getHyperLabels(); if ( _nIndex < static_cast<ItemIndex>(rItems.size()) ) { - for ( HL_Vector::const_iterator i = rItems.begin() + _nIndex; - i != rItems.end(); - ++i, ++_nIndex - ) + for (auto const& item : rItems) { - RoadmapItem* pItem = *i; - - pItem->SetIndex( _nIndex ); - pItem->SetPosition( GetPreviousHyperLabel( _nIndex ) ); + item->SetIndex( _nIndex ); + item->SetPosition( GetPreviousHyperLabel( _nIndex ) ); + ++_nIndex; } } if ( ! m_pImpl->isComplete() ) @@ -410,12 +403,11 @@ void ORoadmap::ChangeRoadmapItemLabel( ItemId _nID, const OUString& _sLabel ) pItem->Update( pItem->GetIndex(), _sLabel ); const HL_Vector& rItems = m_pImpl->getHyperLabels(); - for ( HL_Vector::const_iterator i = rItems.begin(); - i != rItems.end(); - ++i - ) + size_t nPos = 0; + for (auto const& item : rItems) { - (*i)->SetPosition( GetPreviousHyperLabel( i - rItems.begin() ) ); + item->SetPosition( GetPreviousHyperLabel(nPos) ); + ++nPos; } } @@ -430,14 +422,11 @@ RoadmapItem* ORoadmap::GetByID(ItemId _nID) { ItemId nLocID = 0; const HL_Vector& rItems = m_pImpl->getHyperLabels(); - for ( HL_Vector::const_iterator i = rItems.begin(); - i != rItems.end(); - ++i - ) + for (auto const& item : rItems) { - nLocID = (*i)->GetID(); + nLocID = item->GetID(); if ( nLocID == _nID ) - return *i; + return item; } return nullptr; } @@ -493,12 +482,9 @@ RoadmapTypes::ItemId ORoadmap::GetPreviousAvailableItemId(ItemIndex _nNewIndex) void ORoadmap::DeselectOldRoadmapItems() { const HL_Vector& rItems = m_pImpl->getHyperLabels(); - for ( HL_Vector::const_iterator i = rItems.begin(); - i != rItems.end(); - ++i - ) + for (auto const& item : rItems) { - (*i)->ToggleBackgroundColor( COL_TRANSPARENT ); + item->ToggleBackgroundColor( COL_TRANSPARENT ); } } @@ -586,13 +572,10 @@ void ORoadmap::DrawHeadline(vcl::RenderContext& rRenderContext) RoadmapItem* ORoadmap::GetByPointer(vcl::Window const * pWindow) { const HL_Vector& rItems = m_pImpl->getHyperLabels(); - for ( HL_Vector::const_iterator i = rItems.begin(); - i != rItems.end(); - ++i - ) + for (auto const& item : rItems) { - if ( (*i)->Contains( pWindow ) ) - return *i; + if ( item->Contains( pWindow ) ) + return item; } return nullptr; } diff --git a/svtools/source/control/toolbarmenuacc.cxx b/svtools/source/control/toolbarmenuacc.cxx index e33813372e84..eca17d9a53ca 100644 --- a/svtools/source/control/toolbarmenuacc.cxx +++ b/svtools/source/control/toolbarmenuacc.cxx @@ -116,12 +116,11 @@ void ToolbarMenuAcc::FireAccessibleEvent( short nEventId, const Any& rOldValue, aEvtObject.NewValue = rNewValue; aEvtObject.OldValue = rOldValue; - for (EventListenerVector::const_iterator aIter( aTmpListeners.begin() ), aEnd( aTmpListeners.end() ); - aIter != aEnd ; ++aIter) + for (auto const& tmpListener : aTmpListeners) { try { - (*aIter)->notifyEvent( aEvtObject ); + tmpListener->notifyEvent( aEvtObject ); } catch( Exception& ) { @@ -276,19 +275,13 @@ void SAL_CALL ToolbarMenuAcc::addAccessibleEventListener( const Reference< XAcce if( !rxListener.is() ) return; - EventListenerVector::const_iterator aIter = mxEventListeners.begin(); - bool bFound = false; - - while( !bFound && ( aIter != mxEventListeners.end() ) ) + for (auto const& eventListener : mxEventListeners) { - if( *aIter == rxListener ) - bFound = true; - else - ++aIter; + if( eventListener == rxListener ) + return; } - if (!bFound) - mxEventListeners.push_back( rxListener ); + mxEventListeners.push_back( rxListener ); } @@ -504,20 +497,18 @@ void SAL_CALL ToolbarMenuAcc::disposing() } // Inform all listeners that this objects is disposing. - EventListenerVector::const_iterator aListenerIterator (aListenerListCopy.begin()); EventObject aEvent (static_cast<XAccessible*>(this)); - while(aListenerIterator != aListenerListCopy.end()) + for (auto const& listenerCopy : aListenerListCopy) { try { - (*aListenerIterator)->disposing (aEvent); + listenerCopy->disposing (aEvent); } catch( Exception& ) { // Ignore exceptions. } - ++aListenerIterator; } } @@ -559,20 +550,17 @@ void SAL_CALL ToolbarMenuEntryAcc::disposing() } // Inform all listeners that this objects is disposing. - EventListenerVector::const_iterator aListenerIterator (aListenerListCopy.begin()); EventObject aEvent (static_cast<XAccessible*>(this)); - while(aListenerIterator != aListenerListCopy.end()) + for (auto const& listenerCopy : aListenerListCopy) { try { - (*aListenerIterator)->disposing (aEvent); + listenerCopy->disposing (aEvent); } catch( Exception& ) { // Ignore exceptions. } - - ++aListenerIterator; } } @@ -725,10 +713,9 @@ void SAL_CALL ToolbarMenuEntryAcc::addAccessibleEventListener( const Reference< if( rxListener.is() ) { - for (EventListenerVector::const_iterator aIter( mxEventListeners.begin() ), aEnd( mxEventListeners.end() ); - aIter != aEnd; ++aIter ) + for (auto const& eventListener : mxEventListeners) { - if( *aIter == rxListener ) + if (eventListener == rxListener) return; } // listener not found so add it diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx index f4ef3fa90dec..e6e8e6b909e0 100644 --- a/svtools/source/control/valueacc.cxx +++ b/svtools/source/control/valueacc.cxx @@ -88,12 +88,11 @@ void ValueSetAcc::FireAccessibleEvent( short nEventId, const uno::Any& rOldValue aEvtObject.NewValue = rNewValue; aEvtObject.OldValue = rOldValue; - for (::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::const_iterator aIter( aTmpListeners.begin() ); - aIter != aTmpListeners.end() ; ++aIter) + for (auto const& tmpListener : aTmpListeners) { try { - (*aIter)->notifyEvent( aEvtObject ); + tmpListener->notifyEvent( aEvtObject ); } catch(const uno::Exception&) { @@ -339,15 +338,15 @@ void SAL_CALL ValueSetAcc::addAccessibleEventListener( const uno::Reference< acc if( !rxListener.is() ) return; - ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::const_iterator aIter = mxEventListeners.begin(); bool bFound = false; - while( !bFound && ( aIter != mxEventListeners.end() ) ) + for (auto const& eventListener : mxEventListeners) { - if( *aIter == rxListener ) + if(eventListener == rxListener) + { bFound = true; - else - ++aIter; + break; + } } if (!bFound) @@ -601,21 +600,17 @@ void SAL_CALL ValueSetAcc::disposing() } // Inform all listeners that this objects is disposing. - ::std::vector<uno::Reference<accessibility::XAccessibleEventListener> >::const_iterator - aListenerIterator (aListenerListCopy.begin()); lang::EventObject aEvent (static_cast<accessibility::XAccessible*>(this)); - while (aListenerIterator != aListenerListCopy.end()) + for (auto const& listenerCopy : aListenerListCopy) { try { - (*aListenerIterator)->disposing (aEvent); + listenerCopy->disposing (aEvent); } catch(const uno::Exception&) { // Ignore exceptions. } - - ++aListenerIterator; } } @@ -695,10 +690,9 @@ void ValueItemAcc::FireAccessibleEvent( short nEventId, const uno::Any& rOldValu aEvtObject.NewValue = rNewValue; aEvtObject.OldValue = rOldValue; - for (::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::const_iterator aIter( aTmpListeners.begin() ); - aIter != aTmpListeners.end() ; ++aIter) + for (auto const& tmpListener : aTmpListeners) { - (*aIter)->notifyEvent( aEvtObject ); + tmpListener->notifyEvent( aEvtObject ); } } @@ -903,15 +897,15 @@ void SAL_CALL ValueItemAcc::addAccessibleEventListener( const uno::Reference< ac if( !rxListener.is() ) return; - ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::const_iterator aIter = mxEventListeners.begin(); bool bFound = false; - while( !bFound && ( aIter != mxEventListeners.end() ) ) + for (auto const& eventListener : mxEventListeners) { - if( *aIter == rxListener ) + if(eventListener == rxListener) + { bFound = true; - else - ++aIter; + break; + } } if (!bFound) diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx index 1a3377da5358..7dafc5d4dbd8 100644 --- a/svtools/source/dialogs/addresstemplate.cxx +++ b/svtools/source/dialogs/addresstemplate.cxx @@ -565,9 +565,9 @@ void AssignmentPersistentData::ImplCommit() long nLabelWidth = 0; long nListBoxWidth = m_pImpl->pFields[0]->approximate_char_width() * 20; - for (auto aI = m_pImpl->aFieldLabels.cbegin(), aEnd = m_pImpl->aFieldLabels.cend(); aI != aEnd; ++aI) + for (auto const& fieldLabel : m_pImpl->aFieldLabels) { - nLabelWidth = std::max(nLabelWidth, FixedText::getTextDimensions(m_pImpl->pFieldLabels[0], *aI, 0x7FFFFFFF).Width()); + nLabelWidth = std::max(nLabelWidth, FixedText::getTextDimensions(m_pImpl->pFieldLabels[0], fieldLabel, 0x7FFFFFFF).Width()); } for (sal_Int32 row=0; row<FIELD_PAIRS_VISIBLE; ++row) { @@ -649,18 +649,13 @@ void AssignmentPersistentData::ImplCommit() _rMapping.realloc( m_pImpl->aLogicalFieldNames.size() ); AliasProgrammaticPair* pPair = _rMapping.getArray(); - OUString sCurrent; - for ( auto aProgrammatic = m_pImpl->aLogicalFieldNames.cbegin(); - aProgrammatic != m_pImpl->aLogicalFieldNames.cend(); - ++aProgrammatic - ) + for (auto const& logicalFieldName : m_pImpl->aLogicalFieldNames) { - sCurrent = *aProgrammatic; - if ( m_pImpl->pConfigData->hasFieldAssignment( sCurrent ) ) + if ( m_pImpl->pConfigData->hasFieldAssignment(logicalFieldName) ) { // the user gave us an assignment for this field - pPair->ProgrammaticName = *aProgrammatic; - pPair->Alias = m_pImpl->pConfigData->getFieldAssignment( *aProgrammatic ); + pPair->ProgrammaticName = logicalFieldName; + pPair->Alias = m_pImpl->pConfigData->getFieldAssignment(logicalFieldName); ++pPair; } } @@ -687,13 +682,12 @@ void AssignmentPersistentData::ImplCommit() // AddressBookSourceDialog::loadConfiguration: inconsistence between field names and field assignments! assert(m_pImpl->aLogicalFieldNames.size() == m_pImpl->aFieldAssignments.size()); - auto aLogical = m_pImpl->aLogicalFieldNames.cbegin(); auto aAssignment = m_pImpl->aFieldAssignments.begin(); - for ( ; - aLogical != m_pImpl->aLogicalFieldNames.end(); - ++aLogical, ++aAssignment - ) - *aAssignment = m_pImpl->pConfigData->getFieldAssignment(*aLogical); + for (auto const& logicalFieldName : m_pImpl->aLogicalFieldNames) + { + *aAssignment = m_pImpl->pConfigData->getFieldAssignment(logicalFieldName); + ++aAssignment; + } } @@ -937,13 +931,10 @@ void AssignmentPersistentData::ImplCommit() } // adjust m_pImpl->aFieldAssignments - for ( auto aAdjust = m_pImpl->aFieldAssignments.begin(); - aAdjust != m_pImpl->aFieldAssignments.end(); - ++aAdjust - ) - if (!aAdjust->isEmpty()) - if (aColumnNameSet.end() == aColumnNameSet.find(*aAdjust)) - aAdjust->clear(); + for (auto & fieldAssignment : m_pImpl->aFieldAssignments) + if (!fieldAssignment.isEmpty()) + if (aColumnNameSet.end() == aColumnNameSet.find(fieldAssignment)) + fieldAssignment.clear(); } @@ -1127,13 +1118,12 @@ void AssignmentPersistentData::ImplCommit() assert(m_pImpl->aLogicalFieldNames.size() == m_pImpl->aFieldAssignments.size()); // set the field assignments - auto aLogical = m_pImpl->aLogicalFieldNames.cbegin(); auto aAssignment = m_pImpl->aFieldAssignments.cbegin(); - for ( ; - aLogical != m_pImpl->aLogicalFieldNames.end(); - ++aLogical, ++aAssignment - ) - m_pImpl->pConfigData->setFieldAssignment(*aLogical, *aAssignment); + for (auto const& logicalFieldName : m_pImpl->aLogicalFieldNames) + { + m_pImpl->pConfigData->setFieldAssignment(logicalFieldName, *aAssignment); + ++aAssignment; + } EndDialog(RET_OK); diff --git a/svtools/source/dialogs/roadmapwizard.cxx b/svtools/source/dialogs/roadmapwizard.cxx index dae6e40897bb..fc256f3bfcef 100644 --- a/svtools/source/dialogs/roadmapwizard.cxx +++ b/svtools/source/dialogs/roadmapwizard.cxx @@ -77,11 +77,17 @@ namespace svt sal_Int32 RoadmapWizardImpl::getStateIndexInPath( WizardTypes::WizardState _nState, const WizardPath& _rPath ) { sal_Int32 nStateIndexInPath = 0; - WizardPath::const_iterator aPathLoop = _rPath.begin(); - for ( ; aPathLoop != _rPath.end(); ++aPathLoop, ++nStateIndexInPath ) - if ( *aPathLoop == _nState ) + bool bFound = false; + for (auto const& path : _rPath) + { + if (path == _nState) + { + bFound = true; break; - if ( aPathLoop == _rPath.end() ) + } + ++nStateIndexInPath; + } + if (!bFound) nStateIndexInPath = -1; return nStateIndexInPath; } @@ -247,16 +253,13 @@ namespace svt bool bIncompletePath = false; if ( !m_pImpl->bActivePathIsDefinite ) { - for ( Paths::const_iterator aPathPos = m_pImpl->aPaths.begin(); - aPathPos != m_pImpl->aPaths.end(); - ++aPathPos - ) + for (auto const& path : m_pImpl->aPaths) { - if ( aPathPos->first == m_pImpl->nActivePath ) + if ( path.first == m_pImpl->nActivePath ) // it's the path we are just activating -> no need to check anything continue; // the index from which on both paths differ - sal_Int32 nDivergenceIndex = RoadmapWizardImpl::getFirstDifferentIndex( rActivePath, aPathPos->second ); + sal_Int32 nDivergenceIndex = RoadmapWizardImpl::getFirstDifferentIndex( rActivePath, path.second ); if ( nDivergenceIndex <= nCurrentStatePathIndex ) // they differ in an index which we have already left behind us // -> this is no conflict anymore @@ -379,13 +382,10 @@ namespace svt sal_Int32 nCurrentStatePathIndex = RoadmapWizardImpl::getStateIndexInPath( getCurrentState(), rActivePath ); size_t nPossiblePaths(0); - for ( Paths::const_iterator aPathPos = m_pImpl->aPaths.begin(); - aPathPos != m_pImpl->aPaths.end(); - ++aPathPos - ) + for (auto const& path : m_pImpl->aPaths) { // the index from which on both paths differ - sal_Int32 nDivergenceIndex = RoadmapWizardImpl::getFirstDifferentIndex( rActivePath, aPathPos->second ); + sal_Int32 nDivergenceIndex = RoadmapWizardImpl::getFirstDifferentIndex( rActivePath, path.second ); if ( nDivergenceIndex > nCurrentStatePathIndex ) // this path is still a possible path @@ -412,13 +412,13 @@ namespace svt ::std::vector< WizardState > aHistory; getStateHistory( aHistory ); bool bHaveEnabledState = false; - for ( ::std::vector< WizardState >::const_iterator state = aHistory.begin(); - state != aHistory.end() && !bHaveEnabledState; - ++state - ) + for (auto const& state : aHistory) { - if ( isStateEnabled( *state ) ) + if ( isStateEnabled(state) ) + { bHaveEnabledState = true; + break; + } } enableButtons( WizardButtonFlags::PREVIOUS, bHaveEnabledState ); @@ -530,17 +530,11 @@ namespace svt bool RoadmapWizard::knowsState( WizardState i_nState ) const { - for ( Paths::const_iterator path = m_pImpl->aPaths.begin(); - path != m_pImpl->aPaths.end(); - ++path - ) + for (auto const& path : m_pImpl->aPaths) { - for ( WizardPath::const_iterator state = path->second.begin(); - state != path->second.end(); - ++state - ) + for (auto const& state : path.second) { - if ( *state == i_nState ) + if ( state == i_nState ) return true; } } diff --git a/svtools/source/edit/editsyntaxhighlighter.cxx b/svtools/source/edit/editsyntaxhighlighter.cxx index bb4ad8838b3e..004cecdd18f5 100644 --- a/svtools/source/edit/editsyntaxhighlighter.cxx +++ b/svtools/source/edit/editsyntaxhighlighter.cxx @@ -167,10 +167,9 @@ void MultiLineEditSyntaxHighlight::UpdateData() GetTextEngine()->RemoveAttribs( nLine ); std::vector<HighlightPortion> aPortions; aHighlighter.getHighlightPortions( aLine, aPortions ); - for (std::vector<HighlightPortion>::iterator i(aPortions.begin()); - i != aPortions.end(); ++i) + for (auto const& portion : aPortions) { - GetTextEngine()->SetAttrib( TextAttribFontColor( GetColorValue(i->tokenType) ), nLine, i->nBegin, i->nEnd ); + GetTextEngine()->SetAttrib( TextAttribFontColor( GetColorValue(portion.tokenType) ), nLine, portion.nBegin, portion.nEnd ); } } GetTextView()->ShowCursor( false ); diff --git a/svtools/source/graphic/grfcache.cxx b/svtools/source/graphic/grfcache.cxx index a0fc0f09cf99..91668a3956a4 100644 --- a/svtools/source/graphic/grfcache.cxx +++ b/svtools/source/graphic/grfcache.cxx @@ -831,26 +831,19 @@ void GraphicCache::AddGraphicObject( && !maGraphicCache.empty() ) { - GraphicCacheEntryVector::iterator it = maGraphicCache.begin(); - while( !bInserted - && ( it != maGraphicCache.end() ) - ) + for (auto const& elem : maGraphicCache) { - if( (*it)->HasGraphicObjectReference( *pCopyObj ) ) + if( elem->HasGraphicObjectReference( *pCopyObj ) ) { - (*it)->AddGraphicObjectReference( rObj, rSubstitute ); + elem->AddGraphicObjectReference( rObj, rSubstitute ); bInserted = true; - } - else - { - ++it; + break; } } } if( !bInserted ) { - GraphicCacheEntryVector::iterator it = maGraphicCache.begin(); std::unique_ptr< GraphicID > apID; if( !pID ) @@ -858,32 +851,28 @@ void GraphicCache::AddGraphicObject( apID.reset( new GraphicID( rObj ) ); } - while( !bInserted - && ( it != maGraphicCache.end() ) - ) + for (auto const& elem : maGraphicCache) { - const GraphicID& rEntryID = (*it)->GetID(); + const GraphicID& rEntryID = elem->GetID(); if( pID ) { if( rEntryID.GetIDString() == *pID ) { - (*it)->TryToSwapIn(); + elem->TryToSwapIn(); // since pEntry->TryToSwapIn can modify our current list, we have to // iterate from beginning to add a reference to the appropriate // CacheEntry object; after this, quickly jump out of the outer iteration - for( GraphicCacheEntryVector::iterator jt = maGraphicCache.begin(); - !bInserted && jt != maGraphicCache.end(); - ++jt - ) + for (auto const& subelem : maGraphicCache) { - const GraphicID& rID = (*jt)->GetID(); + const GraphicID& rID = subelem->GetID(); if( rID.GetIDString() == *pID ) { - (*jt)->AddGraphicObjectReference( rObj, rSubstitute ); + subelem->AddGraphicObjectReference( rObj, rSubstitute ); bInserted = true; + break; } } @@ -898,13 +887,13 @@ void GraphicCache::AddGraphicObject( { if( rEntryID == *apID ) { - (*it)->AddGraphicObjectReference( rObj, rSubstitute ); + elem->AddGraphicObjectReference( rObj, rSubstitute ); bInserted = true; } } - if( !bInserted ) - ++it; + if(bInserted) + break; } } } @@ -998,10 +987,9 @@ void GraphicCache::SetCacheTimeout( sal_uLong nTimeoutSeconds ) aReleaseTime.addTime( ::salhelper::TTimeValue( nTimeoutSeconds, 0 ) ); } - for( GraphicDisplayCacheEntryVector::const_iterator it = maDisplayCache.begin(); - it != maDisplayCache.end(); ++it ) + for (auto const& elem : maDisplayCache) { - (*it)->SetReleaseTime( aReleaseTime ); + elem->SetReleaseTime( aReleaseTime ); } } @@ -1022,11 +1010,13 @@ bool GraphicCache::IsInDisplayCache( OutputDevice const * pOut, const Point& rPt if( pCacheEntry ) { - for( GraphicDisplayCacheEntryVector::const_iterator it = maDisplayCache.begin(); - !bFound && ( it != maDisplayCache.end() ); ++it ) + for (auto const& elem : maDisplayCache) { - if( (*it)->Matches( pOut, aPtPixel, aSzPixel, pCacheEntry, rAttr ) ) + if( elem->Matches( pOut, aPtPixel, aSzPixel, pCacheEntry, rAttr ) ) + { bFound = true; + break; + } } } @@ -1188,13 +1178,11 @@ GraphicCacheEntry* GraphicCache::ImplGetCacheEntry( const GraphicObject& rObj ) { GraphicCacheEntry* pRet = nullptr; - for( - GraphicCacheEntryVector::iterator it = maGraphicCache.begin(); - !pRet && it != maGraphicCache.end(); - ++it - ) { - if( (*it)->HasGraphicObjectReference( rObj ) ) { - pRet = *it; + for (auto const& elem : maGraphicCache) + { + if( elem->HasGraphicObjectReference( rObj ) ) + { + return elem; } } diff --git a/svtools/source/misc/dialogcontrolling.cxx b/svtools/source/misc/dialogcontrolling.cxx index a6ae0b394583..fbfa4613c6dc 100644 --- a/svtools/source/misc/dialogcontrolling.cxx +++ b/svtools/source/misc/dialogcontrolling.cxx @@ -105,11 +105,8 @@ namespace svt { if ( !m_pImpl->pEventFilter->payAttentionTo( _rEvent ) ) return; - for ( auto loop = m_pImpl->aConcernedWindows.begin(); - loop != m_pImpl->aConcernedWindows.end(); - ++loop - ) - impl_update( _rEvent, *(*loop) ); + for (auto const& concernedWindow : m_pImpl->aConcernedWindows) + impl_update(_rEvent, *concernedWindow); } diff --git a/svtools/source/misc/openfiledroptargetlistener.cxx b/svtools/source/misc/openfiledroptargetlistener.cxx index 802d326f480f..5aff47e67e82 100644 --- a/svtools/source/misc/openfiledroptargetlistener.cxx +++ b/svtools/source/misc/openfiledroptargetlistener.cxx @@ -161,20 +161,16 @@ bool OpenFileDropTargetListener::implts_IsDropFormatSupported( SotClipboardForma /* SAFE { */ SolarMutexGuard aGuard; - DataFlavorExVector::iterator aIter( m_aFormats.begin() ), aEnd( m_aFormats.end() ); - bool bRet = false; - - while ( aIter != aEnd ) + for (auto const& format : m_aFormats) { - if ( nFormat == (*aIter++).mnSotId ) + if (nFormat == format.mnSotId) { - bRet = true; - aIter = aEnd; + return true; } } /* } SAFE */ - return bRet; + return false; } void OpenFileDropTargetListener::implts_OpenFile( const OUString& rFilePath ) diff --git a/svtools/source/misc/stringtransfer.cxx b/svtools/source/misc/stringtransfer.cxx index 215157020af6..14e805fc60c9 100644 --- a/svtools/source/misc/stringtransfer.cxx +++ b/svtools/source/misc/stringtransfer.cxx @@ -74,12 +74,9 @@ namespace svt // check for a string format const DataFlavorExVector& rFormats = aClipboardData.GetDataFlavorExVector(); - for ( DataFlavorExVector::const_iterator aSearch = rFormats.begin(); - aSearch != rFormats.end(); - ++aSearch - ) + for (auto const& format : rFormats) { - if (SotClipboardFormatId::STRING == aSearch->mnSotId) + if (SotClipboardFormatId::STRING == format.mnSotId) { OUString sContent; bool bSuccess = aClipboardData.GetString( SotClipboardFormatId::STRING, sContent ); diff --git a/svtools/source/misc/transfer2.cxx b/svtools/source/misc/transfer2.cxx index 936ccb2301fe..701e9c870682 100644 --- a/svtools/source/misc/transfer2.cxx +++ b/svtools/source/misc/transfer2.cxx @@ -348,18 +348,15 @@ void TransferDataContainer::AddSupportedFormats() bool TransferDataContainer::GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ ) { - TDataCntnrEntryList::iterator aIter( pImpl->aFmtList.begin() ), - aEnd( pImpl->aFmtList.end() ); bool bFnd = false; SotClipboardFormatId nFmtId = SotExchange::GetFormat( rFlavor ); // test first the list - for( ; aIter != aEnd; ++aIter ) + for (auto const& format : pImpl->aFmtList) { - TDataCntnrEntry_Impl& rEntry = *aIter; - if( nFmtId == rEntry.nId ) + if( nFmtId == format.nId ) { - bFnd = SetAny( rEntry.aAny ); + bFnd = SetAny( format.aAny ); break; } } @@ -509,7 +506,7 @@ void TransferDataContainer::CopyAny( SotClipboardFormatId nFmt, bool TransferDataContainer::HasAnyData() const { - return pImpl->aFmtList.begin() != pImpl->aFmtList.end() || + return !pImpl->aFmtList.empty() || nullptr != pImpl->pBookmk; } diff --git a/svtools/source/table/defaultinputhandler.cxx b/svtools/source/table/defaultinputhandler.cxx index 880da1ab8f34..945919bf5140 100644 --- a/svtools/source/table/defaultinputhandler.cxx +++ b/svtools/source/table/defaultinputhandler.cxx @@ -87,19 +87,16 @@ namespace svt { namespace table // ask all other handlers bool handled = false; - for ( MouseFunctions::iterator handler = i_impl.aMouseFunctions.begin(); - ( handler != i_impl.aMouseFunctions.end() ) && !handled; - ++handler - ) + for (auto const& mouseFunction : i_impl.aMouseFunctions) { - if ( *handler == i_impl.pActiveFunction ) + if (mouseFunction == i_impl.pActiveFunction) // we already invoked this function continue; - switch ( (handler->get()->*i_handlerMethod)( i_control, i_event ) ) + switch ( (mouseFunction.get()->*i_handlerMethod)( i_control, i_event ) ) { case ActivateFunction: - i_impl.pActiveFunction = *handler; + i_impl.pActiveFunction = mouseFunction; handled = true; break; case ContinueFunction: diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx index 45d5b3bb5265..dbbd1d3db6fa 100644 --- a/svtools/source/table/tablecontrol_impl.cxx +++ b/svtools/source/table/tablecontrol_impl.cxx @@ -287,14 +287,11 @@ namespace svt { namespace table bool lcl_adjustSelectedRows( ::std::vector< RowPos >& io_selectionIndexes, RowPos const i_firstAffectedRowIndex, TableSize const i_offset ) { bool didChanges = false; - for ( ::std::vector< RowPos >::iterator selPos = io_selectionIndexes.begin(); - selPos != io_selectionIndexes.end(); - ++selPos - ) + for (auto & selectionIndex : io_selectionIndexes) { - if ( *selPos < i_firstAffectedRowIndex ) + if ( selectionIndex < i_firstAffectedRowIndex ) continue; - *selPos += i_offset; + selectionIndex += i_offset; didChanges = true; } return didChanges; @@ -1059,12 +1056,9 @@ namespace svt { namespace table if ( m_nLeftColumn > 0 ) { const long offsetPixel = m_aColumnWidths[ 0 ].getStart() - m_aColumnWidths[ m_nLeftColumn ].getStart(); - for ( ColumnPositions::iterator colPos = m_aColumnWidths.begin(); - colPos != m_aColumnWidths.end(); - ++colPos - ) + for (auto & columnWidth : m_aColumnWidths) { - colPos->move( offsetPixel ); + columnWidth.move( offsetPixel ); } } @@ -1866,12 +1860,9 @@ namespace svt { namespace table void TableControl_Impl::invalidateSelectedRows() { - for ( ::std::vector< RowPos >::iterator selRow = m_aSelectedRows.begin(); - selRow != m_aSelectedRows.end(); - ++selRow - ) + for (auto const& selectedRow : m_aSelectedRows) { - invalidateRow( *selRow ); + invalidateRow(selectedRow); } } @@ -2115,12 +2106,9 @@ namespace svt { namespace table // update our column positions // Do this *before* scrolling, as ScrollFlags::Update will trigger a paint, which already needs the correct // information in m_aColumnWidths - for ( ColumnPositions::iterator colPos = m_aColumnWidths.begin(); - colPos != m_aColumnWidths.end(); - ++colPos - ) + for (auto & columnWidth : m_aColumnWidths) { - colPos->move( nPixelDelta ); + columnWidth.move(nPixelDelta); } // scroll the window content (if supported and possible), or invalidate the complete window diff --git a/svtools/source/uno/statusbarcontroller.cxx b/svtools/source/uno/statusbarcontroller.cxx index fbd5f80001e6..c7cb62ac1903 100644 --- a/svtools/source/uno/statusbarcontroller.cxx +++ b/svtools/source/uno/statusbarcontroller.cxx @@ -195,14 +195,13 @@ void SAL_CALL StatusbarController::dispose() SolarMutexGuard aSolarMutexGuard; Reference< XStatusListener > xStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY ); Reference< XURLTransformer > xURLTransformer = getURLTransformer(); - URLToDispatchMap::iterator pIter = m_aListenerMap.begin(); css::util::URL aTargetURL; - while ( pIter != m_aListenerMap.end() ) + for (auto const& listener : m_aListenerMap) { try { - Reference< XDispatch > xDispatch( pIter->second ); - aTargetURL.Complete = pIter->first; + Reference< XDispatch > xDispatch(listener.second); + aTargetURL.Complete = listener.first; xURLTransformer->parseStrict( aTargetURL ); if ( xDispatch.is() && xStatusListener.is() ) @@ -211,8 +210,6 @@ void SAL_CALL StatusbarController::dispose() catch ( Exception& ) { } - - ++pIter; } // clear hash map @@ -258,13 +255,11 @@ void SAL_CALL StatusbarController::disposing( const EventObject& Source ) if ( !xDispatch.is() ) return; - URLToDispatchMap::iterator pIter = m_aListenerMap.begin(); - while ( pIter != m_aListenerMap.end() ) + for (auto & listener : m_aListenerMap) { // Compare references and release dispatch references if they are equal. - if ( xDispatch == pIter->second ) - pIter->second.clear(); - ++pIter; + if ( xDispatch == listener.second ) + listener.second.clear(); } } @@ -420,15 +415,14 @@ void StatusbarController::bindListener() if ( m_xContext.is() && xDispatchProvider.is() ) { xStatusListener.set( static_cast< OWeakObject* >( this ), UNO_QUERY ); - URLToDispatchMap::iterator pIter = m_aListenerMap.begin(); - while ( pIter != m_aListenerMap.end() ) + for (auto & listener : m_aListenerMap) { Reference< XURLTransformer > xURLTransformer = getURLTransformer(); css::util::URL aTargetURL; - aTargetURL.Complete = pIter->first; + aTargetURL.Complete = listener.first; xURLTransformer->parseStrict( aTargetURL ); - Reference< XDispatch > xDispatch( pIter->second ); + Reference< XDispatch > xDispatch(listener.second); if ( xDispatch.is() ) { // We already have a dispatch object => we have to requery. @@ -442,7 +436,7 @@ void StatusbarController::bindListener() } } - pIter->second.clear(); + listener.second.clear(); xDispatch.clear(); // Query for dispatch object. Old dispatch will be released with this, too. @@ -453,11 +447,10 @@ void StatusbarController::bindListener() catch ( Exception& ) { } - pIter->second = xDispatch; + listener.second = xDispatch; Listener aListener( aTargetURL, xDispatch ); aDispatchVector.push_back( aListener ); - ++pIter; } } } diff --git a/svtools/source/uno/toolboxcontroller.cxx b/svtools/source/uno/toolboxcontroller.cxx index e123da5a4c50..e4affa417bb5 100644 --- a/svtools/source/uno/toolboxcontroller.cxx +++ b/svtools/source/uno/toolboxcontroller.cxx @@ -243,15 +243,14 @@ void SAL_CALL ToolboxController::dispose() SolarMutexGuard aSolarMutexGuard; Reference< XStatusListener > xStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY ); - URLToDispatchMap::iterator pIter = m_aListenerMap.begin(); - while ( pIter != m_aListenerMap.end() ) + for (auto const& listener : m_aListenerMap) { try { - Reference< XDispatch > xDispatch( pIter->second ); + Reference< XDispatch > xDispatch( listener.second ); css::util::URL aTargetURL; - aTargetURL.Complete = pIter->first; + aTargetURL.Complete = listener.first; if ( m_xUrlTransformer.is() ) m_xUrlTransformer->parseStrict( aTargetURL ); @@ -262,7 +261,6 @@ void SAL_CALL ToolboxController::dispose() { } - ++pIter; } m_bDisposed = true; @@ -288,14 +286,12 @@ void SAL_CALL ToolboxController::disposing( const EventObject& Source ) if ( m_bDisposed ) return; - URLToDispatchMap::iterator pIter = m_aListenerMap.begin(); - while ( pIter != m_aListenerMap.end() ) + for (auto & listener : m_aListenerMap) { // Compare references and release dispatch references if they are equal. - Reference< XInterface > xIfac( pIter->second, UNO_QUERY ); + Reference< XInterface > xIfac(listener.second, UNO_QUERY); if ( xSource == xIfac ) - pIter->second.clear(); - ++pIter; + listener.second.clear(); } Reference< XInterface > xIfac( m_xFrame, UNO_QUERY ); @@ -481,15 +477,14 @@ void ToolboxController::bindListener() if ( m_xContext.is() && xDispatchProvider.is() ) { xStatusListener.set( static_cast< OWeakObject* >( this ), UNO_QUERY ); - URLToDispatchMap::iterator pIter = m_aListenerMap.begin(); - while ( pIter != m_aListenerMap.end() ) + for (auto & listener : m_aListenerMap) { css::util::URL aTargetURL; - aTargetURL.Complete = pIter->first; + aTargetURL.Complete = listener.first; if ( m_xUrlTransformer.is() ) m_xUrlTransformer->parseStrict( aTargetURL ); - Reference< XDispatch > xDispatch( pIter->second ); + Reference< XDispatch > xDispatch(listener.second); if ( xDispatch.is() ) { // We already have a dispatch object => we have to requery. @@ -503,7 +498,7 @@ void ToolboxController::bindListener() } } - pIter->second.clear(); + listener.second.clear(); xDispatch.clear(); // Query for dispatch object. Old dispatch will be released with this, too. @@ -514,11 +509,10 @@ void ToolboxController::bindListener() catch ( Exception& ) { } - pIter->second = xDispatch; + listener.second = xDispatch; Listener aListener( aTargetURL, xDispatch ); aDispatchVector.push_back( aListener ); - ++pIter; } } } @@ -570,15 +564,14 @@ void ToolboxController::unbindListener() return; Reference< XStatusListener > xStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY ); - URLToDispatchMap::iterator pIter = m_aListenerMap.begin(); - while ( pIter != m_aListenerMap.end() ) + for (auto & listener : m_aListenerMap) { css::util::URL aTargetURL; - aTargetURL.Complete = pIter->first; + aTargetURL.Complete = listener.first; if ( m_xUrlTransformer.is() ) m_xUrlTransformer->parseStrict( aTargetURL ); - Reference< XDispatch > xDispatch( pIter->second ); + Reference< XDispatch > xDispatch(listener.second); if ( xDispatch.is() ) { // We already have a dispatch object => we have to requery. @@ -591,8 +584,7 @@ void ToolboxController::unbindListener() { } } - pIter->second.clear(); - ++pIter; + listener.second.clear(); } } diff --git a/svtools/source/uno/unocontroltablemodel.cxx b/svtools/source/uno/unocontroltablemodel.cxx index c69e89f9b1fc..fd982321debd 100644 --- a/svtools/source/uno/unocontroltablemodel.cxx +++ b/svtools/source/uno/unocontroltablemodel.cxx @@ -223,12 +223,9 @@ namespace svt { namespace table // notify listeners ModellListeners aListeners( m_pImpl->m_aListeners ); - for ( ModellListeners::const_iterator loop = aListeners.begin(); - loop != aListeners.end(); - ++loop - ) + for (auto const& listener : aListeners) { - (*loop)->columnInserted(); + listener->columnInserted(); } } @@ -246,12 +243,9 @@ namespace svt { namespace table // notify listeners ModellListeners aListeners( m_pImpl->m_aListeners ); - for ( ModellListeners::const_iterator loop = aListeners.begin(); - loop != aListeners.end(); - ++loop - ) + for (auto const& listener : aListeners) { - (*loop)->columnRemoved(); + listener->columnRemoved(); } // dispose the column @@ -269,12 +263,9 @@ namespace svt { namespace table return; // dispose the column instances - for ( ColumnModels::const_iterator col = m_pImpl->aColumns.begin(); - col != m_pImpl->aColumns.end(); - ++col - ) + for (auto const& col : m_pImpl->aColumns) { - UnoGridColumnFacade* pColumn = dynamic_cast< UnoGridColumnFacade* >( col->get() ); + UnoGridColumnFacade* pColumn = dynamic_cast< UnoGridColumnFacade* >( col.get() ); if ( !pColumn ) { SAL_WARN( "svtools.uno", "UnoControlTableModel::removeAllColumns: illegal column implementation!" ); @@ -287,12 +278,9 @@ namespace svt { namespace table // notify listeners ModellListeners aListeners( m_pImpl->m_aListeners ); - for ( ModellListeners::const_iterator loop = aListeners.begin(); - loop != aListeners.end(); - ++loop - ) + for (auto const& listener : aListeners) { - (*loop)->allColumnsRemoved(); + listener->allColumnsRemoved(); } } @@ -300,12 +288,9 @@ namespace svt { namespace table void UnoControlTableModel::impl_notifyTableMetricsChanged() const { ModellListeners aListeners( m_pImpl->m_aListeners ); - for ( ModellListeners::const_iterator loop = aListeners.begin(); - loop != aListeners.end(); - ++loop - ) + for (auto const& listener : aListeners) { - (*loop)->tableMetricsChanged(); + listener->tableMetricsChanged(); } } @@ -741,13 +726,12 @@ namespace svt { namespace table ColPos UnoControlTableModel::getColumnPos( UnoGridColumnFacade const & i_column ) const { DBG_CHECK_ME(); - for ( ColumnModels::const_iterator col = m_pImpl->aColumns.begin(); - col != m_pImpl->aColumns.end(); - ++col - ) + ColPos nPos = 0; + for (auto const& col : m_pImpl->aColumns) { - if ( &i_column == col->get() ) - return col - m_pImpl->aColumns.begin(); + if ( &i_column == col.get() ) + return nPos; + ++nPos; } OSL_ENSURE( false, "UnoControlTableModel::getColumnPos: column not found!" ); return COL_INVALID; @@ -822,12 +806,9 @@ namespace svt { namespace table "UnoControlTableModel::notifyColumnChange: invalid column index!" ); ModellListeners aListeners( m_pImpl->m_aListeners ); - for ( ModellListeners::const_iterator loop = aListeners.begin(); - loop != aListeners.end(); - ++loop - ) + for (auto const& listener : aListeners) { - (*loop)->columnChanged( i_columnPos, i_attributeGroup ); + listener->columnChanged( i_columnPos, i_attributeGroup ); } } @@ -859,12 +840,9 @@ namespace svt { namespace table // multiplex the event to our own listeners ModellListeners aListeners( m_pImpl->m_aListeners ); - for ( ModellListeners::const_iterator loop = aListeners.begin(); - loop != aListeners.end(); - ++loop - ) + for (auto const& listener : aListeners) { - (*loop)->rowsInserted( i_event.FirstRow, i_event.LastRow ); + listener->rowsInserted( i_event.FirstRow, i_event.LastRow ); } } @@ -872,12 +850,9 @@ namespace svt { namespace table void UnoControlTableModel::notifyRowsRemoved( GridDataEvent const & i_event ) const { ModellListeners aListeners( m_pImpl->m_aListeners ); - for ( ModellListeners::const_iterator loop = aListeners.begin(); - loop != aListeners.end(); - ++loop - ) + for (auto const& listener : aListeners) { - (*loop)->rowsRemoved( i_event.FirstRow, i_event.LastRow ); + listener->rowsRemoved( i_event.FirstRow, i_event.LastRow ); } } @@ -888,12 +863,9 @@ namespace svt { namespace table RowPos const lastRow = i_event.FirstRow == -1 ? getRowCount() - 1 : i_event.LastRow; ModellListeners aListeners( m_pImpl->m_aListeners ); - for ( ModellListeners::const_iterator loop = aListeners.begin(); - loop != aListeners.end(); - ++loop - ) + for (auto const& listener : aListeners) { - (*loop)->cellsUpdated( firstRow, lastRow ); + listener->cellsUpdated( firstRow, lastRow ); } } @@ -901,12 +873,9 @@ namespace svt { namespace table void UnoControlTableModel::notifyAllDataChanged() const { ModellListeners aListeners( m_pImpl->m_aListeners ); - for ( ModellListeners::const_iterator loop = aListeners.begin(); - loop != aListeners.end(); - ++loop - ) + for (auto const& listener : aListeners) { - (*loop)->cellsUpdated( 0, getRowCount() - 1 ); + listener->cellsUpdated( 0, getRowCount() - 1 ); } } diff --git a/svtools/source/uno/unoimap.cxx b/svtools/source/uno/unoimap.cxx index 6a0fafaa93d8..65757ccbda15 100644 --- a/svtools/source/uno/unoimap.cxx +++ b/svtools/source/uno/unoimap.cxx @@ -673,15 +673,11 @@ bool SvUnoImageMap::fillImageMap( ImageMap& rMap ) const rMap.SetName( maName ); - auto aIter = maObjectList.begin(); - auto const aEnd = maObjectList.end(); - while( aIter != aEnd ) + for (auto const& elem : maObjectList) { - IMapObject* pNewMapObject = (*aIter)->createIMapObject(); + IMapObject* pNewMapObject = elem->createIMapObject(); rMap.InsertIMapObject( *pNewMapObject ); delete pNewMapObject; - - ++aIter; } return true; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits