1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038
//!
//! All kinds of units for use in style attributes.
//!
use crate::style::ParseStyleAttr;
use crate::OdsError;
use get_size::GetSize;
use get_size_derive::GetSize;
use std::fmt::{Display, Formatter};
/// An angle, as defined in §4.1 of SVG, is a double value that may be followed immediately by one
/// of the following angle unit identifiers: deg (degrees), grad (gradiants) or rad (radians). If no unit
/// identifier is specified, the value is assumed to be in degrees.
/// Note: OpenDocument v1.1 did not support angle specifications that contain an angle unit
/// identifier. Angle unit identifiers should be omitted for compatibility with OpenDocument v1.1
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum Angle {
/// Degrees
Deg(f64),
/// Grad degrees.
Grad(f64),
/// Radiant.
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),
}
}
}
/// A (positive or negative) length, consisting of magnitude and unit, in conformance with the Units of
/// Measure defined in §5.9.13 of XSL.
#[derive(Debug, Clone, Copy, PartialEq, Default, GetSize)]
pub enum Length {
/// Unspecified length, the actual value is some default or whatever.
#[default]
Default,
/// cm
Cm(f64),
/// mm
Mm(f64),
/// inch
In(f64),
/// typographic points
Pt(f64),
/// pica
Pc(f64),
/// em
Em(f64),
}
impl Length {
/// Is the length positive.
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)
}
}
}
/// (Positive or negative) percentage values in conformance with §5.9.11 of XSL.
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum Percent {
/// Percentage
Percent(f64),
}
impl Display for Percent {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
match self {
Percent::Percent(v) => write!(f, "{}%", v),
}
}
}
/// Length or percentage.
#[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),
}
}
}
/// 19.348 number:format-source
///
/// The number:format-source attribute specifies the source of definitions of the short and
/// long display formats.
///
/// The defined values for the number:format-source attribute are:
/// • fixed: the values short and long of the number:style attribute are defined by this
/// standard.
/// • language: the meaning of the values long and short of the number:style attribute
/// depend upon the number:language and number:country attributes of the date style. If
/// neither of those attributes are specified, consumers should use their default locale for short
/// and long date and time formats.
///
/// The default value for this attribute is fixed.
#[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)
}
}
}
/// 19.368 number:transliteration-style
///
/// The number:transliteration-style attribute specifies the transliteration format of a
/// number system.
///
/// The semantics of the values of the number:transliteration-style attribute are locale- and
/// implementation-dependent.
///
/// The default value for this attribute is short.
#[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)
}
}
}
/// 19.484 style:font-family-generic
///
/// The style:font-family-generic attribute specifies a generic font family name.
///
/// The defined values for the style:font-family-generic attribute are:
/// • decorative: the family of decorative fonts.
/// • modern: the family of modern fonts.
/// • roman: the family roman fonts (with serifs).
/// • script: the family of script fonts.
/// • swiss: the family roman fonts (without serifs).
/// • system: the family system fonts.
#[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"),
}
}
}
/// 19.485 style:font-pitch
/// The style:font-pitch attribute specifies whether a font has a fixed or variable width.
/// The defined values for the style:font-pitch attribute are:
/// * fixed: font has a fixed width.
/// * variable: font has a variable width.
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
pub enum FontPitch {
/// Variable font with
Variable,
/// Fixed font width
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"),
}
}
}
/// 19.509 style:page-usage
///
/// The style:page-usage attribute specifies the type of pages that a master page should
/// generate.
///
/// The defined values for the style:page-usage attribute are:
/// • all: if there are no <style:header-left> or <style:footer-left> elements, the
/// header and footer content is the same for left and right pages.
/// • left: <style:header-right> and <style:footer-right> elements are ignored.
/// • mirrored: if there are no <style:header-left> or <style:footer-left> elements,
/// the header and footer content is the same for left and right pages.
/// • right: <style:header-left> and <style:footer-left> elements are ignored.
///
/// The default value for this attribute is all.
#[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)
}
}
}
/// 19.519 style:type
///
/// The style:type attribute specifies the type of a tab stop within paragraph formatting properties.
///
/// The defined values for the style:type attribute are:
/// • center: text is centered on a tab stop.
/// • char: character appears at a tab stop position.
/// • left: text is left aligned with a tab stop.
/// • right: text is right aligned with a tab stop.
///
/// For a <style:tab-stop> 17.8 element the default value for this attribute is left.
#[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
}
}
/// 19.534 svg:font-stretch
///
/// See §20.8.3 of SVG.
///
/// The svg:font-stretch attribute is usable with the following element: <style:font-face>
/// 16.23.
///
/// The values of the svg:font-stretch attribute are normal, ultra-condensed, extracondensed,
/// condensed, semi-condensed, semi-expanded, expanded, extraexpanded or ultra-expanded.
#[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"),
}
}
}
/// 20.183 fo-border Properties.
/// See §7.29.3ff of XSL
#[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"),
}
}
}
/// 20.184 fo:break-after, fo:break-before
/// See §7.19.1 of XSL. The values odd-page and even-page are not supported.
///
/// This attribute shall not be used at the same time as fo:break-before.
///
/// In the OpenDocument XSL-compatible namespace, the fo:break-after attribute does not
/// support even-page, inherit and odd-page values.
///
/// The values of the fo:break-after attribute are auto, column or page.
#[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(())
}
}
/// 20.190 fo:font-size
///
/// See §7.8.4 of XSL.
///
/// The value of this attribute is either an absolute length or a percentage as described in §7.8.4 of
/// XSL. In contrast to XSL, percentage values can be used within common styles only and are
/// based on the font height of the parent style rather than to the font height of the attributes
/// neighborhood. Absolute font heights and relative font heights are not supported.
///
/// In the OpenDocument XSL-compatible namespace, the fo:font-size attribute does not
/// support absolute-size, inherit and relative-size values.
///
/// The values of the fo:font-size attribute are a value of type positiveLength 18.3.26 or a
/// value of type percent 18.3.23.
#[derive(Debug, Clone, Copy, PartialEq)]
#[allow(missing_docs)]
pub enum FontSize {
Length(Length),
Percent(Percent),
}
impl FontSize {
/// Is the fontsize positive. Percentage is always positive.
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),
}
}
}
/// 20.191 fo:font-style
/// See §7.8.7 of XSL.
///
/// This attribute is evaluated for any UNICODE character whose script type is latin. 20.358
///
/// In the OpenDocument XSL-compatible namespace, the fo:font-style attribute does not
/// support backslant and inherit values.
///
/// The values of the fo:font-style attribute are normal, italic or oblique.
#[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"),
}
}
}
/// 20.192 fo:font-variant
///
/// See §7.8.8 of XSL.
///
/// In the OpenDocument XSL-compatible namespace, the fo:font-variant attribute does not
/// support the inherit value.
///
/// The values of the fo:font-variant attribute are normal or small-caps.
#[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"),
}
}
}
/// 20.193 fo:font-weight
///
/// See §7.8.9 of XSL.
///
/// This attribute is evaluated for any UNICODE character whose script type is latin. 20.358
/// In the OpenDocument XSL-compatible namespace, the fo:font-weight attribute does not
/// support bolder, inherit and lighter values.
///
/// The values of the fo:font-weight attribute are normal, bold, 100, 200, 300, 400, 500,
/// 600, 700, 800 or 900.
#[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"),
}
}
}
/// 20.196 fo:hyphenation-keep
///
/// See §7.15.1 of XSL.
///
/// The values of the fo:hyphenation-keep attribute are auto or page
#[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"),
}
}
}
/// 20.197 fo:hyphenation-ladder-count
///
/// See §7.15.2 of XSL.
///
/// The defined values for the fo:hyphenation-ladder-count attribute are:
/// • no-limit:
/// • a value of type positiveInteger
#[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),
}
}
}
/// 20.200 fo:keep-together and fo:keep-with-next
/// See §7.19.3 of XSL.
/// In the OpenDocument XSL-compatible namespace, the fo:keep-together attribute does not
/// support the integer value.
/// The values of the fo:keep-together attribute are auto or always.
#[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(())
}
}
/// 20.203 fo:letter-spacing
///
/// See §7.16.2 of XSL.
///
/// In the OpenDocument XSL-compatible namespace, the fo:letter-spacing attribute does not
/// support the inherit and space values.
///
/// The defined value for the fo:letter-spacing attribute is a value of type length 18.3.18.
///
/// The values of the fo:letter-spacing attribute are a value of type length 18.3.18 or
/// normal.
#[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),
}
}
}
/// 20.204 fo:line-height
///
/// See §7.15.4 of XSL.
///
/// The value normal activates the default line height calculation. The value of this attribute
/// can be a length, a percentage, normal.
///
/// In the OpenDocument XSL-compatible namespace, the fo:line-height attribute does not
/// support the inherit, number, and space values.
///
/// The defined values for the fo:line-height attribute are:
/// • a value of type nonNegativeLength 18.3.20
/// • normal: disables the effects of style:line-height-at-least 20.317 and
/// style:line-spacing 20.318.
/// • a value of type percent 18.3.23
#[derive(Debug, Clone, Copy, PartialEq)]
#[allow(missing_docs)]
pub enum LineHeight {
Normal,
Length(Length),
Percent(Percent),
}
impl LineHeight {
/// Is the fontsize positive. Percentage is always positive.
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),
}
}
}
/// 20.205 fo:margin
///
/// See §7.29.14 of XSL.
///
/// In the OpenDocument XSL-compatible namespace, the fo:margin attribute does not support
/// auto and inherit values.
///
/// The values of the fo:margin attribute are a value of type nonNegativeLength 18.3.20 or a
/// value of type percent 18.3.23.
#[derive(Debug, Clone, Copy, PartialEq)]
#[allow(missing_docs)]
pub enum Margin {
Length(Length),
Percent(Percent),
}
impl Margin {
/// Is the fontsize positive. Percentage is always positive.
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),
}
}
}
/// 20.223 fo:text-align
///
/// See §7.15.9 of XSL.
///
/// If there are no values specified for the fo:text-align and style:justify-single-word
/// 20.301 attributes within the same formatting properties element, the values of those attributes is
/// set to start and false respectively.
/// In the OpenDocument XSL-compatible namespace, the fo:text-align attribute does not
/// support the inherit, inside, outside, or string values.
///
/// The values of the fo:text-align attribute are start, end, left, right, center or
/// justify.
#[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"),
}
}
}
/// 20.224 fo:text-align-last
///
/// See §7.15.10 of XSL.
///
/// This attribute is ignored if it not accompanied by an fo:text-align 20.223 attribute.
/// If no value is specified for this attribute, the value is set to start.
///
/// The values of the fo:text-align-last attribute are start, center or justify.
#[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"),
}
}
}
/// 20.225 fo:text-indent
///
/// The fo:text-indent attribute specifies a positive or negative indent for the first line of a
/// paragraph.
///
/// See §7.15.11 of XSL.
///
/// The attribute value is a length. If the attribute is contained in a
/// common style, the attribute value may be also a percentage that refers to the corresponding text
/// indent of a parent style.
#[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),
}
}
}
/// 20.227 fo:text-transform
///
/// See §7.16.6 of XSL.
///
/// If fo:text-transform and fo:font-variant 20.192 attributes are used simultaneously and
/// have different values than normal and none, the result is undefined.
///
/// Note: In consumers, the fo:text-transform and fo:font-variant
/// attributes are mutually exclusive.
///
/// The values of the fo:text-transform attribute are none, lowercase, uppercase or
/// capitalize.
#[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"),
}
}
}
/// 20.230 fo:wrap-option
/// See §7.15.13 of XSL.
///
/// If wrapping is disabled, it is implementation-defined whether the overflow text is visible or hidden.
/// If the text is hidden consumers may support a scrolling to access the text.
///
/// The values of the fo:wrap-option attribute are no-wrap or wrap.
#[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"),
}
}
}
/// 20.253 style:cell-protect
///
/// The style:cell-protect attribute specifies how a cell is protected.
/// This attribute is only evaluated if the current table is protected.
///
/// The defined values for the style:cell-protect attribute are:
/// • formula-hidden: if cell content is a formula, it is not displayed. It can be replaced by
/// changing the cell content.
/// Note: Replacement of cell content includes replacement with another formula or
/// other cell content.
/// • hidden-and-protected: cell content is not displayed and cannot be edited. If content is a
/// formula, the formula result is not displayed.
/// • none: formula responsible for cell content is neither hidden nor protected.
/// • protected: cell content cannot be edited.
/// • protected formula-hidden: cell content cannot be edited. If content is a formula, it is not
/// displayed. A formula result is displayed.
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[allow(missing_docs)]
pub enum CellProtect {
/// If cell content is a formula, it is not displayed. It can be replaced by
/// changing the cell content.
/// Note: Replacement of cell content includes replacement with another formula or
/// other cell content.
FormulaHidden,
/// cell content is not displayed and cannot be edited. If content is a
/// formula, the formula result is not displayed.
HiddenAndProtected,
/// Formula responsible for cell content is neither hidden nor protected.
None,
/// Cell content cannot be edited.
Protected,
/// cell content cannot be edited. If content is a formula, it is not
/// displayed.
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"),
}
}
}
/// 20.263 style:direction
///
/// The style:direction attribute specifies the direction of characters.
///
/// The style:direction attribute modifies the direction of text rendering as specified by a
/// style:writing-mode attribute. 20.404
///
/// The defined values for the style:direction attribute are:
/// * ltr – left to right, text is rendered in the direction specified by the style:writing-mode
/// attribute
/// * ttb – top to bottom, characters are vertically stacked but not rotated
#[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"),
}
}
}
/// 20.283 style:font-relief
///
/// The style:font-relief attribute specifies whether a font should be embossed, engraved, or
/// neither.
///
/// The defined values for the style:font-relief attribute are:
/// * embossed: characters are embossed.
/// * engraved: characters are engraved.
/// * none: characters are neither embossed or engraved.
#[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"),
}
}
}
/// 20.297 style:glyph-orientation-vertical
///
/// The style:glyph-orientation-vertical attribute specifies a vertical glyph orientation.
/// See §10.7.3 of SVG. The attribute specifies an angle or automatic mode. The only defined angle
/// is 0 degrees, which disables this feature.
///
/// Note: OpenDocument v1.1 did not support angle specifications that contain an
/// angle unit identifier. Angle unit identifiers should be omitted for compatibility with
/// OpenDocument v1.1.
///
/// The values of the style:glyph-orientation-vertical attribute are auto, 0, 0deg, 0rad
/// or 0grad.
#[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),
}
}
}
/// 20.315 style:line-break
/// The style:line-break attribute specifies line breaking rules.
/// The defined values for the style:line-break attribute are:
/// * normal: line breaks may occur between any characters.
/// * strict: line breaks shall not occur before or after implementation-defined characters.
#[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(())
}
}
/// 20.322 style:num-format
///
/// The style:num-format attribute specifies a numbering sequence.
/// If no value is given, no number sequence is displayed.
///
/// The defined values for the style:num-format attribute are:
/// • 1: number sequence starts with “1”.
/// • a: number sequence starts with “a”.
/// • A: number sequence starts with “A”.
/// • empty string: no number sequence displayed.
/// • i: number sequence starts with “i”.
/// • I: number sequence start with “I”.
/// • a value of type string 18.2
#[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),
}
}
}
/// 20.328 style:page-number
///
/// The style:page-number attribute specifies the page number that should be used for a new
/// page when either a paragraph or table style specifies a master page that should be applied
/// beginning from the start of a paragraph or table.
///
/// The defined values for the style:page-number attribute are:
/// • auto: a page has the page number of the previous page, incremented by one.
/// • a value of type nonNegativeInteger 18.2: specifies a page number.
#[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),
}
}
}
/// 20.330 style:print
///
/// The style:print attribute specifies the components in a spreadsheet document to print.
///
/// The value of the style:print attribute is a white space separated list of one or more of these
/// values:
/// • annotations: annotations should be printed.
/// • charts: charts should be printed.
/// • drawings: drawings should be printed.
/// • formulas: formulas should be printed.
/// • grid: grid lines should be printed.
/// • headers: headers should be printed.
/// • objects: (including graphics): objects should be printed.
/// • zero-values: zero-values should be printed.
#[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"),
}
}
}
/// 20.332 style:print-page-order
///
/// The style:print-page-order attribute specifies the order in which data in a spreadsheet is
/// numbered and printed when the data does not fit on one printed page.
///
/// The defined values for the style:print-page-order attribute are:
/// • ltr: create pages from the first column to the last column before continuing with the next set
/// of rows.
/// • ttb: create pages from the top row to the bottom row before continuing with the next set of
/// columns.
#[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"),
}
}
}
/// 20.333 style:print-orientation
///
/// The style:print-orientation attribute specifies the orientation of the printed page. The
/// value of this attribute can be portrait or landscape.
///
/// The defined values for the style:print-orientation attribute are:
/// • landscape: a page is printed in landscape orientation.
/// • portrait: a page is printed in portrait orientation
#[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"),
}
}
}
/// 20.335 style:punctuation-wrap
///
/// The style:punctuation-wrap attribute specifies whether a punctuation mark, if one is
/// present, can be hanging, that is, whether it can placed in the margin area at the end of a full line of
/// text.
///
/// The defined values for the style:punctuation-wrap attribute are:
/// • hanging: a punctuation mark can be placed in the margin area at the end of a full line of text.
/// • simple: a punctuation mark cannot be placed in the margin area at the end of a full line of
/// text.
#[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"),
}
}
}
/// 20.340 style:rel-width
///
/// The style:rel-width attribute specifies the width of a table relative to the width of the area
/// that the table is in.
///
/// The style:rel-width attribute has the data type percent 18.3.23.
#[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),
}
}
}
/// 20.346 style:rotation-align
/// The style:rotation-align attribute specifies how the edge of the text in a cell is aligned
/// after a rotation.
///
/// The values of the style:rotation-align attribute are none, bottom, top or center.
#[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"),
}
}
}
/// 20.363 style:table-centering
///
/// The style:table-centering attribute specifies whether tables are centered horizontally and/
/// or vertically on the page. This attribute only applies to spreadsheet documents.
///
/// The default is to align the table to the top-left or top-right corner of the page, depending of its
/// writing direction.
///
/// The defined values for the style:table-centering attribute are:
/// • both: tables should be centered both horizontally and vertically on the pages where they
/// appear.
/// • horizontal: tables should be centered horizontally on the pages where they appear.
/// • none: tables should not be centered both horizontally or vertically on the pages where they
/// appear.
/// • vertical: tables should be centered vertically on the pages where they appear.
#[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"),
}
}
}
/// 20.364 style:text-align-source
///
/// The style:text-align-source attribute specifies the source of a text-align attribute.
///
/// The defined values for the style:text-align-source attribute are:
/// • fix: content alignment uses the value of the fo:text-align 20.223 attribute.
/// • value-type: content alignment uses the value-type of the cell.
///
/// The default alignment for a cell value-type string is left, for other value-types it is right.
///
/// The values of the style:text-align-source attribute are fix or value-type.
#[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"),
}
}
}
/// 20.365 style:text-autospace
///
/// The style:text-autospace attribute specifies whether to add space between portions of
/// Asian, Western, and complex texts.
///
/// The defined values for the style:text-autospace attribute are:
/// • ideograph-alpha: space should be added between portions of Asian, Western and
/// Complex texts.
/// • none: space should not be added between portions of Asian, Western and complex texts.
#[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"),
}
}
}
/// 20.367 style:text-combine
///
/// The style:text-combine attribute specifies whether to combine characters so that they are
/// displayed within two lines.
///
/// The defined values for the style:text-combine attribute are:
/// * letters: Display text in Kumimoji. Up to five (5) characters are combined within two lines
/// and are displayed with a reduced size in a single wide-cell character. Additional characters
/// are displayed as normal text.
/// * lines: Displays text in Warichu. All characters with the style:text-combine attribute that
/// immediately follow each other are displayed within two lines of approximately the same length.
/// A line break may occur between any two characters to meet this constraint.
/// * none: characters should not be combined.
#[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"),
}
}
}
/// 20.370 style:text-emphasize
///
/// The style:text-emphasize attribute specifies emphasis in a text composed of UNICODE
/// characters whose script type is asian. 20.358
///
/// The value of this attribute consists of two white space-separated values.
/// The first value represents the style to use for emphasis.
/// The second value represents the position of the emphasis and it can be above or below. If the
/// first value is none, the second value can be omitted.
///
/// The defined values for the style:text-emphasize attribute are:
/// * accent: calligraphic accent strokes.
/// * circle: hollow circles.
/// * disc: filled circles.
/// * dot: calligraphic dot.
/// * none: no emphasis marks.
#[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"),
}
}
}
/// 20.370 style:text-emphasize
///
/// The style:text-emphasize attribute specifies emphasis in a text composed of UNICODE
/// characters whose script type is asian. 20.358
///
/// The value of this attribute consists of two white space-separated values.
/// The first value represents the style to use for emphasis.
/// The second value represents the position of the emphasis and it can be above or below. If the
/// first value is none, the second value can be omitted.
///
/// The defined values for the style:text-emphasize attribute are:
/// * accent: calligraphic accent strokes.
/// * circle: hollow circles.
/// * disc: filled circles.
/// * dot: calligraphic dot.
/// * none: no emphasis marks.
#[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"),
}
}
}
/// Line modes for underline, overline, line-through.
///
/// 20.372 style:text-line-through-mode
/// 20.380 style:text-overline-mode
/// 20.389 style:text-underline-mode
///
/// The style:text-line-through-mode attribute specifies whether lining through is applied to
/// words only or to portions of text.
///
/// The defined values for the style:text-line-through-mode attribute are:
/// • continuous: lining is applied to words and separating spaces.
/// • skip-white-space: lining is not applied to spaces between words.
///
/// The values of the style:text-line-through-mode attribute are continuous or skip-white-space.
#[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"),
}
}
}
/// Line style for underline, overline, line-through.
///
/// 20.373 style:text-line-through-style
/// 20.390 style:text-underline-style
/// 20.381 style:text-overline-style
///
/// The style:text-underline-style attribute specifies a style for underlining text.
/// The defined values for the style:text-underline-style attribute are:
/// * none: text has no underlining.
/// * dash: text has a dashed line underlining it.
/// * dot-dash: text has a line whose repeating pattern is a dot followed by a dash underlining it.
/// * dot-dot-dash: text has a line whose repeating pattern is two dots followed by a dash
/// underlining it.
/// * dotted: text has a dotted line underlining it.
/// * long-dash: text has a dashed line whose dashes are longer than the ones from the dashed
/// line for value dash underlining it.
/// * solid: text has a solid line underlining it.
/// * wave: text has a wavy line underlining it.
///
/// Note: The definitions of the values of the style:text-underline-style
/// attribute are based on the text decoration style 'text-underline-style' from
/// CSS3Text, §9.2.
///
/// The values of the style:text-underline-style attribute are none, solid, dotted, dash,
/// long-dash, dot-dash, dot-dot-dash or wave.
#[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"),
}
}
}
/// 20.376 style:text-line-through-type
/// 20.382 style:text-overline-type
/// 20.391 style:text-underline-type
///
/// The style:text-line-through-type attribute specifies whether text is lined through, and if
/// so, whether a single or double line will be used.
///
/// The defined values for the style:text-line-through-type attribute are:
/// • double: a double line should be used for a line-through text.
/// • none: deprecated.
/// • single: a single line should be used for a line-through text.
///
/// Every occurrence of the style:text-line-through-type attribute should be accompanied
/// by an occurrence of the style:text-line-through-style 20.373 attribute on the same
/// element. There should not be an occurrence of the style:text-line-through-type attribute
/// if the value of the style:text-line-through-style attribute is none.
///
/// The values of the style:text-line-through-type attribute are none, single or double.
#[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"),
}
}
}
/// Line width for underline, overline, line-through.
///
/// 20.377 style:text-line-through-width
/// 20.383 style:text-overline-width
/// 20.392 style:text-underline-width
///
/// The style:text-line-through-width attribute specifies the width of a line-through line. The
/// value bold specifies a line width that is calculated from the font sizes like an auto width, but is
/// wider than an auto width.
///
/// The defined values for the style:text-line-through-width attribute are:
/// • auto: the width of a line-through should be calculated from the font size of the text where the
/// line-through will appear.
/// • bold: the width of a line-through should be calculated from the font size of the text where the
/// line-through will appear but is wider than for the value of auto.
/// • a value of type percent 18.3.23
/// • a value of type positiveInteger 18.2
/// • a value of type positiveLength 18.3.26
///
/// The line-through text styles referenced by the values dash, medium, thick and thin, are
/// implementation-defined. Thin shall be smaller width than medium and medium shall be a smaller
/// width than thick.
///
/// The values of the style:text-line-through-width attribute are auto, normal, bold,
/// thin, medium, thick, a value of type positiveInteger 18.2, a value of type percent
/// 18.3.23 or a value of type positiveLength 18.3.26.
#[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"),
}
}
}
/// 20.384 style:text-position
///
/// The style:text-position attribute specifies whether text is positioned above or below the
/// baseline:
///
/// The value specifies the vertical text position as a percentage of the
/// current font height or it takes one of the values sub or super. Negative percentages or the sub
/// value place the text below the baseline. Positive percentages or the super value place the text
/// above the baseline. If sub or super is specified, the consumer chooses an appropriate text
/// position.
///
/// The style:text-position attribute has one or two white space separated values. The first
/// values is of type percent 18.3.23, or is one of: super or sub.
#[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),
}
}
}
/// 20.386 style:text-rotation-scale
/// The style:text-rotation-scale attribute specifies whether for rotated text the width of the
/// text should be scaled to fit into the current line height or the width of the text should remain fixed,
/// therefore changing the current line height.
///
/// The defined values for the style:text-rotation-scale attribute are:
/// * fixed: width of text should remain fixed.
/// * line-height: width of text should be scaled to fit the current line height.
///
/// The values of the style:text-rotation-scale attribute are fixed or line-height
#[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"),
}
}
}
/// 20.396 style:vertical-align
///
/// The style:vertical-align attribute specifies the vertical position of a character. By default
/// characters are aligned according to their baseline.
///
/// The defined values for the style:vertical-align attribute are:
/// * auto: automatically, which sets the vertical alignment to suit the text rotation. Text that is
/// rotated 0 or 90 degrees is aligned to the baseline, while text that is rotated 270 degrees is
/// aligned to the center of the line.
/// * baseline: to the baseline of the character.
/// * bottom: to the bottom of the line.
/// * middle: to the center of the line.
/// * top: to the top of the line.
///
/// The values of the style:vertical-align attribute are top, middle, bottom, auto or
/// baseline.
#[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"),
}
}
}
/// 20.396 style:vertical-align
///
/// The style:vertical-align attribute specifies the vertical alignment of text in a table cell. The
/// options for the vertical alignment attribute are as follows:
///
/// The defined values for the style:vertical-align attribute are:
/// * automatic: consumer determines how to align the text.
/// * bottom: aligns text vertically with the bottom of the cell.
/// * middle: aligns text vertically with the middle of the cell.
/// * top: aligns text vertically with the top of the cell.
///
/// The values of the style:vertical-align attribute are top, middle, bottom or
/// automatic.
#[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"),
}
}
}
/// 20.404 style:writing-mode
///
/// See §7.27.7 of XSL with the additional value of page.
/// The defined value for the style:writing-mode attribute is page: writing mode is inherited from
/// the page that contains the element where this attribute appears.
///
/// The values of the style:writing-mode attribute are lr-tb, rl-tb, tb-rl, tb-lr, lr, rl,
/// tb or page.
#[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"),
}
}
}
/// 20.414 table:align
///
/// The table:align attribute specifies the horizontal alignment of a table.
///
/// The defined values for the table:align attribute are:
/// • center: table aligns to the center between left and right margins.
/// • left: table aligns to the left margin.
/// • margins: table fills all the space between the left and right margins.
/// • right: table aligns to the right margin.
///
/// Consumers that do not support the margins value, may treat this value as left.
#[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"),
}
}
}
/// 20.415 table:border-model
///
/// The table:border-model attribute specifies what border model to use when creating a table
/// with a border.
///
/// The defined values for the table:border-model attribute are:
/// • collapsing: when two adjacent cells have different borders, the wider border appears as
/// the border between the cells. Each cell receives half of the width of the border.
/// • separating: borders appear within the cell that specifies the border.
///
/// In OpenDocument, a row height or column width includes any space required to display borders
/// or padding. This means that, while the width and height of the content area is less than the
/// column width and row height, the sum of the widths of all columns is equal to the total width of the
/// table.
#[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"),
}
}
}
/// 20.426 text:condition
///
/// The text:condition attribute specifies the display of text.
/// The defined value of the text:condition attribute is none, which means text is hidden.
#[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"),
}
}
}
/// 20.427 text:display
///
/// The text:display attribute specifies whether text is hidden.
///
/// The defined values for the text:display attribute are:
/// • condition: text is hidden under the condition specified in the text:condition 20.426
/// attribute.
/// • none: text is hidden unconditionally.
/// • true: text is displayed. This is the default setting
#[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"),
}
}
}