include/svtools/brwbox.hxx | 10 ------- include/vcl/accessibility/AccessibleBrowseBoxTableCell.hxx | 5 --- include/vcl/accessibletableprovider.hxx | 3 -- svtools/source/brwbox/brwbox3.cxx | 17 ------------- vcl/source/accessibility/AccessibleBrowseBox.cxx | 17 +++++-------- vcl/source/accessibility/AccessibleBrowseBoxTableCell.cxx | 5 +-- vcl/source/treelist/svtabbx.cxx | 2 - 7 files changed, 12 insertions(+), 47 deletions(-)
New commits: commit 6decfbd3fb03158ddcdb3aad268f2f451f6b921d Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Fri Feb 7 10:56:37 2025 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Feb 7 20:59:54 2025 +0100 browsebox a11y: Drop duplicate check If `nChildIndex` is negative, an exception is already thrown above, so don't check again. Change-Id: Ia73fe554529ba3ad4b6adc3dff6aee28713b0132 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181238 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/vcl/source/accessibility/AccessibleBrowseBox.cxx b/vcl/source/accessibility/AccessibleBrowseBox.cxx index 2975d87ae454..468236e00cb7 100644 --- a/vcl/source/accessibility/AccessibleBrowseBox.cxx +++ b/vcl/source/accessibility/AccessibleBrowseBox.cxx @@ -102,17 +102,14 @@ AccessibleBrowseBox::getAccessibleChild( sal_Int64 nChildIndex ) throw lang::IndexOutOfBoundsException(); css::uno::Reference< css::accessibility::XAccessible > xRet; - if( nChildIndex >= 0 ) + if (nChildIndex < vcl::BBINDEX_FIRSTCONTROL) + xRet = implGetFixedChild(nChildIndex); + else { - if( nChildIndex < vcl::BBINDEX_FIRSTCONTROL ) - xRet = implGetFixedChild( nChildIndex ); - else - { - // additional controls - nChildIndex -= vcl::BBINDEX_FIRSTCONTROL; - if( nChildIndex < mpBrowseBox->GetAccessibleControlCount() ) - xRet = mpBrowseBox->CreateAccessibleControl( nChildIndex ); - } + // additional controls + nChildIndex -= vcl::BBINDEX_FIRSTCONTROL; + if (nChildIndex < mpBrowseBox->GetAccessibleControlCount()) + xRet = mpBrowseBox->CreateAccessibleControl(nChildIndex); } if( !xRet.is() ) commit 3ef0790a55878285d747fa657f1d73c5bf22793a Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Fri Feb 7 10:36:28 2025 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Feb 7 20:59:47 2025 +0100 browsebox a11y: Report correct child index for cells No longer add any offset when a cell's child index is calculated in AccessibleBrowseBoxTableCell::getAccessibleIndexInParent. For SvHeaderTabListBox, that offset was already 0 anyway. For BrowseBox, that offset was 3 (BBINDEX_FIRSTCONTROL), presumably so that the first cell comes after * the column header (BBINDEX_COLUMNHEADERBAR, 0) * the row header (BBINDEX_ROWHEADERBAR, 1) * the table (BBINDEX_TABLE, 2) However, that doesn't make sense, because the row and column headers and the table are children of the AccessibleBrowseBox, not the AccessibleBrowseBoxTable, and the AccessibleBrowseBoxTableCells are children of the AccessibleBrowseBoxTable, not the AccessibleBrowseBox, so whatever children the AccessibleBrowseBox has is irrelevant for the cell's child index. The incorrect index could be seen like this: 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 accessible object for the table (which has an accessible name of "Table"). 5) Request the child index from the child at index 0 Without this change in place, this is incorrect (0 != 3): In [2]: acc.get_child_at_index(0).get_index_in_parent() Out[2]: 3 With this change in place, this is now 0 as expected: In [3]: acc.get_child_at_index(0).get_index_in_parent() Out[3]: 0 This also makes Accerciser's bookmark feature work for these table cells, i.e. creating a bookmark for a cell and then jumping to that bookmark later will now select the correct cell in the treeview again instead of a different one. Change-Id: Ic1a074cf604a0d0342dd9e2d4b62b58866b78351 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181237 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/include/vcl/accessibility/AccessibleBrowseBoxTableCell.hxx b/include/vcl/accessibility/AccessibleBrowseBoxTableCell.hxx index 11faa3f1e639..84dc81530b47 100644 --- a/include/vcl/accessibility/AccessibleBrowseBoxTableCell.hxx +++ b/include/vcl/accessibility/AccessibleBrowseBoxTableCell.hxx @@ -31,8 +31,6 @@ class VCL_DLLPUBLIC AccessibleBrowseBoxTableCell final public ::comphelper::OCommonAccessibleText { private: - sal_Int32 m_nOffset; - // OCommonAccessibleText virtual OUString implGetText() final override; virtual css::lang::Locale implGetLocale() override; @@ -42,8 +40,7 @@ public: AccessibleBrowseBoxTableCell( const css::uno::Reference< css::accessibility::XAccessible >& _rxParent, ::vcl::IAccessibleTableProvider& _rBrowseBox, sal_Int32 _nRowId, - sal_uInt16 _nColId, - sal_Int32 _nOffset ); + sal_uInt16 _nColId); // XEventListener using AccessibleBrowseBoxBase::disposing; diff --git a/include/vcl/accessibletableprovider.hxx b/include/vcl/accessibletableprovider.hxx index bc43c4735d95..15529f67e5bd 100644 --- a/include/vcl/accessibletableprovider.hxx +++ b/include/vcl/accessibletableprovider.hxx @@ -28,9 +28,6 @@ namespace vcl { -#define OFFSET_DEFAULT (sal_Int32(-1)) -#define OFFSET_NONE (sal_Int32(0)) - enum AccessibleTableChildIndex { /** Child index of the column header bar (first row). Exists always. */ diff --git a/svtools/source/brwbox/brwbox3.cxx b/svtools/source/brwbox/brwbox3.cxx index 9702274edb38..8eaa3d4986f1 100644 --- a/svtools/source/brwbox/brwbox3.cxx +++ b/svtools/source/brwbox/brwbox3.cxx @@ -91,8 +91,7 @@ Reference< XAccessible > BrowseBox::CreateAccessibleCell( sal_Int32 _nRow, sal_u // BBINDEX_TABLE must be the table OSL_ENSURE(m_xAccessible, "Invalid call: Accessible is null"); - return new AccessibleBrowseBoxTableCell(getAccessibleTable(), *this, _nRow, _nColumnPos, - OFFSET_DEFAULT); + return new AccessibleBrowseBoxTableCell(getAccessibleTable(), *this, _nRow, _nColumnPos); } diff --git a/vcl/source/accessibility/AccessibleBrowseBoxTableCell.cxx b/vcl/source/accessibility/AccessibleBrowseBoxTableCell.cxx index da7b66a8974b..b477224c99c3 100644 --- a/vcl/source/accessibility/AccessibleBrowseBoxTableCell.cxx +++ b/vcl/source/accessibility/AccessibleBrowseBoxTableCell.cxx @@ -65,10 +65,9 @@ void AccessibleBrowseBoxTableCell::implGetSelection( sal_Int32& nStartIndex, sal AccessibleBrowseBoxTableCell::AccessibleBrowseBoxTableCell( const Reference<XAccessible>& _rxParent, vcl::IAccessibleTableProvider& _rBrowseBox, - sal_Int32 _nRowPos, sal_uInt16 _nColPos, sal_Int32 _nOffset) + sal_Int32 _nRowPos, sal_uInt16 _nColPos) : ImplInheritanceHelper(_rxParent, _rBrowseBox, nullptr, _nRowPos, _nColPos) { - m_nOffset = ( _nOffset == OFFSET_DEFAULT ) ? sal_Int32(vcl::BBINDEX_FIRSTCONTROL) : _nOffset; sal_Int32 nIndex = getIndex_Impl( _nRowPos, _nColPos, _rBrowseBox.GetColumnCount() ); setAccessibleName( _rBrowseBox.GetAccessibleObjectName( AccessibleBrowseBoxObjType::TableCell, nIndex ) ); setAccessibleDescription( _rBrowseBox.GetAccessibleObjectDescription( AccessibleBrowseBoxObjType::TableCell, nIndex ) ); @@ -169,7 +168,7 @@ sal_Int64 SAL_CALL AccessibleBrowseBoxTableCell::getAccessibleIndexInParent() SolarMethodGuard aGuard(getMutex()); ensureIsAlive(); - return /*vcl::BBINDEX_FIRSTCONTROL*/ m_nOffset + (static_cast<sal_Int64>(getRowPos()) * static_cast<sal_Int64>(mpBrowseBox->GetColumnCount())) + getColumnPos(); + return (static_cast<sal_Int64>(getRowPos()) * static_cast<sal_Int64>(mpBrowseBox->GetColumnCount())) + getColumnPos(); } sal_Int32 SAL_CALL AccessibleBrowseBoxTableCell::getCaretPosition( ) diff --git a/vcl/source/treelist/svtabbx.cxx b/vcl/source/treelist/svtabbx.cxx index ffd946e1b53b..54c83e79ea91 100644 --- a/vcl/source/treelist/svtabbx.cxx +++ b/vcl/source/treelist/svtabbx.cxx @@ -871,7 +871,7 @@ Reference< XAccessible > SvHeaderTabListBox::CreateAccessibleCell( sal_Int32 _nR eState, false); else xChild = new AccessibleBrowseBoxTableCell(m_xAccessible->getTable(), *this, _nRow, - _nColumnPos, OFFSET_NONE); + _nColumnPos); return xChild; } commit d4029719366042b1a5d38e4f5e73c66c2eb08f69 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Fri Feb 7 10:16:26 2025 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Feb 7 20:59:41 2025 +0100 browsebox a11y: Drop unused iface method impls in BrowseBox Those 2 implementations of IAccessibleTableProvider methods are both overriden in the only direct subclass EditBrowseBox, so there's no need for those dummy implementations in the base class. Change-Id: I59fd87c4981aee91d328d4ff591e155b7356799a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181236 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/include/svtools/brwbox.hxx b/include/svtools/brwbox.hxx index fbf29fcf8d33..dc2a7d336d19 100644 --- a/include/svtools/brwbox.hxx +++ b/include/svtools/brwbox.hxx @@ -731,16 +731,6 @@ public: css::accessibility::XAccessible > CreateAccessibleColumnHeader( sal_uInt16 nColumnPos ) override; - /** @return The count of additional controls of the control area. */ - virtual sal_Int32 GetAccessibleControlCount() const override; - - /** Creates the accessible object of an additional control. - @param nIndex The 0-based index of the control. - @return The XAccessible interface of the specified control. */ - virtual css::uno::Reference< - css::accessibility::XAccessible > - CreateAccessibleControl( sal_Int32 nIndex ) override; - /** Converts a point relative to the data window origin to a cell address. @param rnRow Out-parameter that takes the row index. @param rnColumnId Out-parameter that takes the column ID. diff --git a/svtools/source/brwbox/brwbox3.cxx b/svtools/source/brwbox/brwbox3.cxx index 2aa838318d94..9702274edb38 100644 --- a/svtools/source/brwbox/brwbox3.cxx +++ b/svtools/source/brwbox/brwbox3.cxx @@ -111,20 +111,6 @@ Reference< XAccessible > BrowseBox::CreateAccessibleColumnHeader( sal_uInt16 _nC getAccessibleHeaderBar(AccessibleBrowseBoxObjType::ColumnHeaderBar)); } - -sal_Int32 BrowseBox::GetAccessibleControlCount() const -{ - return 0; -} - - -Reference< XAccessible > BrowseBox::CreateAccessibleControl( sal_Int32 ) -{ - SAL_WARN( "svtools", "BrowseBox::CreateAccessibleControl: to be overwritten!" ); - return nullptr; -} - - // Conversions ---------------------------------------------------------------- bool BrowseBox::ConvertPointToCellAddress(