Spreadsheet: do not create string property for empty cell

Otherwise may cause massive slow down when, for example, the user
changes the entire row/column color, which results in large amount of
empty cells.
This commit is contained in:
Zheng, Lei
2021-04-04 15:27:26 +08:00
committed by Chris Hennes
parent 8df2f885e1
commit 68299281d3
2 changed files with 11 additions and 4 deletions

View File

@@ -288,6 +288,8 @@ void Cell::setContent(const char * value)
clearException();
if (value) {
if (owner->sheet()->isRestoring()) {
if (value[0] == '\0' || (value[0] == '\'' && value[1] == '\0'))
return;
expression.reset(new App::StringExpression(owner->sheet(), value));
setUsed(EXPRESSION_SET, true);
return;
@@ -302,7 +304,10 @@ void Cell::setContent(const char * value)
}
}
else if (*value == '\'') {
newExpr = std::make_unique<App::StringExpression>(owner->sheet(), value + 1);
if (value[1] == '\0')
value = nullptr;
else
newExpr = std::make_unique<App::StringExpression>(owner->sheet(), value + 1);
}
else if (*value != '\0') {
// check if value is just a number