include/vcl/accessiblefactory.hxx | 4 -- toolkit/source/controls/table/AccessibleGridControlHeader.cxx | 19 +--------- toolkit/source/controls/table/AccessibleGridControlTableBase.cxx | 6 +-- vcl/source/accessibility/acc_factory.cxx | 7 --- vcl/source/treelist/svtabbx.cxx | 4 +- 5 files changed, 9 insertions(+), 31 deletions(-)
New commits: commit 2443e39e7b9623d3b69a38af5419a54ae0601e40 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Mon Jan 27 13:22:21 2025 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Mon Jan 27 22:24:06 2025 +0100 toolkit a11y: Simplify AccessibleGridControlHeader::getAccessibleChild Reuse existing AccessibleGridControlHeader::implGetChild instead of duplicating the logic. Change-Id: Id5a89a24d511ff5667d8a512fb7c89394ce9c636 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180791 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/toolkit/source/controls/table/AccessibleGridControlHeader.cxx b/toolkit/source/controls/table/AccessibleGridControlHeader.cxx index 45c6a767c525..8baea20fcf81 100644 --- a/toolkit/source/controls/table/AccessibleGridControlHeader.cxx +++ b/toolkit/source/controls/table/AccessibleGridControlHeader.cxx @@ -58,20 +58,8 @@ AccessibleGridControlHeader::getAccessibleChild( sal_Int64 nChildIndex ) ensureIsValidIndex(nChildIndex); ensureAlive(); - Reference< XAccessible > xChild; - if (m_eObjType == vcl::table::AccessibleTableControlObjType::COLUMNHEADERBAR) - { - rtl::Reference<AccessibleGridControlHeaderCell> pColHeaderCell = new AccessibleGridControlHeaderCell(nChildIndex, this, m_aTable, - vcl::table::AccessibleTableControlObjType::COLUMNHEADERCELL); - xChild = pColHeaderCell; - } - else if (m_eObjType == vcl::table::AccessibleTableControlObjType::ROWHEADERBAR) - { - rtl::Reference<AccessibleGridControlHeaderCell> pRowHeaderCell = new AccessibleGridControlHeaderCell(nChildIndex, this, m_aTable, - vcl::table::AccessibleTableControlObjType::ROWHEADERCELL); - xChild = pRowHeaderCell; - } - return xChild; + + return implGetChild(implGetRow(nChildIndex), implGetColumn(nChildIndex)); } sal_Int64 SAL_CALL AccessibleGridControlHeader::getAccessibleIndexInParent() commit f3cb49e5986e9b02cbecfc989888ddf4f09047c2 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Mon Jan 27 13:18:31 2025 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Mon Jan 27 22:24:01 2025 +0100 toolkit a11y: Ensure non-negative child index Extend AccessibleGridControlTableBase::ensureIsValid{Row,Column,Index} to also check that the index is non-negative and use the existing AccessibleGridControlTableBase::ensureIsValidIndex in AccessibleGridControlHeader::getAccessibleChild. Change-Id: If67fe2e23ee2d22683be072a8ed9ccfb1d9efd57 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180790 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/toolkit/source/controls/table/AccessibleGridControlHeader.cxx b/toolkit/source/controls/table/AccessibleGridControlHeader.cxx index b77d63355b80..45c6a767c525 100644 --- a/toolkit/source/controls/table/AccessibleGridControlHeader.cxx +++ b/toolkit/source/controls/table/AccessibleGridControlHeader.cxx @@ -56,8 +56,7 @@ AccessibleGridControlHeader::getAccessibleChild( sal_Int64 nChildIndex ) { SolarMutexGuard aSolarGuard; - if (nChildIndex<0 || nChildIndex>=getAccessibleChildCount()) - throw IndexOutOfBoundsException(); + ensureIsValidIndex(nChildIndex); ensureAlive(); Reference< XAccessible > xChild; if (m_eObjType == vcl::table::AccessibleTableControlObjType::COLUMNHEADERBAR) diff --git a/toolkit/source/controls/table/AccessibleGridControlTableBase.cxx b/toolkit/source/controls/table/AccessibleGridControlTableBase.cxx index 9df91afb57cc..2d32159bd9cf 100644 --- a/toolkit/source/controls/table/AccessibleGridControlTableBase.cxx +++ b/toolkit/source/controls/table/AccessibleGridControlTableBase.cxx @@ -183,13 +183,13 @@ void AccessibleGridControlTableBase::implGetSelectedRows( Sequence< sal_Int32 >& void AccessibleGridControlTableBase::ensureIsValidRow( sal_Int32 nRow ) { - if (nRow >= getAccessibleRowCount()) + if (nRow < 0 || nRow >= getAccessibleRowCount()) throw lang::IndexOutOfBoundsException( u"row index is invalid"_ustr, *this ); } void AccessibleGridControlTableBase::ensureIsValidColumn( sal_Int32 nColumn ) { - if (nColumn >= getAccessibleColumnCount()) + if (nColumn < 0 || nColumn >= getAccessibleColumnCount()) throw lang::IndexOutOfBoundsException( u"column index is invalid"_ustr, *this ); } @@ -202,7 +202,7 @@ void AccessibleGridControlTableBase::ensureIsValidAddress( void AccessibleGridControlTableBase::ensureIsValidIndex( sal_Int64 nChildIndex ) { - if (nChildIndex >= static_cast<sal_Int64>(m_aTable.GetRowCount()) * static_cast<sal_Int64>(m_aTable.GetColumnCount())) + if (nChildIndex < 0 || nChildIndex >= static_cast<sal_Int64>(m_aTable.GetRowCount()) * static_cast<sal_Int64>(m_aTable.GetColumnCount())) throw lang::IndexOutOfBoundsException( u"child index is invalid"_ustr, *this ); } commit 495089ccfc71a5fdba1a6d5d97300571f9c38439 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Mon Jan 27 11:24:32 2025 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Mon Jan 27 22:23:52 2025 +0100 vcl a11y: No longer use factory to create AccessibleTabListBox Just call the ctor directly, now that the class is inside vcl, too, since commit 9283da858506fe3b4383e4cfe0506e470a4356f6 Author: Michael Weghorn <m.wegh...@posteo.de> Date: Tue Dec 17 12:04:04 2024 +0100 a11y: Merge accessibility module into vcl so there's no more need to use the factory to break a dependency cycle. Change-Id: Ieeae16ba91533820b707e6bf0fd964ba7b8a7cc9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180789 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/include/vcl/accessiblefactory.hxx b/include/vcl/accessiblefactory.hxx index 104c6198848a..db3d35a06d8f 100644 --- a/include/vcl/accessiblefactory.hxx +++ b/include/vcl/accessiblefactory.hxx @@ -94,10 +94,6 @@ public: static css::uno::Reference<css::accessibility::XAccessibleContext> createAccessibleContext(vcl::Window* pWindow); - static vcl::IAccessibleTabListBox* - createAccessibleTabListBox(const css::uno::Reference<css::accessibility::XAccessible>& rxParent, - SvHeaderTabListBox& rBox); - static rtl::Reference<vcl::IAccessibleBrowseBox> createAccessibleBrowseBox(const css::uno::Reference<css::accessibility::XAccessible>& _rxParent, vcl::IAccessibleTableProvider& _rBrowseBox); diff --git a/vcl/source/accessibility/acc_factory.cxx b/vcl/source/accessibility/acc_factory.cxx index 5a81bbb21c37..e1ac5e7b02b8 100644 --- a/vcl/source/accessibility/acc_factory.cxx +++ b/vcl/source/accessibility/acc_factory.cxx @@ -190,13 +190,6 @@ Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext(Forma return new SVTXAccessibleNumericField(pFormattedField); } -vcl::IAccessibleTabListBox* -AccessibleFactory::createAccessibleTabListBox(const Reference<XAccessible>& rxParent, - SvHeaderTabListBox& rBox) -{ - return new AccessibleTabListBox( rxParent, rBox ); -} - rtl::Reference<vcl::IAccessibleBrowseBox> AccessibleFactory::createAccessibleBrowseBox(const Reference<XAccessible>& _rxParent, vcl::IAccessibleTableProvider& _rBrowseBox) diff --git a/vcl/source/treelist/svtabbx.cxx b/vcl/source/treelist/svtabbx.cxx index a792f1c707a6..853a531d7f4a 100644 --- a/vcl/source/treelist/svtabbx.cxx +++ b/vcl/source/treelist/svtabbx.cxx @@ -17,6 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <accessibility/accessibletablistbox.hxx> + #include <comphelper/types.hxx> #include <vcl/accessiblefactory.hxx> #include <vcl/toolkit/svtabbx.hxx> @@ -1163,7 +1165,7 @@ Reference< XAccessible > SvHeaderTabListBox::CreateAccessible() Reference< XAccessible > xAccParent = pParent->GetAccessible(); if ( xAccParent.is() ) { - m_pAccessible = AccessibleFactory::createAccessibleTabListBox( xAccParent, *this ); + m_pAccessible = new accessibility::AccessibleTabListBox(xAccParent, *this); if ( m_pAccessible ) xAccessible = m_pAccessible->getMyself(); }