spreadsheet_ods/style/
tablestyle.rs1use crate::attrmap2::AttrMap2;
2use crate::color::Rgb;
3use crate::style::units::{
4 Length, Margin, PageBreak, PageNumber, RelativeScale, TableAlign, TableBorderModel, TextKeep,
5 WritingMode,
6};
7use crate::style::AnyStyleRef;
8use crate::style::{color_string, shadow_string, MasterPageRef, StyleOrigin, StyleUse};
9use core::borrow::Borrow;
10use get_size2::GetSize;
11
12style_ref2!(TableStyleRef);
13
14#[derive(Debug, Clone, GetSize)]
17pub struct TableStyle {
18 origin: StyleOrigin,
20 styleuse: StyleUse,
22 name: String,
24 attr: AttrMap2,
26 tablestyle: AttrMap2,
28}
29
30styles_styles2!(TableStyle, TableStyleRef);
31
32impl TableStyle {
33 pub fn new_empty() -> Self {
35 Self {
36 origin: Default::default(),
37 styleuse: Default::default(),
38 name: Default::default(),
39 attr: Default::default(),
40 tablestyle: Default::default(),
41 }
42 }
43
44 pub fn new<S: AsRef<str>>(name: S) -> Self {
46 Self {
47 origin: Default::default(),
48 styleuse: Default::default(),
49 name: String::from(name.as_ref()),
50 attr: Default::default(),
51 tablestyle: Default::default(),
52 }
53 }
54
55 style_master_page!(attr);
56
57 pub fn attrmap(&self) -> &AttrMap2 {
59 &self.attr
60 }
61
62 pub fn attrmap_mut(&mut self) -> &mut AttrMap2 {
64 &mut self.attr
65 }
66
67 pub fn tablestyle(&self) -> &AttrMap2 {
69 &self.tablestyle
70 }
71
72 pub fn tablestyle_mut(&mut self) -> &mut AttrMap2 {
74 &mut self.tablestyle
75 }
76
77 fo_background_color!(tablestyle);
78 fo_break!(tablestyle);
79 fo_keep_with_next!(tablestyle);
80 fo_margin!(tablestyle);
81 style_may_break_between_rows!(tablestyle);
82 style_page_number!(tablestyle);
83 style_rel_width!(tablestyle);
84 style_width!(tablestyle);
85 style_shadow!(tablestyle);
86 style_writing_mode!(tablestyle);
87
88 table_align!(tablestyle);
89 table_border_model!(tablestyle);
90 table_display!(tablestyle);
91 table_tab_color!(tablestyle);
92}