[API CHANGE] a11y: Switch AccessibleRelationType to enum

Switch css::accessibility::AccessibleRelationType
from integer constants to an enum.

This provides more type safety and improves the debugging
experience, e.g. GDB now prints

    com::sun::accessibility::AccessibleRelationType::AccessibleRelationType_CONTENT_FLOWS_TO

instead of just "2" when printing the value of a
corresponding variable, so it's no longer necessary
to manually look up what constant has that integer
value to know what relation this refers to.

offapi/com/sun/star/accessibility/AccessibleRelationType.idl
had this comment:

> <p>We are using constants instead of a more typesafe enum.  The reason
> for this is that IDL enums may not be extended.  Therefore, in order to
> include future extensions to the set of roles we have to use constants
> here.</p>

However, the a11y UNO API is internal (not published),
so that shouldn't be a concern.

Change-Id: I44a7d56cb085dc24effb24fcd34bb222b78ef4cd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176153
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
This commit is contained in:
Michael Weghorn 2024-11-06 18:54:12 +01:00
parent f0d8873f51
commit 92a36bbd4f
45 changed files with 278 additions and 274 deletions

View file

@ -466,7 +466,7 @@ namespace accessibility
rtl::Reference<utl::AccessibleRelationSetHelper> pRelationSetHelper = new utl::AccessibleRelationSetHelper;
Sequence<Reference<XAccessible>> aSequence { xParent };
pRelationSetHelper->AddRelation(
AccessibleRelation( AccessibleRelationType::NODE_CHILD_OF, aSequence ) );
AccessibleRelation( AccessibleRelationType_NODE_CHILD_OF, aSequence ) );
xRelSet = pRelationSetHelper;
}
return xRelSet;

View file

@ -1302,14 +1302,14 @@ Document::retrieveParagraphRelationSet( Paragraph const * pParagraph )
if (nPara > m_nVisibleBegin && nPara < m_nVisibleEnd)
{
css::uno::Sequence<css::uno::Reference<css::accessibility::XAccessible>> aSequence { getAccessibleChild(getIter(nPara - 1)) };
css::accessibility::AccessibleRelation aRelation( css::accessibility::AccessibleRelationType::CONTENT_FLOWS_FROM, aSequence );
css::accessibility::AccessibleRelation aRelation(css::accessibility::AccessibleRelationType_CONTENT_FLOWS_FROM, aSequence);
pRelationSetHelper->AddRelation( aRelation );
}
if (nPara >= m_nVisibleBegin && m_nVisibleEnd > 1 && nPara < m_nVisibleEnd - 1)
{
css::uno::Sequence<css::uno::Reference<css::accessibility::XAccessible>> aSequence { getAccessibleChild(getIter(nPara + 1)) };
css::accessibility::AccessibleRelation aRelation( css::accessibility::AccessibleRelationType::CONTENT_FLOWS_TO, aSequence );
css::accessibility::AccessibleRelation aRelation( css::accessibility::AccessibleRelationType_CONTENT_FLOWS_TO, aSequence );
pRelationSetHelper->AddRelation( aRelation );
}
@ -1374,7 +1374,7 @@ void Document::FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& r
if( getAccessibleParent()->getAccessibleContext()->getAccessibleRole() == css::accessibility::AccessibleRole::SCROLL_PANE )
{
css::uno::Sequence<css::uno::Reference<css::accessibility::XAccessible>> aSequence { getAccessibleParent() };
rRelationSet.AddRelation( css::accessibility::AccessibleRelation( css::accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) );
rRelationSet.AddRelation( css::accessibility::AccessibleRelation( css::accessibility::AccessibleRelationType_MEMBER_OF, aSequence ) );
}
else
{

View file

@ -25,8 +25,8 @@
namespace uno = ::com::sun::star::uno;
using namespace com::sun::star::accessibility;
using ::com::sun::star::accessibility::AccessibleRelation;
namespace AccessibleRelationType = ::com::sun::star::accessibility::AccessibleRelationType;
void FloatingWindowAccessible::FillAccessibleRelationSet(utl::AccessibleRelationSetHelper& rRelationSet)
{
@ -37,7 +37,7 @@ void FloatingWindowAccessible::FillAccessibleRelationSet(utl::AccessibleRelation
if( pParentWindow )
{
uno::Sequence<uno::Reference<css::accessibility::XAccessible>> aSequence { pParentWindow->GetAccessible() };
rRelationSet.AddRelation( AccessibleRelation( AccessibleRelationType::SUB_WINDOW_OF, aSequence ) );
rRelationSet.AddRelation(AccessibleRelation(AccessibleRelationType_SUB_WINDOW_OF, aSequence));
}
}
}

View file

@ -440,7 +440,7 @@ void VCLXAccessibleList::ProcessWindowEvent (const VclWindowEvent& rVclWindowEve
if (m_pListBoxHelper && (m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) != WB_DROPDOWN)
{
uno::Sequence<uno::Reference<css::accessibility::XAccessible>> aSequence { pBox->GetAccessible() };
rRelationSet.AddRelation( com::sun::star::accessibility::AccessibleRelation( com::sun::star::accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) );
rRelationSet.AddRelation( com::sun::star::accessibility::AccessibleRelation( com::sun::star::accessibility::AccessibleRelationType_MEMBER_OF, aSequence ) );
}
}
else

View file

@ -85,8 +85,8 @@ void VCLXAccessibleRadioButton::FillAccessibleRelationSet( utl::AccessibleRelati
aVec.reserve(aGroup.size());
std::transform(aGroup.begin(), aGroup.end(), std::back_inserter(aVec),
[](const VclPtr<RadioButton>& rxItem) { return rxItem->GetAccessible(); });
rRelationSet.AddRelation( AccessibleRelation( AccessibleRelationType::MEMBER_OF,
comphelper::containerToSequence(aVec) ) );
rRelationSet.AddRelation(AccessibleRelation(AccessibleRelationType_MEMBER_OF,
comphelper::containerToSequence(aVec)));
}
}

View file

@ -19,11 +19,14 @@
#pragma once
#include "TableConnection.hxx"
#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
#include <cppuhelper/implbase.hxx>
#include <toolkit/awt/vclxaccessiblecomponent.hxx>
#include <vcl/vclptr.hxx>
using css::accessibility::AccessibleRelationType;
namespace dbaui
{
class OTableConnection;
@ -68,8 +71,8 @@ namespace dbaui
// XAccessibleRelationSet
virtual sal_Int32 SAL_CALL getRelationCount( ) override;
virtual css::accessibility::AccessibleRelation SAL_CALL getRelation( sal_Int32 nIndex ) override;
virtual sal_Bool SAL_CALL containsRelation( sal_Int16 aRelationType ) override;
virtual css::accessibility::AccessibleRelation SAL_CALL getRelationByType( sal_Int16 aRelationType ) override;
virtual sal_Bool SAL_CALL containsRelation(AccessibleRelationType eRelationType) override;
virtual css::accessibility::AccessibleRelation SAL_CALL getRelationByType(AccessibleRelationType eRelationType) override;
};
}

View file

@ -19,11 +19,14 @@
#pragma once
#include "TableWindow.hxx"
#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
#include <cppuhelper/implbase.hxx>
#include <toolkit/awt/vclxaccessiblecomponent.hxx>
#include <vcl/vclptr.hxx>
using css::accessibility::AccessibleRelationType;
namespace dbaui
{
class OTableWindow;
@ -71,8 +74,8 @@ namespace dbaui
// XAccessibleRelationSet
virtual sal_Int32 SAL_CALL getRelationCount( ) override;
virtual css::accessibility::AccessibleRelation SAL_CALL getRelation( sal_Int32 nIndex ) override;
virtual sal_Bool SAL_CALL containsRelation( sal_Int16 aRelationType ) override;
virtual css::accessibility::AccessibleRelation SAL_CALL getRelationByType( sal_Int16 aRelationType ) override;
virtual sal_Bool SAL_CALL containsRelation(AccessibleRelationType eRelationType) override;
virtual css::accessibility::AccessibleRelation SAL_CALL getRelationByType(AccessibleRelationType eRelationType) override;
};
}

View file

@ -140,15 +140,15 @@ namespace dbaui
m_pLine->GetDestWin()->GetAccessible() };
}
return AccessibleRelation(AccessibleRelationType::CONTROLLED_BY,aSeq);
return AccessibleRelation(AccessibleRelationType_CONTROLLED_BY,aSeq);
}
sal_Bool SAL_CALL OConnectionLineAccess::containsRelation( sal_Int16 aRelationType )
sal_Bool SAL_CALL OConnectionLineAccess::containsRelation(AccessibleRelationType eRelationType)
{
return AccessibleRelationType::CONTROLLED_BY == aRelationType;
return AccessibleRelationType_CONTROLLED_BY == eRelationType;
}
AccessibleRelation SAL_CALL OConnectionLineAccess::getRelationByType( sal_Int16 aRelationType )
AccessibleRelation SAL_CALL OConnectionLineAccess::getRelationByType(AccessibleRelationType eRelationType)
{
if( AccessibleRelationType::CONTROLLED_BY == aRelationType )
if (AccessibleRelationType_CONTROLLED_BY == eRelationType)
return getRelation(0);
return AccessibleRelation();
}

View file

