sc/source/ui/view/output.cxx |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 2eb8abda788e4f8c1b83281463673848c08ed6e0
Author:     Andreas Heinisch <andreas.heini...@yahoo.de>
AuthorDate: Sat Mar 15 01:03:26 2025 +0100
Commit:     Andreas Heinisch <andreas.heini...@yahoo.de>
CommitDate: Sat Mar 15 12:59:54 2025 +0100

    tdf#135891 - Adjust the x position to ensure the correct starting point
    
    Adjust the x position to correctly align the cell background color to
    the drawn grid.
    
    Change-Id: Ic881a20d970befacfdd8a5076d0547256093a04e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182934
    Reviewed-by: Andreas Heinisch <andreas.heini...@yahoo.de>
    Tested-by: Jenkins

diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index bfac94a70f59..60648f726e85 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -1084,11 +1084,12 @@ void ScOutputData::DrawBackground(vcl::RenderContext& 
rRenderContext)
 
     // See more about bWorksInPixels in ScOutputData::DrawGrid
     bool bWorksInPixels = (eType == OUTTYPE_WINDOW);
+    const tools::Long nOneX = bWorksInPixels ? 1 : nOneXLogic;
+    const tools::Long nLayoutSign = bLayoutRTL ? -1 : 1;
+    const tools::Long nSignedOneX = nOneX * nLayoutSign;
 
     tools::Rectangle aRect;
 
-    tools::Long nLayoutSign = bLayoutRTL ? -1 : 1;
-
     rRenderContext.SetLineColor();
 
     bool bShowProt = mbSyntaxMode && mpDoc->IsTabProtected(nTab);
@@ -1131,9 +1132,8 @@ void ScOutputData::DrawBackground(vcl::RenderContext& 
rRenderContext)
                 }
 
                 tools::Long nPosX = nScrX;
-
                 if ( bLayoutRTL )
-                    nPosX += nMirrorW - 1;
+                    nPosX += nMirrorW - nOneX;
 
                 aRect = tools::Rectangle(nPosX, nPosY - 1, nPosX, nPosY - 1 + 
nRowHeight);
                 if (bWorksInPixels)
@@ -1218,6 +1218,9 @@ void ScOutputData::DrawBackground(vcl::RenderContext& 
rRenderContext)
                     drawCells(rRenderContext, pColor, pBackground, pOldColor, 
pOldBackground, aRect, nPosXLogic, nLayoutSign, nOneXLogic, nOneYLogic, 
pDataBarInfo, pOldDataBarInfo, pIconSetInfo, pOldIconSetInfo, 
mpDoc->GetIconSetBitmapMap());
 
                     nPosX = nNewPosX;
+                    // tdf#135891 - adjust the x position to ensure the 
correct starting point
+                    if (!bWorksInPixels && ((nX == 0 && !bLayoutRTL) || (nX == 
nX1 && bLayoutRTL)))
+                        nPosX += nSignedOneX;
                 }
 
                 tools::Long nPosXLogic = nPosX;

Reply via email to