Spreadsheet: Issue #2402: Added functionality to get cell address given an alias.

This commit is contained in:
Eivind Kvedalen
2016-01-15 23:36:27 +01:00
committed by wmayer
parent a583697e5a
commit d45a95bf3a
6 changed files with 70 additions and 0 deletions

View File

@@ -1131,6 +1131,21 @@ void Sheet::setComputedUnit(CellAddress address, const Base::Unit &unit)
void Sheet::setAlias(CellAddress address, const std::string &alias)
{
cells.setAlias(address, alias);
/**
* @brief Get cell given an alias string
* @param alias Alias for cell
*
* @returns Name of cell, or empty string if not defined
*/
std::string Sheet::getAddressFromAlias(const std::string &alias) const
{
const Cell * cell = cells.getValueFromAlias(alias);
if (cell)
return cell->getAddress().toString();
else
return std::string();
}
/**