[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.1' - 2 commits - sc/source

Marco Cecchetti marco.cecchetti at collabora.com
Thu Nov 17 13:54:02 UTC 2016


 sc/source/ui/inc/viewdata.hxx  |    1 
 sc/source/ui/view/tabview2.cxx |   10 ++++-
 sc/source/ui/view/tabview3.cxx |   69 ++++++++++++++++++++++++++---------------
 sc/source/ui/view/viewdata.cxx |    5 --
 4 files changed, 54 insertions(+), 31 deletions(-)

New commits:
commit 333c293185d0c8f0d0fc02ef69523252b4f00628
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date:   Thu Nov 17 12:50:19 2016 +0100

    LOK - Calc: use the whole doc as visible area in ScTabView::PaintArea
    
    This workaround is needed since the visible area in core is not the
    same which is used in the client.
    
    Change-Id: I82b23e689000c4d8106ffa01ed082ae3d629b1be

diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 14fbad9..e9259a5 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -2193,32 +2193,53 @@ void ScTabView::PaintArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCRO
         nCol2 = nEndCol;
         nRow2 = nEndRow;
 
-        SCCOL nScrX = aViewData.GetPosX( eHWhich );
-        SCROW nScrY = aViewData.GetPosY( eVWhich );
-        if (nCol1 < nScrX)
-            nCol1 = nScrX;
-        if (nCol2 < nScrX)
+        if (comphelper::LibreOfficeKit::isActive())
         {
-            if ( eMode == SC_UPDATE_ALL )   // for UPDATE_ALL, paint anyway
-                nCol2 = nScrX;              // (because of extending strings to the right)
-            else
-                bOut = true;                // completely outside the window
+            SCCOL nLastX = 0;
+            SCROW nLastY = 0;
+            SCTAB nTab = aViewData.GetTabNo();
+            ScDocument& rDoc = aViewData.GetDocShell()->GetDocument();
+            if (rDoc.GetPrintArea(nTab, nLastX, nLastY, false))
+            {
+                nCol2 = nLastX;
+                nRow2 = nLastY;
+            }
+
+            if (nCol2 > MAXCOL) nCol2 = MAXCOL;
+            if (nRow2 > MAXROW) nRow2 = MAXROW;
+            bOut = nCol1 > nCol2 || nRow1 > nRow2;
+        }
+        else
+        {
+
+            SCCOL nScrX = aViewData.GetPosX( eHWhich );
+            SCROW nScrY = aViewData.GetPosY( eVWhich );
+
+            if (nCol1 < nScrX)
+                nCol1 = nScrX;
+            if (nCol2 < nScrX)
+            {
+                if ( eMode == SC_UPDATE_ALL )   // for UPDATE_ALL, paint anyway
+                    nCol2 = nScrX;              // (because of extending strings to the right)
+                else
+                    bOut = true;                // completely outside the window
+            }
+            if (nRow1 < nScrY)
+                nRow1 = nScrY;
+            if (nRow2 < nScrY)
+                bOut = true;
+
+            SCCOL nLastX = nScrX + aViewData.VisibleCellsX( eHWhich ) + 1;
+            SCROW nLastY = nScrY + aViewData.VisibleCellsY( eVWhich ) + 1;
+            if (nCol1 > nLastX)
+                bOut = true;
+            if (nCol2 > nLastX)
+                nCol2 = nLastX;
+            if (nRow1 > nLastY)
+                bOut = true;
+            if (nRow2 > nLastY)
+                nRow2 = nLastY;
         }
-        if (nRow1 < nScrY)
-            nRow1 = nScrY;
-        if (nRow2 < nScrY)
-            bOut = true;
-
-        SCCOL nLastX = nScrX + aViewData.VisibleCellsX( eHWhich ) + 1;
-        SCROW nLastY = nScrY + aViewData.VisibleCellsY( eVWhich ) + 1;
-        if (nCol1 > nLastX)
-            bOut = true;
-        if (nCol2 > nLastX)
-            nCol2 = nLastX;
-        if (nRow1 > nLastY)
-            bOut = true;
-        if (nRow2 > nLastY)
-            nRow2 = nLastY;
 
         if (bOut)
             continue;
commit 3d2655ee883a4b77caffa268d457cdaa3a3ff21b
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date:   Thu Nov 17 12:42:34 2016 +0100

    LOK - calc: now PgUp/PgDn offset is used only when PgUp/PgDn are pressed
    
    Change-Id: I340d747021bc794361d6b8eff76335345b60010c

diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx
index f61b0bf..d3b80fc 100644
--- a/sc/source/ui/inc/viewdata.hxx
+++ b/sc/source/ui/inc/viewdata.hxx
@@ -415,6 +415,7 @@ public:
 
     /// Force page size for PgUp/PgDown to overwrite the computation based on m_aVisArea.
     void ForcePageUpDownOffset(long nTwips) { m_nLOKPageUpDownOffset = nTwips; }
+    long GetPageUpDownOffset() { return m_nLOKPageUpDownOffset; }
 
     void            KillEditView();
     void            ResetEditView();
diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx
index 2d4dbe5..9b6d123 100644
--- a/sc/source/ui/view/tabview2.cxx
+++ b/sc/source/ui/view/tabview2.cxx
@@ -45,6 +45,7 @@
 #include "tabprotection.hxx"
 #include "markdata.hxx"
 #include "inputopt.hxx"
+#include <comphelper/lok.hxx>
 
 namespace {
 
@@ -628,6 +629,11 @@ void ScTabView::GetPageMoveEndPosition(SCsCOL nMovX, SCsROW nMovY, SCsCOL& rPage
     ScHSplitPos eWhichX = WhichH( eWhich );
     ScVSplitPos eWhichY = WhichV( eWhich );
 
+    sal_uInt16 nScrSizeY = SC_SIZE_NONE;
+    if (comphelper::LibreOfficeKit::isActive() && aViewData.GetPageUpDownOffset() > 0) {
+        nScrSizeY = ScViewData::ToPixel( aViewData.GetPageUpDownOffset(), aViewData.GetPPTX() );
+    }
+
     SCsCOL nPageX;
     SCsROW nPageY;
     if (nMovX >= 0)
@@ -636,9 +642,9 @@ void ScTabView::GetPageMoveEndPosition(SCsCOL nMovX, SCsROW nMovY, SCsCOL& rPage
         nPageX = ((SCsCOL) aViewData.CellsAtX( nCurX, -1, eWhichX )) * nMovX;
 
     if (nMovY >= 0)
-        nPageY = ((SCsROW) aViewData.CellsAtY( nCurY, 1, eWhichY )) * nMovY;
+        nPageY = ((SCsROW) aViewData.CellsAtY( nCurY, 1, eWhichY, nScrSizeY )) * nMovY;
     else
-        nPageY = ((SCsROW) aViewData.CellsAtY( nCurY, -1, eWhichY )) * nMovY;
+        nPageY = ((SCsROW) aViewData.CellsAtY( nCurY, -1, eWhichY, nScrSizeY )) * nMovY;
 
     if (nMovX != 0 && nPageX == 0) nPageX = (nMovX>0) ? 1 : -1;
     if (nMovY != 0 && nPageY == 0) nPageY = (nMovY>0) ? 1 : -1;
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index dc9a48c..86814e7 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -1735,11 +1735,6 @@ SCROW ScViewData::CellsAtY( SCsROW nPosY, SCsROW nDir, ScVSplitPos eWhichY, sal_
 
     if (nScrSizeY == SC_SIZE_NONE) nScrSizeY = (sal_uInt16) aScrSize.Height();
 
-    if (comphelper::LibreOfficeKit::isActive() && m_nLOKPageUpDownOffset > 0)
-    {
-        nScrSizeY = ToPixel( m_nLOKPageUpDownOffset, nPPTY );
-    }
-
     SCROW nY;
 
     if (nDir==1)


More information about the Libreoffice-commits mailing list