soffice: Support text attrs according to IA2 spec (#15649)
Fixes #15648
Summary of the issue:
So far, LibreOffice was using custom attribute and value
names for reporting text attributes. Spelling errors were
not reported via any attribute. NVDA was using the presence
of a specific underline as heuristic to detect and report
spelling errors.
This works for some cases, but e.g. does not cause misspelled
words on a line being annonced as such when reading a
line in LibreOffice Writer (issue #15648).
Description of user facing changes
Announcement of text attributes also works with
LibreOffice version 24.2 and above.
When announcing a line in LibreOffice Writer, misspelled
words are announced as such with LibreOffice version 24.2
and above.
Description of development approach
Switch LibreOffice from using custom text attribute names
and values to using attributes according to the IAccessible2
text attributes specification
( https://wiki.linuxfoundation.org/accessibility/iaccessible2/textattributes )
instead and implement reporting of the "invalid:spelling;"
attribute for misspelled words:
https://gerrit.libreoffice.org/c/core/+/157804
https://gerrit.libreoffice.org/c/core/+/157845
https://gerrit.libreoffice.org/c/core/+/157867
https://gerrit.libreoffice.org/c/core/+/157939
https://gerrit.libreoffice.org/c/core/+/158088
https://gerrit.libreoffice.org/c/core/+/158089
https://gerrit.libreoffice.org/c/core/+/158090
These changes are contained in LibreOffice >= 24.2.
Adapt NVDA to evaluate those text attributes by
using the already existing implementation from
the IA2TextTextInfo base class in
SymphonyTextInfo._getFormatFieldAndOffsets.
For backwards-compatibility with LibreOffice
versions <= 7.6, keep support for the legacy
attributes and move the handling for that into
a new helper method
SymphonyTextInfo_getFormatFieldFromLegacyAttributesString.
For the case where the legacy attributes are used,
the text attribute string starts with "Version:1;"
(s. the LibreOffice code dropped in
https://gerrit.libreoffice.org/c/core/+/158090 ),
so use that as a criterion what code path to take.
Extract another helper method and address some of the
pre-existing lint issues, but silence
the C901 one for the method that was extracted to handle
the legacy attributes
("'SymphonyTextInfo._getFormatFieldFromLegacyAttributesString' is
too complex (27)").
It's at least already less complex than the single
one was before.