sc/source/ui/view/tabview.cxx | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-)
New commits: commit adf1182bbd865206d412274027c942071e760127 Author: Dennis Francis <dennis.fran...@collabora.com> AuthorDate: Sat May 23 10:47:10 2020 +0530 Commit: Dennis Francis <dennis.fran...@collabora.com> CommitDate: Sat Jul 4 15:32:52 2020 +0200 use helper-class ScRangeProvider in getRowColumnHeader() and avoid some code repetitions. Change-Id: I3e006bc8d9880f3e1ec892aa8f2423edbf9bbf14 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96972 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Dennis Francis <dennis.fran...@collabora.com> (cherry picked from commit c888a2d7dc3fd770a8e95d0bd23e84f307f1355c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97958 Tested-by: Jenkins diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index 495848f46e50..86b1f4e0e46c 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -2621,6 +2621,10 @@ void ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle, tools::J mnLOKStartHeaderCol + 1, mnLOKStartHeaderRow + 1, mnLOKEndHeaderCol, mnLOKEndHeaderRow); + ScRangeProvider aRangeProvider(rRectangle, /* bInPixels */ false, aViewData, + /* nEnlargeX */ 2, /* nEnlargeY */ 2); + const ScRange& rCellRange = aRangeProvider.getCellRange(); + /// *** start collecting ROWS *** /// 1) compute start and end rows @@ -2629,17 +2633,9 @@ void ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle, tools::J { SAL_INFO("sc.lok.header", "Row Header: compute start/end rows."); long nEndHeightPx = 0; - long nRectTopPx = rRectangle.Top() * aViewData.GetPPTX(); - long nRectBottomPx = rRectangle.Bottom() * aViewData.GetPPTY(); - - const auto& rTopNearest = aViewData.GetLOKHeightHelper().getNearestByPosition(nRectTopPx); - const auto& rBottomNearest = aViewData.GetLOKHeightHelper().getNearestByPosition(nRectBottomPx); - - ScBoundsProvider aBoundingRowsProvider(aViewData, nTab, /*bColumnHeader: */ false); - aBoundingRowsProvider.Compute(rTopNearest, rBottomNearest, nRectTopPx, nRectBottomPx); - aBoundingRowsProvider.EnlargeBy(2); - aBoundingRowsProvider.GetStartIndexAndPosition(nStartRow, nStartHeightPx); - aBoundingRowsProvider.GetEndIndexAndPosition(nEndRow, nEndHeightPx); + nStartRow = rCellRange.aStart.Row(); + nEndRow = rCellRange.aEnd.Row(); + aRangeProvider.getRowPositions(nStartHeightPx, nEndHeightPx); aViewData.GetLOKHeightHelper().removeByIndex(mnLOKStartHeaderRow); aViewData.GetLOKHeightHelper().removeByIndex(mnLOKEndHeaderRow); @@ -2773,17 +2769,9 @@ void ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle, tools::J { SAL_INFO("sc.lok.header", "Column Header: compute start/end columns."); long nEndWidthPx = 0; - long nRectLeftPx = rRectangle.Left() * aViewData.GetPPTX(); - long nRectRightPx = rRectangle.Right() * aViewData.GetPPTY(); - - const auto& rLeftNearest = aViewData.GetLOKWidthHelper().getNearestByPosition(nRectLeftPx); - const auto& rRightNearest = aViewData.GetLOKWidthHelper().getNearestByPosition(nRectRightPx); - - ScBoundsProvider aBoundingColsProvider(aViewData, nTab, /*bColumnHeader: */ true); - aBoundingColsProvider.Compute(rLeftNearest, rRightNearest, nRectLeftPx, nRectRightPx); - aBoundingColsProvider.EnlargeBy(2); - aBoundingColsProvider.GetStartIndexAndPosition(nStartCol, nStartWidthPx); - aBoundingColsProvider.GetEndIndexAndPosition(nEndCol, nEndWidthPx); + nStartCol = rCellRange.aStart.Col(); + nEndCol = rCellRange.aEnd.Col(); + aRangeProvider.getColPositions(nStartWidthPx, nEndWidthPx); aViewData.GetLOKWidthHelper().removeByIndex(mnLOKStartHeaderCol); aViewData.GetLOKWidthHelper().removeByIndex(mnLOKEndHeaderCol); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits