|
1 | 1 | # This file is covered by the GNU General Public License. |
2 | 2 | # A part of NonVisual Desktop Access (NVDA) |
3 | 3 | # See the file COPYING for more details. |
4 | | -# Copyright (C) 2016-2022 NV Access Limited, Joseph Lee, Jakub Lukowicz |
| 4 | +# Copyright (C) 2016-2023 NV Access Limited, Joseph Lee, Jakub Lukowicz, Cyrille Bougot |
5 | 5 |
|
6 | 6 | from typing import ( |
7 | 7 | Optional, |
@@ -448,6 +448,24 @@ def _getFormatFieldAtRange(self, textRange, formatConfig, ignoreMixedValues=Fals |
448 | 448 | if isinstance(textColumnNumber, int): |
449 | 449 | formatField.field['text-column-number'] = textColumnNumber |
450 | 450 | return formatField |
| 451 | + |
| 452 | + def _getIndentValueDisplayString(self, val: float) -> str: |
| 453 | + """A function returning the string to display in formatting info in Word documents. |
| 454 | + @param val: an indent value measured in points, fetched via |
| 455 | + an UIAHandler.UIA_Indentation*AttributeId attribute. |
| 456 | + @return: The string used in formatting information to report the length of an indentation. |
| 457 | + """ |
| 458 | + |
| 459 | + if self.obj.WinwordApplicationObject: |
| 460 | + # When Word object model is available we honour Word's options to report distances so that what is |
| 461 | + # reported by NVDA matches Word's UI (rulers, paragraph formatting dialog, etc.) |
| 462 | + # Default seem to be inch or centimeters for Western countries localization of Word and characters for |
| 463 | + # east Asian localisations. |
| 464 | + return self.obj.getLocalizedMeasurementTextForPointSize(val) |
| 465 | + |
| 466 | + # If Word object model is not available, we just fallback to general UIA case, i.e. use Windows regional |
| 467 | + # settings. |
| 468 | + return super()._getIndentValueDisplayString(val) |
451 | 469 |
|
452 | 470 |
|
453 | 471 | class WordBrowseModeDocument(UIABrowseModeDocument): |
|
0 commit comments