diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2018-02-08 11:09:15 +0100 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2018-02-08 18:31:34 +0100 |
commit | 0fb4ae8767fa5ff791cd42934b4215011a269eb0 (patch) | |
tree | 90c10a3b8f566d4f008675f2dbf5b7b07af8158e /svtools/source/table/tablecontrol_impl.cxx | |
parent | 275c1e0a05c1d31c9d83a246082a59db3119059d (diff) |
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 <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'svtools/source/table/tablecontrol_impl.cxx')
-rw-r--r-- | svtools/source/table/tablecontrol_impl.cxx | 30 |
1 files changed, 9 insertions, 21 deletions
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 |