diff options
-rw-r--r-- | editeng/source/rtf/svxrtf.cxx | 25 | ||||
-rw-r--r-- | include/editeng/svxrtf.hxx | 3 |
2 files changed, 21 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 diff --git a/include/editeng/svxrtf.hxx b/include/editeng/svxrtf.hxx index d19c542885bf..d322b1823e2b 100644 --- a/include/editeng/svxrtf.hxx +++ b/include/editeng/svxrtf.hxx @@ -304,6 +304,9 @@ class SvxRTFItemStackType SvxRTFItemStackType( SfxItemPool&, const sal_uInt16* pWhichRange, const EditPosition& ); + static std::unique_ptr<SvxRTFItemStackType> createSvxRTFItemStackType( + SfxItemPool&, const sal_uInt16* pWhichRange, const EditPosition&); + void Add(std::unique_ptr<SvxRTFItemStackType>); void Compress( const SvxRTFParser& ); void DropChildList(); |