summaryrefslogtreecommitdiff
path: root/sw/inc/PostItMgr.hxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-08-19 10:27:00 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-08-19 13:09:33 +0200
commitb55db12f79a01ccbd3276f4a291fe20750efbaf3 (patch)
tree0f102142980bc0ca86ee2e959f193f7964a1f501 /sw/inc/PostItMgr.hxx
parent1b06e7e9e8c467de3450077fe8b90be6b7f73e4b (diff)
use std::optional<OutlinerParaObject> in SwPostItMgr
it is a COW object, no need to allocate separately on heap Change-Id: I9388d2a850a39a8645071dfb2907a4fe7785ac21 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120703 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/inc/PostItMgr.hxx')
-rw-r--r--sw/inc/PostItMgr.hxx7
1 files changed, 4 insertions, 3 deletions
diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx
index 760fc7f8abe7..a2f0af3b9dea 100644
--- a/sw/inc/PostItMgr.hxx
+++ b/sw/inc/PostItMgr.hxx
@@ -33,6 +33,7 @@
#include <unotools/configitem.hxx>
#include <com/sun/star/uno/Any.hxx>
#include "SidebarWindowsTypes.hxx"
+#include <editeng/outlobj.hxx>
#include <svl/lstner.hxx>
#include <vcl/vclptr.hxx>
@@ -137,7 +138,7 @@ class SAL_DLLPUBLIC_RTTI SwPostItMgr final : public SfxListener
bool mbReadOnly;
bool mbDeleteNote;
FieldShadowState mShadowState;
- OutlinerParaObject* mpAnswer;
+ std::optional<OutlinerParaObject> mpAnswer;
OUString maAnswerText;
bool mbIsShowAnchor;
@@ -251,8 +252,8 @@ class SAL_DLLPUBLIC_RTTI SwPostItMgr final : public SfxListener
static Color GetColorLight(std::size_t aAuthorIndex);
static Color GetColorAnchor(std::size_t aAuthorIndex);
- void RegisterAnswer(OutlinerParaObject* pAnswer) { mpAnswer = pAnswer;}
- OutlinerParaObject* IsAnswer() {return mpAnswer;}
+ void RegisterAnswer(OutlinerParaObject* pAnswer) { if (pAnswer) mpAnswer =* pAnswer; else mpAnswer.reset(); }
+ OutlinerParaObject* IsAnswer() { return mpAnswer ? &*mpAnswer : nullptr; }
void RegisterAnswerText(const OUString& aAnswerText) { maAnswerText = aAnswerText; }
const OUString& GetAnswerText() const { return maAnswerText; }
void CheckMetaText();