spreadsheet_ods/style/
rowstyle.rs1use crate::color::Rgb;
2use get_size::GetSize;
3
4use crate::attrmap2::AttrMap2;
5use crate::style::units::{Length, PageBreak, TextKeep};
6use crate::style::AnyStyleRef;
7use crate::style::ParseStyleAttr;
8use crate::style::{color_string, StyleOrigin, StyleUse};
9use crate::OdsError;
10use get_size_derive::GetSize;
11use std::borrow::Borrow;
12
13style_ref2!(RowStyleRef);
14
15#[derive(Debug, Clone, GetSize)]
20pub struct RowStyle {
21 origin: StyleOrigin,
23 styleuse: StyleUse,
25 name: String,
27 attr: AttrMap2,
29 rowstyle: AttrMap2,
31}
32
33styles_styles2!(RowStyle, RowStyleRef);
34
35impl RowStyle {
36 pub fn new_empty() -> Self {
38 Self {
39 origin: Default::default(),
40 styleuse: Default::default(),
41 name: Default::default(),
42 attr: Default::default(),
43 rowstyle: Default::default(),
44 }
45 }
46
47 pub fn new<S: AsRef<str>>(name: S) -> Self {
49 Self {
50 origin: Default::default(),
51 styleuse: Default::default(),
52 name: name.as_ref().to_string(),
53 attr: Default::default(),
54 rowstyle: Default::default(),
55 }
56 }
57
58 pub fn attrmap(&self) -> &AttrMap2 {
60 &self.attr
61 }
62
63 pub fn attrmap_mut(&mut self) -> &mut AttrMap2 {
65 &mut self.attr
66 }
67
68 pub fn rowstyle(&self) -> &AttrMap2 {
70 &self.rowstyle
71 }
72
73 pub fn rowstyle_mut(&mut self) -> &mut AttrMap2 {
75 &mut self.rowstyle
76 }
77
78 fo_background_color!(rowstyle);
79 fo_break!(rowstyle);
80 fo_keep_together!(rowstyle);
81 style_min_row_height!(rowstyle);
82 style_row_height!(rowstyle);
83 style_use_optimal_row_height!(rowstyle);
84}