diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-08-15 17:35:58 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-08-16 12:07:15 +0200 |
commit | eec42f0dbcc79a4c9f456ce97fa1066b8031ea28 (patch) | |
tree | f089f757270293bd94dfac881c62520af76975e0 /include/editeng | |
parent | a6ca6215a5ec82e833ebfcd2ebd4455cb504fd8e (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/editeng')
-rw-r--r-- | include/editeng/outliner.hxx | 4 | ||||
-rw-r--r-- | include/editeng/outlobj.hxx | 3 | ||||
-rw-r--r-- | include/editeng/overflowingtxt.hxx | 16 |
3 files changed, 13 insertions, 10 deletions
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index 23ff675707c1..c340bd15c8c0 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -684,7 +684,7 @@ public: void SetToEmptyText(); - std::unique_ptr<OutlinerParaObject> CreateParaObject( sal_Int32 nStartPara = 0, sal_Int32 nParaCount = EE_PARA_ALL ) const; + std::optional<OutlinerParaObject> CreateParaObject( sal_Int32 nStartPara = 0, sal_Int32 nParaCount = EE_PARA_ALL ) const; const SfxItemSet& GetEmptyItemSet() const; @@ -738,7 +738,7 @@ public: void ClearOverflowingParaNum(); bool IsPageOverflow(); - std::unique_ptr<OutlinerParaObject> GetEmptyParaObject() const; + OutlinerParaObject GetEmptyParaObject() const; void DepthChangedHdl(Paragraph*, ParaFlag nPrevFlags); diff --git a/include/editeng/outlobj.hxx b/include/editeng/outlobj.hxx index b2c00a1683ff..fac9bed9ffb9 100644 --- a/include/editeng/outlobj.hxx +++ b/include/editeng/outlobj.hxx @@ -71,13 +71,16 @@ public: OutlinerParaObject(std::unique_ptr<EditTextObject>, const ParagraphDataVector&, bool bIsEditDoc); OutlinerParaObject( std::unique_ptr<EditTextObject> ); OutlinerParaObject( const OutlinerParaObject&); + OutlinerParaObject(OutlinerParaObject&&) noexcept; ~OutlinerParaObject(); // assignment operator OutlinerParaObject& operator=(const OutlinerParaObject& rCandidate); + OutlinerParaObject& operator=(OutlinerParaObject&&) noexcept; // compare operator bool operator==(const OutlinerParaObject& rCandidate) const; + bool operator!=(const OutlinerParaObject& rCandidate) const { return !operator==(rCandidate); } // #i102062# bool isWrongListEqual(const OutlinerParaObject& rCompare) const; diff --git a/include/editeng/overflowingtxt.hxx b/include/editeng/overflowingtxt.hxx index 3ec7a34354a9..043b8ebd21f4 100644 --- a/include/editeng/overflowingtxt.hxx +++ b/include/editeng/overflowingtxt.hxx @@ -50,11 +50,11 @@ class TextChainingUtils public: static css::uno::Reference< css::datatransfer::XTransferable> CreateTransferableFromText(Outliner const *); - static std::unique_ptr<OutlinerParaObject> JuxtaposeParaObject( + static std::optional<OutlinerParaObject> JuxtaposeParaObject( css::uno::Reference< css::datatransfer::XTransferable > const & xOverflowingContent, Outliner *, OutlinerParaObject const *); - static std::unique_ptr<OutlinerParaObject> DeeplyMergeParaObject( + static std::optional<OutlinerParaObject> DeeplyMergeParaObject( css::uno::Reference< css::datatransfer::XTransferable > const & xOverflowingContent, Outliner *, OutlinerParaObject const *); @@ -71,8 +71,8 @@ class OverflowingText public: OverflowingText(css::uno::Reference< css::datatransfer::XTransferable > const & xOverflowingContent); - std::unique_ptr<OutlinerParaObject> JuxtaposeParaObject(Outliner *, OutlinerParaObject const *); - std::unique_ptr<OutlinerParaObject> DeeplyMergeParaObject(Outliner *, OutlinerParaObject const *); + std::optional<OutlinerParaObject> JuxtaposeParaObject(Outliner *, OutlinerParaObject const *); + std::optional<OutlinerParaObject> DeeplyMergeParaObject(Outliner *, OutlinerParaObject const *); private: css::uno::Reference< css::datatransfer::XTransferable > mxOverflowingContent; @@ -83,7 +83,7 @@ class NonOverflowingText public: NonOverflowingText(const ESelection &aSel, bool bLastParaInterrupted); - std::unique_ptr<OutlinerParaObject> RemoveOverflowingText(Outliner *) const; + std::optional<OutlinerParaObject> RemoveOverflowingText(Outliner *) const; ESelection GetOverflowPointSel() const; bool IsLastParaInterrupted() const; @@ -105,8 +105,8 @@ public: OFlowChainedText(Outliner const *, bool ); ~OFlowChainedText(); - std::unique_ptr<OutlinerParaObject> InsertOverflowingText(Outliner *, OutlinerParaObject const *); - std::unique_ptr<OutlinerParaObject> RemoveOverflowingText(Outliner *); + std::optional<OutlinerParaObject> InsertOverflowingText(Outliner *, OutlinerParaObject const *); + std::optional<OutlinerParaObject> RemoveOverflowingText(Outliner *); ESelection GetOverflowPointSel() const; @@ -124,7 +124,7 @@ class EDITENG_DLLPUBLIC UFlowChainedText { public: UFlowChainedText(Outliner const *, bool); - std::unique_ptr<OutlinerParaObject> CreateMergedUnderflowParaObject(Outliner *, OutlinerParaObject const *); + std::optional<OutlinerParaObject> CreateMergedUnderflowParaObject(Outliner *, OutlinerParaObject const *); private: css::uno::Reference< css::datatransfer::XTransferable > mxUnderflowingTxt; |