[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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user