diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-13 10:43:45 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-14 08:58:36 +0200 |
commit | cf4b4a75ef813b243986b3dc9b5a4be47b218f06 (patch) | |
tree | 046d6206a0cbf229656e0e62b80c84f2f8db2f5c /sw | |
parent | e1beb569ff54c2b9dde6dd442c6ea1cc53a03222 (diff) |
loplugin:useuniqueptr in SwDoc::CopyPageDescHeaderFooterImpl
Change-Id: I14841e14272878d0a17f58b001df9bf1c937f0f2
Reviewed-on: https://gerrit.libreoffice.org/60446
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/doc/docfmt.cxx | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 6eba1a85d01f..0300c658262f 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -1359,13 +1359,13 @@ void SwDoc::CopyPageDescHeaderFooterImpl( bool bCpyHeader, return ; // The header only contains the reference to the format from the other document! - SfxPoolItem* pNewItem = pItem->Clone(); + std::unique_ptr<SfxPoolItem> pNewItem(pItem->Clone()); SwFrameFormat* pOldFormat; if( bCpyHeader ) - pOldFormat = static_cast<SwFormatHeader*>(pNewItem)->GetHeaderFormat(); + pOldFormat = static_cast<SwFormatHeader*>(pNewItem.get())->GetHeaderFormat(); else - pOldFormat = static_cast<SwFormatFooter*>(pNewItem)->GetFooterFormat(); + pOldFormat = static_cast<SwFormatFooter*>(pNewItem.get())->GetFooterFormat(); if( pOldFormat ) { @@ -1397,12 +1397,11 @@ void SwDoc::CopyPageDescHeaderFooterImpl( bool bCpyHeader, pNewFormat->ResetFormatAttr( RES_CNTNT ); } if( bCpyHeader ) - static_cast<SwFormatHeader*>(pNewItem)->RegisterToFormat(*pNewFormat); + static_cast<SwFormatHeader*>(pNewItem.get())->RegisterToFormat(*pNewFormat); else - static_cast<SwFormatFooter*>(pNewItem)->RegisterToFormat(*pNewFormat); + static_cast<SwFormatFooter*>(pNewItem.get())->RegisterToFormat(*pNewFormat); rDestFormat.SetFormatAttr( *pNewItem ); } - delete pNewItem; } void SwDoc::CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc, |