Skip to content

Commit

Permalink
soffice: Implement methods for status bar announcement (nvaccess#14933)
Browse files Browse the repository at this point in the history
Fixes nvaccess#11698

Summary of the issue:
Announcement of the status bar in LibreOffice (e.g. triggered by NVDA+End) didn't work because the default implementations do not work for the LibreOffice case.

Description of user facing changes
Announcement of the status bar (e.g. triggered
by NVDA+End) works for LibreOffice.

Description of development approach
Override the default app module implementation to retrieve the status bar and announce its text in the LibreOffice app module, since the default implementations are not sufficient for the LibreOffice case:

To retrieve the status bar object, locate the descendant with the corresponding role, but only descend into children of role ROOTPANE and WINDOW for performance reasons.

To generate text from the status bar object, retrieve the text of each status bar child using the IAccessibleText interface. (The default implementation in api.py only uses the object names and values, which are both empty.)
  • Loading branch information
michaelweghorn committed Jun 2, 2023
1 parent 4b18a9c commit 62536a9
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
29 changes: 29 additions & 0 deletions source/appModules/soffice.py
Expand Up @@ -4,6 +4,7 @@
# Copyright (C) 2006-2022 NV Access Limited, Bill Dengler, Leonard de Ruijter

from typing import (
Optional,
Union
)

Expand All @@ -17,6 +18,7 @@
import textInfos
import colors
from compoundDocuments import CompoundDocument, TreeCompoundTextInfo
from NVDAObjects import NVDAObject
from NVDAObjects.IAccessible import IAccessible, IA2TextTextInfo
from NVDAObjects.behaviors import EditableText
from logHandler import log
Expand Down Expand Up @@ -340,3 +342,30 @@ def event_NVDAObject_init(self, obj):
# This is a word processor document.
obj.description = None
obj.treeInterceptorClass = SymphonyDocument

def searchStatusBar(self, obj: NVDAObject, max_depth: int = 5) -> Optional[NVDAObject]:
"""Searches for and returns the status bar object
if either the object itself or one of its recursive children
(up to the given depth) has the corresponding role."""
if obj.role == controlTypes.Role.STATUSBAR:
return obj
if max_depth < 1 or obj.role not in {controlTypes.Role.ROOTPANE, controlTypes.Role.WINDOW}:
return None
for child in obj.children:
status_bar = self.searchStatusBar(child, max_depth - 1)
if status_bar:
return status_bar
return None

def _get_statusBar(self) -> Optional[NVDAObject]:
return self.searchStatusBar(api.getForegroundObject())

def getStatusBarText(self, obj: NVDAObject) -> str:
text = ""
for child in obj.children:
textObj = child.IAccessibleTextObject
if textObj:
if text:
text += " "
text += textObj.textAtOffset(0, IA2.IA2_TEXT_BOUNDARY_ALL)[2]
return text
7 changes: 5 additions & 2 deletions user_docs/en/changes.t2t
Expand Up @@ -33,8 +33,11 @@ There are now gestures for showing the braille settings dialog, accessing the st
- Updated LibLouis braille translator to [3.25.0 https://github.com/liblouis/liblouis/releases/tag/v3.25.0]. (#14719)
- CLDR has been updated to version 43.0. (#14918)
- Dash and em-dash symbols will always be sent to the synthesizer. (#13830)
- LibreOffice changes:
- When reporting the review cursor location, the current cursor/caret location is now reported relative to the current page in LibreOffice Writer for LibreOffice versions >= 7.6, similar to what is done for Microsoft Word. (#11696)
- Announcement of the status bar (e.g. triggered by ``NVDA+end``) works for LibreOffice. (#11698)
-
- Distance reported in Microsoft Word will now honour the unit defined in Word's advanced options even when using UIA to access Word documents. (#14542)
- When reporting the review cursor location, the current cursor/caret location is now reported relative to the current page in LibreOffice Writer for LibreOffice versions >= 7.6, similar to what is done for Microsoft Word. (#11696)
- NVDA responds faster when moving the cursor in edit controls. (#14708)
- Baum Braille driver: addes several Braille chord gestures for performing common keyboard commands such as windows+d, alt+tab etc. Please refer to the NVDA user guide for a full list. (#14714)
- When using a Braille Display via the Standard HID braille driver, the dpad can be used to emulate the arrow keys and enter. Also space+dot1 and space+dot4 now map to up and down arrow respectively. (#14713)
Expand Down Expand Up @@ -112,7 +115,7 @@ Instead, functions should be weakly referenceable. (#14627)
Instead import from ``hwIo.ioThread``. (#14627)
- ``IoThread.autoDeleteApcReference`` is deprecated.
It was introduced in NVDA 2023.1 and was never meant to be part of the public API.
Until removal, it behaves as a no-op, i.e. a context manager yielding nothing.
Until removal, it behaves as a no-op, i.e. a context manager yielding nothing. (#14924)
-

= 2023.1 =
Expand Down

0 comments on commit 62536a9

Please sign in to comment.