summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sc/source/ui/view/drawview.cxx16
-rw-r--r--sc/source/ui/view/gridwin4.cxx20
2 files changed, 23 insertions, 13 deletions
diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx
index 43704c80e17d..86042772f399 100644
--- a/sc/source/ui/view/drawview.cxx
+++ b/sc/source/ui/view/drawview.cxx
@@ -965,7 +965,7 @@ void ScDrawView::SyncForGrid( SdrObject* pObj )
Point aCurPosHmm = pGridWin->PixelToLogic(aCurPos, aDrawMode );
Point aGridOff = aCurPosHmm - aOldPos;
// fdo#63878 Fix the X position for RTL Sheet
- if( rDoc.IsNegativePage( GetTab() ) )
+ if( rDoc.IsNegativePage( GetTab() ) && !comphelper::LibreOfficeKit::isActive() )
aGridOff.setX( aCurPosHmm.getX() + aOldPos.getX() );
}
@@ -1044,13 +1044,16 @@ bool ScDrawView::calculateGridOffsetForSdrObject(
Point aCurPosHmm(pGridWin->PixelToLogic(aCurPos, aDrawMode));
Point aGridOff(aCurPosHmm - aOldPos);
+ bool bLOKActive = comphelper::LibreOfficeKit::isActive();
+ bool bNegativePage = rDoc.IsNegativePage(GetTab());
+
// fdo#63878 Fix the X position for RTL Sheet
- if(rDoc.IsNegativePage(GetTab()))
+ if(bNegativePage && !bLOKActive)
{
aGridOff.setX(aCurPosHmm.getX() + aOldPos.getX());
}
- rTarget.setX(aGridOff.X());
+ rTarget.setX(bNegativePage && bLOKActive ? -aGridOff.X() : aGridOff.X());
rTarget.setY(aGridOff.Y());
return true;
}
@@ -1092,13 +1095,16 @@ bool ScDrawView::calculateGridOffsetForB2DRange(
Point aCurPosHmm(pGridWin->PixelToLogic(aCurPos, aDrawMode));
Point aGridOff(aCurPosHmm - aOldPos);
+ bool bLOKActive = comphelper::LibreOfficeKit::isActive();
+ bool bNegativePage = rDoc.IsNegativePage(GetTab());
+
// fdo#63878 Fix the X position for RTL Sheet
- if(rDoc.IsNegativePage(GetTab()))
+ if(bNegativePage && !bLOKActive)
{
aGridOff.setX(aCurPosHmm.getX() + aOldPos.getX());
}
- rTarget.setX(aGridOff.X());
+ rTarget.setX(bLOKActive && bNegativePage ? -aGridOff.X() : aGridOff.X());
rTarget.setY(aGridOff.Y());
return true;
}
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 827ae1074175..83cb7459afa9 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -729,17 +729,20 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
}
tools::Rectangle aDrawingRectLogic;
bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
+ bool bLokRTL = bLayoutRTL && bIsTiledRendering;
std::unique_ptr<ScLokRTLContext> pLokRTLCtxt(
- bIsTiledRendering && bLayoutRTL ?
+ bLokRTL ?
new ScLokRTLContext(aOutputData, aOriginalMode.GetOrigin().X() / TWIPS_PER_PIXEL) :
nullptr);
{
// get drawing pixel rect
- tools::Rectangle aDrawingRectPixel(Point(nScrX, nScrY), Size(aOutputData.GetScrW(), aOutputData.GetScrH()));
+ tools::Rectangle aDrawingRectPixel(
+ bLokRTL ? Point(-(nScrX + aOutputData.GetScrW()), nScrY) : Point(nScrX, nScrY),
+ Size(aOutputData.GetScrW(), aOutputData.GetScrH()));
// correct for border (left/right)
- if(rDoc.MaxCol() == nX2)
+ if(rDoc.MaxCol() == nX2 && !bLokRTL)
{
if(bLayoutRTL)
{
@@ -960,7 +963,8 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
if (bIsTiledRendering)
{
Point aOrigin = aOriginalMode.GetOrigin();
- Size aPixelOffset(aOrigin.getX() / TWIPS_PER_PIXEL, aOrigin.getY() / TWIPS_PER_PIXEL);
+ tools::Long nXOffset = bLayoutRTL ? (-aOrigin.getX() / TWIPS_PER_PIXEL + aOutputData.GetScrW()) : aOrigin.getX() / TWIPS_PER_PIXEL;
+ Size aPixelOffset(nXOffset, aOrigin.getY() / TWIPS_PER_PIXEL);
pContentDev->SetPixelOffset(aPixelOffset);
comphelper::LibreOfficeKit::setLocalRendering();
}
@@ -1081,7 +1085,7 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
Point aStart = mrViewData.GetScrPos( nCol1, nRow1, eOtherWhich );
Point aEnd = mrViewData.GetScrPos( nCol2+1, nRow2+1, eOtherWhich );
- if (bIsTiledRendering && bLayoutRTL)
+ if (bLokRTL)
{
// Transform the cell range X coordinates such that the edit cell area is
// horizontally mirrored w.r.t the (combined-)tile.
@@ -1095,7 +1099,7 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
aEnd.AdjustY( -2 );
tools::Rectangle aBackground(aStart, aEnd);
- if (bIsTiledRendering && bLayoutRTL)
+ if (bLokRTL)
aBackground.Justify();
// Need to draw the background in absolute coords.
@@ -1171,7 +1175,7 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
Point aStart = mrViewData.GetScrPos( nCol1, nRow1, eWhich );
Point aEnd = mrViewData.GetScrPos( nCol2+1, nRow2+1, eWhich );
- if (bIsTiledRendering && bLayoutRTL)
+ if (bLokRTL)
{
// Transform the cell range X coordinates such that the edit cell area is
// horizontally mirrored w.r.t the (combined-)tile.
@@ -1186,7 +1190,7 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
// set the correct mapmode
tools::Rectangle aBackground(aStart, aEnd);
- if (bIsTiledRendering && bLayoutRTL)
+ if (bLokRTL)
aBackground.Justify();
tools::Rectangle aBGAbs(aBackground);