summaryrefslogtreecommitdiff
path: root/winaccessibility
AgeCommit message (Collapse)Author
2023-10-28Fix typoAndrea Gelmini
Change-Id: Id34e34b8f2bbd903f60d293783031a728a6da8ed Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158587 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-10-28Fix typoAndrea Gelmini
Change-Id: Ic34324139bb02ff72d68f59ff761b4491f17322e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158586 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-10-28tdf#135586 a11y: Add a new BLOCK_QUOTE a11y roleMichael Weghorn
A block quote role exists in all of WAI-ARIA 1.3 (role "blockquote", [1]), IAccessible2 (`IA2_ROLE_BLOCK_QUOTE`, [2]) and AT-SPI (`ROLE_BLOCK_QUOTE`, [3]). Take over the definition that is the same in WAI-ARIA and IAccessible2: > A section of content that is quoted from another source. The intended use for now is for a Writer paragraph using the "Block Quotation" paragraph style, similar to how the HEADING role is used for paragraphs using a corresponding paragraph style. For gtk3 (ATK) and winaccessibility (IAccessible2), map the new role to the equivalant roles. For macOS and the gtk4 as well as the Qt-based VCL plugins on Linux which currently don't have an equivalent role, fall back to the same role that the PARAGRAPH role is mapped to. This way, the behavior there will remain unchanged once the BLOCK_QUOTE role is used for Writer paragraphs with the corresponding style. In general, treat BLOCK_QUOTE like PARAGRAPH in code applying special handling for the PARAGRAPH role. [1] https://w3c.github.io/aria/#blockquote [2] https://github.com/LinuxA11y/IAccessible2/blob/3d8c7f0b833453f761ded6b12d8be431507bfe0b/api/AccessibleRole.idl#L318 [3] https://gitlab.gnome.org/GNOME/at-spi2-core/-/blob/7cc4cee53ddbd22631fd110f0e5ce045dec2e411/xml/Accessible.xml#L615-616 Change-Id: I248c183a2e7ec5d6f0a89bf3cb4829bbd8588c77 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158573 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-10-28tdf#135586 wina11y: Make role mapping more explicitMichael Weghorn
The previous `ROLE_TABLE` looked like it might explicitly map the UNO role on the left-hand side to the IAccessible2 role on the right-hand side, and the comment also said so. In reality, the UNO role on the left hand side was not really accessed, but the assumption was that the index of each entry would correspond to the sal_Int16 value of the UNO role (`css::accessibility::AccessibleRole`). Make that mapping more explicit by replacing it with a helper function `lcl_mapToIAccessible2Role` and slightly simplify `AccObject::UpdateRole`. Change-Id: Id02553c4df042982f92fce3338077e95db687a83 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158572 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-10-25tdf#135586 a11y: Make IAccessible2 an external and update itMichael Weghorn
So far, there was an internal copy of the IAccessible2 IDL file added in 2013, and never updated since then (except for cosmetic changes like formatting and typo fixes), and therefore it e.g. doesn't have the `IA2_ROLE_BLOCK_QUOTE` role needed for tdf#135586. Drop the outdated internal copy and integrate an up to date upstream version (current git master) instead. Instead of duplicating things in an internal copy, switch to using the usual mechanism for externals. The IAccessible2 source contains separate .idl files for the different interfaces, while the previous interal copy was already the merged IDL file. Call the IAccessible2 `./concatidl.sh` script to generate the merged `ia2_api_all.idl` (s. external/IAccessible2/ExternalProject_IAccessible2.mk) and adapt the winaccessibility make files to use that version instead of the internal copy. (Add a dependency to the target that generates `ia2_api_all.idl`.) The tarball was generated from the master branch of the IAccessible2 git repo [1] as of commit 3d8c7f0b833453f761ded6b12d8be431507bfe0b (HEAD -> master, origin/master, origin/HEAD, mygithub/master) Author: Michael Weghorn <m.weghorn@posteo.de> Date: Fri Oct 13 04:16:03 2023 +0300 Update no longer working links (#26) * Update link to Linux Foundation Trademark Policy * Update link to Object Attributes specification Signed-off-by: Michael Weghorn <m.weghorn@posteo.de> using this command: $ git archive -o ../IAccessible2-1.3+git20231013.3d8c7f0.tar.gz --prefix=IAccessible2-1.3+git20231013.3d8c7f0/ master Andrea Gelmini's typo fixes have been upstreamed in [2]. [1] https://github.com/LinuxA11y/IAccessible2 [2] https://github.com/LinuxA11y/IAccessible2/pull/21 Change-Id: I9f19ff55694da5d3a9a8750be8de387cbf6da785 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158427 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-10-21tdf#135922 wina11y: Report text-related IA2 obj attrsMichael Weghorn
Extend `CMAccessible::get_attributes` so that it also reports the text-related IAccessible2 object attributes, since what is meant to be reported as a text attribute and what is meant to be reported as an object attribute differs between the IAccessible2 specificiation and what LibreOffice does on the UNO level, s. the commit message in this previous change for more details: Change-Id Ief7c840d3c5274714a914ca0e56df0c5eaffb06d tdf#135922 a11y: Prepare reporting text attrs as IA2 obj attrs Just use a character offset of 0 when querying via the `XAccessibleText` interface here. The exct offset used used shouldn't make any difference for paragraph-specific attributes. With this and the NVDA pull request [1] to evaluate attributes according to the IAccessible2 text attributes and IAccessible2 object attributes specifications, NVDA now reports the alignment of paragraphs in Writer, e.g. says "align center" since the corresponding attribute is now reported for the paragraph object, as can also be seen by querying the IAccessible2 interface manually in NVDA's Python console: >>> focus.IAccessibleObject.attributes 'heading-level:;level:;text-align:center;' ("text-align:center;" was not yet reported without this change in place.) [1] https://github.com/nvaccess/nvda/pull/15649 Change-Id: I5723797232f89db6a2b74d4a601344f2078ee630 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158260 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-10-21wina11y: Just return empty attr string when none presentMichael Weghorn
If the `XAccessibleExtendedAttributes` interface isn't implemented, just return an empty string for the attributes instead of an error code. (This seems like a totally valid case to me, no need to report an error.) Change-Id: I986f030bc7a01da0fdd92a5aa2b4cf3c0d6a9200 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158258 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-10-21wina11y: Indent try blockMichael Weghorn
Change-Id: I89a4ed514e1c24e683b081d04f72cd62ede80065 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158257 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-10-21tdf#135922 a11y: Prepare reporting text attrs as IA2 obj attrsMichael Weghorn
According to the IAccessible2 specification, some of the attributes that LibreOffice handles as text attributes are mapped to IAccessible2 text attributes as well [1], but others should be reported as object attributes [2], e.g. text alignment is reported via the "text-align" object attribute on the paragraph object. So far, `AccessibleTextAttributeHelper` was only handling attributes that are mapped to IAccessible2 text attributes. Prepare for reporting object attributes as well, which will be required to report text alignment on Windows in a compliant way (s. tdf#135922). On the other hand, Qt also expects `QAccessibleTextInterface::attributes` to return text formatting using the attributes specified in the IAccessible2 attribute specifications and maps that to the platform-specific attributes (AT-SPI text attributes on Linux), but currently does not provide any way to report object attributes in addition to text attributes. It however supports e.g. the "text-align" attribute mentioned in the IAccessible2 object attribute specification when it's reported as a text attribute [3]. Therefore, add a new `IA2AttributeType` enum that can be used to specify what kind of IAccessible2 attributes (text attributes, object attributes) to report. Only request IA2 text attributes on Windows when text attributes are requested, but both types for Qt. So far, support for none of the object attributes has been implemented, but an upcoming change will do that. [1] https://wiki.linuxfoundation.org/accessibility/iaccessible2/textattributes [2] https://wiki.linuxfoundation.org/accessibility/iaccessible2/objectattributes [3] https://code.qt.io/cgit/qt/qtbase.git/tree/src/gui/accessible/linux/atspiadaptor.cpp?id=546208f0ff23819d216cbb5bf0b5daded79b454e#n2193 Change-Id: Ief7c840d3c5274714a914ca0e56df0c5eaffb06d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158255 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-10-20wina11y: Drop now unused CMAccessible::get_String4Numbering etc.Michael Weghorn
`CMAccessible::get_String4Numbering` is unused since commit 2bf88c172c9c9d159344b95fb96073f4891a6c30 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Wed Oct 18 13:44:42 2023 +0200 tdf#157696 wina11y: Switch from custom to IA2 text attributes , so drop it. This means that `CMAccessible::get_StringFromAny` is then also unused, so drop it as well. Change-Id: I35abc94b2fc2ecec1789918fbf4ed6707a96c974 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158195 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-10-19tdf#157696 wina11y: Switch from custom to IA2 text attributesMichael Weghorn
So far, reporting text attributes on the a11y layer on Windows did not follow any standard/specification, but LibreOffice's custom attribute values were mostly reported as is (i.e. using the LibreOffice-internal attribute names and values), and assistive tooling had to interpret those in order to support reporting them to the user in a useful way. For example, NVDA has custom code in the LibreOffice-specific app module to do so. [1] Stop using our custom attributes and switch to the use of attributes according to the IAccessible2 text attributes specification [2] instead, which is the applicable specification for `IAccessibleText::get_attributes` that is implemented here. This implies that by reporting more IAccessible2 text attributes, those should "automatically" work if assistive tooling handles those, as is e.g. the case for NVDA and the the "invalid:spelling;" attribute for spelling errors, for which bridging to IA2 has been iplemented in Change-Id I54e5bcbb4bef4c73068243f91a3ee69c10326460 tdf#157696 a11y: Report spelling error via IA2 "invalid:spelling" attr (See also the other tdf#135922 commits preparing for this change.) A change in NVDA is still needed in addition to switch from only handling the custom values for LO to use the existing code path for handling IA2 text attrs instead. Pending pull request that implents this: [3] [1] https://github.com/nvaccess/nvda/blob/9878248c217156de4defe244d2df797d6b3bd0ca/source/appModules/soffice.py#L35-L137 [2] https://wiki.linuxfoundation.org/accessibility/iaccessible2/textattributes [3] https://github.com/nvaccess/nvda/pull/15649 Change-Id: I11492bb5d09d64fd153db1b73d97a331a98ee535 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158090 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-10-11wina11y: Drop CAccTextBase::GetXInterfaceMichael Weghorn
Just use the private `pRXText` member directly. The separate getter doesn't really help regarding readability, in particular since the typical usage pattern involved first checking the member directly, then using the getter, making it less obvious that this was about the same object/reference e.g. if(!pRXText.is()) { return E_FAIL; } if( offset < 0 || offset > GetXInterface()->getCharacterCount() ) return E_FAIL; Change-Id: Iaf786220b94a37e79a46985f58e0586252846f56 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157766 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-10-11wina11y: Drop unnecessary check for empty ReferenceMichael Weghorn
Using operator= with either an empty Reference or nullptr has the same effect. Change-Id: Ifa33127f3718ba4bbf3d364484b412b4108719a8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157765 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-10-07wina11y: Map FRAME a11y role to IAccessible2 equivalentMichael Weghorn
The description of the UNO API role (s. `offapi/com/sun/star/accessibility/AccessibleRole.idl`) and the IAccessible2 role `IA2_ROLE_FRAME` (s. `winaccessibility/source/UAccCOMIDL/ia2_api_all.idl`) match. (The first sentence is even identical.). Therefore, map them accordingly instead of mapping to `ROLE_SYSTEM_DIALOG`, which is not really the same. It's not clear why this "perfect match" was commented ever since commit a18bdb3bc05e761704cc345a66a9d642bc4f4a0a Author: Steve Yin Date: Thu Nov 14 08:18:05 2013 +0000 Integrate branch of IAccessible2 I noticed this because announcement of the status bar in Writer by NVDA as implemented in NVDA commit [1] didn't work any more after commit 2cd1408dd7d6688357257f4a58a8b467628b1884 Author: Michael Weghorn Date: Thu Aug 17 13:15:46 2023 +0100 tdf#156561 a11y: Create VCLXTopWindow peer for border win frame as the DIALOG role was used instead of the WINDOW role after this, and NVDA doesn't consider that yet when looking for the status bar. It also doesn't take `IA2_ROLE_FRAME` into account yet, but this NVDA PR makes NVDA to consider both, `ROLE_SYSTEM_DIALOG` and `IA2_ROLE_FRAME` as well: [2] Just mapping to `ROLE_SYSTEM_WINDOW` instead would still be a better match than the previous `ROLE_SYSTEM_DIALOG` and would make that NVDA scenario work again without further changes to NVDA, but would rather be a workaround than the proper solution. [1] https://github.com/nvaccess/nvda/commit/62536a97cd29019c7055c927746da72435d12b95 [2] https://github.com/nvaccess/nvda/pull/15592 Change-Id: Ide39222d2525cb64106c878e8b0a11174bcb16ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157658 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-09-14Fix typoAndrea Gelmini
Change-Id: I94b00910d261731b712f21a92766d97fed4889a4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156927 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-09-10using decls should come after #includeNoel Grandin
Change-Id: I058551e87bca42adede860f6f299b0f7ae2af3b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156798 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-08-22wina11y: Drop CAccActionBase::GetXInterfaceMichael Weghorn
Just use the `pRXAct` member directly. In particular the fact that all of the `CAccActionBase` methods mixed both ways of accessing the member (first checking `pRXAct` directly, but then retrieving it via `CAccActionBase::GetXInterface` to call a method on it) didn't really increase readability of the code. Change-Id: Ic6f5ce9a9b229b949ac656668e3bbf01cb65af2e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155956 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-08-09wina11y: Drop "#CHECK#" commentsMichael Weghorn
... and "#CHECK XInterface#" comments; it's obvious that this is what the next lines do. Change-Id: I09234d1a2f5c58cfab1580f188229d28d27fc402 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155506 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-08-09wina11y: Use return value instead of out paramMichael Weghorn
... to return the `IAccessible*` in `AccObjectWinManager::GetIAccessibleFromXAccessible` and `CMAccessible::get_IAccessibleFromXAccessible` and adapt the call sites accordingly. This is more straight-forward and the extra bool return value didn't add anything, since it was also just saying whether the pointer was a nullptr, so rather check that directly. Also drop `AccObjectWinManager::GetIMAccByXAcc` that does the same thing and switch the only call site to use `AccObjectWinManager::GetIAccessibleFromXAccessible` instead. Change-Id: I72933df62aa9ac1ff3f2a84c5045dfae354c18e2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155505 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-08-09tdf#156679 wina11y: Convert screen to local coords as neededMichael Weghorn
When `AccTextBase::get_offsetAtPoint` gets called with screen coordinates, convert them to local coordinates within the text object first, because that is what `XAccessibleText::getIndexAtPoint` expects. Not doing so resulted in NVDA failing to create a TextInfo object in the mouse event handler [1] when hovering over a Calc cell containing text, because the method would always return an offset of -1. With this change in place, NVDA now announces the text when hovering over the text and mouse tracking is enabled in NVDA (which is the case by default). Other than with Microsoft Excel, the text is only announced when the mouse is actually over the text, not over free space in the cell, which might be because Excel uses UIA and the UIA equivalent, `ITextProvider::RangeFromPoint` [2] shall also return the index of the closest character when the point itself is not over the actual bounds of any character. [1] https://github.com/nvaccess/nvda/blob/a198c9b5f27e47ff2830f77c833eec584078dfd8/source/NVDAObjects/__init__.py#L1209 [2] https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextprovider-rangefrompoint Change-Id: I1e4ab2dd3dace5fea1de2eef67a91fe3c31218a9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155492 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-08-09tdf#156679 wina11y: Implement accHitTest via UNO equivalentMichael Weghorn
Instead of manually iterating over the children and checking whether the given position is in the location that they're in in `CMAccessible::accHitTest`, use `XAccessibleComponent::XAccessibleComponent`, which provides exactly the functionality that's needed. (This is similar to what the Qt-based VCL plugins on Linux do, s. `QtAccessibleWidget::childAt`.) This also drops the need to limit this to objects that have at most a certain amount of children for performance reasons (previously 256) and thus makes this work e.g. also to identify a Calc cell that the mouse pointer is currently over while previously the document was returned, as could be seen also in NVDA's Python console: 1) start NVDA 2) hover over a Calc cell 3) press NVDA+Ctrl+Z to capture snapshot variables 4) check what NVDA identifies as the mouse object via the Python Console: Before: >>> mouse <NVDAObjects.IAccessible.IAccessible object at 0x00FB9910> >>> mouse.name 'Untitled 1 - LibreOfficeDev Spreadsheets' >>> mouse.role <Role.DOCUMENT: 52> With this change in place: >>> mouse <NVDAObjects.Dynamic_SymphonyIATableCellEditableTextWithAutoSelectDetectionIAccessible object at 0x0774DD10> >>> mouse.name >>> mouse.role <Role.TABLECELL: 29> The cell's text still isn't announced by NVDA even with mouse tracking enabled, but that's another issue. Change-Id: Ib821020cef6303ab786c4c3fc3ccd917398214f1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155491 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-08-09wina11y: Move these 2 checks out of try/catchMichael Weghorn
Change-Id: I4ae7527d9b5047d46aab44a1ab6fa42a99c43a14 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155490 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-08-08wina11y: Drop AccObjectManagerAgent indirectionMichael Weghorn
`AccObjectManagerAgent` was holding an `AccObjectWinManager` object and forwarding everything to that one and the event listeners were holding a pointer to the `AccObjectManagerAgent` object. Drop this `AccObjectManagerAgent` indirection and let all of the classes that were interacting with the `AccObjectManagerAgent` directly interact with the `AccObjectWinManager` instead. The idea of having the agent seems to have been to have an abstraction layer and implement different accessible object managers for all platforms, but the agent already has quite some Windows-/IAccessible-specific code/interface and by now, the Linux VCL plugins and macOS have their own a11y bridges, so the TODO do implement this here for Linux as well seems outdated to me. Even if implementing this for Linux and/or macOS in a similar way, I don't see the need for the agent layer, but one way might be to just have an abstract base class (e.g. `AccObjectManager`) that `AccObjectWinManager` and implementations for other platforms derive from, and have the SalInstance return the platform-specific implementation that the `AccTopWindowListener` would then retrieve and pass on. Given that `AccObjectManagerAgent` was forwarding all calls to `AccObjectWinManager` and the methods and params are mostly the same by now (s.a. the preparatory commits), this change is mostly straightforward. A few notes: * `AccObjectManagerAgent::InsertAccObj` had a default nullptr value for the HWND that `AccObjectWinManager:InsertAccObj` didn't have yet, so add that. * `AccObjectManagerAgent::GetIAccessibleFromResID` had an out param instead of a return value; call sites were adapted to fit `AccObjectWinManager:GetIAccessibleFromResID`. * The `UpdateValue` and `UpdateAccName` methods taking 2 params are called `SetValue` and `SetAccName` in `AccObjectWinManager` instead, so adapt call sites accordingly. * prewin.h and postwin.h includes had to be added around the windows.h include in AccObjectWinManager.hxx (build would otherwise fail) * A few `AccObjectWinManager` methods had to be made virtual to make linking work. Change-Id: I88741bf416d4db25d78e973c0db060a828f27926 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155440 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-08-08wina11y: Drop unused includeMichael Weghorn
Change-Id: I71659b8aa3ba0f0097aa4200ec159272c5c75b24 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155439 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-08-08wina11y: Align param order with other methodsMichael Weghorn
Switch the param order in `AccObjectManagerAgent::NotifyAccEvent` to be consistent with all of its other methods that take the `XAccessible*` first, and also with `AccObjectWinManager::NotifyAccEvent` that is called by the method. This is also in preparation of dropping AccObjectManagerAgent altogether. Change-Id: I83d331176971cc728524266d87939f33acd375f0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155438 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-08-08wina11y: Drop unused default nullptr argMichael Weghorn
Calling this without passing an actual XAccessible* wouldn't make any sense anyway. Change-Id: Ie8d8aecc0c0a3a8a2c1ef62015fba7ad242059b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155437 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-08-08wina11y: Move and simplify casting for Get_ToATInterfaceMichael Weghorn
Move the casting from AccObjectManagerAgent::Get_ToATInterface to AccObjectWinManager::Get_ToATInterface and just do a `reinterpret_cast<HWND>(...)` right away instead of a `static_cast<HWND>(reinterpret_cast<void*>(...))`. This is in preparation of dropping the AccObjectManagerAgent indirection altogether. Change-Id: Iad759f856f727418aab0d20b479fc38feac714ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155436 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-08-08wina11y: Move GetIAccessibleFromXAccessible logicMichael Weghorn
Move the logic from AccObjectManagerAgent::GetIAccessibleFromXAccessible to the new AccObjectWinManager::GetIAccessibleFromXAccessible and just forward to that one. This is in preparation of dropping the AccObjectManagerAgent indirection altogether. Change-Id: Ic276a04cf7dda3762cee0d3932962e2a0947cfde Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155435 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-08-08wina11y: Replace nullptr check with assertMichael Weghorn
`AccObjectManagerAgent::pWinManager` gets set in the ctor and is never reset explicitly, so I don't see any way it can ever be null before the `AccObjectManagerAgent` object itself gets destroyed. Change-Id: I027ca0d15cbc7ca8e183b71b0dbee7ce1acc925d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155434 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-08-08wina11y: Drop AccObjectManagerAgent indirection to get a11y roleMichael Weghorn
Just retrieve it from the context directly here, and drop the now unused `AccObjectWinManager::GetRole`. Change-Id: I4c14d2f9b6fb1df9c58149576897c8585ba4a437 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155433 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-08-03tdf#156473 wina11y: Fix invalid write due to row/col mismatchMichael Weghorn
With the grid control now reporting row/column headers due to the previous tdf#156473-related commits, this copy-paste mistake in commit 8a4271e168f70f9147b567189c1770a243e7fcb1 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Fri Aug 5 09:49:02 2022 +0100 wina11y: Implement IAccessibleTableCell::get{column,row}HeaderCells was now causing hard to debug crashes when moving around in the table from the tdf#156473 sample macro with the NVDA screen reader running on Windows. Change-Id: I9fa30c1181d0fd21a85a73fd660c49667850d82b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155311 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-08-01wina11y: Drop/Clean up CHILD event handling in subclassesMichael Weghorn
Now that Change-Id I62ab32342ef67c770ced9f0d2be867dc9355bd4a ("tdf#156561 wina11y: Handle CHILD event") has implemented handling for the CHILD event in `AccEventListener`, drop the overrides in child classes that effectively do the same. For the case that a new child gets added, `AccFrameEventListener::HandleChildChangedEvent` also passes the HWND, so leave that and only forward to the base class for the other case. Change-Id: I68d836abedbf3563df84187d56851820c043866f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155127 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-08-01tdf#156561 wina11y: Handle CHILD eventMichael Weghorn
So far, `AccessibleEventId::CHILD` events were ignored by `AccComponentEventListener` and its base class, `AccEventListener`. As a result, no event listener would be created when e.g. a child that was previously hidden got shown, resulting e.g. in NVDA not announcing that object when it receives focus later. Handle the event and register a listener when notified about a new child and drop the old child when one gets removed, like some of the derived classes already do in pretty much the same way. (Those implementations will be cleaned up/dropped in a separate commit.) This addresses one of the root causes of why tdf#140762 ("No text spoken by screen reader for 'Borders' dropdown button items in Calc's formatting toolbar (NVDA on Windows)") occured without commit dc0706cabfe39ddb6ea23d60ccfb756f2b9e6efb Author: Michael Weghorn <m.weghorn@posteo.de> Date: Wed Mar 15 17:00:27 2023 +0100 tdf#140762 tdf#152671 Make dock win visible before showing popup , i.e. when the window is made visible only after its parent. Still, this change at least by itself does not yet solve tdf#152671 ("ui, accessibility: auto filter drop down menu is not spoken by the screen reader") and also for the case of the toolbar popup, the initially focused item would no more be announced when reverting the above-mentioned commit and its follow-up commit commit 57c2209dd04abfda90e0aba782bc174243633ec9 Author: Caolán McNamara <caolanm@redhat.com> Date: Thu Apr 6 15:07:15 2023 +0100 tdf#154470 try moving the Show of the client to after the float positioning Example backtrace of the font color popup in the formatting toolbar where no event listener was created previously: 1 AccEventListener::notifyEvent AccEventListener.cxx 74 0x7ffe4b4ecf14 2 AccComponentEventListener::notifyEvent AccComponentEventListener.cxx 82 0x7ffe4b4ee699 3 comphelper::AccessibleEventNotifier::addEvent accessibleeventnotifier.cxx 256 0x7ffe5e80ebac 4 comphelper::OCommonAccessibleComponent::NotifyAccessibleEvent accessiblecomponenthelper.cxx 127 0x7ffe5e80443e 5 VCLXAccessibleToolBoxItem::NotifyChildEvent vclxaccessibletoolboxitem.cxx 213 0x7ffe4b337e10 6 VCLXAccessibleToolBox::UpdateCustomPopupItemp_Impl vclxaccessibletoolbox.cxx 373 0x7ffe4b33334d 7 VCLXAccessibleToolBox::ProcessWindowEvent vclxaccessibletoolbox.cxx 547 0x7ffe4b33263c 8 VCLXAccessibleComponent::WindowEventListener vclxaccessiblecomponent.cxx 112 0x7ffe51e871c5 9 VCLXAccessibleComponent::LinkStubWindowEventListener vclxaccessiblecomponent.cxx 98 0x7ffe51e861f6 10 Link<VclWindowEvent &,void>::Call link.hxx 111 0x7ffe504204b3 11 vcl::Window::CallEventListeners event.cxx 263 0x7ffe50420860 12 svt::PopupWindowControllerImpl::WindowEventListener popupwindowcontroller.cxx 148 0x7ffe53c65593 13 svt::PopupWindowControllerImpl::LinkStubWindowEventListener popupwindowcontroller.cxx 89 0x7ffe53c64f76 14 Link<VclWindowEvent &,void>::Call link.hxx 111 0x7ffe504204b3 15 vcl::Window::CallEventListeners event.cxx 263 0x7ffe50420860 16 vcl::Window::ImplResetReallyVisible stacking.cxx 723 0x7ffe5033d6f1 17 vcl::Window::Show window.cxx 2234 0x7ffe5053eca7 18 ImplDockingWindowWrapper::ImplPreparePopupMode dockmgr.cxx 769 0x7ffe5041154e 19 ImplDockingWindowWrapper::StartPopupMode dockmgr.cxx 816 0x7ffe50413d4c 20 DockingManager::StartPopupMode dockmgr.cxx 349 0x7ffe50413c11 ... <More> Change-Id: I62ab32342ef67c770ced9f0d2be867dc9355bd4a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155126 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-06-13tdf#155794 winaccessibility: no SolarMutex in getAccObjectPtr()Michael Stahl
MSAAServiceImpl::getAccObjectPtr() is called when processing WM_GETOBJECT messages, and this can happen (at least when NVDA is active) during processing SendMessages. When loading a document on a non-main thread, WinSalFrame::SetTitle() calls SetWindowTextW which is equivalent to SendMessage(WM_SETTEXT), while holding SolarMutex, and if the main thread doesn't finish processing it then that's a deadlock. Introduce a new mutex in AccObjectWinManager and use it to guard the 2 members that getAccObjectPtr() reads, while keeping the rest of winaccessibility with the SolarMutex, as the UNO services may be called on any thread. This fixes part of the problem, VCL also needs to stop using SolarMutex. Change-Id: I6df5889fd76f59146b4b0b1e5f4513232f8ab867 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152957 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-04-17loplugin:stringaddStephan Bergmann
Change-Id: Id63306a86c955c1f00252c555a6c0faaed625c7b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150481 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-03-22tdf#154303 wina11y: Don't truncate 64-bit statesMichael Weghorn
commit 8d8e6c84e512c1a8b33aac75965b84481d1a1d13 Date: Sun Jul 3 20:29:28 2022 +0200 [API CHANGE] Drop css::accessibility::XAccessibleStateSet had introduced the use of a 64-bit integer with bit flags for the accessible states. However, `AccObjectWinManager::DecreaseState` and `AccObjectWinManager::IncreaseState` were still using unsigned short, resulting in truncation. As one result, the `AccessibleEventId::STATE_CHANGED` event with state `AccessibleStateType::VISIBLE` from `OAccessibleMenuBaseComponent::SetVisible` would no longer result in the `STATE_SYSTEM_INVISIBLE` being unset and thus the the JAWS screen reader would no longer announce the focused (but considered invisible) menu item. Fix this by switching the param for those two methods to sal_Int64 as well. Change-Id: I714573e2691e82c6287a4b83f872f87568e46495 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149255 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-03-07tdf#154039 wina11y: Increase refcount for returned COM interfaceMichael Weghorn
The reference counter for the IUnknown interface of the COM object needs to be increased in `CMAccessible::get_accSelection` as well, not just in the called `CEnumVariant::Next`, because calling VariantClear` on the temporary variant afterwards decreases the ref count again. Regression from commit 00c0ee8cf0fac0c933c5ae600e99a64b1c7d4397 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Mon Jan 31 07:41:14 2022 +0000 tdf#147083 wina11y: Return a11y object instead of child ID Change-Id: Id968c3d80b38961b836fbb1a9bd6dfeefdff813f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148393 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-01-05Revert all the recent loplugin:unocast changesStephan Bergmann
...as obsoleted by ef533553559fe09b4afab651fc692885d1acf4ed "Rudimentary support for dynamic_cast on UNO proxy objects". This reverts all of: 4cfcc9ac37b90ce64c8402a41eb4638adb185b5c "loplugin:unocast (framework::Desktop)" 03efbf72f4ddf7a84aa8aabef348331bd4b75e8a "loplugin:unocast (vclcanvas::TextLayout)" 80099fdd51a69eaa6c36ca88ef772810e4a777fa "loplugin:unocast (SalGtkXWindow)" cc147f576d8687fb79c77d47d41dc4ba1678a469 "loplugin:unocast (sdext::presenter::CachablePresenterView)" 40db42be1d8fd0f9c6c8c5ba3767ddb9ee2034c2 "loplugin:unocast (vclcanvas::CanvasFont)" 2d1e7995eae29e2826449eb5179f5fae181794a5 "loplugin:unocast (CairoColorSpace)" 4c0bbe4bd97636207cf71a6aa120c67698891da9 "loplugin:unocast (canvas::ParametricPolyPolygon)" 89803666621c07d1b1ac9d3bd883f0ca192a91a0 "loplugin:unocast (vclcanas::CanvasBitmap)" d5e0c2c8db71878d21c2a7255af08cf5f9a6dd04 "loplugin:unocast (sfx2::DigitalSignatures)" c0c4519e0d5b555f59bbc04cc616454edfd1f4ce "loplugin:unocast (VCLXAccessibleComponent)" feb8b833a6245d42400f42a0bc789dc84594ee6f "loplugin:unocast (VCLXDialog)" 1fa58cc6cc9c3849753342a5d9a6ddfa461b5e66 "loplugin:unocast (VCLXMultiPage)" f481f036deb1b1b46f3038074c4659f3a91b9c6c "loplugin:unocast (DocumentSettingsSerializer)" 73df933f5fa5932f94e5a1b338a3eda00a9ce354 "loplugin:unocast (css::embed::EmbeddedUpdate)" 420165ab0ef03c0467f9d17f504de2d2fc78f0e6 "loplugin:unocast (canvas::tools' StandardColorSpace, StandardNoAlphaColorSpace)" 9abe8ee067e6c00f19d8a13346d53c4641c27166 "loplugin:unocast (MutableTreeNode)" 9f3022ceb036f23b4b0994c3e2fbd1001bff225a "loplugin:unocast (VCLXTabPage)" 1be70dda02c12a60778b7607cff2520ae1aa611e "loplugin:unocast (vcl::unotools::VclCanvasBitmap)" d6a70bb641b96e8e5616448c2378131ed62658b4 "loplugin:unocast (basegfx::unotools::UnoPolyPolygon)" 5a14f009e6782c077463c8cbb8e9cea3d7950107 "loplugin:unocast (xmlsecurity::Certificate)" 99009c9535dfa3e0d838989ccc7d84bfa2320ff4 "loplugin:unocast (sd::Annotation)" 0c7585c5fa78887e5459885ed744e8044fd76137 "loplugin:unocast (sd::TextApiObject)" 24e14afd1bfcaed6c200ab081973fba7e47267ca "loplugin:unocast (SignatureVerifierImpl)" 1a7ad0c10d286ce9ae2700ceb2fd50eed1fb43a4 "loplugin:unocast (pcr::PropertyEventTranslation)" a97e2d2702d9a6f37775ccee2c08c4f3b2479c4b "loplugin:unocast (RangePageBreaks)" 19dfdf86ad1f5b08041d8b7a9f196caf881231ab "iloplugin:unocast (pcr::OFormattedNumericControl)" f9785ea595fd8e911f6370e836fa579225b9e571 "loplugin:unocast (frm::OInterfaceContainer)" 5e5f40a4a92a31b0932c690219d002fcf18598cf "loplugin:unocast (ScVbaShapes)" 27b35b2c215b4832d4378ec3a7ecbba926552d06 "loplugin:unocast (ScVbaShapeRange)" cb3108f860065928552a86cf8acc4b3a95718ecf "cid#1517812 Dereference null return value" feba0ddb1521d1142560fe54b7d7696ee910237f "loplugin:unocast (weld::TransportAsXWindow)" 4d6c23216559eb48f9943bb49d6e475a6d64ba15 "loplugin:unocast (oox::ForumlaImExportBase)" 4844c096a8ab6a9a620c410a0949d4499f12a504 "loplugin:unocast (cairocanvas::SurfaceProvider)" 9a0b523e0a84d403b9092176ccec4b3e3efe42d0 "loplugin:unocast (cairocanvas::CanvasBitmap)" 8a5648d8e59b4b007dbbf3824777c19a21efc61e "loplugin:unocast (cairocanvas::TextLayout)" 28c27a0623bc78a0590858f97d03b620985bc84c "loplugin:unocast (cairocanvas::CanvasFont)" 53bc223cb3288e32a417696ee61c29e5f01f209d "loplugin:unocast (cairocanvas::RepaintTarget)" 5f70b0b9f6bc4ab145ddbd9155590ed4a3b1b9ec "loplugin:unocast (SvXMLImport)" 068187a898cdd2e26e9b16c348ecc1ed2dee3f29 "loplugin:unocast (VCLXWindow)" 88b4f966202717cd4ad38a30a8eda22c3e69ed35 "loplugin:unocast (sfx2::sidebar::SidebarController)" f1b7a69b280aefe2f1b3b0f32193494fd765f2bd "loplugin:unocast (SvxLineStyleToolBoxControl)" ba76f0ba7e8de4d2953739c952004b7d9af47197 "loplugin:unocast (i18npool::Calendar_gregorian)" 840154daf934d8df52ead1cb7acd798c4d30f007 "loplugin:unocast (framework::AddonsToolBarWrapper)" b0e9c4c5f063cefa9557810e3349bdb9c7493091 "loplugin:unocast (GrammarCheckingIterator)" 8ee6cfc9655ce9de4617cea1a0d9cb9d7a4fbfac "loplugin:unocast (ucb::ucp::ext::Content)" 5b8cd77c112bc8c0e92b8fec215c3c8e802bbc0a "loplugin:unocast (basic::SfxScriptLibraryContainer)" 9e73ff9fce12e102bb3c3cea8d8bb96c88f2c9ad "loplugin:unocast (sdext::presenter::PresenterNotesView)" a98acca8fbc38d3fd5600ae5056a8e42b6d8a40d "loplugin:unocast (SelectionChangeHandler)" c0b59ad6e35b0cb0dea0821e95f95569739078c1 "Consistently use comphelper::getSomethingImpl<I>(aIdentifier, this)" 276e3ccbdd3259ec3daf8a1a98fa7f406b14e21c "loplugin:unocast (vclcanvas::RepaintTarget)" Change-Id: I37c73e3422a5154bf6cb647640d2d3f23db8bc34 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145063 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-12-23loplugin:unocast (VCLXAccessibleComponent)Stephan Bergmann
(See the upcoming commit introducing that loplugin:unocast on why such dynamic_casts from UNO types are dangerous.) Change-Id: I11496cc1d37e89ce8f11991f86c7b60bb1b93106 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144748 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-11-24Drop redundant -Wnon-virtual-dtorStephan Bergmann
Inspired by <https://gcc.gnu.org/pipermail/gcc-patches/2022-November/607102.html> "[PATCH] doc: -Wdelete-non-virtual-dtor supersedes -Wnon-virtual-dtor", drop explicitly enabling -Wnon-virtual-dtor in favor of -Wdelete-non-virtual-dtor, which is already enabled by -Wall. (-Wdelete-non-virtual-dtor first appeared in Clang 3.0, <https://github.com/llvm/llvm-project/commit/8bd428574c717e68a8274739d2ba0f6dc16fd0fb> "Add new warning that warns when invoking 'delete' on a polymorphic, non-final, class without a virtual destructor", and GCC 4.7, <https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=014ab419efc12a59efebd2720d79e1c055675c85> "invoke.texi: Document -Wdelete-non-virtual-dtor. [...]") Dropping the explicit setting of -Wnon-virtual-dtor (and nowhere setting it implicitly via -Weffc++) means we can get rid of lots of places that either set -Wno-non-virtual-dtor or use some pragma to ignore -Wnon-virtual-dtor. (In various places across extensions/source/activex/ and winaccessibility/, the commits f26996bd3398afa789a5491968244563ccf70908 "Silence -Werror,-Wnon-virtual-dtor in generated so_activex.h (clang-cl)" and c6086ca6535692496fbd718d174d8eb5a5dea7c7 "Silence -Werror,-Wnon-virtual-dtor in generated UAccCOM.h (clang-cl)" had singled out some includes to wrap them in pragmas. Now that those pragmas are gone again, move those includes back to where they had been prior to being singled out. And the -Wno-non-virtual-dtor in external/firebird/macos-arm64.patch.0 appeared first in ccd0e5f445d4a7d0e7aca6c23c02c61bf14510b2 "Make firebird build for macOS on arm64", which, though it doesn't state it explicitly, apparently created that patch's builds/posix/prefix.darwin_arm64 as a copy of firebird's already existing builds/posix/prefix.* files, which routinely include that warning option too, so keep it there too even if it is probably irrelevant throughout.) Change-Id: I7e4fa9f2c07e267b2ed15607905027f6b78142f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143182 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-09-26tdf#117173 wina11y: Send EVENT_SYSTEM_ALERT when notification showsMichael Weghorn
Together with Change-Id Ifcf9304883e2e824ea1b7998d7767e474b87c8b6 ("tdf#119788 tdf#117173 add accessibility NOTIFICATION role") and Change-Id Id62b3942dc17c3a1ed6a08d23438406e5a19c39d ("tdf#117173 a11y: Send SHOWING state change event on Window{Show,Hide}"), this makes NVDA announce the notification in the Search and Replace dialog as an alert, similar to what browsers do e.g. in the alert on empty input for the input validation example at https://www.w3.org/WAI/tutorials/forms/validation/ . Change-Id: I3263df4711f84a6dd9e178aaaaad340b128aa074 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140091 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-09-26tdf#119788 tdf#117173 add accessibility NOTIFICATION roleJim Raykowski
and use it to make screen readers announce notifications from the 'Find and Replace' dialog Change-Id: Ifcf9304883e2e824ea1b7998d7767e474b87c8b6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139709 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-09-17loplugin:loopvartoosmall (clang-cl)Stephan Bergmann
Change-Id: I8925e28d46f1ed983581b539cfbe6a01c034e0ce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140098 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-09-16wina11y: Drop unused CMAccessible helper methodsMichael Weghorn
Their doc says that they are for the `accSelect` implementation, but that one doesn't actually make use of them. Change-Id: I9185a905d00484fcb950a1bdb6013e07a089bb22 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140069 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-09-10wina11y: Report actual app/toolkit name/versionMichael Weghorn
The previous way of reporting "Hannover" as app name, "3.0" as version and no toolkit name and version looks rather arbitrary. Can be queried e.g. from NVDA's Python console as follows after pressing Keypad_Insert+Ctrl+Z with any LibreOffice UI element focused: >>> focus.IAccessibleObject.QueryInterface(IA2.IAccessibleApplication).appName 'Hannover' >>> focus.IAccessibleObject.QueryInterface(IA2.IAccessibleApplication).appVersion '3.0' >>> focus.IAccessibleObject.QueryInterface(IA2.IAccessibleApplication).toolkitName ' ' >>> focus.IAccessibleObject.QueryInterface(IA2.IAccessibleApplication).toolkitVersion ' ' Report the actual app name and version. For the toolkit use "VCL" as name and the same version that LibreOffice has: >>> focus.IAccessibleObject.QueryInterface(IA2.IAccessibleApplication).appName 'LibreOfficeDev' >>> focus.IAccessibleObject.QueryInterface(IA2.IAccessibleApplication).appVersion '7.5' >>> focus.IAccessibleObject.QueryInterface(IA2.IAccessibleApplication).toolkitName 'VCL' >>> focus.IAccessibleObject.QueryInterface(IA2.IAccessibleApplication).toolkitVersion '7.5' Change-Id: I3c6bdb79e6b945c0f9707bfa7bada0fb456d6e05 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139743 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-09-09Simplify by using replaceAll in a loop (winaccessibility/AccTextBase)Julien Nabet
Change-Id: I68c895033d26c81c76e680d2042aac941d56d213 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139707 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-09-02[API CHANGE] tdf#150683 a11y: Switch a11y child index to 64 bitMichael Weghorn
With 16k column support in Calc enabled by default in commit 4c5f8ccf0a2320432b8fe91add1dcadf54d9fd58 Date: Tue Mar 8 12:44:49 2022 +0100 change default Calc number of columns to 16384 (tdf#50916) , the number of Calc cells in a spreadsheet is larger than SAL_MAX_INT32, meaning that a 32-bit a11y child index is no more enough and using it resulted in integer overflows in methods handling corresponding Calc cells in the a11y layer. This e.g. had the effect of the Orca and NVDA screen readers not announcing focused or selected cells properly when their a11y child index was out of the 32-bit integer range. Switch the internal a11y child indices to 64 bit to be able to handle this properly internally. Since the platform APIs (at least AT-SPI on Linux and IAccessible2 on Windows; from what I can see LO's macOS a11y bridge doesn't directly expose the child index) are still restricted to 32 bit, larger child indices still cannot be exposed via the platform APIs. As a consequence, use of the the IAccessible2 and AT-SPI methods that use the child index remains problematic in those cases where the child index is larger. However, as an alternative to using the AT-SPI Table interface and the IAccessibleTable/ IAccessibleTable2 interfaces with the child index to retrieve information about a specific cell, both AT-SPI and IAccessible2 also provide interfaces to retrieve that information directly from the cell object (TableCell interface for AT-SPI, IAccessibleTableCell for IAccessible2). Those interfaces are already implemented/exposed for winaccessibility (s. `CAccTable`) and the qt5/qt6/kf5 VCL plugins (s. the `QAccessibleTableCellInterface` methods implemented in `QtAccessibleInterface`). With the switch to 64-bit internal a11y child indices, these now behave correctly for cells with a child index that doesn't fit into 32 bit as well. NVDA on Windows already uses the IAccessibleTableCell interface and thus announcing focused cells works fine with this change in place. Orca on Linux currently doesn't make use of the AT-SPI TableCell interface yet, but with a suggested change to do so [1], announcement of selected cells works with the qt6 VCL plugin with a current qtbase dev branch as well - when combined with the suggested changes to implement support for the AT-SPI TableCell interface in Qt [2] [3] and the LO change based on that [4] and a fix for a nullptr dereference [5]. The gtk3 VCL plugin doesn't expose the AT-SPI TableCell interface yet, but once it does so (via `AtkTableCell`), it also works with the suggested Orca change [1] in place. (Adding that is planned for an upcoming change, works with a local WIP patch.) For handling return values that are larger than what platform APIs support, the following approach has been chosen for now: 1) When the return value is for the count of (selected) children, the maximum value N supported by the platform API is returned. (This is what `ScAccessibleTableBase::getAccessibleChildCount` did previously.) The first N elements can be accessed by their actual (selection) indices. 2) When the return value is the child/cell index, -2 is returned for objects whose index is greater than the maximum value supported by the platform API. Using a non-negative value would mean that the index would refer to *another* actually existing child. A child index of -1 on the other hand tends to be interpreted as "child is invalid" or "object isn't actually a child of its (previous) parent any more)". For the Orca case, this would result in objects with a child index of -1 not being announced, as they are considered "zombies" [6]. What's still somewhat problematic is the case where more than 2^31 children are *selected*, since access to those children still happens by the index into the selection in the platform APIs, and not all selected items are accessible this way. (Screen readers usually just retrieve the first and last element from the selection and announce those.) Orca already seems to apply different handling for the case for fully selected rows and columns, so "All cells selected" or "Columns ... to ... selected" is announced just fine even if more than 2^31 cells are selected. (Side note: While Microsoft User Interface Automation - UIA - also uses 32-bit indices, it also has specific methods in the ISelectionProvider2 interface that allow to explicitly retrieve the first and last selected item, `ISelectionProvider2::get_FirstSelectedItem` and `ISelectionProvider2::get_LastSelectedItem`, but we currently don't support UIA on Windows.) Bound checks at the beginning of the methods from the `XAccessibleContext`, `XAccessibleSelection` and `XAccessibleTable` interfaces that take a child index (or in helper methods called by those) should generally already prevent too large indices from being passed to the methods in the lower layer code that take smaller integer types. Such bound checking has been been added in various places where it wasn't present yet. If there any remaining issues of this kind that show after this commit, they can probably be solved in a similar way (s.e.g. the change to `AccessibleBrowseBox::getAccessibleChild` in this commit). A few asserts were also added at places where my understanding is that values shouldn't be larger than what is supported by a called method anyway. A test case will be added in a following change. [1] https://gitlab.gnome.org/GNOME/orca/-/merge_requests/131 [2] https://codereview.qt-project.org/c/qt/qtbase/+/428566 [3] https://codereview.qt-project.org/c/qt/qtbase/+/428567 [4] https://gerrit.libreoffice.org/c/core/+/138750 [5] https://codereview.qt-project.org/c/qt/qtbase/+/430157 [6] https://gitlab.gnome.org/GNOME/orca/-/blob/82c8542002e36e0d3d918088d583162d25136143/src/orca/script_utilities.py#L5155 Change-Id: I3af590c988b0e6754fc72545918412f39e8fea07 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139258 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-09-01wina11y: Drop CEnumVariant::m_lLBound that's always 0Michael Weghorn
... and doesn't increase readability. Change-Id: I62f3b37e8b8b948600e4d5e721c67a575628f1d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139217 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-08-31wina11y: Drop unused member and methods related to selectionMichael Weghorn
Those were only used by `AccObjectWinManager::UpdateAccSelection`, which has been dropped in Change-Id I49bfddb636721d9142a88b7ce1eb3ee3a2f9c695 ("wina11y: Drop unused AccObjectWinManager::UpdateAccSelection"). Change-Id: I11d1ad3f01929a68e341f910ec6382f91227e3c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139124 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-08-31wina11y: Drop unused AccObjectWinManager::UpdateAccSelectionMichael Weghorn
It was already unused when it was added in commit a18bdb3bc05e761704cc345a66a9d642bc4f4a0a Date: Thu Nov 14 08:18:05 2013 +0000 Integrate branch of IAccessible2 `CMAccessible::get_accSelection` already queries information on demand. The dropped method looks like another one of the methods that could be used for manual bookkeeping of information instead of querying them from the underlying UNO interfaces on demand. But retrieving them on demand seems preferable, s.a. the commit message in commit fcf4a26275d7503835f9aa23cb94938809840300 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Wed Jan 5 13:41:53 2022 +0000 tdf#146306 wina11y: Retrieve accessible desc on demand > Querying up-to-date values from the underlying > UNO interfaces on demand instead of doing extra > manual bookkeeping in the winaccessibility code > may be possible for more a11y attributes in addition > to the accessible description handled in this commit, > but each one will have to be looked at separately. Change-Id: I49bfddb636721d9142a88b7ce1eb3ee3a2f9c695 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139123 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>