forms/source/solar/component/navbarcontrol.cxx | 8 --- forms/source/solar/component/navbarcontrol.hxx | 3 - include/toolkit/awt/vclxwindow.hxx | 11 ---- svx/source/fmcomp/fmgridif.cxx | 3 - toolkit/source/awt/animatedimagespeer.cxx | 3 - toolkit/source/awt/vclxtoolkit.cxx | 2 toolkit/source/awt/vclxwindow.cxx | 65 ------------------------- toolkit/source/awt/vclxwindows.cxx | 11 ---- toolkit/source/controls/svtxgridcontrol.cxx | 3 - 9 files changed, 5 insertions(+), 104 deletions(-)
New commits: commit 7c351954ce2129b4af81646e160eb2e83a84d0f5 Author: Michael Weghorn <[email protected]> AuthorDate: Mon May 26 10:29:46 2025 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Thu Jun 19 21:31:57 2025 +0200 a11y: Drop a11y logic from VCLXWindow While accessibility logic for vcl::Window and subclasses was previously split between vcl::Window and VCLXWindow, vcl::Window now takes care of everything to create an XAccessible without involving VCLXWindow now after Change-Id: I25de1ab0f8b47b12346abd01bad05cb54fb75f52 Author: Michael Weghorn <[email protected]> Date: Mon May 26 09:45:11 2025 +0200 vcl a11y: Let vcl::Window create accessible directly, drop a11y factory (and previous changes for vcl::Window subclasses). Therefore, drop the remaining a11y logic from VCLXWindow. No longer let it implement the XAccessible and XEventListener interfaces. The latter was only implemented to clear the reference to the accessible context in VCLXWindow::disposing, but VCLXWindow now no longer holds such a reference with this commit in place. Drop calls to (the now nonexistent) VCLXWindow::disposing in subclasses (and drop overrides now only calling base class methods from another subclass). vcl::Window::dispose already takes care of disposing the window's XAccessible, so disposing the XAccessibleContext in VCLXWindow::dispose is no more needed. (VCLXAccessibleComponent implements both, the XAccessible and XAccessibleContext interfaces.) Change-Id: Ided896abdc84cfbbf883621020169699a37cf6df Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185844 Reviewed-by: Michael Weghorn <[email protected]> Tested-by: Jenkins diff --git a/forms/source/solar/component/navbarcontrol.cxx b/forms/source/solar/component/navbarcontrol.cxx index 266e3c1a5a90..c4dfb622304d 100644 --- a/forms/source/solar/component/navbarcontrol.cxx +++ b/forms/source/solar/component/navbarcontrol.cxx @@ -455,14 +455,6 @@ namespace frm // this will connect if not already connected and just update else } - - void SAL_CALL ONavigationBarPeer::disposing( const EventObject& _rSource ) - { - VCLXWindow::disposing( _rSource ); - OFormNavigationHelper::disposing( _rSource ); - } - - void ONavigationBarPeer::getSupportedFeatures( ::std::vector< sal_Int16 >& _rFeatureIds ) { _rFeatureIds.push_back( FormFeature::MoveAbsolute ); diff --git a/forms/source/solar/component/navbarcontrol.hxx b/forms/source/solar/component/navbarcontrol.hxx index e6e8cc1fe563..8dd889068e17 100644 --- a/forms/source/solar/component/navbarcontrol.hxx +++ b/forms/source/solar/component/navbarcontrol.hxx @@ -108,9 +108,6 @@ namespace frm void SAL_CALL setProperty( const OUString& _rPropertyName, const css::uno::Any& _rValue ) override; css::uno::Any SAL_CALL getProperty( const OUString& _rPropertyName ) override; - // XEventListener - virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; - // OFormNavigationHelper overriables virtual void interceptorsChanged( ) override; virtual void featureStateChanged( sal_Int16 _nFeatureId, bool _bEnabled ) override; diff --git a/include/toolkit/awt/vclxwindow.hxx b/include/toolkit/awt/vclxwindow.hxx index f8a495887866..c53e27eebe87 100644 --- a/include/toolkit/awt/vclxwindow.hxx +++ b/include/toolkit/awt/vclxwindow.hxx @@ -28,7 +28,6 @@ #include <com/sun/star/awt/XLayoutConstrains.hpp> #include <com/sun/star/awt/XView.hpp> #include <com/sun/star/beans/XPropertySetInfo.hpp> -#include <com/sun/star/accessibility/XAccessible.hpp> #include <com/sun/star/awt/XDockableWindow.hpp> #include <com/sun/star/awt/XStyleSettingsSupplier.hpp> @@ -42,7 +41,6 @@ #include <functional> template <class ListenerT> class ListenerMultiplexerBase; -namespace com::sun::star::accessibility { class XAccessibleContext; } namespace com::sun::star::awt { class XTopWindowListener; } namespace com::sun::star::awt { class XVclContainerListener; } namespace vcl { class Window; } @@ -58,8 +56,6 @@ typedef cppu::ImplInheritanceHelper< VCLXDevice, css::awt::XLayoutConstrains, css::awt::XView, css::awt::XDockableWindow, - css::accessibility::XAccessible, - css::lang::XEventListener, css::beans::XPropertySetInfo, css::awt::XStyleSettingsSupplier > VCLXWindow_Base; @@ -76,7 +72,6 @@ protected: DECL_DLLPRIVATE_LINK(WindowEventListener, VclWindowEvent&, void ); virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); - static css::uno::Reference<css::accessibility::XAccessibleContext> CreateAccessibleContext(); void SetSynthesizingVCLEvent( bool b ); bool IsSynthesizingVCLEvent() const; @@ -132,9 +127,6 @@ public: bool IsDisposed() const; - // css::lang::XEventListener - virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; - // css::lang::XComponent void SAL_CALL dispose( ) override; void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& rxListener ) override; @@ -189,9 +181,6 @@ public: void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) override; void SAL_CALL setZoom( float fZoomX, float fZoomY ) override; - // css::accessibility::XAccessible - css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override; - // css::awt::XDockableWindow void SAL_CALL addDockableWindowListener( const css::uno::Reference< css::awt::XDockableWindowListener >& xListener ) override; void SAL_CALL removeDockableWindowListener( const css::uno::Reference< css::awt::XDockableWindowListener >& xListener ) override; diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx index 6e5594054364..d3964dbcc0e5 100644 --- a/svx/source/fmcomp/fmgridif.cxx +++ b/svx/source/fmcomp/fmgridif.cxx @@ -1113,9 +1113,6 @@ void FmXGridPeer::disposing(const EventObject& e) } } } - - if ( !bKnownSender ) - VCLXWindow::disposing(e); } diff --git a/toolkit/source/awt/animatedimagespeer.cxx b/toolkit/source/awt/animatedimagespeer.cxx index 8c4be5b324c2..836da6aa52a3 100644 --- a/toolkit/source/awt/animatedimagespeer.cxx +++ b/toolkit/source/awt/animatedimagespeer.cxx @@ -343,9 +343,8 @@ namespace toolkit } - void SAL_CALL AnimatedImagesPeer::disposing( const EventObject& i_event ) + void SAL_CALL AnimatedImagesPeer::disposing(const EventObject&) { - VCLXWindow::disposing( i_event ); } diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx index b2faa296c8aa..bdb8ebb83a6a 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -1088,7 +1088,7 @@ class SVTXRoadmap final : public SVTXRoadmap_Base public: SVTXRoadmap(); - void SAL_CALL disposing( const css::lang::EventObject& Source ) override { VCLXWindow::disposing( Source ); } + void SAL_CALL disposing(const css::lang::EventObject&) override { } // css::awt::XVclWindowPeer void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override; diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx index bca4764f9b85..4a537b3fa57b 100644 --- a/toolkit/source/awt/vclxwindow.cxx +++ b/toolkit/source/awt/vclxwindow.cxx @@ -123,9 +123,6 @@ public: std::unique_ptr<UnoPropertyArrayHelper> mpPropHelper; - - css::uno::Reference< css::accessibility::XAccessibleContext > - mxAccessibleContext; css::uno::Reference< css::awt::XGraphics > mxViewGraphics; rtl::Reference< toolkit::WindowStyleSettings > @@ -858,12 +855,6 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) } } -uno::Reference< accessibility::XAccessibleContext > VCLXWindow::CreateAccessibleContext() -{ - assert(false && "This code path shouldn't be reached any more."); - return {}; -} - void VCLXWindow::SetSynthesizingVCLEvent( bool _b ) { mpImpl->mbSynthesizingVCLEvent = _b; @@ -912,21 +903,6 @@ void VCLXWindow::dispose( ) SetOutputDevice( nullptr ); pWindow.disposeAndClear(); } - - // #i14103# dispose the accessible context after the window has been destroyed, - // otherwise the old value in the child event fired in VCLXAccessibleComponent::ProcessWindowEvent() - // for VclEventId::WindowChildDestroyed contains a reference to an already disposed accessible object - try - { - css::uno::Reference< css::lang::XComponent > xComponent( mpImpl->mxAccessibleContext, css::uno::UNO_QUERY ); - if ( xComponent.is() ) - xComponent->dispose(); - } - catch ( const css::uno::Exception& ) - { - OSL_FAIL( "VCLXWindow::dispose: could not dispose the accessible context!" ); - } - mpImpl->mxAccessibleContext.clear(); } void VCLXWindow::addEventListener( const css::uno::Reference< css::lang::XEventListener >& rxListener ) @@ -2380,47 +2356,6 @@ void VCLXWindow::setZoom( float fZoomX, float /*fZoomY*/ ) } } -// css::lang::XEventListener -void SAL_CALL VCLXWindow::disposing( const css::lang::EventObject& _rSource ) -{ - SolarMutexGuard aGuard; - - if (mpImpl->mbDisposing) - return; - - // check if it comes from our AccessibleContext - uno::Reference< uno::XInterface > aAC( mpImpl->mxAccessibleContext, uno::UNO_QUERY ); - uno::Reference< uno::XInterface > xSource( _rSource.Source, uno::UNO_QUERY ); - - if ( aAC.get() == xSource.get() ) - { // yep, it does - mpImpl->mxAccessibleContext.clear(); - } -} - -// css::accessibility::XAccessible -css::uno::Reference< css::accessibility::XAccessibleContext > VCLXWindow::getAccessibleContext( ) -{ - SolarMutexGuard aGuard; - - // already disposed - if (mpImpl->mbDisposing) - return uno::Reference< accessibility::XAccessibleContext >(); - - if ( !mpImpl->mxAccessibleContext.is() && GetWindow() ) - { - mpImpl->mxAccessibleContext = CreateAccessibleContext(); - - // add as event listener to this component - // in case somebody disposes it, we do not want to have a reference to a dead object - uno::Reference< lang::XComponent > xComp( mpImpl->mxAccessibleContext, uno::UNO_QUERY ); - if ( xComp.is() ) - xComp->addEventListener( this ); - } - - return mpImpl->mxAccessibleContext; -} - // css::awt::XDockable void SAL_CALL VCLXWindow::addDockableWindowListener( const css::uno::Reference< css::awt::XDockableWindowListener >& xListener ) { diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index 1c62f4983b87..6284aa509dae 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -2120,15 +2120,11 @@ void SAL_CALL VCLXListBox::itemListChanged( const EventObject& i_rEvent ) } } -void SAL_CALL VCLXListBox::disposing( const EventObject& i_rEvent ) +void SAL_CALL VCLXListBox::disposing(const EventObject&) { - // just disambiguate - VCLXWindow::disposing( i_rEvent ); } - - void VCLXMessageBox::GetPropertyIds( std::vector< sal_uInt16 > &rIds ) { VCLXTopWindow::ImplGetPropertyIds( rIds ); @@ -4416,14 +4412,11 @@ void SAL_CALL VCLXComboBox::itemListChanged( const EventObject& i_rEvent ) lcl_getImageFromURL(rItem.Second)); } } -void SAL_CALL VCLXComboBox::disposing( const EventObject& i_rEvent ) +void SAL_CALL VCLXComboBox::disposing(const EventObject&) { - // just disambiguate - VCLXEdit::disposing( i_rEvent ); } - void VCLXFormattedSpinField::ImplGetPropertyIds( std::vector< sal_uInt16 > &rIds ) { // Interestingly in the UnoControl API this is diff --git a/toolkit/source/controls/svtxgridcontrol.cxx b/toolkit/source/controls/svtxgridcontrol.cxx index 33468dd3c3f2..93300befe99b 100644 --- a/toolkit/source/controls/svtxgridcontrol.cxx +++ b/toolkit/source/controls/svtxgridcontrol.cxx @@ -665,9 +665,8 @@ void SAL_CALL SVTXGridControl::elementReplaced( const ContainerEvent& ) } -void SAL_CALL SVTXGridControl::disposing( const EventObject& Source ) +void SAL_CALL SVTXGridControl::disposing(const EventObject&) { - VCLXWindow::disposing( Source ); }
