sc/source/ui/inc/prevwsh.hxx | 2 +- sc/source/ui/unoobj/docuno.cxx | 12 ++++++------ sc/source/ui/view/prevwsh.cxx | 7 +++---- 3 files changed, 10 insertions(+), 11 deletions(-)
New commits: commit 5c8f9d0d83127df1017e41d3512a629627527a82 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Wed Jul 4 12:35:18 2018 +0200 loplugin:useuniqueptr in DrawViewKeeper Change-Id: I75c58682539c7f2dd69c8d46f795411aa9fdb52c Reviewed-on: https://gerrit.libreoffice.org/57202 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index a6b9d5497395..b910162833ef 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -1957,14 +1957,14 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec struct DrawViewKeeper { - FmFormView* mpDrawView; - DrawViewKeeper() : mpDrawView(nullptr) {} + std::unique_ptr<FmFormView> mpDrawView; + DrawViewKeeper() {} ~DrawViewKeeper() { if (mpDrawView) { mpDrawView->HideSdrPage(); - delete mpDrawView; + mpDrawView.reset(); } } } aDrawViewKeeper; @@ -1974,9 +1974,9 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec if( pModel ) { - aDrawViewKeeper.mpDrawView = new FmFormView( + aDrawViewKeeper.mpDrawView.reset( new FmFormView( *pModel, - pDev); + pDev) ); aDrawViewKeeper.mpDrawView->ShowSdrPage(aDrawViewKeeper.mpDrawView->GetModel()->GetPage(nTab)); aDrawViewKeeper.mpDrawView->SetPrintPreview(); } @@ -1991,7 +1991,7 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec else pPrintFunc.reset(new ScPrintFunc(pDev, pDocShell, nTab, pPrintFuncCache->GetFirstAttr(nTab), nTotalPages, pSelRange, &aStatus.GetOptions())); - pPrintFunc->SetDrawView( aDrawViewKeeper.mpDrawView ); + pPrintFunc->SetDrawView( aDrawViewKeeper.mpDrawView.get() ); pPrintFunc->SetRenderFlag( true ); if( aStatus.GetMode() == SC_PRINTSEL_RANGE_EXCLUSIVELY_OLE_AND_DRAW_OBJECTS ) pPrintFunc->SetExclusivelyDrawOleAndDrawObjects(); commit e66e004cc00c4616732bbac6500463be30a19643 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Wed Jul 4 11:01:08 2018 +0200 loplugin:useuniqueptr in ScPreviewShell Change-Id: I95c248755200ab1651faa82f00d49f1ca8e04191 Reviewed-on: https://gerrit.libreoffice.org/57201 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sc/source/ui/inc/prevwsh.hxx b/sc/source/ui/inc/prevwsh.hxx index 85b5afdf1044..da22608854fd 100644 --- a/sc/source/ui/inc/prevwsh.hxx +++ b/sc/source/ui/inc/prevwsh.hxx @@ -50,7 +50,7 @@ class SC_DLLPUBLIC ScPreviewShell: public SfxViewShell SvxZoomType eZoom; long nMaxVertPos; - SfxBroadcaster* pAccessibilityBroadcaster; + std::unique_ptr<SfxBroadcaster> pAccessibilityBroadcaster; bool GetPageSize( Size& aPageSize ); private: void Construct( vcl::Window* pParent ); diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx index 53c017e4fe2b..735e715311b7 100644 --- a/sc/source/ui/view/prevwsh.cxx +++ b/sc/source/ui/view/prevwsh.cxx @@ -151,8 +151,7 @@ ScPreviewShell::ScPreviewShell( SfxViewFrame* pViewFrame, pDocShell( static_cast<ScDocShell*>(pViewFrame->GetObjectShell()) ), mpFrameWindow(nullptr), nSourceDesignMode( TRISTATE_INDET ), - nMaxVertPos(0), - pAccessibilityBroadcaster( nullptr ) + nMaxVertPos(0) { Construct( &pViewFrame->GetWindow() ); @@ -185,7 +184,7 @@ ScPreviewShell::~ScPreviewShell() // #108333#; notify Accessibility that Shell is dying and before destroy all BroadcastAccessibility( SfxHint( SfxHintId::Dying ) ); - DELETEZ(pAccessibilityBroadcaster); + pAccessibilityBroadcaster.reset(); SfxBroadcaster* pDrawBC = pDocShell->GetDocument().GetDrawBroadcaster(); if (pDrawBC) @@ -1135,7 +1134,7 @@ void ScPreviewShell::ExitPreview() void ScPreviewShell::AddAccessibilityObject( SfxListener& rObject ) { if (!pAccessibilityBroadcaster) - pAccessibilityBroadcaster = new SfxBroadcaster; + pAccessibilityBroadcaster.reset( new SfxBroadcaster ); rObject.StartListening( *pAccessibilityBroadcaster ); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits