diff options
author | David Tardon <dtardon@redhat.com> | 2016-09-09 10:25:31 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2016-09-09 12:14:04 +0200 |
commit | 109ea4752b734683483aef5154d8debca2d300a3 (patch) | |
tree | 452f493e0355a7d19aed0df29be59f8807d4f4db /xmloff | |
parent | b42af6cee1d2c8a2bdb37d1a6e7e53704b839ee2 (diff) |
use std::shared_ptr
Change-Id: Ib285d2445077a0263a09b36bf1a6fa1fe7f59496
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/inc/animationimport.hxx | 7 | ||||
-rw-r--r-- | xmloff/source/draw/animationimport.cxx | 12 |
2 files changed, 7 insertions, 12 deletions
diff --git a/xmloff/inc/animationimport.hxx b/xmloff/inc/animationimport.hxx index afe509c49b9f..cea9782d64d8 100644 --- a/xmloff/inc/animationimport.hxx +++ b/xmloff/inc/animationimport.hxx @@ -20,6 +20,8 @@ #ifndef INCLUDED_XMLOFF_INC_ANIMATIONIMPORT_HXX #define INCLUDED_XMLOFF_INC_ANIMATIONIMPORT_HXX +#include <memory> + #include <xmloff/xmlictxt.hxx> #include <com/sun/star/animations/XAnimationNode.hpp> @@ -31,7 +33,7 @@ class AnimationsImportHelperImpl; class AnimationNodeContext : public SvXMLImportContext { - AnimationsImportHelperImpl* mpHelper; + std::shared_ptr<AnimationsImportHelperImpl> mpHelper; bool mbRootContext; css::uno::Reference< css::animations::XAnimationNode > mxNode; @@ -45,8 +47,7 @@ public: sal_uInt16 nPrfx, const OUString& rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList, - AnimationsImportHelperImpl* mpImpl = nullptr ); - virtual ~AnimationNodeContext(); + std::shared_ptr<AnimationsImportHelperImpl> pImpl = nullptr ); virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; diff --git a/xmloff/source/draw/animationimport.cxx b/xmloff/source/draw/animationimport.cxx index a9dd0f778a35..85e635f41a7d 100644 --- a/xmloff/source/draw/animationimport.cxx +++ b/xmloff/source/draw/animationimport.cxx @@ -625,16 +625,16 @@ AnimationNodeContext::AnimationNodeContext( const Reference< XAnimationNode >& xParentNode, SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList, - AnimationsImportHelperImpl* pHelper /* = NULL */ ) + std::shared_ptr<AnimationsImportHelperImpl> pHelper ) : SvXMLImportContext(rImport, nPrfx, rLocalName), mpHelper( pHelper ), - mbRootContext( pHelper == nullptr ) + mbRootContext( !pHelper ) { try { if( mbRootContext ) { - mpHelper = new AnimationsImportHelperImpl( rImport ); + mpHelper = std::make_shared<AnimationsImportHelperImpl>( rImport ); mxNode = xParentNode; } else @@ -720,12 +720,6 @@ AnimationNodeContext::AnimationNodeContext( } } -AnimationNodeContext::~AnimationNodeContext() -{ - if( mbRootContext ) - delete mpHelper; -} - void AnimationNodeContext::StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& ) { // code of StartElement is moved to init_node that is now called |