diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-05 11:06:43 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-06 12:33:17 +0200 |
commit | 1f969657a64abc14cb8d1a5428a4da519d7cf6d8 (patch) | |
tree | 7999606f6f1ec21ac90ca331caa3cee955284c3d /sc/source/ui/undo/undotab.cxx | |
parent | 54d82085ccf1ad5f7c2a9b92ffa23db6725640af (diff) |
use more std::unique_ptr in ScUndoMoveTab and ScUndoCopyTab
Change-Id: Id69d87369d2a73b00e4ed6159047eef3135722e1
Reviewed-on: https://gerrit.libreoffice.org/61432
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/ui/undo/undotab.cxx')
-rw-r--r-- | sc/source/ui/undo/undotab.cxx | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx index 0cef12f8bd5e..aff057b84354 100644 --- a/sc/source/ui/undo/undotab.cxx +++ b/sc/source/ui/undo/undotab.cxx @@ -462,19 +462,16 @@ bool ScUndoRenameTab::CanRepeat(SfxRepeatTarget& /* rTarget */) const } ScUndoMoveTab::ScUndoMoveTab( - ScDocShell* pNewDocShell, vector<SCTAB>* pOldTabs, vector<SCTAB>* pNewTabs, - vector<OUString>* pOldNames, vector<OUString>* pNewNames) : + ScDocShell* pNewDocShell, std::unique_ptr<vector<SCTAB>> pOldTabs, std::unique_ptr<vector<SCTAB>> pNewTabs, + std::unique_ptr<vector<OUString>> pOldNames, std::unique_ptr<vector<OUString>> pNewNames) : ScSimpleUndo( pNewDocShell ), - mpOldTabs(pOldTabs), mpNewTabs(pNewTabs), - mpOldNames(pOldNames), mpNewNames(pNewNames) + mpOldTabs(std::move(pOldTabs)), mpNewTabs(std::move(pNewTabs)), + mpOldNames(std::move(pOldNames)), mpNewNames(std::move(pNewNames)) { - if (mpOldNames && mpOldTabs->size() != mpOldNames->size()) - // The sizes differ. Something is wrong. - mpOldNames.reset(); - - if (mpNewNames && mpNewTabs->size() != mpNewNames->size()) - // The sizes differ. Something is wrong. - mpNewNames.reset(); + // The sizes differ. Something is wrong. + assert(!mpOldNames || mpOldTabs->size() == mpOldNames->size()); + // The sizes differ. Something is wrong. + assert(!mpNewNames || mpNewTabs->size() == mpNewNames->size()); } ScUndoMoveTab::~ScUndoMoveTab() @@ -566,18 +563,17 @@ bool ScUndoMoveTab::CanRepeat(SfxRepeatTarget& /* rTarget */) const ScUndoCopyTab::ScUndoCopyTab( ScDocShell* pNewDocShell, - vector<SCTAB>* pOldTabs, vector<SCTAB>* pNewTabs, - vector<OUString>* pNewNames) : + std::unique_ptr<vector<SCTAB>> pOldTabs, std::unique_ptr<vector<SCTAB>> pNewTabs, + std::unique_ptr<vector<OUString>> pNewNames) : ScSimpleUndo( pNewDocShell ), - mpOldTabs(pOldTabs), - mpNewTabs(pNewTabs), - mpNewNames(pNewNames) + mpOldTabs(std::move(pOldTabs)), + mpNewTabs(std::move(pNewTabs)), + mpNewNames(std::move(pNewNames)) { pDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() ); - if (mpNewNames && mpNewTabs->size() != mpNewNames->size()) - // The sizes differ. Something is wrong. - mpNewNames.reset(); + // The sizes differ. Something is wrong. + assert(!mpNewNames || mpNewTabs->size() == mpNewNames->size()); } ScUndoCopyTab::~ScUndoCopyTab() |