public static bool DoesSpanMultipleRows(IRowCol ItemRowCol, byte?AttrByte, int ShowLength) { bool doesSpan = false; var showRowCol = ItemRowCol; if (AttrByte != null) { showRowCol = ItemRowCol.Advance(1); } var endRowCol = showRowCol; if (ShowLength > 0) { endRowCol = showRowCol.Advance(ShowLength - 1); } if (showRowCol.RowNum == endRowCol.RowNum) { doesSpan = false; } else { doesSpan = true; } return(doesSpan); }
public RowColRange(IRowCol From, int Length) { this.From = From; if (Length == 0) { this.To = From; } else { this.To = From.Advance(Length - 1); } }
/// <summary> /// calc and return the end pos of the show text of the text data order. /// </summary> /// <param name="ShowRowCol"></param> /// <returns></returns> public IRowCol ShowEndRowCol(IRowCol ShowRowCol) { IRowCol endRowCol = null; int lx = 0; if (this.TextBytes != null) { lx = this.TextBytes.Length; } if (lx > 0) { endRowCol = ShowRowCol.Advance(lx - 1); } return(endRowCol); }
public IRowCol ItemEndRowCol(IRowCol CurRowCol) { IRowCol endRowCol = null; int lx = 0; if (this.AttrByte != null) { lx = 1; } if (this.TextBytes != null) { lx += this.TextBytes.Length; } if (this.TailAttrByte != null) { lx += 1; } if (lx > 0) { endRowCol = CurRowCol.Advance(lx - 1); } return(endRowCol); }
private static void CreateTextBlockSegments( VisualSpanner Parent, string Text, IRowCol StartRowCol, byte?AttrByte, CanvasDefn CanvasDefn) { IRowCol rowCol = StartRowCol; string text = Text; int segNum = 0; int segBx = 0; // advance past attrByte. #if skip if (AttrByte != null) { rowCol = rowCol.Advance(1); } #endif bool attrByteOccupySpace = true; // loop create textblock segments until no more text. while (text.Length > 0) { // space on this row. var remLx = rowCol.GetRowRemaining(); if (attrByteOccupySpace == true) { remLx -= 1; } // text to place on current row. int usedLx = 0; if (remLx > text.Length) { usedLx = text.Length; } else { usedLx = remLx; } // create the textblock segment. if (usedLx > 0) { segNum += 1; var vtb = new VisualTextBlockSegment( Parent, segNum, segBx, Text.Substring(segBx, usedLx), rowCol as ZeroRowCol, AttrByte, CanvasDefn, attrByteOccupySpace); vtb.SetupUnderline(); Parent.SegmentList.Add(vtb); // advance to next segment in show text. segBx += usedLx; if (text.Length > usedLx) { text = text.Substring(usedLx); } else { text = ""; } } // advance rowCol if (attrByteOccupySpace == true) { usedLx += 1; } rowCol = rowCol.Advance(usedLx); attrByteOccupySpace = false; } }
public static IRowCol AdvanceRight(this IRowCol RowCol) { var rowCol = RowCol.Advance(1); return(rowCol); }
public static IRowCol AdvanceLeft(this IRowCol RowCol) { var rowCol = RowCol.Advance(-1); return(rowCol); }
/// <summary> /// advance the RowCol cursor based on the attribute bytes and show text of the /// text data order. /// </summary> /// <param name="Current"></param> /// <returns></returns> public override IRowCol Advance(IRowCol Current) { var nextRowCol = Current.Advance(this.ItemLength()); return(nextRowCol); }