Пример #1
0
        public void AddToElement(SXL.XElement parent)
        {
            var el = XMLUtil.CreateVisioSchema2003Element("Fill");
            el.Add(this.ForegroundColor.ToXml("FillForegnd"));
            el.Add(this.BackgroundColor.ToXml("FillBkgnd"));
            el.Add(this.Pattern.ToXml("FillPattern"));
            el.Add(this.ShadowForegroundColor.ToXml("ShdwForegnd"));
            el.Add(this.ShadowBackgroundColor.ToXml("ShdwBkgnd"));
            el.Add(this.ShadowPattern.ToXml("ShdwPattern"));

            el.Add(this.ForegroundTransparency.ToXml("FillForegndTrans"));
            el.Add(this.BackgroundTransparency.ToXml("FillBkgndTrans"));

            el.Add(
                this.ShadowForegroundTransparency.ToXml("ShdwForegndTrans"));
            el.Add(
                this.ShadowBackgroundTransparency.ToXml("ShdwBkgndTrans"));

            el.Add(this.ShadowType.ToXml("ShapeShdwType"));
            el.Add(this.ShadowOffsetX.ToXml("ShapeShdwOffsetX"));
            el.Add(this.ShadowOffsetY.ToXml("ShapeShdwOffsetY"));
            el.Add(this.ShadowObliqueAngle.ToXml("ShapeShdwObliqueAngle"));
            el.Add(this.ShadowScale.ToXml("ShapeShdwScaleFactor"));

            parent.Add(el);
        }
Пример #2
0
        public void AddToElement(SXL.XElement parent)
        {
            var connect_el = XMLUtil.CreateVisioSchema2003Element("Connect");
            connect_el.SetAttributeValue("FromSheet", this.FromSheet);

            if (this.FromCell != null)
            {
                connect_el.SetAttributeValue("FromCell", this.FromCell);
            }

            if (this.FromPart.HasValue)
            {
                connect_el.SetAttributeValue("FromPart", this.FromPart.Value);
            }

            connect_el.SetAttributeValue("ToSheet", this.ToSheet);

            if (this.ToCell != null)
            {
                connect_el.SetAttributeValue("ToCell", this.ToCell);
            }

            if (this.ToPart.HasValue)
            {
                connect_el.SetAttributeValue("ToPart", this.ToPart.Value);
            }

            parent.Add(connect_el);
        }
Пример #3
0
        public void AddToElement(SXL.XElement parent)
        {
            var el1 = XMLUtil.CreateVisioSchema2003Element("Protection");
            el1.Add(this.Width.ToXml("LockWidth"));
            el1.Add(this.Height.ToXml("LockHeight"));

            el1.Add(this.MoveX.ToXml("LockMoveX"));
            el1.Add(this.MoveY.ToXml("LockMoveY"));

            el1.Add(this.Aspect.ToXml("LockAspect"));
            el1.Add(this.Delete.ToXml("LockDelete"));

            el1.Add(this.Begin.ToXml("LockBegin"));
            el1.Add(this.Rotate.ToXml("LockRotate"));

            el1.Add(this.Crop.ToXml("LockCrop"));
            el1.Add(this.VtxEdit.ToXml("LockVtxEdit"));

            el1.Add(this.TextEdit.ToXml("LockTextEdit"));
            el1.Add(this.Format.ToXml("LockFormat"));

            el1.Add(this.Group.ToXml("LockGroup"));
            el1.Add(this.CalcWH.ToXml("LockCalcWH"));

            el1.Add(this.Select.ToXml("LockSelect"));
            el1.Add(this.CustProp.ToXml("LockCustProp"));

            parent.Add(el1);

            var el2 = XMLUtil.CreateVisioSchema2006Element("Protection");
            el2.Add(this.FromGroupFormat.ToXml2006("LockFromGroupFormat"));
            el2.Add(this.ThemeColors.ToXml2006("LockThemeColors"));
            el2.Add(this.ThemeEffects.ToXml2006("LockThemeEffects"));
            parent.Add(el2);
        }
