summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-04-10 11:15:01 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-04-13 09:17:20 +0200
commitd0d4a3647692883b17a1acd96a01a1857c5872b1 (patch)
tree30b278f835ac7675847df03e15f11bf0135b8b47
parent846027306a9edcbdf7bf1a3271fd6f8b0d4b139d (diff)
loplugin:useuniqueptr in ScImportExport
Change-Id: I2b064dfcc3ab8ad7eba360fc90cd56ac9bd1cf22 Reviewed-on: https://gerrit.libreoffice.org/52759 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sc/source/ui/docshell/impex.cxx12
-rw-r--r--sc/source/ui/inc/impex.hxx4
2 files changed, 8 insertions, 8 deletions
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index b517bab9911e..099dae70e5e1 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -188,8 +188,8 @@ ScImportExport::ScImportExport( ScDocument* p, const OUString& rPos )
ScImportExport::~ScImportExport() COVERITY_NOEXCEPT_FALSE
{
- delete pUndoDoc;
- delete pExtOptions;
+ pUndoDoc.reset();
+ pExtOptions.reset();
}
void ScImportExport::SetExtOptions( const ScAsciiOptions& rOpt )
@@ -197,7 +197,7 @@ void ScImportExport::SetExtOptions( const ScAsciiOptions& rOpt )
if ( pExtOptions )
*pExtOptions = rOpt;
else
- pExtOptions = new ScAsciiOptions( rOpt );
+ pExtOptions.reset(new ScAsciiOptions( rOpt ));
// "normal" Options
@@ -239,7 +239,7 @@ bool ScImportExport::StartPaste()
}
if( bUndo && pDocSh && pDoc->IsUndoEnabled())
{
- pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
+ pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
pUndoDoc->InitUndo( pDoc, aRange.aStart.Tab(), aRange.aEnd.Tab() );
pDoc->CopyToDocument(aRange, InsertDeleteFlags::ALL | InsertDeleteFlags::NOCAPTIONS, false, *pUndoDoc);
}
@@ -260,9 +260,9 @@ void ScImportExport::EndPaste(bool bAutoRowHeight)
ScMarkData aDestMark;
aDestMark.SetMarkArea(aRange);
pDocSh->GetUndoManager()->AddUndoAction(
- new ScUndoPaste(pDocSh, aRange, aDestMark, pUndoDoc, pRedoDoc, InsertDeleteFlags::ALL, nullptr));
+ new ScUndoPaste(pDocSh, aRange, aDestMark, pUndoDoc.release(), pRedoDoc, InsertDeleteFlags::ALL, nullptr));
}
- pUndoDoc = nullptr;
+ pUndoDoc.reset();
if( pDocSh )
{
if (!bHeight)
diff --git a/sc/source/ui/inc/impex.hxx b/sc/source/ui/inc/impex.hxx
index a143f067494a..d82265dd5c3d 100644
--- a/sc/source/ui/inc/impex.hxx
+++ b/sc/source/ui/inc/impex.hxx
@@ -48,7 +48,7 @@ class ScImportExport
{
ScDocShell* pDocSh;
ScDocument* pDoc;
- ScDocument* pUndoDoc;
+ std::unique_ptr<ScDocument> pUndoDoc;
ScRange aRange;
OUString aStreamPath;
OUString aNonConvertibleChars;
@@ -72,7 +72,7 @@ class ScImportExport
// do not need to broadcast after the import.
ScExportTextOptions mExportTextOptions;
- ScAsciiOptions* pExtOptions; // extended options
+ std::unique_ptr<ScAsciiOptions> pExtOptions; // extended options
bool StartPaste(); // Protect check, set up Undo
void EndPaste(bool bAutoRowHeight = true); // Undo/Redo actions, Repaint