[Libreoffice-commits] core.git: comphelper/source desktop/source include/comphelper sc/source

2019-11-05 Thread Michael Meeks (via logerrit)
 comphelper/source/misc/lok.cxx |2 +-
 desktop/source/lib/init.cxx|8 +---
 include/comphelper/lok.hxx |4 ++--
 sc/source/ui/unoobj/docuno.cxx |   10 +-
 sc/source/ui/view/gridwin4.cxx |   31 +--
 5 files changed, 18 insertions(+), 37 deletions(-)

New commits:
commit 854caac9191b0d6a32fc1d4c9d110f11e7d1a311
Author: Michael Meeks 
AuthorDate: Mon Oct 28 20:43:46 2019 +
Commit: Michael Meeks 
CommitDate: Wed Nov 6 01:18:53 2019 +0100

Revert "sc lok: Implement hi-dpi and zoom for spreadsheets."

This reverts commit 498dceb43f870bf9e380f1f87e99c6ccadf1963c.

Change-Id: Iadb9da47cf8c9a57385530ab888d55169db7639a
Reviewed-on: https://gerrit.libreoffice.org/82088
Tested-by: Jenkins
Reviewed-by: Michael Meeks 

diff --git a/comphelper/source/misc/lok.cxx b/comphelper/source/misc/lok.cxx
index b18314d155e5..4c1337dd927e 100644
--- a/comphelper/source/misc/lok.cxx
+++ b/comphelper/source/misc/lok.cxx
@@ -40,7 +40,7 @@ static Compat g_eCompatFlags(Compat::none);
 
 static LanguageTag g_aLanguageTag("en-US", true);
 
-/// Scaling of the cairo or CoreGraphics canvas painting for HiDPI or zooming 
in Calc.
+/// Scaling of the cairo canvas painting for hi-dpi
 static double g_fDPIScale(1.0);
 
 /// List of  pairs
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index ef201b32061e..5b5b301cdee9 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2720,15 +2720,9 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis,
 // would do - because that one is trying to fit the lines between cells to 
integer multiples of
 // pixels.
 comphelper::ScopeGuard dpiScaleGuard([]() { 
comphelper::LibreOfficeKit::setDPIScale(1.0); });
-double fDPIScaleX = 1.0;
-if (doc_getDocumentType(pThis) == LOK_DOCTYPE_SPREADSHEET)
-{
-fDPIScaleX = (nCanvasWidth * 3840.0) / (256.0 * nTileWidth);
-assert(fabs(fDPIScaleX - ((nCanvasHeight * 3840.0) / (256.0 * 
nTileHeight))) < 0.0001);
-comphelper::LibreOfficeKit::setDPIScale(fDPIScaleX);
-}
 
 #if defined(IOS)
+double fDPIScaleX = 1.0;
 paintTileIOS(pThis, pBuffer, nCanvasWidth, nCanvasHeight, fDPIScaleX, 
nTilePosX, nTilePosY, nTileWidth, nTileHeight);
 #else
 ScopedVclPtrInstance< VirtualDevice > pDevice(DeviceFormat::DEFAULT);
diff --git a/include/comphelper/lok.hxx b/include/comphelper/lok.hxx
index 22d2c6931ab3..b4658913f0d1 100644
--- a/include/comphelper/lok.hxx
+++ b/include/comphelper/lok.hxx
@@ -65,9 +65,9 @@ COMPHELPER_DLLPUBLIC void setTiledPainting(bool 
bTiledPainting);
 COMPHELPER_DLLPUBLIC bool isDialogPainting();
 /// Set if we are painting the dialog.
 COMPHELPER_DLLPUBLIC void setDialogPainting(bool bDialogPainting);
-/// Set the DPI scale for rendering for HiDPI displays.  Used also for zoom in 
Calc.
+/// Set the DPI scale for rendering for HiDPI displays.
 COMPHELPER_DLLPUBLIC void setDPIScale(double fDPIScale);
-/// Get the DPI scale for rendering for HiDPI displays.  Used also for zoom in 
Calc.
+/// Get the DPI scale for rendering for HiDPI displays.
 COMPHELPER_DLLPUBLIC double getDPIScale();
 /// Set if we want no annotations rendering
 COMPHELPER_DLLPUBLIC void setTiledAnnotations(bool bTiledAnnotations);
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 689b785ab982..9b0ae9763001 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -888,12 +888,12 @@ bool ScModelObj::isMimeTypeSupported()
 return EditEngine::HasValidData(aDataHelper.GetTransferable());
 }
 
-void ScModelObj::setClientZoom(int /*nTilePixelWidth_*/, int 
/*nTilePixelHeight_*/, int /*nTileTwipWidth_*/, int /*nTileTwipHeight_*/)
+void ScModelObj::setClientZoom(int nTilePixelWidth_, int nTilePixelHeight_, 
int nTileTwipWidth_, int nTileTwipHeight_)
 {
-mnTilePixelWidth = 256;
-mnTilePixelHeight = 256;
-mnTileTwipWidth = mnTilePixelWidth * TWIPS_PER_PIXEL;
-mnTileTwipHeight = mnTilePixelHeight * TWIPS_PER_PIXEL;
+mnTilePixelWidth = nTilePixelWidth_;
+mnTilePixelHeight = nTilePixelHeight_;
+mnTileTwipWidth = nTileTwipWidth_;
+mnTileTwipHeight = nTileTwipHeight_;
 }
 
 OUString ScModelObj::getRowColumnHeaders(const tools::Rectangle& rRectangle)
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 76041fdc5b7a..9f924931b09b 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1129,30 +1129,17 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
 // coords only, and avoid all the SetMapMode()'s.
 // Similarly to Writer, we should set the mapmode once on the rDevice, and
 // not care about any zoom settings.
-//
-// But until that happens, we actually draw everything at 100%, and only
-// set cairo's or CoreGraphic's scale factor accordingly, so that 
everything
-// is painted  bigger or smaller. This is differ

[Libreoffice-commits] core.git: comphelper/source desktop/source include/comphelper sc/source

2019-07-23 Thread Mike Kaganski (via logerrit)
 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(-)

New commits:
commit 91a3f58ec3ac7998688cab665322d26d5aa3b015
Author: Mike Kaganski 
AuthorDate: Fri Jul 12 20:01:57 2019 +1000
Commit: Mike Kaganski 
CommitDate: Tue Jul 23 15:54:48 2019 +0200

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 

diff --git a/comphelper/source/misc/lok.cxx b/comphelper/source/misc/lok.cxx
index 0ea263f20885..0c43c3fc0822 100644
--- a/comphelper/source/misc/lok.cxx
+++ b/comphelper/source/misc/lok.cxx
@@ -35,6 +35,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 HiDPI or zooming 
in Calc.
@@ -130,6 +132,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 1a18e296a092..b553ba6b8b17 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -4909,6 +4909,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 5f132f9d15f8..aaa3b48e6ae0 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 5e1280cbd98f..8fc6391a665e 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));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits