private static int CompareRIsByX(ReportItem x, ReportItem y) { // order by left position int l1 = x.Left == null ? 0 : x.Left.Size; int l2 = y.Left == null ? 0 : y.Left.Size; int rc = l1 - l2; if (rc != 0) return rc; // then by width l1 = x.Width == null ? int.MaxValue : x.Width.Size; l2 = y.Width == null ? int.MaxValue : y.Width.Size; rc = l1 - l2; if (rc != 0) return rc; // then by y position int t1 = x.Top == null ? 0 : x.Top.Size; int t2 = y.Top == null ? 0 : y.Top.Size; return t1 - t2; }
int PositioningWidth(ReportItem ri) { int w; if (ri.Width == null) { if (ri is Table) { Table t = ri as Table; w = t.WidthInUnits; } else w = int.MaxValue/2; // MaxValue/2 is just meant to be a large number (but won't overflow when adding in the x) } else w = ri.Width.Size; return w; }
private StyleInfo GetStyle(ReportItem ri, Row row) { if (ri.Style == null) return null; return ri.Style.GetStyleInfo(r, row); }
private static bool InTable(ReportItem tb) { Type tp = tb.Parent.Parent.GetType(); return (tp == typeof(TableCell) || tp == typeof(Corner) || tp == typeof(DynamicColumns) || tp == typeof(DynamicRows) || tp == typeof(StaticRow) || tp == typeof(StaticColumn) || tp == typeof(Subtotal) || tp == typeof(MatrixCell)); }
private static bool InList(ReportItem tb) { Type tp = tb.Parent.Parent.GetType(); return (tp == typeof(List)); }
public void MatrixCellStart(Matrix m, ReportItem ri, int row, int column, Row r, float h, float w, int colSpan) { _MatrixCellSpan = colSpan; // save this so that we can put out the right number of \cell if (column != 0) return; // Handle start of new row tw.Write(@"\trowd \trql\trgaph108\trrh0\trleft236"); if (row < _MatrixHeaderRows) // repeat table header on multiple pages tw.Write(@"\trhdr"); int pos = 0; foreach (int width in _MatrixColumnWidths) { pos += width; string border; if (ri != null && ri.Style != null) { StyleInfo si = ri.Style.GetStyleInfo(this.r, r); border = string.Format(@"\clbrdrt\{0}\clbrdrl\{1}\clbrdrb\{2}\clbrdrr\{3}", GetBorderStyle(si.BStyleTop), GetBorderStyle(si.BStyleLeft), GetBorderStyle(si.BStyleBottom), GetBorderStyle(si.BStyleRight)); } else border = @"\clbrdrt\brdrs\clbrdrl\brdrs\clbrdrb\brdrs\clbrdrr\brdrs"; tw.Write(@"{1}\cellx{0}", pos, border); } tw.Write(@"\pard \intbl"); }
public void MatrixCellEnd(Matrix m, ReportItem ri, int row, int column, Row r) { tw.Write(@"\cell"); }
public void MatrixCellStart(Matrix m, ReportItem ri, int row, int column, Row r, float h, float w, int colSpan) { }
public void MatrixCellStart(Matrix m, ReportItem ri, int row, int column, Row r, float h, float w, int colSpan) { if (ri == null) // Empty cell? { if (_SkipMatrixCols == 0) tw.Write("<td>"); return; } string cssName = CssAdd(ri.Style, ri, r, false, h, w); // get the style name for this item tw.Write("<td id='{0}'", cssName); if (colSpan != 1) { tw.Write(" colspan={0}", colSpan); _SkipMatrixCols=-(colSpan-1); // start it as negative as indicator that we need this </td> } else _SkipMatrixCols=0; if (ri is Textbox) { Textbox tb = (Textbox) ri; if (tb.IsToggle && tb.Name != null) // name is required for this { string name = tb.Name.Nm + "_" + (tb.RunCount(this.r)+1).ToString(); bScriptToggle = true; // we need to generate JavaScript in header // TODO -- need to calculate the hide count correctly tw.Write(" onClick=\"hideShow(this, {0}, '{1}')\" onMouseOver=\"style.cursor ='hand'\"", 0, name); } } tw.Write(">"); }
int _ColSpan; // # of columns spanned internal MatrixCellEntry(Rows d, ReportItem ri) { _Data = d; _DisplayItem = ri; _ColSpan = 1; }
private static int CompareRIsByY(ReportItem x, ReportItem y) { // order by y position int t1 = x.Top == null ? 0 : x.Top.Size; int t2 = y.Top == null ? 0 : y.Top.Size; int rc = t1 - t2; if (rc != 0) return rc; // then by height t1 = x.Height == null ? int.MaxValue : x.Height.Size; t2 = y.Height == null ? int.MaxValue : y.Height.Size; rc = t1 - t2; if (rc != 0) return rc; // then by x position int l1 = x.Left == null ? 0 : x.Left.Size; int l2 = y.Left == null ? 0 : y.Left.Size; return l1 - l2; }
public void MatrixCellEnd(Matrix m, ReportItem ri, int row, int column, Row r) { }
public void MatrixCellEnd(Matrix m, ReportItem ri, int row, int column, Row r) { if (_SkipMatrixCols == 0) tw.Write("</td>"); else if (_SkipMatrixCols < 0) { tw.Write("</td>"); _SkipMatrixCols = -_SkipMatrixCols; } else _SkipMatrixCols--; return; }
internal void PositioningFinalPass(int i, List <ReportItem> items) { if (items.Count == 1 || i == 0) // Nothing to do if only one item in list or 1st item in list { return; } int x = this.Left == null? 0: this.Left.Size; int w = PositioningWidth(this); int right = x + w; int y = (this.Top == null? 0: this.Top.Size); if (this is Line) { // normalize the width if (w < 0) { x -= w; w = -w; } } this._YParents = new List <ReportItem>(); int maxParents = 100; // heuristic to limit size of parents; otherwise processing in // extreme cases can blow up for (int ti = i - 1; ti >= 0 && maxParents > 0; ti--) { ReportItem ri = items[ti]; int xw = ri.Left == null? 0: ri.Left.Size; int w2 = PositioningWidth(ri); if (ri is Line) { // normalize the width if (w2 < 0) { xw -= w2; w2 = -w2; } } if (ri.Height == null || ri.Top == null) // if position/height not specified don't use to reposition { continue; } if (y < ri.Top.Size + ri.Height.Size) { continue; } _YParents.Add(ri); // X coordinate overlap maxParents--; if (xw <= x && xw + w2 >= x + w && // if item above completely covers the report item then it will be pushed down first maxParents > 30) // and we haven't already set the maxParents. { maxParents = 30; // just add a few more if necessary } } //foreach (ReportItem ri in items) //{ // if (ri == this) // break; // int xw = ri.Left == null ? 0 : ri.Left.Size; // int w2 = PositioningWidth(ri); // if (ri is Line) // { // normalize the width // if (w2 < 0) // { // xw -= w2; // w2 = -w2; // } // } // //if (xw > right || x > xw + w2) // this allows items to be repositioned only based on what's above them // // continue; // if (ri.Height == null || ri.Top == null) // if position/height not specified don't use to reposition // continue; // if (y < ri.Top.Size + ri.Height.Size) // continue; // _YParents.Add(ri); // X coordinate overlap //} // Reduce the overhead if (this._YParents.Count == 0) { this._YParents = null; } else { this._YParents.TrimExcess(); } return; }