diagram_core/src/page.rs#
Source: lib/diagram_core/src/page.rs
page -- pages, masters and styles: the containers of sheets and shapes
Page { header, sheet, shapes, connects, theme, extras, contents_extras, part }
PageHeader { id, name, name_u, background, back_page, sheet_styles, attrs ... }
Master { header, sheet, icon, shapes, connects, extras, contents_extras, part }
MasterHeader { id, name, name_u, base_id, unique_id, sheet_styles, attrs ... }
Style { header, sheet, extras } StyleHeader { id, name, name_u, based_on, attrs ... }
Connect { from_sheet, from_cell, from_part, to_sheet, to_cell, to_part }
attr(&attrs, name) -> Option<Sym> one of the attributes kept as written
A foreground page names its background page by the background's page ID (back_page); a
background page can have one of its own. A master's content is a page of its own with
shapes; a stencil is a document of masters without pages. The attributes the model works
with are fields, every other attribute stays in `attrs` in file order (ViewScale,
ViewCenterX, Prompt, IconSize, PatternFlags ...), read with attr().
Connect rows are the file's record of glue (CN-15): which cell of which shape (FromSheet,
FromCell, FromPart) is glued to which part of which other shape (ToSheet, ToCell, ToPart);
the sheets are shape IDs of the same page or master.
fn attr(attrs: &[(Sym, Sym)], name: Sym) -> Option<Sym>the value of an attribute kept as writtenstruct Connecta Connect entryfrom_sheet: u32-- FromSheet: the ID of the glued shape (a connector, a callout)from_cell: Option<Sym>-- FromCell: its glued cell (BeginX, EndX, Controls.Row_1 ...)from_part: Option<i32>-- FromPart as writtento_sheet: u32-- ToSheet: the ID of the shape it is glued toto_cell: Option<Sym>-- ToCell: the cell glued to (Connections.X1, PinX ...)to_part: Option<i32>-- ToPart as writtenextras: Extras-- unknown items
struct PageHeaderthe attributes of a page (and of its PageSheet element)id: u32-- ID: unique among the pages of the documentname: Option<Sym>-- Name: the language-dependent name ("Zeichenblatt-1")name_u: Option<Sym>-- NameU: the universal name ("Page-1")is_custom_name: Option<bool>-- IsCustomName as writtenis_custom_name_u: Option<bool>-- IsCustomNameU as writtenbackground: bool-- Background="1": a background pageback_page: Option<u32>-- BackPage: the ID of this page's background pagesheet_styles: StyleRefs-- LineStyle, FillStyle, TextStyle of the PageSheet elementattrs: Vec<(Sym, Sym)>-- the other attributes of the Page element in file order
struct Pagea foreground or background pageheader: PageHeader-- the attributessheet: Sheet-- the page's ShapeSheet (size, scale, layout, print, layers in the Layer section)shapes: ShapeTree-- the shapes on the pageconnects: Vec<Connect>-- the glue recordstheme: Option<u32>-- the theme of the page (an index into Document::themes)extras: Extras-- unknown items of the Page element (in pages.xml)contents_extras: Extras-- unknown items of the PageContents element (the page's own part)part: Option<Sym>-- the name of the page's part as read (None: a new page)
impl Page
fn new(header: PageHeader) -> Pagean empty page with this headerstruct MasterHeaderthe attributes of a master (and of its PageSheet element)id: u32-- ID: unique among the masters of the documentname: Option<Sym>-- Name: the language-dependent namename_u: Option<Sym>-- NameU: the universal name; with BaseID the key for matching masters (LG-04, MS-02)is_custom_name: Option<bool>-- IsCustomName as writtenis_custom_name_u: Option<bool>-- IsCustomNameU as writtenbase_id: Option<Sym>-- BaseID: the GUID of the master's originunique_id: Option<Sym>-- UniqueID: the GUID of this master's versionsheet_styles: StyleRefs-- LineStyle, FillStyle, TextStyle of the PageSheet elementattrs: Vec<(Sym, Sym)>-- the other attributes of the Master element in file order (Prompt, Hidden, IconSize ...)
struct Mastera master: a template shape with its own pageheader: MasterHeader-- the attributessheet: Sheet-- the master page's ShapeSheeticon: Option<Sym>-- the icon as written (base64 text of the Icon element)shapes: ShapeTree-- the master's shapes; the first top-level shape is the master shape of instancesconnects: Vec<Connect>-- glue records inside the masterextras: Extras-- unknown items of the Master element (in masters.xml)contents_extras: Extras-- unknown items of the MasterContents elementpart: Option<Sym>-- the name of the master's part as read
impl Master
fn new(header: MasterHeader) -> Masteran empty master with this header; its new shapes get IDs from 5 on, as Visio's (a file's masters keep the IDs they have)fn master_shape(&self) -> Option<u32>the slot of the shape instances inherit from (the first top-level shape)struct StyleHeaderthe attributes of a style sheetid: u32-- ID: unique among the styles (0 is "No Style")name: Option<Sym>-- Name: the language-dependent namename_u: Option<Sym>-- NameU: the universal nameis_custom_name: Option<bool>-- IsCustomName as writtenis_custom_name_u: Option<bool>-- IsCustomNameU as writtenbased_on: StyleRefs-- LineStyle, FillStyle, TextStyle: the styles this one is based onattrs: Vec<(Sym, Sym)>-- the other attributes in file order
struct Stylea style sheet (Formatvorlage)header: StyleHeader-- the attributessheet: Sheet-- its cellsextras: Extras-- unknown items of the StyleSheet element