mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:07:35 +00:00
Spreadsheet: Reimplement ranges as lazy objects instead of arrays
Doing so makes it possible to talk about theoretically infinite ranges like "all of column A".
This commit is contained in:
parent
892e585e9a
commit
91444de2cf
5 changed files with 214 additions and 51 deletions
|
@ -468,12 +468,14 @@ RefPtr<Sheet> Sheet::from_json(const JsonObject& object, Workbook& workbook)
|
|||
return sheet;
|
||||
}
|
||||
|
||||
Position Sheet::written_data_bounds() const
|
||||
Position Sheet::written_data_bounds(Optional<size_t> column_index) const
|
||||
{
|
||||
Position bound;
|
||||
for (auto& entry : m_cells) {
|
||||
for (auto const& entry : m_cells) {
|
||||
if (entry.value->data().is_empty())
|
||||
continue;
|
||||
if (column_index.has_value() && entry.key.column != *column_index)
|
||||
continue;
|
||||
if (entry.key.row >= bound.row)
|
||||
bound.row = entry.key.row;
|
||||
if (entry.key.column >= bound.column)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue