mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-10 18:10:56 +09:00
Spreadsheet: Make it possible to refer to ranges in other sheets
Now the range A0:C4 in a sheet named "foo" can be represented as: R`sheet("foo"):A0:C4` This makes it possible to do cross-sheet lookups and more.
This commit is contained in:
parent
2104e9a6e4
commit
746b8ec8de
Notes:
sideshowbarker
2024-07-17 09:57:11 +09:00
Author: https://github.com/alimpfard
Commit: 746b8ec8de
Pull-request: https://github.com/SerenityOS/serenity/pull/14391
Reviewed-by: https://github.com/linusg ✅
4 changed files with 93 additions and 20 deletions
|
@ -154,6 +154,7 @@ void SheetGlobalObject::initialize_global_object()
|
|||
define_native_function("column_arithmetic", column_arithmetic, 2, attr);
|
||||
define_native_function("column_index", column_index, 1, attr);
|
||||
define_native_function("get_column_bound", get_column_bound, 1, attr);
|
||||
define_native_accessor("name", get_name, nullptr, attr);
|
||||
}
|
||||
|
||||
void SheetGlobalObject::visit_edges(Visitor& visitor)
|
||||
|
@ -167,6 +168,17 @@ void SheetGlobalObject::visit_edges(Visitor& visitor)
|
|||
}
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::get_name)
|
||||
{
|
||||
auto* this_object = TRY(vm.this_value(global_object).to_object(global_object));
|
||||
|
||||
if (!is<SheetGlobalObject>(this_object))
|
||||
return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "SheetGlobalObject");
|
||||
|
||||
auto sheet_object = static_cast<SheetGlobalObject*>(this_object);
|
||||
return JS::js_string(global_object.heap(), sheet_object->m_sheet.name());
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::get_real_cell_contents)
|
||||
{
|
||||
auto* this_object = TRY(vm.this_value(global_object).to_object(global_object));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue