Ejemplo n.º 1
0
        public static void GradientTransparencies()
        {
            int num_cols = 1;
            int num_rows = 10;
            var color1   = new VisioAutomation.Drawing.ColorRGB(0xff000);
            var color2   = new VisioAutomation.Drawing.ColorRGB(0x000ff);

            var page_size = new VA.Drawing.Size(num_rows / 2.0, num_rows);
            var upperleft = new VA.Drawing.Point(0, page_size.Height);

            var page    = SampleEnvironment.Application.ActiveDocument.Pages.Add();
            var app     = page.Application;
            var docs    = app.Documents;
            var stencil = docs.OpenStencil("basic_U.vss");
            var master  = stencil.Masters["Rectangle"];

            SampleEnvironment.SetPageSize(page, page_size);

            var layout = new GridLayout(num_cols, num_rows, new VA.Drawing.Size(6.0, 1.0), master);

            layout.RowDirection = RowDirection.TopToBottom;
            layout.Origin       = upperleft;
            layout.CellSpacing  = new VA.Drawing.Size(0.1, 0.1);
            layout.PerformLayout();

            double[] trans = EffectsSamples.RangeSteps(0.0, 1.0, num_rows).ToArray();

            int i = 0;

            foreach (var node in layout.Nodes)
            {
                double transparency = trans[i];

                var fmt = new ShapeCells();
                node.Cells = fmt;

                fmt.FillPattern                = 25; // Linear pattern left to right
                fmt.FillForeground             = color1.ToFormula();
                fmt.FillBackground             = color2.ToFormula();
                fmt.FillForegroundTransparency = 0;
                fmt.FillBackgroundTransparency = transparency;
                fmt.LinePattern                = 0;

                node.Text = string.Format("bg trans = {0}%", transparency);
                i++;
            }

            layout.Render(page);

            page.ResizeToFitContents();
        }
Ejemplo n.º 2
0
 public void ApplyFormulasTo(ShapeCells other)
 {
     if (this.Width.HasValue)
     {
         other.Width = this.Width;
     }
     if (this.Height.HasValue)
     {
         other.Height = this.Height;
     }
     if (this.Angle.HasValue)
     {
         other.Angle = this.Angle;
     }
     if (this.PinX.HasValue)
     {
         other.PinX = this.PinX;
     }
     if (this.PinY.HasValue)
     {
         other.PinY = this.PinY;
     }
     if (this.LocPinX.HasValue)
     {
         other.LocPinX = this.LocPinX;
     }
     if (this.LocPinY.HasValue)
     {
         other.LocPinY = this.LocPinY;
     }
     if (this.FillBkgnd.HasValue)
     {
         other.FillBkgnd = this.FillBkgnd;
     }
     if (this.FillBkgndTrans.HasValue)
     {
         other.FillBkgndTrans = this.FillBkgndTrans;
     }
     if (this.FillForegnd.HasValue)
     {
         other.FillForegnd = this.FillForegnd;
     }
     if (this.FillForegndTrans.HasValue)
     {
         other.FillForegndTrans = this.FillForegndTrans;
     }
     if (this.FillPattern.HasValue)
     {
         other.FillPattern = this.FillPattern;
     }
     if (this.ShapeShdwObliqueAngle.HasValue)
     {
         other.ShapeShdwObliqueAngle = this.ShapeShdwObliqueAngle;
     }
     if (this.ShapeShdwOffsetX.HasValue)
     {
         other.ShapeShdwOffsetX = this.ShapeShdwOffsetX;
     }
     if (this.ShapeShdwOffsetY.HasValue)
     {
         other.ShapeShdwOffsetY = this.ShapeShdwOffsetY;
     }
     if (this.ShapeShdwScaleFactor.HasValue)
     {
         other.ShapeShdwScaleFactor = this.ShapeShdwScaleFactor;
     }
     if (this.ShapeShdwType.HasValue)
     {
         other.ShapeShdwType = this.ShapeShdwType;
     }
     if (this.ShdwBkgnd.HasValue)
     {
         other.ShdwBkgnd = this.ShdwBkgnd;
     }
     if (this.ShdwBkgndTrans.HasValue)
     {
         other.ShdwBkgndTrans = this.ShdwBkgndTrans;
     }
     if (this.ShdwForegnd.HasValue)
     {
         other.ShdwForegnd = this.ShdwForegnd;
     }
     if (this.ShdwForegndTrans.HasValue)
     {
         other.ShdwForegndTrans = this.ShdwForegndTrans;
     }
     if (this.ShdwPattern.HasValue)
     {
         other.ShdwPattern = this.ShdwPattern;
     }
     if (this.BeginArrow.HasValue)
     {
         other.BeginArrow = this.BeginArrow;
     }
     if (this.BeginArrowSize.HasValue)
     {
         other.BeginArrowSize = this.BeginArrowSize;
     }
     if (this.EndArrow.HasValue)
     {
         other.EndArrow = this.EndArrow;
     }
     if (this.EndArrowSize.HasValue)
     {
         other.EndArrowSize = this.EndArrowSize;
     }
     if (this.LineCap.HasValue)
     {
         other.LineCap = this.LineCap;
     }
     if (this.LineColor.HasValue)
     {
         other.LineColor = this.LineColor;
     }
     if (this.LineColorTrans.HasValue)
     {
         other.LineColorTrans = this.LineColorTrans;
     }
     if (this.LinePattern.HasValue)
     {
         other.LinePattern = this.LinePattern;
     }
     if (this.LineWeight.HasValue)
     {
         other.LineWeight = this.LineWeight;
     }
     if (this.Rounding.HasValue)
     {
         other.Rounding = this.Rounding;
     }
     if (this.CharAsianFont.HasValue)
     {
         other.CharAsianFont = this.CharAsianFont;
     }
     if (this.CharCase.HasValue)
     {
         other.CharCase = this.CharCase;
     }
     if (this.CharColor.HasValue)
     {
         other.CharColor = this.CharColor;
     }
     if (this.CharComplexScriptFont.HasValue)
     {
         other.CharComplexScriptFont = this.CharComplexScriptFont;
     }
     if (this.CharComplexScriptSize.HasValue)
     {
         other.CharComplexScriptSize = this.CharComplexScriptSize;
     }
     if (this.CharDoubleStrikeThrough.HasValue)
     {
         other.CharDoubleStrikeThrough = this.CharDoubleStrikeThrough;
     }
     if (this.CharDoubleUnderline.HasValue)
     {
         other.CharDoubleUnderline = this.CharDoubleUnderline;
     }
     if (this.CharFont.HasValue)
     {
         other.CharFont = this.CharFont;
     }
     if (this.CharLangID.HasValue)
     {
         other.CharLangID = this.CharLangID;
     }
     if (this.CharLocale.HasValue)
     {
         other.CharLocale = this.CharLocale;
     }
     if (this.CharLocalizeFont.HasValue)
     {
         other.CharLocalizeFont = this.CharLocalizeFont;
     }
     if (this.CharOverline.HasValue)
     {
         other.CharOverline = this.CharOverline;
     }
     if (this.CharPerpendicular.HasValue)
     {
         other.CharPerpendicular = this.CharPerpendicular;
     }
     if (this.CharPos.HasValue)
     {
         other.CharPos = this.CharPos;
     }
     if (this.CharRTLText.HasValue)
     {
         other.CharRTLText = this.CharRTLText;
     }
     if (this.CharFontScale.HasValue)
     {
         other.CharFontScale = this.CharFontScale;
     }
     if (this.CharSize.HasValue)
     {
         other.CharSize = this.CharSize;
     }
     if (this.CharLetterspace.HasValue)
     {
         other.CharLetterspace = this.CharLetterspace;
     }
     if (this.CharStrikethru.HasValue)
     {
         other.CharStrikethru = this.CharStrikethru;
     }
     if (this.CharStyle.HasValue)
     {
         other.CharStyle = this.CharStyle;
     }
     if (this.CharTransparency.HasValue)
     {
         other.CharTransparency = this.CharTransparency;
     }
     if (this.CharUseVertical.HasValue)
     {
         other.CharUseVertical = this.CharUseVertical;
     }
     if (this.BottomMargin.HasValue)
     {
         other.BottomMargin = this.BottomMargin;
     }
     if (this.DefaultTabstop.HasValue)
     {
         other.DefaultTabstop = this.DefaultTabstop;
     }
     if (this.LeftMargin.HasValue)
     {
         other.LeftMargin = this.LeftMargin;
     }
     if (this.RightMargin.HasValue)
     {
         other.RightMargin = this.RightMargin;
     }
     if (this.TextBkgnd.HasValue)
     {
         other.TextBkgnd = this.TextBkgnd;
     }
     if (this.TextBkgndTrans.HasValue)
     {
         other.TextBkgndTrans = this.TextBkgndTrans;
     }
     if (this.TextDirection.HasValue)
     {
         other.TextDirection = this.TextDirection;
     }
     if (this.TopMargin.HasValue)
     {
         other.TopMargin = this.TopMargin;
     }
     if (this.VerticalAlign.HasValue)
     {
         other.VerticalAlign = this.VerticalAlign;
     }
     if (this.ParaBullet.HasValue)
     {
         other.ParaBullet = this.ParaBullet;
     }
     if (this.ParaBulletFont.HasValue)
     {
         other.ParaBulletFont = this.ParaBulletFont;
     }
     if (this.ParaBulletFontSize.HasValue)
     {
         other.ParaBulletFontSize = this.ParaBulletFontSize;
     }
     if (this.ParaBulletString.HasValue)
     {
         other.ParaBulletString = this.ParaBulletString;
     }
     if (this.ParaFlags.HasValue)
     {
         other.ParaFlags = this.ParaFlags;
     }
     if (this.ParaHorizontalAlign.HasValue)
     {
         other.ParaHorizontalAlign = this.ParaHorizontalAlign;
     }
     if (this.ParaIndentFirst.HasValue)
     {
         other.ParaIndentFirst = this.ParaIndentFirst;
     }
     if (this.ParaIndentLeft.HasValue)
     {
         other.ParaIndentLeft = this.ParaIndentLeft;
     }
     if (this.ParaIndentRight.HasValue)
     {
         other.ParaIndentRight = this.ParaIndentRight;
     }
     if (this.ParaLocBulletFont.HasValue)
     {
         other.ParaLocBulletFont = this.ParaLocBulletFont;
     }
     if (this.ParaSpacingAfter.HasValue)
     {
         other.ParaSpacingAfter = this.ParaSpacingAfter;
     }
     if (this.ParaSpacingBefore.HasValue)
     {
         other.ParaSpacingBefore = this.ParaSpacingBefore;
     }
     if (this.ParaSpacingLine.HasValue)
     {
         other.ParaSpacingLine = this.ParaSpacingLine;
     }
     if (this.ParaTextPosAfterBullet.HasValue)
     {
         other.ParaTextPosAfterBullet = this.ParaTextPosAfterBullet;
     }
     if (this.TxtAngle.HasValue)
     {
         other.TxtAngle = this.TxtAngle;
     }
     if (this.TxtHeight.HasValue)
     {
         other.TxtHeight = this.TxtHeight;
     }
     if (this.TxtLocPinX.HasValue)
     {
         other.TxtLocPinX = this.TxtLocPinX;
     }
     if (this.TxtLocPinY.HasValue)
     {
         other.TxtLocPinY = this.TxtLocPinY;
     }
     if (this.TxtPinX.HasValue)
     {
         other.TxtPinX = this.TxtPinX;
     }
     if (this.TxtPinY.HasValue)
     {
         other.TxtPinY = this.TxtPinY;
     }
     if (this.TxtWidth.HasValue)
     {
         other.TxtWidth = this.TxtWidth;
     }
     if (this.ConFixedCode.HasValue)
     {
         other.ConFixedCode = this.ConFixedCode;
     }
     if (this.ConLineJumpCode.HasValue)
     {
         other.ConLineJumpCode = this.ConLineJumpCode;
     }
     if (this.ConLineJumpDirX.HasValue)
     {
         other.ConLineJumpDirX = this.ConLineJumpDirX;
     }
     if (this.ConLineJumpDirY.HasValue)
     {
         other.ConLineJumpDirY = this.ConLineJumpDirY;
     }
     if (this.ConLineJumpStyle.HasValue)
     {
         other.ConLineJumpStyle = this.ConLineJumpStyle;
     }
     if (this.ConLineRouteExt.HasValue)
     {
         other.ConLineRouteExt = this.ConLineRouteExt;
     }
     if (this.ShapeFixedCode.HasValue)
     {
         other.ShapeFixedCode = this.ShapeFixedCode;
     }
     if (this.ShapePermeablePlace.HasValue)
     {
         other.ShapePermeablePlace = this.ShapePermeablePlace;
     }
     if (this.ShapePermeableX.HasValue)
     {
         other.ShapePermeableX = this.ShapePermeableX;
     }
     if (this.ShapePermeableY.HasValue)
     {
         other.ShapePermeableY = this.ShapePermeableY;
     }
     if (this.ShapePlaceFlip.HasValue)
     {
         other.ShapePlaceFlip = this.ShapePlaceFlip;
     }
     if (this.ShapePlaceStyle.HasValue)
     {
         other.ShapePlaceStyle = this.ShapePlaceStyle;
     }
     if (this.ShapePlowCode.HasValue)
     {
         other.ShapePlowCode = this.ShapePlowCode;
     }
     if (this.ShapeRouteStyle.HasValue)
     {
         other.ShapeRouteStyle = this.ShapeRouteStyle;
     }
     if (this.ShapeSplit.HasValue)
     {
         other.ShapeSplit = this.ShapeSplit;
     }
     if (this.ShapeSplittable.HasValue)
     {
         other.ShapeSplittable = this.ShapeSplittable;
     }
 }
Ejemplo n.º 3
0
        public static void FontGlyphComparision(IVisio.Document doc, string[] fontnames, List <string> samplechars)
        {
            var layout = new BoxL.BoxLayout();

            var root = new BoxL.Container(BoxL.Direction.TopToBottom);

            layout.Root       = root;
            root.ChildSpacing = 0.5;

            var nodedata = new NodeData();

            nodedata.Render = false;
            root.Data       = nodedata;

            var fontname_cells = new ShapeCells();

            fontname_cells.FillPattern         = 0;
            fontname_cells.LinePattern         = 0;
            fontname_cells.LineWeight          = 0.0;
            fontname_cells.ParaHorizontalAlign = 0;
            fontname_cells.CharSize            = "36pt";

            var charbox_cells = new ShapeCells();

            charbox_cells.FillPattern         = 0;
            charbox_cells.LinePattern         = 1;
            charbox_cells.LineWeight          = 0.0;
            charbox_cells.LineColor           = "rgb(150,150,150)";
            charbox_cells.ParaHorizontalAlign = 1;
            charbox_cells.CharSize            = "24pt";

            foreach (string fontname in fontnames)
            {
                var fontname_box      = root.AddNodeEx(5, 0.5, fontname);
                var fontname_box_data = (NodeData)fontname_box.Data;
                fontname_box_data.Cells = fontname_cells;

                var font_box = root.AddContainer(BoxL.Direction.TopToBottom);
                font_box.ChildSpacing = 0.25;
                var font_vox_data = (NodeData)font_box.Data;
                if (font_vox_data != null)
                {
                    font_vox_data.Render = false;
                }

                int numcols  = 17;
                int numrows  = 5;
                int numcells = numcols * numrows;


                foreach (int row in Enumerable.Range(0, numrows))
                {
                    var row_box = font_box.AddContainer(BoxL.Direction.LeftToRight);
                    row_box.ChildSpacing = 0.25;
                    var row_box_data = new NodeData();
                    row_box_data.Render = false;

                    row_box.Data = row_box_data;

                    foreach (int col in Enumerable.Range(0, numcols))
                    {
                        int    charindex     = (col + (numcols * row)) % numcells;
                        string curchar       = samplechars[charindex];
                        var    cell_box      = row_box.AddNodeEx(0.50, 0.50, curchar);
                        var    cell_box_data = (NodeData)cell_box.Data;
                        cell_box_data.Font  = fontname;
                        cell_box_data.Cells = charbox_cells;
                    }
                }
            }

            layout.PerformLayout();

            var page = doc.Pages.Add();

            var domshapescol = new ShapeList();

            foreach (var node in layout.Nodes)
            {
                if (node.Data == null)
                {
                    continue;
                }
                var node_data = (NodeData)node.Data;

                if (node_data.Render == false)
                {
                    continue;
                }

                var shape_node = domshapescol.Drop("Rectangle", "basic_u.vss", node.Rectangle);

                var cells = node_data.Cells;
                if (cells == null)
                {
                    cells = new ShapeCells();
                }
                else
                {
                    cells = node_data.Cells.ShallowCopy();
                }

                if (node_data.Font != null)
                {
                    shape_node.CharFontName = node_data.Font;
                }

                shape_node.Cells = cells;
                shape_node.Text  = new VisioAutomation.Models.Text.TextElement(node_data.Text);
            }

            domshapescol.Render(page);

            var bordersize = new VA.Drawing.Size(0.5, 0.5);

            page.ResizeToFitContents(bordersize);
        }
Ejemplo n.º 4
0
 public NodeData()
 {
     this.Render = true;
     this.Cells  = new ShapeCells();
 }
Ejemplo n.º 5
0
        public IVisio.Document DrawNamespacesAndClasses(IList <Type> types_)
        {
            this._client.Application.AssertApplicationAvailable();

            string segoeui_fontname      = "Segoe UI";
            string segoeuilight_fontname = "Segoe UI Light";
            string def_linecolor         = "rgb(180,180,180)";
            string def_shape_fill        = "rgb(245,245,245)";
            string template = null;

            var page_size         = new VisioAutomation.Geometry.Size(8.5, 11);
            var doc               = this._client.Document.New(page_size, template);
            var fonts             = doc.Fonts;
            var font_segoe        = fonts[segoeui_fontname];
            var font_segoelight   = fonts[segoeuilight_fontname];
            int fontid_segoe      = font_segoe.ID16;
            int fontid_segoelight = font_segoelight.ID16;

            var types = types_.Select(t => new TypeInfo(t));

            var pathbuilder = new PathTreeBuilder();

            foreach (var type in types)
            {
                pathbuilder.Add(type.Type.Namespace);
            }

            var namespaces = pathbuilder.GetPaths();

            var tree_layout = new VisioAutomation.Models.Layouts.Tree.Drawing();

            tree_layout.LayoutOptions.Direction     = LayoutDirection.Down;
            tree_layout.LayoutOptions.ConnectorType = ConnectorType.PolyLine;
            var ns_node_map     = new Dictionary <string, Node>(namespaces.Count);
            var node_to_nslabel = new Dictionary <Node, string>(namespaces.Count);

            // create nodes for every namespace
            foreach (string ns in namespaces)
            {
                string label             = ns;
                int    index_of_last_sep = ns.LastIndexOf(pathbuilder.Separator, StringComparison.Ordinal);
                if (index_of_last_sep > 0)
                {
                    label = ns.Substring(index_of_last_sep + 1);
                }

                string ns1 = ns;
                var    types_in_namespace = types.Where(t => t.Type.Namespace == ns1)
                                            .OrderBy(t => t.Type.Name)
                                            .Select(t => t.Label);
                var node = new Node(ns);
                node.Size = new VisioAutomation.Geometry.Size(2.0, (0.15) * (1 + 2 + types_in_namespace.Count()));


                var markup = new VisioAutomation.Models.Text.Element();
                var m1     = markup.AddElement(label + "\n");
                m1.CharacterFormatting.Font  = fontid_segoe;
                m1.CharacterFormatting.Size  = "12.0pt";
                m1.CharacterFormatting.Style = "1"; // Bold
                var m2 = markup.AddElement();
                m2.CharacterFormatting.Font = fontid_segoe;
                m2.CharacterFormatting.Size = "8.0pt";
                m2.AddText(string.Join("\n", types_in_namespace));

                node.Text = markup;

                ns_node_map[ns]       = node;
                node_to_nslabel[node] = label;
            }

            // add children to nodes
            foreach (string ns in namespaces)
            {
                var parent_ns = pathbuilder.PathToParentPath[ns];

                if (parent_ns != null)
                {
                    // the current namespace has a parent
                    var parent_node = ns_node_map[parent_ns];
                    var child_node  = ns_node_map[ns];
                    parent_node.Children.Add(child_node);
                }
                else
                {
                    // that means this namespace is a root, forget about it
                }
            }

            if (pathbuilder.Roots.Count == 0)
            {
            }
            else if (pathbuilder.Roots.Count == 1)
            {
                // when there is exactly one root namespace, then that node will be the tree's root node
                var first_root = pathbuilder.Roots[0];
                var root_n     = ns_node_map[first_root];
                tree_layout.Root = root_n;
            }
            else
            {
                // if there are multiple root namespaces, inject an empty placeholder root
                var root_n = new Node();
                tree_layout.Root = root_n;

                foreach (var root_ns in pathbuilder.Roots)
                {
                    var node = ns_node_map[root_ns];
                    tree_layout.Root.Children.Add(node);
                }
            }

            // format the shapes
            foreach (var node in tree_layout.Nodes)
            {
                if (node.Cells == null)
                {
                    node.Cells = new ShapeCells();
                }
                node.Cells.FillForeground = def_shape_fill;
                //node.ShapeCells.LineWeight = "0";
                //node.ShapeCells.LinePattern = "0";
                node.Cells.LineColor              = def_linecolor;
                node.Cells.ParaHorizontalAlign    = "0";
                node.Cells.TextBlockVerticalAlign = "0";
            }

            var cxn_cells = new ShapeCells();

            cxn_cells.LineColor = def_linecolor;
            tree_layout.LayoutOptions.ConnectorCells = cxn_cells;
            tree_layout.Render(doc.Application.ActivePage);

            DeveloperCommands.hide_ui_stuff(doc);

            return(doc);
        }
