sw a11y: Use OAccessible lcl_getSelectedState

Call SwAccessibleMap::GetContextImpl instead of
SwAccessibleMap::GetContex to get a more concrete
type that subclasses OAccessible and switch the
local variable to that type.

Drop a now redundant call to OAccessible::getAccessibleContext
as that returns a reference to self.

Change-Id: Ib85c98c7b803297775131c333d1cde9e625cb98f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210617
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
This commit is contained in:
Michael Weghorn
2026-09-10 18:32:07 +02:00
parent 571fd28f4d
commit 91e9aa7c3f
+5 -8
View File
@@ -101,22 +101,19 @@ static bool lcl_getSelectedState(const SwAccessibleChild& aChild,
SwAccessibleContext* pContext,
SwAccessibleMap* pMap)
{
Reference< XAccessible > xAcc;
rtl::Reference<comphelper::OAccessible> pAcc;
if ( aChild.GetSwFrame() )
{
xAcc = pMap->GetContext( aChild.GetSwFrame(), false );
pAcc = pMap->GetContextImpl(aChild.GetSwFrame(), false);
}
else if ( aChild.GetDrawObject() )
{
xAcc = pMap->GetContext( aChild.GetDrawObject(), pContext, false );
pAcc = pMap->GetContextImpl(aChild.GetDrawObject(), pContext, false);
}
if( xAcc.is() )
if (pAcc.is())
{
Reference< XAccessibleContext > pRContext = xAcc->getAccessibleContext();
if(!pRContext.is())
return false;
sal_Int64 nRStateSet = pRContext->getAccessibleStateSet();
sal_Int64 nRStateSet = pAcc->getAccessibleStateSet();
if(nRStateSet & AccessibleStateType::SELECTED)
return true;
}