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 /sw | |
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 'sw')
-rw-r--r-- | sw/source/core/frmedt/fecopy.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/inc/UndoManager.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/undo/docundo.cxx | 8 | ||||
-rw-r--r-- | sw/source/uibase/shells/drawsh.cxx | 2 |
4 files changed, 7 insertions, 7 deletions
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index 1a40e6b401b1..e51fab869e2a 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -1567,7 +1567,7 @@ bool SwFEShell::Paste(const Graphic &rGrf, const OUString& rURL) } else { - pView->AddUndo(new SdrUndoAttrObj(*pObj)); + pView->AddUndo(o3tl::make_unique<SdrUndoAttrObj>(*pObj)); SfxItemSet aSet(pView->GetModel()->GetItemPool(), svl::Items<XATTR_FILLSTYLE, XATTR_FILLBITMAP>{}); diff --git a/sw/source/core/inc/UndoManager.hxx b/sw/source/core/inc/UndoManager.hxx index 29f8cd4a44c2..3f7d9b34f631 100644 --- a/sw/source/core/inc/UndoManager.hxx +++ b/sw/source/core/inc/UndoManager.hxx @@ -82,7 +82,7 @@ public: void SetView(SwView* pView) override; // SfxUndoManager - virtual void AddUndoAction(SfxUndoAction *pAction, + virtual void AddUndoAction(std::unique_ptr<SfxUndoAction> pAction, bool bTryMerg = false) override; virtual bool Undo() override; virtual bool Redo() override; diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx index 9d46a6b7bcbf..f5720c7aad77 100644 --- a/sw/source/core/undo/docundo.cxx +++ b/sw/source/core/undo/docundo.cxx @@ -244,7 +244,7 @@ SwUndo* UndoManager::GetLastUndo() void UndoManager::AppendUndo(std::unique_ptr<SwUndo> pUndo) { - AddUndoAction(pUndo.release()); + AddUndoAction(std::move(pUndo)); } void UndoManager::ClearRedo() @@ -511,9 +511,9 @@ SwUndo * UndoManager::RemoveLastUndo() // SfxUndoManager -void UndoManager::AddUndoAction(SfxUndoAction *pAction, bool bTryMerge) +void UndoManager::AddUndoAction(std::unique_ptr<SfxUndoAction> pAction, bool bTryMerge) { - SwUndo *const pUndo( dynamic_cast<SwUndo *>(pAction) ); + SwUndo *const pUndo( dynamic_cast<SwUndo *>(pAction.get()) ); if (pUndo) { if (RedlineFlags::NONE == pUndo->GetRedlineFlags()) @@ -525,7 +525,7 @@ void UndoManager::AddUndoAction(SfxUndoAction *pAction, bool bTryMerge) pUndo->IgnoreRepeat(); } } - SdrUndoManager::AddUndoAction(pAction, bTryMerge); + SdrUndoManager::AddUndoAction(std::move(pAction), bTryMerge); // if the undo nodes array is too large, delete some actions while (UNDO_ACTION_LIMIT < GetUndoNodes().Count()) { diff --git a/sw/source/uibase/shells/drawsh.cxx b/sw/source/uibase/shells/drawsh.cxx index f9e461d8b8ba..baf3939e0282 100644 --- a/sw/source/uibase/shells/drawsh.cxx +++ b/sw/source/uibase/shells/drawsh.cxx @@ -163,7 +163,7 @@ void SwDrawShell::InsertPictureFromFile(SdrObject& rObject) } else // if(rObject.IsClosedObj() && !dynamic_cast< SdrOle2Obj* >(&rObject)) { - pSdrView->AddUndo(new SdrUndoAttrObj(rObject)); + pSdrView->AddUndo(o3tl::make_unique<SdrUndoAttrObj>(rObject)); SfxItemSet aSet(pSdrView->GetModel()->GetItemPool(), svl::Items<XATTR_FILLSTYLE, XATTR_FILLBITMAP>{}); |