Oregami
Repositories/oxedyne/fe2o3

oxedyne/fe2o3/fe2o3_file/src/office/pptx/mod.rs

2.6 KiB, 16 runs

created by r1870400018:22874, which is this file's identity for as long as the history lasts, whatever it is later renamed to

download · who wrote it · its history

1//! PresentationML: the `.pptx` third of the Microsoft formats.
2//!
3//! # The heaviest skeleton of the three, and the reason is structural
4//!
5//! A `.docx` opens with four parts and a `.xlsx` with six. A `.pptx` needs **a slide master, a slide
6//! layout and a theme before it can hold a single slide** -- a slide points at a layout, a layout
7//! points at a master, and a master points at a theme, and PowerPoint refuses the file if any link
8//! in that chain is missing. The theme in particular must carry a complete format scheme: three fill
9//! styles, three line styles, three effect styles and three background fills, whether or not anything
10//! uses them.
11//!
12//! None of that is optional and none of it is content. It is written once, in [`parts`], generated
13//! rather than held as a literal blob so the repetition is a loop instead of a place for a typo.
14//!
15//! # Create, read, show. Not edit.
16//!
17//! [`write`] builds a deck from [`crate::office::deck`]. [`read`] takes the words back out, which is
18//! what a reading view and a model both want.
19//!
20//! **Deck editing is deliberately absent.** Not because it is hard -- it is the same splice-and-copy
21//! the other formats would use -- but because a slide is a position on a canvas, and an edit that
22//! changed the words without knowing the geometry would produce a slide with text over the top of
23//! other text. That is a failure a reader sees and an editor cannot check for. A deck is also the
24//! least useful thing an agent generates, so the value on the other side of that risk is small.
25//!
26//! That last sentence is why [`write`] is the one Office verb behind a cargo feature, `deck-write`,
27//! which is on by default. [`read`] is not behind it: a reading view offers six formats, and losing
28//! one of them would change what a user already has.
29//!
30//! [Written with AI entirely](https://need2know.ai/entirely-ai/code)\
31//! Anthropic Claude
32
33// The skeleton generator serves `write` and nothing else, so it goes with the feature.
34#[cfg(feature = "deck-write")]
35pub mod parts;
36pub mod read;
37pub mod write;
38
39pub use read::read;
40pub use write::write;
41
42/// The PresentationML namespace.
43pub const NS_P: &str = "http://schemas.openxmlformats.org/presentationml/2006/main";
44/// The DrawingML namespace, which every shape and every run of text on a slide is in.
45pub const NS_A: &str = "http://schemas.openxmlformats.org/drawingml/2006/main";
46
47//// Slide geometry, in EMU -- an EMU is 1/914,400 of an inch.
48pub const SLIDE_W: i64 = 12_192_000; // sixteen by nine
49pub const SLIDE_H: i64 = 6_858_000;
50pub const MARGIN: i64 = 457_200; // half an inch
51pub const TITLE_H: i64 = 1_143_000; // where the title ends and the body begins