Пример #1
0
 public void SetLineStyle(TableLineStyle rowlines)
 {
     if (this.selKind_ == TableCellKind.RowSelected)
     {
         MRow row = this.GetRow(this.curRow);
         row.lines = rowlines;
     }
 }
Пример #2
0
 public void SetTableLineStyle(TableLineStyle colLines)
 {
     if (this.selKind_ == TableCellKind.ColSelected)
     {
         this.colLines[this.curCol] = colLines;
     }
 }
Пример #3
0
 public MTable(Node node)
 {
     this.colColSpan = 0;
     this.totalHorzFrameSpacing = 0;
     this.totalWidth = 0;
     this.minWidth = 30;
     this.totalVertFrameSpacing = 0;
     this.tableAlign = 0;
     this.rowFrameSpacing = 0;
     this.colFrameSpacing = 0;
     this.maxWidth = 0;
     this.curRow = 0;
     this.curCol = 0;
     this.selKind_ = TableCellKind.SelAll;
     this.displayStyle = false;
     this.equalRows = false;
     this.equalColumns = false;
     this.align = TableAlign.AXIS;
     this.frame = TableLineStyle.NONE;
     this.framespacing = "0.4em 0.5ex";
     this.side = Side.RIGHT;
     this.minlabelSpacing = "0.8em";
     this.colLines = new TableLineStyle[] { TableLineStyle.NONE };
     this.colSpacing = new string[] { "0.8em" };
     this.colAligns = new HAlign[] { HAlign.CENTER };
     this.rowAligns = new RowAlign[] { RowAlign.BASELINE };
     this.node_ = node;
     this.attrs = AttributeBuilder.mtableAttributes(node);
     if (this.attrs != null)
     {
         this.rowAligns = this.attrs.rowAligns;
         this.colAligns = this.attrs.colAligns;
         this.colLines = this.attrs.colLines;
         this.colSpacing = this.attrs.colSpacing;
         this.displayStyle = this.attrs.displaystyle;
         this.equalRows = this.attrs.equalRows;
         this.equalColumns = this.attrs.equalColumns;
         this.align = this.attrs.align;
         this.frame = this.attrs.frame;
         this.framespacing = this.attrs.framespacing;
         this.side = this.attrs.side;
         this.minlabelSpacing = this.attrs.minlabelspacing;
     }
     this.rows = new ArrayList();
     if (node.HasChildren())
     {
         NodesList nodesList = node.GetChildrenNodes();
         Node n = nodesList.Next();
         for (int i = 0; n != null; i++)
         {
             MRow row = this.AddRow(n, i);
             if (this.attrs != null)
             {
                 if (i < this.attrs.rowSpacing.Length)
                 {
                     row.spacing = this.attrs.rowSpacing[i];
                 }
                 else if (this.attrs.rowSpacing.Length > 0)
                 {
                     row.spacing = this.attrs.rowSpacing[this.attrs.rowSpacing.Length - 1];
                 }
                 if (i < this.attrs.rowLines.Length)
                 {
                     row.lines = this.attrs.rowLines[i];
                 }
                 else if (this.attrs.rowLines.Length > 0)
                 {
                     row.lines = this.attrs.rowLines[this.attrs.rowLines.Length - 1];
                 }
             }
             if (row.attrs != null)
             {
                 row.colAligns = row.attrs.colAligns;
                 row.align = row.attrs.align;
             }
             if (n.HasChildren())
             {
                 NodesList list = n.GetChildrenNodes();
                 Node child = list.Next();
                 int colSpan = 0;
                 if (n.type_.type == ElementType.Mlabeledtr)
                 {
                     row.isLabeled = true;
                     MCell cell = row.AddLabel(child, n.numChildren - 1);
                     if (cell.tableAttrs != null)
                     {
                         cell.rowAlign = cell.tableAttrs.rowAlign;
                         cell.columnAlign = cell.tableAttrs.columnAlign;
                         cell.columnSpan = cell.tableAttrs.columnSpan;
                         cell.rowSpan = cell.tableAttrs.rowSpan;
                     }
                     child = list.Next();
                 }
                 while (child != null)
                 {
                     MCell cell = row.AddCell(child, colSpan);
                     if (cell.tableAttrs != null)
                     {
                         cell.rowAlign = cell.tableAttrs.rowAlign;
                         cell.columnAlign = cell.tableAttrs.columnAlign;
                         cell.columnSpan = cell.tableAttrs.columnSpan;
                         cell.rowSpan = cell.tableAttrs.rowSpan;
                     }
                     child = list.Next();
                     if ((cell.tableAttrs != null) && (cell.tableAttrs.columnSpan > 1))
                     {
                         colSpan += cell.tableAttrs.columnSpan;
                         continue;
                     }
                     colSpan++;
                 }
                 if (colSpan > this.colColSpan)
                 {
                     this.colColSpan = colSpan;
                 }
             }
             n = nodesList.Next();
         }
     }
     if (this.colLines.Length < this.colColSpan)
     {
         TableLineStyle[] lines = new TableLineStyle[this.colColSpan];
         for (int colIndex = 0; colIndex < this.colColSpan; colIndex++)
         {
             if (colIndex < this.colLines.Length)
             {
                 lines[colIndex] = this.colLines[colIndex];
             }
             else if (this.colLines.Length > 0)
             {
                 lines[colIndex] = this.colLines[this.colLines.Length - 1];
             }
             else
             {
                 lines[colIndex] = TableLineStyle.NONE;
             }
         }
         this.colLines = lines;
     }
     if (this.colSpacing.Length < this.colColSpan)
     {
         string[] strings = new string[this.colColSpan];
         for (int colIndex = 0; colIndex < this.colColSpan; colIndex++)
         {
             if (colIndex < this.colSpacing.Length)
             {
                 strings[colIndex] = this.colSpacing[colIndex];
             }
             else if (this.colSpacing.Length > 0)
             {
                 strings[colIndex] = this.colSpacing[this.colSpacing.Length - 1];
             }
             else
             {
                 strings[colIndex] = "0.8em";
             }
         }
         this.colSpacing = strings;
     }
     for (int rowIndex = 0; rowIndex < this.RowCount; rowIndex++)
     {
         MRow row = this.GetRow(rowIndex);
         if (row.isLabeled && (row.cell != null))
         {
             row.cell.colSpan = this.ColCount;
         }
     }
     this.UpdateRowspan();
     this.FixVAligns();
     this.FixHAligns();
     this.UpdateUpDownTies();
 }