diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2024-11-06 18:54:12 +0100 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2024-11-07 08:50:13 +0100 |
commit | 92a36bbd4f3e9ad5d2741f55fe4ac7f03f7e2531 (patch) | |
tree | cca5a42833428cc1041100e476a3060f849ee369 /offapi/com/sun | |
parent | f0d8873f511a3eb951f50bc2ee2ed9b2a2cad4e4 (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 'offapi/com/sun')
3 files changed, 20 insertions, 29 deletions
diff --git a/offapi/com/sun/star/accessibility/AccessibleRelation.idl b/offapi/com/sun/star/accessibility/AccessibleRelation.idl index e2228dcea0cf..4c2d45295945 100644 --- a/offapi/com/sun/star/accessibility/AccessibleRelation.idl +++ b/offapi/com/sun/star/accessibility/AccessibleRelation.idl @@ -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. diff --git a/offapi/com/sun/star/accessibility/AccessibleRelationType.idl b/offapi/com/sun/star/accessibility/AccessibleRelationType.idl index d7e77900359e..03ebf9f2769e 100644 --- a/offapi/com/sun/star/accessibility/AccessibleRelationType.idl +++ b/offapi/com/sun/star/accessibility/AccessibleRelationType.idl @@ -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 }; }; }; }; }; diff --git a/offapi/com/sun/star/accessibility/XAccessibleRelationSet.idl b/offapi/com/sun/star/accessibility/XAccessibleRelationSet.idl index c58fb38b5a1a..a93258fd9490 100644 --- a/offapi/com/sun/star/accessibility/XAccessibleRelationSet.idl +++ b/offapi/com/sun/star/accessibility/XAccessibleRelationSet.idl @@ -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); }; }; }; }; }; |