diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2011-01-19 11:45:03 -0500 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2011-01-19 12:10:41 -0500 |
commit | 781689a5554fcb0a3cbc8e526914d5287e41a0c5 (patch) | |
tree | f97727ceca791d43d3276297445512ecb698c518 /sc/source/core/data/table1.cxx | |
parent | ada9698d918ffd6859680acbd361599d8f8dbd19 (diff) | |
parent | b207eeb1182b078cf6c620a0529137b43429657b (diff) |
Merge remote branch 'origin/libreoffice-3-3'
Conflicts:
sc/inc/document.hxx
sc/source/core/data/drwlayer.cxx
sc/source/core/data/table2.cxx
sc/source/core/data/table3.cxx
Diffstat (limited to 'sc/source/core/data/table1.cxx')
-rw-r--r-- | sc/source/core/data/table1.cxx | 38 |
1 files changed, 13 insertions, 25 deletions
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index b80f6374c2dc..735de70e0553 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -835,28 +835,18 @@ void ScTable::GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, S } -bool ScTable::ShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rStartRow, +bool ScTable::ShrinkToUsedDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const { - o_bShrunk = false; - - PutInOrder( rStartCol, rEndCol); - PutInOrder( rStartRow, rEndRow); - if (rStartCol < 0) - rStartCol = 0, o_bShrunk = true; - if (rStartRow < 0) - rStartRow = 0, o_bShrunk = true; - if (rEndCol > MAXCOL) - rEndCol = MAXCOL, o_bShrunk = true; - if (rEndRow > MAXROW) - rEndRow = MAXROW, o_bShrunk = true; - + bool bRet = false; bool bChanged; + do { bChanged = false; - while (rStartCol < rEndCol) + bool bCont = true; + while (rEndCol > 0 && bCont && rStartCol < rEndCol) { if (aCol[rEndCol].IsEmptyBlock( rStartRow, rEndRow)) { @@ -864,10 +854,11 @@ bool ScTable::ShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rS bChanged = true; } else - break; // while + bCont = false; } - while (rStartCol < rEndCol) + bCont = true; + while (rStartCol < MAXCOL && bCont && rStartCol < rEndCol) { if (aCol[rStartCol].IsEmptyBlock( rStartRow, rEndRow)) { @@ -875,12 +866,12 @@ bool ScTable::ShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rS bChanged = true; } else - break; // while + bCont = false; } if (!bColumnsOnly) { - if (rStartRow < rEndRow) + if (rStartRow < MAXROW && rStartRow < rEndRow) { bool bFound = false; for (SCCOL i=rStartCol; i<=rEndCol && !bFound; i++) @@ -893,7 +884,7 @@ bool ScTable::ShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rS } } - if (rStartRow < rEndRow) + if (rEndRow > 0 && rStartRow < rEndRow) { bool bFound = false; for (SCCOL i=rStartCol; i<=rEndCol && !bFound; i++) @@ -908,12 +899,9 @@ bool ScTable::ShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rS } if (bChanged) - o_bShrunk = true; + bRet = true; } while( bChanged ); - - return rStartCol != rEndCol || (bColumnsOnly ? - !aCol[rStartCol].IsEmptyBlock( rStartRow, rEndRow) : - (rStartRow != rEndRow || aCol[rStartCol].HasDataAt( rStartRow))); + return bRet; } |