diff options
author | Eike Rathke <erack@redhat.com> | 2014-02-10 18:22:27 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-02-11 12:31:14 +0000 |
commit | d27af82cf997df2ddfb3ea689cf943338bd3df1a (patch) | |
tree | 72848c128f8ea0516dcd72f51770c4370c8536fb /sc | |
parent | 04b11e8d5411f687fb573f94d6ed58ace7c424c4 (diff) |
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
(cherry picked from commit 6c5acfbefddeca1b2336cdc4158ec6e6f2a46858)
Reviewed-on: https://gerrit.libreoffice.org/7978
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/table1.cxx | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index f958927ce8ef..e0eb3eb8ef62 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -904,15 +904,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; } } } |