diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-08 11:22:10 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-09 12:09:55 +0200 |
commit | f7ce839c7844f029c0a1ac83a5638e83356b4c4b (patch) | |
tree | c93a342a577133b384a3ccc088d7d0675d4fb9e3 /include | |
parent | 4ba06560e33f17ca1ed72ad722c80eae5ffd4277 (diff) |
use unique_ptr in SfxUndoManager::AddUndoAction
Change-Id: I11483e3cece12a7373f4276972b4c899edf1ce15
Reviewed-on: https://gerrit.libreoffice.org/61566
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r-- | include/editeng/outliner.hxx | 2 | ||||
-rw-r--r-- | include/svl/undo.hxx | 2 | ||||
-rw-r--r-- | include/svx/svddrgmt.hxx | 2 | ||||
-rw-r--r-- | include/svx/svdedtv.hxx | 7 | ||||
-rw-r--r-- | include/svx/svdmodel.hxx | 2 | ||||
-rw-r--r-- | include/svx/svdundo.hxx | 42 | ||||
-rw-r--r-- | include/vcl/texteng.hxx | 2 |
7 files changed, 30 insertions, 29 deletions
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index b6308599cfe3..e0d93e3323e4 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -738,7 +738,7 @@ public: bool IsUndoEnabled() const; void UndoActionStart( sal_uInt16 nId ); void UndoActionEnd(); - void InsertUndo( EditUndo* pUndo ); + void InsertUndo( std::unique_ptr<EditUndo> pUndo ); bool IsInUndo(); void ClearModifyFlag(); diff --git a/include/svl/undo.hxx b/include/svl/undo.hxx index 456a31f56b18..9451b9bd8e71 100644 --- a/include/svl/undo.hxx +++ b/include/svl/undo.hxx @@ -190,7 +190,7 @@ public: virtual ~SfxUndoManager(); void SetMaxUndoActionCount( size_t nMaxUndoActionCount ); - virtual void AddUndoAction( SfxUndoAction *pAction, bool bTryMerg=false ); + virtual void AddUndoAction( std::unique_ptr<SfxUndoAction> pAction, bool bTryMerg=false ); virtual size_t GetUndoActionCount( bool const i_currentLevel = CurrentLevel ) const; OUString GetUndoActionComment( size_t nNo=0, bool const i_currentLevel = CurrentLevel ) const; SfxUndoAction* GetUndoAction( size_t nNo=0 ) const; diff --git a/include/svx/svddrgmt.hxx b/include/svx/svddrgmt.hxx index 5bdd440e3409..0013da3284e3 100644 --- a/include/svx/svddrgmt.hxx +++ b/include/svx/svddrgmt.hxx @@ -155,7 +155,7 @@ protected: Point& Ref1() const { return mrSdrDragView.maRef1; } Point& Ref2() const { return mrSdrDragView.maRef2; } const SdrHdlList& GetHdlList() const { return getSdrDragView().GetHdlList(); } - void AddUndo(SdrUndoAction* pUndo) { getSdrDragView().AddUndo(pUndo); } + void AddUndo(std::unique_ptr<SdrUndoAction> pUndo) { getSdrDragView().AddUndo(std::move(pUndo)); } bool IsDragLimit() { return getSdrDragView().mbDragLimit; } const tools::Rectangle& GetDragLimitRect() { return getSdrDragView().maDragLimit; } const SdrMarkList& GetMarkedObjectList() { return getSdrDragView().GetMarkedObjectList(); } diff --git a/include/svx/svdedtv.hxx b/include/svx/svdedtv.hxx index 63d74b4bc74a..ba6b1172df6b 100644 --- a/include/svx/svdedtv.hxx +++ b/include/svx/svdedtv.hxx @@ -24,6 +24,7 @@ #include <svx/xpoly.hxx> #include <svx/svdmodel.hxx> #include <svx/svxdllapi.h> +#include <svx/svdundo.hxx> #include <o3tl/typed_flags_set.hxx> class SfxUndoAction; @@ -180,13 +181,13 @@ public: void BegUndo(const OUString& rComment) { mpModel->BegUndo(rComment); } // open undo-grouping void BegUndo(const OUString& rComment, const OUString& rObjDescr, SdrRepeatFunc eFunc=SdrRepeatFunc::NONE) { mpModel->BegUndo(rComment,rObjDescr,eFunc); } // open undo-grouping void EndUndo(); // close undo-grouping (incl. BroadcastEdges) - void AddUndo(SdrUndoAction* pUndo) { mpModel->AddUndo(pUndo); } // add action + void AddUndo(std::unique_ptr<SdrUndoAction> pUndo) { mpModel->AddUndo(std::move(pUndo)); } // add action // only after first BegUndo or before last EndUndo: void SetUndoComment(const OUString& rComment, const OUString& rObjDescr) { mpModel->SetUndoComment(rComment,rObjDescr); } bool IsUndoEnabled() const; - std::vector< SdrUndoAction* > CreateConnectorUndo( SdrObject& rO ); - void AddUndoActions( std::vector< SdrUndoAction* >& ); + std::vector< std::unique_ptr<SdrUndoAction> > CreateConnectorUndo( SdrObject& rO ); + void AddUndoActions( std::vector< std::unique_ptr<SdrUndoAction> > ); // Layermanagement with Undo. void InsertNewLayer(const OUString& rName, sal_uInt16 nPos); diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx index 1cf73896c7b6..d08112592703 100644 --- a/include/svx/svdmodel.hxx +++ b/include/svx/svdmodel.hxx @@ -501,7 +501,7 @@ public: void BegUndo(const OUString& rComment); // open Undo group void BegUndo(const OUString& rComment, const OUString& rObjDescr, SdrRepeatFunc eFunc); // open Undo group void EndUndo(); // close Undo group - void AddUndo(SdrUndoAction* pUndo); + void AddUndo(std::unique_ptr<SdrUndoAction> pUndo); sal_uInt16 GetUndoBracketLevel() const { return nUndoLevel; } // only after the first BegUndo or before the last EndUndo: void SetUndoComment(const OUString& rComment); diff --git a/include/svx/svdundo.hxx b/include/svx/svdundo.hxx index c134fb986590..3efb4e75ab90 100644 --- a/include/svx/svdundo.hxx +++ b/include/svx/svdundo.hxx @@ -709,40 +709,40 @@ class SVX_DLLPUBLIC SdrUndoFactory public: // Shapes virtual ~SdrUndoFactory(); - virtual SdrUndoAction* CreateUndoMoveObject( SdrObject& rObject, const Size& rDist ); - virtual SdrUndoAction* CreateUndoGeoObject( SdrObject& rObject ); - virtual SdrUndoAction* CreateUndoAttrObject( SdrObject& rObject, bool bStyleSheet1 = false, bool bSaveText = false ); - virtual SdrUndoAction* CreateUndoRemoveObject( SdrObject& rObject, bool bOrdNumDirect = false); - virtual SdrUndoAction* CreateUndoInsertObject( SdrObject& rObject, bool bOrdNumDirect = false); - virtual SdrUndoAction* CreateUndoDeleteObject( SdrObject& rObject, bool bOrdNumDirect = false); - virtual SdrUndoAction* CreateUndoNewObject( SdrObject& rObject, bool bOrdNumDirect = false); - virtual SdrUndoAction* CreateUndoCopyObject( SdrObject& rObject, bool bOrdNumDirect = false); + virtual std::unique_ptr<SdrUndoAction> CreateUndoMoveObject( SdrObject& rObject, const Size& rDist ); + virtual std::unique_ptr<SdrUndoAction> CreateUndoGeoObject( SdrObject& rObject ); + virtual std::unique_ptr<SdrUndoAction> CreateUndoAttrObject( SdrObject& rObject, bool bStyleSheet1 = false, bool bSaveText = false ); + virtual std::unique_ptr<SdrUndoAction> CreateUndoRemoveObject( SdrObject& rObject, bool bOrdNumDirect = false); + virtual std::unique_ptr<SdrUndoAction> CreateUndoInsertObject( SdrObject& rObject, bool bOrdNumDirect = false); + virtual std::unique_ptr<SdrUndoAction> CreateUndoDeleteObject( SdrObject& rObject, bool bOrdNumDirect = false); + virtual std::unique_ptr<SdrUndoAction> CreateUndoNewObject( SdrObject& rObject, bool bOrdNumDirect = false); + virtual std::unique_ptr<SdrUndoAction> CreateUndoCopyObject( SdrObject& rObject, bool bOrdNumDirect = false); - virtual SdrUndoAction* CreateUndoObjectOrdNum( SdrObject& rObject, sal_uInt32 nOldOrdNum1, sal_uInt32 nNewOrdNum1); + virtual std::unique_ptr<SdrUndoAction> CreateUndoObjectOrdNum( SdrObject& rObject, sal_uInt32 nOldOrdNum1, sal_uInt32 nNewOrdNum1); - virtual SdrUndoAction* CreateUndoReplaceObject( SdrObject& rOldObject, SdrObject& rNewObject, bool bOrdNumDirect = false ); - virtual SdrUndoAction* CreateUndoObjectLayerChange( SdrObject& rObject, SdrLayerID aOldLayer, SdrLayerID aNewLayer ); - virtual SdrUndoAction* CreateUndoObjectSetText( SdrObject& rNewObj, sal_Int32 nText ); + virtual std::unique_ptr<SdrUndoAction> CreateUndoReplaceObject( SdrObject& rOldObject, SdrObject& rNewObject, bool bOrdNumDirect = false ); + virtual std::unique_ptr<SdrUndoAction> CreateUndoObjectLayerChange( SdrObject& rObject, SdrLayerID aOldLayer, SdrLayerID aNewLayer ); + virtual std::unique_ptr<SdrUndoAction> CreateUndoObjectSetText( SdrObject& rNewObj, sal_Int32 nText ); // Implement Title/Description Elements UI for Writer text frames, graphics and embedded objects (#i73249#) - static SdrUndoAction* CreateUndoObjectStrAttr( SdrObject& rObject, + static std::unique_ptr<SdrUndoAction> CreateUndoObjectStrAttr( SdrObject& rObject, SdrUndoObjStrAttr::ObjStrAttrType eObjStrAttrType, const OUString& sOldStr, const OUString& sNewStr ); // Layer - virtual SdrUndoAction* CreateUndoNewLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel); - virtual SdrUndoAction* CreateUndoDeleteLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel); + virtual std::unique_ptr<SdrUndoAction> CreateUndoNewLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel); + virtual std::unique_ptr<SdrUndoAction> CreateUndoDeleteLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel); // Page - virtual SdrUndoAction* CreateUndoDeletePage(SdrPage& rPage); - virtual SdrUndoAction* CreateUndoNewPage(SdrPage& rPage); - virtual SdrUndoAction* CreateUndoCopyPage(SdrPage& rPage); - virtual SdrUndoAction* CreateUndoSetPageNum(SdrPage& rNewPg, sal_uInt16 nOldPageNum1, sal_uInt16 nNewPageNum1); + virtual std::unique_ptr<SdrUndoAction> CreateUndoDeletePage(SdrPage& rPage); + virtual std::unique_ptr<SdrUndoAction> CreateUndoNewPage(SdrPage& rPage); + virtual std::unique_ptr<SdrUndoAction> CreateUndoCopyPage(SdrPage& rPage); + virtual std::unique_ptr<SdrUndoAction> CreateUndoSetPageNum(SdrPage& rNewPg, sal_uInt16 nOldPageNum1, sal_uInt16 nNewPageNum1); // Master page - virtual SdrUndoAction* CreateUndoPageRemoveMasterPage(SdrPage& rChangedPage); - virtual SdrUndoAction* CreateUndoPageChangeMasterPage(SdrPage& rChangedPage); + virtual std::unique_ptr<SdrUndoAction> CreateUndoPageRemoveMasterPage(SdrPage& rChangedPage); + virtual std::unique_ptr<SdrUndoAction> CreateUndoPageChangeMasterPage(SdrPage& rChangedPage); }; #endif // INCLUDED_SVX_SVDUNDO_HXX diff --git a/include/vcl/texteng.hxx b/include/vcl/texteng.hxx index 97a370747ce8..749146eb40d8 100644 --- a/include/vcl/texteng.hxx +++ b/include/vcl/texteng.hxx @@ -265,7 +265,7 @@ public: SfxUndoManager& GetUndoManager(); void UndoActionStart( sal_uInt16 nId = 0 ); void UndoActionEnd(); - void InsertUndo( TextUndo* pUndo, bool bTryMerge = false ); + void InsertUndo( std::unique_ptr<TextUndo> pUndo, bool bTryMerge = false ); bool IsInUndo() { return mbIsInUndo; } void SetIsInUndo( bool bInUndo ) { mbIsInUndo = bInUndo; } void ResetUndo(); |