office-gobmx/include/vcl/vclevent.hxx
Michael Weghorn ce0a48a1eb tdf#155625 a11y: Notify about menu item role change
Send a `AccessibleEventId::ROLE_CHANGED` event
when the accessible role of a menu item changes
(s. how `VCLXAccessibleMenuItem::getAccessibleRole`
takes into account `MenuItemBits::RADIOCHECK` and
`MenuItemBits::CHECKABLE` to determine the accessible
role for the underlying menu entry).

This fixes the issue of obsolete values for roles being
used, which was uncovered by the upcoming
Change-Id I1a047864ce8dc1f1bc3056ad00159f7fd5e5b7d3
("vcl gtk3: Introduce AT-SPI2 tests for the GTK3 accessibility layer").

With this in place, the workaround for tdf#155625 in
the upcoming gtk3/AT-SPI tests is no longer necessary
and `make CppunitTest_vcl_gtk3_a11y` with
https://gerrit.libreoffice.org/c/core/+/153069 patch set 11
still passes after dropping the workaround:

    diff --git a/vcl/qa/cppunit/a11y/atspi2/atspi2.cxx b/vcl/qa/cppunit/a11y/atspi2/atspi2.cxx
    index bbcd263fee0c..762401181bf4 100644
    --- a/vcl/qa/cppunit/a11y/atspi2/atspi2.cxx
    +++ b/vcl/qa/cppunit/a11y/atspi2/atspi2.cxx
    @@ -264,9 +264,6 @@ void Atspi2TestTree::compareObjects(uno::Reference<accessibility::XAccessible> x
          * be represented with a round trip. */
         const auto nLORole = mapToAtspiRole(xLOContext->getAccessibleRole());
         auto nAtspiRole = pAtspiAccessible.getRole();
    -    // FIXME: workaround for https://bugs.documentfoundation.org/show_bug.cgi?id=155625
    -    if (nLORole == ATSPI_ROLE_CHECK_MENU_ITEM && nAtspiRole == ATSPI_ROLE_MENU_ITEM)
    -        nAtspiRole = nLORole;
         CPPUNIT_ASSERT_EQUAL(nLORole, nAtspiRole);
         /* name (no need to worry about debugging suffixes as AccessibilityTools::nameEquals does, as
          * that will also be part of the name sent to ATSPI) */

Change-Id: I0d88a7eda592f5ee9abf368ce1d5feb6611b9971
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154947
Reviewed-by: Colomban Wendling <cwendling@hypra.fr>
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-07-27 16:58:22 +02:00

221 lines
6.3 KiB
C++

/* -*- 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_VCL_VCLEVENT_HXX
#define INCLUDED_VCL_VCLEVENT_HXX
#include <vcl/dllapi.h>
#include <vcl/vclptr.hxx>
class Menu;
namespace com::sun::star::accessibility {
class XAccessible;
}
namespace vcl
{
class Window;
}
enum class VclEventId
{
NONE,
ApplicationDataChanged, // pData = DataChangedEvent*
ButtonClick,
CheckboxToggle,
ComboboxDeselect,
ComboboxDoubleClick,
ComboboxItemAdded, // pData = itempos
ComboboxItemRemoved, // pData = itempos, -1=All
ComboboxSelect,
ComboboxSetText,
ControlGetFocus,
ControlLoseFocus,
DropdownClose,
DropdownOpen,
DropdownPreOpen,
DropdownSelect,
EditCaretChanged,
EditModify,
EditSelectionChanged,
ExtTextInput,
EndExtTextInput,
ItemCollapsed,
ItemExpanded,
ListboxDoubleClick,
ListboxFocus,
ListboxItemAdded, // pData = itempos
ListboxItemRemoved, // pData = itempos, -1=All
ListboxScrolled,
ListboxSelect,
ListboxTreeFocus,
ListboxTreeSelect,
MenuAccessibleNameChanged,
MenuActivate,
MenuDeactivate,
MenuDehighlight,
MenuDisable,
MenuEnable,
MenuHide,
MenuHighlight,
MenuInsertItem,
MenuItemChecked,
MenuItemRoleChanged,
MenuItemTextChanged,
MenuItemUnchecked,
MenuRemoveItem,
MenuSelect,
MenuShow,
MenuSubmenuActivate,
MenuSubmenuChanged,
MenuSubmenuDeactivate,
ObjectDying,
PushbuttonToggle,
RadiobuttonToggle,
RoadmapItemSelected,
ScrollbarEndScroll,
ScrollbarScroll,
SpinbuttonDown,
SpinbuttonUp,
SpinfieldDown,
SpinfieldFirst,
SpinfieldLast,
SpinfieldUp,
StatusbarAllItemsRemoved,
StatusbarDrawItem, // pData = itemid
StatusbarHideItem, // pData = itemid
StatusbarItemAdded, // pData = itemid
StatusbarItemRemoved, // pData = itemid
StatusbarNameChanged, // pData = itemid
StatusbarShowItem, // pData = itemid
TabbarPageActivated, // pData = pageid
TabbarPageDeactivated, // pData = pageid
TabbarPageInserted, // pData = pageid
TabbarPageMoved, // pData = Pair( pagepos_old, pagepos_new )
TabbarPageRemoved, // pData = pageid
TabbarPageSelected, // pData = pageid
TabbarPageTextChanged, // pData = pageid
TableRowSelect,
TabpageActivate, // pData = pageid
TabpageDeactivate, // pData = pageid
TabpageInserted, // pData = pageid
TabpagePageTextChanged, // pData = pageid
TabpageRemoved, // pData = pageid
TabpageRemovedAll,
ToolboxActivate,
ToolboxAllItemsChanged,
ToolboxButtonStateChanged, // pData = itempos
ToolboxClick,
ToolboxDeactivate,
ToolboxDoubleClick,
ToolboxFormatChanged, // request new layout
ToolboxHighlight,
ToolboxHighlightOff, // pData = itempos
ToolboxItemAdded, // pData = itempos
ToolboxItemDisabled, // pData = itempos
ToolboxItemEnabled, // pData = itempos
ToolboxItemRemoved, // pData = itempos
ToolboxItemTextChanged, // pData = itempos
ToolboxItemUpdated,
ToolboxItemWindowChanged,
ToolboxSelect,
WindowActivate,
WindowChildDestroyed, // pData = vcl::Window*
WindowClose,
WindowCommand, // pData = CommandEvent*
WindowDataChanged, // pData = DataChangedEvent*
WindowDeactivate, // pData = vcl::Window* = pPrevActiveWindow
WindowDisabled,
WindowDocking,
WindowEnabled,
WindowEndDocking, // pData = EndDockingData
WindowEndPopupMode, // pData = EndPopupModeData
WindowFrameTitleChanged,// pData = OUString* = oldTitle
WindowGetFocus,
WindowHide,
WindowKeyInput, // pData = KeyEvent*
WindowKeyUp, // pData = KeyEvent*
WindowLoseFocus,
WindowMenubarAdded, // pData = pMenuBar
WindowMenubarRemoved, // pData = pMenuBar
WindowMinimize,
WindowMouseButtonDown, // pData = MouseEvent*
WindowMouseButtonUp, // pData = MouseEvent*
WindowMouseMove, // pData = MouseEvent*
WindowMove,
WindowNormalize,
WindowPaint, // pData = Rectangle*
WindowPrepareToggleFloating, // pData = bool
WindowResize,
WindowShow,
WindowStartDocking, // pData = DockingData
WindowToggleFloating,
WindowGestureEvent,
};
class VCL_DLLPUBLIC VclSimpleEvent
{
private:
VclEventId nId;
VclSimpleEvent(VclSimpleEvent const &) = delete;
VclSimpleEvent& operator =(VclSimpleEvent const &) = delete;
public:
VclSimpleEvent( VclEventId n ) { nId = n; }
virtual ~VclSimpleEvent() {}
VclEventId GetId() const { return nId; }
};
class VCL_DLLPUBLIC VclWindowEvent final : public VclSimpleEvent
{
private:
VclPtr<vcl::Window> pWindow;
void* pData;
public:
VclWindowEvent( vcl::Window* pWin, VclEventId n, void* pDat );
virtual ~VclWindowEvent() override;
vcl::Window* GetWindow() const { return pWindow; }
void* GetData() const { return pData; }
};
class VCL_DLLPUBLIC VclMenuEvent final : public VclSimpleEvent
{
private:
VclPtr<Menu> pMenu;
sal_uInt16 mnPos;
VclMenuEvent(VclMenuEvent const &) = delete;
VclMenuEvent& operator =(VclMenuEvent const &) = delete;
public:
VclMenuEvent( Menu* pM, VclEventId n, sal_uInt16 nPos );
virtual ~VclMenuEvent() override;
Menu* GetMenu() const;
sal_uInt16 GetItemPos() const { return mnPos; }
};
#endif // INCLUDED_VCL_VCLEVENT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */