From a10c3f19c0b6f81ca13d2ab4a882584f5338367f Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Fri, 12 Jul 2019 20:01:57 +1000 Subject: Don't draw gridlines and document background in Online server process ... see https://gerrit.libreoffice.org/72417 They will be drawn client-side. Borders and explicit cell background are still drawn in core. This mode is activated using "sc_no_grid_bg" option in SAL_LOK_OPTIONS environment variable. Change-Id: Ie10e7770b8168ec648d44ae5af0a0a0602d89ee6 Reviewed-on: https://gerrit.libreoffice.org/75484 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- comphelper/source/misc/lok.cxx | 6 ++++++ desktop/source/lib/init.cxx | 3 +++ include/comphelper/lok.hxx | 10 ++++++++++ sc/source/ui/view/gridwin4.cxx | 9 ++++++--- 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/comphelper/source/misc/lok.cxx b/comphelper/source/misc/lok.cxx index e5f3573cb391..4e8f7af1f672 100644 --- a/comphelper/source/misc/lok.cxx +++ b/comphelper/source/misc/lok.cxx @@ -36,6 +36,8 @@ static bool g_bViewIdForVisCursorInvalidation(false); static bool g_bLocalRendering(false); +static Compat g_eCompatFlags(Compat::none); + static LanguageTag g_aLanguageTag("en-US", true); /// Scaling of the cairo or CoreGraphics canvas painting for hi-dpi or zooming in Calc. @@ -131,6 +133,10 @@ bool isLocalRendering() return g_bLocalRendering; } +void setCompatFlag(Compat flag) { g_eCompatFlags = static_cast(g_eCompatFlags | flag); } + +bool isCompatFlagSet(Compat flag) { return (g_eCompatFlags & flag) == flag; } + void setLanguageTag(const LanguageTag& languageTag) { if (g_aLanguageTag != languageTag) diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index ecb3ab752ae8..7ff364ca92e9 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -4890,6 +4890,9 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char bUnipoll = true; else if (it == "profile_events") bProfileZones = true; + else if (it == "sc_no_grid_bg") + comphelper::LibreOfficeKit::setCompatFlag( + comphelper::LibreOfficeKit::Compat::scNoGridBackground); } } diff --git a/include/comphelper/lok.hxx b/include/comphelper/lok.hxx index a2b7eb02bef3..34b4259e60dc 100644 --- a/include/comphelper/lok.hxx +++ b/include/comphelper/lok.hxx @@ -72,6 +72,16 @@ COMPHELPER_DLLPUBLIC void setRangeHeaders(bool bTiledAnnotations); /// Check if range based header data is enabled COMPHELPER_DLLPUBLIC bool isRangeHeaders(); +enum Compat : sal_uInt32 +{ + none = 0, + scNoGridBackground = 1, +}; +/// Set compatibility flags +COMPHELPER_DLLPUBLIC void setCompatFlag(Compat flag); +/// Get compatibility flags +COMPHELPER_DLLPUBLIC bool isCompatFlagSet(Compat flag); + /// Check whether clients want viewId in visible cursor invalidation payload. COMPHELPER_DLLPUBLIC bool isViewIdForVisCursorInvalidation(); diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 99329375b2c2..4d89d32dc755 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -527,6 +527,9 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI ScDocument& rDoc = *pViewData->GetDocument(); const ScViewOptions& rOpts = pViewData->GetOptions(); bool bIsTiledRendering = comphelper::LibreOfficeKit::isActive(); + bool bNoBackgroundAndGrid = bIsTiledRendering + && comphelper::LibreOfficeKit::isCompatFlagSet( + comphelper::LibreOfficeKit::Compat::scNoGridBackground); SCTAB nTab = aOutputData.nTab; SCCOL nX1 = aOutputData.nX1; @@ -710,16 +713,16 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI DrawRedraw( aOutputData, SC_LAYER_BACK ); } else - aOutputData.SetSolidBackground(true); + aOutputData.SetSolidBackground(!bNoBackgroundAndGrid); aOutputData.DrawDocumentBackground(); - if ( bGridFirst && ( bGrid || bPage ) ) + if (bGridFirst && (bGrid || bPage) && !bNoBackgroundAndGrid) aOutputData.DrawGrid(*pContentDev, bGrid, bPage); aOutputData.DrawBackground(*pContentDev); - if ( !bGridFirst && ( bGrid || bPage ) ) + if (!bGridFirst && (bGrid || bPage) && !bNoBackgroundAndGrid) aOutputData.DrawGrid(*pContentDev, bGrid, bPage); pContentDev->SetMapMode(MapMode(MapUnit::MapPixel)); -- cgit