pub struct Styles { /* private fields */ }Expand description
Every style in a document, from both of the places they live.
Implementations§
Source§impl Styles
impl Styles
Sourcepub fn collect(content: Option<&Element>, styles: Option<&Element>) -> Self
pub fn collect(content: Option<&Element>, styles: Option<&Element>) -> Self
Collect the styles of a document from its two parts.
Both are optional because both are optional in the format: a package may
carry all its formatting in automatic styles in content.xml and no
styles.xml at all.
Sourcepub fn add(&mut self, element: &Element)
pub fn add(&mut self, element: &Element)
Take in a style an edit has written into the document, so that it resolves from now on.
Nothing is ever taken out: a style an undo removed from the tree stays here, which keeps its name from being given to a different style while a resolution of it may still be cached.
Sourcepub fn gradient(&self, name: &str) -> Option<&Gradient>
pub fn gradient(&self, name: &str) -> Option<&Gradient>
A gradient by name, as a fill refers to one.
Sourcepub fn fill_image(&self, name: &str) -> Option<&str>
pub fn fill_image(&self, name: &str) -> Option<&str>
Where the picture of a named fill image lives inside the package.
Sourcepub fn heading_style(&self, level: u8) -> Option<&str>
pub fn heading_style(&self, level: u8) -> Option<&str>
The paragraph style a document gives headings of a level: the one that
declares style:default-outline-level as that level, and failing that
the one LibreOffice names Heading_20_{level}.
Sourcepub fn has_style(&self, family: &Family, name: &str) -> bool
pub fn has_style(&self, family: &Family, name: &str) -> bool
Whether a style of a family and name is in the document.
Sourcepub fn list_kind(&self, name: &str) -> Option<ListKind>
pub fn list_kind(&self, name: &str) -> Option<ListKind>
Whether a list style numbers its items or marks them, by the first of its levels that says.
Sourcepub fn list_style_for(&self, kind: ListKind) -> Option<&str>
pub fn list_style_for(&self, kind: ListKind) -> Option<&str>
A list style of a kind the document already has, the first by name.
Sourcepub fn list_style(&self, name: &str) -> Option<&Element>
pub fn list_style(&self, name: &str) -> Option<&Element>
A list style by name, as the text:list-style-name of a list refers to
one.
Sourcepub fn master_page(&self, name: &str) -> Option<&Element>
pub fn master_page(&self, name: &str) -> Option<&Element>
A master page by name.
Sourcepub fn page_layout_of(&self, master_page: &str) -> Option<&PageLayout>
pub fn page_layout_of(&self, master_page: &str) -> Option<&PageLayout>
The page layout a master page points at.
Sourcepub fn resolve(&self, family: &Family, name: &str) -> Rc<Properties>
pub fn resolve(&self, family: &Family, name: &str) -> Rc<Properties>
The resolved properties of a style, with its whole inheritance chain and its family’s default applied.
A name that is not in the document resolves to the family’s default, which is what an application does with a dangling style reference: the paragraph is shown rather than refused.
Sourcepub fn font_family(&self, declared: &str) -> String
pub fn font_family(&self, declared: &str) -> String
The family the properties of a cell’s text come from: a cell style’s
style:parent-style-name chain carries the paragraph and text
properties, so a cell resolves in one call.