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.weghorn@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.weghorn@posteo.de>
Tested-by: Jenkins
This commit is contained in:
Michael Weghorn
2024-12-12 23:00:05 +01:00
parent 6a68b96c6a
commit bbc2823f58
6 changed files with 4 additions and 45 deletions
@@ -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();
@@ -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;
-10
View File
@@ -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);
}
@@ -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;
};
@@ -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
@@ -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);