summaryrefslogtreecommitdiff
path: root/winaccessibility
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2023-11-13 15:53:44 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2023-11-14 08:09:02 +0100
commitd6c6472bbe1c90b733a4d69c4c8528f4de3750d3 (patch)
treec8a36eea0bd19c3a3c2a866222a8d178e9be1a90 /winaccessibility
parent74c1e23c80eef5e246acfbfdf2287b49303ecc6f (diff)
tdf#123864 a11y: Add new AccessibleStateType::CHECKABLE
Both, AT-SPI and IAccessible2 have a CHECKABLE state that describes whether an item is checkable, i.e. whether it can be checked, i.e. whether it is possible that this object can have the CHECKED state. So far, LibreOffice didn't have any equivalent, and e.g. a checkbox that is ticked would report state CHECKED but not CHECKABLE, which is inconsistent. ("How can an object that is not checkable be checked?") For an unchecked object, the fact that it can be checked is unclear since that one will just have the CHECKED state not being present. Introduce a new a11y state, `AccessibleStateType::CHECKABLE` with the same semantics as in AT-SPI and IAccessible2 to bridge the gap. Map the state in winaccessibility (to IAccessible2), gtk3 and an the Qt-based VCL plugins, which are responsible for mapping to AT-SPI. While Qt has an equivalent state flag, it currently doesn't map that to AT-SPI yet. Pending upstream Gerrit change to implement that: [1] The gtk4 a11y API doesn't have a direct equivalent and will be handled separately in a following commit. Reporting the new state where applicable will be implemented in following commits. [1] https://codereview.qt-project.org/c/qt/qtbase/+/517844 Change-Id: I6aa7fec3b3bd728a5cfedcdc8d6b66f06337f7ce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159382 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'winaccessibility')
-rw-r--r--winaccessibility/source/UAccCOM/MAccessible.cxx10
1 files changed, 8 insertions, 2 deletions
diff --git a/winaccessibility/source/UAccCOM/MAccessible.cxx b/winaccessibility/source/UAccCOM/MAccessible.cxx
index d126fc31d716..7497a2f09f7e 100644
--- a/winaccessibility/source/UAccCOM/MAccessible.cxx
+++ b/winaccessibility/source/UAccCOM/MAccessible.cxx
@@ -128,7 +128,7 @@ bool queryTableCell(XAccessible* pXAcc, XInterface** ppXI)
}
-void lcl_addIA2State(AccessibleStates& rStates, sal_Int64 nUnoState)
+void lcl_addIA2State(AccessibleStates& rStates, sal_Int64 nUnoState, sal_Int16 nRole)
{
switch (nUnoState)
{
@@ -138,6 +138,12 @@ void lcl_addIA2State(AccessibleStates& rStates, sal_Int64 nUnoState)
case css::accessibility::AccessibleStateType::ARMED:
rStates |= IA2_STATE_ARMED;
break;
+ case css::accessibility::AccessibleStateType::CHECKABLE:
+ // STATE_SYSTEM_PRESSED is used instead of STATE_SYSTEM_CHECKED for these button
+ // roles (s. AccObject::GetMSAAStateFromUNO), so don't set CHECKABLE state for them
+ if (nRole != AccessibleRole::PUSH_BUTTON && nRole != AccessibleRole::TOGGLE_BUTTON)
+ rStates |= IA2_STATE_CHECKABLE;
+ break;
case css::accessibility::AccessibleStateType::DEFUNC:
rStates |= IA2_STATE_DEFUNCT;
break;
@@ -2592,7 +2598,7 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CMAccessible::get_states(AccessibleStates __RP
{
sal_Int64 nUnoState = sal_Int64(1) << i;
if (nRStateSet & nUnoState)
- lcl_addIA2State(*states, nUnoState);
+ lcl_addIA2State(*states, nUnoState, m_xContext->getAccessibleRole());
}
return S_OK;