summaryrefslogtreecommitdiff
path: root/include/svx
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-08-15 17:35:58 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-08-16 12:07:15 +0200
commiteec42f0dbcc79a4c9f456ce97fa1066b8031ea28 (patch)
treef089f757270293bd94dfac881c62520af76975e0 /include/svx
parenta6ca6215a5ec82e833ebfcd2ebd4455cb504fd8e (diff)
pass OutlinerParaObject around by value
since it uses o3tl::cow_wrapper, so it is really just a wrapper around a pointer, no point in allocating it on the heap Remove assert in SdrText::SetOutlinerParaObject, which was bogus anyhow, because it was comparing pointers, not deep equality. And since we are now being more efficient and avoiding copying of the internal data in OutlinerParaObject, we hit this assert. Change-Id: I6dbfaab5ee2ca05b2001baf63110041e469df9c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120510 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/svx')
-rw-r--r--include/svx/svdoashp.hxx2
-rw-r--r--include/svx/svdobj.hxx4
-rw-r--r--include/svx/svdomeas.hxx2
-rw-r--r--include/svx/svdotable.hxx2
-rw-r--r--include/svx/svdotext.hxx6
-rw-r--r--include/svx/svdtext.hxx11
-rw-r--r--include/svx/svdundo.hxx5
7 files changed, 18 insertions, 14 deletions
diff --git a/include/svx/svdoashp.hxx b/include/svx/svdoashp.hxx
index 48374bc035aa..bb0d3446292e 100644
--- a/include/svx/svdoashp.hxx
+++ b/include/svx/svdoashp.hxx
@@ -220,7 +220,7 @@ public:
virtual basegfx::B2DPolyPolygon TakeXorPoly() const override;
virtual basegfx::B2DPolyPolygon TakeContour() const override;
- virtual void NbcSetOutlinerParaObject(std::unique_ptr<OutlinerParaObject> pTextObject) override;
+ virtual void NbcSetOutlinerParaObject(std::optional<OutlinerParaObject> pTextObject) override;
virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override;
diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx
index d10adcd36445..d3b8089d4d64 100644
--- a/include/svx/svdobj.hxx
+++ b/include/svx/svdobj.hxx
@@ -631,8 +631,8 @@ public:
// keep text in outliner's format
// SetOutlinerParaObject: transfer ownership of *pTextObject!
- void SetOutlinerParaObject(std::unique_ptr<OutlinerParaObject> pTextObject);
- virtual void NbcSetOutlinerParaObject(std::unique_ptr<OutlinerParaObject> pTextObject);
+ void SetOutlinerParaObject(std::optional<OutlinerParaObject> pTextObject);
+ virtual void NbcSetOutlinerParaObject(std::optional<OutlinerParaObject> pTextObject);
virtual OutlinerParaObject* GetOutlinerParaObject() const;
virtual void NbcReformatText();
diff --git a/include/svx/svdomeas.hxx b/include/svx/svdomeas.hxx
index 83277c5e9831..15a6d0e0026e 100644
--- a/include/svx/svdomeas.hxx
+++ b/include/svx/svdomeas.hxx
@@ -131,7 +131,7 @@ public:
virtual void TakeTextAnchorRect(tools::Rectangle& rAnchorRect) const override;
virtual void TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, tools::Rectangle* pViewInit, tools::Rectangle* pViewMin) const override;
virtual EEAnchorMode GetOutlinerViewAnchorMode() const override;
- virtual void NbcSetOutlinerParaObject(std::unique_ptr<OutlinerParaObject> pTextObject) override;
+ virtual void NbcSetOutlinerParaObject(std::optional<OutlinerParaObject> pTextObject) override;
virtual OutlinerParaObject* GetOutlinerParaObject() const override;
virtual bool CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_uInt16 nPos,
diff --git a/include/svx/svdotable.hxx b/include/svx/svdotable.hxx
index 710da9379628..18497bcc2494 100644
--- a/include/svx/svdotable.hxx
+++ b/include/svx/svdotable.hxx
@@ -239,7 +239,7 @@ public:
void TakeTextEditArea(const sdr::table::CellPos& rPos, Size* pPaperMin, Size* pPaperMax, tools::Rectangle* pViewInit, tools::Rectangle* pViewMin) const;
virtual EEAnchorMode GetOutlinerViewAnchorMode() const override;
- virtual void NbcSetOutlinerParaObject(std::unique_ptr<OutlinerParaObject> pTextObject) override;
+ virtual void NbcSetOutlinerParaObject(std::optional<OutlinerParaObject> pTextObject) override;
virtual OutlinerParaObject* GetOutlinerParaObject() const override;
diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index 546c856ca912..d192552d16ad 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -488,11 +488,11 @@ public:
virtual void EndTextEdit(SdrOutliner& rOutl);
virtual EEAnchorMode GetOutlinerViewAnchorMode() const;
- virtual void NbcSetOutlinerParaObject(std::unique_ptr<OutlinerParaObject> pTextObject) override;
- void NbcSetOutlinerParaObjectForText( std::unique_ptr<OutlinerParaObject> pTextObject, SdrText* pText );
+ virtual void NbcSetOutlinerParaObject(std::optional<OutlinerParaObject> pTextObject) override;
+ void NbcSetOutlinerParaObjectForText( std::optional<OutlinerParaObject> pTextObject, SdrText* pText );
virtual OutlinerParaObject* GetOutlinerParaObject() const override;
bool CanCreateEditOutlinerParaObject() const;
- std::unique_ptr<OutlinerParaObject> CreateEditOutlinerParaObject() const;
+ std::optional<OutlinerParaObject> CreateEditOutlinerParaObject() const;
virtual void NbcReformatText() override;
diff --git a/include/svx/svdtext.hxx b/include/svx/svdtext.hxx
index 4a11c12b841e..b3c5cbbf90ec 100644
--- a/include/svx/svdtext.hxx
+++ b/include/svx/svdtext.hxx
@@ -19,10 +19,12 @@
#pragma once
+#include <editeng/outlobj.hxx>
#include <svx/sdr/properties/defaultproperties.hxx>
#include <svx/svxdllapi.h>
#include <tools/weakbase.hxx>
#include <memory>
+#include <optional>
class OutlinerParaObject;
class SdrOutliner;
@@ -48,8 +50,9 @@ public:
void ForceOutlinerParaObject(OutlinerMode nOutlMode);
- virtual void SetOutlinerParaObject(std::unique_ptr<OutlinerParaObject> pTextObject);
- OutlinerParaObject* GetOutlinerParaObject() const;
+ virtual void SetOutlinerParaObject(std::optional<OutlinerParaObject> pTextObject);
+ OutlinerParaObject* GetOutlinerParaObject();
+ const OutlinerParaObject* GetOutlinerParaObject() const;
void CheckPortionInfo(SdrOutliner& rOutliner);
void ReformatText();
@@ -63,7 +66,7 @@ public:
SdrTextObj& GetObject() const { return mrObject; }
/** returns the current OutlinerParaObject and removes it from this instance */
- std::unique_ptr<OutlinerParaObject> RemoveOutlinerParaObject();
+ std::optional<OutlinerParaObject> RemoveOutlinerParaObject();
void dumpAsXml(xmlTextWriterPtr pWriter) const;
@@ -72,7 +75,7 @@ protected:
virtual SfxStyleSheet* GetStyleSheet() const;
private:
- std::unique_ptr<OutlinerParaObject> mpOutlinerParaObject;
+ std::optional<OutlinerParaObject> mpOutlinerParaObject;
SdrTextObj& mrObject;
bool mbPortionInfoChecked;
};
diff --git a/include/svx/svdundo.hxx b/include/svx/svdundo.hxx
index cdfd8070f6ac..ccfa69476bba 100644
--- a/include/svx/svdundo.hxx
+++ b/include/svx/svdundo.hxx
@@ -25,6 +25,7 @@
#include <memory>
#include <vector>
+#include <editeng/outlobj.hxx>
#include <svl/undo.hxx>
#include <svl/style.hxx>
#include <tools/gen.hxx>
@@ -393,9 +394,9 @@ public:
class SVXCORE_DLLPUBLIC SdrUndoObjSetText : public SdrUndoObj
{
protected:
- std::unique_ptr<OutlinerParaObject>
+ std::optional<OutlinerParaObject>
pOldText;
- std::unique_ptr<OutlinerParaObject>
+ std::optional<OutlinerParaObject>
pNewText;
bool bNewTextAvailable;
bool bEmptyPresObj;