object MathML.MathMLVisitor.Visit(MathMLTableElement e, object args) { MathMLTableSizer sizer = new MathMLTableSizer((IFormattingContext)args, this, e); return(sizer.BoundingBox); }
object MathML.MathMLVisitor.Visit(MathMLTableElement e, object args) { MathMLTableSizer sizer = new MathMLTableSizer((IFormattingContext)args, this, e); return sizer.BoundingBox; }
public object Visit(MathMLTableElement e, object args) { Area cache = Area.GetArea(e); if(cache != null) return cache; IFormattingContext ctx = ((IFormattingContext)args).Clone(); MathMLTableSizer sizer = new MathMLTableSizer(ctx, measurer, e); ArrayList cells = new ArrayList(); Debug.WriteLine("Formatting table, extent will be: " + sizer.BoundingBox); for(int i = 0; i < sizer.Cells.Length; i++) { for(int j = 0; j < sizer.Cells[i].Length; j++) { if(sizer.Cells[i][j] != null) { Debug.WriteLine("Formatting cell at [" + i + "][" + j + "] to size of " + sizer.CellSizes[i][j] + ", shift of " + sizer.CellShifts[i][j]); // format an area, try to stretch the area to fit the cell ctx.Stretch = sizer.CellSizes[i][j]; Area cell = (Area)sizer.Cells[i][j].Accept(this, ctx); // get attributes of cell BoundingBox cellSize = sizer.CellSizes[i][j]; PointF cellShift = sizer.CellShifts[i][j]; // adjust the cell shift so the area is aligned properly PointF areaShift = GetCellAlignment(sizer.Cells[i][j], cell, ctx, cellSize, cellShift); cells.Add(new TableCellArea(sizer.Cells[i][j], cell, cellSize, cellShift, areaShift)); } Debug.WriteLineIf(sizer.Cells[i][j] == null, "Cell at [" + i + "][" + j + "] is null"); } } return new TableArea(e, (Area[])cells.ToArray(typeof(Area)), sizer.BoundingBox, sizer.SolidLines, sizer.DashedLines); }