summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-06-13 10:46:16 +0200
committerStephan Bergmann <sbergman@redhat.com>2017-06-13 10:46:16 +0200
commit5389b44827393c80df27e429ba446971a0d7a696 (patch)
tree2a14f1687f17df58ace194eff0d6f88955ec5f0e /svx
parent4ffdb6750fa7d656d249a745f9c6d5ba98353b14 (diff)
Let SfxSetItem ctor take SfxItemSet by unique_ptr
Change-Id: I219dd03477862169cd50eecc14822f6a023f879a
Diffstat (limited to 'svx')
-rw-r--r--svx/source/items/pageitem.cxx8
-rw-r--r--svx/source/xoutdev/xattr.cxx25
-rw-r--r--svx/source/xoutdev/xexch.cxx9
-rw-r--r--svx/source/xoutdev/xpool.cxx13
4 files changed, 36 insertions, 19 deletions
diff --git a/svx/source/items/pageitem.cxx b/svx/source/items/pageitem.cxx
index 7d256e4db7a9..eb5d023a3fd3 100644
--- a/svx/source/items/pageitem.cxx
+++ b/svx/source/items/pageitem.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <utility>
+
#include <tools/stream.hxx>
@@ -262,9 +266,9 @@ SvxSetItem::SvxSetItem( const SvxSetItem& rItem ) :
{
}
-SvxSetItem::SvxSetItem( const sal_uInt16 nId, SfxItemSet* _pSet ) :
+SvxSetItem::SvxSetItem( const sal_uInt16 nId, std::unique_ptr<SfxItemSet>&& _pSet ) :
- SfxSetItem( nId, _pSet )
+ SfxSetItem( nId, std::move(_pSet) )
{
}
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
index 9d34c7382900..a9441061442a 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <utility>
+
#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
#include <com/sun/star/drawing/Hatch.hpp>
#include <com/sun/star/drawing/LineStyle.hpp>
@@ -29,6 +33,7 @@
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <o3tl/any.hxx>
+#include <o3tl/make_unique.hxx>
#include <svl/itempool.hxx>
#include <editeng/memberids.hrc>
#include <tools/stream.hxx>
@@ -3467,14 +3472,14 @@ SfxPoolItem* XFormTextHideFormItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) c
/// a line attribute set item
-XLineAttrSetItem::XLineAttrSetItem( SfxItemSet* pItemSet ) :
- SfxSetItem( XATTRSET_LINE, pItemSet)
+XLineAttrSetItem::XLineAttrSetItem( std::unique_ptr<SfxItemSet>&& pItemSet ) :
+ SfxSetItem( XATTRSET_LINE, std::move(pItemSet))
{
}
XLineAttrSetItem::XLineAttrSetItem( SfxItemPool* pItemPool ) :
SfxSetItem( XATTRSET_LINE,
- new SfxItemSet( *pItemPool, XATTR_LINE_FIRST, XATTR_LINE_LAST))
+ o3tl::make_unique<SfxItemSet>( *pItemPool, XATTR_LINE_FIRST, XATTR_LINE_LAST))
{
}
@@ -3497,21 +3502,21 @@ SfxPoolItem* XLineAttrSetItem::Clone( SfxItemPool* pPool ) const
/// create a set item out of a stream
SfxPoolItem* XLineAttrSetItem::Create( SvStream& rStream, sal_uInt16 /*nVersion*/) const
{
- SfxItemSet *pSet2 = new SfxItemSet( *GetItemSet().GetPool(),
+ auto pSet2 = o3tl::make_unique<SfxItemSet>( *GetItemSet().GetPool(),
XATTR_LINE_FIRST, XATTR_LINE_LAST);
pSet2->Load( rStream );
- return new XLineAttrSetItem( pSet2 );
+ return new XLineAttrSetItem( std::move(pSet2) );
}
/// fill attribute set item
-XFillAttrSetItem::XFillAttrSetItem( SfxItemSet* pItemSet ) :
- SfxSetItem( XATTRSET_FILL, pItemSet)
+XFillAttrSetItem::XFillAttrSetItem( std::unique_ptr<SfxItemSet>&& pItemSet ) :
+ SfxSetItem( XATTRSET_FILL, std::move(pItemSet))
{
}
XFillAttrSetItem::XFillAttrSetItem( SfxItemPool* pItemPool ) :
SfxSetItem( XATTRSET_FILL,
- new SfxItemSet( *pItemPool, XATTR_FILL_FIRST, XATTR_FILL_LAST))
+ o3tl::make_unique<SfxItemSet>( *pItemPool, XATTR_FILL_FIRST, XATTR_FILL_LAST))
{
}
@@ -3534,10 +3539,10 @@ SfxPoolItem* XFillAttrSetItem::Clone( SfxItemPool* pPool ) const
/// create a set item out of a stream
SfxPoolItem* XFillAttrSetItem::Create( SvStream& rStream, sal_uInt16 /*nVersion*/) const
{
- SfxItemSet *pSet2 = new SfxItemSet( *GetItemSet().GetPool(),
+ auto pSet2 = o3tl::make_unique<SfxItemSet>( *GetItemSet().GetPool(),
XATTR_FILL_FIRST, XATTR_FILL_LAST);
pSet2->Load( rStream );
- return new XFillAttrSetItem( pSet2 );
+ return new XFillAttrSetItem( std::move(pSet2) );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/xoutdev/xexch.cxx b/svx/source/xoutdev/xexch.cxx
index 382ad85183e3..156554223b99 100644
--- a/svx/source/xoutdev/xexch.cxx
+++ b/svx/source/xoutdev/xexch.cxx
@@ -17,6 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <o3tl/make_unique.hxx>
#include <sot/formats.hxx>
#include <tools/stream.hxx>
#include <tools/vcompat.hxx>
@@ -28,7 +31,7 @@
#include <svx/xdef.hxx>
#include "svx/xexch.hxx"
#include <memory>
-
+#include <utility>
XFillExchangeData::XFillExchangeData( const XFillAttrSetItem& rXFillAttrSetItem ) :
pXFillAttrSetItem( static_cast<XFillAttrSetItem*>( rXFillAttrSetItem.Clone( rXFillAttrSetItem.GetItemSet().GetPool() ) ) ),
@@ -83,7 +86,7 @@ SvStream& ReadXFillExchangeData( SvStream& rIStm, XFillExchangeData& rData )
{
DBG_ASSERT( rData.pPool, "XFillExchangeData has no pool" );
- SfxItemSet* pSet = new SfxItemSet ( *rData.pPool, XATTR_FILL_FIRST, XATTR_FILL_LAST );
+ auto pSet = o3tl::make_unique<SfxItemSet>( *rData.pPool, XATTR_FILL_FIRST, XATTR_FILL_LAST );
sal_uInt32 nItemCount = 0;
sal_uInt16 nWhich, nItemVersion;
@@ -109,7 +112,7 @@ SvStream& ReadXFillExchangeData( SvStream& rIStm, XFillExchangeData& rData )
}
}
- rData.pXFillAttrSetItem.reset( new XFillAttrSetItem( pSet ) );
+ rData.pXFillAttrSetItem.reset( new XFillAttrSetItem( std::move(pSet) ) );
rData.pPool = rData.pXFillAttrSetItem->GetItemSet().GetPool();
return rIStm;
diff --git a/svx/source/xoutdev/xpool.cxx b/svx/source/xoutdev/xpool.cxx
index 317ca98bc834..591a57fc2575 100644
--- a/svx/source/xoutdev/xpool.cxx
+++ b/svx/source/xoutdev/xpool.cxx
@@ -17,6 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <o3tl/make_unique.hxx>
#include <svx/xtable.hxx>
#include <svx/xattr.hxx>
#include <svx/xpool.hxx>
@@ -106,10 +109,12 @@ XOutdevItemPool::XOutdevItemPool(SfxItemPool* _pMaster, bool bLoadRefCounts)
rPoolDefaults[XATTR_FORMTXTSHDWTRANSP -XATTR_START] = new XFormTextShadowTranspItem;
// create SetItems
- SfxItemSet* pSet=new SfxItemSet(*_pMaster, XATTR_LINE_FIRST, XATTR_LINE_LAST);
- rPoolDefaults[XATTRSET_LINE - XATTR_START] = new XLineAttrSetItem(pSet);
- pSet=new SfxItemSet(*_pMaster, XATTR_FILL_FIRST, XATTR_FILL_LAST);
- rPoolDefaults[XATTRSET_FILL - XATTR_START] = new XFillAttrSetItem(pSet);
+ rPoolDefaults[XATTRSET_LINE - XATTR_START] = new XLineAttrSetItem(
+ o3tl::make_unique<SfxItemSet>(
+ *_pMaster, XATTR_LINE_FIRST, XATTR_LINE_LAST));
+ rPoolDefaults[XATTRSET_FILL - XATTR_START] = new XFillAttrSetItem(
+ o3tl::make_unique<SfxItemSet>(
+ *_pMaster, XATTR_FILL_FIRST, XATTR_FILL_LAST));
// create ItemInfos
for(sal_uInt16 i(GetFirstWhich()); i <= GetLastWhich(); i++)