From fccf28b5795b18907337bbb22a85d23a52280add Mon Sep 17 00:00:00 2001 From: David Tardon Date: Fri, 9 Sep 2016 11:21:00 +0200 Subject: use std::unique_ptr Change-Id: Ic03888e22949c6c3fc529f9a557f58620fc76f20 --- xmloff/source/draw/ximpcustomshape.cxx | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'xmloff/source/draw/ximpcustomshape.cxx') diff --git a/xmloff/source/draw/ximpcustomshape.cxx b/xmloff/source/draw/ximpcustomshape.cxx index 167376bd9c67..029a1ba3b878 100644 --- a/xmloff/source/draw/ximpcustomshape.cxx +++ b/xmloff/source/draw/ximpcustomshape.cxx @@ -20,6 +20,7 @@ #include "ximpcustomshape.hxx" #include "ximpshap.hxx" #include +#include #include #include #include @@ -47,6 +48,7 @@ #include #include #include +#include #include using namespace ::com::sun::star; @@ -1168,7 +1170,7 @@ void XMLEnhancedCustomShapeContext::EndElement() if ( !maEquations.empty() ) { // creating hash map containing the name and index of each equation - EquationHashMap* pH = new EquationHashMap; + std::unique_ptr pH = o3tl::make_unique(); std::vector< OUString >::iterator aEquationNameIter = maEquationNames.begin(); std::vector< OUString >::iterator aEquationNameEnd = maEquationNames.end(); while( aEquationNameIter != aEquationNameEnd ) @@ -1224,8 +1226,8 @@ void XMLEnhancedCustomShapeContext::EndElement() aPathIter->Value); for ( i = 0; i < rSeq.getLength(); i++ ) { - CheckAndResolveEquationParameter( const_cast(rSeq[ i ].First), pH ); - CheckAndResolveEquationParameter( const_cast(rSeq[ i ].Second), pH ); + CheckAndResolveEquationParameter( const_cast(rSeq[ i ].First), pH.get() ); + CheckAndResolveEquationParameter( const_cast(rSeq[ i ].Second), pH.get() ); } } break; @@ -1236,10 +1238,10 @@ void XMLEnhancedCustomShapeContext::EndElement() aPathIter->Value); for ( i = 0; i < rSeq.getLength(); i++ ) { - CheckAndResolveEquationParameter( const_cast(rSeq[ i ].TopLeft.First), pH ); - CheckAndResolveEquationParameter( const_cast(rSeq[ i ].TopLeft.Second), pH ); - CheckAndResolveEquationParameter( const_cast(rSeq[ i ].BottomRight.First), pH ); - CheckAndResolveEquationParameter( const_cast(rSeq[ i ].BottomRight.Second), pH ); + CheckAndResolveEquationParameter( const_cast(rSeq[ i ].TopLeft.First), pH.get() ); + CheckAndResolveEquationParameter( const_cast(rSeq[ i ].TopLeft.Second), pH.get() ); + CheckAndResolveEquationParameter( const_cast(rSeq[ i ].BottomRight.First), pH.get() ); + CheckAndResolveEquationParameter( const_cast(rSeq[ i ].BottomRight.Second), pH.get() ); } } break; @@ -1265,7 +1267,7 @@ void XMLEnhancedCustomShapeContext::EndElement() case EAS_RadiusRangeMaximum : { CheckAndResolveEquationParameter( const_cast(*o3tl::doAccess( - pValues->Value)), pH ); + pValues->Value)), pH.get() ); } break; @@ -1273,9 +1275,9 @@ void XMLEnhancedCustomShapeContext::EndElement() case EAS_Polar : { CheckAndResolveEquationParameter( const_cast((*o3tl::doAccess( - pValues->Value)).First), pH ); + pValues->Value)).First), pH.get() ); CheckAndResolveEquationParameter( const_cast((*o3tl::doAccess( - pValues->Value)).Second), pH ); + pValues->Value)).Second), pH.get() ); } break; default: @@ -1285,7 +1287,6 @@ void XMLEnhancedCustomShapeContext::EndElement() } ++aHandleIter; } - delete pH; } SdXMLCustomShapePropertyMerge( mrCustomShapeGeometry, maExtrusion, EASGet( EAS_Extrusion ) ); -- cgit