spreadsheet_ods/style/
stylemap.rs1use crate::condition::Condition;
6use crate::style::AnyStyleRef;
7use crate::CellRef;
8use get_size2::GetSize;
9
10#[derive(Clone, Debug, GetSize)]
16pub struct StyleMap {
17 condition: Condition,
18 applied_style: AnyStyleRef,
19 base_cell: Option<CellRef>,
20}
21
22impl StyleMap {
23 pub fn new_empty() -> Self {
25 Self {
26 condition: Default::default(),
27 applied_style: AnyStyleRef::from(""),
28 base_cell: None,
29 }
30 }
31
32 pub fn new(
36 condition: Condition,
37 applied_style: AnyStyleRef,
38 base_cell: Option<CellRef>,
39 ) -> Self {
40 Self {
41 condition,
42 applied_style,
43 base_cell,
44 }
45 }
46
47 pub fn condition(&self) -> &Condition {
49 &self.condition
50 }
51
52 pub fn set_condition(&mut self, cond: Condition) {
54 self.condition = cond;
55 }
56
57 pub fn applied_style(&self) -> &AnyStyleRef {
59 &self.applied_style
60 }
61
62 pub fn set_applied_style(&mut self, style: AnyStyleRef) {
64 self.applied_style = style;
65 }
66
67 pub fn base_cell(&self) -> Option<&CellRef> {
69 self.base_cell.as_ref()
70 }
71
72 pub fn set_base_cell(&mut self, cellref: Option<CellRef>) {
74 self.base_cell = cellref;
75 }
76}