|
1 | | -#NVDAObjects/IAccessible/msOffice.py |
2 | | -#A part of NonVisual Desktop Access (NVDA) |
3 | | -#This file is covered by the GNU General Public License. |
4 | | -#See the file COPYING for more details. |
5 | | -#Copyright (C) 2006-2010 Michael Curran <mick@kulgan.net>, James Teh <jamie@jantrid.net> |
| 1 | +# -*- coding: UTF-8 -*- |
| 2 | +# A part of NonVisual Desktop Access (NVDA) |
| 3 | +# Copyright (C) 2006-2020 NV Access Limited, Manish Agrawal, Łukasz Golonka |
| 4 | +# This file may be used under the terms of the GNU General Public License, version 2 or later. |
| 5 | +# For more details see: https://www.gnu.org/licenses/gpl-2.0.html |
6 | 6 |
|
7 | 7 | import oleacc |
8 | 8 | import IAccessibleHandler |
@@ -180,3 +180,36 @@ def script_selectGraphic(self, gesture): |
180 | 180 | "kb:leftArrow": "selectGraphic", |
181 | 181 | "kb:rightArrow": "selectGraphic", |
182 | 182 | } |
| 183 | + |
| 184 | + |
| 185 | +class StatusBar (IAccessible): |
| 186 | + |
| 187 | + def _get_role(self): |
| 188 | + """ #4257: Status bar in Office applications does not expose proper role via IAccessible. |
| 189 | +We cannot acces it via UIA because it does not fire focus events when focused for the first time. |
| 190 | +Fortunately accValue contains "status bar" and is not localized. |
| 191 | +""" |
| 192 | + accValue = self.IAccessibleObject.accValue(self.IAccessibleChildID) |
| 193 | + if accValue == 'Ribbon Tab': |
| 194 | + return controlTypes.ROLE_TAB |
| 195 | + if accValue == 'Status Bar': |
| 196 | + return controlTypes.ROLE_STATUSBAR |
| 197 | + return super()._get_role() |
| 198 | + |
| 199 | + def _get_description(self): |
| 200 | + return "" |
| 201 | + |
| 202 | + def _get_isPresentableFocusAncestor(self): |
| 203 | + accValue = self.IAccessibleObject.accValue(self.IAccessibleChildID) |
| 204 | + if accValue == "Ribbon": |
| 205 | + return False |
| 206 | + return super().isPresentableFocusAncestor |
| 207 | + |
| 208 | + |
| 209 | +class RibbonSection (IAccessible): |
| 210 | + |
| 211 | + def _get_role(self): |
| 212 | + accValue = self.IAccessibleObject.accValue(self.IAccessibleChildID) |
| 213 | + if accValue == "Group": |
| 214 | + return controlTypes.ROLE_GROUPING |
| 215 | + return super()._get_role() |
0 commit comments