comphelper/source/misc/accessiblecomponenthelper.cxx | 13 ------------- include/comphelper/accessiblecomponenthelper.hxx | 16 ---------------- svx/source/accessibility/charmapacc.cxx | 10 ---------- toolkit/inc/controls/accessiblecontrolcontext.hxx | 2 ++ toolkit/source/awt/vclxaccessiblecomponent.cxx | 3 --- toolkit/source/controls/accessiblecontrolcontext.cxx | 5 ++--- 6 files changed, 4 insertions(+), 45 deletions(-)
New commits: commit bbc2823f58aa2deab47be4951a43379d1228d251 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Thu Dec 12 11:39:59 2024 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Thu Dec 12 23:00:05 2024 +0100 a11y: Move OCommonAccessibleComponent::m_aCreator to subclass Move this member holding a weak reference to the XAccessible that created the context to the OAccessibleControlContext subclass, which is the only one making use of it now after previous commit Change-Id: I29fb7cd42512a02fc1cc56835bb83f847e9ec0fd Author: Michael Weghorn <m.wegh...@posteo.de> Date: Thu Dec 12 11:08:54 2024 +0100 tdf#164294 a11y: Don't rely on "creator" to determine child index This also removes the need to call OCommonAccessibleComponent::lateInit in those subclasses that did so previously. Change-Id: I3edd14810feb6c884b4e67db1f76b40ae003dffa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178355 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/comphelper/source/misc/accessiblecomponenthelper.cxx b/comphelper/source/misc/accessiblecomponenthelper.cxx index e9b7ae39818e..de523cbbda55 100644 --- a/comphelper/source/misc/accessiblecomponenthelper.cxx +++ b/comphelper/source/misc/accessiblecomponenthelper.cxx @@ -151,19 +151,6 @@ namespace comphelper } } - - void OCommonAccessibleComponent::lateInit( const Reference< XAccessible >& _rxAccessible ) - { - m_aCreator = _rxAccessible; - } - - - Reference< XAccessible > OCommonAccessibleComponent::getAccessibleCreator( ) const - { - return m_aCreator; - } - - OUString SAL_CALL OCommonAccessibleComponent::getAccessibleId( ) { return OUString(); diff --git a/include/comphelper/accessiblecomponenthelper.hxx b/include/comphelper/accessiblecomponenthelper.hxx index 3adf81c9c97f..55cb5703d596 100644 --- a/include/comphelper/accessiblecomponenthelper.hxx +++ b/include/comphelper/accessiblecomponenthelper.hxx @@ -50,7 +50,6 @@ namespace comphelper { friend class OContextEntryGuard; private: - css::uno::WeakReference< css::accessibility::XAccessible > m_aCreator; // the XAccessible which created our XAccessibleContext AccessibleEventNotifier::TClientId m_nClientId; protected: @@ -58,21 +57,6 @@ namespace comphelper OCommonAccessibleComponent( ); - /** late construction - @param _rxAccessible - the Accessible object which created this context. - <p>If your derived implementation implements the XAccessible (and does not follow the proposed - separation of XAccessible from XAccessibleContext), you may pass <code>this</code> here.</p> - - <p>The object is hold weak, so its life time is not affected.</p> - */ - void lateInit( const css::uno::Reference< css::accessibility::XAccessible >& _rxAccessible ); - - /** retrieves the creator previously set with <method>lateInit</method> - */ - css::uno::Reference< css::accessibility::XAccessible > - getAccessibleCreator( ) const; - public: // XAccessibleEventBroadcaster virtual void SAL_CALL addAccessibleEventListener( const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override final; diff --git a/svx/source/accessibility/charmapacc.cxx b/svx/source/accessibility/charmapacc.cxx index 0f1fbf2b7f42..616e3af9a23a 100644 --- a/svx/source/accessibility/charmapacc.cxx +++ b/svx/source/accessibility/charmapacc.cxx @@ -68,11 +68,6 @@ const rtl::Reference<SvxShowCharSetItemAcc> & SvxShowCharSetItem::GetAccessible( SvxShowCharSetAcc::SvxShowCharSetAcc(SvxShowCharSet* pParent) : m_pParent(pParent) { - osl_atomic_increment(&m_refCount); - { - lateInit(this); - } - osl_atomic_decrement(&m_refCount); } SvxShowCharSetAcc::~SvxShowCharSetAcc() @@ -365,11 +360,6 @@ sal_Int32 SAL_CALL SvxShowCharSetAcc::getAccessibleColumn( sal_Int64 nChildIndex SvxShowCharSetItemAcc::SvxShowCharSetItemAcc( SvxShowCharSetItem* pParent ) : mpParent( pParent ) { OSL_ENSURE(pParent,"NO parent supplied!"); - osl_atomic_increment(&m_refCount); - { // #b6211265 # - lateInit(this); - } - osl_atomic_decrement(&m_refCount); } diff --git a/toolkit/inc/controls/accessiblecontrolcontext.hxx b/toolkit/inc/controls/accessiblecontrolcontext.hxx index a61cf8a30227..e68236823113 100644 --- a/toolkit/inc/controls/accessiblecontrolcontext.hxx +++ b/toolkit/inc/controls/accessiblecontrolcontext.hxx @@ -96,6 +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; }; diff --git a/toolkit/source/awt/vclxaccessiblecomponent.cxx b/toolkit/source/awt/vclxaccessiblecomponent.cxx index f5745eee123a..ba136aac3360 100644 --- a/toolkit/source/awt/vclxaccessiblecomponent.cxx +++ b/toolkit/source/awt/vclxaccessiblecomponent.cxx @@ -53,9 +53,6 @@ VCLXAccessibleComponent::VCLXAccessibleComponent( VCLXWindow* pVCLXWindow ) m_xEventSource->AddEventListener( LINK( this, VCLXAccessibleComponent, WindowEventListener ) ); m_xEventSource->AddChildEventListener( LINK( this, VCLXAccessibleComponent, WindowChildEventListener ) ); } - - // announce the XAccessible of our creator to the base class - lateInit( pVCLXWindow ); } VCLXWindow* VCLXAccessibleComponent::GetVCLXWindow() const diff --git a/toolkit/source/controls/accessiblecontrolcontext.cxx b/toolkit/source/controls/accessiblecontrolcontext.cxx index 220383037f47..c15876e8247d 100644 --- a/toolkit/source/controls/accessiblecontrolcontext.cxx +++ b/toolkit/source/controls/accessiblecontrolcontext.cxx @@ -58,8 +58,7 @@ namespace toolkit // start listening at the model startModelListening(); - // announce the XAccessible to our base class - comphelper::OAccessibleComponentHelper::lateInit(rxCreator); + m_aCreator = rxCreator; } @@ -200,7 +199,7 @@ namespace toolkit vcl::Window* OAccessibleControlContext::implGetWindow( Reference< awt::XWindow >* _pxUNOWindow ) const { - Reference< awt::XControl > xControl( getAccessibleCreator(), UNO_QUERY ); + Reference<awt::XControl> xControl(m_aCreator.get(), UNO_QUERY); Reference< awt::XWindow > xWindow; if ( xControl.is() ) xWindow.set(xControl->getPeer(), css::uno::UNO_QUERY);