summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-06-04 16:33:34 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-06-11 08:27:35 +0200
commit32a5477686ca68a452781119551a9f301e1b873c (patch)
treee3d09db2498fb442669a46356e18d5113f13d558
parented63df584e81892f20b6c15ebf9d41ffd16f4b46 (diff)
loplugin:useuniqueptr in ChartTypeTabPage
Change-Id: Id3b59a5cfc0502042f0038fe4eacc780c2463660 Reviewed-on: https://gerrit.libreoffice.org/55530 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--chart2/source/controller/dialogs/tp_ChartType.cxx48
-rw-r--r--chart2/source/controller/dialogs/tp_ChartType.hxx14
2 files changed, 26 insertions, 36 deletions
diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx
index ecd644fd8fc1..454d37282ddf 100644
--- a/chart2/source/controller/dialogs/tp_ChartType.cxx
+++ b/chart2/source/controller/dialogs/tp_ChartType.cxx
@@ -709,26 +709,26 @@ ChartTypeTabPage::ChartTypeTabPage(vcl::Window* pParent
}
}
- m_aChartTypeDialogControllerList.push_back(new ColumnChartDialogController() );
- m_aChartTypeDialogControllerList.push_back(new BarChartDialogController() );
- m_aChartTypeDialogControllerList.push_back(new PieChartDialogController() );
- m_aChartTypeDialogControllerList.push_back(new AreaChartDialogController() );
- m_aChartTypeDialogControllerList.push_back(new LineChartDialogController() );
+ m_aChartTypeDialogControllerList.emplace_back(new ColumnChartDialogController() );
+ m_aChartTypeDialogControllerList.emplace_back(new BarChartDialogController() );
+ m_aChartTypeDialogControllerList.emplace_back(new PieChartDialogController() );
+ m_aChartTypeDialogControllerList.emplace_back(new AreaChartDialogController() );
+ m_aChartTypeDialogControllerList.emplace_back(new LineChartDialogController() );
if (bEnableComplexChartTypes)
{
- m_aChartTypeDialogControllerList.push_back(new XYChartDialogController() );
- m_aChartTypeDialogControllerList.push_back(new BubbleChartDialogController() );
+ m_aChartTypeDialogControllerList.emplace_back(new XYChartDialogController() );
+ m_aChartTypeDialogControllerList.emplace_back(new BubbleChartDialogController() );
}
- m_aChartTypeDialogControllerList.push_back(new NetChartDialogController() );
+ m_aChartTypeDialogControllerList.emplace_back(new NetChartDialogController() );
if (bEnableComplexChartTypes)
{
- m_aChartTypeDialogControllerList.push_back(new StockChartDialogController() );
+ m_aChartTypeDialogControllerList.emplace_back(new StockChartDialogController() );
}
- m_aChartTypeDialogControllerList.push_back(new CombiColumnLineChartDialogController() );
+ m_aChartTypeDialogControllerList.emplace_back(new CombiColumnLineChartDialogController() );
SvtMiscOptions aOpts;
if ( aOpts.IsExperimentalMode() )
- m_aChartTypeDialogControllerList.push_back(new GL3DBarChartDialogController());
+ m_aChartTypeDialogControllerList.emplace_back(new GL3DBarChartDialogController());
for (auto const& elem : m_aChartTypeDialogControllerList)
{
@@ -752,25 +752,15 @@ ChartTypeTabPage::~ChartTypeTabPage()
void ChartTypeTabPage::dispose()
{
//delete all dialog controller
- for (auto const& elem : m_aChartTypeDialogControllerList)
- {
- delete elem;
- }
m_aChartTypeDialogControllerList.clear();
//delete all resource helper
- delete m_pDim3DLookResourceGroup;
- m_pDim3DLookResourceGroup = nullptr;
- delete m_pStackingResourceGroup;
- m_pStackingResourceGroup = nullptr;
- delete m_pSplineResourceGroup;
- m_pSplineResourceGroup = nullptr;
- delete m_pGeometryResourceGroup;
- m_pGeometryResourceGroup = nullptr;
- delete m_pSortByXValuesResourceGroup;
- m_pSortByXValuesResourceGroup = nullptr;
- delete m_pGL3DResourceGroup;
- m_pGL3DResourceGroup = nullptr;
+ m_pDim3DLookResourceGroup.reset();
+ m_pStackingResourceGroup.reset();
+ m_pSplineResourceGroup.reset();
+ m_pGeometryResourceGroup.reset();
+ m_pSortByXValuesResourceGroup.reset();
+ m_pGL3DResourceGroup.reset();
m_pFT_ChooseType.clear();
m_pMainTypeList.clear();
m_pSubTypeList.clear();
@@ -834,10 +824,10 @@ void ChartTypeTabPage::stateChanged( ChangingResource* /*pResource*/ )
ChartTypeDialogController* ChartTypeTabPage::getSelectedMainType()
{
ChartTypeDialogController* pTypeController = nullptr;
- std::vector< ChartTypeDialogController* >::size_type nM = static_cast< std::vector< ChartTypeDialogController* >::size_type >(
+ auto nM = static_cast< std::vector< ChartTypeDialogController* >::size_type >(
m_pMainTypeList->GetSelectedEntryPos() );
if( nM<m_aChartTypeDialogControllerList.size() )
- pTypeController = m_aChartTypeDialogControllerList[nM];
+ pTypeController = m_aChartTypeDialogControllerList[nM].get();
return pTypeController;
}
diff --git a/chart2/source/controller/dialogs/tp_ChartType.hxx b/chart2/source/controller/dialogs/tp_ChartType.hxx
index 0fd92b0ff5dd..2be2646761c0 100644
--- a/chart2/source/controller/dialogs/tp_ChartType.hxx
+++ b/chart2/source/controller/dialogs/tp_ChartType.hxx
@@ -77,16 +77,16 @@ private:
VclPtr<ListBox> m_pMainTypeList;
VclPtr<ValueSet> m_pSubTypeList;
- Dim3DLookResourceGroup* m_pDim3DLookResourceGroup;
- StackingResourceGroup* m_pStackingResourceGroup;
- SplineResourceGroup* m_pSplineResourceGroup;
- GeometryResourceGroup* m_pGeometryResourceGroup;
- SortByXValuesResourceGroup* m_pSortByXValuesResourceGroup;
- GL3DResourceGroup* m_pGL3DResourceGroup;
+ std::unique_ptr<Dim3DLookResourceGroup> m_pDim3DLookResourceGroup;
+ std::unique_ptr<StackingResourceGroup> m_pStackingResourceGroup;
+ std::unique_ptr<SplineResourceGroup> m_pSplineResourceGroup;
+ std::unique_ptr<GeometryResourceGroup> m_pGeometryResourceGroup;
+ std::unique_ptr<SortByXValuesResourceGroup> m_pSortByXValuesResourceGroup;
+ std::unique_ptr<GL3DResourceGroup> m_pGL3DResourceGroup;
css::uno::Reference< css::chart2::XChartDocument > m_xChartModel;
- std::vector< ChartTypeDialogController* > m_aChartTypeDialogControllerList;
+ std::vector< std::unique_ptr<ChartTypeDialogController> > m_aChartTypeDialogControllerList;
ChartTypeDialogController* m_pCurrentMainType;
sal_Int32 m_nChangingCalls;