summaryrefslogtreecommitdiff
path: root/sc/source/ui/drawfunc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-02-17 12:19:49 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-02-27 19:42:58 +0100
commit31e7845339b30a69f06a04619660398fe4267268 (patch)
tree049ffea6c16bfa05e798ca9dac81aa1a05a17aef /sc/source/ui/drawfunc
parentc97a3592c78ce276a353f95ce68c70a8a39174a0 (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 'sc/source/ui/drawfunc')
-rw-r--r--sc/source/ui/drawfunc/drawsh.cxx24
1 files changed, 12 insertions, 12 deletions
diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx
index 348fb56d53d6..760974b95ffe 100644
--- a/sc/source/ui/drawfunc/drawsh.cxx
+++ b/sc/source/ui/drawfunc/drawsh.cxx
@@ -68,12 +68,12 @@ SFX_IMPL_INTERFACE(ScDrawShell, SfxShell)
namespace
{
- void lcl_convertStringArguments(sal_uInt16 nSlot, const std::unique_ptr<SfxItemSet>& pArgs)
+ void lcl_convertStringArguments(sal_uInt16 nSlot, SfxItemSet& rArgs)
{
Color aColor;
const SfxPoolItem* pItem = nullptr;
- if (SfxItemState::SET == pArgs->GetItemState(SID_ATTR_LINE_WIDTH_ARG, false, &pItem))
+ if (SfxItemState::SET == rArgs.GetItemState(SID_ATTR_LINE_WIDTH_ARG, false, &pItem))
{
double fValue = static_cast<const SvxDoubleItem*>(pItem)->GetValue();
// FIXME: different units...
@@ -81,9 +81,9 @@ namespace
int nValue = fValue * nPow;
XLineWidthItem aItem(nValue);
- pArgs->Put(aItem);
+ rArgs.Put(aItem);
}
- else if (SfxItemState::SET == pArgs->GetItemState(SID_ATTR_COLOR_STR, false, &pItem))
+ else if (SfxItemState::SET == rArgs.GetItemState(SID_ATTR_COLOR_STR, false, &pItem))
{
OUString sColor = static_cast<const SfxStringItem*>(pItem)->GetValue();
@@ -97,33 +97,33 @@ namespace
case SID_ATTR_LINE_COLOR:
{
XLineColorItem aLineColorItem(OUString(), aColor);
- pArgs->Put(aLineColorItem);
+ rArgs.Put(aLineColorItem);
break;
}
case SID_ATTR_FILL_COLOR:
{
XFillColorItem aFillColorItem(OUString(), aColor);
- pArgs->Put(aFillColorItem);
+ rArgs.Put(aFillColorItem);
break;
}
case SID_ATTR_SHADOW_COLOR:
{
XColorItem aItem(SDRATTR_SHADOWCOLOR, aColor);
- pArgs->Put(aItem);
+ rArgs.Put(aItem);
break;
}
}
}
- if (SfxItemState::SET == pArgs->GetItemState(SID_FILL_GRADIENT_JSON, false, &pItem))
+ if (SfxItemState::SET == rArgs.GetItemState(SID_FILL_GRADIENT_JSON, false, &pItem))
{
const SfxStringItem* pJSON = static_cast<const SfxStringItem*>(pItem);
if (pJSON)
{
XGradient aGradient = XGradient::fromJSON(pJSON->GetValue());
XFillGradientItem aItem(aGradient);
- pArgs->Put(aItem);
+ rArgs.Put(aItem);
}
}
}
@@ -294,9 +294,9 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq )
if( pView->AreObjectsMarked() )
{
- std::unique_ptr<SfxItemSet> pNewArgs = rReq.GetArgs()->Clone();
- lcl_convertStringArguments( rReq.GetSlot(), pNewArgs );
- pView->SetAttrToMarked( *pNewArgs, false );
+ SfxItemSet aNewArgs = rReq.GetArgs()->CloneAsValue();
+ lcl_convertStringArguments( rReq.GetSlot(), aNewArgs );
+ pView->SetAttrToMarked( aNewArgs, false );
}
else
pView->SetDefaultAttr( *rReq.GetArgs(), false);