sc/source/core/data/table1.cxx |   12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

New commits:
commit 6c5acfbefddeca1b2336cdc4158ec6e6f2a46858
Author: Eike Rathke <er...@redhat.com>
Date:   Mon Feb 10 18:22:27 2014 +0100

    do not loop 30 million cells to find a non-empty row
    
    If for whatever reason an AutoFilter area was setup to extend down to,
    for example, row 1048559 but the actual last data row is 15817, with 27
    columns it took ScTable::GetDataArea() to look at 27884034 cells to find
    the last non-empty data row ...
    
    Change-Id: Ic8cbebe7ddf9b23c8edb55c4821d8a4c69e8b75d

diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index b3385a3..22da0ae 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -898,15 +898,9 @@ void ScTable::GetDataArea( SCCOL& rStartCol, SCROW& 
rStartRow, SCCOL& rEndCol, S
     {
         if ( !bBottom && rEndRow > 0 && rStartRow < rEndRow )
         {
-            bool shrink = true;
-            do
-            {
-                for ( SCCOL i = rStartCol; i<=rEndCol && shrink; i++)
-                    if (aCol[i].HasDataAt(rEndRow))
-                        shrink = false;
-                if (shrink)
-                    --rEndRow;
-            }while( shrink && rEndRow > 0 && rStartRow < rEndRow );
+            SCROW nLastDataRow = GetLastDataRow( rStartCol, rEndCol, rEndRow);
+            if (nLastDataRow >= 0 && rStartRow <= nLastDataRow && nLastDataRow 
< rEndRow)
+                rEndRow = nLastDataRow;
         }
     }
 }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to