use std::fmt::{Display, Formatter};
use crate::attrmap2::AttrMap2;
use crate::style::units::{Length, PageBreak};
use crate::style::ParseStyleAttr;
use crate::style::{rel_width_string, StyleOrigin, StyleUse};
use crate::OdsError;
style_ref!(ColStyleRef);
#[derive(Debug, Clone)]
pub struct ColStyle {
origin: StyleOrigin,
styleuse: StyleUse,
name: String,
attr: AttrMap2,
colstyle: AttrMap2,
}
styles_styles!(ColStyle, ColStyleRef);
impl ColStyle {
pub fn new_empty() -> Self {
Self {
origin: Default::default(),
styleuse: Default::default(),
name: Default::default(),
attr: Default::default(),
colstyle: Default::default(),
}
}
pub fn new<S: Into<String>>(name: S) -> Self {
Self {
origin: Default::default(),
styleuse: Default::default(),
name: name.into(),
attr: Default::default(),
colstyle: Default::default(),
}
}
pub fn attrmap(&self) -> &AttrMap2 {
&self.attr
}
pub fn attrmap_mut(&mut self) -> &mut AttrMap2 {
&mut self.attr
}
pub fn colstyle(&self) -> &AttrMap2 {
&self.colstyle
}
pub fn colstyle_mut(&mut self) -> &mut AttrMap2 {
&mut self.colstyle
}
fo_break!(colstyle);
style_column_width!(colstyle);
style_rel_column_width!(colstyle);
style_use_optimal_column_width!(colstyle);
}