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

Bartosz Kosiorek gang65 at poczta.onet.pl
Wed Feb 8 23:13:29 UTC 2017


 sc/source/core/data/table1.cxx |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

New commits:
commit 0e0fef10002b46965edad02b3f460a502d9f6595
Author: Bartosz Kosiorek <gang65 at poczta.onet.pl>
Date:   Sat Jan 28 15:18:08 2017 +0100

    tdf#50916 Allow proper updating, deleting and inserting tabs
    
    Change-Id: Ib318c3ff14970483fdcda1fdd6de9969f47ccbe8
    Reviewed-on: https://gerrit.libreoffice.org/33647
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Bartosz Kosiorek <gang65 at poczta.onet.pl>

diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index bb899e5..1869808 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -1692,7 +1692,7 @@ void ScTable::UpdateInsertTab( sc::RefUpdateInsertTabContext& rCxt )
                 ScRange( 0, 0, rCxt.mnInsertPos, MAXCOL, MAXROW, MAXTAB),
                 0, 0, rCxt.mnSheets);
 
-    for (SCCOL i=0; i <= MAXCOL; i++)
+    for (SCCOL i=0; i < aCol.size(); i++)
         aCol[i].UpdateInsertTab(rCxt);
 
     if (IsStreamValid())
@@ -1722,7 +1722,7 @@ void ScTable::UpdateDeleteTab( sc::RefUpdateDeleteTabContext& rCxt )
                 ScRange( 0, 0, rCxt.mnDeletePos, MAXCOL, MAXROW, MAXTAB),
                 0, 0, -rCxt.mnSheets);
 
-    for (SCCOL i = 0; i <= MAXCOL; ++i)
+    for (SCCOL i = 0; i < aCol.size(); ++i)
         aCol[i].UpdateDeleteTab(rCxt);
 
     if (IsStreamValid())
@@ -1747,7 +1747,7 @@ void ScTable::UpdateMoveTab(
                 ScRange( 0, 0, rCxt.mnOldPos, MAXCOL, MAXROW, MAXTAB),
                 0, 0, rCxt.mnNewPos - rCxt.mnOldPos);
 
-    for ( SCCOL i=0; i <= MAXCOL; i++ )
+    for ( SCCOL i=0; i < aCol.size(); i++ )
     {
         aCol[i].UpdateMoveTab(rCxt, nTabNo);
         if (pProgress)
@@ -1760,7 +1760,7 @@ void ScTable::UpdateMoveTab(
 
 void ScTable::UpdateCompile( bool bForceIfNameInUse )
 {
-    for (SCCOL i=0; i <= MAXCOL; i++)
+    for (SCCOL i=0; i < aCol.size(); i++)
     {
         aCol[i].UpdateCompile( bForceIfNameInUse );
     }
@@ -1769,7 +1769,8 @@ void ScTable::UpdateCompile( bool bForceIfNameInUse )
 void ScTable::SetTabNo(SCTAB nNewTab)
 {
     nTab = nNewTab;
-    for (SCCOL i=0; i <= MAXCOL; i++) aCol[i].SetTabNo(nNewTab);
+    for (SCCOL i=0; i < aCol.size(); i++)
+        aCol[i].SetTabNo(nNewTab);
 }
 
 void ScTable::FindRangeNamesInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
@@ -1809,6 +1810,11 @@ void ScTable::ExtendPrintArea( OutputDevice* pDev,
             // These columns are visible.  Check for empty columns.
             for (SCCOL j = i; j <= nLastCol; ++j)
             {
+                if ( j >= aCol.size() )
+                {
+                    aSkipCols.setTrue( j, MAXCOL );
+                    break;
+                }
                 if (aCol[j].GetCellCount() == 0)
                     // empty
                     aSkipCols.setTrue(j,j);


More information about the Libreoffice-commits mailing list