Skip to main content

ppt_rs/
constants.rs

1//! Global constants - no hardcoding
2
3/// Version information
4pub mod version {
5    pub const MAJOR: u32 = 1;
6    pub const MINOR: u32 = 0;
7    pub const PATCH: u32 = 2;
8    pub const VERSION_STRING: &str = "1.0.2";
9}
10
11/// Presentation defaults
12pub mod presentation {
13    pub const DEFAULT_TITLE: &str = "Presentation";
14    pub const DEFAULT_SLIDES: usize = 1;
15    pub const DEFAULT_WIDTH: i32 = 9144000;  // EMU
16    pub const DEFAULT_HEIGHT: i32 = 6858000; // EMU
17}
18
19/// Slide defaults
20pub mod slide {
21    pub const DEFAULT_SLIDE_ID: i32 = 255;
22    pub const SLIDE_WIDTH: i32 = 9144000;   // EMU
23    pub const SLIDE_HEIGHT: i32 = 6858000;  // EMU
24}
25
26/// File system defaults
27pub mod filesystem {
28    pub const DEFAULT_OUTPUT_DIR: &str = "examples/output";
29    pub const DEFAULT_EXTENSION: &str = "pptx";
30    pub const DEFAULT_FILENAME: &str = "presentation";
31}
32
33/// XML defaults
34pub mod xml {
35    pub const XML_VERSION: &str = "1.0";
36    pub const XML_ENCODING: &str = "UTF-8";
37    pub const XML_STANDALONE: &str = "yes";
38}
39
40/// Theme defaults
41pub mod theme {
42    pub const DEFAULT_THEME_NAME: &str = "Office Theme";
43    pub const DEFAULT_THEME_FILE: &str = "theme1";
44    pub const DEFAULT_COLOR_SCHEME: &str = "Office";
45    pub const DEFAULT_FONT_SCHEME: &str = "Office";
46}
47
48/// Layout defaults
49pub mod layout {
50    pub const DEFAULT_LAYOUT_FILE: &str = "slideLayout1";
51    pub const DEFAULT_MASTER_FILE: &str = "slideMaster1";
52}
53
54/// Color defaults
55pub mod colors {
56    pub const WHITE: &str = "FFFFFF";
57    pub const BLACK: &str = "000000";
58    pub const DARK_BLUE: &str = "1F497D";
59    pub const LIGHT_GRAY: &str = "EBEBEB";
60    pub const ACCENT_BLUE: &str = "4472C4";
61    pub const ACCENT_ORANGE: &str = "ED7D31";
62}
63
64/// Font defaults
65pub mod fonts {
66    pub const DEFAULT_FONT: &str = "Calibri";
67    pub const MAJOR_FONT: &str = "Calibri";
68    pub const MINOR_FONT: &str = "Calibri";
69}
70
71/// CLI defaults
72pub mod cli {
73    pub const APP_NAME: &str = "pptcli";
74    pub const AUTHOR: &str = "PPTX Generator";
75    pub const DEFAULT_SLIDES_CLI: usize = 1;
76}
77
78/// Size formatting
79pub mod sizes {
80    pub const BYTES_PER_KB: usize = 1024;
81    pub const BYTES_PER_MB: usize = 1024 * 1024;
82}
83
84/// Relationship IDs
85pub mod relationships {
86    pub const PRESENTATION_REL_ID: &str = "rId1";
87    pub const CORE_PROPS_REL_ID: &str = "rId2";
88    pub const APP_PROPS_REL_ID: &str = "rId3";
89    pub const SLIDE_MASTER_REL_ID: &str = "rId1";
90    pub const THEME_REL_ID: &str = "rId2";
91}
92
93#[cfg(test)]
94mod tests {
95    use super::*;
96
97    #[test]
98    fn test_version() {
99        assert_eq!(version::VERSION_STRING, "1.0.2");
100    }
101
102    #[test]
103    fn test_presentation_defaults() {
104        assert_eq!(presentation::DEFAULT_TITLE, "Presentation");
105        assert_eq!(presentation::DEFAULT_SLIDES, 1);
106    }
107
108    #[test]
109    fn test_colors() {
110        assert_eq!(colors::WHITE, "FFFFFF");
111        assert_eq!(colors::BLACK, "000000");
112    }
113}