private void Render(IVisio.Page page, BL.BoxLayout layout)
        {
            layout.PerformLayout();
            var doc = page.Document;
            var fonts = doc.Fonts;
            var default_font = fonts[this.Font];
            int default_font_id = default_font.ID;
            // Perform Rendering
            var domshapescol = new VA.DOM.ShapeList();
            foreach (var n in layout.Nodes)
            {
                if (n.Data != null)
                {
                    var r = n.Rectangle;
                    var n_data = (RenderItem) n.Data;
                    var s = domshapescol.DrawRectangle(r);

                    // Set Text
                    if (n_data.ShapeText != null)
                    {
                        s.Text = new VA.Text.Markup.TextElement(this.ToUpper ? n_data.ShapeText.ToUpper() : n_data.ShapeText);
                    }

                    // Set Cells
                    if (n_data.Cells != null)
                    {
                        s.Cells = n_data.Cells;
                    }

                    // draw Underline
                    if (n_data.Underline)
                    {
                        var u = domshapescol.DrawLine(r.LowerLeft, r.LowerRight);
                    }

                    n_data.Cells.CharFont = default_font_id;
                }
            }
            domshapescol.Render(page);
        }
 private void draw_cell(CategoryCell cell_item, BL.Container n_row_col)
 {
     var n_cell = n_row_col.AddContainer(BL.Direction.LeftToRight, CellWidth, CellHeight);
     n_cell.ChildSpacing = CellVerticalSeparation/2;
     
     var cell_data = new RenderItem();
     cell_data.CategoryCell = cell_item;
     cell_data.ShapeText = cell_item.Item.Text;
     cell_data.Cells = cellformat;
     n_cell.Data = cell_data;
     
     if (cell_item.Item.Items != null)
     {
         foreach (var sub_cat_items in cell_item.Item.Items)
         {
             var subn_cell = n_cell.AddBox(CellWidth, CellHeight);
             var subcell_data = new RenderItem();
             subcell_data.CategoryCell = null;
             subcell_data.ShapeText = sub_cat_items.Text;
             subcell_data.Cells = subcellformat;
             subn_cell.Data = subcell_data;
         }
         n_cell.AddBox(0.25, 0.25);
     }
 }
 private void add_title(BL.Container root)
 {
     var n_title = root.AddBox(2.0, 0.5);
     var node_data = new RenderItem();
     node_data.CategoryCell = null;
     node_data.ShapeText = this.Title;
     node_data.Cells = titleformat;
     n_title.Data = node_data;
 }
 private BL.BoxLayout create_layout(out BL.Container root)
 {
     var layout = new BL.BoxLayout();
     layout.Root = new BL.Container(BL.Direction.TopToBottom);
     root = layout.Root;
     return layout;
 }
        private void AddMajorRow(List<string> ycats, int row, BL.Container root, List<string> xcats, int cols)
        {
            var n_row = root.AddContainer(BL.Direction.LeftToRight);
            n_row.ChildSpacing = CellHorizontalSeparation;

            // -- add indent
            n_row.AddBox(Indent, 0.25);

            foreach (int col in Enumerable.Range(0, cols))
            {
                var n_cell = n_row.AddContainer(BL.Direction.LeftToRight);

                // ---
                n_cell.Direction = BL.Direction.LeftToRight;
                n_cell.ChildSpacing = CellVerticalSeparation;
                var items_for_cells = this.Items.Where(i => i.XCategory == xcats[col] && i.YCategory == ycats[row]);
                foreach (var cell_item in items_for_cells)
                {
                    draw_cell(cell_item, n_cell);
                }
            }

            var n_row_label = root.AddBox(0.25, CategoryHeight);
            var info = new RenderItem();
            info.CategoryCell = null;
            info.ShapeText = ycats[row];
            info.Cells = ycatformat;
            info.Underline = true;
            n_row_label.Data = info;
        }
        private void AddXCatLabels(List<string> xcats, int cols, BL.Container root)
        {
            var n_row = root.AddContainer(BL.Direction.LeftToRight);
            n_row.ChildSpacing = CellHorizontalSeparation;

            // Add indent
            n_row.AddBox(Indent, 0.25);

            // Add XCategory labels
            foreach (int col in Enumerable.Range(0, cols))
            {
                var n_label = n_row.AddBox(CellWidth, 0.5);
                var info = new RenderItem();
                info.CategoryCell = null;
                info.ShapeText = xcats[col];
                info.Cells = xcatformat;
                n_label.Data = info;
            }
        }