summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2017-11-09 21:57:12 +0100
committerJulien Nabet <serval2412@yahoo.fr>2017-11-10 07:13:41 +0100
commit20dbb652d8bff996ac417f1c2c0894277c52497c (patch)
treee8a7ed9d1a5fca807973f6e4eaf0b320b413758e
parent65e578640f0258768a9253389356dbc63c845b7e (diff)
Replace lists by vectors in xichart/xipivot (sc)
+ use for range loops Change-Id: I598d09a363005781a89354a25ea6a87a2b7c8b62 Reviewed-on: https://gerrit.libreoffice.org/44568 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
-rw-r--r--sc/source/filter/excel/xichart.cxx40
-rw-r--r--sc/source/filter/excel/xipivot.cxx10
-rw-r--r--sc/source/filter/inc/xichart.hxx3
-rw-r--r--sc/source/filter/inc/xipivot.hxx5
4 files changed, 28 insertions, 30 deletions
diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx
index 627c8f998521..571c47467576 100644
--- a/sc/source/filter/excel/xichart.cxx
+++ b/sc/source/filter/excel/xichart.cxx
@@ -1906,12 +1906,12 @@ void XclImpChSeries::FinalizeDataFormats()
}
// copy series formatting to child objects
- for( XclImpChSerTrendLineList::iterator aLIt = maTrendLines.begin(), aLEnd = maTrendLines.end(); aLIt != aLEnd; ++aLIt )
+ for (auto const& trendLine : maTrendLines)
{
- (*aLIt)->SetDataFormat(mxSeriesFmt);
+ trendLine->SetDataFormat(mxSeriesFmt);
if (mxTitleLink->HasString())
{
- (*aLIt)->SetTrendlineName(mxTitleLink->GetString());
+ trendLine->SetTrendlineName(mxTitleLink->GetString());
}
}
for (auto const& it : m_ErrorBars)
@@ -1932,14 +1932,14 @@ void XclImpChSeries::FinalizeDataFormats()
}
// set text labels to data formats
- for( XclImpChTextMap::iterator aTIt = maLabels.begin(), aTEnd = maLabels.end(); aTIt != aTEnd; ++aTIt )
+ for (auto const& label : maLabels)
{
- sal_uInt16 nPointIdx = aTIt->first;
+ sal_uInt16 nPointIdx = label.first;
if (nPointIdx == EXC_CHDATAFORMAT_ALLPOINTS)
{
if (!mxSeriesFmt)
mxSeriesFmt = CreateDataFormat(nPointIdx, EXC_CHDATAFORMAT_DEFAULT);
- mxSeriesFmt->SetDataLabel(aTIt->second);
+ mxSeriesFmt->SetDataLabel(label.second);
}
else if (nPointIdx < EXC_CHDATAFORMAT_MAXPOINTCOUNT)
{
@@ -1955,7 +1955,7 @@ void XclImpChSeries::FinalizeDataFormats()
}
else
p = itr->second;
- p->SetDataLabel(aTIt->second);
+ p->SetDataLabel(label.second);
}
}
@@ -1964,8 +1964,8 @@ void XclImpChSeries::FinalizeDataFormats()
mxSeriesFmt->UpdateSeriesFormat( pTypeGroup->GetTypeInfo(), pTypeGroup->GetGroupFormat().get() );
// update data point formats (removes unchanged automatic formatting)
- for( XclImpChDataFormatMap::iterator aFIt = maPointFmts.begin(), aFEnd = maPointFmts.end(); aFIt != aFEnd; ++aFIt )
- aFIt->second->UpdatePointFormat( pTypeGroup->GetTypeInfo(), mxSeriesFmt.get() );
+ for (auto const& pointFormat : maPointFmts)
+ pointFormat.second->UpdatePointFormat( pTypeGroup->GetTypeInfo(), mxSeriesFmt.get() );
}
}
@@ -2070,10 +2070,10 @@ Reference< XDataSeries > XclImpChSeries::CreateDataSeries() const
}
// data point formatting
- for( XclImpChDataFormatMap::const_iterator aIt = maPointFmts.begin(), aEnd = maPointFmts.end(); aIt != aEnd; ++aIt )
+ for (auto const& pointFormat : maPointFmts)
{
- ScfPropertySet aPointProp = lclGetPointPropSet( xDataSeries, aIt->first );
- aIt->second->Convert( aPointProp, rTypeInfo, &aSeriesProp );
+ ScfPropertySet aPointProp = lclGetPointPropSet( xDataSeries, pointFormat.first );
+ pointFormat.second->Convert( aPointProp, rTypeInfo, &aSeriesProp );
}
}
return xDataSeries;
@@ -2147,11 +2147,11 @@ void XclImpChSeries::ConvertTrendLines( Reference< XDataSeries > const & xDataSe
Reference< XRegressionCurveContainer > xRegCurveCont( xDataSeries, UNO_QUERY );
if( xRegCurveCont.is() )
{
- for( XclImpChSerTrendLineList::const_iterator aIt = maTrendLines.begin(), aEnd = maTrendLines.end(); aIt != aEnd; ++aIt )
+ for (auto const& trendLine : maTrendLines)
{
try
{
- Reference< XRegressionCurve > xRegCurve = (*aIt)->CreateRegressionCurve();
+ Reference< XRegressionCurve > xRegCurve = trendLine->CreateRegressionCurve();
if( xRegCurve.is() )
{
xRegCurveCont->addRegressionCurve( xRegCurve );
@@ -2867,11 +2867,11 @@ void XclImpChTypeGroup::InsertDataSeries( Reference< XChartType > const & xChart
void XclImpChTypeGroup::CreateDataSeries( Reference< XChartType > const & xChartType, sal_Int32 nApiAxesSetIdx ) const
{
bool bSpline = false;
- for( XclImpChSeriesVec::const_iterator aIt = maSeries.begin(), aEnd = maSeries.end(); aIt != aEnd; ++aIt )
+ for (auto const& elem : maSeries)
{
- Reference< XDataSeries > xDataSeries = (*aIt)->CreateDataSeries();
+ Reference< XDataSeries > xDataSeries = elem->CreateDataSeries();
InsertDataSeries( xChartType, xDataSeries, nApiAxesSetIdx );
- bSpline |= (*aIt)->HasSpline();
+ bSpline |= elem->HasSpline();
}
// spline - TODO: set at single series (#i66858#)
if( bSpline && !maTypeInfo.IsSeriesFrameFormat() && (maTypeInfo.meTypeCateg != EXC_CHTYPECATEG_RADAR) )
@@ -3524,12 +3524,12 @@ void XclImpChAxesSet::Finalize()
{
// finalize chart type groups, erase empty groups without series
XclImpChTypeGroupMap aValidGroups;
- for( XclImpChTypeGroupMap::const_iterator aIt = maTypeGroups.begin(), aEnd = maTypeGroups.end(); aIt != aEnd; ++aIt )
+ for (auto const& typeGroup : maTypeGroups)
{
- XclImpChTypeGroupRef xTypeGroup = aIt->second;
+ XclImpChTypeGroupRef xTypeGroup = typeGroup.second;
xTypeGroup->Finalize();
if( xTypeGroup->IsValidGroup() )
- aValidGroups.emplace(aIt->first, xTypeGroup);
+ aValidGroups.emplace(typeGroup.first, xTypeGroup);
}
maTypeGroups.swap( aValidGroups );
}
diff --git a/sc/source/filter/excel/xipivot.cxx b/sc/source/filter/excel/xipivot.cxx
index 29373715858e..e63db6cdb1ab 100644
--- a/sc/source/filter/excel/xipivot.cxx
+++ b/sc/source/filter/excel/xipivot.cxx
@@ -1040,20 +1040,20 @@ void XclImpPTField::ConvertHiddenField( ScDPSaveData& rSaveData ) const
bool XclImpPTField::HasDataFieldInfo() const
{
- return !maDataInfoList.empty();
+ return !maDataInfoVector.empty();
}
void XclImpPTField::AddDataFieldInfo( const XclPTDataFieldInfo& rDataInfo )
{
OSL_ENSURE( maFieldInfo.mnAxes & EXC_SXVD_AXIS_DATA, "XclImpPTField::AddDataFieldInfo - no data field" );
- maDataInfoList.push_back( rDataInfo );
+ maDataInfoVector.push_back( rDataInfo );
}
void XclImpPTField::ConvertDataField( ScDPSaveData& rSaveData ) const
{
OSL_ENSURE( maFieldInfo.mnAxes & EXC_SXVD_AXIS_DATA, "XclImpPTField::ConvertDataField - no data field" );
- OSL_ENSURE( !maDataInfoList.empty(), "XclImpPTField::ConvertDataField - no data field info" );
- if (maDataInfoList.empty())
+ OSL_ENSURE( !maDataInfoVector.empty(), "XclImpPTField::ConvertDataField - no data field info" );
+ if (maDataInfoVector.empty())
return;
OUString aFieldName = GetFieldName();
@@ -1067,7 +1067,7 @@ void XclImpPTField::ConvertDataField( ScDPSaveData& rSaveData ) const
return;
}
- XclPTDataFieldInfoList::const_iterator aIt = maDataInfoList.begin(), aEnd = maDataInfoList.end();
+ auto aIt = maDataInfoVector.begin(), aEnd = maDataInfoVector.end();
ConvertDataField( *pSaveDim, *aIt );
diff --git a/sc/source/filter/inc/xichart.hxx b/sc/source/filter/inc/xichart.hxx
index dd8782eba495..bbba69a88cb5 100644
--- a/sc/source/filter/inc/xichart.hxx
+++ b/sc/source/filter/inc/xichart.hxx
@@ -821,7 +821,6 @@ private:
private:
typedef ::std::map<sal_uInt16, XclImpChDataFormatRef> XclImpChDataFormatMap;
typedef ::std::map<sal_uInt16, XclImpChTextRef> XclImpChTextMap;
- typedef ::std::list< XclImpChSerTrendLineRef > XclImpChSerTrendLineList;
typedef ::std::map<sal_uInt8, std::unique_ptr<XclImpChSerErrorBar>> XclImpChSerErrorBarMap;
XclChSeries maData; /// Contents of the CHSERIES record.
@@ -832,7 +831,7 @@ private:
XclImpChDataFormatRef mxSeriesFmt; /// CHDATAFORMAT group for series format.
XclImpChDataFormatMap maPointFmts; /// CHDATAFORMAT groups for data point formats.
XclImpChTextMap maLabels; /// Data point labels (CHTEXT groups).
- XclImpChSerTrendLineList maTrendLines; /// Trend line settings (CHSERTRENDLINE records).
+ std::vector< XclImpChSerTrendLineRef > maTrendLines; /// Trend line settings (CHSERTRENDLINE records).
XclImpChSerErrorBarMap m_ErrorBars; /// Error bar settings (CHSERERRORBAR records).
sal_uInt16 mnGroupIdx; /// Chart type group (CHTYPEGROUP group) this series is assigned to.
sal_uInt16 mnSeriesIdx; /// 0-based series index.
diff --git a/sc/source/filter/inc/xipivot.hxx b/sc/source/filter/inc/xipivot.hxx
index fedfd4e28704..f6fa56d3cc0b 100644
--- a/sc/source/filter/inc/xipivot.hxx
+++ b/sc/source/filter/inc/xipivot.hxx
@@ -22,7 +22,7 @@
#include "xlpivot.hxx"
#include "xiroot.hxx"
-#include <list>
+#include <vector>
#include <memory>
class ScDPSaveData;
@@ -279,14 +279,13 @@ private:
void ConvertDataFieldInfo( ScDPSaveDimension& rSaveDim, const XclPTDataFieldInfo& rDataInfo ) const;
private:
- typedef ::std::list< XclPTDataFieldInfo > XclPTDataFieldInfoList;
typedef ::std::vector< XclImpPTItemRef > XclImpPTItemVec;
const XclImpPivotTable& mrPTable; /// Parent pivot table containing this field.
XclPTFieldInfo maFieldInfo; /// General field info (SXVD record).
XclPTFieldExtInfo maFieldExtInfo; /// Extended field info (SXVDEX record).
XclPTPageFieldInfo maPageInfo; /// Page field info (entry from SXPI record).
- XclPTDataFieldInfoList maDataInfoList; /// List of extended data field info (SXDI records).
+ std::vector< XclPTDataFieldInfo > maDataInfoVector; /// Vector of extended data field info (SXDI records).
XclImpPTItemVec maItems; /// List of all items of this field.
};