svtools/source/brwbox/brwbox2.cxx | 30 --- vcl/inc/accessibility/AccessibleBrowseBox.hxx | 3 vcl/inc/accessibility/AccessibleBrowseBoxBase.hxx | 69 ------- vcl/inc/accessibility/AccessibleBrowseBoxHeaderBar.hxx | 3 vcl/inc/accessibility/AccessibleBrowseBoxHeaderCell.hxx | 2 vcl/inc/accessibility/AccessibleBrowseBoxTable.hxx | 3 vcl/inc/accessibility/accessiblebrowseboxcell.hxx | 1 vcl/source/accessibility/AccessibleBrowseBox.cxx | 5 vcl/source/accessibility/AccessibleBrowseBoxBase.cxx | 127 ------------- vcl/source/accessibility/AccessibleBrowseBoxHeaderBar.cxx | 5 vcl/source/accessibility/AccessibleBrowseBoxHeaderCell.cxx | 6 vcl/source/accessibility/AccessibleBrowseBoxTable.cxx | 5 vcl/source/accessibility/accessiblebrowseboxcell.cxx | 10 - vcl/source/accessibility/accessibleeditbrowseboxcell.cxx | 2 14 files changed, 27 insertions(+), 244 deletions(-)
New commits: commit ced891245d29e83905ab2849e63ff52eb588f139 Author: Michael Weghorn <[email protected]> AuthorDate: Wed Feb 5 11:19:52 2025 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Fri Feb 7 09:17:30 2025 +0100 browsebox a11y: Don't report EditBrowseBoxTableCell as its own parent The EditBrowseBoxTableCell ctor's first param is the parent, the second one is the owner. The EditBrowseBoxTableCellAccess is the owner, but not the parent, which means that the params were passed in the wrong order. Since EditBrowseBoxTableCellAccess::getAccessibleContext returns the EditBrowseBoxTableCell, this would result in the EditBrowseBoxTableCell reporting itself as its own parent. This results in infinite recursion when trying to walk up the a11y hierarchy starting at the EditBrowseBoxTableCell. Switch the order of the first 2 params to fix that. This addresses a preexisting issue that was now triggering a crash as described in commit 261dd0fd48b2e2c284485c25feade854154595aa Author: Michael Weghorn <[email protected]> Date: Fri Jan 31 11:40:09 2025 +0100 browsebox a11y: Use comphelper::OAccessibleComponentHelper [...] Sample scenario for BrowseBox: 1) Start Base, create a new database 2) With the "Tables" section enabled, click on "Create Table in Design View..." 3) in Accerciser's treeview of the LO a11y, navigate through the a11y objects of the table and its children A quick test with Orca [...] triggered a crash for the BrowseBox case. The underlying problem is a preexisting issue however, and will be addressed in an upcoming commit. Sample backtrace: Thread 1 received signal SIGSEGV, Segmentation fault. 0x00007fd5a4700cde in std::scoped_lock<std::mutex>::scoped_lock (this=0x7ffe58c71100, __m=...) at /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/mutex:787 787 { _M_device.lock(); } (rr) bt #0 0x00007fd5a4700cde in std::scoped_lock<std::mutex>::scoped_lock (this=0x7ffe58c71100, __m=...) at /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/mutex:787 #1 0x00007fd5a47402e4 in cppu::getTypeEntries (cd=0x7fd59e2da610 <cppu::detail::ImplClassData<cppu::ImplInheritanceHelper<comphelper::OCommonAccessibleComponent, com::sun::star::accessibility::XAccessibleComponent>, com::sun::star::accessibility::XAccessibleComponent>::operator()()::s_cd>) at /home/michi/development/git/libreoffice/cppuhelper/source/implbase_ex.cxx:69 #2 0x00007fd5a473f399 in cppu::queryDeepNoXInterface (pDemandedTDR=0x55ca49389ab0, cd=0x7fd59e2da610 <cppu::detail::ImplClassData<cppu::ImplInheritanceHelper<comphelper::OCommonAccessibleComponent, com::sun::star::accessibility::XAccessibleComponent>, com::sun::star::accessibility::XAccessibleComponent>::operator()()::s_cd>, that=0x55ca4a156260) at /home/michi/development/git/libreoffice/cppuhelper/source/implbase_ex.cxx:148 #3 0x00007fd5a473f917 in cppu::ImplHelper_queryNoXInterface (rType=invalid uno::Type, cd=0x7fd59e2da610 <cppu::detail::ImplClassData<cppu::ImplInheritanceHelper<comphelper::OCommonAccessibleComponent, com::sun::star::accessibility::XAccessibleComponent>, com::sun::star::accessibility::XAccessibleComponent>::operator()()::s_cd>, that=0x55ca4a156260) at /home/michi/development/git/libreoffice/cppuhelper/source/implbase_ex.cxx:225 #4 0x00007fd59ccdac55 in cppu::ImplInheritanceHelper<comphelper::OCommonAccessibleComponent, com::sun::star::accessibility::XAccessibleComponent>::queryInterface (this=0x55ca4a156260, aType=invalid uno::Type) at include/cppuhelper/implbase.hxx:165 #5 0x00007fd59ccd8375 in cppu::ImplInheritanceHelper<comphelper::OAccessibleComponentHelper, com::sun::star::awt::XFocusListener, com::sun::star::lang::XServiceInfo>::queryInterface (this=0x55ca4a156260, aType=invalid uno::Type) at include/cppuhelper/implbase.hxx:166 #6 0x00007fd59ccfab51 in EditBrowseBoxTableCell::queryInterface (this=0x55ca4a156260, _rType=invalid uno::Type) at /home/michi/development/git/libreoffice/vcl/source/accessibility/accessibleeditbrowseboxcell.cxx:62 #7 0x00007fd59ccd9ac5 in com::sun::star::uno::BaseReference::iquery (pInterface=0x55ca4a156260, rType=invalid uno::Type) at include/com/sun/star/uno/Reference.hxx:59 #8 0x00007fd59cce8739 in com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleContext>::iquery (pInterface=0x55ca4a156260) at include/com/sun/star/uno/Reference.hxx:74 #9 0x00007fd59ccfe39c in com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleContext>::query (rRef=...) at include/com/sun/star/uno/Reference.hxx:380 #10 0x00007fd59ccfd0b6 in com::sun::star::uno::WeakReference<com::sun::star::accessibility::XAccessibleContext>::operator com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleContext> (this=0x55ca4a14a1e0) at include/cppuhelper/weakref.hxx:218 #11 0x00007fd59ccfc4d1 in EditBrowseBoxTableCellAccess::getAccessibleContext (this=0x55ca4a14a1a0) at /home/michi/development/git/libreoffice/vcl/source/accessibility/accessibleeditbrowseboxcell.cxx:202 #12 0x00007fd59ccfc6a4 in non-virtual thunk to EditBrowseBoxTableCellAccess::getAccessibleContext() () at /home/michi/development/git/libreoffice/instdir/program/libvcllo.so #13 0x00007fd5a4ce8642 in comphelper::OCommonAccessibleComponent::implGetParentContext (this=0x55ca4a156260) at /home/michi/development/git/libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:208 #14 0x00007fd5a4ce8bdb in comphelper::OCommonAccessibleComponent::getLocationOnScreen (this=0x55ca4a156260) at /home/michi/development/git/libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:238 #15 0x00007fd5a4ce9075 in comphelper::OAccessibleComponentHelper::getLocationOnScreen (this=0x55ca4a156260) at /home/michi/development/git/libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:285 #16 0x00007fd5a4ce90a9 in non-virtual thunk to comphelper::OAccessibleComponentHelper::getLocationOnScreen() () at /home/michi/development/git/libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:285 #17 0x00007fd5a4ce8cb6 in comphelper::OCommonAccessibleComponent::getLocationOnScreen (this=0x55ca4a156260) at /home/michi/development/git/libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:242 #18 0x00007fd5a4ce9075 in comphelper::OAccessibleComponentHelper::getLocationOnScreen (this=0x55ca4a156260) at /home/michi/development/git/libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:285 #19 0x00007fd5a4ce90a9 in non-virtual thunk to comphelper::OAccessibleComponentHelper::getLocationOnScreen() () at /home/michi/development/git/libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:285 #20 0x00007fd5a4ce8cb6 in comphelper::OCommonAccessibleComponent::getLocationOnScreen (this=0x55ca4a156260) at /home/michi/development/git/libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:242 #21 0x00007fd5a4ce9075 in comphelper::OAccessibleComponentHelper::getLocationOnScreen (this=0x55ca4a156260) at /home/michi/development/git/libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:285 #22 0x00007fd5a4ce90a9 in non-virtual thunk to comphelper::OAccessibleComponentHelper::getLocationOnScreen() () at /home/michi/development/git/libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:285 #23 0x00007fd5a4ce8cb6 in comphelper::OCommonAccessibleComponent::getLocationOnScreen (this=0x55ca4a156260) at /home/michi/development/git/libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:242 #24 0x00007fd5a4ce9075 in comphelper::OAccessibleComponentHelper::getLocationOnScreen (this=0x55ca4a156260) at /home/michi/development/git/libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:285 #25 0x00007fd5a4ce90a9 in non-virtual thunk to comphelper::OAccessibleComponentHelper::getLocationOnScreen() () at /home/michi/development/git/libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:285 #26 0x00007fd5a4ce8cb6 in comphelper::OCommonAccessibleComponent::getLocationOnScreen (this=0x55ca4a156260) at /home/michi/development/git/libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:242 #27 0x00007fd5a4ce9075 in comphelper::OAccessibleComponentHelper::getLocationOnScreen (this=0x55ca4a156260) at /home/michi/development/git/libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:285 #28 0x00007fd5a4ce90a9 in non-virtual thunk to comphelper::OAccessibleComponentHelper::getLocationOnScreen() () at /home/michi/development/git/libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:285 #29 0x00007fd5a4ce8cb6 in comphelper::OCommonAccessibleComponent::getLocationOnScreen (this=0x55ca4a156260) at /home/michi/development/git/libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:242 #30 0x00007fd5a4ce9075 in comphelper::OAccessibleComponentHelper::getLocationOnScreen (this=0x55ca4a156260) at /home/michi/development/git/libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:285 #31 0x00007fd5a4ce90a9 in non-virtual thunk to comphelper::OAccessibleComponentHelper::getLocationOnScreen() () at /home/michi/development/git/libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:285 #32 0x00007fd5a4ce8cb6 in comphelper::OCommonAccessibleComponent::getLocationOnScreen (this=0x55ca4a156260) at /home/michi/development/git/libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:242 #33 0x00007fd5a4ce9075 in comphelper::OAccessibleComponentHelper::getLocationOnScreen (this=0x55ca4a156260) at /home/michi/development/git/libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:285 #34 0x00007fd5a4ce90a9 in non-virtual thunk to comphelper::OAccessibleComponentHelper::getLocationOnScreen() () at /home/michi/development/git/libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:285 #35 0x00007fd5a4ce8cb6 in comphelper::OCommonAccessibleComponent::getLocationOnScreen (this=0x55ca4a156260) at /home/michi/development/git/libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:242 #36 0x00007fd5a4ce9075 in comphelper::OAccessibleComponentHelper::getLocationOnScreen (this=0x55ca4a156260) at /home/michi/development/git/libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:285 #37 0x00007fd5a4ce90a9 in non-virtual thunk to comphelper::OAccessibleComponentHelper::getLocationOnScreen() () at /home/michi/development/git/libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:285 #38 0x00007fd5a4ce8cb6 in comphelper::OCommonAccessibleComponent::getLocationOnScreen (this=0x55ca4a156260) at /home/michi/development/git/libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:242 #39 0x00007fd5a4ce9075 in comphelper::OAccessibleComponentHelper::getLocationOnScreen (this=0x55ca4a156260) at /home/michi/development/git/libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:285 #40 0x00007fd5a4ce90a9 in non-virtual thunk to comphelper::OAccessibleComponentHelper::getLocationOnScreen() () at /home/michi/development/git/libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:285 #41 0x00007fd5a4ce8cb6 in comphelper::OCommonAccessibleComponent::getLocationOnScreen (this=0x55ca4a156260) at /home/michi/development/git/libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:242 #42 0x00007fd5a4ce9075 in comphelper::OAccessibleComponentHelper::getLocationOnScreen (this=0x55ca4a156260) at /home/michi/development/git/libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:285 #43 0x00007fd5a4ce90a9 in non-virtual thunk to comphelper::OAccessibleComponentHelper::getLocationOnScreen() () at /home/michi/development/git/libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:285 #44 0x00007fd5a4ce8cb6 in comphelper::OCommonAccessibleComponent::getLocationOnScreen (this=0x55ca4a156260) at /home/michi/development/git/libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:242 #45 0x00007fd5a4ce9075 in comphelper::OAccessibleComponentHelper::getLocationOnScreen (this=0x55ca4a156260) at /home/michi/development/git/libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:285 #46 0x00007fd5a4ce90a9 in non-virtual thunk to comphelper::OAccessibleComponentHelper::getLocationOnScreen() () at /home/michi/development/git/libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:285 #47 0x00007fd5a4ce8cb6 in comphelper::OCommonAccessibleComponent::getLocationOnScreen (this=0x55ca4a156260) at /home/michi/development/git/libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:242 #48 0x00007fd5a4ce9075 in comphelper::OAccessibleComponentHelper::getLocationOnScreen (this=0x55ca4a156260) at /home/michi/development/git/libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:285 [...] Change-Id: If8b0edba80c804ba621c808495358d6358be96ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181154 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/vcl/source/accessibility/accessibleeditbrowseboxcell.cxx b/vcl/source/accessibility/accessibleeditbrowseboxcell.cxx index 9fdb8a24df7b..66f2dd77ea3b 100644 --- a/vcl/source/accessibility/accessibleeditbrowseboxcell.cxx +++ b/vcl/source/accessibility/accessibleeditbrowseboxcell.cxx @@ -205,7 +205,7 @@ css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL EditBrows css::uno::Reference< css::accessibility::XAccessibleContext > xInnerContext = m_xControlAccessible->getAccessibleContext(); css::uno::Reference< css::accessibility::XAccessible > xMe( this ); - xMyContext = new EditBrowseBoxTableCell( xMe, m_xParent, xInnerContext, *m_pBrowseBox, m_xFocusWindow, m_nRowPos, m_nColPos ); + xMyContext = new EditBrowseBoxTableCell(m_xParent, xMe, xInnerContext, *m_pBrowseBox, m_xFocusWindow, m_nRowPos, m_nColPos); m_aContext = xMyContext; } return xMyContext; commit 738450ff592d069f20092c1c31071fe4ee9414a4 Author: Michael Weghorn <[email protected]> AuthorDate: Fri Jan 31 11:40:09 2025 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Fri Feb 7 09:17:23 2025 +0100 browsebox a11y: Use comphelper::OAccessibleComponentHelper Let AccessibleBrowseBoxBase derive from comphelper::OAccessibleComponentHelper instead of duplicating much of the logic for notifying of a11y events and location/bounds handling. The involved classes are the a11y classes for both, BrowseBox (see BrowseBox::CreateAccessible) and SvHeaderTabListBox (see SvHeaderTabListBox::CreateAccessible). With the fixes to the involved classes from previous commits in place, a quick test for both of these with Accerciser and the qt6 VCL plugin didn't show any change in behavior with this commit in place. Sample scenario for SvHeaderTabListBox: "Tools" -> "Options" -> "Advanced" -> "Open Expert Configuration" Sample scenario for BrowseBox: 1) Start Base, create a new database 2) With the "Tables" section enabled, click on "Create Table in Design View..." 3) in Accerciser's treeview of the LO a11y, navigate through the a11y objects of the table and its children A quick test with Orca also didn't reveal any changes in behavior for the expert configuration case, but triggered a crash for the BrowseBox case. The underlying problem is a preexisting issue however, and will be addressed in an upcoming commit. Change-Id: I2a540ade0c5f6a5a82c764de4cef37be556453fd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181153 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/vcl/inc/accessibility/AccessibleBrowseBox.hxx b/vcl/inc/accessibility/AccessibleBrowseBox.hxx index c8edc8a89341..387709d9a9f5 100644 --- a/vcl/inc/accessibility/AccessibleBrowseBox.hxx +++ b/vcl/inc/accessibility/AccessibleBrowseBox.hxx @@ -138,9 +138,6 @@ protected: /** @attention This method requires locked mutex's and a living object. @return The bounding box (VCL rect.) relative to the parent window. */ virtual tools::Rectangle implGetBoundingBox() override; - /** @attention This method requires locked mutex's and a living object. - @return The bounding box (VCL rect.) in screen coordinates. */ - virtual AbsoluteScreenPixelRectangle implGetBoundingBoxOnScreen() override; // internal helper methods diff --git a/vcl/inc/accessibility/AccessibleBrowseBoxBase.hxx b/vcl/inc/accessibility/AccessibleBrowseBoxBase.hxx index b8758c4aeac5..4a2d98f1ab58 100644 --- a/vcl/inc/accessibility/AccessibleBrowseBoxBase.hxx +++ b/vcl/inc/accessibility/AccessibleBrowseBoxBase.hxx @@ -36,6 +36,7 @@ #include <com/sun/star/accessibility/XAccessibleComponent.hpp> #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> #include <com/sun/star/awt/XFocusListener.hpp> +#include <comphelper/accessiblecomponenthelper.hxx> #include <comphelper/accessibleeventnotifier.hxx> #include <comphelper/uno3.hxx> @@ -46,20 +47,11 @@ namespace vcl { class IAccessibleTableProvider; } -typedef ::cppu::WeakComponentImplHelper< - css::accessibility::XAccessibleContext, - css::accessibility::XAccessibleComponent, - css::accessibility::XAccessibleEventBroadcaster, - css::awt::XFocusListener, - css::lang::XServiceInfo > - AccessibleBrowseBoxImplHelper; - /** The BrowseBox accessible objects inherit from this base class. It - implements basic functionality for various Accessibility interfaces and - the event broadcaster and contains the osl::Mutex. */ -class AccessibleBrowseBoxBase : - public ::cppu::BaseMutex, - public AccessibleBrowseBoxImplHelper + implements basic functionality for various Accessibility interfaces. */ +class AccessibleBrowseBoxBase + : public cppu::ImplInheritanceHelper<comphelper::OAccessibleComponentHelper, + css::awt::XFocusListener, css::lang::XServiceInfo> { public: /** Constructor sets specified name and description. If the constant of a @@ -94,11 +86,11 @@ public: OUString rDescription ); protected: - virtual ~AccessibleBrowseBoxBase() override; - /** Commits DeFunc event to listeners and cleans up members. */ virtual void SAL_CALL disposing() override; + virtual css::awt::Rectangle implGetBounds() override; + public: // XAccessibleContext @@ -143,24 +135,6 @@ public: // XAccessibleComponent - /** @return - TRUE, if the point lies within the bounding box of this object. */ - virtual sal_Bool SAL_CALL containsPoint( const css::awt::Point& rPoint ) override; - - /** @return The bounding box of this object. */ - virtual css::awt::Rectangle SAL_CALL getBounds() override; - - /** @return - The upper left corner of the bounding box relative to the parent. */ - virtual css::awt::Point SAL_CALL getLocation() override; - - /** @return - The upper left corner of the bounding box in screen coordinates. */ - virtual css::awt::Point SAL_CALL getLocationOnScreen() override; - - /** @return The size of the bounding box. */ - virtual css::awt::Size SAL_CALL getSize() override; - virtual sal_Int32 SAL_CALL getForeground( ) override; virtual sal_Int32 SAL_CALL getBackground( ) override; @@ -178,16 +152,6 @@ public: */ virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& rPoint ) override; - // XAccessibleEventBroadcaster - - /** Adds a new event listener */ - virtual void SAL_CALL addAccessibleEventListener( - const css::uno::Reference< css::accessibility::XAccessibleEventListener>& rxListener ) override; - - /** Removes an event listener. */ - virtual void SAL_CALL removeAccessibleEventListener( - const css::uno::Reference< css::accessibility::XAccessibleEventListener>& rxListener ) override; - // XTypeProvider /** @return a unique implementation ID. */ @@ -236,10 +200,6 @@ protected: @attention This method requires locked mutex's and a living object. @return The bounding box (VCL rect.) relative to the parent window. */ virtual tools::Rectangle implGetBoundingBox() = 0; - /** Derived classes return the bounding box in screen coordinates. - @attention This method requires locked mutex's and a living object. - @return The bounding box (VCL rect.) in screen coordinates. */ - virtual AbsoluteScreenPixelRectangle implGetBoundingBoxOnScreen() = 0; /** Creates a bitset of states of the current object. This method calls FillStateSet at the BrowseBox which @@ -255,19 +215,6 @@ protected: @attention This method requires a locked mutex. */ inline void implSetName( const OUString& rName ); - /** Locks all mutex's and calculates the bounding box relative to the - parent window. - @return The bounding box (VCL rect.) relative to the parent object. - @throws css::lang::DisposedException - */ - tools::Rectangle getBoundingBox(); - /** Locks all mutex's and calculates the bounding box in screen - coordinates. - @return The bounding box (VCL rect.) in screen coordinates. - @throws css::lang::DisposedException - */ - AbsoluteScreenPixelRectangle getBoundingBoxOnScreen(); - public: /** @return The osl::Mutex member provided by the class BaseMutex. */ ::osl::Mutex& getMutex( ) { return m_aMutex; } @@ -296,8 +243,6 @@ private: /** The type of this object (for names, descriptions, state sets, ...). */ AccessibleBrowseBoxObjType meObjType; - - ::comphelper::AccessibleEventNotifier::TClientId m_aClientId; }; diff --git a/vcl/inc/accessibility/AccessibleBrowseBoxHeaderBar.hxx b/vcl/inc/accessibility/AccessibleBrowseBoxHeaderBar.hxx index 791f3548535d..84da986ed6f8 100644 --- a/vcl/inc/accessibility/AccessibleBrowseBoxHeaderBar.hxx +++ b/vcl/inc/accessibility/AccessibleBrowseBoxHeaderBar.hxx @@ -158,9 +158,6 @@ private: /** @attention This method requires locked mutex's and a living object. @return The bounding box (VCL rect.) relative to the parent window. */ virtual tools::Rectangle implGetBoundingBox() override; - /** @attention This method requires locked mutex's and a living object. - @return The bounding box (VCL rect.) in screen coordinates. */ - virtual AbsoluteScreenPixelRectangle implGetBoundingBoxOnScreen() override; /** @attention This method requires locked mutex's and a living object. @return The count of used rows. */ diff --git a/vcl/inc/accessibility/AccessibleBrowseBoxHeaderCell.hxx b/vcl/inc/accessibility/AccessibleBrowseBoxHeaderCell.hxx index aa9a0d8672d4..8ddeaf8ef35f 100644 --- a/vcl/inc/accessibility/AccessibleBrowseBoxHeaderCell.hxx +++ b/vcl/inc/accessibility/AccessibleBrowseBoxHeaderCell.hxx @@ -57,8 +57,6 @@ public: private: virtual tools::Rectangle implGetBoundingBox() override; - - virtual AbsoluteScreenPixelRectangle implGetBoundingBoxOnScreen() override; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/accessibility/AccessibleBrowseBoxTable.hxx b/vcl/inc/accessibility/AccessibleBrowseBoxTable.hxx index 8406ea8ec18d..18c2b52b8fee 100644 --- a/vcl/inc/accessibility/AccessibleBrowseBoxTable.hxx +++ b/vcl/inc/accessibility/AccessibleBrowseBoxTable.hxx @@ -103,9 +103,6 @@ protected: /** @attention This method requires locked mutex's and a living object. @return The bounding box (VCL rect.) relative to the parent window. */ virtual tools::Rectangle implGetBoundingBox() override; - /** @attention This method requires locked mutex's and a living object. - @return The bounding box (VCL rect.) in screen coordinates. */ - virtual AbsoluteScreenPixelRectangle implGetBoundingBoxOnScreen() override; // internal helper methods diff --git a/vcl/inc/accessibility/accessiblebrowseboxcell.hxx b/vcl/inc/accessibility/accessiblebrowseboxcell.hxx index 7cf98875df04..b13099b08afb 100644 --- a/vcl/inc/accessibility/accessiblebrowseboxcell.hxx +++ b/vcl/inc/accessibility/accessiblebrowseboxcell.hxx @@ -41,7 +41,6 @@ protected: protected: // AccessibleBrowseBoxBase overridables virtual tools::Rectangle implGetBoundingBox() override; - virtual AbsoluteScreenPixelRectangle implGetBoundingBoxOnScreen() override; // XAccessibleComponent virtual void SAL_CALL grabFocus() override; diff --git a/vcl/source/accessibility/AccessibleBrowseBox.cxx b/vcl/source/accessibility/AccessibleBrowseBox.cxx index fda7f0bda39f..9efa020c4248 100644 --- a/vcl/source/accessibility/AccessibleBrowseBox.cxx +++ b/vcl/source/accessibility/AccessibleBrowseBox.cxx @@ -175,11 +175,6 @@ tools::Rectangle AccessibleBrowseBox::implGetBoundingBox() return mpBrowseBox->GetWindowExtentsRelative( *pParent ); } -AbsoluteScreenPixelRectangle AccessibleBrowseBox::implGetBoundingBoxOnScreen() -{ - return mpBrowseBox->GetWindowExtentsAbsolute(); -} - // internal helper methods css::uno::Reference< css::accessibility::XAccessible > AccessibleBrowseBox::implGetTable() { diff --git a/vcl/source/accessibility/AccessibleBrowseBoxBase.cxx b/vcl/source/accessibility/AccessibleBrowseBoxBase.cxx index 592fc6743b61..69efa4fac723 100644 --- a/vcl/source/accessibility/AccessibleBrowseBoxBase.cxx +++ b/vcl/source/accessibility/AccessibleBrowseBoxBase.cxx @@ -63,29 +63,18 @@ AccessibleBrowseBoxBase::AccessibleBrowseBoxBase( AccessibleBrowseBoxObjType eObjType, OUString rName, OUString rDescription ) : - AccessibleBrowseBoxImplHelper( m_aMutex ), + ImplInheritanceHelper(), mxParent(std::move( rxParent )), mpBrowseBox( &rBrowseBox ), m_xFocusWindow(std::move(_xFocusWindow)), maName(std::move( rName )), maDescription(std::move( rDescription )), - meObjType( eObjType ), - m_aClientId(0) + meObjType( eObjType ) { if ( m_xFocusWindow.is() ) m_xFocusWindow->addFocusListener( this ); } -AccessibleBrowseBoxBase::~AccessibleBrowseBoxBase() -{ - if( isAlive() ) - { - // increment ref count to prevent double call of Dtor - osl_atomic_increment( &m_refCount ); - dispose(); - } -} - void SAL_CALL AccessibleBrowseBoxBase::disposing() { ::osl::MutexGuard aGuard( getMutex() ); @@ -95,17 +84,17 @@ void SAL_CALL AccessibleBrowseBoxBase::disposing() m_xFocusWindow->removeFocusListener( this ); } - if (m_aClientId) - { - AccessibleEventNotifier::TClientId nId(m_aClientId); - m_aClientId = 0; - AccessibleEventNotifier::revokeClientNotifyDisposing( nId, *this ); - } + OAccessibleComponentHelper::disposing(); mxParent = nullptr; mpBrowseBox = nullptr; } +css::awt::Rectangle AccessibleBrowseBoxBase::implGetBounds() +{ + return vcl::unohelper::ConvertToAWTRect(implGetBoundingBox()); +} + // css::accessibility::XAccessibleContext Reference< css::accessibility::XAccessible > SAL_CALL AccessibleBrowseBoxBase::getAccessibleParent() @@ -197,32 +186,6 @@ lang::Locale SAL_CALL AccessibleBrowseBoxBase::getLocale() // css::accessibility::XAccessibleComponent -sal_Bool SAL_CALL AccessibleBrowseBoxBase::containsPoint( const css::awt::Point& rPoint ) -{ - return tools::Rectangle(Point(), getBoundingBox().GetSize()) - .Contains(vcl::unohelper::ConvertToVCLPoint(rPoint)); -} - -awt::Rectangle SAL_CALL AccessibleBrowseBoxBase::getBounds() -{ - return vcl::unohelper::ConvertToAWTRect(getBoundingBox()); -} - -awt::Point SAL_CALL AccessibleBrowseBoxBase::getLocation() -{ - return vcl::unohelper::ConvertToAWTPoint(getBoundingBox().TopLeft()); -} - -awt::Point SAL_CALL AccessibleBrowseBoxBase::getLocationOnScreen() -{ - return vcl::unohelper::ConvertToAWTPoint(getBoundingBoxOnScreen().TopLeft()); -} - -awt::Size SAL_CALL AccessibleBrowseBoxBase::getSize() -{ - return vcl::unohelper::ConvertToAWTSize(getBoundingBox().GetSize()); -} - void SAL_CALL AccessibleBrowseBoxBase::focusGained( const css::awt::FocusEvent& ) { css::uno::Any aFocused; @@ -241,41 +204,6 @@ void SAL_CALL AccessibleBrowseBoxBase::focusLost( const css::awt::FocusEvent& ) commitEvent(AccessibleEventId::STATE_CHANGED,aEmpty,aFocused); } -// css::accessibility::XAccessibleEventBroadcaster - -void SAL_CALL AccessibleBrowseBoxBase::addAccessibleEventListener( - const css::uno::Reference< css::accessibility::XAccessibleEventListener>& _rxListener ) -{ - if ( _rxListener.is() ) - { - ::osl::MutexGuard aGuard( getMutex() ); - if (!m_aClientId) - m_aClientId = AccessibleEventNotifier::registerClient(); - - AccessibleEventNotifier::addEventListener(m_aClientId, _rxListener); - } -} - -void SAL_CALL AccessibleBrowseBoxBase::removeAccessibleEventListener( - const css::uno::Reference< css::accessibility::XAccessibleEventListener>& _rxListener ) -{ - if (!(_rxListener.is() && m_aClientId)) - return; - - ::osl::MutexGuard aGuard( getMutex() ); - sal_Int32 nListenerCount = AccessibleEventNotifier::removeEventListener(m_aClientId, _rxListener ); - if ( !nListenerCount ) - { - // no listeners anymore - // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client), - // and at least to us not firing any events anymore, in case somebody calls - // NotifyAccessibleEvent, again - - AccessibleEventNotifier::TClientId nId(m_aClientId); - m_aClientId = 0; - AccessibleEventNotifier::revokeClient( nId ); - } -} // XTypeProvider @@ -376,47 +304,10 @@ void AccessibleBrowseBoxBase::ensureIsAlive() const throw lang::DisposedException(); } -tools::Rectangle AccessibleBrowseBoxBase::getBoundingBox() -{ - SolarMethodGuard aGuard(getMutex()); - ensureIsAlive(); - - tools::Rectangle aRect = implGetBoundingBox(); - if ( aRect.Left() == 0 && aRect.Top() == 0 && aRect.Right() == 0 && aRect.Bottom() == 0 ) - { - SAL_WARN( "accessibility", "rectangle doesn't exist" ); - } - return aRect; -} - -AbsoluteScreenPixelRectangle AccessibleBrowseBoxBase::getBoundingBoxOnScreen() -{ - SolarMethodGuard aGuard(getMutex()); - ensureIsAlive(); - - AbsoluteScreenPixelRectangle aRect = implGetBoundingBoxOnScreen(); - if ( aRect.Left() == 0 && aRect.Top() == 0 && aRect.Right() == 0 && aRect.Bottom() == 0 ) - { - SAL_WARN( "accessibility", "rectangle doesn't exist" ); - } - return aRect; -} - void AccessibleBrowseBoxBase::commitEvent( sal_Int16 _nEventId, const Any& _rNewValue, const Any& _rOldValue ) { - osl::MutexGuard aGuard( getMutex() ); - if (!m_aClientId) - // if we don't have a client id for the notifier, then we don't have listeners, then - // we don't need to notify anything - return; - - // build an event object - AccessibleEventObject aEvent(*this, _nEventId, _rNewValue, _rOldValue, -1); - - // let the notifier handle this event - - AccessibleEventNotifier::addEvent(m_aClientId, aEvent ); + NotifyAccessibleEvent(_nEventId, _rOldValue, _rNewValue); } sal_Int16 SAL_CALL AccessibleBrowseBoxBase::getAccessibleRole() diff --git a/vcl/source/accessibility/AccessibleBrowseBoxHeaderBar.cxx b/vcl/source/accessibility/AccessibleBrowseBoxHeaderBar.cxx index a9c60e47df65..8ea3e7518825 100644 --- a/vcl/source/accessibility/AccessibleBrowseBoxHeaderBar.cxx +++ b/vcl/source/accessibility/AccessibleBrowseBoxHeaderBar.cxx @@ -305,11 +305,6 @@ tools::Rectangle AccessibleBrowseBoxHeaderBar::implGetBoundingBox() return mpBrowseBox->calcHeaderRect(isColumnBar(), false); } -AbsoluteScreenPixelRectangle AccessibleBrowseBoxHeaderBar::implGetBoundingBoxOnScreen() -{ - return AbsoluteScreenPixelRectangle(mpBrowseBox->calcHeaderRect(isColumnBar())); -} - sal_Int32 AccessibleBrowseBoxHeaderBar::implGetRowCount() const { // column header bar: only 1 row diff --git a/vcl/source/accessibility/AccessibleBrowseBoxHeaderCell.cxx b/vcl/source/accessibility/AccessibleBrowseBoxHeaderCell.cxx index db5319663d41..bdd277e86e7d 100644 --- a/vcl/source/accessibility/AccessibleBrowseBoxHeaderCell.cxx +++ b/vcl/source/accessibility/AccessibleBrowseBoxHeaderCell.cxx @@ -129,12 +129,6 @@ tools::Rectangle AccessibleBrowseBoxHeaderCell::implGetBoundingBox() return getRectangle(mpBrowseBox,m_nColumnRowId,false,isRowBarCell()); } - -AbsoluteScreenPixelRectangle AccessibleBrowseBoxHeaderCell::implGetBoundingBoxOnScreen() -{ - return AbsoluteScreenPixelRectangle(getRectangle(mpBrowseBox,m_nColumnRowId,true,isRowBarCell())); -} - sal_Int64 SAL_CALL AccessibleBrowseBoxHeaderCell::getAccessibleIndexInParent() { ::osl::MutexGuard aGuard( getMutex() ); diff --git a/vcl/source/accessibility/AccessibleBrowseBoxTable.cxx b/vcl/source/accessibility/AccessibleBrowseBoxTable.cxx index 0aa1e1ad08e4..e0c200305da5 100644 --- a/vcl/source/accessibility/AccessibleBrowseBoxTable.cxx +++ b/vcl/source/accessibility/AccessibleBrowseBoxTable.cxx @@ -193,11 +193,6 @@ tools::Rectangle AccessibleBrowseBoxTable::implGetBoundingBox() return mpBrowseBox->calcTableRect(false); } -AbsoluteScreenPixelRectangle AccessibleBrowseBoxTable::implGetBoundingBoxOnScreen() -{ - return AbsoluteScreenPixelRectangle(mpBrowseBox->calcTableRect()); -} - // internal helper methods ---------------------------------------------------- Reference< XAccessibleTable > AccessibleBrowseBoxTable::implGetHeaderBar( diff --git a/vcl/source/accessibility/accessiblebrowseboxcell.cxx b/vcl/source/accessibility/accessiblebrowseboxcell.cxx index 1c4aceea07c9..866ca88655b8 100644 --- a/vcl/source/accessibility/accessiblebrowseboxcell.cxx +++ b/vcl/source/accessibility/accessiblebrowseboxcell.cxx @@ -61,9 +61,4 @@ void SAL_CALL AccessibleBrowseBoxCell::grabFocus() return aCellRect; } -AbsoluteScreenPixelRectangle AccessibleBrowseBoxCell::implGetBoundingBoxOnScreen() -{ - return AbsoluteScreenPixelRectangle(mpBrowseBox->GetFieldRectPixel( m_nRowPos, m_nColPos, false, /*bOnScreen*/true )); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 855fe539121d5ede59d12dbd3d2537afe67d2b3a Author: Michael Weghorn <[email protected]> AuthorDate: Wed Feb 5 10:03:22 2025 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Fri Feb 7 09:17:16 2025 +0100 browsebox a11y: Fix parent-relative cell coords Parent-relative coordinates are meant to be relative to the immediate parent. The immediate parent of the cells is the table, and the immediate parent of the AccessibleBrowseBoxTable is the AccessibleBrowseBox (which is the a11y class for BrowseBox). Therefore: * Don't add the position of the BrowseBox inside of its parent widget when relative coords are requested. * In AccessibleBrowseBoxCell::implGetBoundingBox, subtract the relative position of the table from the result of BrowseBox::GetFieldRectPixel, because BrowseBox::GetFieldRectPixel returns the relative position within the BrowseBox (i.e. the parent's parent), not within the accessible parent. Without this commit, the wrong area would be highlighted e.g. for the following scenario when using the gtk3 VCL plugin: 1) Start base, create a new database 2) With the "Tables" section enabled, click on "Create Table in Design View..."# 3) Start Accerciser 4) in Accerciser's treeview of the LO a11y, navigate to the a11y object of the (non-header) table cells Result: Incorrect area is highlighted on screen, not the one actually covered by the cell. See also commit 589ead3a6ae776fdbcb426f2817fbb94933a8bf7 Author: Michael Weghorn <[email protected]> Date: Tue Feb 4 17:16:27 2025 +0100 treeview a11y: Fix parent-relative coordinates for a similar case. Change-Id: I45154fcb8365d40984b34ea750cff621ddd0331f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181152 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx index f613bdcb26e4..767b219eab07 100644 --- a/svtools/source/brwbox/brwbox2.cxx +++ b/svtools/source/brwbox/brwbox2.cxx @@ -1942,10 +1942,6 @@ void BrowseBox::SetCursorColor(const Color& _rCol) tools::Rectangle BrowseBox::calcHeaderRect(bool _bIsColumnBar, bool _bOnScreen) { - vcl::Window* pParent = nullptr; - if ( !_bOnScreen ) - pParent = GetAccessibleParentWindow(); - Point aTopLeft; tools::Long nWidth; tools::Long nHeight; @@ -1960,25 +1956,17 @@ tools::Rectangle BrowseBox::calcHeaderRect(bool _bIsColumnBar, bool _bOnScreen) nWidth = GetColumnWidth(0); nHeight = GetWindowExtentsAbsolute().GetHeight() - aTopLeft.Y() - GetControlArea().GetSize().Height(); } - if (pParent) - aTopLeft += GetWindowExtentsRelative( *pParent ).TopLeft(); - else + if (_bOnScreen) aTopLeft += Point(GetWindowExtentsAbsolute().TopLeft()); return tools::Rectangle(aTopLeft,Size(nWidth,nHeight)); } tools::Rectangle BrowseBox::calcTableRect(bool _bOnScreen) { - vcl::Window* pParent = nullptr; - if ( !_bOnScreen ) - pParent = GetAccessibleParentWindow(); - - tools::Rectangle aRect; - if (pParent) - aRect = GetWindowExtentsRelative( *pParent ); - else - aRect = tools::Rectangle(GetWindowExtentsAbsolute()); - tools::Rectangle aRowBar = calcHeaderRect(false, pParent == nullptr); + tools::Rectangle aRect(GetWindowExtentsAbsolute()); + if (!_bOnScreen) + aRect.SetPos(Point(0, 0)); + tools::Rectangle aRowBar = calcHeaderRect(false, _bOnScreen); tools::Long nX = aRowBar.Right() - aRect.Left(); tools::Long nY = aRowBar.Top() - aRect.Top(); @@ -1989,16 +1977,10 @@ tools::Rectangle BrowseBox::calcTableRect(bool _bOnScreen) tools::Rectangle BrowseBox::GetFieldRectPixel( sal_Int32 _nRowId, sal_uInt16 _nColId, bool /*_bIsHeader*/, bool _bOnScreen ) { - vcl::Window* pParent = nullptr; - if ( !_bOnScreen ) - pParent = GetAccessibleParentWindow(); - tools::Rectangle aRect = GetFieldRectPixel(_nRowId, _nColId, true); Point aTopLeft = aRect.TopLeft(); - if (pParent) - aTopLeft += GetWindowExtentsRelative( *pParent ).TopLeft(); - else + if (_bOnScreen) aTopLeft += Point(GetWindowExtentsAbsolute().TopLeft()); return tools::Rectangle(aTopLeft,aRect.GetSize()); diff --git a/vcl/source/accessibility/accessiblebrowseboxcell.cxx b/vcl/source/accessibility/accessiblebrowseboxcell.cxx index 9eab8fa3a82c..1c4aceea07c9 100644 --- a/vcl/source/accessibility/accessiblebrowseboxcell.cxx +++ b/vcl/source/accessibility/accessiblebrowseboxcell.cxx @@ -55,7 +55,10 @@ void SAL_CALL AccessibleBrowseBoxCell::grabFocus() ::tools::Rectangle AccessibleBrowseBoxCell::implGetBoundingBox() { - return mpBrowseBox->GetFieldRectPixel( m_nRowPos, m_nColPos, false, /*bOnScreen*/false ); + tools::Rectangle aCellRect = mpBrowseBox->GetFieldRectPixel(m_nRowPos, m_nColPos, false, /*bOnScreen*/false); + // above rect is relative to the browse box, convert it to be relative to the table (which is the cell's parent) + aCellRect.SetPos(aCellRect.TopLeft() - mpBrowseBox->calcTableRect(false).TopLeft()); + return aCellRect; } AbsoluteScreenPixelRectangle AccessibleBrowseBoxCell::implGetBoundingBoxOnScreen()
