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

loplugin:useuniqueptr in ImpEditView

Change-Id: I9bda92e4a096b73394d579da94eeeb4448134618
Reviewed-on: https://gerrit.libreoffice.org/49147Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst beb17b18
...@@ -408,7 +408,7 @@ const Pointer& EditView::GetPointer() const ...@@ -408,7 +408,7 @@ const Pointer& EditView::GetPointer() const
vcl::Cursor* EditView::GetCursor() const vcl::Cursor* EditView::GetCursor() const
{ {
return pImpEditView->pCursor; return pImpEditView->pCursor.get();
} }
void EditView::InsertText( const OUString& rStr, bool bSelect ) void EditView::InsertText( const OUString& rStr, bool bSelect )
......
...@@ -99,18 +99,13 @@ ImpEditView::~ImpEditView() ...@@ -99,18 +99,13 @@ ImpEditView::~ImpEditView()
{ {
RemoveDragAndDropListeners(); RemoveDragAndDropListeners();
if ( pOutWin && ( pOutWin->GetCursor() == pCursor ) ) if ( pOutWin && ( pOutWin->GetCursor() == pCursor.get() ) )
pOutWin->SetCursor( nullptr ); pOutWin->SetCursor( nullptr );
delete pCursor;
delete pBackgroundColor;
delete pPointer;
} }
void ImpEditView::SetBackgroundColor( const Color& rColor ) void ImpEditView::SetBackgroundColor( const Color& rColor )
{ {
delete pBackgroundColor; pBackgroundColor.reset( new Color( rColor ) );
pBackgroundColor = new Color( rColor );
} }
void ImpEditView::RegisterViewShell(OutlinerViewShell* pViewShell) void ImpEditView::RegisterViewShell(OutlinerViewShell* pViewShell)
......
...@@ -225,8 +225,8 @@ class ImpEditView : public vcl::unohelper::DragAndDropClient ...@@ -225,8 +225,8 @@ class ImpEditView : public vcl::unohelper::DragAndDropClient
private: private:
EditView* pEditView; EditView* pEditView;
vcl::Cursor* pCursor; std::unique_ptr<vcl::Cursor> pCursor;
Color* pBackgroundColor; std::unique_ptr<Color> pBackgroundColor;
/// Containing view shell, if any. /// Containing view shell, if any.
OutlinerViewShell* mpViewShell; OutlinerViewShell* mpViewShell;
/// An other shell, just listening to our state, if any. /// An other shell, just listening to our state, if any.
...@@ -234,7 +234,7 @@ private: ...@@ -234,7 +234,7 @@ private:
EditEngine* pEditEngine; EditEngine* pEditEngine;
VclPtr<vcl::Window> pOutWin; VclPtr<vcl::Window> pOutWin;
EditView::OutWindowSet aOutWindowSet; EditView::OutWindowSet aOutWindowSet;
Pointer* pPointer; std::unique_ptr<Pointer> pPointer;
std::unique_ptr<DragAndDropInfo> pDragAndDropInfo; std::unique_ptr<DragAndDropInfo> pDragAndDropInfo;
css::uno::Reference< css::datatransfer::dnd::XDragSourceListener > mxDnDListener; css::uno::Reference< css::datatransfer::dnd::XDragSourceListener > mxDnDListener;
...@@ -1213,19 +1213,17 @@ inline const Pointer& ImpEditView::GetPointer() ...@@ -1213,19 +1213,17 @@ inline const Pointer& ImpEditView::GetPointer()
{ {
if ( !pPointer ) if ( !pPointer )
{ {
pPointer = new Pointer( IsVertical() ? PointerStyle::TextVertical : PointerStyle::Text ); pPointer.reset( new Pointer( IsVertical() ? PointerStyle::TextVertical : PointerStyle::Text ) );
return *pPointer; return *pPointer;
} }
if(PointerStyle::Text == pPointer->GetStyle() && IsVertical()) if(PointerStyle::Text == pPointer->GetStyle() && IsVertical())
{ {
delete pPointer; pPointer.reset( new Pointer(PointerStyle::TextVertical) );
pPointer = new Pointer(PointerStyle::TextVertical);
} }
else if(PointerStyle::TextVertical == pPointer->GetStyle() && !IsVertical()) else if(PointerStyle::TextVertical == pPointer->GetStyle() && !IsVertical())
{ {
delete pPointer; pPointer.reset( new Pointer(PointerStyle::Text) );
pPointer = new Pointer(PointerStyle::Text);
} }
return *pPointer; return *pPointer;
...@@ -1234,8 +1232,8 @@ inline const Pointer& ImpEditView::GetPointer() ...@@ -1234,8 +1232,8 @@ inline const Pointer& ImpEditView::GetPointer()
inline vcl::Cursor* ImpEditView::GetCursor() inline vcl::Cursor* ImpEditView::GetCursor()
{ {
if ( !pCursor ) if ( !pCursor )
pCursor = new vcl::Cursor; pCursor.reset( new vcl::Cursor );
return pCursor; return pCursor.get();
} }
void ConvertItem( SfxPoolItem& rPoolItem, MapUnit eSourceUnit, MapUnit eDestUnit ); void ConvertItem( SfxPoolItem& rPoolItem, MapUnit eSourceUnit, MapUnit eDestUnit );
......
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