summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-11-10 08:54:33 +0200
committerNoel Grandin <noel@peralex.com>2015-11-10 09:41:53 +0200
commite0dec4c73b6ada7733726f756e4506a7e3114048 (patch)
tree90d92e9c24b7e2425a3be235786ff887ea8d84f6 /chart2
parent126103cd2ad057f3d6adf907114239820ead8df4 (diff)
chart2: replace boost::ptr_vector with std::vector<unique_ptr>
Change-Id: Ia5c35cbd54045a79e896832adf2dbe68c5facf1f
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/view/charttypes/GL3DBarChart.cxx28
-rw-r--r--chart2/source/view/inc/GL3DBarChart.hxx3
-rw-r--r--chart2/source/view/inc/GL3DPlotterBase.hxx5
-rw-r--r--chart2/source/view/main/ChartView.cxx4
4 files changed, 18 insertions, 22 deletions
diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index 5f7023397325..c8065348d5f7 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -63,17 +63,15 @@ float calculateTextWidth(const OUString& rText)
return rText.getLength() * 10;
}
-double findMaxValue(const boost::ptr_vector<VDataSeries>& rDataSeriesContainer)
+double findMaxValue(const std::vector<std::unique_ptr<VDataSeries> >& rDataSeriesContainer)
{
double nMax = 0.0;
- for (boost::ptr_vector<VDataSeries>::const_iterator itr = rDataSeriesContainer.begin(),
- itrEnd = rDataSeriesContainer.end(); itr != itrEnd; ++itr)
+ for (const std::unique_ptr<VDataSeries>& rDataSeries : rDataSeriesContainer)
{
- const VDataSeries& rDataSeries = *itr;
- sal_Int32 nPointCount = rDataSeries.getTotalPointCount();
+ sal_Int32 nPointCount = rDataSeries->getTotalPointCount();
for(sal_Int32 nIndex = 0; nIndex < nPointCount; ++nIndex)
{
- double nVal = rDataSeries.getYValue(nIndex);
+ double nVal = rDataSeries->getYValue(nIndex);
nMax = std::max(nMax, nVal);
}
}
@@ -599,7 +597,7 @@ GL3DBarChart::~GL3DBarChart()
mpWindow->setRenderer(NULL);
}
-void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSeriesContainer,
+void GL3DBarChart::create3DShapes(const std::vector<std::unique_ptr<VDataSeries> >& rDataSeriesContainer,
ExplicitCategoriesProvider& rCatProvider)
{
SharedResourceAccess aResGuard(maCond1, maCond2);
@@ -654,24 +652,22 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
}
else
{
- const VDataSeries& rFirstRow = *(rDataSeriesContainer.begin());
+ const VDataSeries& rFirstRow = *rDataSeriesContainer.begin()->get();
mnBarsInRow = rFirstRow.getTotalPointCount();
}
- for (boost::ptr_vector<VDataSeries>::const_iterator itr = rDataSeriesContainer.begin(),
- itrEnd = rDataSeriesContainer.end(); itr != itrEnd; ++itr)
+ for (const std::unique_ptr<VDataSeries>& rDataSeries : rDataSeriesContainer)
{
nYPos = nSeriesIndex * (BAR_SIZE_Y + BAR_DISTANCE_Y) + BAR_DISTANCE_Y;
- const VDataSeries& rDataSeries = *itr;
- sal_Int32 nPointCount = rDataSeries.getTotalPointCount();
+ sal_Int32 nPointCount = rDataSeries->getTotalPointCount();
nMaxPointCount = std::max(nMaxPointCount, nPointCount);
- bool bMappedFillProperty = rDataSeries.hasPropertyMapping("FillColor");
+ bool bMappedFillProperty = rDataSeries->hasPropertyMapping("FillColor");
// Create series name text object.
OUString aSeriesName =
DataSeriesHelper::getDataSeriesLabel(
- rDataSeries.getModel(), mxChartType->getRoleOfSequenceForSeriesLabel());
+ rDataSeries->getModel(), mxChartType->getRoleOfSequenceForSeriesLabel());
maSeriesNames.push_back(aSeriesName);
@@ -696,12 +692,12 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
{
if(bMappedFillProperty)
{
- double nPropVal = rDataSeries.getValueByProperty(nIndex, "FillColor");
+ double nPropVal = rDataSeries->getValueByProperty(nIndex, "FillColor");
if(!rtl::math::isNan(nPropVal))
nColor = static_cast<sal_uInt32>(nPropVal);
}
- float nVal = rDataSeries.getYValue(nIndex);
+ float nVal = rDataSeries->getYValue(nIndex);
if (rtl::math::isNan(nVal))
continue;
diff --git a/chart2/source/view/inc/GL3DBarChart.hxx b/chart2/source/view/inc/GL3DBarChart.hxx
index 5f68b27c33e1..419c67975245 100644
--- a/chart2/source/view/inc/GL3DBarChart.hxx
+++ b/chart2/source/view/inc/GL3DBarChart.hxx
@@ -13,7 +13,6 @@
#include <GL3DPlotterBase.hxx>
#include <vector>
-#include <boost/ptr_container/ptr_vector.hpp>
#include "VDataSeries.hxx"
#include <glm/glm.hpp>
@@ -71,7 +70,7 @@ public:
virtual ~GL3DBarChart();
- virtual void create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSeries,
+ virtual void create3DShapes(const std::vector<std::unique_ptr<VDataSeries>>& rDataSeries,
ExplicitCategoriesProvider& rCatProvider) override;
virtual void render() override;
diff --git a/chart2/source/view/inc/GL3DPlotterBase.hxx b/chart2/source/view/inc/GL3DPlotterBase.hxx
index ceea643e8854..c403389fc8f4 100644
--- a/chart2/source/view/inc/GL3DPlotterBase.hxx
+++ b/chart2/source/view/inc/GL3DPlotterBase.hxx
@@ -10,8 +10,9 @@
#ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_GL3DPLOTTERBASE_HXX
#define INCLUDED_CHART2_SOURCE_VIEW_INC_GL3DPLOTTERBASE_HXX
-#include <boost/ptr_container/ptr_vector.hpp>
#include "VDataSeries.hxx"
+#include <vector>
+#include <memory>
namespace chart {
@@ -22,7 +23,7 @@ class GL3DPlotterBase
public:
virtual ~GL3DPlotterBase();
- virtual void create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSeries,
+ virtual void create3DShapes(const std::vector<std::unique_ptr<VDataSeries> >& rDataSeries,
ExplicitCategoriesProvider& rCatProvider) = 0;
virtual void render() = 0;
};
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 975f3cfb10e2..34a54da10537 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -3403,7 +3403,7 @@ void ChartView::createShapes3D()
if( !xDataSeriesContainer.is() )
return;
- boost::ptr_vector<VDataSeries> aDataSeries;
+ std::vector<std::unique_ptr<VDataSeries> > aDataSeries;
uno::Sequence< uno::Reference< XDataSeries > > aSeriesList( xDataSeriesContainer->getDataSeries() );
for( sal_Int32 nS = 0; nS < aSeriesList.getLength(); ++nS )
{
@@ -3411,7 +3411,7 @@ void ChartView::createShapes3D()
if(!xDataSeries.is())
continue;
- aDataSeries.push_back(new VDataSeries(xDataSeries));
+ aDataSeries.push_back(std::make_unique<VDataSeries>(xDataSeries));
}
std::unique_ptr<ExplicitCategoriesProvider> pCatProvider(new ExplicitCategoriesProvider(xCooSys, mrChartModel));