[API CHANGE] Pass XAccessible to XAccessibleGroupPosition::getGroupPosition

Instead of passing an XAccessibleContext wrapped in a uno::Any,
pass the XAccessible. This drops an extra level of
wrapping/unwrapping.

The same will be done for XAccessibleGroupPosition::getObjectLink
in an upcoming commit.

Since the XAccessibleGroupPosition interface
(and the UNO a11y API in general) is unpublished
and meant for internal use only, changing it should
be unproblematic.

Change-Id: I5db3a99bb8d78099e3b136cbcd402fe2ae49d49c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211216
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
Michael Weghorn
2026-09-20 22:23:52 +02:00
parent c9aadb8a2e
commit a19da3e1cd
6 changed files with 13 additions and 15 deletions
+2 -2
View File
@@ -128,8 +128,8 @@ public:
/// Return this object's role. /// Return this object's role.
virtual sal_Int16 SAL_CALL getAccessibleRole() override; virtual sal_Int16 SAL_CALL getAccessibleRole() override;
//===== XAccessibleGroupPosition ========================================= //===== XAccessibleGroupPosition =========================================
virtual css::uno::Sequence< sal_Int32 > SAL_CALL virtual css::uno::Sequence<sal_Int32> SAL_CALL getGroupPosition(
getGroupPosition( const css::uno::Any& rAny ) override; const css::uno::Reference<css::accessibility::XAccessible>& rxAccessible) override;
virtual OUString SAL_CALL getObjectLink( const css::uno::Any& accoject ) override; virtual OUString SAL_CALL getObjectLink( const css::uno::Any& accoject ) override;
/** The destructor releases its children manager and text engine if /** The destructor releases its children manager and text engine if
still existent. These are responsible to send appropriate events. still existent. These are responsible to send appropriate events.
@@ -22,7 +22,7 @@ module com { module sun { module star { module accessibility {
interface XAccessibleGroupPosition : ::com::sun::star::uno::XInterface interface XAccessibleGroupPosition : ::com::sun::star::uno::XInterface
{ {
/* Returns the group position of the object */ /* Returns the group position of the object */
sequence<long> getGroupPosition( [in] any accoject ) raises (::com::sun::star::lang::IndexOutOfBoundsException); sequence<long> getGroupPosition( [in] XAccessible accObject ) raises (::com::sun::star::lang::IndexOutOfBoundsException);
/* Returns the hyperlink URL info of the object */ /* Returns the hyperlink URL info of the object */
string getObjectLink( [in] any accoject ) raises (::com::sun::star::lang::IndexOutOfBoundsException); string getObjectLink( [in] any accoject ) raises (::com::sun::star::lang::IndexOutOfBoundsException);
@@ -389,8 +389,8 @@ sal_Bool SAL_CALL AccessibleDrawDocumentView::supportsService(const OUString& rS
} }
//===== XAccessibleGroupPosition ========================================= //===== XAccessibleGroupPosition =========================================
uno::Sequence< sal_Int32 > SAL_CALL uno::Sequence<sal_Int32> SAL_CALL AccessibleDrawDocumentView::getGroupPosition(
AccessibleDrawDocumentView::getGroupPosition( const uno::Any& rAny ) const css::uno::Reference<css::accessibility::XAccessible>& rxAccessible)
{ {
SolarMutexGuard g; SolarMutexGuard g;
@@ -400,13 +400,11 @@ uno::Sequence< sal_Int32 > SAL_CALL
// [2] the position of the object in the group // [2] the position of the object in the group
uno::Sequence< sal_Int32 > aRet( 3 ); uno::Sequence< sal_Int32 > aRet( 3 );
//get the xShape of the current selected drawing object //get the xShape of the current selected drawing object
uno::Reference<XAccessibleContext> xAccContent; if (!rxAccessible.is())
rAny >>= xAccContent;
if ( !xAccContent.is() )
{ {
return aRet; return aRet;
} }
AccessibleShape* pAcc = comphelper::getFromUnoTunnel<AccessibleShape>( xAccContent ); AccessibleShape* pAcc = comphelper::getFromUnoTunnel<AccessibleShape>(rxAccessible);
if ( !pAcc ) if ( !pAcc )
{ {
return aRet; return aRet;
@@ -79,8 +79,8 @@ public:
propertyChange (const css::beans::PropertyChangeEvent& rEventObject) override; propertyChange (const css::beans::PropertyChangeEvent& rEventObject) override;
//===== XAccessibleGroupPosition ========================================= //===== XAccessibleGroupPosition =========================================
virtual css::uno::Sequence< sal_Int32 > SAL_CALL virtual css::uno::Sequence<sal_Int32> SAL_CALL getGroupPosition(
getGroupPosition( const css::uno::Any& rAny ) override; const css::uno::Reference<css::accessibility::XAccessible>& rxAccessible) override;
virtual OUString SAL_CALL getObjectLink( const css::uno::Any& accoject ) override; virtual OUString SAL_CALL getObjectLink( const css::uno::Any& accoject ) override;
private: private:
+3 -3
View File
@@ -993,8 +993,8 @@ struct XShapePosCompareHelper
//end of group position //end of group position
// XAccessibleGroupPosition // XAccessibleGroupPosition
uno::Sequence< sal_Int32 > SAL_CALL uno::Sequence<sal_Int32> SAL_CALL
AccessibleShape::getGroupPosition( const uno::Any& ) AccessibleShape::getGroupPosition(const css::uno::Reference<css::accessibility::XAccessible>&)
{ {
// we will return the: // we will return the:
// [0] group level // [0] group level
@@ -1033,7 +1033,7 @@ AccessibleShape::getGroupPosition( const uno::Any& )
Reference< XAccessibleGroupPosition > xGroupPosition( xParent,uno::UNO_QUERY ); Reference< XAccessibleGroupPosition > xGroupPosition( xParent,uno::UNO_QUERY );
if ( xGroupPosition.is() ) if ( xGroupPosition.is() )
{ {
aRet = xGroupPosition->getGroupPosition( uno::Any( getAccessibleContext() ) ); aRet = xGroupPosition->getGroupPosition(this);
} }
return aRet; return aRet;
} }
@@ -1809,7 +1809,7 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CMAccessible::get_groupPosition(long __RPC_FAR
Reference< XAccessibleGroupPosition > xGroupPosition( pRContext, UNO_QUERY ); Reference< XAccessibleGroupPosition > xGroupPosition( pRContext, UNO_QUERY );
if ( xGroupPosition.is() ) if ( xGroupPosition.is() )
{ {
Sequence< sal_Int32 > rSeq = xGroupPosition->getGroupPosition( Any( pRContext ) ); Sequence<sal_Int32> rSeq = xGroupPosition->getGroupPosition(m_xAccessible);
if (rSeq.getLength() >= 3) if (rSeq.getLength() >= 3)
{ {
*groupLevel = rSeq[0]; *groupLevel = rSeq[0];