[Libreoffice-commits] core.git: 2 commits - sc/source
Noel Grandin
noel.grandin at collabora.co.uk
Wed Jul 4 06:36:18 UTC 2018
sc/source/ui/inc/drawview.hxx | 2 +-
sc/source/ui/inc/preview.hxx | 6 +++---
sc/source/ui/view/drawview.cxx | 8 ++------
sc/source/ui/view/preview.cxx | 20 ++++++++------------
4 files changed, 14 insertions(+), 22 deletions(-)
New commits:
commit a618f06d1f6c480d46eb0630f82e25963c654a35
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Tue Jul 3 10:31:15 2018 +0200
loplugin:useuniqueptr in ScPreview
Change-Id: I081066d34ed6b134b5354f8df7f9801356ef181c
Reviewed-on: https://gerrit.libreoffice.org/56907
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sc/source/ui/inc/preview.hxx b/sc/source/ui/inc/preview.hxx
index a43002c545ae..ac4e8f5ed6e8 100644
--- a/sc/source/ui/inc/preview.hxx
+++ b/sc/source/ui/inc/preview.hxx
@@ -51,8 +51,8 @@ private:
long nTotalPages;
Size aPageSize; // for GetOptimalZoom
ScPrintState aState;
- ScPreviewLocationData* pLocationData; // stores table layout for accessibility API
- FmFormView* pDrawView;
+ std::unique_ptr<ScPreviewLocationData> pLocationData; // stores table layout for accessibility API
+ std::unique_ptr<FmFormView> pDrawView;
// internal:
ScDocShell* pDocShell;
@@ -156,7 +156,7 @@ public:
DECL_STATIC_LINK( ScPreview, InvalidateHdl, void*, void );
static void StaticInvalidate();
- FmFormView* GetDrawView() { return pDrawView; }
+ FmFormView* GetDrawView() { return pDrawView.get(); }
SC_DLLPUBLIC void SetSelectedTabs(const ScMarkData& rMark);
const ScMarkData::MarkedTabsType& GetSelectedTabs() const { return maSelectedTabs; }
diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx
index b709cf1a3d12..116615793c5f 100644
--- a/sc/source/ui/view/preview.cxx
+++ b/sc/source/ui/view/preview.cxx
@@ -144,8 +144,8 @@ ScPreview::~ScPreview()
void ScPreview::dispose()
{
- delete pDrawView;
- delete pLocationData;
+ pDrawView.reset();
+ pLocationData.reset();
vcl::Window::dispose();
}
@@ -160,15 +160,12 @@ void ScPreview::UpdateDrawView() // nTab must be right
if ( pDrawView && ( !pDrawView->GetSdrPageView() || pDrawView->GetSdrPageView()->GetPage() != pPage ) )
{
// convert the displayed Page of drawView (see below) does not work?!?
- delete pDrawView;
- pDrawView = nullptr;
+ pDrawView.reset();
}
if ( !pDrawView ) // New Drawing?
{
- pDrawView = new FmFormView(
- *pModel,
- this);
+ pDrawView.reset( new FmFormView( *pModel, this) );
// The DrawView takes over the Design-Mode from the Model
// (Settings "In opening Draftmode"), therefore to restore here
@@ -179,8 +176,7 @@ void ScPreview::UpdateDrawView() // nTab must be right
}
else if ( pDrawView )
{
- delete pDrawView; // for this Chart is not needed
- pDrawView = nullptr;
+ pDrawView.reset(); // for this Chart is not needed
}
}
@@ -404,7 +400,7 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation )
pPrintFunc->SetClearFlag(true);
pPrintFunc->SetUseStyleColor( pScMod->GetAccessOptions().GetIsForPagePreviews() );
- pPrintFunc->SetDrawView( pDrawView );
+ pPrintFunc->SetDrawView( pDrawView.get() );
// MultiSelection for the one Page must produce something inconvenient
Range aPageRange( nPageNo+1, nPageNo+1 );
@@ -685,13 +681,13 @@ const ScPreviewLocationData& ScPreview::GetLocationData()
{
if ( !pLocationData )
{
- pLocationData = new ScPreviewLocationData( &pDocShell->GetDocument(), this );
+ pLocationData.reset( new ScPreviewLocationData( &pDocShell->GetDocument(), this ) );
bLocationValid = false;
}
if ( !bLocationValid )
{
pLocationData->Clear();
- DoPrint( pLocationData );
+ DoPrint( pLocationData.get() );
bLocationValid = true;
}
return *pLocationData;
commit 2720dbe9f79b6d954f40b9b50aeb8ddd267a4b36
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Tue Jul 3 10:22:08 2018 +0200
loplugin:useuniqueptr in ScDrawView
Change-Id: Idbc47bdb3ff16d29a93365654b36b047c564de70
Reviewed-on: https://gerrit.libreoffice.org/56906
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sc/source/ui/inc/drawview.hxx b/sc/source/ui/inc/drawview.hxx
index ad353cdd7a29..ce2af6a66b58 100644
--- a/sc/source/ui/inc/drawview.hxx
+++ b/sc/source/ui/inc/drawview.hxx
@@ -39,7 +39,7 @@ class ScDrawView final : public FmFormView
SCTAB nTab;
Fraction aScaleX; // Factor for Drawing-MapMode
Fraction aScaleY;
- SdrDropMarkerOverlay* pDropMarker;
+ std::unique_ptr<SdrDropMarkerOverlay> pDropMarker;
SdrObject* pDropMarkObj;
bool bInConstruct;
diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx
index 51b281c91b3f..ca10345efed0 100644
--- a/sc/source/ui/view/drawview.cxx
+++ b/sc/source/ui/view/drawview.cxx
@@ -123,11 +123,7 @@ void ScDrawView::Construct()
void ScDrawView::ImplClearCalcDropMarker()
{
- if(pDropMarker)
- {
- delete pDropMarker;
- pDropMarker = nullptr;
- }
+ pDropMarker.reset();
}
ScDrawView::~ScDrawView()
@@ -907,7 +903,7 @@ void ScDrawView::MarkDropObj( SdrObject* pObj )
if(pDropMarkObj)
{
- pDropMarker = new SdrDropMarkerOverlay(*this, *pDropMarkObj);
+ pDropMarker.reset( new SdrDropMarkerOverlay(*this, *pDropMarkObj) );
}
}
}
More information about the Libreoffice-commits
mailing list