npoi
251 строка · 6.5 Кб
1using System;
2using System.IO;
3using System.Xml;
4using System.Xml.Serialization;
5using NPOI.OpenXml4Net.Util;
6
7
8namespace NPOI.OpenXmlFormats.Wordprocessing
9{
10#region Range Permission
11
12[Serializable]
13[XmlType(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main")]
14public enum ST_ProofErr
15{
16
17
18spellStart,
19
20
21spellEnd,
22
23
24gramStart,
25
26
27gramEnd,
28}
29
30[XmlInclude(typeof(CT_PermStart))]
31
32[Serializable]
33
34[XmlType(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main")]
35[XmlRoot(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", IsNullable = true)]
36public class CT_Perm
37{
38
39private string idField;
40
41private ST_DisplacedByCustomXml displacedByCustomXmlField;
42
43private bool displacedByCustomXmlFieldSpecified;
44public static CT_Perm Parse(XmlNode node, XmlNamespaceManager namespaceManager)
45{
46if (node == null)
47return null;
48CT_Perm ctObj = new CT_Perm();
49ctObj.id = XmlHelper.ReadString(node.Attributes["r:id"]);
50if (node.Attributes["w:displacedByCustomXml"] != null)
51ctObj.displacedByCustomXml = (ST_DisplacedByCustomXml)Enum.Parse(typeof(ST_DisplacedByCustomXml), node.Attributes["w:displacedByCustomXml"].Value);
52return ctObj;
53}
54
55
56
57internal void Write(StreamWriter sw, string nodeName)
58{
59sw.Write("<w:");
60sw.Write(nodeName);
61XmlHelper.WriteAttribute(sw, "r:id", this.id);
62XmlHelper.WriteAttribute(sw, "w:displacedByCustomXml", this.displacedByCustomXml.ToString());
63sw.Write(">");
64sw.WriteEndW(nodeName);
65}
66
67[XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified, Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/relationships")]
68public string id
69{
70get
71{
72return this.idField;
73}
74set
75{
76this.idField = value;
77}
78}
79
80[XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified)]
81public ST_DisplacedByCustomXml displacedByCustomXml
82{
83get
84{
85return this.displacedByCustomXmlField;
86}
87set
88{
89this.displacedByCustomXmlField = value;
90}
91}
92
93[XmlIgnore]
94public bool displacedByCustomXmlSpecified
95{
96get
97{
98return this.displacedByCustomXmlFieldSpecified;
99}
100set
101{
102this.displacedByCustomXmlFieldSpecified = value;
103}
104}
105}
106
107
108[Serializable]
109
110[XmlType(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main")]
111[XmlRoot(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", IsNullable = true)]
112public class CT_PermStart : CT_Perm
113{
114
115private ST_EdGrp edGrpField;
116
117private bool edGrpFieldSpecified;
118
119private string edField;
120
121private string colFirstField;
122
123private string colLastField;
124
125[XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified)]
126public ST_EdGrp edGrp
127{
128get
129{
130return this.edGrpField;
131}
132set
133{
134this.edGrpField = value;
135}
136}
137
138[XmlIgnore]
139public bool edGrpSpecified
140{
141get
142{
143return this.edGrpFieldSpecified;
144}
145set
146{
147this.edGrpFieldSpecified = value;
148}
149}
150
151[XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified)]
152public string ed
153{
154get
155{
156return this.edField;
157}
158set
159{
160this.edField = value;
161}
162}
163
164[XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified, DataType = "integer")]
165public string colFirst
166{
167get
168{
169return this.colFirstField;
170}
171set
172{
173this.colFirstField = value;
174}
175}
176
177[XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified, DataType = "integer")]
178public string colLast
179{
180get
181{
182return this.colLastField;
183}
184set
185{
186this.colLastField = value;
187}
188}
189public static new CT_PermStart Parse(XmlNode node, XmlNamespaceManager namespaceManager)
190{
191if (node == null)
192return null;
193CT_PermStart ctObj = new CT_PermStart();
194if (node.Attributes["w:edGrp"] != null)
195ctObj.edGrp = (ST_EdGrp)Enum.Parse(typeof(ST_EdGrp), node.Attributes["w:edGrp"].Value);
196ctObj.ed = XmlHelper.ReadString(node.Attributes["w:ed"]);
197ctObj.colFirst = XmlHelper.ReadString(node.Attributes["w:colFirst"]);
198ctObj.colLast = XmlHelper.ReadString(node.Attributes["w:colLast"]);
199ctObj.id = XmlHelper.ReadString(node.Attributes["w:id"]);
200if (node.Attributes["w:displacedByCustomXml"] != null)
201ctObj.displacedByCustomXml = (ST_DisplacedByCustomXml)Enum.Parse(typeof(ST_DisplacedByCustomXml), node.Attributes["w:displacedByCustomXml"].Value);
202return ctObj;
203}
204
205
206
207internal new void Write(StreamWriter sw, string nodeName)
208{
209sw.Write(string.Format("<w:{0}", nodeName));
210XmlHelper.WriteAttribute(sw, "w:edGrp", this.edGrp.ToString());
211XmlHelper.WriteAttribute(sw, "w:ed", this.ed);
212XmlHelper.WriteAttribute(sw, "w:colFirst", this.colFirst);
213XmlHelper.WriteAttribute(sw, "w:colLast", this.colLast);
214XmlHelper.WriteAttribute(sw, "w:id", this.id);
215XmlHelper.WriteAttribute(sw, "w:displacedByCustomXml", this.displacedByCustomXml.ToString());
216sw.Write(">");
217sw.WriteEndW(nodeName);
218}
219
220}
221
222
223[Serializable]
224[XmlType(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main")]
225public enum ST_EdGrp
226{
227
228
229none,
230
231
232everyone,
233
234
235administrators,
236
237
238contributors,
239
240
241editors,
242
243
244owners,
245
246
247current,
248}
249#endregion
250
251}
252