diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-24 11:17:43 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-25 08:46:36 +0200 |
commit | be1cc9d0d2e7cdbf449521a9e602ac5a288255ab (patch) | |
tree | 6c8166a051d97f67f5d1f29ceee5d04ce1466096 /sw | |
parent | df0175c71ee836ed6e832e8849d9004cef530c65 (diff) |
loplugin:useuniqueptr in SwHHCWrapper
Change-Id: Id651533b725c61f2fabd6ac51d640a42b06e6eea
Reviewed-on: https://gerrit.libreoffice.org/57942
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/hhcwrp.hxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/lingu/hhcwrp.cxx | 26 |
2 files changed, 15 insertions, 15 deletions
diff --git a/sw/inc/hhcwrp.hxx b/sw/inc/hhcwrp.hxx index f595cf045d10..6cfdec0f2347 100644 --- a/sw/inc/hhcwrp.hxx +++ b/sw/inc/hhcwrp.hxx @@ -34,8 +34,8 @@ class SW_DLLPUBLIC SwHHCWrapper : public editeng::HangulHanjaConversion VclPtr<vcl::Window> m_pWin; SwWrtShell &m_rWrtShell; - SwConversionArgs *m_pConvArgs; /**< object for arguments (and results) needed - to find of next convertible text portion */ + std::unique_ptr<SwConversionArgs> m_pConvArgs; /**< object for arguments (and results) needed + to find of next convertible text portion */ sal_Int32 m_nLastPos; /**< starting position of the last found text part (needs to be sth that gets not moved like diff --git a/sw/source/uibase/lingu/hhcwrp.cxx b/sw/source/uibase/lingu/hhcwrp.cxx index 7192e4b72265..5765a20bee11 100644 --- a/sw/source/uibase/lingu/hhcwrp.cxx +++ b/sw/source/uibase/lingu/hhcwrp.cxx @@ -113,7 +113,7 @@ SwHHCWrapper::SwHHCWrapper( SwHHCWrapper::~SwHHCWrapper() { - delete m_pConvArgs; + m_pConvArgs.reset(); SwViewShell::SetCareWin( nullptr ); @@ -522,9 +522,9 @@ void SwHHCWrapper::Convert() if (pSttPos->nNode.GetNode().IsTextNode() && pEndPos->nNode.GetNode().IsTextNode()) { - m_pConvArgs = new SwConversionArgs( GetSourceLanguage(), + m_pConvArgs.reset( new SwConversionArgs( GetSourceLanguage(), pSttPos->nNode.GetNode().GetTextNode(), pSttPos->nContent, - pEndPos->nNode.GetNode().GetTextNode(), pEndPos->nContent ); + pEndPos->nNode.GetNode().GetTextNode(), pEndPos->nContent ) ); } else // we are not in the text (maybe a graphic or OLE object is selected) let's start from the top { @@ -538,9 +538,9 @@ void SwHHCWrapper::Convert() // just in case we check anyway... if (!pTextNode || !pTextNode->IsTextNode()) return; - m_pConvArgs = new SwConversionArgs( GetSourceLanguage(), + m_pConvArgs.reset( new SwConversionArgs( GetSourceLanguage(), pTextNode, pSttPos->nContent, - pTextNode, pSttPos->nContent ); + pTextNode, pSttPos->nContent ) ); } OSL_ENSURE( m_pConvArgs->pStartNode && m_pConvArgs->pStartNode->IsTextNode(), "failed to get proper start text node" ); @@ -596,16 +596,16 @@ void SwHHCWrapper::Convert() } if ( m_bIsOtherContent ) - ConvStart_impl( m_pConvArgs, SvxSpellArea::Other ); + ConvStart_impl( m_pConvArgs.get(), SvxSpellArea::Other ); else { m_bStartChk = false; - ConvStart_impl( m_pConvArgs, SvxSpellArea::BodyEnd ); + ConvStart_impl( m_pConvArgs.get(), SvxSpellArea::BodyEnd ); } ConvertDocument(); - ConvEnd_impl( m_pConvArgs ); + ConvEnd_impl( m_pConvArgs.get() ); } bool SwHHCWrapper::ConvNext_impl( ) @@ -628,7 +628,7 @@ bool SwHHCWrapper::ConvNext_impl( ) if ( m_bIsOtherContent ) { m_bStartChk = false; - ConvStart_impl( m_pConvArgs, SvxSpellArea::Body ); + ConvStart_impl( m_pConvArgs.get(), SvxSpellArea::Body ); bGoOn = true; } else if ( m_bStartDone && m_bEndDone ) @@ -636,14 +636,14 @@ bool SwHHCWrapper::ConvNext_impl( ) // body region done, ask about special region if( !m_bIsSelection && m_rWrtShell.HasOtherCnt() ) { - ConvStart_impl( m_pConvArgs, SvxSpellArea::Other ); + ConvStart_impl( m_pConvArgs.get(), SvxSpellArea::Other ); m_bIsOtherContent = bGoOn = true; } } else { m_bStartChk = !m_bStartDone; - ConvStart_impl( m_pConvArgs, m_bStartChk ? SvxSpellArea::BodyStart : SvxSpellArea::BodyEnd ); + ConvStart_impl( m_pConvArgs.get(), m_bStartChk ? SvxSpellArea::BodyStart : SvxSpellArea::BodyEnd ); bGoOn = true; } return bGoOn; @@ -660,14 +660,14 @@ void SwHHCWrapper::FindConvText_impl() while ( bConv ) { - bFound = ConvContinue_impl( m_pConvArgs ); + bFound = ConvContinue_impl( m_pConvArgs.get() ); if (bFound) { bConv = false; } else { - ConvEnd_impl( m_pConvArgs ); + ConvEnd_impl( m_pConvArgs.get() ); bConv = ConvNext_impl(); } } |