diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-06-12 17:53:50 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-06-12 17:53:50 +0200 |
commit | af2d5119c620947da59434c6367514925ec75bb2 (patch) | |
tree | 958710a9b38954a930bcf44c859ed0ee27edcf56 /sc | |
parent | 0f8670ecebcf2af9c98b805c5e446ff073354d92 (diff) |
Use unique_ptr fro ScMergePatternState::pItemSet
Change-Id: I672785b273eaa8862f43112d7f25ae495b65b0c7
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/attarray.hxx | 7 | ||||
-rw-r--r-- | sc/source/core/data/attarray.cxx | 3 | ||||
-rw-r--r-- | sc/source/core/data/document.cxx | 2 |
3 files changed, 8 insertions, 4 deletions
diff --git a/sc/inc/attarray.hxx b/sc/inc/attarray.hxx index 551ec560981f..bfa224cbc791 100644 --- a/sc/inc/attarray.hxx +++ b/sc/inc/attarray.hxx @@ -23,6 +23,9 @@ #include "global.hxx" #include "attrib.hxx" #include <algorithm> +#include <memory> + +#include <svl/itemset.hxx> class ScDocument; class ScEditDataArray; @@ -61,14 +64,14 @@ struct ScLineFlags struct ScMergePatternState { - SfxItemSet* pItemSet; ///< allocated in MergePatternArea, used for resulting ScPatternAttr + std::unique_ptr<SfxItemSet> pItemSet; const ScPatternAttr* pOld1; ///< existing objects, temporary const ScPatternAttr* pOld2; bool mbValidPatternId; sal_uInt64 mnPatternId; - ScMergePatternState() : pItemSet(nullptr), pOld1(nullptr), pOld2(nullptr), + ScMergePatternState() : pOld1(nullptr), pOld2(nullptr), mbValidPatternId(true), mnPatternId(0) {} }; diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx index 9f5141402043..28fd7e5681a4 100644 --- a/sc/source/core/data/attarray.cxx +++ b/sc/source/core/data/attarray.cxx @@ -19,6 +19,7 @@ #include "attarray.hxx" #include "scitems.hxx" +#include <o3tl/make_unique.hxx> #include <svx/algitem.hxx> #include <editeng/boxitem.hxx> #include <editeng/lineitem.hxx> @@ -1017,7 +1018,7 @@ void ScAttrArray::MergePatternArea( SCROW nStartRow, SCROW nEndRow, else { // first pattern - copied from parent - rState.pItemSet = new SfxItemSet( *rThisSet.GetPool(), rThisSet.GetRanges() ); + rState.pItemSet = o3tl::make_unique<SfxItemSet>( *rThisSet.GetPool(), rThisSet.GetRanges() ); rState.pItemSet->Set( rThisSet, bDeep ); rState.mnPatternId = pPattern->GetKey(); } diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 33860d081b33..90e126d588bc 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -4983,7 +4983,7 @@ ScPatternAttr* ScDocument::CreateSelectionPattern( const ScMarkData& rMark, bool OSL_ENSURE( aState.pItemSet, "SelectionPattern Null" ); if (aState.pItemSet) { - ScPatternAttr* pPattern = new ScPatternAttr( aState.pItemSet ); + ScPatternAttr* pPattern = new ScPatternAttr( aState.pItemSet.release() ); if (aState.mbValidPatternId) pPattern->SetKey(aState.mnPatternId); |