Skip to main content

Styles

Struct Styles 

Source
pub struct Styles { /* private fields */ }
Expand description

Every style in a document, from both of the places they live.

Implementations§

Source§

impl Styles

Source

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.

Source

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.

Source

pub fn style(&self, family: &Family, name: &str) -> Option<&Style>

A style by family and name.

Source

pub fn gradient(&self, name: &str) -> Option<&Gradient>

A gradient by name, as a fill refers to one.

Source

pub fn fill_image(&self, name: &str) -> Option<&str>

Where the picture of a named fill image lives inside the package.

Source

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.

Source

pub fn master_page(&self, name: &str) -> Option<&Element>

A master page by name.

Source

pub fn page_layout_of(&self, master_page: &str) -> Option<&PageLayout>

The page layout a master page points at.

Source

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.

Source

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.

Auto Trait Implementations§

§

impl !Freeze for Styles

§

impl !RefUnwindSafe for Styles

§

impl !Send for Styles

§

impl !Sync for Styles

§

impl Unpin for Styles

§

impl UnsafeUnpin for Styles

§

impl UnwindSafe for Styles

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.