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/source/ui/view | |
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/source/ui/view')
-rw-r--r-- | sc/source/ui/view/preview.cxx | 20 |
1 files changed, 8 insertions, 12 deletions
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; |