nvda
46a34368 - soffice: Report keyboard-triggered formatting toggles in Writer (#16413)

Commit
1 year ago
soffice: Report keyboard-triggered formatting toggles in Writer (#16413) * soffice: Report keyboard-triggered formatting toggles in Writer ### Link to issue number: Fixes #4248 ### Summary of the issue: When toggling text formatting in LibreOffice Writer using keyboard shortcuts (eg. Ctrl+B for toggling bold when using English UI), NVDA was not reporting whether bold was enabled or not. ### Description of user facing changes In LibreOffice Writer (version 24.8 and newer), when toggling text formatting (bold, italic, underline, subscript/superscript, alignment) using the corresponding keyboard shortcut, NVDA announces the new formatting attribute (e.g. "Bold on", "Bold off"), similar to how it does for Microsoft Word. ### Description of development approach In the SymphonyDocument class, register gestures for keyboard shortcuts that can be used to toggle formatting in LibreOffice Writer. Add a method to handle the gestures, which is the same for all attributes and enables processing of state change events on toolbar buttons until a timeout (of currently 0.15 seconds) is reached. During that time, when a state change event for a toolbar button is received from LibreOffice, the name of the button and its new state (on/off) are announced. This also requires a corresponding change in LibreOffice [1] so that the state change events for toolbar buttons are actually sent, contained in LibreOffice >= 24.8: commit 0425b6eb47830b1fe630dc0128d5049f4b3e5582 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Tue Apr 16 19:02:30 2024 +0200 tdf#160695 wina11y: Send status change events for toolbar buttons Note: An alternative approach querying the text attributes from the IAccessibleText interface instead of the button state would run into the problem that it works reliably when text is selected, but has no clear way to figure out whether or not bold is enabled or not when there's no selection. (The text attributes need to be queried for a given index, but when the text cursor is e.g. in front of the first character of non-bold text, Ctrl+B would enable bold for newly typed text, but querying the text attributes at index 0 of the existing text would still not report bold, resulting in issues like as observed and described in issue #16412 for MS Word.) [1] https://git.libreoffice.org/core/commit/0425b6eb47830b1fe630dc0128d5049f4b3e5582 ### Testing strategy: 1. start NVDA 2. start LibreOffice Writer (current development version, e.g. an upcoming daily build available from [2]). 3. Press Ctrl+B to enable Bold 4. Verify that NVDA announces "Bold on" 5. Press Ctrl+B again to disable bold formatting 6. Verify that NVDA announces "Bold off" 7. Type "hello world" 8. repeat steps 3-6 9. move text cursor to the beginning of the text 10. repeat steps 3-6 11. select the text 12. repeat steps 3-6 13. repeat steps 1-12 for other formatting attributes (Ctrl+I for italic, Ctrl+U for underline,...) [2] https://dev-builds.libreoffice.org/daily/master/current.html ### Known issues with pull request: None ### Code Review Checklist: - [x] Documentation: - Change log entry - User Documentation - Developer / Technical Documentation - Context sensitive help for GUI changes - [x] Testing: - Unit tests - System (end to end) tests - Manual testing - [x] UX of all users considered: - Speech - Braille - Low Vision - Different web browsers - Localization in other languages / culture than English - [x] API is compatible with existing add-ons. - [x] Security precautions taken. * Follow-up: Use @script decorator As suggested in review: https://github.com/nvaccess/nvda/pull/16413#discussion_r1568980382 * Follow-up: Address review comments s. https://github.com/nvaccess/nvda/pull/16413#pullrequestreview-2007798779 * Follow-up: Use function docstring instead of comments s. https://github.com/nvaccess/nvda/pull/16413#pullrequestreview-2008231160 Co-authored-by: Cyrille Bougot <cyrille.bougot2@laposte.net> * Follow-up: Use Sphinx syntax for reference s. https://github.com/nvaccess/nvda/pull/16413#discussion_r1571759738 --------- Co-authored-by: Cyrille Bougot <cyrille.bougot2@laposte.net> Co-authored-by: Sean Budd <sean@nvaccess.org>
Parents
Loading