diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-06-29 15:38:29 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-02 08:47:58 +0200 |
commit | 50c63e5c2f7962e8893e2d04b0e958209432f4c9 (patch) | |
tree | 308893225e96328c5ff5fd071a97c2110e61577b /include | |
parent | d98f1e4e0373782ad71b945dcc92c1c3d6dcf6c8 (diff) |
pass OutlinerParaObject around by std::unique_ptr
SdrText::SetOutlinerParaObject was modified to not check for
self-assign, and instead assert because
the existing check was no longer possible.
Fix bug in SdrUndoObjSetText::Undo(), where it was calling
SdrText::SetOutlinerParaObject unnecessarily,
because NbcSetOutlinerParaObjectForText already does that.
Optimise Outliner::GetEmptyParaObject by creating a new constructor for
OutlinerParaObject,
so we don't need to copy the new object we get back from
GetEmptyTextObject, unnecessarily.
Change-Id: I57c475583d6c31658c154e24992b3d587bad9841
Reviewed-on: https://gerrit.libreoffice.org/56730
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r-- | include/editeng/outliner.hxx | 4 | ||||
-rw-r--r-- | include/editeng/outlobj.hxx | 1 | ||||
-rw-r--r-- | include/editeng/overflowingtxt.hxx | 16 | ||||
-rw-r--r-- | include/svx/svdoashp.hxx | 2 | ||||
-rw-r--r-- | include/svx/svdobj.hxx | 4 | ||||
-rw-r--r-- | include/svx/svdomeas.hxx | 2 | ||||
-rw-r--r-- | include/svx/svdotable.hxx | 2 | ||||
-rw-r--r-- | include/svx/svdotext.hxx | 6 | ||||
-rw-r--r-- | include/svx/svdtext.hxx | 2 |
9 files changed, 20 insertions, 19 deletions
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index 03743cd362ee..c0d4a9a82437 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -705,7 +705,7 @@ public: void SetToEmptyText(); - OutlinerParaObject* CreateParaObject( sal_Int32 nStartPara = 0, sal_Int32 nParaCount = EE_PARA_ALL ) const; + std::unique_ptr<OutlinerParaObject> CreateParaObject( sal_Int32 nStartPara = 0, sal_Int32 nParaCount = EE_PARA_ALL ) const; const SfxItemSet& GetEmptyItemSet() const; @@ -759,7 +759,7 @@ public: void ClearOverflowingParaNum(); bool IsPageOverflow(); - OutlinerParaObject *GetEmptyParaObject() const; + std::unique_ptr<OutlinerParaObject> GetEmptyParaObject() const; void DepthChangedHdl(Paragraph*, ParaFlag nPrevFlags); diff --git a/include/editeng/outlobj.hxx b/include/editeng/outlobj.hxx index 0186ce72af16..b7ddc4c59403 100644 --- a/include/editeng/outlobj.hxx +++ b/include/editeng/outlobj.hxx @@ -66,6 +66,7 @@ public: // constructors/destructor OutlinerParaObject( const EditTextObject&, const ParagraphDataVector&, bool bIsEditDoc); OutlinerParaObject( const EditTextObject&); + OutlinerParaObject( std::unique_ptr<EditTextObject> ); OutlinerParaObject( const OutlinerParaObject&); ~OutlinerParaObject(); diff --git a/include/editeng/overflowingtxt.hxx b/include/editeng/overflowingtxt.hxx index 19bf287995d5..66d4527648c8 100644 --- a/include/editeng/overflowingtxt.hxx +++ b/include/editeng/overflowingtxt.hxx @@ -51,11 +51,11 @@ class TextChainingUtils public: static css::uno::Reference< css::datatransfer::XTransferable> CreateTransferableFromText(Outliner const *); - static OutlinerParaObject *JuxtaposeParaObject( + static std::unique_ptr<OutlinerParaObject> JuxtaposeParaObject( css::uno::Reference< css::datatransfer::XTransferable > const & xOverflowingContent, Outliner *, OutlinerParaObject const *); - static OutlinerParaObject *DeeplyMergeParaObject( + static std::unique_ptr<OutlinerParaObject> DeeplyMergeParaObject( css::uno::Reference< css::datatransfer::XTransferable > const & xOverflowingContent, Outliner *, OutlinerParaObject const *); @@ -70,8 +70,8 @@ public: class OverflowingText { public: - OutlinerParaObject *JuxtaposeParaObject(Outliner *, OutlinerParaObject const *); - OutlinerParaObject *DeeplyMergeParaObject(Outliner *, OutlinerParaObject const *); + std::unique_ptr<OutlinerParaObject> JuxtaposeParaObject(Outliner *, OutlinerParaObject const *); + std::unique_ptr<OutlinerParaObject> DeeplyMergeParaObject(Outliner *, OutlinerParaObject const *); private: friend class Outliner; @@ -83,7 +83,7 @@ private: class NonOverflowingText { public: - OutlinerParaObject *RemoveOverflowingText(Outliner *) const; + std::unique_ptr<OutlinerParaObject> RemoveOverflowingText(Outliner *) const; ESelection GetOverflowPointSel() const; bool IsLastParaInterrupted() const; @@ -108,8 +108,8 @@ public: OFlowChainedText(Outliner const *, bool ); ~OFlowChainedText(); - OutlinerParaObject *InsertOverflowingText(Outliner *, OutlinerParaObject const *); - OutlinerParaObject *RemoveOverflowingText(Outliner *); + std::unique_ptr<OutlinerParaObject> InsertOverflowingText(Outliner *, OutlinerParaObject const *); + std::unique_ptr<OutlinerParaObject> RemoveOverflowingText(Outliner *); ESelection GetOverflowPointSel() const; @@ -127,7 +127,7 @@ class EDITENG_DLLPUBLIC UFlowChainedText { public: UFlowChainedText(Outliner const *, bool); - OutlinerParaObject *CreateMergedUnderflowParaObject(Outliner *, OutlinerParaObject const *); + std::unique_ptr<OutlinerParaObject> CreateMergedUnderflowParaObject(Outliner *, OutlinerParaObject const *); private: css::uno::Reference< css::datatransfer::XTransferable > mxUnderflowingTxt; diff --git a/include/svx/svdoashp.hxx b/include/svx/svdoashp.hxx index e82e5018d137..8247b9b5fcce 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(OutlinerParaObject* pTextObject) override; + virtual void NbcSetOutlinerParaObject(std::unique_ptr<OutlinerParaObject> pTextObject) override; virtual SdrObject* DoConvertToPolyObj(bool bBezier, bool bAddText) const override; diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx index 21529b482147..d97edb022e4c 100644 --- a/include/svx/svdobj.hxx +++ b/include/svx/svdobj.hxx @@ -680,8 +680,8 @@ public: // keep text in outliner's format // SetOutlinerParaObject: transfer ownership of *pTextObject! - void SetOutlinerParaObject(OutlinerParaObject* pTextObject); - virtual void NbcSetOutlinerParaObject(OutlinerParaObject* pTextObject); + void SetOutlinerParaObject(std::unique_ptr<OutlinerParaObject> pTextObject); + virtual void NbcSetOutlinerParaObject(std::unique_ptr<OutlinerParaObject> pTextObject); virtual OutlinerParaObject* GetOutlinerParaObject() const; virtual void NbcReformatText(); virtual void ReformatText(); diff --git a/include/svx/svdomeas.hxx b/include/svx/svdomeas.hxx index 72abb9abefcd..0e30251dcab5 100644 --- a/include/svx/svdomeas.hxx +++ b/include/svx/svdomeas.hxx @@ -136,7 +136,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(OutlinerParaObject* pTextObject) override; + virtual void NbcSetOutlinerParaObject(std::unique_ptr<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 1119c8c9fc59..ad42885a124f 100644 --- a/include/svx/svdotable.hxx +++ b/include/svx/svdotable.hxx @@ -237,7 +237,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(OutlinerParaObject* pTextObject) override; + virtual void NbcSetOutlinerParaObject(std::unique_ptr<OutlinerParaObject> pTextObject) override; virtual OutlinerParaObject* GetOutlinerParaObject() const override; diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx index 7be26b52d40f..3b0e307246ba 100644 --- a/include/svx/svdotext.hxx +++ b/include/svx/svdotext.hxx @@ -488,10 +488,10 @@ public: virtual void EndTextEdit(SdrOutliner& rOutl); virtual EEAnchorMode GetOutlinerViewAnchorMode() const; - virtual void NbcSetOutlinerParaObject(OutlinerParaObject* pTextObject) override; - void NbcSetOutlinerParaObjectForText( OutlinerParaObject* pTextObject, SdrText* pText ); + virtual void NbcSetOutlinerParaObject(std::unique_ptr<OutlinerParaObject> pTextObject) override; + void NbcSetOutlinerParaObjectForText( std::unique_ptr<OutlinerParaObject> pTextObject, SdrText* pText ); virtual OutlinerParaObject* GetOutlinerParaObject() const override; - OutlinerParaObject* GetEditOutlinerParaObject() const; + std::unique_ptr<OutlinerParaObject> GetEditOutlinerParaObject() const; virtual void NbcReformatText() override; virtual void ReformatText() override; diff --git a/include/svx/svdtext.hxx b/include/svx/svdtext.hxx index 11b91f028fb8..18f8d0bc7e00 100644 --- a/include/svx/svdtext.hxx +++ b/include/svx/svdtext.hxx @@ -49,7 +49,7 @@ public: void ForceOutlinerParaObject( OutlinerMode nOutlMode ); - virtual void SetOutlinerParaObject( OutlinerParaObject* pTextObject ); + virtual void SetOutlinerParaObject( std::unique_ptr<OutlinerParaObject> pTextObject ); OutlinerParaObject* GetOutlinerParaObject() const; void CheckPortionInfo( SdrOutliner& rOutliner ); |