396 Commits
Author SHA1 Message Date
Michael Weghorn 720a9455a6 a11y: Get UnoControl accessible without implementing XAccessible
By now, almost all a11y implementations implement both,
the XAccessible and XAccessibleContext interfaces themselves,
and they do so via the OAccessible base class.

One remaining case that only implements the XAccessible interface
directly is UnoControl. XAccessible::getAccessibleContext
is used from within AccessibleControlShape::Init to get the
accessible context. That accessible context however
is an OAccessible and implements both, the XAccessible
and XAccessibleContext interfaces again.

Stop requiring that UnoControl implements XAccessible
by instead adding a dedicated new method UnoControl::getAccessible
to directly get the OAccessible without relying on
the XAccessible interface being implemented by UnoControl.

In AccessibleControlShape::Init, cast to UnoControl
instead of querying for the XAccessible interface
and call the new method directly.

Stop implementing the XAccessible interface in
UnoControl as it is no longer needed now.

This aligns the UnoControl a11y logic more with how
a11y is implemented elsewhere across the code base.

Sample steps to trigger the modified code
when using the gtk3 vcl plugin on Linux:

* start the Orca screen reader
* start Writer
* insert a few push button controls using
  "Form" -> "Push Button" and then clicking into
  the document and dragging to insert
* disable design mode using "Form" -> "Design Mode"
* focus one of the controls by clicking on it
* press the Tab key to move focus between the controls

No differences in behavior were observed when
doing this with or without this change in place.

Side note: Announcement of the controls when they
receive focus didn't work (reliably) when opening an
existing document containing form controls instead of
inserting them into a new one, but that is preexisting
and unrelated to this commit.

Also adjust test AccessibleFixedTextTest::testFixedText
of the CppunitTest_toolkit_a11y test suite
accordingly that was assuming that it can
query the XAccessible interface directly
from the UNO control.

Change-Id: I8cc3902a8de725eda3d810920f1da2d390c06f73
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210464
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2026-09-05 10:43:42 +02:00
Michael Weghorn ef182d04d5 toolkit a11y: Pass OAccessible to UnoControl::DisposeAccessibleContext
Pass the more concrete OAccessible instead of a reference
to the abstract XComponent UNO interface.

Change-Id: Idcbf5c1eb09cc1380a85410b76d8b1e2df022b6d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210460
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2026-09-04 08:16:28 +02:00
Michael Weghorn 0ee559bf34 toolkit a11y: Use WeakRef to more concrete OAccessible in UnoControl
Switch from using a weak reference (css::uno::WeakReferenceHelper)
to the abstract XAccessibleContext UNO interface to a weak
reference (unotools::WeakReference) of the more concrete
OAccessible class in UnoControl.

This makes clear that the accessible is always an OAccessible
subclass and allows dropping some UNO-querying for the
wanted UNO interfaces.

Change-Id: Ib1ea66c83da9bbf76891c492d84aa57c396f2f44
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210459
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2026-09-04 08:15:05 +02:00
Gabor Kelemen 94d987edc2 tdf#146619 Use more forward declarations in include/toolkit
Change-Id: I46b4f8c398662b2826f7e4bf90f43750e3569667
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198240
Reviewed-by: Gabor Kelemen <gabor.kelemen@collabora.com>
Tested-by: Jenkins
2026-02-07 00:41:15 +01:00
Noel Grandin 6d0e5ddede remove BitmapEx
all use-sites have been converted to Bitmap

Change-Id: I1a8842217a266eef100bd387ab013b004e532256
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190618
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2025-09-05 19:45:45 +02:00
Simon Chenery 18034109ea tdf#143148 replace include guards with pragma once in dir include/toolkit
Change-Id: I3d17e4db89c1299aabdc633da769ecb8ff646434
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189834
Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Tested-by: Jenkins
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2025-08-25 20:46:59 +02:00
Noel Grandin 0a4405f9aa BitmapEx->Bitmap in VCLUnoHelper::CreateBitmap
now that Bitmap can handle transparency

Change-Id: I1de94ef39e00d16b052573ee323886953b574570
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188968
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2025-08-05 21:07:56 +02:00
Michael Weghorn 7c351954ce a11y: Drop a11y logic from VCLXWindow
While accessibility logic for vcl::Window and subclasses
was previously split between vcl::Window and
VCLXWindow, vcl::Window now takes care of everything
to create an XAccessible without involving VCLXWindow
now after

    Change-Id: I25de1ab0f8b47b12346abd01bad05cb54fb75f52
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Mon May 26 09:45:11 2025 +0200

        vcl a11y: Let vcl::Window create accessible directly, drop a11y factory

