From 739b0716504d2526fb7283100420e4bd5eacb7c2 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Wed, 4 Dec 2024 15:48:51 +0100 Subject: [PATCH] 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 --- accessibility/Library_acc.mk | 8 ------ accessibility/inc/pch/precompiled_acc.hxx | 2 -- accessibility/source/helper/acc_factory.cxx | 15 ----------- include/toolkit/helper/accessiblefactory.hxx | 5 ---- include/vcl/menu.hxx | 3 +++ include/vcl/toolkit/unowrap.hxx | 4 --- solenv/clang-format/excludelist | 26 +++++++++---------- toolkit/inc/helper/unowrapper.hxx | 4 --- toolkit/source/helper/unowrapper.cxx | 5 ---- vcl/Library_vcl.mk | 8 ++++++ .../accessiblemenubasecomponent.hxx | 0 .../accessiblemenucomponent.hxx | 3 ++- .../accessiblemenuitemcomponent.hxx | 2 +- .../inc/accessibility}/vclxaccessiblemenu.hxx | 2 +- .../accessibility}/vclxaccessiblemenubar.hxx | 2 +- .../accessibility}/vclxaccessiblemenuitem.hxx | 2 +- .../vclxaccessiblemenuseparator.hxx | 2 +- .../vclxaccessiblepopupmenu.hxx | 2 +- .../accessiblemenubasecomponent.cxx | 8 +++--- .../accessiblemenucomponent.cxx | 2 +- .../accessiblemenuitemcomponent.cxx | 2 +- .../accessibility}/vclxaccessiblemenu.cxx | 2 +- .../accessibility}/vclxaccessiblemenubar.cxx | 2 +- .../accessibility}/vclxaccessiblemenuitem.cxx | 3 ++- .../vclxaccessiblemenuseparator.cxx | 2 +- .../vclxaccessiblepopupmenu.cxx | 2 +- vcl/source/window/menu.cxx | 21 +++++++++++---- 27 files changed, 60 insertions(+), 79 deletions(-) rename {accessibility/inc/standard => vcl/inc/accessibility}/accessiblemenubasecomponent.hxx (100%) rename {accessibility/inc/standard => vcl/inc/accessibility}/accessiblemenucomponent.hxx (98%) rename {accessibility/inc/standard => vcl/inc/accessibility}/accessiblemenuitemcomponent.hxx (98%) rename {accessibility/inc/standard => vcl/inc/accessibility}/vclxaccessiblemenu.hxx (98%) rename {accessibility/inc/standard => vcl/inc/accessibility}/vclxaccessiblemenubar.hxx (97%) rename {accessibility/inc/standard => vcl/inc/accessibility}/vclxaccessiblemenuitem.hxx (98%) rename {accessibility/inc/standard => vcl/inc/accessibility}/vclxaccessiblemenuseparator.hxx (96%) rename {accessibility/inc/standard => vcl/inc/accessibility}/vclxaccessiblepopupmenu.hxx (96%) rename {accessibility/source/standard => vcl/source/accessibility}/accessiblemenubasecomponent.cxx (98%) rename {accessibility/source/standard => vcl/source/accessibility}/accessiblemenucomponent.cxx (99%) rename {accessibility/source/standard => vcl/source/accessibility}/accessiblemenuitemcomponent.cxx (99%) rename {accessibility/source/standard => vcl/source/accessibility}/vclxaccessiblemenu.cxx (99%) rename {accessibility/source/standard => vcl/source/accessibility}/vclxaccessiblemenubar.cxx (98%) rename {accessibility/source/standard => vcl/source/accessibility}/vclxaccessiblemenuitem.cxx (99%) rename {accessibility/source/standard => vcl/source/accessibility}/vclxaccessiblemenuseparator.cxx (96%) rename {accessibility/source/standard => vcl/source/accessibility}/vclxaccessiblepopupmenu.cxx (97%) diff --git a/accessibility/Library_acc.mk b/accessibility/Library_acc.mk index 7080203fccaf..5acdf2a7be99 100644 --- a/accessibility/Library_acc.mk +++ b/accessibility/Library_acc.mk @@ -72,9 +72,6 @@ $(eval $(call gb_Library_add_exception_objects,acc,\ accessibility/source/helper/acc_factory \ accessibility/source/helper/accresmgr \ accessibility/source/helper/IComboListBoxHelper \ - accessibility/source/standard/accessiblemenubasecomponent \ - accessibility/source/standard/accessiblemenucomponent \ - accessibility/source/standard/accessiblemenuitemcomponent \ accessibility/source/standard/floatingwindowaccessible \ accessibility/source/standard/svtaccessiblenumericfield \ accessibility/source/standard/vclxaccessiblebox \ @@ -91,11 +88,6 @@ $(eval $(call gb_Library_add_exception_objects,acc,\ accessibility/source/standard/vclxaccessiblelist \ accessibility/source/standard/vclxaccessiblelistbox \ accessibility/source/standard/vclxaccessiblelistitem \ - accessibility/source/standard/vclxaccessiblemenu \ - accessibility/source/standard/vclxaccessiblemenubar \ - accessibility/source/standard/vclxaccessiblemenuitem \ - accessibility/source/standard/vclxaccessiblemenuseparator \ - accessibility/source/standard/vclxaccessiblepopupmenu \ accessibility/source/standard/vclxaccessibleradiobutton \ accessibility/source/standard/vclxaccessiblescrollbar \ accessibility/source/standard/vclxaccessiblestatusbar \ diff --git a/accessibility/inc/pch/precompiled_acc.hxx b/accessibility/inc/pch/precompiled_acc.hxx index 7919e40b3c08..ca08b4d1858e 100644 --- a/accessibility/inc/pch/precompiled_acc.hxx +++ b/accessibility/inc/pch/precompiled_acc.hxx @@ -305,8 +305,6 @@ #include #include #include -#include -#include #include #include #include diff --git a/accessibility/source/helper/acc_factory.cxx b/accessibility/source/helper/acc_factory.cxx index d95d47b214d9..191cc7528703 100644 --- a/accessibility/source/helper/acc_factory.cxx +++ b/accessibility/source/helper/acc_factory.cxx @@ -42,8 +42,6 @@ #include #include #include -#include -#include #include #include #include @@ -115,8 +113,6 @@ public: createAccessibleContext( SVTXNumericField* _pXWindow ) override; virtual css::uno::Reference< css::accessibility::XAccessibleContext > createAccessibleContext( VCLXWindow* _pXWindow ) override; - virtual css::uno::Reference< css::accessibility::XAccessible > - createAccessible( Menu* _pMenu, bool _bIsMenuBar ) override; // ::vcl::IAccessibleFactory virtual vcl::IAccessibleTabListBox* @@ -224,17 +220,6 @@ AccessibleFactory::~AccessibleFactory() { } -Reference< XAccessible > AccessibleFactory::createAccessible( Menu* _pMenu, bool _bIsMenuBar ) -{ - rtl::Reference pAccessible; - if ( _bIsMenuBar ) - pAccessible = new VCLXAccessibleMenuBar( _pMenu ); - else - pAccessible = new VCLXAccessiblePopupMenu( _pMenu ); - pAccessible->SetStates(); - return pAccessible; -} - Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXButton* _pXWindow ) { return new VCLXAccessibleButton( _pXWindow ); diff --git a/include/toolkit/helper/accessiblefactory.hxx b/include/toolkit/helper/accessiblefactory.hxx index 6c0532ce9edb..2b2c3455abd7 100644 --- a/include/toolkit/helper/accessiblefactory.hxx +++ b/include/toolkit/helper/accessiblefactory.hxx @@ -133,11 +133,6 @@ namespace toolkit virtual css::uno::Reference< css::accessibility::XAccessibleContext > createAccessibleContext( VCLXWindow* _pXWindow ) = 0; - /** creates an accessible component for the given menu - */ - virtual css::uno::Reference< css::accessibility::XAccessible > - createAccessible( Menu* _pMenu, bool _bIsMenuBar ) = 0; - protected: virtual ~IAccessibleFactory() override {} }; diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx index 19216d9585cc..e241609fcdb6 100644 --- a/include/vcl/menu.hxx +++ b/include/vcl/menu.hxx @@ -401,6 +401,9 @@ public: * Get the ID of the window. */ const OUString& get_id() const { return maID; } + +private: + css::uno::Reference CreateAccessible(); }; struct MenuBarButtonCallbackArg diff --git a/include/vcl/toolkit/unowrap.hxx b/include/vcl/toolkit/unowrap.hxx index 359810652e05..9d1231919229 100644 --- a/include/vcl/toolkit/unowrap.hxx +++ b/include/vcl/toolkit/unowrap.hxx @@ -65,10 +65,6 @@ public: virtual void WindowDestroyed( vcl::Window* pWindow ) = 0; - // Accessibility - virtual css::uno::Reference< css::accessibility::XAccessible > - CreateAccessible( Menu* pMenu, bool bIsMenuBar ) = 0; - /** Get the application's UNO wrapper object. Note that this static function will only ever try to create UNO wrapper object once, and diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index acffbef29a58..74614d7f5a58 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -46,9 +46,6 @@ accessibility/inc/extended/accessibletablistboxtable.hxx accessibility/inc/extended/textwindowaccessibility.hxx accessibility/inc/helper/IComboListBoxHelper.hxx accessibility/inc/helper/listboxhelper.hxx -accessibility/inc/standard/accessiblemenubasecomponent.hxx -accessibility/inc/standard/accessiblemenucomponent.hxx -accessibility/inc/standard/accessiblemenuitemcomponent.hxx accessibility/inc/standard/vclxaccessiblebox.hxx accessibility/inc/standard/vclxaccessiblebutton.hxx accessibility/inc/standard/vclxaccessiblecheckbox.hxx @@ -56,9 +53,6 @@ accessibility/inc/standard/vclxaccessibleedit.hxx accessibility/inc/standard/vclxaccessibleheaderbaritem.hxx accessibility/inc/standard/vclxaccessiblelist.hxx accessibility/inc/standard/vclxaccessiblelistitem.hxx -accessibility/inc/standard/vclxaccessiblemenu.hxx -accessibility/inc/standard/vclxaccessiblemenubar.hxx -accessibility/inc/standard/vclxaccessiblemenuitem.hxx accessibility/inc/standard/vclxaccessibleradiobutton.hxx accessibility/inc/standard/vclxaccessiblescrollbar.hxx accessibility/inc/standard/vclxaccessiblestatusbar.hxx @@ -99,9 +93,6 @@ accessibility/source/extended/accessibletablistbox.cxx accessibility/source/extended/accessibletablistboxtable.cxx accessibility/source/extended/textwindowaccessibility.cxx accessibility/source/helper/acc_factory.cxx -accessibility/source/standard/accessiblemenubasecomponent.cxx -accessibility/source/standard/accessiblemenucomponent.cxx -accessibility/source/standard/accessiblemenuitemcomponent.cxx accessibility/source/standard/floatingwindowaccessible.cxx accessibility/source/standard/vclxaccessiblebox.cxx accessibility/source/standard/vclxaccessiblebutton.cxx @@ -114,10 +105,6 @@ accessibility/source/standard/vclxaccessibleheaderbaritem.cxx accessibility/source/standard/vclxaccessiblelist.cxx accessibility/source/standard/vclxaccessiblelistbox.cxx accessibility/source/standard/vclxaccessiblelistitem.cxx -accessibility/source/standard/vclxaccessiblemenu.cxx -accessibility/source/standard/vclxaccessiblemenubar.cxx -accessibility/source/standard/vclxaccessiblemenuitem.cxx -accessibility/source/standard/vclxaccessiblepopupmenu.cxx accessibility/source/standard/vclxaccessibleradiobutton.cxx accessibility/source/standard/vclxaccessiblescrollbar.cxx accessibility/source/standard/vclxaccessiblestatusbar.cxx @@ -14173,6 +14160,12 @@ vcl/inc/IPrioritable.hxx vcl/inc/ResampleKernel.hxx vcl/inc/bitmap/bmpfast.hxx vcl/inc/accel.hxx +vcl/inc/accessibility/accessiblemenubasecomponent.hxx +vcl/inc/accessibility/accessiblemenucomponent.hxx +vcl/inc/accessibility/accessiblemenuitemcomponent.hxx +vcl/inc/accessibility/vclxaccessiblemenu.hxx +vcl/inc/accessibility/vclxaccessiblemenubar.hxx +vcl/inc/accessibility/vclxaccessiblemenuitem.hxx vcl/inc/accmgr.hxx vcl/inc/animate/AnimationRenderer.hxx vcl/inc/brdwin.hxx @@ -14522,6 +14515,13 @@ vcl/quartz/salgdicommon.cxx vcl/quartz/salvd.cxx vcl/quartz/utils.cxx vcl/source/accessibility/characterattributeshelper.cxx +vcl/source/accessibility/accessiblemenubasecomponent.cxx +vcl/source/accessibility/accessiblemenucomponent.cxx +vcl/source/accessibility/accessiblemenuitemcomponent.cxx +vcl/source/accessibility/vclxaccessiblemenu.cxx +vcl/source/accessibility/vclxaccessiblemenubar.cxx +vcl/source/accessibility/vclxaccessiblemenuitem.cxx +vcl/source/accessibility/vclxaccessiblepopupmenu.cxx vcl/source/animate/AnimationRenderer.cxx vcl/source/app/IconThemeInfo.cxx vcl/source/app/IconThemeScanner.cxx diff --git a/toolkit/inc/helper/unowrapper.hxx b/toolkit/inc/helper/unowrapper.hxx index dfed1b1215f1..274e60beb2c3 100644 --- a/toolkit/inc/helper/unowrapper.hxx +++ b/toolkit/inc/helper/unowrapper.hxx @@ -60,10 +60,6 @@ public: void WindowDestroyed( vcl::Window* pWindow ) override; - // Accessibility - virtual css::uno::Reference< css::accessibility::XAccessible > - CreateAccessible( Menu* pMenu, bool bIsMenuBar ) override; - private: virtual ~UnoWrapper(); }; diff --git a/toolkit/source/helper/unowrapper.cxx b/toolkit/source/helper/unowrapper.cxx index 50e1c8e74d90..3c2b7dbaff7f 100644 --- a/toolkit/source/helper/unowrapper.cxx +++ b/toolkit/source/helper/unowrapper.cxx @@ -312,9 +312,4 @@ void UnoWrapper::WindowDestroyed( vcl::Window* pWindow ) } } -css::uno::Reference< css::accessibility::XAccessible > UnoWrapper::CreateAccessible( Menu* pMenu, bool bIsMenuBar ) -{ - return maAccessibleFactoryAccess.getFactory().createAccessible( pMenu, bIsMenuBar ); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index ae12cf9cfda7..420024cc2ab2 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -99,6 +99,14 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/skia/SkiaHelper \ vcl/source/accessibility/AccessibleTextAttributeHelper \ vcl/source/accessibility/characterattributeshelper \ + vcl/source/accessibility/accessiblemenubasecomponent \ + vcl/source/accessibility/accessiblemenucomponent \ + vcl/source/accessibility/accessiblemenuitemcomponent \ + vcl/source/accessibility/vclxaccessiblemenu \ + vcl/source/accessibility/vclxaccessiblemenubar \ + vcl/source/accessibility/vclxaccessiblemenuitem \ + vcl/source/accessibility/vclxaccessiblemenuseparator \ + vcl/source/accessibility/vclxaccessiblepopupmenu \ vcl/source/animate/Animation \ vcl/source/animate/AnimationFrame \ vcl/source/animate/AnimationRenderer \ diff --git a/accessibility/inc/standard/accessiblemenubasecomponent.hxx b/vcl/inc/accessibility/accessiblemenubasecomponent.hxx similarity index 100% rename from accessibility/inc/standard/accessiblemenubasecomponent.hxx rename to vcl/inc/accessibility/accessiblemenubasecomponent.hxx diff --git a/accessibility/inc/standard/accessiblemenucomponent.hxx b/vcl/inc/accessibility/accessiblemenucomponent.hxx similarity index 98% rename from accessibility/inc/standard/accessiblemenucomponent.hxx rename to vcl/inc/accessibility/accessiblemenucomponent.hxx index e9d46dcfa70a..2954b52119e5 100644 --- a/accessibility/inc/standard/accessiblemenucomponent.hxx +++ b/vcl/inc/accessibility/accessiblemenucomponent.hxx @@ -19,7 +19,8 @@ #pragma once -#include +#include + #include #include diff --git a/accessibility/inc/standard/accessiblemenuitemcomponent.hxx b/vcl/inc/accessibility/accessiblemenuitemcomponent.hxx similarity index 98% rename from accessibility/inc/standard/accessiblemenuitemcomponent.hxx rename to vcl/inc/accessibility/accessiblemenuitemcomponent.hxx index fae6e577b590..58b819f8ad66 100644 --- a/accessibility/inc/standard/accessiblemenuitemcomponent.hxx +++ b/vcl/inc/accessibility/accessiblemenuitemcomponent.hxx @@ -19,7 +19,7 @@ #pragma once -#include +#include diff --git a/accessibility/inc/standard/vclxaccessiblemenu.hxx b/vcl/inc/accessibility/vclxaccessiblemenu.hxx similarity index 98% rename from accessibility/inc/standard/vclxaccessiblemenu.hxx rename to vcl/inc/accessibility/vclxaccessiblemenu.hxx index ce7b3f0580de..3f6903587166 100644 --- a/accessibility/inc/standard/vclxaccessiblemenu.hxx +++ b/vcl/inc/accessibility/vclxaccessiblemenu.hxx @@ -19,7 +19,7 @@ #pragma once -#include +#include #include #include diff --git a/accessibility/inc/standard/vclxaccessiblemenubar.hxx b/vcl/inc/accessibility/vclxaccessiblemenubar.hxx similarity index 97% rename from accessibility/inc/standard/vclxaccessiblemenubar.hxx rename to vcl/inc/accessibility/vclxaccessiblemenubar.hxx index c5b3984e0b7e..31e50c8b75ff 100644 --- a/accessibility/inc/standard/vclxaccessiblemenubar.hxx +++ b/vcl/inc/accessibility/vclxaccessiblemenubar.hxx @@ -19,7 +19,7 @@ #pragma once -#include +#include #include class VclSimpleEvent; diff --git a/accessibility/inc/standard/vclxaccessiblemenuitem.hxx b/vcl/inc/accessibility/vclxaccessiblemenuitem.hxx similarity index 98% rename from accessibility/inc/standard/vclxaccessiblemenuitem.hxx rename to vcl/inc/accessibility/vclxaccessiblemenuitem.hxx index aa6a0afc814a..ddde3cda04b6 100644 --- a/accessibility/inc/standard/vclxaccessiblemenuitem.hxx +++ b/vcl/inc/accessibility/vclxaccessiblemenuitem.hxx @@ -19,7 +19,7 @@ #pragma once -#include +#include #include #include diff --git a/accessibility/inc/standard/vclxaccessiblemenuseparator.hxx b/vcl/inc/accessibility/vclxaccessiblemenuseparator.hxx similarity index 96% rename from accessibility/inc/standard/vclxaccessiblemenuseparator.hxx rename to vcl/inc/accessibility/vclxaccessiblemenuseparator.hxx index 51071c19d130..ce971ca49ac0 100644 --- a/accessibility/inc/standard/vclxaccessiblemenuseparator.hxx +++ b/vcl/inc/accessibility/vclxaccessiblemenuseparator.hxx @@ -19,7 +19,7 @@ #pragma once -#include +#include class VCLXAccessibleMenuSeparator final : public OAccessibleMenuItemComponent { diff --git a/accessibility/inc/standard/vclxaccessiblepopupmenu.hxx b/vcl/inc/accessibility/vclxaccessiblepopupmenu.hxx similarity index 96% rename from accessibility/inc/standard/vclxaccessiblepopupmenu.hxx rename to vcl/inc/accessibility/vclxaccessiblepopupmenu.hxx index 8e93af22d8d9..6f099b722452 100644 --- a/accessibility/inc/standard/vclxaccessiblepopupmenu.hxx +++ b/vcl/inc/accessibility/vclxaccessiblepopupmenu.hxx @@ -19,7 +19,7 @@ #pragma once -#include +#include class VCLXAccessiblePopupMenu final : public OAccessibleMenuComponent { diff --git a/accessibility/source/standard/accessiblemenubasecomponent.cxx b/vcl/source/accessibility/accessiblemenubasecomponent.cxx similarity index 98% rename from accessibility/source/standard/accessiblemenubasecomponent.cxx rename to vcl/source/accessibility/accessiblemenubasecomponent.cxx index dbedd1daff30..10f7dff9e6b5 100644 --- a/accessibility/source/standard/accessiblemenubasecomponent.cxx +++ b/vcl/source/accessibility/accessiblemenubasecomponent.cxx @@ -17,10 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include -#include -#include -#include +#include +#include +#include +#include #include #include diff --git a/accessibility/source/standard/accessiblemenucomponent.cxx b/vcl/source/accessibility/accessiblemenucomponent.cxx similarity index 99% rename from accessibility/source/standard/accessiblemenucomponent.cxx rename to vcl/source/accessibility/accessiblemenucomponent.cxx index 7fe594721294..4163d096011e 100644 --- a/accessibility/source/standard/accessiblemenucomponent.cxx +++ b/vcl/source/accessibility/accessiblemenucomponent.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include +#include #include #include diff --git a/accessibility/source/standard/accessiblemenuitemcomponent.cxx b/vcl/source/accessibility/accessiblemenuitemcomponent.cxx similarity index 99% rename from accessibility/source/standard/accessiblemenuitemcomponent.cxx rename to vcl/source/accessibility/accessiblemenuitemcomponent.cxx index 0d171e64ccaa..a50415e9ab77 100644 --- a/accessibility/source/standard/accessiblemenuitemcomponent.cxx +++ b/vcl/source/accessibility/accessiblemenuitemcomponent.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include +#include #include #include diff --git a/accessibility/source/standard/vclxaccessiblemenu.cxx b/vcl/source/accessibility/vclxaccessiblemenu.cxx similarity index 99% rename from accessibility/source/standard/vclxaccessiblemenu.cxx rename to vcl/source/accessibility/vclxaccessiblemenu.cxx index 5ba208d2f368..c38cc84ebed2 100644 --- a/accessibility/source/standard/vclxaccessiblemenu.cxx +++ b/vcl/source/accessibility/vclxaccessiblemenu.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include +#include #include #include diff --git a/accessibility/source/standard/vclxaccessiblemenubar.cxx b/vcl/source/accessibility/vclxaccessiblemenubar.cxx similarity index 98% rename from accessibility/source/standard/vclxaccessiblemenubar.cxx rename to vcl/source/accessibility/vclxaccessiblemenubar.cxx index 9664254fa543..4e64803db783 100644 --- a/accessibility/source/standard/vclxaccessiblemenubar.cxx +++ b/vcl/source/accessibility/vclxaccessiblemenubar.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include +#include #include #include diff --git a/accessibility/source/standard/vclxaccessiblemenuitem.cxx b/vcl/source/accessibility/vclxaccessiblemenuitem.cxx similarity index 99% rename from accessibility/source/standard/vclxaccessiblemenuitem.cxx rename to vcl/source/accessibility/vclxaccessiblemenuitem.cxx index a1491c99bc4c..a8696f43e380 100644 --- a/accessibility/source/standard/vclxaccessiblemenuitem.cxx +++ b/vcl/source/accessibility/vclxaccessiblemenuitem.cxx @@ -17,8 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include +#include #include + #include #include diff --git a/accessibility/source/standard/vclxaccessiblemenuseparator.cxx b/vcl/source/accessibility/vclxaccessiblemenuseparator.cxx similarity index 96% rename from accessibility/source/standard/vclxaccessiblemenuseparator.cxx rename to vcl/source/accessibility/vclxaccessiblemenuseparator.cxx index d64ccb0baa25..7100d1972c39 100644 --- a/accessibility/source/standard/vclxaccessiblemenuseparator.cxx +++ b/vcl/source/accessibility/vclxaccessiblemenuseparator.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include +#include #include diff --git a/accessibility/source/standard/vclxaccessiblepopupmenu.cxx b/vcl/source/accessibility/vclxaccessiblepopupmenu.cxx similarity index 97% rename from accessibility/source/standard/vclxaccessiblepopupmenu.cxx rename to vcl/source/accessibility/vclxaccessiblepopupmenu.cxx index d8b840eee784..95df37593bd2 100644 --- a/accessibility/source/standard/vclxaccessiblepopupmenu.cxx +++ b/vcl/source/accessibility/vclxaccessiblepopupmenu.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include +#include #include #include diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 6e7fc5494ca5..581279acd8bf 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include +#include +#include + #include #include @@ -1317,6 +1321,17 @@ bool Menu::ImplIsSelectable( sal_uInt16 nPos ) const return bSelectable; } +css::uno::Reference Menu::CreateAccessible() +{ + rtl::Reference xAccessible; + if (IsMenuBar()) + xAccessible = new VCLXAccessibleMenuBar(this); + else + xAccessible = new VCLXAccessiblePopupMenu(this); + xAccessible->SetStates(); + return xAccessible; +} + css::uno::Reference Menu::GetAccessible() { // Since PopupMenu are sometimes shared by different instances of MenuBar, the mxAccessible member gets @@ -1340,11 +1355,7 @@ css::uno::Reference Menu::GetAccessible() } } else if ( !mxAccessible.is() ) - { - UnoWrapperBase* pWrapper = UnoWrapperBase::GetUnoWrapper(); - if ( pWrapper ) - mxAccessible = pWrapper->CreateAccessible(this, IsMenuBar()); - } + mxAccessible = CreateAccessible(); return mxAccessible; }