npoi

Форк
0
/
RangePermission.cs 
251 строка · 6.5 Кб
1
using System;
2
using System.IO;
3
using System.Xml;
4
using System.Xml.Serialization;
5
using NPOI.OpenXml4Net.Util;
6

7

8
namespace NPOI.OpenXmlFormats.Wordprocessing
9
{
10
    #region Range Permission
11

12
    [Serializable]
13
    [XmlType(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main")]
14
    public enum ST_ProofErr
15
    {
16

17
    
18
        spellStart,
19

20
    
21
        spellEnd,
22

23
    
24
        gramStart,
25

26
    
27
        gramEnd,
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)]
36
    public class CT_Perm
37
    {
38

39
        private string idField;
40

41
        private ST_DisplacedByCustomXml displacedByCustomXmlField;
42

43
        private bool displacedByCustomXmlFieldSpecified;
44
        public static CT_Perm Parse(XmlNode node, XmlNamespaceManager namespaceManager)
45
        {
46
            if (node == null)
47
                return null;
48
            CT_Perm ctObj = new CT_Perm();
49
            ctObj.id = XmlHelper.ReadString(node.Attributes["r:id"]);
50
            if (node.Attributes["w:displacedByCustomXml"] != null)
51
                ctObj.displacedByCustomXml = (ST_DisplacedByCustomXml)Enum.Parse(typeof(ST_DisplacedByCustomXml), node.Attributes["w:displacedByCustomXml"].Value);
52
            return ctObj;
53
        }
54

55

56

57
        internal void Write(StreamWriter sw, string nodeName)
58
        {
59
            sw.Write("<w:");
60
            sw.Write(nodeName);
61
            XmlHelper.WriteAttribute(sw, "r:id", this.id);
62
            XmlHelper.WriteAttribute(sw, "w:displacedByCustomXml", this.displacedByCustomXml.ToString());
63
            sw.Write(">");
64
            sw.WriteEndW(nodeName);
65
        }
66

67
        [XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified, Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/relationships")]
68
        public string id
69
        {
70
            get
71
            {
72
                return this.idField;
73
            }
74
            set
75
            {
76
                this.idField = value;
77
            }
78
        }
79

80
        [XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified)]
81
        public ST_DisplacedByCustomXml displacedByCustomXml
82
        {
83
            get
84
            {
85
                return this.displacedByCustomXmlField;
86
            }
87
            set
88
            {
89
                this.displacedByCustomXmlField = value;
90
            }
91
        }
92

93
        [XmlIgnore]
94
        public bool displacedByCustomXmlSpecified
95
        {
96
            get
97
            {
98
                return this.displacedByCustomXmlFieldSpecified;
99
            }
100
            set
101
            {
102
                this.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)]
112
    public class CT_PermStart : CT_Perm
113
    {
114

115
        private ST_EdGrp edGrpField;
116

117
        private bool edGrpFieldSpecified;
118

119
        private string edField;
120

121
        private string colFirstField;
122

123
        private string colLastField;
124

125
        [XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified)]
126
        public ST_EdGrp edGrp
127
        {
128
            get
129
            {
130
                return this.edGrpField;
131
            }
132
            set
133
            {
134
                this.edGrpField = value;
135
            }
136
        }
137

138
        [XmlIgnore]
139
        public bool edGrpSpecified
140
        {
141
            get
142
            {
143
                return this.edGrpFieldSpecified;
144
            }
145
            set
146
            {
147
                this.edGrpFieldSpecified = value;
148
            }
149
        }
150

151
        [XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified)]
152
        public string ed
153
        {
154
            get
155
            {
156
                return this.edField;
157
            }
158
            set
159
            {
160
                this.edField = value;
161
            }
162
        }
163

164
        [XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified, DataType = "integer")]
165
        public string colFirst
166
        {
167
            get
168
            {
169
                return this.colFirstField;
170
            }
171
            set
172
            {
173
                this.colFirstField = value;
174
            }
175
        }
176

177
        [XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified, DataType = "integer")]
178
        public string colLast
179
        {
180
            get
181
            {
182
                return this.colLastField;
183
            }
184
            set
185
            {
186
                this.colLastField = value;
187
            }
188
        }
189
        public static new CT_PermStart Parse(XmlNode node, XmlNamespaceManager namespaceManager)
190
        {
191
            if (node == null)
192
                return null;
193
            CT_PermStart ctObj = new CT_PermStart();
194
            if (node.Attributes["w:edGrp"] != null)
195
                ctObj.edGrp = (ST_EdGrp)Enum.Parse(typeof(ST_EdGrp), node.Attributes["w:edGrp"].Value);
196
            ctObj.ed = XmlHelper.ReadString(node.Attributes["w:ed"]);
197
            ctObj.colFirst = XmlHelper.ReadString(node.Attributes["w:colFirst"]);
198
            ctObj.colLast = XmlHelper.ReadString(node.Attributes["w:colLast"]);
199
            ctObj.id = XmlHelper.ReadString(node.Attributes["w:id"]);
200
            if (node.Attributes["w:displacedByCustomXml"] != null)
201
                ctObj.displacedByCustomXml = (ST_DisplacedByCustomXml)Enum.Parse(typeof(ST_DisplacedByCustomXml), node.Attributes["w:displacedByCustomXml"].Value);
202
            return ctObj;
203
        }
204

205

206

207
        internal new void Write(StreamWriter sw, string nodeName)
208
        {
209
            sw.Write(string.Format("<w:{0}", nodeName));
210
            XmlHelper.WriteAttribute(sw, "w:edGrp", this.edGrp.ToString());
211
            XmlHelper.WriteAttribute(sw, "w:ed", this.ed);
212
            XmlHelper.WriteAttribute(sw, "w:colFirst", this.colFirst);
213
            XmlHelper.WriteAttribute(sw, "w:colLast", this.colLast);
214
            XmlHelper.WriteAttribute(sw, "w:id", this.id);
215
            XmlHelper.WriteAttribute(sw, "w:displacedByCustomXml", this.displacedByCustomXml.ToString());
216
            sw.Write(">");
217
            sw.WriteEndW(nodeName);
218
        }
219

220
    }
221

222

223
    [Serializable]
224
    [XmlType(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main")]
225
    public enum ST_EdGrp
226
    {
227

228
    
229
        none,
230

231
    
232
        everyone,
233

234
    
235
        administrators,
236

237
    
238
        contributors,
239

240
    
241
        editors,
242

243
    
244
        owners,
245

246
    
247
        current,
248
    }
249
    #endregion
250

251
}
252

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.