diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2022-03-28 08:40:59 +0200 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2022-03-29 06:48:25 +0200 |
commit | 5371eef48a34acd06307a7b2bf898586938e27ff (patch) | |
tree | 47c040c3bf90be6faf0d8211f461b2909a87e642 /sc | |
parent | 5d0965f3f12fedb2228ba28f261a90245e343c09 (diff) |
a11y: Add new table model change types for row/col insertion/del
So far, there were two types/constants
to use in an `AcessibleTableModelChange` event to indicate
the insertion or deletion of rows and/or columns. From
`offapi/com/sun/star/accessibility/AccessibleTableModelChangeType.idl`:
> /** One or more rows and/or columns have been inserted.
>
> <p>Use the fields of the AccessibleTableModelChange
> structure to determine the indices of the rows and/or columns that
> have been inserted.</p>
> */
> const short INSERT = 1;
>
> /** One or more rows and/or columns have been deleted.
>
> <p>The affected area of the table is stored in the fields of the
> AccessibleTableModelChange structure.</p>
> */
> const short DELETE = 2;
From the documentation, it would be possible to indicate an
insertion or deletion of both, rows and columns in a single
event. However, there is no single instance where this is
actually used to indicate the deletion/insertion of
both, whole rows and whole columns at the same time.
The way that indices are currently used is rather confusing
and results in incorrect a11y events being sent on maOS as well
as the gtk3 VCL plugin:
When only rows are inserted, row indices are set as expected
(index of the first and last inserted row), but the column
indices are set to the first and last column in the table;
i.e. the indices actually give the range of the newly
inserted cell range, rather than just the indices of the rows
that have been inserted. (The same applies
the other way around when only columns are inserted.)
That's not what I would have expected when reading the
documentation. ("Use the fields of the AccessibleTableModelChange
structure to determine the indices of the rows and/or columns that
have been inserted.")
In the same way, the range of deleted cells is set
when emitting `AccessibleTableModelChangeType::DELETE` events.
In this case, this can be seen as matching what the
documentation says. ("The affected area of the table is
stored in the fields of the AccessibleTableModelChange
structure.")
In any case, the way that the events are handled
in the gtk3 VCL plugin and for macOS results in
the emission of incorrect events,
since those are handling such indices as if both,
rows and columns had been inserted/deleted.
Example for the gtk3 VCL plugin:
Row with index 1 has been deleted from a table.
-> an AccessibleTableModelChange event is sent with
Type=AccessibleTableModelChangeType::DELETE
FirstRow=1
LastRow=1
FirstColumn=0
LastColumn=<index of last column>
This would then result in 2 AT-SPI events being
emitted by the gtk3 VCL plugin:
* one that indicates that row 1 has been deleted (OK)
* another event that indicates that all columns have been
deleted (NOT OK)
Instead of changing the handling of the existing
`AccessibleTableModelChangeType`s, introduce 4 new
types to replace the existing ones that
don't mix handling of rows and columns at
the same time: one for row insertion,
one for column insertion, one for row deletion,
one for column deletion.
This commit also adds handling for the newly added
change types for macOS and the gtk3 VCL plugin on
Linux.
winaccessibility is unaffected because
it doesn't have any handling specific
to the change type.
The qt5/qt6 VCL plugins don't yet have any
handling for the `AcessibleTableModelChange`
event yet (but that will be added in a follow-up
commit).
Existing uses of
`AccessibleTableModelChangeType::INSERT` and
`AccessibleTableModelChangeType::DELETE` will
be migrated to use the new types in
follow-up commits.
From a UNO API perspective, this change
and the final removal of the
`AccessibleTableModelChangeType::DELETE`
and `AccessibleTableModelChangeType::INSERT`
constants in a follow-up commit
should be unproblematic, because the
corresponding APIs have been unpublished in
commit 70626249cd247d9acdad417b8eaf252bae22c059
Date: Thu Nov 29 00:27:03 2012 +0100
API CHANGE a11y unpublishing and add/removeListener rename.
The following Python script was used in follow-up
commits to check that AT-SPI events with the expected
indices are retrieved with the gtk3 VCL plugin after
porting existing uses of
`AccessibleTableModelChangeType::INSERT` and
`AccessibleTableModelChangeType::DELETE`.
#!/usr/bin/python3
import pyatspi
def listener(e):
try:
if e.host_application.name != 'soffice':
return
except:
return
print(e)
pyatspi.Registry.registerEventListener(listener, "object:row-inserted", "object:column-inserted", "object:column-deleted", "object:row-deleted")
pyatspi.Registry.start()
Change-Id: I30821a5acafa4f3d1dafdfc219f3b4568d9a6e89
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132217
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'sc')
0 files changed, 0 insertions, 0 deletions