Reporting indent in Word with UIA (fix-up) (#12924)
Fixes #12899
Fix-up of #12908
Relates to #12770
Summary of the issue:
Historically, the indent in NVDA is reported via object model and its terminology is similar to what is found in Word's paragraph formatting dialog.
In #12908, reporting indant via UIA has been introduced. A mapping between UIA text attributes relative to indent and the type of indent that is reported was used. This mapping was doing the following assumption:
UIA first line indent corresponds to Word's first line indent
UIA leading indent corresponds to Word's left indent
UIA trailing indent corresponds to Word's right indent
This assumption is not always correct for the first two points. And you can seen that object model access. And UIA access give not the same results in the following examples:
left indent = 2.5cm and first line indent = 2.5cm
left indent = 2.5cm and first line negative indent = 2.5cm
Moreover, first line negative was reported in the object model code, whereas it does not appear at all in the UIA code, what evidences missing code.
Description of how this pull request fixes the issue:
Correct matching between Word's and UIA terminology has been implemented. To clarify:
Word's terminology
left indent = distance from the left margin to the left-most start of a line (it may be the first line or the following lines)
right indent = distance from the right margin to the end of the paragraph's lines (except the last that may be incomplete)
first line indent = distance between the start of the first line and the start of the other lines when the first line starts after the other ones
hanging indent = distance between the start of the first line and the start of the other lines when the first line starts before the other ones
UIA terminology
first line indent = distance from the left margin to the start of the first line of the paragraph
leading indent: distance from the left margin to the start of the following lines (2nd, 3rd, etc.)
trailing indent = distance from the right margin to the end of the paragraph's lines (except the last that may be incomplete)
Addition: do not report zero indent
In addition, I have removed reporting any type of indent when its value is zero. Indeed, it was not reported in this case with the object model access, and I felt it was worth continuing in this way. Moreover, in #12908, nothing has been indicated that zero values should now be reported, so I assumed that it was unintentional.
Possible alternative design
I have aligned what is reported to what preexisted with the object model access, since in #12908 no information was indicating that it should have been modified.
But another option may have been to report indentation as provided by UIA and to align the object model access code to what is provided by UIA.
I have also not chosen this alternative design because I think that today, only Word provides indentation information via UIA. Thus, this makes sense to follow with Words conventions. If another provider should provide indent information one day, maybe the way indentation is reported should be reconsidered and uniformed.
Should you however prefer this alternative design, just let me know.
Testing strategy:
Tested various paragraph formatting with non-zero left indent and the 3 following cases:
no first line indent
first line indent > 0
negative indent > 0