pptx 0.1.0

A Rust library for creating and manipulating PowerPoint (.pptx) files
Documentation
//! Pattern type enumeration for `DrawingML` fills.

/// Specifies the fill pattern used in a shape.
///
/// Alias: `MsoPatternType`
#[non_exhaustive]
#[repr(u8)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum MsoPatternType {
    Cross,
    DarkDownwardDiagonal,
    DarkHorizontal,
    DarkUpwardDiagonal,
    DarkVertical,
    DashedDownwardDiagonal,
    DashedHorizontal,
    DashedUpwardDiagonal,
    DashedVertical,
    DiagonalBrick,
    DiagonalCross,
    Divot,
    DottedDiamond,
    DottedGrid,
    DownwardDiagonal,
    Horizontal,
    HorizontalBrick,
    LargeCheckerBoard,
    LargeConfetti,
    LargeGrid,
    LightDownwardDiagonal,
    LightHorizontal,
    LightUpwardDiagonal,
    LightVertical,
    NarrowHorizontal,
    NarrowVertical,
    OutlinedDiamond,
    Percent10,
    Percent20,
    Percent25,
    Percent30,
    Percent40,
    Percent5,
    Percent50,
    Percent60,
    Percent70,
    Percent75,
    Percent80,
    Percent90,
    Plaid,
    Shingle,
    SmallCheckerBoard,
    SmallConfetti,
    SmallGrid,
    SolidDiamond,
    Sphere,
    Trellis,
    UpwardDiagonal,
    Vertical,
    Wave,
    Weave,
    WideDownwardDiagonal,
    WideUpwardDiagonal,
    ZigZag,
}

impl MsoPatternType {
    /// Return the XML attribute value for this pattern type.
    #[must_use]
    pub const fn to_xml_str(self) -> &'static str {
        match self {
            Self::Cross => "cross",
            Self::DarkDownwardDiagonal => "dkDnDiag",
            Self::DarkHorizontal => "dkHorz",
            Self::DarkUpwardDiagonal => "dkUpDiag",
            Self::DarkVertical => "dkVert",
            Self::DashedDownwardDiagonal => "dashDnDiag",
            Self::DashedHorizontal => "dashHorz",
            Self::DashedUpwardDiagonal => "dashUpDiag",
            Self::DashedVertical => "dashVert",
            Self::DiagonalBrick => "diagBrick",
            Self::DiagonalCross => "diagCross",
            Self::Divot => "divot",
            Self::DottedDiamond => "dotDmnd",
            Self::DottedGrid => "dotGrid",
            Self::DownwardDiagonal => "dnDiag",
            Self::Horizontal => "horz",
            Self::HorizontalBrick => "horzBrick",
            Self::LargeCheckerBoard => "lgCheck",
            Self::LargeConfetti => "lgConfetti",
            Self::LargeGrid => "lgGrid",
            Self::LightDownwardDiagonal => "ltDnDiag",
            Self::LightHorizontal => "ltHorz",
            Self::LightUpwardDiagonal => "ltUpDiag",
            Self::LightVertical => "ltVert",
            Self::NarrowHorizontal => "narHorz",
            Self::NarrowVertical => "narVert",
            Self::OutlinedDiamond => "openDmnd",
            Self::Percent10 => "pct10",
            Self::Percent20 => "pct20",
            Self::Percent25 => "pct25",
            Self::Percent30 => "pct30",
            Self::Percent40 => "pct40",
            Self::Percent5 => "pct5",
            Self::Percent50 => "pct50",
            Self::Percent60 => "pct60",
            Self::Percent70 => "pct70",
            Self::Percent75 => "pct75",
            Self::Percent80 => "pct80",
            Self::Percent90 => "pct90",
            Self::Plaid => "plaid",
            Self::Shingle => "shingle",
            Self::SmallCheckerBoard => "smCheck",
            Self::SmallConfetti => "smConfetti",
            Self::SmallGrid => "smGrid",
            Self::SolidDiamond => "solidDmnd",
            Self::Sphere => "sphere",
            Self::Trellis => "trellis",
            Self::UpwardDiagonal => "upDiag",
            Self::Vertical => "vert",
            Self::Wave => "wave",
            Self::Weave => "weave",
            Self::WideDownwardDiagonal => "wdDnDiag",
            Self::WideUpwardDiagonal => "wdUpDiag",
            Self::ZigZag => "zigZag",
        }
    }

    /// Parse an XML pattern type attribute value.
    #[must_use]
    pub fn from_xml_str(s: &str) -> Option<Self> {
        match s {
            "cross" => Some(Self::Cross),
            "dkDnDiag" => Some(Self::DarkDownwardDiagonal),
            "dkHorz" => Some(Self::DarkHorizontal),
            "dkUpDiag" => Some(Self::DarkUpwardDiagonal),
            "dkVert" => Some(Self::DarkVertical),
            "dashDnDiag" => Some(Self::DashedDownwardDiagonal),
            "dashHorz" => Some(Self::DashedHorizontal),
            "dashUpDiag" => Some(Self::DashedUpwardDiagonal),
            "dashVert" => Some(Self::DashedVertical),
            "diagBrick" => Some(Self::DiagonalBrick),
            "diagCross" => Some(Self::DiagonalCross),
            "divot" => Some(Self::Divot),
            "dotDmnd" => Some(Self::DottedDiamond),
            "dotGrid" => Some(Self::DottedGrid),
            "dnDiag" => Some(Self::DownwardDiagonal),
            "horz" => Some(Self::Horizontal),
            "horzBrick" => Some(Self::HorizontalBrick),
            "lgCheck" => Some(Self::LargeCheckerBoard),
            "lgConfetti" => Some(Self::LargeConfetti),
            "lgGrid" => Some(Self::LargeGrid),
            "ltDnDiag" => Some(Self::LightDownwardDiagonal),
            "ltHorz" => Some(Self::LightHorizontal),
            "ltUpDiag" => Some(Self::LightUpwardDiagonal),
            "ltVert" => Some(Self::LightVertical),
            "narHorz" => Some(Self::NarrowHorizontal),
            "narVert" => Some(Self::NarrowVertical),
            "openDmnd" => Some(Self::OutlinedDiamond),
            "pct10" => Some(Self::Percent10),
            "pct20" => Some(Self::Percent20),
            "pct25" => Some(Self::Percent25),
            "pct30" => Some(Self::Percent30),
            "pct40" => Some(Self::Percent40),
            "pct5" => Some(Self::Percent5),
            "pct50" => Some(Self::Percent50),
            "pct60" => Some(Self::Percent60),
            "pct70" => Some(Self::Percent70),
            "pct75" => Some(Self::Percent75),
            "pct80" => Some(Self::Percent80),
            "pct90" => Some(Self::Percent90),
            "plaid" => Some(Self::Plaid),
            "shingle" => Some(Self::Shingle),
            "smCheck" => Some(Self::SmallCheckerBoard),
            "smConfetti" => Some(Self::SmallConfetti),
            "smGrid" => Some(Self::SmallGrid),
            "solidDmnd" => Some(Self::SolidDiamond),
            "sphere" => Some(Self::Sphere),
            "trellis" => Some(Self::Trellis),
            "upDiag" => Some(Self::UpwardDiagonal),
            "vert" => Some(Self::Vertical),
            "wave" => Some(Self::Wave),
            "weave" => Some(Self::Weave),
            "wdDnDiag" => Some(Self::WideDownwardDiagonal),
            "wdUpDiag" => Some(Self::WideUpwardDiagonal),
            "zigZag" => Some(Self::ZigZag),
            _ => None,
        }
    }
}