(and previous changes for vcl::Window subclasses).

Therefore, drop the remaining a11y logic from
VCLXWindow.

No longer let it implement the XAccessible and
XEventListener interfaces.
The latter was only implemented to clear the
reference to the accessible context in
VCLXWindow::disposing, but VCLXWindow now no longer
holds such a reference with this commit in place.

Drop calls to (the now nonexistent) VCLXWindow::disposing
in subclasses (and drop overrides now only calling
base class methods from another subclass).

vcl::Window::dispose already takes care of disposing the
window's XAccessible, so disposing the XAccessibleContext
in VCLXWindow::dispose is no more needed.
(VCLXAccessibleComponent implements both, the XAccessible
and XAccessibleContext interfaces.)

Change-Id: Ided896abdc84cfbbf883621020169699a37cf6df
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185844
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
2025-06-19 21:31:57 +02:00
Michael Weghorn 5e18a357fb toolkit a11y: Fix clang plugin build
This fixes the following lolugin build error caused by
an a11y change series of mine colliding with

    commit 8c33382691
    Date:   Tue Jun 17 12:26:32 2025 +0200

        loplugin:unnecessaryvirtual

and not caught by CI because my series was based on an
older master not containing that commit yet.

    In file included from /home/michi/development/git/libreoffice/toolkit/source/awt/vclxwindow.cxx:35:
    /home/michi/development/git/libreoffice/include/toolkit/awt/vclxwindow.hxx:80:21: error: this member function can be declared static [loplugin:staticmethods]
       79 |     css::uno::Reference< css::accessibility::XAccessibleContext >
          |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       80 |                     CreateAccessibleContext();
          |                     ^~~~~~~~~~~~~~~~~~~~~~~~~
    /home/michi/development/git/libreoffice/toolkit/source/awt/vclxwindow.cxx:861:65: note: defined here: [loplugin:staticmethods]
      861 | uno::Reference< accessibility::XAccessibleContext > VCLXWindow::CreateAccessibleContext()
          | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
      862 | {
          | ~
      863 |     assert(false && "This code path shouldn't be reached any more.");
          |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      864 |     return {};
          |     ~~~~~~~~~~
      865 | }
          | ~
    1 error generated.

Change-Id: Ia645d2c81331dc5d8e871b105804722bfe9168eb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186723
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Michael Weghorn <m.weghorn@posteo.de>
2025-06-19 19:49:14 +02:00
Noel Grandin 8c33382691 loplugin:unnecessaryvirtual
Change-Id: I721cf3175ab964ed7285a9f06c9b59219e08c044
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186667
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2025-06-18 19:25:31 +02:00
Noel Grandin 2853601a8f use more concrete UNO classes
Change-Id: I14d12f6c577be7a47cead8c12c6db8d360e78867
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186527
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2025-06-16 12:57:55 +02:00
Noel Grandin 497a4090de use more concrete UNO classes
Change-Id: I94202657c9338596f0b16c63bab110d3af7d94df
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186519
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2025-06-15 22:43:12 +02:00
Noel Grandin 30911c1a2b use more concrete UNO classes
Change-Id: I1425886c86f277930ad03c97fcb01fd7546235ff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186518
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2025-06-15 20:32:31 +02:00
Noel Grandin 5a98bee1b8 use more concrete UNO classes
Change-Id: I9551b5739805c16bf3fd5b26812bd85bde7b17ff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186517
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2025-06-15 18:25:32 +02:00
Noel Grandin 890513107e use more concrete UNO classes
Change-Id: I1b0c58a76da08c48fe967d27e34c2cc516d8cd16
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186511
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2025-06-15 13:50:07 +02:00
Michael Weghorn 3cb6bae61d vcl a11y: Let Edit and subclasses create their accessible directly
This is the equivalent of

    commit f82aac71ed
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Thu May 22 12:30:12 2025 +0200

        vcl a11y: Let PushButton create its accessible directly

for Edit subclasses, see that commit's message for more background.

Since all of DateField, TimeField, MultiLineEdit and VclMultiLineEdit
are (not necessarily direct) subclasses of Edit and none of their
subclasses further up the class hierarchy than Edit override
Edit::CreateAccessible, there is no need for them to do so either,
but they can use the Edit implementation. Therefore, just drop the
corresponding methods of their VCLXWindow subclasses that were
calling `AccessibleFactory::createAccessibleContext(Edit* pEdit)`
explicitly.

(Before

    Change-Id: Ifb7452de3e011a73aa798d1ea0302bbbc74ed7d2
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Thu May 22 20:13:09 2025 +0200

        vcl a11y: Set DateField/TimeField window type in ctor

, two of them had some additional extra logic that might
have required them to override the base class implementation.)

Since VCLXAccessibleEdit implements the XAccessible interface
now, its SVTXAccessibleNumericField subclass no longer needs
to implement that directly.

Change-Id: I5fe96a9061afb9f51e494cdd41a27636d0aa4d74
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185838
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
2025-05-28 09:20:47 +02:00
Michael Weghorn 64fd4b55a9 vcl a11y: Let FormattedField create its accessible directly
This is the FormattedField equivalent of

    commit f82aac71ed
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Thu May 22 12:30:12 2025 +0200

        vcl a11y: Let PushButton create its accessible directly

, see that commit's message for more background.

Change-Id: I81e196680cc976b73ab029e595713e616ea90bee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185692
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
2025-05-28 09:20:24 +02:00
Michael Weghorn 2bccfbd9ee toolkit: Drop VCLXHeaderBar
Since

    Change-Id: I26249401d9bcde81908553cc01521ac0ead338dd
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Thu May 22 19:37:35 2025 +0200

        vcl a11y: Let HeaderBar create its accessible directly

, the class doesn't add any functionality to its VCLXWindow
base class, so drop it altogether and just use plain
VCLXWindow instead.

Change-Id: I288103d2681a81c3828e311c9b12b7aee1ec1f85
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185691
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2025-05-28 09:20:18 +02:00
Michael Weghorn 63feda6b8d vcl a11y: Let HeaderBar create its accessible directly
This is basically the HeaderBar equivalent of

    commit f82aac71ed
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Thu May 22 12:30:12 2025 +0200

        vcl a11y: Let PushButton create its accessible directly

, see that commit's message for more background.

In this case of HeaderBar, there is already an existing
HeaderBar::CreateAccessible method that was handling
the case where a custom function to create the XAccessible
was set and the default vcl::Window logic going via the
VCLXWindow/AccessibleFactory was only triggered otherwise.
Handle that case also directly in there instead.

Change-Id: I26249401d9bcde81908553cc01521ac0ead338dd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185690
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2025-05-28 09:20:12 +02:00
Michael Weghorn 942838c81f toolkit: Drop VCLXToolBox
Since

    Change-Id: Ib6a6746f7fcbcacddc4cc05a00cf63fe04407f80
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Thu May 22 19:21:33 2025 +0200

        vcl a11y: Let ToolBox create its accessible directly

, the class doesn't add any functionality to its VCLXWindow
base class, so drop it altogether and just use plain
VCLXWindow instead.

Change-Id: I2ef8efa06dc04e5e9b18dc743575666d41ce5648
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185689
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
2025-05-28 09:20:06 +02:00
Michael Weghorn 05591f072f vcl a11y: Let ToolBox create its accessible directly
This is the ToolBox equivalent of

    commit f82aac71ed
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Thu May 22 12:30:12 2025 +0200

        vcl a11y: Let PushButton create its accessible directly

, see that commit's message for more background.

Change-Id: Ib6a6746f7fcbcacddc4cc05a00cf63fe04407f80
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185688
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2025-05-28 09:19:59 +02:00
Michael Weghorn 8ff115110e vcl a11y: Let ComboBox create its accessible directly
This is the ComboBox equivalent of

    Change-Id: If6fa82008f3347c4f95538ab181eaa50c7d9636b
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Thu May 22 12:30:12 2025 +0200

        vcl a11y: Let PushButton create its accessible directly

, see that commit's message for more background.

Change-Id: I8ae7a8a53fa04088ab9130d0905498eb45ad46ac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185687
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2025-05-26 07:33:43 +02:00
Michael Weghorn 01f3de9b22 vcl a11y: Let ScrollBar create its accessible directly
This is the ScrollBar equivalent of

    Change-Id: If6fa82008f3347c4f95538ab181eaa50c7d9636b
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Thu May 22 12:30:12 2025 +0200

        vcl a11y: Let PushButton create its accessible directly

, see that commit's message for more background.

Change-Id: I0d8759b699fea20ccf8bea9ec897879f6e3e07b1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185686
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2025-05-26 07:33:36 +02:00
Michael Weghorn 77e753ede1 vcl a11y: Let FixedText create its accessible directly
This is the FixedText equivalent of

    Change-Id: If6fa82008f3347c4f95538ab181eaa50c7d9636b
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Thu May 22 12:30:12 2025 +0200

        vcl a11y: Let PushButton create its accessible directly

, see that commit's message for more background.

Change-Id: Id3cbc91d6217bbca2d0e770f4fa4813377c10fe6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185675
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2025-05-26 07:33:29 +02:00
Michael Weghorn 14eff4a61f vcl a11y: Let FixedHyperlink create its accessible directly
This is the FixedHyperlink equivalent of

    Change-Id: If6fa82008f3347c4f95538ab181eaa50c7d9636b
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Thu May 22 12:30:12 2025 +0200

        vcl a11y: Let PushButton create its accessible directly

, see that commit's message for more background.

Change-Id: I2b4f1bd25b4f925bdc7d51948057fbc66c718404
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185674
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2025-05-26 07:33:22 +02:00
Michael Weghorn 5283354327 vcl a11y: Let ListBox create its accessible directly
This is the ListBox equivalent of

    Change-Id: If6fa82008f3347c4f95538ab181eaa50c7d9636b
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Thu May 22 12:30:12 2025 +0200

        vcl a11y: Let PushButton create its accessible directly

, see that commit's message for more background.

Change-Id: Ife6382fe72b245b5df2742a17000cf8bb29112b5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185673
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2025-05-26 07:33:16 +02:00
Michael Weghorn e59f294c02 vcl a11y: Let RadioButton create its accessible directly
This is the RadioButton equivalent of

    Change-Id: If6fa82008f3347c4f95538ab181eaa50c7d9636b
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Thu May 22 12:30:12 2025 +0200

        vcl a11y: Let PushButton create its accessible directly

, see that commit's message for more background.

Change-Id: I0bfe50d36250074e21df42ff046a97095b198b71
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185672
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
2025-05-26 07:33:09 +02:00
Michael Weghorn 2a87fc4d06 vcl a11y: Let CheckBox create its accessible directly
This is the CheckBox equivalent of

    Change-Id: If6fa82008f3347c4f95538ab181eaa50c7d9636b
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Thu May 22 12:30:12 2025 +0200

        vcl a11y: Let PushButton create its accessible directly

, see that commit's message for more background.

Change-Id: I6b6ead743cde3489935a902fed9b63d78fd642f8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185671
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2025-05-26 07:33:03 +02:00
Michael Weghorn f82aac71ed vcl a11y: Let PushButton create its accessible directly
So far, the VCLXButton was the XAccessible implementation
for PushButton (and subclasses), which got returned in
Window::CreateAccessible.

VCLXButton's implementation of XAccessible::getAccessibleContext
was then responsible for creating the XAccessibleContext,
a VCLXAccessibleButton.

Drop that separation between XAccessible and XAccessibleContext,
let VCLXAccessibleButton also implement the XAccessible interface
itself, and override Window::CreateAccessible in
PushButton to create the VCLXAccessibleButton directly without
requiring the VCLXButton and AccessibleFactory for this.

This is one step towards unifying the approach for all vcl::Window
subclasses (some were already creating their accessibles
directly), makes responsibilities clearer (currently
shared between vcl::Window and VCLXWindow) and prepares
for more upcoming a11y changes (towards making
VCLXAccessibleComponent/OAccessibleComponentHelper implement both,
XAccessible and XAccessibleContext).

Similar changes for other vcl::Window subclasses will follow.

Internal code previously depending on the fact that a vcl::Window's
VCLXWindow/XWindow was its XAccessible was adjusted previously in
commits like

    commit b1f3e41f10
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Wed May 21 11:03:56 2025 +0200

        sw a11y test: Don't rely on XWindow being XAccessible

If this commit causes any issues, there might be
another place requiring a similar change.

