summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-03-15 10:47:41 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-03-15 11:58:28 +0100
commitc7395735777f674bdd40efdfcbf56f488226e633 (patch)
tree3be0cd8f60aabdb0f03cbf1c94dde476701357e0
parent426d55c1a9510be5a95950a94d40463cf4f178fa (diff)
loplugin:useuniqueptr in UndoRemovePresObjectImpl
Change-Id: Ieaaedf6d5815c9dd49dc2f992cfaef7f74c43428 Reviewed-on: https://gerrit.libreoffice.org/51312 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sd/inc/undo/undoobjects.hxx6
-rw-r--r--sd/source/core/undo/undoobjects.cxx12
2 files changed, 6 insertions, 12 deletions
diff --git a/sd/inc/undo/undoobjects.hxx b/sd/inc/undo/undoobjects.hxx
index 2e0023246e10..59c120816415 100644
--- a/sd/inc/undo/undoobjects.hxx
+++ b/sd/inc/undo/undoobjects.hxx
@@ -42,9 +42,9 @@ protected:
virtual void Redo();
private:
- SfxUndoAction* mpUndoUsercall;
- SfxUndoAction* mpUndoAnimation;
- SfxUndoAction* mpUndoPresObj;
+ std::unique_ptr<SfxUndoAction> mpUndoUsercall;
+ std::unique_ptr<SfxUndoAction> mpUndoAnimation;
+ std::unique_ptr<SfxUndoAction> mpUndoPresObj;
};
class UndoRemoveObject : public SdrUndoRemoveObj, public UndoRemovePresObjectImpl
diff --git a/sd/source/core/undo/undoobjects.cxx b/sd/source/core/undo/undoobjects.cxx
index bd3589c2af98..6b3a4e80876e 100644
--- a/sd/source/core/undo/undoobjects.cxx
+++ b/sd/source/core/undo/undoobjects.cxx
@@ -44,24 +44,21 @@ ViewShellId SdUndoAction::GetViewShellId() const
}
UndoRemovePresObjectImpl::UndoRemovePresObjectImpl( SdrObject& rObject )
-: mpUndoUsercall(nullptr)
-, mpUndoAnimation(nullptr)
-, mpUndoPresObj(nullptr)
{
SdPage* pPage = dynamic_cast< SdPage* >( rObject.GetPage() );
if( pPage )
{
if( pPage->IsPresObj(&rObject) )
- mpUndoPresObj = new UndoObjectPresentationKind( rObject );
+ mpUndoPresObj.reset( new UndoObjectPresentationKind( rObject ) );
if( rObject.GetUserCall() )
- mpUndoUsercall = new UndoObjectUserCall(rObject);
+ mpUndoUsercall.reset( new UndoObjectUserCall(rObject) );
if( pPage->hasAnimationNode() )
{
css::uno::Reference< css::drawing::XShape > xShape( rObject.getUnoShape(), css::uno::UNO_QUERY );
if( pPage->getMainSequence()->hasEffect( xShape ) )
{
- mpUndoAnimation = new UndoAnimation( static_cast< SdDrawDocument* >( pPage->GetModel() ), pPage );
+ mpUndoAnimation.reset( new UndoAnimation( static_cast< SdDrawDocument* >( pPage->GetModel() ), pPage ) );
}
}
}
@@ -69,9 +66,6 @@ UndoRemovePresObjectImpl::UndoRemovePresObjectImpl( SdrObject& rObject )
UndoRemovePresObjectImpl::~UndoRemovePresObjectImpl()
{
- delete mpUndoAnimation;
- delete mpUndoPresObj;
- delete mpUndoUsercall;
}
void UndoRemovePresObjectImpl::Undo()