summaryrefslogtreecommitdiff
path: root/sc/source/ui/view/tabview.cxx
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-05-25 00:39:58 +0530
commitab9a53c4dff622c9ed747cc82c03f67a67f33aed (patch)
tree923dd9215dcc34cc7ea4dcc551f329d347f7e366 /sc/source/ui/view/tabview.cxx
parent9947021efa2481dcda99f987013ea8a0de786536 (diff)
use helper-class ScRangeProvider in getRowColumnHeader()
and avoid some code repetitions. Change-Id: I3e006bc8d9880f3e1ec892aa8f2423edbf9bbf14
Diffstat (limited to 'sc/source/ui/view/tabview.cxx')
-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 f0d272ca7895..7c0bfa847aba 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);