@ -181,20 +181,20 @@ namespace dbaui
OJoinTableView* pView = m_pTable->getTableView();
auto aIter = pView->getTableConnections(m_pTable) + nIndex;
aRet.TargetSet = { getParentChild(aIter - pView->getTableConnections().begin()) };
aRet.RelationType = AccessibleRelationType::CONTROLLER_FOR;
aRet.RelationType = AccessibleRelationType_CONTROLLER_FOR;
}
return aRet;
}
sal_Bool SAL_CALL OTableWindowAccess::containsRelation( sal_Int16 aRelationType )
sal_Bool SAL_CALL OTableWindowAccess::containsRelation(AccessibleRelationType eRelationType)
{
::osl::MutexGuard aGuard( m_aMutex );
return AccessibleRelationType::CONTROLLER_FOR == aRelationType
return AccessibleRelationType_CONTROLLER_FOR == eRelationType
&& m_pTable && m_pTable->getTableView()->ExistsAConn(m_pTable);
}
AccessibleRelation SAL_CALL OTableWindowAccess::getRelationByType( sal_Int16 aRelationType )
AccessibleRelation SAL_CALL OTableWindowAccess::getRelationByType(AccessibleRelationType eRelationType)
{
::osl::MutexGuard aGuard( m_aMutex );
if( AccessibleRelationType::CONTROLLER_FOR == aRelationType && m_pTable)
if (AccessibleRelationType_CONTROLLER_FOR == eRelationType && m_pTable)
{
OJoinTableView* pView = m_pTable->getTableView();
const auto& rConnectionList = pView->getTableConnections();
@ -213,7 +213,7 @@ namespace dbaui
}
Sequence<Reference<css::accessibility::XAccessible>> aSeq(aRelations.data(), aRelations.size());
return AccessibleRelation(AccessibleRelationType::CONTROLLER_FOR, aSeq);
return AccessibleRelation(AccessibleRelationType_CONTROLLER_FOR, aSeq);
}
return AccessibleRelation();
}

View file

@ -132,14 +132,14 @@ void AccessibleContextBase::SetRelationSet (
{
// Try to emit some meaningful events indicating differing relations in
// both sets.
const std::pair<short int, short int> aRelationDescriptors[] = {
{ AccessibleRelationType::CONTROLLED_BY, AccessibleEventId::CONTROLLED_BY_RELATION_CHANGED },
{ AccessibleRelationType::CONTROLLER_FOR, AccessibleEventId::CONTROLLER_FOR_RELATION_CHANGED },
{ AccessibleRelationType::LABELED_BY, AccessibleEventId::LABELED_BY_RELATION_CHANGED },
{ AccessibleRelationType::LABEL_FOR, AccessibleEventId::LABEL_FOR_RELATION_CHANGED },
{ AccessibleRelationType::MEMBER_OF, AccessibleEventId::MEMBER_OF_RELATION_CHANGED },
const std::pair<AccessibleRelationType, short int> aRelationDescriptors[] = {
{ AccessibleRelationType_CONTROLLED_BY, AccessibleEventId::CONTROLLED_BY_RELATION_CHANGED },
{ AccessibleRelationType_CONTROLLER_FOR, AccessibleEventId::CONTROLLER_FOR_RELATION_CHANGED },
{ AccessibleRelationType_LABELED_BY, AccessibleEventId::LABELED_BY_RELATION_CHANGED },
{ AccessibleRelationType_LABEL_FOR, AccessibleEventId::LABEL_FOR_RELATION_CHANGED },
{ AccessibleRelationType_MEMBER_OF, AccessibleEventId::MEMBER_OF_RELATION_CHANGED },
};
for (const std::pair<short int, short int>& rPair : aRelationDescriptors)
for (const std::pair<AccessibleRelationType, short int>& rPair : aRelationDescriptors)
{
if (mxRelationSet->containsRelation(rPair.first)
!= rxNewRelationSet->containsRelation(rPair.first))

View file

@ -738,8 +738,8 @@ namespace accessibility
{
uno::Sequence<uno::Reference<XAccessible>> aSequence
{ mpParaManager->GetChild( nMyParaIndex - 1 ).first.get() };
AccessibleRelation aAccRel( AccessibleRelationType::CONTENT_FLOWS_FROM,
aSequence );
AccessibleRelation aAccRel(AccessibleRelationType_CONTENT_FLOWS_FROM,
aSequence );
pAccRelSetHelper->AddRelation( aAccRel );
}
@ -749,8 +749,8 @@ namespace accessibility
{
uno::Sequence<uno::Reference<XAccessible>> aSequence
{ mpParaManager->GetChild( nMyParaIndex + 1 ).first.get() };
AccessibleRelation aAccRel( AccessibleRelationType::CONTENT_FLOWS_TO,
aSequence );
AccessibleRelation aAccRel(AccessibleRelationType_CONTENT_FLOWS_TO,
aSequence );
pAccRelSetHelper->AddRelation( aAccRel );
}

View file

@ -27,11 +27,14 @@
#include <cppunit/TestAssert.h>
#include <com/sun/star/accessibility/AccessibleEventObject.hpp>
#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
#include <com/sun/star/accessibility/XAccessible.hpp>
#include <com/sun/star/accessibility/XAccessibleAction.hpp>
#include <com/sun/star/accessibility/XAccessibleContext.hpp>
#include <com/sun/star/accessibility/XAccessibleText.hpp>
using css::accessibility::AccessibleRelationType;
class OOO_DLLPUBLIC_TEST AccessibilityTools
{
public:
@ -178,7 +181,7 @@ public:
static OUString getRoleName(const sal_Int16 role);
static OUString getEventIdName(const sal_Int16 event_id);
static OUString getRelationTypeName(const sal_Int16 rel_type);
static OUString getRelationTypeName(AccessibleRelationType rel_type);
template <typename T> static std::string debugString(const css::uno::Reference<T>& x)
{

View file

@ -77,7 +77,7 @@ protected:
static css::uno::Reference<css::accessibility::XAccessibleContext> getFirstRelationTargetOfType(
const css::uno::Reference<css::accessibility::XAccessibleContext>& xContext,
sal_Int16 relationType);
css::accessibility::AccessibleRelationType relationType);
/**
* @brief Tries to list all children of an accessible

View file

@ -22,11 +22,14 @@
#include <unotools/unotoolsdllapi.h>
#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
#include <cppuhelper/implbase.hxx>
#include <mutex>
#include <vector>
using css::accessibility::AccessibleRelationType;
//= XAccessibleRelationSet helper classes
//... namespace utl .......................................................
@ -77,22 +80,20 @@ public:
/** Tests whether the relation set contains a relation matching the
specified key.
@param aRelationType
The type of relation to look for in this set of relations. This
has to be one of the constants of
AccessibleRelationType.
@param eRelationType
The type of relation to look for in this set of relations.
@return
Returns <TRUE/> if there is a (at least one) relation of the
given type and <FALSE/> if there is no such relation in the set.
*/
virtual sal_Bool SAL_CALL containsRelation(sal_Int16 aRelationType) override;
virtual sal_Bool SAL_CALL
containsRelation(css::accessibility::AccessibleRelationType eRelationType) override;
/** Retrieve and return the relation with the given relation type.
@param aRelationType
The type of the relation to return. This has to be one of the
constants of AccessibleRelationType.
@param eRelationType
The type of the relation to return.
@return
If a relation with the given type could be found than (a copy
@ -100,7 +101,7 @@ public:
type INVALID is returned.
*/
virtual css::accessibility::AccessibleRelation SAL_CALL
getRelationByType(sal_Int16 aRelationType) override;
getRelationByType(AccessibleRelationType eRelationType) override;
/// @throws uno::RuntimeException
void AddRelation(const css::accessibility::AccessibleRelation& rRelation);

View file

@ -31,14 +31,13 @@ struct AccessibleRelation
{
/** Type of the relation.
<p>Its value has to be one of the constants defined by
AccessibleRelationType. If that value is INVALID then
<p>If that value is INVALID then
the whole relation is regarded as invalid. The content of the
TargetSet is then undefined.</p>
@see AccessibleRelationType
*/
short RelationType;
::com::sun::star::accessibility::AccessibleRelationType RelationType;
/** Set of objects that are the relation's targets.

View file

@ -21,70 +21,65 @@ module com { module sun { module star { module accessibility {
/** Collection of relation types.
<p>This list of constants defines the available types of relations that
<p>This enum defines the available types of relations that
are usable by AccessibleRelation.</p>
<p>We are using constants instead of a more typesafe enum. The reason
for this is that IDL enums may not be extended. Therefore, in order to
include future extensions to the set of roles we have to use constants
here.</p>
@since OOo 1.1.2
*/
constants AccessibleRelationType
enum AccessibleRelationType
{
/** Invalid relation type.
<p>Indicates an invalid relation type. This is used to indicate
that a retrieval method could not find a requested relation.</p>
*/
const short INVALID = 0;
INVALID,
/** Content-flows-from relation.
<p>Indicates a content flow between the related objects.</p>
*/
const short CONTENT_FLOWS_FROM = 1;
CONTENT_FLOWS_FROM,
/** Content-flows-to relation.
<p>Indicates a content flow between the related objects.</p>
*/
const short CONTENT_FLOWS_TO = 2;
CONTENT_FLOWS_TO,
/** Controlled-by relation type.
<p>Indicates an object is controlled by one or more target
objects.</p>
*/
const short CONTROLLED_BY = 3;
CONTROLLED_BY,
/** Controller-for relation type.
<p>Indicates an object is a controller for one or more target
objects.</p>
*/
const short CONTROLLER_FOR = 4;
CONTROLLER_FOR,
/** Label-for relation type.
<p>Indicates an object is a label for one or more target
objects.</p>
*/
const short LABEL_FOR = 5;
LABEL_FOR,
/** Labeled-by relation type.
<p>Indicates an object is labeled by one or more target objects.</p>
*/
const short LABELED_BY = 6;
LABELED_BY,
/** Member-of relation type.
<p>Indicates an object is a member of a group of one or more target
objects.</p>
*/
const short MEMBER_OF = 7;
MEMBER_OF,
/** Sub-Window-of relation type.
@ -93,7 +88,7 @@ constants AccessibleRelationType
window. Note that there is no relation that points the other way,
from the parent window to the child window.</p>
*/
const short SUB_WINDOW_OF = 8;
SUB_WINDOW_OF,
/** Node-Child-of relation type.
@ -103,7 +98,7 @@ constants AccessibleRelationType
@since OOo 3.0
*/
const short NODE_CHILD_OF = 9;
NODE_CHILD_OF,
/** Described-by relation type.
@ -111,7 +106,7 @@ constants AccessibleRelationType
@since OOo 3.5
*/
const short DESCRIBED_BY = 10;
DESCRIBED_BY
};
}; }; }; };

View file

@ -61,29 +61,26 @@ interface XAccessibleRelationSet : ::com::sun::star::uno::XInterface
/** Tests whether the relation set contains a relation matching the
specified key.
@param aRelationType
The type of relation to look for in this set of relations. This
has to be one of the constants of
AccessibleRelationType.
@param eRelationType
The type of relation to look for in this set of relations.
@return
Returns `TRUE` if there is a (at least one) relation of the
given type and `FALSE` if there is no such relation in the set.
*/
boolean containsRelation ([in] short aRelationType);
boolean containsRelation ([in] ::com::sun::star::accessibility::AccessibleRelationType eRelationType);
/** Retrieve and return the relation with the given relation type.
@param aRelationType
The type of the relation to return. This has to be one of the
constants of AccessibleRelationType.
The type of the relation to return.
@return
If a relation with the given type could be found than (a copy
of) this relation is returned. Otherwise a relation with the
type INVALID is returned.
*/
AccessibleRelation getRelationByType ([in] short aRelationType);
AccessibleRelation getRelationByType ([in] ::com::sun::star::accessibility::AccessibleRelationType eRelationType);
};
}; }; }; };

