mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 21:59:07 +00:00
Spreadsheet: Implement the cut operation for cells
This is done by adding another field to our custom text/x-spreadsheet-data mime-type that specifies the action (just copy/cut for now)
This commit is contained in:
parent
b474f49164
commit
147d30ae4f
Notes:
sideshowbarker
2024-07-18 21:49:08 +09:00
Author: https://github.com/IdanHo
Commit: 147d30ae4f
Pull-request: https://github.com/SerenityOS/serenity/pull/5559
Issue: https://github.com/SerenityOS/serenity/issues/4275
3 changed files with 25 additions and 10 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020, the SerenityOS developers.
|
||||
* Copyright (c) 2020-2021, the SerenityOS developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -325,7 +325,7 @@ Position Sheet::offset_relative_to(const Position& base, const Position& offset,
|
|||
return { new_column, new_row };
|
||||
}
|
||||
|
||||
void Sheet::copy_cells(Vector<Position> from, Vector<Position> to, Optional<Position> resolve_relative_to)
|
||||
void Sheet::copy_cells(Vector<Position> from, Vector<Position> to, Optional<Position> resolve_relative_to, CopyOperation copy_operation)
|
||||
{
|
||||
auto copy_to = [&](auto& source_position, Position target_position) {
|
||||
auto& target_cell = ensure(target_position);
|
||||
|
@ -337,6 +337,8 @@ void Sheet::copy_cells(Vector<Position> from, Vector<Position> to, Optional<Posi
|
|||
}
|
||||
|
||||
target_cell.copy_from(*source_cell);
|
||||
if (copy_operation == CopyOperation::Cut)
|
||||
source_cell->set_data("");
|
||||
};
|
||||
|
||||
if (from.size() == to.size()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue