diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2024-12-17 13:58:03 +0100 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2024-12-17 22:57:26 +0100 |
commit | 7503bb286ff6bc15c1682d47b188fc37f3beff31 (patch) | |
tree | 437a40bada522b4652e09ace0738bbc1e1307000 /include | |
parent | 4c35e9beedc9ba89b20e7ce48cc04c800ee2fa6a (diff) |
[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 1af510e95147374e5289ae1c12f1f280931919f4
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
Diffstat (limited to 'include')
-rw-r--r-- | include/svtools/brwbox.hxx | 10 | ||||
-rw-r--r-- | include/toolkit/awt/vclxwindow.hxx | 7 | ||||
-rw-r--r-- | include/vcl/accessiblefactory.hxx | 297 | ||||
-rw-r--r-- | include/vcl/svtaccessiblefactory.hxx | 59 |
4 files changed, 57 insertions, 316 deletions
diff --git a/include/svtools/brwbox.hxx b/include/svtools/brwbox.hxx index a514e70dd524..8ceb560e9614 100644 --- a/include/svtools/brwbox.hxx +++ b/include/svtools/brwbox.hxx @@ -28,7 +28,6 @@ #include <vcl/timer.hxx> #include <vcl/AccessibleBrowseBoxObjType.hxx> #include <vcl/accessibletableprovider.hxx> -#include <vcl/svtaccessiblefactory.hxx> #include <vector> #include <stack> @@ -46,10 +45,6 @@ namespace svt { class BrowseBoxImpl; } -namespace vcl { - class IAccessibleFactory; -} - namespace weld { class Scrollbar; } @@ -349,7 +344,6 @@ private: Color m_aCursorColor; // special color for cursor, COL_TRANSPARENT for usual (VCL-painted) "inverted" cursor BrowserMode m_nCurrentMode; // last argument of SetMode (redundant, as our other members represent the current settings, too) - vcl::AccessibleFactoryAccess m_aFactoryAccess; rtl::Reference<vcl::IAccessibleBrowseBox> m_pAccessible; THeaderCellMap m_aColHeaderCellMap; @@ -397,10 +391,6 @@ private: getAccessibleTable(); protected: - /// retrieves the XAccessible implementation associated with the BrowseBox instance - SAL_DLLPRIVATE ::vcl::IAccessibleFactory& getAccessibleFactory(); - -protected: bool m_bNavigationBar; sal_uInt16 ColCount() const; diff --git a/include/toolkit/awt/vclxwindow.hxx b/include/toolkit/awt/vclxwindow.hxx index 300874f4c43b..01e003db073a 100644 --- a/include/toolkit/awt/vclxwindow.hxx +++ b/include/toolkit/awt/vclxwindow.hxx @@ -49,11 +49,6 @@ namespace vcl { class Window; } class VclWindowEvent; -namespace vcl -{ - class IAccessibleFactory; -} - class UnoPropertyArrayHelper; class VCLXWindowImpl; @@ -89,8 +84,6 @@ protected: void SetSystemParent_Impl( const css::uno::Any& rHandle ); - vcl::IAccessibleFactory& getAccessibleFactory(); - // helper ... static void PushPropertyIds( std::vector< sal_uInt16 > &aIds, int nFirstId, ...); // for use in controls/ diff --git a/include/vcl/accessiblefactory.hxx b/include/vcl/accessiblefactory.hxx index cc97ce380f66..b65d60895c97 100644 --- a/include/vcl/accessiblefactory.hxx +++ b/include/vcl/accessiblefactory.hxx @@ -20,6 +20,7 @@ #pragma once #include <vcl/AccessibleBrowseBoxObjType.hxx> +#include <vcl/dllapi.h> #include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/uno/Reference.hxx> @@ -69,275 +70,91 @@ namespace vcl class IAccessibleTable; class IAccessibleTableControl; } +} - /** a function which is able to create a factory for the standard Accessible/Context - components needed for standard toolkit controls - - The returned pointer denotes an instance of the IAccessibleFactory, which has been acquired - <em>once</em>. The caller is responsible for holding this reference as long as it needs the - factory, and release it afterwards. - */ - typedef void* (* GetSvtAccessibilityComponentFactory)( ); - - - /** a function which is able to create a factory for the standard Accessible/Context - components needed for standard VCL controls - - The returned pointer denotes an instance of the IAccessibleFactory, which has been acquired - <em>once</em>. The caller is responsible for holding this reference as long as it needs the - factory, and release it afterwards. - */ - typedef void* (* GetStandardAccComponentFactory)( ); - - - //= IAccessibleFactory - - class IAccessibleFactory : public virtual ::salhelper::SimpleReferenceObject - { - public: - virtual vcl::IAccessibleTabListBox* - createAccessibleTabListBox( - const css::uno::Reference< css::accessibility::XAccessible >& rxParent, - SvHeaderTabListBox& rBox - ) const = 0; - virtual css::uno::Reference< css::accessibility::XAccessible > - createAccessibleTreeListBox( - SvTreeListBox& _rListBox, - const css::uno::Reference< css::accessibility::XAccessible >& _xParent - ) const = 0; - virtual css::uno::Reference< css::accessibility::XAccessible > - createAccessibleIconView( - SvTreeListBox& _rListBox, - const css::uno::Reference< css::accessibility::XAccessible >& _xParent - ) const = 0; - virtual rtl::Reference<vcl::IAccessibleBrowseBox> - createAccessibleBrowseBox( - const css::uno::Reference< css::accessibility::XAccessible >& _rxParent, - vcl::IAccessibleTableProvider& _rBrowseBox - ) const = 0; - virtual rtl::Reference<table::IAccessibleTableControl> - createAccessibleTableControl( - const css::uno::Reference< css::accessibility::XAccessible >& _rxParent, - table::IAccessibleTable& _rTable - ) const = 0; - - virtual css::uno::Reference< css::accessibility::XAccessible > - createAccessibleIconChoiceCtrl( - SvtIconChoiceCtrl& _rIconCtrl, - const css::uno::Reference< css::accessibility::XAccessible >& _xParent - ) const = 0; - - virtual css::uno::Reference< css::accessibility::XAccessibleContext > - createAccessibleTextWindowContext( - vcl::Window* pWindow, TextEngine& rEngine, TextView& rView - ) const = 0; - - virtual css::uno::Reference< css::accessibility::XAccessible > - createAccessibleBrowseBoxHeaderBar( - const css::uno::Reference< css::accessibility::XAccessible >& rxParent, - vcl::IAccessibleTableProvider& _rOwningTable, - AccessibleBrowseBoxObjType _eObjType - ) const = 0; - - virtual css::uno::Reference< css::accessibility::XAccessible > - createAccessibleBrowseBoxTableCell( - const css::uno::Reference< css::accessibility::XAccessible >& _rxParent, - vcl::IAccessibleTableProvider& _rBrowseBox, - sal_Int32 _nRowId, - sal_uInt16 _nColId, - sal_Int32 _nOffset - ) const = 0; - - virtual css::uno::Reference< css::accessibility::XAccessible > - createAccessibleBrowseBoxHeaderCell( - sal_Int32 _nColumnRowId, - const css::uno::Reference< css::accessibility::XAccessible >& rxParent, - vcl::IAccessibleTableProvider& _rBrowseBox, - AccessibleBrowseBoxObjType _eObjType - ) const = 0; - - virtual css::uno::Reference< css::accessibility::XAccessible > - createAccessibleCheckBoxCell( - const css::uno::Reference< css::accessibility::XAccessible >& _rxParent, - vcl::IAccessibleTableProvider& _rBrowseBox, - sal_Int32 _nRowPos, - sal_uInt16 _nColPos, - const TriState& _eState, - bool _bIsTriState - ) const = 0; - - virtual css::uno::Reference< css::accessibility::XAccessible > - createEditBrowseBoxTableCellAccess( - const css::uno::Reference< css::accessibility::XAccessible >& _rxParent, - const css::uno::Reference< css::accessibility::XAccessible >& _rxControlAccessible, - const css::uno::Reference< css::awt::XWindow >& _rxFocusWindow, - vcl::IAccessibleTableProvider& _rBrowseBox, - sal_Int32 _nRowPos, - sal_uInt16 _nColPos - ) const = 0; - - /** creates an accessible context for a button window - */ - virtual css::uno::Reference< css::accessibility::XAccessibleContext > - createAccessibleContext(PushButton* pButton) = 0; - - /** creates an accessible context for a checkbox window - */ - virtual css::uno::Reference< css::accessibility::XAccessibleContext > - createAccessibleContext(CheckBox* pCheckBox) = 0; - - /** creates an accessible context for a radio button window - */ - virtual css::uno::Reference< css::accessibility::XAccessibleContext > - createAccessibleContext(RadioButton* pRadioButton) = 0; - - /** creates an accessible context for a listbox window - */ - virtual css::uno::Reference< css::accessibility::XAccessibleContext > - createAccessibleContext(ListBox* pListBox) = 0; - - /** creates an accessible context for a fixed hyperlink window - */ - virtual css::uno::Reference< css::accessibility::XAccessibleContext > - createAccessibleContext(FixedHyperlink* pFixedHyperlink) = 0; - - /** creates an accessible context for a fixed text window - */ - virtual css::uno::Reference< css::accessibility::XAccessibleContext > - createAccessibleContext(FixedText* pFixedText) = 0; - - /** creates an accessible context for a scrollbar window - */ - virtual css::uno::Reference< css::accessibility::XAccessibleContext > - createAccessibleContext(ScrollBar* pScrollBar) = 0; - - /** creates an accessible context for an edit window - */ - virtual css::uno::Reference< css::accessibility::XAccessibleContext > - createAccessibleContext(Edit* pEdit) = 0; - - /** creates an accessible context for a combo box window - */ - virtual css::uno::Reference< css::accessibility::XAccessibleContext > - createAccessibleContext(ComboBox* pComboBox) = 0; - - /** creates an accessible context for a toolbox window - */ - virtual css::uno::Reference< css::accessibility::XAccessibleContext > - createAccessibleContext(ToolBox* pToolBox) = 0; - - /** creates an accessible context for a headerbar window - */ - virtual css::uno::Reference< css::accessibility::XAccessibleContext > - createAccessibleContext(HeaderBar* pHeaderBar) = 0; - - /** creates an accessible context for a numeric field - */ - virtual css::uno::Reference< css::accessibility::XAccessibleContext > - createAccessibleContext(FormattedField* pFormattedField) = 0; - - /** creates an accessible context for a generic window - */ - virtual css::uno::Reference< css::accessibility::XAccessibleContext > - createAccessibleContext(vcl::Window* pWindow) = 0; - - protected: - virtual ~IAccessibleFactory() override {} - }; - -} // namespace vcl - -class AccessibleFactory : public vcl::IAccessibleFactory +class VCL_DLLPUBLIC AccessibleFactory { public: - AccessibleFactory(); - - virtual css::uno::Reference<css::accessibility::XAccessibleContext> - createAccessibleContext(PushButton* pButton) override; - virtual css::uno::Reference<css::accessibility::XAccessibleContext> - createAccessibleContext(CheckBox* pCheckBox) override; - virtual css::uno::Reference<css::accessibility::XAccessibleContext> - createAccessibleContext(RadioButton* pRadioButton) override; - virtual css::uno::Reference<css::accessibility::XAccessibleContext> - createAccessibleContext(ListBox* pListBox) override; - virtual css::uno::Reference<css::accessibility::XAccessibleContext> - createAccessibleContext(FixedText* pFixedText) override; - virtual css::uno::Reference<css::accessibility::XAccessibleContext> - createAccessibleContext(FixedHyperlink* pFixedHyperlink) override; - virtual css::uno::Reference<css::accessibility::XAccessibleContext> - createAccessibleContext(ScrollBar* pScrollBar) override; - virtual css::uno::Reference<css::accessibility::XAccessibleContext> - createAccessibleContext(Edit* pEdit) override; - virtual css::uno::Reference<css::accessibility::XAccessibleContext> - createAccessibleContext(ComboBox* pComboBox) override; - virtual css::uno::Reference<css::accessibility::XAccessibleContext> - createAccessibleContext(ToolBox* pToolBox) override; - virtual css::uno::Reference<css::accessibility::XAccessibleContext> - createAccessibleContext(HeaderBar* pHeaderBar) override; - virtual css::uno::Reference<css::accessibility::XAccessibleContext> - createAccessibleContext(FormattedField* pFormattedField) override; - virtual css::uno::Reference<css::accessibility::XAccessibleContext> - createAccessibleContext(vcl::Window* pWindow) override; - - virtual vcl::IAccessibleTabListBox* + AccessibleFactory() = delete; + + static css::uno::Reference<css::accessibility::XAccessibleContext> + createAccessibleContext(PushButton* pButton); + static css::uno::Reference<css::accessibility::XAccessibleContext> + createAccessibleContext(CheckBox* pCheckBox); + static css::uno::Reference<css::accessibility::XAccessibleContext> + createAccessibleContext(RadioButton* pRadioButton); + static css::uno::Reference<css::accessibility::XAccessibleContext> + createAccessibleContext(ListBox* pListBox); + static css::uno::Reference<css::accessibility::XAccessibleContext> + createAccessibleContext(FixedText* pFixedText); + static css::uno::Reference<css::accessibility::XAccessibleContext> + createAccessibleContext(FixedHyperlink* pFixedHyperlink); + static css::uno::Reference<css::accessibility::XAccessibleContext> + createAccessibleContext(ScrollBar* pScrollBar); + static css::uno::Reference<css::accessibility::XAccessibleContext> + createAccessibleContext(Edit* pEdit); + static css::uno::Reference<css::accessibility::XAccessibleContext> + createAccessibleContext(ComboBox* pComboBox); + static css::uno::Reference<css::accessibility::XAccessibleContext> + createAccessibleContext(ToolBox* pToolBox); + static css::uno::Reference<css::accessibility::XAccessibleContext> + createAccessibleContext(HeaderBar* pHeaderBar); + static css::uno::Reference<css::accessibility::XAccessibleContext> + createAccessibleContext(FormattedField* pFormattedField); + static css::uno::Reference<css::accessibility::XAccessibleContext> + createAccessibleContext(vcl::Window* pWindow); + + static vcl::IAccessibleTabListBox* createAccessibleTabListBox(const css::uno::Reference<css::accessibility::XAccessible>& rxParent, - SvHeaderTabListBox& rBox) const override; + SvHeaderTabListBox& rBox); - virtual rtl::Reference<vcl::IAccessibleBrowseBox> + static rtl::Reference<vcl::IAccessibleBrowseBox> createAccessibleBrowseBox(const css::uno::Reference<css::accessibility::XAccessible>& _rxParent, - vcl::IAccessibleTableProvider& _rBrowseBox) const override; + vcl::IAccessibleTableProvider& _rBrowseBox); - virtual rtl::Reference<vcl::table::IAccessibleTableControl> createAccessibleTableControl( + static rtl::Reference<vcl::table::IAccessibleTableControl> createAccessibleTableControl( const css::uno::Reference<css::accessibility::XAccessible>& _rxParent, - vcl::table::IAccessibleTable& _rTable) const override; + vcl::table::IAccessibleTable& _rTable); - virtual css::uno::Reference<css::accessibility::XAccessible> createAccessibleIconChoiceCtrl( + static css::uno::Reference<css::accessibility::XAccessible> createAccessibleIconChoiceCtrl( SvtIconChoiceCtrl& _rIconCtrl, - const css::uno::Reference<css::accessibility::XAccessible>& _xParent) const override; + const css::uno::Reference<css::accessibility::XAccessible>& _xParent); - virtual css::uno::Reference<css::accessibility::XAccessibleContext> - createAccessibleTextWindowContext(vcl::Window* pWindow, TextEngine& rEngine, - TextView& rView) const override; + static css::uno::Reference<css::accessibility::XAccessibleContext> + createAccessibleTextWindowContext(vcl::Window* pWindow, TextEngine& rEngine, TextView& rView); - virtual css::uno::Reference<css::accessibility::XAccessible> createAccessibleTreeListBox( + static css::uno::Reference<css::accessibility::XAccessible> createAccessibleTreeListBox( SvTreeListBox& _rListBox, - const css::uno::Reference<css::accessibility::XAccessible>& _xParent) const override; + const css::uno::Reference<css::accessibility::XAccessible>& _xParent); - virtual css::uno::Reference<css::accessibility::XAccessible> createAccessibleIconView( - SvTreeListBox& _rListBox, - const css::uno::Reference<css::accessibility::XAccessible>& _xParent) const override; + static css::uno::Reference<css::accessibility::XAccessible> + createAccessibleIconView(SvTreeListBox& _rListBox, + const css::uno::Reference<css::accessibility::XAccessible>& _xParent); - virtual css::uno::Reference<css::accessibility::XAccessible> createAccessibleBrowseBoxHeaderBar( + static css::uno::Reference<css::accessibility::XAccessible> createAccessibleBrowseBoxHeaderBar( const css::uno::Reference<css::accessibility::XAccessible>& rxParent, - vcl::IAccessibleTableProvider& _rOwningTable, - AccessibleBrowseBoxObjType _eObjType) const override; + vcl::IAccessibleTableProvider& _rOwningTable, AccessibleBrowseBoxObjType _eObjType); - virtual css::uno::Reference<css::accessibility::XAccessible> createAccessibleBrowseBoxTableCell( + static css::uno::Reference<css::accessibility::XAccessible> createAccessibleBrowseBoxTableCell( const css::uno::Reference<css::accessibility::XAccessible>& _rxParent, vcl::IAccessibleTableProvider& _rBrowseBox, sal_Int32 _nRowId, sal_uInt16 _nColId, - sal_Int32 _nOffset) const override; + sal_Int32 _nOffset); - virtual css::uno::Reference<css::accessibility::XAccessible> - createAccessibleBrowseBoxHeaderCell( + static css::uno::Reference<css::accessibility::XAccessible> createAccessibleBrowseBoxHeaderCell( sal_Int32 _nColumnRowId, const css::uno::Reference<css::accessibility::XAccessible>& rxParent, - vcl::IAccessibleTableProvider& _rBrowseBox, - AccessibleBrowseBoxObjType _eObjType) const override; + vcl::IAccessibleTableProvider& _rBrowseBox, AccessibleBrowseBoxObjType _eObjType); - virtual css::uno::Reference<css::accessibility::XAccessible> createAccessibleCheckBoxCell( + static css::uno::Reference<css::accessibility::XAccessible> createAccessibleCheckBoxCell( const css::uno::Reference<css::accessibility::XAccessible>& _rxParent, vcl::IAccessibleTableProvider& _rBrowseBox, sal_Int32 _nRowPos, sal_uInt16 _nColPos, - const TriState& _eState, bool _bIsTriState) const override; + const TriState& _eState, bool _bIsTriState); - virtual css::uno::Reference<css::accessibility::XAccessible> createEditBrowseBoxTableCellAccess( + static css::uno::Reference<css::accessibility::XAccessible> createEditBrowseBoxTableCellAccess( const css::uno::Reference<css::accessibility::XAccessible>& _rxParent, const css::uno::Reference<css::accessibility::XAccessible>& _rxControlAccessible, const css::uno::Reference<css::awt::XWindow>& _rxFocusWindow, - vcl::IAccessibleTableProvider& _rBrowseBox, sal_Int32 _nRowPos, - sal_uInt16 _nColPos) const override; - -protected: - virtual ~AccessibleFactory() override; + vcl::IAccessibleTableProvider& _rBrowseBox, sal_Int32 _nRowPos, sal_uInt16 _nColPos); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/svtaccessiblefactory.hxx b/include/vcl/svtaccessiblefactory.hxx deleted file mode 100644 index 14bcc653265a..000000000000 --- a/include/vcl/svtaccessiblefactory.hxx +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_INCLUDE_VCL_SVTACCESSIBLEFACTORY_HXX -#define INCLUDED_INCLUDE_VCL_SVTACCESSIBLEFACTORY_HXX - -#include <config_options.h> -#include <vcl/dllapi.h> - -namespace vcl { class IAccessibleFactory; } - -namespace vcl -{ - /** a client for the accessibility implementations which have been outsourced - from the main vcl/svtools libraries - - All instances of this class share a reference to a common IAccessibleFactory - instance, which is used for creating all kind of Accessibility related - components. - - When the AccessibleFactoryAccess goes away, also this factory goes away, and the respective - library is unloaded. - - This class is not thread-safe. - */ - class UNLESS_MERGELIBS(VCL_DLLPUBLIC) AccessibleFactoryAccess - { - private: - bool m_bInitialized; - - public: - AccessibleFactoryAccess(); - - IAccessibleFactory& getFactory(); - - private: - void ensureInitialized(); - }; -} // namespace svt - -#endif // INCLUDED_INCLUDE_VCL_SVTACCESSIBLEFACTORY_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |