1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:37:35 +00:00

Spreadsheet: Let the cells know their own position in the sheet

This commit is contained in:
AnotherTest 2020-09-26 15:29:11 +03:30 committed by Andreas Kling
parent 13ce24de13
commit f159d161fa
7 changed files with 227 additions and 22 deletions

View file

@ -245,12 +245,12 @@ RefPtr<Sheet> Sheet::from_json(const JsonObject& object, Workbook& workbook)
OwnPtr<Cell> cell;
switch (kind) {
case Cell::LiteralString:
cell = make<Cell>(obj.get("value").to_string(), sheet->make_weak_ptr());
cell = make<Cell>(obj.get("value").to_string(), position, sheet->make_weak_ptr());
break;
case Cell::Formula: {
auto& interpreter = sheet->interpreter();
auto value = interpreter.call(parse_function, json, JS::js_string(interpreter.heap(), obj.get("value").as_string()));
cell = make<Cell>(obj.get("source").to_string(), move(value), sheet->make_weak_ptr());
cell = make<Cell>(obj.get("source").to_string(), move(value), position, sheet->make_weak_ptr());
break;
}
}