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>
This commit is contained in:
parent
3d780e72b9
commit
739b071650
27 changed files with 60 additions and 79 deletions
|
@ -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 \
|
||||
|
|
|
@ -305,8 +305,6 @@
|
|||
#include <sot/exchange.hxx>
|
||||
#include <sot/formats.hxx>
|
||||
#include <sot/sotdllapi.h>
|
||||
#include <standard/accessiblemenubasecomponent.hxx>
|
||||
#include <standard/accessiblemenuitemcomponent.hxx>
|
||||
#include <standard/vclxaccessiblebox.hxx>
|
||||
#include <standard/vclxaccessibletextcomponent.hxx>
|
||||
#include <svl/SfxBroadcaster.hxx>
|
||||
|
|
|
@ -42,8 +42,6 @@
|
|||
#include <standard/vclxaccessiblestatusbar.hxx>
|
||||
#include <standard/vclxaccessibletabcontrol.hxx>
|
||||
#include <standard/vclxaccessibletabpagewindow.hxx>
|
||||
#include <standard/vclxaccessiblemenubar.hxx>
|
||||
#include <standard/vclxaccessiblepopupmenu.hxx>
|
||||
#include <extended/accessibletablistbox.hxx>
|
||||
#include <extended/AccessibleBrowseBox.hxx>
|
||||
#include <extended/accessibleiconchoicectrl.hxx>
|
||||
|
@ -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<OAccessibleMenuBaseComponent> 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 );
|
||||
|
|
|
@ -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 {}
|
||||
};
|
||||
|
|
|
@ -401,6 +401,9 @@ public:
|
|||
* Get the ID of the window.
|
||||
*/
|
||||
const OUString& get_id() const { return maID; }
|
||||
|
||||
private:
|
||||
css::uno::Reference<css::accessibility::XAccessible> CreateAccessible();
|
||||
};
|
||||
|
||||
struct MenuBarButtonCallbackArg
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
};
|
||||
|
|
|
@ -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: */
|
||||
|
|
|
@ -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 \
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <standard/accessiblemenubasecomponent.hxx>
|
||||
#include <accessibility/accessiblemenubasecomponent.hxx>
|
||||
|
||||
#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
|
||||
#include <cppuhelper/implbase.hxx>
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <standard/accessiblemenubasecomponent.hxx>
|
||||
#include <accessibility/accessiblemenubasecomponent.hxx>
|
||||
|
||||
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <standard/vclxaccessiblemenuitem.hxx>
|
||||
#include <accessibility/vclxaccessiblemenuitem.hxx>
|
||||
#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
|
||||
|
||||
#include <cppuhelper/implbase.hxx>
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <standard/accessiblemenucomponent.hxx>
|
||||
#include <accessibility/accessiblemenucomponent.hxx>
|
||||
#include <vcl/vclptr.hxx>
|
||||
|
||||
class VclSimpleEvent;
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <standard/accessiblemenuitemcomponent.hxx>
|
||||
#include <accessibility/accessiblemenuitemcomponent.hxx>
|
||||
|
||||
#include <com/sun/star/accessibility/AccessibleScrollType.hpp>
|
||||
#include <com/sun/star/accessibility/XAccessibleAction.hpp>
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <standard/accessiblemenuitemcomponent.hxx>
|
||||
#include <accessibility/accessiblemenuitemcomponent.hxx>
|
||||
|
||||
class VCLXAccessibleMenuSeparator final : public OAccessibleMenuItemComponent
|
||||
{
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <standard/accessiblemenucomponent.hxx>
|
||||
#include <accessibility/accessiblemenucomponent.hxx>
|
||||
|
||||
class VCLXAccessiblePopupMenu final : public OAccessibleMenuComponent
|
||||
{
|
|
@ -17,10 +17,10 @@
|
|||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#include <standard/accessiblemenubasecomponent.hxx>
|
||||
#include <standard/vclxaccessiblemenu.hxx>
|
||||
#include <standard/vclxaccessiblemenuitem.hxx>
|
||||
#include <standard/vclxaccessiblemenuseparator.hxx>
|
||||
#include <accessibility/accessiblemenubasecomponent.hxx>
|
||||
#include <accessibility/vclxaccessiblemenu.hxx>
|
||||
#include <accessibility/vclxaccessiblemenuitem.hxx>
|
||||
#include <accessibility/vclxaccessiblemenuseparator.hxx>
|
||||
|
||||
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
|
||||
#include <com/sun/star/accessibility/AccessibleRole.hpp>
|
|
@ -17,7 +17,7 @@
|
|||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#include <standard/accessiblemenucomponent.hxx>
|
||||
#include <accessibility/accessiblemenucomponent.hxx>
|
||||
|
||||
#include <com/sun/star/accessibility/AccessibleRole.hpp>
|
||||
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
|
|
@ -17,7 +17,7 @@
|
|||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#include <standard/accessiblemenuitemcomponent.hxx>
|
||||
#include <accessibility/accessiblemenuitemcomponent.hxx>
|
||||
|
||||
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
|
||||
#include <com/sun/star/accessibility/AccessibleRole.hpp>
|
|
@ -17,7 +17,7 @@
|
|||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#include <standard/vclxaccessiblemenu.hxx>
|
||||
#include <accessibility/vclxaccessiblemenu.hxx>
|
||||
|
||||
#include <com/sun/star/accessibility/AccessibleRole.hpp>
|
||||
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
|
|
@ -17,7 +17,7 @@
|
|||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#include <standard/vclxaccessiblemenubar.hxx>
|
||||
#include <accessibility/vclxaccessiblemenubar.hxx>
|
||||
|
||||
#include <com/sun/star/accessibility/AccessibleRole.hpp>
|
||||
#include <comphelper/accessiblecontexthelper.hxx>
|
|
@ -17,8 +17,9 @@
|
|||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#include <standard/vclxaccessiblemenuitem.hxx>
|
||||
#include <accessibility/vclxaccessiblemenuitem.hxx>
|
||||
#include <comphelper/accessiblecontexthelper.hxx>
|
||||
|
||||
#include <comphelper/accessiblekeybindinghelper.hxx>
|
||||
#include <com/sun/star/awt/KeyModifier.hpp>
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#include <standard/vclxaccessiblemenuseparator.hxx>
|
||||
#include <accessibility/vclxaccessiblemenuseparator.hxx>
|
||||
|
||||
#include <com/sun/star/accessibility/AccessibleRole.hpp>
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#include <standard/vclxaccessiblepopupmenu.hxx>
|
||||
#include <accessibility/vclxaccessiblepopupmenu.hxx>
|
||||
|
||||
#include <com/sun/star/accessibility/AccessibleRole.hpp>
|
||||
#include <comphelper/accessiblecontexthelper.hxx>
|
|
@ -17,6 +17,10 @@
|
|||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#include <accessibility/accessiblemenubasecomponent.hxx>
|
||||
#include <accessibility/vclxaccessiblemenubar.hxx>
|
||||
#include <accessibility/vclxaccessiblepopupmenu.hxx>
|
||||
|
||||
#include <comphelper/diagnose_ex.hxx>
|
||||
#include <sal/log.hxx>
|
||||
|
||||
|
@ -1317,6 +1321,17 @@ bool Menu::ImplIsSelectable( sal_uInt16 nPos ) const
|
|||
return bSelectable;
|
||||
}
|
||||
|
||||
css::uno::Reference<css::accessibility::XAccessible> Menu::CreateAccessible()
|
||||
{
|
||||
rtl::Reference<OAccessibleMenuBaseComponent> xAccessible;
|
||||
if (IsMenuBar())
|
||||
xAccessible = new VCLXAccessibleMenuBar(this);
|
||||
else
|
||||
xAccessible = new VCLXAccessiblePopupMenu(this);
|
||||
xAccessible->SetStates();
|
||||
return xAccessible;
|
||||
}
|
||||
|
||||
css::uno::Reference<css::accessibility::XAccessible> Menu::GetAccessible()
|
||||
{
|
||||
// Since PopupMenu are sometimes shared by different instances of MenuBar, the mxAccessible member gets
|
||||
|
@ -1340,11 +1355,7 @@ css::uno::Reference<css::accessibility::XAccessible> Menu::GetAccessible()
|
|||
}
|
||||
}
|
||||
else if ( !mxAccessible.is() )
|
||||
{
|
||||
UnoWrapperBase* pWrapper = UnoWrapperBase::GetUnoWrapper();
|
||||
if ( pWrapper )
|
||||
mxAccessible = pWrapper->CreateAccessible(this, IsMenuBar());
|
||||
}
|
||||
mxAccessible = CreateAccessible();
|
||||
|
||||
return mxAccessible;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue