sw/source/core/inc/UndoTable.hxx | 4 ++-- sw/source/core/undo/untbl.cxx | 20 ++++++++------------ 2 files changed, 10 insertions(+), 14 deletions(-)
New commits: commit da9c06ee12e9845e5e06908b1c34ce2bc62145a2 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Jul 18 11:06:25 2018 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Jul 19 08:10:07 2018 +0200 loplugin:useuniqueptr in SwUndoTextToTable Change-Id: Ifa873c977b925ca446ba547ec59ddde2345eb0e2 Reviewed-on: https://gerrit.libreoffice.org/57685 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/source/core/inc/UndoTable.hxx b/sw/source/core/inc/UndoTable.hxx index 88cece131191..85c0691b8228 100644 --- a/sw/source/core/inc/UndoTable.hxx +++ b/sw/source/core/inc/UndoTable.hxx @@ -75,8 +75,8 @@ class SwUndoTextToTable : public SwUndo, public SwUndRng { OUString sTableNm; SwInsertTableOptions aInsTableOpts; - std::vector<sal_uLong>* pDelBoxes; - SwTableAutoFormat* pAutoFormat; + std::vector<sal_uLong> mvDelBoxes; + std::unique_ptr<SwTableAutoFormat> pAutoFormat; SwHistory* pHistory; sal_Unicode cTrenner; sal_uInt16 nAdjust; diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index 927b489eba31..96b0f0c659e6 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -689,11 +689,10 @@ SwUndoTextToTable::SwUndoTextToTable( const SwPaM& rRg, sal_Unicode cCh, sal_uInt16 nAdj, const SwTableAutoFormat* pAFormat ) : SwUndo( SwUndoId::TEXTTOTABLE, rRg.GetDoc() ), SwUndRng( rRg ), aInsTableOpts( rInsTableOpts ), - pDelBoxes( nullptr ), pAutoFormat( nullptr ), pHistory( nullptr ), cTrenner( cCh ), nAdjust( nAdj ) { if( pAFormat ) - pAutoFormat = new SwTableAutoFormat( *pAFormat ); + pAutoFormat.reset( new SwTableAutoFormat( *pAFormat ) ); const SwPosition* pEnd = rRg.End(); SwNodes& rNds = rRg.GetDoc()->GetNodes(); @@ -704,8 +703,7 @@ SwUndoTextToTable::SwUndoTextToTable( const SwPaM& rRg, SwUndoTextToTable::~SwUndoTextToTable() { - delete pDelBoxes; - delete pAutoFormat; + pAutoFormat.reset(); } void SwUndoTextToTable::UndoImpl(::sw::UndoRedoContext & rContext) @@ -729,13 +727,13 @@ void SwUndoTextToTable::UndoImpl(::sw::UndoRedoContext & rContext) pHistory->SetTmpEnd( pHistory->Count() ); } - if( pDelBoxes ) + if( !mvDelBoxes.empty() ) { pTNd->DelFrames(); SwTable& rTable = pTNd->GetTable(); - for( size_t n = pDelBoxes->size(); n; ) + for( size_t n = mvDelBoxes.size(); n; ) { - SwTableBox* pBox = rTable.GetTableBox( (*pDelBoxes)[ --n ] ); + SwTableBox* pBox = rTable.GetTableBox( mvDelBoxes[ --n ] ); if( pBox ) ::DeleteBox_( rTable, pBox, nullptr, false, false ); else { @@ -794,7 +792,7 @@ void SwUndoTextToTable::RedoImpl(::sw::UndoRedoContext & rContext) SetPaM(rPam); SwTable const*const pTable = rContext.GetDoc().TextToTable( - aInsTableOpts, rPam, cTrenner, nAdjust, pAutoFormat ); + aInsTableOpts, rPam, cTrenner, nAdjust, pAutoFormat.get() ); static_cast<SwFrameFormat*>(pTable->GetFrameFormat())->SetName( sTableNm ); } @@ -805,15 +803,13 @@ void SwUndoTextToTable::RepeatImpl(::sw::RepeatContext & rContext) { rContext.GetDoc().TextToTable( aInsTableOpts, rContext.GetRepeatPaM(), cTrenner, nAdjust, - pAutoFormat ); + pAutoFormat.get() ); } } void SwUndoTextToTable::AddFillBox( const SwTableBox& rBox ) { - if( !pDelBoxes ) - pDelBoxes = new std::vector<sal_uLong>; - pDelBoxes->push_back( rBox.GetSttIdx() ); + mvDelBoxes.push_back( rBox.GetSttIdx() ); } SwHistory& SwUndoTextToTable::GetHistory() _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits