1use crate::error::{PptError, Result};
4use crate::parts::presentation::PresentationPart;
5use crate::slide::{Slide, Slides};
6use std::io::{Read, Write};
7
8pub struct Presentation {
13 part: PresentationPart,
14}
15
16impl Presentation {
17 pub fn new() -> Result<Self> {
19 let part = PresentationPart::new()?;
20 Ok(Self { part })
21 }
22
23 pub fn open<R: Read>(_reader: R) -> Result<Self> {
25 Err(PptError::NotImplemented("Opening presentations".to_string()))
27 }
28
29 pub fn save<W: Write>(&self, _writer: W) -> Result<()> {
31 Err(PptError::NotImplemented("Saving presentations".to_string()))
33 }
34
35 pub fn save_to_file<P: AsRef<std::path::Path>>(&self, path: P) -> Result<()> {
37 let file = std::fs::File::create(path)?;
38 let writer = std::io::BufWriter::new(file);
39 self.save(writer)
40 }
41
42 pub fn slides(&self) -> Slides {
44 Slides::new(&self.part)
45 }
46
47 pub fn part(&self) -> &PresentationPart {
49 &self.part
50 }
51
52 pub fn part_mut(&mut self) -> &mut PresentationPart {
54 &mut self.part
55 }
56
57 pub fn core_properties(&self) -> Result<()> {
59 self.part.core_properties()
60 }
61
62 pub fn slide_width(&self) -> Option<u32> {
64 Some(9144000) }
67
68 pub fn set_slide_width(&mut self, _width: u32) -> Result<()> {
70 Ok(())
72 }
73
74 pub fn slide_height(&self) -> Option<u32> {
76 Some(6858000) }
79
80 pub fn set_slide_height(&mut self, _height: u32) -> Result<()> {
82 Ok(())
84 }
85}
86