|
43 | 43 | import winVersion |
44 | 44 |
|
45 | 45 |
|
| 46 | +paragraphIndentIDs = { |
| 47 | + UIAHandler.UIA_IndentationFirstLineAttributeId: "first-line-indent", |
| 48 | + UIAHandler.UIA_IndentationLeadingAttributeId: "left-indent", |
| 49 | + UIAHandler.UIA_IndentationTrailingAttributeId: "right-indent", |
| 50 | +} |
| 51 | + |
46 | 52 | class UIATextInfo(textInfos.TextInfo): |
47 | 53 |
|
48 | 54 | _cache_controlFieldNVDAObjectClass=True |
@@ -168,6 +174,8 @@ def _getFormatFieldAtRange(self,textRange,formatConfig,ignoreMixedValues=False): |
168 | 174 | UIAHandler.UIA_IsSuperscriptAttributeId, |
169 | 175 | UIAHandler.UIA_IsSubscriptAttributeId |
170 | 176 | }) |
| 177 | + if formatConfig["reportParagraphIndentation"]: |
| 178 | + IDs.update(set(paragraphIndentIDs)) |
171 | 179 | if formatConfig["reportAlignment"]: |
172 | 180 | IDs.add(UIAHandler.UIA_HorizontalTextAlignmentAttributeId) |
173 | 181 | if formatConfig["reportColor"]: |
@@ -223,6 +231,21 @@ def _getFormatFieldAtRange(self,textRange,formatConfig,ignoreMixedValues=False): |
223 | 231 | val=fetcher.getValue(UIAHandler.UIA_StyleNameAttributeId,ignoreMixedValues=ignoreMixedValues) |
224 | 232 | if val!=UIAHandler.handler.reservedNotSupportedValue: |
225 | 233 | formatField["style"]=val |
| 234 | + if formatConfig["reportParagraphIndentation"]: |
| 235 | + for ID, fieldAttr in paragraphIndentIDs.items(): |
| 236 | + val = fetcher.getValue(ID, ignoreMixedValues=ignoreMixedValues) |
| 237 | + if isinstance(val, float): |
| 238 | + # val is in points (1/72 of an inch) |
| 239 | + val /= 72.0 |
| 240 | + if languageHandler.useImperialMeasurements(): |
| 241 | + # Translators: a measurement in inches |
| 242 | + valText = _("{val:.2f} in").format(val=val) |
| 243 | + else: |
| 244 | + # Convert from inches to centermetres |
| 245 | + val *= 2.54 |
| 246 | + # Translators: a measurement in centermetres |
| 247 | + valText = _("{val:.2f} cm").format(val=val) |
| 248 | + formatField[fieldAttr] = valText |
226 | 249 | if formatConfig["reportAlignment"]: |
227 | 250 | val=fetcher.getValue(UIAHandler.UIA_HorizontalTextAlignmentAttributeId,ignoreMixedValues=ignoreMixedValues) |
228 | 251 | if val==UIAHandler.HorizontalTextAlignment_Left: |
|
0 commit comments