diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2013-11-28 15:19:55 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-11-28 15:19:55 +0100 |
commit | 6014e3c98d7f1f767297ff0f0b6f1a3be18b32d0 (patch) | |
tree | 9e74183905e6b2cafb2789d9035ab264ba0a4cf9 /sd | |
parent | dc6649908984c55659bc013e35f8131b7f85e6e7 (diff) |
Use rtl::Reference instead of std::auto_ptr
Change-Id: I4402b0b259c0dcd03a222993c861114028d6fb75
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx | 57 | ||||
-rw-r--r-- | sd/source/ui/inc/AccessibleDrawDocumentView.hxx | 2 |
2 files changed, 17 insertions, 42 deletions
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<AccessiblePageShape> xPage(CreateDrawPageShape()); + if (xPage.is()) { - pPage->acquire(); - pPage->Init(); - SAL_WNODEPRECATED_DECLARATIONS_PUSH - mpChildrenManager->AddAccessibleShape ( - std::auto_ptr<AccessibleShape>(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<AccessiblePageShape> AccessibleDrawDocumentView::CreateDrawPageShape (void) { - AccessiblePageShape* pShape = NULL; + rtl::Reference<AccessiblePageShape> xShape; // Create a shape that represents the actual draw page. uno::Reference<drawing::XDrawView> 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<drawing::XShapes> ( 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<AccessiblePageShape> xPage(CreateDrawPageShape ()); + if (xPage.is()) { - pPage->acquire(); - pPage->Init(); - SAL_WNODEPRECATED_DECLARATIONS_PUSH - mpChildrenManager->AddAccessibleShape ( - std::auto_ptr<AccessibleShape>(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<AccessiblePageShape> xPage(CreateDrawPageShape ()); + if (xPage.is()) { - pPage->acquire(); - pPage->Init(); - mpChildrenManager->AddAccessibleShape ( - std::auto_ptr<AccessibleShape>(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<AccessiblePageShape> CreateDrawPageShape (void); /// Create an accessible name that contains the current view mode. virtual OUString |