diff options
author | Dennis Francis <dennis.francis@collabora.com> | 2021-12-06 13:42:27 +0530 |
---|---|---|
committer | Dennis Francis <dennis.francis@collabora.com> | 2022-02-02 10:10:07 +0100 |
commit | 2c250e8f5007e756afb794944f0be791e2d535f4 (patch) | |
tree | ea3e41eeb2cb11a2386caded95021ccbcd469e41 /svx | |
parent | 9903e1f4957cf14039f4a3cef096cf7a08aedcc0 (diff) |
lokCalcRTL: shapes: do not send negative(X) invalidations
LOK client expects tile invalidations in positive document coordinates
irrespective of RTL flags.
For this introduce a flag mbNegativeX in svx class SdrMarkView to
indicate the case when all x coordinates are negated (this happens only
for the LOK + Calc + RTL mode). Use this flag to counter negate the
x coordinates before sending invalidation rectangles.
Conflicts:
sc/source/ui/view/drawvie3.cxx
Change-Id: I35d8142718b538e55b668a8ee18f3dd1fe433951
(cherry picked from commit 5e37acbaaa0b0891829907331ecacd2d3b67526d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129195
Tested-by: Jenkins
Reviewed-by: Dennis Francis <dennis.francis@collabora.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/svdraw/sdrpagewindow.cxx | 13 | ||||
-rw-r--r-- | svx/source/svdraw/svdmrkv.cxx | 9 |
2 files changed, 18 insertions, 4 deletions
diff --git a/svx/source/svdraw/sdrpagewindow.cxx b/svx/source/svdraw/sdrpagewindow.cxx index aeb337d7a8e5..5facfc45d237 100644 --- a/svx/source/svdraw/sdrpagewindow.cxx +++ b/svx/source/svdraw/sdrpagewindow.cxx @@ -430,7 +430,8 @@ void SdrPageWindow::RedrawLayer(const SdrLayerID* pId, // Invalidate call, used from ObjectContact(OfPageView) in InvalidatePartOfView(...) void SdrPageWindow::InvalidatePageWindow(const basegfx::B2DRange& rRange) { - if (GetPageView().IsVisible() && GetPaintWindow().OutputToWindow()) + bool bLOKActive = comphelper::LibreOfficeKit::isActive(); + if (!bLOKActive && GetPageView().IsVisible() && GetPaintWindow().OutputToWindow()) { OutputDevice& rWindow(GetPaintWindow().GetOutputDevice()); basegfx::B2DRange aDiscreteRange(rRange); @@ -454,15 +455,19 @@ void SdrPageWindow::InvalidatePageWindow(const basegfx::B2DRange& rRange) GetPageView().GetView().InvalidateOneWin(rWindow, aVCLDiscreteRectangle); rWindow.EnableMapMode(bWasMapModeEnabled); } - else if (comphelper::LibreOfficeKit::isActive()) + else if (bLOKActive) { // we don't really have to have a paint window with LOK; OTOH we know // that the drawinglayer units are 100ths of mm, so they are easy to // convert to twips + + // If the shapes use negative X coordinates, make them positive before sending + // the invalidation rectangle. + bool bNegativeX = mpImpl->mrPageView.GetView().IsNegativeX(); const tools::Rectangle aRect100thMM( - static_cast<tools::Long>(floor(rRange.getMinX())), + static_cast<tools::Long>(bNegativeX ? std::max(0.0, ceil(-rRange.getMaxX())) : floor(rRange.getMinX())), static_cast<tools::Long>(floor(rRange.getMinY())), - static_cast<tools::Long>(ceil(rRange.getMaxX())), + static_cast<tools::Long>(bNegativeX ? std::max(0.0, floor(-rRange.getMinX())) : ceil(rRange.getMaxX())), static_cast<tools::Long>(ceil(rRange.getMaxY()))); const tools::Rectangle aRectTwips = o3tl::convert(aRect100thMM, o3tl::Length::mm100, o3tl::Length::twip); diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index 42aa011ab8b4..4406b5f535ff 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -179,6 +179,7 @@ SdrMarkView::SdrMarkView(SdrModel& rSdrModel, OutputDevice* pOut) , mbMrkPntDirty(false) , mbMarkedPointsRectsDirty(false) , mbMarkHandlesHidden(false) + , mbNegativeX(false) { BrkMarkObj(); @@ -273,6 +274,14 @@ void SdrMarkView::modelHasChangedLOKit() } pResultSelection = &aSelection; + + if (mbNegativeX) + { + // Convert to positive X doc-coordinates + tools::Long nTmp = aSelection.Left(); + aSelection.SetLeft(-aSelection.Right()); + aSelection.SetRight(-nTmp); + } } if (SfxViewShell* pViewShell = GetSfxViewShell()) |