[Libreoffice-commits] core.git: include/svx svx/source

Stephan Bergmann sbergman at redhat.com
Thu Feb 11 16:24:41 UTC 2016


 include/svx/ChildrenManager.hxx              |   18 ++++++++-------
 svx/source/accessibility/ChildrenManager.cxx |   32 ++++++---------------------
 2 files changed, 18 insertions(+), 32 deletions(-)

New commits:
commit 01c62797c2c8acf6cb8cdd0f713411dca5411ac3
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Feb 11 17:24:04 2016 +0100

    Simplify ChildrenManager
    
    Change-Id: I43762aa8b572651676d8cac4848d4c6d478cf850

diff --git a/include/svx/ChildrenManager.hxx b/include/svx/ChildrenManager.hxx
index bb0b88f..4e6aea5 100644
--- a/include/svx/ChildrenManager.hxx
+++ b/include/svx/ChildrenManager.hxx
@@ -20,6 +20,9 @@
 #ifndef INCLUDED_SVX_CHILDRENMANAGER_HXX
 #define INCLUDED_SVX_CHILDRENMANAGER_HXX
 
+#include <sal/config.h>
+
+#include <rtl/ref.hxx>
 #include <svx/IAccessibleViewForwarderListener.hxx>
 #include <svx/AccessibleShapeTreeInfo.hxx>
 #include <com/sun/star/drawing/XShape.hpp>
@@ -67,8 +70,7 @@ class ChildrenManagerImpl;
     accessible objects access to data normally known only to the top level
     owner of the shapes.</p>
 */
-class SVX_DLLPUBLIC ChildrenManager
-    :   public IAccessibleViewForwarderListener
+class SVX_DLLPUBLIC ChildrenManager final
 {
 public:
     /** Create a children manager, which manages the children of the given
@@ -98,7 +100,7 @@ public:
     /** If there still are managed children these are marked as DEFUNC and
         released.
     */
-    virtual ~ChildrenManager();
+    ~ChildrenManager();
 
     /** Return the number of currently visible accessible children.
         @return
@@ -190,13 +192,13 @@ public:
     */
     void RemoveFocus();
 
-    virtual void ViewForwarderChanged (ChangeType aChangeType,
-        const IAccessibleViewForwarder* pViewForwarder) override;
-
-protected:
-    ChildrenManagerImpl* mpImpl;
+    void ViewForwarderChanged(
+        IAccessibleViewForwarderListener::ChangeType aChangeType,
+        const IAccessibleViewForwarder* pViewForwarder);
 
 private:
+    rtl::Reference<ChildrenManagerImpl> mpImpl;
+
     ChildrenManager (const ChildrenManager&) = delete;
     ChildrenManager& operator= (const ChildrenManager&) = delete;
 };
diff --git a/svx/source/accessibility/ChildrenManager.cxx b/svx/source/accessibility/ChildrenManager.cxx
index 1caeea6..77beb00 100644
--- a/svx/source/accessibility/ChildrenManager.cxx
+++ b/svx/source/accessibility/ChildrenManager.cxx
@@ -33,21 +33,17 @@ ChildrenManager::ChildrenManager (
     const css::uno::Reference<drawing::XShapes>& rxShapeList,
     const AccessibleShapeTreeInfo& rShapeTreeInfo,
     AccessibleContextBase& rContext)
-    : mpImpl (nullptr)
+    : mpImpl(
+        new ChildrenManagerImpl(
+            rxParent, rxShapeList, rShapeTreeInfo, rContext))
 {
-    mpImpl = new ChildrenManagerImpl (rxParent, rxShapeList, rShapeTreeInfo, rContext);
-    if (mpImpl != nullptr)
-        mpImpl->Init ();
-    else
-        throw uno::RuntimeException(
-            "ChildrenManager::ChildrenManager can't create implementation object", nullptr);
+    mpImpl->Init ();
 }
 
 
 ChildrenManager::~ChildrenManager()
 {
-    if (mpImpl != nullptr)
-        mpImpl->dispose();
+    mpImpl->dispose();
 
     // emtpy
     OSL_TRACE ("~ChildrenManager");
@@ -55,7 +51,6 @@ ChildrenManager::~ChildrenManager()
 
 long ChildrenManager::GetChildCount() const throw ()
 {
-    assert(mpImpl != nullptr);
     return mpImpl->GetChildCount();
 }
 
@@ -63,14 +58,12 @@ css::uno::Reference<XAccessible> ChildrenManager::GetChild (long nIndex)
     throw (css::uno::RuntimeException,
            css::lang::IndexOutOfBoundsException)
 {
-    assert(mpImpl != nullptr);
     return mpImpl->GetChild (nIndex);
 }
 
 Reference<XAccessible> ChildrenManager::GetChild (const Reference<drawing::XShape>& xShape)
     throw (css::uno::RuntimeException)
 {
-    assert(mpImpl != nullptr);
     return mpImpl->GetChild (xShape);
 }
 
@@ -78,63 +71,54 @@ css::uno::Reference<css::drawing::XShape> ChildrenManager::GetChildShape(long nI
     throw (css::uno::RuntimeException,
            css::lang::IndexOutOfBoundsException)
 {
-    assert(mpImpl != nullptr);
     return mpImpl->GetChildShape(nIndex);
 }
 
 void ChildrenManager::Update (bool bCreateNewObjectsOnDemand)
 {
-    assert(mpImpl != nullptr);
     mpImpl->Update (bCreateNewObjectsOnDemand);
 }
 
 void ChildrenManager::SetShapeList (const css::uno::Reference<css::drawing::XShapes>& xShapeList)
 {
-    assert(mpImpl != nullptr);
     mpImpl->SetShapeList (xShapeList);
 }
 
 void ChildrenManager::AddAccessibleShape (css::uno::Reference<css::accessibility::XAccessible> const & shape)
 {
-    assert(mpImpl != nullptr);
     mpImpl->AddAccessibleShape (shape);
 }
 
 void ChildrenManager::ClearAccessibleShapeList()
 {
-    assert(mpImpl != nullptr);
     mpImpl->ClearAccessibleShapeList ();
 }
 
 void ChildrenManager::SetInfo (AccessibleShapeTreeInfo& rShapeTreeInfo)
 {
-    assert(mpImpl != nullptr);
     mpImpl->SetInfo (rShapeTreeInfo);
 }
 
 void ChildrenManager::UpdateSelection()
 {
-    assert(mpImpl != nullptr);
     mpImpl->UpdateSelection ();
 }
 
 bool ChildrenManager::HasFocus()
 {
-    assert(mpImpl != nullptr);
     return mpImpl->HasFocus ();
 }
 
 void ChildrenManager::RemoveFocus()
 {
-    assert(mpImpl != nullptr);
     mpImpl->RemoveFocus ();
 }
 
 // IAccessibleViewForwarderListener
-void ChildrenManager::ViewForwarderChanged (ChangeType aChangeType,
-        const IAccessibleViewForwarder* pViewForwarder)
+void ChildrenManager::ViewForwarderChanged(
+    IAccessibleViewForwarderListener::ChangeType aChangeType,
+    const IAccessibleViewForwarder* pViewForwarder)
 {
-    assert(mpImpl != nullptr);
     mpImpl->ViewForwarderChanged (aChangeType, pViewForwarder);
 }
 


More information about the Libreoffice-commits mailing list