View file

@ -414,7 +414,7 @@ void ScAccessibleCell::FillDependents(utl::AccessibleRelationSetHelper* pRelatio
bFound = true;
}
if (bFound)
AddRelation(aCellIter.GetPos(), AccessibleRelationType::CONTROLLER_FOR, pRelationSet);
AddRelation(aCellIter.GetPos(), AccessibleRelationType_CONTROLLER_FOR, pRelationSet);
}
}
}
@ -432,20 +432,20 @@ void ScAccessibleCell::FillPrecedents(utl::AccessibleRelationSetHelper* pRelatio
ScRange aRef;
while ( aIter.GetNextRef( aRef ) )
{
AddRelation( aRef, AccessibleRelationType::CONTROLLED_BY, pRelationSet);
AddRelation( aRef, AccessibleRelationType_CONTROLLED_BY, pRelationSet);
}
}
}
void ScAccessibleCell::AddRelation(const ScAddress& rCell,
const sal_uInt16 aRelationType,
const AccessibleRelationType eRelationType,
utl::AccessibleRelationSetHelper* pRelationSet)
{
AddRelation(ScRange(rCell, rCell), aRelationType, pRelationSet);
AddRelation(ScRange(rCell, rCell), eRelationType, pRelationSet);
}
void ScAccessibleCell::AddRelation(const ScRange& rRange,
const sal_uInt16 aRelationType,
const AccessibleRelationType eRelationType,
utl::AccessibleRelationSetHelper* pRelationSet)
{
uno::Reference < XAccessibleTable > xTable ( getAccessibleParent()->getAccessibleContext(), uno::UNO_QUERY );
@ -477,7 +477,7 @@ void ScAccessibleCell::AddRelation(const ScRange& rRange,
}
OSL_ENSURE(nCount == nPos, "something went wrong");
AccessibleRelation aRelation;
aRelation.RelationType = aRelationType;
aRelation.RelationType = eRelationType;
aRelation.TargetSet = std::move(aTargetSet);
pRelationSet->AddRelation(aRelation);
}

View file

@ -301,7 +301,7 @@ Reference< XAccessibleRelationSet > SAL_CALL ScAccessibleCsvRuler::getAccessible
if( xAccObj.is() )
{
Sequence<Reference<css::accessibility::XAccessible>> aSeq{ xAccObj };
pRelationSet->AddRelation( AccessibleRelation( AccessibleRelationType::CONTROLLER_FOR, aSeq ) );
pRelationSet->AddRelation( AccessibleRelation( AccessibleRelationType_CONTROLLER_FOR, aSeq ) );
}
return pRelationSet;
@ -840,7 +840,7 @@ Reference< XAccessibleRelationSet > SAL_CALL ScAccessibleCsvGrid::getAccessibleR
if( xAccObj.is() )
{
Sequence<Reference<css::accessibility::XAccessible>> aSeq{ xAccObj };
pRelationSet->AddRelation( AccessibleRelation( AccessibleRelationType::CONTROLLED_BY, aSeq ) );
pRelationSet->AddRelation( AccessibleRelation( AccessibleRelationType_CONTROLLED_BY, aSeq ) );
}
}

View file

@ -894,7 +894,7 @@ rtl::Reference<utl::AccessibleRelationSetHelper> ScChildrenShapes::GetRelationSe
AccessibleRelation aRelation;
aRelation.TargetSet = { Get(pAccShapeData) };
aRelation.RelationType = AccessibleRelationType::CONTROLLER_FOR;
aRelation.RelationType = AccessibleRelationType_CONTROLLER_FOR;
pRelationSet->AddRelation(aRelation);
}
@ -1147,7 +1147,7 @@ rtl::Reference<utl::AccessibleRelationSetHelper> ScChildrenShapes::GetRelationSe
}
AccessibleRelation aRelation;
aRelation.TargetSet = { xAccessible };
aRelation.RelationType = AccessibleRelationType::CONTROLLED_BY;
aRelation.RelationType = AccessibleRelationType_CONTROLLED_BY;
pRelationSet->AddRelation(aRelation);
}

View file

@ -518,13 +518,13 @@ uno::Reference< XAccessibleRelationSet > ScAccessibleEditObject::getAccessibleRe
if ( pLabeledBy && pLabeledBy != pWindow )
{
uno::Sequence<uno::Reference<css::accessibility::XAccessible>> aSequence { pLabeledBy->GetAccessible() };
rRelationSet->AddRelation( AccessibleRelation( AccessibleRelationType::LABELED_BY, aSequence ) );
rRelationSet->AddRelation( AccessibleRelation( AccessibleRelationType_LABELED_BY, aSequence ) );
}
vcl::Window* pMemberOf = pWindow->GetAccessibleRelationMemberOf();
if ( pMemberOf && pMemberOf != pWindow )
{
uno::Sequence< uno::Reference<css::accessibility::XAccessible> > aSequence { pMemberOf->GetAccessible() };
rRelationSet->AddRelation( AccessibleRelation( AccessibleRelationType::MEMBER_OF, aSequence ) );
rRelationSet->AddRelation( AccessibleRelation( AccessibleRelationType_MEMBER_OF, aSequence ) );
}
return rRelationSet;
}

View file

