include/svx/ChildrenManager.hxx                  |    3 +-
 svx/source/accessibility/ChildrenManager.cxx     |    2 -
 svx/source/accessibility/ChildrenManagerImpl.cxx |   29 +++++++++--------------
 svx/source/accessibility/ChildrenManagerImpl.hxx |   10 +++----
 4 files changed, 20 insertions(+), 24 deletions(-)

New commits:
commit c6f1659fa2be14f830fb4a8264b70420df22f7e0
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Wed Jun 29 20:49:03 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Jun 30 22:14:14 2022 +0200

    tdf#137544 elide some UNO_QUERY
    
    Change-Id: I58b5a800d2f24168c9d1c109769344a00dea8e1d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136658
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/svx/ChildrenManager.hxx b/include/svx/ChildrenManager.hxx
index 0498b43fdff0..c14ae6c1c476 100644
--- a/include/svx/ChildrenManager.hxx
+++ b/include/svx/ChildrenManager.hxx
@@ -46,6 +46,7 @@ class XShapes;
 namespace accessibility
 {
 class AccessibleContextBase;
+class AccessibleShape;
 class AccessibleShapeTreeInfo;
 class ChildrenManagerImpl;
 
@@ -164,7 +165,7 @@ public:
 
         @param shape must be non-null
     */
-    void 
AddAccessibleShape(css::uno::Reference<css::accessibility::XAccessible> const& 
shape);
+    void AddAccessibleShape(rtl::Reference<AccessibleShape> const& shape);
 
     /** Clear the list of accessible shapes which have been added by
         previous calls to <member>AddAccessibleShape</member>.
diff --git a/svx/source/accessibility/ChildrenManager.cxx 
b/svx/source/accessibility/ChildrenManager.cxx
index 71983f46e98c..d0e681b550f1 100644
--- a/svx/source/accessibility/ChildrenManager.cxx
+++ b/svx/source/accessibility/ChildrenManager.cxx
@@ -74,7 +74,7 @@ void ChildrenManager::SetShapeList (const 
css::uno::Reference<css::drawing::XSha
     mpImpl->SetShapeList (xShapeList);
 }
 
-void ChildrenManager::AddAccessibleShape 
(css::uno::Reference<css::accessibility::XAccessible> const & shape)
+void ChildrenManager::AddAccessibleShape (rtl::Reference<AccessibleShape> 
const & shape)
 {
     mpImpl->AddAccessibleShape (shape);
 }
diff --git a/svx/source/accessibility/ChildrenManagerImpl.cxx 
b/svx/source/accessibility/ChildrenManagerImpl.cxx
index d22f81e76684..27647f70c097 100644
--- a/svx/source/accessibility/ChildrenManagerImpl.cxx
+++ b/svx/source/accessibility/ChildrenManagerImpl.cxx
@@ -24,6 +24,7 @@
 #include "ChildrenManagerImpl.hxx"
 #include <svx/ShapeTypeHandler.hxx>
 #include <svx/AccessibleControlShape.hxx>
+#include <svx/AccessibleShape.hxx>
 #include <svx/AccessibleShapeInfo.hxx>
 #include <svx/IAccessibleViewForwarder.hxx>
 #include <vcl/svapp.hxx>
@@ -424,7 +425,7 @@ void ChildrenManagerImpl::CreateAccessibilityObjects (
             rChild.mbCreateEventPending = false;
             mrContext.CommitChange (
                 AccessibleEventId::CHILD,
-                uno::Any(rChild.mxAccessibleShape),
+                
uno::Any(uno::Reference<XAccessible>(rChild.mxAccessibleShape)),
                 uno::Any());
         }
         ++nPos;
@@ -472,7 +473,7 @@ void ChildrenManagerImpl::AddShape (const 
Reference<drawing::XShape>& rxShape)
 
     // Inform listeners about new child.
     uno::Any aNewShape;
-    aNewShape <<= rDescriptor.mxAccessibleShape;
+    aNewShape <<= uno::Reference<XAccessible>(rDescriptor.mxAccessibleShape);
     aGuard.clear();
     mrContext.CommitChange (
         AccessibleEventId::CHILD,
@@ -517,7 +518,7 @@ void ChildrenManagerImpl::SetShapeList (const 
css::uno::Reference<css::drawing::
 }
 
 
-void ChildrenManagerImpl::AddAccessibleShape 
(css::uno::Reference<css::accessibility::XAccessible> const & shape)
+void ChildrenManagerImpl::AddAccessibleShape (rtl::Reference<AccessibleShape> 
const & shape)
 {
     assert(shape.is());
     maAccessibleShapes.push_back (shape);
@@ -547,7 +548,7 @@ void ChildrenManagerImpl::ClearAccessibleShapeList()
     for (auto& rChild : aLocalVisibleChildren)
         if ( rChild.mxAccessibleShape.is() && rChild.mxShape.is() )
         {
-            ::comphelper::disposeComponent(rChild.mxAccessibleShape);
+            rChild.mxAccessibleShape->dispose();
             rChild.mxAccessibleShape = nullptr;
         }
 
@@ -556,7 +557,7 @@ void ChildrenManagerImpl::ClearAccessibleShapeList()
         if (rpShape.is())
         {
             // Dispose the object.
-            ::comphelper::disposeComponent(rpShape);
+            rpShape->dispose();
             rpShape = nullptr;
         }
 }
@@ -748,7 +749,7 @@ bool ChildrenManagerImpl::ReplaceChild (
         mrContext.CommitChange (
             AccessibleEventId::CHILD,
             uno::Any(),
-            uno::Any (I->mxAccessibleShape));
+            uno::Any (uno::Reference<XAccessible>(I->mxAccessibleShape)));
 
         // Replace with replacement and send an event about existence
         // of the new child.
@@ -764,7 +765,7 @@ bool ChildrenManagerImpl::ReplaceChild (
         I->mxAccessibleShape = pNewChild.get();
         mrContext.CommitChange (
             AccessibleEventId::CHILD,
-            uno::Any (I->mxAccessibleShape),
+            uno::Any (uno::Reference<XAccessible>(I->mxAccessibleShape)),
             uno::Any());
 
         return true;
@@ -1026,7 +1027,7 @@ ChildDescriptor::ChildDescriptor (const 
Reference<drawing::XShape>& xShape)
 }
 
 
-ChildDescriptor::ChildDescriptor (const Reference<XAccessible>& 
rxAccessibleShape)
+ChildDescriptor::ChildDescriptor (const rtl::Reference<AccessibleShape>& 
rxAccessibleShape)
     : mxAccessibleShape (rxAccessibleShape),
       mbCreateEventPending (true)
 {
@@ -1036,11 +1037,6 @@ ChildDescriptor::ChildDescriptor (const 
Reference<XAccessible>& rxAccessibleShap
     pAccessibleShape->SetState (AccessibleStateType::VISIBLE);
 }
 
-AccessibleShape* ChildDescriptor::GetAccessibleShape() const
-{
-    return static_cast<AccessibleShape*> (mxAccessibleShape.get());
-}
-
 void ChildDescriptor::setIndexAtAccessibleShape(sal_Int32 _nIndex)
 {
     AccessibleShape* pShape = GetAccessibleShape();
@@ -1056,16 +1052,15 @@ void ChildDescriptor::disposeAccessibleObject 
(AccessibleContextBase& rParent)
 
     // Send event that the shape has been removed.
     uno::Any aOldValue;
-    aOldValue <<= mxAccessibleShape;
+    aOldValue <<= uno::Reference<XAccessible>(mxAccessibleShape);
     rParent.CommitChange (
         AccessibleEventId::CHILD,
         uno::Any(),
         aOldValue);
 
     // Dispose and remove the object.
-    Reference<lang::XComponent> xComponent (mxAccessibleShape, uno::UNO_QUERY);
-    if (xComponent.is())
-        xComponent->dispose ();
+    if (mxAccessibleShape.is())
+        mxAccessibleShape->dispose();
 
     mxAccessibleShape = nullptr;
 }
diff --git a/svx/source/accessibility/ChildrenManagerImpl.hxx 
b/svx/source/accessibility/ChildrenManagerImpl.hxx
index f4105c878f47..20b4ea732b22 100644
--- a/svx/source/accessibility/ChildrenManagerImpl.hxx
+++ b/svx/source/accessibility/ChildrenManagerImpl.hxx
@@ -182,7 +182,7 @@ public:
             The new shape that is added to the list of accessible shapes; must
             be non-null.
     */
-    void AddAccessibleShape 
(css::uno::Reference<css::accessibility::XAccessible> const & shape);
+    void AddAccessibleShape (rtl::Reference<AccessibleShape> const & shape);
 
     /** Clear the lists of accessible shapes and that of visible accessible
         shapes.  The list of UNO shapes is not modified.
@@ -289,7 +289,7 @@ private:
     /** This list of additional accessible shapes that can or shall not be
         created by the shape factory.
     */
-    typedef std::vector< css::uno::Reference< css::accessibility::XAccessible> 
> AccessibleShapeList;
+    typedef std::vector< rtl::Reference< AccessibleShape> > 
AccessibleShapeList;
     AccessibleShapeList maAccessibleShapes;
 
     /** Rectangle that describes the visible area in which a shape has to lie
@@ -426,7 +426,7 @@ public:
         empty and only replaced by a reference to a new object when that is
         requested from the outside.
     */
-    css::uno::Reference<css::accessibility::XAccessible> mxAccessibleShape;
+    rtl::Reference<AccessibleShape> mxAccessibleShape;
 
     /** Return a pointer to the implementation object of the accessible
         shape of this descriptor.
@@ -435,7 +435,7 @@ public:
             shape is empty or it can not be transformed into a pointer to
             the desired class.
     */
-    AccessibleShape* GetAccessibleShape() const;
+    AccessibleShape* GetAccessibleShape() const { return 
mxAccessibleShape.get(); }
 
     /** set the index _nIndex at the accessible shape
         @param  _nIndex
@@ -459,7 +459,7 @@ public:
     /** Create a new descriptor for the specified shape with empty reference
         to the original shape.
     */
-    explicit ChildDescriptor (const 
css::uno::Reference<css::accessibility::XAccessible>& rxAccessibleShape);
+    explicit ChildDescriptor (const rtl::Reference<AccessibleShape>& 
rxAccessibleShape);
 
     /** Dispose the accessible object of this descriptor.  If that object
         does not exist then do nothing.

Reply via email to