loplugin:useuniqueptr in ScAccessibleDocumentPagePreview

Change-Id: I0b90d59e627691c6c187f34591992301102afcfe
Reviewed-on: https://gerrit.libreoffice.org/56556
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2018-06-27 11:30:28 +02:00
parent b1b490ee35
commit f35ddce379
2 changed files with 8 additions and 10 deletions

View File

@@ -1189,11 +1189,9 @@ void SAL_CALL ScAccessibleDocumentPagePreview::disposing()
// no need to Dispose the AccessibleTextHelper, // no need to Dispose the AccessibleTextHelper,
// as long as mpNotesChildren are destructed here // as long as mpNotesChildren are destructed here
if (mpNotesChildren) mpNotesChildren.reset();
DELETEZ(mpNotesChildren);
if (mpShapeChildren) mpShapeChildren.reset();
DELETEZ(mpShapeChildren);
ScAccessibleDocumentBase::disposing(); ScAccessibleDocumentBase::disposing();
} }
@@ -1541,7 +1539,7 @@ ScNotesChildren* ScAccessibleDocumentPagePreview::GetNotesChildren()
{ {
if (!mpNotesChildren && mpViewShell) if (!mpNotesChildren && mpViewShell)
{ {
mpNotesChildren = new ScNotesChildren(mpViewShell, this); mpNotesChildren.reset( new ScNotesChildren(mpViewShell, this) );
const ScPreviewLocationData& rData = mpViewShell->GetLocationData(); const ScPreviewLocationData& rData = mpViewShell->GetLocationData();
ScPagePreviewCountData aCount( rData, mpViewShell->GetWindow(), GetNotesChildren(), GetShapeChildren() ); ScPagePreviewCountData aCount( rData, mpViewShell->GetWindow(), GetNotesChildren(), GetShapeChildren() );
@@ -1549,18 +1547,18 @@ ScNotesChildren* ScAccessibleDocumentPagePreview::GetNotesChildren()
//! order is background shapes, header, table or notes, footer, foreground shapes, controls //! order is background shapes, header, table or notes, footer, foreground shapes, controls
mpNotesChildren->Init(aCount.aVisRect, aCount.nBackShapes + aCount.nHeaders); mpNotesChildren->Init(aCount.aVisRect, aCount.nBackShapes + aCount.nHeaders);
} }
return mpNotesChildren; return mpNotesChildren.get();
} }
ScShapeChildren* ScAccessibleDocumentPagePreview::GetShapeChildren() ScShapeChildren* ScAccessibleDocumentPagePreview::GetShapeChildren()
{ {
if (!mpShapeChildren && mpViewShell) if (!mpShapeChildren && mpViewShell)
{ {
mpShapeChildren = new ScShapeChildren(mpViewShell, this); mpShapeChildren.reset( new ScShapeChildren(mpViewShell, this) );
mpShapeChildren->Init(); mpShapeChildren->Init();
} }
return mpShapeChildren; return mpShapeChildren.get();
} }
OUString ScAccessibleDocumentPagePreview::getAccessibleName() OUString ScAccessibleDocumentPagePreview::getAccessibleName()

View File

@@ -117,8 +117,8 @@ protected:
private: private:
ScPreviewShell* mpViewShell; ScPreviewShell* mpViewShell;
ScNotesChildren* mpNotesChildren; std::unique_ptr<ScNotesChildren> mpNotesChildren;
ScShapeChildren* mpShapeChildren; std::unique_ptr<ScShapeChildren> mpShapeChildren;
rtl::Reference<ScAccessiblePreviewTable> mpTable; rtl::Reference<ScAccessiblePreviewTable> mpTable;
rtl::Reference<ScAccessiblePageHeader> mpHeader; rtl::Reference<ScAccessiblePageHeader> mpHeader;
rtl::Reference<ScAccessiblePageHeader> mpFooter; rtl::Reference<ScAccessiblePageHeader> mpFooter;