Add handling for accSelection returning IDispatch or negative child ID (#13277)
Fixes #13276
Summary of the issue:
In case a single child is selected, IAccessible::get_accSelection can either return the child ID of a selected simple element or an IDispatch for a selected accessible object, s.
https://docs.microsoft.com/en-us/windows/win32/api/oleacc/nf-oleacc-iaccessible-get_accselection
and
https://docs.microsoft.com/en-us/windows/win32/winauto/how-servers-implement-child-ids .
Previously, only positive child IDs were considered in NVDA, while LibreOffice was returning negative child IDs for Calc cells, which does not fit the MSAA spec.
NVDA did not yet support the case where an IDispatch is returned.
Description of how this pull request fixes the issue:
This PR implements the missing handling for an IDispatch returned as accSelection in NVDA.
LibreOffice was adapted to return such a one from LibreOffice 7.4 on, corresponding LibreOffice commit:
https://git.libreoffice.org/core/commit/00c0ee8cf0fac0c933c5ae600e99a64b1c7d4397
In addition, negative child IDs are now also accepted.
As pointed out by James Teh in the discussion on the
initial version of the pull request:
The use of negative child ids doesn't fit well into the IAccessible spec, but
it has been done by IAccessible2 for a very long time and should be considered
standard for all intents and purposes. A negative child id should be treated as
a unique id, while a positive child id should be treated as a child index.
Supporting negative child IDs fixes the issue for LibreOffice 7.3.