Files
ElyOffice/crates/ely-lok/src/commands/sheet.rs
T
ZacharyZhang-NYandClaude Opus 5.5 87886c8a8d R5.5: ElyTable right-click menus, Excel-style; three rounds used, last fixes tested
Grid and header menus share ely_office::menu with ElyDoc. Each item's
availability is the kernel's state for the exact command it runs
(patch 0045). Patch 0046 lets a header select its row or column while
a shape is selected or its text is edited: the view shell ends the
drawing edit, keeps the typed text, leaves drawing mode, then marks.
Ely no longer sends Esc first.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-14 13:02:10 -04:00

173 lines
4.6 KiB
Rust

//! Spreadsheet rows: sheets, cells, rows and columns.
use super::{Arg, Check, Command, command};
/// A sheet position, counted from 1.
const SHEET: Arg = Arg::Int("Index", "unsigned short", 1, 10000);
/// The selection modifier: none, Shift or the command key.
const MODIFIER: Arg = Arg::Int("Modifier", "short", 0, 0x3000);
/// Workbook and range editing commands (TABLE-01, TABLE-02).
pub(super) const ROWS: &[Command] = &[
command(
"sheet.insert",
".uno:Insert",
&[Arg::Text("Name"), SHEET],
Check::Undoable,
),
command(
"sheet.rename",
".uno:Name",
&[Arg::Text("Name"), SHEET],
Check::Undoable,
),
command(
"sheet.move",
".uno:Move",
&[SHEET, Arg::Bool("Copy"), Arg::Bool("UseCurrentDocument")],
Check::Undoable,
),
command(
"sheet.hide",
".uno:Hide",
&[Arg::Int("nTabNumber", "short", 0, 9999)],
Check::Undoable,
),
command(
"sheet.show",
".uno:Show",
&[Arg::Text("aTableName")],
Check::Undoable,
),
command("sheet.delete", ".uno:Remove", &[SHEET], Check::Undoable),
command(
"cell.goto",
".uno:GoToCell",
&[Arg::Text("ToPoint")],
Check::Result,
),
command(
"cell.enter",
".uno:EnterString",
&[Arg::Loose("StringName")],
Check::Undoable,
),
command(
"rows.insert_above",
".uno:InsertRowsBefore",
&[],
Check::Undoable,
),
command(
"rows.insert_below",
".uno:InsertRowsAfter",
&[],
Check::Undoable,
),
command(
"columns.insert_before",
".uno:InsertColumnsBefore",
&[],
Check::Undoable,
),
command(
"columns.insert_after",
".uno:InsertColumnsAfter",
&[],
Check::Undoable,
),
command("rows.delete", ".uno:DeleteRows", &[], Check::Undoable),
command("columns.delete", ".uno:DeleteColumns", &[], Check::Undoable),
// Flags: V shifts down, > shifts right.
command(
"cells.insert",
".uno:InsertCell",
&[Arg::Text("Flags")],
Check::Undoable,
),
// Flags: U shifts up, L shifts left.
command(
"cells.delete",
".uno:DeleteCell",
&[Arg::Text("Flags")],
Check::Undoable,
),
command(
"cells.merge",
".uno:MergeCells",
&[Arg::Bool("MoveContents")],
Check::Undoable,
),
command("cells.split", ".uno:SplitCell", &[], Check::Undoable),
command("cells.clear", ".uno:ClearContents", &[], Check::Undoable),
command("view.freeze", ".uno:FreezePanes", &[], Check::Finished),
command("rows.hide", ".uno:HideRow", &[], Check::Undoable),
command("rows.show", ".uno:ShowRow", &[], Check::Undoable),
command("columns.hide", ".uno:HideColumn", &[], Check::Undoable),
command("columns.show", ".uno:ShowColumn", &[], Check::Undoable),
// Sizes in 1/100 mm; rows and columns from 1.
command(
"rows.height",
".uno:RowHeight",
&[
Arg::Int("RowHeight", "unsigned short", 1, 65535),
Arg::Int("Row", "long", 1, 1048576),
],
Check::Undoable,
),
command(
"columns.width",
".uno:ColumnWidth",
&[
Arg::Int("ColumnWidth", "unsigned short", 1, 65535),
Arg::Int("Column", "unsigned short", 1, 16384),
],
Check::Undoable,
),
// The same sizes for every selected row or column.
command(
"rows.height_selected",
".uno:RowHeight",
&[Arg::Int("RowHeight", "unsigned short", 1, 65535)],
Check::Undoable,
),
command(
"columns.width_selected",
".uno:ColumnWidth",
&[Arg::Int("ColumnWidth", "unsigned short", 1, 65535)],
Check::Undoable,
),
command(
"rows.optimal",
".uno:SetOptimalRowHeight",
&[Arg::Int("aExtraHeight", "unsigned short", 0, 0)],
Check::Undoable,
),
command(
"columns.optimal",
".uno:SetOptimalColumnWidth",
&[Arg::Int("aExtraWidth", "unsigned short", 0, 0)],
Check::Undoable,
),
// Rows and columns from 0.
command(
"select.column",
".uno:SelectColumn",
&[Arg::Int("Col", "long", 0, 16383), MODIFIER],
Check::Finished,
),
command(
"select.row",
".uno:SelectRow",
&[Arg::Int("Row", "long", 0, 1048575), MODIFIER],
Check::Finished,
),
command(
"fill.auto",
".uno:AutoFill",
&[Arg::Text("EndCell")],
Check::Undoable,
),
];