@ -22,6 +22,7 @@
#include <memory>
#include "AccessibleCellBase.hxx"
#include "viewdata.hxx"
#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
#include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp>
#include <rtl/ref.hxx>
#include <editeng/AccessibleStaticTextBase.hxx>
@ -36,6 +37,8 @@ class ScAccessibleDocument;
typedef cppu::ImplHelper1< css::accessibility::XAccessibleExtendedAttributes>
ScAccessibleCellAttributeImpl;
using css::accessibility::AccessibleRelationType;
/** @descr
This base class provides an implementation of the
<code>AccessibleCell</code> service.
@ -152,10 +155,10 @@ private:
void FillDependents(utl::AccessibleRelationSetHelper* pRelationSet);
void FillPrecedents(utl::AccessibleRelationSetHelper* pRelationSet);
void AddRelation(const ScAddress& rCell,
const sal_uInt16 aRelationType,
const AccessibleRelationType eRelationType,
::utl::AccessibleRelationSetHelper* pRelationSet);
void AddRelation(const ScRange& rRange,
const sal_uInt16 aRelationType,
const AccessibleRelationType eRelationType,
::utl::AccessibleRelationSetHelper* pRelationSet);
bool IsFormulaMode();
bool IsDropdown() const;

View file

@ -210,7 +210,7 @@ public:
AccessibleRelationSet();
void AddRelation (
const sal_Int16 nRelationType,
const AccessibleRelationType eRelationType,
const Reference<XAccessible>& rxObject);
//----- XAccessibleRelationSet --------------------------------------------
@ -219,9 +219,9 @@ public:
virtual AccessibleRelation SAL_CALL getRelation (sal_Int32 nIndex) override;
virtual sal_Bool SAL_CALL containsRelation (sal_Int16 nRelationType) override;
virtual sal_Bool SAL_CALL containsRelation(css::accessibility::AccessibleRelationType eRelationType) override;
virtual AccessibleRelation SAL_CALL getRelationByType (sal_Int16 nRelationType) override;
virtual AccessibleRelation SAL_CALL getRelationByType(AccessibleRelationType eRelationType) override;
private:
::std::vector<AccessibleRelation> maRelations;
@ -1193,11 +1193,11 @@ AccessibleRelationSet::AccessibleRelationSet()
}
void AccessibleRelationSet::AddRelation (
const sal_Int16 nRelationType,
const AccessibleRelationType eRelationType,
const Reference<XAccessible>& rxObject)
{
maRelations.emplace_back();
maRelations.back().RelationType = nRelationType;
maRelations.back().RelationType = eRelationType;
maRelations.back().TargetSet = { rxObject };
}
@ -1216,16 +1216,16 @@ AccessibleRelation SAL_CALL AccessibleRelationSet::getRelation (sal_Int32 nIndex
return maRelations[nIndex];
}
sal_Bool SAL_CALL AccessibleRelationSet::containsRelation (sal_Int16 nRelationType)
sal_Bool SAL_CALL AccessibleRelationSet::containsRelation(AccessibleRelationType eRelationType)
{
return std::any_of(maRelations.begin(), maRelations.end(),
[nRelationType](const AccessibleRelation& rRelation) { return rRelation.RelationType == nRelationType; });
[eRelationType](const AccessibleRelation& rRelation) { return rRelation.RelationType == eRelationType; });
}
AccessibleRelation SAL_CALL AccessibleRelationSet::getRelationByType (sal_Int16 nRelationType)
AccessibleRelation SAL_CALL AccessibleRelationSet::getRelationByType(AccessibleRelationType eRelationType)
{
auto iRelation = std::find_if(maRelations.begin(), maRelations.end(),
[nRelationType](const AccessibleRelation& rRelation) { return rRelation.RelationType == nRelationType; });
[eRelationType](const AccessibleRelation& rRelation) { return rRelation.RelationType == eRelationType; });
if (iRelation != maRelations.end())
return *iRelation;
return AccessibleRelation();
@ -1260,12 +1260,12 @@ Reference<XAccessibleRelationSet> SAL_CALL
{
if (mnParagraphIndex>0)
pSet->AddRelation(
AccessibleRelationType::CONTENT_FLOWS_FROM,
AccessibleRelationType_CONTENT_FLOWS_FROM,
xParentContext->getAccessibleChild(mnParagraphIndex-1));
if (mnParagraphIndex<xParentContext->getAccessibleChildCount()-1)
pSet->AddRelation(
AccessibleRelationType::CONTENT_FLOWS_TO,
AccessibleRelationType_CONTENT_FLOWS_TO,
xParentContext->getAccessibleChild(mnParagraphIndex+1));
}
}

View file

@ -554,11 +554,11 @@ Reference< XAccessibleRelationSet > SAL_CALL AccessibleControlShape::getAccessib
css::uno::Sequence<css::uno::Reference<XAccessible>> aSequence { xAcc };
if( getAccessibleRole() == AccessibleRole::RADIO_BUTTON )
{
pRelationSetHelper->AddRelation( AccessibleRelation( AccessibleRelationType::MEMBER_OF, aSequence ) );
pRelationSetHelper->AddRelation( AccessibleRelation( AccessibleRelationType_MEMBER_OF, aSequence ) );
}
else
{
pRelationSetHelper->AddRelation( AccessibleRelation( AccessibleRelationType::LABELED_BY, aSequence ) );
pRelationSetHelper->AddRelation( AccessibleRelation( AccessibleRelationType_LABELED_BY, aSequence ) );
}
}
return pRelationSetHelper;

View file

@ -364,7 +364,7 @@ uno::Reference<XAccessibleRelationSet> SAL_CALL
if(aSequence[0])
{
pRelationSet->AddRelation(
AccessibleRelation( AccessibleRelationType::DESCRIBED_BY, aSequence ) );
AccessibleRelation(AccessibleRelationType_DESCRIBED_BY, aSequence));
}
return pRelationSet;
}

View file

@ -481,7 +481,7 @@ Reference<XAccessibleRelationSet> SAL_CALL SvxRectCtlChildAccessibleContext::get
if( mxParent.is() )
{
uno::Sequence<uno::Reference<css::accessibility::XAccessible>> aSequence { mxParent };
pRelationSetHelper->AddRelation( css::accessibility::AccessibleRelation( css::accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) );
pRelationSetHelper->AddRelation(css::accessibility::AccessibleRelation(css::accessibility::AccessibleRelationType_MEMBER_OF, aSequence));
}
return pRelationSetHelper;

View file

@ -109,13 +109,13 @@ void AccessibleRelationSet::contents_flows_to_and_from()
{
CPPUNIT_ASSERT_EQUAL_MESSAGE("didn't gain correct count of relations", sal_Int32(1),
set->getRelationCount());
sal_Int16 firstrelation = set->getRelation(0).RelationType;
AccessibleRelationType firstrelation = set->getRelation(0).RelationType;
css::uno::Reference<css::accessibility::XAccessibleText> adummy(
set->getRelation(0).TargetSet[0], uno::UNO_QUERY_THROW);
atarget = adummy;
CPPUNIT_ASSERT_EQUAL_MESSAGE("didn't gain correct relation type for paragraph 0",
AccessibilityTools::getRelationTypeName(
accessibility::AccessibleRelationType::CONTENT_FLOWS_TO),
accessibility::AccessibleRelationType_CONTENT_FLOWS_TO),
AccessibilityTools::getRelationTypeName(firstrelation));
css::uno::Reference<css::accessibility::XAccessibleText> paraText2(para2,
@ -129,23 +129,23 @@ void AccessibleRelationSet::contents_flows_to_and_from()
css::uno::Reference<css::accessibility::XAccessibleRelationSet> set2
= oObj2->getAccessibleRelationSet();
sal_Int16 relationtypes[2] = { accessibility::AccessibleRelationType::INVALID,
accessibility::AccessibleRelationType::INVALID };
AccessibleRelationType relationtypes[2] = { accessibility::AccessibleRelationType_INVALID,
accessibility::AccessibleRelationType_INVALID };
css::uno::Reference<css::accessibility::XAccessibleText> atargets[2];
if (set2.is())
{
CPPUNIT_ASSERT_EQUAL_MESSAGE("didn't gain correct count of relations", sal_Int32(2),
set2->getRelationCount());
sal_Int16 tmprelation = set2->getRelation(0).RelationType;
if (tmprelation == accessibility::AccessibleRelationType::CONTENT_FLOWS_FROM)
AccessibleRelationType tmprelation = set2->getRelation(0).RelationType;
if (tmprelation == accessibility::AccessibleRelationType_CONTENT_FLOWS_FROM)
{
css::uno::Reference<css::accessibility::XAccessibleText> adummy(
set2->getRelation(0).TargetSet[0], uno::UNO_QUERY_THROW);
atargets[0] = adummy;
relationtypes[0] = tmprelation;
}
else if (tmprelation == accessibility::AccessibleRelationType::CONTENT_FLOWS_TO)
else if (tmprelation == accessibility::AccessibleRelationType_CONTENT_FLOWS_TO)
{
css::uno::Reference<css::accessibility::XAccessibleText> adummy(
set2->getRelation(0).TargetSet[0], uno::UNO_QUERY_THROW);
@ -157,14 +157,14 @@ void AccessibleRelationSet::contents_flows_to_and_from()
CPPUNIT_FAIL("didn't gain correct relation type");
}
tmprelation = set2->getRelation(1).RelationType;
if (tmprelation == accessibility::AccessibleRelationType::CONTENT_FLOWS_FROM)
if (tmprelation == accessibility::AccessibleRelationType_CONTENT_FLOWS_FROM)
{
css::uno::Reference<css::accessibility::XAccessibleText> adummy(
set2->getRelation(1).TargetSet[0], uno::UNO_QUERY_THROW);
atargets[0] = adummy;
relationtypes[0] = tmprelation;
}
else if (tmprelation == accessibility::AccessibleRelationType::CONTENT_FLOWS_TO)
else if (tmprelation == accessibility::AccessibleRelationType_CONTENT_FLOWS_TO)
{
css::uno::Reference<css::accessibility::XAccessibleText> adummy(
set2->getRelation(1).TargetSet[0], uno::UNO_QUERY_THROW);
@ -179,7 +179,7 @@ void AccessibleRelationSet::contents_flows_to_and_from()
CPPUNIT_ASSERT_EQUAL_MESSAGE("didn't gain correct relation type for paragraph 1",
AccessibilityTools::getRelationTypeName(
accessibility::AccessibleRelationType::CONTENT_FLOWS_FROM),
accessibility::AccessibleRelationType_CONTENT_FLOWS_FROM),
AccessibilityTools::getRelationTypeName(relationtypes[0]));
css::uno::Reference<css::accessibility::XAccessibleText> paraText1(para1, uno::UNO_QUERY_THROW);
@ -188,7 +188,7 @@ void AccessibleRelationSet::contents_flows_to_and_from()
CPPUNIT_ASSERT_EQUAL_MESSAGE("didn't gain correct relation type for paragraph 3",
AccessibilityTools::getRelationTypeName(
accessibility::AccessibleRelationType::CONTENT_FLOWS_TO),
accessibility::AccessibleRelationType_CONTENT_FLOWS_TO),
AccessibilityTools::getRelationTypeName(relationtypes[1]));
css::uno::Reference<css::accessibility::XAccessibleText> paraText3(para3, uno::UNO_QUERY_THROW);

View file

@ -756,8 +756,7 @@ uno::Reference<XAccessibleRelationSet> SAL_CALL SwAccessibleParagraph::getAccess
if ( pPrevContentFrame )
{
uno::Sequence<uno::Reference<XAccessible>> aSequence { GetMap()->GetContext(pPrevContentFrame) };
AccessibleRelation aAccRel( AccessibleRelationType::CONTENT_FLOWS_FROM,
aSequence );
AccessibleRelation aAccRel(AccessibleRelationType_CONTENT_FLOWS_FROM, aSequence);
pHelper->AddRelation( aAccRel );
}
@ -765,8 +764,7 @@ uno::Reference<XAccessibleRelationSet> SAL_CALL SwAccessibleParagraph::getAccess
if ( pNextContentFrame )
{
uno::Sequence<uno::Reference<XAccessible>> aSequence { GetMap()->GetContext(pNextContentFrame) };
AccessibleRelation aAccRel( AccessibleRelationType::CONTENT_FLOWS_TO,
aSequence );
AccessibleRelation aAccRel(AccessibleRelationType_CONTENT_FLOWS_TO, aSequence);
pHelper->AddRelation( aAccRel );
}
}

View file

@ -269,10 +269,10 @@ SwFlyFrame* SwAccessibleTextFrame::getFlyFrame() const
return pFlyFrame;
}
AccessibleRelation SwAccessibleTextFrame::makeRelation( sal_Int16 nType, const SwFlyFrame* pFrame )
AccessibleRelation SwAccessibleTextFrame::makeRelation(AccessibleRelationType eType, const SwFlyFrame* pFrame )
{
uno::Sequence<uno::Reference<XAccessible>> aSequence { GetMap()->GetContext(pFrame) };
return AccessibleRelation( nType, aSequence );
return AccessibleRelation(eType, aSequence);
}
uno::Reference<XAccessibleRelationSet> SAL_CALL SwAccessibleTextFrame::getAccessibleRelationSet( )
@ -291,12 +291,12 @@ uno::Reference<XAccessibleRelationSet> SAL_CALL SwAccessibleTextFrame::getAccess
const SwFlyFrame* pPrevFrame = pFlyFrame->GetPrevLink();
if( pPrevFrame != nullptr )
pHelper->AddRelation( makeRelation(
AccessibleRelationType::CONTENT_FLOWS_FROM, pPrevFrame ) );
AccessibleRelationType_CONTENT_FLOWS_FROM, pPrevFrame ) );
const SwFlyFrame* pNextFrame = pFlyFrame->GetNextLink();
if( pNextFrame != nullptr )
pHelper->AddRelation( makeRelation(
AccessibleRelationType::CONTENT_FLOWS_TO, pNextFrame ) );
AccessibleRelationType_CONTENT_FLOWS_TO, pNextFrame ) );
return pHelper;
}

View file

@ -104,7 +104,7 @@ private:
SwFlyFrame* getFlyFrame() const;
css::accessibility::AccessibleRelation makeRelation(
sal_Int16 nType, const SwFlyFrame* pFrame );
css::accessibility::AccessibleRelationType eType, const SwFlyFrame* pFrame);
public:
virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet> SAL_CALL getAccessibleRelationSet() override;

View file

@ -620,34 +620,35 @@ OUString AccessibilityTools::getEventIdName(const sal_Int16 event_id)
return unknownName(event_id);
}
OUString AccessibilityTools::getRelationTypeName(const sal_Int16 rel_type)
OUString AccessibilityTools::getRelationTypeName(AccessibleRelationType rel_type)
{
switch (rel_type)
{
case accessibility::AccessibleRelationType::CONTENT_FLOWS_FROM:
case accessibility::AccessibleRelationType_CONTENT_FLOWS_FROM:
return u"CONTENT_FLOWS_FROM"_ustr;
case accessibility::AccessibleRelationType::CONTENT_FLOWS_TO:
case accessibility::AccessibleRelationType_CONTENT_FLOWS_TO:
return u"CONTENT_FLOWS_TO"_ustr;
case accessibility::AccessibleRelationType::CONTROLLED_BY:
case accessibility::AccessibleRelationType_CONTROLLED_BY:
return u"CONTROLLED_BY"_ustr;
case accessibility::AccessibleRelationType::CONTROLLER_FOR:
case accessibility::AccessibleRelationType_CONTROLLER_FOR:
return u"CONTROLLER_FOR"_ustr;
case accessibility::AccessibleRelationType::DESCRIBED_BY:
case accessibility::AccessibleRelationType_DESCRIBED_BY:
return u"DESCRIBED_BY"_ustr;
case accessibility::AccessibleRelationType::INVALID:
case accessibility::AccessibleRelationType_INVALID:
return u"INVALID"_ustr;
case accessibility::AccessibleRelationType::LABELED_BY:
case accessibility::AccessibleRelationType_LABELED_BY:
return u"LABELED_BY"_ustr;
case accessibility::AccessibleRelationType::LABEL_FOR:
case accessibility::AccessibleRelationType_LABEL_FOR:
return u"LABEL_FOR"_ustr;
case accessibility::AccessibleRelationType::MEMBER_OF:
case accessibility::AccessibleRelationType_MEMBER_OF:
return u"MEMBER_OF"_ustr;
case accessibility::AccessibleRelationType::NODE_CHILD_OF:
case accessibility::AccessibleRelationType_NODE_CHILD_OF:
return u"NODE_CHILD_OF"_ustr;
case accessibility::AccessibleRelationType::SUB_WINDOW_OF:
case accessibility::AccessibleRelationType_SUB_WINDOW_OF:
return u"SUB_WINDOW_OF"_ustr;
default:
return unknownName(static_cast<sal_Int64>(rel_type));
}
return unknownName(rel_type);
}
OUString AccessibilityTools::debugName(accessibility::XAccessibleContext* ctx)

View file

@ -117,14 +117,14 @@ test::AccessibleTestBase::getPreviousFlowingSibling(
const uno::Reference<accessibility::XAccessibleContext>& xContext)
{
return getFirstRelationTargetOfType(xContext,
accessibility::AccessibleRelationType::CONTENT_FLOWS_FROM);
accessibility::AccessibleRelationType_CONTENT_FLOWS_FROM);
}
uno::Reference<accessibility::XAccessibleContext> test::AccessibleTestBase::getNextFlowingSibling(
const uno::Reference<accessibility::XAccessibleContext>& xContext)
{
return getFirstRelationTargetOfType(xContext,
accessibility::AccessibleRelationType::CONTENT_FLOWS_TO);
accessibility::AccessibleRelationType_CONTENT_FLOWS_TO);
}
/* Care has to be taken not to walk sideways as the relation is also used
@ -234,7 +234,8 @@ OUString test::AccessibleTestBase::collectText(
uno::Reference<accessibility::XAccessibleContext>
test::AccessibleTestBase::getFirstRelationTargetOfType(
const uno::Reference<accessibility::XAccessibleContext>& xContext, sal_Int16 relationType)
const uno::Reference<accessibility::XAccessibleContext>& xContext,
css::accessibility::AccessibleRelationType relationType)
{
auto relset = xContext->getAccessibleRelationSet();
@ -281,7 +282,7 @@ void test::AccessibleTestBase::dumpA11YTree(
const auto& rel = xRelSet->getRelation(i);
std::cout << "(type=" << AccessibilityTools::getRelationTypeName(rel.RelationType)
<< " (" << rel.RelationType << ")";
<< " (" << static_cast<int>(rel.RelationType) << ")";
std::cout << " targets=[";
int j = 0;
for (const uno::Reference<accessibility::XAccessible>& xTarget : rel.TargetSet)

View file

@ -394,21 +394,21 @@ void VCLXAccessibleComponent::FillAccessibleRelationSet( utl::AccessibleRelation
if ( pLabeledBy && pLabeledBy != pWindow )
{
uno::Sequence<uno::Reference<css::accessibility::XAccessible>> aSequence { pLabeledBy->GetAccessible() };
rRelationSet.AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::LABELED_BY, aSequence ) );
rRelationSet.AddRelation(accessibility::AccessibleRelation(accessibility::AccessibleRelationType_LABELED_BY, aSequence));
}
vcl::Window* pLabelFor = pWindow->GetAccessibleRelationLabelFor();
if ( pLabelFor && pLabelFor != pWindow )
{
uno::Sequence<uno::Reference<css::accessibility::XAccessible>> aSequence { pLabelFor->GetAccessible() };
rRelationSet.AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::LABEL_FOR, aSequence ) );
rRelationSet.AddRelation(accessibility::AccessibleRelation(accessibility::AccessibleRelationType_LABEL_FOR, aSequence));
}
vcl::Window* pMemberOf = pWindow->GetAccessibleRelationMemberOf();
if ( pMemberOf && pMemberOf != pWindow )
{
uno::Sequence<uno::Reference<css::accessibility::XAccessible>> aSequence { pMemberOf->GetAccessible() };
rRelationSet.AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) );
rRelationSet.AddRelation(accessibility::AccessibleRelation(accessibility::AccessibleRelationType_MEMBER_OF, aSequence));
}
}

View file

@ -75,24 +75,22 @@ public class NameProvider
/** Return the name of the specified relation.
@param nRelation
Id of the relation for which to return its name. This is one of
the ids listed in the <type>AccessibleRelationType</const>
constants group.
@param eRelation
Id of the relation for which to return its name.
@return
Returns the name of the specified relation type or an empty
string if an invalid / unknown role id was given.
string if an invalid / unknown relation type id was given.
*/
public static String getRelationName (int nRelation)
public static String getRelationName (AccessibleRelationType eRelation)
{
return maRelationMap.get (Integer.valueOf(nRelation));
return maRelationMap.get(eRelation);
}
private static HashMap<Integer, String> maStateMap = new HashMap<Integer, String>();
private static HashMap<Integer, String> maEventMap = new HashMap<Integer, String>();
private static HashMap<Integer, String> maRoleMap = new HashMap<Integer, String>();
private static HashMap<Integer, String> maRelationMap = new HashMap<Integer, String>();
private static HashMap<AccessibleRelationType, String> maRelationMap = new HashMap<AccessibleRelationType, String>();
static {
maStateMap.put (Integer.valueOf(AccessibleStateType.INVALID), "INVALID");
@ -264,14 +262,14 @@ public class NameProvider
maRoleMap.put (Integer.valueOf(AccessibleRole.VIEW_PORT), "VIEW_PORT");
maRoleMap.put (Integer.valueOf(AccessibleRole.WINDOW), "WINDOW");
maRelationMap.put (Integer.valueOf(AccessibleRelationType.INVALID), "INVALID");
maRelationMap.put (Integer.valueOf(AccessibleRelationType.CONTENT_FLOWS_FROM), "CONTENT_FLOWS_FROM");
maRelationMap.put (Integer.valueOf(AccessibleRelationType.CONTENT_FLOWS_TO), "CONTENT_FLOWS_TO");
maRelationMap.put (Integer.valueOf(AccessibleRelationType.CONTROLLED_BY), "CONTROLLED_BY");
maRelationMap.put (Integer.valueOf(AccessibleRelationType.CONTROLLER_FOR), "CONTROLLER_FOR");
maRelationMap.put (Integer.valueOf(AccessibleRelationType.LABEL_FOR), "LABEL_FOR");
maRelationMap.put (Integer.valueOf(AccessibleRelationType.LABELED_BY), "LABELED_BY");
maRelationMap.put (Integer.valueOf(AccessibleRelationType.MEMBER_OF), "MEMBER_OF");
maRelationMap.put (Integer.valueOf(AccessibleRelationType.SUB_WINDOW_OF), "SUB_WINDOW_OF");
maRelationMap.put (AccessibleRelationType.INVALID, "INVALID");
maRelationMap.put (AccessibleRelationType.CONTENT_FLOWS_FROM, "CONTENT_FLOWS_FROM");
maRelationMap.put (AccessibleRelationType.CONTENT_FLOWS_TO, "CONTENT_FLOWS_TO");
maRelationMap.put (AccessibleRelationType.CONTROLLED_BY, "CONTROLLED_BY");
maRelationMap.put (AccessibleRelationType.CONTROLLER_FOR, "CONTROLLER_FOR");
maRelationMap.put (AccessibleRelationType.LABEL_FOR, "LABEL_FOR");
maRelationMap.put (AccessibleRelationType.LABELED_BY, "LABELED_BY");
maRelationMap.put (AccessibleRelationType.MEMBER_OF, "MEMBER_OF");
maRelationMap.put (AccessibleRelationType.SUB_WINDOW_OF, "SUB_WINDOW_OF");
}
}

