diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-13 11:03:56 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-14 09:24:40 +0200 |
commit | 2327d5cfc1cb938b5b7e1c6388d460a1236f4665 (patch) | |
tree | 27cead368f979dadc8164ceb41166c50c57777cc /sw | |
parent | 1cb4dc25a9d45e748d637177ac2a15a68debc162 (diff) |
loplugin:useuniqueptr in SwTextFrame
Change-Id: I34fac0560a1a408df421365379b15e64c96c9a15
Reviewed-on: https://gerrit.libreoffice.org/60450
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/text/frmcrsr.cxx | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx index 8cb7a18aedcf..a017ce95bc1e 100644 --- a/sw/source/core/text/frmcrsr.cxx +++ b/sw/source/core/text/frmcrsr.cxx @@ -567,8 +567,9 @@ bool SwTextFrame::GetCursorOfst_(SwPosition* pPos, const Point& rPoint, if ( IsRightToLeft() ) SwitchRTLtoLTR( const_cast<Point&>(rPoint) ); - SwFillData *pFillData = ( pCMS && pCMS->m_pFill ) ? - new SwFillData( pCMS, pPos, getFrameArea(), rPoint ) : nullptr; + std::unique_ptr<SwFillData> pFillData; + if ( pCMS && pCMS->m_pFill ) + pFillData.reset(new SwFillData( pCMS, pPos, getFrameArea(), rPoint )); if ( IsEmpty() ) { @@ -652,7 +653,6 @@ bool SwTextFrame::GetCursorOfst_(SwPosition* pPos, const Point& rPoint, } const_cast<Point&>(rPoint) = aOldPoint; - delete pFillData; return true; } @@ -1349,7 +1349,7 @@ void SwTextFrame::FillCursorPos( SwFillData& rFill ) const return; } } - SwFont *pFnt; + std::unique_ptr<SwFont> pFnt; SwTextFormatColl* pColl = GetTextNodeForParaProps()->GetTextColl(); SwTwips nFirst = GetTextNodeForParaProps()->GetSwAttrSet().GetULSpace().GetLower(); SwTwips nDiff = rFill.Y() - getFrameArea().Bottom(); @@ -1368,12 +1368,12 @@ void SwTextFrame::FillCursorPos( SwFillData& rFill ) const aSet.Put( *GetTextNodeForParaProps()->GetpSwAttrSet() ); aSet.SetParent( pSet ); pSet = &aSet; - pFnt = new SwFont( pSet, &GetDoc().getIDocumentSettingAccess() ); + pFnt.reset(new SwFont( pSet, &GetDoc().getIDocumentSettingAccess() )); } else { SwFontAccess aFontAccess( pColl, pSh ); - pFnt = new SwFont( aFontAccess.Get()->GetFont() ); + pFnt.reset(new SwFont( aFontAccess.Get()->GetFont() )); pFnt->CheckFontCacheId( pSh, pFnt->GetActual() ); } OutputDevice* pOut = pSh->GetOut(); @@ -1675,7 +1675,6 @@ void SwTextFrame::FillCursorPos( SwFillData& rFill ) const } } const_cast<SwCursorMoveState*>(rFill.pCMS)->m_bFillRet = bFill; - delete pFnt; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |