Files
ElyOffice/crates/ely-lok/src/commands/layout.rs
T

282 lines
7.5 KiB
Rust

//! Layout rows: pages, headers, fields, tables, images.
use super::{Arg, Check, Command, command};
/// Page, table and object commands.
pub(super) const ROWS: &[Command] = &[
command(
"page.size",
".uno:AttributePageSize",
&[
Arg::Int("AttributePageSize.Width", "long", 1_000, 600_000),
Arg::Int("AttributePageSize.Height", "long", 1_000, 600_000),
],
Check::Undoable,
),
command(
"page.orientation",
".uno:AttributePageSize",
&[
Arg::Int("AttributePageSize.Width", "long", 1_000, 600_000),
Arg::Int("AttributePageSize.Height", "long", 1_000, 600_000),
Arg::Bool("AttributePage.Landscape"),
Arg::Int("AttributePage.Layout", "long", 0, 3),
Arg::Int("AttributePage.NumType", "long", 0, 99),
],
Check::Undoable,
),
command(
"page.margins_lr",
".uno:PageLRMargin",
&[
Arg::Int("Page.Left", "long", 0, 99_990),
Arg::Int("Page.Right", "long", 0, 99_990),
],
Check::Undoable,
),
command(
"page.margins_ul",
".uno:PageULMargin",
&[
Arg::Int("Page.Upper", "long", 0, 99_990),
Arg::Int("Page.Lower", "long", 0, 99_990),
],
Check::Undoable,
),
command(
"page.columns",
".uno:PageColumnType",
&[Arg::Int("PageColumnType", "short", 1, 3)],
Check::Undoable,
),
command("page.break", ".uno:InsertPagebreak", &[], Check::Undoable),
command(
"page.section",
".uno:InsertBreak",
&[Arg::Int("Kind", "short", 3, 3), Arg::Text("TemplateName")],
Check::Undoable,
),
command(
"header.on",
".uno:SwPageHeaderItem",
&[Arg::Bool("SwPageHeaderItem")],
Check::Undoable,
),
command(
"footer.on",
".uno:SwPageFooterItem",
&[Arg::Bool("SwPageFooterItem")],
Check::Undoable,
),
command(
"header.layout",
".uno:SwPageHeaderLayout",
&[Arg::Int("SwPageHeaderLayout", "short", 0, 3)],
Check::Undoable,
),
command(
"footer.layout",
".uno:SwPageFooterLayout",
&[Arg::Int("SwPageFooterLayout", "short", 0, 3)],
Check::Undoable,
),
command(
"field.page",
".uno:InsertPageNumberField",
&[],
Check::Undoable,
),
command(
"field.pages",
".uno:InsertPageCountField",
&[],
Check::Undoable,
),
command(
"table.insert",
".uno:InsertTable",
&[
Arg::Int("Columns", "unsigned short", 1, 99),
Arg::Int("Rows", "unsigned short", 1, 999),
],
Check::Undoable,
),
command(
"table.row_above",
".uno:InsertRowsBefore",
&[],
Check::Undoable,
),
command(
"table.row_below",
".uno:InsertRowsAfter",
&[],
Check::Undoable,
),
command(
"table.column_left",
".uno:InsertColumnsBefore",
&[],
Check::Undoable,
),
command(
"table.column_right",
".uno:InsertColumnsAfter",
&[],
Check::Undoable,
),
command("table.delete_rows", ".uno:DeleteRows", &[], Check::Undoable),
command(
"table.delete_columns",
".uno:DeleteColumns",
&[],
Check::Undoable,
),
command("table.delete", ".uno:DeleteTable", &[], Check::Undoable),
command("table.merge", ".uno:MergeCells", &[], Check::Undoable),
command("table.select", ".uno:SelectTable", &[], Check::Result),
command(
"table.split",
".uno:SplitCell",
&[Arg::Int("Amount", "long", 2, 9), Arg::Bool("Horizontal")],
Check::Undoable,
),
command(
"table.even_columns",
".uno:DistributeColumns",
&[],
Check::Undoable,
),
command(
"table.optimal_height",
".uno:SetOptimalRowHeight",
&[],
Check::Undoable,
),
command(
"table.even_rows",
".uno:DistributeRows",
&[],
Check::Undoable,
),
command(
"table.border",
".uno:TableChangeCurrentBorderPosition",
&[
Arg::Text("BorderType"),
Arg::Int("Index", "unsigned short", 0, 999),
Arg::Int("Offset", "long", -600_000, 600_000),
],
Check::Undoable,
),
command(
"table.borders_all",
".uno:SetBorderStyle",
&[
Arg::Line("OuterBorder.LeftBorder", true),
Arg::Line("OuterBorder.RightBorder", true),
Arg::Line("OuterBorder.TopBorder", true),
Arg::Line("OuterBorder.BottomBorder", true),
Arg::Line("InnerBorder.Horizontal", true),
Arg::Line("InnerBorder.Vertical", true),
],
Check::Undoable,
),
command(
"table.borders_none",
".uno:SetBorderStyle",
&[
Arg::Line("OuterBorder.LeftBorder", false),
Arg::Line("OuterBorder.RightBorder", false),
Arg::Line("OuterBorder.TopBorder", false),
Arg::Line("OuterBorder.BottomBorder", false),
Arg::Line("InnerBorder.Horizontal", false),
Arg::Line("InnerBorder.Vertical", false),
],
Check::Undoable,
),
command(
"table.shading",
".uno:TableCellBackgroundColor",
&[Arg::Int(
"TableCellBackgroundColor.Color",
"long",
-1,
0xFF_FFFF,
)],
Check::Undoable,
),
command(
"table.repeat_heading",
".uno:HeadingRowsRepeat",
&[],
Check::Undoable,
),
command(
"table.row_split",
".uno:RowSplit",
&[Arg::Bool("RowSplit")],
Check::Undoable,
),
command(
"image.insert",
".uno:InsertGraphic",
&[Arg::Text("FileName")],
Check::Undoable,
),
command(
"image.anchor_page",
".uno:SetAnchorToPage",
&[],
Check::Undoable,
),
command(
"image.anchor_paragraph",
".uno:SetAnchorToPara",
&[],
Check::Undoable,
),
command(
"image.anchor_char",
".uno:SetAnchorAtChar",
&[],
Check::Undoable,
),
command(
"image.anchor_as_char",
".uno:SetAnchorToChar",
&[],
Check::Undoable,
),
command("image.wrap_off", ".uno:WrapOff", &[], Check::Undoable),
command("image.wrap_on", ".uno:WrapOn", &[], Check::Undoable),
command("image.wrap_ideal", ".uno:WrapIdeal", &[], Check::Undoable),
command("image.wrap_left", ".uno:WrapLeft", &[], Check::Undoable),
command("image.wrap_right", ".uno:WrapRight", &[], Check::Undoable),
command(
"image.wrap_through",
".uno:WrapThrough",
&[],
Check::Undoable,
),
command("image.front", ".uno:BringToFront", &[], Check::Undoable),
command("image.back", ".uno:SendToBack", &[], Check::Undoable),
command(
"image.forward",
".uno:ObjectForwardOne",
&[],
Check::Undoable,
),
command("image.backward", ".uno:ObjectBackOne", &[], Check::Undoable),
command("image.crop", ".uno:Crop", &[], Check::Cropping),
command(
"image.size",
".uno:TransformDialog",
&[
Arg::Int("TransformWidth", "uint32", 57, 340_000),
Arg::Int("TransformHeight", "uint32", 57, 340_000),
],
Check::Undoable,
),
];