sc/source/core/data/table1.cxx | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-)
New commits: commit c782212abf4114b6dd366c38a44574be21c81eb1 Author: Eike Rathke <[email protected]> Date: Mon Feb 10 20:52:07 2014 +0100 use GetLastDataRow() also in ShrinkToUsedDataArea() Change-Id: Ie9d729900d6096dc8f540b3bc52df749b15675e2 diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index 1ba2c2c..45180cf 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -966,13 +966,10 @@ bool ScTable::ShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rS if (rStartRow < rEndRow) { - bool bFound = false; - for (SCCOL i=rStartCol; i<=rEndCol && !bFound; i++) - if (aCol[i].HasDataAt( rEndRow)) - bFound = true; - if (!bFound) + SCROW nLastDataRow = GetLastDataRow( rStartCol, rEndCol, rEndRow); + if (0 <= nLastDataRow && nLastDataRow < rEndRow) { - --rEndRow; + rEndRow = std::max( rStartRow, nLastDataRow); bChanged = true; } } commit c32e93e561d234e289ce14b88a73368d7862ee47 Author: Eike Rathke <[email protected]> Date: Mon Feb 10 20:00:52 2014 +0100 actually the extra check isn't needed The end row will be the maximum of the start row and the last data row up to the original end row. Change-Id: I906a5f44f31f333c814b6832767dc3bd0ecd8278 diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index 8e6f276..1ba2c2c 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -899,8 +899,8 @@ void ScTable::GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, S if ( !bBottom && rEndRow > 0 && rStartRow < rEndRow ) { SCROW nLastDataRow = GetLastDataRow( rStartCol, rEndCol, rEndRow); - if (nLastDataRow >= 0 && rStartRow <= nLastDataRow && nLastDataRow < rEndRow) - rEndRow = nLastDataRow; + if (nLastDataRow < rEndRow) + rEndRow = std::max( rStartRow, nLastDataRow); } } } commit 840accea91da58a4532ff7cf7f5b1eaa501f0b6d Author: Eike Rathke <[email protected]> Date: Mon Feb 10 19:45:16 2014 +0100 cosmetical adapt to style Change-Id: I210f74670631707b02b68150efac76b0985390ac diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index 22da0ae..8e6f276 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -882,15 +882,15 @@ void ScTable::GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, S if ( !bTop && rStartRow < MAXROW && rStartRow < rEndRow ) { - bool shrink = true; + bool bShrink = true; do { - for ( SCCOL i = rStartCol; i<=rEndCol && shrink; i++) + for ( SCCOL i = rStartCol; i<=rEndCol && bShrink; i++) if (aCol[i].HasDataAt(rStartRow)) - shrink = false; - if (shrink) + bShrink = false; + if (bShrink) ++rStartRow; - }while( shrink && rStartRow < MAXROW && rStartRow < rEndRow); + } while (bShrink && rStartRow < MAXROW && rStartRow < rEndRow); } } _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
