Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
soffice: Support text attrs according to IA2 spec
### Link to issue number: Fixes nvaccess#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 nvaccess#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. Address some of the pre-existing lint issues, but silence the C901 ones ("'SymphonyTextInfo._getFormatFieldFromLegacyAttributesString' is too complex (27)", same for "_SymphonyTextInfo._getFormatFieldAndOffsets"). Each one of them is at least already less complex than the single one was before, now that it has been split into two methods. ### Testing strategy: Test that incorrect spelling in the middle of a line in LibreOffice Writer gets announced when testing the scenario described in issue nvaccess#15648 with both, the LibreOffice and the NVDA changes in place. Test that the character attributes from the sample document attached to https://bugs.documentfoundation.org/show_bug.cgi?id=157696 works with these changes in NVDA in place, and *both*, * a current LibreOffice development version containing the above-mentioned LibreOffice changes * LibreOffice 7.6.2 which does not contain the above-mentioned changes and therefore triggers the "legacy" code path. ### Known issues with pull request: Requires the above-mentioned LibreOffice changes in addition to actually make the scenario described in issue nvaccess#15648 work. ### Code Review Checklist: - [x] Documentation: - Change log entry - User Documentation - Developer / Technical Documentation - Context sensitive help for GUI changes - [x] Testing: - Unit tests - System (end to end) tests - Manual testing - [x] UX of all users considered: - Speech - Braille - Low Vision - Different web browsers - Localization in other languages / culture than English - [x] API is compatible with existing add-ons. - [x] Security precautions taken.
- Loading branch information