umya_spreadsheet/structs/drawing/
bevel_bottom.rs1use std::io::Cursor;
3
4use quick_xml::{
5 Reader,
6 Writer,
7 events::BytesStart,
8};
9
10use super::{
11 super::{
12 EnumValue,
13 Int64Value,
14 },
15 BevelPresetValues,
16};
17use crate::{
18 reader::driver::{
19 get_attribute,
20 set_string_from_xml,
21 },
22 writer::driver::write_start_tag,
23};
24
25#[derive(Clone, Default, Debug)]
26pub struct BevelBottom {
27 width: Int64Value,
28 height: Int64Value,
29 preset: EnumValue<BevelPresetValues>,
30}
31
32impl BevelBottom {
33 #[inline]
34 #[must_use]
35 pub fn width(&self) -> i64 {
36 self.width.value()
37 }
38
39 #[inline]
40 #[must_use]
41 #[deprecated(since = "3.0.0", note = "Use width()")]
42 pub fn get_width(&self) -> i64 {
43 self.width()
44 }
45
46 #[inline]
47 pub fn set_width(&mut self, value: i64) -> &mut BevelBottom {
48 self.width.set_value(value);
49 self
50 }
51
52 #[inline]
53 #[must_use]
54 pub fn height(&self) -> i64 {
55 self.height.value()
56 }
57
58 #[inline]
59 #[must_use]
60 #[deprecated(since = "3.0.0", note = "Use height()")]
61 pub fn get_height(&self) -> i64 {
62 self.height()
63 }
64
65 #[inline]
66 pub fn set_height(&mut self, value: i64) -> &mut BevelBottom {
67 self.height.set_value(value);
68 self
69 }
70
71 #[inline]
72 #[must_use]
73 pub fn preset(&self) -> &BevelPresetValues {
74 self.preset.value()
75 }
76
77 #[inline]
78 #[must_use]
79 #[deprecated(since = "3.0.0", note = "Use preset()")]
80 pub fn get_preset(&self) -> &BevelPresetValues {
81 self.preset()
82 }
83
84 #[inline]
85 pub fn set_preset(&mut self, value: BevelPresetValues) -> &mut BevelBottom {
86 self.preset.set_value(value);
87 self
88 }
89
90 #[inline]
91 pub(crate) fn set_attributes<R: std::io::BufRead>(
92 &mut self,
93 _reader: &mut Reader<R>,
94 e: &BytesStart,
95 ) {
96 set_string_from_xml!(self, e, width, "w");
97 set_string_from_xml!(self, e, height, "h");
98 set_string_from_xml!(self, e, preset, "prst");
99 }
100
101 pub(crate) fn write_to(&self, writer: &mut Writer<Cursor<Vec<u8>>>) {
102 let mut attributes: crate::structs::AttrCollection = Vec::new();
104 let width = self.width.value_string();
105 if self.width.has_value() {
106 attributes.push(("w", &width).into());
107 }
108 let height = self.height.value_string();
109 if self.height.has_value() {
110 attributes.push(("h", &height).into());
111 }
112 if self.preset.has_value() {
113 attributes.push(("prst", self.preset.value_string()).into());
114 }
115
116 write_start_tag(writer, "a:bevelB", attributes, true);
117 }
118}