[Libreoffice-commits] core.git: Branch 'feature/calczoom' - 8 commits - comphelper/source desktop/qa desktop/source include/comphelper libreofficekit/qa sc/source sw/source

Michael Meeks (via logerrit) logerrit at kemper.freedesktop.org
Fri Nov 1 15:46:00 UTC 2019


Rebased ref, commits from common ancestor:
commit f614921b06b596341f6e672e84a2e1c2c87020b7
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Fri Nov 1 15:40:43 2019 +0000
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Nov 1 15:40:43 2019 +0000

    sc lok: cope with non 100% zoom better.
    
    Do the tile rendering and alignment ourselves. More work required
    to get cleaner conversion between view and document twips (view
    twips being rounded to produce nice round pixel sizes when
    re-converted).
    
    Change-Id: I51edb186cfd2dc434005cc074f4ed8de19c85cb3

diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx
index 52da7fba5c5b..24dd5e69a275 100644
--- a/sc/source/ui/inc/viewdata.hxx
+++ b/sc/source/ui/inc/viewdata.hxx
@@ -161,13 +161,15 @@ class ScBoundsProvider
     const bool bColumnHeader;
     const index_type MAX_INDEX;
 
+    double mfPPTX;
+    double mfPPTY;
     index_type nFirstIndex;
     index_type nSecondIndex;
     long nFirstPositionPx;
     long nSecondPositionPx;
 
 public:
-    ScBoundsProvider(ScDocument* pD, SCTAB nT, bool bColumnHeader);
+    ScBoundsProvider(const ScViewData &rView, SCTAB nT, bool bColumnHeader);
 
     void GetStartIndexAndPosition(SCCOL& nIndex, long& nPosition) const;
     void GetEndIndexAndPosition(SCCOL& nIndex, long& nPosition) const;
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 9f924931b09b..3a54172c8760 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1098,7 +1098,7 @@ namespace
         const auto& rStartNearest = rPositionHelper.getNearestByPosition(nTileStartPosPx);
         const auto& rEndNearest = rPositionHelper.getNearestByPosition(nTileEndPosPx);
 
-        ScBoundsProvider aBoundsProvider(pDoc, nTab, bColumnHeader);
+        ScBoundsProvider aBoundsProvider(*pViewData, nTab, bColumnHeader);
         aBoundsProvider.Compute(rStartNearest, rEndNearest, nTileStartPosPx, nTileEndPosPx);
         aBoundsProvider.GetStartIndexAndPosition(nStartIndex, nStartPosPx); ++nStartIndex;
         aBoundsProvider.GetEndIndexAndPosition(nEndIndex, nEndPosPx);
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 807dc27d4993..8d84742368d4 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -2495,13 +2495,13 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle)
     {
         SAL_INFO("sc.lok.header", "Row Header: compute start/end rows.");
         long nEndHeightPx = 0;
-        long nRectTopPx = rRectangle.Top() / TWIPS_PER_PIXEL;
-        long nRectBottomPx = rRectangle.Bottom() / TWIPS_PER_PIXEL;
+        long nRectTopPx = rRectangle.Top() * aViewData.GetPPTX();
+        long nRectBottomPx = rRectangle.Bottom() * aViewData.GetPPTY();
 
         const auto& rTopNearest = aViewData.GetLOKHeightHelper().getNearestByPosition(nRectTopPx);
         const auto& rBottomNearest = aViewData.GetLOKHeightHelper().getNearestByPosition(nRectBottomPx);
 
-        ScBoundsProvider aBoundingRowsProvider(pDoc, nTab, /*bColumnHeader: */ false);
+        ScBoundsProvider aBoundingRowsProvider(aViewData, nTab, /*bColumnHeader: */ false);
         aBoundingRowsProvider.Compute(rTopNearest, rBottomNearest, nRectTopPx, nRectBottomPx);
         aBoundingRowsProvider.EnlargeBy(2);
         aBoundingRowsProvider.GetStartIndexAndPosition(nStartRow, nStartHeightPx);
@@ -2591,7 +2591,7 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle)
     {
         OUString aText = OUString::number(nStartRow + 1);
         aBuffer.append("{ \"text\": \"").append(aText).append("\", ");
-        aBuffer.append("\"size\": \"").append(OUString::number(nTotalPixels * TWIPS_PER_PIXEL)).append("\", ");
+        aBuffer.append("\"size\": \"").append(OUString::number(nTotalPixels / aViewData.GetPPTX())).append("\", ");
         aBuffer.append("\"groupLevels\": \"").append(OUString::number(nRowGroupDepth)).append("\" }");
     }
 
