diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-30 13:54:33 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-03 08:27:48 +0200 |
commit | 6be7e2e9dd8027d284f1b00ef6e3b4654eec7d79 (patch) | |
tree | d43e18e7ef12d29089f9eb34bbe95a78245261cc /sw | |
parent | dff829e863fd05bedd5bcb713cd80c10fa582932 (diff) |
pass SdrUndoAction around by std::unique_ptr
convert the LINK we use here to std::function, since LINK
does not currently handle std::unique_ptr
Change-Id: I9df80352e612445e5f5ca513d7d4196d65589778
Reviewed-on: https://gerrit.libreoffice.org/59804
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/doc.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/DocumentDrawModelManager.cxx | 5 | ||||
-rw-r--r-- | sw/source/core/undo/undraw.cxx | 6 |
3 files changed, 6 insertions, 7 deletions
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 5094c35f7344..b06048cbadbc 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -500,7 +500,7 @@ public: IDocumentState & getIDocumentState(); // IDocumentDrawModelAccess - DECL_LINK( AddDrawUndo, SdrUndoAction *, void ); + void AddDrawUndo( std::unique_ptr<SdrUndoAction> ); IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const; IDocumentDrawModelAccess & getIDocumentDrawModelAccess(); diff --git a/sw/source/core/doc/DocumentDrawModelManager.cxx b/sw/source/core/doc/DocumentDrawModelManager.cxx index 3dd25de33693..a449c2707591 100644 --- a/sw/source/core/doc/DocumentDrawModelManager.cxx +++ b/sw/source/core/doc/DocumentDrawModelManager.cxx @@ -30,6 +30,7 @@ #include <swtypes.hxx> #include <ndtxt.hxx> #include <svl/hint.hxx> +#include <svx/svdundo.hxx> #include <viewsh.hxx> #include <view.hxx> #include <drawdoc.hxx> @@ -131,7 +132,7 @@ void DocumentDrawModelManager::InitDrawModel() if ( pRefDev ) mpDrawModel->SetRefDevice( pRefDev ); - mpDrawModel->SetNotifyUndoActionHdl( LINK( &m_rDoc, SwDoc, AddDrawUndo )); + mpDrawModel->SetNotifyUndoActionHdl( std::bind( &SwDoc::AddDrawUndo, &m_rDoc, std::placeholders::_1 )); SwViewShell* const pSh = m_rDoc.getIDocumentLayoutAccess().GetCurrentViewShell(); if ( pSh ) { @@ -350,7 +351,7 @@ bool DocumentDrawModelManager::Search(const SwPaM& rPaM, const SvxSearchItem& rS void DocumentDrawModelManager::DrawNotifyUndoHdl() { - mpDrawModel->SetNotifyUndoActionHdl( Link<SdrUndoAction*,void>() ); + mpDrawModel->SetNotifyUndoActionHdl( nullptr ); } } diff --git a/sw/source/core/undo/undraw.cxx b/sw/source/core/undo/undraw.cxx index 2b1a8c442f15..43cf4cd248eb 100644 --- a/sw/source/core/undo/undraw.cxx +++ b/sw/source/core/undo/undraw.cxx @@ -55,7 +55,7 @@ struct SwUndoGroupObjImpl // Draw-Objecte -IMPL_LINK( SwDoc, AddDrawUndo, SdrUndoAction *, pUndo, void ) +void SwDoc::AddDrawUndo( std::unique_ptr<SdrUndoAction> pUndo ) { if (GetIDocumentUndoRedo().DoesUndo() && GetIDocumentUndoRedo().DoesDrawUndo()) @@ -65,10 +65,8 @@ IMPL_LINK( SwDoc, AddDrawUndo, SdrUndoAction *, pUndo, void ) if( pSh && pSh->HasDrawView() ) pMarkList = &pSh->GetDrawView()->GetMarkedObjectList(); - GetIDocumentUndoRedo().AppendUndo( new SwSdrUndo(std::unique_ptr<SdrUndoAction>(pUndo), pMarkList, this) ); + GetIDocumentUndoRedo().AppendUndo( new SwSdrUndo(std::move(pUndo), pMarkList, this) ); } - else - delete pUndo; } SwSdrUndo::SwSdrUndo( std::unique_ptr<SdrUndoAction> pUndo, const SdrMarkList* pMrkLst, const SwDoc* pDoc ) |