use crate::enums::shapes::PpPlaceholderType;
use crate::opc::pack_uri::PackURI;
use crate::shapes::shapetree::ShapeTree;
use crate::shapes::Shape;
use crate::text::TextFrame;
use crate::units::{RelationshipId, SlideId};
#[derive(Debug, Clone)]
pub struct SlideRef {
pub r_id: RelationshipId,
pub partname: PackURI,
}
#[derive(Debug, Clone)]
pub struct SlideLayoutRef {
pub r_id: RelationshipId,
pub partname: PackURI,
pub name: String,
pub slide_master_part_name: Option<String>,
}
#[derive(Debug, Clone)]
pub struct SlideMasterRef {
pub r_id: RelationshipId,
pub partname: PackURI,
}
#[derive(Debug, Clone)]
pub struct NotesSlideRef {
pub partname: PackURI,
}
#[derive(Debug, Clone)]
pub struct NotesMasterRef {
pub r_id: RelationshipId,
pub partname: PackURI,
}
#[derive(Debug, Clone)]
pub struct SlideProperties {
pub slide_id: SlideId,
pub name: String,
pub has_notes_slide: bool,
}
#[derive(Debug, Clone)]
pub struct NotesSlide {
pub name: Option<String>,
pub shapes: ShapeTree,
pub notes_text: String,
pub part_name: Option<String>,
}
impl NotesSlide {
#[must_use]
pub fn name(&self) -> Option<&str> {
self.name.as_deref()
}
#[must_use]
pub fn part_name(&self) -> Option<&str> {
self.part_name.as_deref()
}
#[must_use]
pub const fn shapes(&self) -> &ShapeTree {
&self.shapes
}
#[must_use]
pub fn placeholders(&self) -> Vec<&Shape> {
self.shapes
.shapes
.iter()
.filter(|s| s.is_placeholder())
.collect()
}
#[must_use]
pub fn notes_placeholder(&self) -> Option<&Shape> {
self.shapes.shapes.iter().find(|s| {
s.placeholder()
.is_some_and(|ph| ph.ph_type == Some(PpPlaceholderType::Body))
})
}
#[must_use]
pub fn notes_text_frame(&self) -> Option<&TextFrame> {
self.notes_placeholder()
.and_then(|s| s.as_autoshape())
.and_then(|a| a.text_frame())
}
#[must_use]
pub fn notes_text(&self) -> &str {
&self.notes_text
}
}