According to the discussion in [1], there might be third-party
code (unrelated to a11y except for using UNO a11y API) also
relying on the assumption that the vcl::Window's XAccessible
is its VCLXWindow, but the UNO a11y API is an internal
implementation detail explicitly unpublished in

    commit 70626249cd
    Date:   Thu Nov 29 00:27:03 2012 +0100

        API CHANGE a11y unpublishing and add/removeListener rename.

and has no stability guarantuee whatsoever and is therefore
not meant to be used by external users. If any third-party
code was relying on this implementation detail, it should be
ported away from relying on UNO a11y API.

If there were a desperate need to still be able to
retrieve the XAccessibleContext via the VCLXWindow/XWindow
(at least temporarily) somehow, a (temporary) workaround
once this commit and corresponding upcoming commits are in place
could be to let VCLXWindow still implement the XAccessible
interface and return the XAccessibleContext from the window's
actual XAccessible in VLCXWindow::getAccessibleContext.
But in my opinion, code relying on that assumption should really
be adjusted instead, also to avoid breaking again when unpublished
UNO a11y API changes again in the future.

[1] https://gerrit.libreoffice.org/c/core/+/185597/comments/48aae563_7c620891

Change-Id: If6fa82008f3347c4f95538ab181eaa50c7d9636b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185670
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
2025-05-26 07:32:55 +02:00
Michael Weghorn d8a908c28f toolkit: Drop unnecessary XWindow2 param specialization
XWindow2 subclasses XWindow, so there's no need for
a VCLUnoHelper::GetWindow variant taking an XWindow2
reference that does the same as the variant taking
an XWindow reference.

Change-Id: I6f931252d2ae2e046dc31c076094e71b8aa71346
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185273
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2025-05-15 06:47:39 +02:00
Gabor Kelemen 72df5a6fdf Drop unneeded forward declarations from include/
test drive the new bin/find-unneeded-includes --fwdecl mode

Change-Id: I507fa2b172ec9e348d1d91066ea241f02187b5ed
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179321
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2025-01-03 09:32:27 +01:00
Michael Weghorn 7503bb286f [API CHANGE] a11y: Drop UNO service to create a11y contexts
Drop the com.sun.star.accessibility.GetStandardAccessibleFactoryService
UNO service that was used to create instances of
the a11y classes for (mainly vcl) widgets.

The service was needed to break a dependency cycle.
However, with

    Change-Id: Ib46c87446dc9121d3b8e735e0e5a40594da73cc5
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Tue Dec 17 12:04:04 2024 +0100

        a11y: Merge accessibility module into vcl

and all the preparatory commits in place, there
is no more dependency cycle, as the a11y classes
for vcl widgets no longer depend on any modules
"above" vcl.

Therefore, drop the UNO service and the abstract
vcl::IAccessibleFactory class and other related
classes.

Make all methods in the AccessibleFactory class
(that was previously subclassing the abstract
IAccessibleFactory) static helper methods,
and call them directly.

The UNO service dropped in this commit was
introduced in

    commit 1af510e951
    Date:   Wed Feb 21 11:30:47 2024 +0200

        Create an UNO service to do the symbol lookup in toolkit::AccessibilityClient

and its documentation was already clearly stating
that it's only meant for LibreOffice internal use:

> /**
>   The toolkit module uses this to get a pointer to the AccessibleFactory from the acc module.
>   Because we have a dependency in our modules that goes the "wrong" way.
>
>   @since LibreOffice 24.8
>
>   @internal
>
>   ATTENTION: This is marked <em>internal</em> and does not
>   have the <em>published</em> flag, which means it is subject to
>   change without notice and should not be used outside the LibreOffice core.
> */

Change-Id: Ib97396a4bad486d9530361dd851ad3ee0f9681b8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178689
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
2024-12-17 22:57:26 +01:00
Michael Weghorn 90c3d4b17f a11y: Merge toolkit::IAccessibleFactory into vcl one
toolkit::IAccessibleFactory and
vcl::IAccessibleFactory are abstract classes
providing methods to retrieve the XAccessible or
XAccessibleContext for different vcl widgets.

Both are implemented by the same class in the
accessibility module: AccessibleFactory

Merge toolkit::IAccessibleFactory into
vcl::IAccessibleFactory to have things in
one place, and have everything in vcl, i.e.
no longer part of it in toolkit that itself
depends on vcl.

