summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2024-12-12 11:58:34 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2024-12-12 23:00:23 +0100
commitadd40b532e004048f17d3f3e3b9f63dcc039e938 (patch)
treebe398fc7a9731ef4e1c3182906e2f26c07df4d9b /toolkit
parentbbc2823f58aa2deab47be4951a43379d1228d251 (diff)
toolkit a11y: Pass the XControl ref right away
Instead of passing/using a Reference<XAccessible> and querying that one for the XControl interface in the OAccessibleControlContext ctor and in OAccessibleControlContext::implGetWindow, pass (and remember) the control via a Reference<XControl> right away. Change-Id: I0a9e15cda37bf42ff06f00ef3f49efacf2992043 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178356 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/inc/controls/accessiblecontrolcontext.hxx14
-rw-r--r--toolkit/source/controls/accessiblecontrolcontext.cxx17
2 files changed, 15 insertions, 16 deletions
diff --git a/toolkit/inc/controls/accessiblecontrolcontext.hxx b/toolkit/inc/controls/accessiblecontrolcontext.hxx
index e68236823113..4ab60f8be207 100644
--- a/toolkit/inc/controls/accessiblecontrolcontext.hxx
+++ b/toolkit/inc/controls/accessiblecontrolcontext.hxx
@@ -25,6 +25,7 @@
#include <rtl/ref.hxx>
namespace vcl { class Window; }
+namespace com::sun::star::awt { class XControl; }
namespace com::sun::star::awt { class XWindow; }
namespace com::sun::star::beans { class XPropertySet; }
namespace com::sun::star::beans { class XPropertySetInfo; }
@@ -46,12 +47,11 @@ namespace toolkit
{
public:
/** creates an accessible context for a uno control
- @param _rxCreator
- the uno control's XAccessible interface. This must be an XControl, from which an XControlModel
- can be retrieved.
+ @param rxControl
+ the uno control. This must be an XControl from which an XControlModel can be retrieved.
*/
static rtl::Reference<OAccessibleControlContext> create(
- const css::uno::Reference< css::accessibility::XAccessible >& _rxCreator
+ const css::uno::Reference<css::awt::XControl>& rxControl
);
private:
@@ -86,7 +86,7 @@ namespace toolkit
vcl::Window* implGetWindow( css::uno::Reference< css::awt::XWindow >* _pxUNOWindow = nullptr ) const;
- OAccessibleControlContext(const css::uno::Reference<css::accessibility::XAccessible>& rxCreator);
+ OAccessibleControlContext(const css::uno::Reference<css::awt::XControl>& rxControl);
virtual ~OAccessibleControlContext() override;
// OCommonAccessibleComponent overridables
@@ -96,8 +96,8 @@ namespace toolkit
m_xControlModel; // the model of the control which's context we implement
css::uno::Reference< css::beans::XPropertySetInfo >
m_xModelPropsInfo; // the cached property set info of the model
- // the XAccessible which created our XAccessibleContext
- css::uno::WeakReference<css::accessibility::XAccessible> m_aCreator;
+ // the XControl whose XAccessibleContext this OAccessibleControlContext is
+ css::uno::WeakReference<css::awt::XControl> m_aControl;
};
diff --git a/toolkit/source/controls/accessiblecontrolcontext.cxx b/toolkit/source/controls/accessiblecontrolcontext.cxx
index c15876e8247d..28c25e3058f4 100644
--- a/toolkit/source/controls/accessiblecontrolcontext.cxx
+++ b/toolkit/source/controls/accessiblecontrolcontext.cxx
@@ -46,11 +46,10 @@ namespace toolkit
//= OAccessibleControlContext
- OAccessibleControlContext::OAccessibleControlContext(const Reference< XAccessible >& rxCreator)
+ OAccessibleControlContext::OAccessibleControlContext(const css::uno::Reference<css::awt::XControl>& rxControl)
{
- Reference<awt::XControl> xControl(rxCreator, UNO_QUERY);
- if ( xControl.is() )
- m_xControlModel.set(xControl->getModel(), css::uno::UNO_QUERY);
+ if (rxControl.is())
+ m_xControlModel.set(rxControl->getModel(), css::uno::UNO_QUERY);
OSL_ENSURE( m_xControlModel.is(), "OAccessibleControlContext::Init: invalid creator (no control, or control without model!" );
if ( !m_xControlModel.is() )
throw DisposedException(); // caught by the caller (the create method)
@@ -58,7 +57,7 @@ namespace toolkit
// start listening at the model
startModelListening();
- m_aCreator = rxCreator;
+ m_aControl = rxControl;
}
@@ -68,16 +67,16 @@ namespace toolkit
}
- rtl::Reference<OAccessibleControlContext> OAccessibleControlContext::create( const Reference< XAccessible >& _rxCreator )
+ rtl::Reference<OAccessibleControlContext> OAccessibleControlContext::create(const Reference<awt::XControl>& rXControl)
{
rtl::Reference<OAccessibleControlContext> pNew;
try
{
- pNew = new OAccessibleControlContext(_rxCreator);
+ pNew = new OAccessibleControlContext(rXControl);
}
catch( const Exception& )
{
- TOOLS_WARN_EXCEPTION( "toolkit", "OAccessibleControlContext::create: caught an exception from the late ctor!" );
+ TOOLS_WARN_EXCEPTION( "toolkit", "OAccessibleControlContext::create: caught an exception in ctor!" );
}
return pNew;
}
@@ -199,7 +198,7 @@ namespace toolkit
vcl::Window* OAccessibleControlContext::implGetWindow( Reference< awt::XWindow >* _pxUNOWindow ) const
{
- Reference<awt::XControl> xControl(m_aCreator.get(), UNO_QUERY);
+ Reference<awt::XControl> xControl(m_aControl);
Reference< awt::XWindow > xWindow;
if ( xControl.is() )
xWindow.set(xControl->getPeer(), css::uno::UNO_QUERY);