[Libreoffice-commits] core.git: Branch 'feature/tiled-editing' - 4 commits - sc/source

Jan Holesovsky kendy at collabora.com
Fri Apr 3 14:28:54 PDT 2015


 sc/source/ui/unoobj/docuno.cxx |   12 +++++++++---
 sc/source/ui/view/gridwin4.cxx |   35 +++++++++++++++++++++++++----------
 sc/source/ui/view/viewdata.cxx |   15 +++++++++++----
 3 files changed, 45 insertions(+), 17 deletions(-)

New commits:
commit 440c2c1cccf26e5e0eda6b7ae1a2868798b4057b
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Fri Apr 3 23:22:56 2015 +0200

    sc tiled editing: Fix the conversion so that it works with zoom too.
    
    Change-Id: I80d9ed6abe6b3ddb2bb1e0d6b7c74ce50d0df55a

diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index b098082..231d1f8 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -480,9 +480,8 @@ void ScModelObj::paintTile( VirtualDevice& rDevice,
     //if (pGridWindow->GetOutputSizePixel() != aTileSize)
     //    pGridWindow->SetOutputSizePixel(Size(nOutputWidth, nOutputHeight));
     // so instead for now, set the viewport size to document size
-    const MapMode aMapTwip(MAP_TWIP);
     Size aDocSize = getDocumentSize();
-    pGridWindow->SetOutputSizePixel(pGridWindow->LogicToPixel(aDocSize, aMapTwip));
+    pGridWindow->SetOutputSizePixel(Size(aDocSize.Width() * pViewData->GetPPTX(), aDocSize.Height() * pViewData->GetPPTY()));
 
     pGridWindow->PaintTile( rDevice, nOutputWidth, nOutputHeight,
                             nTilePosX, nTilePosY, nTileWidth, nTileHeight );
commit ca18f7310f76f72f86806bd2586486e7c446a098
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Fri Apr 3 23:07:31 2015 +0200

    Revert "sc tiled editing: This got fixed by the recent changes."
    
    Needed again.
    
    This reverts commit b11c58889cde10f43a9f239a959eb2c252dc4db7.

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index a9c0135..269d12e 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -893,7 +893,10 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
         // set the correct mapmode
         Rectangle aBackground(aStart, aEnd);
         if (bIsTiledRendering)
+        {
+            aBackground += Point(nScrX, nScrY);
             rDevice.SetMapMode(aDrawMode);
+        }
         else
             rDevice.SetMapMode(pViewData->GetLogicMode());
 
commit 5deb60a4ef6243bcef5c6a50b3ed2073d3353bc9
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Fri Apr 3 23:04:06 2015 +0200

    sc tiled editing: For now, revert to using the entire doc size.
    
    There are still too many problems with the interaction with the editeng,
    unfortunately.
    
    Change-Id: I5cdbc80dbe1dc3996ecd89f0bca5399cbfb9c9b0

diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 7c3bb1b..b098082 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -473,9 +473,16 @@ void ScModelObj::paintTile( VirtualDevice& rDevice,
     ScGridWindow* pGridWindow = pViewData->GetActiveWin();
 
     // update the size of the area we are painting
-    Size aTileSize(nOutputWidth, nOutputHeight);
-    if (pGridWindow->GetOutputSizePixel() != aTileSize)
-        pGridWindow->SetOutputSizePixel(Size(nOutputWidth, nOutputHeight));
+    // FIXME we want to use only the minimal necessary size, like the
+    // following; but for the moment there is too many problems with that and
+    // interaction with editeng used for the cell editing
+    //Size aTileSize(nOutputWidth, nOutputHeight);
+    //if (pGridWindow->GetOutputSizePixel() != aTileSize)
+    //    pGridWindow->SetOutputSizePixel(Size(nOutputWidth, nOutputHeight));
+    // so instead for now, set the viewport size to document size
+    const MapMode aMapTwip(MAP_TWIP);
+    Size aDocSize = getDocumentSize();
+    pGridWindow->SetOutputSizePixel(pGridWindow->LogicToPixel(aDocSize, aMapTwip));
 
     pGridWindow->PaintTile( rDevice, nOutputWidth, nOutputHeight,
                             nTilePosX, nTilePosY, nTileWidth, nTileHeight );
commit 0a0238129a47c42c996f0000836bd48cee57b78a
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Fri Apr 3 20:57:49 2015 +0200

    sc tiled editing: Correct position of the selection in far positions.
    
    Before this commit, the selections outside of the aScrSize rectangle did not
    work - they always degraded to a single cell selection.
    
    Change-Id: Ie51da710424bff3691302f5923b141a2f2bea676

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 7202f3d..a9c0135 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1554,23 +1554,35 @@ void ScGridWindow::GetSelectionRects( ::std::vector< Rectangle >& rPixelRects )
 
     SCCOL nPosX = pViewData->GetPosX( eHWhich );
     SCROW nPosY = pViewData->GetPosY( eVWhich );
+    // is the selection visible at all?
     if (nTestX2 < nPosX || nTestY2 < nPosY)
-        return;                                         // unsichtbar
+        return;
     SCCOL nRealX1 = nX1;
     if (nX1 < nPosX)
         nX1 = nPosX;
     if (nY1 < nPosY)
         nY1 = nPosY;
 
-    SCCOL nXRight = nPosX + pViewData->VisibleCellsX(eHWhich);
-    if (nXRight > MAXCOL) nXRight = MAXCOL;
-    SCROW nYBottom = nPosY + pViewData->VisibleCellsY(eVWhich);
-    if (nYBottom > MAXROW) nYBottom = MAXROW;
-
-    if (nX1 > nXRight || nY1 > nYBottom)
-        return;                                         // unsichtbar
-    if (nX2 > nXRight) nX2 = nXRight;
-    if (nY2 > nYBottom) nY2 = nYBottom;
+    if (!pDoc->GetDrawLayer()->isTiledRendering())
+    {
+        // limit the selection to only what is visible on the screen
+        SCCOL nXRight = nPosX + pViewData->VisibleCellsX(eHWhich);
+        if (nXRight > MAXCOL)
+            nXRight = MAXCOL;
+
+        SCROW nYBottom = nPosY + pViewData->VisibleCellsY(eVWhich);
+        if (nYBottom > MAXROW)
+            nYBottom = MAXROW;
+
+        // is the selection visible at all?
+        if (nX1 > nXRight || nY1 > nYBottom)
+            return;
+
+        if (nX2 > nXRight)
+            nX2 = nXRight;
+        if (nY2 > nYBottom)
+            nY2 = nYBottom;
+    }
 
     double nPPTX = pViewData->GetPPTX();
     double nPPTY = pViewData->GetPPTY();
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 32ed642..fb375a5 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -1513,13 +1513,14 @@ Point ScViewData::GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich,
     }
 
     sal_uInt16 nTSize;
+    bool bIsTiledRendering = GetDocument()->GetDrawLayer()->isTiledRendering();
 
     SCCOL   nPosX = GetPosX(eWhichX);
     SCCOL   nX;
 
     long nScrPosX=0;
     if (nWhereX >= nPosX)
-        for (nX=nPosX; nX<nWhereX && (bAllowNeg || nScrPosX<=aScrSize.Width()); nX++)
+        for (nX = nPosX; nX < nWhereX && (bAllowNeg || bIsTiledRendering || nScrPosX <= aScrSize.Width()); nX++)
         {
             if ( nX > MAXCOL )
                 nScrPosX = 65535;
@@ -1550,7 +1551,7 @@ Point ScViewData::GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich,
 
     long nScrPosY=0;
     if (nWhereY >= nPosY)
-        for (nY=nPosY; nY<nWhereY && (bAllowNeg || nScrPosY<=aScrSize.Height()); nY++)
+        for (nY = nPosY; nY < nWhereY && (bAllowNeg || bIsTiledRendering || nScrPosY <= aScrSize.Height()); nY++)
         {
             if ( nY > MAXROW )
                 nScrPosY = 65535;
@@ -1591,8 +1592,14 @@ Point ScViewData::GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich,
         nScrPosX = aScrSize.Width() - 1 - nScrPosX;
     }
 
-    if (nScrPosX > 32767) nScrPosX=32767;
-    if (nScrPosY > 32767) nScrPosY=32767;
+    if (!bIsTiledRendering)
+    {
+        if (nScrPosX > 32767)
+            nScrPosX = 32767;
+        if (nScrPosY > 32767)
+            nScrPosY = 32767;
+    }
+
     return Point( nScrPosX, nScrPosY );
 }
 


More information about the Libreoffice-commits mailing list