diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-06-03 10:02:59 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-06-03 14:28:50 +0200 |
commit | b30839cecd25b9f6f56fcf4b3d3e90ab23a3d0b7 (patch) | |
tree | 6a29596eae72af659b8759343fbf35414609d0e0 /editeng/source | |
parent | 9e6a2a6eb3c959bd9ca3fc3a24ae089489383a69 (diff) |
use std::make_unique instead of new
Change-Id: I267b82dd573fc8bd30e1c5d47e9b1f2e98c2b412
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116645
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'editeng/source')
-rw-r--r-- | editeng/source/rtf/svxrtf.cxx | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx index 43c6a8e6f8e5..9d5f3abe84ec 100644 --- a/editeng/source/rtf/svxrtf.cxx +++ b/editeng/source/rtf/svxrtf.cxx @@ -609,23 +609,34 @@ const vcl::Font& SvxRTFParser::GetFont( sal_uInt16 nId ) return *pDfltFont; } +std::unique_ptr<SvxRTFItemStackType> SvxRTFItemStackType::createSvxRTFItemStackType( + SfxItemPool& rPool, const sal_uInt16* pWhichRange, const EditPosition& rEditPosition) +{ + struct MakeUniqueEnabler : public SvxRTFItemStackType + { + MakeUniqueEnabler(SfxItemPool& rPool, const sal_uInt16* pWhichRange, const EditPosition& rEditPosition) + : SvxRTFItemStackType(rPool, pWhichRange, rEditPosition) + { + } + }; + return std::make_unique<MakeUniqueEnabler>(rPool, pWhichRange, rEditPosition); +} + SvxRTFItemStackType* SvxRTFParser::GetAttrSet_() { SvxRTFItemStackType* pCurrent = aAttrStack.empty() ? nullptr : aAttrStack.back().get(); - std::unique_ptr<SvxRTFItemStackType> pNew; + std::unique_ptr<SvxRTFItemStackType> xNew; if( pCurrent ) - pNew.reset(new SvxRTFItemStackType( *pCurrent, *mxInsertPosition, false/*bCopyAttr*/ )); + xNew = std::make_unique<SvxRTFItemStackType>(*pCurrent, *mxInsertPosition, false/*bCopyAttr*/); else - pNew.reset(new SvxRTFItemStackType( *pAttrPool, aWhichMap.data(), - *mxInsertPosition )); - pNew->SetRTFDefaults( GetRTFDefaults() ); + xNew = SvxRTFItemStackType::createSvxRTFItemStackType(*pAttrPool, aWhichMap.data(), *mxInsertPosition); + xNew->SetRTFDefaults( GetRTFDefaults() ); - aAttrStack.push_back( std::move(pNew) ); + aAttrStack.push_back( std::move(xNew) ); bNewGroup = false; return aAttrStack.back().get(); } - void SvxRTFParser::ClearStyleAttr_( SvxRTFItemStackType& rStkType ) { // check attributes to the attributes of the stylesheet or to |