use crate::excel::XmlReader;
use anyhow::bail;
use outline::XlsxOutline;
use quick_xml::events::Event;
use std::io::Read;
pub mod custom_dash;
pub mod head_end;
pub mod line_join_bevel;
pub mod line_reference;
pub mod miter;
pub mod outline;
pub mod round_line_join;
pub mod tail_end;
pub type XlsxLineStyleList = Vec<XlsxOutline>;
pub(crate) fn load_line_style_list(
reader: &mut XmlReader<impl Read>,
) -> anyhow::Result<XlsxLineStyleList> {
let mut outlines: Vec<XlsxOutline> = vec![];
let mut buf = Vec::new();
loop {
buf.clear();
match reader.read_event_into(&mut buf) {
Ok(Event::Start(ref e)) if e.local_name().as_ref() == b"ln" => {
outlines.push(XlsxOutline::load(reader, e)?);
}
Ok(Event::End(ref e)) if e.local_name().as_ref() == b"lnStyleLst" => break,
Ok(Event::Eof) => bail!("unexpected end of file."),
Err(e) => bail!(e.to_string()),
_ => (),
}
}
Ok(outlines)
}