diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-01-10 16:36:08 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-01-11 08:41:26 +0100 |
commit | 9fd69aba34f9818ac760f5704e007b92679d65b1 (patch) | |
tree | 88387c1f1225d1112443caafcddd47ad0445118d /sw | |
parent | 3c7b2b7279bc5d4fd72ae0b1d1fc50812792ed08 (diff) |
use unique_ptr in SwUndoDelSection
Change-Id: I2637872300c60f880e32b00f5f545f6145b563bf
Reviewed-on: https://gerrit.libreoffice.org/66120
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/undo/unsect.cxx | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/sw/source/core/undo/unsect.cxx b/sw/source/core/undo/unsect.cxx index 1a40d6c5b424..d10680ab9f97 100644 --- a/sw/source/core/undo/unsect.cxx +++ b/sw/source/core/undo/unsect.cxx @@ -42,12 +42,12 @@ #include <calc.hxx> #include <o3tl/make_unique.hxx> -static SfxItemSet* lcl_GetAttrSet( const SwSection& rSect ) +static std::unique_ptr<SfxItemSet> lcl_GetAttrSet( const SwSection& rSect ) { // save attributes of the format (columns, color, ...) // Content and Protect items are not interesting since they are already // stored in Section, thus delete them. - SfxItemSet* pAttr = nullptr; + std::unique_ptr<SfxItemSet> pAttr; if( rSect.GetFormat() ) { sal_uInt16 nCnt = 1; @@ -56,13 +56,12 @@ static SfxItemSet* lcl_GetAttrSet( const SwSection& rSect ) if( nCnt < rSect.GetFormat()->GetAttrSet().Count() ) { - pAttr = new SfxItemSet( rSect.GetFormat()->GetAttrSet() ); + pAttr.reset(new SfxItemSet( rSect.GetFormat()->GetAttrSet() )); pAttr->ClearItem( RES_PROTECT ); pAttr->ClearItem( RES_CNTNT ); if( !pAttr->Count() ) { - delete pAttr; - pAttr = nullptr; + pAttr.reset(); } } } @@ -424,7 +423,7 @@ void SwUndoUpdateSection::UndoImpl(::sw::UndoRedoContext & rContext) SwSection& rNdSect = pSectNd->GetSection(); SwFormat* pFormat = rNdSect.GetFormat(); - SfxItemSet* pCur = ::lcl_GetAttrSet( rNdSect ); + std::unique_ptr<SfxItemSet> pCur = ::lcl_GetAttrSet( rNdSect ); if (m_pAttrSet) { // The Content and Protect items must persist @@ -445,7 +444,7 @@ void SwUndoUpdateSection::UndoImpl(::sw::UndoRedoContext & rContext) pFormat->ResetFormatAttr( RES_HEADER, RES_OPAQUE ); pFormat->ResetFormatAttr( RES_SURROUND, RES_FRMATR_END-1 ); } - m_pAttrSet.reset(pCur); + m_pAttrSet = std::move(pCur); if (!m_bOnlyAttrChanged) { |