summaryrefslogtreecommitdiff
path: root/vcl/qt5
AgeCommit message (Collapse)Author
2023-05-28Use getXWeak in vclMike Kaganski
Change-Id: I665c9dc8c4f9cc4a996d9bf990cbfa33822bd07f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150885 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-05-23Resolves tdf#145080 - Use accent color for focused cellHeiko Tietze
Accent color added but effectively working only on macOS See inline comments for gtk, qt, and win Change-Id: I1e4a729331735683921f94b27bb2bb02555c0165 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151887 Tested-by: Jenkins Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
2023-05-13tdf#148251 qt: Use std::swap instead of using temporary valuesDr. David Alan Gilbert
Another std::swap case in drawLine Change-Id: I207fe3c8c6c88532c23faf3aa3188acdcda3a5b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151654 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-05-09Related: tdf#142176 rearrange screensaver inhibiter to be more genericCaolán McNamara
and for not-x11 I see gtk just uses 0 for xid (which is called window_system_id there now) Change-Id: I9248bcceaa2d21d34133dea80697776df0aa8c6c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151560 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-04-28qt a11y: Forward changes to active stateMichael Weghorn
Forwarding of a11y state change events had in general been implemented in commit 8c3e8af0e60865ec6d38e2117efdb4ed2f10a20c Author: Michael Weghorn <m.weghorn@posteo.de> Date: Fri Jun 17 17:29:19 2022 +0200 qt a11y: Forward STATE_CHANGED event as such , but that commit explicitly did not yet enable forwarding of changes to the `active` state; quoting from the commit message: > For some reason, forwarding changes to state `AccessibleStateType::ACTIVE` > resulted in Orca becoming unresponsive (stop talking) quite quickly. > That needs further analysis, so that state change isn't forwarded > to Qt for now. I no longer see this problem on Debian testing with Orca 43.1-1, current LO master and qtbase dev branch as of commit 589c6d066f84833a7c3dda1638037f4b2e91b7aa plus the pending Qt Gerrit change [1] ("a11y atspi: Implement TableCell methods Get{Column,Row}HeaderCells") in place. Without the latter qtbase change, I can observe Orca becoming unresponsive quite quickly when moving around in Calc after pressing Shift, which may be due to waiting for a timeout instead of receiving the proper reply to the AT-SPI methods that that Gerrit change implements. (S.a. QTBUG-113110 [2] for another scenario using a simple pyatspi script to trigger what is potentially the same underlying issue.) Therefore, drop the old workaround. With this LO and the Qt change in place, Orca announces the focused and selected cell(s) in Calc with the qt6 VCL plugin and these steps: 1) start LO Calc with the qt6 VCL plugin 2) press Shift and wait a few seconds 3) move around using the arrow keys 4) select cells using Shift + arrow keys Ideally, this should also work without step 2, but apparently that step currently somehow triggers something relevant (creation of relevant a11y objects and registration of their listeners?) that doesn't yet happen without step 2. [1] https://codereview.qt-project.org/c/qt/qtbase/+/473907 [2] https://bugreports.qt.io/browse/QTBUG-113110 Change-Id: Icff8bbe7a6ee233407804c9098166945cdef4315 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151176 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-04-22qt a11y: Implement QAccessibleSelectionInterface added in Qt 6.5Michael Weghorn
This adds an implementation of the `QAccessibleSelectionInterface` that was added in Qt 6.5 in commit [1] commit 9d16d5e2245c26e5746fd7609300b84a2a983457 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Tue Oct 11 15:23:54 2022 +0200 a11y: Add new QAccessibleSelectionInterface , s.a. QTBUG-105909 [2]. The `QAccessibleSelectionInterface` is currently still marked as preliminary in Qt, so changes to the API *might* still happen and require an update of the implementation here as well). Quoting from the commit message of the above commit: > This interface is marked \preliminary until: > > 1. There is a working a11y bridge for macOS/VoiceOver > 2. There is a working a11y bridge for Windows/UI Automation > 3. There is a working a11y bridge for linux/AT-SPI > 4. There is at least one implementation (e.g. QAccessibleTable) > that implements it successfully (second candidate: > Qt Quick TableView [...]) The AT-SPI bridge (point 3 from above) has been implemented in [3] commit ece2feee0317b582a56a0bfc783f11fe67d3edee Author: Michael Weghorn <m.weghorn@posteo.de> Date: Tue Oct 11 15:24:04 2022 +0200 a11y atspi: Bridge newly introduced QAccessibleSelectionInterface , an implementation for `QAccessibleTable` (point 4 from above) was added in [4] commit 092bbc9ad30c6cd7389053dc4b332cc762693676 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Wed Oct 12 07:07:48 2022 +0200 a11y: Implement QAccessibleSelectionInterface for item views . The Qt Gerrit changes for the macOS implementation (point 1 from above) and the Windows/UIA implementation (point 2 from above) are currently still awaiting review: [5] [6] To avoid duplication, just call the newly added methods `QtAccessibleWidget::selectedItemCount` and `QtAccessibleWidget::selectedItem` from the `QAccessibleTableInterface` methods `QtAccessibleWidget::selectedCellCount` and and `QtAccessibleWidget::selectedCells`, and therefore implement the former also for Qt < 6.5. Sample use of the interface from Accerciser's IPython console (with 18 cells selected in Calc and the spreadsheet object selected in Accerciser's a11y object tree; screencast attached to QTBUG-105909 [2]): In [10]: acc.get_interfaces() Out[10]: ['Accessible', 'Component', 'Selection', 'Table'] In [11]: sel = acc.querySelection() In [12]: sel.nSelectedChildren Out[12]: 18 In [13]: sel.getSelectedChild(0).name Out[13]: 'B1' In [14]: sel.deselectSelectedChild(1) Out[14]: True In [15]: sel.deselectChild(1) Out[15]: True In [16]: sel.selectChild(0) Out[16]: True In [17]: sel.clearSelection() Out[17]: True In [18]: sel.selectAll() Out[18]: True [1] https://code.qt.io/cgit/qt/qtbase.git/commit/?id=9d16d5e2245c26e5746fd7609300b84a2a983457 [2] https://bugreports.qt.io/browse/QTBUG-105909 [3] https://code.qt.io/cgit/qt/qtbase.git/commit/?id=ece2feee0317b582a56a0bfc783f11fe67d3edee [4] https://code.qt.io/cgit/qt/qtbase.git/commit/?id=092bbc9ad30c6cd7389053dc4b332cc762693676 [5] https://codereview.qt-project.org/c/qt/qtbase/+/451353 [6] https://codereview.qt-project.org/c/qt/qtbase/+/451646 Change-Id: Iac3c050448183610af3bd3b10a56e82d7d52cb91 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138750 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-04-15qt a11y: Send QAccessible::ObjectCreated event for correct objectMichael Weghorn
When an `AccessibleEventId::CHILD` event with its s `NewValue` set is received, that means that this a11y child object has been created, so the `QAccessible::ObjectCreated` event needs to be sent for the newly created object, not the accessible interface of the listener (which is the parent). This makes announcement of (part of) the font color popup button in Writer's toolbar generally work with Orca and the qt6 VCL plugin e.g. the buttons in the popup are now announced (but the colors are not yet). Adapting this for the case where a child has been removed (bridged to Qt as `QAccessible::ObjectDestroyed` event) would currently results in crashes when closing the application e.g. after using the character font color popup in the Writer toolbar. This needs further investigation, so don't send the event for now, but add a `SAL_WARN`. Also warn when receiving a `CHILD` event with neither `OldValue` nore `NewValue` set, since that shouldn't happen, s.a. documentation in `offapi/com/sun/star/accessibility/AccessibleEventId.idl`. Change-Id: I183e71de061489fdc9751620820268f280f1949f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150417 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-04-12qt: Don't show non-visible menu entriesMichael Weghorn
Take the visibility of the menu item (that e.g. gets set in `QtMenu::ShowItem`) into account when updating the menu in `QtMenu::DoFullMenuUpdate`. With this in place, only the relevant entry is shown in the context menu for items in the character table in the special characters dialog (Writer: "Insert" -> "Special Character") while previously, the "Add to favorites" and "Remove from favorites" entries would both be shown at the same time regardless of whether the character was present in the favorites or not. (Both entries would actually do the same: add the character if it was not present in the favorites, remove it if it was already there...). Change-Id: Ica5f07d6009d97db2df0540293b096565bf1dd52 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150285 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-04-02tdf#152979 qt: Re-add workaround for X11 modality change w/ hide/showMichael Weghorn
Essentially add back the workaround originally added in commit e770bacc85a0eec96de77068d61b03f374b3cdec Date: Sun Jun 2 21:01:33 2019 +0000 Qt5 workaround modal change after show bug but then dropped again in commit 2dc6bdd1d5789ace0500cad90f5d2eb930888bb9 Date: Wed Jun 5 17:39:45 2019 +0000 tdf#125692 SalObject always holds a SystemChildWindow , since it turns out that it is still needed for other use cases than the original one from tdf#125692, as the freeze of the basic IDE dialog dialog preview described in tdf#152979. The qt.qpa.xcb: internal error: void QXcbWindow::setNetWmStateOnUnmappedWindow() called on mapped window issue mentioned there is apparently also worked around in upstream Qt tests, s. this qtbase commit [1]: commit 3714e51436eebb64873c58dc36cf89ef8f139f09 Author: Volker Hilsheimer <volker.hilsheimer@qt.io> Date: Mon Sep 20 13:44:26 2021 +0200 QWidgetWindow: Stabilize test on Xcb Showing, hiding, and showing a window can result in the Xcb QPA plugin warning about qt.qpa.xcb: internal error: void QXcbWindow::setNetWmStateOnUnmappedWindow() called on mapped window The point of the test is to verify that we get a paint event on a window that is shown again after having been hidden, not to verify that async windowing systems can handle a show/hide/show sequence. So wait for the window being exposed before we hide it. Pick-to: 6.2 5.15 Change-Id: If91a9926613645e78e332dacff34bd57e4034b6f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Decrease the sleep from the original 250 ms to 100 ms, since tdf#152979 comment 14 mentions that this is enough. [1] https://code.qt.io/cgit/qt/qtbase.git/commit/?id=3714e51436eebb64873c58dc36cf89ef8f139f09 Change-Id: I57ed520d0df85b7a3bcf47c2f9314754649482ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149912 Tested-by: Jenkins Reviewed-by: Rafael Lima <rafael.palma.lima@gmail.com>
2023-03-29tdf#149805 tdf#151677 tdf#152217 tdf#154043 tdf#153458 tdf#153800 Revert ↵Michael Weghorn
"VCL expect ... correct frame size for native menubars" This reverts commit afc828b9833b7a612369e95606ba56d41ef2c369 Date: Sat May 28 23:47:21 2022 +0200 VCL expect correct frame size for native menubars ... and renove the wrong framesize hack in the Qt backend because it caused several regressions and unfortunately the commit also doesn't fix all of the bugs mentioned in its commit message (while some previous patch sets of the change did address more, yet had other issues, s.a. the discussion in the commit's Gerrit change [1]). While e.g. the drag and drop issues reported in tdf#153458 and tdf#153800 could be fixed by translating the event position using `mapToParent()` (as is done in `QtWidget::fillSalAbstractMouseEvent` with the above commit in place), I currently don't see how to address the other issues and the overall direction of the change is not fully clear to me at this point. (There are also other pending changes in the relation change still pending in Gerrit that would presumably need more work/analysis.) After all, it seems the best way forward to revert the commit for now. This also reverts the follow-up commit commit 25da92004038c03c0feedf373e8038e7ee3e0c37 Date: Thu Jul 21 11:33:02 2022 +0200 Make JunitTest_toolkit_unoapi_1 succeed again on macOS that fixed a test failure introduced by the above commit. Luckily, there seem to be no follow-up commits that depend on this and the commits can be reverted cleanly without the need to resolve any conflicts manually. This reverts commit 25da92004038c03c0feedf373e8038e7ee3e0c37. This reverts commit afc828b9833b7a612369e95606ba56d41ef2c369. [1] https://gerrit.libreoffice.org/c/core/+/135082 Change-Id: I4c099ad7de8cbbad10da391ede4770d8c748fbde Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149495 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-03-14Related tdf#129547 and tdf#154136: add COLON keyJulien Nabet
Change-Id: I17978dbb100fbfa6f6ddbbbdf96872076bc2a289 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86713 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-03-06qt a11y: Handle all QAccessible::Relation flagsMichael Weghorn
The bits/flags in `QAccessible::Relation` can be set in any combination, while the previous code would only properly handle the case that `QAccessible::AllRelations` is set. This would e.g. mean that QtAccessibleWidget::relations(QAccessible::FlowsTo | QAccessible::FlowsFrom) would not return both relations as it should. The previous handling of the case that just a single flag is set also looks odd, since it would use the sal_Int16 value of the UNO relation as an index into the set of relations... Fix this by always iterating over all relations and applying the filter in `lcl_appendRelation` (only append those that match the filter). (At least for AT-SPI, the previous handling should not have caused any issues in practice, since Qt's AT-SPI bridge always passes `QAccessible::AllRelations` from what I can see.) Change-Id: Icc21ac252db026f607fe8d6041252916b1d9e3a9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148352 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-03-06qt a11y: Add mapping for relations added in Qt 6.6Michael Weghorn
Map `AccessibleRelationType::CONTENT_FLOWS_FROM`, `AccessibleRelationType::CONTENT_FLOWS_TO` and `AccessibleRelationType::DESCRIBED_BY` to the Qt equivalents added in Qt 6.6 and vice versa. As described in more detail in commit e55713dffbe8d8eba18068f6c2af14c10b787220 Date: Fri Feb 17 15:25:37 2023 +0100 qt a11y: Invert relation type to match Qt's semantic , the "inverse" relation needs to be used when mapping to/from the Qt relation. For example the Orca screen reader on Linux makes use of the FlOWS_FROM and FLOWS_TO relations. So far, when using the qt6 VCL plugin with Orca running, moving focus to a Writer paragraph resulted in these warnings being emitted: warn:vcl.qt:220606:220606:vcl/qt6/../qt5/QtAccessibleWidget.cxx:218: Unmatched relation: 1 warn:vcl.qt:220606:220606:vcl/qt6/../qt5/QtAccessibleWidget.cxx:218: Unmatched relation: 2 and thus Orca not being able to make use of those relations. Sample use in Accerciser's Python console, with a Writer document having three paragraphs with texts "First", "second", and "third" and the a11y object of the second paragraph's a11y object selected in Accerciser's a11y tree view: In [1]: acc.queryText().getStringAtOffset(0, pyatspi.TEXT_GRANULARITY_PARAGRAPH) Out[1]: ('second', 0, 6) In [2]: acc.get_relation_set() Out[2]: [<Atspi.Relation object at 0x7fccc36862c0 (AtspiRelation at 0x421e100)>, <Atspi.Relation object at 0x7fccc358c280 (AtspiRelation at 0x4493c60)>] In [3]: first_relation = acc.get_relation_set()[0] In [4]: first_relation.get_n_targets() Out[4]: 1 In [5]: first_relation.get_relation_type() Out[5]: <enum ATSPI_RELATION_FLOWS_FROM of type Atspi.RelationType> In [6]: first_relation.get_target(0) Out[6]: <Atspi.Accessible object at 0x7fccc35aa4c0 (AtspiAccessible at 0x4479820)> In [7]: first_relation.get_target(0).queryText().getStringAtOffset(0, 1) Out[7]: ('First', 0, 5) In [8]: second_relation = acc.get_relation_set()[1] In [9]: second_relation.get_n_targets() Out[9]: 1 In [10]: second_relation.get_relation_type() Out[10]: <enum ATSPI_RELATION_FLOWS_TO of type Atspi.RelationType> In [11]: second_relation.get_target(0).queryText().getStringAtOffset(0,1) Out[11]: ('third', 0, 5) (QTBUG-105864 [1] also has a sample doc and pyatspi script that can be used for testing.) Qt commit adding the relations [2]: commit f5358e5932bc8701621389c265c4ea86c92c536c Author: Michael Weghorn <m.weghorn@posteo.de> Date: Fri Feb 17 13:48:38 2023 +0100 a11y: Add new relations DescriptionFor, Described, Flows{From,To} This is equivalent to the corresponding relation types defined in the IAccessible2 spec [1] (IA2_RELATION_DESCRIPTION_FOR, IA2_RELATION_DESCRIBED_BY, IA2_RELATION_FLOWS_FROM, IA2_RELATION_FLOWS_TO) and for AT-SPI on Linux [2] (relation types ATSPI_RELATION_DESCRIPTION_FOR, ATSPI_RELATION_DESCRIBED_BY, ATSPI_RELATION_FLOWS_FROM, ATSPI_RELATION_FLOWS_TO). User Interface Automation (UIA) on Windows also has corresponding properties for 3 of them [3]: UIA_DescribedByPropertyId, UIA_FlowsFromPropertyId, UIA_FlowsToPropertyId. This commit adds the new flags and implements the mapping for the AT-SPI case. Note that the relation type is conceptually always "inverted" when comparing Qt and AT-SPI (or Qt and UIA) as clarified in afbfe30093d49eff0ec4c28c220d33c233b9f807. "QAccessible::Description" instead of "QAccessible::DescriptionFor" would align better with the naming scheme of the other relations, but that is already used in the Text enum. [1] https://accessibility.linuxfoundation.org/a11yspecs/ia2/docs/html/group__grp_relations.html [2] https://lazka.github.io/pgi-docs/Atspi-2.0/enums.html#Atspi.RelationType [3] https://docs.microsoft.com/en-us/windows/win32/winauto/uiauto-automation-element-propids [ChangeLog][QtGui][QAccessible::RelationFlag] Added new relation flags DescriptionFor, Described, FlowsFrom and FlowsTo. Fixes: QTBUG-105864 Change-Id: If2d46099eeea75e177358c821d1ae833a553bd0e Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io> [1] https://bugreports.qt.io/browse/QTBUG-105864 [2] https://code.qt.io/cgit/qt/qtbase.git/commit/?id=f5358e5932bc8701621389c265c4ea86c92c536c Change-Id: I6e5d78fb26f62a6f1745d4f94647e8dc0fe2abfd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138687 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-03-04tdf#153803 qt: Let Qt style draw combobox popup bordersMichael Weghorn
... and listbox popup borders as well. Declare suppport for native drawing of focus for pushbuttons, since the Qt-based VCL plugins take care of drawing focus for controls. As far as I can see, there is no need to actually implement drawing of focus separately for the Qt-based VCL plugins, though, since that is already handled by the `ControlState::FOCUSED` state when drawing the entire control. Support for this is what `ComboBox::ImplInit` and `ListBox::ImplInit` check and if it's not supported, they enable double buffering for the window (which would have the result that the `pWin` in `ImplDrawFrame` in vcl/source/window/decoview.cxx would be nullptr and thus no native drawing of the frame would happen), s.a. commit d4714b0fdb81e6e561ae526cc517ecc9a40a603e Date: Mon Jun 17 17:02:54 2019 +0200 tdf#101978 vcl combobox/listbox floating window: avoid flicker With this in place, the border in the popup windows for listboxes and comboboxes are drawn by the Qt style. Yet another way to achieve this would be to support drawing `ControlPart::ListboxWindow` for `ControlType::Listbox`, so that the other rendering path in `ImplSmallBorderWindowView::DrawWindow` is taken, but that is currently complicated by the fact that bounding and content rect are not really used consequently there, so that would have to be cleaned up first, s.a. the commit message in commit 5c96e813bed3293605f8d746f188cc051d1e5949 Date: Thu Feb 2 15:27:37 2023 +0000 tdf#150451 Fix borders in Editbox controls (kf5) for more details. Change-Id: I8cd2396e7075a475e53e016acbb16d6fb54bad2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148160 Tested-by: Jenkins Reviewed-by: Rafael Lima <rafael.palma.lima@gmail.com>
2023-03-02tdf#152073 tdf#153895 basicide: Set bg color for border winMichael Weghorn
As described in the original commit to address tdf#152073 ("Glitch rendering line numbers in Basic IDE editor (kf5 only)"), the fact that the KDE Breeze style's frame border is partly transparent was causing artifacts in the Basic IDE: commit 6f4b8b7cfe2907b7da46eec6951a0e09b836a6de Author: Michael Weghorn <m.weghorn@posteo.de> Date: Tue Jan 31 16:08:53 2023 +0100 tdf#152073 qt: Draw background when drawing frame For native drawing of a frame (border), use the window background color as default color. As mentioned in commit f39f21d92ec83c3a5062f29dd26214fc83012c06 ("tdf#138010 (IV) VclScrolledWindow: Use actual border width"), the Qt/KDE Breeze style uses a frame width of 2, with the actual 1 pixel border being surrounded by a 1 pixel padding/margin. Transparent background did not ensure that the 1 pixel padding/margin is repainted and could thus result in artifacts from what was painted to that location previously (s. the Basic IDE editor example from tdf#152073). [...] However, there are cases when a transparent background is actually wanted, like in the print dialog (tdf#153895). Therefore, revert the original commit mentioned above and explicitly set a background color for the border windows of the involved windows in the Basic IDE instead, which is in line with the alternative already mentioned in the above commit ("An alternative might be to explicitly draw the background further up the call stack, [...]."), but enables transparency in the qt5/qt6/kf5-specific drawing for the frame again. Change-Id: Ifb4deb80c6ae245ec630a4fdc23f675e5587836c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148117 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-03-01tdf#153869 qt: Unminimize window when requestedMichael Weghorn
Remove the `Qt::WindowMinimized` state from the widget's window states if the `SalFrameToTop::RestoreWhenMin` flag is set to request restoring the minimized window. Change-Id: I0cb67f28c1e9c3f48a9a234702a4aaa7e3ffec8d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148036 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-02-21tdf#144302 tdf#153333 qt: Load cursor from icon themeMichael Weghorn
Load cursor from the icon theme similar to how the gtk VCL plugins do it. This not only allows using the themed cursor icons, but also helps avoid QTBUG-95434 [1] ("Bitmap cursors not supported on QtWayland") that would result in no cursor being shown on Wayland at all when our custom bitmap cursors are used. [1] https://bugreports.qt.io/browse/QTBUG-95434 Change-Id: Id65db4e7d71b8cee8a514c06c21c59dcc2afa889 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147379 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-02-20qt a11y: Invert relation type to match Qt's semanticMichael Weghorn
As Jan Arve Sæther pointed out in a review comment [1] for a pending Qt change to add more a11y relation types to Qt, Qt's semantic for relations is basically the other way around (i.e. inversed) as compared to the semantic used by AT-SPI or LO. For example, if an a11y interface `interfaceA` is the label for another a11y interface `interfaceB`, interfaceA->relations() will contain a pair { interfaceB, QAccessible::Labelled } since the target `interfaceB` is labelled by `interfaceA`. On the other hand in LO, the `XAccessibleRelationSet` for an `XAccessibleContext` has the role that the a11y object itself has *for* the targets, i.e. in that case the interfaceA->getAccessibleRelationSet() would contain an item of type `AccessibleRelationType::LABEL_FOR` because `interfaceA` is a label for the relation target `interfaceB`. Therefore, adapt the mapping between the relation types accordingly. AT-SPI's semantic/handling matches the one that LO has again, which is taken care of by the fact that Qt maps the relation types the other way around in it's AT-SPI bridge again. [2] There's also a pending Qt change [3] to clarify the Qt doc. [1] https://codereview.qt-project.org/c/qt/qtbase/+/428174/comment/eef0cf38_e6ff7dea/ [2] https://code.qt.io/cgit/qt/qtbase.git/tree/src/gui/accessible/linux/qspi_constant_mappings.cpp?id=e8322a4cc043e1a150cc4c6b86ee2f9cf858cd24#n98 [3] https://codereview.qt-project.org/c/qt/qtbase/+/460414 Change-Id: Ic30d878afc477ad3c6a188d22f35078034f8123c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147223 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-02-20tdf#153614 qt: Set keyboard focus state when focused, tooMichael Weghorn
For example the Breeze theme only draws a light blue focus rectangle for list boxes when the `QStyle::State_KeyboardFocusChange` state is set in addition to `QStyle::State_HasFocus`. Therefore, set that state in addition to ensure that the focused control actually gets a focus indicator when moving there using the keyboard. Change-Id: Ib4b85f9140629e6b69c80b85e85913392a6c000f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147019 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-02-10Fix typoAndrea Gelmini
Change-Id: I14c04884eab36560c96dbc59b809a5871d87b75f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146750 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
2023-02-10tdf#150451 Fix borders in Editbox controls (kf5)Rafael Lima
The bounding rectangle calculated for an Editbox in QtGraphics_Controls::getNativeControlRegion was not always enough to accommodate content and the borders. The KDE Breeze does not draw any borders if the total height of the bounding rectangle is smaller than the minimum size needed for content + frame at top and bottom, s. Style::drawFrameLineEditPrimitive in the Breeze style [1]. Therefore, ensure a minimum height of that size. The Breeze style also considers the type of the passed widget when retrieving the frame width using QStyle::pixelMetric [2], so pass a dummy `QLineEdit` in order to get the actual frame width of 6 that the Breeze style uses for line edits, rather than the default value of 2 that is returned when not passing any widget. Just do that for the minimum size calculation for now and not everywhere, because the handling for edit boxes here in the qt VCL plugins and in the calling code currently does all kinds of "interesting" things like doing extra size adjustments or passing the content rect where the bounding rect would be expected,... Ideally this should be cleaned up in the callers and all platform integrations in a follow-up commit to adhere to what the doc in vcl/inc/WidgetDrawInterface.hxx says, but this here keeps it working with existing code for now. (s.a. discussion in the Gerrit change for more details) Tested using various scaling factors: 1, 1.25, 1.5, 1.75 and 2.0. [1] https://invent.kde.org/plasma/breeze/-/blob/144ea45018d28758db07afd987d97318d56c4981/kstyle/breezestyle.cpp#L3527 [2] https://invent.kde.org/plasma/breeze/-/blob/144ea45018d28758db07afd987d97318d56c4981/kstyle/breezestyle.cpp#L555 Co-authored-by: Michael Weghorn <m.weghorn@posteo.de> Change-Id: If8cb4794c7f3ce1be4d1ee421c9c27ad5adf5da2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146516 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-02-07improve readability of VirtualDevice constructorNoel Grandin
(a) It is not obvious what DeviceFormat::DEFAULT means (b) There are two parameters (each with two states), but only really 2 possible overall states So (1) use more useful names (2) combine the two parameters into one enum Change-Id: Ic0595b39e032cc9e019b88326389d055b977da00 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146589 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-02-01tdf#152073 qt: Draw background when drawing frameMichael Weghorn
For native drawing of a frame (border), use the window background color as default color. As mentioned in commit f39f21d92ec83c3a5062f29dd26214fc83012c06 ("tdf#138010 (IV) VclScrolledWindow: Use actual border width"), the Qt/KDE Breeze style uses a frame width of 2, with the actual 1 pixel border being surrounded by a 1 pixel padding/margin. Transparent background did not ensure that the 1 pixel padding/margin is repainted and could thus result in artifacts from what was painted to that location previously (s. the Basic IDE editor example from tdf#152073). Use the window background for the default image color when drawing a frame to avoid this. The gtk3 VCL plugin also explicitly draws a background for the corresponding code path, using `gtk_render_background`. An alternative might be to explicitly draw the background further up the call stack, or pass an explicit background color from `DecorationView::DrawFrame` and only apply a default color in `QtGraphics_Controls::drawNativeControl` when a background color (other than `COL_DEFAULT`) is passed to that method. Sample bt for gtk3: 1 GtkSalGraphics::drawNativeControl salnativewidgets-gtk.cxx 1835 0x7fffe6271f92 2 SalGraphics::DrawNativeControl salgdilayout.cxx 807 0x7fffee887739 3 OutputDevice::DrawNativeControl nativecontrols.cxx 287 0x7fffee58906e 4 (anonymous namespace)::ImplDrawFrame decoview.cxx 600 0x7fffee1b2055 5 DecorationView::DrawFrame decoview.cxx 886 0x7fffee1b32c8 6 ImplSmallBorderWindowView::DrawWindow brdwin.cxx 742 0x7fffee0ea3ea 7 ImplBorderWindow::Paint brdwin.cxx 1630 0x7fffee0ee99a 8 PaintHelper::DoPaint paint.cxx 313 0x7fffee0c9f1c 9 vcl::Window::ImplCallPaint paint.cxx 617 0x7fffee0cb4b3 10 PaintHelper::~PaintHelper paint.cxx 552 0x7fffee0cae14 11 vcl::Window::ImplCallPaint paint.cxx 623 0x7fffee0cb513 Many thanks to Rafael Lima for the very helpful analysis in [1] and [2]. [1] https://bugs.documentfoundation.org/show_bug.cgi?id=152073#c2 [2] https://bugs.documentfoundation.org/show_bug.cgi?id=152073#c3 Change-Id: I08e6d05d0fc3d0e54952a65cd28dee92615df0a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146419 Reviewed-by: Rafael Lima <rafael.palma.lima@gmail.com> Tested-by: Jenkins
2023-01-12drop internal support for 1-bit imagesNoel Grandin
on modern hardware, these are less efficient than regular alpha channels. Also, this greatly simplies the range of stuff that vcl needs to deal with, which will make the upcoming transparency->alpha patch easier to deal with. Enhance vcl::CreateFromData to convert incoming 1-bit data to 8-bit image. Change-Id: I35829da750029fe373d0d2911a669d10bab6ad23 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145321 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-01-06use std::optional for SALCOLOR_NONENoel Grandin
instead of re-using an actual real color value, because it will totally not work when I convert vcl to use alpha instead of transparency Change-Id: I01f043e0b65ffd852989dfe28f2b9d5a43c9c3d7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145075 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-12-21No need for bool return value hereNoel Grandin
all of the implementations of this method return true. Change-Id: I6dc02499af1809110edd482a48d9f6d5d42ead19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144620 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-11-21stop setting OpenSymbol as a "Symbol" fontCaolán McNamara
which has a specific meaning of a Windows Symbol encoding Change-Id: I6e5d079303fccfabc8204fc0dbae0870efb839a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142947 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-11-18rename IsStarSymbol to IsOpenSymbolCaolán McNamara
Change-Id: If525ba9826f5bc2d860233cbabf58d1d290be054 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142936 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-10-01vcl: Use PhysicalFontFace::GetRawFontData() for font embeddingKhaled Hosny
Change-Id: I6f7c4508f7cef022eaf65a998cb242078d3771c6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140826 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
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-16tdf#117173: qt a11y: Forward changes to SHOWING stateMichael Weghorn
While Qt doesn't have an equivalent state for the SHOWING state used in LibreOffice and in IAccessible2, it has separate `QAccessible::ObjectHide` and `QAccessible::ObjectShow` event types used to indicate that an object changed state to being (no longer) displayed, so use those. In fact, Qt's `AtspiAdaptor` handles those by mapping them to state change events for the AT-SPI "showing" state again. [1] [1] https://code.qt.io/cgit/qt/qtbase.git/tree/src/gui/accessible/linux/atspiadaptor.cpp?id=ce16eb2679f69b28d2debd1ce18a99f7279b4295#n896 Change-Id: Iae2b9ec26403d9a9887e86c4155ba64a73f19b60 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139812 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-09-14tdf#150882 qt: Report menu bar height when not hiddenMichael Weghorn
`QWidget::isVisible` only returns `true` if the widget is actually visible on screen. Therefore, even if the menu itself has been set to be visible in `QtMenu::ShowMenuBar`, the call to `mpQMenuBar->isVisible()` will still return `false` as long as the corresponding window the menu belongs to isn't shown on screen (yet). However, since the menu bar height may be used to calculate the position of other items (e.g. in the macro dialog) before the corresponding window gets shown, what should be relevant is whether the menu bar itself is meant to be hidden or not. Therefore, use `QWidget::isHidden` instead. Quoting the Qt doc [1] for `QWidget`'s `visible` property: > This property holds whether the widget is visible > > Calling setVisible(true) or show() sets the widget to visible status if > all its parent widgets up to the window are visible. If an ancestor is > not visible, the widget won't become visible until all its ancestors are > shown. [...] > > Calling setVisible(false) or hide() hides a widget explicitly. An > explicitly hidden widget will never become visible, even if all its > ancestors become visible, unless you show it. This makes the menu show properly in the macro dialog while still not reserving any space for the menu in the main window in case of using the "Tabbed" interface (where no "traditional" menu is present). [1] https://doc.qt.io/qt-6/qwidget.html#visible-prop Change-Id: Ifb6e22db8224013f06320d090a19d80d9e38a990 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139910 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-09-11vcl: Move CreateFontSubset() to PhysicalFontFaceKhaled Hosny
Having it in SalGraphics is not necessary as the code now depends on PhysicalFontFace for accessing raw font data, and this consolidates all the near identical copies of this code into one. Change-Id: I8a411f102fd2188a456bdeb8a0d794078d74e47b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139762 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-11vcl: Add a PhysicalFontFace-backed TrueTypeFontKhaled Hosny
This is mainly to be able to get the font table data from the PhysicalFontFace so that an actual font file or full font data are not required (since they are not always available, e.g. with CoreText fonts). This is slightly based on QtTrueTypeFont that this code replaces. Change-Id: I6926706dfc6765076100ac0314a30f9ff970ddb6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139760 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-06vcl: Drop unused SalGraphics::CreateFontSubset() argumentKhaled Hosny
pWidths is always nullptr. Change-Id: I1c666f146865786269e9513cbb6c8ffdc7df96e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139461 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-06vcl: Drop now unused SalGraphics::GetGlyphWidths()Khaled Hosny
Change-Id: Iec8974d6fc67d9d599c5e92aa325225963da0021 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139459 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-05vcl: fontinstance.{cxx,hxx} -> LogicalFontInstance.{cxx,hxx}Khaled Hosny
Every time I need this file, I had to lookup the file name and location. Rename it following the pattern of other font classes and move the header next to their headers. Change-Id: Ia1e3ee4be9375c1110e169c593e1f8e7aad39c76 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139446 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-05vcl: Consolidate PhysicalFontFace::GetFontCapabilities()Khaled Hosny
All subclasses are doing the same thing in slightly different ways, so move it to the base class that we can now access font tables there. Change-Id: I1f8827dbc345aa852e1f7aaaa4cb4615593289c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139395 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-05vcl: Consolidate PhysicalFontFace::GetFontCharMap()Khaled Hosny
All subclasses are doing the same thing in slightly different ways, so move it to the base class that we can now access font tables there. Also drop unused PhysicalFontFace::HasChar(). Change-Id: I77022b4dc3688de2788c18966f39f407a6abb730 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139340 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-04vcl: Create hb_face_t in PhysicalFontFaceKhaled Hosny
The two map to each other, and we want to access hb_face_t to provide some functionality scattered currently in platform-specific implementations. Change-Id: Ib3842752ec240b8254db828dba95a6a0ad65f16a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139275 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.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-02tdf#150683 qt a11y: Add bound checks for table methodsMichael Weghorn
Since the row/column indices come from outside (usually from assistive technology like a screen reader), validate them before using them when calling the corresponding methods on the XAccessibleTable{,Selection} interfaces. Otherwise, calling the corresponding UNO methods will result in a crash due to an `IndexOutOfBoundsException` being thrown. Change-Id: I4d018d16b99f1c2c7b88c1c9e03f16d40ec3345c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139250 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-09-01qt: Add include needed with qtbase dev branchMichael Weghorn
`qVersion()` has been moved to a different header in qtbase commit [1]: commit 50b05e3e2ad969abf4b939d5db2253380e47d775 (gerrit/dev) Author: Sona Kurazyan <sona.kurazyan@qt.io> Date: Tue Aug 30 10:37:00 2022 +0200 Move qVersion() from qglobal.h to qlibraryinfo.h Since qVersion() might be called also from C code, disable the parts of qlibraryinfo.h that are relevant only for C++ code if __cplusplus is not defined. [ChangeLog][Potentially Source-Incompatible Changes] qVersion() is moved from qglobal.h to qlibraryinfo.h, '#include <QtCore/QLibraryInfo>' needs to be added where it's used. Task-number: QTBUG-99313 Change-Id: I3363ef3fa4073114e5151cb3a2a1e8282ad42a4d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> [1] https://code.qt.io/cgit/qt/qtbase.git/commit/?id=50b05e3e2ad969abf4b939d5db2253380e47d775 Change-Id: Iafeb0ed6a77420f9a303d8ec4d3c5ba29c6f4b19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139221 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-09-01tdf#150683 qt a11y: Avoid using 32-bit child index hereMichael Weghorn
Passing the `QObject` of the child directly in the `QAccessibleEvent` ctor generally has the same effect as setting the parent in the ctor and then passing the child index via `QAccessibleEvent::setChild`. In both cases, `QAccessibleEvent::accessibleInterface` will return the `QAccessibleInterface*` for the child afterwards. However, the latter only works correctly with child indices that fit into 32 bit, which isn't the case for all cells in a Calc spreadsheet with 16k column support. Change-Id: Iaa7b936df237f82dc21a00d3ac419a1519a95226 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139147 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-08-26qt a11y: Set the (un)selected child in selection add/remove eventMichael Weghorn
Qt itself sets the child index when sending `QAccessible::SelectionAdd` or `QAccessible::SelectionRemove` events for its own widgets and the handling in its AT-SPI adapter assumes that this is the case, so do so here as well. Work around QTBUG-105988 [1] by using the `QAccessibleEvent` ctor that takes a `QObject*` instead of the one that takes the `QAccesibleInterface*`, since calling `QAccessibleEvent::setChild` in the event object would otherwise break things. When used in combination with the suggested Qt changes to send AT-SPI `SelectionChanged` events for these event types and `QAccessible::SelectionWithin` [2] [3], the suggested Qt changes to add support for the AT-SPI selection interface [4] [5] and a corresponding LibreOffice demo change [6] that implements the suggested `QAccessibleSelectionInterface`, this makes Orca announce selected Calc cells for the qt6 VCL plugin. [1] https://bugreports.qt.io/browse/QTBUG-105988 [2] https://codereview.qt-project.org/c/qt/qtbase/+/429146 [3] https://codereview.qt-project.org/c/qt/qtbase/+/429147 [4] https://codereview.qt-project.org/c/qt/qtbase/+/428566 [5] https://codereview.qt-project.org/c/qt/qtbase/+/428567 [6] https://gerrit.libreoffice.org/c/core/+/138750 Change-Id: Id1cd28aa8cab208d7713ddd46ede5a7acd73334a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138882 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-08-26automatically set TextRenderModeForResolutionIndependentLayout if we scaleCaolán McNamara
Always render glyphs with a mode suitable for rendering of resolution-independent layout positions if we scale the text positions. The idea being to typically continue to use the system defaults for font settings for UI elements, but where we are rendering into application canvases where there's a mapmode set then automatically use a good mode to render that. Change-Id: I0e5857e377da72ae1a2ede1d88d6408819fc9200 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138324 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-08-25qt a11y: Forward text selection change event as suchMichael Weghorn
Change-Id: I7e208d964c5b5badb0a3ea3a19c3ca3cc7fa4ff4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138838 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-08-25qt a11y: Work around Qt ignoring ActiveDescendantChanged eventsMichael Weghorn
While Qt has a `QAccessible::ActiveDescendantChanged` event type, events of that type are just ignored in Qt's AT-SPI adapter [1]. Work around that by sending a "focused" event for the child instead, for which handling inside Qt has been added in [2]. While adding support for properly handling `QAccessible::ActiveDescendantChanged` in Qt might be worth looking into at some point, this appears to work just fine for now and e.g. makes Orca announce the focused cell in Calc when moving between cells using the keyboard in the qt6 VCL plugin. [1] https://code.qt.io/cgit/qt/qtbase.git/tree/src/gui/accessible/linux/atspiadaptor.cpp?id=0131dbd2f95449c09758208d8b190c9238a5c46a#n1121 [2] https://code.qt.io/cgit/qt/qtbase.git/commit/?id=f3509565480107c2587212f7d55cc5f92facc417 Change-Id: I809695de427b6438d37a5a4840044e7ca3d4cd08 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138809 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-08-24qt a11y: Remember associated QObject also for non-QtXAcccessible caseMichael Weghorn
This is similar to what Change-Id Ic890a387ff016e889f25dba70c82d0d81ae7a9e3 ("qt a11y: Remember and reuse existing QObject for XAccessible") does to avoid creating another `QtXAccessible` for an `XAccessible` if one has been created earlier. However, there is an additional case that needs to be covered to avoid creating multiple `QObjects` for a single `XAccessible`: `QtAccessibleWidget::customFactory` not only gets called by explicitly calling `QAccessible::queryAccessibleInterface` from within LibreOffice code, but the Qt library itself also calls this method, in which case no entry associating the `XAccessible` with its `QObject` had been inserted into the map handled by our `QtAccessibleRegistry` previously. This would result in a "new" `QtXAccessible` object being created later when a `QObject` would be needed for that `XAccessible`, rather than using the `QtWidget` that is the actual `QObject` associated with the object. Prevent that from happening by inserting an entry into the map for this case as well. With this and two Accerciser fixes [1] [2] in place, jumping to bookmarks in Accerciser's treeview of the LO a11y hierarchy now generally works with the qt6 VCL plugin. It previously failed due to the fact that a new object was created and navigating the tree up to the root application object from the bookmarked object would then fail. The fact that there were two objects could be seen e.g. by using the following commands in Accerciser's IPython console with the root "soffice.bin" application a11y object selected in the treeview after starting Calc: In [25]: acc[1][0][0].get_parent().path Out[25]: '/org/a11y/atspi/accessible/2147483672' In [26]: acc[1][0].path Out[26]: '/org/a11y/atspi/accessible/2147483648' -> Two different IDs/paths for what should be the same object. (The parent of the first child of the object at tree path 1,0 should be the object itself, but here it wasn't.) With this change in place, this now works as expected: In [28]: acc[1][0][0].get_parent().path Out[28]: '/org/a11y/atspi/accessible/2147483648' In [29]: acc[1][0].path Out[29]: '/org/a11y/atspi/accessible/2147483648' Together with Change-Id Ic890a387ff016e889f25dba70c82d0d81ae7a9e3 ("qt a11y: Remember and reuse existing QObject for XAccessible"), this also addresses the remaining issue mentioned in commit 99640693d28ca11b31a1d3855e104d2d8c5122d7 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Wed Aug 3 16:49:48 2022 +0200 > Note however that this change alone is not yet sufficient > for a window to actually be returned for any arbitrary a11y > object deeper down the hierarchy. This is because > walking up the a11y hierarchy currently results in new > Qt a11y objects being created for the parents instead of > using existing ones, and the newly created ones lack > the association to the widgets. > (This works in a WIP branch that remembers/caches > a11y objects, but that needs some additional work before > it can be merged.) Note that there are still cases where navigation to bookmarks in Accerciser's tree view doesn't work (reliably), but those would need to be looked at separately and might not be specific to the qt6 VCL plugin. (At least I have come across such cases with gtk3 as well.) [1] https://gitlab.gnome.org/GNOME/accerciser/-/commit/c2a3e9f1eb1fcd6eb059f1f2fe6e629b86521335 [2] https://gitlab.gnome.org/GNOME/accerciser/-/commit/a092dc933985fafd5b1e2cc3374c7bbc0fb2d12e Change-Id: I02262014a45a4b024cdc1bbd385da8a35a2c304a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138764 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-08-24qt a11y: Remember and reuse existing QObject for XAccessibleMichael Weghorn
Previously, a new `QtXAccessible` object was created for an `XAccessible` each time before `QAccessible::queryAccessibleInterface` was called, which is not only unnecessary but also causes various issues, e.g. it breaks walking the a11y hierarchy upwards (i.e. from children to parents), since a new object is created for the parent. This introduces `QtAccessibleRegistry` that keeps a mapping between the `XAccessible` and the associated `QObject`. That mapping is used to reuse already created objects instead of creating new ones for the same `XAccessible`. The entry for an `XAccessible` is removed again from the map in `QtAccessibleWidget::invalidate`, which gets called when the `XAccessible` gets disposed, s. `QtAccessibleEventListener::disposing`. With this in place, Orca now also nicely announces only the text of the push buttons themselves in the "Save Document?" dialog when switching between the buttons using the Tab key, rather than announcing the whole widget hierarchy every time (probably because creating a new object every time prevented Orca from recognizing that the previously selected pushbutton and the newly selected one are siblings, i.e. have the same parent object.) Change-Id: Ic890a387ff016e889f25dba70c82d0d81ae7a9e3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138757 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>