use crate::style::ParseStyleAttr;
use crate::OdsError;
use get_size2::GetSize;
use std::fmt::{Display, Formatter};
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum Angle {
Deg(f64),
Grad(f64),
Rad(f64),
}
impl Display for Angle {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
match self {
Angle::Deg(v) => write!(f, "{}deg", v),
Angle::Grad(v) => write!(f, "{}grad", v),
Angle::Rad(v) => write!(f, "{}rad", v),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Default, GetSize)]
pub enum Length {
#[default]
Default,
Cm(f64),
Mm(f64),
In(f64),
Pt(f64),
Pc(f64),
Em(f64),
}
impl Length {
pub fn is_positive(&self) -> bool {
0f64 <= match self {
Length::Default => 0f64,
Length::Cm(v) => *v,
Length::Mm(v) => *v,
Length::In(v) => *v,
Length::Pt(v) => *v,
Length::Pc(v) => *v,
Length::Em(v) => *v,
}
}
}
impl Display for Length {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
match self {
Length::Cm(v) => write!(f, "{}cm", v),
Length::Mm(v) => write!(f, "{}mm", v),
Length::In(v) => write!(f, "{}in", v),
Length::Pt(v) => write!(f, "{}pt", v),
Length::Pc(v) => write!(f, "{}pc", v),
Length::Em(v) => write!(f, "{}em", v),
Length::Default => write!(f, ""),
}
}
}
impl ParseStyleAttr<Length> for Length {
fn parse_attr(attr: Option<&str>) -> Result<Option<Length>, OdsError> {
if let Some(s) = attr {
if s.ends_with("cm") {
Ok(Some(Length::Cm(s.split_at(s.len() - 2).0.parse()?)))
} else if s.ends_with("mm") {
Ok(Some(Length::Mm(s.split_at(s.len() - 2).0.parse()?)))
} else if s.ends_with("in") {
Ok(Some(Length::In(s.split_at(s.len() - 2).0.parse()?)))
} else if s.ends_with("pt") {
Ok(Some(Length::Pt(s.split_at(s.len() - 2).0.parse()?)))
} else if s.ends_with("pc") {
Ok(Some(Length::Pc(s.split_at(s.len() - 2).0.parse()?)))
} else if s.ends_with("em") {
Ok(Some(Length::Em(s.split_at(s.len() - 2).0.parse()?)))
} else {
Err(OdsError::Parse("invalid length", Some(s.to_string())))
}
} else {
Ok(None)
}
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum Percent {
Percent(f64),
}
impl Display for Percent {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
match self {
Percent::Percent(v) => write!(f, "{}%", v),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
#[allow(missing_docs)]
pub enum LengthPercent {
Length(Length),
Percent(Percent),
}
impl From<Length> for LengthPercent {
fn from(value: Length) -> Self {
LengthPercent::Length(value)
}
}
impl From<Percent> for LengthPercent {
fn from(value: Percent) -> Self {
LengthPercent::Percent(value)
}
}
impl Display for LengthPercent {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
match self {
LengthPercent::Length(v) => write!(f, "{}", v),
LengthPercent::Percent(v) => write!(f, "{}", v),
}
}
}
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[allow(missing_docs)]
pub enum FormatSource {
Fixed,
Language,
}
impl Display for FormatSource {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
FormatSource::Fixed => write!(f, "fixed"),
FormatSource::Language => write!(f, "language"),
}
}
}
impl ParseStyleAttr<FormatSource> for FormatSource {
fn parse_attr(attr: Option<&str>) -> Result<Option<FormatSource>, OdsError> {
if let Some(attr) = attr {
match attr {
"fixed" => Ok(Some(FormatSource::Fixed)),
"language" => Ok(Some(FormatSource::Language)),
_ => Err(OdsError::Parse(
"invalid format source",
Some(attr.to_string()),
)),
}
} else {
Ok(None)
}
}
}
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[allow(missing_docs)]
pub enum TransliterationStyle {
Short,
Medium,
Long,
}
impl Display for TransliterationStyle {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
TransliterationStyle::Short => write!(f, "short"),
TransliterationStyle::Medium => write!(f, "medium"),
TransliterationStyle::Long => write!(f, "long"),
}
}
}
impl ParseStyleAttr<TransliterationStyle> for TransliterationStyle {
fn parse_attr(attr: Option<&str>) -> Result<Option<TransliterationStyle>, OdsError> {
if let Some(attr) = attr {
match attr {
"short" => Ok(Some(TransliterationStyle::Short)),
"medium" => Ok(Some(TransliterationStyle::Medium)),
"long" => Ok(Some(TransliterationStyle::Long)),
_ => Err(OdsError::Parse(
"invalid number:transliteration-style",
Some(attr.to_string()),
)),
}
} else {
Ok(None)
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[allow(missing_docs)]
pub enum FontFamilyGeneric {
Decorative,
Modern,
Roman,
Script,
Swiss,
System,
}
impl Display for FontFamilyGeneric {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
FontFamilyGeneric::Decorative => write!(f, "decorative"),
FontFamilyGeneric::Modern => write!(f, "modern"),
FontFamilyGeneric::Roman => write!(f, "roman"),
FontFamilyGeneric::Script => write!(f, "script"),
FontFamilyGeneric::Swiss => write!(f, "swiss"),
FontFamilyGeneric::System => write!(f, "system"),
}
}
}
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
pub enum FontPitch {
Variable,
Fixed,
}
impl Display for FontPitch {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
match self {
FontPitch::Variable => write!(f, "variable"),
FontPitch::Fixed => write!(f, "fixed"),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[allow(missing_docs)]
pub enum MasterPageUsage {
All,
Left,
Mirrored,
Right,
}
impl Display for MasterPageUsage {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
MasterPageUsage::All => write!(f, "all"),
MasterPageUsage::Left => write!(f, "left"),
MasterPageUsage::Mirrored => write!(f, "mirrored"),
MasterPageUsage::Right => write!(f, "right"),
}
}
}
impl ParseStyleAttr<MasterPageUsage> for MasterPageUsage {
fn parse_attr(attr: Option<&str>) -> Result<Option<MasterPageUsage>, OdsError> {
if let Some(attr) = attr {
match attr {
"all" => Ok(Some(MasterPageUsage::All)),
"left" => Ok(Some(MasterPageUsage::Left)),
"mirrored" => Ok(Some(MasterPageUsage::Mirrored)),
"right" => Ok(Some(MasterPageUsage::Right)),
_ => Err(OdsError::Parse(
"invalid style:page-usage",
Some(attr.to_string()),
)),
}
} else {
Ok(None)
}
}
}
#[derive(Clone, Copy, Debug)]
#[allow(missing_docs)]
pub enum TabStopType {
Center,
Left,
Right,
Char,
}
impl Display for TabStopType {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
match self {
TabStopType::Center => write!(f, "center"),
TabStopType::Left => write!(f, "left"),
TabStopType::Right => write!(f, "right"),
TabStopType::Char => write!(f, "char"),
}
}
}
impl Default for TabStopType {
fn default() -> Self {
Self::Left
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[allow(missing_docs)]
pub enum FontStretch {
Normal,
UltraCondensed,
ExtraCondensed,
Condensed,
SemiCondensed,
SemiExpanded,
Expanded,
ExtraExpanded,
UltraExpanded,
}
impl Display for FontStretch {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
FontStretch::Normal => write!(f, "normal"),
FontStretch::UltraCondensed => write!(f, "ultra-condensed"),
FontStretch::ExtraCondensed => write!(f, "extra-condensed"),
FontStretch::Condensed => write!(f, "condensed"),
FontStretch::SemiCondensed => write!(f, "semi-condensed"),
FontStretch::SemiExpanded => write!(f, "semi-expanded"),
FontStretch::Expanded => write!(f, "expanded"),
FontStretch::ExtraExpanded => write!(f, "extra-expanded"),
FontStretch::UltraExpanded => write!(f, "ultra-expanded"),
}
}
}
#[allow(missing_docs)]
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
pub enum Border {
None,
Hidden,
Dotted,
Dashed,
Solid,
Double,
Groove,
Ridge,
Inset,
Outset,
}
impl Display for Border {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
match self {
Border::None => write!(f, "none"),
Border::Hidden => write!(f, "hidden"),
Border::Dotted => write!(f, "dotted"),
Border::Dashed => write!(f, "dashed"),
Border::Solid => write!(f, "solid"),
Border::Double => write!(f, "double"),
Border::Groove => write!(f, "groove"),
Border::Ridge => write!(f, "ridge"),
Border::Inset => write!(f, "inset"),
Border::Outset => write!(f, "outset"),
}
}
}
#[allow(missing_docs)]
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
pub enum PageBreak {
Auto,
Column,
Page,
}
impl Display for PageBreak {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
match self {
PageBreak::Auto => write!(f, "auto")?,
PageBreak::Column => write!(f, "column")?,
PageBreak::Page => write!(f, "page")?,
}
Ok(())
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
#[allow(missing_docs)]
pub enum FontSize {
Length(Length),
Percent(Percent),
}
impl FontSize {
pub fn is_positive(&self) -> bool {
match self {
FontSize::Length(v) => v.is_positive(),
FontSize::Percent(_) => true,
}
}
}
impl From<Length> for FontSize {
fn from(value: Length) -> Self {
FontSize::Length(value)
}
}
impl From<Percent> for FontSize {
fn from(value: Percent) -> Self {
FontSize::Percent(value)
}
}
impl Display for FontSize {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
match self {
FontSize::Percent(v) => write!(f, "{}", v),
FontSize::Length(v) => write!(f, "{}", v),
}
}
}
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[allow(missing_docs)]
pub enum FontStyle {
Normal,
Italic,
Oblique,
}
impl Display for FontStyle {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
match self {
FontStyle::Normal => write!(f, "normal"),
FontStyle::Italic => write!(f, "italic"),
FontStyle::Oblique => write!(f, "oblique"),
}
}
}
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[allow(missing_docs)]
pub enum FontVariant {
Normal,
SmallCaps,
}
impl Display for FontVariant {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
match self {
FontVariant::Normal => write!(f, "normal"),
FontVariant::SmallCaps => write!(f, "small-caps"),
}
}
}
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[allow(missing_docs)]
pub enum FontWeight {
Normal,
Bold,
W100,
W200,
W300,
W400,
W500,
W600,
W700,
W800,
W900,
}
impl Display for FontWeight {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
match self {
FontWeight::Normal => write!(f, "normal"),
FontWeight::Bold => write!(f, "bold"),
FontWeight::W100 => write!(f, "100"),
FontWeight::W200 => write!(f, "200"),
FontWeight::W300 => write!(f, "300"),
FontWeight::W400 => write!(f, "400"),
FontWeight::W500 => write!(f, "500"),
FontWeight::W600 => write!(f, "600"),
FontWeight::W700 => write!(f, "700"),
FontWeight::W800 => write!(f, "800"),
FontWeight::W900 => write!(f, "900"),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[allow(missing_docs)]
pub enum Hyphenation {
Auto,
Page,
}
impl Display for Hyphenation {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
Hyphenation::Auto => write!(f, "auto"),
Hyphenation::Page => write!(f, "page"),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[allow(missing_docs)]
pub enum HyphenationLadderCount {
NoLimit,
Count(u32),
}
impl Display for HyphenationLadderCount {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
HyphenationLadderCount::NoLimit => write!(f, "no_limit"),
HyphenationLadderCount::Count(c) => c.fmt(f),
}
}
}
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[allow(missing_docs)]
pub enum TextKeep {
Auto,
Always,
}
impl Display for TextKeep {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
match self {
TextKeep::Auto => write!(f, "auto")?,
TextKeep::Always => write!(f, "always")?,
}
Ok(())
}
}
#[derive(Debug, Clone, PartialEq)]
#[allow(missing_docs)]
pub enum LetterSpacing {
Normal,
Length(Length),
}
impl From<Length> for LetterSpacing {
fn from(value: Length) -> Self {
LetterSpacing::Length(value)
}
}
impl Display for LetterSpacing {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
LetterSpacing::Normal => write!(f, "normal"),
LetterSpacing::Length(v) => write!(f, "{}", v),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
#[allow(missing_docs)]
pub enum LineHeight {
Normal,
Length(Length),
Percent(Percent),
}
impl LineHeight {
pub fn is_positive(&self) -> bool {
match self {
LineHeight::Normal => true,
LineHeight::Length(v) => v.is_positive(),
LineHeight::Percent(_) => true,
}
}
}
impl From<Length> for LineHeight {
fn from(value: Length) -> Self {
LineHeight::Length(value)
}
}
impl From<Percent> for LineHeight {
fn from(value: Percent) -> Self {
LineHeight::Percent(value)
}
}
impl Display for LineHeight {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
LineHeight::Normal => write!(f, "normal"),
LineHeight::Length(v) => v.fmt(f),
LineHeight::Percent(v) => v.fmt(f),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
#[allow(missing_docs)]
pub enum Margin {
Length(Length),
Percent(Percent),
}
impl Margin {
pub fn is_positive(&self) -> bool {
match self {
Margin::Length(v) => v.is_positive(),
Margin::Percent(_) => true,
}
}
}
impl From<Length> for Margin {
fn from(value: Length) -> Self {
Margin::Length(value)
}
}
impl From<Percent> for Margin {
fn from(value: Percent) -> Self {
Margin::Percent(value)
}
}
impl Display for Margin {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
Margin::Length(v) => v.fmt(f),
Margin::Percent(v) => v.fmt(f),
}
}
}
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[allow(missing_docs)]
pub enum TextAlign {
Start,
Center,
End,
Justify,
Inside,
Outside,
Left,
Right,
}
impl Display for TextAlign {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
match self {
TextAlign::Start => write!(f, "start"),
TextAlign::Center => write!(f, "center"),
TextAlign::End => write!(f, "end"),
TextAlign::Justify => write!(f, "justify"),
TextAlign::Inside => write!(f, "inside"),
TextAlign::Outside => write!(f, "outside"),
TextAlign::Left => write!(f, "left"),
TextAlign::Right => write!(f, "right"),
}
}
}
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[allow(missing_docs)]
pub enum TextAlignLast {
Start,
Center,
Justify,
}
impl Display for TextAlignLast {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
match self {
TextAlignLast::Start => write!(f, "start"),
TextAlignLast::Center => write!(f, "center"),
TextAlignLast::Justify => write!(f, "justify"),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
#[allow(missing_docs)]
pub enum Indent {
Length(Length),
Percent(Percent),
}
impl From<Length> for Indent {
fn from(value: Length) -> Self {
Indent::Length(value)
}
}
impl From<Percent> for Indent {
fn from(value: Percent) -> Self {
Indent::Percent(value)
}
}
impl Display for Indent {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
Indent::Length(v) => v.fmt(f),
Indent::Percent(v) => v.fmt(f),
}
}
}
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[allow(missing_docs)]
pub enum TextTransform {
None,
Lowercase,
Uppercase,
Capitalize,
}
impl Display for TextTransform {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
match self {
TextTransform::None => write!(f, "none"),
TextTransform::Lowercase => write!(f, "lowercase"),
TextTransform::Uppercase => write!(f, "uppercase"),
TextTransform::Capitalize => write!(f, "capitalize"),
}
}
}
#[allow(missing_docs)]
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
pub enum WrapOption {
NoWrap,
Wrap,
}
impl Display for WrapOption {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
match self {
WrapOption::NoWrap => write!(f, "no-wrap"),
WrapOption::Wrap => write!(f, "wrap"),
}
}
}
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[allow(missing_docs)]
pub enum CellProtect {
FormulaHidden,
HiddenAndProtected,
None,
Protected,
ProtectedFormulaHidden,
}
impl Display for CellProtect {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
CellProtect::FormulaHidden => write!(f, "formula-hidden"),
CellProtect::HiddenAndProtected => write!(f, "hidden-and-protected"),
CellProtect::None => write!(f, "none"),
CellProtect::Protected => write!(f, "protected"),
CellProtect::ProtectedFormulaHidden => write!(f, "protected formula-hidden"),
}
}
}
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[allow(missing_docs)]
pub enum WritingDirection {
Ltr,
Ttb,
}
impl Display for WritingDirection {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
match self {
WritingDirection::Ltr => write!(f, "ltr"),
WritingDirection::Ttb => write!(f, "ttb"),
}
}
}
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[allow(missing_docs)]
pub enum TextRelief {
None,
Embossed,
Engraved,
}
impl Display for TextRelief {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
match self {
TextRelief::None => write!(f, "none"),
TextRelief::Embossed => write!(f, "embossed"),
TextRelief::Engraved => write!(f, "engraved"),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
#[allow(missing_docs)]
pub enum GlyphOrientation {
Auto,
Zero,
Angle(Angle),
}
impl Display for GlyphOrientation {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
GlyphOrientation::Auto => write!(f, "auto"),
GlyphOrientation::Zero => write!(f, "0"),
GlyphOrientation::Angle(a) => a.fmt(f),
}
}
}
#[allow(missing_docs)]
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
pub enum LineBreak {
Normal,
Strict,
}
impl Display for LineBreak {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
match self {
LineBreak::Normal => write!(f, "normal")?,
LineBreak::Strict => write!(f, "strict")?,
}
Ok(())
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
#[allow(missing_docs)]
pub enum StyleNumFormat {
None,
Number,
LowerAlpha,
Alpha,
LowerRoman,
Roman,
Text(String),
}
impl Display for StyleNumFormat {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
StyleNumFormat::None => write!(f, ""),
StyleNumFormat::Number => write!(f, "1"),
StyleNumFormat::LowerAlpha => write!(f, "a"),
StyleNumFormat::Alpha => write!(f, "A"),
StyleNumFormat::LowerRoman => write!(f, "i"),
StyleNumFormat::Roman => write!(f, "I"),
StyleNumFormat::Text(v) => write!(f, "{}", v),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[allow(missing_docs)]
pub enum PageNumber {
Auto,
Number(u32),
}
impl Display for PageNumber {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
PageNumber::Auto => write!(f, "auto"),
PageNumber::Number(v) => v.fmt(f),
}
}
}
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[allow(missing_docs)]
pub enum PrintContent {
Headers,
Grid,
Annotations,
Objects,
Charts,
Drawings,
Formulas,
ZeroValues,
}
impl Display for PrintContent {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
PrintContent::Headers => write!(f, "headers"),
PrintContent::Grid => write!(f, "grid"),
PrintContent::Annotations => write!(f, "annotations"),
PrintContent::Objects => write!(f, "objects"),
PrintContent::Charts => write!(f, "charts"),
PrintContent::Drawings => write!(f, "drawings"),
PrintContent::Formulas => write!(f, "formulas"),
PrintContent::ZeroValues => write!(f, "zero-values"),
}
}
}
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[allow(missing_docs)]
pub enum PrintOrder {
Ltr,
Ttb,
}
impl Display for PrintOrder {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
PrintOrder::Ltr => write!(f, "ltr"),
PrintOrder::Ttb => write!(f, "ttb"),
}
}
}
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[allow(missing_docs)]
pub enum PrintOrientation {
Landscape,
Portrait,
}
impl Display for PrintOrientation {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
PrintOrientation::Landscape => write!(f, "landscape"),
PrintOrientation::Portrait => write!(f, "portrait"),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[allow(missing_docs)]
pub enum PunctuationWrap {
Hanging,
Simple,
}
impl Display for PunctuationWrap {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
PunctuationWrap::Hanging => write!(f, "hanging"),
PunctuationWrap::Simple => write!(f, "simple"),
}
}
}
#[derive(Debug, Clone, PartialEq)]
#[allow(missing_docs)]
pub enum RelativeScale {
Scale,
ScaleMin,
Percent(Percent),
}
impl Display for RelativeScale {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
RelativeScale::Scale => write!(f, "scale"),
RelativeScale::ScaleMin => write!(f, "scale-min"),
RelativeScale::Percent(v) => write!(f, "{}", v),
}
}
}
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[allow(missing_docs)]
pub enum RotationAlign {
None,
Bottom,
Top,
Center,
}
impl Display for RotationAlign {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
match self {
RotationAlign::None => write!(f, "none"),
RotationAlign::Bottom => write!(f, "bottom"),
RotationAlign::Top => write!(f, "top"),
RotationAlign::Center => write!(f, "center"),
}
}
}
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[allow(missing_docs)]
pub enum PrintCentering {
None,
Horizontal,
Vertical,
Both,
}
impl Display for PrintCentering {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
PrintCentering::None => write!(f, "none"),
PrintCentering::Horizontal => write!(f, "horizontal"),
PrintCentering::Vertical => write!(f, "vertical"),
PrintCentering::Both => write!(f, "both"),
}
}
}
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[allow(missing_docs)]
pub enum TextAlignSource {
Fix,
ValueType,
}
impl Display for TextAlignSource {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
match self {
TextAlignSource::Fix => write!(f, "fix"),
TextAlignSource::ValueType => write!(f, "value-type"),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[allow(missing_docs)]
pub enum TextAutoSpace {
IdeographAlpha,
None,
}
impl Display for TextAutoSpace {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
TextAutoSpace::IdeographAlpha => write!(f, "ideograph-alpha"),
TextAutoSpace::None => write!(f, "none"),
}
}
}
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[allow(missing_docs)]
pub enum TextCombine {
None,
Letters,
Lines,
}
impl Display for TextCombine {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
match self {
TextCombine::None => write!(f, "none"),
TextCombine::Letters => write!(f, "letters"),
TextCombine::Lines => write!(f, "lines"),
}
}
}
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[allow(missing_docs)]
pub enum TextEmphasize {
None,
Accent,
Circle,
Disc,
Dot,
}
impl Display for TextEmphasize {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
match self {
TextEmphasize::None => write!(f, "none"),
TextEmphasize::Accent => write!(f, "accent"),
TextEmphasize::Circle => write!(f, "circle"),
TextEmphasize::Disc => write!(f, "disc"),
TextEmphasize::Dot => write!(f, "dot"),
}
}
}
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[allow(missing_docs)]
pub enum TextEmphasizePosition {
Above,
Below,
}
impl Display for TextEmphasizePosition {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
match self {
TextEmphasizePosition::Above => write!(f, "above"),
TextEmphasizePosition::Below => write!(f, "below"),
}
}
}
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[allow(missing_docs)]
pub enum LineMode {
Continuous,
SkipWhiteSpace,
}
impl Display for LineMode {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
match self {
LineMode::Continuous => write!(f, "continuous"),
LineMode::SkipWhiteSpace => write!(f, "skip-white-space"),
}
}
}
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[allow(missing_docs)]
pub enum LineStyle {
Dash,
DotDash,
DotDotDash,
Dotted,
LongDash,
None,
Solid,
Wave,
}
impl Display for LineStyle {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
match self {
LineStyle::Dash => write!(f, "dash"),
LineStyle::DotDash => write!(f, "dot-dash"),
LineStyle::DotDotDash => write!(f, "dot-dot-dash"),
LineStyle::Dotted => write!(f, "dotted"),
LineStyle::LongDash => write!(f, "long-dash"),
LineStyle::None => write!(f, "none"),
LineStyle::Solid => write!(f, "solid"),
LineStyle::Wave => write!(f, "wave"),
}
}
}
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[allow(missing_docs)]
pub enum LineType {
None,
Single,
Double,
}
impl Display for LineType {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
match self {
LineType::None => write!(f, "none"),
LineType::Single => write!(f, "single"),
LineType::Double => write!(f, "double"),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
#[allow(missing_docs)]
pub enum LineWidth {
Auto,
Bold,
Percent(Percent),
Int(u32),
Length(Length),
Normal,
Dash,
Thin,
Medium,
Thick,
}
impl From<Length> for LineWidth {
fn from(value: Length) -> Self {
LineWidth::Length(value)
}
}
impl From<Percent> for LineWidth {
fn from(value: Percent) -> Self {
LineWidth::Percent(value)
}
}
impl Display for LineWidth {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
match self {
LineWidth::Auto => write!(f, "auto"),
LineWidth::Bold => write!(f, "bold"),
LineWidth::Percent(v) => write!(f, "{}", v),
LineWidth::Int(v) => write!(f, "{}", v),
LineWidth::Length(v) => write!(f, "{}", v),
LineWidth::Normal => write!(f, "normal"),
LineWidth::Dash => write!(f, "dash"),
LineWidth::Thin => write!(f, "thin"),
LineWidth::Medium => write!(f, "medium"),
LineWidth::Thick => write!(f, "thick"),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
#[allow(missing_docs)]
pub enum TextPosition {
Sub,
Super,
Percent(Percent),
}
impl From<Percent> for TextPosition {
fn from(value: Percent) -> Self {
TextPosition::Percent(value)
}
}
impl Display for TextPosition {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
match self {
TextPosition::Sub => write!(f, "sub"),
TextPosition::Super => write!(f, "super"),
TextPosition::Percent(v) => write!(f, "{}", v),
}
}
}
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[allow(missing_docs)]
pub enum RotationScale {
Fixed,
LineHeight,
}
impl Display for RotationScale {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
match self {
RotationScale::Fixed => write!(f, "fixed"),
RotationScale::LineHeight => write!(f, "line-height"),
}
}
}
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[allow(missing_docs)]
pub enum ParaAlignVertical {
Top,
Middle,
Bottom,
Auto,
Baseline,
}
impl Display for ParaAlignVertical {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
match self {
ParaAlignVertical::Top => write!(f, "top"),
ParaAlignVertical::Middle => write!(f, "middle"),
ParaAlignVertical::Bottom => write!(f, "bottom"),
ParaAlignVertical::Auto => write!(f, "auto"),
ParaAlignVertical::Baseline => write!(f, "baseline"),
}
}
}
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[allow(missing_docs)]
pub enum CellAlignVertical {
Top,
Middle,
Bottom,
Automatic,
}
impl Display for CellAlignVertical {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
match self {
CellAlignVertical::Top => write!(f, "top"),
CellAlignVertical::Middle => write!(f, "middle"),
CellAlignVertical::Bottom => write!(f, "bottom"),
CellAlignVertical::Automatic => write!(f, "automatic"),
}
}
}
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[allow(missing_docs)]
pub enum WritingMode {
LrTb,
RlTb,
TbRl,
TbLr,
Lr,
Rl,
Tb,
Page,
}
impl Display for WritingMode {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
match self {
WritingMode::LrTb => write!(f, "lr-tb"),
WritingMode::RlTb => write!(f, "rl-tb"),
WritingMode::TbRl => write!(f, "tb-rl"),
WritingMode::TbLr => write!(f, "tb-lr"),
WritingMode::Lr => write!(f, "lr"),
WritingMode::Rl => write!(f, "rl"),
WritingMode::Tb => write!(f, "tb"),
WritingMode::Page => write!(f, "page"),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
#[allow(missing_docs)]
pub enum TableAlign {
Center,
Left,
Right,
Margins,
}
impl Display for TableAlign {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
TableAlign::Center => write!(f, "center"),
TableAlign::Left => write!(f, "left"),
TableAlign::Right => write!(f, "right"),
TableAlign::Margins => write!(f, "margins"),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
#[allow(missing_docs)]
pub enum TableBorderModel {
Collapsing,
Separating,
}
impl Display for TableBorderModel {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
TableBorderModel::Collapsing => write!(f, "collapsing"),
TableBorderModel::Separating => write!(f, "separating"),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[allow(missing_docs)]
pub enum TextCondition {
None,
}
impl Display for TextCondition {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
TextCondition::None => write!(f, "none"),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[allow(missing_docs)]
pub enum TextDisplay {
None,
Condition,
True,
}
impl Display for TextDisplay {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
TextDisplay::None => write!(f, "none"),
TextDisplay::Condition => write!(f, "condition"),
TextDisplay::True => write!(f, "true"),
}
}
}