summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2023-12-18 09:10:36 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2023-12-20 17:09:52 +0100
commit2bd0e347f15c50f354386b775d681243a5dd52a8 (patch)
tree5dff878002ef97035185bb6239d4f448a9bbf396 /vcl
parent42efced9c0e8f7682fe7989bbda6d88d6e5af785 (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> Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161037
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 3a66b962ebd6..82d630742ab5 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;