chart2/source/controller/dialogs/tp_ChartType.cxx     |   48 +++++++-----------
 chart2/source/controller/dialogs/tp_ChartType.hxx     |   14 ++---
 chart2/source/controller/dialogs/tp_PointGeometry.cxx |    5 -
 chart2/source/controller/dialogs/tp_PointGeometry.hxx |    2 
 chart2/source/controller/dialogs/tp_TitleRotation.cxx |    5 -
 chart2/source/controller/dialogs/tp_TitleRotation.hxx |    2 
 6 files changed, 32 insertions(+), 44 deletions(-)

New commits:
commit 32a5477686ca68a452781119551a9f301e1b873c
Author: Noel Grandin <noel.gran...@collabora.co.uk>
Date:   Mon Jun 4 16:33:34 2018 +0200

    loplugin:useuniqueptr in ChartTypeTabPage
    
    Change-Id: Id3b59a5cfc0502042f0038fe4eacc780c2463660
    Reviewed-on: https://gerrit.libreoffice.org/55530
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

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;
commit ed63df584e81892f20b6c15ebf9d41ffd16f4b46
Author: Noel Grandin <noel.gran...@collabora.co.uk>
Date:   Mon Jun 4 16:30:09 2018 +0200

    loplugin:useuniqueptr in SchAlignmentTabPage
    
    Change-Id: Ib457e6894d233fa4737bb4a6488b37c5455ee098
    Reviewed-on: https://gerrit.libreoffice.org/55529
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/chart2/source/controller/dialogs/tp_TitleRotation.cxx 
b/chart2/source/controller/dialogs/tp_TitleRotation.cxx
index d4521676529b..f2d60eac5f60 100644
--- a/chart2/source/controller/dialogs/tp_TitleRotation.cxx
+++ b/chart2/source/controller/dialogs/tp_TitleRotation.cxx
@@ -41,7 +41,7 @@ SchAlignmentTabPage::SchAlignmentTabPage(vcl::Window* pWindow,
     get(m_pLbTextDirection,"textdirLB");
     get(m_pFtABCD,"labelABCD");
     m_pCtrlDial->SetText(m_pFtABCD->GetText());
-    m_pOrientHlp = new svx::OrientationHelper(*m_pCtrlDial, *m_pNfRotate, 
*m_pCbStacked);
+    m_pOrientHlp.reset( new svx::OrientationHelper(*m_pCtrlDial, *m_pNfRotate, 
*m_pCbStacked) );
 
     m_pCbStacked->EnableTriState( false );
     m_pOrientHlp->Enable();
@@ -60,8 +60,7 @@ SchAlignmentTabPage::~SchAlignmentTabPage()
 
 void SchAlignmentTabPage::dispose()
 {
-    delete m_pOrientHlp;
-    m_pOrientHlp = nullptr;
+    m_pOrientHlp.reset();
     m_pCtrlDial.clear();
     m_pFtRotate.clear();
     m_pNfRotate.clear();
diff --git a/chart2/source/controller/dialogs/tp_TitleRotation.hxx 
b/chart2/source/controller/dialogs/tp_TitleRotation.hxx
index aa49e4ff5407..8af1a4f67b9a 100644
--- a/chart2/source/controller/dialogs/tp_TitleRotation.hxx
+++ b/chart2/source/controller/dialogs/tp_TitleRotation.hxx
@@ -35,7 +35,7 @@ private:
     VclPtr<FixedText>               m_pFtRotate;
     VclPtr<NumericField>            m_pNfRotate;
     VclPtr<TriStateBox>             m_pCbStacked;
-    svx::OrientationHelper*  m_pOrientHlp;
+    std::unique_ptr<svx::OrientationHelper>  m_pOrientHlp;
     VclPtr<FixedText>               m_pFtTextDirection;
     VclPtr<TextDirectionListBox>    m_pLbTextDirection;
     VclPtr<FixedText>               m_pFtABCD;
commit b3380825a51682d67a3c8b706d1d73e9bd5585cf
Author: Noel Grandin <noel.gran...@collabora.co.uk>
Date:   Mon Jun 4 16:28:57 2018 +0200

    loplugin:useuniqueptr in SchLayoutTabPage
    
    Change-Id: I8ba5a2e5800e88dcb6c17a8cf74bd315a9215918
    Reviewed-on: https://gerrit.libreoffice.org/55528
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/chart2/source/controller/dialogs/tp_PointGeometry.cxx 
b/chart2/source/controller/dialogs/tp_PointGeometry.cxx
index 2350c3eb3e5d..906ac1986446 100644
--- a/chart2/source/controller/dialogs/tp_PointGeometry.cxx
+++ b/chart2/source/controller/dialogs/tp_PointGeometry.cxx
@@ -33,7 +33,7 @@ SchLayoutTabPage::SchLayoutTabPage(vcl::Window* pWindow,const 
SfxItemSet& rInAtt
      : SfxTabPage(pWindow, "tp_ChartType", 
"modules/schart/ui/tp_ChartType.ui", &rInAttrs)
      , m_pGeometryResources(nullptr)
 {
-    m_pGeometryResources = new BarGeometryResources( this );
+    m_pGeometryResources.reset(new BarGeometryResources( this ));
 }
 
 SchLayoutTabPage::~SchLayoutTabPage()
@@ -43,8 +43,7 @@ SchLayoutTabPage::~SchLayoutTabPage()
 
 void SchLayoutTabPage::dispose()
 {
-    delete m_pGeometryResources;
-    m_pGeometryResources = nullptr;
+    m_pGeometryResources.reset();
     SfxTabPage::dispose();
 }
 
diff --git a/chart2/source/controller/dialogs/tp_PointGeometry.hxx 
b/chart2/source/controller/dialogs/tp_PointGeometry.hxx
index f095435bf7a9..f9cfad788f33 100644
--- a/chart2/source/controller/dialogs/tp_PointGeometry.hxx
+++ b/chart2/source/controller/dialogs/tp_PointGeometry.hxx
@@ -37,7 +37,7 @@ public:
     virtual void Reset(const SfxItemSet* rInAttrs) override;
 
 private:
-    BarGeometryResources*   m_pGeometryResources;
+    std::unique_ptr<BarGeometryResources> m_pGeometryResources;
 };
 
 } //namespace chart
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to