summaryrefslogtreecommitdiff
path: root/svtools/source/uno/unoimap.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'svtools/source/uno/unoimap.cxx')
-rw-r--r--svtools/source/uno/unoimap.cxx17
1 files changed, 8 insertions, 9 deletions
diff --git a/svtools/source/uno/unoimap.cxx b/svtools/source/uno/unoimap.cxx
index 4c337df681d3..2999b5aff1a3 100644
--- a/svtools/source/uno/unoimap.cxx
+++ b/svtools/source/uno/unoimap.cxx
@@ -78,7 +78,7 @@ public:
UNO3_GETIMPLEMENTATION_DECL( SvUnoImageMapObject )
- IMapObject* createIMapObject() const;
+ std::unique_ptr<IMapObject> createIMapObject() const;
rtl::Reference<SvMacroTableEventDescriptor> mxEvents;
@@ -246,7 +246,7 @@ SvUnoImageMapObject::SvUnoImageMapObject( const IMapObject& rMapObject, const Sv
mxEvents = new SvMacroTableEventDescriptor( rMapObject.GetMacroTable(), pSupportedMacroItems );
}
-IMapObject* SvUnoImageMapObject::createIMapObject() const
+std::unique_ptr<IMapObject> SvUnoImageMapObject::createIMapObject() const
{
const OUString aURL( maURL );
const OUString aAltText( maAltText );
@@ -254,21 +254,21 @@ IMapObject* SvUnoImageMapObject::createIMapObject() const
const OUString aTarget( maTarget );
const OUString aName( maName );
- IMapObject* pNewIMapObject;
+ std::unique_ptr<IMapObject> pNewIMapObject;
switch( mnType )
{
case IMAP_OBJ_RECTANGLE:
{
const tools::Rectangle aRect( maBoundary.X, maBoundary.Y, maBoundary.X + maBoundary.Width - 1, maBoundary.Y + maBoundary.Height - 1 );
- pNewIMapObject = new IMapRectangleObject( aRect, aURL, aAltText, aDesc, aTarget, aName, mbIsActive, false );
+ pNewIMapObject.reset(new IMapRectangleObject( aRect, aURL, aAltText, aDesc, aTarget, aName, mbIsActive, false ));
}
break;
case IMAP_OBJ_CIRCLE:
{
const Point aCenter( maCenter.X, maCenter.Y );
- pNewIMapObject = new IMapCircleObject( aCenter, mnRadius, aURL, aAltText, aDesc, aTarget, aName, mbIsActive, false );
+ pNewIMapObject.reset(new IMapCircleObject( aCenter, mnRadius, aURL, aAltText, aDesc, aTarget, aName, mbIsActive, false ));
}
break;
@@ -285,7 +285,7 @@ IMapObject* SvUnoImageMapObject::createIMapObject() const
}
aPoly.Optimize( PolyOptimizeFlags::CLOSE );
- pNewIMapObject = new IMapPolygonObject( aPoly, aURL, aAltText, aDesc, aTarget, aName, mbIsActive, false );
+ pNewIMapObject.reset(new IMapPolygonObject( aPoly, aURL, aAltText, aDesc, aTarget, aName, mbIsActive, false ));
}
break;
}
@@ -675,9 +675,8 @@ void SvUnoImageMap::fillImageMap( ImageMap& rMap ) const
for (auto const& elem : maObjectList)
{
- IMapObject* pNewMapObject = elem->createIMapObject();
- rMap.InsertIMapObject( *pNewMapObject );
- delete pNewMapObject;
+ std::unique_ptr<IMapObject> pNewMapObject = elem->createIMapObject();
+ rMap.InsertIMapObject( std::move(pNewMapObject) );
}
}