summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-01-29 10:54:14 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-02-05 07:50:07 +0100
commit6b786b43c63419f13cadab200f9af8095a1e8d56 (patch)
tree3510f4877b1e808a1a367a9f186d9906ea189d39 /editeng
parent518dacc5094bbadbca3167c4dcd2072adc7b3090 (diff)
loplugin:useuniqueptr in SvxNumberFormat
Change-Id: I0433349e6f4108297e0f4cab65c1e859424bd282 Reviewed-on: https://gerrit.libreoffice.org/49148 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/items/numitem.cxx28
1 files changed, 11 insertions, 17 deletions
diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index d18452a7010b..c7b06b773e78 100644
--- a/editeng/source/items/numitem.cxx
+++ b/editeng/source/items/numitem.cxx
@@ -210,8 +210,8 @@ SvxNumberFormat::SvxNumberFormat( SvStream &rStream )
rStream.ReadUInt16( hasGraphicBrush );
if ( hasGraphicBrush )
{
- pGraphicBrush = new SvxBrushItem( SID_ATTR_BRUSH );
- pGraphicBrush = static_cast<SvxBrushItem*>(pGraphicBrush->Create( rStream, BRUSH_GRAPHIC_VERSION ));
+ std::unique_ptr<SvxBrushItem> pTmp( new SvxBrushItem( SID_ATTR_BRUSH ) );
+ pGraphicBrush.reset( static_cast<SvxBrushItem*>(pTmp->Create( rStream, BRUSH_GRAPHIC_VERSION )) );
}
else pGraphicBrush = nullptr;
rStream.ReadUInt16( nTmp16 ); eVertOrient = nTmp16;
@@ -220,7 +220,7 @@ SvxNumberFormat::SvxNumberFormat( SvStream &rStream )
rStream.ReadUInt16( hasBulletFont );
if ( hasBulletFont )
{
- pBulletFont = new vcl::Font( );
+ pBulletFont.reset( new vcl::Font() );
ReadFont( rStream, *pBulletFont );
}
else pBulletFont = nullptr;
@@ -239,8 +239,6 @@ SvxNumberFormat::SvxNumberFormat( SvStream &rStream )
SvxNumberFormat::~SvxNumberFormat()
{
- delete pGraphicBrush;
- delete pBulletFont;
}
void SvxNumberFormat::Store(SvStream &rStream, FontToSubsFontConverter pConverter)
@@ -335,14 +333,14 @@ SvxNumberFormat& SvxNumberFormat::operator=( const SvxNumberFormat& rFormat )
nBulletRelSize = rFormat.nBulletRelSize;
SetShowSymbol(rFormat.IsShowSymbol());
sCharStyleName = rFormat.sCharStyleName;
- DELETEZ(pGraphicBrush);
+ pGraphicBrush.reset();
if(rFormat.pGraphicBrush)
{
- pGraphicBrush = new SvxBrushItem(*rFormat.pGraphicBrush);
+ pGraphicBrush.reset( new SvxBrushItem(*rFormat.pGraphicBrush) );
}
- DELETEZ(pBulletFont);
+ pBulletFont.reset();
if(rFormat.pBulletFont)
- pBulletFont = new vcl::Font(*rFormat.pBulletFont);
+ pBulletFont.reset( new vcl::Font(*rFormat.pBulletFont) );
return *this;
}
@@ -395,13 +393,11 @@ void SvxNumberFormat::SetGraphicBrush( const SvxBrushItem* pBrushItem,
{
if(!pBrushItem)
{
- delete pGraphicBrush;
- pGraphicBrush = nullptr;
+ pGraphicBrush.reset();
}
else if ( !pGraphicBrush || (*pBrushItem != *pGraphicBrush) )
{
- delete pGraphicBrush;
- pGraphicBrush = static_cast<SvxBrushItem*>(pBrushItem->Clone());
+ pGraphicBrush.reset( static_cast<SvxBrushItem*>(pBrushItem->Clone()) );
}
if(pOrient)
@@ -419,8 +415,7 @@ void SvxNumberFormat::SetGraphic( const OUString& rName )
if( pGraphicBrush && pGraphicBrush->GetGraphicLink() == rName )
return ;
- delete pGraphicBrush;
- pGraphicBrush = new SvxBrushItem( rName, "", GPOS_AREA, 0 );
+ pGraphicBrush.reset( new SvxBrushItem( rName, "", GPOS_AREA, 0 ) );
if( eVertOrient == text::VertOrientation::NONE )
eVertOrient = text::VertOrientation::TOP;
@@ -434,8 +429,7 @@ sal_Int16 SvxNumberFormat::GetVertOrient() const
void SvxNumberFormat::SetBulletFont(const vcl::Font* pFont)
{
- delete pBulletFont;
- pBulletFont = pFont ? new vcl::Font(*pFont): nullptr;
+ pBulletFont.reset( pFont ? new vcl::Font(*pFont): nullptr );
}
void SvxNumberFormat::SetPositionAndSpaceMode( SvxNumPositionAndSpaceMode ePositionAndSpaceMode )