summaryrefslogtreecommitdiff
path: root/editeng/source/outliner/outliner.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-05-09 13:56:07 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-05-15 15:56:14 +0200
commit863d2485e60251ac45b019b2c58ced7cfc9d978e (patch)
tree5b7222b6957289a68c4359097d3f672fc20bd152 /editeng/source/outliner/outliner.cxx
parent941193639939c759616595c08241a817f7aed501 (diff)
loplugin:useuniqueptr in ParagraphList
Change-Id: I042fb945b0585a0409d76a509c7f9287aa220b68 Reviewed-on: https://gerrit.libreoffice.org/54180 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'editeng/source/outliner/outliner.cxx')
-rw-r--r--editeng/source/outliner/outliner.cxx25
1 files changed, 12 insertions, 13 deletions
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index cc19399e1812..344ece6b82ff 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -101,7 +101,7 @@ Paragraph* Outliner::Insert(const OUString& rText, sal_Int32 nAbsPos, sal_Int16
pEditEngine->SetUpdateMode( false );
ImplBlockInsertionCallbacks( true );
pPara = new Paragraph( nDepth );
- pParaList->Insert( pPara, nAbsPos );
+ pParaList->Insert( std::unique_ptr<Paragraph>(pPara), nAbsPos );
pEditEngine->InsertParagraph( nAbsPos, OUString() );
DBG_ASSERT(pPara==pParaList->GetParagraph(nAbsPos),"Insert:Failed");
ImplInitDepth( nAbsPos, nDepth, false );
@@ -126,7 +126,7 @@ void Outliner::ParagraphInserted( sal_Int32 nPara )
if( bPasting || pEditEngine->IsInUndo() )
{
Paragraph* pPara = new Paragraph( -1 );
- pParaList->Insert( pPara, nPara );
+ pParaList->Insert( std::unique_ptr<Paragraph>(pPara), nPara );
if( pEditEngine->IsInUndo() )
{
pPara->nFlags = ParaFlag::SETBULLETTEXT;
@@ -143,7 +143,7 @@ void Outliner::ParagraphInserted( sal_Int32 nPara )
nDepth = pParaBefore->GetDepth();
Paragraph* pPara = new Paragraph( nDepth );
- pParaList->Insert( pPara, nPara );
+ pParaList->Insert( std::unique_ptr<Paragraph>(pPara), nPara );
if( !pEditEngine->IsInUndo() )
{
@@ -171,7 +171,6 @@ void Outliner::ParagraphDeleted( sal_Int32 nPara )
}
pParaList->Remove( nPara );
- delete pPara;
if( !pEditEngine->IsInUndo() && !bPasting )
{
@@ -468,7 +467,7 @@ void Outliner::SetText( const OUString& rText, Paragraph* pPara )
}
if( nPos ) // not with the first paragraph
{
- pParaList->Insert( pPara, nInsPos );
+ pParaList->Insert( std::unique_ptr<Paragraph>(pPara), nInsPos );
pEditEngine->InsertParagraph( nInsPos, aStr );
ParagraphInsertedHdl(pPara);
}
@@ -581,10 +580,10 @@ void Outliner::SetText( const OutlinerParaObject& rPObj )
pParaList->Clear();
for( sal_Int32 nCurPara = 0; nCurPara < rPObj.Count(); nCurPara++ )
{
- Paragraph* pPara = new Paragraph( rPObj.GetParagraphData(nCurPara));
+ std::unique_ptr<Paragraph> pPara(new Paragraph( rPObj.GetParagraphData(nCurPara)));
ImplCheckDepth( pPara->nDepth );
- pParaList->Append(pPara);
+ pParaList->Append(std::move(pPara));
ImplCheckNumBulletItem( nCurPara );
}
@@ -622,7 +621,7 @@ void Outliner::AddText( const OutlinerParaObject& rPObj )
for( sal_Int32 n = 0; n < rPObj.Count(); n++ )
{
Paragraph* pPara = new Paragraph( rPObj.GetParagraphData(n) );
- pParaList->Append(pPara);
+ pParaList->Append(std::unique_ptr<Paragraph>(pPara));
sal_Int32 nP = nPara+n;
DBG_ASSERT(pParaList->GetAbsPos(pPara)==nP,"AddText:Out of sync");
ImplInitDepth( nP, pPara->GetDepth(), false );
@@ -1110,8 +1109,8 @@ ErrCode Outliner::Read( SvStream& rInput, const OUString& rBaseURL, EETextFormat
pParaList->Clear();
for ( sal_Int32 n = 0; n < nParas; n++ )
{
- Paragraph* pPara = new Paragraph( 0 );
- pParaList->Append(pPara);
+ std::unique_ptr<Paragraph> pPara(new Paragraph( 0 ));
+ pParaList->Append(std::move(pPara));
}
ImpFilterIndents( 0, nParas-1 );
@@ -1257,8 +1256,8 @@ Outliner::Outliner(SfxItemPool* pPool, OutlinerMode nMode)
pParaList.reset( new ParagraphList );
pParaList->SetVisibleStateChangedHdl( LINK( this, Outliner, ParaVisibleStateChangedHdl ) );
- Paragraph* pPara = new Paragraph( 0 );
- pParaList->Append(pPara);
+ std::unique_ptr<Paragraph> pPara(new Paragraph( 0 ));
+ pParaList->Append(std::move(pPara));
pEditEngine.reset( new OutlinerEditEng( this, pPool ) );
pEditEngine->SetBeginMovingParagraphsHdl( LINK( this, Outliner, BeginMovingParagraphsHdl ) );
@@ -1887,7 +1886,7 @@ void Outliner::Clear()
ImplBlockInsertionCallbacks( true );
pEditEngine->Clear();
pParaList->Clear();
- pParaList->Append( new Paragraph( nMinDepth ));
+ pParaList->Append( std::unique_ptr<Paragraph>(new Paragraph( nMinDepth )));
bFirstParaIsEmpty = true;
ImplBlockInsertionCallbacks( false );
}