[Libreoffice-commits] core.git: svx/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Fri Apr 30 11:17:18 UTC 2021
svx/source/dialog/weldeditview.cxx | 31 ++++++++++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
New commits:
commit 5f89b8cc5521b683a519b93bbc3da739ed0fd795
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Apr 29 20:33:04 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Apr 30 13:16:40 2021 +0200
extend the selection range so adjacent lines are considered one block
and so we get one border around multiple lines of an editview
selection
Change-Id: Ic641035da1c7d2b891cd6e6193b524e6b581e76f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114895
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/svx/source/dialog/weldeditview.cxx b/svx/source/dialog/weldeditview.cxx
index d59aab1877a6..6e83d079c722 100644
--- a/svx/source/dialog/weldeditview.cxx
+++ b/svx/source/dialog/weldeditview.cxx
@@ -181,8 +181,37 @@ void WeldEditView::DoPaint(vcl::RenderContext& rRenderContext, const tools::Rect
std::vector<basegfx::B2DRange> aLogicRanges;
aLogicRanges.reserve(aLogicRects.size());
+ tools::Long nMinX(LONG_MAX), nMaxX(0), nMinY(LONG_MAX), nMaxY(0);
for (const auto& aRect : aLogicRects)
- aLogicRanges.emplace_back(vcl::unotools::b2DRectangleFromRectangle(aRect));
+ {
+ nMinX = std::min(nMinX, aRect.Left());
+ nMinY = std::min(nMinY, aRect.Top());
+ nMaxX = std::max(nMaxX, aRect.Right());
+ nMaxY = std::max(nMaxY, aRect.Bottom());
+ }
+
+ const Size aLogicPixel(rRenderContext.PixelToLogic(Size(1, 1)));
+ for (const auto& aRect : aLogicRects)
+ {
+ // Extend each range by one pixel so multiple lines touch each
+ // other if adjacent, so the whole set is drawn with a single
+ // border around the lot. But keep the selection within the
+ // original max extents.
+ auto nTop = aRect.Top();
+ if (nTop > nMinY)
+ nTop -= aLogicPixel.Height();
+ auto nBottom = aRect.Bottom();
+ if (nBottom < nMaxY)
+ nBottom += aLogicPixel.Height();
+ auto nLeft = aRect.Left();
+ if (nLeft > nMinX)
+ nLeft -= aLogicPixel.Width();
+ auto nRight = aRect.Right();
+ if (nRight < nMaxX)
+ nRight += aLogicPixel.Width();
+
+ aLogicRanges.emplace_back(nLeft, nTop, nRight, nBottom);
+ }
// get the system's highlight color
const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
More information about the Libreoffice-commits
mailing list