Change-Id: I5da571899c9987267cbec2950630d0c44ff4d2f7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178643
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-12-17 22:56:38 +01:00
Michael Weghorn 26c2b0af00 a11y: Move VCLXAccessibleComponent from toolkit to vcl
After

    commit 168512dce7
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Thu Dec 12 18:06:13 2024 +0100

        a11y: Stop using VCLXWindow in vcl a11y classes

and further related commits, VCLXAccessibleComponent
no longer depends on anything in the toolkit module,
so move it from there to vcl.

This way, subclassing VCLXAccessibleComponent (as the
a11y classes for vcl widgets do, currently located in
accessibility/ ) no longer introduces a toolkit
dependency.

Change-Id: I4fd33fb1dc2265d75e8ca9ad87bcc70db61639d3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178434
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-12-13 20:51:52 +01:00
Michael Weghorn 168512dce7 a11y: Stop using VCLXWindow in vcl a11y classes
Adjust VCLXAccessibleComponent and subclasses to take
a vcl::Window arg instead of a VCLXWindow in the ctor
and drop the VCLXAccessibleComponent::m_xVCLXWindow member
that used to hold a reference to the VCLXWindow.
(VCLXAccessibleComponent still holds a VclPtr
to the corresponding vcl::Window.)

Instead of passing the UNO/toolkit peer (VCLXWindow
and subclasses) to the AccessibleFactory to create
an XAccessibleContext context for the underlying VCL
widget, pass the underlying vcl widget, which can
now be passed as is to the corresponding ctors
of VCLXAccessibleComponent and specialized subclasses.

This follows earlier commits replacing the use of the
VCLXWindow classes by direct uses of the vcl::Window
subclasses inside VCLXAccessibleComponent and subclasses
and is the next step in reducing the UNO/toolkit
dependency in the accessibility implementation for
vcl widgets.

For now, the logic where those accessible objects
are created remains in VCLXWindow::CreateAccessibleContext
and overrides, but that can change in the future.

`IAccessibleFactory::createAccessibleContext(VCLXMultiLineEdit*)`
is just dropped and doesn't need its own replacement:
The previous VCLXMultiLineEdit variant was
creating a VCLXAccessibleEdit like the variant
taking a VCLXEdit, but VCLXMultiLineEdit doesn't
subclass VCLXEdit.
The vcl MultiLineEdit however subclasses Edit,
so VCLXMultiLineEdit::CreateAccessibleContext can make
use of `IAccessibleFactory::createAccessibleContext(Edit*)`
as well now.

This also implements what was mentioned in earlier
commit

    Change-Id: I67bb7a6a237e57d0c522790c09a595c02ac06325
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Thu Dec 12 17:16:29 2024 +0100

        sw annotation win a11y: Skip VCLXWindow logic

:

> Drop the comment about the code being dodgy from
> SwAnnotationWin::CreateAccessible. This commit partially
> addresses it and switching VCLXAccessibleComponent
> to using the vcl::Window will take care of the rest,
> see upcoming commit
> Change-Id If0894e733273eecad268c6a932ecee7c2e34b4c2
> ("a11y: Stop using VCLXWindow in vcl a11y classes").

Now that the VCLXAccessibleComponent ctor takes a
vcl::Window, the sw::annotation::SwAnnotationWin
can be passed directly.

From a user perspective, no change in behavior is
intended by this commit.

Change-Id: If0894e733273eecad268c6a932ecee7c2e34b4c2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178385
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
2024-12-12 23:02:33 +01:00
Michael Weghorn dd8c7d0342 a11y: Rename VCLXAccessibleComponent::m_x{EventSource -> Window}
Change-Id: I3724481e81a5f2987567b51424da479879ca78ba
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178364
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
2024-12-12 23:00:39 +01:00
Michael Weghorn f975b84185 a11y: Drop SAL_LOPLUGIN_ANNOTATE("crosscast")
Added in:

    commit d66a97d562
    Date:   Thu Jan 12 08:29:24 2023 +0100

        loplugin:crosscast (clang-cl)

        > winaccessibility/source/service/AccTopWindowListener.cxx(47,36): error: suspicious dynamic cross cast from 'css::accessibility::XAccessible *' to 'VCLXAccessibleComponent *' [loplugin:crosscast]
        >     else if (auto pvclxcomponent = dynamic_cast<VCLXAccessibleComponent*>(pAccessible))
        >                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        Change-Id: Iee7585dd2fa0d92af3be6b89d7d08326de3d1e7b
        Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145380
        Tested-by: Jenkins
        Reviewed-by: Stephan Bergmann <sbergman@redhat.com>

