1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:38:11 +00:00

Spreadsheet: Add conditional formatting

Currently only supports setting the foregound and the background colours.
This patch also unifies `foreground_color' and `background_color' used
throughout to a `Format' struct, in hopes of getting more formatting
options one day :P
This commit is contained in:
AnotherTest 2020-09-25 22:31:39 +03:30 committed by Andreas Kling
parent 6902a09e47
commit 395df7b27d
13 changed files with 401 additions and 28 deletions

View file

@ -46,6 +46,12 @@ SheetGlobalObject::~SheetGlobalObject()
JS::Value SheetGlobalObject::get(const JS::PropertyName& name, JS::Value receiver) const
{
if (name.is_string()) {
if (name.as_string() == "value") {
if (auto cell = m_sheet.current_evaluated_cell())
return cell->js_data();
return JS::js_undefined();
}
if (auto pos = Sheet::parse_cell_name(name.as_string()); pos.has_value()) {
auto& cell = m_sheet.ensure(pos.value());
cell.reference_from(m_sheet.current_evaluated_cell());