summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.com>2021-03-25 20:57:18 +0530
committerDennis Francis <dennis.francis@collabora.com>2021-04-07 06:28:27 +0200
commit3092322bb83998397b09d3f34b6d04b5e5c1da50 (patch)
tree9112288a5b73dda83ae29e12d5b4bd87b35d0ae5 /sc
parentd0b4719ca3d4608bcb7431dbeb097146dd5a5127 (diff)
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 <jenkinscollaboraoffice@gmail.com> Reviewed-by: Michael Meeks <michael.meeks@collabora.com> (cherry picked from commit e3fa896aa14c03165190f0fef304ff0e8074d619) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113632 Tested-by: Jenkins Reviewed-by: Dennis Francis <dennis.francis@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/inc/output.hxx2
-rw-r--r--sc/source/ui/view/gridwin4.cxx10
-rw-r--r--sc/source/ui/view/output.cxx49
3 files changed, 47 insertions, 14 deletions
diff --git a/sc/source/ui/inc/output.hxx b/sc/source/ui/inc/output.hxx
index b3079259f8b0..64720edf5e85 100644
--- a/sc/source/ui/inc/output.hxx
+++ b/sc/source/ui/inc/output.hxx
@@ -336,7 +336,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 18adeb9af620..7dde48a0e4dc 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -831,8 +831,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 fc1750f53e14..93b542b2c851 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -288,8 +288,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;
tools::Long nPosX;
@@ -325,11 +328,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;
}
@@ -351,7 +355,11 @@ void ScOutputData::DrawGrid(vcl::RenderContext& rRenderContext, bool bGrid, bool
tools::Long nLayoutSign = bLayoutRTL ? -1 : 1;
tools::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
@@ -393,17 +401,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 !!!!!
@@ -453,14 +466,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);
}
@@ -510,17 +527,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
@@ -558,7 +580,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);
}
@@ -566,7 +593,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);
}