summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-09-19 21:02:25 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-09-20 12:29:46 +0200
commite2e43363b429b7909ed3dbe79ccab35d0274106e (patch)
treeb32b5a030d8f5b3300bb8871192f3b75cdcda84a
parent1405f98b6e0fc43d41c3b8f16923589eccd08495 (diff)
no need to allocate these SfxItemSet on the heap
Change-Id: I1703ee1d7cfc5f3f3458dce8db36fa86c578814c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122331 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sw/source/core/frmedt/fefly1.cxx14
1 files changed, 7 insertions, 7 deletions
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index a453e9906c65..821b5b53e5ff 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -1244,19 +1244,19 @@ void SwFEShell::SetFrameFormat( SwFrameFormat *pNewFormat, bool bKeepOrient, Poi
SwFlyFrameFormat* pFlyFormat = pFly->GetFormat();
const Point aPt( pFly->getFrameArea().Pos() );
- std::unique_ptr<SfxItemSet> pSet;
+ std::optional<SfxItemSet> oSet;
const SfxPoolItem* pItem;
if( SfxItemState::SET == pNewFormat->GetItemState( RES_ANCHOR, false, &pItem ))
{
- pSet.reset(new SfxItemSet( GetDoc()->GetAttrPool(), aFrameFormatSetRange ));
- pSet->Put( *pItem );
- if( !sw_ChkAndSetNewAnchor( *pFly, *pSet ))
+ oSet.emplace( GetDoc()->GetAttrPool(), aFrameFormatSetRange );
+ oSet->Put( *pItem );
+ if( !sw_ChkAndSetNewAnchor( *pFly, *oSet ))
{
- pSet.reset();
+ oSet.reset();
}
}
- if( GetDoc()->SetFrameFormatToFly( *pFlyFormat, *pNewFormat, pSet.get(), bKeepOrient ))
+ if( GetDoc()->SetFrameFormatToFly( *pFlyFormat, *pNewFormat, oSet ? &*oSet : nullptr, bKeepOrient ))
{
SwFlyFrame* pFrame = pFlyFormat->GetFrame( &aPt );
if( pFrame )
@@ -1264,7 +1264,7 @@ void SwFEShell::SetFrameFormat( SwFrameFormat *pNewFormat, bool bKeepOrient, Poi
else
GetLayout()->SetAssertFlyPages();
}
- pSet.reset();
+ oSet.reset();
EndAllActionAndCall();
}