desktop/source/deployment/gui/dp_gui_extlistbox.cxx   |   12 ++++-----
 desktop/source/deployment/gui/dp_gui_extlistbox.hxx   |    4 +--
 desktop/source/deployment/gui/dp_gui_updatedialog.cxx |   22 ++++++----------
 desktop/source/deployment/gui/dp_gui_updatedialog.hxx |    4 +--
 sd/source/ui/animations/CustomAnimationDialog.cxx     |   24 ++++++++----------
 sd/source/ui/animations/CustomAnimationDialog.hxx     |    6 ++--
 sd/source/ui/animations/CustomAnimationPane.cxx       |   12 ++++-----
 sd/source/ui/animations/CustomAnimationPane.hxx       |    2 -
 8 files changed, 39 insertions(+), 47 deletions(-)

New commits:
commit e5dfdbcc2084bfdb213afbe03d00136e93d5c4d2
Author: Noel Grandin <noel.gran...@collabora.co.uk>
Date:   Thu Jun 21 15:34:16 2018 +0200

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

diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx 
b/sd/source/ui/animations/CustomAnimationDialog.cxx
index 224bf1223bc1..fbcdad9097c9 100644
--- a/sd/source/ui/animations/CustomAnimationDialog.cxx
+++ b/sd/source/ui/animations/CustomAnimationDialog.cxx
@@ -2167,9 +2167,9 @@ CustomAnimationDialog::CustomAnimationDialog(vcl::Window* 
pParent, STLPropertySe
     sal_uInt16 nTimingId = mpTabControl->GetPageId("timing");
     sal_uInt16 nTextAnimId = mpTabControl->GetPageId("textanim");
 
-    mpEffectTabPage = VclPtr<CustomAnimationEffectTabPage>::Create( 
mpTabControl, mpSet );
+    mpEffectTabPage = VclPtr<CustomAnimationEffectTabPage>::Create( 
mpTabControl, mpSet.get() );
     mpTabControl->SetTabPage( nEffectId, mpEffectTabPage );
-    mpDurationTabPage = VclPtr<CustomAnimationDurationTabPage>::Create( 
mpTabControl, mpSet );
+    mpDurationTabPage = VclPtr<CustomAnimationDurationTabPage>::Create( 
mpTabControl, mpSet.get() );
     mpTabControl->SetTabPage( nTimingId, mpDurationTabPage );
 
     bool bHasText = false;
@@ -2178,7 +2178,7 @@ CustomAnimationDialog::CustomAnimationDialog(vcl::Window* 
pParent, STLPropertySe
 
     if( bHasText )
     {
-        mpTextAnimTabPage = VclPtr<CustomAnimationTextAnimTabPage>::Create( 
mpTabControl, mpSet );
+        mpTextAnimTabPage = VclPtr<CustomAnimationTextAnimTabPage>::Create( 
mpTabControl, mpSet.get() );
         mpTabControl->SetTabPage( nTextAnimId, mpTextAnimTabPage );
     }
     else
@@ -2202,8 +2202,8 @@ void CustomAnimationDialog::dispose()
     mpDurationTabPage.disposeAndClear();
     mpTextAnimTabPage.disposeAndClear();
 
-    delete mpSet;
-    delete mpResultSet;
+    mpSet.reset();
+    mpResultSet.reset();
 
     mpTabControl.clear();
     TabDialog::dispose();
@@ -2211,23 +2211,21 @@ void CustomAnimationDialog::dispose()
 
 STLPropertySet* CustomAnimationDialog::getResultSet()
 {
-    delete mpResultSet;
-
     mpResultSet = createDefaultSet();
 
-    mpEffectTabPage->update( mpResultSet );
-    mpDurationTabPage->update( mpResultSet );
+    mpEffectTabPage->update( mpResultSet.get() );
+    mpDurationTabPage->update( mpResultSet.get() );
     if( mpTextAnimTabPage )
-        mpTextAnimTabPage->update( mpResultSet );
+        mpTextAnimTabPage->update( mpResultSet.get() );
 
-    return mpResultSet;
+    return mpResultSet.get();
 }
 
-STLPropertySet* CustomAnimationDialog::createDefaultSet()
+std::unique_ptr<STLPropertySet> CustomAnimationDialog::createDefaultSet()
 {
     Any aEmpty;
 
-    STLPropertySet* pSet = new STLPropertySet();
+    std::unique_ptr<STLPropertySet> pSet(new STLPropertySet());
     pSet->setPropertyDefaultValue( nHandleMaxParaDepth, makeAny( sal_Int32(-1) 
) );
 
     pSet->setPropertyDefaultValue( nHandleHasAfterEffect, makeAny( false ) );
diff --git a/sd/source/ui/animations/CustomAnimationDialog.hxx 
b/sd/source/ui/animations/CustomAnimationDialog.hxx
index 2ad30fb2bcb1..14f605b2984f 100644
--- a/sd/source/ui/animations/CustomAnimationDialog.hxx
+++ b/sd/source/ui/animations/CustomAnimationDialog.hxx
@@ -148,11 +148,11 @@ public:
 
     STLPropertySet* getResultSet();
 
-    static STLPropertySet* createDefaultSet();
+    static std::unique_ptr<STLPropertySet> createDefaultSet();
 
 private:
-    STLPropertySet* mpSet;
-    STLPropertySet* mpResultSet;
+    std::unique_ptr<STLPropertySet> mpSet;
+    std::unique_ptr<STLPropertySet> mpResultSet;
 
     VclPtr<TabControl> mpTabControl;
 
diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx 
b/sd/source/ui/animations/CustomAnimationPane.cxx
index 2421d51ec461..a3a3d5d44dc3 100644
--- a/sd/source/ui/animations/CustomAnimationPane.cxx
+++ b/sd/source/ui/animations/CustomAnimationPane.cxx
@@ -917,7 +917,7 @@ void CustomAnimationPane::UpdateLook()
     }
 }
 
-void addValue( STLPropertySet* pSet, sal_Int32 nHandle, const Any& rValue )
+void addValue( std::unique_ptr<STLPropertySet>& pSet, sal_Int32 nHandle, const 
Any& rValue )
 {
     switch( pSet->getPropertyState( nHandle ) )
     {
@@ -1122,9 +1122,9 @@ static bool hasVisibleShape( const Reference< XShape >& 
xShape )
     return true;
 }
 
-STLPropertySet* CustomAnimationPane::createSelectionSet()
+std::unique_ptr<STLPropertySet> CustomAnimationPane::createSelectionSet()
 {
-    STLPropertySet* pSet = CustomAnimationDialog::createDefaultSet();
+    std::unique_ptr<STLPropertySet> pSet = 
CustomAnimationDialog::createDefaultSet();
 
     pSet->setPropertyValue( nHandleCurrentPage, makeAny( mxCurrentPage ) );
 
@@ -1666,13 +1666,13 @@ void CustomAnimationPane::changeSelection( 
STLPropertySet const * pResultSet, ST
 
 void CustomAnimationPane::showOptions(const OString& sPage)
 {
-    STLPropertySet* pSet = createSelectionSet();
+    std::unique_ptr<STLPropertySet> pSet = createSelectionSet();
 
-    VclPtrInstance< CustomAnimationDialog > pDlg(this, pSet, sPage);
+    VclPtrInstance< CustomAnimationDialog > pDlg(this, pSet.get(), sPage);
     if( pDlg->Execute() )
     {
         addUndo();
-        changeSelection( pDlg->getResultSet(), pSet );
+        changeSelection( pDlg->getResultSet(), pSet.get() );
         updateControls();
     }
 }
diff --git a/sd/source/ui/animations/CustomAnimationPane.hxx 
b/sd/source/ui/animations/CustomAnimationPane.hxx
index 086b717dbc84..f1aff2e25cdc 100644
--- a/sd/source/ui/animations/CustomAnimationPane.hxx
+++ b/sd/source/ui/animations/CustomAnimationPane.hxx
@@ -109,7 +109,7 @@ private:
     void moveSelection( bool bUp );
     void onPreview( bool bForcePreview );
 
-    STLPropertySet* createSelectionSet();
+    std::unique_ptr<STLPropertySet> createSelectionSet();
     void changeSelection( STLPropertySet const * pResultSet, STLPropertySet 
const * pOldSet );
 
     static css::uno::Any getProperty1Value( sal_Int32 nType, const 
CustomAnimationEffectPtr& pEffect );
commit b9426828aefad95aace7f8935ef5dbd6a4664091
Author: Noel Grandin <noel.gran...@collabora.co.uk>
Date:   Thu Jun 21 10:45:32 2018 +0200

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

diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx 
b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
index 60bc41d003e5..5df9f5574093 100644
--- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
@@ -224,8 +224,8 @@ void ExtensionBox_Impl::Init()
 
     m_xRemoveListener = new ExtensionRemovedListener( this );
 
-    m_pLocale = new lang::Locale( 
Application::GetSettings().GetLanguageTag().getLocale() );
-    m_pCollator = new CollatorWrapper( 
::comphelper::getProcessComponentContext() );
+    m_pLocale.reset( new lang::Locale( 
Application::GetSettings().GetLanguageTag().getLocale() ) );
+    m_pCollator.reset( new CollatorWrapper( 
::comphelper::getProcessComponentContext() ) );
     m_pCollator->loadDefaultCollator( *m_pLocale, 
i18n::CollatorOptions::CollatorOptions_IGNORE_CASE );
 
     Show();
@@ -256,8 +256,8 @@ void ExtensionBox_Impl::dispose()
 
     m_xRemoveListener.clear();
 
-    delete m_pLocale;
-    delete m_pCollator;
+    m_pLocale.reset();
+    m_pCollator.reset();
     ::svt::IExtensionListBox::dispose();
 }
 
@@ -841,7 +841,7 @@ bool ExtensionBox_Impl::FindEntryPos( const TEntry_Impl& 
rEntry, const long nSta
 
     if ( nStart == nEnd )
     {
-        eCompare = rEntry->CompareTo( m_pCollator, m_vEntries[ nStart ] );
+        eCompare = rEntry->CompareTo( m_pCollator.get(), m_vEntries[ nStart ] 
);
         if ( eCompare < 0 )
             return false;
         else if ( eCompare == 0 )
@@ -862,7 +862,7 @@ bool ExtensionBox_Impl::FindEntryPos( const TEntry_Impl& 
rEntry, const long nSta
     }
 
     const long nMid = nStart + ( ( nEnd - nStart ) / 2 );
-    eCompare = rEntry->CompareTo( m_pCollator, m_vEntries[ nMid ] );
+    eCompare = rEntry->CompareTo( m_pCollator.get(), m_vEntries[ nMid ] );
 
     if ( eCompare < 0 )
         return FindEntryPos( rEntry, nStart, nMid-1, nPos );
diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx 
b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx
index 8a2ede5822ca..356a4ff2e238 100644
--- a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx
+++ b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx
@@ -140,8 +140,8 @@ class ExtensionBox_Impl : public ::svt::IExtensionListBox
     std::vector< TEntry_Impl > m_vEntries;
     std::vector< TEntry_Impl > m_vRemovedEntries;
 
-    css::lang::Locale    *m_pLocale;
-    CollatorWrapper      *m_pCollator;
+    std::unique_ptr<css::lang::Locale> m_pLocale;
+    std::unique_ptr<CollatorWrapper>   m_pCollator;
 
     //Holds weak references to extensions to which is we have added an 
XEventListener
     std::vector< css::uno::WeakReference<
diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx 
b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
index 37513af9e031..852addaaa829 100644
--- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
+++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
@@ -548,14 +548,8 @@ void UpdateDialog::dispose()
 {
     storeIgnoredUpdates();
 
-    for (auto const& listboxEntry : m_ListboxEntries)
-    {
-        delete listboxEntry;
-    }
-    for (auto const& ignoredUpdate : m_ignoredUpdates)
-    {
-        delete ignoredUpdate;
-    }
+    m_ListboxEntries.clear();
+    m_ignoredUpdates.clear();
     m_pUpdates.disposeAndClear();
     m_pchecking.clear();
     m_pthrobber.clear();
@@ -719,7 +713,7 @@ void UpdateDialog::addEnabledUpdate( OUString const & name,
     UpdateDialog::Index *pEntry = new UpdateDialog::Index( ENABLED_UPDATE, 
nIndex, name );
 
     m_enabledUpdates.push_back( data );
-    m_ListboxEntries.push_back( pEntry );
+    m_ListboxEntries.emplace_back( pEntry );
 
     if ( ! isIgnoredUpdate( pEntry ) )
     {
@@ -742,7 +736,7 @@ void UpdateDialog::addDisabledUpdate( 
UpdateDialog::DisabledUpdate const & data
     UpdateDialog::Index *pEntry = new UpdateDialog::Index( DISABLED_UPDATE, 
nIndex, data.name );
 
     m_disabledUpdates.push_back( data );
-    m_ListboxEntries.push_back( pEntry );
+    m_ListboxEntries.emplace_back( pEntry );
 
     isIgnoredUpdate( pEntry );
     addAdditional( pEntry, SvLBoxButtonKind::DisabledCheckbox );
@@ -755,7 +749,7 @@ void UpdateDialog::addSpecificError( 
UpdateDialog::SpecificError const & data )
     UpdateDialog::Index *pEntry = new UpdateDialog::Index( SPECIFIC_ERROR, 
nIndex, data.name );
 
     m_specificErrors.push_back( data );
-    m_ListboxEntries.push_back( pEntry );
+    m_ListboxEntries.emplace_back( pEntry );
 
     addAdditional( pEntry, SvLBoxButtonKind::StaticImage);
 }
@@ -976,7 +970,7 @@ void UpdateDialog::getIgnoredUpdates()
         uno::Any aPropValue( uno::Reference< beans::XPropertySet >( 
xNameAccess->getByName( aIdentifier ), uno::UNO_QUERY_THROW 
)->getPropertyValue( PROPERTY_VERSION ) );
         aPropValue >>= aVersion;
         IgnoredUpdate *pData = new IgnoredUpdate( aIdentifier, aVersion );
-        m_ignoredUpdates.push_back( pData );
+        m_ignoredUpdates.emplace_back( pData );
     }
 }
 
@@ -1106,7 +1100,7 @@ void UpdateDialog::setIgnoredUpdate( UpdateDialog::Index 
const *pIndex, bool bIg
         if ( bIgnore && !bFound )
         {
             IgnoredUpdate *pData = new IgnoredUpdate( aExtensionID, aVersion );
-            m_ignoredUpdates.push_back( pData );
+            m_ignoredUpdates.emplace_back( pData );
         }
     }
 }
@@ -1222,7 +1216,7 @@ IMPL_LINK_NOARG(UpdateDialog, allHandler, CheckBox&, void)
         for (auto const& listboxEntry : m_ListboxEntries)
         {
             if ( listboxEntry->m_bIgnored || ( listboxEntry->m_eKind != 
ENABLED_UPDATE ) )
-                insertItem( listboxEntry, SvLBoxButtonKind::DisabledCheckbox );
+                insertItem( listboxEntry.get(), 
SvLBoxButtonKind::DisabledCheckbox );
         }
     }
     else
diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx 
b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx
index 5e83051f9ddd..6116ca95ee71 100644
--- a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx
+++ b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx
@@ -194,8 +194,8 @@ private:
     std::vector< dp_gui::UpdateData > m_enabledUpdates;
     std::vector< UpdateDialog::DisabledUpdate > m_disabledUpdates;
     std::vector< UpdateDialog::SpecificError > m_specificErrors;
-    std::vector< UpdateDialog::IgnoredUpdate* > m_ignoredUpdates;
-    std::vector< Index* > m_ListboxEntries;
+    std::vector< std::unique_ptr<UpdateDialog::IgnoredUpdate> > 
m_ignoredUpdates;
+    std::vector< std::unique_ptr<Index> > m_ListboxEntries;
     std::vector< dp_gui::UpdateData > & m_updateData;
     rtl::Reference< UpdateDialog::Thread > m_thread;
     css::uno::Reference< css::deployment::XExtensionManager > 
m_xExtensionManager;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to