Ejemplo n.º 6
0
        public IVisio.Document DrawNamespaces(IList <Type> types)
        {
            this._client.Application.AssertApplicationAvailable();

            string template      = null;
            string def_linecolor = "rgb(140,140,140)";
            string def_fillcolor = "rgb(240,240,240)";
            string def_font      = "Segoe UI";

            var page_size = new VisioAutomation.Geometry.Size(8.5, 11);
            var doc       = this._client.Document.New(page_size, template);
            var fonts     = doc.Fonts;
            var font      = fonts[def_font];
            int fontid    = font.ID16;

            var pathbuilder = new PathTreeBuilder();

            foreach (var type in types)
            {
                pathbuilder.Add(type.Namespace);
            }

            var namespaces = pathbuilder.GetPaths();

            var tree_layout = new VisioAutomation.Models.Layouts.Tree.Drawing();

            tree_layout.LayoutOptions.Direction     = LayoutDirection.Right;
            tree_layout.LayoutOptions.ConnectorType = ConnectorType.CurvedBezier;
            var ns_node_map = new Dictionary <string, Node>(namespaces.Count);

            // create nodes for every namespace
            foreach (string ns in namespaces)
            {
                string label             = ns;
                int    index_of_last_sep = ns.LastIndexOf(pathbuilder.Separator, StringComparison.Ordinal);
                if (index_of_last_sep > 0)
                {
                    label = ns.Substring(index_of_last_sep + 1);
                }

                var node = new Node(ns);
                node.Text       = new VisioAutomation.Models.Text.Element(label);
                node.Size       = new VisioAutomation.Geometry.Size(2.0, 0.25);
                ns_node_map[ns] = node;
            }

            // add children to nodes
            foreach (string ns in namespaces)
            {
                var parent_ns = pathbuilder.PathToParentPath[ns];

                if (parent_ns != null)
                {
                    // the current namespace has a parent
                    var parent_node = ns_node_map[parent_ns];
                    var child_node  = ns_node_map[ns];
                    parent_node.Children.Add(child_node);
                }
                else
                {
                    // that means this namespace is a root, forget about it
                }
            }

            if (pathbuilder.Roots.Count == 0)
            {
            }
            else if (pathbuilder.Roots.Count == 1)
            {
                // when there is exactly one root namespace, then that node will be the tree's root node
                var first_root = pathbuilder.Roots[0];
                var root_n     = ns_node_map[first_root];
                tree_layout.Root = root_n;
            }
            else
            {
                // if there are multiple root namespaces, inject an empty placeholder root
                var root_n = new Node();
                tree_layout.Root = root_n;

                foreach (var root_ns in pathbuilder.Roots)
                {
                    var node = ns_node_map[root_ns];
                    tree_layout.Root.Children.Add(node);
                }
            }

            // format the shapes
            foreach (var node in tree_layout.Nodes)
            {
                if (node.Cells == null)
                {
                    node.Cells = new ShapeCells();
                }
                node.Cells.FillForeground      = def_fillcolor;
                node.Cells.CharFont            = fontid;
                node.Cells.LineColor           = def_linecolor;
                node.Cells.ParaHorizontalAlign = "0";
            }

            var cxn_cells = new ShapeCells();

            cxn_cells.LineColor = def_linecolor;
            tree_layout.LayoutOptions.ConnectorCells = cxn_cells;


            tree_layout.Render(doc.Application.ActivePage);

            DeveloperCommands.hide_ui_stuff(doc);
            return(doc);
        }
Ejemplo n.º 7
0
        private static BoxLayout CreateTwoLevelLayout(List <string[]> data)
        {
            double itemsep = 0.0;
            var    major_group_direction = Direction.LeftToRight;
            var    minor_group_direction = Direction.TopToBottom;

            var name_to_major_group = new Dictionary <string, Container>();
            var name_to_minor_group = new Dictionary <string, Container>();

            var layout1 = new BoxLayout();

            layout1.Root = new Container(major_group_direction);

            var major_cells = new ShapeCells();

            major_cells.FillForeground         = "rgb(245,245,245)";
            major_cells.CharFont               = 0;
            major_cells.CharSize               = "12pt";
            major_cells.ParaHorizontalAlign    = "0";
            major_cells.TextBlockVerticalAlign = "0";
            major_cells.LineWeight             = "0";
            major_cells.LinePattern            = "0";

            var minor_cells = new ShapeCells();

            minor_cells.FillForeground         = "rgb(230,230,230)";
            minor_cells.CharFont               = 0;
            minor_cells.CharSize               = "10pt";
            minor_cells.ParaHorizontalAlign    = "0";
            minor_cells.TextBlockVerticalAlign = "0";
            minor_cells.LineWeight             = "0";
            minor_cells.LinePattern            = "0";

            var item_cells = new ShapeCells();

            item_cells.CharFont               = 0;
            item_cells.FillPattern            = "0";
            item_cells.CharSize               = "8pt";
            item_cells.ParaHorizontalAlign    = "0";
            item_cells.TextBlockVerticalAlign = "0";
            item_cells.LineWeight             = "0";
            item_cells.LinePattern            = "0";


            foreach (var row in data)
            {
                var majorname = row[0];
                var minorname = row[1];
                var itemname  = row[2];

                Container majorcnt;
                if (name_to_major_group.ContainsKey(majorname))
                {
                    majorcnt = name_to_major_group[majorname];
                }
                else
                {
                    majorcnt = layout1.Root.AddContainer(minor_group_direction, 1, 1);

                    var major_info = new TwoLevelInfo();
                    major_info.Text       = majorname;
                    major_info.Render     = true;
                    major_info.ShapeCells = major_cells;
                    majorcnt.Data         = major_info;


                    name_to_major_group[majorname] = majorcnt;

                    Box headerbox = majorcnt.AddBox(2, 0.25);
                }

                Container minorcnt;
                var       minorkey = majorname + "___" + minorname;
                if (name_to_minor_group.ContainsKey(minorkey))
                {
                    minorcnt = name_to_minor_group[minorkey];
                }
                else
                {
                    minorcnt = majorcnt.AddContainer(minor_group_direction);
                    minorcnt.ChildSpacing = itemsep;
                    var minor_info = new TwoLevelInfo();
                    minor_info.Text               = minorname;
                    minor_info.Render             = true;
                    minor_info.ShapeCells         = minor_cells;
                    minorcnt.Data                 = minor_info;
                    name_to_minor_group[minorkey] = minorcnt;

                    Box headerbox = minorcnt.AddBox(2, 0.25);
                }

                Box itembox = minorcnt.AddBox(2, 0.25);

                var item_info = new TwoLevelInfo();
                item_info.Text   = itemname;
                item_info.Render = true;


                item_info.ShapeCells = item_cells;

                itembox.Data = item_info;
            }
            return(layout1);
        }
