summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXisco Fauli <anistenis@gmail.com>2016-05-29 21:08:19 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-06-03 06:19:37 +0000
commitd0879b721d8c429248f9da7ce02c6c71327e2954 (patch)
tree91fc0a37b317b000923ef605d1e7a9c37f6f6c87
parenta6593e7fd3660b806864911c219903608c0c5b59 (diff)
tdf#89329: use unique_ptr for pImpl in imageitm
Change-Id: I935da01bd03a9812facf30e1d45da1c4949188ed Reviewed-on: https://gerrit.libreoffice.org/25633 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r--include/svl/imageitm.hxx3
-rw-r--r--svl/source/items/imageitm.cxx35
2 files changed, 19 insertions, 19 deletions
diff --git a/include/svl/imageitm.hxx b/include/svl/imageitm.hxx
index bfe972ed5442..d19c8be282de 100644
--- a/include/svl/imageitm.hxx
+++ b/include/svl/imageitm.hxx
@@ -22,11 +22,12 @@
#include <svl/svldllapi.h>
#include <svl/intitem.hxx>
+#include <memory>
struct SfxImageItem_Impl;
class SVL_DLLPUBLIC SfxImageItem : public SfxInt16Item
{
- SfxImageItem_Impl* pImp;
+ std::unique_ptr<SfxImageItem_Impl> pImpl;
public:
static SfxPoolItem* CreateDefault();
SfxImageItem( sal_uInt16 nWhich = 0 );
diff --git a/svl/source/items/imageitm.cxx b/svl/source/items/imageitm.cxx
index 9d07db34a576..4b2e31c8ab28 100644
--- a/svl/source/items/imageitm.cxx
+++ b/svl/source/items/imageitm.cxx
@@ -35,22 +35,21 @@ struct SfxImageItem_Impl
SfxImageItem::SfxImageItem( sal_uInt16 which )
- : SfxInt16Item( which, 0 )
+ : SfxInt16Item( which, 0 ),
+ pImpl( new SfxImageItem_Impl)
{
- pImp = new SfxImageItem_Impl;
- pImp->nAngle = 0;
- pImp->bMirrored = false;
+ pImpl->nAngle = 0;
+ pImpl->bMirrored = false;
}
SfxImageItem::SfxImageItem( const SfxImageItem& rItem )
- : SfxInt16Item( rItem )
+ : SfxInt16Item( rItem ),
+ pImpl( new SfxImageItem_Impl( *(rItem.pImpl.get()) ) )
{
- pImp = new SfxImageItem_Impl( *(rItem.pImp) );
}
SfxImageItem::~SfxImageItem()
{
- delete pImp;
}
@@ -63,16 +62,16 @@ SfxPoolItem* SfxImageItem::Clone( SfxItemPool* ) const
bool SfxImageItem::operator==( const SfxPoolItem& rItem ) const
{
return (static_cast<const SfxImageItem&>(rItem).GetValue() == GetValue()) &&
- (*pImp == *static_cast<const SfxImageItem&>(rItem).pImp);
+ (*pImpl == *static_cast<const SfxImageItem&>(rItem).pImpl);
}
bool SfxImageItem::QueryValue( css::uno::Any& rVal, sal_uInt8 ) const
{
css::uno::Sequence< css::uno::Any > aSeq( 4 );
aSeq[0] = css::uno::makeAny( GetValue() );
- aSeq[1] = css::uno::makeAny( pImp->nAngle );
- aSeq[2] = css::uno::makeAny( pImp->bMirrored );
- aSeq[3] = css::uno::makeAny( OUString( pImp->aURL ));
+ aSeq[1] = css::uno::makeAny( pImpl->nAngle );
+ aSeq[2] = css::uno::makeAny( pImpl->bMirrored );
+ aSeq[3] = css::uno::makeAny( OUString( pImpl->aURL ));
rVal = css::uno::makeAny( aSeq );
return true;
@@ -87,10 +86,10 @@ bool SfxImageItem::PutValue( const css::uno::Any& rVal, sal_uInt8 )
OUString aURL;
if ( aSeq[0] >>= nVal )
SetValue( nVal );
- aSeq[1] >>= pImp->nAngle;
- aSeq[2] >>= pImp->bMirrored;
+ aSeq[1] >>= pImpl->nAngle;
+ aSeq[2] >>= pImpl->bMirrored;
if ( aSeq[3] >>= aURL )
- pImp->aURL = aURL;
+ pImpl->aURL = aURL;
return true;
}
@@ -99,22 +98,22 @@ bool SfxImageItem::PutValue( const css::uno::Any& rVal, sal_uInt8 )
void SfxImageItem::SetRotation( long nValue )
{
- pImp->nAngle = nValue;
+ pImpl->nAngle = nValue;
}
long SfxImageItem::GetRotation() const
{
- return pImp->nAngle;
+ return pImpl->nAngle;
}
void SfxImageItem::SetMirrored( bool bSet )
{
- pImp->bMirrored = bSet;
+ pImpl->bMirrored = bSet;
}
bool SfxImageItem::IsMirrored() const
{
- return pImp->bMirrored;
+ return pImpl->bMirrored;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */