sc/source/ui/inc/output.hxx    |    2 -
 sc/source/ui/view/gridwin4.cxx |   10 ++++++--
 sc/source/ui/view/output.cxx   |   49 +++++++++++++++++++++++++++++++----------
 3 files changed, 47 insertions(+), 14 deletions(-)

New commits:
commit e3fa896aa14c03165190f0fef304ff0e8074d619
Author:     Dennis Francis <dennis.fran...@collabora.com>
AuthorDate: Thu Mar 25 20:57:18 2021 +0530
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Mon Apr 5 13:21:15 2021 +0200

    lok: draw bgcolor lines for covering client grid...
    
    ... that are over merged cells area. This is needed as client has no
    information about merged cells.
    
    Change-Id: I625d64cc3abd0ee1e60a8af9469a152286f25fd0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113145
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Michael Meeks <michael.me...@collabora.com>

diff --git a/sc/source/ui/inc/output.hxx b/sc/source/ui/inc/output.hxx
index 0053055b1265..a832ad9f2bb1 100644
--- a/sc/source/ui/inc/output.hxx
+++ b/sc/source/ui/inc/output.hxx
@@ -334,7 +334,7 @@ public:
 
     void    SetSnapPixel();
 
-    void    DrawGrid(vcl::RenderContext& rRenderContext, bool bGrid, bool 
bPage);
+    void    DrawGrid(vcl::RenderContext& rRenderContext, bool bGrid, bool 
bPage, bool bMergeCover = false);
     void    DrawStrings( bool bPixelToLogic = false );
 
     /// Draw all strings, or provide Rectangle where the text (defined by 
rAddress) would be drawn.
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 7fa1b6c0001c..dce3d4a6d5d4 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -818,8 +818,14 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, 
const ScTableInfo& rTableI
 
     aOutputData.DrawDocumentBackground();
 
-    if (bGridFirst && (bGrid || bPage) && !bNoBackgroundAndGrid)
-        aOutputData.DrawGrid(*pContentDev, bGrid, bPage);
+    if (bGridFirst && (bGrid || bPage))
+    {
+        // Draw lines in background color cover over lok client grid lines in 
merged cell areas if bNoBackgroundAndGrid is set.
+        if (bNoBackgroundAndGrid)
+            aOutputData.DrawGrid(*pContentDev, false /* bGrid */, false /* 
bPage */, true /* bMergeCover */);
+        else
+            aOutputData.DrawGrid(*pContentDev, bGrid, bPage);
+    }
 
     aOutputData.DrawBackground(*pContentDev);
 
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index ced84e795ecd..0aa76721e54a 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -286,8 +286,11 @@ void ScOutputData::SetSyntaxMode( bool bNewMode )
     }
 }
 
-void ScOutputData::DrawGrid(vcl::RenderContext& rRenderContext, bool bGrid, 
bool bPage)
+void ScOutputData::DrawGrid(vcl::RenderContext& rRenderContext, bool bGrid, 
bool bPage, bool bMergeCover)
 {
+    // bMergeCover : Draw lines in sheet bgcolor to cover lok client grid 
lines in merged cell areas.
+    // (Used when scNoGridBackground is set in lok mode.)
+
     SCCOL nX;
     SCROW nY;
     long nPosX;
@@ -323,11 +326,12 @@ void ScOutputData::DrawGrid(vcl::RenderContext& 
rRenderContext, bool bGrid, bool
     // break all the drawing by one change.
     // So until that happens, we need to special case.
     bool bWorksInPixels = bMetaFile;
+    const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig();
+    Color aSheetBGColor = rColorCfg.GetColorValue(::svtools::DOCCOLOR).nColor;
 
     if ( eType == OUTTYPE_WINDOW )
     {
         bWorksInPixels = true;
-        const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig();
         aPageColor = 
rColorCfg.GetColorValue(svtools::CALCPAGEBREAKAUTOMATIC).nColor;
         aManualColor = 
rColorCfg.GetColorValue(svtools::CALCPAGEBREAKMANUAL).nColor;
     }
@@ -349,7 +353,11 @@ void ScOutputData::DrawGrid(vcl::RenderContext& 
rRenderContext, bool bGrid, bool
     long nLayoutSign = bLayoutRTL ? -1 : 1;
     long nSignedOneX = nOneX * nLayoutSign;
 
-    rRenderContext.SetLineColor(aGridColor);
+    if (bGrid)
+        rRenderContext.SetLineColor(aGridColor);
+    else if (bMergeCover)
+        rRenderContext.SetLineColor(aSheetBGColor);
+
     ScGridMerger aGrid(&rRenderContext, nOneX, nOneY);
 
     // vertical lines
@@ -391,17 +399,22 @@ void ScOutputData::DrawGrid(vcl::RenderContext& 
rRenderContext, bool bGrid, bool
                                                         aPageColor );
                         bDashed = true;
                     }
-                    else
+                    else if (bGrid)
                     {
                         rRenderContext.SetLineColor( aGridColor );
                         bDashed = false;
                     }
+                    else if (bMergeCover)
+                    {
+                        rRenderContext.SetLineColor(aSheetBGColor);
+                        bDashed = false;
+                    }
 
                     nBreakOld = nBreak;
                 }
             }
 
-            bool bDraw = bGrid || nBreakOld != ScBreakType::NONE; // simple 
grid only if set that way
+            bool bDraw = bGrid || nBreakOld != ScBreakType::NONE || 
bMergeCover; // simple grid only if set that way
 
             sal_uInt16 nWidthXplus2 = pRowInfo[0].pCellInfo[nXplus2].nWidth;
             bSingle = false; //! get into Fillinfo !!!!!
@@ -451,14 +464,18 @@ void ScOutputData::DrawGrid(vcl::RenderContext& 
rRenderContext, bool bGrid, bool
                             }
                         }
 
-                        if (pThisRowInfo->bChanged && !bHOver)
+                        if (pThisRowInfo->bChanged && !bHOver && bGrid)
+                        {
+                            aGrid.AddVerLine(bWorksInPixels, 
nPosX-nSignedOneX, nPosY, nNextY-nOneY, bDashed);
+                        }
+                        else if (bHOver && bMergeCover)
                         {
                             aGrid.AddVerLine(bWorksInPixels, 
nPosX-nSignedOneX, nPosY, nNextY-nOneY, bDashed);
                         }
                         nPosY = nNextY;
                     }
                 }
-                else
+                else if (bGrid)
                 {
                     aGrid.AddVerLine(bWorksInPixels, nPosX-nSignedOneX, nScrY, 
nScrY+nScrH-nOneY, bDashed);
                 }
@@ -508,17 +525,22 @@ void ScOutputData::DrawGrid(vcl::RenderContext& 
rRenderContext, bool bGrid, bool
                                                         aPageColor );
                         bDashed = true;
                     }
-                    else
+                    else if (bGrid)
                     {
                         rRenderContext.SetLineColor( aGridColor );
                         bDashed = false;
                     }
+                    else if (bMergeCover)
+                    {
+                        rRenderContext.SetLineColor(aSheetBGColor);
+                        bDashed = false;
+                    }
 
                     nBreakOld = nBreak;
                 }
             }
 
-            bool bDraw = bGrid || nBreakOld != ScBreakType::NONE;    // simple 
grid only if set so
+            bool bDraw = bGrid || nBreakOld != ScBreakType::NONE || 
bMergeCover;    // simple grid only if set so
 
             bool bNextYisNextRow = (pRowInfo[nArrYplus1].nRowNo == nYplus1);
             bSingle = !bNextYisNextRow;             // Hidden
@@ -556,7 +578,12 @@ void ScOutputData::DrawGrid(vcl::RenderContext& 
rRenderContext, bool bGrid, bool
                                             ->IsVerOverlapped();
                                     //! nVisY from Array ??
                             }
-                            if (!bVOver)
+
+                            if (!bVOver && bGrid)
+                            {
+                                aGrid.AddHorLine(bWorksInPixels, nPosX, 
nNextX-nSignedOneX, nPosY-nOneY, bDashed);
+                            }
+                            else if (bVOver && bMergeCover)
                             {
                                 aGrid.AddHorLine(bWorksInPixels, nPosX, 
nNextX-nSignedOneX, nPosY-nOneY, bDashed);
                             }
@@ -564,7 +591,7 @@ void ScOutputData::DrawGrid(vcl::RenderContext& 
rRenderContext, bool bGrid, bool
                         nPosX = nNextX;
                     }
                 }
-                else
+                else if (bGrid)
                 {
                     aGrid.AddHorLine(bWorksInPixels, nScrX, nScrX+nScrW-nOneX, 
nPosY-nOneY, bDashed);
                 }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to