summaryrefslogtreecommitdiff
path: root/editeng/source/items/bulitem.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-01-11 12:53:32 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-01-13 13:08:52 +0000
commitcd8fdb46fd9a215532688585f3466d36b1daa1ac (patch)
tree8e25067a0e72ce5afe9c490f9eef567821f594c7 /editeng/source/items/bulitem.cxx
parente6d7d737522124350a17a3cfdee055f03200a274 (diff)
new loplugin: useuniqueptr: editeng
Change-Id: I6df65eab882780d996ee996b5fef8020186b6d98 Reviewed-on: https://gerrit.libreoffice.org/32958 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'editeng/source/items/bulitem.cxx')
-rw-r--r--editeng/source/items/bulitem.cxx22
1 files changed, 6 insertions, 16 deletions
diff --git a/editeng/source/items/bulitem.cxx b/editeng/source/items/bulitem.cxx
index 1283f3287532..1e2e6a81a62b 100644
--- a/editeng/source/items/bulitem.cxx
+++ b/editeng/source/items/bulitem.cxx
@@ -133,7 +133,7 @@ SvxBulletItem::SvxBulletItem( SvStream& rStrm, sal_uInt16 _nWhich )
nStyle = SvxBulletStyle::NONE;
}
else
- pGraphicObject = new GraphicObject( aBmp );
+ pGraphicObject.reset( new GraphicObject( aBmp ) );
}
sal_Int32 nTmp(0);
@@ -159,7 +159,8 @@ SvxBulletItem::SvxBulletItem( SvStream& rStrm, sal_uInt16 _nWhich )
SvxBulletItem::SvxBulletItem( const SvxBulletItem& rItem) : SfxPoolItem( rItem )
{
aFont = rItem.aFont;
- pGraphicObject = ( rItem.pGraphicObject ? new GraphicObject( *rItem.pGraphicObject ) : nullptr );
+ if (rItem.pGraphicObject)
+ pGraphicObject.reset( new GraphicObject( *rItem.pGraphicObject ) );
aPrevText = rItem.aPrevText;
aFollowText = rItem.aFollowText;
nStart = rItem.nStart;
@@ -172,7 +173,6 @@ SvxBulletItem::SvxBulletItem( const SvxBulletItem& rItem) : SfxPoolItem( rItem )
SvxBulletItem::~SvxBulletItem()
{
- delete pGraphicObject;
}
@@ -273,12 +273,7 @@ SvStream& SvxBulletItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) c
if( ( nStyle == SvxBulletStyle::BMP ) &&
( !pGraphicObject || ( GraphicType::NONE == pGraphicObject->GetType() ) || ( GraphicType::Default == pGraphicObject->GetType() ) ) )
{
- if( pGraphicObject )
- {
- delete( const_cast< SvxBulletItem* >( this )->pGraphicObject );
- const_cast< SvxBulletItem* >( this )->pGraphicObject = nullptr;
- }
-
+ const_cast< SvxBulletItem* >( this )->pGraphicObject.reset();
const_cast< SvxBulletItem* >( this )->nStyle = SvxBulletStyle::NONE;
}
@@ -366,16 +361,11 @@ void SvxBulletItem::SetGraphicObject( const GraphicObject& rGraphicObject )
{
if( ( GraphicType::NONE == rGraphicObject.GetType() ) || ( GraphicType::Default == rGraphicObject.GetType() ) )
{
- if( pGraphicObject )
- {
- delete pGraphicObject;
- pGraphicObject = nullptr;
- }
+ pGraphicObject.reset();
}
else
{
- delete pGraphicObject;
- pGraphicObject = new GraphicObject( rGraphicObject );
+ pGraphicObject.reset( new GraphicObject( rGraphicObject ) );
}
}