summaryrefslogtreecommitdiff
path: root/writerfilter/source/dmapper/DomainMapperTableManager.cxx
diff options
context:
space:
mode:
authorArkadiy Illarionov <qarkai@gmail.com>2018-09-29 19:35:12 +0300
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-09-29 21:14:35 +0200
commit65b00f316517b0f570b6aff30e70d95d4d543c03 (patch)
tree57793ade4859169f33ee5d8672872d53b51ba1c5 /writerfilter/source/dmapper/DomainMapperTableManager.cxx
parent618d474f059a75c2ac04df16c830d71a88690118 (diff)
Simplify containers iterations in w*
Use range-based loop or replace with STL functions. Change-Id: Ie1e169f9d2d44e188180164bd1f93af43740425d Reviewed-on: https://gerrit.libreoffice.org/61141 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'writerfilter/source/dmapper/DomainMapperTableManager.cxx')
-rw-r--r--writerfilter/source/dmapper/DomainMapperTableManager.cxx23
1 files changed, 7 insertions, 16 deletions
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index ed7dfebe97c4..f76f28dcac1f 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -35,6 +35,7 @@
#include "DomainMapper.hxx"
#include <rtl/math.hxx>
#include <sal/log.hxx>
+#include <numeric>
namespace writerfilter {
namespace dmapper {
@@ -562,21 +563,19 @@ void DomainMapperTableManager::endOfRowAction()
IntVectorPtr pCellWidths = getCurrentCellWidths( );
if(!m_nTableWidth && pTableGrid->size())
{
- ::std::vector<sal_Int32>::const_iterator aCellIter = pTableGrid->begin();
-
#ifdef DEBUG_WRITERFILTER
TagLogger::getInstance().startElement("tableWidth");
#endif
- while( aCellIter != pTableGrid->end() )
+ for( const auto& rCell : *pTableGrid )
{
#ifdef DEBUG_WRITERFILTER
TagLogger::getInstance().startElement("col");
- TagLogger::getInstance().attribute("width", *aCellIter);
+ TagLogger::getInstance().attribute("width", rCell);
TagLogger::getInstance().endElement();
#endif
- m_nTableWidth = o3tl::saturating_add(m_nTableWidth, *aCellIter++);
+ m_nTableWidth = o3tl::saturating_add(m_nTableWidth, rCell);
}
if (m_nTableWidth > 0 && !m_bTableSizeTypeInserted)
@@ -601,26 +600,18 @@ void DomainMapperTableManager::endOfRowAction()
#ifdef DEBUG_WRITERFILTER
TagLogger::getInstance().startElement("gridSpans");
{
- ::std::vector<sal_Int32>::const_iterator aGridSpanIter = pCurrentSpans->begin();
- ::std::vector<sal_Int32>::const_iterator aGridSpanIterEnd = pCurrentSpans->end();
-
- while (aGridSpanIter != aGridSpanIterEnd)
+ for (const auto& rGridSpan : *pCurrentSpans)
{
TagLogger::getInstance().startElement("gridSpan");
- TagLogger::getInstance().attribute("span", *aGridSpanIter);
+ TagLogger::getInstance().attribute("span", rGridSpan);
TagLogger::getInstance().endElement();
-
- ++aGridSpanIter;
}
}
TagLogger::getInstance().endElement();
#endif
//calculate number of used grids - it has to match the size of m_aTableGrid
- size_t nGrids = 0;
- ::std::vector<sal_Int32>::const_iterator aGridSpanIter = pCurrentSpans->begin();
- for( ; aGridSpanIter != pCurrentSpans->end(); ++aGridSpanIter)
- nGrids += *aGridSpanIter;
+ size_t nGrids = std::accumulate(pCurrentSpans->begin(), pCurrentSpans->end(), sal::static_int_cast<size_t>(0));
// sj: the grid is having no units... they is containing only relative values.
// a table with a grid of "1:2:1" looks identical as if the table is having