summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-03-07 14:23:46 -0500
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-03-07 14:25:05 -0500
commit01de94471c20a8b9c36d6080638d70e57eac55bf (patch)
treec05716b7178d5404e4d00b22471c0559ca6b95a8
parent9d54a7f67196cac2a5701c06d8dc55f102d0af60 (diff)
fdo#75718: Correctly count the length of trailing empty range.
This affects auto fill, apparently. Change-Id: I653918d374122bc9bb938231934c149da79a3306
-rw-r--r--sc/source/core/data/column2.cxx10
1 files changed, 5 insertions, 5 deletions
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 6c6e47e4a98d..38eb94e908b7 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -1214,13 +1214,13 @@ bool ScColumn::IsNotesEmptyBlock(SCROW nStartRow, SCROW nEndRow) const
SCSIZE ScColumn::GetEmptyLinesInBlock( SCROW nStartRow, SCROW nEndRow, ScDirection eDir ) const
{
- // Given a range of rows, find a top or bottom empty segment.
+ // Given a range of rows, find a top or bottom empty segment. Skip the start row.
switch (eDir)
{
case DIR_TOP:
{
// Determine the length of empty head segment.
- size_t nLength = nEndRow - nStartRow + 1;
+ size_t nLength = nEndRow - nStartRow;
std::pair<sc::CellStoreType::const_iterator,size_t> aPos = maCells.position(nStartRow);
sc::CellStoreType::const_iterator it = aPos.first;
if (it->type != sc::element_type_empty)
@@ -1234,8 +1234,8 @@ SCSIZE ScColumn::GetEmptyLinesInBlock( SCROW nStartRow, SCROW nEndRow, ScDirecti
break;
case DIR_BOTTOM:
{
- // Determine the length empty tail segment.
- size_t nLength = nEndRow - nStartRow + 1;
+ // Determine the length of empty tail segment.
+ size_t nLength = nEndRow - nStartRow;
std::pair<sc::CellStoreType::const_iterator,size_t> aPos = maCells.position(nEndRow);
sc::CellStoreType::const_iterator it = aPos.first;
if (it->type != sc::element_type_empty)
@@ -1243,7 +1243,7 @@ SCSIZE ScColumn::GetEmptyLinesInBlock( SCROW nStartRow, SCROW nEndRow, ScDirecti
return 0;
// length of this empty block from the tip to the end row position.
- size_t nThisLen = aPos.second;
+ size_t nThisLen = aPos.second + 1;
return std::min(nThisLen, nLength);
}
break;