summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.com>2020-05-23 10:47:10 +0530
committerDennis Francis <dennis.francis@collabora.com>2020-07-04 12:32:44 +0200
commitc888a2d7dc3fd770a8e95d0bd23e84f307f1355c (patch)
tree3ac7d290a5051bc2a337e868fc76ebb5c4edbf3b /sc/source/ui
parentd64a5efdb8a2db38a5339ae04eb13807ba944ea0 (diff)
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@gmail.com> Reviewed-by: Dennis Francis <dennis.francis@collabora.com>
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/view/tabview.cxx32
1 files changed, 10 insertions, 22 deletions
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);