@@ -2603,7 +2603,7 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle)
         // nSize will be 0 for hidden rows.
         const long nSizePx = lcl_GetRowHeightPx(pDoc, nRow, nTab);
         nTotalPixels += nSizePx;
-        const long nTotalTwips = nTotalPixels * TWIPS_PER_PIXEL;
+        const long nTotalTwips = nTotalPixels / aViewData.GetPPTY();
 
         if (bRangeHeaderSupport && nRowGroupDepth > 0)
         {
@@ -2638,13 +2638,13 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle)
     {
         SAL_INFO("sc.lok.header", "Column Header: compute start/end columns.");
         long nEndWidthPx = 0;
-        long nRectLeftPx = rRectangle.Left() / TWIPS_PER_PIXEL;
-        long nRectRightPx = rRectangle.Right() / TWIPS_PER_PIXEL;
+        long nRectLeftPx = rRectangle.Left() * aViewData.GetPPTX();
+        long nRectRightPx = rRectangle.Right() * aViewData.GetPPTY();
 
         const auto& rLeftNearest = aViewData.GetLOKWidthHelper().getNearestByPosition(nRectLeftPx);
         const auto& rRightNearest = aViewData.GetLOKWidthHelper().getNearestByPosition(nRectRightPx);
 
-        ScBoundsProvider aBoundingColsProvider(pDoc, nTab, /*bColumnHeader: */ true);
+        ScBoundsProvider aBoundingColsProvider(aViewData, nTab, /*bColumnHeader: */ true);
         aBoundingColsProvider.Compute(rLeftNearest, rRightNearest, nRectLeftPx, nRectRightPx);
         aBoundingColsProvider.EnlargeBy(2);
         aBoundingColsProvider.GetStartIndexAndPosition(nStartCol, nStartWidthPx);
@@ -2734,7 +2734,7 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle)
     {
         OUString aText = OUString::number(nStartCol + 1);
         aBuffer.append("{ \"text\": \"").append(aText).append("\", ");
-        aBuffer.append("\"size\": \"").append(OUString::number(nTotalPixels * TWIPS_PER_PIXEL)).append("\", ");
+        aBuffer.append("\"size\": \"").append(OUString::number(nTotalPixels / aViewData.GetPPTY())).append("\", ");
         aBuffer.append("\"groupLevels\": \"").append(OUString::number(nColGroupDepth)).append("\" }");
     }
 
@@ -2746,7 +2746,7 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle)
         // nSize will be 0 for hidden columns.
         const long nSizePx = lcl_GetColWidthPx(pDoc, nCol, nTab);
         nTotalPixels += nSizePx;
-        const long nTotalTwips = nTotalPixels * TWIPS_PER_PIXEL;
+        const long nTotalTwips = nTotalPixels / aViewData.GetPPTY();
 
         if (bRangeHeaderSupport && nColGroupDepth > 0)
         {
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 0eb317ff1eca..64b3daed8b39 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -280,11 +280,13 @@ long ScPositionHelper::computePosition(index_type nIndex, const std::function<lo
     return nTotalPixels;
 }
 
-ScBoundsProvider::ScBoundsProvider(ScDocument* pD, SCTAB nT, bool bColHeader)
-    : pDoc(pD)
+ScBoundsProvider::ScBoundsProvider(const ScViewData &rView, SCTAB nT, bool bColHeader)
+    : pDoc(rView.GetDocument())
     , nTab(nT)
     , bColumnHeader(bColHeader)
-    , MAX_INDEX(bColHeader ? pD->MaxCol() : MAXTILEDROW)
+    , MAX_INDEX(bColHeader ? pDoc->MaxCol() : MAXTILEDROW)
+    , mfPPTX(rView.GetPPTX())
+    , mfPPTY(rView.GetPPTY())
     , nFirstIndex(-1)
     , nSecondIndex(-1)
     , nFirstPositionPx(-1)
@@ -322,7 +324,7 @@ void ScBoundsProvider::GetEndIndexAndPosition(SCROW& nIndex, long& nPosition) co
 long ScBoundsProvider::GetSize(index_type nIndex) const
 {
     const sal_uInt16 nSize = bColumnHeader ? pDoc->GetColWidth(nIndex, nTab) : pDoc->GetRowHeight(nIndex, nTab);
-    return ScViewData::ToPixel(nSize, 1.0 / TWIPS_PER_PIXEL);
+    return ScViewData::ToPixel(nSize, bColumnHeader ? mfPPTX : mfPPTY);
 }
 
 void ScBoundsProvider::GetIndexAndPos(index_type nNearestIndex, long nNearestPosition,
@@ -1372,10 +1374,9 @@ void ScViewData::SetMaxTiledCol( SCCOL nNewMaxCol )
         nNewMaxCol = pDoc->MaxCol();
 
     const SCTAB nTab = GetTabNo();
-    ScDocument* pThisDoc = pDoc;
-    auto GetColWidthPx = [pThisDoc, nTab](SCCOL nCol) {
-        const sal_uInt16 nSize = pThisDoc->GetColWidth(nCol, nTab);
-        const long nSizePx = ScViewData::ToPixel(nSize, 1.0 / TWIPS_PER_PIXEL);
+    auto GetColWidthPx = [this, nTab](SCCOL nCol) {
+        const sal_uInt16 nSize = this->pDoc->GetColWidth(nCol, nTab);
+        const long nSizePx = this->ToPixel(nSize, nPPTX);
         return nSizePx;
     };
 
@@ -1398,10 +1399,9 @@ void ScViewData::SetMaxTiledRow( SCROW nNewMaxRow )
         nNewMaxRow = MAXTILEDROW;
 
     const SCTAB nTab = GetTabNo();
-    ScDocument* pThisDoc = pDoc;
-    auto GetRowHeightPx = [pThisDoc, nTab](SCROW nRow) {
-        const sal_uInt16 nSize = pThisDoc->GetRowHeight(nRow, nTab);
-        const long nSizePx = ScViewData::ToPixel(nSize, 1.0 / TWIPS_PER_PIXEL);
+    auto GetRowHeightPx = [this, nTab](SCROW nRow) {
+        const sal_uInt16 nSize = this->pDoc->GetRowHeight(nRow, nTab);
+        const long nSizePx = this->ToPixel(nSize, nPPTY);
         return nSizePx;
     };
 
commit bf3a66485781afe21ce99e6020420851e32e05c8
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Fri Nov 1 14:50:28 2019 +0000
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Nov 1 15:31:17 2019 +0000

    tilebench: polish zoom squash into zoom tests.
    
    Change-Id: Iedf3233c9c39eff969e0a90528f1287f7dfc33f0

diff --git a/libreofficekit/qa/tilebench/tilebench.cxx b/libreofficekit/qa/tilebench/tilebench.cxx
index 7660c6bc9d20..f5dccf81affa 100644
--- a/libreofficekit/qa/tilebench/tilebench.cxx
+++ b/libreofficekit/qa/tilebench/tilebench.cxx
@@ -295,6 +295,21 @@ static int diffTiles( const std::vector<unsigned char> &vBase,
     return nDifferent;
 }
 
+static std::vector<unsigned char> paintTile( Document *pDocument,
+                                             long nX, long nY,
+                                             long const nTilePixelWidth,
+                                             long const nTilePixelHeight,
+                                             long const nTileTwipWidth,
+                                             long const nTileTwipHeight )
+{
+//    long e = 0; // tweak if we suspect an overlap / visibility issue.
+//    pDocument->setClientVisibleArea( nX - e, nY - e, nTileTwipWidth + e, nTileTwipHeight + e );
+    std::vector<unsigned char> vData( nTilePixelWidth * nTilePixelHeight * 4 );
+    pDocument->paintTile( vData.data(), nTilePixelWidth, nTilePixelHeight,
+                          nX, nY, nTileTwipWidth, nTileTwipHeight );
+    return vData;
+}
+
 static bool testJoinsAt( Document *pDocument, long nX, long nY,
                          long const nTilePixelSize,
                          long const nTileTwipSize )
@@ -306,12 +321,26 @@ static bool testJoinsAt( Document *pDocument, long nX, long nY,
     long const nTileTwipWidth = nTileTwipSize;
     long const nTileTwipHeight = nTileTwipSize;
 
-    // Get a base image 4x the size
     long initPosX = nX * nTileTwipWidth, initPosY = nY * nTileTwipHeight;
-    std::vector<unsigned char> vBase( nTilePixelWidth * nTilePixelHeight * 4 * 4 );
 
-    pDocument->paintTile( vBase.data(), nTilePixelWidth * 2, nTilePixelHeight * 2,
-                          initPosX, initPosY, nTileTwipWidth * 2, nTileTwipHeight * 2 );
+    // Calc has to do significant work on changing zoom ...
+    pDocument->setClientZoom( nTilePixelWidth, nTilePixelHeight,
+                              nTileTwipWidth, nTileTwipHeight );
+
+    // Unfortunately without getting this nothing renders ...
+    std::stringstream aForceHeaders;
+    aForceHeaders << ".uno:ViewRowColumnHeaders?x=" << initPosX << "&y=" << initPosY <<
+        "&width=" << (nTileTwipWidth * 2) << "&height=" << (nTileTwipHeight * 2);
+    std::string cmd = aForceHeaders.str();
+    char* pJSON = pDocument->getCommandValues(cmd.c_str());
+    fprintf(stderr, "command: '%s' values '%s'\n", cmd.c_str(), pJSON);
+    free(pJSON);
+
+    // Get a base image 4x the size
+    std::vector<unsigned char> vBase(
+        paintTile(pDocument, initPosX, initPosY,
+                  nTilePixelWidth * 2, nTilePixelHeight * 2,
+                  nTileTwipWidth * 2, nTileTwipHeight * 2));
 
     const struct {
         long X;
@@ -326,11 +355,13 @@ static bool testJoinsAt( Document *pDocument, long nX, long nY,
     // Compare each of the 4x tiles with a sub-tile of the larger image
     for( auto &rPos : aCompare )
     {
-        std::vector<unsigned char> vCompare( nTilePixelWidth * nTilePixelHeight * 4 );
-        pDocument->paintTile( vCompare.data(), nTilePixelWidth, nTilePixelHeight,
-                              initPosX + rPos.X * nTileTwipWidth,
-                              initPosY + rPos.Y * nTileTwipHeight,
-                              nTileTwipWidth, nTileTwipHeight );
+        std::vector<unsigned char> vCompare(
+            paintTile(pDocument,
+                      initPosX + rPos.X * nTileTwipWidth,
+                      initPosY + rPos.Y * nTileTwipHeight,
+                      nTilePixelWidth, nTilePixelHeight,
+                      nTileTwipWidth, nTileTwipHeight));
+
         std::vector<unsigned char> vDiff( nTilePixelWidth * 3 * nTilePixelHeight * 4 );
         int nDifferences = diffTiles( vBase, nTilePixelWidth * 2,
                                       vCompare, nTilePixelWidth,
@@ -368,11 +399,12 @@ static int testJoin( Document *pDocument)
 
     // Use realistic dimensions, similar to the Online client.
     long const nTilePixelSize = 256;
-    long const nTileTwipSize = 1852;
+    long const nTileTwipSize = 3840;
     double fZooms[] = {
-//        0.5, 0.6, 0.7, 0.85,
+        0.5,
+        0.6, 0.7, 0.85,
         1.0,
-//        1.2, 1.5, 1.75,
+        1.2, 1.5, 1.75,
         2.0
     };
     long nFails = 0;
commit fdb58d741bfc3c93a43b4b8998c0046c075d8ce5
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Mon Oct 28 21:39:14 2019 +0000
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Mon Oct 28 21:39:14 2019 +0000

    Revert "lok: sc: make hi-dpi/zoom compatible with retrieving cell cursor"
    
    This reverts commit e3ff84aed5be8e0d2780d80b178fa8fc0e388859.
    
    Change-Id: I174dd54cf7b44f12c90c61882814b6dee9be9b7c

diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 49a26253b388..5097f4b0dbc8 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -813,7 +813,9 @@ void DesktopLOKTest::testCellCursor()
 
     OString aRectangle(aTree.get<std::string>("commandValues").c_str());
     // cell cursor geometry + col + row
-    CPPUNIT_ASSERT_EQUAL(OString("0, 0, 1274, 254, 0, 0"), aRectangle);
+    CPPUNIT_ASSERT_EQUAL(OString("0, 0, 1279, 255, 0, 0"), aRectangle);
+
+    comphelper::LibreOfficeKit::setActive(false);
 }
 
 void DesktopLOKTest::testCommandResult()
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 777a9ed220f1..d2917b346cc4 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5674,7 +5674,7 @@ OString ScGridWindow::getCellCursor( int nOutputWidth, int nOutputHeight,
     return getCellCursor(zoomX, zoomY);
 }
 
-OString ScGridWindow::getCellCursor(const Fraction& /*rZoomX*/, const Fraction& /*rZoomY*/) const
+OString ScGridWindow::getCellCursor(const Fraction& rZoomX, const Fraction& rZoomY) const
 {
     // GridWindow stores a shown cell cursor in mpOOCursors, hence
     // we can use that to determine whether we would want to be showing
@@ -5690,10 +5690,7 @@ OString ScGridWindow::getCellCursor(const Fraction& /*rZoomX*/, const Fraction&
     Fraction defaultZoomX = pViewData->GetZoomX();
     Fraction defaultZoomY = pViewData->GetZoomY();
 
-    // hardcode to what we mean as 100% (256px tiles meaning 3840 twips)
-    Fraction aFracX(long(256 * TWIPS_PER_PIXEL), 3840);
-    Fraction aFracY(long(256 * TWIPS_PER_PIXEL), 3840);
-    pViewData->SetZoom(aFracX, aFracY, true);
+    pViewData->SetZoom(rZoomX, rZoomY, true);
 
     Point aScrPos = pViewData->GetScrPos( nX, nY, eWhich, true );
     long nSizeXPix;
commit 07e4b8e6ebd87d03336819e881cf5608e8e7f180
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Mon Oct 28 20:43:46 2019 +0000
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Mon Oct 28 21:21:33 2019 +0000

    Revert "sc lok: Implement hi-dpi and zoom for spreadsheets."
    
    This reverts commit 498dceb43f870bf9e380f1f87e99c6ccadf1963c.
    
    Change-Id: Iadb9da47cf8c9a57385530ab888d55169db7639a

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 <viewid, bMobile> pairs
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 3884dbc98882..b16b34a00957 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2730,15 +2730,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/libreofficekit/qa/tilebench/tilebench.cxx b/libreofficekit/qa/tilebench/tilebench.cxx
index 3c46afed18ec..7660c6bc9d20 100644
--- a/libreofficekit/qa/tilebench/tilebench.cxx
+++ b/libreofficekit/qa/tilebench/tilebench.cxx
@@ -370,9 +370,9 @@ static int testJoin( Document *pDocument)
     long const nTilePixelSize = 256;
     long const nTileTwipSize = 1852;
     double fZooms[] = {
-        0.5, 0.6, 0.7, 0.85,
+//        0.5, 0.6, 0.7, 0.85,
         1.0,
-        1.2, 1.5, 1.75,
+//        1.2, 1.5, 1.75,
         2.0
     };
     long nFails = 0;
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index eb7f2d7281b2..66d6e423e300 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 different to what Calc's internal
-    // scaling would do - because that one is trying to fit the lines between
-    // cells to integer multiples of pixels.
-    //
-    // See also desktop/source/lib/init.cxx for details, where we have to set
-    // the stuff accordingly for the VirtualDevice creation.
-
-    // page break zoom, and aLogicMode in ScViewData - hardcode that to what
-    // we mean as 100% (256px tiles meaning 3840 twips)
-    Fraction aFracX(long(256 * TWIPS_PER_PIXEL), 3840);
-    Fraction aFracY(long(256 * TWIPS_PER_PIXEL), 3840);
-    pViewData->SetZoom(aFracX, aFracY, true);
 
-    // Cairo or CoreGraphics scales for us, we have to compensate for that,
-    // otherwise we are painting too far away
-    const double fDPIScale = comphelper::LibreOfficeKit::getDPIScale();
+    Fraction aFracX(long(nOutputWidth * TWIPS_PER_PIXEL), nTileWidth);
+    Fraction aFracY(long(nOutputHeight * TWIPS_PER_PIXEL), nTileHeight);
+
+    // page break zoom, and aLogicMode in ScViewData
+    pViewData->SetZoom(aFracX, aFracY, true);
 
-    const double fTilePosXPixel = static_cast<double>(nTilePosX) * nOutputWidth / (nTileWidth * fDPIScale);
-    const double fTilePosYPixel = static_cast<double>(nTilePosY) * nOutputHeight / (nTileHeight * fDPIScale);
-    const double fTileBottomPixel = static_cast<double>(nTilePosY + nTileHeight) * nOutputHeight / (nTileHeight * fDPIScale);
-    const double fTileRightPixel = static_cast<double>(nTilePosX + nTileWidth) * nOutputWidth / (nTileWidth * fDPIScale);
+    const double fTilePosXPixel = static_cast<double>(nTilePosX) * nOutputWidth / nTileWidth;
+    const double fTilePosYPixel = static_cast<double>(nTilePosY) * nOutputHeight / nTileHeight;
+    const double fTileBottomPixel = static_cast<double>(nTilePosY + nTileHeight) * nOutputHeight / nTileHeight;
+    const double fTileRightPixel = static_cast<double>(nTilePosX + nTileWidth) * nOutputWidth / nTileWidth;
 
     SCTAB nTab = pViewData->GetTabNo();
     ScDocument* pDoc = pViewData->GetDocument();
commit 8c41fb20b8a3566c29f81496b6191f38eb69a677
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Fri Oct 25 21:16:42 2019 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Sat Oct 26 10:56:53 2019 +0100

    lok: implement zoom tests.
    
    Change-Id: Ieffc89b8119c2baf56383ac8b5d3cb54dc9d0d2d

diff --git a/libreofficekit/qa/tilebench/tilebench.cxx b/libreofficekit/qa/tilebench/tilebench.cxx
index fef5271bdf27..3c46afed18ec 100644
--- a/libreofficekit/qa/tilebench/tilebench.cxx
+++ b/libreofficekit/qa/tilebench/tilebench.cxx
@@ -339,8 +339,9 @@ static bool testJoinsAt( Document *pDocument, long nX, long nY,
                                       vDiff );
         if ( nDifferences > 0 )
         {
-            fprintf( stderr, "  %d differences in sub-tile pixel mismatch at %ld, %ld at offset %ld, %ld (twips)\n",
-                     nDifferences, rPos.X, rPos.Y, initPosX, initPosY );
+            fprintf( stderr, "  %d differences in sub-tile pixel mismatch at %ld, %ld at offset %ld, %ld (twips) size %ld\n",
+                     nDifferences, rPos.X, rPos.Y, initPosX, initPosY,
+                     nTileTwipWidth);
             dumpTile("_base", nTilePixelWidth * 2, nTilePixelHeight * 2,
                      mode, vBase.data());
 /*            dumpTile("_sub", nTilePixelWidth, nTilePixelHeight,
@@ -368,15 +369,29 @@ static int testJoin( Document *pDocument)
     // Use realistic dimensions, similar to the Online client.
     long const nTilePixelSize = 256;
     long const nTileTwipSize = 1852;
+    double fZooms[] = {
+        0.5, 0.6, 0.7, 0.85,
+        1.0,
+        1.2, 1.5, 1.75,
+        2.0
+    };
     long nFails = 0;
+    std::stringstream results;
 
-    for( long y = 0; y < 5; ++y )
+    for( auto z : fZooms )
     {
-        for( long x = 0; x < 5; ++x )
+        long nBad = 0;
+        for( long y = 0; y < 5; ++y )
         {
-            if ( !testJoinsAt( pDocument, x, y, nTilePixelSize, nTileTwipSize ) )
-                nFails++;
+            for( long x = 0; x < 5; ++x )
+            {
+                if ( !testJoinsAt( pDocument, x, y, nTilePixelSize, nTileTwipSize * z ) )
+                    nBad++;
+            }
         }
+        if (nBad > 0)
+            results << "\tZoom " << z << " bad tiles: " << nBad << "\n";
+        nFails += nBad;
     }
 
     if (nFails > 0)
@@ -384,6 +399,8 @@ static int testJoin( Document *pDocument)
     else
         fprintf( stderr, "All joins compared correctly\n" );
 
+    fprintf(stderr, "%s\n", results.str().c_str());
+
     return nFails;
 }
 
commit d4d6db7fe848fa66fc2073e675b83556f69f2637
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Fri Oct 25 19:58:35 2019 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Sat Oct 26 10:56:51 2019 +0100

    lok: improve tilebench and add an unpleasant text rendering test case.
    
    Change-Id: I9e769cff6db794389bcef821c08ca1cd60173ab9

diff --git a/libreofficekit/qa/data/join/README b/libreofficekit/qa/data/join/README
new file mode 100644
index 000000000000..35762e1f0525
--- /dev/null
+++ b/libreofficekit/qa/data/join/README
@@ -0,0 +1,4 @@
+Files to run through tilebench --join to detect problems.
+
+bin/run tilebench instdir/program libreofficekit/qa/join/<filename> --join
+
diff --git a/libreofficekit/qa/data/join/calc-100-textjitter.xlsx b/libreofficekit/qa/data/join/calc-100-textjitter.xlsx
new file mode 100644
index 000000000000..94a3e5254d9a
Binary files /dev/null and b/libreofficekit/qa/data/join/calc-100-textjitter.xlsx differ
diff --git a/libreofficekit/qa/tilebench/tilebench.cxx b/libreofficekit/qa/tilebench/tilebench.cxx
index a1d415fe56bb..fef5271bdf27 100644
--- a/libreofficekit/qa/tilebench/tilebench.cxx
+++ b/libreofficekit/qa/tilebench/tilebench.cxx
@@ -72,19 +72,21 @@ static void dumpTile(const char *pNameStem,
         nTotalWidth = nWidth;
 
     auto pBuffer = reinterpret_cast<const char *>(pBufferU);
+    static int counter = 0;
     std::string aName = "/tmp/dump_tile";
     aName += pNameStem;
+    aName += "_" + std::to_string(counter);
     aName += ".ppm";
 #ifndef IOS
     std::ofstream ofs(aName);
 #else
     NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
     NSString *documentsDirectory = [paths objectAtIndex:0];
-    static int counter = 0;
-    NSString *path = [NSString stringWithFormat:@"%@/dump_tile_%d.ppm", documentsDirectory, counter++];
+    NSString *path = [NSString stringWithFormat:@"%@/dump_tile_%d.ppm", documentsDirectory, counter];
     std::ofstream ofs([path UTF8String]);
     std::cerr << "---> Dumping tile\n";
 #endif
+    counter++;
     ofs << "P6\n"
         << nWidth << " "
         << nHeight << "\n"
@@ -356,7 +358,7 @@ static bool testJoinsAt( Document *pDocument, long nX, long nY,
 }
 
 // Check that our tiles join nicely ...
-static void testJoin( Document *pDocument)
+static int testJoin( Document *pDocument)
 {
     // Ignore parts - just the first for now ...
     long nWidth = 0, nHeight = 0;
@@ -366,20 +368,23 @@ static void testJoin( Document *pDocument)
     // Use realistic dimensions, similar to the Online client.
     long const nTilePixelSize = 256;
     long const nTileTwipSize = 1852;
+    long nFails = 0;
 
     for( long y = 0; y < 5; ++y )
     {
         for( long x = 0; x < 5; ++x )
         {
             if ( !testJoinsAt( pDocument, x, y, nTilePixelSize, nTileTwipSize ) )
-            {
-                fprintf( stderr, "failed\n" );
-                return;
-            }
+                nFails++;
         }
     }
 
-    fprintf( stderr, "All joins compared correctly\n" );
+    if (nFails > 0)
+        fprintf( stderr, "Failed %ld joins\n", nFails );
+    else
+        fprintf( stderr, "All joins compared correctly\n" );
+
+    return nFails;
 }
 
 static std::atomic<bool> bDialogRendered(false);
@@ -512,7 +517,7 @@ int main( int argc, char* argv[] )
 
     aTimes.emplace_back("initialization");
     // coverity[tainted_string] - build time test tool
-    Office *pOffice = lok_cpp_init(install_path, user_profile);
+    std::unique_ptr<Office> pOffice( lok_cpp_init(install_path, user_profile) );
     if (pOffice == nullptr)
     {
         fprintf(stderr, "Failed to initialize Office from %s\n", argv[1]);
@@ -521,13 +526,13 @@ int main( int argc, char* argv[] )
     aTimes.emplace_back();
     pOffice->registerCallback(ignoreCallback, nullptr);
 
-    Document *pDocument = nullptr;
+    std::unique_ptr<Document> pDocument;
 
     pOffice->setOptionalFeatures(LOK_FEATURE_NO_TILED_ANNOTATIONS);
 
     aTimes.emplace_back("load document");
     if (doc_url != nullptr)
-        pDocument = pOffice->documentLoad(doc_url);
+        pDocument.reset(pOffice->documentLoad(doc_url));
     aTimes.emplace_back();
 
     if (pDocument)
@@ -540,11 +545,11 @@ int main( int argc, char* argv[] )
             int max_tiles = (argc > arg ? atoi(argv[arg++]) : -1);
             const bool dump = true;
 
-            testTile (pDocument, max_parts, max_tiles, dump);
+            testTile (pDocument.get(), max_parts, max_tiles, dump);
         }
         else if (!strcmp(mode, "--join"))
         {
-            testJoin (pDocument);
+            return testJoin (pDocument.get());
         }
         else if (!strcmp (mode, "--dialog"))
         {
@@ -563,16 +568,16 @@ int main( int argc, char* argv[] )
                     return help("missing argument to --dialog and no default");
                 }
             }
-            testDialog (pDocument, uno_cmd);
+            testDialog (pDocument.get(), uno_cmd);
         } else
             return help ("unknown parameter");
     }
 
     aTimes.emplace_back("destroy document");
-    delete pDocument;
+    pDocument.reset();
     aTimes.emplace_back();
 
-    delete pOffice;
+    pOffice.reset();
 
     double nTotal = 0.0;
     fprintf (stderr, "profile run:\n");
commit 1d4797283c27a5a1675793c16dd33c4636a8cc60
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Fri Oct 25 19:55:37 2019 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Sat Oct 26 10:56:50 2019 +0100

    lok: disable page break view for tiled rendering mode.
    
    Why ? dotted lines fail to join giving differences in the grid depending
    on render position, vcl's LineInfo has no offset to compensate (yet).
    
    Restore when vcl's LineInfo is better.
    
    Change-Id: I45803ee80c8fcefd17a37dc3fd93fbafd94fffd4

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index aed7f1447d39..76041fdc5b7a 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -560,7 +560,7 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
     bool bGrid = rOpts.GetOption( VOPT_GRID ) && pViewData->GetShowGrid();
     bool bGridFirst = !rOpts.GetOption( VOPT_GRID_ONTOP );
 
-    bool bPage = rOpts.GetOption( VOPT_PAGEBREAKS );
+    bool bPage = rOpts.GetOption( VOPT_PAGEBREAKS ) && !bIsTiledRendering;
     // tdf#124983, if option LibreOfficeDev Calc/View/Visual Aids/Page breaks
     // is enabled, breaks should be visible. If the document is opened the first
     // time, the breaks are not calculated yet, so this initialization is
commit 83f0a054533d3b3bd9299560b86a66a458a31905
Author:     Henry Castro <hcastro at collabora.com>
AuthorDate: Thu Feb 7 09:21:20 2019 -0400
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Sat Oct 26 10:56:49 2019 +0100

    lok: Bullets and Numbering → disable Graphic selection in Customize
    
    Change-Id: If0f7b953a40ca1d5f469087cb8f362a949c39b37
    Reviewed-on: https://gerrit.libreoffice.org/67499
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/79810
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>

diff --git a/sw/source/ui/misc/num.cxx b/sw/source/ui/misc/num.cxx
index b2eef82f6580..603e05bebb3e 100644
--- a/sw/source/ui/misc/num.cxx
+++ b/sw/source/ui/misc/num.cxx
@@ -49,6 +49,7 @@
 #include <svl/aeitem.hxx>
 #include <svl/slstitm.hxx>
 #include <svl/intitem.hxx>
+#include <comphelper/lok.hxx>
 
 static bool bLastRelative = false;
 
@@ -885,7 +886,16 @@ SwSvxNumBulletTabDialog::SwSvxNumBulletTabDialog(weld::Window* pParent,
     AddTabPage("bullets", RID_SVXPAGE_PICK_BULLET );
     AddTabPage("outlinenum", RID_SVXPAGE_PICK_NUM );
     AddTabPage("graphics", RID_SVXPAGE_PICK_BMP );
-    AddTabPage("customize", RID_SVXPAGE_NUM_OPTIONS );
+
+    if (comphelper::LibreOfficeKit::isActive())
+    {
+        RemoveTabPage("customize");
+    }
+    else
+    {
+        AddTabPage("customize", RID_SVXPAGE_NUM_OPTIONS );
+    }
+
     AddTabPage("position", RID_SVXPAGE_NUM_POSITION );
 }
 


More information about the Libreoffice-commits mailing list