umya_spreadsheet/structs/vml/
path.rs

1use super::office::ConnectValues;
2use crate::reader::driver::*;
3use crate::structs::EnumValue;
4use crate::writer::driver::*;
5use quick_xml::events::BytesStart;
6use quick_xml::Reader;
7use quick_xml::Writer;
8use std::io::Cursor;
9
10#[derive(Clone, Default, Debug)]
11pub struct Path {
12    connection_point_type: EnumValue<ConnectValues>,
13}
14impl Path {
15    pub fn get_connection_point_type(&self) -> &ConnectValues {
16        self.connection_point_type.get_value()
17    }
18
19    pub fn set_connection_point_type(&mut self, value: ConnectValues) -> &mut Self {
20        self.connection_point_type.set_value(value);
21        self
22    }
23
24    pub(crate) fn set_attributes<R: std::io::BufRead>(
25        &mut self,
26        _reader: &mut Reader<R>,
27        e: &BytesStart,
28    ) {
29        set_string_from_xml!(self, e, connection_point_type, "o:connecttype");
30    }
31
32    pub(crate) fn write_to(&self, writer: &mut Writer<Cursor<Vec<u8>>>) {
33        // v:path
34        let mut attributes: Vec<(&str, &str)> = Vec::new();
35        if self.connection_point_type.has_value() {
36            attributes.push((
37                "o:connecttype",
38                self.connection_point_type.get_value_string(),
39            ));
40        }
41        write_start_tag(writer, "v:path", attributes, true);
42    }
43}