summaryrefslogtreecommitdiff
path: root/svx/source/table
diff options
context:
space:
mode:
Diffstat (limited to 'svx/source/table')
-rw-r--r--svx/source/table/accessibletableshape.cxx8
-rw-r--r--svx/source/table/cell.cxx4
-rw-r--r--svx/source/table/propertyset.cxx4
-rw-r--r--svx/source/table/tabledesign.cxx67
-rw-r--r--svx/source/table/tablehandles.cxx5
-rw-r--r--svx/source/table/tablelayouter.cxx8
-rw-r--r--svx/source/table/tablemodel.cxx24
-rw-r--r--svx/source/table/tablerow.cxx8
-rw-r--r--svx/source/table/tableundo.cxx15
9 files changed, 52 insertions, 91 deletions
diff --git a/svx/source/table/accessibletableshape.cxx b/svx/source/table/accessibletableshape.cxx
index 5f4a82a0d00f..7a17b1027768 100644
--- a/svx/source/table/accessibletableshape.cxx
+++ b/svx/source/table/accessibletableshape.cxx
@@ -126,9 +126,9 @@ void AccessibleTableShapeImpl::dispose()
if( mxTable.is() )
{
//remove all the cell's acc object in table's dispose.
- for( AccessibleCellMap::iterator iter( maChildMap.begin() ); iter != maChildMap.end(); ++iter )
+ for( auto& rEntry : maChildMap )
{
- (*iter).second->dispose();
+ rEntry.second->dispose();
}
maChildMap.clear();
Reference< XModifyListener > xListener( this );
@@ -302,9 +302,9 @@ void SAL_CALL AccessibleTableShapeImpl::modified( const EventObject& /*aEvent*/
// all accessible cell instances still left in aTempChildMap must be disposed
// as they are no longer part of the table
- for( AccessibleCellMap::iterator iter( aTempChildMap.begin() ); iter != aTempChildMap.end(); ++iter )
+ for( auto& rEntry : aTempChildMap )
{
- (*iter).second->dispose();
+ rEntry.second->dispose();
}
//notify bridge to update the acc cache.
AccessibleTableShape *pAccTable = dynamic_cast <AccessibleTableShape *> (mxAccessible.get());
diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx
index 8eba9c1b4cd8..d2908706168a 100644
--- a/svx/source/table/cell.cxx
+++ b/svx/source/table/cell.cxx
@@ -260,9 +260,9 @@ namespace sdr
SfxItemSet aSet(pOutliner->GetParaAttribs(nPara));
aSet.Put(rSet);
- for (std::vector<sal_uInt16>::const_iterator aI = aCharWhichIds.begin(); aI != aCharWhichIds.end(); ++aI)
+ for (const auto& rWhichId : aCharWhichIds)
{
- pOutliner->RemoveCharAttribs(nPara, *aI);
+ pOutliner->RemoveCharAttribs(nPara, rWhichId);
}
pOutliner->SetParaAttribs(nPara, aSet);
diff --git a/svx/source/table/propertyset.cxx b/svx/source/table/propertyset.cxx
index 1b5e081e444b..643a4879d907 100644
--- a/svx/source/table/propertyset.cxx
+++ b/svx/source/table/propertyset.cxx
@@ -42,10 +42,8 @@ void FastPropertySetInfo::addProperties( const PropertyVector& rProps )
sal_uInt32 nIndex = maProperties.size();
sal_uInt32 nCount = rProps.size();
maProperties.resize( nIndex + nCount );
- PropertyVector::const_iterator aIter( rProps.begin() );
- while( nCount-- )
+ for( const Property& rProperty : rProps )
{
- const Property& rProperty = (*aIter++);
maProperties[nIndex] = rProperty;
maMap[ rProperty.Name ] = nIndex++;
}
diff --git a/svx/source/table/tabledesign.cxx b/svx/source/table/tabledesign.cxx
index 69701ad708d7..770944c0dc28 100644
--- a/svx/source/table/tabledesign.cxx
+++ b/svx/source/table/tabledesign.cxx
@@ -487,13 +487,10 @@ Any SAL_CALL TableDesignFamily::getByName( const OUString& rName )
{
SolarMutexGuard aGuard;
- const TableDesignStyleVector::const_iterator aEnd( maDesigns.end() );
- for( TableDesignStyleVector::const_iterator iter( maDesigns.begin() );
- iter != aEnd; ++iter)
- {
- if( (*iter)->getName() == rName )
- return Any( (*iter) );
- }
+ auto iter = std::find_if(maDesigns.begin(), maDesigns.end(),
+ [&rName](const Reference<XStyle>& rpStyle) { return rpStyle->getName() == rName; });
+ if (iter != maDesigns.end())
+ return Any( (*iter) );
throw NoSuchElementException();
}
@@ -506,10 +503,8 @@ Sequence< OUString > SAL_CALL TableDesignFamily::getElementNames()
Sequence< OUString > aRet( maDesigns.size() );
OUString* pNames = aRet.getArray();
- const TableDesignStyleVector::const_iterator aEnd( maDesigns.end() );
- for( TableDesignStyleVector::const_iterator iter( maDesigns.begin() );
- iter != aEnd; ++iter)
- *pNames++ = (*iter)->getName();
+ for( const auto& rpStyle : maDesigns )
+ *pNames++ = rpStyle->getName();
return aRet;
}
@@ -519,13 +514,8 @@ sal_Bool SAL_CALL TableDesignFamily::hasByName( const OUString& aName )
{
SolarMutexGuard aGuard;
- const TableDesignStyleVector::const_iterator aEnd( maDesigns.end() );
- for( TableDesignStyleVector::const_iterator iter( maDesigns.begin() );
- iter != aEnd; ++iter)
- if( (*iter)->getName() == aName )
- return true;
-
- return false;
+ return std::any_of(maDesigns.begin(), maDesigns.end(),
+ [&aName](const Reference<XStyle>& rpStyle) { return rpStyle->getName() == aName; });
}
@@ -580,11 +570,9 @@ void SAL_CALL TableDesignFamily::insertByName( const OUString& rName, const Any&
throw IllegalArgumentException();
xStyle->setName( rName );
- const TableDesignStyleVector::const_iterator aEnd( maDesigns.end() );
- for( TableDesignStyleVector::const_iterator iter( maDesigns.begin() );
- iter != aEnd; ++iter)
- if( (*iter)->getName() == rName )
- throw ElementExistException();
+ if (std::any_of(maDesigns.begin(), maDesigns.end(),
+ [&rName](const Reference<XStyle>& rpStyle) { return rpStyle->getName() == rName; }))
+ throw ElementExistException();
maDesigns.push_back( xStyle );
}
@@ -594,18 +582,14 @@ void SAL_CALL TableDesignFamily::removeByName( const OUString& rName )
{
SolarMutexGuard aGuard;
- const TableDesignStyleVector::const_iterator aEnd( maDesigns.end() );
- for( TableDesignStyleVector::iterator iter( maDesigns.begin() );
- iter != aEnd; ++iter)
+ auto iter = std::find_if(maDesigns.begin(), maDesigns.end(),
+ [&rName](const Reference<XStyle>& rpStyle) { return rpStyle->getName() == rName; });
+ if (iter != maDesigns.end())
{
- if( (*iter)->getName() == rName )
- {
- maDesigns.erase( iter );
- return;
- }
+ maDesigns.erase( iter );
+ return;
}
-
throw NoSuchElementException();
}
@@ -621,16 +605,13 @@ void SAL_CALL TableDesignFamily::replaceByName( const OUString& rName, const Any
if( !xStyle.is() )
throw IllegalArgumentException();
- const TableDesignStyleVector::const_iterator aEnd( maDesigns.end() );
- for( TableDesignStyleVector::iterator iter( maDesigns.begin() );
- iter != aEnd; ++iter)
+ auto iter = std::find_if(maDesigns.begin(), maDesigns.end(),
+ [&rName](const Reference<XStyle>& rpStyle) { return rpStyle->getName() == rName; });
+ if (iter != maDesigns.end())
{
- if( (*iter)->getName() == rName )
- {
- (*iter) = xStyle;
- xStyle->setName( rName );
- return;
- }
+ (*iter) = xStyle;
+ xStyle->setName( rName );
+ return;
}
throw NoSuchElementException();
@@ -662,9 +643,9 @@ void SAL_CALL TableDesignFamily::dispose( )
TableDesignStyleVector aDesigns;
aDesigns.swap( maDesigns );
- for( TableDesignStyleVector::iterator iter( aDesigns.begin() ); iter != aDesigns.end(); ++iter )
+ for( const auto& rStyle : aDesigns )
{
- Reference< XComponent > xComp( (*iter), UNO_QUERY );
+ Reference< XComponent > xComp( rStyle, UNO_QUERY );
if( xComp.is() )
xComp->dispose();
}
diff --git a/svx/source/table/tablehandles.cxx b/svx/source/table/tablehandles.cxx
index 4d2dec6fd78f..accbad2739d0 100644
--- a/svx/source/table/tablehandles.cxx
+++ b/svx/source/table/tablehandles.cxx
@@ -119,12 +119,9 @@ void TableEdgeHdl::getPolyPolygon(basegfx::B2DPolyPolygon& rVisible, basegfx::B2
basegfx::B2DPoint aStart(aOffset), aEnd(aOffset);
int nPos = mbHorizontal ? 0 : 1;
- TableEdgeVector::const_iterator aIter( maEdges.begin() );
- while( aIter != maEdges.end() )
+ for( const TableEdge& aEdge : maEdges )
{
- TableEdge aEdge(*aIter++);
-
aStart[nPos] = aOffset[nPos] + aEdge.mnStart;
aEnd[nPos] = aOffset[nPos] + aEdge.mnEnd;
diff --git a/svx/source/table/tablelayouter.cxx b/svx/source/table/tablelayouter.cxx
index 4012f2fa429a..5560d86e57e0 100644
--- a/svx/source/table/tablelayouter.cxx
+++ b/svx/source/table/tablelayouter.cxx
@@ -643,13 +643,11 @@ void TableLayouter::LayoutTableWidth( tools::Rectangle& rArea, bool bFit )
for( nCol = 1; nCol < nColCount; ++nCol )
{
bool bChanges = false;
- MergeableCellVector::iterator iter( aMergedCells[nCol].begin() );
const sal_Int32 nOldSize = maColumns[nCol].mnSize;
- while( iter != aMergedCells[nCol].end() )
+ for( const CellRef& xCell : aMergedCells[nCol] )
{
- CellRef xCell( (*iter++) );
sal_Int32 nMinWidth = xCell->getMinimumWidth();
for( sal_Int32 nMCol = nCol - xCell->getColumnSpan() + 1; (nMCol > 0) && (nMCol < nCol); ++nMCol )
@@ -806,10 +804,8 @@ void TableLayouter::LayoutTableHeight( tools::Rectangle& rArea, bool bFit )
bool bChanges = false;
sal_Int32 nOldSize = maRows[nRow].mnSize;
- MergeableCellVector::iterator iter( aMergedCells[nRow].begin() );
- while( iter != aMergedCells[nRow].end() )
+ for( const CellRef& xCell : aMergedCells[nRow] )
{
- CellRef xCell( (*iter++) );
sal_Int32 nMinHeight = xCell->getMinimumHeight();
for( sal_Int32 nMRow = nRow - xCell->getRowSpan() + 1; (nMRow > 0) && (nMRow < nRow); ++nMRow )
diff --git a/svx/source/table/tablemodel.cxx b/svx/source/table/tablemodel.cxx
index 1b934d7731b1..386d00b455b6 100644
--- a/svx/source/table/tablemodel.cxx
+++ b/svx/source/table/tablemodel.cxx
@@ -88,10 +88,8 @@ template< class Vec, class Iter, class Entry > static sal_Int32 insert_range( Ve
else
{
// insert
- sal_Int32 nFind = nIndex;
Iter aIter( rVector.begin() );
- while( nFind-- )
- ++aIter;
+ std::advance( aIter, nIndex );
Entry aEmpty;
rVector.insert( aIter, nCount, aEmpty );
@@ -499,17 +497,15 @@ void TableModel::disposing()
{
if( !maRows.empty() )
{
- RowVector::iterator aIter( maRows.begin() );
- while( aIter != maRows.end() )
- (*aIter++)->dispose();
+ for( auto& rpRow : maRows )
+ rpRow->dispose();
RowVector().swap(maRows);
}
if( !maColumns.empty() )
{
- ColumnVector::iterator aIter( maColumns.begin() );
- while( aIter != maColumns.end() )
- (*aIter++)->dispose();
+ for( auto& rpCol : maColumns )
+ rpCol->dispose();
ColumnVector().swap(maColumns);
}
@@ -1091,20 +1087,18 @@ void TableModel::merge( sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nColSpan, sal_
void TableModel::updateRows()
{
sal_Int32 nRow = 0;
- RowVector::iterator iter = maRows.begin();
- while( iter != maRows.end() )
+ for( auto& rpRow : maRows )
{
- (*iter++)->mnRow = nRow++;
+ rpRow->mnRow = nRow++;
}
}
void TableModel::updateColumns()
{
sal_Int32 nColumn = 0;
- ColumnVector::iterator iter = maColumns.begin();
- while( iter != maColumns.end() )
+ for( auto& rpCol : maColumns )
{
- (*iter++)->mnColumn = nColumn++;
+ rpCol->mnColumn = nColumn++;
}
}
diff --git a/svx/source/table/tablerow.cxx b/svx/source/table/tablerow.cxx
index d1dd1f371800..f7ca4d8d40d0 100644
--- a/svx/source/table/tablerow.cxx
+++ b/svx/source/table/tablerow.cxx
@@ -73,9 +73,8 @@ void TableRow::dispose()
mxTableModel.clear();
if( !maCells.empty() )
{
- CellVector::iterator aIter( maCells.begin() );
- while( aIter != maCells.end() )
- (*aIter++)->dispose();
+ for( auto& rpCell : maCells )
+ rpCell->dispose();
CellVector().swap(maCells);
}
}
@@ -128,8 +127,7 @@ void TableRow::removeColumns( sal_Int32 nIndex, sal_Int32 nCount )
if( (nIndex + nCount) < static_cast< sal_Int32 >( maCells.size() ) )
{
CellVector::iterator aBegin( maCells.begin() );
- while( nIndex-- && (aBegin != maCells.end()) )
- ++aBegin;
+ std::advance(aBegin, nIndex);
if( nCount > 1 )
{
diff --git a/svx/source/table/tableundo.cxx b/svx/source/table/tableundo.cxx
index 1f444ae0f660..c7f53e7c0306 100644
--- a/svx/source/table/tableundo.cxx
+++ b/svx/source/table/tableundo.cxx
@@ -155,9 +155,8 @@ void CellUndo::getDataFromCell( Data& rData )
static void Dispose( RowVector& rRows )
{
- RowVector::iterator aIter( rRows.begin() );
- while( aIter != rRows.end() )
- (*aIter++)->dispose();
+ for( auto& rpRow : rRows )
+ rpRow->dispose();
}
@@ -243,17 +242,15 @@ void RemoveRowUndo::Redo()
static void Dispose( ColumnVector& rCols )
{
- ColumnVector::iterator aIter( rCols.begin() );
- while( aIter != rCols.end() )
- (*aIter++)->dispose();
+ for( auto& rpCol : rCols )
+ rpCol->dispose();
}
static void Dispose( CellVector& rCells )
{
- CellVector::iterator aIter( rCells.begin() );
- while( aIter != rCells.end() )
- (*aIter++)->dispose();
+ for( auto& rpCell : rCells )
+ rpCell->dispose();
}