diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2023-12-18 09:10:36 +0100 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2023-12-19 09:30:23 +0100 |
commit | eef4d5cbd10a042bd3b5fb555e0bf9b0dd7d1215 (patch) | |
tree | 4b6545048b72bb40c213e8292d708bd6f76e312a /accessibility | |
parent | 8bc6119812223643b50dcd22c504f9f853976352 (diff) |
tdf#123864 a11y: Handle new checkable state for VCLXAccessibleMenuItem
Add reporting for the new CHECKABLE a11y state introduced in
commit d6c6472bbe1c90b733a4d69c4c8528f4de3750d3
Author: Michael Weghorn <m.weghorn@posteo.de>
Date: Mon Nov 13 15:53:44 2023 +0100
tdf#123864 a11y: Add new AccessibleStateType::CHECKABLE
for `VCLXAccessibleMenuItem`.
`MenuItemData::HasCheck` looks like it already provides
what's needed to say whether an item is checkable, therefore
add a `Menu::IsItemCheckable` that makes use of this and
and a `VCLXAccessibleMenuItem::IsCheckable` that
makes use of that in turn.
Extend `VCLXAccessibleMenuItem::FillAccessibleStateSet` to
use the latter to report the CHECKABLE state accordingly.
Change-Id: Id23196ef2527a71a338102a5143a8bd6fd41db84
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160902
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'accessibility')
-rw-r--r-- | accessibility/inc/standard/vclxaccessiblemenuitem.hxx | 1 | ||||
-rw-r--r-- | accessibility/source/standard/vclxaccessiblemenuitem.cxx | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/accessibility/inc/standard/vclxaccessiblemenuitem.hxx b/accessibility/inc/standard/vclxaccessiblemenuitem.hxx index ddc50a8f3577..4eec5fa6746e 100644 --- a/accessibility/inc/standard/vclxaccessiblemenuitem.hxx +++ b/accessibility/inc/standard/vclxaccessiblemenuitem.hxx @@ -41,6 +41,7 @@ class VCLXAccessibleMenuItem : public cppu::ImplInheritanceHelper< protected: virtual bool IsFocused() override; virtual bool IsSelected() override; + virtual bool IsCheckable(); virtual bool IsChecked() override; virtual bool IsHighlighted() override; diff --git a/accessibility/source/standard/vclxaccessiblemenuitem.cxx b/accessibility/source/standard/vclxaccessiblemenuitem.cxx index 2c4e8043c00b..03bdc88c93c5 100644 --- a/accessibility/source/standard/vclxaccessiblemenuitem.cxx +++ b/accessibility/source/standard/vclxaccessiblemenuitem.cxx @@ -66,6 +66,14 @@ bool VCLXAccessibleMenuItem::IsSelected() return IsHighlighted(); } +bool VCLXAccessibleMenuItem::IsCheckable() +{ + if (!m_pParent) + return false; + + const sal_uInt16 nItemId = m_pParent->GetItemId(m_nItemPos); + return m_pParent->IsItemCheckable(nItemId); +} bool VCLXAccessibleMenuItem::IsChecked() { @@ -107,6 +115,8 @@ void VCLXAccessibleMenuItem::FillAccessibleStateSet( sal_Int64& rStateSet ) if ( IsSelected() ) rStateSet |= AccessibleStateType::SELECTED; + if (IsCheckable()) + rStateSet |= AccessibleStateType::CHECKABLE; if ( IsChecked() ) rStateSet |= AccessibleStateType::CHECKED; } |