npoi

Форк
0
/
SpreadsheetDrawing.cs 
2056 строк · 63.9 Кб
1
using System;
2
using System.IO;
3
using System.Xml;
4
using System.Xml.Schema;
5
using System.Xml.Serialization;
6
using System.Collections.Generic;
7
using System.ComponentModel;
8
using System.Text;
9
using NPOI.OpenXml4Net.Util;
10
using NPOI.OpenXmlFormats.Vml;
11

12
namespace NPOI.OpenXmlFormats.Dml.Spreadsheet
13
{
14
    [Serializable]
15
    [System.ComponentModel.DesignerCategoryAttribute("code")]
16
    [XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing")]
17
    public class CT_NonVisualDrawingProps
18
    {
19
        public static CT_NonVisualDrawingProps Parse(XmlNode node, XmlNamespaceManager namespaceManager)
20
        {
21
            if (node == null)
22
                return null;
23
            CT_NonVisualDrawingProps ctObj = new CT_NonVisualDrawingProps();
24
            ctObj.id = XmlHelper.ReadUInt(node.Attributes["id"]);
25
            ctObj.name = XmlHelper.ReadString(node.Attributes["name"]);
26
            ctObj.descr = XmlHelper.ReadString(node.Attributes["descr"]);
27
            ctObj.hidden = XmlHelper.ReadBool(node.Attributes["hidden"]);
28
            foreach (XmlNode childNode in node.ChildNodes)
29
            {
30
                if (childNode.LocalName == "hlinkClick")
31
                    ctObj.hlinkClick = CT_Hyperlink.Parse(childNode, namespaceManager);
32
                else if (childNode.LocalName == "hlinkHover")
33
                    ctObj.hlinkHover = CT_Hyperlink.Parse(childNode, namespaceManager);
34
                else if (childNode.LocalName == "extLst")
35
                    ctObj.extLst = CT_OfficeArtExtensionList.Parse(childNode, namespaceManager);
36
            }
37
            return ctObj;
38
        }
39

40

41

42
        internal void Write(StreamWriter sw, string nodeName)
43
        {
44
            sw.Write(string.Format("<xdr:{0}", nodeName));
45
            XmlHelper.WriteAttribute(sw, "id", this.id, true);
46
            XmlHelper.WriteAttribute(sw, "name", this.name);
47
            XmlHelper.WriteAttribute(sw, "descr", this.descr);
48
            XmlHelper.WriteAttribute(sw, "hidden", this.hidden, false);
49
            sw.Write(">");
50
            if (this.hlinkClick != null)
51
                this.hlinkClick.Write(sw, "hlinkClick");
52
            if (this.hlinkHover != null)
53
                this.hlinkHover.Write(sw, "hlinkHover");
54
            if (this.extLst != null)
55
                this.extLst.Write(sw, "extLst");
56
            sw.Write(string.Format("</xdr:{0}>", nodeName));
57
        }
58

59
        private CT_Hyperlink hlinkClickField = null;
60

61
        private CT_Hyperlink hlinkHoverField = null;
62

63
        private CT_OfficeArtExtensionList extLstField = null;
64

65
        private uint idField;
66

67
        private string nameField = null;
68

69
        private string descrField;
70

71
        private bool? hiddenField = null;
72

73
        [XmlElement(Order = 0)]
74
        public CT_Hyperlink hlinkClick
75
        {
76
            get
77
            {
78
                return this.hlinkClickField;
79
            }
80
            set
81
            {
82
                this.hlinkClickField = value;
83
            }
84
        }
85

86
        [XmlElement(Order = 1)]
87
        public CT_Hyperlink hlinkHover
88
        {
89
            get
90
            {
91
                return this.hlinkHoverField;
92
            }
93
            set
94
            {
95
                this.hlinkHoverField = value;
96
            }
97
        }
98

99
        [XmlElement(Order = 2)]
100
        public CT_OfficeArtExtensionList extLst
101
        {
102
            get
103
            {
104
                return this.extLstField;
105
            }
106
            set
107
            {
108
                this.extLstField = value;
109
            }
110
        }
111

112
        [XmlAttribute]
113
        public uint id
114
        {
115
            get
116
            {
117
                return this.idField;
118
            }
119
            set
120
            {
121
                this.idField = value;
122
            }
123
        }
124

125
        [XmlAttribute]
126
        public string name
127
        {
128
            get
129
            {
130
                return this.nameField;
131
            }
132
            set
133
            {
134
                this.nameField = value;
135
            }
136
        }
137

138
        [XmlAttribute]
139
        [DefaultValue("")]
140
        public string descr
141
        {
142
            get
143
            {
144
                return null == this.descrField ? "" : descrField;
145
            }
146
            set
147
            {
148
                this.descrField = value;
149
            }
150
        }
151
        [XmlIgnore]
152
        public bool descrSpecified
153
        {
154
            get { return (null != descrField); }
155
        }
156
        [XmlAttribute]
157
        [DefaultValue(false)]
158
        public bool hidden
159
        {
160
            get
161
            {
162
                return null == this.hiddenField ? false : (bool)hiddenField;
163
            }
164
            set
165
            {
166
                this.hiddenField = value;
167
            }
168
        }
169

170
        [XmlIgnore]
171
        public bool hiddenSpecified
172
        {
173
            get { return (null != hiddenField); }
174
        }
175
    }
176
    [Serializable]
177
    [System.ComponentModel.DesignerCategoryAttribute("code")]
178
    [XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing")]
179
    public class CT_NonVisualGraphicFrameProperties
180
    {
181

182
        private CT_GraphicalObjectFrameLocking graphicFrameLocksField;
183

184
        private CT_OfficeArtExtensionList extLstField;
185

186
        public CT_NonVisualGraphicFrameProperties()
187
        {
188
            //this.extLstField = new CT_OfficeArtExtensionList();
189
            //this.graphicFrameLocksField = new CT_GraphicalObjectFrameLocking();
190
        }
191
        public static CT_NonVisualGraphicFrameProperties Parse(XmlNode node, XmlNamespaceManager namespaceManager)
192
        {
193
            if (node == null)
194
                return null;
195
            CT_NonVisualGraphicFrameProperties ctObj = new CT_NonVisualGraphicFrameProperties();
196
            foreach (XmlNode childNode in node.ChildNodes)
197
            {
198
                if (childNode.LocalName == "graphicFrameLocks")
199
                    ctObj.graphicFrameLocks = CT_GraphicalObjectFrameLocking.Parse(childNode, namespaceManager);
200
                else if (childNode.LocalName == "extLst")
201
                    ctObj.extLst = CT_OfficeArtExtensionList.Parse(childNode, namespaceManager);
202
            }
203
            return ctObj;
204
        }
205

206

207

208
        internal void Write(StreamWriter sw, string nodeName)
209
        {
210
            sw.Write(string.Format("<xdr:{0}", nodeName));
211
            sw.Write(">");
212
            if (this.graphicFrameLocks != null)
213
                this.graphicFrameLocks.Write(sw, "graphicFrameLocks");
214
            if (this.extLst != null)
215
                this.extLst.Write(sw, "extLst");
216
            sw.Write(string.Format("</xdr:{0}>", nodeName));
217
        }
218

219
        [XmlElement(Order = 0)]
220
        public CT_GraphicalObjectFrameLocking graphicFrameLocks
221
        {
222
            get
223
            {
224
                return this.graphicFrameLocksField;
225
            }
226
            set
227
            {
228
                this.graphicFrameLocksField = value;
229
            }
230
        }
231

232
        [XmlElement(Order = 1)]
233
        public CT_OfficeArtExtensionList extLst
234
        {
235
            get
236
            {
237
                return this.extLstField;
238
            }
239
            set
240
            {
241
                this.extLstField = value;
242
            }
243
        }
244
    }
245
    [Serializable]
246
    [XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing")]
247
    public class CT_GraphicalObjectFrameNonVisual
248
    {
249

250
        CT_NonVisualDrawingProps cNvPrField;
251
        CT_NonVisualGraphicFrameProperties cNvGraphicFramePrField;
252
        public static CT_GraphicalObjectFrameNonVisual Parse(XmlNode node, XmlNamespaceManager namespaceManager)
253
        {
254
            if (node == null)
255
                return null;
256
            CT_GraphicalObjectFrameNonVisual ctObj = new CT_GraphicalObjectFrameNonVisual();
257
            foreach (XmlNode childNode in node.ChildNodes)
258
            {
259
                if (childNode.LocalName == "cNvPr")
260
                    ctObj.cNvPr = CT_NonVisualDrawingProps.Parse(childNode, namespaceManager);
261
                else if (childNode.LocalName == "cNvGraphicFramePr")
262
                    ctObj.cNvGraphicFramePr = CT_NonVisualGraphicFrameProperties.Parse(childNode, namespaceManager);
263
            }
264
            return ctObj;
265
        }
266

267

268

269
        internal void Write(StreamWriter sw, string nodeName)
270
        {
271
            sw.Write(string.Format("<xdr:{0}", nodeName));
272
            sw.Write(">");
273
            if (this.cNvPr != null)
274
                this.cNvPr.Write(sw, "cNvPr");
275
            if (this.cNvGraphicFramePr != null)
276
                this.cNvGraphicFramePr.Write(sw, "cNvGraphicFramePr");
277
            sw.Write(string.Format("</xdr:{0}>", nodeName));
278
        }
279

280
        public CT_NonVisualDrawingProps AddNewCNvPr()
281
        {
282
            this.cNvPrField = new CT_NonVisualDrawingProps();
283
            return this.cNvPrField;
284
        }
285
        public CT_NonVisualGraphicFrameProperties AddNewCNvGraphicFramePr()
286
        {
287
            this.cNvGraphicFramePrField = new CT_NonVisualGraphicFrameProperties();
288
            return this.cNvGraphicFramePrField;
289
        }
290

291
        public CT_NonVisualDrawingProps cNvPr
292
        {
293
            get { return cNvPrField; }
294
            set { cNvPrField = value; }
295
        }
296
        public CT_NonVisualGraphicFrameProperties cNvGraphicFramePr
297
        {
298
            get { return cNvGraphicFramePrField; }
299
            set { cNvGraphicFramePrField = value; }
300
        }
301
    }
302
    [Serializable]
303
    [System.ComponentModel.DesignerCategoryAttribute("code")]
304
    [XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing")]
305
    public class CT_NonVisualPictureProperties
306
    {
307
        public static CT_NonVisualPictureProperties Parse(XmlNode node, XmlNamespaceManager namespaceManager)
308
        {
309
            if (node == null)
310
                return null;
311
            CT_NonVisualPictureProperties ctObj = new CT_NonVisualPictureProperties();
312
            ctObj.preferRelativeResize = XmlHelper.ReadBool(node.Attributes["preferRelativeResize"], true);
313
            foreach (XmlNode childNode in node.ChildNodes)
314
            {
315
                if (childNode.LocalName == "picLocks")
316
                    ctObj.picLocks = CT_PictureLocking.Parse(childNode, namespaceManager);
317
                else if (childNode.LocalName == "extLst")
318
                    ctObj.extLst = CT_OfficeArtExtensionList.Parse(childNode, namespaceManager);
319
            }
320
            return ctObj;
321
        }
322

323

324

325
        internal void Write(StreamWriter sw, string nodeName)
326
        {
327
            sw.Write(string.Format("<xdr:{0}", nodeName));
328
            if(!preferRelativeResize)
329
                XmlHelper.WriteAttribute(sw, "preferRelativeResize", this.preferRelativeResize);
330
            sw.Write(">");
331
            if (this.picLocks != null)
332
                this.picLocks.Write(sw, "picLocks");
333
            if (this.extLst != null)
334
                this.extLst.Write(sw, "extLst");
335
            sw.Write(string.Format("</xdr:{0}>", nodeName));
336
        }
337

338
        private CT_PictureLocking picLocksField = null;
339

340
        private CT_OfficeArtExtensionList extLstField = null;
341

342
        private bool preferRelativeResizeField = true;
343

344
        public CT_NonVisualPictureProperties()
345
        {
346
        }
347

348
        public CT_PictureLocking AddNewPicLocks()
349
        {
350
            this.picLocksField = new CT_PictureLocking();
351
            return picLocksField;
352
        }
353

354
        [XmlElement(Order = 0)]
355
        public CT_PictureLocking picLocks
356
        {
357
            get
358
            {
359
                return this.picLocksField;
360
            }
361
            set
362
            {
363
                this.picLocksField = value;
364
            }
365
        }
366

367
        [XmlElement(Order = 1)]
368
        public CT_OfficeArtExtensionList extLst
369
        {
370
            get
371
            {
372
                return this.extLstField;
373
            }
374
            set
375
            {
376
                this.extLstField = value;
377
            }
378
        }
379

380
        [XmlAttribute]
381
        public bool preferRelativeResize
382
        {
383
            get
384
            {
385
                return this.preferRelativeResizeField;
386
            }
387
            set
388
            {
389
                this.preferRelativeResizeField = value;
390
            }
391
        }
392
    }
393
    [Serializable]
394
    [XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing")]
395
    [XmlRoot(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing", IsNullable = true)]
396
    public class CT_BlipFillProperties
397
    {
398

399
        private CT_Blip blipField = null;
400

401
        private CT_RelativeRect srcRectField = null;
402

403
        private CT_TileInfoProperties tileField = null;
404

405
        private CT_StretchInfoProperties stretchField = null;
406

407
        private uint dpiField;
408
        private bool dpiFieldSpecified;
409

410
        private bool rotWithShapeField;
411

412
        private bool rotWithShapeFieldSpecified;
413

414
        public CT_Blip AddNewBlip()
415
        {
416
            this.blipField = new CT_Blip();
417
            return blipField;
418
        }
419

420
        public CT_StretchInfoProperties AddNewStretch()
421
        {
422
            this.stretchField = new CT_StretchInfoProperties();
423
            return stretchField;
424
        }
425

426
        public static CT_BlipFillProperties Parse(XmlNode node, XmlNamespaceManager namespaceManager)
427
        {
428
            if (node == null)
429
                return null;
430
            CT_BlipFillProperties ctObj = new CT_BlipFillProperties();
431
            ctObj.dpi = XmlHelper.ReadUInt(node.Attributes["dpi"]);
432
            ctObj.rotWithShape = XmlHelper.ReadBool(node.Attributes["rotWithShape"]);
433
            foreach (XmlNode childNode in node.ChildNodes)
434
            {
435
                if (childNode.LocalName == "blip")
436
                    ctObj.blip = CT_Blip.Parse(childNode, namespaceManager);
437
                else if (childNode.LocalName == "srcRect")
438
                    ctObj.srcRect = CT_RelativeRect.Parse(childNode, namespaceManager);
439
                else if (childNode.LocalName == "tile")
440
                    ctObj.tile = CT_TileInfoProperties.Parse(childNode, namespaceManager);
441
                else if (childNode.LocalName == "stretch")
442
                    ctObj.stretch = CT_StretchInfoProperties.Parse(childNode, namespaceManager);
443
            }
444
            return ctObj;
445
        }
446

447

448

449
        internal void Write(StreamWriter sw, string nodeName)
450
        {
451
            sw.Write(string.Format("<xdr:{0}", nodeName));
452
            XmlHelper.WriteAttribute(sw, "dpi", this.dpi);
453
            if(rotWithShape)
454
                XmlHelper.WriteAttribute(sw, "rotWithShape", this.rotWithShape);
455
            sw.Write(">");
456
            if (this.blip != null)
457
                this.blip.Write(sw, "blip");
458
            if (this.srcRect != null)
459
                this.srcRect.Write(sw, "srcRect");
460
            if (this.tile != null)
461
                this.tile.Write(sw, "tile");
462
            if (this.stretch != null)
463
                this.stretch.Write(sw, "stretch");
464
            sw.Write(string.Format("</xdr:{0}>", nodeName));
465
        }
466

467
        [XmlElement(Order = 0)]
468
        public CT_Blip blip
469
        {
470
            get
471
            {
472
                return this.blipField;
473
            }
474
            set
475
            {
476
                this.blipField = value;
477
            }
478
        }
479

480
        [XmlElement(Order = 1)]
481
        public CT_RelativeRect srcRect
482
        {
483
            get
484
            {
485
                return this.srcRectField;
486
            }
487
            set
488
            {
489
                this.srcRectField = value;
490
            }
491
        }
492

493
        [XmlElement(Order = 2)]
494
        public CT_TileInfoProperties tile
495
        {
496
            get
497
            {
498
                return this.tileField;
499
            }
500
            set
501
            {
502
                this.tileField = value;
503
            }
504
        }
505

506
        [XmlElement(Order = 3)]
507
        public CT_StretchInfoProperties stretch
508
        {
509
            get
510
            {
511
                return this.stretchField;
512
            }
513
            set
514
            {
515
                this.stretchField = value;
516
            }
517
        }
518

519
        [XmlAttribute]
520
        public uint dpi
521
        {
522
            get
523
            {
524
                return (uint)this.dpiField;
525
            }
526
            set
527
            {
528
                this.dpiField = value;
529
            }
530
        }
531
        [XmlIgnore]
532
        public bool dpiSpecified
533
        {
534
            get
535
            {
536
                return dpiFieldSpecified;
537
            }
538
            set
539
            {
540
                this.dpiFieldSpecified = value;
541
            }
542
        }
543

544

545
        [XmlAttribute]
546
        public bool rotWithShape
547
        {
548
            get
549
            {
550
                return (bool)this.rotWithShapeField;
551
            }
552
            set
553
            {
554
                this.rotWithShapeField = value;
555
            }
556
        }
557
        [XmlIgnore]
558
        public bool rotWithShapeSpecified
559
        {
560
            get
561
            {
562
                return rotWithShapeFieldSpecified;
563
            }
564
            set
565
            {
566
                this.rotWithShapeFieldSpecified = value;
567
            }
568
        }
569

570
        public bool IsSetBlip()
571
        {
572
            return this.blipField != null;
573
        }
574

575
    }
576
    [Serializable]
577
    [XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing")]
578
    public class CT_ShapeProperties
579
    {
580

581
        private CT_Transform2D xfrmField = null;
582

583
        private CT_CustomGeometry2D custGeomField = null;
584

585
        private CT_PresetGeometry2D prstGeomField = null;
586

587
        private CT_NoFillProperties noFillField = null;
588

589
        private CT_SolidColorFillProperties solidFillField = null;
590

591
        private CT_GradientFillProperties gradFillField = null;
592

593
        private CT_BlipFillProperties blipFillField = null;
594

595
        private CT_PatternFillProperties pattFillField = null;
596

597
        private CT_GroupFillProperties grpFillField = null;
598

599
        private CT_LineProperties lnField = null;
600

601
        private CT_EffectList effectLstField = null;
602

603
        private CT_EffectContainer effectDagField = null;
604

605
        private CT_Scene3D scene3dField = null;
606

607
        private CT_Shape3D sp3dField = null;
608

609
        private CT_OfficeArtExtensionList extLstField = null;
610

611
        private ST_BlackWhiteMode bwModeField = ST_BlackWhiteMode.none;
612

613

614
        public CT_PresetGeometry2D AddNewPrstGeom()
615
        {
616
            this.prstGeomField = new CT_PresetGeometry2D();
617
            return this.prstGeomField;
618
        }
619
        public CT_Transform2D AddNewXfrm()
620
        {
621
            this.xfrmField = new CT_Transform2D();
622
            return this.xfrmField;
623
        }
624
        public CT_SolidColorFillProperties AddNewSolidFill()
625
        {
626
            this.solidFillField = new CT_SolidColorFillProperties();
627
            return this.solidFillField;
628
        }
629
        public CT_CustomGeometry2D AddNewCustGeom()
630
        {
631
            this.custGeomField = new CT_CustomGeometry2D();
632
            return this.custGeomField;
633
        }
634
        public bool IsSetPattFill()
635
        {
636
            return this.pattFillField != null;
637
        }
638
        public bool IsSetSolidFill()
639
        {
640
            return this.solidFillField != null;
641
        }
642
        public bool IsSetLn()
643
        {
644
            return this.lnField != null;
645
        }
646
        public CT_LineProperties AddNewLn()
647
        {
648
            this.lnField = new CT_LineProperties();
649
            return lnField;
650
        }
651
        public void unsetPattFill()
652
        {
653
            this.pattFill = null;
654
        }
655
        public void unsetSolidFill()
656
        {
657
            this.solidFill = null;
658
        }
659

660
        [XmlElement(Order = 0)]
661
        public CT_Transform2D xfrm
662
        {
663
            get
664
            {
665
                return this.xfrmField;
666
            }
667
            set
668
            {
669
                this.xfrmField = value;
670
            }
671
        }
672

673
        [XmlElement(Order = 1)]
674
        public CT_CustomGeometry2D custGeom
675
        {
676
            get
677
            {
678
                return this.custGeomField;
679
            }
680
            set
681
            {
682
                this.custGeomField = value;
683
            }
684
        }
685

686
        [XmlElement(Order = 2)]
687
        public CT_PresetGeometry2D prstGeom
688
        {
689
            get
690
            {
691
                return this.prstGeomField;
692
            }
693
            set
694
            {
695
                this.prstGeomField = value;
696
            }
697
        }
698

699
        [XmlElement(Order = 3)]
700
        public CT_NoFillProperties noFill
701
        {
702
            get
703
            {
704
                return this.noFillField;
705
            }
706
            set
707
            {
708
                this.noFillField = value;
709
            }
710
        }
711

712
        [XmlElement(Order = 4)]
713
        public CT_SolidColorFillProperties solidFill
714
        {
715
            get
716
            {
717
                return this.solidFillField;
718
            }
719
            set
720
            {
721
                this.solidFillField = value;
722
            }
723
        }
724

725
        [XmlElement(Order = 5)]
726
        public CT_GradientFillProperties gradFill
727
        {
728
            get
729
            {
730
                return this.gradFillField;
731
            }
732
            set
733
            {
734
                this.gradFillField = value;
735
            }
736
        }
737

738
        [XmlElement(Order = 6)]
739
        public CT_BlipFillProperties blipFill
740
        {
741
            get
742
            {
743
                return this.blipFillField;
744
            }
745
            set
746
            {
747
                this.blipFillField = value;
748
            }
749
        }
750

751
        [XmlElement(Order = 7)]
752
        public CT_PatternFillProperties pattFill
753
        {
754
            get
755
            {
756
                return this.pattFillField;
757
            }
758
            set
759
            {
760
                this.pattFillField = value;
761
            }
762
        }
763

764
        [XmlElement(Order = 8)]
765
        public CT_GroupFillProperties grpFill
766
        {
767
            get
768
            {
769
                return this.grpFillField;
770
            }
771
            set
772
            {
773
                this.grpFillField = value;
774
            }
775
        }
776

777
        [XmlElement(Order = 9)]
778
        public CT_LineProperties ln
779
        {
780
            get
781
            {
782
                return this.lnField;
783
            }
784
            set
785
            {
786
                this.lnField = value;
787
            }
788
        }
789

790
        [XmlElement(Order = 10)]
791
        public CT_EffectList effectLst
792
        {
793
            get
794
            {
795
                return this.effectLstField;
796
            }
797
            set
798
            {
799
                this.effectLstField = value;
800
            }
801
        }
802

803
        [XmlElement(Order = 11)]
804
        public CT_EffectContainer effectDag
805
        {
806
            get
807
            {
808
                return this.effectDagField;
809
            }
810
            set
811
            {
812
                this.effectDagField = value;
813
            }
814
        }
815

816
        [XmlElement(Order = 12)]
817
        public CT_Scene3D scene3d
818
        {
819
            get
820
            {
821
                return this.scene3dField;
822
            }
823
            set
824
            {
825
                this.scene3dField = value;
826
            }
827
        }
828

829
        [XmlElement(Order = 13)]
830
        public CT_Shape3D sp3d
831
        {
832
            get
833
            {
834
                return this.sp3dField;
835
            }
836
            set
837
            {
838
                this.sp3dField = value;
839
            }
840
        }
841

842
        [XmlElement(Order = 14)]
843
        public CT_OfficeArtExtensionList extLst
844
        {
845
            get
846
            {
847
                return this.extLstField;
848
            }
849
            set
850
            {
851
                this.extLstField = value;
852
            }
853
        }
854

855
        [XmlAttribute]
856
        public ST_BlackWhiteMode bwMode
857
        {
858
            get
859
            {
860
                return this.bwModeField;
861
            }
862
            set
863
            {
864
                this.bwModeField = value;
865
            }
866
        }
867
        [XmlIgnore]
868
        public bool bwModeSpecified
869
        {
870
            get { return ST_BlackWhiteMode.none != this.bwModeField; }
871
        }
872

873
        public static CT_ShapeProperties Parse(XmlNode node, XmlNamespaceManager namespaceManager)
874
        {
875
            if (node == null)
876
                return null;
877
            CT_ShapeProperties ctObj = new CT_ShapeProperties();
878
            if (node.Attributes["bwMode"] != null)
879
                ctObj.bwMode = (ST_BlackWhiteMode)Enum.Parse(typeof(ST_BlackWhiteMode), node.Attributes["bwMode"].Value);
880
            foreach (XmlNode childNode in node.ChildNodes)
881
            {
882
                if (childNode.LocalName == "xfrm")
883
                    ctObj.xfrm = CT_Transform2D.Parse(childNode, namespaceManager);
884
                else if (childNode.LocalName == "custGeom")
885
                    ctObj.custGeom = CT_CustomGeometry2D.Parse(childNode, namespaceManager);
886
                else if (childNode.LocalName == "prstGeom")
887
                    ctObj.prstGeom = CT_PresetGeometry2D.Parse(childNode, namespaceManager);
888
                else if (childNode.LocalName == "noFill")
889
                    ctObj.noFill = new CT_NoFillProperties();
890
                else if (childNode.LocalName == "solidFill")
891
                    ctObj.solidFill = CT_SolidColorFillProperties.Parse(childNode, namespaceManager);
892
                else if (childNode.LocalName == "gradFill")
893
                    ctObj.gradFill = CT_GradientFillProperties.Parse(childNode, namespaceManager);
894
                else if (childNode.LocalName == "blipFill")
895
                    ctObj.blipFill = CT_BlipFillProperties.Parse(childNode, namespaceManager);
896
                else if (childNode.LocalName == "pattFill")
897
                    ctObj.pattFill = CT_PatternFillProperties.Parse(childNode, namespaceManager);
898
                else if (childNode.LocalName == "grpFill")
899
                    ctObj.grpFill = new CT_GroupFillProperties();
900
                else if (childNode.LocalName == "ln")
901
                    ctObj.ln = CT_LineProperties.Parse(childNode, namespaceManager);
902
                else if (childNode.LocalName == "effectLst")
903
                    ctObj.effectLst = CT_EffectList.Parse(childNode, namespaceManager);
904
                else if (childNode.LocalName == "effectDag")
905
                    ctObj.effectDag = CT_EffectContainer.Parse(childNode, namespaceManager);
906
                else if (childNode.LocalName == "scene3d")
907
                    ctObj.scene3d = CT_Scene3D.Parse(childNode, namespaceManager);
908
                else if (childNode.LocalName == "sp3d")
909
                    ctObj.sp3d = CT_Shape3D.Parse(childNode, namespaceManager);
910
                else if (childNode.LocalName == "extLst")
911
                    ctObj.extLst = CT_OfficeArtExtensionList.Parse(childNode, namespaceManager);
912
            }
913
            return ctObj;
914
        }
915

916

917

918
        internal void Write(StreamWriter sw, string nodeName)
919
        {
920
            sw.Write(string.Format("<xdr:{0}", nodeName));
921
            if(bwMode!= ST_BlackWhiteMode.none)
922
                XmlHelper.WriteAttribute(sw, "bwMode", this.bwMode.ToString());
923
            sw.Write(">");
924
            if (this.xfrm != null)
925
                this.xfrm.Write(sw, "a:xfrm");
926
            if (this.custGeom != null)
927
                this.custGeom.Write(sw, "custGeom");
928
            if (this.prstGeom != null)
929
                this.prstGeom.Write(sw, "prstGeom");
930
            if (this.noFill != null)
931
                sw.Write("<a:noFill/>");
932
            if (this.solidFill != null)
933
                this.solidFill.Write(sw, "solidFill");
934
            if (this.gradFill != null)
935
                this.gradFill.Write(sw, "gradFill");
936
            if (this.blipFill != null)
937
                this.blipFill.Write(sw, "blipFill");
938
            if (this.pattFill != null)
939
                this.pattFill.Write(sw, "pattFill");
940
            if (this.grpFill != null)
941
                sw.Write("<a:grpFill/>");
942
            if (this.ln != null)
943
                this.ln.Write(sw, "ln");
944
            if (this.effectLst != null)
945
                this.effectLst.Write(sw, "effectLst");
946
            if (this.effectDag != null)
947
                this.effectDag.Write(sw, "effectDag");
948
            if (this.scene3d != null)
949
                this.scene3d.Write(sw, "scene3d");
950
            if (this.sp3d != null)
951
                this.sp3d.Write(sw, "sp3d");
952
            if (this.extLst != null)
953
                this.extLst.Write(sw, "extLst");
954
            sw.Write(string.Format("</xdr:{0}>", nodeName));
955
        }
956

957
    }
958

959

960
    [Serializable]
961
    [XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing")]
962
    public class CT_GraphicalObjectFrame
963
    {
964
        CT_GraphicalObjectFrameNonVisual nvGraphicFramePrField;
965
        CT_Transform2D xfrmField;
966
        CT_GraphicalObject graphicField;
967
        private string macroField;
968
        private bool fPublishedField;
969

970
        public void Set(CT_GraphicalObjectFrame obj)
971
        {
972
            this.xfrmField = obj.xfrmField;
973
            this.graphicField = obj.graphicField;
974
            this.nvGraphicFramePrField = obj.nvGraphicFramePrField;
975
            this.macroField = obj.macroField;
976
            this.fPublishedField = obj.fPublishedField;
977
        }
978

979
        public CT_Transform2D AddNewXfrm()
980
        {
981
            this.xfrmField = new CT_Transform2D();
982
            return this.xfrmField;
983
        }
984
        public CT_GraphicalObject AddNewGraphic()
985
        {
986
            this.graphicField = new CT_GraphicalObject();
987
            return this.graphicField;
988
        }
989

990
        public CT_GraphicalObjectFrameNonVisual AddNewNvGraphicFramePr()
991
        {
992
            this.nvGraphicFramePr = new CT_GraphicalObjectFrameNonVisual();
993
            return this.nvGraphicFramePr;
994
        }
995
        [XmlElement]
996
        public CT_GraphicalObjectFrameNonVisual nvGraphicFramePr
997
        {
998
            get { return nvGraphicFramePrField; }
999
            set { nvGraphicFramePrField = value; }
1000
        }
1001
        [XmlElement]
1002
        public CT_Transform2D xfrm
1003
        {
1004
            get { return xfrmField; }
1005
            set { xfrmField = value; }
1006
        }
1007
        [XmlAttribute]
1008
        public string macro
1009
        {
1010
            get { return macroField; }
1011
            set { macroField = value; }
1012
        }
1013
        [XmlAttribute]
1014
        [DefaultValue(false)]
1015
        public bool fPublished
1016
        {
1017
            get { return fPublishedField; }
1018
            set { fPublishedField = value; }
1019
        }
1020
        [XmlElement]
1021
        public CT_GraphicalObject graphic
1022
        {
1023
            get { return graphicField; }
1024
            set { graphicField = value; }
1025
        }
1026
        public static CT_GraphicalObjectFrame Parse(XmlNode node, XmlNamespaceManager namespaceManager)
1027
        {
1028
            if (node == null)
1029
                return null;
1030
            CT_GraphicalObjectFrame ctObj = new CT_GraphicalObjectFrame();
1031
            ctObj.macro = XmlHelper.ReadString(node.Attributes["macro"]);
1032
            ctObj.fPublished = XmlHelper.ReadBool(node.Attributes["fPublished"]);
1033
            foreach (XmlNode childNode in node.ChildNodes)
1034
            {
1035
                if (childNode.LocalName == "nvGraphicFramePr")
1036
                    ctObj.nvGraphicFramePr = CT_GraphicalObjectFrameNonVisual.Parse(childNode, namespaceManager);
1037
                else if (childNode.LocalName == "xfrm")
1038
                    ctObj.xfrm = CT_Transform2D.Parse(childNode, namespaceManager);
1039
                else if (childNode.LocalName == "graphic")
1040
                    ctObj.graphic = CT_GraphicalObject.Parse(childNode, namespaceManager);
1041
            }
1042
            return ctObj;
1043
        }
1044

1045

1046

1047
        internal void Write(StreamWriter sw, string nodeName)
1048
        {
1049
            sw.Write(string.Format("<xdr:{0}", nodeName));
1050
            XmlHelper.WriteAttribute(sw, "macro", this.macro, true);
1051
            XmlHelper.WriteAttribute(sw, "fPublished", this.fPublished, false);
1052
            sw.Write(">");
1053
            if (this.nvGraphicFramePr != null)
1054
                this.nvGraphicFramePr.Write(sw, "nvGraphicFramePr");
1055
            if (this.xfrm != null)
1056
                this.xfrm.Write(sw, "xdr:xfrm");
1057
            if (this.graphic != null)
1058
                this.graphic.Write(sw, "graphic");
1059
            sw.Write(string.Format("</xdr:{0}>", nodeName));
1060
        }
1061

1062
    }
1063

1064

1065

1066
    [Serializable]
1067
    [XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing")]
1068
    public class CT_ConnectorNonVisual
1069
    {
1070
        private CT_NonVisualDrawingProps cNvPrField;
1071
        private CT_NonVisualConnectorProperties cNvCxnSpPrField;
1072

1073
        public CT_NonVisualConnectorProperties cNvCxnSpPr
1074
        {
1075
            get
1076
            {
1077
                return this.cNvCxnSpPrField;
1078
            }
1079
            set
1080
            {
1081
                this.cNvCxnSpPrField = value;
1082
            }
1083
        }
1084
        public CT_NonVisualDrawingProps AddNewCNvPr()
1085
        {
1086
            this.cNvPr = new CT_NonVisualDrawingProps();
1087
            return this.cNvPr;
1088
        }
1089
        public CT_NonVisualConnectorProperties AddNewCNvCxnSpPr()
1090
        {
1091
            this.cNvCxnSpPr = new CT_NonVisualConnectorProperties();
1092
            return this.cNvCxnSpPr;
1093
        }
1094

1095

1096
        public CT_NonVisualDrawingProps cNvPr
1097
        {
1098
            get
1099
            {
1100
                return this.cNvPrField;
1101
            }
1102
            set
1103
            {
1104
                this.cNvPrField = value;
1105
            }
1106
        }
1107
        public static CT_ConnectorNonVisual Parse(XmlNode node, XmlNamespaceManager namespaceManager)
1108
        {
1109
            if (node == null)
1110
                return null;
1111
            CT_ConnectorNonVisual ctObj = new CT_ConnectorNonVisual();
1112
            foreach (XmlNode childNode in node.ChildNodes)
1113
            {
1114
                if (childNode.LocalName == "cNvCxnSpPr")
1115
                    ctObj.cNvCxnSpPr = CT_NonVisualConnectorProperties.Parse(childNode, namespaceManager);
1116
                else if (childNode.LocalName == "cNvPr")
1117
                    ctObj.cNvPr = CT_NonVisualDrawingProps.Parse(childNode, namespaceManager);
1118
            }
1119
            return ctObj;
1120
        }
1121

1122
        internal void Write(StreamWriter sw, string nodeName)
1123
        {
1124
            sw.Write(string.Format("<xdr:{0}", nodeName));
1125
            sw.Write(">");
1126
            if (this.cNvPr != null)
1127
                this.cNvPr.Write(sw, "cNvPr");
1128
            if (this.cNvCxnSpPr != null)
1129
                this.cNvCxnSpPr.Write(sw, "cNvCxnSpPr");
1130
            sw.Write(string.Format("</xdr:{0}>", nodeName));
1131
        }
1132

1133

1134
    }
1135

1136

1137
    [Serializable]
1138
    [XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing")]
1139
    public class CT_Marker
1140
    {
1141
        private int _col;
1142
        private long _colOff;
1143
        private int _row;
1144
        private long _rowOff;
1145

1146
        public int col
1147
        {
1148
            get 
1149
            {
1150
                return _col;
1151
            }
1152
            set 
1153
            {
1154
                _col = value;
1155
            }
1156
        }
1157
        public long colOff
1158
        {
1159
            get 
1160
            {
1161
                return _colOff;
1162
            }
1163
            set
1164
            {
1165
                _colOff = value;
1166
            }
1167
        }
1168
        public int row
1169
        {
1170
            get { return _row; }
1171
            set { _row = value; }
1172
        }
1173
        public long rowOff
1174
        {
1175
            get
1176
            {
1177
                return _rowOff;
1178
            }
1179
            set
1180
            {
1181
                _rowOff = value;
1182
            }
1183
        }
1184

1185
        public static CT_Marker Parse(XmlNode node, XmlNamespaceManager nameSpaceManager)
1186
        {
1187
            CT_Marker ctMarker = new CT_Marker();
1188
            foreach (XmlNode subnode in node.ChildNodes)
1189
            {
1190
                if (subnode.LocalName == "col")
1191
                {
1192
                    ctMarker.col = Int32.Parse(subnode.InnerText);
1193
                }
1194
                else if (subnode.LocalName == "colOff")
1195
                {
1196
                    ctMarker.colOff = Int64.Parse(subnode.InnerText);
1197
                }
1198
                else if (subnode.LocalName == "row")
1199
                {
1200
                    ctMarker.row = Int32.Parse(subnode.InnerText);
1201
                }
1202
                else if (subnode.LocalName == "rowOff")
1203
                {
1204
                    ctMarker.rowOff = Int64.Parse(subnode.InnerText);
1205
                }
1206
            }
1207
            return ctMarker;
1208
        }
1209

1210
        public override string ToString()
1211
        {
1212
            StringBuilder sb=new StringBuilder();
1213
            using(StringWriter sw =new StringWriter(sb))
1214
            {
1215
                sw.Write("<xdr:col>");
1216
                sw.Write(this.col.ToString());
1217
                sw.Write("</xdr:col>");
1218
                sw.Write("<xdr:colOff>");
1219
                sw.Write(this.colOff.ToString());
1220
                sw.Write("</xdr:colOff>");
1221
                sw.Write("<xdr:row>");
1222
                sw.Write(this.row.ToString());
1223
                sw.Write("</xdr:row>");
1224
                sw.Write("<xdr:rowOff>");
1225
                sw.Write(this.rowOff.ToString());
1226
                sw.Write("</xdr:rowOff>");
1227
            }
1228
            return sb.ToString();
1229
        }
1230

1231
        internal void Write(StreamWriter sw, string nodeName)
1232
        {
1233
            sw.Write(string.Format("<{0}>", nodeName));
1234
            sw.Write("<xdr:col>");
1235
            sw.Write(this.col.ToString());
1236
            sw.Write("</xdr:col>");
1237
            sw.Write("<xdr:colOff>");
1238
            sw.Write(this.colOff.ToString());
1239
            sw.Write("</xdr:colOff>");
1240
            sw.Write("<xdr:row>");
1241
            sw.Write(this.row.ToString());
1242
            sw.Write("</xdr:row>");
1243
            sw.Write("<xdr:rowOff>");
1244
            sw.Write(this.rowOff.ToString());
1245
            sw.Write("</xdr:rowOff>");
1246
            sw.Write(string.Format("</{0}>", nodeName));
1247
        }
1248
    }
1249
    public enum ST_EditAs
1250
    {
1251
        NONE,
1252
        twoCell,
1253
        oneCell,
1254
        absolute
1255
    }
1256

1257
    [Serializable]
1258
    [XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing")]
1259
    public class CT_AnchorClientData
1260
    {
1261
        
1262
        public static CT_AnchorClientData Parse(XmlNode node, XmlNamespaceManager namespaceManager)
1263
        {
1264
            if (node == null)
1265
                return null;
1266
            CT_AnchorClientData ctObj = new CT_AnchorClientData();
1267
            ctObj.fLocksWithSheet = XmlHelper.ReadBool(node.Attributes["fLocksWithSheet"], true);
1268
            ctObj.fPrintsWithSheet = XmlHelper.ReadBool(node.Attributes["fPrintsWithSheet"], true);
1269
            return ctObj;
1270
        }
1271

1272

1273

1274
        internal void Write(StreamWriter sw, string nodeName)
1275
        {
1276
            sw.Write(string.Format("<xdr:{0}", nodeName));
1277
            XmlHelper.WriteAttribute(sw, "fLocksWithSheet", this.fLocksWithSheet, false, true);
1278
            XmlHelper.WriteAttribute(sw, "fPrintsWithSheet", this.fPrintsWithSheet, false, true);
1279
            sw.Write("/>");
1280
        }
1281
        bool _fLocksWithSheet = true;
1282
        bool _fPrintsWithSheet = true;
1283

1284
        [XmlAttribute]
1285
        public bool fLocksWithSheet
1286
        {
1287
            get
1288
            {
1289
                return _fLocksWithSheet;
1290
            }
1291
            set
1292
            {
1293
                _fLocksWithSheet = value;
1294
            }
1295
        }
1296
        [XmlAttribute]
1297
        public bool fPrintsWithSheet
1298
        {
1299
            get
1300
            {
1301
                return _fPrintsWithSheet;
1302
            }
1303
            set
1304
            {
1305
                _fPrintsWithSheet = value;
1306
            }
1307
        }
1308
    }
1309

1310

1311

1312
    [Serializable]
1313
    [XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing")]
1314
    [XmlRoot("wsDr", Namespace = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing", IsNullable = true)]
1315
    public class CT_Drawing
1316
    {
1317
        private List<IEG_Anchor> cellAnchors = new List<IEG_Anchor>();
1318
        //private List<CT_AbsoulteCellAnchor> absoluteCellAnchors = new List<CT_AbsoulteCellAnchor>();
1319

1320
        public CT_TwoCellAnchor AddNewTwoCellAnchor()
1321
        {
1322
            CT_TwoCellAnchor anchor = new CT_TwoCellAnchor();
1323
            cellAnchors.Add(anchor);
1324
            return anchor;
1325
        }
1326
        public int SizeOfTwoCellAnchorArray()
1327
        {
1328
            int count = 0;
1329
            foreach (IEG_Anchor anchor in cellAnchors)
1330
            {
1331
                if (anchor is CT_TwoCellAnchor)
1332
                {
1333
                    count++;
1334
                }
1335
            }
1336
            return count;
1337
        }
1338

1339
        public void Save(Stream stream)
1340
        {
1341
            using (StreamWriter sw = new StreamWriter(stream))
1342
            {
1343
                sw.Write("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>");
1344
                sw.Write("<xdr:wsDr xmlns:xdr=\"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\">");
1345
                foreach (IEG_Anchor anchor in this.cellAnchors)
1346
                {
1347
                    anchor.Write(sw);
1348
                }
1349
                sw.Write("</xdr:wsDr>");
1350
            }
1351
        }
1352

1353
        [XmlIgnore]
1354
        public List<IEG_Anchor> CellAnchors
1355
        {
1356
            get { return cellAnchors; }
1357
            set { cellAnchors = value; }
1358
        }
1359

1360
        //[XmlElement("absoluteAnchor")]
1361
        //public List<CT_TwoCellAnchor> AbsoluteAnchors
1362
        //{
1363
        //    get { return absoluteAnchors; }
1364
        //    set { absoluteAnchors = value; }
1365
        //}
1366

1367
        public void Set(CT_Drawing ctDrawing)
1368
        {
1369
            this.cellAnchors.Clear();
1370
            foreach (IEG_Anchor anchor in ctDrawing.cellAnchors)
1371
            {
1372
                this.cellAnchors.Add(anchor);
1373
            }
1374
        }
1375

1376
        public int SizeOfAbsoluteAnchorArray()
1377
        {
1378
            return 0;
1379
        }
1380

1381
        public int SizeOfOneCellAnchorArray()
1382
        {
1383
            int count = 0;
1384
            foreach (IEG_Anchor anchor in cellAnchors)
1385
            {
1386
                if (anchor is CT_OneCellAnchor)
1387
                {
1388
                    count++;
1389
                }
1390
            }
1391
            return count;
1392
        }
1393

1394
        public static CT_Drawing Parse(XmlDocument xmldoc, XmlNamespaceManager namespaceManager)
1395
        {
1396
            XmlNodeList cellanchorNodes = xmldoc.SelectNodes("/xdr:wsDr/*", namespaceManager);
1397
            CT_Drawing ctDrawing = new CT_Drawing();
1398
            foreach (XmlNode node in cellanchorNodes)
1399
            {
1400
                if (node.LocalName == "twoCellAnchor")
1401
                {
1402
                    CT_TwoCellAnchor twoCellAnchor = CT_TwoCellAnchor.Parse(node, namespaceManager);
1403
                    ctDrawing.cellAnchors.Add(twoCellAnchor);
1404
                }
1405
                else if (node.LocalName == "oneCellAnchor")
1406
                {
1407
                    CT_OneCellAnchor oneCellAnchor = CT_OneCellAnchor.Parse(node, namespaceManager);
1408
                    ctDrawing.cellAnchors.Add(oneCellAnchor);
1409
                }
1410
                else if (node.LocalName == "absCellAnchor")
1411
                {
1412
                    CT_AbsoluteCellAnchor absCellAnchor = CT_AbsoluteCellAnchor.Parse(node, namespaceManager);
1413
                    ctDrawing.cellAnchors.Add(absCellAnchor);
1414
                }
1415
            }
1416
            return ctDrawing;
1417
        }
1418
    }
1419
    [Serializable]
1420
    [XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing")]
1421
    public class CT_LegacyDrawing
1422
    {
1423

1424
        private string idField;
1425

1426
        [XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified, Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/relationships")]
1427
        public string id
1428
        {
1429
            get
1430
            {
1431
                return this.idField;
1432
            }
1433
            set
1434
            {
1435
                this.idField = value;
1436
            }
1437
        }
1438
    }
1439
    [XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing")]
1440
    public class CT_OneCellAnchor: IEG_Anchor
1441
    {
1442
        private CT_Marker fromField = new CT_Marker();
1443
        private CT_PositiveSize2D extField; //= new CT_PositiveSize2D();
1444
        private CT_AnchorClientData clientDataField = new CT_AnchorClientData(); // 1..1 element
1445
        private CT_Shape shapeField = null;
1446
        private CT_GroupShape groupShapeField = null;
1447
        private CT_GraphicalObjectFrame graphicalObjectField = null;
1448
        private CT_Connector connectorField = null;
1449
        private CT_Picture pictureField = null;
1450

1451
        [XmlElement]
1452
        public CT_Marker from
1453
        {
1454
            get { return fromField; }
1455
            set { fromField = value; }
1456
        }
1457
        CT_AlternateContent alternateContentField = null;
1458
        public CT_AlternateContent alternateContent
1459
        {
1460
            get
1461
            {
1462
                return alternateContentField;
1463
            }
1464
            set
1465
            {
1466
                this.alternateContentField = value;
1467
            }
1468
        }
1469
        [XmlElement]
1470
        public CT_PositiveSize2D ext
1471
        {
1472
            get { return this.extField; }
1473
            set { this.extField = value; }
1474
        }
1475
        public CT_AnchorClientData AddNewClientData()
1476
        {
1477
            this.clientDataField = new CT_AnchorClientData();
1478
            return this.clientDataField;
1479
        }
1480
        [XmlElement]
1481
        public CT_AnchorClientData clientData
1482
        {
1483
            get { return clientDataField; }
1484
            set { clientDataField = value; }
1485
        }
1486
        public CT_Shape sp
1487
        {
1488
            get { return shapeField; }
1489
            set { shapeField = value; }
1490
        }
1491
        public CT_GroupShape groupShape
1492
        {
1493
            get { return groupShapeField; }
1494
            set { groupShapeField = value; }
1495
        }
1496
        public CT_GraphicalObjectFrame graphicFrame
1497
        {
1498
            get { return graphicalObjectField; }
1499
            set { graphicalObjectField = value; }
1500
        }
1501
        public CT_Connector connector
1502
        {
1503
            get { return connectorField; }
1504
            set { connectorField = value; }
1505
        }
1506
        public CT_Picture picture
1507
        {
1508
            get { return pictureField; }
1509
            set { pictureField = value; }
1510
        }
1511
         
1512
        public void Write(StreamWriter sw)
1513
        {
1514
            sw.Write("<xdr:oneCellAnchor>");
1515
            this.from.Write(sw, "xdr:from");
1516
            this.ext.Write(sw, "xdr:ext");
1517
            if (this.sp != null)
1518
                sp.Write(sw, "sp");
1519
            else if (this.connector != null)
1520
                this.connector.Write(sw, "cxnSp");
1521
            else if (this.groupShape != null)
1522
                this.groupShape.Write(sw, "grpSp");
1523
            else if (this.graphicalObjectField != null)
1524
                this.graphicalObjectField.Write(sw, "graphicFrame");
1525
            else if (this.pictureField != null)
1526
                this.picture.Write(sw, "pic");
1527
            if (this.alternateContent != null)
1528
            {
1529
                this.alternateContent.Write(sw, "AlternateContent");
1530
            }
1531
            if (this.clientData != null)
1532
                this.clientData.Write(sw, "clientData");
1533
            sw.Write("</xdr:oneCellAnchor>");
1534
        }
1535

1536
        internal static CT_OneCellAnchor Parse(XmlNode node, XmlNamespaceManager namespaceManager)
1537
        {
1538
            CT_OneCellAnchor oneCellAnchor = new CT_OneCellAnchor();
1539
            foreach (XmlNode childNode in node.ChildNodes)
1540
            {
1541
                if (childNode.LocalName == "from")
1542
                {
1543
                    oneCellAnchor.from = CT_Marker.Parse(childNode, namespaceManager);
1544
                }
1545
                else if (childNode.LocalName == "ext")
1546
                {
1547
                    oneCellAnchor.ext = CT_PositiveSize2D.Parse(childNode, namespaceManager);
1548
                }
1549
                else if (childNode.LocalName == "sp")
1550
                {
1551
                    oneCellAnchor.sp = CT_Shape.Parse(childNode, namespaceManager); ;
1552
                }
1553
                else if (childNode.LocalName == "pic")
1554
                {
1555
                    oneCellAnchor.picture = CT_Picture.Parse(childNode, namespaceManager);
1556
                }
1557
                else if (childNode.LocalName == "cxnSp")
1558
                {
1559
                    oneCellAnchor.connector = CT_Connector.Parse(childNode, namespaceManager);
1560
                }
1561
                else if (childNode.LocalName == "grpSp")
1562
                {
1563
                    oneCellAnchor.groupShape = CT_GroupShape.Parse(childNode, namespaceManager);
1564
                }
1565
                else if (childNode.LocalName == "graphicFrame")
1566
                {
1567
                    oneCellAnchor.graphicFrame = CT_GraphicalObjectFrame.Parse(childNode, namespaceManager);
1568
                }
1569
                else if (childNode.LocalName == "AlternateContent")
1570
                {
1571
                    oneCellAnchor.alternateContent = CT_AlternateContent.Parse(childNode, namespaceManager);
1572
                }
1573
                else if (childNode.LocalName == "clientData")
1574
                {
1575
                    oneCellAnchor.clientData = CT_AnchorClientData.Parse(childNode, namespaceManager);
1576
                }
1577
            }
1578
            return oneCellAnchor;
1579
        }
1580
    }
1581

1582
    public interface IEG_Anchor
1583
    {
1584
        CT_Shape sp { get; set; }
1585
        CT_Connector connector { get; set; }
1586
        CT_GraphicalObjectFrame graphicFrame { get; set; }
1587
        CT_Picture picture { get; set; }
1588
        CT_GroupShape groupShape { get; set; }
1589
        CT_AnchorClientData clientData { get; set; }
1590
        void Write(StreamWriter sw);
1591
    }
1592
    public class CT_AbsoluteCellAnchor : IEG_Anchor
1593
    {
1594
        CT_Point2D posField;
1595
        CT_PositiveSize2D extField;
1596
        CT_AnchorClientData clientDataField = new CT_AnchorClientData();
1597
        private CT_Shape shapeField = null;
1598
        private CT_GroupShape groupShapeField = null;
1599
        private CT_GraphicalObjectFrame graphicalObjectField = null;
1600
        private CT_Connector connectorField = null;
1601
        private CT_Picture pictureField = null;
1602
        public static CT_AbsoluteCellAnchor Parse(XmlNode node, XmlNamespaceManager namespaceManager)
1603
        {
1604
            CT_AbsoluteCellAnchor absCellAnchor = new CT_AbsoluteCellAnchor();
1605
            foreach (XmlNode childNode in node.ChildNodes)
1606
            {
1607
                if (childNode.LocalName == "pos")
1608
                {
1609
                    absCellAnchor.pos = CT_Point2D.Parse(childNode, namespaceManager);
1610
                }
1611
                else if (childNode.LocalName == "ext")
1612
                {
1613
                    absCellAnchor.ext = CT_PositiveSize2D.Parse(childNode, namespaceManager);
1614
                }
1615
                else if (childNode.LocalName == "sp")
1616
                {
1617
                    absCellAnchor.sp = CT_Shape.Parse(childNode, namespaceManager); ;
1618
                }
1619
                else if (childNode.LocalName == "pic")
1620
                {
1621
                    absCellAnchor.picture = CT_Picture.Parse(childNode, namespaceManager);
1622
                }
1623
                else if (childNode.LocalName == "cxnSp")
1624
                {
1625
                    absCellAnchor.connector = CT_Connector.Parse(childNode, namespaceManager);
1626
                }
1627
                else if (childNode.LocalName == "grpSp")
1628
                {
1629
                    absCellAnchor.groupShape = CT_GroupShape.Parse(childNode, namespaceManager);
1630
                }
1631
                else if (childNode.LocalName == "graphicFrame")
1632
                {
1633
                    absCellAnchor.graphicFrame = CT_GraphicalObjectFrame.Parse(childNode, namespaceManager);
1634
                }
1635
                else if (childNode.LocalName == "clientData")
1636
                {
1637
                    absCellAnchor.clientData = CT_AnchorClientData.Parse(childNode, namespaceManager);
1638
                }
1639
            }
1640
            return absCellAnchor;
1641
        }
1642

1643
        public CT_AnchorClientData clientData
1644
        {
1645
            get { return clientDataField; }
1646
            set { clientDataField = value; }
1647
        }
1648

1649
        public CT_Point2D AddNewOff()
1650
        {
1651
            this.posField = new CT_Point2D();
1652
            return this.posField;
1653
        }
1654

1655
        public CT_Point2D pos
1656
        {
1657
            get
1658
            {
1659
                return this.posField;
1660
            }
1661
            set
1662
            {
1663
                this.posField = value;
1664
            }
1665
        }
1666
        public CT_PositiveSize2D ext
1667
        {
1668
            get { return this.extField; }
1669
            set { this.extField = value; }
1670
        }
1671
        public CT_AnchorClientData AddNewClientData()
1672
        {
1673
            this.clientDataField = new CT_AnchorClientData();
1674
            return this.clientDataField;
1675
        }
1676
        public CT_Shape sp
1677
        {
1678
            get { return shapeField; }
1679
            set { shapeField = value; }
1680
        }
1681
        public CT_GroupShape groupShape
1682
        {
1683
            get { return groupShapeField; }
1684
            set { groupShapeField = value; }
1685
        }
1686
        public CT_GraphicalObjectFrame graphicFrame
1687
        {
1688
            get { return graphicalObjectField; }
1689
            set { graphicalObjectField = value; }
1690
        }
1691
        public CT_Connector connector
1692
        {
1693
            get { return connectorField; }
1694
            set { connectorField = value; }
1695
        }
1696
        public CT_Picture picture
1697
        {
1698
            get { return pictureField; }
1699
            set { pictureField = value; }
1700
        }
1701
        public void Write(StreamWriter sw)
1702
        {
1703
            sw.Write("<xdr:absCellAnchor>");
1704
            if (this.pos!=null)
1705
                this.pos.Write(sw, "pos");
1706
            if (this.sp != null)
1707
                sp.Write(sw, "sp");
1708
            else if (this.connector != null)
1709
                this.connector.Write(sw, "cxnSp");
1710
            else if (this.groupShape != null)
1711
                this.groupShape.Write(sw, "grpSp");
1712
            else if (this.graphicalObjectField != null)
1713
                this.graphicalObjectField.Write(sw, "graphicFrame");
1714
            else if (this.pictureField != null)
1715
                this.picture.Write(sw, "pic");
1716

1717
            if (this.clientData != null)
1718
            {
1719
                this.clientData.Write(sw, "clientData");
1720
            }
1721
            sw.Write("</xdr:absCellAnchor>");
1722
        }
1723
    }
1724
    [Serializable]
1725
    [XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing")]
1726
    public class CT_TwoCellAnchor : IEG_Anchor //- was empty interface
1727
    {
1728
        private CT_Marker fromField = new CT_Marker(); // 1..1 element
1729
        private CT_Marker toField = new CT_Marker(); // 1..1 element
1730
        // 1..1 element choice - one of CT_Shape, CT_GroupShape, CT_GraphicalObjectFrame, CT_Connector or CT_Picture
1731
        private CT_Shape shapeField = null;
1732
        private CT_GroupShape groupShapeField = null;
1733
        private CT_GraphicalObjectFrame graphicalObjectField = null;
1734
        private CT_Connector connectorField = null;
1735
        private CT_Picture pictureField = null;
1736

1737
        private CT_AnchorClientData clientDataField = null; // 1..1 element
1738

1739
        private ST_EditAs editAsField = ST_EditAs.NONE; // 0..1 attribute
1740

1741
        public CT_TwoCellAnchor()
1742
        {
1743
            this.clientDataField = new CT_AnchorClientData();
1744
        }
1745

1746
        public CT_Shape AddNewSp()
1747
        {
1748
            shapeField = new CT_Shape();
1749
            return shapeField;
1750
        }
1751

1752
        public CT_GroupShape AddNewGrpSp()
1753
        {
1754
            groupShapeField = new CT_GroupShape();
1755
            return groupShapeField;
1756
        }
1757

1758
        public CT_GraphicalObjectFrame AddNewGraphicFrame()
1759
        {
1760
            graphicalObjectField = new CT_GraphicalObjectFrame();
1761
            return graphicalObjectField;
1762
        }
1763

1764
        public CT_Connector AddNewCxnSp()
1765
        {
1766
            connectorField = new CT_Connector();
1767
            return connectorField;
1768
        }
1769

1770
        public CT_Picture AddNewPic()
1771
        {
1772
            pictureField = new CT_Picture();
1773
            return pictureField;
1774
        }
1775

1776
        public CT_AnchorClientData AddNewClientData()
1777
        {
1778
            this.clientDataField = new CT_AnchorClientData();
1779
            return this.clientDataField;
1780
        }
1781
        [XmlElement]
1782
        public CT_AnchorClientData clientData
1783
        {
1784
            get { return clientDataField; }
1785
            set { clientDataField = value; }
1786
        }
1787
        [XmlAttribute]
1788
        public ST_EditAs editAs
1789
        {
1790
            get { return editAsField; }
1791
            set { editAsField = value; }
1792
        }
1793
        bool editAsSpecifiedField = false;
1794
        [XmlIgnore]
1795
        public bool editAsSpecified
1796
        {
1797
            get { return editAsSpecifiedField; }
1798
            set { editAsSpecifiedField = value; }
1799
        }
1800

1801
        [XmlElement]
1802
        public CT_Marker from
1803
        {
1804
            get { return fromField; }
1805
            set { fromField = value; }
1806
        }
1807

1808
        [XmlElement]
1809
        public CT_Marker to
1810
        {
1811
            get { return toField; }
1812
            set { toField = value; }
1813
        }
1814

1815
        private Vml.CT_AlternateContent alternateContentField = null;
1816

1817
        public Vml.CT_AlternateContent alternateContent
1818
        {
1819
            get
1820
            {
1821
                return alternateContentField;
1822
            }
1823
            set
1824
            {
1825
                this.alternateContentField = value;
1826
            }
1827
        }
1828

1829
        #region Choice - one of CT_Shape, CT_GroupShape, CT_GraphicalObjectFrame, CT_Connector or CT_Picture
1830

1831
        [XmlElement]
1832
        public CT_Shape sp
1833
        {
1834
            get { return shapeField; }
1835
            set { shapeField = value; }
1836
        }
1837
        [XmlElement]
1838
        public CT_GroupShape groupShape
1839
        {
1840
            get { return groupShapeField; }
1841
            set { groupShapeField = value; }
1842
        }
1843

1844
        [XmlElement]
1845
        public CT_GraphicalObjectFrame graphicFrame
1846
        {
1847
            get { return graphicalObjectField; }
1848
            set { graphicalObjectField = value; }
1849
        }
1850

1851
        [XmlElement]
1852
        public CT_Connector connector
1853
        {
1854
            get { return connectorField; }
1855
            set { connectorField = value; }
1856
        }
1857

1858
        [XmlElement("pic")]
1859
        public CT_Picture picture
1860
        {
1861
            get { return pictureField; }
1862
            set { pictureField = value; }
1863
        }
1864

1865
        #endregion Choice - one of CT_Shape, CT_GroupShape, CT_GraphicalObjectFrame, CT_Connector or CT_Picture
1866

1867
        public void Write(StreamWriter sw)
1868
        {
1869
            sw.Write("<xdr:twoCellAnchor");
1870
            if(this.editAsField!= ST_EditAs.NONE)
1871
                sw.Write(string.Format(" editAs=\"{0}\"",this.editAsField.ToString()));
1872
            sw.Write(">");
1873
            this.from.Write(sw, "xdr:from");
1874
            this.to.Write(sw, "xdr:to");
1875
            if (this.sp != null)
1876
                sp.Write(sw, "sp");
1877
            else if (this.connector != null)
1878
                this.connector.Write(sw, "cxnSp");
1879
            else if (this.groupShape != null)
1880
                this.groupShape.Write(sw, "grpSp");
1881
            else if (this.graphicalObjectField != null)
1882
                this.graphicalObjectField.Write(sw, "graphicFrame");
1883
            else if (this.pictureField != null)
1884
                this.picture.Write(sw, "pic");
1885
            if (this.alternateContent != null)
1886
            {
1887
                this.alternateContent.Write(sw, "AlternateContent");
1888
            }
1889
            if (this.clientData != null)
1890
            {
1891
                this.clientData.Write(sw, "clientData");
1892
            }
1893
            sw.Write("</xdr:twoCellAnchor>");
1894
        }
1895

1896
        internal static CT_TwoCellAnchor Parse(XmlNode node, XmlNamespaceManager namespaceManager)
1897
        {
1898
            CT_TwoCellAnchor twoCellAnchor = new CT_TwoCellAnchor();
1899
            if (node.Attributes["editAs"] != null)
1900
                twoCellAnchor.editAs = (ST_EditAs)Enum.Parse(typeof(ST_EditAs), node.Attributes["editAs"].Value);
1901

1902
            foreach(XmlNode childNode in node.ChildNodes)
1903
            {
1904
                if (childNode.LocalName == "from")
1905
                {
1906
                    twoCellAnchor.from = CT_Marker.Parse(childNode, namespaceManager);
1907
                }
1908
                else if (childNode.LocalName == "to")
1909
                {
1910
                    twoCellAnchor.to = CT_Marker.Parse(childNode, namespaceManager);
1911
                }
1912
                else if (childNode.LocalName == "sp")
1913
                {
1914
                    twoCellAnchor.sp = CT_Shape.Parse(childNode, namespaceManager); ;
1915
                }
1916
                else if (childNode.LocalName == "pic")
1917
                {
1918
                    twoCellAnchor.picture = CT_Picture.Parse(childNode, namespaceManager);
1919
                }
1920
                else if (childNode.LocalName == "cxnSp")
1921
                {
1922
                    twoCellAnchor.connector = CT_Connector.Parse(childNode, namespaceManager);
1923
                }
1924
                else if (childNode.LocalName == "grpSp")
1925
                {
1926
                    twoCellAnchor.groupShape = CT_GroupShape.Parse(childNode, namespaceManager);
1927
                }
1928
                else if (childNode.LocalName == "graphicFrame")
1929
                {
1930
                    twoCellAnchor.graphicFrame = CT_GraphicalObjectFrame.Parse(childNode, namespaceManager);
1931
                }
1932
                else if (childNode.LocalName == "AlternateContent")
1933
                {
1934
                    twoCellAnchor.alternateContent = Vml.CT_AlternateContent.Parse(childNode, namespaceManager);
1935
                }
1936
                else if (childNode.LocalName == "clientData")
1937
                {
1938
                    twoCellAnchor.clientData = CT_AnchorClientData.Parse(childNode, namespaceManager);
1939
                }
1940
            }
1941
            return twoCellAnchor;
1942
        }
1943
    }
1944

1945
    [Serializable]
1946
    [XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing")]
1947
    public class CT_Connector // empty interface: EG_ObjectChoices
1948
    {
1949
        string macroField;
1950
        bool fPublishedField;
1951
        private CT_ShapeProperties spPrField;
1952
        private CT_ShapeStyle styleField;
1953
        private CT_ConnectorNonVisual nvCxnSpPrField;
1954
        public CT_ConnectorNonVisual nvCxnSpPr
1955
        {
1956
            get { return nvCxnSpPrField; }
1957
            set { nvCxnSpPrField = value; }
1958
        }
1959
        public static CT_Connector Parse(XmlNode node, XmlNamespaceManager namespaceManager)
1960
        {
1961
            if (node == null)
1962
                return null;
1963
            CT_Connector ctObj = new CT_Connector();
1964
            ctObj.macro = XmlHelper.ReadString(node.Attributes["macro"]);
1965
            ctObj.fPublished = XmlHelper.ReadBool(node.Attributes["fPublished"]);
1966
            foreach (XmlNode childNode in node.ChildNodes)
1967
            {
1968
                if (childNode.LocalName == "nvCxnSpPr")
1969
                    ctObj.nvCxnSpPr = CT_ConnectorNonVisual.Parse(childNode, namespaceManager);
1970
                else if (childNode.LocalName == "spPr")
1971
                    ctObj.spPr = CT_ShapeProperties.Parse(childNode, namespaceManager);
1972
                else if (childNode.LocalName == "style")
1973
                    ctObj.style = CT_ShapeStyle.Parse(childNode, namespaceManager);
1974
            }
1975
            return ctObj;
1976
        }
1977

1978

1979

1980
        internal void Write(StreamWriter sw, string nodeName)
1981
        {
1982
            sw.Write(string.Format("<xdr:{0}", nodeName));
1983
            XmlHelper.WriteAttribute(sw, "macro", this.macro, true);
1984
            XmlHelper.WriteAttribute(sw, "fPublished", this.fPublished,false);
1985
            sw.Write(">");
1986
            if (this.nvCxnSpPr != null)
1987
                this.nvCxnSpPr.Write(sw, "nvCxnSpPr");
1988
            if (this.spPr != null)
1989
                this.spPr.Write(sw, "spPr");
1990
            if (this.style != null)
1991
                this.style.Write(sw, "style");
1992
            sw.Write(string.Format("</xdr:{0}>", nodeName));
1993
        }
1994

1995
        public void Set(CT_Connector obj)
1996
        {
1997
            this.macroField = obj.macro;
1998
            this.fPublishedField = obj.fPublished;
1999
            this.spPrField = obj.spPr;
2000
            this.styleField = obj.style;
2001
            this.nvCxnSpPrField = obj.nvCxnSpPr;
2002
        }
2003
        public CT_ConnectorNonVisual AddNewNvCxnSpPr()
2004
        {
2005
            this.nvCxnSpPr = new CT_ConnectorNonVisual();
2006
            return nvCxnSpPr;
2007
        }
2008
        public CT_ShapeProperties AddNewSpPr()
2009
        {
2010
            this.spPrField = new CT_ShapeProperties();
2011
            return spPrField;
2012
        }
2013
        public CT_ShapeStyle AddNewStyle()
2014
        {
2015
            this.styleField = new CT_ShapeStyle();
2016
            return this.styleField;
2017
        }
2018
        public CT_ShapeProperties spPr
2019
        {
2020
            get
2021
            {
2022
                return this.spPrField;
2023
            }
2024
            set
2025
            {
2026
                this.spPrField = value;
2027
            }
2028
        }
2029
        public CT_ShapeStyle style
2030
        {
2031
            get
2032
            {
2033
                return this.styleField;
2034
            }
2035
            set
2036
            {
2037
                this.styleField = value;
2038
            }
2039
        }
2040
        [XmlAttribute]
2041
        public string macro
2042
        {
2043
            get { return this.macroField; }
2044
            set { this.macroField = value; }
2045
        }
2046
        [XmlAttribute]
2047
        public bool fPublished
2048
        {
2049
            get { return this.fPublishedField; }
2050
            set { this.fPublishedField = value; }
2051
        }
2052
    }
2053

2054
    
2055

2056
}
2057

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

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

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

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