diff options
author | Samuel Thibault <sthibault@hypra.fr> | 2019-05-02 17:24:30 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-05-09 13:39:33 +0200 |
commit | b4009daccd11e416865efd5fd3c205c46691bb12 (patch) | |
tree | ae169db727876878617f003999ca9bbf2b7b753a /include | |
parent | 639aba04ce74c3055b3b1c7ea4cd46a06da1f8ed (diff) |
tdf#124400 a11y: add accessible ID
Such ID is not meant to be presented to the user, but to be an ID
which is stable over application development. Typically, this is
the gtkbuilder ID. Such an ID can then be used to identify a given
well-known accessible object independently from the current locale,
user-visible labelling, or dialog structure. This can then be used
for tailored screen reading (e.g. automatically announcing the
content of a well-known object), or for automatic regression testing
(to check the behavior of well-known objects). Uniqueness within
the window is thus desirable when returning a non-empty string.
This adds XAccessibleXContext2 to augment XAccessibleXContext with
getAccessibleId(). The VCL implementation just takes Window::get_id(),
i.e. the gtkbuilder id, which is enough for most use cases for now.
atk_object_wrapper_new then passes it to
atk_object_set_accessible_id() for AT-SPI technologies to pick it up.
Change-Id: Iea0ad08d036e539dbcfec1a9be026c8da8d17357
Reviewed-on: https://gerrit.libreoffice.org/71743
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Jenkins
Diffstat (limited to 'include')
-rw-r--r-- | include/comphelper/accessiblecontexthelper.hxx | 7 | ||||
-rw-r--r-- | include/toolkit/awt/vclxaccessiblecomponent.hxx | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/include/comphelper/accessiblecontexthelper.hxx b/include/comphelper/accessiblecontexthelper.hxx index 7af467872faa..f8182526b280 100644 --- a/include/comphelper/accessiblecontexthelper.hxx +++ b/include/comphelper/accessiblecontexthelper.hxx @@ -22,7 +22,7 @@ #include <cppuhelper/compbase2.hxx> #include <cppuhelper/basemutex.hxx> -#include <com/sun/star/accessibility/XAccessibleContext.hpp> +#include <com/sun/star/accessibility/XAccessibleContext2.hpp> #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> #include <comphelper/comphelperdllapi.h> #include <comphelper/solarmutex.hxx> @@ -37,7 +37,7 @@ namespace comphelper class OContextHelper_Impl; - typedef ::cppu::WeakAggComponentImplHelper2 < css::accessibility::XAccessibleContext, + typedef ::cppu::WeakAggComponentImplHelper2 < css::accessibility::XAccessibleContext2, css::accessibility::XAccessibleEventBroadcaster > OAccessibleContextHelper_Base; @@ -91,6 +91,9 @@ namespace comphelper virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override = 0; virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) override = 0; + // XAccessibleContext2 - default implementation + virtual OUString SAL_CALL getAccessibleId( ) override; + // XAccessibleContext - default implementations /** default implementation for retrieving the index of this object within the parent <p>This basic implementation here returns the index <code>i</code> of the child for which diff --git a/include/toolkit/awt/vclxaccessiblecomponent.hxx b/include/toolkit/awt/vclxaccessiblecomponent.hxx index 8779f0e14237..377dcbc57ce1 100644 --- a/include/toolkit/awt/vclxaccessiblecomponent.hxx +++ b/include/toolkit/awt/vclxaccessiblecomponent.hxx @@ -99,6 +99,7 @@ public: sal_Int16 SAL_CALL getAccessibleRole( ) override; OUString SAL_CALL getAccessibleDescription( ) override; OUString SAL_CALL getAccessibleName( ) override; + OUString SAL_CALL getAccessibleId( ) override; css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override; css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) override; css::lang::Locale SAL_CALL getLocale( ) override; @@ -138,6 +139,7 @@ private: sal_Int16 getAccessibleRole() => VCL Window::GetAccessibleRole() OUString getAccessibleDescription() => VCL Window::GetAccessibleDescription OUString getAccessibleName() => VCL Window::GetAccessibleText() => Most windows return Window::GetText() + OUString getAccessibleId() => VCL Window::get_id() Reference< XAccessibleRelationSet > getAccessibleRelationSet() Reference< XAccessibleStateSet > getAccessibleStateSet() => override FillAccessibleStateSet( ... ) |