summaryrefslogtreecommitdiff
path: root/winaccessibility/source
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2024-04-24 14:39:46 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2024-04-24 23:04:35 +0200
commitd4f6534e8870e8f271984c37ce54a6878f372ae1 (patch)
treea436e84d416170538a3b554ec15b5a471716d2ae /winaccessibility/source
parentb6a8fec62cb7576ac8a94a76ca88256eb4f97695 (diff)
[API CHANGE] a11y: Use XAccessible for relation targets
Use a Sequence of XAccessible rather than its base interface XInterface for AccessibleRelation's TargetSet. As the targets are accessible objects as well, anything other than XAccessible doesn't make much sense. Using XAccessible right away makes that clearer and avoids the need to query the XAccessible interface. (The winaccessibility bridge was already using `static_cast`, relying on the fact that the objects are XAccessibles.) The a11y UNO API is not published, so an API change should be unproblematic. Change-Id: I7f08e98d1ec303d5343d9a7954187cdd71495ebc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166586 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
Diffstat (limited to 'winaccessibility/source')
-rw-r--r--winaccessibility/source/UAccCOM/AccRelation.cxx8
-rw-r--r--winaccessibility/source/UAccCOM/MAccessible.cxx22
2 files changed, 14 insertions, 16 deletions
diff --git a/winaccessibility/source/UAccCOM/AccRelation.cxx b/winaccessibility/source/UAccCOM/AccRelation.cxx
index b866d3f0ba36..4312491595bd 100644
--- a/winaccessibility/source/UAccCOM/AccRelation.cxx
+++ b/winaccessibility/source/UAccCOM/AccRelation.cxx
@@ -80,7 +80,7 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccRelation::get_nTargets(long * nTargets)
if (nTargets == nullptr)
return E_INVALIDARG;
- Sequence< Reference< XInterface > > xTargets = relation.TargetSet;
+ Sequence<Reference<XAccessible>> xTargets = relation.TargetSet;
*nTargets = xTargets.getLength();
return S_OK;
@@ -102,12 +102,12 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccRelation::get_target(long targetIndex, IUn
if (target == nullptr)
return E_FAIL;
- Sequence< Reference< XInterface > > xTargets = relation.TargetSet;
+ Sequence<Reference<XAccessible>> xTargets = relation.TargetSet;
int nCount = xTargets.getLength();
if( targetIndex >= nCount )
return E_FAIL;
- Reference<XAccessible> xRAcc(xTargets[targetIndex], UNO_QUERY);
+ Reference<XAccessible> xRAcc = xTargets[targetIndex];
IAccessible* pRet = CMAccessible::get_IAccessibleFromXAccessible(xRAcc.get());
if (pRet)
{
@@ -139,7 +139,7 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccRelation::get_targets(long, IUnknown * * t
if (nTargets == nullptr)
return E_INVALIDARG;
- Sequence< Reference< XInterface > > xTargets = relation.TargetSet;
+ Sequence<Reference<XAccessible>> xTargets = relation.TargetSet;
int nCount = xTargets.getLength();
*target = static_cast<IUnknown*>(::CoTaskMemAlloc(nCount*sizeof(IUnknown)));
diff --git a/winaccessibility/source/UAccCOM/MAccessible.cxx b/winaccessibility/source/UAccCOM/MAccessible.cxx
index 8694ef418bbc..908c0b5ca527 100644
--- a/winaccessibility/source/UAccCOM/MAccessible.cxx
+++ b/winaccessibility/source/UAccCOM/MAccessible.cxx
@@ -717,12 +717,10 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CMAccessible::get_accKeyboardShortcut(VARIANT
if(paccRelation == nullptr)
return S_FALSE;
- Sequence< Reference< XInterface > > xTargets = paccRelation->TargetSet;
- Reference<XInterface> pRAcc = xTargets[0];
+ Sequence<Reference<XAccessible>> xTargets = paccRelation->TargetSet;
+ Reference<XAccessible> xAcc = xTargets[0];
- XAccessible* pXAcc = static_cast<XAccessible*>(pRAcc.get());
-
- Reference<XAccessibleContext> xLabelContext = pXAcc->getAccessibleContext();
+ Reference<XAccessibleContext> xLabelContext = xAcc->getAccessibleContext();
if (!xLabelContext.is())
return S_FALSE;
@@ -742,8 +740,8 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CMAccessible::get_accKeyboardShortcut(VARIANT
if(paccRelation)
{
xTargets = paccRelation->TargetSet;
- pRAcc = xTargets[0];
- if (m_xAccessible.get() != static_cast<XAccessible*>(pRAcc.get()))
+ xAcc = xTargets[0];
+ if (m_xAccessible.get() != xAcc.get())
return S_FALSE;
}
@@ -1794,8 +1792,8 @@ static XAccessible* getTheParentOfMember(XAccessible* pXAcc)
AccessibleRelation accRelation = pRrelationSet->getRelation(i);
if (accRelation.RelationType == AccessibleRelationType::MEMBER_OF)
{
- Sequence< Reference< XInterface > > xTargets = accRelation.TargetSet;
- return static_cast<XAccessible*>(xTargets[0].get());
+ Sequence<Reference<XAccessible>> xTargets = accRelation.TargetSet;
+ return xTargets[0].get();
}
}
return nullptr;
@@ -1863,15 +1861,15 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CMAccessible::get_groupPosition(long __RPC_FAR
AccessibleRelation accRelation = pRrelationSet->getRelation(i);
if (accRelation.RelationType == AccessibleRelationType::MEMBER_OF)
{
- Sequence< Reference< XInterface > > xTargets = accRelation.TargetSet;
+ Sequence<Reference<XAccessible>> xTargets = accRelation.TargetSet;
- Reference<XInterface> pRAcc = xTargets[0];
+ Reference<XAccessible> xTarget = xTargets[0];
sal_Int64 nChildCount = pRParentContext->getAccessibleChildCount();
assert(nChildCount < std::numeric_limits<long>::max());
for (sal_Int64 j = 0; j< nChildCount; j++)
{
if( getTheParentOfMember(pRParentContext->getAccessibleChild(j).get())
- == static_cast<XAccessible*>(pRAcc.get()) &&
+ == xTarget.get() &&
pRParentContext->getAccessibleChild(j)->getAccessibleContext()->getAccessibleRole() == AccessibleRole::RADIO_BUTTON)
number++;
if (pRParentContext->getAccessibleChild(j).get() == m_xAccessible.get())