diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-05-08 08:29:46 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-05-09 08:47:50 +0200 |
commit | e0382c3ad7786910bc9aa81cf581798df0f2508c (patch) | |
tree | 6acb0196add99896ced2aa1a76ff5b432bc45401 /forms | |
parent | 38a684f72988f29e1c07bf9fa5a83e275e80e24c (diff) |
avoid copying when placing items into SfxItemSet
Change-Id: I05c627f590e7794c1ba11b66021dc30aa3285eb0
Reviewed-on: https://gerrit.libreoffice.org/71941
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'forms')
-rw-r--r-- | forms/source/richtext/richtextimplcontrol.cxx | 4 | ||||
-rw-r--r-- | forms/source/richtext/rtattributehandler.cxx | 9 |
2 files changed, 4 insertions, 9 deletions
diff --git a/forms/source/richtext/richtextimplcontrol.cxx b/forms/source/richtext/richtextimplcontrol.cxx index 50f240aeae93..fb63c82bfc39 100644 --- a/forms/source/richtext/richtextimplcontrol.cxx +++ b/forms/source/richtext/richtextimplcontrol.cxx @@ -228,9 +228,7 @@ namespace frm WhichId nNormalizedWhichId = _rScriptSetItem.GetItemSet().GetPool()->GetWhich( _rScriptSetItem.Which() ); if ( pNormalizedItem ) { - std::unique_ptr<SfxPoolItem> pProperWhich(pNormalizedItem->Clone()); - pProperWhich->SetWhich( nNormalizedWhichId ); - _rScriptSetItem.GetItemSet().Put( *pProperWhich ); + _rScriptSetItem.GetItemSet().Put( pNormalizedItem->CloneSetWhich(nNormalizedWhichId) ); } else _rScriptSetItem.GetItemSet().InvalidateItem( nNormalizedWhichId ); diff --git a/forms/source/richtext/rtattributehandler.cxx b/forms/source/richtext/rtattributehandler.cxx index 7c2845e9b34f..1f17b32c3396 100644 --- a/forms/source/richtext/rtattributehandler.cxx +++ b/forms/source/richtext/rtattributehandler.cxx @@ -291,13 +291,12 @@ namespace frm { if ( _pAdditionalArg ) { - std::unique_ptr<SfxPoolItem> pCorrectWich(_pAdditionalArg->Clone()); - pCorrectWich->SetWhich( getWhich() ); + std::unique_ptr<SfxPoolItem> pCorrectWich(_pAdditionalArg->CloneSetWhich(getWhich())); if ( m_bScriptDependent ) putItemForScript( _rNewAttribs, *pCorrectWich, _nForScriptType ); else - _rNewAttribs.Put( *pCorrectWich ); + _rNewAttribs.Put( std::move(pCorrectWich) ); } else OSL_FAIL( "SlotHandler::executeAttribute: need attributes to do something!" ); @@ -433,9 +432,7 @@ namespace frm OSL_ENSURE( dynamic_cast<const SfxBoolItem*>( _pAdditionalArg) != nullptr, "BooleanHandler::executeAttribute: invalid argument!" ); if ( _pAdditionalArg ) { - std::unique_ptr<SfxPoolItem> pCorrectWich(_pAdditionalArg->Clone()); - pCorrectWich->SetWhich( getWhich() ); - _rNewAttribs.Put( *pCorrectWich ); + _rNewAttribs.Put( _pAdditionalArg->CloneSetWhich(getWhich()) ); } } |