Ejemplo n.º 8
0
 public void ApplyFormulasTo(ShapeCells other)
 {
     if (this.Width.HasValue) { other.Width = this.Width; }
     if (this.Height.HasValue) { other.Height = this.Height; }
     if (this.Angle.HasValue) { other.Angle = this.Angle; }
     if (this.PinX.HasValue) { other.PinX = this.PinX; }
     if (this.PinY.HasValue) { other.PinY = this.PinY; }
     if (this.LocPinX.HasValue) { other.LocPinX = this.LocPinX; }
     if (this.LocPinY.HasValue) { other.LocPinY = this.LocPinY; }
     if (this.FillBkgnd.HasValue) { other.FillBkgnd = this.FillBkgnd; }
     if (this.FillBkgndTrans.HasValue) { other.FillBkgndTrans = this.FillBkgndTrans; }
     if (this.FillForegnd.HasValue) { other.FillForegnd = this.FillForegnd; }
     if (this.FillForegndTrans.HasValue) { other.FillForegndTrans = this.FillForegndTrans; }
     if (this.FillPattern.HasValue) { other.FillPattern = this.FillPattern; }
     if (this.ShapeShdwObliqueAngle.HasValue) { other.ShapeShdwObliqueAngle = this.ShapeShdwObliqueAngle; }
     if (this.ShapeShdwOffsetX.HasValue) { other.ShapeShdwOffsetX = this.ShapeShdwOffsetX; }
     if (this.ShapeShdwOffsetY.HasValue) { other.ShapeShdwOffsetY = this.ShapeShdwOffsetY; }
     if (this.ShapeShdwScaleFactor.HasValue) { other.ShapeShdwScaleFactor = this.ShapeShdwScaleFactor; }
     if (this.ShapeShdwType.HasValue) { other.ShapeShdwType = this.ShapeShdwType; }
     if (this.ShdwBkgnd.HasValue) { other.ShdwBkgnd = this.ShdwBkgnd; }
     if (this.ShdwBkgndTrans.HasValue) { other.ShdwBkgndTrans = this.ShdwBkgndTrans; }
     if (this.ShdwForegnd.HasValue) { other.ShdwForegnd = this.ShdwForegnd; }
     if (this.ShdwForegndTrans.HasValue) { other.ShdwForegndTrans = this.ShdwForegndTrans; }
     if (this.ShdwPattern.HasValue) { other.ShdwPattern = this.ShdwPattern; }
     if (this.BeginArrow.HasValue) { other.BeginArrow = this.BeginArrow; }
     if (this.BeginArrowSize.HasValue) { other.BeginArrowSize = this.BeginArrowSize; }
     if (this.EndArrow.HasValue) { other.EndArrow = this.EndArrow; }
     if (this.EndArrowSize.HasValue) { other.EndArrowSize = this.EndArrowSize; }
     if (this.LineCap.HasValue) { other.LineCap = this.LineCap; }
     if (this.LineColor.HasValue) { other.LineColor = this.LineColor; }
     if (this.LineColorTrans.HasValue) { other.LineColorTrans = this.LineColorTrans; }
     if (this.LinePattern.HasValue) { other.LinePattern = this.LinePattern; }
     if (this.LineWeight.HasValue) { other.LineWeight = this.LineWeight; }
     if (this.Rounding.HasValue) { other.Rounding = this.Rounding; }
     if (this.CharAsianFont.HasValue) { other.CharAsianFont = this.CharAsianFont; }
     if (this.CharCase.HasValue) { other.CharCase = this.CharCase; }
     if (this.CharColor.HasValue) { other.CharColor = this.CharColor; }
     if (this.CharComplexScriptFont.HasValue) { other.CharComplexScriptFont = this.CharComplexScriptFont; }
     if (this.CharComplexScriptSize.HasValue) { other.CharComplexScriptSize = this.CharComplexScriptSize; }
     if (this.CharDoubleStrikeThrough.HasValue) { other.CharDoubleStrikeThrough = this.CharDoubleStrikeThrough; }
     if (this.CharDoubleUnderline.HasValue) { other.CharDoubleUnderline = this.CharDoubleUnderline; }
     if (this.CharFont.HasValue) { other.CharFont = this.CharFont; }
     if (this.CharLangID.HasValue) { other.CharLangID = this.CharLangID; }
     if (this.CharLocale.HasValue) { other.CharLocale = this.CharLocale; }
     if (this.CharLocalizeFont.HasValue) { other.CharLocalizeFont = this.CharLocalizeFont; }
     if (this.CharOverline.HasValue) { other.CharOverline = this.CharOverline; }
     if (this.CharPerpendicular.HasValue) { other.CharPerpendicular = this.CharPerpendicular; }
     if (this.CharPos.HasValue) { other.CharPos = this.CharPos; }
     if (this.CharRTLText.HasValue) { other.CharRTLText = this.CharRTLText; }
     if (this.CharFontScale.HasValue) { other.CharFontScale = this.CharFontScale; }
     if (this.CharSize.HasValue) { other.CharSize = this.CharSize; }
     if (this.CharLetterspace.HasValue) { other.CharLetterspace = this.CharLetterspace; }
     if (this.CharStrikethru.HasValue) { other.CharStrikethru = this.CharStrikethru; }
     if (this.CharStyle.HasValue) { other.CharStyle = this.CharStyle; }
     if (this.CharTransparency.HasValue) { other.CharTransparency = this.CharTransparency; }
     if (this.CharUseVertical.HasValue) { other.CharUseVertical = this.CharUseVertical; }
     if (this.BottomMargin.HasValue) { other.BottomMargin = this.BottomMargin; }
     if (this.DefaultTabstop.HasValue) { other.DefaultTabstop = this.DefaultTabstop; }
     if (this.LeftMargin.HasValue) { other.LeftMargin = this.LeftMargin; }
     if (this.RightMargin.HasValue) { other.RightMargin = this.RightMargin; }
     if (this.TextBkgnd.HasValue) { other.TextBkgnd = this.TextBkgnd; }
     if (this.TextBkgndTrans.HasValue) { other.TextBkgndTrans = this.TextBkgndTrans; }
     if (this.TextDirection.HasValue) { other.TextDirection = this.TextDirection; }
     if (this.TopMargin.HasValue) { other.TopMargin = this.TopMargin; }
     if (this.VerticalAlign.HasValue) { other.VerticalAlign = this.VerticalAlign; }
     if (this.ParaBullet.HasValue) { other.ParaBullet = this.ParaBullet; }
     if (this.ParaBulletFont.HasValue) { other.ParaBulletFont = this.ParaBulletFont; }
     if (this.ParaBulletFontSize.HasValue) { other.ParaBulletFontSize = this.ParaBulletFontSize; }
     if (this.ParaBulletString.HasValue) { other.ParaBulletString = this.ParaBulletString; }
     if (this.ParaFlags.HasValue) { other.ParaFlags = this.ParaFlags; }
     if (this.ParaHorizontalAlign.HasValue) { other.ParaHorizontalAlign = this.ParaHorizontalAlign; }
     if (this.ParaIndentFirst.HasValue) { other.ParaIndentFirst = this.ParaIndentFirst; }
     if (this.ParaIndentLeft.HasValue) { other.ParaIndentLeft = this.ParaIndentLeft; }
     if (this.ParaIndentRight.HasValue) { other.ParaIndentRight = this.ParaIndentRight; }
     if (this.ParaLocBulletFont.HasValue) { other.ParaLocBulletFont = this.ParaLocBulletFont; }
     if (this.ParaSpacingAfter.HasValue) { other.ParaSpacingAfter = this.ParaSpacingAfter; }
     if (this.ParaSpacingBefore.HasValue) { other.ParaSpacingBefore = this.ParaSpacingBefore; }
     if (this.ParaSpacingLine.HasValue) { other.ParaSpacingLine = this.ParaSpacingLine; }
     if (this.ParaTextPosAfterBullet.HasValue) { other.ParaTextPosAfterBullet = this.ParaTextPosAfterBullet; }
     if (this.TxtAngle.HasValue) { other.TxtAngle = this.TxtAngle; }
     if (this.TxtHeight.HasValue) { other.TxtHeight = this.TxtHeight; }
     if (this.TxtLocPinX.HasValue) { other.TxtLocPinX = this.TxtLocPinX; }
     if (this.TxtLocPinY.HasValue) { other.TxtLocPinY = this.TxtLocPinY; }
     if (this.TxtPinX.HasValue) { other.TxtPinX = this.TxtPinX; }
     if (this.TxtPinY.HasValue) { other.TxtPinY = this.TxtPinY; }
     if (this.TxtWidth.HasValue) { other.TxtWidth = this.TxtWidth; }
     if (this.ConFixedCode.HasValue) { other.ConFixedCode = this.ConFixedCode; }
     if (this.ConLineJumpCode.HasValue) { other.ConLineJumpCode = this.ConLineJumpCode; }
     if (this.ConLineJumpDirX.HasValue) { other.ConLineJumpDirX = this.ConLineJumpDirX; }
     if (this.ConLineJumpDirY.HasValue) { other.ConLineJumpDirY = this.ConLineJumpDirY; }
     if (this.ConLineJumpStyle.HasValue) { other.ConLineJumpStyle = this.ConLineJumpStyle; }
     if (this.ConLineRouteExt.HasValue) { other.ConLineRouteExt = this.ConLineRouteExt; }
     if (this.ShapeFixedCode.HasValue) { other.ShapeFixedCode = this.ShapeFixedCode; }
     if (this.ShapePermeablePlace.HasValue) { other.ShapePermeablePlace = this.ShapePermeablePlace; }
     if (this.ShapePermeableX.HasValue) { other.ShapePermeableX = this.ShapePermeableX; }
     if (this.ShapePermeableY.HasValue) { other.ShapePermeableY = this.ShapePermeableY; }
     if (this.ShapePlaceFlip.HasValue) { other.ShapePlaceFlip = this.ShapePlaceFlip; }
     if (this.ShapePlaceStyle.HasValue) { other.ShapePlaceStyle = this.ShapePlaceStyle; }
     if (this.ShapePlowCode.HasValue) { other.ShapePlowCode = this.ShapePlowCode; }
     if (this.ShapeRouteStyle.HasValue) { other.ShapeRouteStyle = this.ShapeRouteStyle; }
     if (this.ShapeSplit.HasValue) { other.ShapeSplit = this.ShapeSplit; }
     if (this.ShapeSplittable.HasValue) { other.ShapeSplittable = this.ShapeSplittable; }
 }