/// <summary> /// calc absolute location. /// </summary> /// <param name="Loc"></param> /// <param name="Start"></param> /// <returns></returns> public static IScreenLoc AbsoluteLoc(this IScreenLoc Loc, IScreenLoc Start) { var rowNum = Start.RowNum + Loc.RowNum; var colNum = Start.ColNum + Loc.ColNum; if (Loc.LocationFrame == LocationFrame.OneBased) { rowNum -= 1; colNum -= 1; } return(Loc.NewInstance(rowNum, colNum)); }
public static DataItemReport CaptureReport(this IScreenSection section, ScreenContent Content) { var sb = new StringBuilder(); var sectionHeader = section as ISectionHeader; var sectionDim = section.CalcDim(); var itemReport = new DataItemReport(); IScreenLoc start = section.ScreenLoc; { start = start.NewInstance(start.RowNum, start.ColNum); } int repeatIx = 0; bool endOfRows = false; while (endOfRows == false) { if ((repeatIx > 0) && (repeatIx >= section.RepeatCount)) { break; } repeatIx += 1; // section is a subfile. subfile row can be blank. If blank consider as // the end of rows of the subfile. So no need to match. bool rowIsBlank = false; if (section.PurposeCode == ScreenPurposeCode.ReportDetail) { if (Content.RowIsBlank(start.RowNum) == true) { rowIsBlank = true; } } // a blank row. no more rows to match. if (rowIsBlank == true) { endOfRows = true; } if (endOfRows == false) { var report = sectionHeader.CaptureToReport(start, Content); var combo = DataItemReport.CombineVertically(itemReport, report); itemReport = combo; } start.RowNum += 1; } return(itemReport); }
public static bool Match(this IScreenSection section, ScreenContent Content, string DebugInfo) { bool isMatch = true; var header = section as ISectionHeader; var sectionDim = section.CalcDim(); IScreenLoc start = section.ScreenLoc; { start = start.NewInstance(start.RowNum, start.ColNum); } int repeatIx = 0; bool endOfRows = false; while (isMatch == true) { if ((repeatIx > 0) && (repeatIx >= section.RepeatCount)) { break; } repeatIx += 1; // section is a subfile. subfile row can be blank. If blank consider as // the end of rows of the subfile. So no need to match. bool rowIsBlank = false; if (section.PurposeCode == ScreenPurposeCode.ReportDetail) { if (Content.RowIsBlank(start.RowNum) == true) { rowIsBlank = true; } } // a blank row. no more rows to match. if (rowIsBlank == true) { endOfRows = true; } if (endOfRows == false) { isMatch = header.Match(start, Content, DebugInfo); } start.RowNum += 1; } return(isMatch); }
public static IScreenLoc Advance(this IScreenLoc Loc, int Length, ScreenDim Dim) { int col = Loc.ColNum + Length; int row = Loc.RowNum; // adjust to zero based. if (Loc.LocationFrame == LocationFrame.OneBased) { col -= 1; row -= 1; } // negative advance and column off the charts to the left. while (col < 0) { col += Dim.Width; row -= 1; if (row < 0) { row = Dim.Height - 1; } } // positive advance and column out of bounds to the right. while (col >= Dim.Width) { col -= Dim.Width; row += 1; if (row >= Dim.Height) { row = Dim.Height - 1; } } // back to one based. if (Loc.LocationFrame == LocationFrame.OneBased) { col += 1; row += 1; } return(Loc.NewInstance(row, col)); }