summaryrefslogtreecommitdiff
path: root/sc/source/core/tool/scmatrix.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/core/tool/scmatrix.cxx')
-rw-r--r--sc/source/core/tool/scmatrix.cxx32
1 files changed, 26 insertions, 6 deletions
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 998f56203be7..4398308bf90e 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -1999,6 +1999,31 @@ public:
}
};
+namespace {
+
+MatrixImplType::position_type increment_position(const MatrixImplType::position_type& pos, size_t n)
+{
+ MatrixImplType::position_type ret = pos;
+ do
+ {
+ if (ret.second + n < ret.first->size)
+ {
+ ret.second += n;
+ break;
+ }
+ else
+ {
+ n -= (ret.first->size - ret.second);
+ ++ret.first;
+ ret.second = 0;
+ }
+ }
+ while (n > 0);
+ return ret;
+}
+
+}
+
template<typename T>
struct MatrixOpWrapper
{
@@ -2027,7 +2052,6 @@ public:
block_type::const_iterator itEnd = block_type::end(*node.data);
MatrixIteratorWrapper<block_type, T> aFunc(it, itEnd, maOp);
pos = mrMat.set(pos,aFunc.begin(), aFunc.end());
- ++pos.first;
}
break;
case mdds::mtm::element_boolean:
@@ -2039,7 +2063,6 @@ public:
MatrixIteratorWrapper<block_type, T> aFunc(it, itEnd, maOp);
pos = mrMat.set(pos, aFunc.begin(), aFunc.end());
- ++pos.first;
}
break;
case mdds::mtm::element_string:
@@ -2051,7 +2074,6 @@ public:
MatrixIteratorWrapper<block_type, T> aFunc(it, itEnd, maOp);
pos = mrMat.set(pos, aFunc.begin(), aFunc.end());
- ++pos.first;
}
break;
case mdds::mtm::element_empty:
@@ -2061,15 +2083,13 @@ public:
std::vector<char> aVec(node.size);
MatrixIteratorWrapper<std::vector<char>, T> aFunc(aVec.begin(), aVec.end(), maOp);
pos = mrMat.set(pos, aFunc.begin(), aFunc.end());
- ++pos.first;
}
- else
- pos.second += node.size;
}
break;
default:
;
}
+ pos = increment_position(pos, node.size);
}
};