include/toolkit/awt/vclxwindows.hxx | 12 -------- include/vcl/accessiblefactory.hxx | 4 -- include/vcl/toolkit/fmtfield.hxx | 2 + toolkit/source/awt/vclxwindows.cxx | 23 ----------------- toolkit/source/helper/unowrapper.cxx | 3 -- vcl/inc/accessibility/svtaccessiblenumericfield.hxx | 7 ++++- vcl/inc/accessibility/vclxaccessibleheaderbar.hxx | 7 ++++- vcl/source/accessibility/acc_factory.cxx | 10 ------- vcl/source/accessibility/svtaccessiblenumericfield.cxx | 9 ++++++ vcl/source/accessibility/vclxaccessibleheaderbar.cxx | 12 ++++++++ vcl/source/control/FormattedField.cxx | 7 +++++ vcl/source/treelist/headbar.cxx | 4 ++ 12 files changed, 45 insertions(+), 55 deletions(-)
New commits: commit 64fd4b55a9f1711b766d5e59133dc1222f0793d9 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Mon May 26 09:17:05 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Wed May 28 09:20:24 2025 +0200 vcl a11y: Let FormattedField create its accessible directly This is the FormattedField 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: I81e196680cc976b73ab029e595713e616ea90bee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185692 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 cf518c575b6a..f65bef419d65 100644 --- a/include/toolkit/awt/vclxwindows.hxx +++ b/include/toolkit/awt/vclxwindows.hxx @@ -552,8 +552,6 @@ public: sal_Bool SAL_CALL isStrictFormat( ) override; virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override; - - virtual css::uno::Reference< css::accessibility::XAccessibleContext > CreateAccessibleContext() override; }; // class VCLXListBox diff --git a/include/vcl/accessiblefactory.hxx b/include/vcl/accessiblefactory.hxx index 37dba975062d..b70e99e64108 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(FormattedField* pFormattedField); - static css::uno::Reference<css::accessibility::XAccessibleContext> createAccessibleContext(vcl::Window* pWindow); }; diff --git a/include/vcl/toolkit/fmtfield.hxx b/include/vcl/toolkit/fmtfield.hxx index 34b7ea755707..1bbe45eda0a2 100644 --- a/include/vcl/toolkit/fmtfield.hxx +++ b/include/vcl/toolkit/fmtfield.hxx @@ -33,6 +33,8 @@ public: virtual void dispose() override; + virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override; + // Spin-Handling virtual void Up() override; virtual void Down() override; diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index 79725a54b57e..ffe7dd45e6fd 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -7274,14 +7274,6 @@ SVTXNumericField::~SVTXNumericField() { } - -css::uno::Reference<accessibility::XAccessibleContext> SVTXNumericField::CreateAccessibleContext() -{ - VclPtr<FormattedField> pFormattedField = GetAs<FormattedField>(); - return AccessibleFactory::createAccessibleContext(pFormattedField); -} - - void SVTXNumericField::setValue( double Value ) { SolarMutexGuard aGuard; diff --git a/vcl/inc/accessibility/svtaccessiblenumericfield.hxx b/vcl/inc/accessibility/svtaccessiblenumericfield.hxx index 6b2f1390e8d0..3231f5c83221 100644 --- a/vcl/inc/accessibility/svtaccessiblenumericfield.hxx +++ b/vcl/inc/accessibility/svtaccessiblenumericfield.hxx @@ -28,13 +28,18 @@ #include <com/sun/star/accessibility/XAccessibleValue.hpp> class SVTXAccessibleNumericField final - : public cppu::ImplInheritanceHelper<VCLXAccessibleEdit, css::accessibility::XAccessibleValue> + : public cppu::ImplInheritanceHelper<VCLXAccessibleEdit, css::accessibility::XAccessible, + css::accessibility::XAccessibleValue> { public: SVTXAccessibleNumericField(FormattedField* pFormattedField); virtual void ProcessWindowEvent(const VclWindowEvent& rVclWindowEvent) override; + // XAccessible + virtual css::uno::Reference<com::sun::star::accessibility::XAccessibleContext> + SAL_CALL getAccessibleContext() override; + // XAccessibleContext virtual sal_Int16 SAL_CALL getAccessibleRole() override; diff --git a/vcl/source/accessibility/acc_factory.cxx b/vcl/source/accessibility/acc_factory.cxx index 3da4616bb9d0..14d69a85ed25 100644 --- a/vcl/source/accessibility/acc_factory.cxx +++ b/vcl/source/accessibility/acc_factory.cxx @@ -110,9 +110,4 @@ Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext(vcl:: } } -Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext(FormattedField* pFormattedField) -{ - return new SVTXAccessibleNumericField(pFormattedField); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/accessibility/svtaccessiblenumericfield.cxx b/vcl/source/accessibility/svtaccessiblenumericfield.cxx index ea39ff8c2a6d..f9475778bca5 100644 --- a/vcl/source/accessibility/svtaccessiblenumericfield.cxx +++ b/vcl/source/accessibility/svtaccessiblenumericfield.cxx @@ -42,6 +42,15 @@ void SVTXAccessibleNumericField::ProcessWindowEvent(const VclWindowEvent& rVclWi } } +// XAccessible + +css::uno::Reference<com::sun::star::accessibility::XAccessibleContext> +SVTXAccessibleNumericField::getAccessibleContext() +{ + OExternalLockGuard aGuard(this); + return this; +} + sal_Int16 SVTXAccessibleNumericField::getAccessibleRole() { return AccessibleRole::SPIN_BOX; } css::uno::Any SAL_CALL SVTXAccessibleNumericField::getCurrentValue() diff --git a/vcl/source/control/FormattedField.cxx b/vcl/source/control/FormattedField.cxx index c67e289ffa2b..6d7a6601afe1 100644 --- a/vcl/source/control/FormattedField.cxx +++ b/vcl/source/control/FormattedField.cxx @@ -17,6 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <accessibility/svtaccessiblenumericfield.hxx> + #include <rtl/math.hxx> #include <svl/numformat.hxx> #include <comphelper/processfactory.hxx> @@ -49,6 +51,11 @@ void FormattedField::dispose() SpinField::dispose(); } +css::uno::Reference<css::accessibility::XAccessible> FormattedField::CreateAccessible() +{ + return new SVTXAccessibleNumericField(this); +} + void FormattedField::SetText(const OUString& rStr) { GetFormatter().SetFieldText(rStr, Selection(0, 0)); commit 2bccfbd9ee56c89764b2e8163cf874cc3650738e Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Mon May 26 09:16:53 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Wed May 28 09:20:18 2025 +0200 toolkit: Drop VCLXHeaderBar Since Change-Id: I26249401d9bcde81908553cc01521ac0ead338dd Author: Michael Weghorn <m.wegh...@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.wegh...@posteo.de> diff --git a/include/toolkit/awt/vclxwindows.hxx b/include/toolkit/awt/vclxwindows.hxx index e12c7640853a..cf518c575b6a 100644 --- a/include/toolkit/awt/vclxwindows.hxx +++ b/include/toolkit/awt/vclxwindows.hxx @@ -691,11 +691,4 @@ public: virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); } }; -class VCLXHeaderBar final : public VCLXWindow -{ -public: - VCLXHeaderBar(); - virtual ~VCLXHeaderBar() override; -}; - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index d4e22007d1de..79725a54b57e 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -5901,14 +5901,6 @@ css::uno::Any VCLXPatternField::getProperty( const OUString& PropertyName ) return aProp; } -VCLXHeaderBar::VCLXHeaderBar() -{ -} - -VCLXHeaderBar::~VCLXHeaderBar() -{ -} - VCLXFrame::VCLXFrame() { } diff --git a/toolkit/source/helper/unowrapper.cxx b/toolkit/source/helper/unowrapper.cxx index 413fe6c5979e..cc036e1f629f 100644 --- a/toolkit/source/helper/unowrapper.cxx +++ b/toolkit/source/helper/unowrapper.cxx @@ -87,8 +87,6 @@ static rtl::Reference<VCLXWindow> CreateXWindow( vcl::Window const * pWindow ) case WindowType::TABPAGE: return new VCLXContainer; case WindowType::TABCONTROL: return new VCLXMultiPage; - case WindowType::HEADERBAR: return new VCLXHeaderBar; - case WindowType::BORDERWINDOW: { if (pWindow->IsNativeFrame()) @@ -111,6 +109,7 @@ static rtl::Reference<VCLXWindow> CreateXWindow( vcl::Window const * pWindow ) // case WindowType::SCROLLBARBOX: // case WindowType::PATTERNBOX: // case WindowType::CURRENCYBOX: + case WindowType::HEADERBAR: case WindowType::TOOLBOX: default: return new VCLXWindow( true ); } commit 63feda6b8d614cda08f98bd6e801e081beaffd18 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Mon May 26 09:16:19 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Wed May 28 09:20:12 2025 +0200 vcl a11y: Let HeaderBar create its accessible directly This is basically the HeaderBar 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. 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.wegh...@posteo.de> diff --git a/include/toolkit/awt/vclxwindows.hxx b/include/toolkit/awt/vclxwindows.hxx index 17d65b6c0b6e..e12c7640853a 100644 --- a/include/toolkit/awt/vclxwindows.hxx +++ b/include/toolkit/awt/vclxwindows.hxx @@ -696,9 +696,6 @@ class VCLXHeaderBar final : public VCLXWindow public: VCLXHeaderBar(); virtual ~VCLXHeaderBar() override; - - virtual css::uno::Reference< css::accessibility::XAccessibleContext > CreateAccessibleContext() override; - }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/accessiblefactory.hxx b/include/vcl/accessiblefactory.hxx index 2760eba5e9b6..37dba975062d 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(HeaderBar* pHeaderBar); - static css::uno::Reference<css::accessibility::XAccessibleContext> createAccessibleContext(FormattedField* pFormattedField); static css::uno::Reference<css::accessibility::XAccessibleContext> createAccessibleContext(vcl::Window* pWindow); diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index 3cc98a515805..d4e22007d1de 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -5909,13 +5909,6 @@ VCLXHeaderBar::~VCLXHeaderBar() { } -css::uno::Reference< css::accessibility::XAccessibleContext > VCLXHeaderBar::CreateAccessibleContext() -{ - VclPtr<HeaderBar> pHeaderBar = GetAs<HeaderBar>(); - return AccessibleFactory::createAccessibleContext(pHeaderBar); -} - - VCLXFrame::VCLXFrame() { } diff --git a/vcl/inc/accessibility/vclxaccessibleheaderbar.hxx b/vcl/inc/accessibility/vclxaccessibleheaderbar.hxx index 09b84536ea17..3e0e36400ea7 100644 --- a/vcl/inc/accessibility/vclxaccessibleheaderbar.hxx +++ b/vcl/inc/accessibility/vclxaccessibleheaderbar.hxx @@ -26,7 +26,8 @@ class VCLXAccessibleHeaderBarItem; typedef std::vector<unotools::WeakReference<VCLXAccessibleHeaderBarItem>> ListItems; -class VCLXAccessibleHeaderBar final : public VCLXAccessibleComponent +class VCLXAccessibleHeaderBar final + : public cppu::ImplInheritanceHelper<VCLXAccessibleComponent, css::accessibility::XAccessible> { VclPtr<HeaderBar> m_pHeadBar; @@ -35,6 +36,10 @@ public: VCLXAccessibleHeaderBar(HeaderBar* pHeaderBar); + // 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> diff --git a/vcl/source/accessibility/acc_factory.cxx b/vcl/source/accessibility/acc_factory.cxx index 249af591f696..3da4616bb9d0 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(HeaderBar* pHeaderBar) -{ - return new VCLXAccessibleHeaderBar(pHeaderBar); -} - Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext(FormattedField* pFormattedField) { return new SVTXAccessibleNumericField(pFormattedField); diff --git a/vcl/source/accessibility/vclxaccessibleheaderbar.cxx b/vcl/source/accessibility/vclxaccessibleheaderbar.cxx index 28c2b4f78a2e..214d1ec8a07d 100644 --- a/vcl/source/accessibility/vclxaccessibleheaderbar.cxx +++ b/vcl/source/accessibility/vclxaccessibleheaderbar.cxx @@ -20,6 +20,7 @@ #include <accessibility/vclxaccessibleheaderbar.hxx> #include <accessibility/vclxaccessibleheaderbaritem.hxx> +#include <comphelper/accessiblecontexthelper.hxx> #include <o3tl/safeint.hxx> #include <vcl/headbar.hxx> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> @@ -32,7 +33,7 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::accessibility; VCLXAccessibleHeaderBar::VCLXAccessibleHeaderBar(HeaderBar* pHeaderBar) - : VCLXAccessibleComponent(pHeaderBar) + : ImplInheritanceHelper(pHeaderBar) { m_pHeadBar = pHeaderBar; } @@ -51,6 +52,15 @@ Sequence<OUString> VCLXAccessibleHeaderBar::getSupportedServiceNames() return { u"com.sun.star.awt.AccessibleHeaderBar"_ustr }; } +// XAccessible + +css::uno::Reference<com::sun::star::accessibility::XAccessibleContext> +VCLXAccessibleHeaderBar::getAccessibleContext() +{ + comphelper::OExternalLockGuard aGuard(this); + return this; +} + // =======XAccessibleContext======= sal_Int64 SAL_CALL VCLXAccessibleHeaderBar::getAccessibleChildCount() diff --git a/vcl/source/treelist/headbar.cxx b/vcl/source/treelist/headbar.cxx index e8588b0371c6..03f60f9a8c4b 100644 --- a/vcl/source/treelist/headbar.cxx +++ b/vcl/source/treelist/headbar.cxx @@ -17,6 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <accessibility/vclxaccessibleheaderbar.hxx> + #include <vcl/headbar.hxx> #include <rtl/ustrbuf.hxx> #include <tools/debug.hxx> @@ -1281,7 +1283,7 @@ css::uno::Reference< css::accessibility::XAccessible > HeaderBar::CreateAccessib maCreateAccessibleHdl.Call( this ); if ( !mxAccessible.is() ) - mxAccessible = Window::CreateAccessible(); + mxAccessible = new VCLXAccessibleHeaderBar(this); } return mxAccessible;