diff options
author | Rafael Lima <rafael.palma.lima@gmail.com> | 2024-05-24 14:31:04 +0200 |
---|---|---|
committer | Rafael Lima <rafael.palma.lima@gmail.com> | 2024-05-29 14:03:16 +0200 |
commit | a764f661e0e1b94af128cc2290ee6510adad5ffd (patch) | |
tree | 303d6f131037d7a22f3782d08eaabc7c2a3bf35a | |
parent | fc1e6a64bd0517a7e67f08860c29b44d030220eb (diff) |
tdf#161234 New design for the cell outline
The change introduced by commit I9df98 made the cell outline a bit wider than the actual cell. However, that change did not play well with higher zoom levels because:
1) The AutoFill handle disconnected from the cell outline
2) The distance between the outline and the cell was too far in at higher zoom levels
This patch proposes an alternative design that deals with both issues.
Change-Id: Ic3cd7d240f6cfc1af4a39409537e264912ef61b3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167945
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Reviewed-by: Rafael Lima <rafael.palma.lima@gmail.com>
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 2762929ccb9b..1b62cfb695e4 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -6589,7 +6589,8 @@ void ScGridWindow::UpdateCursorOverlay() tools::Long nSizeYPix; mrViewData.GetMergeSizePixel( nX, nY, nSizeXPix, nSizeYPix ); - const double nAdjustBorder(mrViewData.GetZoomX() * 3); + // tdf#143733 Make cell outline wider than the cell + const double nAdjustBorder(2 + mrViewData.GetZoomX()); aScrPos.AdjustX(-nAdjustBorder); aScrPos.AdjustY(-nAdjustBorder); @@ -6888,12 +6889,27 @@ void ScGridWindow::UpdateAutoFillOverlay() tools::Long nSizeYPix; mrViewData.GetMergeSizePixel( nX, nY, nSizeXPix, nSizeYPix ); + // tdf#161234 Make AutoFill handle follow cell outline. This happens only when the + // autofill handle is in the same cell as the outline. Note that nAdjustBorder needs + // to be calculated the same way as in ScGridWindow::UpdateCursorOverlay() + double nAdjustBorder(0); + SCCOL nX2 = mrViewData.GetCurX(); + SCCOL nY2 = mrViewData.GetCurY(); + const ScMergeAttr* pMerge = rDoc.GetAttr(nX2, nY2, nTab, ATTR_MERGE); + if (pMerge->GetColMerge() >= 1 || pMerge->GetRowMerge() >= 1) + { + nX2 += pMerge->GetColMerge() - 1; + nY2 += pMerge->GetRowMerge() - 1; + } + if (nX == nX2 && nY == nY2) + nAdjustBorder = 2 + static_cast<double>(mrViewData.GetZoomX()); + if (bLayoutRTL && !comphelper::LibreOfficeKit::isActive()) - aFillPos.AdjustX( -(nSizeXPix - 2 + (aFillHandleSize.Width() / 2)) ); + aFillPos.AdjustX( -(nSizeXPix + nAdjustBorder + (aFillHandleSize.Width() / 2)) ); else - aFillPos.AdjustX(nSizeXPix - (aFillHandleSize.Width() / 2) ); + aFillPos.AdjustX(nSizeXPix + nAdjustBorder - (aFillHandleSize.Width() / 2) ); - aFillPos.AdjustY(nSizeYPix ); + aFillPos.AdjustY(nSizeYPix + nAdjustBorder); aFillPos.AdjustY( -(aFillHandleSize.Height() / 2) ); tools::Rectangle aFillRect(aFillPos, aFillHandleSize); |