From 6014e3c98d7f1f767297ff0f0b6f1a3be18b32d0 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 28 Nov 2013 15:19:55 +0100 Subject: Use rtl::Reference instead of std::auto_ptr Change-Id: I4402b0b259c0dcd03a222993c861114028d6fb75 --- .../accessibility/AccessibleDrawDocumentView.cxx | 57 ++++++---------------- sd/source/ui/inc/AccessibleDrawDocumentView.hxx | 2 +- 2 files changed, 17 insertions(+), 42 deletions(-) (limited to 'sd') diff --git a/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx b/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx index 5dd336d79227..2c4558a1f50b 100644 --- a/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx +++ b/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx @@ -122,20 +122,11 @@ void AccessibleDrawDocumentView::Init (void) mpChildrenManager = new ChildrenManager(this, xShapeList, maShapeTreeInfo, *this); if (mpChildrenManager != NULL) { - // Create the page shape and initialize it. The shape is acquired - // before initialization and released after transferring ownership - // to the children manager to prevent premature disposing of the - // shape. - AccessiblePageShape* pPage = CreateDrawPageShape(); - if (pPage != NULL) + rtl::Reference xPage(CreateDrawPageShape()); + if (xPage.is()) { - pPage->acquire(); - pPage->Init(); - SAL_WNODEPRECATED_DECLARATIONS_PUSH - mpChildrenManager->AddAccessibleShape ( - std::auto_ptr(pPage)); - SAL_WNODEPRECATED_DECLARATIONS_POP - pPage->release(); + xPage->Init(); + mpChildrenManager->AddAccessibleShape (xPage.get()); mpChildrenManager->Update (); } mpChildrenManager->UpdateSelection (); @@ -159,9 +150,9 @@ void AccessibleDrawDocumentView::ViewForwarderChanged (ChangeType aChangeType, /** The page shape is created on every call at the moment (provided that every thing goes well). */ -AccessiblePageShape* AccessibleDrawDocumentView::CreateDrawPageShape (void) +rtl::Reference AccessibleDrawDocumentView::CreateDrawPageShape (void) { - AccessiblePageShape* pShape = NULL; + rtl::Reference xShape; // Create a shape that represents the actual draw page. uno::Reference xView (mxController, uno::UNO_QUERY); @@ -201,12 +192,12 @@ AccessiblePageShape* AccessibleDrawDocumentView::CreateDrawPageShape (void) // Create the accessible object for the shape and // initialize it. - pShape = new AccessiblePageShape ( + xShape = new AccessiblePageShape ( xView->getCurrentPage(), this, maShapeTreeInfo); } } } - return pShape; + return xShape; } @@ -351,21 +342,12 @@ void SAL_CALL mpChildrenManager->SetShapeList (uno::Reference ( xView->getCurrentPage(), uno::UNO_QUERY)); - // Create the page shape and initialize it. The shape is - // acquired before initialization and released after - // transferring ownership to the children manager to prevent - // premature disposing of the shape. - AccessiblePageShape* pPage = CreateDrawPageShape (); - if (pPage != NULL) + rtl::Reference xPage(CreateDrawPageShape ()); + if (xPage.is()) { - pPage->acquire(); - pPage->Init(); - SAL_WNODEPRECATED_DECLARATIONS_PUSH - mpChildrenManager->AddAccessibleShape ( - std::auto_ptr(pPage)); - SAL_WNODEPRECATED_DECLARATIONS_POP + xPage->Init(); + mpChildrenManager->AddAccessibleShape (xPage.get()); mpChildrenManager->Update (false); - pPage->release(); } } else @@ -415,19 +397,12 @@ void SAL_CALL } } } - // Create the page shape and initialize it. The shape is - // acquired before initialization and released after - // transferring ownership to the children manager to prevent - // premature disposing of the shape. - AccessiblePageShape* pPage = CreateDrawPageShape (); - if (pPage != NULL) + rtl::Reference xPage(CreateDrawPageShape ()); + if (xPage.is()) { - pPage->acquire(); - pPage->Init(); - mpChildrenManager->AddAccessibleShape ( - std::auto_ptr(pPage)); + xPage->Init(); + mpChildrenManager->AddAccessibleShape (xPage.get()); mpChildrenManager->Update (false); - pPage->release(); } } } diff --git a/sd/source/ui/inc/AccessibleDrawDocumentView.hxx b/sd/source/ui/inc/AccessibleDrawDocumentView.hxx index e82275c252bc..d6a3d0262a82 100644 --- a/sd/source/ui/inc/AccessibleDrawDocumentView.hxx +++ b/sd/source/ui/inc/AccessibleDrawDocumentView.hxx @@ -158,7 +158,7 @@ protected: /** Create a shape the represents the page as seen on the screen. */ - AccessiblePageShape* CreateDrawPageShape (void); + rtl::Reference CreateDrawPageShape (void); /// Create an accessible name that contains the current view mode. virtual OUString -- cgit