From e0382c3ad7786910bc9aa81cf581798df0f2508c Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 8 May 2019 08:29:46 +0200 Subject: avoid copying when placing items into SfxItemSet Change-Id: I05c627f590e7794c1ba11b66021dc30aa3285eb0 Reviewed-on: https://gerrit.libreoffice.org/71941 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sc/source/filter/excel/xlroot.cxx | 9 +++------ sc/source/filter/ftools/ftools.cxx | 3 +-- sc/source/filter/rtf/eeimpars.cxx | 20 ++++++++------------ 3 files changed, 12 insertions(+), 20 deletions(-) (limited to 'sc/source/filter') diff --git a/sc/source/filter/excel/xlroot.cxx b/sc/source/filter/excel/xlroot.cxx index c1044e216115..977f848061d6 100644 --- a/sc/source/filter/excel/xlroot.cxx +++ b/sc/source/filter/excel/xlroot.cxx @@ -388,12 +388,9 @@ ScHeaderEditEngine& XclRoot::GetHFEditEngine() const SfxItemSet aItemSet( *GetDoc().GetPool(), svl::Items{} ); ScPatternAttr::FillToEditItemSet( *pEditSet, aItemSet ); // FillToEditItemSet() adjusts font height to 1/100th mm, we need twips - std::unique_ptr pNewItem( aItemSet.Get( ATTR_FONT_HEIGHT ).CloneSetWhich(EE_CHAR_FONTHEIGHT)); - pEditSet->Put( *pNewItem ); - pNewItem = aItemSet.Get( ATTR_CJK_FONT_HEIGHT ).CloneSetWhich(EE_CHAR_FONTHEIGHT_CJK); - pEditSet->Put( *pNewItem ); - pNewItem = aItemSet.Get( ATTR_CTL_FONT_HEIGHT ).CloneSetWhich(EE_CHAR_FONTHEIGHT_CTL); - pEditSet->Put( *pNewItem ); + pEditSet->Put( aItemSet.Get( ATTR_FONT_HEIGHT ).CloneSetWhich(EE_CHAR_FONTHEIGHT) ); + pEditSet->Put( aItemSet.Get( ATTR_CJK_FONT_HEIGHT ).CloneSetWhich(EE_CHAR_FONTHEIGHT_CJK) ); + pEditSet->Put( aItemSet.Get( ATTR_CTL_FONT_HEIGHT ).CloneSetWhich(EE_CHAR_FONTHEIGHT_CTL) ); rEE.SetDefaults( pEditSet ); // takes ownership } return *mrData.mxHFEditEngine; diff --git a/sc/source/filter/ftools/ftools.cxx b/sc/source/filter/ftools/ftools.cxx index 8f9eaed44279..c34c446ea482 100644 --- a/sc/source/filter/ftools/ftools.cxx +++ b/sc/source/filter/ftools/ftools.cxx @@ -211,8 +211,7 @@ void ScfTools::PutItem( SfxItemSet& rItemSet, const SfxPoolItem& rItem, sal_uInt { if( !bSkipPoolDef || (rItem != rItemSet.GetPool()->GetDefaultItem( nWhichId )) ) { - std::unique_ptr pNewItem(rItem.CloneSetWhich(nWhichId)); - rItemSet.Put( *pNewItem ); + rItemSet.Put( rItem.CloneSetWhich(nWhichId) ); } } diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx index 3f3710326292..f6f27d1b061c 100644 --- a/sc/source/filter/rtf/eeimpars.cxx +++ b/sc/source/filter/rtf/eeimpars.cxx @@ -271,27 +271,23 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, double nOutputFactor, SvNu { if ( pFont ) { - std::unique_ptr pNewItem(pFont->CloneSetWhich( - ScGlobal::GetScriptedWhichID(nScript, ATTR_FONT ))); - pAttrItemSet->Put( *pNewItem ); + pAttrItemSet->Put( pFont->CloneSetWhich( + ScGlobal::GetScriptedWhichID(nScript, ATTR_FONT )) ); } if ( pHeight ) { - std::unique_ptr pNewItem(pHeight->CloneSetWhich( - ScGlobal::GetScriptedWhichID(nScript, ATTR_FONT_HEIGHT ))); - pAttrItemSet->Put( *pNewItem ); + pAttrItemSet->Put( pHeight->CloneSetWhich( + ScGlobal::GetScriptedWhichID(nScript, ATTR_FONT_HEIGHT )) ); } if ( pWeight ) { - std::unique_ptr pNewItem(pWeight->CloneSetWhich( - ScGlobal::GetScriptedWhichID(nScript, ATTR_FONT_WEIGHT ))); - pAttrItemSet->Put( *pNewItem ); + pAttrItemSet->Put( pWeight->CloneSetWhich( + ScGlobal::GetScriptedWhichID(nScript, ATTR_FONT_WEIGHT )) ); } if ( pPosture ) { - std::unique_ptr pNewItem(pPosture->CloneSetWhich( - ScGlobal::GetScriptedWhichID(nScript, ATTR_FONT_POSTURE ))); - pAttrItemSet->Put( *pNewItem ); + pAttrItemSet->Put( pPosture->CloneSetWhich( + ScGlobal::GetScriptedWhichID(nScript, ATTR_FONT_POSTURE )) ); } } } -- cgit