summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-06-21 15:34:16 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-06-25 09:12:47 +0200
commite5dfdbcc2084bfdb213afbe03d00136e93d5c4d2 (patch)
treed704fa92734cf5beaa3ccc780d9c221c81b3f2c5 /sd
parentb9426828aefad95aace7f8935ef5dbd6a4664091 (diff)
loplugin:useuniqueptr in CustomAnimationDialog
Change-Id: Ic2e93c1493159c9602bd68b409052117766dcc02 Reviewed-on: https://gerrit.libreoffice.org/56328 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/animations/CustomAnimationDialog.cxx24
-rw-r--r--sd/source/ui/animations/CustomAnimationDialog.hxx6
-rw-r--r--sd/source/ui/animations/CustomAnimationPane.cxx12
-rw-r--r--sd/source/ui/animations/CustomAnimationPane.hxx2
4 files changed, 21 insertions, 23 deletions
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 );