Skip to main content

ppt_rs/generator/slide_content/
layout.rs

1//! Slide layout types
2
3/// Slide layout types
4#[derive(Clone, Debug, Copy, PartialEq, Eq)]
5pub enum SlideLayout {
6    /// Title slide (centered title + subtitle)
7    CenteredTitle,
8    /// Title and content (bullets)
9    TitleAndContent,
10    /// Two columns of content
11    TwoColumn,
12    /// Section divider (large title)
13    SectionHeader,
14    /// Blank slide
15    Blank,
16    /// Title only (no content area)
17    TitleOnly,
18    /// Title at top, content fills rest
19    TitleAndBigContent,
20}
21
22impl SlideLayout {
23    /// 1-based `slideLayoutN.xml` index on slide master 1.
24    pub fn layout_number(&self) -> usize {
25        match self {
26            SlideLayout::CenteredTitle => 1,
27            SlideLayout::TitleAndContent => 2,
28            SlideLayout::TwoColumn => 3,
29            SlideLayout::SectionHeader => 4,
30            SlideLayout::Blank => 5,
31            SlideLayout::TitleOnly => 6,
32            SlideLayout::TitleAndBigContent => 7,
33        }
34    }
35
36    pub fn as_str(&self) -> &'static str {
37        match self {
38            SlideLayout::TitleOnly => "titleOnly",
39            SlideLayout::TitleAndContent => "titleAndContent",
40            SlideLayout::TitleAndBigContent => "titleAndBigContent",
41            SlideLayout::Blank => "blank",
42            SlideLayout::CenteredTitle => "centeredTitle",
43            SlideLayout::TwoColumn => "twoColumn",
44            SlideLayout::SectionHeader => "sectionHeader",
45        }
46    }
47}