diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-02-17 12:19:49 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-02-27 19:42:58 +0100 |
commit | 31e7845339b30a69f06a04619660398fe4267268 (patch) | |
tree | 049ffea6c16bfa05e798ca9dac81aa1a05a17aef /editeng/source/uno | |
parent | c97a3592c78ce276a353f95ce68c70a8a39174a0 (diff) |
use more SfxItemSet::CloneAsValue
to reduce heap allocations
Change-Id: Ia755c3e7f9610a5441a447cc74ea38ebcef068bc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130066
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'editeng/source/uno')
-rw-r--r-- | editeng/source/uno/unotext.cxx | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx index 81549327bf24..60e19748fcd8 100644 --- a/editeng/source/uno/unotext.cxx +++ b/editeng/source/uno/unotext.cxx @@ -601,16 +601,16 @@ uno::Any SvxUnoTextRangeBase::_getPropertyValue(const OUString& PropertyName, sa const SfxItemPropertyMapEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName ); if( pMap ) { - std::unique_ptr<SfxItemSet> pAttribs; + std::optional<SfxItemSet> oAttribs; if( nPara != -1 ) - pAttribs = pForwarder->GetParaAttribs( nPara ).Clone(); + oAttribs.emplace(pForwarder->GetParaAttribs( nPara ).CloneAsValue()); else - pAttribs = pForwarder->GetAttribs( GetSelection() ).Clone(); + oAttribs.emplace(pForwarder->GetAttribs( GetSelection() ).CloneAsValue()); // Replace Dontcare with Default, so that one always has a mirror - pAttribs->ClearInvalidItems(); + oAttribs->ClearInvalidItems(); - getPropertyValue( pMap, aAny, *pAttribs ); + getPropertyValue( pMap, aAny, *oAttribs ); return aAny; } @@ -879,13 +879,13 @@ uno::Sequence< uno::Any > SvxUnoTextRangeBase::_getPropertyValues( const uno::Se SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : nullptr; if( pForwarder ) { - std::unique_ptr<SfxItemSet> pAttribs; + std::optional<SfxItemSet> oAttribs; if( nPara != -1 ) - pAttribs = pForwarder->GetParaAttribs( nPara ).Clone(); + oAttribs.emplace(pForwarder->GetParaAttribs( nPara ).CloneAsValue()); else - pAttribs = pForwarder->GetAttribs( GetSelection() ).Clone(); + oAttribs.emplace(pForwarder->GetAttribs( GetSelection() ).CloneAsValue() ); - pAttribs->ClearInvalidItems(); + oAttribs->ClearInvalidItems(); const OUString* pPropertyNames = aPropertyNames.getConstArray(); uno::Any* pValues = aValues.getArray(); @@ -895,7 +895,7 @@ uno::Sequence< uno::Any > SvxUnoTextRangeBase::_getPropertyValues( const uno::Se const SfxItemPropertyMapEntry* pMap = mpPropSet->getPropertyMapEntry( *pPropertyNames ); if( pMap ) { - getPropertyValue( pMap, *pValues, *pAttribs ); + getPropertyValue( pMap, *pValues, *oAttribs ); } } } |