mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-15 06:52:23 +00:00
Parse IDML table options
This commit is contained in:
1 file changed
+32
@@ -78,6 +78,19 @@ pub struct AlternatingStrokeValues {
|
||||
pub skip_last: Option<f64>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq)]
|
||||
pub struct TableOptions {
|
||||
pub direction: Option<String>,
|
||||
pub header_rows: Option<f64>,
|
||||
pub footer_rows: Option<f64>,
|
||||
pub applied_style: Option<String>,
|
||||
pub space_before: Option<f64>,
|
||||
pub space_after: Option<f64>,
|
||||
pub repeat_header: bool,
|
||||
pub repeat_footer: bool,
|
||||
pub borders: [StrokeValues; 4],
|
||||
}
|
||||
|
||||
impl Values {
|
||||
/// The attributes and `<Properties>` of `el`.
|
||||
pub fn of(el: &El) -> Values {
|
||||
@@ -240,6 +253,25 @@ impl Values {
|
||||
skip_last: num(&format!("SkipLastAlternatingStroke{kind}s")),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn table_options(&self) -> TableOptions {
|
||||
TableOptions {
|
||||
direction: self.value("TableDirection"),
|
||||
header_rows: self.num("HeaderRowCount"),
|
||||
footer_rows: self.num("FooterRowCount"),
|
||||
applied_style: self.value("AppliedTableStyle"),
|
||||
space_before: self.num("SpaceBefore"),
|
||||
space_after: self.num("SpaceAfter"),
|
||||
repeat_header: self.get("HeaderBehavior") != Some("RepeatOnce"),
|
||||
repeat_footer: self.get("FooterBehavior") != Some("RepeatOnce"),
|
||||
borders: [
|
||||
self.stroke_values("TopBorder"),
|
||||
self.stroke_values("LeftBorder"),
|
||||
self.stroke_values("BottomBorder"),
|
||||
self.stroke_values("RightBorder"),
|
||||
],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// `el` without its indentation: the whitespace-only text between the children of an element
|
||||
|
||||
Reference in new issue
Block a user