diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-24 13:38:41 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-30 08:38:50 +0200 |
commit | db41d66179916146411cd2483460d7ab4ba7e6c4 (patch) | |
tree | d78ebfa9639be17be5b0caac137813ed98eca1cc | |
parent | 6b2e5bce6e658a6e6c202ed801052da14b5f87be (diff) |
loplugin:useuniqueptr in SvTreeListBox
Change-Id: Ib5b4cb667e8c7979ba03a680af7923f9caf9dfc3
Reviewed-on: https://gerrit.libreoffice.org/53593
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | include/svtools/treelistbox.hxx | 2 | ||||
-rw-r--r-- | svtools/source/contnr/treelistbox.cxx | 13 |
2 files changed, 6 insertions, 9 deletions
diff --git a/include/svtools/treelistbox.hxx b/include/svtools/treelistbox.hxx index ac58f6228069..83c7b83f0490 100644 --- a/include/svtools/treelistbox.hxx +++ b/include/svtools/treelistbox.hxx @@ -291,7 +291,7 @@ protected: virtual sal_uLong Insert( SvTreeListEntry* pEntry,sal_uLong nRootPos = TREELIST_APPEND ); // In-place editing - SvInplaceEdit2* pEdCtrl; + std::unique_ptr<SvInplaceEdit2> pEdCtrl; void EditText( const OUString&, const tools::Rectangle&,const Selection&); void CancelTextEditing(); bool EditingCanceled() const; diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx index 63ddcdbd62e1..c236e432e227 100644 --- a/svtools/source/contnr/treelistbox.cxx +++ b/svtools/source/contnr/treelistbox.cxx @@ -352,7 +352,6 @@ SvTreeListBox::SvTreeListBox(vcl::Window* pParent, WinBits nWinStyle) : pModel->SetCloneLink( LINK(this, SvTreeListBox, CloneHdl_Impl )); pModel->InsertView( this ); pHdlEntry = nullptr; - pEdCtrl = nullptr; eSelMode = SelectionMode::Single; nDragDropMode = DragDropMode::NONE; SetType(WindowType::TREELISTBOX); @@ -885,14 +884,14 @@ void SvTreeListBox::EnableSelectionAsDropTarget( bool bEnable ) void SvTreeListBox::EditText( const OUString& rStr, const tools::Rectangle& rRect, const Selection& rSel ) { - delete pEdCtrl; + pEdCtrl.reset(); nImpFlags |= SvTreeListBoxFlags::IN_EDT; nImpFlags &= ~SvTreeListBoxFlags::EDTEND_CALLED; HideFocus(); - pEdCtrl = new SvInplaceEdit2( + pEdCtrl.reset( new SvInplaceEdit2( this, rRect.TopLeft(), rRect.GetSize(), rStr, LINK( this, SvTreeListBox, TextEditEndedHdl_Impl ), - rSel ); + rSel ) ); } IMPL_LINK_NOARG(SvTreeListBox, TextEditEndedHdl_Impl, SvInplaceEdit2&, void) @@ -1363,8 +1362,7 @@ void SvTreeListBox::dispose() { ClearTabList(); - delete pEdCtrl; - pEdCtrl = nullptr; + pEdCtrl.reset(); if( pModel ) { @@ -2033,8 +2031,7 @@ void SvTreeListBox::LoseFocus() void SvTreeListBox::ModelHasCleared() { pImpl->pCursor = nullptr; // else we crash in GetFocus when editing in-place - delete pEdCtrl; - pEdCtrl = nullptr; + pEdCtrl.reset(); pImpl->Clear(); nFocusWidth = -1; |