sw/source/uibase/docvw/srcedtw.cxx | 16 +++++++--------- sw/source/uibase/inc/srcedtw.hxx | 8 ++++---- sw/source/uibase/lingu/sdrhhcwrap.cxx | 10 +++++----- sw/source/uibase/lingu/sdrhhcwrap.hxx | 2 +- 4 files changed, 17 insertions(+), 19 deletions(-)
New commits: commit df0175c71ee836ed6e832e8849d9004cef530c65 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue Jul 24 11:14:11 2018 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Jul 25 08:46:22 2018 +0200 loplugin:useuniqueptr in SdrHHCWrapper Change-Id: I1695dcf5af4f51e118b0286229e00896b09ec0bd Reviewed-on: https://gerrit.libreoffice.org/57941 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/source/uibase/lingu/sdrhhcwrap.cxx b/sw/source/uibase/lingu/sdrhhcwrap.cxx index 6ae103bcb830..9eb0a9d3f9ac 100644 --- a/sw/source/uibase/lingu/sdrhhcwrap.cxx +++ b/sw/source/uibase/lingu/sdrhhcwrap.cxx @@ -72,13 +72,13 @@ SdrHHCWrapper::SdrHHCWrapper( SwView* pVw, Size aSize( 1, 1 ); SetPaperSize( aSize ); - pOutlView = new OutlinerView( this, &(pView->GetEditWin()) ); + pOutlView.reset( new OutlinerView( this, &(pView->GetEditWin()) ) ); pOutlView->GetOutliner()->SetRefDevice(pView->GetWrtShell().getIDocumentDeviceAccess().getPrinter( false )); // Hack: all SdrTextObj attributes should be transferred to EditEngine pOutlView->SetBackgroundColor( COL_WHITE ); - InsertView( pOutlView ); + InsertView( pOutlView.get() ); Point aPoint( 0, 0 ); tools::Rectangle aRect( aPoint, aSize ); pOutlView->SetOutputArea( aRect ); @@ -96,8 +96,8 @@ SdrHHCWrapper::~SdrHHCWrapper() SetUpdateMode(false); pOutlView->SetOutputArea( tools::Rectangle( Point(), Size(1, 1) ) ); } - RemoveView( pOutlView ); - delete pOutlView; + RemoveView( pOutlView.get() ); + pOutlView.reset(); } void SdrHHCWrapper::StartTextConversion() @@ -156,7 +156,7 @@ bool SdrHHCWrapper::ConvertNextDocument() SetUpdateMode(true); pView->GetWrtShell().MakeVisible(pTextObj->GetLogicRect()); - pSdrView->SdrBeginTextEdit(pTextObj, pPV, &pView->GetEditWin(), false, this, pOutlView, true, true); + pSdrView->SdrBeginTextEdit(pTextObj, pPV, &pView->GetEditWin(), false, this, pOutlView.get(), true, true); } else SetUpdateMode(false); diff --git a/sw/source/uibase/lingu/sdrhhcwrap.hxx b/sw/source/uibase/lingu/sdrhhcwrap.hxx index fd6ac484979b..133e47cc9200 100644 --- a/sw/source/uibase/lingu/sdrhhcwrap.hxx +++ b/sw/source/uibase/lingu/sdrhhcwrap.hxx @@ -31,7 +31,7 @@ class SdrHHCWrapper : public SdrOutliner SwView* pView; SdrTextObj* pTextObj; - OutlinerView* pOutlView; + std::unique_ptr<OutlinerView> pOutlView; sal_Int32 nOptions; sal_uInt16 nDocIndex; LanguageType nSourceLang; commit f154ed6d9c5ba1895ec07f0d93337f6941803e59 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue Jul 24 11:06:31 2018 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Jul 25 08:46:07 2018 +0200 loplugin:useuniqueptr in SwSrcEditWindow Change-Id: I64d8a4ab60df95672363df7a4ac65cf4d2f9c8c2 Reviewed-on: https://gerrit.libreoffice.org/57939 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/source/uibase/docvw/srcedtw.cxx b/sw/source/uibase/docvw/srcedtw.cxx index a625f02bd999..f38d0b287546 100644 --- a/sw/source/uibase/docvw/srcedtw.cxx +++ b/sw/source/uibase/docvw/srcedtw.cxx @@ -292,12 +292,10 @@ void SwSrcEditWindow::dispose() if ( m_pTextEngine ) { EndListening( *m_pTextEngine ); - m_pTextEngine->RemoveView( m_pTextView ); + m_pTextEngine->RemoveView( m_pTextView.get() ); - delete m_pTextView; - m_pTextView = nullptr; - delete m_pTextEngine; - m_pTextEngine = nullptr; + m_pTextView.reset(); + m_pTextEngine.reset(); } m_pHScrollbar.disposeAndClear(); m_pVScrollbar.disposeAndClear(); @@ -518,13 +516,13 @@ void SwSrcEditWindow::CreateTextEngine() m_pHScrollbar->EnableDrag(); m_pVScrollbar->Show(); - m_pTextEngine = new ExtTextEngine; - m_pTextView = new TextView( m_pTextEngine, m_pOutWin ); + m_pTextEngine.reset(new ExtTextEngine); + m_pTextView.reset(new TextView( m_pTextEngine.get(), m_pOutWin )); m_pTextView->SetAutoIndentMode(true); - m_pOutWin->SetTextView(m_pTextView); + m_pOutWin->SetTextView(m_pTextView.get()); m_pTextEngine->SetUpdateMode( false ); - m_pTextEngine->InsertView( m_pTextView ); + m_pTextEngine->InsertView( m_pTextView.get() ); vcl::Font aFont; aFont.SetTransparent( false ); diff --git a/sw/source/uibase/inc/srcedtw.hxx b/sw/source/uibase/inc/srcedtw.hxx index ef9f90a096f8..beb43502c158 100644 --- a/sw/source/uibase/inc/srcedtw.hxx +++ b/sw/source/uibase/inc/srcedtw.hxx @@ -64,8 +64,8 @@ class SwSrcEditWindow : public vcl::Window, public SfxListener private: class ChangesListener; friend class ChangesListener; - TextView* m_pTextView; - ExtTextEngine* m_pTextEngine; + std::unique_ptr<TextView> m_pTextView; + std::unique_ptr<ExtTextEngine> m_pTextEngine; VclPtr<TextViewOutWin> m_pOutWin; VclPtr<ScrollBar> m_pHScrollbar, @@ -121,9 +121,9 @@ public: void Write(SvStream& rOutput) { m_pTextEngine->Write(rOutput); } TextView* GetTextView() - {return m_pTextView;} + {return m_pTextView.get();} TextEngine* GetTextEngine() - {return m_pTextEngine;} + {return m_pTextEngine.get();} SwSrcView* GetSrcView() {return m_pSrcView;} TextViewOutWin* GetOutWin() {return m_pOutWin;} _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits