Skip to main content

umya_spreadsheet/structs/drawing/
spacing_percent.rs

1// a:spcPct
2use std::io::Cursor;
3
4use quick_xml::{
5    Reader,
6    Writer,
7    events::BytesStart,
8};
9
10use super::super::super::Int32Value;
11use crate::{
12    reader::driver::get_attribute,
13    writer::driver::write_start_tag,
14};
15
16#[derive(Clone, Default, Debug)]
17pub struct SpacingPercent {
18    val: Int32Value,
19}
20impl SpacingPercent {
21    #[inline]
22    #[must_use]
23    pub fn val(&self) -> i32 {
24        self.val.value()
25    }
26
27    #[inline]
28    #[must_use]
29    #[deprecated(since = "3.0.0", note = "Use val()")]
30    pub fn get_val(&self) -> i32 {
31        self.val()
32    }
33
34    #[inline]
35    pub fn set_val(&mut self, value: i32) -> &mut Self {
36        self.val.set_value(value);
37        self
38    }
39
40    #[inline]
41    pub(crate) fn set_attributes<R: std::io::BufRead>(
42        &mut self,
43        _reader: &mut Reader<R>,
44        e: &BytesStart,
45    ) {
46        self.val.set_value_string(get_attribute(e, b"val").unwrap());
47    }
48
49    #[inline]
50    pub(crate) fn write_to(&self, writer: &mut Writer<Cursor<Vec<u8>>>) {
51        // a:spcPct
52        write_start_tag(
53            writer,
54            "a:spcPct",
55            vec![("val", &self.val.value_string()).into()],
56            true,
57        );
58    }
59}