summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-06-25 11:54:10 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-06-27 15:47:54 -0400
commit18cd17813ebf19ac247d2d8003c3b96fb8582d28 (patch)
tree869d2005072a9a4705ca049d163077ff98344aef /sc
parenta8d277d0d90116d6f8788beb64d9bb563f159464 (diff)
Move a common if statement into the function.
Change-Id: Ic13c9e7bdfea97c4f7782181dc70d6965ba0b6b9
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/dociter.cxx14
1 files changed, 8 insertions, 6 deletions
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index 08d7dbc2f6c2..60696df7e344 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -1762,6 +1762,10 @@ namespace {
bool advanceBlock(size_t nRow, sc::CellStoreType::const_iterator& rPos, const sc::CellStoreType::const_iterator& rEnd)
{
+ if (nRow < rPos->position + rPos->size)
+ // Block already contains the specified row. Nothing to do.
+ return true;
+
// This block is behind the current row position. Advance the block.
for (++rPos; rPos != rEnd; ++rPos)
{
@@ -1789,9 +1793,8 @@ void ScHorizontalCellIterator::Advance()
if (nRow < r.maPos->position)
continue;
- if (r.maPos->position + r.maPos->size <= nRow)
- if (!advanceBlock(nRow, r.maPos, r.maEnd))
- continue;
+ if (!advanceBlock(nRow, r.maPos, r.maEnd))
+ continue;
if (r.maPos->type == sc::element_type_empty)
continue;
@@ -1827,9 +1830,8 @@ void ScHorizontalCellIterator::Advance()
continue;
}
- if (r.maPos->position + r.maPos->size <= nRow)
- if (!advanceBlock(nRow, r.maPos, r.maEnd))
- continue;
+ if (!advanceBlock(nRow, r.maPos, r.maEnd))
+ continue;
if (r.maPos->type == sc::element_type_empty)
{