diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-08-07 17:31:38 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-08-07 18:59:25 +0200 |
commit | 80f99cda3d25180f0b9fbdbb6f25c7e3e295fee9 (patch) | |
tree | a1dd24b3e9bfde0b59b4467426fc044c92548e84 /sw/inc | |
parent | cf2a7501fa1848fdccd9717f52f18d0f44db458b (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: Ib90f482c850d7e376637c5a11a7d09d78081719a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137927
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/inc')
-rw-r--r-- | sw/inc/HandleAnchorNodeChg.hxx | 2 | ||||
-rw-r--r-- | sw/inc/fmtanchr.hxx | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/sw/inc/HandleAnchorNodeChg.hxx b/sw/inc/HandleAnchorNodeChg.hxx index 446f9ac710a6..540e87a685bd 100644 --- a/sw/inc/HandleAnchorNodeChg.hxx +++ b/sw/inc/HandleAnchorNodeChg.hxx @@ -63,7 +63,7 @@ private: bool mbAnchorNodeChanged; /// If the fly frame has a comment, this points to the old comment anchor. - std::unique_ptr<SwPosition> mpCommentAnchor; + std::optional<SwPosition> moCommentAnchor; SwWrtShell* mpWrtShell; diff --git a/sw/inc/fmtanchr.hxx b/sw/inc/fmtanchr.hxx index 05a190bd5e1d..8dc5ecf59db6 100644 --- a/sw/inc/fmtanchr.hxx +++ b/sw/inc/fmtanchr.hxx @@ -22,10 +22,12 @@ #include "swdllapi.h" #include "hintids.hxx" #include "format.hxx" +#include "pam.hxx" #include <svl/poolitem.hxx> #include <svx/swframetypes.hxx> #include <memory> +#include <optional> struct SwPosition; class IntlWrapper; @@ -33,7 +35,7 @@ class IntlWrapper; /// FlyAnchors class SW_DLLPUBLIC SwFormatAnchor final : public SfxPoolItem { - std::unique_ptr<SwPosition> m_pContentAnchor; /**< 0 for page-bound frames. + std::optional<SwPosition> m_oContentAnchor; /**< 0 for page-bound frames. Index for paragraph-bound frames. Position for character-bound frames. */ RndStdIds m_eAnchorId; @@ -64,7 +66,7 @@ public: RndStdIds GetAnchorId() const { return m_eAnchorId; } sal_uInt16 GetPageNum() const { return m_nPageNumber; } - const SwPosition *GetContentAnchor() const { return m_pContentAnchor.get(); } + const SwPosition* GetContentAnchor() const { return m_oContentAnchor ? &*m_oContentAnchor : nullptr; } // #i28701# sal_uInt32 GetOrder() const { return m_nOrder;} |