From c3a108217d5a43c84554d8a8252d063d9bbb72b4 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Fri, 18 Sep 2026 10:32:12 +0200 Subject: [PATCH] toolkit: Move TableControl::ConvertPointToCellAddress logic to its impl Most of the TableControl logic is already implemented in its implementation class, TableControl_Impl and most TableControl methods just forward to the corresponding TableControl_Impl ones. This commit is part of a series to implement that approach for more methods by moving the logic to TableControl_Impl, to make the handling more consistent and prepare for merging TableControl and TableControl_Impl in an upcoming commit. Change-Id: Ibf26eebf0506d6cfc5448064075eae9412ff1fc9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211153 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- toolkit/inc/controls/table/tablecontrol_impl.hxx | 1 + toolkit/source/controls/table/tablecontrol.cxx | 4 +--- toolkit/source/controls/table/tablecontrol_impl.cxx | 8 ++++++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/toolkit/inc/controls/table/tablecontrol_impl.hxx b/toolkit/inc/controls/table/tablecontrol_impl.hxx index 9f0cf2f498ad..2935b87900f0 100644 --- a/toolkit/inc/controls/table/tablecontrol_impl.hxx +++ b/toolkit/inc/controls/table/tablecontrol_impl.hxx @@ -338,6 +338,7 @@ public: ScrollBar* getHorzScrollbar() { return m_pHScroll; } ScrollBar* getVertScrollbar() { return m_pVScroll; } + bool convertPointToCellAddress(sal_Int32& rRow, sal_Int32& rColPos, const Point& rPoint); tools::Rectangle calcHeaderRect(bool bColHeader); tools::Rectangle calcHeaderCellRect(bool bColHeader, sal_Int32 nPos); tools::Rectangle calcTableRect() const; diff --git a/toolkit/source/controls/table/tablecontrol.cxx b/toolkit/source/controls/table/tablecontrol.cxx index f15666dde6be..4f542be4c3f1 100644 --- a/toolkit/source/controls/table/tablecontrol.cxx +++ b/toolkit/source/controls/table/tablecontrol.cxx @@ -454,9 +454,7 @@ sal_Int32 TableControl::GetColumnCount() const { return m_pImpl->getColumnCount( bool TableControl::ConvertPointToCellAddress(sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint) { - _rnRow = m_pImpl->getRowAtPoint(_rPoint); - _rnColPos = m_pImpl->getColAtPoint(_rPoint); - return _rnRow >= 0; + return m_pImpl->convertPointToCellAddress(_rnRow, _rnColPos, _rPoint); } void TableControl::FillAccessibleStateSetForCell(sal_Int64& _rStateSet, sal_Int32 _nRow, diff --git a/toolkit/source/controls/table/tablecontrol_impl.cxx b/toolkit/source/controls/table/tablecontrol_impl.cxx index d6e5cb850d67..b7bebca1cd23 100644 --- a/toolkit/source/controls/table/tablecontrol_impl.cxx +++ b/toolkit/source/controls/table/tablecontrol_impl.cxx @@ -2180,6 +2180,14 @@ void TableControl_Impl::commitTableEvent(sal_Int16 const i_eventID, const Any& i m_xAccessibleTable->commitTableEvent(i_eventID, i_newValue, i_oldValue); } +bool TableControl_Impl::convertPointToCellAddress(sal_Int32& rRow, sal_Int32& rColPos, + const Point& rPoint) +{ + rRow = getRowAtPoint(rPoint); + rColPos = getColAtPoint(rPoint); + return rRow >= 0; +} + tools::Rectangle TableControl_Impl::calcHeaderRect(bool bColHeader) { tools::Rectangle const aRectTableWithHeaders(impl_getAllVisibleCellsArea());