summaryrefslogtreecommitdiff
path: root/sd/source/ui/animations/CustomAnimationDialog.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-06-11 16:05:21 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-06-20 11:16:34 +0200
commitcebcb879c169171f9c1306999e3843d081f4c2ce (patch)
tree74d46ecb1dc86062c94eb8cbba71b997123482b0 /sd/source/ui/animations/CustomAnimationDialog.cxx
parentd79b0d8648067055616de6f8913e5dbbac5311f4 (diff)
loplugin:useuniqueptr in PropertyControl
Change-Id: I6b648f26f3946da27585a70f18406e92d9de80c2 Reviewed-on: https://gerrit.libreoffice.org/56107 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd/source/ui/animations/CustomAnimationDialog.cxx')
-rw-r--r--sd/source/ui/animations/CustomAnimationDialog.cxx31
1 files changed, 14 insertions, 17 deletions
diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx
index 95f23249006f..224bf1223bc1 100644
--- a/sd/source/ui/animations/CustomAnimationDialog.cxx
+++ b/sd/source/ui/animations/CustomAnimationDialog.cxx
@@ -2285,18 +2285,15 @@ PropertyControl::~PropertyControl()
void PropertyControl::dispose()
{
- delete mpSubControl;
+ mpSubControl.reset();
ListBox::dispose();
}
-void PropertyControl::setSubControl( PropertySubControl* pSubControl )
+void PropertyControl::setSubControl( std::unique_ptr<PropertySubControl> pSubControl )
{
- if( mpSubControl && mpSubControl != pSubControl )
- delete mpSubControl;
+ mpSubControl = std::move(pSubControl);
- mpSubControl = pSubControl;
-
- Control* pControl = pSubControl ? pSubControl->getControl() : nullptr;
+ Control* pControl = mpSubControl ? mpSubControl->getControl() : nullptr;
if( pControl )
{
@@ -2323,15 +2320,15 @@ PropertySubControl::~PropertySubControl()
{
}
-PropertySubControl* PropertySubControl::create( sal_Int32 nType, vcl::Window* pParent, const Any& rValue, const OUString& rPresetId, const Link<LinkParamNone*,void>& rModifyHdl )
+std::unique_ptr<PropertySubControl> PropertySubControl::create( sal_Int32 nType, vcl::Window* pParent, const Any& rValue, const OUString& rPresetId, const Link<LinkParamNone*,void>& rModifyHdl )
{
- PropertySubControl* pSubControl = nullptr;
+ std::unique_ptr<PropertySubControl> pSubControl;
switch( nType )
{
case nPropertyTypeDirection:
case nPropertyTypeSpokes:
case nPropertyTypeZoom:
- pSubControl = new PresetPropertyBox( nType, pParent, rValue, rPresetId, rModifyHdl );
+ pSubControl.reset( new PresetPropertyBox( nType, pParent, rValue, rPresetId, rModifyHdl ) );
break;
case nPropertyTypeColor:
@@ -2339,31 +2336,31 @@ PropertySubControl* PropertySubControl::create( sal_Int32 nType, vcl::Window* pP
case nPropertyTypeFirstColor:
case nPropertyTypeCharColor:
case nPropertyTypeLineColor:
- pSubControl = new ColorPropertyBox( nType, pParent, rValue, rModifyHdl );
+ pSubControl.reset( new ColorPropertyBox( nType, pParent, rValue, rModifyHdl ) );
break;
case nPropertyTypeFont:
- pSubControl = new FontPropertyBox( nType, pParent, rValue, rModifyHdl );
+ pSubControl.reset( new FontPropertyBox( nType, pParent, rValue, rModifyHdl ) );
break;
case nPropertyTypeCharHeight:
- pSubControl = new CharHeightPropertyBox( nType, pParent, rValue, rModifyHdl );
+ pSubControl.reset( new CharHeightPropertyBox( nType, pParent, rValue, rModifyHdl ) );
break;
case nPropertyTypeRotate:
- pSubControl = new RotationPropertyBox( nType, pParent, rValue, rModifyHdl );
+ pSubControl.reset( new RotationPropertyBox( nType, pParent, rValue, rModifyHdl ) );
break;
case nPropertyTypeTransparency:
- pSubControl = new TransparencyPropertyBox( nType, pParent, rValue, rModifyHdl );
+ pSubControl.reset( new TransparencyPropertyBox( nType, pParent, rValue, rModifyHdl ) );
break;
case nPropertyTypeScale:
- pSubControl = new ScalePropertyBox( nType, pParent, rValue, rModifyHdl );
+ pSubControl.reset( new ScalePropertyBox( nType, pParent, rValue, rModifyHdl ) );
break;
case nPropertyTypeCharDecoration:
- pSubControl = new FontStylePropertyBox( nType, pParent, rValue, rModifyHdl );
+ pSubControl.reset( new FontStylePropertyBox( nType, pParent, rValue, rModifyHdl ) );
break;
}