Expand description
OpenDocument, read and written: the package, its XML, its styles, and the
three bodies that an ODF document can have.
§Bytes in, bytes out
Nothing here opens a file. A Package is made from a byte slice and
turned back into a Vec<u8>, which is what lets the same code serve a
desktop window, a sandboxed macOS application that may only replace the
file it was handed, a browser, and a test that never touches a disk.
§What it does not understand, it keeps
The document is held as the XML tree it was parsed from, not as a summary of the parts this crate has opinions about. An element nobody here has heard of keeps its attributes, its children and its position, and is written back where it was found. A viewer does not need that; an editor built on a model that discarded the unread nine tenths of ODF would destroy every document it saved, and by then the model is load-bearing everywhere.
Typed reading is therefore a view over the tree rather than a replacement
for it: Styles resolves a style name through its inheritance chain, and
the three document types in doc index the body for the application that
draws it.
Re-exports§
pub use doc::Document;pub use edit::Refused;pub use place::Transform;pub use xml::Element;pub use xml::Name;pub use xml::Node;pub use xml::Ns;
Modules§
- doc
- The three kinds of document, over one shared reader.
- draw
draw:enhanced-geometry: the outline of a custom shape, worked out.- edit
- Changing the text of a paragraph, and what an edit may refuse.
- media_
type - The media type of each format this crate reads, as written in a package’s
mimetypeentry and in the desktop’s media-type database. - place
draw:transform: where a shape sits when a corner and a size cannot say it.- xml
- The document tree: namespace-qualified names, elements, and the parser and writer that turn a part of a package into one and back.
Structs§
- Border
- One edge of a border, as ODF writes all three of its parts in one attribute.
- Cell
Properties - Cell formatting, which a spreadsheet reads for every visible cell.
- Color
- An opaque colour.
- Edges
- The four edges of a box, in the order ODF’s shorthand implies.
- Gradient
- One of a document’s named gradients.
- Graphic
Properties - How a shape is filled and outlined.
- Length
- A length, held in points.
- Meta
- A document’s metadata, as far as a window shows it.
- Package
- An
OpenDocumentpackage: a zip archive whose first entry declares the media type of everything else in it. - Page
Layout - A page’s dimensions and margins, from a
style:page-layout. - Paragraph
Properties - Paragraph formatting.
- Part
- One entry of a package.
- Percent
- A percentage, held as the number before the sign.
- Properties
- Everything a resolved style says, across every family.
- Style
- One style as the document declares it.
- Styles
- Every style in a document, from both of the places they live.
- Text
Properties - Character formatting.
Enums§
- Anchor
- Where a shape’s label sits between its top and bottom edges.
- Break
- A page or column break asked for before or after a paragraph.
- Error
- A package that could not be read, or a document that could not be written.
- Family
- Which kind of thing a style applies to.
- Fill
- What fills a shape or the ground behind a slide.
- Gradient
Style - How a gradient runs, which is the part of it a renderer has to understand.
- List
Kind - How a list marks its items.
- Measure
- A length or a percentage, which is what ODF permits wherever it permits either.
- Position
- Where a run sits relative to the baseline.
- Text
Align - How a paragraph’s lines sit against its edges.
- Vertical
Align - Vertical placement inside a cell.