AccTopWindowListener::HandleWindowOpened no longer does
that crosscast now, see

    Change-Id: Ic96d2c95128af144c7769aac40707299b1c80f8c
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Thu Dec 5 14:07:52 2024 +0000

        tdf#164093 tdf#157001 wina11y: Use vcl::Window's actual XAccessible

Change-Id: Ifca76a5d519099f9cbe06f8bde606e01871363fc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177891
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
2024-12-05 20:12:47 +01:00
Michael Weghorn 739b071650 a11y: Move menu a11y classes to vcl, no more use factory
Other than most of the a11y implementations for vcl
classes, VCLXAccessiblePopupMenu etc. do not
make use of any VCLXWindow (i.e. UNO/toolkit wrapper of a
vcl::Window) and thus do not depend on the toolkit
module, which the accessibility module depends on.

Therefore, there's also no need to use the accessible
factory to create them (which is needed when toolkit
classes are involved to avoid a dependency cycle).

Move those classes from the accessibility module to
vcl and add a new method Menu::CreateAccessible and
move the logic from AccessibleFactory::createAccessible
there. Drop the now unnecessary factory methods
previously used for those classes.

No change in behavior intended (yet), but this
also simplifies the code involved for the
tdf#164093 scenario.

Change-Id: Ie3f6f1a02bf6662206d31383473cdc868e1f9164
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177812
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-12-04 20:47:30 +01:00
Michael Weghorn 3d780e72b9 Move helpers for css::awt/VCL point/rect/size to vcl::unohelper
Move helpers to convert between the Rectangle, Point and Size
classes in vcl and in css::awt from VCLUnoHelper (in the toolkit module)
to vcl::unohelper (in the vcl module), for reuse in vcl in upcoming
commits.

Change-Id: I7b11c8a6b8c843a01ce25b1e4c0fb1869ad1e6ee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177816
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-12-04 20:47:14 +01:00
Michael Weghorn a2c1a337f0 [API CHANGE] a11y: Drop XAccessibleExtendedComponent::getFont
This method from the unpublished XAccessibleExtendedComponent
interface is not used by any of the a11y platform bridges, and
I don't know of any platform a11y API that would need it.

In order to report character/font attributes, there is the
XAccessibleText interface and its
XAccessiText::getCharacterAttributes method instead, which
actually gets used by the platform a11y bridges.

Therefore, drop this method to simplify code, and also decouple
the accessibility module a bit further from the toolkit
module without having to reorganize code further.
(VCLXFont from the toolkit module currently gets used in
various implementations.)

Change-Id: I06ea3cc5998a13927b3f869877b28f03ac07c89b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177809
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-12-04 20:46:21 +01:00
Michael Weghorn 7431507d24 toolkit: Pass VCLXFont init args in ctor
Pass arguments right away in ctor rather than
having a ctor that takes no arguments and then
having to call VCLXFont::Init with the arguments
right after calling the ctor.

Change-Id: I651e27154499f61638409377438f9589bc7412a3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177795
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-12-04 20:44:22 +01:00
Michael Weghorn 78ef285661 Use '#pragma once' in vclxfont.hxx
Change-Id: I445ec8a08c6622c681e459efc2dd2afbf74dd78e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177794
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
2024-12-04 20:44:00 +01:00
Stephan Bergmann 709b1f3ddb Make sure VCLXPopupMenu has unique RTTI
...by providing a non-inline key function for that class.  This would have
prevented the issue that has been addressed by
2fe53b2e43 "Fix crash due to unexpected
dynamic_cast failures in optimized build", where a dynamic_cast to VCLXPopupMenu
failed on macOS (which uses pointer equivalence to determine RTTI equivalence),
because VCLXPopupMenu is final, so the compiler, at least in optimized builds,
just used a comparison between the object's recorded RTTI (from dylib A) against
the type's RTTI in dylib B, which erroneously failed.

