use super::element::{Element, ElementBase};
#[derive(Debug, Clone)]
#[allow(dead_code)]
pub struct Document {
element: Element,
}
#[allow(dead_code)]
impl Document {
pub fn new() -> Self {
Self {
element: Element::new("office:document"),
}
}
pub fn version(&self) -> Option<&str> {
self.element.get_attribute("office:version")
}
}
#[derive(Debug, Clone)]
#[allow(dead_code)]
pub struct Body {
element: Element,
}
#[allow(dead_code)]
impl Body {
pub fn new() -> Self {
Self {
element: Element::new("office:body"),
}
}
pub fn body_type(&self) -> Option<&str> {
for child in self.element.children() {
let tag = child.tag_name();
if tag == "office:text" {
return Some("text");
} else if tag == "office:spreadsheet" {
return Some("spreadsheet");
} else if tag == "office:presentation" {
return Some("presentation");
}
}
None
}
}