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