summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.com>2021-11-10 18:51:59 +0530
committerDennis Francis <dennis.francis@collabora.com>2022-01-25 08:21:49 +0100
commit8866098c2ac731ffd878c72d70f38f6a65c17184 (patch)
tree607610fa6b97bdc17a331920f9d36b256990bf95
parent1b728994b89b1518137a538f57ee3d7e6644d8da (diff)
lokCalcRTL: Fix the tile offsets
Change-Id: Id0db3d422c8c47ed6fbbc505ca9a857ac54c033a (cherry picked from commit 250aeac7434f924c82927a9de8a089e42a4fec00) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128889 Tested-by: Jenkins Reviewed-by: Dennis Francis <dennis.francis@collabora.com>
-rw-r--r--sc/source/ui/view/gridwin4.cxx25
1 files changed, 25 insertions, 0 deletions
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 18a8ef76f2cd..f92b92096766 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1326,6 +1326,22 @@ namespace
nBottomRightTileIndex = nEndIndex;
}
+ void lcl_RTLAdjustTileColOffset(ScViewData& rViewData, sal_Int32& nTileColOffset,
+ tools::Long nTileEndPx, sal_Int32 nEndCol, SCTAB nTab,
+ const ScDocument& rDoc, double fPPTX)
+ {
+ auto GetColWidthPx = [&rDoc, nTab, fPPTX](SCCOL nCol) {
+ const sal_uInt16 nSize = rDoc.GetColWidth(nCol, nTab);
+ const tools::Long nSizePx = ScViewData::ToPixel(nSize, fPPTX);
+ return nSizePx;
+ };
+
+ ScPositionHelper rHelper = rViewData.GetLOKWidthHelper();
+ tools::Long nEndColPos = rHelper.computePosition(nEndCol, GetColWidthPx);
+
+ nTileColOffset += (nEndColPos - nTileEndPx - nTileColOffset);
+ }
+
class ScLOKProxyObjectContact final : public sdr::contact::ObjectContactOfPageView
{
private:
@@ -1468,6 +1484,15 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
if (nBottomRightTileRow > MAXTILEDROW)
nBottomRightTileRow = MAXTILEDROW;
+ bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
+
+ if (bLayoutRTL)
+ {
+ lcl_RTLAdjustTileColOffset(mrViewData, nTopLeftTileColOffset,
+ fTileRightPixel, nBottomRightTileCol, nTab,
+ rDoc, fPPTX);
+ }
+
// size of the document including drawings, charts, etc.
SCCOL nEndCol = 0;
SCROW nEndRow = 0;