1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#![allow(unused_must_use)]
use std::borrow::Cow;
use strong_xml::{XmlRead, XmlWrite};
use crate::{__setter, __xml_test_suites};
use super::BodyContent;
#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:sdt")]
pub struct SDT<'a> {
#[xml(child = "w:sdtPr")]
pub property: Option<SDTProperty<'a>>,
#[xml(child = "w:sdtEndPr")]
pub end_property: Option<SDTEndProperty>,
#[xml(child = "w:sdtContent")]
pub content: Option<SDTContent<'a>>,
}
impl<'a> SDT<'a> {
__setter!(property: Option<SDTProperty<'a>>);
__setter!(end_property: Option<SDTEndProperty>);
__setter!(content: Option<SDTContent<'a>>);
}
#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:sdtPr")]
pub struct SDTProperty<'a> {
#[xml(child = "w:id")]
pub id: Option<STDId>,
#[xml(child = "w:docPartObj")]
pub doc_part_obj: Option<DocPartObj<'a>>,
}
#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:id")]
pub struct STDId {
#[xml(attr = "w:val")]
pub id: Option<isize>,
}
#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:docPartObj")]
pub struct DocPartObj<'a> {
#[xml(child = "w:docPartGallery")]
pub doc_part_gallery: Option<DocPartGallery<'a>>,
#[xml(child = "w:docPartUnique")]
pub doc_part_unique: Option<DocPartUnique>,
}
#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:docPartGallery")]
pub struct DocPartGallery<'a> {
#[xml(attr = "w:val")]
pub name: Option<Cow<'a, str>>,
}
#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:docPartUnique")]
pub struct DocPartUnique {}
#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:sdtEndPr")]
pub struct SDTEndProperty {}
#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:sdtContent")]
pub struct SDTContent<'a> {
#[xml(
child = "w:p",
child = "w:tc",
child = "w:tbl",
child = "w:sectPr",
child = "w:sdt"
)]
pub content: Vec<BodyContent<'a>>,
}
__xml_test_suites!(SDT, SDT::default(), "<w:sdt/>",);