📄 tlmbase.cs
字号:
}
//----------------------------------------------------------------------------------------------------x
/// <summary>Writes the committed horizontal lines.</summary>
/// <param name="bOrderTop">Order</param>
private void WriteCommittedHorLines(Boolean bOrderTop) {
for (Int32 iRow = 0; iRow <= tlmRow_Committed.iIndex; iRow++) {
TlmRow row = aTlmRow[iRow];
// top line
for (Int32 iCol = 0; iCol < al_TlmColumn.Count; iCol++) {
TlmCell cell = row.aTlmCell[iCol];
if (cell == null || cell.bVisibleLineTop(iCol) != bOrderTop) {
continue;
}
if (cell.tlmRow_Start.iIndex != iRow || cell.pp_LineTop == null) {
iCol = cell.tlmColumn_End.iIndex;
continue;
}
Int32 iColEnd = iCol;
OptimizeTopLine(bOrderTop, cell, ref iColEnd);
Double rPosStart = (iCol == cell.tlmColumn_Start.iIndex ? cell.rPosMarginLeft : al_TlmColumn[iCol].rPosX);
TlmColumn col_End = al_TlmColumn[iColEnd];
TlmCell cell_End = row.aTlmCell[iColEnd];
Double rPosEnd = (iCol == col_End.iIndex ? cell_End.rPosMarginRight : col_End.rPosX + col_End.rWidth);
RepLine repLine = new RepLine(cell.pp_LineTop, rPosEnd - rPosStart, rTest);
container_Cur.AddLT(rPosStart, cell.rPosMarginTop, repLine);
iCol = iColEnd;
}
// bottom line
for (Int32 iCol = 0; iCol < al_TlmColumn.Count; iCol++) {
TlmCell cell = row.aTlmCell[iCol];
if (cell == null || cell.bVisibleLineBottom(iCol) != bOrderTop) {
continue;
}
if (cell.tlmRow_End.iIndex != iRow || cell.pp_LineBottom == null) {
iCol = cell.tlmColumn_End.iIndex;
continue;
}
Int32 iColEnd = iCol;
OptimizeBottomLine(bOrderTop, cell, ref iColEnd);
Double rPosStart = (iCol == cell.tlmColumn_Start.iIndex ? cell.rPosMarginLeft : al_TlmColumn[iCol].rPosX);
TlmColumn col_End = al_TlmColumn[iColEnd];
TlmCell cell_End = row.aTlmCell[iColEnd];
Double rPosEnd = (iCol == col_End.iIndex ? cell_End.rPosMarginRight : col_End.rPosX + col_End.rWidth);
RepLine repLine = new RepLine(cell.pp_LineBottom, rPosEnd - rPosStart, -rTest);
container_Cur.AddLT(rPosStart, cell.rPosMarginBottom, repLine);
iCol = iColEnd;
}
}
}
//----------------------------------------------------------------------------------------------------x
/// <summary>This method can be used to optimize the top line.</summary>
/// <param name="bOrderTop">Order</param>
/// <param name="cell">Start cell</param>
/// <param name="iColEnd">End column</param>
private void OptimizeTopLine(Boolean bOrderTop, TlmCell cell, ref Int32 iColEnd) {
}
//----------------------------------------------------------------------------------------------------x
/// <summary>This method can be used to optimize the bottom line.</summary>
/// <param name="bOrderTop">Order</param>
/// <param name="cell">Start cell</param>
/// <param name="iColEnd">End column</param>
private void OptimizeBottomLine(Boolean bOrderTop, TlmCell cell, ref Int32 iColEnd) {
}
//----------------------------------------------------------------------------------------------------x
/// <summary>Writes the committed vertical lines.</summary>
/// <param name="bOrderTop">Order</param>
private void WriteCommittedVertLines(Boolean bOrderTop) {
for (Int32 iCol = 0; iCol < al_TlmColumn.Count; iCol++) {
TlmColumn col = al_TlmColumn[iCol];
// left line
for (Int32 iRow = 0; iRow <= tlmRow_Committed.iIndex; iRow++) {
TlmRow row = aTlmRow[iRow];
TlmCell cell = row.aTlmCell[iCol];
if (cell == null || cell.bVisibleLineLeft(iRow) != bOrderTop) {
continue;
}
if (cell.tlmColumn_Start.iIndex != iCol || cell.pp_LineLeft == null) {
iRow = cell.tlmRow_End.iIndex;
continue;
}
Int32 iRowEnd = iRow;
OptimizeLeftLine(bOrderTop, cell, ref iRowEnd);
Double rPosStart = (iRow == cell.tlmRow_Start.iIndex ? cell.rPosMarginTop : row.rPosTop);
TlmRow row_End = aTlmRow[iRowEnd];
TlmCell cell_End = row_End.aTlmCell[iCol];
Double rPosEnd = (iRow == row_End.iIndex ? cell_End.rPosMarginBottom : row_End.rPosBottom);
RepLine repLine = new RepLine(cell.pp_LineLeft, rTest, rPosEnd - rPosStart);
container_Cur.AddLT(cell.rPosMarginLeft, rPosStart, repLine);
iRow = iRowEnd;
}
// right line
for (Int32 iRow = 0; iRow <= tlmRow_Committed.iIndex; iRow++) {
TlmRow row = aTlmRow[iRow];
TlmCell cell = row.aTlmCell[iCol];
if (cell == null || cell.bVisibleLineRight(iRow) != bOrderTop) {
continue;
}
if (cell.tlmColumn_End.iIndex != iCol || cell.pp_LineRight == null) {
iRow = cell.tlmRow_End.iIndex;
continue;
}
Int32 iRowEnd = iRow;
OptimizeRightLine(bOrderTop, cell, ref iRowEnd);
Double rPosStart = (iRow == cell.tlmRow_Start.iIndex ? cell.rPosMarginTop : row.rPosTop);
TlmRow row_End = aTlmRow[iRowEnd];
TlmCell cell_End = row_End.aTlmCell[iCol];
Double rPosEnd = (iRow == row_End.iIndex ? cell_End.rPosMarginBottom : row_End.rPosBottom);
RepLine repLine = new RepLine(cell.pp_LineRight, -rTest, rPosEnd - rPosStart);
container_Cur.AddLT(cell.rPosMarginRight, rPosStart, repLine);
iRow = iRowEnd;
}
}
}
//----------------------------------------------------------------------------------------------------x
/// <summary>This method can be used to optimize the left line.</summary>
/// <param name="bOrderTop">Order</param>
/// <param name="cell">Start cell</param>
/// <param name="iRowEnd">End row</param>
private void OptimizeLeftLine(Boolean bOrderTop, TlmCell cell, ref Int32 iRowEnd) {
}
//----------------------------------------------------------------------------------------------------x
/// <summary>This method can be used to optimize the right line.</summary>
/// <param name="bOrderTop">Order</param>
/// <param name="cell">Start cell</param>
/// <param name="iRowEnd">End row</param>
private void OptimizeRightLine(Boolean bOrderTop, TlmCell cell, ref Int32 iRowEnd) {
}
//----------------------------------------------------------------------------------------------------x
/// <summary>This method will be called before the report objects will be written to the container.</summary>
internal protected virtual void OnBeforeWrite() {
}
//----------------------------------------------------------------------------------------------------x
/// <summary>Writes all committed objects to the report.</summary>
/// <param name="bLastContainer">Last container</param>
private void WriteCommittedReportObjects(Boolean bLastContainer) {
if (tlmRow_Committed == null) {
return;
}
OnBeforeWrite();
Double rRowCommitted_PosBottom_Contents = tlmRow_Committed.rCalculateBottomPos(true);
Double rRowCommitted_PosBottom_Graphics = rRowCommitted_PosBottom_Contents;
if (tableHeight == TableHeight.Static || (tableHeight == TableHeight.AdjustLast && !bLastContainer)) {
rRowCommitted_PosBottom_Graphics = container_Cur.rHeight;
}
// background
tlmRow_Committed.rPosBottom = rRowCommitted_PosBottom_Graphics;
Byte[,] aaiDone = new Byte[tlmRow_Committed.iIndex + 1, al_TlmColumn.Count]; // 0:init; 1:temp; 2:done
for (Int32 iRow = 0; iRow <= tlmRow_Committed.iIndex; iRow++) {
TlmRow row = aTlmRow[iRow];
for (Int32 iCol = 0; iCol < al_TlmColumn.Count; iCol++) {
if (aaiDone[iRow, iCol] == 2) { // background of this cell has been created before
continue;
}
TlmCell cell = row.aTlmCell[iCol];
if (cell == null || cell.bp_Back == null) {
continue;
}
Int32 iColEnd = iCol;
Int32 iRowEnd = iRow;
OptimizeBackground(aaiDone, ref iRowEnd, ref iColEnd);
Double rPosX1 = (iCol == cell.tlmColumn_Start.iIndex ? cell.rPosMarginLeft : al_TlmColumn[iCol].rPosX);
Double rPosY1 = (iRow == cell.tlmRow_Start.iIndex ? cell.rPosMarginTop : row.rPosTop);
TlmRow row_End = aTlmRow[iRowEnd];
TlmColumn col_End = al_TlmColumn[iColEnd];
TlmCell cell_End = row_End.aTlmCell[iColEnd];
Double rPosX2 = (iColEnd == col_End.iIndex ? cell_End.rPosMarginRight : col_End.rPosX + col_End.rWidth);
Double rPosY2 = (iRowEnd == row_End.iIndex ? cell_End.rPosMarginBottom : row_End.rPosBottom);
#if (Test)
container_Cur.AddLT(rPosX1, rPosY1, new RepLine(pp_Test, rPosX2 - rPosX1, rPosY2 - rPosY1));
#else
RepRect repRect = new RepRect(cell.bp_Back, rPosX2 - rPosX1, rPosY2 - rPosY1);
container_Cur.AddLT(rPosX1, rPosY1, repRect);
#endif
}
}
// contents
tlmRow_Committed.rPosBottom = rRowCommitted_PosBottom_Contents; // vertically aligned contents must have this bottom position
for (Int32 iRow = 0; iRow <= tlmRow_Committed.iIndex; iRow++) {
TlmRow row = aTlmRow[iRow];
for (Int32 iCol = 0; iCol < al_TlmColumn.Count; iCol++) {
TlmCell cell = row.aTlmCell[iCol];
if (cell == null || iRow != cell.tlmRow_Start.iIndex) {
continue;
}
Boolean bLastRow = (Object.ReferenceEquals(cell.tlmRow_End, tlmRow_Committed));
Double rMaxY = cell.rCalculateMaxY(bLastRow);
Double rOfsY = 0;
if (!RT.bEquals(cell.rAngle, -90, 0.001)) {
Debug.Assert(!Double.IsNaN(cell.tlmRow_End.rPosBottom));
rOfsY = (cell.tlmRow_End.rPosBottom - row.rPosTop - rMaxY) * cell.rAlignV;
}
Int32 iRepObjCount = (bLastRow ? cell.tlmColumn_Start.iRepObjCommitted : cell.iRepObjCount);
for (Int32 iRepObj = 0; iRepObj < iRepObjCount; iRepObj++) {
RepObj repObj = cell.repObj_Get(iRepObj);
repObj.matrixD.rDX += cell.rPosMarginLeft;
repObj.matrixD.rDY += cell.rPosMarginTop + rOfsY;
container_Cur.Add(repObj);
}
#if (Test)
Double rX1 = cell.rPosMarginLeft + cell.rIndentLeft;
Double rY1 = cell.rPosMarginTop + cell.rIndentTop;
Double rX2 = cell.rPosMarginRight - cell.rIndentRight;
Double rY2 = cell.rPosMarginBottom - cell.rIndentBottom;
container_Cur.AddLT(rX1, rY1, new RepRect(pp_Test, rX2 - rX1, rY2 - rY1));
#endif
iCol = cell.tlmColumn_End.iIndex;
}
}
// horizontal lines
tlmRow_Committed.rPosBottom = rRowCommitted_PosBottom_Graphics;
WriteCommittedHorLines(false);
WriteCommittedHorLines(true);
WriteCommittedVertLines(false);
WriteCommittedVertLines(true);
// Remove committed report objects
RemoveCommittedRowsAndRepObjs();
_container_Cur = null;
}
//----------------------------------------------------------------------------------------------------x
/// <summary>This method will optimize the background rectangles.</summary>
/// <param name="aaiDone">Status of the cells</param>
/// <param name="iRowEnd">End row</param>
/// <param name="iColEnd">End column</param>
internal protected virtual void OptimizeBackground(Byte[,] aaiDone, ref Int32 iRowEnd, ref Int32 iColEnd) {
TlmRow row = aTlmRow[iRowEnd];
TlmCell cell = row.aTlmCell[iColEnd];
for (Int32 iR = iRowEnd; iR <= cell.tlmRow_End.iIndex; iR++) {
for (Int32 iC = iColEnd; iC <= cell.tlmColumn_End.iIndex; iC++) {
aaiDone[iR, iC] = 2;
}
}
iRowEnd = cell.tlmRow_End.iIndex;
iColEnd = cell.tlmColumn_End.iIndex;
}
//----------------------------------------------------------------------------------------------------x
/// <summary>Commits as many objects as there can be placed into the current container.</summary>
/// <remarks>All rows will be closed except the last.</remarks>
/// <returns>True if a new page is required</returns>
private Boolean bCommit() {
// Get the index and top position of the first uncommitted row that is not closed
Int32 iRow = 0;
Double rY = 0;
if (tlmRow_Committed != null) {
iRow = tlmRow_Committed.iIndex;
if (tlmRow_Committed.status == TlmRow.Status.Closed) {
iRow++;
}
if (iRow > 0) {
rY = aTlmRow[iRow - 1].rPosBottom;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -