[Spreadsheet] Remove alias from dynamic properties on removeRows/Columns

When removing a row in a spreadsheet which has an assigned alias, the
alias will not be removed from the list of dynamic properties.

This makes it impossible to create a new alias which uses the same name
even if the original was removed (using removeRows/removeColumns)

Fixes #4492
This commit is contained in:
Benjamin Nauck
2021-01-01 18:37:58 +01:00
parent d5092d78f0
commit d525b29fa5
4 changed files with 60 additions and 0 deletions

View File

@@ -1135,6 +1135,14 @@ void Sheet::insertColumns(int col, int count)
void Sheet::removeColumns(int col, int count)
{
// Remove aliases, if defined
for (auto address : cells.getColumns(col, count)) {
auto cell = getCell(address);
std::string aliasStr;
if (cell && cell->getAlias(aliasStr))
removeDynamicProperty(aliasStr.c_str());
}
cells.removeColumns(col, count);
updateColumnsOrRows(true,col,-count);
}
@@ -1163,6 +1171,14 @@ void Sheet::insertRows(int row, int count)
void Sheet::removeRows(int row, int count)
{
// Remove aliases, if defined
for (auto address : cells.getRows(row, count)) {
auto cell = getCell(address);
std::string aliasStr;
if (cell && cell->getAlias(aliasStr))
removeDynamicProperty(aliasStr.c_str());
}
cells.removeRows(row, count);
updateColumnsOrRows(false,row,-count);
}