summaryrefslogtreecommitdiff
path: root/sc/source/ui/docshell/docfunc.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-01-15 09:09:22 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-01-16 11:05:47 +0100
commitd08425c14b29bbac9f33c234f89b451388cd1d7c (patch)
treefa441dcaa912692c2e10f6189337446147400bfd /sc/source/ui/docshell/docfunc.cxx
parent4c9caae6c8ab608688a68be2c81bde2dd40315b7 (diff)
use unique_ptr in sc
Change-Id: If64b50919002f1f7376602f6e9cfb24e2184263b Reviewed-on: https://gerrit.libreoffice.org/66417 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/ui/docshell/docfunc.cxx')
-rw-r--r--sc/source/ui/docshell/docfunc.cxx14
1 files changed, 7 insertions, 7 deletions
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 8f8d642190e5..a3255535443f 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -2457,7 +2457,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
WaitObject aWait( ScDocShell::GetActiveDialogParent() ); // important because of TrackFormulas in UpdateReference
ScDocumentUniquePtr pUndoDoc;
- ScDocument* pRefUndoDoc = nullptr;
+ std::unique_ptr<ScDocument> pRefUndoDoc;
std::unique_ptr<ScRefUndoData> pUndoData;
if ( bRecord )
{
@@ -2480,7 +2480,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
InsertDeleteFlags::ALL | InsertDeleteFlags::NOCAPTIONS, false, *pUndoDoc );
}
- pRefUndoDoc = new ScDocument( SCDOCMODE_UNDO );
+ pRefUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
pRefUndoDoc->InitUndo( &rDoc, 0, nTabCount-1 );
pUndoData.reset(new ScRefUndoData( &rDoc ));
@@ -2501,22 +2501,22 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
switch (eCmd)
{
case DelCellCmd::CellsUp:
- rDoc.DeleteRow( nStartCol, 0, nEndCol, MAXTAB, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc, nullptr, &aFullMark );
+ rDoc.DeleteRow( nStartCol, 0, nEndCol, MAXTAB, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc.get(), nullptr, &aFullMark );
nPaintEndRow = MAXROW;
break;
case DelCellCmd::Rows:
- rDoc.DeleteRow( 0, 0, MAXCOL, MAXTAB, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc, &bUndoOutline, &aFullMark );
+ rDoc.DeleteRow( 0, 0, MAXCOL, MAXTAB, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc.get(), &bUndoOutline, &aFullMark );
nPaintStartCol = 0;
nPaintEndCol = MAXCOL;
nPaintEndRow = MAXROW;
nPaintFlags |= PaintPartFlags::Left;
break;
case DelCellCmd::CellsLeft:
- rDoc.DeleteCol( nStartRow, 0, nEndRow, MAXTAB, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc, nullptr, &aFullMark );
+ rDoc.DeleteCol( nStartRow, 0, nEndRow, MAXTAB, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc.get(), nullptr, &aFullMark );
nPaintEndCol = MAXCOL;
break;
case DelCellCmd::Cols:
- rDoc.DeleteCol( 0, 0, MAXROW, MAXTAB, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc, &bUndoOutline, &aFullMark );
+ rDoc.DeleteCol( 0, 0, MAXROW, MAXTAB, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc.get(), &bUndoOutline, &aFullMark );
nPaintStartRow = 0;
nPaintEndRow = MAXROW;
nPaintEndCol = MAXCOL;
@@ -2544,7 +2544,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
// copy with bColRowFlags=false (#54194#)
pRefUndoDoc->CopyToDocument(0,0,0,MAXCOL,MAXROW,MAXTAB,InsertDeleteFlags::FORMULA,false,*pUndoDoc,nullptr,false);
- delete pRefUndoDoc;
+ pRefUndoDoc.reset();
std::unique_ptr<SCTAB[]> pTabs( new SCTAB[nSelCount]);
std::unique_ptr<SCTAB[]> pScenarios( new SCTAB[nSelCount]);