npoi
2056 строк · 63.9 Кб
1using System;
2using System.IO;
3using System.Xml;
4using System.Xml.Schema;
5using System.Xml.Serialization;
6using System.Collections.Generic;
7using System.ComponentModel;
8using System.Text;
9using NPOI.OpenXml4Net.Util;
10using NPOI.OpenXmlFormats.Vml;
11
12namespace NPOI.OpenXmlFormats.Dml.Spreadsheet
13{
14[Serializable]
15[System.ComponentModel.DesignerCategoryAttribute("code")]
16[XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing")]
17public class CT_NonVisualDrawingProps
18{
19public static CT_NonVisualDrawingProps Parse(XmlNode node, XmlNamespaceManager namespaceManager)
20{
21if (node == null)
22return null;
23CT_NonVisualDrawingProps ctObj = new CT_NonVisualDrawingProps();
24ctObj.id = XmlHelper.ReadUInt(node.Attributes["id"]);
25ctObj.name = XmlHelper.ReadString(node.Attributes["name"]);
26ctObj.descr = XmlHelper.ReadString(node.Attributes["descr"]);
27ctObj.hidden = XmlHelper.ReadBool(node.Attributes["hidden"]);
28foreach (XmlNode childNode in node.ChildNodes)
29{
30if (childNode.LocalName == "hlinkClick")
31ctObj.hlinkClick = CT_Hyperlink.Parse(childNode, namespaceManager);
32else if (childNode.LocalName == "hlinkHover")
33ctObj.hlinkHover = CT_Hyperlink.Parse(childNode, namespaceManager);
34else if (childNode.LocalName == "extLst")
35ctObj.extLst = CT_OfficeArtExtensionList.Parse(childNode, namespaceManager);
36}
37return ctObj;
38}
39
40
41
42internal void Write(StreamWriter sw, string nodeName)
43{
44sw.Write(string.Format("<xdr:{0}", nodeName));
45XmlHelper.WriteAttribute(sw, "id", this.id, true);
46XmlHelper.WriteAttribute(sw, "name", this.name);
47XmlHelper.WriteAttribute(sw, "descr", this.descr);
48XmlHelper.WriteAttribute(sw, "hidden", this.hidden, false);
49sw.Write(">");
50if (this.hlinkClick != null)
51this.hlinkClick.Write(sw, "hlinkClick");
52if (this.hlinkHover != null)
53this.hlinkHover.Write(sw, "hlinkHover");
54if (this.extLst != null)
55this.extLst.Write(sw, "extLst");
56sw.Write(string.Format("</xdr:{0}>", nodeName));
57}
58
59private CT_Hyperlink hlinkClickField = null;
60
61private CT_Hyperlink hlinkHoverField = null;
62
63private CT_OfficeArtExtensionList extLstField = null;
64
65private uint idField;
66
67private string nameField = null;
68
69private string descrField;
70
71private bool? hiddenField = null;
72
73[XmlElement(Order = 0)]
74public CT_Hyperlink hlinkClick
75{
76get
77{
78return this.hlinkClickField;
79}
80set
81{
82this.hlinkClickField = value;
83}
84}
85
86[XmlElement(Order = 1)]
87public CT_Hyperlink hlinkHover
88{
89get
90{
91return this.hlinkHoverField;
92}
93set
94{
95this.hlinkHoverField = value;
96}
97}
98
99[XmlElement(Order = 2)]
100public CT_OfficeArtExtensionList extLst
101{
102get
103{
104return this.extLstField;
105}
106set
107{
108this.extLstField = value;
109}
110}
111
112[XmlAttribute]
113public uint id
114{
115get
116{
117return this.idField;
118}
119set
120{
121this.idField = value;
122}
123}
124
125[XmlAttribute]
126public string name
127{
128get
129{
130return this.nameField;
131}
132set
133{
134this.nameField = value;
135}
136}
137
138[XmlAttribute]
139[DefaultValue("")]
140public string descr
141{
142get
143{
144return null == this.descrField ? "" : descrField;
145}
146set
147{
148this.descrField = value;
149}
150}
151[XmlIgnore]
152public bool descrSpecified
153{
154get { return (null != descrField); }
155}
156[XmlAttribute]
157[DefaultValue(false)]
158public bool hidden
159{
160get
161{
162return null == this.hiddenField ? false : (bool)hiddenField;
163}
164set
165{
166this.hiddenField = value;
167}
168}
169
170[XmlIgnore]
171public bool hiddenSpecified
172{
173get { return (null != hiddenField); }
174}
175}
176[Serializable]
177[System.ComponentModel.DesignerCategoryAttribute("code")]
178[XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing")]
179public class CT_NonVisualGraphicFrameProperties
180{
181
182private CT_GraphicalObjectFrameLocking graphicFrameLocksField;
183
184private CT_OfficeArtExtensionList extLstField;
185
186public CT_NonVisualGraphicFrameProperties()
187{
188//this.extLstField = new CT_OfficeArtExtensionList();
189//this.graphicFrameLocksField = new CT_GraphicalObjectFrameLocking();
190}
191public static CT_NonVisualGraphicFrameProperties Parse(XmlNode node, XmlNamespaceManager namespaceManager)
192{
193if (node == null)
194return null;
195CT_NonVisualGraphicFrameProperties ctObj = new CT_NonVisualGraphicFrameProperties();
196foreach (XmlNode childNode in node.ChildNodes)
197{
198if (childNode.LocalName == "graphicFrameLocks")
199ctObj.graphicFrameLocks = CT_GraphicalObjectFrameLocking.Parse(childNode, namespaceManager);
200else if (childNode.LocalName == "extLst")
201ctObj.extLst = CT_OfficeArtExtensionList.Parse(childNode, namespaceManager);
202}
203return ctObj;
204}
205
206
207
208internal void Write(StreamWriter sw, string nodeName)
209{
210sw.Write(string.Format("<xdr:{0}", nodeName));
211sw.Write(">");
212if (this.graphicFrameLocks != null)
213this.graphicFrameLocks.Write(sw, "graphicFrameLocks");
214if (this.extLst != null)
215this.extLst.Write(sw, "extLst");
216sw.Write(string.Format("</xdr:{0}>", nodeName));
217}
218
219[XmlElement(Order = 0)]
220public CT_GraphicalObjectFrameLocking graphicFrameLocks
221{
222get
223{
224return this.graphicFrameLocksField;
225}
226set
227{
228this.graphicFrameLocksField = value;
229}
230}
231
232[XmlElement(Order = 1)]
233public CT_OfficeArtExtensionList extLst
234{
235get
236{
237return this.extLstField;
238}
239set
240{
241this.extLstField = value;
242}
243}
244}
245[Serializable]
246[XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing")]
247public class CT_GraphicalObjectFrameNonVisual
248{
249
250CT_NonVisualDrawingProps cNvPrField;
251CT_NonVisualGraphicFrameProperties cNvGraphicFramePrField;
252public static CT_GraphicalObjectFrameNonVisual Parse(XmlNode node, XmlNamespaceManager namespaceManager)
253{
254if (node == null)
255return null;
256CT_GraphicalObjectFrameNonVisual ctObj = new CT_GraphicalObjectFrameNonVisual();
257foreach (XmlNode childNode in node.ChildNodes)
258{
259if (childNode.LocalName == "cNvPr")
260ctObj.cNvPr = CT_NonVisualDrawingProps.Parse(childNode, namespaceManager);
261else if (childNode.LocalName == "cNvGraphicFramePr")
262ctObj.cNvGraphicFramePr = CT_NonVisualGraphicFrameProperties.Parse(childNode, namespaceManager);
263}
264return ctObj;
265}
266
267
268
269internal void Write(StreamWriter sw, string nodeName)
270{
271sw.Write(string.Format("<xdr:{0}", nodeName));
272sw.Write(">");
273if (this.cNvPr != null)
274this.cNvPr.Write(sw, "cNvPr");
275if (this.cNvGraphicFramePr != null)
276this.cNvGraphicFramePr.Write(sw, "cNvGraphicFramePr");
277sw.Write(string.Format("</xdr:{0}>", nodeName));
278}
279
280public CT_NonVisualDrawingProps AddNewCNvPr()
281{
282this.cNvPrField = new CT_NonVisualDrawingProps();
283return this.cNvPrField;
284}
285public CT_NonVisualGraphicFrameProperties AddNewCNvGraphicFramePr()
286{
287this.cNvGraphicFramePrField = new CT_NonVisualGraphicFrameProperties();
288return this.cNvGraphicFramePrField;
289}
290
291public CT_NonVisualDrawingProps cNvPr
292{
293get { return cNvPrField; }
294set { cNvPrField = value; }
295}
296public CT_NonVisualGraphicFrameProperties cNvGraphicFramePr
297{
298get { return cNvGraphicFramePrField; }
299set { cNvGraphicFramePrField = value; }
300}
301}
302[Serializable]
303[System.ComponentModel.DesignerCategoryAttribute("code")]
304[XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing")]
305public class CT_NonVisualPictureProperties
306{
307public static CT_NonVisualPictureProperties Parse(XmlNode node, XmlNamespaceManager namespaceManager)
308{
309if (node == null)
310return null;
311CT_NonVisualPictureProperties ctObj = new CT_NonVisualPictureProperties();
312ctObj.preferRelativeResize = XmlHelper.ReadBool(node.Attributes["preferRelativeResize"], true);
313foreach (XmlNode childNode in node.ChildNodes)
314{
315if (childNode.LocalName == "picLocks")
316ctObj.picLocks = CT_PictureLocking.Parse(childNode, namespaceManager);
317else if (childNode.LocalName == "extLst")
318ctObj.extLst = CT_OfficeArtExtensionList.Parse(childNode, namespaceManager);
319}
320return ctObj;
321}
322
323
324
325internal void Write(StreamWriter sw, string nodeName)
326{
327sw.Write(string.Format("<xdr:{0}", nodeName));
328if(!preferRelativeResize)
329XmlHelper.WriteAttribute(sw, "preferRelativeResize", this.preferRelativeResize);
330sw.Write(">");
331if (this.picLocks != null)
332this.picLocks.Write(sw, "picLocks");
333if (this.extLst != null)
334this.extLst.Write(sw, "extLst");
335sw.Write(string.Format("</xdr:{0}>", nodeName));
336}
337
338private CT_PictureLocking picLocksField = null;
339
340private CT_OfficeArtExtensionList extLstField = null;
341
342private bool preferRelativeResizeField = true;
343
344public CT_NonVisualPictureProperties()
345{
346}
347
348public CT_PictureLocking AddNewPicLocks()
349{
350this.picLocksField = new CT_PictureLocking();
351return picLocksField;
352}
353
354[XmlElement(Order = 0)]
355public CT_PictureLocking picLocks
356{
357get
358{
359return this.picLocksField;
360}
361set
362{
363this.picLocksField = value;
364}
365}
366
367[XmlElement(Order = 1)]
368public CT_OfficeArtExtensionList extLst
369{
370get
371{
372return this.extLstField;
373}
374set
375{
376this.extLstField = value;
377}
378}
379
380[XmlAttribute]
381public bool preferRelativeResize
382{
383get
384{
385return this.preferRelativeResizeField;
386}
387set
388{
389this.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)]
396public class CT_BlipFillProperties
397{
398
399private CT_Blip blipField = null;
400
401private CT_RelativeRect srcRectField = null;
402
403private CT_TileInfoProperties tileField = null;
404
405private CT_StretchInfoProperties stretchField = null;
406
407private uint dpiField;
408private bool dpiFieldSpecified;
409
410private bool rotWithShapeField;
411
412private bool rotWithShapeFieldSpecified;
413
414public CT_Blip AddNewBlip()
415{
416this.blipField = new CT_Blip();
417return blipField;
418}
419
420public CT_StretchInfoProperties AddNewStretch()
421{
422this.stretchField = new CT_StretchInfoProperties();
423return stretchField;
424}
425
426public static CT_BlipFillProperties Parse(XmlNode node, XmlNamespaceManager namespaceManager)
427{
428if (node == null)
429return null;
430CT_BlipFillProperties ctObj = new CT_BlipFillProperties();
431ctObj.dpi = XmlHelper.ReadUInt(node.Attributes["dpi"]);
432ctObj.rotWithShape = XmlHelper.ReadBool(node.Attributes["rotWithShape"]);
433foreach (XmlNode childNode in node.ChildNodes)
434{
435if (childNode.LocalName == "blip")
436ctObj.blip = CT_Blip.Parse(childNode, namespaceManager);
437else if (childNode.LocalName == "srcRect")
438ctObj.srcRect = CT_RelativeRect.Parse(childNode, namespaceManager);
439else if (childNode.LocalName == "tile")
440ctObj.tile = CT_TileInfoProperties.Parse(childNode, namespaceManager);
441else if (childNode.LocalName == "stretch")
442ctObj.stretch = CT_StretchInfoProperties.Parse(childNode, namespaceManager);
443}
444return ctObj;
445}
446
447
448
449internal void Write(StreamWriter sw, string nodeName)
450{
451sw.Write(string.Format("<xdr:{0}", nodeName));
452XmlHelper.WriteAttribute(sw, "dpi", this.dpi);
453if(rotWithShape)
454XmlHelper.WriteAttribute(sw, "rotWithShape", this.rotWithShape);
455sw.Write(">");
456if (this.blip != null)
457this.blip.Write(sw, "blip");
458if (this.srcRect != null)
459this.srcRect.Write(sw, "srcRect");
460if (this.tile != null)
461this.tile.Write(sw, "tile");
462if (this.stretch != null)
463this.stretch.Write(sw, "stretch");
464sw.Write(string.Format("</xdr:{0}>", nodeName));
465}
466
467[XmlElement(Order = 0)]
468public CT_Blip blip
469{
470get
471{
472return this.blipField;
473}
474set
475{
476this.blipField = value;
477}
478}
479
480[XmlElement(Order = 1)]
481public CT_RelativeRect srcRect
482{
483get
484{
485return this.srcRectField;
486}
487set
488{
489this.srcRectField = value;
490}
491}
492
493[XmlElement(Order = 2)]
494public CT_TileInfoProperties tile
495{
496get
497{
498return this.tileField;
499}
500set
501{
502this.tileField = value;
503}
504}
505
506[XmlElement(Order = 3)]
507public CT_StretchInfoProperties stretch
508{
509get
510{
511return this.stretchField;
512}
513set
514{
515this.stretchField = value;
516}
517}
518
519[XmlAttribute]
520public uint dpi
521{
522get
523{
524return (uint)this.dpiField;
525}
526set
527{
528this.dpiField = value;
529}
530}
531[XmlIgnore]
532public bool dpiSpecified
533{
534get
535{
536return dpiFieldSpecified;
537}
538set
539{
540this.dpiFieldSpecified = value;
541}
542}
543
544
545[XmlAttribute]
546public bool rotWithShape
547{
548get
549{
550return (bool)this.rotWithShapeField;
551}
552set
553{
554this.rotWithShapeField = value;
555}
556}
557[XmlIgnore]
558public bool rotWithShapeSpecified
559{
560get
561{
562return rotWithShapeFieldSpecified;
563}
564set
565{
566this.rotWithShapeFieldSpecified = value;
567}
568}
569
570public bool IsSetBlip()
571{
572return this.blipField != null;
573}
574
575}
576[Serializable]
577[XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing")]
578public class CT_ShapeProperties
579{
580
581private CT_Transform2D xfrmField = null;
582
583private CT_CustomGeometry2D custGeomField = null;
584
585private CT_PresetGeometry2D prstGeomField = null;
586
587private CT_NoFillProperties noFillField = null;
588
589private CT_SolidColorFillProperties solidFillField = null;
590
591private CT_GradientFillProperties gradFillField = null;
592
593private CT_BlipFillProperties blipFillField = null;
594
595private CT_PatternFillProperties pattFillField = null;
596
597private CT_GroupFillProperties grpFillField = null;
598
599private CT_LineProperties lnField = null;
600
601private CT_EffectList effectLstField = null;
602
603private CT_EffectContainer effectDagField = null;
604
605private CT_Scene3D scene3dField = null;
606
607private CT_Shape3D sp3dField = null;
608
609private CT_OfficeArtExtensionList extLstField = null;
610
611private ST_BlackWhiteMode bwModeField = ST_BlackWhiteMode.none;
612
613
614public CT_PresetGeometry2D AddNewPrstGeom()
615{
616this.prstGeomField = new CT_PresetGeometry2D();
617return this.prstGeomField;
618}
619public CT_Transform2D AddNewXfrm()
620{
621this.xfrmField = new CT_Transform2D();
622return this.xfrmField;
623}
624public CT_SolidColorFillProperties AddNewSolidFill()
625{
626this.solidFillField = new CT_SolidColorFillProperties();
627return this.solidFillField;
628}
629public CT_CustomGeometry2D AddNewCustGeom()
630{
631this.custGeomField = new CT_CustomGeometry2D();
632return this.custGeomField;
633}
634public bool IsSetPattFill()
635{
636return this.pattFillField != null;
637}
638public bool IsSetSolidFill()
639{
640return this.solidFillField != null;
641}
642public bool IsSetLn()
643{
644return this.lnField != null;
645}
646public CT_LineProperties AddNewLn()
647{
648this.lnField = new CT_LineProperties();
649return lnField;
650}
651public void unsetPattFill()
652{
653this.pattFill = null;
654}
655public void unsetSolidFill()
656{
657this.solidFill = null;
658}
659
660[XmlElement(Order = 0)]
661public CT_Transform2D xfrm
662{
663get
664{
665return this.xfrmField;
666}
667set
668{
669this.xfrmField = value;
670}
671}
672
673[XmlElement(Order = 1)]
674public CT_CustomGeometry2D custGeom
675{
676get
677{
678return this.custGeomField;
679}
680set
681{
682this.custGeomField = value;
683}
684}
685
686[XmlElement(Order = 2)]
687public CT_PresetGeometry2D prstGeom
688{
689get
690{
691return this.prstGeomField;
692}
693set
694{
695this.prstGeomField = value;
696}
697}
698
699[XmlElement(Order = 3)]
700public CT_NoFillProperties noFill
701{
702get
703{
704return this.noFillField;
705}
706set
707{
708this.noFillField = value;
709}
710}
711
712[XmlElement(Order = 4)]
713public CT_SolidColorFillProperties solidFill
714{
715get
716{
717return this.solidFillField;
718}
719set
720{
721this.solidFillField = value;
722}
723}
724
725[XmlElement(Order = 5)]
726public CT_GradientFillProperties gradFill
727{
728get
729{
730return this.gradFillField;
731}
732set
733{
734this.gradFillField = value;
735}
736}
737
738[XmlElement(Order = 6)]
739public CT_BlipFillProperties blipFill
740{
741get
742{
743return this.blipFillField;
744}
745set
746{
747this.blipFillField = value;
748}
749}
750
751[XmlElement(Order = 7)]
752public CT_PatternFillProperties pattFill
753{
754get
755{
756return this.pattFillField;
757}
758set
759{
760this.pattFillField = value;
761}
762}
763
764[XmlElement(Order = 8)]
765public CT_GroupFillProperties grpFill
766{
767get
768{
769return this.grpFillField;
770}
771set
772{
773this.grpFillField = value;
774}
775}
776
777[XmlElement(Order = 9)]
778public CT_LineProperties ln
779{
780get
781{
782return this.lnField;
783}
784set
785{
786this.lnField = value;
787}
788}
789
790[XmlElement(Order = 10)]
791public CT_EffectList effectLst
792{
793get
794{
795return this.effectLstField;
796}
797set
798{
799this.effectLstField = value;
800}
801}
802
803[XmlElement(Order = 11)]
804public CT_EffectContainer effectDag
805{
806get
807{
808return this.effectDagField;
809}
810set
811{
812this.effectDagField = value;
813}
814}
815
816[XmlElement(Order = 12)]
817public CT_Scene3D scene3d
818{
819get
820{
821return this.scene3dField;
822}
823set
824{
825this.scene3dField = value;
826}
827}
828
829[XmlElement(Order = 13)]
830public CT_Shape3D sp3d
831{
832get
833{
834return this.sp3dField;
835}
836set
837{
838this.sp3dField = value;
839}
840}
841
842[XmlElement(Order = 14)]
843public CT_OfficeArtExtensionList extLst
844{
845get
846{
847return this.extLstField;
848}
849set
850{
851this.extLstField = value;
852}
853}
854
855[XmlAttribute]
856public ST_BlackWhiteMode bwMode
857{
858get
859{
860return this.bwModeField;
861}
862set
863{
864this.bwModeField = value;
865}
866}
867[XmlIgnore]
868public bool bwModeSpecified
869{
870get { return ST_BlackWhiteMode.none != this.bwModeField; }
871}
872
873public static CT_ShapeProperties Parse(XmlNode node, XmlNamespaceManager namespaceManager)
874{
875if (node == null)
876return null;
877CT_ShapeProperties ctObj = new CT_ShapeProperties();
878if (node.Attributes["bwMode"] != null)
879ctObj.bwMode = (ST_BlackWhiteMode)Enum.Parse(typeof(ST_BlackWhiteMode), node.Attributes["bwMode"].Value);
880foreach (XmlNode childNode in node.ChildNodes)
881{
882if (childNode.LocalName == "xfrm")
883ctObj.xfrm = CT_Transform2D.Parse(childNode, namespaceManager);
884else if (childNode.LocalName == "custGeom")
885ctObj.custGeom = CT_CustomGeometry2D.Parse(childNode, namespaceManager);
886else if (childNode.LocalName == "prstGeom")
887ctObj.prstGeom = CT_PresetGeometry2D.Parse(childNode, namespaceManager);
888else if (childNode.LocalName == "noFill")
889ctObj.noFill = new CT_NoFillProperties();
890else if (childNode.LocalName == "solidFill")
891ctObj.solidFill = CT_SolidColorFillProperties.Parse(childNode, namespaceManager);
892else if (childNode.LocalName == "gradFill")
893ctObj.gradFill = CT_GradientFillProperties.Parse(childNode, namespaceManager);
894else if (childNode.LocalName == "blipFill")
895ctObj.blipFill = CT_BlipFillProperties.Parse(childNode, namespaceManager);
896else if (childNode.LocalName == "pattFill")
897ctObj.pattFill = CT_PatternFillProperties.Parse(childNode, namespaceManager);
898else if (childNode.LocalName == "grpFill")
899ctObj.grpFill = new CT_GroupFillProperties();
900else if (childNode.LocalName == "ln")
901ctObj.ln = CT_LineProperties.Parse(childNode, namespaceManager);
902else if (childNode.LocalName == "effectLst")
903ctObj.effectLst = CT_EffectList.Parse(childNode, namespaceManager);
904else if (childNode.LocalName == "effectDag")
905ctObj.effectDag = CT_EffectContainer.Parse(childNode, namespaceManager);
906else if (childNode.LocalName == "scene3d")
907ctObj.scene3d = CT_Scene3D.Parse(childNode, namespaceManager);
908else if (childNode.LocalName == "sp3d")
909ctObj.sp3d = CT_Shape3D.Parse(childNode, namespaceManager);
910else if (childNode.LocalName == "extLst")
911ctObj.extLst = CT_OfficeArtExtensionList.Parse(childNode, namespaceManager);
912}
913return ctObj;
914}
915
916
917
918internal void Write(StreamWriter sw, string nodeName)
919{
920sw.Write(string.Format("<xdr:{0}", nodeName));
921if(bwMode!= ST_BlackWhiteMode.none)
922XmlHelper.WriteAttribute(sw, "bwMode", this.bwMode.ToString());
923sw.Write(">");
924if (this.xfrm != null)
925this.xfrm.Write(sw, "a:xfrm");
926if (this.custGeom != null)
927this.custGeom.Write(sw, "custGeom");
928if (this.prstGeom != null)
929this.prstGeom.Write(sw, "prstGeom");
930if (this.noFill != null)
931sw.Write("<a:noFill/>");
932if (this.solidFill != null)
933this.solidFill.Write(sw, "solidFill");
934if (this.gradFill != null)
935this.gradFill.Write(sw, "gradFill");
936if (this.blipFill != null)
937this.blipFill.Write(sw, "blipFill");
938if (this.pattFill != null)
939this.pattFill.Write(sw, "pattFill");
940if (this.grpFill != null)
941sw.Write("<a:grpFill/>");
942if (this.ln != null)
943this.ln.Write(sw, "ln");
944if (this.effectLst != null)
945this.effectLst.Write(sw, "effectLst");
946if (this.effectDag != null)
947this.effectDag.Write(sw, "effectDag");
948if (this.scene3d != null)
949this.scene3d.Write(sw, "scene3d");
950if (this.sp3d != null)
951this.sp3d.Write(sw, "sp3d");
952if (this.extLst != null)
953this.extLst.Write(sw, "extLst");
954sw.Write(string.Format("</xdr:{0}>", nodeName));
955}
956
957}
958
959
960[Serializable]
961[XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing")]
962public class CT_GraphicalObjectFrame
963{
964CT_GraphicalObjectFrameNonVisual nvGraphicFramePrField;
965CT_Transform2D xfrmField;
966CT_GraphicalObject graphicField;
967private string macroField;
968private bool fPublishedField;
969
970public void Set(CT_GraphicalObjectFrame obj)
971{
972this.xfrmField = obj.xfrmField;
973this.graphicField = obj.graphicField;
974this.nvGraphicFramePrField = obj.nvGraphicFramePrField;
975this.macroField = obj.macroField;
976this.fPublishedField = obj.fPublishedField;
977}
978
979public CT_Transform2D AddNewXfrm()
980{
981this.xfrmField = new CT_Transform2D();
982return this.xfrmField;
983}
984public CT_GraphicalObject AddNewGraphic()
985{
986this.graphicField = new CT_GraphicalObject();
987return this.graphicField;
988}
989
990public CT_GraphicalObjectFrameNonVisual AddNewNvGraphicFramePr()
991{
992this.nvGraphicFramePr = new CT_GraphicalObjectFrameNonVisual();
993return this.nvGraphicFramePr;
994}
995[XmlElement]
996public CT_GraphicalObjectFrameNonVisual nvGraphicFramePr
997{
998get { return nvGraphicFramePrField; }
999set { nvGraphicFramePrField = value; }
1000}
1001[XmlElement]
1002public CT_Transform2D xfrm
1003{
1004get { return xfrmField; }
1005set { xfrmField = value; }
1006}
1007[XmlAttribute]
1008public string macro
1009{
1010get { return macroField; }
1011set { macroField = value; }
1012}
1013[XmlAttribute]
1014[DefaultValue(false)]
1015public bool fPublished
1016{
1017get { return fPublishedField; }
1018set { fPublishedField = value; }
1019}
1020[XmlElement]
1021public CT_GraphicalObject graphic
1022{
1023get { return graphicField; }
1024set { graphicField = value; }
1025}
1026public static CT_GraphicalObjectFrame Parse(XmlNode node, XmlNamespaceManager namespaceManager)
1027{
1028if (node == null)
1029return null;
1030CT_GraphicalObjectFrame ctObj = new CT_GraphicalObjectFrame();
1031ctObj.macro = XmlHelper.ReadString(node.Attributes["macro"]);
1032ctObj.fPublished = XmlHelper.ReadBool(node.Attributes["fPublished"]);
1033foreach (XmlNode childNode in node.ChildNodes)
1034{
1035if (childNode.LocalName == "nvGraphicFramePr")
1036ctObj.nvGraphicFramePr = CT_GraphicalObjectFrameNonVisual.Parse(childNode, namespaceManager);
1037else if (childNode.LocalName == "xfrm")
1038ctObj.xfrm = CT_Transform2D.Parse(childNode, namespaceManager);
1039else if (childNode.LocalName == "graphic")
1040ctObj.graphic = CT_GraphicalObject.Parse(childNode, namespaceManager);
1041}
1042return ctObj;
1043}
1044
1045
1046
1047internal void Write(StreamWriter sw, string nodeName)
1048{
1049sw.Write(string.Format("<xdr:{0}", nodeName));
1050XmlHelper.WriteAttribute(sw, "macro", this.macro, true);
1051XmlHelper.WriteAttribute(sw, "fPublished", this.fPublished, false);
1052sw.Write(">");
1053if (this.nvGraphicFramePr != null)
1054this.nvGraphicFramePr.Write(sw, "nvGraphicFramePr");
1055if (this.xfrm != null)
1056this.xfrm.Write(sw, "xdr:xfrm");
1057if (this.graphic != null)
1058this.graphic.Write(sw, "graphic");
1059sw.Write(string.Format("</xdr:{0}>", nodeName));
1060}
1061
1062}
1063
1064
1065
1066[Serializable]
1067[XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing")]
1068public class CT_ConnectorNonVisual
1069{
1070private CT_NonVisualDrawingProps cNvPrField;
1071private CT_NonVisualConnectorProperties cNvCxnSpPrField;
1072
1073public CT_NonVisualConnectorProperties cNvCxnSpPr
1074{
1075get
1076{
1077return this.cNvCxnSpPrField;
1078}
1079set
1080{
1081this.cNvCxnSpPrField = value;
1082}
1083}
1084public CT_NonVisualDrawingProps AddNewCNvPr()
1085{
1086this.cNvPr = new CT_NonVisualDrawingProps();
1087return this.cNvPr;
1088}
1089public CT_NonVisualConnectorProperties AddNewCNvCxnSpPr()
1090{
1091this.cNvCxnSpPr = new CT_NonVisualConnectorProperties();
1092return this.cNvCxnSpPr;
1093}
1094
1095
1096public CT_NonVisualDrawingProps cNvPr
1097{
1098get
1099{
1100return this.cNvPrField;
1101}
1102set
1103{
1104this.cNvPrField = value;
1105}
1106}
1107public static CT_ConnectorNonVisual Parse(XmlNode node, XmlNamespaceManager namespaceManager)
1108{
1109if (node == null)
1110return null;
1111CT_ConnectorNonVisual ctObj = new CT_ConnectorNonVisual();
1112foreach (XmlNode childNode in node.ChildNodes)
1113{
1114if (childNode.LocalName == "cNvCxnSpPr")
1115ctObj.cNvCxnSpPr = CT_NonVisualConnectorProperties.Parse(childNode, namespaceManager);
1116else if (childNode.LocalName == "cNvPr")
1117ctObj.cNvPr = CT_NonVisualDrawingProps.Parse(childNode, namespaceManager);
1118}
1119return ctObj;
1120}
1121
1122internal void Write(StreamWriter sw, string nodeName)
1123{
1124sw.Write(string.Format("<xdr:{0}", nodeName));
1125sw.Write(">");
1126if (this.cNvPr != null)
1127this.cNvPr.Write(sw, "cNvPr");
1128if (this.cNvCxnSpPr != null)
1129this.cNvCxnSpPr.Write(sw, "cNvCxnSpPr");
1130sw.Write(string.Format("</xdr:{0}>", nodeName));
1131}
1132
1133
1134}
1135
1136
1137[Serializable]
1138[XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing")]
1139public class CT_Marker
1140{
1141private int _col;
1142private long _colOff;
1143private int _row;
1144private long _rowOff;
1145
1146public int col
1147{
1148get
1149{
1150return _col;
1151}
1152set
1153{
1154_col = value;
1155}
1156}
1157public long colOff
1158{
1159get
1160{
1161return _colOff;
1162}
1163set
1164{
1165_colOff = value;
1166}
1167}
1168public int row
1169{
1170get { return _row; }
1171set { _row = value; }
1172}
1173public long rowOff
1174{
1175get
1176{
1177return _rowOff;
1178}
1179set
1180{
1181_rowOff = value;
1182}
1183}
1184
1185public static CT_Marker Parse(XmlNode node, XmlNamespaceManager nameSpaceManager)
1186{
1187CT_Marker ctMarker = new CT_Marker();
1188foreach (XmlNode subnode in node.ChildNodes)
1189{
1190if (subnode.LocalName == "col")
1191{
1192ctMarker.col = Int32.Parse(subnode.InnerText);
1193}
1194else if (subnode.LocalName == "colOff")
1195{
1196ctMarker.colOff = Int64.Parse(subnode.InnerText);
1197}
1198else if (subnode.LocalName == "row")
1199{
1200ctMarker.row = Int32.Parse(subnode.InnerText);
1201}
1202else if (subnode.LocalName == "rowOff")
1203{
1204ctMarker.rowOff = Int64.Parse(subnode.InnerText);
1205}
1206}
1207return ctMarker;
1208}
1209
1210public override string ToString()
1211{
1212StringBuilder sb=new StringBuilder();
1213using(StringWriter sw =new StringWriter(sb))
1214{
1215sw.Write("<xdr:col>");
1216sw.Write(this.col.ToString());
1217sw.Write("</xdr:col>");
1218sw.Write("<xdr:colOff>");
1219sw.Write(this.colOff.ToString());
1220sw.Write("</xdr:colOff>");
1221sw.Write("<xdr:row>");
1222sw.Write(this.row.ToString());
1223sw.Write("</xdr:row>");
1224sw.Write("<xdr:rowOff>");
1225sw.Write(this.rowOff.ToString());
1226sw.Write("</xdr:rowOff>");
1227}
1228return sb.ToString();
1229}
1230
1231internal void Write(StreamWriter sw, string nodeName)
1232{
1233sw.Write(string.Format("<{0}>", nodeName));
1234sw.Write("<xdr:col>");
1235sw.Write(this.col.ToString());
1236sw.Write("</xdr:col>");
1237sw.Write("<xdr:colOff>");
1238sw.Write(this.colOff.ToString());
1239sw.Write("</xdr:colOff>");
1240sw.Write("<xdr:row>");
1241sw.Write(this.row.ToString());
1242sw.Write("</xdr:row>");
1243sw.Write("<xdr:rowOff>");
1244sw.Write(this.rowOff.ToString());
1245sw.Write("</xdr:rowOff>");
1246sw.Write(string.Format("</{0}>", nodeName));
1247}
1248}
1249public enum ST_EditAs
1250{
1251NONE,
1252twoCell,
1253oneCell,
1254absolute
1255}
1256
1257[Serializable]
1258[XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing")]
1259public class CT_AnchorClientData
1260{
1261
1262public static CT_AnchorClientData Parse(XmlNode node, XmlNamespaceManager namespaceManager)
1263{
1264if (node == null)
1265return null;
1266CT_AnchorClientData ctObj = new CT_AnchorClientData();
1267ctObj.fLocksWithSheet = XmlHelper.ReadBool(node.Attributes["fLocksWithSheet"], true);
1268ctObj.fPrintsWithSheet = XmlHelper.ReadBool(node.Attributes["fPrintsWithSheet"], true);
1269return ctObj;
1270}
1271
1272
1273
1274internal void Write(StreamWriter sw, string nodeName)
1275{
1276sw.Write(string.Format("<xdr:{0}", nodeName));
1277XmlHelper.WriteAttribute(sw, "fLocksWithSheet", this.fLocksWithSheet, false, true);
1278XmlHelper.WriteAttribute(sw, "fPrintsWithSheet", this.fPrintsWithSheet, false, true);
1279sw.Write("/>");
1280}
1281bool _fLocksWithSheet = true;
1282bool _fPrintsWithSheet = true;
1283
1284[XmlAttribute]
1285public bool fLocksWithSheet
1286{
1287get
1288{
1289return _fLocksWithSheet;
1290}
1291set
1292{
1293_fLocksWithSheet = value;
1294}
1295}
1296[XmlAttribute]
1297public bool fPrintsWithSheet
1298{
1299get
1300{
1301return _fPrintsWithSheet;
1302}
1303set
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)]
1315public class CT_Drawing
1316{
1317private List<IEG_Anchor> cellAnchors = new List<IEG_Anchor>();
1318//private List<CT_AbsoulteCellAnchor> absoluteCellAnchors = new List<CT_AbsoulteCellAnchor>();
1319
1320public CT_TwoCellAnchor AddNewTwoCellAnchor()
1321{
1322CT_TwoCellAnchor anchor = new CT_TwoCellAnchor();
1323cellAnchors.Add(anchor);
1324return anchor;
1325}
1326public int SizeOfTwoCellAnchorArray()
1327{
1328int count = 0;
1329foreach (IEG_Anchor anchor in cellAnchors)
1330{
1331if (anchor is CT_TwoCellAnchor)
1332{
1333count++;
1334}
1335}
1336return count;
1337}
1338
1339public void Save(Stream stream)
1340{
1341using (StreamWriter sw = new StreamWriter(stream))
1342{
1343sw.Write("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>");
1344sw.Write("<xdr:wsDr xmlns:xdr=\"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\">");
1345foreach (IEG_Anchor anchor in this.cellAnchors)
1346{
1347anchor.Write(sw);
1348}
1349sw.Write("</xdr:wsDr>");
1350}
1351}
1352
1353[XmlIgnore]
1354public List<IEG_Anchor> CellAnchors
1355{
1356get { return cellAnchors; }
1357set { cellAnchors = value; }
1358}
1359
1360//[XmlElement("absoluteAnchor")]
1361//public List<CT_TwoCellAnchor> AbsoluteAnchors
1362//{
1363// get { return absoluteAnchors; }
1364// set { absoluteAnchors = value; }
1365//}
1366
1367public void Set(CT_Drawing ctDrawing)
1368{
1369this.cellAnchors.Clear();
1370foreach (IEG_Anchor anchor in ctDrawing.cellAnchors)
1371{
1372this.cellAnchors.Add(anchor);
1373}
1374}
1375
1376public int SizeOfAbsoluteAnchorArray()
1377{
1378return 0;
1379}
1380
1381public int SizeOfOneCellAnchorArray()
1382{
1383int count = 0;
1384foreach (IEG_Anchor anchor in cellAnchors)
1385{
1386if (anchor is CT_OneCellAnchor)
1387{
1388count++;
1389}
1390}
1391return count;
1392}
1393
1394public static CT_Drawing Parse(XmlDocument xmldoc, XmlNamespaceManager namespaceManager)
1395{
1396XmlNodeList cellanchorNodes = xmldoc.SelectNodes("/xdr:wsDr/*", namespaceManager);
1397CT_Drawing ctDrawing = new CT_Drawing();
1398foreach (XmlNode node in cellanchorNodes)
1399{
1400if (node.LocalName == "twoCellAnchor")
1401{
1402CT_TwoCellAnchor twoCellAnchor = CT_TwoCellAnchor.Parse(node, namespaceManager);
1403ctDrawing.cellAnchors.Add(twoCellAnchor);
1404}
1405else if (node.LocalName == "oneCellAnchor")
1406{
1407CT_OneCellAnchor oneCellAnchor = CT_OneCellAnchor.Parse(node, namespaceManager);
1408ctDrawing.cellAnchors.Add(oneCellAnchor);
1409}
1410else if (node.LocalName == "absCellAnchor")
1411{
1412CT_AbsoluteCellAnchor absCellAnchor = CT_AbsoluteCellAnchor.Parse(node, namespaceManager);
1413ctDrawing.cellAnchors.Add(absCellAnchor);
1414}
1415}
1416return ctDrawing;
1417}
1418}
1419[Serializable]
1420[XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing")]
1421public class CT_LegacyDrawing
1422{
1423
1424private string idField;
1425
1426[XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified, Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/relationships")]
1427public string id
1428{
1429get
1430{
1431return this.idField;
1432}
1433set
1434{
1435this.idField = value;
1436}
1437}
1438}
1439[XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing")]
1440public class CT_OneCellAnchor: IEG_Anchor
1441{
1442private CT_Marker fromField = new CT_Marker();
1443private CT_PositiveSize2D extField; //= new CT_PositiveSize2D();
1444private CT_AnchorClientData clientDataField = new CT_AnchorClientData(); // 1..1 element
1445private CT_Shape shapeField = null;
1446private CT_GroupShape groupShapeField = null;
1447private CT_GraphicalObjectFrame graphicalObjectField = null;
1448private CT_Connector connectorField = null;
1449private CT_Picture pictureField = null;
1450
1451[XmlElement]
1452public CT_Marker from
1453{
1454get { return fromField; }
1455set { fromField = value; }
1456}
1457CT_AlternateContent alternateContentField = null;
1458public CT_AlternateContent alternateContent
1459{
1460get
1461{
1462return alternateContentField;
1463}
1464set
1465{
1466this.alternateContentField = value;
1467}
1468}
1469[XmlElement]
1470public CT_PositiveSize2D ext
1471{
1472get { return this.extField; }
1473set { this.extField = value; }
1474}
1475public CT_AnchorClientData AddNewClientData()
1476{
1477this.clientDataField = new CT_AnchorClientData();
1478return this.clientDataField;
1479}
1480[XmlElement]
1481public CT_AnchorClientData clientData
1482{
1483get { return clientDataField; }
1484set { clientDataField = value; }
1485}
1486public CT_Shape sp
1487{
1488get { return shapeField; }
1489set { shapeField = value; }
1490}
1491public CT_GroupShape groupShape
1492{
1493get { return groupShapeField; }
1494set { groupShapeField = value; }
1495}
1496public CT_GraphicalObjectFrame graphicFrame
1497{
1498get { return graphicalObjectField; }
1499set { graphicalObjectField = value; }
1500}
1501public CT_Connector connector
1502{
1503get { return connectorField; }
1504set { connectorField = value; }
1505}
1506public CT_Picture picture
1507{
1508get { return pictureField; }
1509set { pictureField = value; }
1510}
1511
1512public void Write(StreamWriter sw)
1513{
1514sw.Write("<xdr:oneCellAnchor>");
1515this.from.Write(sw, "xdr:from");
1516this.ext.Write(sw, "xdr:ext");
1517if (this.sp != null)
1518sp.Write(sw, "sp");
1519else if (this.connector != null)
1520this.connector.Write(sw, "cxnSp");
1521else if (this.groupShape != null)
1522this.groupShape.Write(sw, "grpSp");
1523else if (this.graphicalObjectField != null)
1524this.graphicalObjectField.Write(sw, "graphicFrame");
1525else if (this.pictureField != null)
1526this.picture.Write(sw, "pic");
1527if (this.alternateContent != null)
1528{
1529this.alternateContent.Write(sw, "AlternateContent");
1530}
1531if (this.clientData != null)
1532this.clientData.Write(sw, "clientData");
1533sw.Write("</xdr:oneCellAnchor>");
1534}
1535
1536internal static CT_OneCellAnchor Parse(XmlNode node, XmlNamespaceManager namespaceManager)
1537{
1538CT_OneCellAnchor oneCellAnchor = new CT_OneCellAnchor();
1539foreach (XmlNode childNode in node.ChildNodes)
1540{
1541if (childNode.LocalName == "from")
1542{
1543oneCellAnchor.from = CT_Marker.Parse(childNode, namespaceManager);
1544}
1545else if (childNode.LocalName == "ext")
1546{
1547oneCellAnchor.ext = CT_PositiveSize2D.Parse(childNode, namespaceManager);
1548}
1549else if (childNode.LocalName == "sp")
1550{
1551oneCellAnchor.sp = CT_Shape.Parse(childNode, namespaceManager); ;
1552}
1553else if (childNode.LocalName == "pic")
1554{
1555oneCellAnchor.picture = CT_Picture.Parse(childNode, namespaceManager);
1556}
1557else if (childNode.LocalName == "cxnSp")
1558{
1559oneCellAnchor.connector = CT_Connector.Parse(childNode, namespaceManager);
1560}
1561else if (childNode.LocalName == "grpSp")
1562{
1563oneCellAnchor.groupShape = CT_GroupShape.Parse(childNode, namespaceManager);
1564}
1565else if (childNode.LocalName == "graphicFrame")
1566{
1567oneCellAnchor.graphicFrame = CT_GraphicalObjectFrame.Parse(childNode, namespaceManager);
1568}
1569else if (childNode.LocalName == "AlternateContent")
1570{
1571oneCellAnchor.alternateContent = CT_AlternateContent.Parse(childNode, namespaceManager);
1572}
1573else if (childNode.LocalName == "clientData")
1574{
1575oneCellAnchor.clientData = CT_AnchorClientData.Parse(childNode, namespaceManager);
1576}
1577}
1578return oneCellAnchor;
1579}
1580}
1581
1582public interface IEG_Anchor
1583{
1584CT_Shape sp { get; set; }
1585CT_Connector connector { get; set; }
1586CT_GraphicalObjectFrame graphicFrame { get; set; }
1587CT_Picture picture { get; set; }
1588CT_GroupShape groupShape { get; set; }
1589CT_AnchorClientData clientData { get; set; }
1590void Write(StreamWriter sw);
1591}
1592public class CT_AbsoluteCellAnchor : IEG_Anchor
1593{
1594CT_Point2D posField;
1595CT_PositiveSize2D extField;
1596CT_AnchorClientData clientDataField = new CT_AnchorClientData();
1597private CT_Shape shapeField = null;
1598private CT_GroupShape groupShapeField = null;
1599private CT_GraphicalObjectFrame graphicalObjectField = null;
1600private CT_Connector connectorField = null;
1601private CT_Picture pictureField = null;
1602public static CT_AbsoluteCellAnchor Parse(XmlNode node, XmlNamespaceManager namespaceManager)
1603{
1604CT_AbsoluteCellAnchor absCellAnchor = new CT_AbsoluteCellAnchor();
1605foreach (XmlNode childNode in node.ChildNodes)
1606{
1607if (childNode.LocalName == "pos")
1608{
1609absCellAnchor.pos = CT_Point2D.Parse(childNode, namespaceManager);
1610}
1611else if (childNode.LocalName == "ext")
1612{
1613absCellAnchor.ext = CT_PositiveSize2D.Parse(childNode, namespaceManager);
1614}
1615else if (childNode.LocalName == "sp")
1616{
1617absCellAnchor.sp = CT_Shape.Parse(childNode, namespaceManager); ;
1618}
1619else if (childNode.LocalName == "pic")
1620{
1621absCellAnchor.picture = CT_Picture.Parse(childNode, namespaceManager);
1622}
1623else if (childNode.LocalName == "cxnSp")
1624{
1625absCellAnchor.connector = CT_Connector.Parse(childNode, namespaceManager);
1626}
1627else if (childNode.LocalName == "grpSp")
1628{
1629absCellAnchor.groupShape = CT_GroupShape.Parse(childNode, namespaceManager);
1630}
1631else if (childNode.LocalName == "graphicFrame")
1632{
1633absCellAnchor.graphicFrame = CT_GraphicalObjectFrame.Parse(childNode, namespaceManager);
1634}
1635else if (childNode.LocalName == "clientData")
1636{
1637absCellAnchor.clientData = CT_AnchorClientData.Parse(childNode, namespaceManager);
1638}
1639}
1640return absCellAnchor;
1641}
1642
1643public CT_AnchorClientData clientData
1644{
1645get { return clientDataField; }
1646set { clientDataField = value; }
1647}
1648
1649public CT_Point2D AddNewOff()
1650{
1651this.posField = new CT_Point2D();
1652return this.posField;
1653}
1654
1655public CT_Point2D pos
1656{
1657get
1658{
1659return this.posField;
1660}
1661set
1662{
1663this.posField = value;
1664}
1665}
1666public CT_PositiveSize2D ext
1667{
1668get { return this.extField; }
1669set { this.extField = value; }
1670}
1671public CT_AnchorClientData AddNewClientData()
1672{
1673this.clientDataField = new CT_AnchorClientData();
1674return this.clientDataField;
1675}
1676public CT_Shape sp
1677{
1678get { return shapeField; }
1679set { shapeField = value; }
1680}
1681public CT_GroupShape groupShape
1682{
1683get { return groupShapeField; }
1684set { groupShapeField = value; }
1685}
1686public CT_GraphicalObjectFrame graphicFrame
1687{
1688get { return graphicalObjectField; }
1689set { graphicalObjectField = value; }
1690}
1691public CT_Connector connector
1692{
1693get { return connectorField; }
1694set { connectorField = value; }
1695}
1696public CT_Picture picture
1697{
1698get { return pictureField; }
1699set { pictureField = value; }
1700}
1701public void Write(StreamWriter sw)
1702{
1703sw.Write("<xdr:absCellAnchor>");
1704if (this.pos!=null)
1705this.pos.Write(sw, "pos");
1706if (this.sp != null)
1707sp.Write(sw, "sp");
1708else if (this.connector != null)
1709this.connector.Write(sw, "cxnSp");
1710else if (this.groupShape != null)
1711this.groupShape.Write(sw, "grpSp");
1712else if (this.graphicalObjectField != null)
1713this.graphicalObjectField.Write(sw, "graphicFrame");
1714else if (this.pictureField != null)
1715this.picture.Write(sw, "pic");
1716
1717if (this.clientData != null)
1718{
1719this.clientData.Write(sw, "clientData");
1720}
1721sw.Write("</xdr:absCellAnchor>");
1722}
1723}
1724[Serializable]
1725[XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing")]
1726public class CT_TwoCellAnchor : IEG_Anchor //- was empty interface
1727{
1728private CT_Marker fromField = new CT_Marker(); // 1..1 element
1729private 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
1731private CT_Shape shapeField = null;
1732private CT_GroupShape groupShapeField = null;
1733private CT_GraphicalObjectFrame graphicalObjectField = null;
1734private CT_Connector connectorField = null;
1735private CT_Picture pictureField = null;
1736
1737private CT_AnchorClientData clientDataField = null; // 1..1 element
1738
1739private ST_EditAs editAsField = ST_EditAs.NONE; // 0..1 attribute
1740
1741public CT_TwoCellAnchor()
1742{
1743this.clientDataField = new CT_AnchorClientData();
1744}
1745
1746public CT_Shape AddNewSp()
1747{
1748shapeField = new CT_Shape();
1749return shapeField;
1750}
1751
1752public CT_GroupShape AddNewGrpSp()
1753{
1754groupShapeField = new CT_GroupShape();
1755return groupShapeField;
1756}
1757
1758public CT_GraphicalObjectFrame AddNewGraphicFrame()
1759{
1760graphicalObjectField = new CT_GraphicalObjectFrame();
1761return graphicalObjectField;
1762}
1763
1764public CT_Connector AddNewCxnSp()
1765{
1766connectorField = new CT_Connector();
1767return connectorField;
1768}
1769
1770public CT_Picture AddNewPic()
1771{
1772pictureField = new CT_Picture();
1773return pictureField;
1774}
1775
1776public CT_AnchorClientData AddNewClientData()
1777{
1778this.clientDataField = new CT_AnchorClientData();
1779return this.clientDataField;
1780}
1781[XmlElement]
1782public CT_AnchorClientData clientData
1783{
1784get { return clientDataField; }
1785set { clientDataField = value; }
1786}
1787[XmlAttribute]
1788public ST_EditAs editAs
1789{
1790get { return editAsField; }
1791set { editAsField = value; }
1792}
1793bool editAsSpecifiedField = false;
1794[XmlIgnore]
1795public bool editAsSpecified
1796{
1797get { return editAsSpecifiedField; }
1798set { editAsSpecifiedField = value; }
1799}
1800
1801[XmlElement]
1802public CT_Marker from
1803{
1804get { return fromField; }
1805set { fromField = value; }
1806}
1807
1808[XmlElement]
1809public CT_Marker to
1810{
1811get { return toField; }
1812set { toField = value; }
1813}
1814
1815private Vml.CT_AlternateContent alternateContentField = null;
1816
1817public Vml.CT_AlternateContent alternateContent
1818{
1819get
1820{
1821return alternateContentField;
1822}
1823set
1824{
1825this.alternateContentField = value;
1826}
1827}
1828
1829#region Choice - one of CT_Shape, CT_GroupShape, CT_GraphicalObjectFrame, CT_Connector or CT_Picture
1830
1831[XmlElement]
1832public CT_Shape sp
1833{
1834get { return shapeField; }
1835set { shapeField = value; }
1836}
1837[XmlElement]
1838public CT_GroupShape groupShape
1839{
1840get { return groupShapeField; }
1841set { groupShapeField = value; }
1842}
1843
1844[XmlElement]
1845public CT_GraphicalObjectFrame graphicFrame
1846{
1847get { return graphicalObjectField; }
1848set { graphicalObjectField = value; }
1849}
1850
1851[XmlElement]
1852public CT_Connector connector
1853{
1854get { return connectorField; }
1855set { connectorField = value; }
1856}
1857
1858[XmlElement("pic")]
1859public CT_Picture picture
1860{
1861get { return pictureField; }
1862set { pictureField = value; }
1863}
1864
1865#endregion Choice - one of CT_Shape, CT_GroupShape, CT_GraphicalObjectFrame, CT_Connector or CT_Picture
1866
1867public void Write(StreamWriter sw)
1868{
1869sw.Write("<xdr:twoCellAnchor");
1870if(this.editAsField!= ST_EditAs.NONE)
1871sw.Write(string.Format(" editAs=\"{0}\"",this.editAsField.ToString()));
1872sw.Write(">");
1873this.from.Write(sw, "xdr:from");
1874this.to.Write(sw, "xdr:to");
1875if (this.sp != null)
1876sp.Write(sw, "sp");
1877else if (this.connector != null)
1878this.connector.Write(sw, "cxnSp");
1879else if (this.groupShape != null)
1880this.groupShape.Write(sw, "grpSp");
1881else if (this.graphicalObjectField != null)
1882this.graphicalObjectField.Write(sw, "graphicFrame");
1883else if (this.pictureField != null)
1884this.picture.Write(sw, "pic");
1885if (this.alternateContent != null)
1886{
1887this.alternateContent.Write(sw, "AlternateContent");
1888}
1889if (this.clientData != null)
1890{
1891this.clientData.Write(sw, "clientData");
1892}
1893sw.Write("</xdr:twoCellAnchor>");
1894}
1895
1896internal static CT_TwoCellAnchor Parse(XmlNode node, XmlNamespaceManager namespaceManager)
1897{
1898CT_TwoCellAnchor twoCellAnchor = new CT_TwoCellAnchor();
1899if (node.Attributes["editAs"] != null)
1900twoCellAnchor.editAs = (ST_EditAs)Enum.Parse(typeof(ST_EditAs), node.Attributes["editAs"].Value);
1901
1902foreach(XmlNode childNode in node.ChildNodes)
1903{
1904if (childNode.LocalName == "from")
1905{
1906twoCellAnchor.from = CT_Marker.Parse(childNode, namespaceManager);
1907}
1908else if (childNode.LocalName == "to")
1909{
1910twoCellAnchor.to = CT_Marker.Parse(childNode, namespaceManager);
1911}
1912else if (childNode.LocalName == "sp")
1913{
1914twoCellAnchor.sp = CT_Shape.Parse(childNode, namespaceManager); ;
1915}
1916else if (childNode.LocalName == "pic")
1917{
1918twoCellAnchor.picture = CT_Picture.Parse(childNode, namespaceManager);
1919}
1920else if (childNode.LocalName == "cxnSp")
1921{
1922twoCellAnchor.connector = CT_Connector.Parse(childNode, namespaceManager);
1923}
1924else if (childNode.LocalName == "grpSp")
1925{
1926twoCellAnchor.groupShape = CT_GroupShape.Parse(childNode, namespaceManager);
1927}
1928else if (childNode.LocalName == "graphicFrame")
1929{
1930twoCellAnchor.graphicFrame = CT_GraphicalObjectFrame.Parse(childNode, namespaceManager);
1931}
1932else if (childNode.LocalName == "AlternateContent")
1933{
1934twoCellAnchor.alternateContent = Vml.CT_AlternateContent.Parse(childNode, namespaceManager);
1935}
1936else if (childNode.LocalName == "clientData")
1937{
1938twoCellAnchor.clientData = CT_AnchorClientData.Parse(childNode, namespaceManager);
1939}
1940}
1941return twoCellAnchor;
1942}
1943}
1944
1945[Serializable]
1946[XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing")]
1947public class CT_Connector // empty interface: EG_ObjectChoices
1948{
1949string macroField;
1950bool fPublishedField;
1951private CT_ShapeProperties spPrField;
1952private CT_ShapeStyle styleField;
1953private CT_ConnectorNonVisual nvCxnSpPrField;
1954public CT_ConnectorNonVisual nvCxnSpPr
1955{
1956get { return nvCxnSpPrField; }
1957set { nvCxnSpPrField = value; }
1958}
1959public static CT_Connector Parse(XmlNode node, XmlNamespaceManager namespaceManager)
1960{
1961if (node == null)
1962return null;
1963CT_Connector ctObj = new CT_Connector();
1964ctObj.macro = XmlHelper.ReadString(node.Attributes["macro"]);
1965ctObj.fPublished = XmlHelper.ReadBool(node.Attributes["fPublished"]);
1966foreach (XmlNode childNode in node.ChildNodes)
1967{
1968if (childNode.LocalName == "nvCxnSpPr")
1969ctObj.nvCxnSpPr = CT_ConnectorNonVisual.Parse(childNode, namespaceManager);
1970else if (childNode.LocalName == "spPr")
1971ctObj.spPr = CT_ShapeProperties.Parse(childNode, namespaceManager);
1972else if (childNode.LocalName == "style")
1973ctObj.style = CT_ShapeStyle.Parse(childNode, namespaceManager);
1974}
1975return ctObj;
1976}
1977
1978
1979
1980internal void Write(StreamWriter sw, string nodeName)
1981{
1982sw.Write(string.Format("<xdr:{0}", nodeName));
1983XmlHelper.WriteAttribute(sw, "macro", this.macro, true);
1984XmlHelper.WriteAttribute(sw, "fPublished", this.fPublished,false);
1985sw.Write(">");
1986if (this.nvCxnSpPr != null)
1987this.nvCxnSpPr.Write(sw, "nvCxnSpPr");
1988if (this.spPr != null)
1989this.spPr.Write(sw, "spPr");
1990if (this.style != null)
1991this.style.Write(sw, "style");
1992sw.Write(string.Format("</xdr:{0}>", nodeName));
1993}
1994
1995public void Set(CT_Connector obj)
1996{
1997this.macroField = obj.macro;
1998this.fPublishedField = obj.fPublished;
1999this.spPrField = obj.spPr;
2000this.styleField = obj.style;
2001this.nvCxnSpPrField = obj.nvCxnSpPr;
2002}
2003public CT_ConnectorNonVisual AddNewNvCxnSpPr()
2004{
2005this.nvCxnSpPr = new CT_ConnectorNonVisual();
2006return nvCxnSpPr;
2007}
2008public CT_ShapeProperties AddNewSpPr()
2009{
2010this.spPrField = new CT_ShapeProperties();
2011return spPrField;
2012}
2013public CT_ShapeStyle AddNewStyle()
2014{
2015this.styleField = new CT_ShapeStyle();
2016return this.styleField;
2017}
2018public CT_ShapeProperties spPr
2019{
2020get
2021{
2022return this.spPrField;
2023}
2024set
2025{
2026this.spPrField = value;
2027}
2028}
2029public CT_ShapeStyle style
2030{
2031get
2032{
2033return this.styleField;
2034}
2035set
2036{
2037this.styleField = value;
2038}
2039}
2040[XmlAttribute]
2041public string macro
2042{
2043get { return this.macroField; }
2044set { this.macroField = value; }
2045}
2046[XmlAttribute]
2047public bool fPublished
2048{
2049get { return this.fPublishedField; }
2050set { this.fPublishedField = value; }
2051}
2052}
2053
2054
2055
2056}
2057