summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-06-28 10:37:20 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-06-29 08:37:23 +0200
commitf5772b154d0c806ef029f1feee1ee92537eec463 (patch)
tree6b71a6af653d2a7b7f309d0ad4521177c3b16c01
parent286461d872057ab8110d9713c5cbe859448dda70 (diff)
loplugin:useuniqueptr in various ScUndo*
Change-Id: I604d7b900836e87fc768e1b00dc62a570ff477b5 Reviewed-on: https://gerrit.libreoffice.org/56619 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sc/source/ui/inc/undobase.hxx12
-rw-r--r--sc/source/ui/inc/undoblk.hxx28
-rw-r--r--sc/source/ui/inc/undocell.hxx10
-rw-r--r--sc/source/ui/inc/undodat.hxx2
-rw-r--r--sc/source/ui/inc/undotab.hxx14
-rw-r--r--sc/source/ui/undo/undobase.cxx26
-rw-r--r--sc/source/ui/undo/undoblk.cxx30
-rw-r--r--sc/source/ui/undo/undoblk2.cxx9
-rw-r--r--sc/source/ui/undo/undoblk3.cxx50
-rw-r--r--sc/source/ui/undo/undocell.cxx18
-rw-r--r--sc/source/ui/undo/undodat.cxx8
-rw-r--r--sc/source/ui/undo/undotab.cxx48
12 files changed, 127 insertions, 128 deletions
diff --git a/sc/source/ui/inc/undobase.hxx b/sc/source/ui/inc/undobase.hxx
index 6fa0fbd7a9e2..a531caf1cac2 100644
--- a/sc/source/ui/inc/undobase.hxx
+++ b/sc/source/ui/inc/undobase.hxx
@@ -88,7 +88,7 @@ public:
protected:
ScRange aBlockRange;
- SdrUndoAction* pDrawUndo;
+ std::unique_ptr<SdrUndoAction> pDrawUndo;
ScBlockUndoMode eMode;
void BeginUndo();
@@ -108,7 +108,7 @@ public:
protected:
ScRangeList maBlockRanges;
- SdrUndoAction* mpDrawUndo;
+ std::unique_ptr<SdrUndoAction> mpDrawUndo;
void BeginUndo();
void EndUndo();
@@ -123,7 +123,7 @@ protected:
class ScDBFuncUndo: public ScSimpleUndo
{
protected:
- ScDBData* pAutoDBRange;
+ std::unique_ptr<ScDBData> pAutoDBRange;
ScRange aOriginalRange;
public:
@@ -147,9 +147,9 @@ public:
virtual ~ScMoveUndo() override;
protected:
- SdrUndoAction* pDrawUndo;
- ScDocument* pRefUndoDoc;
- ScRefUndoData* pRefUndoData;
+ std::unique_ptr<SdrUndoAction> pDrawUndo;
+ std::unique_ptr<ScDocument> pRefUndoDoc;
+ std::unique_ptr<ScRefUndoData> pRefUndoData;
ScMoveUndoMode eMode;
void BeginUndo();
diff --git a/sc/source/ui/inc/undoblk.hxx b/sc/source/ui/inc/undoblk.hxx
index 7fd2ad69d6ad..90100c3ac292 100644
--- a/sc/source/ui/inc/undoblk.hxx
+++ b/sc/source/ui/inc/undoblk.hxx
@@ -201,11 +201,11 @@ public:
private:
ScMarkData aMarkData;
- ScDocument* pUndoDoc;
- ScDocument* pRedoDoc;
+ std::unique_ptr<ScDocument> pUndoDoc;
+ std::unique_ptr<ScDocument> pRedoDoc;
InsertDeleteFlags nFlags;
- ScRefUndoData* pRefUndoData;
- ScRefUndoData* pRefRedoData;
+ std::unique_ptr<ScRefUndoData> pRefUndoData;
+ std::unique_ptr<ScRefUndoData> pRefRedoData;
sal_uLong nStartChangeAction;
sal_uLong nEndChangeAction;
bool bRedoFilled;
@@ -273,7 +273,7 @@ private:
ScRange aRange;
ScMarkData aMarkData;
ScDocumentUniquePtr pUndoDoc; // Block mark and deleted data
- SdrUndoAction* pDrawUndo; // Deleted objects
+ std::unique_ptr<SdrUndoAction> pDrawUndo; // Deleted objects
sal_uLong nStartChangeAction;
sal_uLong nEndChangeAction;
InsertDeleteFlags nFlags;
@@ -346,7 +346,7 @@ private:
ScRange aRange;
ScRange aRangeCover;
std::unique_ptr<ScEditDataArray> mpDataArray;
- ScDocument* pUndoDoc;
+ std::unique_ptr<ScDocument> pUndoDoc;
bool bMulti;
ScPatternAttr* pApplyPattern;
SvxBoxItem* pLineOuter;
@@ -389,7 +389,7 @@ private:
sal_uInt16 nNewSize;
bool bWidth;
ScSizeMode eMode;
- SdrUndoAction* pDrawUndo;
+ std::unique_ptr<SdrUndoAction> pDrawUndo;
};
class ScUndoAutoFill: public ScBlockUndo
@@ -445,7 +445,7 @@ private:
ScCellMergeOption maOption;
bool mbMergeContents; // Merge contents in Redo().
ScDocumentUniquePtr mxUndoDoc; // when data is merged
- SdrUndoAction* mpDrawUndo;
+ std::unique_ptr<SdrUndoAction> mpDrawUndo;
void DoChange( bool bUndo ) const;
};
@@ -495,8 +495,8 @@ private:
ScAddress aCursorPos;
ScMarkData aMarkData;
OUString aUndoStr; // Data at single selection
- ScDocument* pUndoDoc; // Block mark and deleted data
- SvxSearchItem* pSearchItem;
+ std::unique_ptr<ScDocument> pUndoDoc; // Block mark and deleted data
+ std::unique_ptr<SvxSearchItem> pSearchItem;
sal_uLong nStartChangeAction;
sal_uLong nEndChangeAction;
@@ -555,9 +555,9 @@ public:
private:
ScMarkData aMarkData;
ScAddress aCursorPos;
- ScDocument* pUndoDoc; // Block mark and deleted data
+ std::unique_ptr<ScDocument> pUndoDoc; // Block mark and deleted data
ScAddress aNewCursorPos;
- ScDocument* pRedoDoc; // Block mark and new data
+ std::unique_ptr<ScDocument> pRedoDoc; // Block mark and new data
sal_uLong nStartChangeAction;
sal_uLong nEndChangeAction;
ScConversionParam maConvParam; /// Conversion type and parameters.
@@ -583,8 +583,8 @@ public:
private:
ScMarkData aMarkData;
- ScDocument* pUndoDoc;
- ScDocument* pRedoDoc;
+ std::unique_ptr<ScDocument> pUndoDoc;
+ std::unique_ptr<ScDocument> pRedoDoc;
ScRange aRange;
bool bMulti;
sal_uLong nStartChangeAction;
diff --git a/sc/source/ui/inc/undocell.hxx b/sc/source/ui/inc/undocell.hxx
index dd2bc46f4ea8..51caaead3557 100644
--- a/sc/source/ui/inc/undocell.hxx
+++ b/sc/source/ui/inc/undocell.hxx
@@ -325,7 +325,7 @@ private:
ScAddress maPos;
ScNoteData maOldData;
ScNoteData maNewData;
- SdrUndoAction* mpDrawUndo;
+ std::unique_ptr<SdrUndoAction> mpDrawUndo;
};
/** Undo action for showing or hiding a cell note caption. */
@@ -364,10 +364,10 @@ public:
private:
bool bIsDelete;
- ScDetOpList* pOldList;
+ std::unique_ptr<ScDetOpList> pOldList;
sal_uInt16 nAction;
ScAddress aPos;
- SdrUndoAction* pDrawUndo;
+ std::unique_ptr<SdrUndoAction> pDrawUndo;
};
class ScUndoRangeNames: public ScSimpleUndo
@@ -386,8 +386,8 @@ public:
virtual OUString GetComment() const override;
private:
- ScRangeName* pOldRanges;
- ScRangeName* pNewRanges;
+ std::unique_ptr<ScRangeName> pOldRanges;
+ std::unique_ptr<ScRangeName> pNewRanges;
SCTAB mnTab;
void DoChange( bool bUndo );
diff --git a/sc/source/ui/inc/undodat.hxx b/sc/source/ui/inc/undodat.hxx
index 092936461e36..bb8a86213ba1 100644
--- a/sc/source/ui/inc/undodat.hxx
+++ b/sc/source/ui/inc/undodat.hxx
@@ -229,7 +229,7 @@ public:
virtual OUString GetComment() const override;
private:
- SdrUndoAction* pDrawUndo;
+ std::unique_ptr<SdrUndoAction> pDrawUndo;
SCTAB nTab;
ScQueryParam aQueryParam;
ScDocumentUniquePtr xUndoDoc;
diff --git a/sc/source/ui/inc/undotab.hxx b/sc/source/ui/inc/undotab.hxx
index eb3c92e59a96..06ad4eb87bac 100644
--- a/sc/source/ui/inc/undotab.hxx
+++ b/sc/source/ui/inc/undotab.hxx
@@ -56,7 +56,7 @@ public:
private:
OUString sNewName;
- SdrUndoAction* pDrawUndo;
+ std::unique_ptr<SdrUndoAction> pDrawUndo;
sal_uLong nEndChangeAction;
SCTAB nTab;
bool bAppend;
@@ -82,7 +82,7 @@ public:
private:
- SdrUndoAction* pDrawUndo;
+ std::unique_ptr<SdrUndoAction> pDrawUndo;
std::vector<OUString> aNameList;
sal_uLong nStartChangeAction;
sal_uLong nEndChangeAction;
@@ -191,7 +191,7 @@ private:
std::shared_ptr< ::std::vector<SCTAB> > mpOldTabs;
std::shared_ptr< ::std::vector<SCTAB> > mpNewTabs;
std::shared_ptr< ::std::vector< OUString> > mpNewNames;
- SdrUndoAction* pDrawUndo;
+ std::unique_ptr<SdrUndoAction> pDrawUndo;
void DoChange() const;
};
@@ -248,7 +248,7 @@ private:
OUString aComment;
Color aColor;
ScScenarioFlags nFlags;
- SdrUndoAction* pDrawUndo;
+ std::unique_ptr<SdrUndoAction> pDrawUndo;
};
class ScUndoImportTab : public ScSimpleUndo
@@ -270,7 +270,7 @@ private:
SCTAB nTab;
SCTAB nCount;
ScDocumentUniquePtr xRedoDoc;
- SdrUndoAction* pDrawUndo;
+ std::unique_ptr<SdrUndoAction> pDrawUndo;
void DoChange() const;
};
@@ -389,8 +389,8 @@ public:
private:
SCTAB nTab;
- ScPrintRangeSaver* pOldRanges;
- ScPrintRangeSaver* pNewRanges;
+ std::unique_ptr<ScPrintRangeSaver> pOldRanges;
+ std::unique_ptr<ScPrintRangeSaver> pNewRanges;
void DoChange( bool bUndo );
};
diff --git a/sc/source/ui/undo/undobase.cxx b/sc/source/ui/undo/undobase.cxx
index 42c8f993040e..e2c74dfd864a 100644
--- a/sc/source/ui/undo/undobase.cxx
+++ b/sc/source/ui/undo/undobase.cxx
@@ -245,12 +245,12 @@ ScBlockUndo::ScBlockUndo( ScDocShell* pDocSh, const ScRange& rRange,
aBlockRange( rRange ),
eMode( eBlockMode )
{
- pDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() ).release();
+ pDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() );
}
ScBlockUndo::~ScBlockUndo()
{
- delete pDrawUndo;
+ pDrawUndo.reset();
}
void ScBlockUndo::BeginUndo()
@@ -265,7 +265,7 @@ void ScBlockUndo::EndUndo()
AdjustHeight();
EnableDrawAdjust( &pDocShell->GetDocument(), true );
- DoSdrUndoAction( pDrawUndo, &pDocShell->GetDocument() );
+ DoSdrUndoAction( pDrawUndo.get(), &pDocShell->GetDocument() );
ShowBlock();
ScSimpleUndo::EndUndo();
@@ -346,12 +346,12 @@ ScMultiBlockUndo::ScMultiBlockUndo(
ScSimpleUndo(pDocSh),
maBlockRanges(rRanges)
{
- mpDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() ).release();
+ mpDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() );
}
ScMultiBlockUndo::~ScMultiBlockUndo()
{
- delete mpDrawUndo;
+ mpDrawUndo.reset();
}
void ScMultiBlockUndo::BeginUndo()
@@ -363,7 +363,7 @@ void ScMultiBlockUndo::BeginUndo()
void ScMultiBlockUndo::EndUndo()
{
EnableDrawAdjust(&pDocShell->GetDocument(), true);
- DoSdrUndoAction(mpDrawUndo, &pDocShell->GetDocument());
+ DoSdrUndoAction(mpDrawUndo.get(), &pDocShell->GetDocument());
ShowBlock();
ScSimpleUndo::EndUndo();
@@ -416,14 +416,14 @@ ScMoveUndo::ScMoveUndo( ScDocShell* pDocSh, ScDocument* pRefDoc, ScRefUndoData*
ScDocument& rDoc = pDocShell->GetDocument();
if (pRefUndoData)
pRefUndoData->DeleteUnchanged(&rDoc);
- pDrawUndo = GetSdrUndoAction( &rDoc ).release();
+ pDrawUndo = GetSdrUndoAction( &rDoc );
}
ScMoveUndo::~ScMoveUndo()
{
- delete pRefUndoData;
- delete pRefUndoDoc;
- delete pDrawUndo;
+ pRefUndoData.reset();
+ pRefUndoDoc.reset();
+ pDrawUndo.reset();
}
void ScMoveUndo::UndoRef()
@@ -450,7 +450,7 @@ void ScMoveUndo::BeginUndo()
void ScMoveUndo::EndUndo()
{
- DoSdrUndoAction( pDrawUndo, &pDocShell->GetDocument() ); // must also be called when pointer is null
+ DoSdrUndoAction( pDrawUndo.get(), &pDocShell->GetDocument() ); // must also be called when pointer is null
if (pRefUndoDoc && eMode == SC_UNDO_REFLAST)
UndoRef();
@@ -464,12 +464,12 @@ ScDBFuncUndo::ScDBFuncUndo( ScDocShell* pDocSh, const ScRange& rOriginal ) :
ScSimpleUndo( pDocSh ),
aOriginalRange( rOriginal )
{
- pAutoDBRange = pDocSh->GetOldAutoDBRange().release();
+ pAutoDBRange = pDocSh->GetOldAutoDBRange();
}
ScDBFuncUndo::~ScDBFuncUndo()
{
- delete pAutoDBRange;
+ pAutoDBRange.reset();
}
void ScDBFuncUndo::BeginUndo()
diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index 0de0757d8b0b..d4f5f03a453c 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -374,7 +374,7 @@ void ScUndoDeleteCells::SetChangeTrack()
{
ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
- pChangeTrack->AppendDeleteRange( aEffRange, pRefUndoDoc,
+ pChangeTrack->AppendDeleteRange( aEffRange, pRefUndoDoc.get(),
nStartChangeAction, nEndChangeAction );
else
nStartChangeAction = nEndChangeAction = 0;
@@ -685,7 +685,7 @@ void ScUndoDeleteMulti::SetChangeTrack()
aRange.aEnd.SetCol( static_cast<SCCOL>(nEnd) );
}
sal_uLong nDummyStart;
- pChangeTrack->AppendDeleteRange( aRange, pRefUndoDoc,
+ pChangeTrack->AppendDeleteRange( aRange, pRefUndoDoc.get(),
nDummyStart, nEndChangeAction );
}
}
@@ -841,7 +841,7 @@ void ScUndoCut::DoChange( const bool bUndo )
/*A*/ pDocShell->PostPaint( aExtendedRange, PaintPartFlags::Grid, nExtFlags );
if ( !bUndo ) // draw redo after updating row heights
- RedoSdrUndoAction( pDrawUndo ); //! include in ScBlockUndo?
+ RedoSdrUndoAction( pDrawUndo.get() ); //! include in ScBlockUndo?
pDocShell->PostDataChanged();
if (pViewShell)
@@ -902,10 +902,10 @@ ScUndoPaste::ScUndoPaste( ScDocShell* pNewDocShell, const ScRangeList& rRanges,
ScUndoPaste::~ScUndoPaste()
{
- delete pUndoDoc;
- delete pRedoDoc;
- delete pRefUndoData;
- delete pRefRedoData;
+ pUndoDoc.reset();
+ pRedoDoc.reset();
+ pRefUndoData.reset();
+ pRefRedoData.reset();
}
OUString ScUndoPaste::GetComment() const
@@ -920,7 +920,7 @@ void ScUndoPaste::SetChangeTrack()
{
for (size_t i = 0, n = maBlockRanges.size(); i < n; ++i)
{
- pChangeTrack->AppendContentRange(maBlockRanges[i], pUndoDoc,
+ pChangeTrack->AppendContentRange(maBlockRanges[i], pUndoDoc.get(),
nStartChangeAction, nEndChangeAction, SC_CACM_PASTE );
}
}
@@ -936,9 +936,9 @@ void ScUndoPaste::DoChange(bool bUndo)
// (with DeleteUnchanged after the DoUndo call)
bool bCreateRedoData = ( bUndo && pRefUndoData && !pRefRedoData );
if ( bCreateRedoData )
- pRefRedoData = new ScRefUndoData( &rDoc );
+ pRefRedoData.reset( new ScRefUndoData( &rDoc ) );
- ScRefUndoData* pWorkRefData = bUndo ? pRefUndoData : pRefRedoData;
+ ScRefUndoData* pWorkRefData = bUndo ? pRefUndoData.get() : pRefRedoData.get();
// Always back-up either all or none of the content for Undo
InsertDeleteFlags nUndoFlags = InsertDeleteFlags::NONE;
@@ -971,7 +971,7 @@ void ScUndoPaste::DoChange(bool bUndo)
break;
}
- pRedoDoc = new ScDocument( SCDOCMODE_UNDO );
+ pRedoDoc.reset( new ScDocument( SCDOCMODE_UNDO ) );
pRedoDoc->InitUndoSelected( &rDoc, aMarkData, bColInfo, bRowInfo );
}
// read "redo" data from the document in the first undo
@@ -1096,7 +1096,7 @@ void ScUndoPaste::DoChange(bool bUndo)
}
if ( !bUndo ) // draw redo after updating row heights
- RedoSdrUndoAction(mpDrawUndo);
+ RedoSdrUndoAction(mpDrawUndo.get());
pDocShell->PostPaint(aDrawRanges, nPaint, nExtFlags);
@@ -1199,11 +1199,11 @@ void ScUndoDragDrop::SetChangeTrack()
if ( bCut )
{
nStartChangeAction = pChangeTrack->GetActionMax() + 1;
- pChangeTrack->AppendMove( aSrcRange, aDestRange, pRefUndoDoc );
+ pChangeTrack->AppendMove( aSrcRange, aDestRange, pRefUndoDoc.get() );
nEndChangeAction = pChangeTrack->GetActionMax();
}
else
- pChangeTrack->AppendContentRange( aDestRange, pRefUndoDoc,
+ pChangeTrack->AppendContentRange( aDestRange, pRefUndoDoc.get(),
nStartChangeAction, nEndChangeAction );
}
else
@@ -1466,7 +1466,7 @@ void ScUndoDragDrop::Redo()
pClipDoc.reset();
ShowTable( aDestRange.aStart.Tab() );
- RedoSdrUndoAction( pDrawUndo ); //! include in ScBlockUndo?
+ RedoSdrUndoAction( pDrawUndo.get() ); //! include in ScBlockUndo?
EnableDrawAdjust( &rDoc, true ); //! include in ScBlockUndo?
EndRedo();
diff --git a/sc/source/ui/undo/undoblk2.cxx b/sc/source/ui/undo/undoblk2.cxx
index c2a81e7b4b8c..8334c05dd455 100644
--- a/sc/source/ui/undo/undoblk2.cxx
+++ b/sc/source/ui/undo/undoblk2.cxx
@@ -52,17 +52,16 @@ ScUndoWidthOrHeight::ScUndoWidthOrHeight( ScDocShell* pNewDocShell,
maRanges(rRanges),
nNewSize( nNewSizeTwips ),
bWidth( bNewWidth ),
- eMode( eNewMode ),
- pDrawUndo( nullptr )
+ eMode( eNewMode )
{
- pDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() ).release();
+ pDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() );
}
ScUndoWidthOrHeight::~ScUndoWidthOrHeight()
{
pUndoDoc.reset();
pUndoTab.reset();
- delete pDrawUndo;
+ pDrawUndo.reset();
}
OUString ScUndoWidthOrHeight::GetComment() const
@@ -122,7 +121,7 @@ void ScUndoWidthOrHeight::Undo()
}
}
- DoSdrUndoAction( pDrawUndo, &rDoc );
+ DoSdrUndoAction( pDrawUndo.get(), &rDoc );
if (pViewShell)
{
diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx
index 1ace788eb96a..2d7ac8fe424e 100644
--- a/sc/source/ui/undo/undoblk3.cxx
+++ b/sc/source/ui/undo/undoblk3.cxx
@@ -77,7 +77,7 @@ ScUndoDeleteContents::ScUndoDeleteContents(
bMulti ( bNewMulti ) // unnecessary
{
if (bObjects)
- pDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() ).release();
+ pDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() );
if ( !(aMarkData.IsMarked() || aMarkData.IsMultiMarked()) ) // if no cell is selected:
aMarkData.SetMarkArea( aRange ); // select cell under cursor
@@ -88,7 +88,7 @@ ScUndoDeleteContents::ScUndoDeleteContents(
ScUndoDeleteContents::~ScUndoDeleteContents()
{
pUndoDoc.reset();
- delete pDrawUndo;
+ pDrawUndo.reset();
}
OUString ScUndoDeleteContents::GetComment() const
@@ -138,7 +138,7 @@ void ScUndoDeleteContents::DoChange( const bool bUndo )
pUndoDoc->CopyToDocument(aCopyRange, nUndoFlags, bMulti, rDoc, &aMarkData);
- DoSdrUndoAction( pDrawUndo, &rDoc );
+ DoSdrUndoAction( pDrawUndo.get(), &rDoc );
ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
@@ -151,7 +151,7 @@ void ScUndoDeleteContents::DoChange( const bool bUndo )
pDocShell->UpdatePaintExt( nExtFlags, aRange ); // content before the change
aMarkData.MarkToMulti();
- RedoSdrUndoAction( pDrawUndo );
+ RedoSdrUndoAction( pDrawUndo.get() );
// do not delete objects and note captions, they have been removed via drawing undo
InsertDeleteFlags nRedoFlags = (nFlags & ~InsertDeleteFlags::OBJECTS) | InsertDeleteFlags::NOCAPTIONS;
rDoc.DeleteSelection( nRedoFlags, aMarkData );
@@ -372,7 +372,7 @@ ScUndoSelectionAttr::~ScUndoSelectionAttr()
if (pLineInner)
pPool->Remove(*pLineInner);
- delete pUndoDoc;
+ pUndoDoc.reset();
}
OUString ScUndoSelectionAttr::GetComment() const
@@ -648,7 +648,7 @@ ScUndoMerge::ScUndoMerge(ScDocShell* pNewDocShell, const ScCellMergeOption& rOpt
ScUndoMerge::~ScUndoMerge()
{
- delete mpDrawUndo;
+ mpDrawUndo.reset();
}
OUString ScUndoMerge::GetComment() const
@@ -719,9 +719,9 @@ void ScUndoMerge::DoChange( bool bUndo ) const
}
if (bUndo)
- DoSdrUndoAction( mpDrawUndo, &rDoc );
+ DoSdrUndoAction( mpDrawUndo.get(), &rDoc );
else
- RedoSdrUndoAction( mpDrawUndo );
+ RedoSdrUndoAction( mpDrawUndo.get() );
bool bDidPaint = false;
if ( pViewShell )
@@ -928,14 +928,14 @@ ScUndoReplace::ScUndoReplace( ScDocShell* pNewDocShell, const ScMarkData& rMark,
aUndoStr ( rNewUndoStr ),
pUndoDoc ( pNewUndoDoc )
{
- pSearchItem = new SvxSearchItem( *pItem );
+ pSearchItem.reset( new SvxSearchItem( *pItem ) );
SetChangeTrack();
}
ScUndoReplace::~ScUndoReplace()
{
- delete pUndoDoc;
- delete pSearchItem;
+ pUndoDoc.reset();
+ pSearchItem.reset();
}
void ScUndoReplace::SetChangeTrack()
@@ -947,7 +947,7 @@ void ScUndoReplace::SetChangeTrack()
if ( pUndoDoc )
{ //! UndoDoc includes only the changed cells,
// that is why an Iterator can be used
- pChangeTrack->AppendContentsIfInRefDoc( pUndoDoc,
+ pChangeTrack->AppendContentsIfInRefDoc( pUndoDoc.get(),
nStartChangeAction, nEndChangeAction );
}
else
@@ -1066,7 +1066,7 @@ void ScUndoReplace::Redo()
{
SetViewMarkData( aMarkData );
- pViewShell->SearchAndReplace( pSearchItem, false, true );
+ pViewShell->SearchAndReplace( pSearchItem.get(), false, true );
}
}
else if (pSearchItem->GetPattern() &&
@@ -1079,7 +1079,7 @@ void ScUndoReplace::Redo()
}
else
if (pViewShell)
- pViewShell->SearchAndReplace( pSearchItem, false, true );
+ pViewShell->SearchAndReplace( pSearchItem.get(), false, true );
SetChangeTrack();
@@ -1089,7 +1089,7 @@ void ScUndoReplace::Redo()
void ScUndoReplace::Repeat(SfxRepeatTarget& rTarget)
{
if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr)
- static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->SearchAndReplace( pSearchItem, true, false );
+ static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->SearchAndReplace( pSearchItem.get(), true, false );
}
bool ScUndoReplace::CanRepeat(SfxRepeatTarget& rTarget) const
@@ -1189,8 +1189,8 @@ ScUndoConversion::ScUndoConversion(
ScUndoConversion::~ScUndoConversion()
{
- delete pUndoDoc;
- delete pRedoDoc;
+ pUndoDoc.reset();
+ pRedoDoc.reset();
}
void ScUndoConversion::SetChangeTrack()
@@ -1200,7 +1200,7 @@ void ScUndoConversion::SetChangeTrack()
if ( pChangeTrack )
{
if ( pUndoDoc )
- pChangeTrack->AppendContentsIfInRefDoc( pUndoDoc,
+ pChangeTrack->AppendContentsIfInRefDoc( pUndoDoc.get(),
nStartChangeAction, nEndChangeAction );
else
{
@@ -1252,7 +1252,7 @@ void ScUndoConversion::DoChange( ScDocument* pRefDoc, const ScAddress& rCursorPo
void ScUndoConversion::Undo()
{
BeginUndo();
- DoChange( pUndoDoc, aCursorPos );
+ DoChange( pUndoDoc.get(), aCursorPos );
ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
@@ -1262,7 +1262,7 @@ void ScUndoConversion::Undo()
void ScUndoConversion::Redo()
{
BeginRedo();
- DoChange( pRedoDoc, aNewCursorPos );
+ DoChange( pRedoDoc.get(), aNewCursorPos );
SetChangeTrack();
EndRedo();
}
@@ -1293,8 +1293,8 @@ bMulti ( bNewMulti )
ScUndoRefConversion::~ScUndoRefConversion()
{
- delete pUndoDoc;
- delete pRedoDoc;
+ pUndoDoc.reset();
+ pRedoDoc.reset();
}
OUString ScUndoRefConversion::GetComment() const
@@ -1306,7 +1306,7 @@ void ScUndoRefConversion::SetChangeTrack()
{
ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
- pChangeTrack->AppendContentsIfInRefDoc( pUndoDoc,
+ pChangeTrack->AppendContentsIfInRefDoc( pUndoDoc.get(),
nStartChangeAction, nEndChangeAction );
else
nStartChangeAction = nEndChangeAction = 0;
@@ -1336,7 +1336,7 @@ void ScUndoRefConversion::Undo()
{
BeginUndo();
if (pUndoDoc)
- DoChange(pUndoDoc);
+ DoChange(pUndoDoc.get());
ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
@@ -1347,7 +1347,7 @@ void ScUndoRefConversion::Redo()
{
BeginRedo();
if (pRedoDoc)
- DoChange(pRedoDoc);
+ DoChange(pRedoDoc.get());
SetChangeTrack();
EndRedo();
}
diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx
index 51f5b105f040..9cfd7a0ccca1 100644
--- a/sc/source/ui/undo/undocell.cxx
+++ b/sc/source/ui/undo/undocell.cxx
@@ -915,13 +915,13 @@ ScUndoReplaceNote::ScUndoReplaceNote( ScDocShell& rDocShell, const ScAddress& rP
ScUndoReplaceNote::~ScUndoReplaceNote()
{
- delete mpDrawUndo;
+ mpDrawUndo.reset();
}
void ScUndoReplaceNote::Undo()
{
BeginUndo();
- DoSdrUndoAction( mpDrawUndo, &pDocShell->GetDocument() );
+ DoSdrUndoAction( mpDrawUndo.get(), &pDocShell->GetDocument() );
/* Undo insert -> remove new note.
Undo remove -> insert old note.
Undo replace -> remove new note, insert old note. */
@@ -934,7 +934,7 @@ void ScUndoReplaceNote::Undo()
void ScUndoReplaceNote::Redo()
{
BeginRedo();
- RedoSdrUndoAction( mpDrawUndo );
+ RedoSdrUndoAction( mpDrawUndo.get() );
/* Redo insert -> insert new note.
Redo remove -> remove old note.
Redo replace -> remove old note, insert new note. */
@@ -1048,8 +1048,8 @@ ScUndoDetective::ScUndoDetective( ScDocShell* pNewDocShell,
ScUndoDetective::~ScUndoDetective()
{
- delete pDrawUndo;
- delete pOldList;
+ pDrawUndo.reset();
+ pOldList.reset();
}
OUString ScUndoDetective::GetComment() const
@@ -1073,7 +1073,7 @@ void ScUndoDetective::Undo()
BeginUndo();
ScDocument& rDoc = pDocShell->GetDocument();
- DoSdrUndoAction(pDrawUndo, &rDoc);
+ DoSdrUndoAction(pDrawUndo.get(), &rDoc);
if (bIsDelete)
{
@@ -1109,7 +1109,7 @@ void ScUndoDetective::Redo()
{
BeginRedo();
- RedoSdrUndoAction(pDrawUndo);
+ RedoSdrUndoAction(pDrawUndo.get());
ScDocument& rDoc = pDocShell->GetDocument();
@@ -1146,8 +1146,8 @@ ScUndoRangeNames::ScUndoRangeNames( ScDocShell* pNewDocShell,
ScUndoRangeNames::~ScUndoRangeNames()
{
- delete pOldRanges;
- delete pNewRanges;
+ pOldRanges.reset();
+ pNewRanges.reset();
}
OUString ScUndoRangeNames::GetComment() const
diff --git a/sc/source/ui/undo/undodat.cxx b/sc/source/ui/undo/undodat.cxx
index 11ad1c6daef2..71f2b11bd7be 100644
--- a/sc/source/ui/undo/undodat.cxx
+++ b/sc/source/ui/undo/undodat.cxx
@@ -722,12 +722,12 @@ ScUndoQuery::ScUndoQuery( ScDocShell* pNewDocShell, SCTAB nNewTab, const ScQuery
aAdvSource = *pAdvSrc;
}
- pDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() ).release();
+ pDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() );
}
ScUndoQuery::~ScUndoQuery()
{
- delete pDrawUndo;
+ pDrawUndo.reset();
}
OUString ScUndoQuery::GetComment() const
@@ -809,7 +809,7 @@ void ScUndoQuery::Undo()
MAXCOL, aQueryParam.nRow2, nTab );
rDoc.SetDirty( aDirtyRange, true );
- DoSdrUndoAction( pDrawUndo, &rDoc );
+ DoSdrUndoAction( pDrawUndo.get(), &rDoc );
SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
@@ -1890,7 +1890,7 @@ void ScUndoDataForm::DoChange( const bool bUndo )
}
if ( !bUndo ) // draw redo after updating row heights
- RedoSdrUndoAction( pDrawUndo ); //! include in ScBlockUndo?
+ RedoSdrUndoAction( pDrawUndo.get() ); //! include in ScBlockUndo?
pDocShell->PostPaint( aDrawRange, nPaint, nExtFlags );
diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx
index 8746136dc2fc..689f61b43142 100644
--- a/sc/source/ui/undo/undotab.cxx
+++ b/sc/source/ui/undo/undotab.cxx
@@ -68,13 +68,13 @@ ScUndoInsertTab::ScUndoInsertTab( ScDocShell* pNewDocShell,
nTab( nTabNum ),
bAppend( bApp )
{
- pDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() ).release();
+ pDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() );
SetChangeTrack();
}
ScUndoInsertTab::~ScUndoInsertTab()
{
- delete pDrawUndo;
+ pDrawUndo.reset();
}
OUString ScUndoInsertTab::GetComment() const
@@ -109,7 +109,7 @@ void ScUndoInsertTab::Undo()
bDrawIsInUndo = false;
pDocShell->SetInUndo( false ); //! EndUndo
- DoSdrUndoAction( pDrawUndo, &pDocShell->GetDocument() );
+ DoSdrUndoAction( pDrawUndo.get(), &pDocShell->GetDocument() );
ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
@@ -123,7 +123,7 @@ void ScUndoInsertTab::Redo()
{
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- RedoSdrUndoAction( pDrawUndo ); // Draw Redo first
+ RedoSdrUndoAction( pDrawUndo.get() ); // Draw Redo first
pDocShell->SetInUndo( true ); //! BeginRedo
bDrawIsInUndo = true;
@@ -160,14 +160,14 @@ ScUndoInsertTables::ScUndoInsertTables( ScDocShell* pNewDocShell,
aNameList( newNameList ),
nTab( nTabNum )
{
- pDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() ).release();
+ pDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() );
SetChangeTrack();
}
ScUndoInsertTables::~ScUndoInsertTables()
{
- delete pDrawUndo;
+ pDrawUndo.reset();
}
OUString ScUndoInsertTables::GetComment() const
@@ -208,7 +208,7 @@ void ScUndoInsertTables::Undo()
bDrawIsInUndo = false;
pDocShell->SetInUndo( false ); //! EndUndo
- DoSdrUndoAction( pDrawUndo, &pDocShell->GetDocument() );
+ DoSdrUndoAction( pDrawUndo.get(), &pDocShell->GetDocument() );
ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
@@ -222,7 +222,7 @@ void ScUndoInsertTables::Redo()
{
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- RedoSdrUndoAction( pDrawUndo ); // Draw Redo first
+ RedoSdrUndoAction( pDrawUndo.get() ); // Draw Redo first
pDocShell->SetInUndo( true ); //! BeginRedo
bDrawIsInUndo = true;
@@ -277,7 +277,7 @@ void ScUndoDeleteTab::SetChangeTrack()
{
aRange.aStart.SetTab( theTabs[i] );
aRange.aEnd.SetTab( theTabs[i] );
- pChangeTrack->AppendDeleteRange( aRange, pRefUndoDoc,
+ pChangeTrack->AppendDeleteRange( aRange, pRefUndoDoc.get(),
nTmpChangeAction, nEndChangeAction, static_cast<short>(i) );
}
}
@@ -377,7 +377,7 @@ void ScUndoDeleteTab::Redo()
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
pViewShell->SetTabNo( lcl_GetVisibleTabBefore( pDocShell->GetDocument(), theTabs.front() ) );
- RedoSdrUndoAction( pDrawUndo ); // Draw Redo first
+ RedoSdrUndoAction( pDrawUndo.get() ); // Draw Redo first
pDocShell->SetInUndo( true ); //! BeginRedo
bDrawIsInUndo = true;
@@ -575,7 +575,7 @@ ScUndoCopyTab::ScUndoCopyTab(
mpNewNames(pNewNames),
pDrawUndo( nullptr )
{
- pDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() ).release();
+ pDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() );
if (mpNewNames && mpNewTabs->size() != mpNewNames->size())
// The sizes differ. Something is wrong.
@@ -584,7 +584,7 @@ ScUndoCopyTab::ScUndoCopyTab(
ScUndoCopyTab::~ScUndoCopyTab()
{
- delete pDrawUndo;
+ pDrawUndo.reset();
}
OUString ScUndoCopyTab::GetComment() const
@@ -610,7 +610,7 @@ void ScUndoCopyTab::Undo()
{
ScDocument& rDoc = pDocShell->GetDocument();
- DoSdrUndoAction( pDrawUndo, &rDoc ); // before the sheets are deleted
+ DoSdrUndoAction( pDrawUndo.get(), &rDoc ); // before the sheets are deleted
vector<SCTAB>::const_reverse_iterator itr, itrEnd = mpNewTabs->rend();
for (itr = mpNewTabs->rbegin(); itr != itrEnd; ++itr)
@@ -687,7 +687,7 @@ void ScUndoCopyTab::Redo()
}
}
- RedoSdrUndoAction( pDrawUndo ); // after the sheets are inserted
+ RedoSdrUndoAction( pDrawUndo.get() ); // after the sheets are inserted
pViewShell->SetTabNo( nDestTab, true ); // after draw-undo
@@ -786,12 +786,12 @@ ScUndoMakeScenario::ScUndoMakeScenario( ScDocShell* pNewDocShell,
nFlags( nF ),
pDrawUndo( nullptr )
{
- pDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() ).release();
+ pDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() );
}
ScUndoMakeScenario::~ScUndoMakeScenario()
{
- delete pDrawUndo;
+ pDrawUndo.reset();
}
OUString ScUndoMakeScenario::GetComment() const
@@ -809,7 +809,7 @@ void ScUndoMakeScenario::Undo()
bDrawIsInUndo = false;
pDocShell->SetInUndo( false );
- DoSdrUndoAction( pDrawUndo, &rDoc );
+ DoSdrUndoAction( pDrawUndo.get(), &rDoc );
pDocShell->PostPaint(0,0,nDestTab,MAXCOL,MAXROW,MAXTAB, PaintPartFlags::All);
pDocShell->PostDataChanged();
@@ -828,7 +828,7 @@ void ScUndoMakeScenario::Redo()
{
SetViewMarkData(*mpMarkData);
- RedoSdrUndoAction( pDrawUndo ); // Draw Redo first
+ RedoSdrUndoAction( pDrawUndo.get() ); // Draw Redo first
pDocShell->SetInUndo( true );
bDrawIsInUndo = true;
@@ -865,12 +865,12 @@ ScUndoImportTab::ScUndoImportTab(ScDocShell* pShell,
, nCount(nNewCount)
, pDrawUndo(nullptr)
{
- pDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() ).release();
+ pDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() );
}
ScUndoImportTab::~ScUndoImportTab()
{
- delete pDrawUndo;
+ pDrawUndo.reset();
}
OUString ScUndoImportTab::GetComment() const
@@ -942,7 +942,7 @@ void ScUndoImportTab::Undo()
}
- DoSdrUndoAction( pDrawUndo, &rDoc ); // before the sheets are deleted
+ DoSdrUndoAction( pDrawUndo.get(), &rDoc ); // before the sheets are deleted
bDrawIsInUndo = true;
for (i=0; i<nCount; i++)
@@ -995,7 +995,7 @@ void ScUndoImportTab::Redo()
rDoc.SetTabProtection(nTabPos, xRedoDoc->GetTabProtection(nTabPos));
}
- RedoSdrUndoAction( pDrawUndo ); // after the sheets are inserted
+ RedoSdrUndoAction( pDrawUndo.get() ); // after the sheets are inserted
DoChange();
}
@@ -1304,8 +1304,8 @@ ScUndoPrintRange::ScUndoPrintRange( ScDocShell* pShell, SCTAB nNewTab,
ScUndoPrintRange::~ScUndoPrintRange()
{
- delete pOldRanges;
- delete pNewRanges;
+ pOldRanges.reset();
+ pNewRanges.reset();
}
void ScUndoPrintRange::DoChange(bool bUndo)