diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2021-12-09 17:27:51 +0100 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2021-12-10 08:42:40 +0100 |
commit | 8e586c366d0b27646c5bbe7623b6e9bfc4df0e14 (patch) | |
tree | ad4aa0b5fde5ae7ef2a803e6c0ca5ab7f8f4aa2b /sc | |
parent | db3a61cd958f4a70417929cf8e1fa9bfd0bfe5a3 (diff) |
sc a11y: Handle FOCUSED state for cell
Implement handling for the FOCUSED state of a cell, similar to
how 'ScAccessibleSpreadsheet::IsFocused' does for a
spreadsheet.
(The fact that the state was not handled before turned out
to be the cause for the NVDA and Orca screen readers no longer
announcing the focused cell with some other local WIP changes to
winaccessibility and qt5/qt6 accessibility in place.)
Change-Id: I0334e98cd306189196cf3ee2e5e48f87eb3748c5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126619
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/Accessibility/AccessibleCell.cxx | 11 | ||||
-rw-r--r-- | sc/source/ui/inc/AccessibleCell.hxx | 1 |
2 files changed, 12 insertions, 0 deletions
diff --git a/sc/source/ui/Accessibility/AccessibleCell.cxx b/sc/source/ui/Accessibility/AccessibleCell.cxx index 8c6f330e52fa..01670ca7c560 100644 --- a/sc/source/ui/Accessibility/AccessibleCell.cxx +++ b/sc/source/ui/Accessibility/AccessibleCell.cxx @@ -231,6 +231,9 @@ uno::Reference<XAccessibleStateSet> SAL_CALL pStateSet->AddState(AccessibleStateType::DEFUNC); else { + if (IsFocused()) + pStateSet->AddState(AccessibleStateType::FOCUSED); + if (IsFormulaMode()) { pStateSet->AddState(AccessibleStateType::ENABLED); @@ -337,6 +340,14 @@ bool ScAccessibleCell::IsOpaque() const return bOpaque; } +bool ScAccessibleCell::IsFocused() const +{ + if (mpViewShell && mpViewShell->GetViewData().GetCurPos() == maCellAddress) + return mpViewShell->GetActiveWin()->HasFocus(); + + return false; +} + bool ScAccessibleCell::IsSelected() { if (IsFormulaMode()) diff --git a/sc/source/ui/inc/AccessibleCell.hxx b/sc/source/ui/inc/AccessibleCell.hxx index 629eb4994650..c47b739579f1 100644 --- a/sc/source/ui/inc/AccessibleCell.hxx +++ b/sc/source/ui/inc/AccessibleCell.hxx @@ -145,6 +145,7 @@ private: virtual bool IsEditable( const css::uno::Reference<css::accessibility::XAccessibleStateSet>& rxParentStates) override; bool IsOpaque() const; + bool IsFocused() const; bool IsSelected(); static ScDocument* GetDocument(ScTabViewShell* mpViewShell); |