soffice: Make selected cell announcement more efficient#13233
Conversation
|
@LeonarddeR : Any thoughts on this? |
See test results for failed build of commit 7615c8eeb3 |
e3f6f8b to
f18ec84
Compare
Had another idea: While I don't see any way to do this via the |
|
I think your latter idea is great indeed, as long as get_accSelection is stable. I recall it had some buggery in the past though that might have been fixed lately. |
Link to issue number: Fixes nvaccess#13232 Summary of the issue: Since commit 32bf54e ("Improve selection and merged cell announcements in LibreOffice Calc 7.3 and above (nvaccess#12849)"), information about selected cells in LibreOffice Calc is queried using the 'IAccessibleTable2' interface which is supported from LibreOffice 7.3 on. The call to the 'selectedCells' method on that interface requests a list of a11y objects for all currently selected cells, of which only the first and the last one are actually needed for the announcement of selected cells. Since Calc spreadsheets have more than a billion cells, this is inefficient when many cells are selected and resulted in Calc becoming unresponsive. Description of how this pull request fixes the issue: Instead of using the 'selectedCells' method from the 'IAccessibleTable2' interface, the first and last selected cell are now retrieved using the 'accSelection' on the 'IAccessible' object of the table, which avoids that a11y objects for all other selected cells have to be generated as well.
f18ec84 to
cfb0578
Compare
I have updated the PR accordingly,
I completely agree. Announcing only the cell count for more than 2000 cells was just a poor alternative to not announcing anything when many cells are selected, to work around Calc becoming unresponsive when trying to generate a11y objects for all selected cells. Side note: Unrelated to this change, there's an issue that NVDA runs into an exception when only a single cell is selected (e.g. when reducing a previously larger selection to just one cell). I plan to follow up on that next week. |
From LibreOffice change https://gerrit.libreoffice.org/c/core/+/129201 on, the IEnumVARIANT returns an IDispatch rather than a child ID, s. a. discussion in nvaccess#13277 . Add a type check and handle both cases.
|
I have added another commit on top that makes this work for the case where the IEnumVARIANT returns an IDispatch instead of a child ID, so this will work with LibreOffice versions including change https://gerrit.libreoffice.org/c/core/+/129201 as well, s. discussion in PR #13277. |
seanbudd
left a comment
There was a problem hiding this comment.
Apologies for the late review @michaelweghorn.
The approach generally looks good, with some suggestion on handling the types.
I've also fixed up the PR description.
|
I'll look into taking these actions on soon if @michaelweghorn doesn't get the chance. |
s. nvaccess#13233 (comment) > I think it would be best to capture the type specifically here, and raise an exception if an unexpected type is used.
|
@seanbudd: Thanks for the review and fixup of the PR description! I couldn't apply all suggestions as is, s. inline comments. If anything is wrong with my setup, I'd be happy about any help to fix that. |
|
Thanks @seanbudd - also for helping out with my limited Python skills. |
Link to issue number:
Fixes #13232
Summary of the issue:
Since PR #12849, information about selected cells in LibreOffice Calc is queried using the 'IAccessibleTable2' interface which is
supported from LibreOffice 7.3 on.
The call to the 'selectedCells' method on that interface requests a list of a11y objects for all currently selected cells, of which only the first and the last one are actually needed for the announcement of selected cells.
Since Calc spreadsheets have more than a billion cells, this is inefficient when many cells are selected and resulted in Calc becoming unresponsive.
Description of how this pull request fixes the issue:
Instead of using the 'selectedCells' method from the 'IAccessibleTable2' interface, the first and last selected cell are now retrieved using the 'accSelection' on the 'IAccessible' object of the table, which avoids that a11y objects for all other selected
cells have to be generated as well.
Testing strategy:
Known issues with pull request:
none
Change log entries:
Changes
- Announcement of selected cells for LibreOffice Calc is more efficient and no longer results in a Calc freeze when many cells are selected. (#13232)Code Review Checklist: