npoi

Форк
0
1094 строки · 32.1 Кб
1
using NPOI.OpenXml4Net.Util;
2
using System;
3
using System.Collections.Generic;
4
using System.IO;
5
using System.Xml;
6
using System.Xml.Serialization;
7

8
namespace NPOI.OpenXmlFormats.Wordprocessing
9
{
10

11
    [Serializable]
12
    [XmlType(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main")]
13
    [XmlRoot(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", IsNullable = true)]
14
    public class CT_FFTextType
15
    {
16

17
        private ST_FFTextType valField;
18

19
        [XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified)]
20
        public ST_FFTextType val
21
        {
22
            get
23
            {
24
                return this.valField;
25
            }
26
            set
27
            {
28
                this.valField = value;
29
            }
30
        }
31

32
        public static CT_FFTextType Parse(XmlNode node, XmlNamespaceManager namespaceManager)
33
        {
34
            if (node == null)
35
                return null;
36
            CT_FFTextType ctObj = new CT_FFTextType();
37
            ctObj.valField = (ST_FFTextType)Enum.Parse(typeof(ST_FFTextType), XmlHelper.ReadString(node.Attributes["w:val"]));
38
            return ctObj;
39
        }
40

41
        internal void Write(StreamWriter sw, string nodeName)
42
        {
43
            sw.Write(string.Format("<w:{0}", nodeName));
44
            XmlHelper.WriteAttribute(sw, "w:val", this.valField.ToString());
45
            sw.Write("/>");
46
        }
47
    }
48

49

50
    [Serializable]
51
    [XmlType(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main")]
52
    public enum ST_FFTextType
53
    {
54

55
    
56
        regular,
57

58
    
59
        number,
60

61
    
62
        date,
63

64
    
65
        currentTime,
66

67
    
68
        currentDate,
69

70
    
71
        calculated,
72
    }
73

74

75
    [Serializable]
76

77
    [XmlType(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main")]
78
    [XmlRoot(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", IsNullable = true)]
79
    public class CT_FFName
80
    {
81

82
        private string valField;
83

84
        [XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified)]
85
        public string val
86
        {
87
            get
88
            {
89
                return this.valField;
90
            }
91
            set
92
            {
93
                this.valField = value;
94
            }
95
        }
96

97
        public static CT_FFName Parse(XmlNode node, XmlNamespaceManager namespaceManager)
98
        {
99
            if (node == null)
100
                return null;
101
            CT_FFName ctObj = new CT_FFName();
102
            ctObj.val = XmlHelper.ReadString(node.Attributes["w:val"]);
103
            return ctObj;
104
        }
105

106

107

108
        internal void Write(StreamWriter sw, string nodeName)
109
        {
110
            sw.Write(string.Format("<w:{0}", nodeName));
111
            XmlHelper.WriteAttribute(sw, "w:val", this.val, true);
112
            sw.Write("/>");
113
        }
114
    }
115

116

117
    [Serializable]
118

119
    [XmlType(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main")]
120
    [XmlRoot(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", IsNullable = true)]
121
    public class CT_FldChar
122
    {
123
        private ST_FldCharType fldCharTypeField;
124

125
        private ST_OnOff fldLockField;
126

127
        private bool fldLockFieldSpecified;
128

129
        private ST_OnOff dirtyField;
130

131
        private bool dirtyFieldSpecified;
132

133
        private CT_FFData ffDataField;
134
        public CT_FFData ffData
135
        {
136
            get { return this.ffDataField; }
137
            set { this.ffDataField = value; }
138
        }
139
        private CT_Text fldDataField;
140
        public CT_Text fldData
141
        {
142
            get { return this.fldDataField; }
143
            set { this.fldDataField = value; }
144
        }
145
        private CT_TrackChangeNumbering numberingChangeField;
146
        public CT_TrackChangeNumbering numberingChange
147
        {
148
            get { return this.numberingChangeField; }
149
            set { this.numberingChangeField = value; }
150
        }
151
        public static CT_FldChar Parse(XmlNode node, XmlNamespaceManager namespaceManager)
152
        {
153
            if (node == null)
154
                return null;
155
            CT_FldChar ctObj = new CT_FldChar();
156
            if (node.Attributes["w:fldCharType"] != null)
157
                ctObj.fldCharType = (ST_FldCharType)Enum.Parse(typeof(ST_FldCharType), node.Attributes["w:fldCharType"].Value);
158
            if (node.Attributes["w:fldLock"] != null)
159
                ctObj.fldLock = (ST_OnOff)Enum.Parse(typeof(ST_OnOff), node.Attributes["w:fldLock"].Value,true);
160
            if (node.Attributes["w:dirty"] != null)
161
                ctObj.dirty = (ST_OnOff)Enum.Parse(typeof(ST_OnOff), node.Attributes["w:dirty"].Value,true);
162
            foreach (XmlNode childNode in node.ChildNodes)
163
            {
164
                if (childNode.LocalName == "ffData")
165
                {
166
                    ctObj.ffDataField = CT_FFData.Parse(childNode, namespaceManager);
167
                }
168
                else if (childNode.LocalName == "fldData")
169
                {
170
                    ctObj.fldDataField = CT_Text.Parse(childNode, namespaceManager);
171
                }
172
                else if (childNode.LocalName == "numberingChange")
173
                {
174
                    ctObj.numberingChangeField = CT_TrackChangeNumbering.Parse(childNode, namespaceManager);
175
                }
176
            }
177
            return ctObj;
178
        }
179

180

181

182
        internal void Write(StreamWriter sw, string nodeName)
183
        {
184
            sw.Write(string.Format("<w:{0}", nodeName));
185
            XmlHelper.WriteAttribute(sw, "w:fldCharType", this.fldCharType.ToString());
186
            if(this.fldLock!= ST_OnOff.off)
187
                XmlHelper.WriteAttribute(sw, "w:fldLock", this.fldLock.ToString());
188
            if (this.dirty != ST_OnOff.off)
189
                XmlHelper.WriteAttribute(sw, "w:dirty", this.dirty.ToString());
190
            if (this.ffDataField == null && this.fldDataField == null && this.numberingChangeField == null)
191
            {
192
                sw.Write(string.Format("/>", nodeName));
193
            }
194
            else
195
            {
196
                sw.Write(">");
197
                if (this.ffDataField != null)
198
                {
199
                    this.ffDataField.Write(sw, "ffData");
200
                }
201
                if (this.fldDataField != null)
202
                {
203
                    this.fldDataField.Write(sw, "fldData");
204
                }
205
                if (this.numberingChangeField != null)
206
                {
207
                    this.numberingChangeField.Write(sw, "numberingChange");
208
                }
209
                sw.WriteEndW(nodeName);
210
            }
211
        }
212

213
        [XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified)]
214
        public ST_FldCharType fldCharType
215
        {
216
            get
217
            {
218
                return this.fldCharTypeField;
219
            }
220
            set
221
            {
222
                this.fldCharTypeField = value;
223
            }
224
        }
225

226
        [XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified)]
227
        public ST_OnOff fldLock
228
        {
229
            get
230
            {
231
                return this.fldLockField;
232
            }
233
            set
234
            {
235
                this.fldLockField = value;
236
            }
237
        }
238

239
        [XmlIgnore]
240
        public bool fldLockSpecified
241
        {
242
            get
243
            {
244
                return this.fldLockFieldSpecified;
245
            }
246
            set
247
            {
248
                this.fldLockFieldSpecified = value;
249
            }
250
        }
251

252
        [XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified)]
253
        public ST_OnOff dirty
254
        {
255
            get
256
            {
257
                return this.dirtyField;
258
            }
259
            set
260
            {
261
                this.dirtyField = value;
262
            }
263
        }
264

265
        [XmlIgnore]
266
        public bool dirtySpecified
267
        {
268
            get
269
            {
270
                return this.dirtyFieldSpecified;
271
            }
272
            set
273
            {
274
                this.dirtyFieldSpecified = value;
275
            }
276
        }
277
    }
278

279

280
    [Serializable]
281

282
    [XmlType(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main")]
283
    [XmlRoot(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", IsNullable = true)]
284
    public class CT_FFData
285
    {
286

287
        private List<object> itemsField;
288

289
        private List<FFDataItemsType> itemsElementNameField;
290

291
        public CT_FFData()
292
        {
293
            this.itemsElementNameField = new List<FFDataItemsType>();
294
            this.itemsField = new List<object>();
295
        }
296

297
        [XmlElement("calcOnExit", typeof(CT_OnOff), Order = 0)]
298
        [XmlElement("checkBox", typeof(CT_FFCheckBox), Order = 0)]
299
        [XmlElement("ddList", typeof(CT_FFDDList), Order = 0)]
300
        [XmlElement("enabled", typeof(CT_OnOff), Order = 0)]
301
        [XmlElement("entryMacro", typeof(CT_MacroName), Order = 0)]
302
        [XmlElement("exitMacro", typeof(CT_MacroName), Order = 0)]
303
        [XmlElement("helpText", typeof(CT_FFHelpText), Order = 0)]
304
        [XmlElement("name", typeof(CT_FFName), Order = 0)]
305
        [XmlElement("statusText", typeof(CT_FFStatusText), Order = 0)]
306
        [XmlElement("textInput", typeof(CT_FFTextInput), Order = 0)]
307
        [XmlChoiceIdentifier("ItemsElementName")]
308
        public object[] Items
309
        {
310
            get
311
            {
312
                return this.itemsField.ToArray();
313
            }
314
            set
315
            {
316
                this.itemsField.Clear();
317
                this.itemsField.AddRange(value);
318
            }
319
        }
320

321
        [XmlElement("ItemsElementName", Order = 1)]
322
        [XmlIgnore]
323
        public FFDataItemsType[] ItemsElementName
324
        {
325
            get
326
            {
327
                return this.itemsElementNameField.ToArray();
328
            }
329
            set
330
            {
331
                this.itemsElementNameField.Clear();
332
                this.itemsElementNameField.AddRange(value);
333
            }
334
        }
335

336
        internal static CT_FFData Parse(XmlNode node, XmlNamespaceManager namespaceManager)
337
        {
338
            if (node == null)
339
                return null;
340
            CT_FFData ctObj = new CT_FFData();
341

342
            foreach (XmlNode childNode in node.ChildNodes)
343
            {
344
                if (childNode.LocalName == "name")
345
                {
346
                    ctObj.AddNewObject(CT_FFName.Parse(childNode, namespaceManager) ,FFDataItemsType.name);
347
                }
348
                //else if (childNode.LocalName == "tabIndex")
349
                //{
350

351
                //}
352
                else if (childNode.LocalName == "enabled")
353
                {
354
                    ctObj.AddNewObject(CT_OnOff.Parse(childNode, namespaceManager), FFDataItemsType.enabled);
355
                }
356
                else if (childNode.LocalName == "calcOnExit")
357
                {
358
                    ctObj.AddNewObject(CT_OnOff.Parse(childNode, namespaceManager), FFDataItemsType.calcOnExit);
359
                }
360
                else if (childNode.LocalName == "checkBox")
361
                {
362
                    ctObj.AddNewObject(CT_FFCheckBox.Parse(childNode, namespaceManager), FFDataItemsType.checkBox);
363
                }
364
                else if (childNode.LocalName == "ddList")
365
                {
366
                    ctObj.AddNewObject(CT_FFDDList.Parse(childNode, namespaceManager), FFDataItemsType.ddList);
367
                }
368
                else if (childNode.LocalName == "entryMacro")
369
                {
370
                    ctObj.AddNewObject(CT_MacroName.Parse(childNode, namespaceManager), FFDataItemsType.entryMacro);
371
                }
372
                else if (childNode.LocalName == "exitMacro")
373
                {
374
                    ctObj.AddNewObject(CT_MacroName.Parse(childNode, namespaceManager), FFDataItemsType.exitMacro);
375
                }
376
                else if (childNode.LocalName == "helpText")
377
                {
378
                    ctObj.AddNewObject(CT_FFHelpText.Parse(childNode, namespaceManager), FFDataItemsType.helpText);
379
                }
380
                else if (childNode.LocalName == "statusText")
381
                {
382
                    ctObj.AddNewObject(CT_FFStatusText.Parse(childNode, namespaceManager), FFDataItemsType.statusText);
383
                }
384
                else if (childNode.LocalName == "textInput")
385
                {
386
                    ctObj.AddNewObject(CT_FFTextInput.Parse(childNode, namespaceManager), FFDataItemsType.textInput);
387
                }
388
            }
389
            return ctObj;
390
        }
391
        internal void Write(StreamWriter sw, string nodeName)
392
        {
393
            sw.Write(string.Format("<w:{0}>", nodeName));
394

395
            for (int i=0;i<this.itemsElementNameField.Count;i++)
396
            {
397
                if (this.itemsElementNameField[i] == FFDataItemsType.name)
398
                    (this.itemsField[i] as CT_FFName).Write(sw, "name");
399
                else if (this.itemsElementNameField[i] == FFDataItemsType.enabled)
400
                    (this.itemsField[i] as CT_OnOff).Write(sw, "enabled");
401
                else if (this.itemsElementNameField[i] == FFDataItemsType.calcOnExit)
402
                    (this.itemsField[i] as CT_OnOff).Write(sw, "calcOnExit");
403
                else if (this.itemsElementNameField[i] == FFDataItemsType.ddList)
404
                    (this.itemsField[i] as CT_FFDDList).Write(sw, "ddList");
405
                else if (this.itemsElementNameField[i] == FFDataItemsType.checkBox)
406
                    (this.itemsField[i] as CT_FFCheckBox).Write(sw, "checkBox");
407
                else if (this.itemsElementNameField[i] == FFDataItemsType.entryMacro)
408
                    (this.itemsField[i] as CT_MacroName).Write(sw, "entryMacro");
409
                else if (this.itemsElementNameField[i] == FFDataItemsType.exitMacro)
410
                    (this.itemsField[i] as CT_MacroName).Write(sw, "exitMacro");
411
                else if (this.itemsElementNameField[i] == FFDataItemsType.helpText)
412
                    (this.itemsField[i] as CT_FFHelpText).Write(sw, "helpText");
413
                else if (this.itemsElementNameField[i] == FFDataItemsType.statusText)
414
                    (this.itemsField[i] as CT_FFStatusText).Write(sw, "statusText");
415
                else if (this.itemsElementNameField[i] == FFDataItemsType.textInput)
416
                    (this.itemsField[i] as CT_FFTextInput).Write(sw, "textInput");
417
            }
418

419
            sw.WriteEndW(nodeName);
420
        }
421
        private void AddNewObject(object obj, FFDataItemsType type)
422
        {
423
            lock(this)
424
            {
425
                this.itemsElementNameField.Add(type);
426
                this.itemsField.Add(obj);
427
            }
428
        }
429

430
        #region Generic methods for object operation
431

432
        private List<T> GetObjectList<T>(FFDataItemsType type) where T : class
433
        {
434
            lock (this)
435
            {
436
                List<T> list = new List<T>();
437
                for (int i = 0; i < itemsElementNameField.Count; i++)
438
                {
439
                    if (itemsElementNameField[i] == type)
440
                        list.Add(itemsField[i] as T);
441
                }
442
                return list;
443
            }
444
        }
445
        private int SizeOfObjectArray(FFDataItemsType type)
446
        {
447
            lock (this)
448
            {
449
                int size = 0;
450
                for (int i = 0; i < itemsElementNameField.Count; i++)
451
                {
452
                    if (itemsElementNameField[i] == type)
453
                        size++;
454
                }
455
                return size;
456
            }
457
        }
458
        private T GetObjectArray<T>(int p, FFDataItemsType type) where T : class
459
        {
460
            lock (this)
461
            {
462
                int pos = GetObjectIndex(type, p);
463
                if (pos < 0 || pos >= this.itemsField.Count)
464
                    return null;
465
                return itemsField[pos] as T;
466
            }
467
        }
468
        private T InsertNewObject<T>(FFDataItemsType type, int p) where T : class, new()
469
        {
470
            T t = new T();
471
            lock (this)
472
            {
473
                int pos = GetObjectIndex(type, p);
474
                this.itemsElementNameField.Insert(pos, type);
475
                this.itemsField.Insert(pos, t);
476
            }
477
            return t;
478
        }
479
        private T AddNewObject<T>(FFDataItemsType type) where T : class, new()
480
        {
481
            T t = new T();
482
            lock (this)
483
            {
484
                this.itemsElementNameField.Add(type);
485
                this.itemsField.Add(t);
486
            }
487
            return t;
488
        }
489
        private void SetObjectArray<T>(FFDataItemsType type, int p, T obj) where T : class
490
        {
491
            lock (this)
492
            {
493
                int pos = GetObjectIndex(type, p);
494
                if (pos < 0 || pos >= this.itemsField.Count)
495
                    return;
496
                if (this.itemsField[pos] is T)
497
                    this.itemsField[pos] = obj;
498
                else
499
                    throw new Exception(string.Format(@"object types are difference, itemsField[{0}] is {1}, and parameter obj is {2}",
500
                        pos, this.itemsField[pos].GetType().Name, typeof(T).Name));
501
            }
502
        }
503
        private int GetObjectIndex(FFDataItemsType type, int p)
504
        {
505
            int index = -1;
506
            int pos = 0;
507
            for (int i = 0; i < itemsElementNameField.Count; i++)
508
            {
509
                if (itemsElementNameField[i] == type)
510
                {
511
                    if (pos == p)
512
                    {
513
                        //return itemsField[p] as T;
514
                        index = i;
515
                        break;
516
                    }
517
                    else
518
                        pos++;
519
                }
520
            }
521
            return index;
522
        }
523
        private void RemoveObject(FFDataItemsType type, int p)
524
        {
525
            lock (this)
526
            {
527
                int pos = GetObjectIndex(type, p);
528
                if (pos < 0 || pos >= this.itemsField.Count)
529
                    return;
530
                itemsElementNameField.RemoveAt(pos);
531
                itemsField.RemoveAt(pos);
532
            }
533
        }
534
        #endregion
535

536
        public List<CT_FFCheckBox> GetCheckBoxList()
537
        {
538
            return GetObjectList<CT_FFCheckBox>(FFDataItemsType.checkBox);
539
        }
540
    }
541

542

543
    [Serializable]
544

545
    [XmlType(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main")]
546
    [XmlRoot(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", IsNullable = true)]
547
    public class CT_FFCheckBox
548
    {
549

550
        private object itemField;
551

552
        private CT_OnOff defaultField;
553

554
        private CT_OnOff checkedField;
555

556
        public CT_FFCheckBox()
557
        {
558
            this.checkedField = new CT_OnOff();
559
            this.defaultField = new CT_OnOff();
560
        }
561

562
        [XmlElement("size", typeof(CT_HpsMeasure), Order = 0)]
563
        [XmlElement("sizeAuto", typeof(CT_OnOff), Order = 0)]
564
        public object Item
565
        {
566
            get
567
            {
568
                return this.itemField;
569
            }
570
            set
571
            {
572
                this.itemField = value;
573
            }
574
        }
575

576
        [XmlElement(Order = 1)]
577
        public CT_OnOff @default
578
        {
579
            get
580
            {
581
                return this.defaultField;
582
            }
583
            set
584
            {
585
                this.defaultField = value;
586
            }
587
        }
588

589
        [XmlElement(Order = 2)]
590
        public CT_OnOff @checked
591
        {
592
            get
593
            {
594
                return this.checkedField;
595
            }
596
            set
597
            {
598
                this.checkedField = value;
599
            }
600
        }
601

602
        public static CT_FFCheckBox Parse(XmlNode node, XmlNamespaceManager namespaceManager)
603
        {
604
            if (node == null)
605
                return null;
606
            CT_FFCheckBox ctObj = new CT_FFCheckBox();
607
            foreach (XmlNode childNode in node.ChildNodes)
608
            {
609
                if (childNode.LocalName == "checked")
610
                {
611
                    ctObj.checkedField = CT_OnOff.Parse(childNode, namespaceManager);
612
                }
613
                else if (childNode.LocalName == "default")
614
                {
615
                    ctObj.defaultField = CT_OnOff.Parse(childNode, namespaceManager);
616
                }
617
                else if (childNode.LocalName == "size")
618
                {
619
                    ctObj.itemField = CT_HpsMeasure.Parse(childNode, namespaceManager);
620
                }
621
                else if (childNode.LocalName == "sizeAuto")
622
                {
623
                    ctObj.itemField = CT_OnOff.Parse(childNode, namespaceManager);
624
                }
625
            }
626
            return ctObj;
627
        }
628

629

630

631
        internal void Write(StreamWriter sw, string nodeName)
632
        {
633
            sw.Write(string.Format("<w:{0}>", nodeName));
634
            if (this.defaultField != null)
635
                this.defaultField.Write(sw, "default");
636
            if (this.checkedField != null)
637
                this.checkedField.Write(sw, "checked");
638
            if (this.itemField != null)
639
            {
640
                if (this.itemField is CT_OnOff)
641
                    (this.itemField as CT_OnOff).Write(sw, "sizeAuto");
642
                else
643
                    (this.itemField as CT_HpsMeasure).Write(sw, "size");
644
            }
645
            sw.WriteEndW(nodeName);
646
        }
647
    }
648

649

650
    [Serializable]
651

652
    [XmlType(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main")]
653
    [XmlRoot(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", IsNullable = true)]
654
    public class CT_FFDDList
655
    {
656

657
        private CT_DecimalNumber resultField;
658

659
        private CT_DecimalNumber defaultField;
660

661
        private List<CT_String> listEntryField;
662

663
        public CT_FFDDList()
664
        {
665
            this.listEntryField = new List<CT_String>();
666
            this.defaultField = new CT_DecimalNumber();
667
            this.resultField = new CT_DecimalNumber();
668
        }
669

670
        [XmlElement(Order = 0)]
671
        public CT_DecimalNumber result
672
        {
673
            get
674
            {
675
                return this.resultField;
676
            }
677
            set
678
            {
679
                this.resultField = value;
680
            }
681
        }
682

683
        [XmlElement(Order = 1)]
684
        public CT_DecimalNumber @default
685
        {
686
            get
687
            {
688
                return this.defaultField;
689
            }
690
            set
691
            {
692
                this.defaultField = value;
693
            }
694
        }
695

696
        [XmlElement("listEntry", Order = 2)]
697
        public List<CT_String> listEntry
698
        {
699
            get
700
            {
701
                return this.listEntryField;
702
            }
703
            set
704
            {
705
                this.listEntryField = value;
706
            }
707
        }
708

709
        public static CT_FFDDList Parse(XmlNode node, XmlNamespaceManager namespaceManager)
710
        {
711
            if (node == null)
712
                return null;
713
            CT_FFDDList ctObj = new CT_FFDDList();
714
            foreach (XmlNode childNode in node.ChildNodes)
715
            {
716
                if (childNode.LocalName == "result")
717
                {
718
                    ctObj.resultField = CT_DecimalNumber.Parse(childNode, namespaceManager);
719
                }
720
                else if (childNode.LocalName == "default")
721
                {
722
                    ctObj.defaultField = CT_DecimalNumber.Parse(childNode, namespaceManager);
723
                }
724
                else if (childNode.LocalName == "listEntry")
725
                {
726
                    ctObj.listEntryField.Add(CT_String.Parse(childNode, namespaceManager));
727
                }
728
            }
729
            return ctObj;
730
        }
731

732

733

734
        internal void Write(StreamWriter sw, string nodeName)
735
        {
736
            sw.Write(string.Format("<w:{0}>", nodeName));
737
            if (this.defaultField != null)
738
                this.defaultField.Write(sw, "default");
739
            if (this.resultField != null)
740
                this.resultField.Write(sw, "result");
741
            foreach (CT_String str in listEntry)
742
            {
743
                str.Write(sw, "listEntry");
744
            }
745
            sw.WriteEndW(nodeName);
746
        }
747
    }
748

749

750
    [Serializable]
751

752
    [XmlType(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main")]
753
    [XmlRoot(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", IsNullable = true)]
754
    public class CT_FFHelpText
755
    {
756

757
        private ST_InfoTextType typeField;
758

759
        private bool typeFieldSpecified;
760

761
        private string valField;
762

763
        [XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified)]
764
        public ST_InfoTextType type
765
        {
766
            get
767
            {
768
                return this.typeField;
769
            }
770
            set
771
            {
772
                this.typeField = value;
773
            }
774
        }
775

776
        [XmlIgnore]
777
        public bool typeSpecified
778
        {
779
            get
780
            {
781
                return this.typeFieldSpecified;
782
            }
783
            set
784
            {
785
                this.typeFieldSpecified = value;
786
            }
787
        }
788

789
        [XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified)]
790
        public string val
791
        {
792
            get
793
            {
794
                return this.valField;
795
            }
796
            set
797
            {
798
                this.valField = value;
799
            }
800
        }
801

802
        public static CT_FFHelpText Parse(XmlNode node, XmlNamespaceManager namespaceManager)
803
        {
804
            if (node == null)
805
                return null;
806
            CT_FFHelpText ctObj = new CT_FFHelpText();
807
            if (node.Attributes["w:type"] != null)
808
            {
809
                ctObj.typeFieldSpecified = true;
810
                ctObj.typeField = (ST_InfoTextType)Enum.Parse(typeof(ST_InfoTextType), node.Attributes["w:type"].Value);
811
            }
812
            ctObj.valField = XmlHelper.ReadString(node.Attributes["w:val"]);
813
            return ctObj;
814
        }
815

816
        internal void Write(StreamWriter sw, string nodeName)
817
        {
818
            sw.Write(string.Format("<w:{0}", nodeName));
819
            XmlHelper.WriteAttribute(sw, "w:val", this.valField);
820
            if (this.typeFieldSpecified)
821
            {
822
                XmlHelper.WriteAttribute(sw, "w:type", this.typeField.ToString());
823
            }
824
            sw.Write("/>");
825
        }
826
    }
827

828

829
    [Serializable]
830
    [XmlType(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main")]
831
    public enum ST_InfoTextType
832
    {
833

834
    
835
        text,
836

837
    
838
        autoText,
839
    }
840

841

842
    [Serializable]
843

844
    [XmlType(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main")]
845
    [XmlRoot(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", IsNullable = true)]
846
    public class CT_FFStatusText
847
    {
848

849
        private ST_InfoTextType typeField;
850

851
        private bool typeFieldSpecified;
852

853
        private string valField;
854

855
        [XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified)]
856
        public ST_InfoTextType type
857
        {
858
            get
859
            {
860
                return this.typeField;
861
            }
862
            set
863
            {
864
                this.typeField = value;
865
            }
866
        }
867

868
        [XmlIgnore]
869
        public bool typeSpecified
870
        {
871
            get
872
            {
873
                return this.typeFieldSpecified;
874
            }
875
            set
876
            {
877
                this.typeFieldSpecified = value;
878
            }
879
        }
880

881
        [XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified)]
882
        public string val
883
        {
884
            get
885
            {
886
                return this.valField;
887
            }
888
            set
889
            {
890
                this.valField = value;
891
            }
892
        }
893

894
        public static CT_FFStatusText Parse(XmlNode node, XmlNamespaceManager namespaceManager)
895
        {
896
            if (node == null)
897
                return null;
898
            CT_FFStatusText ctObj = new CT_FFStatusText();
899
            if (node.Attributes["w:type"] != null)
900
            {
901
                ctObj.typeFieldSpecified = true;
902
                ctObj.typeField = (ST_InfoTextType)Enum.Parse(typeof(ST_InfoTextType), node.Attributes["w:type"].Value);
903
            }
904
            ctObj.valField = XmlHelper.ReadString(node.Attributes["w:val"]);
905
            return ctObj;
906
        }
907

908
        internal void Write(StreamWriter sw, string nodeName)
909
        {
910
            sw.Write(string.Format("<w:{0}", nodeName));
911
            XmlHelper.WriteAttribute(sw, "w:val", this.valField);
912
            if (this.typeFieldSpecified)
913
            {
914
                XmlHelper.WriteAttribute(sw, "w:type", this.typeField.ToString());
915
            }
916
            sw.Write("/>");
917
        }
918
    }
919

920

921
    [Serializable]
922

923
    [XmlType(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main")]
924
    [XmlRoot(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", IsNullable = true)]
925
    public class CT_FFTextInput
926
    {
927

928
        private CT_FFTextType typeField;
929

930
        private CT_String defaultField;
931

932
        private CT_DecimalNumber maxLengthField;
933

934
        private CT_String formatField;
935

936
        public CT_FFTextInput()
937
        {
938
            this.formatField = new CT_String();
939
            this.maxLengthField = new CT_DecimalNumber();
940
            this.defaultField = new CT_String();
941
            this.typeField = new CT_FFTextType();
942
        }
943

944
        [XmlElement(Order = 0)]
945
        public CT_FFTextType type
946
        {
947
            get
948
            {
949
                return this.typeField;
950
            }
951
            set
952
            {
953
                this.typeField = value;
954
            }
955
        }
956

957
        [XmlElement(Order = 1)]
958
        public CT_String @default
959
        {
960
            get
961
            {
962
                return this.defaultField;
963
            }
964
            set
965
            {
966
                this.defaultField = value;
967
            }
968
        }
969

970
        [XmlElement(Order = 2)]
971
        public CT_DecimalNumber maxLength
972
        {
973
            get
974
            {
975
                return this.maxLengthField;
976
            }
977
            set
978
            {
979
                this.maxLengthField = value;
980
            }
981
        }
982

983
        [XmlElement(Order = 3)]
984
        public CT_String format
985
        {
986
            get
987
            {
988
                return this.formatField;
989
            }
990
            set
991
            {
992
                this.formatField = value;
993
            }
994
        }
995

996
        public static CT_FFTextInput Parse(XmlNode node, XmlNamespaceManager namespaceManager)
997
        {
998
            if (node == null)
999
                return null;
1000
            CT_FFTextInput ctObj = new CT_FFTextInput();
1001
            foreach (XmlNode childNode in node.ChildNodes)
1002
            {
1003
                if (childNode.LocalName == "type")
1004
                {
1005
                    ctObj.typeField = CT_FFTextType.Parse(childNode, namespaceManager);
1006
                }
1007
                else if (childNode.LocalName == "default")
1008
                {
1009
                    ctObj.defaultField = CT_String.Parse(childNode, namespaceManager);
1010
                }
1011
                else if (childNode.LocalName == "format")
1012
                {
1013
                    ctObj.formatField = CT_String.Parse(childNode, namespaceManager);
1014
                }
1015
                else if (childNode.LocalName == "maxLength")
1016
                {
1017
                    ctObj.maxLengthField = CT_DecimalNumber.Parse(childNode, namespaceManager);
1018
                }
1019
            }
1020
            return ctObj;
1021
        }
1022

1023

1024

1025
        internal void Write(StreamWriter sw, string nodeName)
1026
        {
1027
            sw.Write(string.Format("<w:{0}>", nodeName));
1028
            if (this.typeField == null)
1029
                this.typeField.Write(sw, "type");
1030
            if (this.defaultField != null)
1031
                this.defaultField.Write(sw, "default");
1032
            if (this.formatField != null)
1033
                this.formatField.Write(sw, "format");
1034
            if (this.maxLengthField != null)
1035
                this.maxLengthField.Write(sw, "maxLength");
1036
            
1037
            sw.WriteEndW(nodeName);
1038
        }
1039
    }
1040

1041

1042
    [Serializable]
1043
    [XmlType(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", IncludeInSchema = false)]
1044
    public enum FFDataItemsType
1045
    {
1046

1047
    
1048
        calcOnExit,
1049

1050
    
1051
        checkBox,
1052

1053
    
1054
        ddList,
1055

1056
    
1057
        enabled,
1058

1059
    
1060
        entryMacro,
1061

1062
    
1063
        exitMacro,
1064

1065
    
1066
        helpText,
1067

1068
    
1069
        name,
1070

1071
    
1072
        statusText,
1073

1074
    
1075
        textInput,
1076
    }
1077

1078

1079
    [Serializable]
1080
    [XmlType(Namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main")]
1081
    public enum ST_FldCharType
1082
    {
1083

1084
    
1085
        begin,
1086

1087
    
1088
        separate,
1089

1090
    
1091
        end,
1092
    }
1093

1094
}
1095

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

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

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

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