View file

@ -30,11 +30,11 @@ using namespace ::com::sun::star::accessibility;
namespace
{
AccessibleRelation lcl_getRelationByType( std::vector<AccessibleRelation>& raRelations, sal_Int16 aRelationType )
AccessibleRelation lcl_getRelationByType( std::vector<AccessibleRelation>& raRelations, AccessibleRelationType eRelationType)
{
for (const auto& aRelation: raRelations)
{
if (aRelation.RelationType == aRelationType)
if (aRelation.RelationType == eRelationType)
return aRelation;
}
return AccessibleRelation();
@ -114,32 +114,31 @@ sal_Int32 SAL_CALL
given type and <FALSE/> if there is no such relation in the set.
*/
sal_Bool SAL_CALL
AccessibleRelationSetHelper::containsRelation( sal_Int16 aRelationType )
AccessibleRelationSetHelper::containsRelation(AccessibleRelationType eRelationType)
{
std::scoped_lock aGuard (maMutex);
AccessibleRelation defaultRelation; // default is INVALID
AccessibleRelation relationByType = lcl_getRelationByType(maRelations, aRelationType);
AccessibleRelation relationByType = lcl_getRelationByType(maRelations, eRelationType);
return relationByType.RelationType != defaultRelation.RelationType;
}
/** Retrieve and return the relation with the given relation type.
@param aRelationType
The type of the relation to return. This has to be one of the
constants of <type>AccessibleRelationType</type>.
@param eRelationType
The type of the relation to return.
@return
If a relation with the given type could be found than (a copy
If a relation with the given type could be found, then (a copy
of) this relation is returned. Otherwise a relation with the
type INVALID is returned.
*/
AccessibleRelation SAL_CALL
AccessibleRelationSetHelper::getRelationByType( sal_Int16 aRelationType )
AccessibleRelationSetHelper::getRelationByType(AccessibleRelationType eRelationType)
{
std::scoped_lock aGuard (maMutex);
return lcl_getRelationByType(maRelations, aRelationType);
return lcl_getRelationByType(maRelations, eRelationType);
}
void AccessibleRelationSetHelper::AddRelation(const AccessibleRelation& rRelation)

View file

@ -206,8 +206,8 @@ static std::ostream &operator<<(std::ostream &s, NSObject *obj) {
Reference < XAccessibleRelationSet > rxAccessibleRelationSet = [ self accessibleContext ] -> getAccessibleRelationSet();
if( rxAccessibleRelationSet.is() )
{
AccessibleRelation relationMemberOf = rxAccessibleRelationSet -> getRelationByType ( AccessibleRelationType::MEMBER_OF );
if ( relationMemberOf.RelationType == AccessibleRelationType::MEMBER_OF && relationMemberOf.TargetSet.hasElements() )
AccessibleRelation relationMemberOf = rxAccessibleRelationSet -> getRelationByType ( AccessibleRelationType_MEMBER_OF );
if ( relationMemberOf.RelationType == AccessibleRelationType_MEMBER_OF && relationMemberOf.TargetSet.hasElements() )
return relationMemberOf.TargetSet[0];
}
return Reference < XAccessible > ();
@ -341,8 +341,8 @@ static std::ostream &operator<<(std::ostream &s, NSObject *obj) {
if ( mActsAsRadioGroup ) {
NSMutableArray * children = [ [ NSMutableArray alloc ] init ];
Reference < XAccessibleRelationSet > rxAccessibleRelationSet = [ self accessibleContext ] -> getAccessibleRelationSet();
AccessibleRelation const relationMemberOf = rxAccessibleRelationSet -> getRelationByType ( AccessibleRelationType::MEMBER_OF );
if ( relationMemberOf.RelationType == AccessibleRelationType::MEMBER_OF && relationMemberOf.TargetSet.hasElements() ) {
AccessibleRelation const relationMemberOf = rxAccessibleRelationSet -> getRelationByType ( AccessibleRelationType_MEMBER_OF );
if ( relationMemberOf.RelationType == AccessibleRelationType_MEMBER_OF && relationMemberOf.TargetSet.hasElements() ) {
for (Reference <XAccessible> const & rMateAccessible : relationMemberOf.TargetSet ) {
if ( rMateAccessible.is() ) {
Reference< XAccessibleContext > rMateAccessibleContext( rMateAccessible -> getAccessibleContext() );
@ -677,8 +677,8 @@ static std::ostream &operator<<(std::ostream &s, NSObject *obj) {
NSString * title = [ self titleAttribute ];
id titleElement = nil;
if ( [ title length ] == 0 ) {
AccessibleRelation relationLabeledBy = [ self accessibleContext ] -> getAccessibleRelationSet() -> getRelationByType ( AccessibleRelationType::LABELED_BY );
if ( relationLabeledBy.RelationType == AccessibleRelationType::LABELED_BY && relationLabeledBy.TargetSet.hasElements() ) {
AccessibleRelation relationLabeledBy = [ self accessibleContext ] -> getAccessibleRelationSet() -> getRelationByType ( AccessibleRelationType_LABELED_BY );
if ( relationLabeledBy.RelationType == AccessibleRelationType_LABELED_BY && relationLabeledBy.TargetSet.hasElements() ) {
Reference <XAccessible> rxAccessible = relationLabeledBy.TargetSet[0];
titleElement = [ AquaA11yFactory wrapperForAccessibleContext: rxAccessible -> getAccessibleContext() ];
}
@ -692,8 +692,8 @@ static std::ostream &operator<<(std::ostream &s, NSObject *obj) {
-(id)servesAsTitleForUIElementsAttribute {
if ( [ self accessibleContext ] -> getAccessibleRelationSet().is() ) {
id titleForElement = nil;
AccessibleRelation relationLabelFor = [ self accessibleContext ] -> getAccessibleRelationSet() -> getRelationByType ( AccessibleRelationType::LABEL_FOR );
if ( relationLabelFor.RelationType == AccessibleRelationType::LABEL_FOR && relationLabelFor.TargetSet.hasElements() ) {
AccessibleRelation relationLabelFor = [ self accessibleContext ] -> getAccessibleRelationSet() -> getRelationByType ( AccessibleRelationType_LABEL_FOR );
if ( relationLabelFor.RelationType == AccessibleRelationType_LABEL_FOR && relationLabelFor.TargetSet.hasElements() ) {
Reference <XAccessible> rxAccessible = relationLabelFor.TargetSet[0];
titleForElement = [ AquaA11yFactory wrapperForAccessibleContext: rxAccessible -> getAccessibleContext() ];
}
@ -839,10 +839,10 @@ static std::ostream &operator<<(std::ostream &s, NSObject *obj) {
if ( title && ! [ title isEqualToString: @"" ] ) {
[ attributeNames addObject: NSAccessibilityTitleAttribute ];
}
if ( [ title length ] == 0 && rxRelationSet.is() && rxRelationSet -> containsRelation ( AccessibleRelationType::LABELED_BY ) ) {
if ( [ title length ] == 0 && rxRelationSet.is() && rxRelationSet -> containsRelation ( AccessibleRelationType_LABELED_BY ) ) {
[ attributeNames addObject: NSAccessibilityTitleUIElementAttribute ];
}
if ( rxRelationSet.is() && rxRelationSet -> containsRelation ( AccessibleRelationType::LABEL_FOR ) ) {
if ( rxRelationSet.is() && rxRelationSet -> containsRelation ( AccessibleRelationType_LABEL_FOR ) ) {
[ attributeNames addObject: NSAccessibilityServesAsTitleForUIElementsAttribute ];
}
// Special Attributes depending on interface
@ -1156,9 +1156,9 @@ static Reference < XAccessibleContext > hitTestRunner ( css::awt::Point point,
if ( [ element isKindOfClass: [ SalFrameWindow class ] ] && [ self isViewElement: element hitByPoint: point ] ) {
// we have a child window that is hit
Reference < XAccessibleRelationSet > relationSet = [ static_cast<SalFrameWindow *>(element) accessibleContext ] -> getAccessibleRelationSet();
if ( relationSet.is() && relationSet -> containsRelation ( AccessibleRelationType::SUB_WINDOW_OF )) {
if ( relationSet.is() && relationSet -> containsRelation ( AccessibleRelationType_SUB_WINDOW_OF )) {
// we have a valid relation to the parent element
AccessibleRelation const relation = relationSet -> getRelationByType ( AccessibleRelationType::SUB_WINDOW_OF );
AccessibleRelation const relation = relationSet -> getRelationByType ( AccessibleRelationType_SUB_WINDOW_OF );
for (Reference<XAccessible> const & rxAccessible : relation.TargetSet) {
if ( rxAccessible.is() && rxAccessible -> getAccessibleContext().is() ) {
// hit test for children of parent

View file

@ -194,33 +194,33 @@ static AtspiStateType mapAtspiState(sal_Int64 nState)
}
}
static AtspiRelationType mapRelationType(sal_Int16 nRelation)
static AtspiRelationType mapRelationType(AccessibleRelationType eRelation)
{
switch (nRelation)
switch (eRelation)
{
case accessibility::AccessibleRelationType::CONTENT_FLOWS_FROM:
case accessibility::AccessibleRelationType_CONTENT_FLOWS_FROM:
return ATSPI_RELATION_FLOWS_FROM;
case accessibility::AccessibleRelationType::CONTENT_FLOWS_TO:
case accessibility::AccessibleRelationType_CONTENT_FLOWS_TO:
return ATSPI_RELATION_FLOWS_TO;
case accessibility::AccessibleRelationType::CONTROLLED_BY:
case accessibility::AccessibleRelationType_CONTROLLED_BY:
return ATSPI_RELATION_CONTROLLED_BY;
case accessibility::AccessibleRelationType::CONTROLLER_FOR:
case accessibility::AccessibleRelationType_CONTROLLER_FOR:
return ATSPI_RELATION_CONTROLLER_FOR;
case accessibility::AccessibleRelationType::DESCRIBED_BY:
case accessibility::AccessibleRelationType_DESCRIBED_BY:
return ATSPI_RELATION_DESCRIBED_BY;
case accessibility::AccessibleRelationType::LABEL_FOR:
case accessibility::AccessibleRelationType_LABEL_FOR:
return ATSPI_RELATION_LABEL_FOR;
case accessibility::AccessibleRelationType::LABELED_BY:
case accessibility::AccessibleRelationType_LABELED_BY:
return ATSPI_RELATION_LABELLED_BY;
case accessibility::AccessibleRelationType::MEMBER_OF:
case accessibility::AccessibleRelationType_MEMBER_OF:
return ATSPI_RELATION_MEMBER_OF;
case accessibility::AccessibleRelationType::SUB_WINDOW_OF:
case accessibility::AccessibleRelationType_SUB_WINDOW_OF:
return ATSPI_RELATION_SUBWINDOW_OF;
case accessibility::AccessibleRelationType::NODE_CHILD_OF:
case accessibility::AccessibleRelationType_NODE_CHILD_OF:
return ATSPI_RELATION_NODE_CHILD_OF;
default:
return ATSPI_RELATION_NULL;
}
return ATSPI_RELATION_NULL;
}
static std::string debugString(const Atspi::Accessible& pAtspiAccessible)
@ -470,13 +470,13 @@ CPPUNIT_TEST_FIXTURE(Atspi2TestTree, Test1)
CPPUNIT_ASSERT(xLODocFirstChild.is());
CPPUNIT_ASSERT(
!getFirstRelationTargetOfType(xLODocFirstChild->getAccessibleContext(),
accessibility::AccessibleRelationType::CONTENT_FLOWS_FROM));
accessibility::AccessibleRelationType_CONTENT_FLOWS_FROM));
const auto nLODocChildCount = xLODocContext->getAccessibleChildCount();
const auto xLODocLastChild = xLODocContext->getAccessibleChild(nLODocChildCount - 1);
CPPUNIT_ASSERT(xLODocLastChild.is());
CPPUNIT_ASSERT(
!getFirstRelationTargetOfType(xLODocLastChild->getAccessibleContext(),
accessibility::AccessibleRelationType::CONTENT_FLOWS_TO));
accessibility::AccessibleRelationType_CONTENT_FLOWS_TO));
// END HACK
auto xContext = getWindowAccessibleContext();

View file

@ -938,7 +938,7 @@ sal_Int64 Atspi2TestTree::swChildIndex(uno::Reference<accessibility::XAccessible
for (sal_Int64 n = 0;; n++)
{
auto xPrev = getFirstRelationTargetOfType(
xContext, accessibility::AccessibleRelationType::CONTENT_FLOWS_FROM);
xContext, accessibility::AccessibleRelationType_CONTENT_FLOWS_FROM);
if (!xPrev.is())
return n;
xContext = xPrev;
@ -977,7 +977,7 @@ void Atspi2TestTree::testSwScroll(
do
{
xLONextContext = getFirstRelationTargetOfType(
xLONextContext, accessibility::AccessibleRelationType::CONTENT_FLOWS_TO);
xLONextContext, accessibility::AccessibleRelationType_CONTENT_FLOWS_TO);
xLONextText.set(xLONextContext, uno::UNO_QUERY);
nAfterLast++;
} while (xLONextContext.is() && !xLONextText.is());

View file

@ -219,35 +219,35 @@ sal_Int16 lcl_matchQtTextBoundaryType(QAccessible::TextBoundaryType boundaryType
return -1;
}
QAccessible::Relation lcl_matchUnoRelation(short relationType)
QAccessible::Relation lcl_matchUnoRelation(AccessibleRelationType eRelationType)
{
// Qt semantics is the other way around
switch (relationType)
switch (eRelationType)
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 6, 0)
case AccessibleRelationType::CONTENT_FLOWS_FROM:
case AccessibleRelationType_CONTENT_FLOWS_FROM:
return QAccessible::FlowsTo;
case AccessibleRelationType::CONTENT_FLOWS_TO:
case AccessibleRelationType_CONTENT_FLOWS_TO:
return QAccessible::FlowsFrom;
#endif
case AccessibleRelationType::CONTROLLED_BY:
case AccessibleRelationType_CONTROLLED_BY:
return QAccessible::Controller;
case AccessibleRelationType::CONTROLLER_FOR:
case AccessibleRelationType_CONTROLLER_FOR:
return QAccessible::Controlled;
#if QT_VERSION >= QT_VERSION_CHECK(6, 6, 0)
case AccessibleRelationType::DESCRIBED_BY:
case AccessibleRelationType_DESCRIBED_BY:
return QAccessible::DescriptionFor;
#endif
case AccessibleRelationType::LABELED_BY:
case AccessibleRelationType_LABELED_BY:
return QAccessible::Label;
case AccessibleRelationType::LABEL_FOR:
case AccessibleRelationType_LABEL_FOR:
return QAccessible::Labelled;
case AccessibleRelationType::INVALID:
case AccessibleRelationType::MEMBER_OF:
case AccessibleRelationType::SUB_WINDOW_OF:
case AccessibleRelationType::NODE_CHILD_OF:
case AccessibleRelationType_INVALID:
case AccessibleRelationType_MEMBER_OF:
case AccessibleRelationType_SUB_WINDOW_OF:
case AccessibleRelationType_NODE_CHILD_OF:
default:
SAL_WARN("vcl.qt", "Unmatched relation: " << relationType);
SAL_WARN("vcl.qt", "Unmatched relation: " << static_cast<int>(eRelationType));
return {};
}
}

View file

@ -6308,7 +6308,7 @@ a11yrelationset SalInstanceDrawingArea::get_accessible_relation_set()
pLabeledBy->GetAccessible()
};
pRelationSetHelper->AddRelation(css::accessibility::AccessibleRelation(
css::accessibility::AccessibleRelationType::LABELED_BY, aSequence));
css::accessibility::AccessibleRelationType_LABELED_BY, aSequence));
}
vcl::Window* pMemberOf = pWindow->GetAccessibleRelationMemberOf();
if (pMemberOf && pMemberOf != pWindow)
@ -6317,7 +6317,7 @@ a11yrelationset SalInstanceDrawingArea::get_accessible_relation_set()
pMemberOf->GetAccessible()
};
pRelationSetHelper->AddRelation(css::accessibility::AccessibleRelation(
css::accessibility::AccessibleRelationType::MEMBER_OF, aSequence));
css::accessibility::AccessibleRelationType_MEMBER_OF, aSequence));
}
}
return pRelationSetHelper;

View file

@ -61,45 +61,45 @@ using namespace ::com::sun::star;
static GObjectClass *parent_class = nullptr;
static AtkRelationType mapRelationType( sal_Int16 nRelation )
static AtkRelationType mapRelationType(accessibility::AccessibleRelationType eRelation)
{
AtkRelationType type = ATK_RELATION_NULL;
switch( nRelation )
switch (eRelation)
{
case accessibility::AccessibleRelationType::CONTENT_FLOWS_FROM:
case accessibility::AccessibleRelationType_CONTENT_FLOWS_FROM:
type = ATK_RELATION_FLOWS_FROM;
break;
case accessibility::AccessibleRelationType::CONTENT_FLOWS_TO:
case accessibility::AccessibleRelationType_CONTENT_FLOWS_TO:
type = ATK_RELATION_FLOWS_TO;
break;
case accessibility::AccessibleRelationType::CONTROLLED_BY:
case accessibility::AccessibleRelationType_CONTROLLED_BY:
type = ATK_RELATION_CONTROLLED_BY;
break;
case accessibility::AccessibleRelationType::CONTROLLER_FOR:
case accessibility::AccessibleRelationType_CONTROLLER_FOR:
type = ATK_RELATION_CONTROLLER_FOR;
break;
case accessibility::AccessibleRelationType::LABEL_FOR:
case accessibility::AccessibleRelationType_LABEL_FOR:
type = ATK_RELATION_LABEL_FOR;
break;
case accessibility::AccessibleRelationType::LABELED_BY:
case accessibility::AccessibleRelationType_LABELED_BY:
type = ATK_RELATION_LABELLED_BY;
break;
case accessibility::AccessibleRelationType::MEMBER_OF:
case accessibility::AccessibleRelationType_MEMBER_OF:
type = ATK_RELATION_MEMBER_OF;
break;
case accessibility::AccessibleRelationType::SUB_WINDOW_OF:
case accessibility::AccessibleRelationType_SUB_WINDOW_OF:
type = ATK_RELATION_SUBWINDOW_OF;
break;
case accessibility::AccessibleRelationType::NODE_CHILD_OF:
case accessibility::AccessibleRelationType_NODE_CHILD_OF:
type = ATK_RELATION_NODE_CHILD_OF;
break;

View file

@ -410,25 +410,25 @@ static void applyRelations(LoAccessible* pLoAccessible,
css::accessibility::AccessibleRelation aRelation = xRelationSet->getRelation(i);
switch (aRelation.RelationType)
{
case css::accessibility::AccessibleRelationType::CONTENT_FLOWS_TO:
case css::accessibility::AccessibleRelationType_CONTENT_FLOWS_TO:
eGtkRelation = GTK_ACCESSIBLE_RELATION_FLOW_TO;
break;
case css::accessibility::AccessibleRelationType::CONTROLLER_FOR:
case css::accessibility::AccessibleRelationType_CONTROLLER_FOR:
eGtkRelation = GTK_ACCESSIBLE_RELATION_CONTROLS;
break;
case css::accessibility::AccessibleRelationType::DESCRIBED_BY:
case css::accessibility::AccessibleRelationType_DESCRIBED_BY:
eGtkRelation = GTK_ACCESSIBLE_RELATION_DESCRIBED_BY;
break;
case css::accessibility::AccessibleRelationType::LABELED_BY:
case css::accessibility::AccessibleRelationType_LABELED_BY:
eGtkRelation = GTK_ACCESSIBLE_RELATION_LABELLED_BY;
break;
case css::accessibility::AccessibleRelationType::CONTENT_FLOWS_FROM:
case css::accessibility::AccessibleRelationType::CONTROLLED_BY:
case css::accessibility::AccessibleRelationType::INVALID:
case css::accessibility::AccessibleRelationType::LABEL_FOR:
case css::accessibility::AccessibleRelationType::MEMBER_OF:
case css::accessibility::AccessibleRelationType::NODE_CHILD_OF:
case css::accessibility::AccessibleRelationType::SUB_WINDOW_OF:
case css::accessibility::AccessibleRelationType_CONTENT_FLOWS_FROM:
case css::accessibility::AccessibleRelationType_CONTROLLED_BY:
case css::accessibility::AccessibleRelationType_INVALID:
case css::accessibility::AccessibleRelationType_LABEL_FOR:
case css::accessibility::AccessibleRelationType_MEMBER_OF:
case css::accessibility::AccessibleRelationType_NODE_CHILD_OF:
case css::accessibility::AccessibleRelationType_SUB_WINDOW_OF:
// GTK has no equivalent for these
continue;
default:

View file

@ -192,31 +192,31 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CAccRelation::put_XSubInterface(hyper pXSubInt
return S_OK;
}
const wchar_t* CAccRelation::mapToIA2RelationType(sal_Int16 nUnoRelationType)
const wchar_t* CAccRelation::mapToIA2RelationType(AccessibleRelationType eUnoRelationType)
{
switch (nUnoRelationType)
switch (eUnoRelationType)
{
case AccessibleRelationType::CONTENT_FLOWS_FROM:
case AccessibleRelationType_CONTENT_FLOWS_FROM:
return IA2_RELATION_FLOWS_FROM;
case AccessibleRelationType::CONTENT_FLOWS_TO:
case AccessibleRelationType_CONTENT_FLOWS_TO:
return IA2_RELATION_FLOWS_TO;
case AccessibleRelationType::CONTROLLED_BY:
case AccessibleRelationType_CONTROLLED_BY:
return IA2_RELATION_CONTROLLED_BY;
case AccessibleRelationType::CONTROLLER_FOR:
case AccessibleRelationType_CONTROLLER_FOR:
return IA2_RELATION_CONTROLLER_FOR;
case AccessibleRelationType::LABEL_FOR:
case AccessibleRelationType_LABEL_FOR:
return IA2_RELATION_LABEL_FOR;
case AccessibleRelationType::LABELED_BY:
case AccessibleRelationType_LABELED_BY:
return IA2_RELATION_LABELED_BY;
case AccessibleRelationType::MEMBER_OF:
case AccessibleRelationType_MEMBER_OF:
return IA2_RELATION_MEMBER_OF;
case AccessibleRelationType::SUB_WINDOW_OF:
case AccessibleRelationType_SUB_WINDOW_OF:
return IA2_RELATION_SUBWINDOW_OF;
case AccessibleRelationType::NODE_CHILD_OF:
case AccessibleRelationType_NODE_CHILD_OF:
return IA2_RELATION_NODE_CHILD_OF;
case AccessibleRelationType::DESCRIBED_BY:
case AccessibleRelationType_DESCRIBED_BY:
return IA2_RELATION_DESCRIBED_BY;
case AccessibleRelationType::INVALID:
case AccessibleRelationType_INVALID:
return L"INVALID";
default:
assert(false && "unhandled AccessibleRelationType");
@ -224,31 +224,31 @@ const wchar_t* CAccRelation::mapToIA2RelationType(sal_Int16 nUnoRelationType)
}
}
sal_Int16 CAccRelation::mapToUnoRelationType(const BSTR aIA2RelationType)
AccessibleRelationType CAccRelation::mapToUnoRelationType(const BSTR aIA2RelationType)
{
if (wcscmp(aIA2RelationType, IA2_RELATION_FLOWS_FROM) == 0)
return AccessibleRelationType::CONTENT_FLOWS_FROM;
return AccessibleRelationType_CONTENT_FLOWS_FROM;
if (wcscmp(aIA2RelationType, IA2_RELATION_FLOWS_TO) == 0)
return AccessibleRelationType::CONTENT_FLOWS_TO;
return AccessibleRelationType_CONTENT_FLOWS_TO;
if (wcscmp(aIA2RelationType, IA2_RELATION_CONTROLLED_BY) == 0)
return AccessibleRelationType::CONTROLLED_BY;
return AccessibleRelationType_CONTROLLED_BY;
if (wcscmp(aIA2RelationType, IA2_RELATION_CONTROLLER_FOR) == 0)
return AccessibleRelationType::CONTROLLER_FOR;
return AccessibleRelationType_CONTROLLER_FOR;
if (wcscmp(aIA2RelationType, IA2_RELATION_LABEL_FOR) == 0)
return AccessibleRelationType::LABEL_FOR;
return AccessibleRelationType_LABEL_FOR;
if (wcscmp(aIA2RelationType, IA2_RELATION_LABELED_BY) == 0)
return AccessibleRelationType::LABELED_BY;
return AccessibleRelationType_LABELED_BY;
if (wcscmp(aIA2RelationType, IA2_RELATION_MEMBER_OF) == 0)
return AccessibleRelationType::MEMBER_OF;
return AccessibleRelationType_MEMBER_OF;
if (wcscmp(aIA2RelationType, IA2_RELATION_SUBWINDOW_OF) == 0)
return AccessibleRelationType::SUB_WINDOW_OF;
return AccessibleRelationType_SUB_WINDOW_OF;
if (wcscmp(aIA2RelationType, IA2_RELATION_NODE_CHILD_OF) == 0)
return AccessibleRelationType::NODE_CHILD_OF;
return AccessibleRelationType_NODE_CHILD_OF;
if (wcscmp(aIA2RelationType, IA2_RELATION_DESCRIBED_BY) == 0)
return AccessibleRelationType::DESCRIBED_BY;
return AccessibleRelationType_DESCRIBED_BY;
// not all IAccessible2 relation types have a UNO equivalent
return AccessibleRelationType::INVALID;
return AccessibleRelationType_INVALID;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -22,9 +22,12 @@
#include "Resource.h" // main symbols
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
#include "UNOXWrapper.h"
using css::accessibility::AccessibleRelationType;
/**
* CAccRelation implements IAccessibleRelation interface.
*/
@ -74,8 +77,8 @@ public:
// Override of IUNOXWrapper.
STDMETHOD(put_XSubInterface)(hyper pXSubInterface) override;
static const wchar_t* mapToIA2RelationType(sal_Int16 nUnoRelationType);
static sal_Int16 mapToUnoRelationType(const BSTR aIA2RelationType);
static const wchar_t* mapToIA2RelationType(AccessibleRelationType eUnoRelationType);
static AccessibleRelationType mapToUnoRelationType(const BSTR aIA2RelationType);
private:
css::accessibility::AccessibleRelation relation;

View file

@ -713,7 +713,7 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CMAccessible::get_accKeyboardShortcut(VARIANT
AccessibleRelation accRelation;
for(int i=0; i<nRelCount ; i++)
{
if (pRrelationSet->getRelation(i).RelationType == AccessibleRelationType::LABELED_BY)
if (pRrelationSet->getRelation(i).RelationType == AccessibleRelationType_LABELED_BY)
{
accRelation = pRrelationSet->getRelation(i);
paccRelation = &accRelation;
@ -736,7 +736,7 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CMAccessible::get_accKeyboardShortcut(VARIANT
paccRelation = nullptr;
for(int j=0; j<nRelCount ; j++)
{
if (pRrelationSet->getRelation(j).RelationType == AccessibleRelationType::LABEL_FOR)
if (pRrelationSet->getRelation(j).RelationType == AccessibleRelationType_LABEL_FOR)
{
accRelation = pRrelationSet->getRelation(j);
paccRelation = &accRelation;
@ -1765,7 +1765,7 @@ static XAccessible* getTheParentOfMember(XAccessible* pXAcc)
for(sal_Int32 i=0 ; i<nRelations ; i++)
{
AccessibleRelation accRelation = pRrelationSet->getRelation(i);
if (accRelation.RelationType == AccessibleRelationType::MEMBER_OF)
if (accRelation.RelationType == AccessibleRelationType_MEMBER_OF)
{
Sequence<Reference<XAccessible>> xTargets = accRelation.TargetSet;
return xTargets[0].get();
@ -1834,7 +1834,7 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CMAccessible::get_groupPosition(long __RPC_FAR
for(int i=0 ; i<nRel ; i++)
{
AccessibleRelation accRelation = pRrelationSet->getRelation(i);
if (accRelation.RelationType == AccessibleRelationType::MEMBER_OF)
if (accRelation.RelationType == AccessibleRelationType_MEMBER_OF)
{
Sequence<Reference<XAccessible>> xTargets = accRelation.TargetSet;
@ -2727,12 +2727,12 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CMAccessible::get_relationTargetsOfType(BSTR t
if (!xRelationSet.is())
return S_FALSE;
const sal_Int16 nUnoRelationType = CAccRelation::mapToUnoRelationType(type);
if (nUnoRelationType == AccessibleRelationType::INVALID)
const AccessibleRelationType eUnoRelationType = CAccRelation::mapToUnoRelationType(type);
if (eUnoRelationType == AccessibleRelationType_INVALID)
return S_FALSE;
AccessibleRelation aRelation = xRelationSet->getRelationByType(nUnoRelationType);
if (aRelation.RelationType != nUnoRelationType || !aRelation.TargetSet.hasElements())
AccessibleRelation aRelation = xRelationSet->getRelationByType(eUnoRelationType);
if (aRelation.RelationType != eUnoRelationType || !aRelation.TargetSet.hasElements())
return S_FALSE;
const sal_Int32 nRetCount