Kaydet (Commit) db41d661 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in SvTreeListBox

Change-Id: Ib5b4cb667e8c7979ba03a680af7923f9caf9dfc3
Reviewed-on: https://gerrit.libreoffice.org/53593Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 6b2e5bce
...@@ -291,7 +291,7 @@ protected: ...@@ -291,7 +291,7 @@ protected:
virtual sal_uLong Insert( SvTreeListEntry* pEntry,sal_uLong nRootPos = TREELIST_APPEND ); virtual sal_uLong Insert( SvTreeListEntry* pEntry,sal_uLong nRootPos = TREELIST_APPEND );
// In-place editing // In-place editing
SvInplaceEdit2* pEdCtrl; std::unique_ptr<SvInplaceEdit2> pEdCtrl;
void EditText( const OUString&, const tools::Rectangle&,const Selection&); void EditText( const OUString&, const tools::Rectangle&,const Selection&);
void CancelTextEditing(); void CancelTextEditing();
bool EditingCanceled() const; bool EditingCanceled() const;
......
...@@ -352,7 +352,6 @@ SvTreeListBox::SvTreeListBox(vcl::Window* pParent, WinBits nWinStyle) : ...@@ -352,7 +352,6 @@ SvTreeListBox::SvTreeListBox(vcl::Window* pParent, WinBits nWinStyle) :
pModel->SetCloneLink( LINK(this, SvTreeListBox, CloneHdl_Impl )); pModel->SetCloneLink( LINK(this, SvTreeListBox, CloneHdl_Impl ));
pModel->InsertView( this ); pModel->InsertView( this );
pHdlEntry = nullptr; pHdlEntry = nullptr;
pEdCtrl = nullptr;
eSelMode = SelectionMode::Single; eSelMode = SelectionMode::Single;
nDragDropMode = DragDropMode::NONE; nDragDropMode = DragDropMode::NONE;
SetType(WindowType::TREELISTBOX); SetType(WindowType::TREELISTBOX);
...@@ -885,14 +884,14 @@ void SvTreeListBox::EnableSelectionAsDropTarget( bool bEnable ) ...@@ -885,14 +884,14 @@ void SvTreeListBox::EnableSelectionAsDropTarget( bool bEnable )
void SvTreeListBox::EditText( const OUString& rStr, const tools::Rectangle& rRect, void SvTreeListBox::EditText( const OUString& rStr, const tools::Rectangle& rRect,
const Selection& rSel ) const Selection& rSel )
{ {
delete pEdCtrl; pEdCtrl.reset();
nImpFlags |= SvTreeListBoxFlags::IN_EDT; nImpFlags |= SvTreeListBoxFlags::IN_EDT;
nImpFlags &= ~SvTreeListBoxFlags::EDTEND_CALLED; nImpFlags &= ~SvTreeListBoxFlags::EDTEND_CALLED;
HideFocus(); HideFocus();
pEdCtrl = new SvInplaceEdit2( pEdCtrl.reset( new SvInplaceEdit2(
this, rRect.TopLeft(), rRect.GetSize(), rStr, this, rRect.TopLeft(), rRect.GetSize(), rStr,
LINK( this, SvTreeListBox, TextEditEndedHdl_Impl ), LINK( this, SvTreeListBox, TextEditEndedHdl_Impl ),
rSel ); rSel ) );
} }
IMPL_LINK_NOARG(SvTreeListBox, TextEditEndedHdl_Impl, SvInplaceEdit2&, void) IMPL_LINK_NOARG(SvTreeListBox, TextEditEndedHdl_Impl, SvInplaceEdit2&, void)
...@@ -1363,8 +1362,7 @@ void SvTreeListBox::dispose() ...@@ -1363,8 +1362,7 @@ void SvTreeListBox::dispose()
{ {
ClearTabList(); ClearTabList();
delete pEdCtrl; pEdCtrl.reset();
pEdCtrl = nullptr;
if( pModel ) if( pModel )
{ {
...@@ -2033,8 +2031,7 @@ void SvTreeListBox::LoseFocus() ...@@ -2033,8 +2031,7 @@ void SvTreeListBox::LoseFocus()
void SvTreeListBox::ModelHasCleared() void SvTreeListBox::ModelHasCleared()
{ {
pImpl->pCursor = nullptr; // else we crash in GetFocus when editing in-place pImpl->pCursor = nullptr; // else we crash in GetFocus when editing in-place
delete pEdCtrl; pEdCtrl.reset();
pEdCtrl = nullptr;
pImpl->Clear(); pImpl->Clear();
nFocusWidth = -1; nFocusWidth = -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment