summaryrefslogtreecommitdiff
path: root/sw/source/core/doc/docfly.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-08-07 19:19:48 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-08-07 20:36:00 +0200
commitb1cefa026d52fad4557d10c721fe9d5e57200bd6 (patch)
tree95520b9f2ea95b97f6f2442ea9cdcb0570191b0c /sw/source/core/doc/docfly.cxx
parent57ae68004899076303666da3ed7b2ee8a1e5ae94 (diff)
no need to allocate these SwPosition separately
It is a small object, and in these places is already contained inside a heap object. Change-Id: I930d87827104e04fff2ad6b481ed94348a49701d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137930 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/core/doc/docfly.cxx')
-rw-r--r--sw/source/core/doc/docfly.cxx10
1 files changed, 5 insertions, 5 deletions
diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx
index 9915e7de01b2..54d976f40677 100644
--- a/sw/source/core/doc/docfly.cxx
+++ b/sw/source/core/doc/docfly.cxx
@@ -767,11 +767,11 @@ bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList,
// anchored object the complete <SwPosition> is kept, because the
// anchor index position could be moved, if the object again is
// anchored as character.
- std::unique_ptr<const SwPosition> xOldAsCharAnchorPos;
+ std::optional<const SwPosition> oOldAsCharAnchorPos;
const RndStdIds eOldAnchorType = pContact->GetAnchorId();
if ( !_bSameOnly && eOldAnchorType == RndStdIds::FLY_AS_CHAR )
{
- xOldAsCharAnchorPos.reset(new SwPosition(pContact->GetContentAnchor()));
+ oOldAsCharAnchorPos.emplace(pContact->GetContentAnchor());
}
if ( _bSameOnly )
@@ -973,7 +973,7 @@ bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList,
pAnchoredObj->UpdateObjInSortedList();
// #i54336#
- if (xOldAsCharAnchorPos)
+ if (oOldAsCharAnchorPos)
{
if ( pNewAnchorFrame)
{
@@ -981,8 +981,8 @@ bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList,
// The TextAttribut needs to be destroyed which, unfortunately, also
// destroys the format. To avoid that, we disconnect the format from
// the attribute.
- const sal_Int32 nIndx( xOldAsCharAnchorPos->GetContentIndex() );
- SwTextNode* pTextNode( xOldAsCharAnchorPos->GetNode().GetTextNode() );
+ const sal_Int32 nIndx( oOldAsCharAnchorPos->GetContentIndex() );
+ SwTextNode* pTextNode( oOldAsCharAnchorPos->GetNode().GetTextNode() );
assert(pTextNode && "<SwDoc::ChgAnchor(..)> - missing previous anchor text node for as-character anchored object");
SwTextAttr * const pHint =
pTextNode->GetTextAttrForCharAt( nIndx, RES_TXTATR_FLYCNT );