[Libreoffice-commits] core.git: 2 commits - cui/source

Noel Grandin noel.grandin at collabora.co.uk
Thu Jun 21 06:27:29 UTC 2018


 cui/source/customize/macropg.cxx |    6 +++---
 cui/source/inc/backgrnd.hxx      |    6 +++---
 cui/source/inc/macropg.hxx       |    2 +-
 cui/source/tabpages/backgrnd.cxx |   17 +++++++----------
 4 files changed, 14 insertions(+), 17 deletions(-)

New commits:
commit c253fc8e8076f6528ff4b2c3d70de79a385e1c81
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Jun 20 15:46:19 2018 +0200

    loplugin:useuniqueptr in SvxBackgroundTabPage
    
    Change-Id: Icfabf2bcbe49142871d6bef70ce0d73ed371a5b3
    Reviewed-on: https://gerrit.libreoffice.org/56193
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/cui/source/inc/backgrnd.hxx b/cui/source/inc/backgrnd.hxx
index a67caba32a2a..b08e9b92d249 100644
--- a/cui/source/inc/backgrnd.hxx
+++ b/cui/source/inc/backgrnd.hxx
@@ -115,10 +115,10 @@ private:
     OUString    aBgdGraphicPath;
     OUString    aBgdGraphicFilter;
 
-    SvxBackgroundPage_Impl* pPageImpl;
-    SvxOpenGraphicDialog* pImportDlg;
+    std::unique_ptr<SvxBackgroundPage_Impl> pPageImpl;
+    std::unique_ptr<SvxOpenGraphicDialog> pImportDlg;
 
-    SvxBackgroundTable_Impl*    pTableBck_Impl;///< Items for Sw-Table must be corrected
+    std::unique_ptr<SvxBackgroundTable_Impl> pTableBck_Impl;///< Items for Sw-Table must be corrected
     std::unique_ptr<SvxBrushItem> pHighlighting;
 
     void                FillColorValueSets_Impl();
diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx
index 19874430deec..76f5a1567207 100644
--- a/cui/source/tabpages/backgrnd.cxx
+++ b/cui/source/tabpages/backgrnd.cxx
@@ -385,20 +385,17 @@ void SvxBackgroundTabPage::dispose()
     if (pPageImpl)
     {
         delete pPageImpl->pLoadIdle;
-        delete pPageImpl;
-        pPageImpl = nullptr;
+        pPageImpl.reset();
     }
 
-    delete pImportDlg;
-    pImportDlg = nullptr;
+    pImportDlg.reset();
 
     if( pTableBck_Impl)
     {
         delete pTableBck_Impl->pCellBrush;
         delete pTableBck_Impl->pRowBrush;
         delete pTableBck_Impl->pTableBrush;
-        delete pTableBck_Impl;
-        pTableBck_Impl = nullptr;
+        pTableBck_Impl.reset();
     }
 
     m_pAsGrid.clear();
@@ -532,7 +529,7 @@ void SvxBackgroundTabPage::Reset( const SfxItemSet* rSet )
                 DELETEZ( pTableBck_Impl->pTableBrush);
             }
             else
-                pTableBck_Impl = new SvxBackgroundTable_Impl();
+                pTableBck_Impl.reset( new SvxBackgroundTable_Impl() );
 
             pTableBck_Impl->nActPos = nValue;
 
@@ -1141,7 +1138,7 @@ IMPL_LINK_NOARG(SvxBackgroundTabPage, BrowseHdl_Impl, Button*, void)
     bool bHtml = 0 != ( nHtmlMode & HTMLMODE_ON );
 
     OUString aStrBrowse(get<vcl::Window>("findgraphicsft")->GetText());
-    pImportDlg = new SvxOpenGraphicDialog(aStrBrowse, GetFrameWeld());
+    pImportDlg.reset( new SvxOpenGraphicDialog(aStrBrowse, GetFrameWeld()) );
     if ( bHtml )
         pImportDlg->EnableLink(false);
     pImportDlg->SetPath( aBgdGraphicPath, m_pBtnLink->IsChecked() );
@@ -1163,7 +1160,7 @@ IMPL_LINK_NOARG(SvxBackgroundTabPage, BrowseHdl_Impl, Button*, void)
         pPageImpl->pLoadIdle->Start();
     }
     else
-        DELETEZ( pImportDlg );
+        pImportDlg.reset();
 }
 
 /** Delayed loading of the graphic.
@@ -1215,7 +1212,7 @@ IMPL_LINK( SvxBackgroundTabPage, LoadIdleHdl_Impl, Timer*, pIdle, void )
             }
 
             FileClickHdl_Impl(m_pBtnLink);
-            DELETEZ( pImportDlg );
+            pImportDlg.reset();
         }
     }
 }
commit 655e6386a4805c33492478e0c4dfe2f291f8a273
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Jun 20 15:44:16 2018 +0200

    loplugin:useuniqueptr in SvxMacroTabPage_
    
    Change-Id: I1720d624efee71611e8c2f7dab2aed22a0ecee10
    Reviewed-on: https://gerrit.libreoffice.org/56192
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx
index 6d87a95f73a5..dbba1ebe1aa2 100644
--- a/cui/source/customize/macropg.cxx
+++ b/cui/source/customize/macropg.cxx
@@ -220,7 +220,7 @@ SvxMacroTabPage_::SvxMacroTabPage_(vcl::Window* pParent, const OString& rID,
     bAppEvents(false),
     bInitialized(false)
 {
-    mpImpl = new SvxMacroTabPage_Impl( rAttrSet );
+    mpImpl.reset( new SvxMacroTabPage_Impl( rAttrSet ) );
 }
 
 SvxMacroTabPage_::~SvxMacroTabPage_()
@@ -230,7 +230,7 @@ SvxMacroTabPage_::~SvxMacroTabPage_()
 
 void SvxMacroTabPage_::dispose()
 {
-    DELETEZ( mpImpl );
+    mpImpl.reset();
     SfxTabPage::dispose();
 }
 
@@ -571,7 +571,7 @@ IMPL_LINK_NOARG( SvxMacroTabPage_, DoubleClickHdl_Impl, SvTreeListBox*, bool)
 // handler for double click on the listbox, and for the assign/delete buttons
 void SvxMacroTabPage_::GenericHandler_Impl( SvxMacroTabPage_* pThis, PushButton* pBtn )
 {
-    SvxMacroTabPage_Impl*    pImpl = pThis->mpImpl;
+    SvxMacroTabPage_Impl*    pImpl = pThis->mpImpl.get();
     SvHeaderTabListBox& rListBox = pImpl->pEventLB->GetListBox();
     SvTreeListEntry* pE = rListBox.FirstSelected();
     if( !pE || LISTBOX_ENTRY_NOTFOUND == rListBox.GetModel()->GetAbsPos( pE ) )
diff --git a/cui/source/inc/macropg.hxx b/cui/source/inc/macropg.hxx
index 040fcc7838d2..1144dc3d1898 100644
--- a/cui/source/inc/macropg.hxx
+++ b/cui/source/inc/macropg.hxx
@@ -65,7 +65,7 @@ class SvxMacroTabPage_ : public SfxTabPage
 
     css::uno::Reference< css::container::XNameReplace > m_xAppEvents;
 protected:
-    SvxMacroTabPage_Impl*      mpImpl;
+    std::unique_ptr<SvxMacroTabPage_Impl> mpImpl;
     css::uno::Reference< css::container::XNameReplace > m_xDocEvents;
     css::uno::Reference< css::util::XModifiable > m_xModifiable;
     EventsHash m_appEventsHash;


More information about the Libreoffice-commits mailing list