Spreadsheet: Fixed issue #2352, removal of rows and columns.
This commit is contained in:
parent
4b5ae54e88
commit
71605e63ef
|
@ -567,8 +567,9 @@ public:
|
|||
if (varExpr) {
|
||||
static const boost::regex e("(\\${0,1})([A-Za-z]+)(\\${0,1})([0-9]+)");
|
||||
boost::cmatch cm;
|
||||
std::string s = varExpr->name();
|
||||
|
||||
if (boost::regex_match(varExpr->name().c_str(), cm, e)) {
|
||||
if (boost::regex_match(s.c_str(), cm, e)) {
|
||||
const boost::sub_match<const char *> colstr = cm[2];
|
||||
const boost::sub_match<const char *> rowstr = cm[4];
|
||||
int thisRow, thisCol;
|
||||
|
@ -590,11 +591,11 @@ public:
|
|||
CellAddress to(r.to());
|
||||
|
||||
if (from.row() >= mRow || from.col() >= mCol) {
|
||||
from = CellAddress(from.row() + mRowCount, from.col() + mColCount);
|
||||
from = CellAddress(std::max(0, from.row() + mRowCount), std::max(0, from.col() + mColCount));
|
||||
mChanged = true;
|
||||
}
|
||||
if (to.row() >= mRow || to.col() >= mCol) {
|
||||
to = CellAddress(to.row() + mRowCount, to.col() + mColCount);
|
||||
to = CellAddress(std::max(0, to.row() + mRowCount), std::max(0, to.col() + mColCount));
|
||||
mChanged = true;
|
||||
}
|
||||
rangeExpr->setRange(Range(from, to));
|
||||
|
@ -667,7 +668,7 @@ void PropertySheet::removeRows(int row, int count)
|
|||
/* Sort them */
|
||||
std::sort(keys.begin(), keys.end(), boost::bind(&PropertySheet::rowSortFunc, this, _1, _2));
|
||||
|
||||
RewriteExpressionVisitor visitor(CellAddress(row + count, CellAddress::MAX_COLUMNS), -count, 0);
|
||||
RewriteExpressionVisitor visitor(CellAddress(row + count - 1, CellAddress::MAX_COLUMNS), -count, 0);
|
||||
|
||||
Signaller signaller(*this);
|
||||
for (std::vector<CellAddress>::const_iterator i = keys.begin(); i != keys.end(); ++i) {
|
||||
|
@ -753,7 +754,7 @@ void PropertySheet::removeColumns(int col, int count)
|
|||
/* Sort them */
|
||||
std::sort(keys.begin(), keys.end(), boost::bind(&PropertySheet::colSortFunc, this, _1, _2));
|
||||
|
||||
RewriteExpressionVisitor visitor(CellAddress(CellAddress::MAX_ROWS, col + count), 0, -count);
|
||||
RewriteExpressionVisitor visitor(CellAddress(CellAddress::MAX_ROWS, col + count - 1), 0, -count);
|
||||
|
||||
Signaller signaller(*this);
|
||||
for (std::vector<CellAddress>::const_iterator i = keys.begin(); i != keys.end(); ++i) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user