parent
ca6e24179d
commit
fe34873259
|
@ -0,0 +1,35 @@
|
|||
use serde::{Deserialize, Serialize, Serializer};
|
||||
|
||||
use crate::documents::BuildXML;
|
||||
use crate::xml_builder::*;
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, PartialEq)]
|
||||
pub struct IsLgl {}
|
||||
|
||||
impl IsLgl {
|
||||
pub fn new() -> IsLgl {
|
||||
IsLgl {}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for IsLgl {
|
||||
fn default() -> Self {
|
||||
IsLgl {}
|
||||
}
|
||||
}
|
||||
|
||||
impl BuildXML for IsLgl {
|
||||
fn build(&self) -> Vec<u8> {
|
||||
let b = XMLBuilder::new();
|
||||
b.is_lgl().build()
|
||||
}
|
||||
}
|
||||
|
||||
impl Serialize for IsLgl {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
serializer.serialize_bool(true)
|
||||
}
|
||||
}
|
|
@ -17,6 +17,8 @@ pub struct Level {
|
|||
pub suffix: LevelSuffixType,
|
||||
pub pstyle: Option<String>,
|
||||
pub level_restart: Option<LevelRestart>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub is_lgl: Option<IsLgl>,
|
||||
}
|
||||
|
||||
impl Level {
|
||||
|
@ -38,6 +40,7 @@ impl Level {
|
|||
suffix: LevelSuffixType::Tab,
|
||||
pstyle: None,
|
||||
level_restart: None,
|
||||
is_lgl: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -114,6 +117,11 @@ impl Level {
|
|||
self.level_restart = Some(LevelRestart::new(v));
|
||||
self
|
||||
}
|
||||
|
||||
pub fn is_lgl(mut self) -> Self {
|
||||
self.is_lgl = Some(IsLgl::new());
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl BuildXML for Level {
|
||||
|
@ -126,7 +134,8 @@ impl BuildXML for Level {
|
|||
.add_child(&self.jc)
|
||||
.add_child(&self.paragraph_property)
|
||||
.add_child(&self.run_property)
|
||||
.add_optional_child(&self.level_restart);
|
||||
.add_optional_child(&self.level_restart)
|
||||
.add_optional_child(&self.is_lgl);
|
||||
|
||||
if self.suffix != LevelSuffixType::Tab {
|
||||
b = b.suffix(&self.suffix.to_string());
|
||||
|
|
|
@ -39,6 +39,7 @@ mod instr_pageref;
|
|||
mod instr_tc;
|
||||
mod instr_text;
|
||||
mod instr_toc;
|
||||
mod is_lgl;
|
||||
mod italic;
|
||||
mod italic_cs;
|
||||
mod justification;
|
||||
|
@ -73,6 +74,7 @@ mod section;
|
|||
mod section_property;
|
||||
mod shading;
|
||||
mod shape;
|
||||
mod spec_vanish;
|
||||
mod start;
|
||||
mod strike;
|
||||
mod structured_data_tag;
|
||||
|
@ -106,7 +108,6 @@ mod text_direction;
|
|||
mod underline;
|
||||
mod v_align;
|
||||
mod vanish;
|
||||
mod spec_vanish;
|
||||
mod vert_align;
|
||||
mod vertical_merge;
|
||||
mod wp_anchor;
|
||||
|
@ -155,6 +156,7 @@ pub use instr_pageref::*;
|
|||
pub use instr_tc::*;
|
||||
pub use instr_text::*;
|
||||
pub use instr_toc::*;
|
||||
pub use is_lgl::*;
|
||||
pub use italic::*;
|
||||
pub use italic_cs::*;
|
||||
pub use justification::*;
|
||||
|
@ -189,6 +191,7 @@ pub use section::*;
|
|||
pub use section_property::*;
|
||||
pub use shading::*;
|
||||
pub use shape::*;
|
||||
pub use spec_vanish::*;
|
||||
pub use start::*;
|
||||
pub use strike::*;
|
||||
pub use structured_data_tag::*;
|
||||
|
@ -222,7 +225,6 @@ pub use text_direction::*;
|
|||
pub use underline::*;
|
||||
pub use v_align::*;
|
||||
pub use vanish::*;
|
||||
pub use spec_vanish::*;
|
||||
pub use vert_align::*;
|
||||
pub use vertical_merge::*;
|
||||
pub use wp_anchor::*;
|
||||
|
|
|
@ -28,6 +28,7 @@ impl ElementReader for Level {
|
|||
let mut level_restart = None;
|
||||
let mut has_indent = false;
|
||||
let mut suffix = LevelSuffixType::Tab;
|
||||
let mut is_lgl = None;
|
||||
|
||||
loop {
|
||||
let e = r.next();
|
||||
|
@ -62,6 +63,9 @@ impl ElementReader for Level {
|
|||
XMLElement::Suffix => {
|
||||
suffix = LevelSuffixType::from_str(&attributes[0].value)?;
|
||||
}
|
||||
XMLElement::IsLgl => {
|
||||
is_lgl = Some(IsLgl::new());
|
||||
}
|
||||
XMLElement::LevelText => {
|
||||
level_text = LevelText::new(attributes[0].value.clone());
|
||||
}
|
||||
|
@ -98,6 +102,7 @@ impl ElementReader for Level {
|
|||
l.paragraph_property = ppr;
|
||||
l.run_property = rpr;
|
||||
l.level_restart = level_restart;
|
||||
l.is_lgl = is_lgl;
|
||||
return Ok(l);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -126,6 +126,7 @@ pub enum XMLElement {
|
|||
Num,
|
||||
NumberFormat,
|
||||
Suffix,
|
||||
IsLgl,
|
||||
LevelText,
|
||||
LevelJustification,
|
||||
LevelRestart,
|
||||
|
@ -334,6 +335,7 @@ impl FromStr for XMLElement {
|
|||
"num" => Ok(XMLElement::Num),
|
||||
"numFmt" => Ok(XMLElement::NumberFormat),
|
||||
"suff" => Ok(XMLElement::Suffix),
|
||||
"isLgl" => Ok(XMLElement::IsLgl),
|
||||
"lvlText" => Ok(XMLElement::LevelText),
|
||||
"lvlRestart" => Ok(XMLElement::LevelRestart),
|
||||
"lvlJc" => Ok(XMLElement::LevelJustification),
|
||||
|
|
|
@ -411,6 +411,7 @@ impl XMLBuilder {
|
|||
closed_with_str!(abstract_num_id, "w:abstractNumId");
|
||||
closed!(vanish, "w:vanish");
|
||||
closed!(spec_vanish, "w:specVanish");
|
||||
closed!(is_lgl, "w:isLgl");
|
||||
|
||||
open!(open_drawing, "w:drawing");
|
||||
open!(open_anchor, "wp:anchor");
|
||||
|
|
|
@ -305,6 +305,7 @@ macro_rules! closed_with_child {
|
|||
|
||||
macro_rules! closed {
|
||||
($name: ident, $el_name: expr) => {
|
||||
#[allow(clippy::wrong_self_convention)]
|
||||
pub(crate) fn $name(mut self) -> Self {
|
||||
self.writer
|
||||
.write(XmlEvent::start_element($el_name))
|
||||
|
@ -313,6 +314,8 @@ macro_rules! closed {
|
|||
}
|
||||
};
|
||||
($name: ident, $el_name: expr, $attr0: expr) => {
|
||||
#[allow(clippy::wrong_self_convention)]
|
||||
|
||||
pub(crate) fn $name(mut self, arg0: &str) -> Self {
|
||||
self.writer
|
||||
.write(XmlEvent::start_element($el_name).attr($attr0, arg0))
|
||||
|
@ -322,6 +325,7 @@ macro_rules! closed {
|
|||
};
|
||||
($name: ident, $el_name: expr, $attr0: expr, $attr1: expr) => {
|
||||
#[allow(dead_code)]
|
||||
#[allow(clippy::wrong_self_convention)]
|
||||
pub(crate) fn $name(mut self, arg0: &str, arg1: &str) -> Self {
|
||||
self.writer
|
||||
.write(
|
||||
|
|
|
@ -12,6 +12,7 @@ export type LevelJSON = {
|
|||
runProperty: RunPropertyJSON;
|
||||
pstyle: string | null;
|
||||
levelRestart: number | null;
|
||||
isLgl?: boolean | null;
|
||||
};
|
||||
|
||||
export type AbstractNumberingJSON = {
|
||||
|
|
|
@ -2148,6 +2148,7 @@ Object {
|
|||
},
|
||||
Object {
|
||||
"format": "decimal",
|
||||
"isLgl": true,
|
||||
"jc": "left",
|
||||
"level": 1,
|
||||
"levelRestart": null,
|
||||
|
@ -2178,6 +2179,7 @@ Object {
|
|||
},
|
||||
Object {
|
||||
"format": "decimal",
|
||||
"isLgl": true,
|
||||
"jc": "left",
|
||||
"level": 2,
|
||||
"levelRestart": null,
|
||||
|
@ -2208,6 +2210,7 @@ Object {
|
|||
},
|
||||
Object {
|
||||
"format": "decimal",
|
||||
"isLgl": true,
|
||||
"jc": "left",
|
||||
"level": 3,
|
||||
"levelRestart": null,
|
||||
|
@ -2238,6 +2241,7 @@ Object {
|
|||
},
|
||||
Object {
|
||||
"format": "decimal",
|
||||
"isLgl": true,
|
||||
"jc": "left",
|
||||
"level": 4,
|
||||
"levelRestart": null,
|
||||
|
@ -2268,6 +2272,7 @@ Object {
|
|||
},
|
||||
Object {
|
||||
"format": "decimal",
|
||||
"isLgl": true,
|
||||
"jc": "left",
|
||||
"level": 5,
|
||||
"levelRestart": null,
|
||||
|
@ -2298,6 +2303,7 @@ Object {
|
|||
},
|
||||
Object {
|
||||
"format": "decimal",
|
||||
"isLgl": true,
|
||||
"jc": "left",
|
||||
"level": 6,
|
||||
"levelRestart": null,
|
||||
|
@ -2328,6 +2334,7 @@ Object {
|
|||
},
|
||||
Object {
|
||||
"format": "decimal",
|
||||
"isLgl": true,
|
||||
"jc": "left",
|
||||
"level": 7,
|
||||
"levelRestart": null,
|
||||
|
@ -2358,6 +2365,7 @@ Object {
|
|||
},
|
||||
Object {
|
||||
"format": "decimal",
|
||||
"isLgl": true,
|
||||
"jc": "left",
|
||||
"level": 8,
|
||||
"levelRestart": null,
|
||||
|
@ -61014,6 +61022,7 @@ Object {
|
|||
},
|
||||
Object {
|
||||
"format": "decimal",
|
||||
"isLgl": true,
|
||||
"jc": "left",
|
||||
"level": 1,
|
||||
"levelRestart": null,
|
||||
|
@ -61044,6 +61053,7 @@ Object {
|
|||
},
|
||||
Object {
|
||||
"format": "decimal",
|
||||
"isLgl": true,
|
||||
"jc": "left",
|
||||
"level": 2,
|
||||
"levelRestart": null,
|
||||
|
@ -61074,6 +61084,7 @@ Object {
|
|||
},
|
||||
Object {
|
||||
"format": "decimal",
|
||||
"isLgl": true,
|
||||
"jc": "left",
|
||||
"level": 3,
|
||||
"levelRestart": null,
|
||||
|
@ -61104,6 +61115,7 @@ Object {
|
|||
},
|
||||
Object {
|
||||
"format": "decimal",
|
||||
"isLgl": true,
|
||||
"jc": "left",
|
||||
"level": 4,
|
||||
"levelRestart": null,
|
||||
|
@ -61134,6 +61146,7 @@ Object {
|
|||
},
|
||||
Object {
|
||||
"format": "decimal",
|
||||
"isLgl": true,
|
||||
"jc": "left",
|
||||
"level": 5,
|
||||
"levelRestart": null,
|
||||
|
@ -61164,6 +61177,7 @@ Object {
|
|||
},
|
||||
Object {
|
||||
"format": "decimal",
|
||||
"isLgl": true,
|
||||
"jc": "left",
|
||||
"level": 6,
|
||||
"levelRestart": null,
|
||||
|
@ -61194,6 +61208,7 @@ Object {
|
|||
},
|
||||
Object {
|
||||
"format": "decimal",
|
||||
"isLgl": true,
|
||||
"jc": "left",
|
||||
"level": 7,
|
||||
"levelRestart": null,
|
||||
|
@ -61224,6 +61239,7 @@ Object {
|
|||
},
|
||||
Object {
|
||||
"format": "decimal",
|
||||
"isLgl": true,
|
||||
"jc": "left",
|
||||
"level": 8,
|
||||
"levelRestart": null,
|
||||
|
@ -93223,6 +93239,7 @@ Object {
|
|||
},
|
||||
Object {
|
||||
"format": "decimal",
|
||||
"isLgl": true,
|
||||
"jc": "left",
|
||||
"level": 1,
|
||||
"levelRestart": null,
|
||||
|
@ -132445,6 +132462,7 @@ Object {
|
|||
},
|
||||
Object {
|
||||
"format": "decimal",
|
||||
"isLgl": true,
|
||||
"jc": "left",
|
||||
"level": 1,
|
||||
"levelRestart": null,
|
||||
|
@ -134464,6 +134482,7 @@ Object {
|
|||
},
|
||||
Object {
|
||||
"format": "decimal",
|
||||
"isLgl": true,
|
||||
"jc": "left",
|
||||
"level": 1,
|
||||
"levelRestart": null,
|
||||
|
@ -134767,6 +134786,7 @@ Object {
|
|||
},
|
||||
Object {
|
||||
"format": "decimal",
|
||||
"isLgl": true,
|
||||
"jc": "left",
|
||||
"level": 1,
|
||||
"levelRestart": null,
|
||||
|
@ -135070,6 +135090,7 @@ Object {
|
|||
},
|
||||
Object {
|
||||
"format": "decimal",
|
||||
"isLgl": true,
|
||||
"jc": "left",
|
||||
"level": 1,
|
||||
"levelRestart": null,
|
||||
|
|
Loading…
Reference in New Issue