diff options
-rw-r--r-- | include/svx/svdmrkv.hxx | 6 | ||||
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/view/drawvie3.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin4.cxx | 2 | ||||
-rw-r--r-- | svx/source/svdraw/sdrpagewindow.cxx | 13 | ||||
-rw-r--r-- | svx/source/svdraw/svdmrkv.cxx | 9 |
6 files changed, 34 insertions, 4 deletions
diff --git a/include/svx/svdmrkv.hxx b/include/svx/svdmrkv.hxx index d4ece164bece..ec9055711c3f 100644 --- a/include/svx/svdmrkv.hxx +++ b/include/svx/svdmrkv.hxx @@ -130,6 +130,9 @@ protected: // flag to completely disable handles at the view bool mbMarkHandlesHidden : 1; + // flag indicating whether all x coordinates are negated or not + bool mbNegativeX : 1; + // Helper to get a possible GridOffset from SdrObject bool getPossibleGridOffsetForSdrObject( basegfx::B2DVector& rOffset, @@ -240,6 +243,9 @@ public: bool HasMarkableObj() const { return MarkableObjectsExceed(0); }; + /// whether all x coordinates in use are negated or not + void SetNegativeX(bool bOn) { mbNegativeX = bOn; } + bool IsNegativeX() const { return mbNegativeX; } // migrate selections diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 80ac5e29db7e..2525b360d1a3 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -578,7 +578,13 @@ void ScModelObj::setPart( int nPart, bool /*bAllowChangeFocus*/ ) ScTabView* pTabView = pViewData->GetView(); if (pTabView) + { + if (SdrView* pDrawView = pViewData->GetViewShell()->GetScDrawView()) + pDrawView->SetNegativeX(comphelper::LibreOfficeKit::isActive() && + pViewData->GetDocument().IsLayoutRTL(nPart)); + pTabView->SelectTabPage(nPart + 1); + } } int ScModelObj::getParts() diff --git a/sc/source/ui/view/drawvie3.cxx b/sc/source/ui/view/drawvie3.cxx index 88c74b442bfe..ce4d132b87e4 100644 --- a/sc/source/ui/view/drawvie3.cxx +++ b/sc/source/ui/view/drawvie3.cxx @@ -25,6 +25,7 @@ #include <svx/svdoole2.hxx> #include <svx/ImageMapInfo.hxx> #include <sfx2/viewfrm.hxx> +#include <comphelper/lok.hxx> #include <svtools/optionsdrawinglayer.hxx> #include <strings.hrc> @@ -49,6 +50,7 @@ ScDrawView::ScDrawView( pDropMarkObj( nullptr ), bInConstruct( true ) { + SetNegativeX(comphelper::LibreOfficeKit::isActive() && rDoc.IsLayoutRTL(nTab)); // #i73602# Use default from the configuration SetBufferedOverlayAllowed(SvtOptionsDrawinglayer::IsOverlayBuffer_Calc()); diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 5a21738bb9c3..42ce441e53d1 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -1609,6 +1609,8 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice, new FmFormView( *pModel, &rDevice)); + + mpLOKDrawView->SetNegativeX(bLayoutRTL); mpLOKDrawView->ShowSdrPage(mpLOKDrawView->GetModel()->GetPage(nTab)); aOutputData.SetDrawView(mpLOKDrawView.get()); aOutputData.SetSpellCheckContext(mpSpellCheckCxt.get()); 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()) |