include/toolkit/awt/vclxwindows.hxx | 11 ----------- include/vcl/accessiblefactory.hxx | 2 -- include/vcl/toolbox.hxx | 2 ++ sw/qa/uitest/table/tdf146145.py | 10 +++++++--- toolkit/source/awt/vclxtoolkit.cxx | 2 +- toolkit/source/awt/vclxwindows.cxx | 16 ---------------- toolkit/source/helper/unowrapper.cxx | 3 +-- vcl/inc/accessibility/vclxaccessibletoolbox.hxx | 8 +++++++- vcl/source/accessibility/acc_factory.cxx | 5 ----- vcl/source/accessibility/vclxaccessibletoolbox.cxx | 8 ++++++++ vcl/source/window/toolbox2.cxx | 6 ++++++ 11 files changed, 32 insertions(+), 41 deletions(-)
New commits: commit 942838c81f6a67cd96e8a5f04ff8bdb3d57ef9b7 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Mon May 26 09:15:52 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Wed May 28 09:20:06 2025 +0200 toolkit: Drop VCLXToolBox Since Change-Id: Ib6a6746f7fcbcacddc4cc05a00cf63fe04407f80 Author: Michael Weghorn <m.wegh...@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.wegh...@posteo.de> Tested-by: Jenkins diff --git a/include/toolkit/awt/vclxwindows.hxx b/include/toolkit/awt/vclxwindows.hxx index 267c6fc4f1eb..17d65b6c0b6e 100644 --- a/include/toolkit/awt/vclxwindows.hxx +++ b/include/toolkit/awt/vclxwindows.hxx @@ -691,14 +691,6 @@ public: virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); } }; -// class VCLXToolBox -class VCLXToolBox final : public VCLXWindow -{ -public: - VCLXToolBox(); - virtual ~VCLXToolBox() override; -}; - class VCLXHeaderBar final : public VCLXWindow { public: diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx index 4600fc1dd926..b2faa296c8aa 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -1641,7 +1641,7 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( rtl::Reference<VCLXWindow>* ppNewCom break; case WindowType::TOOLBOX: pNewWindow = VclPtr<ToolBox>::Create( pParent, nWinBits ); - *ppNewComp = new VCLXToolBox; + *ppNewComp = new VCLXWindow; break; case WindowType::TRISTATEBOX: pNewWindow = VclPtr<CheckBox>::Create( pParent, nWinBits ); diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index b9ca4245e325..3cc98a515805 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -5901,16 +5901,6 @@ css::uno::Any VCLXPatternField::getProperty( const OUString& PropertyName ) return aProp; } - - -VCLXToolBox::VCLXToolBox() -{ -} - -VCLXToolBox::~VCLXToolBox() -{ -} - VCLXHeaderBar::VCLXHeaderBar() { } diff --git a/toolkit/source/helper/unowrapper.cxx b/toolkit/source/helper/unowrapper.cxx index 3c2b7dbaff7f..413fe6c5979e 100644 --- a/toolkit/source/helper/unowrapper.cxx +++ b/toolkit/source/helper/unowrapper.cxx @@ -85,8 +85,6 @@ static rtl::Reference<VCLXWindow> CreateXWindow( vcl::Window const * pWindow ) case WindowType::WINDOW: case WindowType::TABPAGE: return new VCLXContainer; - - case WindowType::TOOLBOX: return new VCLXToolBox; case WindowType::TABCONTROL: return new VCLXMultiPage; case WindowType::HEADERBAR: return new VCLXHeaderBar; @@ -113,6 +111,7 @@ static rtl::Reference<VCLXWindow> CreateXWindow( vcl::Window const * pWindow ) // case WindowType::SCROLLBARBOX: // case WindowType::PATTERNBOX: // case WindowType::CURRENCYBOX: + case WindowType::TOOLBOX: default: return new VCLXWindow( true ); } } commit 05591f072f752ae24de271ed5a96e0fc91440a6e Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Mon May 26 09:08:41 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Wed May 28 09:19:59 2025 +0200 vcl a11y: Let ToolBox create its accessible directly This is the ToolBox equivalent of commit f82aac71ede9c3f2dc059ca4c8b24f60e0841933 Author: Michael Weghorn <m.wegh...@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.wegh...@posteo.de> diff --git a/include/toolkit/awt/vclxwindows.hxx b/include/toolkit/awt/vclxwindows.hxx index eca70b9ec08f..267c6fc4f1eb 100644 --- a/include/toolkit/awt/vclxwindows.hxx +++ b/include/toolkit/awt/vclxwindows.hxx @@ -694,9 +694,6 @@ public: // class VCLXToolBox class VCLXToolBox final : public VCLXWindow { - virtual css::uno::Reference< css::accessibility::XAccessibleContext > - CreateAccessibleContext() override; - public: VCLXToolBox(); virtual ~VCLXToolBox() override; diff --git a/include/vcl/accessiblefactory.hxx b/include/vcl/accessiblefactory.hxx index abed6406fced..2760eba5e9b6 100644 --- a/include/vcl/accessiblefactory.hxx +++ b/include/vcl/accessiblefactory.hxx @@ -65,8 +65,6 @@ public: static css::uno::Reference<css::accessibility::XAccessibleContext> createAccessibleContext(Edit* pEdit); 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); diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx index 779c5853f0b7..50cbd54a8977 100644 --- a/include/vcl/toolbox.hxx +++ b/include/vcl/toolbox.hxx @@ -262,6 +262,8 @@ public: virtual ~ToolBox() override; virtual void dispose() override; + virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override; + virtual void Click(); SAL_DLLPRIVATE void DoubleClick(); virtual void Activate() override; diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index da8c5a0d845e..b9ca4245e325 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -5911,12 +5911,6 @@ VCLXToolBox::~VCLXToolBox() { } -css::uno::Reference< css::accessibility::XAccessibleContext > VCLXToolBox::CreateAccessibleContext() -{ - VclPtr<ToolBox> pToolBox = GetAs<ToolBox>(); - return AccessibleFactory::createAccessibleContext(pToolBox); -} - VCLXHeaderBar::VCLXHeaderBar() { } diff --git a/vcl/inc/accessibility/vclxaccessibletoolbox.hxx b/vcl/inc/accessibility/vclxaccessibletoolbox.hxx index b67ae030fdc4..c2fffa9faabf 100644 --- a/vcl/inc/accessibility/vclxaccessibletoolbox.hxx +++ b/vcl/inc/accessibility/vclxaccessibletoolbox.hxx @@ -29,7 +29,9 @@ class VCLXAccessibleToolBoxItem; typedef std::map< sal_Int32, rtl::Reference< VCLXAccessibleToolBoxItem > > ToolBoxItemsMap; -class VCLXAccessibleToolBox final : public cppu::ImplInheritanceHelper<VCLXAccessibleComponent, css::accessibility::XAccessibleSelection> +class VCLXAccessibleToolBox final + : public cppu::ImplInheritanceHelper<VCLXAccessibleComponent, css::accessibility::XAccessible, + css::accessibility::XAccessibleSelection> { private: ToolBoxItemsMap m_aAccessibleChildren; @@ -68,6 +70,10 @@ public: virtual OUString SAL_CALL getImplementationName() override; virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + // XAccessible + virtual css::uno::Reference<com::sun::star::accessibility::XAccessibleContext> + SAL_CALL getAccessibleContext() override; + // XAccessibleContext virtual sal_Int64 SAL_CALL getAccessibleChildCount( ) override; virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int64 i ) override; diff --git a/vcl/source/accessibility/acc_factory.cxx b/vcl/source/accessibility/acc_factory.cxx index 3bf3ef9c857a..249af591f696 100644 --- a/vcl/source/accessibility/acc_factory.cxx +++ b/vcl/source/accessibility/acc_factory.cxx @@ -110,11 +110,6 @@ Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext(vcl:: } } -Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext(ToolBox* pToolBox) -{ - return new VCLXAccessibleToolBox(pToolBox); -} - Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext(HeaderBar* pHeaderBar) { return new VCLXAccessibleHeaderBar(pHeaderBar); diff --git a/vcl/source/accessibility/vclxaccessibletoolbox.cxx b/vcl/source/accessibility/vclxaccessibletoolbox.cxx index 639d3b6cb61f..027ac98727e6 100644 --- a/vcl/source/accessibility/vclxaccessibletoolbox.cxx +++ b/vcl/source/accessibility/vclxaccessibletoolbox.cxx @@ -520,6 +520,14 @@ Sequence< OUString > VCLXAccessibleToolBox::getSupportedServiceNames() std::initializer_list<OUString>{u"com.sun.star.accessibility.AccessibleToolBox"_ustr}); } +// XAccessible +css::uno::Reference<com::sun::star::accessibility::XAccessibleContext> +VCLXAccessibleToolBox::getAccessibleContext() +{ + OExternalLockGuard aGuard(this); + return this; +} + // XAccessibleContext sal_Int64 SAL_CALL VCLXAccessibleToolBox::getAccessibleChildCount( ) { diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index 32e25698f461..84e2582b43d1 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -38,6 +38,7 @@ #include <vcl/IconThemeInfo.hxx> #include <vcl/commandinfoprovider.hxx> +#include <accessibility/vclxaccessibletoolbox.hxx> #include <svdata.hxx> #include <uitest/toolboxuiobject.hxx> #include <brdwin.hxx> @@ -329,6 +330,11 @@ void ToolBox::ImplUpdateItem( ImplToolItems::size_type nIndex ) } } +css::uno::Reference<css::accessibility::XAccessible> ToolBox::CreateAccessible() +{ + return new VCLXAccessibleToolBox(this); +} + void ToolBox::Click() { CallEventListeners( VclEventId::ToolboxClick ); commit 864904e8d04fadb905dc9e22326a7bf0f69d38c7 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Mon May 26 08:56:43 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Wed May 28 09:19:53 2025 +0200 sw uitest: Port tdf146145 away from using a11y API Stop using the UNO a11y API in that UI test in order to check whether the "Accept" toolbar item in the Track Changes toolbar is enabled or not. The previous logic was depending on the implementation detail that ToolBox's XWindow is also its XAccessible, which will no longer be the case after upcoming commit Change-Id: Ib6a6746f7fcbcacddc4cc05a00cf63fe04407f80 Author: Michael Weghorn <m.wegh...@posteo.de> Date: Mon May 26 09:08:41 2025 +0200 vcl a11y: Let ToolBox create its accessible directly Instead, use the API newly introduced in previous commit Change-Id: I6fcbee3ce894ad82ec42fa034b85544b50408779 Author: Michael Weghorn <m.wegh...@posteo.de> Date: Mon May 26 08:26:37 2025 +0200 [API CHANGE] uitest: Add API to get XUIObject for specific XWindow to get a UI test object for the toolbar. For checking the state of the toolbar item, check the toolbar child infos, as the toolbar items and their state are provided that way since Change-Id: I6064ad3481e1cef694762c321e244097d8c3029b Author: Michael Weghorn <m.wegh...@posteo.de> Date: Mon May 26 08:57:32 2025 +0200 vcl uitest: Add support for toolbar items This also allows to use the toolbar item's text to identify the one of interest, instead of having to rely on the toolbar item being at a particular index. To run the test: make UITest_sw_table UITEST_TEST_NAME="tdf146145.tdf146145.test_tdf146145" Change-Id: Ice15d7a9e48c27a257bd6943f473b75c2526e3f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185775 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/sw/qa/uitest/table/tdf146145.py b/sw/qa/uitest/table/tdf146145.py index 8a7eabf2b5bb..c2e6739d324f 100644 --- a/sw/qa/uitest/table/tdf146145.py +++ b/sw/qa/uitest/table/tdf146145.py @@ -8,20 +8,24 @@ # from uitest.framework import UITestCase -from uitest.uihelper.common import get_url_for_data_file +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file import time from com.sun.star.accessibility.AccessibleStateType import ENABLED class tdf146145(UITestCase): - # access to the private:resource changes toolbar via accessibility API def is_enabled_Accept_Track_Change(self): xFrame = self.document.getCurrentController().getFrame() for i in xFrame.getPropertyValue("LayoutManager").getElements(): if i.getPropertyValue('ResourceURL') == 'private:resource/toolbar/changes': - return (ENABLED & i.getRealInterface().getAccessibleContext().getAccessibleChild(5).getAccessibleStateSet()) == ENABLED + xToolBox = self.xUITest.getWindow(i.getRealInterface()) + for child_name in xToolBox.getChildren(): + child = xToolBox.getChild(child_name) + states = get_state_as_dict(child) + if states['Text'] == 'Accept': + return states['Enabled'] == 'true' return False