summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2023-12-18 09:10:36 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2023-12-19 09:30:23 +0100
commiteef4d5cbd10a042bd3b5fb555e0bf9b0dd7d1215 (patch)
tree4b6545048b72bb40c213e8292d708bd6f76e312a /vcl
parent8bc6119812223643b50dcd22c504f9f853976352 (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 'vcl')
-rw-r--r--vcl/source/window/menu.cxx11
1 files changed, 11 insertions, 0 deletions
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 0a065589a41f..2dbba65ba245 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -907,6 +907,17 @@ void Menu::CheckItem( std::u16string_view rIdent , bool bCheck )
CheckItem( GetItemId( rIdent ), bCheck );
}
+bool Menu::IsItemCheckable(sal_uInt16 nItemId) const
+{
+ size_t nPos;
+ MenuItemData* pData = pItemList->GetData(nItemId, nPos);
+
+ if (!pData)
+ return false;
+
+ return pData->HasCheck();
+}
+
bool Menu::IsItemChecked( sal_uInt16 nItemId ) const
{
size_t nPos;