diff options
Diffstat (limited to 'vcl/source/edit')
-rw-r--r-- | vcl/source/edit/texteng.cxx | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx index fb36cb6c3607..287b80c09710 100644 --- a/vcl/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -489,7 +489,7 @@ void TextEngine::ImpRemoveChars( const TextPaM& rPaM, sal_Int32 nChars ) break; // for } } - InsertUndo( new TextUndoRemoveChars( this, rPaM, aStr ) ); + InsertUndo( o3tl::make_unique<TextUndoRemoveChars>( this, rPaM, aStr ) ); } mpDoc->RemoveChars( rPaM, nChars ); @@ -504,7 +504,7 @@ TextPaM TextEngine::ImpConnectParagraphs( sal_uInt32 nLeft, sal_uInt32 nRight ) TextNode* pRight = mpDoc->GetNodes()[ nRight ].get(); if ( IsUndoEnabled() && !IsInUndo() ) - InsertUndo( new TextUndoConnectParas( this, nLeft, pLeft->GetText().getLength() ) ); + InsertUndo( o3tl::make_unique<TextUndoConnectParas>( this, nLeft, pLeft->GetText().getLength() ) ); // first lookup Portions, as pRight is gone after ConnectParagraphs TEParaPortion* pLeftPortion = mpTEParaPortions->GetObject( nLeft ); @@ -599,7 +599,7 @@ void TextEngine::ImpRemoveParagraph( sal_uInt32 nPara ) // the Node is handled by Undo and is deleted if appropriate mpDoc->GetNodes().erase( mpDoc->GetNodes().begin() + nPara ); if ( IsUndoEnabled() && !IsInUndo() ) - InsertUndo( new TextUndoDelPara( this, pNode.release(), nPara ) ); + InsertUndo( o3tl::make_unique<TextUndoDelPara>( this, pNode.release(), nPara ) ); mpTEParaPortions->Remove( nPara ); @@ -721,9 +721,9 @@ TextPaM TextEngine::ImpInsertText( sal_Unicode c, const TextSelection& rCurSel, if ( IsUndoEnabled() && !IsInUndo() ) { - TextUndoInsertChars* pNewUndo = new TextUndoInsertChars( this, aPaM, OUString(c) ); + std::unique_ptr<TextUndoInsertChars> pNewUndo(new TextUndoInsertChars( this, aPaM, OUString(c) )); bool bTryMerge = !bDoOverwrite && ( c != ' ' ); - InsertUndo( pNewUndo, bTryMerge ); + InsertUndo( std::move(pNewUndo), bTryMerge ); } TEParaPortion* pPortion = mpTEParaPortions->GetObject( aPaM.GetPara() ); @@ -766,7 +766,7 @@ TextPaM TextEngine::ImpInsertText( const TextSelection& rCurSel, const OUString& { OUString aLine(aText.copy(nStart, nEnd-nStart)); if ( IsUndoEnabled() && !IsInUndo() ) - InsertUndo( new TextUndoInsertChars( this, aPaM, aLine ) ); + InsertUndo( o3tl::make_unique<TextUndoInsertChars>( this, aPaM, aLine ) ); TEParaPortion* pPortion = mpTEParaPortions->GetObject( aPaM.GetPara() ); pPortion->MarkInvalid( aPaM.GetIndex(), aLine.getLength() ); @@ -806,7 +806,7 @@ TextPaM TextEngine::ImpInsertParaBreak( const TextSelection& rCurSel ) TextPaM TextEngine::ImpInsertParaBreak( const TextPaM& rPaM ) { if ( IsUndoEnabled() && !IsInUndo() ) - InsertUndo( new TextUndoSplitPara( this, rPaM.GetPara(), rPaM.GetIndex() ) ); + InsertUndo( o3tl::make_unique<TextUndoSplitPara>( this, rPaM.GetPara(), rPaM.GetIndex() ) ); TextNode* pNode = mpDoc->GetNodes()[ rPaM.GetPara() ].get(); bool bFirstParaContentChanged = rPaM.GetIndex() < pNode->GetText().getLength(); @@ -1313,10 +1313,10 @@ void TextEngine::UndoActionEnd() GetUndoManager().LeaveListAction(); } -void TextEngine::InsertUndo( TextUndo* pUndo, bool bTryMerge ) +void TextEngine::InsertUndo( std::unique_ptr<TextUndo> pUndo, bool bTryMerge ) { SAL_WARN_IF( IsInUndo(), "vcl", "InsertUndo: in Undo mode!" ); - GetUndoManager().AddUndoAction( pUndo, bTryMerge ); + GetUndoManager().AddUndoAction( std::move(pUndo), bTryMerge ); } void TextEngine::ResetUndo() |