[PATCH 2/3] if empty row / col leads to shrink area, suppress all empty rows/col
Pierre-André Jacquod
pjacquod at alumni.ethz.ch
Mon Nov 28 01:10:15 PST 2011
and not just the last one, leaving the other within the selection
area
---
sc/source/core/data/table1.cxx | 38 ++++++++++++++++++++++----------------
1 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 48d7455..ce2051b 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -815,22 +815,25 @@ void ScTable::GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, S
if ( !bIncludeOld && !bOnlyDown )
{
- if ( !bLeft && rStartCol < MAXCOL && rStartCol < rEndCol )
- if ( aCol[rStartCol].IsEmptyBlock(rStartRow,rEndRow) )
+ if ( !bLeft )
+ while ( aCol[rStartCol].IsEmptyBlock(rStartRow,rEndRow) && rStartCol < MAXCOL && rStartCol < rEndCol)
++rStartCol;
- if ( !bRight && rEndCol > 0 && rStartCol < rEndCol )
- if ( aCol[rEndCol].IsEmptyBlock(rStartRow,rEndRow) )
+ if ( !bRight )
+ while ( aCol[rEndCol].IsEmptyBlock(rStartRow,rEndRow) && rEndCol > 0 && rStartCol < rEndCol)
--rEndCol;
if ( !bTop && rStartRow < MAXROW && rStartRow < rEndRow )
{
- bFound = false;
- for (i=rStartCol; i<=rEndCol && !bFound; i++)
- if (aCol[i].HasDataAt(rStartRow))
- bFound = true;
- if (!bFound)
- ++rStartRow;
+ bool shrink = true;
+ do
+ {
+ for (i=rStartCol; i<=rEndCol && shrink; i++)
+ if (aCol[i].HasDataAt(rStartRow))
+ shrink = false;
+ if (shrink)
+ ++rStartRow;
+ }while( shrink && rStartRow < MAXROW && rStartRow < rEndRow);
}
}
@@ -838,12 +841,15 @@ void ScTable::GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, S
{
if ( !bBottom && rEndRow > 0 && rStartRow < rEndRow )
{
- bFound = false;
- for (i=rStartCol; i<=rEndCol && !bFound; i++)
- if (aCol[i].HasDataAt(rEndRow))
- bFound = true;
- if (!bFound)
- --rEndRow;
+ bool shrink = true;
+ do
+ {
+ for (i=rStartCol; i<=rEndCol && shrink; i++)
+ if (aCol[i].HasDataAt(rEndRow))
+ shrink = false;
+ if (shrink)
+ --rEndRow;
+ }while( shrink && rEndRow > 0 && rStartRow < rEndRow );
}
}
}
--
1.7.3.4
--------------040306070801060504050807
Content-Type: text/x-patch;
name="0001-if-changes-selection-only-down-this-is-also-valid-fo.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename*0="0001-if-changes-selection-only-down-this-is-also-valid-fo.pa";
filename*1="tch"
More information about the LibreOffice
mailing list