[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - sc/source
Dennis Francis (via logerrit)
logerrit at kemper.freedesktop.org
Sat Jul 4 10:33:18 UTC 2020
sc/source/ui/view/tabview.cxx | 32 ++++++++++----------------------
1 file changed, 10 insertions(+), 22 deletions(-)
New commits:
commit c888a2d7dc3fd770a8e95d0bd23e84f307f1355c
Author: Dennis Francis <dennis.francis at collabora.com>
AuthorDate: Sat May 23 10:47:10 2020 +0530
Commit: Dennis Francis <dennis.francis at collabora.com>
CommitDate: Sat Jul 4 12:32:44 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 <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Dennis Francis <dennis.francis at collabora.com>
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index f2ff907bfbb5..834bc01b9af6 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -2621,6 +2621,10 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle)
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 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle)
{
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);
@@ -2772,17 +2768,9 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle)
{
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);
More information about the Libreoffice-commits
mailing list