diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-03 10:31:15 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-04 08:36:07 +0200 |
commit | a618f06d1f6c480d46eb0630f82e25963c654a35 (patch) | |
tree | 20cf26cd8f8d424cb78a4d1f0fd681b8f27504fb /sc | |
parent | 2720dbe9f79b6d954f40b9b50aeb8ddd267a4b36 (diff) |
loplugin:useuniqueptr in ScPreview
Change-Id: I081066d34ed6b134b5354f8df7f9801356ef181c
Reviewed-on: https://gerrit.libreoffice.org/56907
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/inc/preview.hxx | 6 | ||||
-rw-r--r-- | sc/source/ui/view/preview.cxx | 20 |
2 files changed, 11 insertions, 15 deletions
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; |