Change-Id: I68ff864c266bf28d19032527f91de592ca1437f8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176188
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-11-07 11:53:29 +01:00
Michael Weghorn 2fdee9fd60 Unify/Port to use VCLUnoHelper for AWT <-> VCL conversions
Following

    Change-Id: Id48f81deb05aee2026509037f7d14575735e5be0
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Wed Jul 10 14:49:03 2024 +0200

        VCLUnoHelper: Align AWT <-> VCL helpers with convert.hxx impl

, port all uses of the helper functions defined in
`include/toolkit/helper/convert.hxx` to use the
`VCLUnoHelper` equivalents instead, to unify usage
and avoid duplication.

Drop `include/toolkit/helper/convert.hxx` now that
it's unused.

Change-Id: I22695a93e40e47bb2b14d191a2e0a4eb7c856895
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170317
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-07-11 06:44:48 +02:00
Michael Weghorn f111fbf5d5 VCLUnoHelper: Align AWT <-> VCL helpers with convert.hxx impl
There are currently (at least) 2 sets of helpers
for converting from AWT to VCL point, rectangle
and size classes - and the other way around:

* the ones in `include/toolkit/helper/convert.hxx`
* the ones provided by `VCLUnoHelper`

Align the `VCLUnoHelper` implementations with the
ones in `include/toolkit/helper/convert.hxx` and
make them inline as well.

Switch params from the specific subclasses to the
more generic base classes as well
(e.g. `css::awt::Point` -> `PointTemplateBase`).

Otherwise, `VCLUnoHelper::ConvertToVCLRect` is the only one
that didn't implement the functionality in the
exact same way as the counterpart, `VCLRectangle`,
as it was manually calculating the right and bottom
edges.

The `VCLRectangle` implementation
gives the same result for valid rects, so take over
that one. (It shouldn't make a difference for the
only 2 current callers, `ControlHolder::getPosSize`
and `VCLXGraphics::clear`.)

This commit is in preparation of consolidating all uses
to use the `VCLUnoHelper` variants and getting
rid of the other one in following commits.

Change-Id: Id48f81deb05aee2026509037f7d14575735e5be0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170316
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
2024-07-11 06:44:28 +02:00
Stephan Bergmann dc01a6e7ef Some missing "block untrusted referer links" for form controls
...where "Referer" is now passed in as an additional property, so that the
relevant objects can decide whether to obtain graphics while loading a document

Change-Id: Ie3dabc574861713212b906a0d7793f438a7d50a8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168674
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-06-11 16:09:34 +02:00
Stephan Bergmann d98e014cf6 Extended loplugin:ostr manual changes
I had done these a while ago, when I looked into extending loplugin:ostr to do
more automatic rewriting, and these were places where I needed to do something
manually, for one reason or another, because the automatic rewriting would not
pick it up correctly.

However, I got distracted, and a wholesale automatic rewrite would still run
into cases where an _ostr/_ustr instance from a library's .rodata would still be
referenced after the library has already been dlcose'd.  So I never came around
to finishing all that.

But there appears to be renewed interest in (automatic) rewritings here now, so
it probably makes sense if I share this part of my work anyway.

Change-Id: I3da9d38398e4bca373cb0000a9d34b49a36ad58a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166792
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
Tested-by: Jenkins
2024-04-28 11:29:52 +02:00
Noel Grandin 621e162053 add UNLESS_MERGELIBS_MORE and use to reduce symbol visibility
Change-Id: I2e6c2dcd06c76e0f5f68a1debde3a20665104b27
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164219
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-03-02 09:36:01 +01:00
Noel Grandin a5ccdbbc45 UBSan RTTI fixes
after I missed a bunch of stuff when testing UBSan with
  commit 3ba92b5f1e
  hide more symbols
Change-Id: Id3cb0b70b9fa24c7e3fba7fd565eb658dafa00f8

Change-Id: I369587ed3e14e50ca272037b9d950b62841695d5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163703
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-02-22 06:59:23 +01:00
Noel Grandin 3ba92b5f1e hide more symbols
using the bin/find-can-be-private-symbols.py script
to find classes with large numbers of exported symbols
that can hidden.

before
exported       = 58104
imported       = 30810
unused_exports = 35433

after
exported       = 55094
imported       = 31073
unused_exports = 32423

Change-Id: Idd0a70ee3740afd5ca1a86771e0e2ff8090d102d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163456
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-02-19 09:09:06 +01:00