summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-10-08 11:22:10 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-10-09 12:09:55 +0200
commitf7ce839c7844f029c0a1ac83a5638e83356b4c4b (patch)
treec93a342a577133b384a3ccc088d7d0675d4fb9e3 /sc
parent4ba06560e33f17ca1ed72ad722c80eae5ffd4277 (diff)
use unique_ptr in SfxUndoManager::AddUndoAction
Change-Id: I11483e3cece12a7373f4276972b4c899edf1ce15 Reviewed-on: https://gerrit.libreoffice.org/61566 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/docshell/arealink.cxx4
-rw-r--r--sc/source/ui/docshell/dbdocfun.cxx30
-rw-r--r--sc/source/ui/docshell/dbdocimp.cxx2
-rw-r--r--sc/source/ui/docshell/docfunc.cxx120
-rw-r--r--sc/source/ui/docshell/docfuncutil.cxx2
-rw-r--r--sc/source/ui/docshell/docsh4.cxx8
-rw-r--r--sc/source/ui/docshell/docsh5.cxx16
-rw-r--r--sc/source/ui/docshell/impex.cxx2
-rw-r--r--sc/source/ui/docshell/olinefun.cxx18
-rw-r--r--sc/source/ui/docshell/tablink.cxx4
-rw-r--r--sc/source/ui/drawfunc/drawsh5.cxx2
-rw-r--r--sc/source/ui/drawfunc/fuins2.cxx4
-rw-r--r--sc/source/ui/drawfunc/futext3.cxx6
-rw-r--r--sc/source/ui/namedlg/namedefdlg.cxx2
-rw-r--r--sc/source/ui/unoobj/TablePivotCharts.cxx4
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx12
-rw-r--r--sc/source/ui/unoobj/chartuno.cxx6
-rw-r--r--sc/source/ui/view/dbfunc.cxx6
-rw-r--r--sc/source/ui/view/dbfunc3.cxx6
-rw-r--r--sc/source/ui/view/drawvie3.cxx4
-rw-r--r--sc/source/ui/view/drawvie4.cxx10
-rw-r--r--sc/source/ui/view/drawview.cxx6
-rw-r--r--sc/source/ui/view/formatsh.cxx8
-rw-r--r--sc/source/ui/view/preview.cxx4
-rw-r--r--sc/source/ui/view/spelldialog.cxx2
-rw-r--r--sc/source/ui/view/viewfun2.cxx26
-rw-r--r--sc/source/ui/view/viewfun3.cxx18
-rw-r--r--sc/source/ui/view/viewfun4.cxx8
-rw-r--r--sc/source/ui/view/viewfun7.cxx2
-rw-r--r--sc/source/ui/view/viewfunc.cxx22
30 files changed, 181 insertions, 183 deletions
diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx
index d0797a453873..6461f802c126 100644
--- a/sc/source/ui/docshell/arealink.cxx
+++ b/sc/source/ui/docshell/arealink.cxx
@@ -140,7 +140,7 @@ void ScAreaLink::Closed()
bool bUndo (rDoc.IsUndoEnabled());
if (bAddUndo && bUndo)
{
- m_pDocSh->GetUndoManager()->AddUndoAction( new ScUndoRemoveAreaLink( m_pDocSh,
+ m_pDocSh->GetUndoManager()->AddUndoAction( o3tl::make_unique<ScUndoRemoveAreaLink>( m_pDocSh,
aFileName, aFilterName, aOptions,
aSourceArea, aDestArea, GetRefreshDelay() ) );
@@ -417,7 +417,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
rDoc.CopyToDocument(aNewRange, InsertDeleteFlags::ALL & ~InsertDeleteFlags::NOTE, false, *pRedoDoc);
m_pDocSh->GetUndoManager()->AddUndoAction(
- new ScUndoUpdateAreaLink( m_pDocSh,
+ o3tl::make_unique<ScUndoUpdateAreaLink>( m_pDocSh,
aFileName, aFilterName, aOptions,
aSourceArea, aOldRange, GetRefreshDelay(),
aNewUrl, rNewFilter, aNewOpt,
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index d82ce8b2ca39..b374d94cd34e 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -106,7 +106,7 @@ bool ScDBDocFunc::AddDBRange( const OUString& rName, const ScRange& rRange )
if (bUndo)
{
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoDBData( &rDocShell, std::move(pUndoColl),
+ o3tl::make_unique<ScUndoDBData>( &rDocShell, std::move(pUndoColl),
o3tl::make_unique<ScDBCollection>( *pDocColl ) ) );
}
@@ -139,7 +139,7 @@ bool ScDBDocFunc::DeleteDBRange(const OUString& rName)
if (bUndo)
{
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoDBData( &rDocShell, std::move(pUndoColl),
+ o3tl::make_unique<ScUndoDBData>( &rDocShell, std::move(pUndoColl),
o3tl::make_unique<ScDBCollection>( *pDocColl ) ) );
}
@@ -183,7 +183,7 @@ bool ScDBDocFunc::RenameDBRange( const OUString& rOld, const OUString& rNew )
if (bUndo)
{
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoDBData( &rDocShell, std::move(pUndoColl),
+ o3tl::make_unique<ScUndoDBData>( &rDocShell, std::move(pUndoColl),
o3tl::make_unique<ScDBCollection>( *pDocColl ) ) );
}
else
@@ -234,7 +234,7 @@ void ScDBDocFunc::ModifyDBData( const ScDBData& rNewData )
if (bUndo)
{
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoDBData( &rDocShell, std::move(pUndoColl),
+ o3tl::make_unique<ScUndoDBData>( &rDocShell, std::move(pUndoColl),
o3tl::make_unique<ScDBCollection>( *pDocColl ) ) );
}
@@ -276,7 +276,7 @@ void ScDBDocFunc::ModifyAllDBData( const ScDBCollection& rNewColl, const std::ve
if (bRecord)
{
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoDBData(&rDocShell, std::move(pUndoColl),
+ o3tl::make_unique<ScUndoDBData>(&rDocShell, std::move(pUndoColl),
o3tl::make_unique<ScDBCollection>(rNewColl)));
}
}
@@ -443,7 +443,7 @@ bool ScDBDocFunc::RepeatDB( const OUString& rDBName, bool bApi, bool bIsUnnamed,
}
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoRepeatDB( &rDocShell, nTab,
+ o3tl::make_unique<ScUndoRepeatDB>( &rDocShell, nTab,
nStartCol, nStartRow, nEndCol, nEndRow,
nNewEndRow,
//nCurX, nCurY,
@@ -571,8 +571,8 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam,
if (bRecord)
{
// Set up an undo object.
- sc::UndoSort* pUndoAction = new sc::UndoSort(&rDocShell, aUndoParam);
- rDocShell.GetUndoManager()->AddUndoAction(pUndoAction);
+ rDocShell.GetUndoManager()->AddUndoAction(
+ o3tl::make_unique<sc::UndoSort>(&rDocShell, aUndoParam));
}
pDBData->SetSortParam(rSortParam);
@@ -930,7 +930,7 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
{
// create undo action after executing, because of drawing layer undo
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoQuery( &rDocShell, nTab, rQueryParam, std::move(pUndoDoc), std::move(pUndoDB),
+ o3tl::make_unique<ScUndoQuery>( &rDocShell, nTab, rQueryParam, std::move(pUndoDoc), std::move(pUndoDB),
pOld, bDoSize, pAdvSource ) );
}
@@ -1108,7 +1108,7 @@ void ScDBDocFunc::DoSubTotals( SCTAB nTab, const ScSubTotalParam& rParam,
{
// ScDBData* pUndoDBData = pDBData ? new ScDBData( *pDBData ) : NULL;
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoSubTotals( &rDocShell, nTab,
+ o3tl::make_unique<ScUndoSubTotals>( &rDocShell, nTab,
rParam, aNewParam.nRow2,
std::move(pUndoDoc), std::move(pUndoTab), // pUndoDBData,
std::move(pUndoRange), std::move(pUndoDB) ) );
@@ -1325,7 +1325,7 @@ bool ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb
if (bRecord)
{
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoDataPilot(
+ o3tl::make_unique<ScUndoDataPilot>(
&rDocShell, std::move(pOldUndoDoc), std::move(pNewUndoDoc), &aUndoDPObj, pOldObj, bAllowMove));
}
@@ -1370,7 +1370,7 @@ bool ScDBDocFunc::RemovePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi)
for (SdrOle2Obj* pChartObject : aListOfObjects)
{
rDoc.GetChartListenerCollection()->removeByName(pChartObject->GetName());
- pModel->AddUndo(new SdrUndoDelObj(*pChartObject));
+ pModel->AddUndo(o3tl::make_unique<SdrUndoDelObj>(*pChartObject));
pChartObject->getSdrPageFromSdrObject()->RemoveObject(pChartObject->GetOrdNum());
}
}
@@ -1409,7 +1409,7 @@ bool ScDBDocFunc::RemovePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi)
if (bRecord)
{
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoDataPilot(
+ o3tl::make_unique<ScUndoDataPilot>(
&rDocShell, std::move(pOldUndoDoc), nullptr, pUndoDPObj.get(), nullptr, false));
// pUndoDPObj is copied
@@ -1522,7 +1522,7 @@ bool ScDBDocFunc::CreatePivotTable(const ScDPObject& rDPObj, bool bRecord, bool
if (bRecord)
{
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoDataPilot(&rDocShell, nullptr, std::move(pNewUndoDoc), nullptr, &rDestObj, false));
+ o3tl::make_unique<ScUndoDataPilot>(&rDocShell, nullptr, std::move(pNewUndoDoc), nullptr, &rDestObj, false));
}
// notify API objects
@@ -1597,7 +1597,7 @@ bool ScDBDocFunc::UpdatePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi)
if (bRecord)
{
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoDataPilot(
+ o3tl::make_unique<ScUndoDataPilot>(
&rDocShell, std::move(pOldUndoDoc), std::move(pNewUndoDoc), &aUndoDPObj, &rDPObj, false));
}
diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx
index 49c1cf8d542b..a83b0c376ab5 100644
--- a/sc/source/ui/docshell/dbdocimp.cxx
+++ b/sc/source/ui/docshell/dbdocimp.cxx
@@ -583,7 +583,7 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
std::unique_ptr<ScDBData> pRedoDBData(pDBData ? new ScDBData( *pDBData ) : nullptr);
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoImportData( &rDocShell, nTab,
+ o3tl::make_unique<ScUndoImportData>( &rDocShell, nTab,
rParam, nUndoEndCol, nUndoEndRow,
nFormulaCols,
std::move(pUndoDoc), std::move(pRedoDoc),
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 58b6c92b4ba3..0d25a473db1a 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -110,7 +110,7 @@ void ScDocFunc::NotifyDrawUndo( std::unique_ptr<SdrUndoAction> pUndoAction)
if( pDrawLayer && pDrawLayer->IsRecording() )
pDrawLayer->AddCalcUndo( std::move(pUndoAction) );
else
- rDocShell.GetUndoManager()->AddUndoAction( new ScUndoDraw( std::move(pUndoAction), &rDocShell ) );
+ rDocShell.GetUndoManager()->AddUndoAction( o3tl::make_unique<ScUndoDraw>( std::move(pUndoAction), &rDocShell ) );
rDocShell.SetDrawModified();
// the affected sheet isn't known, so all stream positions are invalidated
@@ -191,7 +191,7 @@ bool ScDocFunc::DetectiveAddPred(const ScAddress& rPos)
if (bUndo)
{
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoDetective( &rDocShell, std::move(pUndo), &aOperation ) );
+ o3tl::make_unique<ScUndoDetective>( &rDocShell, std::move(pUndo), &aOperation ) );
}
aModificator.SetDocumentModified();
SfxBindings* pBindings = rDocShell.GetViewBindings();
@@ -230,7 +230,7 @@ bool ScDocFunc::DetectiveDelPred(const ScAddress& rPos)
if (bUndo)
{
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoDetective( &rDocShell, std::move(pUndo), &aOperation ) );
+ o3tl::make_unique<ScUndoDetective>( &rDocShell, std::move(pUndo), &aOperation ) );
}
aModificator.SetDocumentModified();
SfxBindings* pBindings = rDocShell.GetViewBindings();
@@ -267,7 +267,7 @@ bool ScDocFunc::DetectiveAddSucc(const ScAddress& rPos)
if (bUndo)
{
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoDetective( &rDocShell, std::move(pUndo), &aOperation ) );
+ o3tl::make_unique<ScUndoDetective>( &rDocShell, std::move(pUndo), &aOperation ) );
}
aModificator.SetDocumentModified();
SfxBindings* pBindings = rDocShell.GetViewBindings();
@@ -306,7 +306,7 @@ bool ScDocFunc::DetectiveDelSucc(const ScAddress& rPos)
if (bUndo)
{
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoDetective( &rDocShell, std::move(pUndo), &aOperation ) );
+ o3tl::make_unique<ScUndoDetective>( &rDocShell, std::move(pUndo), &aOperation ) );
}
aModificator.SetDocumentModified();
SfxBindings* pBindings = rDocShell.GetViewBindings();
@@ -343,7 +343,7 @@ bool ScDocFunc::DetectiveAddError(const ScAddress& rPos)
if (bUndo)
{
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoDetective( &rDocShell, std::move(pUndo), &aOperation ) );
+ o3tl::make_unique<ScUndoDetective>( &rDocShell, std::move(pUndo), &aOperation ) );
}
aModificator.SetDocumentModified();
SfxBindings* pBindings = rDocShell.GetViewBindings();
@@ -381,7 +381,7 @@ bool ScDocFunc::DetectiveMarkInvalid(SCTAB nTab)
if (pUndo && bUndo)
{
pUndo->SetComment( ScResId( STR_UNDO_DETINVALID ) );
- rDocShell.GetUndoManager()->AddUndoAction( pUndo.release() );
+ rDocShell.GetUndoManager()->AddUndoAction( std::move(pUndo) );
}
aModificator.SetDocumentModified();
if ( bOverflow )
@@ -425,7 +425,7 @@ bool ScDocFunc::DetectiveDelAll(SCTAB nTab)
if (bUndo)
{
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoDetective( &rDocShell, std::move(pUndo), nullptr, std::move(pUndoList) ) );
+ o3tl::make_unique<ScUndoDetective>( &rDocShell, std::move(pUndo), nullptr, std::move(pUndoList) ) );
}
aModificator.SetDocumentModified();
SfxBindings* pBindings = rDocShell.GetViewBindings();
@@ -496,8 +496,8 @@ bool ScDocFunc::DetectiveRefresh( bool bAutomatic )
pUndo->SetComment( ScResId( STR_UNDO_DETREFRESH ) );
// associate with the last action
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoDraw( std::move(pUndo), &rDocShell ),
- bAutomatic );
+ o3tl::make_unique<ScUndoDraw>( std::move(pUndo), &rDocShell ),
+ bAutomatic );
}
}
rDocShell.SetDrawModified();
@@ -745,7 +745,7 @@ bool ScDocFunc::TransliterateText( const ScMarkData& rMark, TransliterationFlags
rDoc.CopyToDocument(aCopyRange, InsertDeleteFlags::CONTENTS, true, *pUndoDoc, &aMultiMark);
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoTransliterate( &rDocShell, aMultiMark, std::move(pUndoDoc), nType ) );
+ o3tl::make_unique<ScUndoTransliterate>( &rDocShell, aMultiMark, std::move(pUndoDoc), nType ) );
}
rDoc.TransliterateText( aMultiMark, nType );
@@ -802,7 +802,7 @@ bool ScDocFunc::SetNormalString( bool& o_rbNumFmtSet, const ScAddress& rPos, con
{
// because of ChangeTracking, UndoAction can be created only after SetString was called
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoEnterData(&rDocShell, rPos, aOldValues, rText, nullptr));
+ o3tl::make_unique<ScUndoEnterData>(&rDocShell, rPos, aOldValues, rText, nullptr));
}
if ( bEditDeleted || rDoc.HasAttrib( ScRange(rPos), HasAttrFlags::NeedHeight ) )
@@ -837,7 +837,7 @@ bool ScDocFunc::SetValueCell( const ScAddress& rPos, double fVal, bool bInteract
SfxUndoManager* pUndoMgr = rDocShell.GetUndoManager();
ScCellValue aNewVal;
aNewVal.assign(rDoc, rPos);
- pUndoMgr->AddUndoAction(new ScUndoSetCell(&rDocShell, rPos, aOldVal, aNewVal));
+ pUndoMgr->AddUndoAction(o3tl::make_unique<ScUndoSetCell>(&rDocShell, rPos, aOldVal, aNewVal));
}
if (bHeight)
@@ -869,11 +869,11 @@ void ScDocFunc::SetValueCells( const ScAddress& rPos, const std::vector<double>&
if (rDoc.IsUndoEnabled())
{
- sc::UndoSetCells* pUndoObj = new sc::UndoSetCells(&rDocShell, rPos);
+ std::unique_ptr<sc::UndoSetCells> pUndoObj(new sc::UndoSetCells(&rDocShell, rPos));
rDoc.TransferCellValuesTo(rPos, aVals.size(), pUndoObj->GetOldValues());
pUndoObj->SetNewValues(aVals);
SfxUndoManager* pUndoMgr = rDocShell.GetUndoManager();
- pUndoMgr->AddUndoAction(pUndoObj);
+ pUndoMgr->AddUndoAction(std::move(pUndoObj));
}
rDoc.SetValues(rPos, aVals);
@@ -907,7 +907,7 @@ bool ScDocFunc::SetStringCell( const ScAddress& rPos, const OUString& rStr, bool
SfxUndoManager* pUndoMgr = rDocShell.GetUndoManager();
ScCellValue aNewVal;
aNewVal.assign(rDoc, rPos);
- pUndoMgr->AddUndoAction(new ScUndoSetCell(&rDocShell, rPos, aOldVal, aNewVal));
+ pUndoMgr->AddUndoAction(o3tl::make_unique<ScUndoSetCell>(&rDocShell, rPos, aOldVal, aNewVal));
}
if (bHeight)
@@ -942,7 +942,7 @@ bool ScDocFunc::SetEditCell( const ScAddress& rPos, const EditTextObject& rStr,
SfxUndoManager* pUndoMgr = rDocShell.GetUndoManager();
ScCellValue aNewVal;
aNewVal.assign(rDoc, rPos);
- pUndoMgr->AddUndoAction(new ScUndoSetCell(&rDocShell, rPos, aOldVal, aNewVal));
+ pUndoMgr->AddUndoAction(o3tl::make_unique<ScUndoSetCell>(&rDocShell, rPos, aOldVal, aNewVal));
}
if (bHeight)
@@ -1006,7 +1006,7 @@ bool ScDocFunc::SetFormulaCell( const ScAddress& rPos, ScFormulaCell* pCell, boo
SfxUndoManager* pUndoMgr = rDocShell.GetUndoManager();
ScCellValue aNewVal;
aNewVal.assign(rDoc, rPos);
- pUndoMgr->AddUndoAction(new ScUndoSetCell(&rDocShell, rPos, aOldVal, aNewVal));
+ pUndoMgr->AddUndoAction(o3tl::make_unique<ScUndoSetCell>(&rDocShell, rPos, aOldVal, aNewVal));
}
if (bHeight)
@@ -1198,7 +1198,7 @@ bool ScDocFunc::ShowNote( const ScAddress& rPos, bool bShow )
// move the caption to internal or hidden layer and create undo action
pNote->ShowCaption( rPos, bShow );
if( rDoc.IsUndoEnabled() )
- rDocShell.GetUndoManager()->AddUndoAction( new ScUndoShowHideNote( rDocShell, rPos, bShow ) );
+ rDocShell.GetUndoManager()->AddUndoAction( o3tl::make_unique<ScUndoShowHideNote>( rDocShell, rPos, bShow ) );
rDoc.SetStreamValid(rPos.Tab(), false);
@@ -1284,7 +1284,7 @@ void ScDocFunc::ReplaceNote( const ScAddress& rPos, const OUString& rNoteText, c
// create the undo action
if( pUndoMgr && (aOldData.m_pCaption || aNewData.m_pCaption) )
- pUndoMgr->AddUndoAction( new ScUndoReplaceNote( rDocShell, rPos, aOldData, aNewData, pDrawLayer->GetCalcUndo() ) );
+ pUndoMgr->AddUndoAction( o3tl::make_unique<ScUndoReplaceNote>( rDocShell, rPos, aOldData, aNewData, pDrawLayer->GetCalcUndo() ) );
// repaint cell (to make note marker visible)
rDocShell.PostPaintCell( rPos );
@@ -1344,7 +1344,7 @@ bool ScDocFunc::ApplyAttributes( const ScMarkData& rMark, const ScPatternAttr& r
rDoc.CopyToDocument(aMultiRange, InsertDeleteFlags::ATTRIB, bMulti, *pUndoDoc, &rMark);
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoSelectionAttr(
+ o3tl::make_unique<ScUndoSelectionAttr>(
&rDocShell, rMark,
aMultiRange.aStart.Col(), aMultiRange.aStart.Row(), aMultiRange.aStart.Tab(),
aMultiRange.aEnd.Col(), aMultiRange.aEnd.Row(), aMultiRange.aEnd.Tab(),
@@ -1426,7 +1426,7 @@ bool ScDocFunc::ApplyStyle( const ScMarkData& rMark, const OUString& rStyleName,
rDoc.CopyToDocument( aCopyRange, InsertDeleteFlags::ATTRIB, bMulti, *pUndoDoc, &rMark );
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoSelectionStyle(
+ o3tl::make_unique<ScUndoSelectionStyle>(
&rDocShell, rMark, aMultiRange, rStyleName, std::move(pUndoDoc) ) );
}
@@ -1960,7 +1960,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
if (bRecord && pUndoRemoveMerge)
{
- rDocShell.GetUndoManager()->AddUndoAction( pUndoRemoveMerge.release());
+ rDocShell.GetUndoManager()->AddUndoAction( std::move(pUndoRemoveMerge));
}
switch (eCmd)
@@ -2021,7 +2021,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
rDocShell.GetUndoManager()->LeaveListAction();
}
- rDocShell.GetUndoManager()->AddUndoAction( new ScUndoInsertCells(
+ rDocShell.GetUndoManager()->AddUndoAction( o3tl::make_unique<ScUndoInsertCells>(
&rDocShell, ScRange( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab ),
nUndoPos, std::move(pTabs), std::move(pScenarios), eCmd, std::move(pRefUndoDoc), std::move(pUndoData), bPartOfPaste ) );
}
@@ -2441,7 +2441,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
if (bRecord && pUndoRemoveMerge)
{
- rDocShell.GetUndoManager()->AddUndoAction( pUndoRemoveMerge.release());
+ rDocShell.GetUndoManager()->AddUndoAction( std::move(pUndoRemoveMerge));
}
// do it
@@ -2553,7 +2553,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
rDocShell.GetUndoManager()->LeaveListAction();
}
- rDocShell.GetUndoManager()->AddUndoAction( new ScUndoDeleteCells(
+ rDocShell.GetUndoManager()->AddUndoAction( o3tl::make_unique<ScUndoDeleteCells>(
&rDocShell, ScRange( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab ),
nUndoPos, std::move(pTabs), std::move(pScenarios),
eCmd, std::move(pUndoDoc), std::move(pUndoData) ) );
@@ -2930,7 +2930,7 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
ScAddress aDestPos(nDestCol, nDestRow, nDestTab);
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoDragDrop(
+ o3tl::make_unique<ScUndoDragDrop>(
&rDocShell, aUndoRange, aDestPos, bCut, std::move(pUndoDoc), bScenariosAdded));
}
@@ -3144,7 +3144,7 @@ bool ScDocFunc::InsertTable( SCTAB nTab, const OUString& rName, bool bRecord, bo
{
if (bRecord)
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoInsertTab( &rDocShell, nTab, bAppend, rName));
+ o3tl::make_unique<ScUndoInsertTab>( &rDocShell, nTab, bAppend, rName));
// Update views:
// Only insert vba modules if vba mode ( and not currently importing XML )
if( bInsertDocModule )
@@ -3227,7 +3227,7 @@ bool ScDocFunc::DeleteTable( SCTAB nTab, bool bRecord )
vector<SCTAB> theTabs;
theTabs.push_back(nTab);
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoDeleteTab( &rDocShell, theTabs, std::move(pUndoDoc), std::move(pUndoData) ));
+ o3tl::make_unique<ScUndoDeleteTab>( &rDocShell, theTabs, std::move(pUndoDoc), std::move(pUndoData) ));
}
// Update views:
if( bVbaEnabled )
@@ -3300,7 +3300,7 @@ void ScDocFunc::SetTableVisible( SCTAB nTab, bool bVisible, bool bApi )
{
std::vector<SCTAB> undoTabs;
undoTabs.push_back(nTab);
- rDocShell.GetUndoManager()->AddUndoAction( new ScUndoShowHideTab( &rDocShell, undoTabs, bVisible ) );
+ rDocShell.GetUndoManager()->AddUndoAction( o3tl::make_unique<ScUndoShowHideTab>( &rDocShell, undoTabs, bVisible ) );
}
// update views
@@ -3327,7 +3327,7 @@ bool ScDocFunc::SetLayoutRTL( SCTAB nTab, bool bRTL )
if (bUndo)
{
- rDocShell.GetUndoManager()->AddUndoAction( new ScUndoLayoutRTL( &rDocShell, nTab, bRTL ) );
+ rDocShell.GetUndoManager()->AddUndoAction( o3tl::make_unique<ScUndoLayoutRTL>( &rDocShell, nTab, bRTL ) );
}
rDocShell.PostPaint( 0,0,0,MAXCOL,MAXROW,MAXTAB, PaintPartFlags::All );
@@ -3365,7 +3365,7 @@ bool ScDocFunc::RenameTable( SCTAB nTab, const OUString& rName, bool bRecord, bo
if (bRecord)
{
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoRenameTab( &rDocShell, nTab, sOldName, rName));
+ o3tl::make_unique<ScUndoRenameTab>( &rDocShell, nTab, sOldName, rName));
}
rDocShell.PostPaintExtras();
aModificator.SetDocumentModified();
@@ -3401,7 +3401,7 @@ bool ScDocFunc::SetTabBgColor( SCTAB nTab, const Color& rColor, bool bRecord, bo
if (bRecord)
{
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoTabColor( &rDocShell, nTab, aOldTabBgColor, rColor));
+ o3tl::make_unique<ScUndoTabColor>( &rDocShell, nTab, aOldTabBgColor, rColor));
}
rDocShell.PostPaintExtras();
ScDocShellModificator aModificator( rDocShell );
@@ -3466,7 +3466,7 @@ bool ScDocFunc::SetTabBgColor(
if (bRecord)
{
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoTabColor( &rDocShell, rUndoTabColorList));
+ o3tl::make_unique<ScUndoTabColor>( &rDocShell, rUndoTabColorList));
}
rDocShell.PostPaintExtras();
ScDocShellModificator aModificator( rDocShell );
@@ -3649,7 +3649,7 @@ bool ScDocFunc::SetWidthOrHeight(
ScMarkData aMark;
aMark.SelectOneTable( nTab );
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoWidthOrHeight(
+ o3tl::make_unique<ScUndoWidthOrHeight>(
&rDocShell, aMark, nStart, nTab, nEnd, nTab, std::move(pUndoDoc),
aUndoRanges, std::move(pUndoTab), eMode, nSizeTwips, bWidth));
}
@@ -3690,7 +3690,7 @@ bool ScDocFunc::InsertPageBreak( bool bColumn, const ScAddress& rPos,
if (bRecord)
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoPageBreak( &rDocShell, rPos.Col(), rPos.Row(), nTab, bColumn, true ) );
+ o3tl::make_unique<ScUndoPageBreak>( &rDocShell, rPos.Col(), rPos.Row(), nTab, bColumn, true ) );
if (bColumn)
rDoc.SetColBreak(static_cast<SCCOL>(nPos), nTab, false, true);
@@ -3754,7 +3754,7 @@ bool ScDocFunc::RemovePageBreak( bool bColumn, const ScAddress& rPos,
if (bRecord)
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoPageBreak( &rDocShell, rPos.Col(), rPos.Row(), nTab, bColumn, false ) );
+ o3tl::make_unique<ScUndoPageBreak>( &rDocShell, rPos.Col(), rPos.Row(), nTab, bColumn, false ) );
if (bColumn)
rDoc.RemoveColBreak(static_cast<SCCOL>(nPos), nTab, false, true);
@@ -3806,7 +3806,7 @@ void ScDocFunc::ProtectSheet( SCTAB nTab, const ScTableProtection& rProtect )
::std::unique_ptr<ScTableProtection> p(new ScTableProtection(*pProtect));
p->setProtected(true); // just in case ...
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoTabProtect(&rDocShell, nTab, std::move(p)) );
+ o3tl::make_unique<ScUndoTabProtect>(&rDocShell, nTab, std::move(p)) );
// ownership of unique_ptr now transferred to ScUndoTabProtect.
}
@@ -3836,7 +3836,7 @@ bool ScDocFunc::Protect( SCTAB nTab, const OUString& rPassword )
::std::unique_ptr<ScDocProtection> p(new ScDocProtection(*pProtect));
p->setProtected(true); // just in case ...
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoDocProtect(&rDocShell, std::move(p)) );
+ o3tl::make_unique<ScUndoDocProtect>(&rDocShell, std::move(p)) );
// ownership of unique_ptr is transferred to ScUndoDocProtect.
}
}
@@ -3859,7 +3859,7 @@ bool ScDocFunc::Protect( SCTAB nTab, const OUString& rPassword )
::std::unique_ptr<ScTableProtection> p(new ScTableProtection(*pProtect));
p->setProtected(true); // just in case ...
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoTabProtect(&rDocShell, nTab, std::move(p)) );
+ o3tl::make_unique<ScUndoTabProtect>(&rDocShell, nTab, std::move(p)) );
// ownership of unique_ptr now transferred to ScUndoTabProtect.
}
}
@@ -3906,7 +3906,7 @@ bool ScDocFunc::Unprotect( SCTAB nTab, const OUString& rPassword, bool bApi )
{
pProtectCopy->setProtected(false);
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoDocProtect(&rDocShell, std::move(pProtectCopy)) );
+ o3tl::make_unique<ScUndoDocProtect>(&rDocShell, std::move(pProtectCopy)) );
// ownership of unique_ptr now transferred to ScUndoDocProtect.
}
}
@@ -3941,7 +3941,7 @@ bool ScDocFunc::Unprotect( SCTAB nTab, const OUString& rPassword, bool bApi )
{
pProtectCopy->setProtected(false);
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoTabProtect(&rDocShell, nTab, std::move(pProtectCopy)) );
+ o3tl::make_unique<ScUndoTabProtect>(&rDocShell, nTab, std::move(pProtectCopy)) );
// ownership of unique_ptr now transferred to ScUndoTabProtect.
}
}
@@ -3987,7 +3987,7 @@ void ScDocFunc::ClearItems( const ScMarkData& rMark, const sal_uInt16* pWhich, b
rDoc.CopyToDocument( aMarkRange, InsertDeleteFlags::ATTRIB, true, *pUndoDoc, &aMultiMark );
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoClearItems( &rDocShell, aMultiMark, std::move(pUndoDoc), pWhich ) );
+ o3tl::make_unique<ScUndoClearItems>( &rDocShell, aMultiMark, std::move(pUndoDoc), pWhich ) );
}
rDoc.ClearSelectionItems( pWhich, aMultiMark );
@@ -4033,7 +4033,7 @@ bool ScDocFunc::ChangeIndent( const ScMarkData& rMark, bool bIncrement, bool bAp
rDoc.CopyToDocument( aCopyRange, InsertDeleteFlags::ATTRIB, true, *pUndoDoc, &rMark );
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoIndent( &rDocShell, rMark, std::move(pUndoDoc), bIncrement ) );
+ o3tl::make_unique<ScUndoIndent>( &rDocShell, rMark, std::move(pUndoDoc), bIncrement ) );
}
rDoc.ChangeSelectionIndent( bIncrement, rMark );
@@ -4157,7 +4157,7 @@ bool ScDocFunc::AutoFormat( const ScRange& rRange, const ScMarkData* pTabMark,
if ( bRecord ) // only now is Draw-Undo available
{
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoAutoFormat( &rDocShell, rRange, std::move(pUndoDoc), aMark, bSize, nFormatNo ) );
+ o3tl::make_unique<ScUndoAutoFormat>( &rDocShell, rRange, std::move(pUndoDoc), aMark, bSize, nFormatNo ) );
}
aModificator.SetDocumentModified();
@@ -4242,7 +4242,7 @@ bool ScDocFunc::EnterMatrix( const ScRange& rRange, const ScMarkData* pTabMark,
{
//! take selected sheets into account also when undoing
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoEnterMatrix( &rDocShell, rRange, std::move(pUndoDoc), rString ) );
+ o3tl::make_unique<ScUndoEnterMatrix>( &rDocShell, rRange, std::move(pUndoDoc), rString ) );
}
// Err522 painting of DDE-Formulas will be intercepted during interpreting
@@ -4296,7 +4296,7 @@ bool ScDocFunc::TabOp( const ScRange& rRange, const ScMarkData* pTabMark,
rDoc.CopyToDocument( rRange, InsertDeleteFlags::ALL & ~InsertDeleteFlags::NOTE, false, *pUndoDoc );
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoTabOp( &rDocShell,
+ o3tl::make_unique<ScUndoTabOp>( &rDocShell,
nStartCol, nStartRow, nStartTab,
nEndCol, nEndRow, nEndTab, std::move(pUndoDoc),
rParam.aRefFormulaCell,
@@ -4492,7 +4492,7 @@ bool ScDocFunc::FillSimple( const ScRange& rRange, const ScMarkData* pTabMark,
if ( bRecord ) // only now is Draw-Undo available
{
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoAutoFill( &rDocShell, aDestArea, aSourceArea, std::move(pUndoDoc), aMark,
+ o3tl::make_unique<ScUndoAutoFill>( &rDocShell, aDestArea, aSourceArea, std::move(pUndoDoc), aMark,
eDir, FILL_SIMPLE, FILL_DAY, MAXDOUBLE, 1.0, 1e307) );
}
@@ -4623,7 +4623,7 @@ bool ScDocFunc::FillSeries( const ScRange& rRange, const ScMarkData* pTabMark,
if ( bRecord ) // only now is Draw-Undo available
{
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoAutoFill( &rDocShell, aDestArea, aSourceArea, std::move(pUndoDoc), aMark,
+ o3tl::make_unique<ScUndoAutoFill>( &rDocShell, aDestArea, aSourceArea, std::move(pUndoDoc), aMark,
eDir, eCmd, eDateCmd, fStart, fStep, fMax) );
}
@@ -4762,7 +4762,7 @@ bool ScDocFunc::FillAuto( ScRange& rRange, const ScMarkData* pTabMark, FillDir e
if ( bRecord ) // only now is Draw-Undo available
{
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoAutoFill( &rDocShell, aDestArea, aSourceArea, std::move(pUndoDoc), aMark,
+ o3tl::make_unique<ScUndoAutoFill>( &rDocShell, aDestArea, aSourceArea, std::move(pUndoDoc), aMark,
eDir, eCmd, eDateCmd, MAXDOUBLE, fStep, fMax) );
}
@@ -4876,7 +4876,7 @@ bool ScDocFunc::MergeCells( const ScCellMergeOption& rOption, bool bContents, bo
{
std::unique_ptr<SdrUndoGroup> pDrawUndo = rDoc.GetDrawLayer() ? rDoc.GetDrawLayer()->GetCalcUndo() : nullptr;
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoMerge(&rDocShell, rOption, bNeedContentsUndo, std::move(pUndoDoc), std::move(pDrawUndo)) );
+ o3tl::make_unique<ScUndoMerge>(&rDocShell, rOption, bNeedContentsUndo, std::move(pUndoDoc), std::move(pDrawUndo)) );
}
aModificator.SetDocumentModified();
@@ -4969,7 +4969,7 @@ bool ScDocFunc::UnmergeCells( const ScCellMergeOption& rOption, bool bRecord, Sc
else
{
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoRemoveMerge( &rDocShell, rOption, ScDocumentUniquePtr(pUndoDoc) ) );
+ o3tl::make_unique<ScUndoRemoveMerge>( &rDocShell, rOption, ScDocumentUniquePtr(pUndoDoc) ) );
}
}
aModificator.SetDocumentModified();
@@ -5004,7 +5004,7 @@ void ScDocFunc::SetNewRangeNames( std::unique_ptr<ScRangeName> pNewRanges, bool
std::unique_ptr<ScRangeName> pUndoRanges(new ScRangeName(*pOld));
std::unique_ptr<ScRangeName> pRedoRanges(new ScRangeName(*pNewRanges));
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoRangeNames( &rDocShell, std::move(pUndoRanges), std::move(pRedoRanges), nTab ) );
+ o3tl::make_unique<ScUndoRangeNames>( &rDocShell, std::move(pUndoRanges), std::move(pRedoRanges), nTab ) );
}
// #i55926# While loading XML, formula cells only have a single string token,
@@ -5038,7 +5038,7 @@ void ScDocFunc::ModifyAllRangeNames(const std::map<OUString, std::unique_ptr<ScR
std::map<OUString, ScRangeName*> aOldRangeMap;
rDoc.GetRangeNameMap(aOldRangeMap);
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoAllRangeNames(&rDocShell, aOldRangeMap, rRangeMap));
+ o3tl::make_unique<ScUndoAllRangeNames>(&rDocShell, aOldRangeMap, rRangeMap));
}
rDoc.PreprocessAllRangeNamesUpdate(rRangeMap);
@@ -5301,7 +5301,7 @@ bool ScDocFunc::InsertNameList( const ScAddress& rStartPos, bool bApi )
InsertDeleteFlags::ALL, false, *pRedoDoc);
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoListNames( &rDocShell,
+ o3tl::make_unique<ScUndoListNames>( &rDocShell,
ScRange( nStartCol,nStartRow,nTab, nEndCol,nEndRow,nTab ),
std::move(pUndoDoc), std::move(pRedoDoc) ) );
}
@@ -5398,7 +5398,7 @@ void ScDocFunc::InsertAreaLink( const OUString& rFile, const OUString& rFilter,
ScAreaLink* pOldArea = static_cast<ScAreaLink*>(pBase);
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoRemoveAreaLink( &rDocShell,
+ o3tl::make_unique<ScUndoRemoveAreaLink>( &rDocShell,
pOldArea->GetFile(), pOldArea->GetFilter(), pOldArea->GetOptions(),
pOldArea->GetSource(), pOldArea->GetDestArea(), pOldArea->GetRefreshDelay() ) );
}
@@ -5428,7 +5428,7 @@ void ScDocFunc::InsertAreaLink( const OUString& rFile, const OUString& rFilter,
if (bUndo)
{
- rDocShell.GetUndoManager()->AddUndoAction( new ScUndoInsertAreaLink( &rDocShell,
+ rDocShell.GetUndoManager()->AddUndoAction( o3tl::make_unique<ScUndoInsertAreaLink>( &rDocShell,
rFile, aFilterName, aNewOptions,
rSource, rDestRange, nRefresh ) );
if ( nRemoved )
@@ -5516,7 +5516,7 @@ void ScDocFunc::ReplaceConditionalFormat( sal_uLong nOldFormat, ScConditionalFor
aCompleteRange.aEnd.Col(),aCompleteRange.aEnd.Row(),nTab,
InsertDeleteFlags::ALL, false, *pRedoDoc);
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoConditionalFormat(&rDocShell, std::move(pUndoDoc), std::move(pRedoDoc), aCompleteRange));
+ o3tl::make_unique<ScUndoConditionalFormat>(&rDocShell, std::move(pUndoDoc), std::move(pRedoDoc), aCompleteRange));
}
if(pRepaintRange)
@@ -5566,7 +5566,7 @@ void ScDocFunc::SetConditionalFormatList( ScConditionalFormatList* pList, SCTAB
pRedoDoc->SetCondFormList(new ScConditionalFormatList(pRedoDoc.get(), *pList), nTab);
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoConditionalFormatList(&rDocShell, std::move(pUndoDoc), std::move(pRedoDoc), nTab));
+ o3tl::make_unique<ScUndoConditionalFormatList>(&rDocShell, std::move(pUndoDoc), std::move(pRedoDoc), nTab));
}
rDoc.SetStreamValid(nTab, false);
@@ -5598,7 +5598,7 @@ void ScDocFunc::ConvertFormulaToValue( const ScRange& rRange, bool bInteraction
if (bRecord && pUndoVals)
{
rDocShell.GetUndoManager()->AddUndoAction(
- new sc::UndoFormulaToValue(&rDocShell, *pUndoVals));
+ o3tl::make_unique<sc::UndoFormulaToValue>(&rDocShell, *pUndoVals));
}
rDocShell.PostPaint(rRange, PaintPartFlags::Grid);
diff --git a/sc/source/ui/docshell/docfuncutil.cxx b/sc/source/ui/docshell/docfuncutil.cxx
index 0ee0805ee905..6e469c5c7e88 100644
--- a/sc/source/ui/docshell/docfuncutil.cxx
+++ b/sc/source/ui/docshell/docfuncutil.cxx
@@ -85,7 +85,7 @@ void DocFuncUtil::addDeleteContentsUndo(
pDocSh, rMark, rRange, std::move(pUndoDoc), bMulti, nFlags, bDrawUndo));
pUndo->SetDataSpans(pSpans);
- pUndoMgr->AddUndoAction(pUndo.release());
+ pUndoMgr->AddUndoAction(std::move(pUndo));
}
std::unique_ptr<ScSimpleUndo::DataSpansType> DocFuncUtil::getNonEmptyCellSpans(
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 1fab2b481f6f..b09254aeb764 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -388,7 +388,7 @@ void ScDocShell::Execute( SfxRequest& rReq )
if (bUndo)
{
GetUndoManager()->AddUndoAction(
- new ScUndoChartData( this, aChartName, aRangeListRef,
+ o3tl::make_unique<ScUndoChartData>( this, aChartName, aRangeListRef,
bColHeaders, bRowHeaders, bAddRange ) );
}
m_aDocument.UpdateChartArea( aChartName, aRangeListRef,
@@ -400,7 +400,7 @@ void ScDocShell::Execute( SfxRequest& rReq )
if (bUndo)
{
GetUndoManager()->AddUndoAction(
- new ScUndoChartData( this, aChartName, aNewRange,
+ o3tl::make_unique<ScUndoChartData>( this, aChartName, aNewRange,
bColHeaders, bRowHeaders, bAddRange ) );
}
m_aDocument.UpdateChartArea( aChartName, aNewRange,
@@ -1524,7 +1524,7 @@ void ScDocShell::SetPrintZoom( SCTAB nTab, sal_uInt16 nScale, sal_uInt16 nPages
{
sal_uInt16 nOldScale = rSet.Get(ATTR_PAGE_SCALE).GetValue();
sal_uInt16 nOldPages = rSet.Get(ATTR_PAGE_SCALETOPAGES).GetValue();
- GetUndoManager()->AddUndoAction( new ScUndoPrintZoom(
+ GetUndoManager()->AddUndoAction( o3tl::make_unique<ScUndoPrintZoom>(
this, nTab, nOldScale, nOldPages, nScale, nPages ) );
}
@@ -1726,7 +1726,7 @@ void ScDocShell::ExecutePageStyle( const SfxViewShell& rCaller,
if (bUndo)
{
GetUndoManager()->AddUndoAction(
- new ScUndoModifyStyle( this, SfxStyleFamily::Page,
+ o3tl::make_unique<ScUndoModifyStyle>( this, SfxStyleFamily::Page,
aOldData, aNewData ) );
}
diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index f94be4468f18..01a6fe6a906b 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -324,7 +324,7 @@ ScDBData* ScDocShell::GetDBData( const ScRange& rMarked, ScGetDBMode eMode, ScGe
{
m_aDocument.CompileHybridFormula();
- GetUndoManager()->AddUndoAction( new ScUndoDBData( this,
+ GetUndoManager()->AddUndoAction( o3tl::make_unique<ScUndoDBData>( this,
std::move(pUndoColl),
o3tl::make_unique<ScDBCollection>( *pColl ) ) );
}
@@ -598,7 +598,7 @@ void ScDocShell::DoConsolidate( const ScConsolidateParam& rParam, bool bRecord )
m_aDocument.CopyToDocument(aOldDest, InsertDeleteFlags::ALL, false, *pUndoDoc);
GetUndoManager()->AddUndoAction(
- new ScUndoConsolidate( this, aDestArea, rParam, std::move(pUndoDoc),
+ o3tl::make_unique<ScUndoConsolidate>( this, aDestArea, rParam, std::move(pUndoDoc),
true, nInsertCount, std::move(pUndoTab), std::move(pUndoData) ) );
}
else
@@ -615,7 +615,7 @@ void ScDocShell::DoConsolidate( const ScConsolidateParam& rParam, bool bRecord )
m_aDocument.CopyToDocument(aOldDest, InsertDeleteFlags::ALL, false, *pUndoDoc);
GetUndoManager()->AddUndoAction(
- new ScUndoConsolidate( this, aDestArea, rParam, std::move(pUndoDoc),
+ o3tl::make_unique<ScUndoConsolidate>( this, aDestArea, rParam, std::move(pUndoDoc),
false, 0, nullptr, std::move(pUndoData) ) );
}
}
@@ -716,7 +716,7 @@ void ScDocShell::UseScenario( SCTAB nTab, const OUString& rName, bool bRecord )
}
GetUndoManager()->AddUndoAction(
- new ScUndoUseScenario( this, aScenMark,
+ o3tl::make_unique<ScUndoUseScenario>( this, aScenMark,
ScArea( nTab,nStartCol,nStartRow,nEndCol,nEndRow ),
std::move(pUndoDoc), rName ) );
}
@@ -766,7 +766,7 @@ void ScDocShell::ModifyScenario( SCTAB nTab, const OUString& rName, const OUStri
ScScenarioFlags nOldFlags;
m_aDocument.GetScenarioData( nTab, aOldComment, aOldColor, nOldFlags );
GetUndoManager()->AddUndoAction(
- new ScUndoScenarioFlags(this, nTab,
+ o3tl::make_unique<ScUndoScenarioFlags>(this, nTab,
aOldName, rName, aOldComment, rComment,
aOldColor, rColor, nOldFlags, nFlags) );
@@ -811,7 +811,7 @@ SCTAB ScDocShell::MakeScenario( SCTAB nTab, const OUString& rName, const OUStrin
if (bRecord)
{
GetUndoManager()->AddUndoAction(
- new ScUndoMakeScenario( this, nTab, nNewTab,
+ o3tl::make_unique<ScUndoMakeScenario>( this, nTab, nNewTab,
rName, rComment, rColor, nFlags, rMark ));
}
@@ -937,7 +937,7 @@ bool ScDocShell::MoveTable( SCTAB nSrcTab, SCTAB nDestTab, bool bCopy, bool bRec
unique_ptr< vector<SCTAB> > pSrcList(new vector<SCTAB>(1, nSrcTab));
unique_ptr< vector<SCTAB> > pDestList(new vector<SCTAB>(1, nDestTab));
GetUndoManager()->AddUndoAction(
- new ScUndoCopyTab(this, std::move(pSrcList), std::move(pDestList)));
+ o3tl::make_unique<ScUndoCopyTab>(this, std::move(pSrcList), std::move(pDestList)));
}
bool bVbaEnabled = m_aDocument.IsInVBAMode();
@@ -1004,7 +1004,7 @@ bool ScDocShell::MoveTable( SCTAB nSrcTab, SCTAB nDestTab, bool bCopy, bool bRec
unique_ptr< vector<SCTAB> > pSrcList(new vector<SCTAB>(1, nSrcTab));
unique_ptr< vector<SCTAB> > pDestList(new vector<SCTAB>(1, nDestTab));
GetUndoManager()->AddUndoAction(
- new ScUndoMoveTab(this, std::move(pSrcList), std::move(pDestList)));
+ o3tl::make_unique<ScUndoMoveTab>(this, std::move(pSrcList), std::move(pDestList)));
}
Broadcast( ScTablesHint( SC_TAB_MOVED, nSrcTab, nDestTab ) );
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 0e80e499411d..f82630e600b1 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -263,7 +263,7 @@ void ScImportExport::EndPaste(bool bAutoRowHeight)
ScMarkData aDestMark;
aDestMark.SetMarkArea(aRange);
pDocSh->GetUndoManager()->AddUndoAction(
- new ScUndoPaste(pDocSh, aRange, aDestMark, std::move(pUndoDoc), std::move(pRedoDoc), InsertDeleteFlags::ALL, nullptr));
+ o3tl::make_unique<ScUndoPaste>(pDocSh, aRange, aDestMark, std::move(pUndoDoc), std::move(pRedoDoc), InsertDeleteFlags::ALL, nullptr));
}
pUndoDoc.reset();
if( pDocSh )
diff --git a/sc/source/ui/docshell/olinefun.cxx b/sc/source/ui/docshell/olinefun.cxx
index b63de2cf27a4..23a8f846af35 100644
--- a/sc/source/ui/docshell/olinefun.cxx
+++ b/sc/source/ui/docshell/olinefun.cxx
@@ -111,7 +111,7 @@ void ScOutlineDocFunc::MakeOutline( const ScRange& rRange, bool bColumns, bool b
if (bRecord)
{
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoMakeOutline( &rDocShell,
+ o3tl::make_unique<ScUndoMakeOutline>( &rDocShell,
nStartCol,nStartRow,nTab,nEndCol,nEndRow,nTab,
std::move(pUndoTab), bColumns, true ) );
}
@@ -172,7 +172,7 @@ void ScOutlineDocFunc::RemoveOutline( const ScRange& rRange, bool bColumns, bool
if (bRecord)
{
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoMakeOutline( &rDocShell,
+ o3tl::make_unique<ScUndoMakeOutline>( &rDocShell,
nStartCol,nStartRow,nTab, nEndCol,nEndRow,nTab,
std::move(pUndoTab), bColumns, false ) );
}
@@ -228,7 +228,7 @@ bool ScOutlineDocFunc::RemoveAllOutlines( SCTAB nTab, bool bRecord )
std::unique_ptr<ScOutlineTable> pUndoTab(new ScOutlineTable( *pTable ));
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoRemoveAllOutlines( &rDocShell,
+ o3tl::make_unique<ScUndoRemoveAllOutlines>( &rDocShell,
nStartCol, nStartRow, nTab,
nEndCol, nEndRow, nTab,
std::move(pUndoDoc), std::move(pUndoTab) ) );
@@ -300,7 +300,7 @@ void ScOutlineDocFunc::AutoOutline( const ScRange& rRange, bool bRecord )
if (bRecord)
{
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoAutoOutline( &rDocShell,
+ o3tl::make_unique<ScUndoAutoOutline>( &rDocShell,
nStartCol, nStartRow, nTab,
nEndCol, nEndRow, nTab,
std::move(pUndoDoc), std::move(pUndoTab) ) );
@@ -348,7 +348,7 @@ bool ScOutlineDocFunc::SelectLevel( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
}
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoOutlineLevel( &rDocShell,
+ o3tl::make_unique<ScUndoOutlineLevel>( &rDocShell,
nStart, nEnd, nTab, //! calculate start and end
std::move(pUndoDoc), std::move(pUndoTab),
bColumns, nLevel ) );
@@ -461,7 +461,7 @@ bool ScOutlineDocFunc::ShowMarkedOutlines( const ScRange& rRange, bool bRecord )
rDoc.CopyToDocument(0, nStartRow, nTab, MAXCOL, nEndRow, nTab, InsertDeleteFlags::NONE, false, *pUndoDoc);
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoOutlineBlock( &rDocShell,
+ o3tl::make_unique<ScUndoOutlineBlock>( &rDocShell,
nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab,
std::move(pUndoDoc), std::move(pUndoTab), true ) );
}
@@ -589,7 +589,7 @@ bool ScOutlineDocFunc::HideMarkedOutlines( const ScRange& rRange, bool bRecord )
rDoc.CopyToDocument(0, nEffStartRow, nTab, MAXCOL, nEffEndRow, nTab, InsertDeleteFlags::NONE, false, *pUndoDoc);
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoOutlineBlock( &rDocShell,
+ o3tl::make_unique<ScUndoOutlineBlock>( &rDocShell,
nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab,
std::move(pUndoDoc), std::move(pUndoTab), false ) );
}
@@ -666,7 +666,7 @@ void ScOutlineDocFunc::ShowOutline( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
}
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoDoOutline( &rDocShell,
+ o3tl::make_unique<ScUndoDoOutline>( &rDocShell,
nStart, nEnd, nTab, std::move(pUndoDoc), //! calc start and end
bColumns, nLevel, nEntry, true ) );
}
@@ -758,7 +758,7 @@ bool ScOutlineDocFunc::HideOutline( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
}
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoDoOutline( &rDocShell,
+ o3tl::make_unique<ScUndoDoOutline>( &rDocShell,
nStart, nEnd, nTab, std::move(pUndoDoc),
bColumns, nLevel, nEntry, false ) );
}
diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx
index 4b1ebb5928ed..1644c6eba5c6 100644
--- a/sc/source/ui/docshell/tablink.cxx
+++ b/sc/source/ui/docshell/tablink.cxx
@@ -145,7 +145,7 @@ void ScTableLink::Closed()
if (bAddUndo && bUndo)
{
pImpl->m_pDocSh->GetUndoManager()->AddUndoAction(
- new ScUndoRemoveLink( pImpl->m_pDocSh, aFileName ) );
+ o3tl::make_unique<ScUndoRemoveLink>( pImpl->m_pDocSh, aFileName ) );
bAddUndo = false; // only once
}
@@ -384,7 +384,7 @@ bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter,
if (bAddUndo && bUndo)
pImpl->m_pDocSh->GetUndoManager()->AddUndoAction(
- new ScUndoRefreshLink( pImpl->m_pDocSh, std::move(pUndoDoc) ) );
+ o3tl::make_unique<ScUndoRefreshLink>( pImpl->m_pDocSh, std::move(pUndoDoc) ) );
// Paint (may be several tables)
diff --git a/sc/source/ui/drawfunc/drawsh5.cxx b/sc/source/ui/drawfunc/drawsh5.cxx
index 8cd59b32e9ff..cc036a2bd5e4 100644
--- a/sc/source/ui/drawfunc/drawsh5.cxx
+++ b/sc/source/ui/drawfunc/drawsh5.cxx
@@ -522,7 +522,7 @@ void ScDrawShell::ExecDrawFunc( SfxRequest& rReq )
if(!aPersistName.isEmpty())
{
pDocSh->GetUndoManager()->AddUndoAction(
- new ScUndoRenameObject(pDocSh, aPersistName, pSelected->GetName(), aName));
+ o3tl::make_unique<ScUndoRenameObject>(pDocSh, aPersistName, pSelected->GetName(), aName));
}
}
diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx
index 2ea92dec0858..6ac928a06401 100644
--- a/sc/source/ui/drawfunc/fuins2.cxx
+++ b/sc/source/ui/drawfunc/fuins2.cxx
@@ -564,7 +564,7 @@ FuInsertChart::FuInsertChart(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawV
if (bUndo)
{
pScDocSh->GetUndoManager()->AddUndoAction(
- new ScUndoInsertTab( pScDocSh, nNewTab,
+ o3tl::make_unique<ScUndoInsertTab>( pScDocSh, nNewTab,
true/*bAppend*/, aTabName ) );
}
@@ -727,7 +727,7 @@ FuInsertChart::FuInsertChart(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawV
{
// add undo action the same way as in SdrEditView::InsertObjectAtView
// (using UndoActionHdl etc.)
- pView->AddUndo(new SdrUndoNewObj(*pObj));
+ pView->AddUndo(o3tl::make_unique<SdrUndoNewObj>(*pObj));
}
// BM/IHA --
diff --git a/sc/source/ui/drawfunc/futext3.cxx b/sc/source/ui/drawfunc/futext3.cxx
index a6ffeb93e4ec..6f7431056b9f 100644
--- a/sc/source/ui/drawfunc/futext3.cxx
+++ b/sc/source/ui/drawfunc/futext3.cxx
@@ -92,9 +92,9 @@ void FuText::StopEditMode()
// create a "insert note" undo action if needed
if( bNewNote )
- pUndoMgr->AddUndoAction( new ScUndoReplaceNote( *pDocShell, aNotePos, pNote->GetNoteData(), true, std::move(pCalcUndo) ) );
+ pUndoMgr->AddUndoAction( o3tl::make_unique<ScUndoReplaceNote>( *pDocShell, aNotePos, pNote->GetNoteData(), true, std::move(pCalcUndo) ) );
else
- pUndoMgr->AddUndoAction( pCalcUndo.release() );
+ pUndoMgr->AddUndoAction( std::move(pCalcUndo) );
}
}
@@ -143,7 +143,7 @@ void FuText::StopEditMode()
// delete note from document (removes caption, but does not delete it)
rDoc.ReleaseNote(aNotePos);
// create undo action for removed note
- pUndoMgr->AddUndoAction( new ScUndoReplaceNote( *pDocShell, aNotePos, aNoteData, false, pDrawLayer->GetCalcUndo() ) );
+ pUndoMgr->AddUndoAction( o3tl::make_unique<ScUndoReplaceNote>( *pDocShell, aNotePos, aNoteData, false, pDrawLayer->GetCalcUndo() ) );
}
else
{
diff --git a/sc/source/ui/namedlg/namedefdlg.cxx b/sc/source/ui/namedlg/namedefdlg.cxx
index d88f368d8a28..ff226ef9a471 100644
--- a/sc/source/ui/namedlg/namedefdlg.cxx
+++ b/sc/source/ui/namedlg/namedefdlg.cxx
@@ -258,7 +258,7 @@ void ScNameDefDlg::AddPushed()
assert( pNewEntry); // undo of no insertion smells fishy
if (pNewEntry)
mpDocShell->GetUndoManager()->AddUndoAction(
- new ScUndoAddRangeData( mpDocShell, pNewEntry, nTab) );
+ o3tl::make_unique<ScUndoAddRangeData>( mpDocShell, pNewEntry, nTab) );
// set table stream invalid, otherwise RangeName won't be saved if no other
// call invalidates the stream
diff --git a/sc/source/ui/unoobj/TablePivotCharts.cxx b/sc/source/ui/unoobj/TablePivotCharts.cxx
index 7f150e228572..22c3b2bbc6d1 100644
--- a/sc/source/ui/unoobj/TablePivotCharts.cxx
+++ b/sc/source/ui/unoobj/TablePivotCharts.cxx
@@ -164,7 +164,7 @@ void SAL_CALL TablePivotCharts::addNewByName(OUString const & rName,
xObject->setVisualAreaSize(nAspect, aAwtSize);
pPage->InsertObject(pObject);
- pModel->AddUndo(new SdrUndoInsertObj(*pObject));
+ pModel->AddUndo(o3tl::make_unique<SdrUndoInsertObj>(*pObject));
}
}
@@ -177,7 +177,7 @@ void SAL_CALL TablePivotCharts::removeByName(const OUString& rName)
ScDocument& rDoc = m_pDocShell->GetDocument();
ScDrawLayer* pModel = rDoc.GetDrawLayer();
SdrPage* pPage = pModel->GetPage(sal_uInt16(m_nTab));
- pModel->AddUndo(new SdrUndoDelObj(*pObject));
+ pModel->AddUndo(o3tl::make_unique<SdrUndoDelObj>(*pObject));
pPage->RemoveObject(pObject->GetOrdNum());
}
}
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index bb877953a05c..3107100af06b 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -1086,7 +1086,7 @@ void ScHelperFunctions::ApplyBorder( ScDocShell* pDocShell, const ScRangeList& r
if (bUndo)
{
pDocShell->GetUndoManager()->AddUndoAction(
- new ScUndoBorder( pDocShell, rRanges, std::move(pUndoDoc), rOuter, rInner ) );
+ o3tl::make_unique<ScUndoBorder>( pDocShell, rRanges, std::move(pUndoDoc), rOuter, rInner ) );
}
for (size_t i = 0; i < nCount; ++i )
@@ -1223,7 +1223,7 @@ static bool lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange,
ScMarkData aDestMark;
aDestMark.SelectOneTable( nTab );
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoPaste(
+ o3tl::make_unique<ScUndoPaste>(
&rDocShell, ScRange(nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab),
aDestMark, std::move(pUndoDoc), nullptr, InsertDeleteFlags::CONTENTS, nullptr, false));
}
@@ -1324,7 +1324,7 @@ static bool lcl_PutFormulaArray( ScDocShell& rDocShell, const ScRange& rRange,
ScMarkData aDestMark;
aDestMark.SelectOneTable( nTab );
rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoPaste( &rDocShell,
+ o3tl::make_unique<ScUndoPaste>( &rDocShell,
ScRange(nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab), aDestMark,
std::move(pUndoDoc), nullptr, InsertDeleteFlags::CONTENTS, nullptr, false));
}
@@ -4047,7 +4047,7 @@ sal_Int32 SAL_CALL ScCellRangesBase::replaceAll( const uno::Reference<util::XSea
nReplaced = pUndoDoc->GetCellCount();
pDocShell->GetUndoManager()->AddUndoAction(
- new ScUndoReplace( pDocShell, *pUndoMark, nCol, nRow, nTab,
+ o3tl::make_unique<ScUndoReplace>( pDocShell, *pUndoMark, nCol, nRow, nTab,
aUndoStr, std::move(pUndoDoc), pSearchItem ) );
pDocShell->PostPaintGridAll();
@@ -7015,7 +7015,7 @@ void SAL_CALL ScTableSheetObj::removeAllManualPageBreaks()
pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true );
rDoc.CopyToDocument(0,0,nTab, MAXCOL,MAXROW,nTab, InsertDeleteFlags::NONE, false, *pUndoDoc);
pDocSh->GetUndoManager()->AddUndoAction(
- new ScUndoRemoveBreaks( pDocSh, nTab, std::move(pUndoDoc) ) );
+ o3tl::make_unique<ScUndoRemoveBreaks>( pDocSh, nTab, std::move(pUndoDoc) ) );
}
rDoc.RemoveManualBreaks(nTab);
@@ -7182,7 +7182,7 @@ void ScTableSheetObj::PrintAreaUndo_Impl( std::unique_ptr<ScPrintRangeSaver> pOl
if(bUndo)
{
pDocSh->GetUndoManager()->AddUndoAction(
- new ScUndoPrintRange(
+ o3tl::make_unique<ScUndoPrintRange>(
pDocSh,
nTab,
std::move(pOldRanges),
diff --git a/sc/source/ui/unoobj/chartuno.cxx b/sc/source/ui/unoobj/chartuno.cxx
index 61670c1b86fa..d3be0afbf05f 100644
--- a/sc/source/ui/unoobj/chartuno.cxx
+++ b/sc/source/ui/unoobj/chartuno.cxx
@@ -261,7 +261,7 @@ void SAL_CALL ScChartsObj::addNewByName( const OUString& rName,
// ChartHelper::AdaptDefaultsForChart( xObj );
pPage->InsertObject( pObj );
- pModel->AddUndo( new SdrUndoInsertObj( *pObj ) );
+ pModel->AddUndo( o3tl::make_unique<SdrUndoInsertObj>( *pObj ) );
}
}
@@ -276,7 +276,7 @@ void SAL_CALL ScChartsObj::removeByName( const OUString& aName )
ScDrawLayer* pModel = rDoc.GetDrawLayer(); // is not zero
SdrPage* pPage = pModel->GetPage(static_cast<sal_uInt16>(nTab)); // is not zero
- pModel->AddUndo( new SdrUndoDelObj( *pObj ) );
+ pModel->AddUndo( o3tl::make_unique<SdrUndoDelObj>( *pObj ) );
pPage->RemoveObject( pObj->GetOrdNum() );
//! Notify etc.???
@@ -508,7 +508,7 @@ void ScChartObj::Update_Impl( const ScRangeListRef& rRanges, bool bColHeaders, b
if (bUndo)
{
pDocShell->GetUndoManager()->AddUndoAction(
- new ScUndoChartData( pDocShell, aChartName, rRanges, bColHeaders, bRowHeaders, false ) );
+ o3tl::make_unique<ScUndoChartData>( pDocShell, aChartName, rRanges, bColHeaders, bRowHeaders, false ) );
}
rDoc.UpdateChartArea( aChartName, rRanges, bColHeaders, bRowHeaders, false );
}
diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx
index 24e2d194f537..03c5f5f4fcef 100644
--- a/sc/source/ui/view/dbfunc.cxx
+++ b/sc/source/ui/view/dbfunc.cxx
@@ -315,7 +315,7 @@ void ScDBFunc::ToggleAutoFilter()
ScRange aRange;
pDBData->GetArea( aRange );
pDocSh->GetUndoManager()->AddUndoAction(
- new ScUndoAutoFilter( pDocSh, aRange, pDBData->GetName(), false ) );
+ o3tl::make_unique<ScUndoAutoFilter>( pDocSh, aRange, pDBData->GetName(), false ) );
pDBData->SetAutoFilter(false);
@@ -354,7 +354,7 @@ void ScDBFunc::ToggleAutoFilter()
ScRange aRange;
pDBData->GetArea( aRange );
pDocSh->GetUndoManager()->AddUndoAction(
- new ScUndoAutoFilter( pDocSh, aRange, pDBData->GetName(), true ) );
+ o3tl::make_unique<ScUndoAutoFilter>( pDocSh, aRange, pDBData->GetName(), true ) );
pDBData->SetAutoFilter(true);
@@ -413,7 +413,7 @@ void ScDBFunc::HideAutoFilter()
ScRange aRange;
pDBData->GetArea( aRange );
pDocSh->GetUndoManager()->AddUndoAction(
- new ScUndoAutoFilter( pDocSh, aRange, pDBData->GetName(), false ) );
+ o3tl::make_unique<ScUndoAutoFilter>( pDocSh, aRange, pDBData->GetName(), false ) );
pDBData->SetAutoFilter(false);
diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx
index 72f36dbeabb3..a74bb99e49b2 100644
--- a/sc/source/ui/view/dbfunc3.cxx
+++ b/sc/source/ui/view/dbfunc3.cxx
@@ -524,7 +524,7 @@ void ScDBFunc::DoSubTotals( const ScSubTotalParam& rParam, bool bRecord,
if (bRecord)
{
pDocSh->GetUndoManager()->AddUndoAction(
- new ScUndoSubTotals( pDocSh, nTab,
+ o3tl::make_unique<ScUndoSubTotals>( pDocSh, nTab,
rParam, aNewParam.nRow2,
std::move(pUndoDoc), std::move(pUndoTab), // pUndoDBData,
std::move(pUndoRange), std::move(pUndoDB) ) );
@@ -611,7 +611,7 @@ bool ScDBFunc::MakePivotTable(
if (bUndo)
{
pDocSh->GetUndoManager()->AddUndoAction(
- new ScUndoInsertTab( pDocSh, nNewTab, bAppend, lcl_MakePivotTabName( aName, i ) ));
+ o3tl::make_unique<ScUndoInsertTab>( pDocSh, nNewTab, bAppend, lcl_MakePivotTabName( aName, i ) ));
}
GetViewData().InsertTab( nNewTab );
@@ -2231,7 +2231,7 @@ void ScDBFunc::RepeatDB( bool bRecord )
}
GetViewData().GetDocShell()->GetUndoManager()->AddUndoAction(
- new ScUndoRepeatDB( GetViewData().GetDocShell(), nTab,
+ o3tl::make_unique<ScUndoRepeatDB>( GetViewData().GetDocShell(), nTab,
nStartCol, nStartRow, nEndCol, nEndRow,
nNewEndRow,
nCurX, nCurY,
diff --git a/sc/source/ui/view/drawvie3.cxx b/sc/source/ui/view/drawvie3.cxx
index f6538789b5d6..aeae719ae3c3 100644
--- a/sc/source/ui/view/drawvie3.cxx
+++ b/sc/source/ui/view/drawvie3.cxx
@@ -67,7 +67,7 @@ void ScDrawView::SetPageAnchored()
for( size_t i=0; i<nCount; ++i )
{
SdrObject* pObj = pMark->GetMark(i)->GetMarkedSdrObj();
- AddUndo (new ScUndoAnchorData( pObj, pDoc, nTab ));
+ AddUndo (o3tl::make_unique<ScUndoAnchorData>( pObj, pDoc, nTab ));
ScDrawLayer::SetPageAnchored( *pObj );
}
EndUndo();
@@ -95,7 +95,7 @@ void ScDrawView::SetCellAnchored(bool bResizeWithCell)
for( size_t i=0; i<nCount; ++i )
{
SdrObject* pObj = pMark->GetMark(i)->GetMarkedSdrObj();
- AddUndo (new ScUndoAnchorData( pObj, pDoc, nTab ));
+ AddUndo (o3tl::make_unique<ScUndoAnchorData>( pObj, pDoc, nTab ));
ScDrawLayer::SetCellAnchoredFromPosition(*pObj, *pDoc, nTab, bResizeWithCell);
}
EndUndo();
diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx
index f884429f6ad1..b3cb3e660f2a 100644
--- a/sc/source/ui/view/drawvie4.cxx
+++ b/sc/source/ui/view/drawvie4.cxx
@@ -444,7 +444,7 @@ void ScDrawView::CalcNormScale( Fraction& rFractX, Fraction& rFractY ) const
void ScDrawView::SetMarkedOriginalSize()
{
- SdrUndoGroup* pUndoGroup = new SdrUndoGroup(*GetModel());
+ std::unique_ptr<SdrUndoGroup> pUndoGroup(new SdrUndoGroup(*GetModel()));
const SdrMarkList& rMarkList = GetMarkedObjectList();
long nDone = 0;
@@ -529,11 +529,9 @@ void ScDrawView::SetMarkedOriginalSize()
{
pUndoGroup->SetComment(ScResId( STR_UNDO_ORIGINALSIZE ));
ScDocShell* pDocSh = pViewData->GetDocShell();
- pDocSh->GetUndoManager()->AddUndoAction(pUndoGroup);
+ pDocSh->GetUndoManager()->AddUndoAction(std::move(pUndoGroup));
pDocSh->SetDrawModified();
}
- else
- delete pUndoGroup;
}
void ScDrawView::FitToCellSize()
@@ -562,7 +560,7 @@ void ScDrawView::FitToCellSize()
return;
}
- SdrUndoGroup* pUndoGroup = new SdrUndoGroup(*GetModel());
+ std::unique_ptr<SdrUndoGroup> pUndoGroup(new SdrUndoGroup(*GetModel()));
tools::Rectangle aGraphicRect = pObj->GetSnapRect();
tools::Rectangle aCellRect = ScDrawLayer::GetCellRect( *pDoc, pObjData->maStart, true);
@@ -587,7 +585,7 @@ void ScDrawView::FitToCellSize()
pUndoGroup->SetComment(ScResId( STR_UNDO_FITCELLSIZE ));
ScDocShell* pDocSh = pViewData->GetDocShell();
- pDocSh->GetUndoManager()->AddUndoAction(pUndoGroup);
+ pDocSh->GetUndoManager()->AddUndoAction(std::move(pUndoGroup));
}
diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx
index 670dba85023c..dc13c9192493 100644
--- a/sc/source/ui/view/drawview.cxx
+++ b/sc/source/ui/view/drawview.cxx
@@ -220,7 +220,7 @@ void ScDrawView::SetMarkedToLayer( SdrLayerID nLayerNo )
SdrObject* pObj = rMark.GetMark(i)->GetMarkedSdrObj();
if ( dynamic_cast<const SdrUnoObj*>( pObj) == nullptr && (pObj->GetLayer() != SC_LAYER_INTERN) )
{
- AddUndo( new SdrUndoObjectLayerChange( *pObj, pObj->GetLayer(), nLayerNo) );
+ AddUndo( o3tl::make_unique<SdrUndoObjectLayerChange>( *pObj, pObj->GetLayer(), nLayerNo) );
pObj->SetLayer( nLayerNo );
}
}
@@ -870,7 +870,7 @@ void ScDrawView::DeleteMarked()
delete pNote;
// add the undo action for the note
if( bUndo )
- pUndoMgr->AddUndoAction( new ScUndoReplaceNote( *pDocShell, pCaptData->maStart, aNoteData, false, pDrawLayer->GetCalcUndo() ) );
+ pUndoMgr->AddUndoAction( o3tl::make_unique<ScUndoReplaceNote>( *pDocShell, pCaptData->maStart, aNoteData, false, pDrawLayer->GetCalcUndo() ) );
// repaint the cell to get rid of the note marker
if( pDocShell )
pDocShell->PostPaintCell( pCaptData->maStart );
@@ -988,7 +988,7 @@ SdrObject* ScDrawView::ApplyGraphicToObject(
}
else if(rHitObject.IsClosedObj() && !dynamic_cast< SdrOle2Obj* >(&rHitObject))
{
- AddUndo(new SdrUndoAttrObj(rHitObject));
+ AddUndo(o3tl::make_unique<SdrUndoAttrObj>(rHitObject));
SfxItemSet aSet(GetModel()->GetItemPool(), svl::Items<XATTR_FILLSTYLE, XATTR_FILLBITMAP>{});
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index 7c54228e83ef..cd52cbd4aaf9 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -701,7 +701,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq )
nRetMask = sal_uInt16( nullptr != pStyleSheet );
if ( pStyleSheet && !pScMod->GetIsWaterCan() )
{
- ScUndoApplyPageStyle* pUndoAction = nullptr;
+ std::unique_ptr<ScUndoApplyPageStyle> pUndoAction;
SCTAB nTabCount = rDoc.GetTableCount();
ScMarkData::iterator itr = rMark.begin(), itrEnd = rMark.end();
for (; itr != itrEnd && *itr < nTabCount; ++itr)
@@ -712,13 +712,13 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq )
rDoc.SetPageStyle( *itr, aStyleName );
ScPrintFunc( pDocSh, pTabViewShell->GetPrinter(true), *itr ).UpdatePages();
if( !pUndoAction )
- pUndoAction = new ScUndoApplyPageStyle( pDocSh, aStyleName );
+ pUndoAction.reset(new ScUndoApplyPageStyle( pDocSh, aStyleName ));
pUndoAction->AddSheetAction( *itr, aOldName );
}
}
if( pUndoAction )
{
- pDocSh->GetUndoManager()->AddUndoAction( pUndoAction );
+ pDocSh->GetUndoManager()->AddUndoAction( std::move(pUndoAction) );
pDocSh->SetDocumentModified();
rBindings.Invalidate( SID_STYLE_FAMILY4 );
rBindings.Invalidate( SID_STATUS_PAGESTYLE );
@@ -933,7 +933,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq )
if ( bAddUndo && bUndo)
pDocSh->GetUndoManager()->AddUndoAction(
- new ScUndoModifyStyle( pDocSh, eFamily, aOldData, aNewData ) );
+ o3tl::make_unique<ScUndoModifyStyle>( pDocSh, eFamily, aOldData, aNewData ) );
if ( bStyleToMarked )
{
diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx
index d5c3e6e7f3d8..304be3fc5f1f 100644
--- a/sc/source/ui/view/preview.cxx
+++ b/sc/source/ui/view/preview.cxx
@@ -1112,7 +1112,7 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt )
if( bUndo )
{
pDocShell->GetUndoManager()->AddUndoAction(
- new ScUndoModifyStyle( pDocShell, SfxStyleFamily::Page,
+ o3tl::make_unique<ScUndoModifyStyle>( pDocShell, SfxStyleFamily::Page,
aOldData, aNewData ) );
}
@@ -1214,7 +1214,7 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt )
if( bUndo )
{
pDocShell->GetUndoManager()->AddUndoAction(
- new ScUndoModifyStyle( pDocShell, SfxStyleFamily::Page,
+ o3tl::make_unique<ScUndoModifyStyle>( pDocShell, SfxStyleFamily::Page,
aOldData, aNewData ) );
}
diff --git a/sc/source/ui/view/spelldialog.cxx b/sc/source/ui/view/spelldialog.cxx
index 0678f8aea6b1..4e8ca58965e9 100644
--- a/sc/source/ui/view/spelldialog.cxx
+++ b/sc/source/ui/view/spelldialog.cxx
@@ -124,7 +124,7 @@ void ScSpellDialogChildWindow::Reset()
SCROW nOldRow = rCursor.Row();
SCCOL nNewCol = mpViewData->GetCurX();
SCROW nNewRow = mpViewData->GetCurY();
- mpDocShell->GetUndoManager()->AddUndoAction( new ScUndoConversion(
+ mpDocShell->GetUndoManager()->AddUndoAction( o3tl::make_unique<ScUndoConversion>(
mpDocShell, mpViewData->GetMarkData(),
nOldCol, nOldRow, nTab, std::move(mxUndoDoc),
nNewCol, nNewRow, nTab, std::move(mxRedoDoc),
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 38533736a681..a60715eba83f 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -912,7 +912,7 @@ void ScViewFunc::RemoveManualBreaks()
pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true );
rDoc.CopyToDocument( 0,0,nTab, MAXCOL,MAXROW,nTab, InsertDeleteFlags::NONE, false, *pUndoDoc );
pDocSh->GetUndoManager()->AddUndoAction(
- new ScUndoRemoveBreaks( pDocSh, nTab, std::move(pUndoDoc) ) );
+ o3tl::make_unique<ScUndoRemoveBreaks>( pDocSh, nTab, std::move(pUndoDoc) ) );
}
rDoc.RemoveManualBreaks(nTab);
@@ -1032,7 +1032,7 @@ void ScViewFunc::SetPrintRanges( bool bEntireSheet, const OUString* pPrint,
SCTAB nCurTab = GetViewData().GetTabNo();
std::unique_ptr<ScPrintRangeSaver> pNewRanges = rDoc.CreatePrintRangeSaver();
pDocSh->GetUndoManager()->AddUndoAction(
- new ScUndoPrintRange( pDocSh, nCurTab, std::move(pOldRanges), std::move(pNewRanges) ) );
+ o3tl::make_unique<ScUndoPrintRange>( pDocSh, nCurTab, std::move(pOldRanges), std::move(pNewRanges) ) );
}
else
pOldRanges.reset();
@@ -1589,7 +1589,7 @@ void ScViewFunc::FillTab( InsertDeleteFlags nFlags, ScPasteFunc nFunction, bool
if (bUndo)
{ //! for ChangeTrack not until the end
pDocSh->GetUndoManager()->AddUndoAction(
- new ScUndoFillTable( pDocSh, rMark,
+ o3tl::make_unique<ScUndoFillTable>( pDocSh, rMark,
aMarkRange.aStart.Col(), aMarkRange.aStart.Row(), nTab,
aMarkRange.aEnd.Col(), aMarkRange.aEnd.Row(), nTab,
std::move(pUndoDoc), bMulti, nTab, nFlags, nFunction, bSkipEmpty, bAsLink ) );
@@ -1839,7 +1839,7 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem,
if (bAddUndo)
{
GetViewData().GetDocShell()->GetUndoManager()->AddUndoAction(
- new ScUndoReplace( GetViewData().GetDocShell(), *pUndoMark,
+ o3tl::make_unique<ScUndoReplace>( GetViewData().GetDocShell(), *pUndoMark,
nCol, nRow, nTab,
aUndoStr, std::move(pUndoDoc), pSearchItem ) );
}
@@ -2216,7 +2216,7 @@ void ScViewFunc::InsertTables(std::vector<OUString>& aNames, SCTAB nTab,
{
if (bRecord)
pDocSh->GetUndoManager()->AddUndoAction(
- new ScUndoInsertTables( pDocSh, nTab, aNames));
+ o3tl::make_unique<ScUndoInsertTables>( pDocSh, nTab, aNames));
// Update views
@@ -2244,7 +2244,7 @@ bool ScViewFunc::AppendTable( const OUString& rName, bool bRecord )
SCTAB nTab = rDoc.GetTableCount()-1;
if (bRecord)
pDocSh->GetUndoManager()->AddUndoAction(
- new ScUndoInsertTab( pDocSh, nTab, true, rName));
+ o3tl::make_unique<ScUndoInsertTab>( pDocSh, nTab, true, rName));
GetViewData().InsertTab( nTab );
SetTabNo( nTab, true );
pDocSh->PostPaintExtras();
@@ -2410,7 +2410,7 @@ bool ScViewFunc::DeleteTables(const vector<SCTAB> &TheTabs, bool bRecord )
if (bRecord)
{
pDocSh->GetUndoManager()->AddUndoAction(
- new ScUndoDeleteTab( GetViewData().GetDocShell(), TheTabs,
+ o3tl::make_unique<ScUndoDeleteTab>( GetViewData().GetDocShell(), TheTabs,
std::move(pUndoDoc), std::move(pUndoData) ));
}
@@ -2614,7 +2614,7 @@ void ScViewFunc::ImportTables( ScDocShell* pSrcShell,
if (bUndo)
{
pDocSh->GetUndoManager()->AddUndoAction(
- new ScUndoImportTab( pDocSh, nTab, nCount ) );
+ o3tl::make_unique<ScUndoImportTab>( pDocSh, nTab, nCount ) );
}
for (i=0; i<nInsCount; i++)
@@ -2775,7 +2775,7 @@ void ScViewFunc::MoveTable(
{
pDestDoc->GetName(nDestTab, sName);
pDestShell->GetUndoManager()->AddUndoAction(
- new ScUndoImportTab( pDestShell, nDestTab,
+ o3tl::make_unique<ScUndoImportTab>( pDestShell, nDestTab,
static_cast<SCTAB>(TheTabs.size())));
}
@@ -2965,13 +2965,13 @@ void ScViewFunc::MoveTable(
if (bCopy)
{
pDocShell->GetUndoManager()->AddUndoAction(
- new ScUndoCopyTab(
+ o3tl::make_unique<ScUndoCopyTab>(
pDocShell, std::move(pSrcTabs), std::move(pDestTabs), std::move(pDestNames)));
}
else
{
pDocShell->GetUndoManager()->AddUndoAction(
- new ScUndoMoveTab(
+ o3tl::make_unique<ScUndoMoveTab>(
pDocShell, std::move(pSrcTabs), std::move(pDestTabs), std::move(pTabNames), std::move(pDestNames)));
}
}
@@ -3020,7 +3020,7 @@ void ScViewFunc::ShowTable( const std::vector<OUString>& rNames )
{
if (bUndo)
{
- pDocSh->GetUndoManager()->AddUndoAction( new ScUndoShowHideTab( pDocSh, undoTabs, true ) );
+ pDocSh->GetUndoManager()->AddUndoAction( o3tl::make_unique<ScUndoShowHideTab>( pDocSh, undoTabs, true ) );
}
pDocSh->PostPaint(0,0,0,MAXCOL,MAXROW,MAXTAB, PaintPartFlags::Extras);
pDocSh->SetDocumentModified();
@@ -3065,7 +3065,7 @@ void ScViewFunc::HideTable( const ScMarkData& rMark )
}
if (bUndo)
{
- pDocSh->GetUndoManager()->AddUndoAction( new ScUndoShowHideTab( pDocSh, undoTabs, false ) );
+ pDocSh->GetUndoManager()->AddUndoAction( o3tl::make_unique<ScUndoShowHideTab>( pDocSh, undoTabs, false ) );
}
// Update views
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index e02a4d44a1d4..6565b0a7b042 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -139,7 +139,7 @@ void ScViewFunc::CutToClip()
if ( bRecord ) // Draw-Undo now available
pDocSh->GetUndoManager()->AddUndoAction(
- new ScUndoCut( pDocSh, aRange, aOldEnd, rMark, std::move(pUndoDoc) ) );
+ o3tl::make_unique<ScUndoCut>( pDocSh, aRange, aOldEnd, rMark, std::move(pUndoDoc) ) );
aModificator.SetDocumentModified();
pDocSh->UpdateOle(&GetViewData());
@@ -1421,10 +1421,10 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc,
// Merge the paste undo action into the insert action.
// Use ScUndoWrapper so the ScUndoPaste pointer can be stored in the insert action.
- pUndoMgr->AddUndoAction( new ScUndoWrapper( std::move(pUndo) ), true );
+ pUndoMgr->AddUndoAction( o3tl::make_unique<ScUndoWrapper>( std::move(pUndo) ), true );
}
else
- pUndoMgr->AddUndoAction( pUndo.release() );
+ pUndoMgr->AddUndoAction( std::move(pUndo) );
pUndoMgr->LeaveListAction();
}
@@ -1614,9 +1614,9 @@ bool ScViewFunc::PasteMultiRangesFromClip(
aMarkedRange, aMark, std::move(pUndoDoc), nullptr, nFlags|nUndoFlags, nullptr, false, &aOptions));
if (bInsertCells)
- pUndoMgr->AddUndoAction(new ScUndoWrapper(std::move(pUndo)), true);
+ pUndoMgr->AddUndoAction(o3tl::make_unique<ScUndoWrapper>(std::move(pUndo)), true);
else
- pUndoMgr->AddUndoAction(pUndo.release());
+ pUndoMgr->AddUndoAction(std::move(pUndo));
pUndoMgr->LeaveListAction();
}
@@ -1775,10 +1775,10 @@ bool ScViewFunc::PasteFromClipToMultiRanges(
aOptions.bAsLink = bAsLink;
aOptions.eMoveMode = eMoveMode;
- ScUndoPaste* pUndo = new ScUndoPaste(
- pDocSh, aRanges, aMark, std::move(pUndoDoc), nullptr, nFlags|nUndoFlags, nullptr, false, &aOptions);
- pUndoMgr->AddUndoAction(pUndo);
+ pUndoMgr->AddUndoAction(
+ o3tl::make_unique<ScUndoPaste>(
+ pDocSh, aRanges, aMark, std::move(pUndoDoc), nullptr, nFlags|nUndoFlags, nullptr, false, &aOptions));
pUndoMgr->LeaveListAction();
}
@@ -1999,7 +1999,7 @@ void ScViewFunc::DataFormPutData( SCROW nCurrentRow ,
nUndoEndCol, nUndoEndRow, nEndTab, rMark,
std::move(pUndoDoc), std::move(pRedoDoc),
std::move(pUndoData) ) );
- pUndoMgr->AddUndoAction( new ScUndoWrapper( std::move(pUndo) ), true );
+ pUndoMgr->AddUndoAction( o3tl::make_unique<ScUndoWrapper>( std::move(pUndo) ), true );
PaintPartFlags nPaint = PaintPartFlags::Grid;
if (bColInfo)
diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx
index daa553c1d204..25e8fb0b18cf 100644
--- a/sc/source/ui/view/viewfun4.cxx
+++ b/sc/source/ui/view/viewfun4.cxx
@@ -145,7 +145,7 @@ void ScViewFunc::PasteRTF( SCCOL nStartCol, SCROW nStartRow,
ScMarkData aDestMark;
aDestMark.SetMarkArea( aMarkRange );
pDocSh->GetUndoManager()->AddUndoAction(
- new ScUndoPaste( pDocSh, aMarkRange, aDestMark,
+ o3tl::make_unique<ScUndoPaste>( pDocSh, aMarkRange, aDestMark,
std::move(pUndoDoc), std::move(pRedoDoc), InsertDeleteFlags::ALL, nullptr));
}
}
@@ -300,7 +300,7 @@ void ScViewFunc::DoRefConversion()
pDoc->CopyToDocument( aCopyRange, InsertDeleteFlags::ALL, bMulti, *pRedoDoc, &rMark );
pDocSh->GetUndoManager()->AddUndoAction(
- new ScUndoRefConversion( pDocSh,
+ o3tl::make_unique<ScUndoRefConversion>( pDocSh,
aMarkRange, rMark, std::move(pUndoDoc), std::move(pRedoDoc), bMulti) );
}
@@ -430,7 +430,7 @@ void ScViewFunc::DoThesaurus()
if (bRecord)
{
GetViewData().GetDocShell()->GetUndoManager()->AddUndoAction(
- new ScUndoThesaurus(
+ o3tl::make_unique<ScUndoThesaurus>(
GetViewData().GetDocShell(), nCol, nRow, nTab, aOldText, aNewText));
}
}
@@ -556,7 +556,7 @@ void ScViewFunc::DoSheetConversion( const ScConversionParam& rConvParam )
SCCOL nNewCol = rViewData.GetCurX();
SCROW nNewRow = rViewData.GetCurY();
rViewData.GetDocShell()->GetUndoManager()->AddUndoAction(
- new ScUndoConversion(
+ o3tl::make_unique<ScUndoConversion>(
pDocSh, rMark,
nCol, nRow, nTab, std::move(pUndoDoc),
nNewCol, nNewRow, nTab, std::move(pRedoDoc), rConvParam ) );
diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx
index 4258b3338bd7..512477711a28 100644
--- a/sc/source/ui/view/viewfun7.cxx
+++ b/sc/source/ui/view/viewfun7.cxx
@@ -167,7 +167,7 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel,
pNewObj->NbcMove(Size(nDiffX,nDiffY));
if (pDestPage)
pDestPage->InsertObject( pNewObj );
- pScDrawView->AddUndo(new SdrUndoInsertObj( *pNewObj ));
+ pScDrawView->AddUndo(o3tl::make_unique<SdrUndoInsertObj>( *pNewObj ));
if (ScDrawLayer::IsCellAnchored(*pNewObj))
ScDrawLayer::SetCellAnchoredFromPosition(*pNewObj, *GetViewData().GetDocument(), nTab,
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 9361c9b5cc9e..b1171ef2573e 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -618,7 +618,7 @@ void ScViewFunc::EnterValue( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& r
if (bUndo)
{
pDocSh->GetUndoManager()->AddUndoAction(
- new ScUndoEnterValue(pDocSh, aPos, aUndoCell, rValue));
+ o3tl::make_unique<ScUndoEnterValue>(pDocSh, aPos, aUndoCell, rValue));
}
pDocSh->PostPaintCell( aPos );
@@ -725,7 +725,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab,
if ( bRecord )
{ // because of ChangeTrack current first
pDocSh->GetUndoManager()->AddUndoAction(
- new ScUndoEnterData(pDocSh, ScAddress(nCol,nRow,nTab), aOldValues, aString, std::move(pUndoData)));
+ o3tl::make_unique<ScUndoEnterData>(pDocSh, ScAddress(nCol,nRow,nTab), aOldValues, aString, std::move(pUndoData)));
}
HideAllCursors();
@@ -1081,7 +1081,7 @@ void ScViewFunc::ApplyPatternLines( const ScPatternAttr& rAttr, const SvxBoxItem
pDoc->CopyToDocument( aCopyRange, InsertDeleteFlags::ATTRIB, bCopyOnlyMarked, *pUndoDoc, &aFuncMark );
pDocSh->GetUndoManager()->AddUndoAction(
- new ScUndoSelectionAttr(
+ o3tl::make_unique<ScUndoSelectionAttr>(
pDocSh, aFuncMark,
aMarkRange.aStart.Col(), aMarkRange.aStart.Row(), aMarkRange.aStart.Tab(),
aMarkRange.aEnd.Col(), aMarkRange.aEnd.Row(), aMarkRange.aEnd.Tab(),
@@ -1193,7 +1193,7 @@ void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr, bool bCursor
pUndoAttr = new ScUndoSelectionAttr(
pDocSh, aFuncMark, nStartCol, nStartRow, nStartTab,
nEndCol, nEndRow, nEndTab, std::move(pUndoDoc), bMulti, &rAttr );
- pDocSh->GetUndoManager()->AddUndoAction(pUndoAttr);
+ pDocSh->GetUndoManager()->AddUndoAction(std::unique_ptr<ScUndoSelectionAttr>(pUndoAttr));
pEditDataArray = pUndoAttr->GetDataArray();
}
@@ -1234,10 +1234,10 @@ void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr, bool bCursor
if (bRecord)
{
- ScUndoCursorAttr* pUndo = new ScUndoCursorAttr(
- pDocSh, nCol, nRow, nTab, pOldPat.get(), pNewPat, &rAttr );
+ std::unique_ptr<ScUndoCursorAttr> pUndo(new ScUndoCursorAttr(
+ pDocSh, nCol, nRow, nTab, pOldPat.get(), pNewPat, &rAttr ));
pUndo->SetEditData(std::move(pOldEditData), std::move(pNewEditData));
- pDocSh->GetUndoManager()->AddUndoAction(pUndo);
+ pDocSh->GetUndoManager()->AddUndoAction(std::move(pUndo));
}
pOldPat.reset(); // is copied in undo (Pool)
@@ -1368,7 +1368,7 @@ void ScViewFunc::SetStyleSheetToMarked( const SfxStyleSheet* pStyleSheet )
OUString aName = pStyleSheet->GetName();
pDocSh->GetUndoManager()->AddUndoAction(
- new ScUndoSelectionStyle( pDocSh, aFuncMark, aMarkRange, aName, std::move(pUndoDoc) ) );
+ o3tl::make_unique<ScUndoSelectionStyle>( pDocSh, aFuncMark, aMarkRange, aName, std::move(pUndoDoc) ) );
}
rDoc.ApplySelectionStyle( static_cast<const ScStyleSheet&>(*pStyleSheet), aFuncMark );
@@ -1402,7 +1402,7 @@ void ScViewFunc::SetStyleSheetToMarked( const SfxStyleSheet* pStyleSheet )
OUString aName = pStyleSheet->GetName();
pDocSh->GetUndoManager()->AddUndoAction(
- new ScUndoSelectionStyle( pDocSh, aUndoMark, aMarkRange, aName, std::move(pUndoDoc) ) );
+ o3tl::make_unique<ScUndoSelectionStyle>( pDocSh, aUndoMark, aMarkRange, aName, std::move(pUndoDoc) ) );
}
ScMarkData::iterator itr = aFuncMark.begin(), itrEnd = aFuncMark.end();
@@ -1876,7 +1876,7 @@ void ScViewFunc::DeleteMulti( bool bRows )
if (bRecord)
{
pDocSh->GetUndoManager()->AddUndoAction(
- new ScUndoDeleteMulti(
+ o3tl::make_unique<ScUndoDeleteMulti>(
pDocSh, bRows, bNeedRefresh, nTab, aSpans, std::move(pUndoDoc), std::move(pUndoData)));
}
@@ -2230,7 +2230,7 @@ void ScViewFunc::SetWidthOrHeight(
if (bRecord)
{
pDocSh->GetUndoManager()->AddUndoAction(
- new ScUndoWidthOrHeight(
+ o3tl::make_unique<ScUndoWidthOrHeight>(
pDocSh, aMarkData, nStart, nCurTab, nEnd, nCurTab,
std::move(pUndoDoc), aUndoRanges, std::move(pUndoTab), eMode, nSizeTwips, bWidth));
}