summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2024-11-06 18:54:12 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2024-11-07 08:50:13 +0100
commit92a36bbd4f3e9ad5d2741f55fe4ac7f03f7e2531 (patch)
treecca5a42833428cc1041100e476a3060f849ee369 /editeng
parentf0d8873f511a3eb951f50bc2ee2ed9b2a2cad4e4 (diff)
[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::star::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
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/accessibility/AccessibleContextBase.cxx14
-rw-r--r--editeng/source/accessibility/AccessibleEditableTextPara.cxx8
2 files changed, 11 insertions, 11 deletions
diff --git a/editeng/source/accessibility/AccessibleContextBase.cxx b/editeng/source/accessibility/AccessibleContextBase.cxx
index d904490751f0..64d58a39092e 100644
--- a/editeng/source/accessibility/AccessibleContextBase.cxx
+++ b/editeng/source/accessibility/AccessibleContextBase.cxx
@@ -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))
diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
index 94b111004544..26bee59e731d 100644
--- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx
+++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
@@ -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 );
}