Пример #4
0
        public void AddToElement(SXL.XElement parent)
        {
            var el = XMLUtil.CreateVisioSchema2003Element("Misc");
            el.Add(this.NoObjHandles.ToXml("NoObjHandles"));
            el.Add(this.NonPrinting.ToXml("NonPrinting"));
            el.Add(this.NoCtlHandles.ToXml("NoCtlHandles"));
            el.Add(this.NoAlignBox.ToXml("NoAlignBox"));

            el.Add(this.UpdateAlignBox.ToXml("UpdateAlignBox"));
            el.Add(this.HideText.ToXml("HideText"));
            el.Add(this.DynFeedback.ToXml("DynFeedback"));
            el.Add(this.GlueType.ToXml("GlueType"));
            el.Add(this.WalkPreference.ToXml("WalkPreference"));

            el.Add(this.BegTrigger.ToXml("BegTrigger"));
            el.Add(this.EndTrigger.ToXml("EndTrigger"));

            el.Add(this.ObjType.ToXml("ObjType"));
            el.Add(this.Comment.ToXml("Comment"));
            el.Add(this.IsDropSource.ToXml("IsDropSource"));
            el.Add(this.NoLiveDynamics.ToXml("NoLiveDynamics"));
            el.Add(this.LocalizeMerge.ToXml("LocalizeMerge"));

            el.Add(this.Calendar.ToXml("Calendar"));
            el.Add(this.LangID.ToXml("LangID"));
            el.Add(this.ShapeKeywords.ToXml("ShapeKeywords"));
            el.Add(this.DropOnPageScale.ToXml("DropOnPageScale"));

            parent.Add(el);
        }
Пример #5
0
 public void AddToElement(SXL.XElement parent)
 {
     if (this.Runs != null)
     {
         var text_el = XMLUtil.CreateVisioSchema2003Element("Text");
         foreach (var ft in this.m_runs)
         {
             if (ft.CharacterFormatIndex.HasValue)
             {
                 var xcp = XMLUtil.CreateVisioSchema2003Element("cp");
                 xcp.SetAttributeValue("IX", ft.CharacterFormatIndex.Value);
                 text_el.Add(xcp);
             }
             if (ft.ParagraphFormatIndex.HasValue)
             {
                 var xpp = XMLUtil.CreateVisioSchema2003Element("pp");
                 xpp.SetAttributeValue("IX", ft.ParagraphFormatIndex.Value);
                 text_el.Add(xpp);
             }
             if (ft.TabsFormatIndex.HasValue)
             {
                 var xtp = XMLUtil.CreateVisioSchema2003Element("tp");
                 xtp.SetAttributeValue("IX", ft.TabsFormatIndex.Value);
                 text_el.Add(xtp);
             }
             text_el.Add(ft.Text);
         }
         parent.Add(text_el);
     }
 }
        public static ShapeInfo FromXml(Client client, SXL.XElement shape_el)
        {
            var info = new ShapeInfo();
            info.ID = shape_el.Attribute("id").Value;
            client.WriteVerbose( "Reading shape id={0}", info.ID);

            info.Label = shape_el.Attribute("label").Value;
            info.Stencil = shape_el.Attribute("stencil").Value;
            info.Master = shape_el.Attribute("master").Value;
            info.Element = shape_el;
            info.URL = XmlUtil.GetAttributeValue(shape_el, "url", null);

            info.custprops = new Dictionary<string, VACUSTPROP.CustomPropertyCells>();
            foreach (var customprop_el in shape_el.Elements("customprop"))
            {
                string cp_name = customprop_el.Attribute("name").Value;
                string cp_value = customprop_el.Attribute("value").Value;

                var cp = new VACUSTPROP.CustomPropertyCells();
                cp.Value = cp_value;

                info.custprops.Add(cp_name,cp);
            }

            return info;
        }
Пример #7
0
        public void AddToElement(SXL.XElement parent)
        {
            var el = XMLUtil.CreateVisioSchema2003Element("PageLayout");
            el.Add(this.ResizePage.ToXml("ResizePage"));
            el.Add(this.EnableGrid.ToXml("EnableGrid"));
            el.Add(this.DynamicsOff.ToXml("DynamicsOff"));
            el.Add(this.PlaceStyle.ToXml("PlaceStyle"));
            el.Add(this.RouteStyle.ToXml("RouteStyle"));
            el.Add(this.PlaceDepth.ToXml("PlaceDepth"));
            el.Add(this.PlowCode.ToXml("PlowCode"));
            el.Add(this.LineJumpCode.ToXml("LineJumpCode"));
            el.Add(this.LineJumpStyle.ToXml("LineJumpStyle"));
            el.Add(this.PageLineJumpDirX.ToXml("PageLineJumpDirX"));
            el.Add(this.PageLineJumpDirY.ToXml("PageLineJumpDirY"));
            el.Add(this.LineToNodeX.ToXml("LineToNodeX"));
            el.Add(this.LineToNodeY.ToXml("LineToNodeY"));
            el.Add(this.BlockSizeX.ToXml("BlockSizeX"));
            el.Add(this.BlockSizeY.ToXml("BlockSizeY"));
            el.Add(this.AvenueSizeX.ToXml("AvenueSizeX"));
            el.Add(this.AvenueSizeY.ToXml("AvenueSizeY"));
            el.Add(this.LineToLineX.ToXml("LineToLineX"));
            el.Add(this.LineToLineY.ToXml("LineToLineY"));
            el.Add(this.LineJumpFactorX.ToXml("LineJumpFactorX"));
            el.Add(this.LineJumpFactorY.ToXml("LineJumpFactorY"));
            el.Add(this.LineAdjustFrom.ToXml("LineAdjustFrom"));
            el.Add(this.LineAdjustTo.ToXml("LineAdjustTo"));

            el.Add(this.PlaceFlip.ToXml("PlaceFlip"));
            el.Add(this.LineRouteExt.ToXml("LineRouteExt"));
            el.Add(this.PageShapeSplit.ToXml("PageShapeSplit"));

            parent.Add(el);
        }
        public static void CleanUpTemplate(SXL.XDocument vdx_xml_doc)
        {
            var root = vdx_xml_doc.Root;

            string ns_2003 = Internal.Constants.VisioXmlNamespace2003;

            // set document properties
            var docprops = root.ElementVisioSchema2003("DocumentProperties");
            docprops.RemoveElement(ns_2003 + "PreviewPicture");
            docprops.SetElementValue(ns_2003 + "Creator", "");
            docprops.SetElementValue(ns_2003 + "Company", "");

            // remove any pages
            var pages = root.ElementVisioSchema2003("Pages");
            pages.RemoveNodes();

            // Do not remove the FaceNames node - it contains fonts to which the template may be referring
            root.RemoveElement(ns_2003 + "Windows");
            root.RemoveElement(ns_2003 + "DocumentProperties");


            // TODO Add DocumentSettings to VDX
            var docsettings = root.ElementsVisioSchema2003("DocumentSettings");
            if (docsettings != null)
            {
                SXL.Extensions.Remove(docsettings);
            }
        }
Пример #9
0
        public void AddToElement(SXL.XElement parent)
        {
            var prop_el = Internal.XMLUtil.CreateVisioSchema2003Element("Prop");
            if (this.Name != null)
            {
                prop_el.SetElementValue("Name", this.Name);
            }

            prop_el.SetAttributeValue("NameU", this.NameU);
            prop_el.SetAttributeValue("ID", this.ID);
            prop_el.SetElementValueConditional("Del", this._del);

            if (this.Value!=null)
            {
                var val_el = new SXL.XElement(Internal.Constants.VisioXmlNamespace2003 + "Value");
                prop_el.Add(val_el);
                val_el.SetAttributeValue("Unit", "STR");
                val_el.SetValue(this.Value);                
            }
            prop_el.Add(this.Prompt.ToXml("Prompt"));
            prop_el.Add(this.Label.ToXml("Label"));
            prop_el.Add(this.Format.ToXml("Format"));
            prop_el.Add(this.SortKey.ToXml("SortKey"));
            prop_el.Add(this.Type.ToXml("Type"));
            prop_el.Add(this.Invisible.ToXml("Invisible"));
            prop_el.Add(this.LangID.ToXml("LangID"));
            prop_el.Add(this.Calendar.ToXml("Calendar"));
            parent.Add(prop_el);
        }
Пример #10
0
 public void ToXml(SXL.XElement parent)
 {
     var facename_el = XMLUtil.CreateVisioSchema2003Element("FaceName");
     facename_el.SetAttributeValueInt("ID", this.ID);
     facename_el.SetAttributeValue("Name", this.Name);
     parent.Add(facename_el);
 }
Пример #11
0
        public void AddToElement(SXL.XElement parent)
        {
            var el = XMLUtil.CreateVisioSchema2003Element("PrintProps");
            el.Add(this.PageLeftMargin.ToXml("PageLeftMargin"));
            el.Add(this.PageRightMargin.ToXml("PageRightMargin"));
            el.Add(this.PageTopMargin.ToXml("PageTopMargin"));
            el.Add(this.PageBottomMargin.ToXml("PageBottomMargin"));

            el.Add(this.ScaleX.ToXml("ScaleX"));
            el.Add(this.ScaleY.ToXml("ScaleY"));

            el.Add(this.PagesX.ToXml("PagesX"));
            el.Add(this.PagesY.ToXml("PagesY"));

            el.Add(this.CenterX.ToXml("CenterX"));
            el.Add(this.CenterY.ToXml("CenterY"));

            el.Add(this.OnPage.ToXml("OnPage"));
            el.Add(this.PrintGrid.ToXml("PrintGrid"));

            el.Add(this.PrintPageOrientation.ToXml("PrintPageOrientation"));
            el.Add(this.PaperKind.ToXml("PaperKind"));

            el.Add(this.PaperSource.ToXml("PaperSource"));
            el.Add(this.ShdwObliqueAngle.ToXml("ShdwObliqueAngle"));

            el.Add(this.ShdwScaleFactor.ToXml("ShdwScaleFactor"));

            parent.Add(el);
        }
Пример #12
0
 public static BooleanValue XmlToValue(SXL.XElement type_el)
 {
     var i = int.Parse(type_el.Value);
     var b = (i != 0);
     var bv = new BooleanValue(b);
     return bv;
 }
        public static IList<DGMODEL.Drawing> LoadFromXML(VA.Scripting.Client client, SXL.XDocument xmldoc)
        {
            var pagedatas = LoadPageDataFromXML(client, xmldoc);

            // STOP IF ANY ERRORS
            int num_errors = pagedatas.Select(pagedata => pagedata.Errors.Count).Sum();
            if (num_errors > 1)
            {
                foreach (var pagedata in pagedatas)
                {
                    foreach (var error in pagedata.Errors)
                    {
                        client.WriteVerbose( error.Text);
                    }
                    client.WriteVerbose( "Errors encountered in shape data. Stopping.");
                }
            }

            // DRAW EACH PAGE
            foreach (var pagedata in pagedatas)
            {
                client.WriteVerbose( "Creating shape AutoLayout nodes");
                foreach (var shape_info in pagedata.ShapeInfos)
                {
                    var dg_shape = pagedata.DirectedGraph.AddShape(shape_info.ID, shape_info.Label, shape_info.Stencil, shape_info.Master);
                    dg_shape.URL = shape_info.URL;
                    dg_shape.CustomProperties = new Dictionary<string, VACUSTPROP.CustomPropertyCells>();
                    foreach (var kv in shape_info.custprops)
                    {
                        dg_shape.CustomProperties[kv.Key] = kv.Value;
                    }
                }

                client.WriteVerbose( "Creating connector AutoLayout nodes");
                foreach (var con_info in pagedata.ConnectorInfos)
                {
                    var def_connector_type = VACXN.ConnectorType.Curved;
                    var connectory_type = def_connector_type;

                    var from_shape = pagedata.DirectedGraph.Shapes.Find(con_info.From);
                    var to_shape = pagedata.DirectedGraph.Shapes.Find(con_info.To);

                    var def_con_color = new VA.Drawing.ColorRGB(0x000000);
                    var def_con_weight = 1.0/72.0;
                    var def_end_arrow = 2;
                    var dg_connector = pagedata.DirectedGraph.Connect(con_info.ID, from_shape, to_shape, con_info.Label, connectory_type);

                    dg_connector.Cells = new VA.DOM.ShapeCells();
                    dg_connector.Cells.LineColor = con_info.Element.AttributeAsColor("color", def_con_color).ToFormula();
                    dg_connector.Cells.LineWeight = con_info.Element.AttributeAsInches("weight", def_con_weight);
                    dg_connector.Cells.EndArrow = def_end_arrow;
                }
                client.WriteVerbose( "Rendering AutoLayout...");
            }
            client.WriteVerbose( "Finished rendering AutoLayout");

            var directedgraphs = pagedatas.Select(pagedata => pagedata.DirectedGraph).ToList();
            return directedgraphs;
        }
Пример #14
0
 public override void AddToElement(SXL.XElement parent, int index)
 {
     var el = XMLUtil.CreateVisioSchema2003Element("LineTo");
     el.SetAttributeValueInt("IX", index);
     el.Add(this.X.ToXml("X"));
     el.Add(this.Y.ToXml("Y"));
     parent.Add(el);
 }
Пример #15
0
        public void AddToElement(SXL.XElement parent)
        {
            var el = XMLUtil.CreateVisioSchema2003Element("XForm1D");
            el.Add(this.BeginX.ToXml("BeginX"));
            el.Add(this.BeginY.ToXml("BeginY"));
            el.Add(this.EndX.ToXml("EndX"));
            el.Add(this.EndY.ToXml("EndY"));

            parent.Add(el);
        }
Пример #16
0
 public static DateTimeValue XmlToValue(SXL.XElement parent)
 {
     System.DateTime dt = System.DateTime.Now;
     if (System.DateTime.TryParse(parent.Value, out dt))
     {
         return new DateTimeValue(dt);
     }
     var x = System.DateTime.ParseExact(parent.Value, "yyyyMMddTHH:mm:ss", null);
     var y = new DateTimeValue(x);
     return y;
 }
Пример #17
0
 protected override void AddToTypeEl(SXL.XElement parent)
 {
     if (this.Boolean)
     {
         parent.Add("1");
     }
     else
     {
         parent.Add("0");
     }
 }
Пример #18
0
 public override void AddToElement(SXL.XElement parent, int index)
 {
     var el = XMLUtil.CreateVisioSchema2003Element("Ellipse");
     el.SetAttributeValueInt("IX", index);
     el.Add(this.X.ToXml("X"));
     el.Add(this.Y.ToXml("Y"));
     el.Add(this.A.ToXml("A"));
     el.Add(this.B.ToXml("B"));
     el.Add(this.C.ToXml("C"));
     el.Add(this.D.ToXml("D"));
     parent.Add(el);
 }
Пример #19
0
 public void AddToElement(SXL.XElement parent)
 {
     var el = XMLUtil.CreateVisioSchema2003Element("TextXForm");
     el.Add(this.PinX.ToXml("TxtPinX"));
     el.Add(this.PinY.ToXml("TxtPinY"));
     el.Add(this.Width.ToXml("TxtWidth"));
     el.Add(this.Height.ToXml("TxtHeight"));
     el.Add(this.LocPinX.ToXml("TxtLocPinX"));
     el.Add(this.LocPinY.ToXml("TxtLocPinY"));
     el.Add(this.Angle.ToXml("TxtAngle"));
     parent.Add(el);
 }
        public static ConnectorInfo FromXml(Client client, SXL.XElement shape_el)
        {
            var info = new ConnectorInfo();
            info.ID = shape_el.Attribute("id").Value;
            client.WriteVerbose("Reading connector id={0}", info.ID);

            info.Label = shape_el.Attribute("label").Value;
            info.From = shape_el.Attribute("from").Value;
            info.To = shape_el.Attribute("to").Value;

            info.Element = shape_el;
            return info;
        }
        public void CreateVDX(Elements.Drawing vdoc, SXL.XDocument dom)
        {
            if (vdoc == null)
            {
                throw new System.ArgumentNullException("vdoc");
            }

            if (dom == null)
            {
                throw new System.ArgumentNullException("dom");
            }

            this._ModifyTemplate(dom, vdoc);
        }
        public void WriteOutputIsValid(string xml, string validXPath, string simplifiedXPath)
        {
            // Arrange
            var includeAllAttributesExceptNamespaceDeclarations = Substitute.For<IAttributeFilter>();
            includeAllAttributesExceptNamespaceDeclarations.IsIncluded(Arg.Any<XAttribute>()).Returns(info => !info.Arg<XAttribute>().IsNamespaceDeclaration);
            var filters = new[] {includeAllAttributesExceptNamespaceDeclarations};
            var testNode = xml.SelectSingleNode(validXPath);

            // Act
            var actualXPath = new SimplifiedXPathWriter(filters).Write(testNode);

            // Assert
            Assert.That(actualXPath, Is.EqualTo(simplifiedXPath));
        }
Пример #23
0
        public void AddToElement(SXL.XElement parent)
        {
            var el1 = XMLUtil.CreateVisioSchema2003Element("Event");
            el1.Add(this.TheData.ToXml("TheData"));
            el1.Add(this.TheText.ToXml("TheText"));
            el1.Add(this.EventDblClick.ToXml("EventDblClick"));
            el1.Add(this.EventXFMod.ToXml("EventXFMod"));
            el1.Add(this.EventDrop.ToXml("EventDrop"));
            parent.Add(el1);

            var el2 = XMLUtil.CreateVisioSchema2006Element("Event");
            el2.Add(this.EventMultiDrop.ToXml2006("EventMultiDrop"));
            parent.Add(el2);
        }
Пример #24
0
 public void AddToElement(SXL.XElement parent)
 {
     var line_el = XMLUtil.CreateVisioSchema2003Element("Line");
     line_el.Add(this.Weight.ToXml("LineWeight"));
     line_el.Add(this.Color.ToXml("LineColor"));
     line_el.Add(this.Pattern.ToXml("LinePattern"));
     line_el.Add(this.Rounding.ToXml("Rounding"));
     line_el.Add(this.EndArrowSize.ToXml("EndArrowSize"));
     line_el.Add(this.BeginArrowSize.ToXml("BeginArrowSize"));
     line_el.Add(this.EndArrow.ToXml("EndArrow"));
     line_el.Add(this.BeginArrow.ToXml("BeginArrow"));
     line_el.Add(this.Cap.ToXml("LineCap"));
     line_el.Add(this.Transparency.ToXml("LineColorTrans"));
     parent.Add(line_el);
 }
        public override bool Execute()
        {
            if (!this.InputFiles.Any())
                return true;

            Instance = new RazorGeneratorBuildTask();

            if (AppConfigPath == null)
            {
                var configNames = new[] {
                    PathUtils.CombinePaths(ProjectDir, "Web.config"),
                    PathUtils.CombinePaths(ProjectDir, "App.config"),
                    PathUtils.CombinePaths(ProjectDir, "web.config"), //unix
                    PathUtils.CombinePaths(ProjectDir, "app.config"),
                };
                AppConfigPath = configNames.FirstOrDefault(File.Exists);
            }

            // Use the task's parent project's web/app configuration file
            using (AppConfigScope.Change(AppConfigPath))
            {
                var allowedConfigs = ConfigurationManager.AppSettings[ConfigurationAppKeyName] ?? this.AllowedConfigurations;

                // If specified, only generate source code if the Project Configuration matches the given Configuration from the user
                if (!ConfigurationMatches(this.ProjectConfiguration, allowedConfigs))
                    return true;

                var pageBaseTypeName = GetPageBaseTypeName();
                var pathProvider = new RazorBuildPathProvider(this.ProjectDir);
                var transformer = new RazorViewPageTransformer(pageBaseTypeName);

                for (int i = 0; i < this.InputFiles.Length; i++)
                {
                    var file = new RazorBuildTaskFile(this.InputFiles[i].ItemSpec, pathProvider);
                    var pageHost = new RazorPageHost(pathProvider, file, transformer, new CSharpCodeProvider(), new Dictionary<string, string>())
                    {
                        RootNamespace = this.ProjectRootNamespace
                    };

                    var fileName = this.OutputFiles[i].ItemSpec = ToUniqueFilePath(this.OutputFiles[i].ItemSpec, pageHost.DefaultNamespace);
                    var sourceCode = pageHost.GenerateSourceCode();

                    File.WriteAllText(fileName, sourceCode);
                }

                return true;
            }
        }
Пример #26
0
        public void AddToElement(SXL.XElement parent)
        {
            var el = XMLUtil.CreateVisioSchema2003Element("XForm");
            el.Add(this.PinX.ToXml("PinX"));
            el.Add(this.PinY.ToXml("PinY"));
            el.Add(this.Width.ToXml("Width"));
            el.Add(this.Height.ToXml("Height"));
            el.Add(this.LocPinX.ToXml("LocPinX"));
            el.Add(this.LocPinY.ToXml("LocPinY"));
            el.Add(this.Angle.ToXml("Angle"));
            el.Add(this.FlipX.ToXml("FlipX"));
            el.Add(this.FlipY.ToXml("FlipY"));
            el.Add(this.FlipMode.ToXml("FlipMode"));

            parent.Add(el);
        }
Пример #27
0
        public void AddToElement(SXL.XElement parent, int ix)
        {
            var colorentry_el = XMLUtil.CreateVisioSchema2003Element("ColorEntry");
            colorentry_el.SetAttributeValueInt("IX", ix);

            byte rbyte;
            byte gbyte;
            byte bbyte;
            ColorEntry.GetRGBBytes(this.RGB, out rbyte, out gbyte, out bbyte);
            const string format_string = "#{0:x2}{1:x2}{2:x2}";
            string color_string = string.Format(System.Globalization.CultureInfo.InvariantCulture, format_string, rbyte, gbyte, bbyte);

            colorentry_el.SetAttributeValue("RGB", color_string);

            parent.Add(colorentry_el);
        }
Пример #28
0
        public void AddToElement(SXL.XElement parent)
        {
            var el1 = XMLUtil.CreateVisioSchema2003Element("TextBlock");
            el1.Add(this.LeftMargin.ToXml("LeftMargin"));
            el1.Add(this.RightMargin.ToXml("RightMargin"));
            el1.Add(this.TopMargin.ToXml("TopMargin"));
            el1.Add(this.BottomMargin.ToXml("BottomMargin"));
            el1.Add(this.VerticalAlign.ToXml("VerticalAlign"));
            el1.Add(this.TextBkgnd.ToXml("TextBkgnd"));

            el1.Add(this.DefaultTabStop.ToXml("DefaultTabStop"));
            el1.Add(this.TextDirection.ToXml("TextDirection"));
            el1.Add(this.TextBkgndTrans.ToXml("TextBkgndTrans"));

            parent.Add(el1);
        }
Пример #29
0
 public void AddToElement(SXL.XElement parent)
 {
     var el = XMLUtil.CreateVisioSchema2003Element("PageProps");
     el.Add(this.PageWidth.ToXml("PageWidth"));
     el.Add(this.PageHeight.ToXml("PageHeight"));
     el.Add(this.ShdwOffsetX.ToXml("ShdwOffsetX"));
     el.Add(this.ShdwOffsetY.ToXml("ShdwOffsetY"));
     el.Add(this.PageScale.ToXml("PageScale"));
     el.Add(this.DrawingSizeType.ToXml("DrawingSizeType"));
     el.Add(this.DrawingScaleType.ToXml("DrawingScaleType"));
     el.Add(this.InhibitSnap.ToXml("InhibitSnap"));
     el.Add(this.UIVisibility.ToXml("UIVisibility"));
     el.Add(this.ShdwType.ToXml("ShdwType"));
     el.Add(this.ShdwObliqueAngle.ToXml("ShdwObliqueAngle"));
     el.Add(this.ShdwScaleFactor.ToXml("ShdwScaleFactor"));
     parent.Add(el);
 }
        private void _ModifyTemplate( SXL.XDocument dom, Elements.Drawing doc_node)
        {
            if (dom.Root == null)
            {
                throw new System.ArgumentException("DOM must have a root node");
            }

            var root = dom.Root;
            root.AddFirst(doc_node.DocumentProperties.ToXml());

            var xfacenames = root.ElementVisioSchema2003("FaceNames");
            xfacenames.RemoveAll();

            foreach (var vface in doc_node.Faces.Items)
            {
                vface.ToXml(xfacenames);
            }

            var xcolors = root.ElementVisioSchema2003("Colors");
            xcolors.RemoveAll();

            int ix = 0;
            foreach (var color in doc_node.Colors)
            {
                color.AddToElement(xcolors, ix++);
            }

            var xpages = root.ElementVisioSchema2003("Pages");

            foreach (var page_node in doc_node.Pages.Items)
            {
                page_node.AddToElement(xpages);
            }

            if (doc_node.Windows != null && doc_node.Windows.Count > 0)
            {
                var xwindows = Internal.XMLUtil.CreateVisioSchema2003Element("Windows");
                root.Add(xwindows);

                foreach (var window in doc_node.Windows)
                {
                    window.AddToElement(xwindows);
                }
            }
        }