diff options
-rw-r--r-- | editeng/source/items/textitem.cxx | 3 | ||||
-rw-r--r-- | include/svl/poolitem.hxx | 2 | ||||
-rw-r--r-- | include/svx/pageitem.hxx | 6 | ||||
-rw-r--r-- | include/svx/xflasit.hxx | 6 | ||||
-rw-r--r-- | include/svx/xlnasit.hxx | 5 | ||||
-rw-r--r-- | sc/inc/patattr.hxx | 4 | ||||
-rw-r--r-- | sc/qa/unit/ucalc_formula.cxx | 3 | ||||
-rw-r--r-- | sc/source/core/data/docpool.cxx | 11 | ||||
-rw-r--r-- | sc/source/core/data/document.cxx | 3 | ||||
-rw-r--r-- | sc/source/core/data/patattr.cxx | 18 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh6.cxx | 11 | ||||
-rw-r--r-- | sc/source/ui/view/viewfunc.cxx | 6 | ||||
-rw-r--r-- | svl/source/items/sitem.cxx | 10 | ||||
-rw-r--r-- | svx/source/items/pageitem.cxx | 8 | ||||
-rw-r--r-- | svx/source/xoutdev/xattr.cxx | 25 | ||||
-rw-r--r-- | svx/source/xoutdev/xexch.cxx | 9 | ||||
-rw-r--r-- | svx/source/xoutdev/xpool.cxx | 13 |
17 files changed, 93 insertions, 50 deletions
diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index 72de8968f410..c6882ca85ca2 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -20,6 +20,7 @@ #include <com/sun/star/style/CaseMap.hpp> #include <com/sun/star/awt/FontDescriptor.hpp> #include <com/sun/star/frame/status/FontHeight.hpp> +#include <o3tl/make_unique.hxx> #include <vcl/bitmapex.hxx> #include <tools/stream.hxx> #include <math.h> @@ -3258,7 +3259,7 @@ SfxPoolItem* SvxScriptTypeItem::Clone( SfxItemPool * ) const *************************************************************************/ SvxScriptSetItem::SvxScriptSetItem( sal_uInt16 nSlotId, SfxItemPool& rPool ) - : SfxSetItem( nSlotId, new SfxItemSet( rPool, + : SfxSetItem( nSlotId, o3tl::make_unique<SfxItemSet>( rPool, SID_ATTR_CHAR_FONT, SID_ATTR_CHAR_FONT )) { sal_uInt16 nLatin, nAsian, nComplex; diff --git a/include/svl/poolitem.hxx b/include/svl/poolitem.hxx index 2eefbf1f66cf..b2a05b993f4a 100644 --- a/include/svl/poolitem.hxx +++ b/include/svl/poolitem.hxx @@ -272,7 +272,7 @@ class SVL_DLLPUBLIC SfxSetItem: public SfxPoolItem SfxSetItem & operator=( const SfxSetItem& ) = delete; public: - SfxSetItem( sal_uInt16 nWhich, SfxItemSet *pSet ); + SfxSetItem( sal_uInt16 nWhich, std::unique_ptr<SfxItemSet> &&pSet ); SfxSetItem( sal_uInt16 nWhich, const SfxItemSet &rSet ); SfxSetItem( const SfxSetItem&, SfxItemPool *pPool = nullptr ); virtual ~SfxSetItem() override; diff --git a/include/svx/pageitem.hxx b/include/svx/pageitem.hxx index 0a322a6a08d0..80277b7d3d3f 100644 --- a/include/svx/pageitem.hxx +++ b/include/svx/pageitem.hxx @@ -19,6 +19,10 @@ #ifndef INCLUDED_SVX_PAGEITEM_HXX #define INCLUDED_SVX_PAGEITEM_HXX +#include <sal/config.h> + +#include <memory> + #include <svl/poolitem.hxx> #include <svx/svxdllapi.h> #include <editeng/svxenum.hxx> @@ -99,7 +103,7 @@ class SVX_DLLPUBLIC SvxSetItem: public SfxSetItem public: SvxSetItem( const sal_uInt16 nId, const SfxItemSet& rSet ); SvxSetItem( const SvxSetItem& rItem ); - SvxSetItem( const sal_uInt16 nId, SfxItemSet* pSet ); + SvxSetItem( const sal_uInt16 nId, std::unique_ptr<SfxItemSet>&& pSet ); virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; diff --git a/include/svx/xflasit.hxx b/include/svx/xflasit.hxx index 73ceb0c3f1ab..62419e2cb462 100644 --- a/include/svx/xflasit.hxx +++ b/include/svx/xflasit.hxx @@ -20,6 +20,10 @@ #ifndef INCLUDED_SVX_XFLASIT_HXX #define INCLUDED_SVX_XFLASIT_HXX +#include <sal/config.h> + +#include <memory> + #include <svl/poolitem.hxx> #include <svx/svxdllapi.h> @@ -27,7 +31,7 @@ class SVX_DLLPUBLIC XFillAttrSetItem : public SfxSetItem { public: - XFillAttrSetItem(SfxItemSet* pItemSet ); + XFillAttrSetItem(std::unique_ptr<SfxItemSet>&& pItemSet ); XFillAttrSetItem(SfxItemPool* pItemPool); XFillAttrSetItem(const XFillAttrSetItem& rAttr); XFillAttrSetItem(const XFillAttrSetItem& rAttr, diff --git a/include/svx/xlnasit.hxx b/include/svx/xlnasit.hxx index 9b82ddef18e4..1643c223e23d 100644 --- a/include/svx/xlnasit.hxx +++ b/include/svx/xlnasit.hxx @@ -20,6 +20,9 @@ #ifndef INCLUDED_SVX_XLNASIT_HXX #define INCLUDED_SVX_XLNASIT_HXX +#include <sal/config.h> + +#include <memory> #include <svl/poolitem.hxx> #include <svx/svxdllapi.h> @@ -28,7 +31,7 @@ class SVX_DLLPUBLIC XLineAttrSetItem : public SfxSetItem { public: - XLineAttrSetItem(SfxItemSet* pItemSet ); + XLineAttrSetItem(std::unique_ptr<SfxItemSet>&& pItemSet ); XLineAttrSetItem(SfxItemPool* pItemPool); XLineAttrSetItem(const XLineAttrSetItem& rAttr); XLineAttrSetItem(const XLineAttrSetItem& rAttr, diff --git a/sc/inc/patattr.hxx b/sc/inc/patattr.hxx index 05bfc926c6ac..964b4a4eeba4 100644 --- a/sc/inc/patattr.hxx +++ b/sc/inc/patattr.hxx @@ -56,8 +56,8 @@ class SC_DLLPUBLIC ScPatternAttr: public SfxSetItem ScStyleSheet* pStyle; sal_uInt64 mnKey; public: - ScPatternAttr(SfxItemSet* pItemSet, const OUString& rStyleName); - ScPatternAttr(SfxItemSet* pItemSet); + ScPatternAttr(std::unique_ptr<SfxItemSet>&& pItemSet, const OUString& rStyleName); + ScPatternAttr(std::unique_ptr<SfxItemSet>&& pItemSet); ScPatternAttr(SfxItemPool* pItemPool); ScPatternAttr(const ScPatternAttr& rPatternAttr); diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index 93c500a1dbfa..a438eaeb77e8 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -33,6 +33,7 @@ #include "docoptio.hxx" #include <formula/vectortoken.hxx> +#include <o3tl/make_unique.hxx> #include <officecfg/Office/Common.hxx> #include <svl/broadcast.hxx> @@ -3424,7 +3425,7 @@ void Test::testFormulaRefUpdateValidity() SfxUInt32Item aItem(ATTR_VALIDDATA, nIndex); ScPatternAttr aNewAttrs( - new SfxItemSet(*m_pDoc->GetPool(), ATTR_PATTERN_START, ATTR_PATTERN_END)); + o3tl::make_unique<SfxItemSet>(*m_pDoc->GetPool(), ATTR_PATTERN_START, ATTR_PATTERN_END)); aNewAttrs.GetItemSet().Put(aItem); m_pDoc->ApplyPattern(0, 1, 0, aNewAttrs); diff --git a/sc/source/core/data/docpool.cxx b/sc/source/core/data/docpool.cxx index 7c235d04124b..1e5511642fff 100644 --- a/sc/source/core/data/docpool.cxx +++ b/sc/source/core/data/docpool.cxx @@ -17,10 +17,15 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <utility> + #include "scitems.hxx" #include <comphelper/string.hxx> #include <i18nutil/unicode.hxx> +#include <o3tl/make_unique.hxx> #include <vcl/outdev.hxx> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> @@ -204,7 +209,7 @@ ScDocumentPool::ScDocumentPool() GetDefaultFonts( aDummy, *pCjkFont, *pCtlFont ); SvxBoxInfoItem* pGlobalBorderInnerAttr = new SvxBoxInfoItem( ATTR_BORDER_INNER ); - SfxItemSet* pSet = new SfxItemSet( *this, ATTR_PATTERN_START, ATTR_PATTERN_END ); + auto pSet = o3tl::make_unique<SfxItemSet>( *this, ATTR_PATTERN_START, ATTR_PATTERN_END ); SfxItemSet aSetItemItemSet( *this, ATTR_BACKGROUND, ATTR_BACKGROUND, ATTR_BORDER, ATTR_SHADOW, @@ -286,9 +291,9 @@ ScDocumentPool::ScDocumentPool() // TODO: Write additional method ScGlobal::IsInit() or somesuch // or detect whether this is the Secondary Pool for a MessagePool if ( ScGlobal::GetEmptyBrushItem() ) - rPoolDefaults[ ATTR_PATTERN - ATTR_STARTINDEX ] = new ScPatternAttr( pSet, ScGlobal::GetRscString(STR_STYLENAME_STANDARD) ); + rPoolDefaults[ ATTR_PATTERN - ATTR_STARTINDEX ] = new ScPatternAttr( std::move(pSet), ScGlobal::GetRscString(STR_STYLENAME_STANDARD) ); else - rPoolDefaults[ ATTR_PATTERN - ATTR_STARTINDEX ] = new ScPatternAttr( pSet, STRING_STANDARD ); // FIXME: without name? + rPoolDefaults[ ATTR_PATTERN - ATTR_STARTINDEX ] = new ScPatternAttr( std::move(pSet), STRING_STANDARD ); // FIXME: without name? rPoolDefaults[ ATTR_LRSPACE - ATTR_STARTINDEX ] = new SvxLRSpaceItem( ATTR_LRSPACE ); rPoolDefaults[ ATTR_ULSPACE - ATTR_STARTINDEX ] = new SvxULSpaceItem( ATTR_ULSPACE ); diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 90e126d588bc..41545c80b41a 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -104,6 +104,7 @@ #include <limits> #include <map> #include <memory> +#include <utility> #include <comphelper/lok.hxx> #include <LibreOfficeKit/LibreOfficeKitEnums.h> @@ -4983,7 +4984,7 @@ ScPatternAttr* ScDocument::CreateSelectionPattern( const ScMarkData& rMark, bool OSL_ENSURE( aState.pItemSet, "SelectionPattern Null" ); if (aState.pItemSet) { - ScPatternAttr* pPattern = new ScPatternAttr( aState.pItemSet.release() ); + ScPatternAttr* pPattern = new ScPatternAttr( std::move(aState.pItemSet) ); if (aState.mbValidPatternId) pPattern->SetKey(aState.mnPatternId); diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx index 811f986d6aef..0ab7a9c60c0c 100644 --- a/sc/source/core/data/patattr.cxx +++ b/sc/source/core/data/patattr.cxx @@ -18,8 +18,10 @@ */ #include <memory> +#include <utility> #include "scitems.hxx" #include <editeng/adjustitem.hxx> +#include <o3tl/make_unique.hxx> #include <svx/algitem.hxx> #include <editeng/boxitem.hxx> #include <editeng/lineitem.hxx> @@ -66,16 +68,16 @@ using sc::HMMToTwips; using sc::TwipsToHMM; -ScPatternAttr::ScPatternAttr( SfxItemSet* pItemSet, const OUString& rStyleName ) - : SfxSetItem ( ATTR_PATTERN, pItemSet ), +ScPatternAttr::ScPatternAttr( std::unique_ptr<SfxItemSet>&& pItemSet, const OUString& rStyleName ) + : SfxSetItem ( ATTR_PATTERN, std::move(pItemSet) ), pName ( new OUString( rStyleName ) ), pStyle ( nullptr ), mnKey(0) { } -ScPatternAttr::ScPatternAttr( SfxItemSet* pItemSet ) - : SfxSetItem ( ATTR_PATTERN, pItemSet ), +ScPatternAttr::ScPatternAttr( std::unique_ptr<SfxItemSet>&& pItemSet ) + : SfxSetItem ( ATTR_PATTERN, std::move(pItemSet) ), pName ( nullptr ), pStyle ( nullptr ), mnKey(0) @@ -83,7 +85,7 @@ ScPatternAttr::ScPatternAttr( SfxItemSet* pItemSet ) } ScPatternAttr::ScPatternAttr( SfxItemPool* pItemPool ) - : SfxSetItem ( ATTR_PATTERN, new SfxItemSet( *pItemPool, ATTR_PATTERN_START, ATTR_PATTERN_END ) ), + : SfxSetItem ( ATTR_PATTERN, o3tl::make_unique<SfxItemSet>( *pItemPool, ATTR_PATTERN_START, ATTR_PATTERN_END ) ), pName ( nullptr ), pStyle ( nullptr ), mnKey(0) @@ -105,7 +107,7 @@ ScPatternAttr::~ScPatternAttr() SfxPoolItem* ScPatternAttr::Clone( SfxItemPool *pPool ) const { - ScPatternAttr* pPattern = new ScPatternAttr( GetItemSet().Clone(true, pPool) ); + ScPatternAttr* pPattern = new ScPatternAttr( std::unique_ptr<SfxItemSet>(GetItemSet().Clone(true, pPool)) ); pPattern->pStyle = pStyle; pPattern->pName.reset( pName ? new OUString(*pName) : nullptr ); @@ -158,11 +160,11 @@ SfxPoolItem* ScPatternAttr::Create( SvStream& rStream, sal_uInt16 /* nVersion */ else pStr = new OUString( ScGlobal::GetRscString(STR_STYLENAME_STANDARD) ); - SfxItemSet *pNewSet = new SfxItemSet( *GetItemSet().GetPool(), + auto pNewSet = o3tl::make_unique<SfxItemSet>( *GetItemSet().GetPool(), ATTR_PATTERN_START, ATTR_PATTERN_END ); pNewSet->Load( rStream ); - ScPatternAttr* pPattern = new ScPatternAttr( pNewSet ); + ScPatternAttr* pPattern = new ScPatternAttr( std::move(pNewSet) ); pPattern->pName.reset( pStr ); diff --git a/sc/source/ui/docshell/docsh6.cxx b/sc/source/ui/docshell/docsh6.cxx index fda2c606ad19..1f3acb3312b7 100644 --- a/sc/source/ui/docshell/docsh6.cxx +++ b/sc/source/ui/docshell/docsh6.cxx @@ -19,6 +19,7 @@ #include "scitems.hxx" +#include <o3tl/make_unique.hxx> #include <svx/pageitem.hxx> #include <sfx2/linkmgr.hxx> @@ -39,7 +40,7 @@ #include <vcl/msgbox.hxx> #include <memory> - +#include <utility> namespace { @@ -209,16 +210,16 @@ static void lcl_AdjustPool( SfxStyleSheetBasePool* pStylePool ) if (rStyleSet.GetItemState(ATTR_PAGE_HEADERSET,false,&pItem) == SfxItemState::SET) { const SfxItemSet& rSrcSet = static_cast<const SvxSetItem*>(pItem)->GetItemSet(); - SfxItemSet* pDestSet = new SfxItemSet(*rStyleSet.GetPool(),rSrcSet.GetRanges()); + auto pDestSet = o3tl::make_unique<SfxItemSet>(*rStyleSet.GetPool(),rSrcSet.GetRanges()); pDestSet->Put(rSrcSet); - rStyleSet.Put(SvxSetItem(ATTR_PAGE_HEADERSET,pDestSet)); + rStyleSet.Put(SvxSetItem(ATTR_PAGE_HEADERSET,std::move(pDestSet))); } if (rStyleSet.GetItemState(ATTR_PAGE_FOOTERSET,false,&pItem) == SfxItemState::SET) { const SfxItemSet& rSrcSet = static_cast<const SvxSetItem*>(pItem)->GetItemSet(); - SfxItemSet* pDestSet = new SfxItemSet(*rStyleSet.GetPool(),rSrcSet.GetRanges()); + auto pDestSet = o3tl::make_unique<SfxItemSet>(*rStyleSet.GetPool(),rSrcSet.GetRanges()); pDestSet->Put(rSrcSet); - rStyleSet.Put(SvxSetItem(ATTR_PAGE_FOOTERSET,pDestSet)); + rStyleSet.Put(SvxSetItem(ATTR_PAGE_FOOTERSET,std::move(pDestSet))); } pStyle = pStylePool->Next(); diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 2c7e7c885242..db6edf9d6112 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -871,8 +871,8 @@ void ScViewFunc::ApplyAttributes( const SfxItemSet* pDialogSet, return; } - ScPatternAttr aOldAttrs( new SfxItemSet(*pOldSet) ); - ScPatternAttr aNewAttrs( new SfxItemSet(*pDialogSet) ); + ScPatternAttr aOldAttrs( o3tl::make_unique<SfxItemSet>(*pOldSet) ); + ScPatternAttr aNewAttrs( o3tl::make_unique<SfxItemSet>(*pDialogSet) ); aNewAttrs.DeleteUnchanged( &aOldAttrs ); if ( pDialogSet->GetItemState( ATTR_VALUE_FORMAT ) == SfxItemState::SET ) @@ -980,7 +980,7 @@ void ScViewFunc::ApplyAttr( const SfxPoolItem& rAttrItem ) return; } - ScPatternAttr aNewAttrs( new SfxItemSet( *GetViewData().GetDocument()->GetPool(), + ScPatternAttr aNewAttrs( o3tl::make_unique<SfxItemSet>( *GetViewData().GetDocument()->GetPool(), ATTR_PATTERN_START, ATTR_PATTERN_END ) ); aNewAttrs.GetItemSet().Put( rAttrItem ); diff --git a/svl/source/items/sitem.cxx b/svl/source/items/sitem.cxx index 0ea270fc9980..fdfbe7870450 100644 --- a/svl/source/items/sitem.cxx +++ b/svl/source/items/sitem.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <utility> + #include <rtl/ustring.hxx> #include <svl/itemset.hxx> #include <svl/poolitem.hxx> @@ -29,11 +33,11 @@ SfxSetItem::SfxSetItem( sal_uInt16 which, const SfxItemSet &rSet) : } -SfxSetItem::SfxSetItem( sal_uInt16 which, SfxItemSet *pS) : +SfxSetItem::SfxSetItem( sal_uInt16 which, std::unique_ptr<SfxItemSet> &&pS) : SfxPoolItem(which), - pSet(pS) + pSet(std::move(pS)) { - DBG_ASSERT(pS, "SfxSetItem without set constructed" ); + DBG_ASSERT(pSet, "SfxSetItem without set constructed" ); } 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++) |