excel_cli/actions/
cell.rs

1use super::{ActionType, Command};
2use crate::excel::Cell;
3use anyhow::Result;
4
5#[derive(Clone)]
6pub struct CellAction {
7    pub sheet_index: usize,
8    pub sheet_name: String,
9    pub row: usize,
10    pub col: usize,
11    pub old_value: Cell,
12    pub new_value: Cell,
13    pub action_type: ActionType,
14}
15
16impl CellAction {
17    pub fn new(
18        sheet_index: usize,
19        sheet_name: String,
20        row: usize,
21        col: usize,
22        old_value: Cell,
23        new_value: Cell,
24        action_type: ActionType,
25    ) -> Self {
26        Self {
27            sheet_index,
28            sheet_name,
29            row,
30            col,
31            old_value,
32            new_value,
33            action_type,
34        }
35    }
36}
37
38impl Command for CellAction {
39    fn execute(&self) -> Result<()> {
40        unimplemented!("Requires an ActionExecutor implementation")
41    }
42
43    fn undo(&self) -> Result<()> {
44        unimplemented!("Requires an ActionExecutor implementation")
45    }
46
47    fn action_type(&self) -> ActionType {
48        self.action_type.clone()
49    }
50}