summaryrefslogtreecommitdiff
path: root/editeng/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-01-29 10:08:44 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-02-05 07:49:56 +0100
commit518dacc5094bbadbca3167c4dcd2072adc7b3090 (patch)
tree1cd46d40e612227fbc077678ddc4ab75dadb8501 /editeng/source
parentbeb17b18b1621d057aab255051e7265efecf17b3 (diff)
loplugin:useuniqueptr in ImpEditView
Change-Id: I9bda92e4a096b73394d579da94eeeb4448134618 Reviewed-on: https://gerrit.libreoffice.org/49147 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'editeng/source')
-rw-r--r--editeng/source/editeng/editview.cxx2
-rw-r--r--editeng/source/editeng/impedit.cxx9
-rw-r--r--editeng/source/editeng/impedit.hxx18
3 files changed, 11 insertions, 18 deletions
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index 6e1c66f42353..cb202fd07c73 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -408,7 +408,7 @@ const Pointer& EditView::GetPointer() const
vcl::Cursor* EditView::GetCursor() const
{
- return pImpEditView->pCursor;
+ return pImpEditView->pCursor.get();
}
void EditView::InsertText( const OUString& rStr, bool bSelect )
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index 0d531faa8854..a7b0cfb1b272 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -99,18 +99,13 @@ ImpEditView::~ImpEditView()
{
RemoveDragAndDropListeners();
- if ( pOutWin && ( pOutWin->GetCursor() == pCursor ) )
+ if ( pOutWin && ( pOutWin->GetCursor() == pCursor.get() ) )
pOutWin->SetCursor( nullptr );
-
- delete pCursor;
- delete pBackgroundColor;
- delete pPointer;
}
void ImpEditView::SetBackgroundColor( const Color& rColor )
{
- delete pBackgroundColor;
- pBackgroundColor = new Color( rColor );
+ pBackgroundColor.reset( new Color( rColor ) );
}
void ImpEditView::RegisterViewShell(OutlinerViewShell* pViewShell)
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 64b04166563d..1e53e23aa185 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -225,8 +225,8 @@ class ImpEditView : public vcl::unohelper::DragAndDropClient
private:
EditView* pEditView;
- vcl::Cursor* pCursor;
- Color* pBackgroundColor;
+ std::unique_ptr<vcl::Cursor> pCursor;
+ std::unique_ptr<Color> pBackgroundColor;
/// Containing view shell, if any.
OutlinerViewShell* mpViewShell;
/// An other shell, just listening to our state, if any.
@@ -234,7 +234,7 @@ private:
EditEngine* pEditEngine;
VclPtr<vcl::Window> pOutWin;
EditView::OutWindowSet aOutWindowSet;
- Pointer* pPointer;
+ std::unique_ptr<Pointer> pPointer;
std::unique_ptr<DragAndDropInfo> pDragAndDropInfo;
css::uno::Reference< css::datatransfer::dnd::XDragSourceListener > mxDnDListener;
@@ -1213,19 +1213,17 @@ inline const Pointer& ImpEditView::GetPointer()
{
if ( !pPointer )
{
- pPointer = new Pointer( IsVertical() ? PointerStyle::TextVertical : PointerStyle::Text );
+ pPointer.reset( new Pointer( IsVertical() ? PointerStyle::TextVertical : PointerStyle::Text ) );
return *pPointer;
}
if(PointerStyle::Text == pPointer->GetStyle() && IsVertical())
{
- delete pPointer;
- pPointer = new Pointer(PointerStyle::TextVertical);
+ pPointer.reset( new Pointer(PointerStyle::TextVertical) );
}
else if(PointerStyle::TextVertical == pPointer->GetStyle() && !IsVertical())
{
- delete pPointer;
- pPointer = new Pointer(PointerStyle::Text);
+ pPointer.reset( new Pointer(PointerStyle::Text) );
}
return *pPointer;
@@ -1234,8 +1232,8 @@ inline const Pointer& ImpEditView::GetPointer()
inline vcl::Cursor* ImpEditView::GetCursor()
{
if ( !pCursor )
- pCursor = new vcl::Cursor;
- return pCursor;
+ pCursor.reset( new vcl::Cursor );
+ return pCursor.get();
}
void ConvertItem( SfxPoolItem& rPoolItem, MapUnit eSourceUnit, MapUnit eDestUnit );