[Libreoffice-commits] core.git: include/svl svl/source
Xisco Fauli
anistenis at gmail.com
Fri Jun 3 06:20:18 UTC 2016
include/svl/imageitm.hxx | 3 ++-
svl/source/items/imageitm.cxx | 35 +++++++++++++++++------------------
2 files changed, 19 insertions(+), 19 deletions(-)
New commits:
commit d0879b721d8c429248f9da7ce02c6c71327e2954
Author: Xisco Fauli <anistenis at gmail.com>
Date: Sun May 29 21:08:19 2016 +0200
tdf#89329: use unique_ptr for pImpl in imageitm
Change-Id: I935da01bd03a9812facf30e1d45da1c4949188ed
Reviewed-on: https://gerrit.libreoffice.org/25633
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/include/svl/imageitm.hxx b/include/svl/imageitm.hxx
index bfe972e..d19c8be 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 9d07db3..4b2e31c 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: */
More information about the Libreoffice-commits
mailing list