Skip to main content

visi_core/core/
actions.rs

1use serde::{Deserialize, Serialize};
2
3/// A single edit made to a workbook, recorded so a
4/// host can observe or replay it.
5#[derive(Debug, Clone, Serialize, Deserialize)]
6pub enum SheetAction {
7    /// A cell's raw text was replaced.
8    SetCellSrc {
9        /// Sheet the cell is on.
10        sheet_name: String,
11        /// Column index, 0-based.
12        col: usize,
13        /// Row index, 0-based.
14        row: usize,
15        /// The new text.
16        src: String,
17    },
18    /// A column was renamed.
19    UpdateColName {
20        /// Sheet the column is on.
21        sheet_name: String,
22        /// Column index, 0-based.
23        col: usize,
24        /// The new name.
25        name: String,
26    },
27    /// A sheet was renamed.
28    UpdateTableName {
29        /// The sheet's previous name.
30        old_name: String,
31        /// Its new name.
32        new_name: String,
33    },
34    /// An empty row was inserted.
35    InsertRow {
36        /// Sheet the row was inserted on.
37        sheet_name: String,
38        /// Position it was inserted at, 0-based.
39        index: usize,
40    },
41    /// A row was deleted.
42    DeleteRow {
43        /// Sheet the row was deleted from.
44        sheet_name: String,
45        /// Position it occupied, 0-based.
46        index: usize,
47    },
48    /// An empty column was inserted.
49    InsertCol {
50        /// Sheet the column was inserted on.
51        sheet_name: String,
52        /// Position it was inserted at, 0-based.
53        index: usize,
54    },
55    /// A column was deleted.
56    DeleteCol {
57        /// Sheet the column was deleted from.
58        sheet_name: String,
59        /// Position it occupied, 0-based.
60        index: usize,
61    },
62    /// A sheet was added to the workbook.
63    AddTable {
64        /// The sheet, in full.
65        sheet: Box<crate::core::Sheet>,
66    },
67    /// A sheet was removed from the workbook.
68    DeleteTable {
69        /// Name of the sheet that was removed.
70        sheet_name: String,
71    },
72}