Esempio n. 1
0
        //----------------------------------------------------------------------------------------------------x
        /// <summary>Determines the visibility of the top line in reference to the specified column.</summary>
        /// <param name="iCol">Column index</param>
        /// <returns>If the top line is visible, the method returns <see langword="true"/>, otherwise it returns <see langword="false"/>.</returns>
        internal Boolean bVisibleLineTop(Int32 iCol)
        {
            Debug.Assert(iCol >= tlmColumn_Start.iIndex && iCol <= tlmColumn_End.iIndex);
            Int32 i = tlmRow_Start.iIndex;

            if (i == 0)
            {
                return(true);
            }
            TlmRow  row      = tlmBase.list_TlmRow[i - 1];
            TlmCell cell_Top = row.aTlmCell[iCol];

            return(iOrderLineTop >= cell_Top.iOrderLineBottom);
        }
Esempio n. 2
0
        //----------------------------------------------------------------------------------------------------x
        /// <summary>Determines the visibility of the bottom line in reference to the specified column.</summary>
        /// <param name="iCol">Column index</param>
        /// <returns>If the bottom line is visible, the method returns <see langword="true"/>, otherwise it returns <see langword="false"/>.</returns>
        internal Boolean bVisibleLineBottom(Int32 iCol)
        {
            Debug.Assert(iCol >= tlmColumn_Start.iIndex && iCol <= tlmColumn_End.iIndex);
            Int32 i = tlmRow_End.iIndex;

            if (i >= tlmBase.tlmRow_Committed.iIndex)
            {
                return(true);
            }
            TlmRow  row         = tlmBase.list_TlmRow[i + 1];
            TlmCell cell_Bottom = row.aTlmCell[iCol];

            return(iOrderLineBottom > cell_Bottom.iOrderLineTop);
        }
Esempio n. 3
0
        //----------------------------------------------------------------------------------------------------x
        #region Line Visibility
        //----------------------------------------------------------------------------------------------------x

        //----------------------------------------------------------------------------------------------------x
        /// <summary>Determines the visibility of the left line in reference to the specified row.</summary>
        /// <param name="iRow">Row index</param>
        /// <returns>If the left line is visible, the method returns <see langword="true"/>, otherwise it returns <see langword="false"/>.</returns>
        internal Boolean bVisibleLineLeft(Int32 iRow)
        {
            Debug.Assert(iRow >= tlmRow_Start.iIndex && iRow <= tlmRow_End.iIndex);
            Int32 i = tlmColumn_Start.iIndex;

            if (i == 0)
            {
                return(true);
            }
            TlmRow  row       = tlmBase.aTlmRow[iRow];
            TlmCell cell_Left = row.aTlmCell[i - 1];

            return(iOrderLineLeft >= cell_Left.iOrderLineRight);
        }
Esempio n. 4
0
        //----------------------------------------------------------------------------------------------------x
        /// <summary>Determines the visibility of the right line in reference to the specified row.</summary>
        /// <param name="iRow">Row index</param>
        /// <returns>If the right line is visible, the method returns <see langword="true"/>, otherwise it returns <see langword="false"/>.</returns>
        internal Boolean bVisibleLineRight(Int32 iRow)
        {
            Debug.Assert(iRow >= tlmRow_Start.iIndex && iRow <= tlmRow_End.iIndex);
            Int32 i = tlmColumn_End.iIndex;

            if (i == tlmBase.list_TlmColumn.Count - 1)
            {
                return(true);
            }
            TlmRow  row        = tlmBase.list_TlmRow[iRow];
            TlmCell cell_Right = row.aTlmCell[i + 1];

            return(iOrderLineRight > cell_Right.iOrderLineLeft);
        }
Esempio n. 5
0
 //----------------------------------------------------------------------------------------------------x###
 /// <summary>This method will be called before the report objects will be written to the container.</summary>
 internal protected override void OnBeforeWrite()
 {
     foreach (TlmColumn col in al_TlmColumn)
     {
         TlmCell cell = tlmRow_Committed.aTlmCell[col.iIndex];
         if (!Double.IsNaN(col.rBorderBottom))
         {
             cell.rMarginBottom = col.rBorderBottom;
         }
         if (!Object.ReferenceEquals(col.penProp_BorderBottom, PenProp.penProp_Null))
         {
             cell.penProp_LineBottom = col.penProp_BorderBottom;
         }
     }
 }
        /// <summary>Creates the table header.</summary>
        private void CreateHeader(Container cont)
        {
            TlmRow row = tlmRow_New((TlmRow)null, aCellCreateType);

            row.bAutoCommit      = false;
            row.rPreferredHeight = tlmRowDef_Header.rPreferredHeight;

            foreach (TlmColumn col in al_TlmColumn)
            {
                TlmCell cell = row.aTlmCell[col.iIndex];

                TlmCellDef hd_Base = tlmCellDef_Header;
                TlmCellDef hd_Col  = col.tlmCellDef_Header;

                cell.rAlignH     = (Double.IsNaN(hd_Col.rAlignH) ? hd_Base.rAlignH : hd_Col.rAlignH);
                cell.rAlignV     = (Double.IsNaN(hd_Col.rAlignV) ? hd_Base.rAlignV : hd_Col.rAlignV);
                cell.rAngle      = (Double.IsNaN(hd_Col.rAngle) ? hd_Base.rAngle : hd_Col.rAngle);
                cell.tlmTextMode = (hd_Col.tlmTextMode == TlmTextMode.FallBack ? hd_Base.tlmTextMode : hd_Col.tlmTextMode);
                cell.rLineFeed   = (Double.IsNaN(hd_Col.rLineFeed) ? hd_Base.rLineFeed : hd_Col.rLineFeed);

                cell.rMarginLeft   = (Double.IsNaN(hd_Col.rMarginLeft) ? hd_Base.rMarginLeft : hd_Col.rMarginLeft);
                cell.rMarginRight  = (Double.IsNaN(hd_Col.rMarginRight) ? hd_Base.rMarginRight : hd_Col.rMarginRight);
                cell.rMarginTop    = (Double.IsNaN(hd_Col.rMarginTop) ? hd_Base.rMarginTop : hd_Col.rMarginTop);
                cell.rMarginBottom = (Double.IsNaN(hd_Col.rMarginBottom) ? hd_Base.rMarginBottom : hd_Col.rMarginBottom);

                cell.rIndentLeft   = (Double.IsNaN(hd_Col.rIndentLeft) ? hd_Base.rIndentLeft : hd_Col.rIndentLeft);
                cell.rIndentRight  = (Double.IsNaN(hd_Col.rIndentRight) ? hd_Base.rIndentRight : hd_Col.rIndentRight);
                cell.rIndentTop    = (Double.IsNaN(hd_Col.rIndentTop) ? hd_Base.rIndentTop : hd_Col.rIndentTop);
                cell.rIndentBottom = (Double.IsNaN(hd_Col.rIndentBottom) ? hd_Base.rIndentBottom : hd_Col.rIndentBottom);

                cell.brushProp_Back = (Object.ReferenceEquals(hd_Col.brushProp_Back, BrushProp.bp_Null) ? hd_Base.brushProp_Back : hd_Col.brushProp_Back);

                cell.penProp_LineLeft   = (Object.ReferenceEquals(hd_Col.penProp_LineLeft, PenProp.penProp_Null) ? hd_Base.penProp_LineLeft : hd_Col.penProp_LineLeft);
                cell.penProp_LineRight  = (Object.ReferenceEquals(hd_Col.penProp_LineRight, PenProp.penProp_Null) ? hd_Base.penProp_LineRight : hd_Col.penProp_LineRight);
                cell.penProp_LineTop    = (Object.ReferenceEquals(hd_Col.penProp_LineTop, PenProp.penProp_Null) ? hd_Base.penProp_LineTop : hd_Col.penProp_LineTop);
                cell.penProp_LineBottom = (Object.ReferenceEquals(hd_Col.penProp_LineBottom, PenProp.penProp_Null) ? hd_Base.penProp_LineBottom : hd_Col.penProp_LineBottom);

                cell.iOrderLineLeft   = (hd_Col.iOrderLineLeft == Int32.MinValue ? hd_Base.iOrderLineLeft : hd_Col.iOrderLineLeft);
                cell.iOrderLineRight  = (hd_Col.iOrderLineRight == Int32.MinValue ? hd_Base.iOrderLineRight : hd_Col.iOrderLineRight);
                cell.iOrderLineTop    = (hd_Col.iOrderLineTop == Int32.MinValue ? hd_Base.iOrderLineTop : hd_Col.iOrderLineTop);
                cell.iOrderLineBottom = (hd_Col.iOrderLineBottom == Int32.MinValue ? hd_Base.iOrderLineBottom : hd_Col.iOrderLineBottom);

                if (col.sHeader != null)
                {
                    cell.Add(new RepString(col.fontProp_Header, col.sHeader));
                }
            }
        }
Esempio n. 7
0
 //----------------------------------------------------------------------------------------------------x###
 /// <summary>This method will be called after a new row has been created.</summary>
 /// <param name="row"></param>
 internal protected override void OnNewRow(TlmRow row)
 {
     if (row.iIndex != 0)
     {
         return;
     }
     foreach (TlmColumn col in al_TlmColumn)
     {
         TlmCell cell = row.aTlmCell[col.iIndex];
         if (!Double.IsNaN(col.rBorderTop))
         {
             cell.rMarginTop = col.rBorderTop;
         }
         if (!Object.ReferenceEquals(col.penProp_BorderTop, PenProp.penProp_Null))
         {
             cell.penProp_LineTop = col.penProp_BorderTop;
         }
     }
 }
 //----------------------------------------------------------------------------------------------------x
 /// <summary>This method will be called before the report objects will be written to the container.</summary>
 internal protected override void OnBeforeWrite()
 {
     for (Int32 iCol = 0; iCol < al_TlmColumn.Count; iCol++)
     {
         TlmCell cell = tlmRow_Committed.aTlmCell[iCol];
         if (cell.tlmColumn_Start.iIndex != iCol)
         {
             continue;
         }
         TlmColumn col = al_TlmColumn[iCol];
         if (!Double.IsNaN(col.rBorderBottom))
         {
             cell.rMarginBottom = col.rBorderBottom;
         }
         if (!Object.ReferenceEquals(col.penProp_BorderBottom, PenProp.penProp_Null))
         {
             cell.penProp_LineBottom = col.penProp_BorderBottom;
         }
     }
 }
Esempio n. 9
0
                //----------------------------------------------------------------------------------------------------x
                /// <summary>Advances the enumerator to the next element of the collection.</summary>
                /// <returns>true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.</returns>
                public Boolean MoveNext()
                {
                    Int32 iIndex = 0;

                    if (tlmCell != null)
                    {
                        iIndex = tlmCell.tlmColumn_End.iIndex + 1;
                    }

                    do
                    {
                        if (iIndex >= tlmRow.tlmBase.list_TlmColumn.Count)
                        {
                            tlmCell = null;
                            return(false);
                        }
                        tlmCell = tlmRow.aTlmCell[iIndex];
                        iIndex++;
                    } while (tlmCell == null);
                    return(true);
                }
Esempio n. 10
0
        //----------------------------------------------------------------------------------------------------x
        /// <summary>Calculates the bottom position of the row.</summary>
        /// <returns>The bottom position in points (1/72 inch).</returns>
        internal Double rCalculateBottomPos()
        {
            Double rY = 0;

            for (Int32 iCol = 0; iCol < tlmBase.list_TlmColumn.Count; iCol++)
            {
                TlmCell cell = aTlmCell[iCol];
                if (cell == null || cell.tlmColumn_Start.iIndex != iCol || cell.tlmRow_End.iIndex != iIndex)
                {
                    continue;
                }
                Double rMaxY = cell.rCalculateMaxY(false);
                rMaxY += cell.rMarginTop + cell.rMarginBottom + cell.tlmRow_Start.rPosTop;
                if (rMaxY > rY)
                {
                    rY = rMaxY;
                }
            }
            Debug.Assert(!Double.IsNaN(rY));
            return(rY);
        }
Esempio n. 11
0
        //----------------------------------------------------------------------------------------------------x
        /// <summary>Calculates the bottom position of the row.</summary>
        /// <param name="bCommitted">true: bottom position of committed rows; false: bottom position of all rows. </param>
        /// <returns>The bottom position in points (1/72 inch).</returns>
        internal Double rCalculateBottomPos(Boolean bCommitted)
        {
            Debug.Assert(!bCommitted || Object.ReferenceEquals(tlmBase.tlmRow_Committed, this));
            Double rY = 0;

            for (Int32 iCol = 0; iCol < tlmBase.al_TlmColumn.Count; iCol++)
            {
                TlmCell cell = aTlmCell[iCol];
                if (cell == null || cell.tlmColumn_Start.iIndex != iCol || cell.tlmRow_End.iIndex != iIndex)
                {
                    continue;
                }
                Double rMaxY = cell.rCalculateMaxY(bCommitted);
                rMaxY += cell.rMarginTop + cell.rMarginBottom + cell.tlmRow_Start.rPosTop;
                if (rMaxY > rY)
                {
                    rY = rMaxY;
                }
            }
            Debug.Assert(!Double.IsNaN(rY));
            return(rY);
        }
        //----------------------------------------------------------------------------------------------------x
        // Virtual Methods
        //----------------------------------------------------------------------------------------------------x

        //----------------------------------------------------------------------------------------------------x
        /// <summary>This method will be called before the row will be closed.</summary>
        /// <param name="row">Row that will be closed</param>
        internal protected override void OnClosingRow(TlmRow row)
        {
            if (row.iIndex != 1)
            {
                return;
            }
            for (Int32 iCol = 0; iCol < al_TlmColumn.Count; iCol++)
            {
                TlmCell cell = row.aTlmCell[iCol];
                if (cell.tlmColumn_Start.iIndex != iCol)
                {
                    continue;
                }
                TlmColumn col = al_TlmColumn[iCol];
                if (!Double.IsNaN(col.rBorderTop))
                {
                    cell.rMarginTop = col.rBorderTop;
                }
                if (!Object.ReferenceEquals(col.penProp_BorderTop, PenProp.penProp_Null))
                {
                    cell.penProp_LineTop = col.penProp_BorderTop;
                }
            }
        }
Esempio n. 13
0
        //----------------------------------------------------------------------------------------------------x
        /// <summary>Adds a report object to the cell at the current position.</summary>
        /// <remarks>The current horizontal position <see cref="TlmCell.rCurX"/> will be incremented by the width of the report object.</remarks>
        /// <param name="repObj">Report object that will be added to the cell</param>
        internal void SplitCell(TlmRow tlmRow_2)
        {
            TlmRow tlmRow_Committed = tlmBase.tlmRow_Committed;

            TlmCell tlmCell_2 = new TlmCell(tlmColumn_Start, tlmColumn_End, tlmRow_2);

            if (tlmRow_End.iIndex != tlmRow_Committed.iIndex)
            {
                tlmCell_2.tlmRow_End = tlmRow_End;
            }
            tlmRow_2.aTlmCell.SetCell(tlmColumn_Start.iIndex, tlmCell_2);
            tlmRow_End = tlmRow_Committed;

            tlmCell_2.rAlignH            = rAlignH;
            tlmCell_2.rAlignV            = rAlignV;
            tlmCell_2.rAngle             = rAngle;
            tlmCell_2.tlmTextMode        = tlmTextMode;
            tlmCell_2.rLineFeed          = rLineFeed;
            tlmCell_2.rMarginLeft        = rMarginLeft;
            tlmCell_2.rMarginRight       = rMarginRight;
            tlmCell_2.rMarginTop         = rMarginTop;
            tlmCell_2.rMarginBottom      = rMarginBottom;
            tlmCell_2.rIndentLeft        = rIndentLeft;
            tlmCell_2.rIndentRight       = rIndentRight;
            tlmCell_2.rIndentTop         = rIndentTop;
            tlmCell_2.rIndentBottom      = rIndentBottom;
            tlmCell_2.brushProp_Back     = brushProp_Back;
            tlmCell_2.penProp_LineLeft   = penProp_LineLeft;
            tlmCell_2.penProp_LineRight  = penProp_LineRight;
            tlmCell_2.penProp_LineTop    = penProp_LineTop;
            tlmCell_2.penProp_LineBottom = penProp_LineBottom;
            tlmCell_2.iOrderLineLeft     = iOrderLineLeft;
            tlmCell_2.iOrderLineRight    = iOrderLineRight;
            tlmCell_2.iOrderLineTop      = iOrderLineTop;
            tlmCell_2.iOrderLineBottom   = iOrderLineBottom;

            // get vertical offset
            Int32  iStartIndex = tlmColumn_Start.iRepObjCommitted;
            Double rDelta      = 0.0;

            if (iStartIndex < iRepObjCount)
            {
                RepObj repObj = repObj_Get(iStartIndex);
                rDelta = repObj.rPosTop - rIndentTop;
            }

            tlmCell_2.status = status;
            tlmCell_2.rCurX  = rCurX;
            tlmCell_2.rCurY  = rCurY - rDelta;
            tlmCell_2.iFirstRepObjOfCurLine = Math.Max(0, iFirstRepObjOfCurLine - iStartIndex);
            tlmCell_2.bCut = bCut;

            // copy RepObjects
            for (Int32 iRepObj = iStartIndex; iRepObj < iRepObjCount; iRepObj++)
            {
                RepObj repObj = repObj_Get(iRepObj);
                repObj.matrixD.rDY -= rDelta;
                tlmCell_2.AddRepObj(repObj);
            }
            RemoveRange(iStartIndex, iRepObjCount - iStartIndex);
        }
Esempio n. 14
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Sets the enumerator to its initial position, which is before the first element in the collection.</summary>
 public void Reset()
 {
     tlmCell = null;
 }
Esempio n. 15
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Sets the cell with the specified index.</summary>
 /// <param name="iIndex">Index</param>
 /// <param name="cell">Cell</param>
 internal void SetCell(Int32 iIndex, TlmCell cell)
 {
     aTlmCell[iIndex] = cell;
 }
Esempio n. 16
0
        //----------------------------------------------------------------------------------------------------x
        /// <summary>Creates a row definition object.</summary>
        /// <param name="tlmBase">Table layout manager of this row</param>
        /// <param name="tlmRow_Prev">The new row will be inserted after <paramref name="tlmRow_Prev"/> or at the beginning if it is <see langword="null"/>.</param>
        /// <param name="aCellCreateType">Array with the cell creation data for each column</param>
        /// <exception cref="ReportException">The row cannot be created.</exception>
        internal TlmRow(TlmBase tlmBase, TlmRow tlmRow_Prev, TlmBase.CellCreateType[] aCellCreateType) : this(tlmBase) {
            if (tlmBase.list_TlmColumn.Count != aCellCreateType.Length)
            {
                throw new ReportException("The length of the cell create type array must be equal to the number of coulmns that are defined for this table layout manager.");
            }

            for (Int32 iCol = 0; iCol < tlmBase.list_TlmColumn.Count; iCol++)
            {
                TlmColumn col = tlmBase.list_TlmColumn[iCol];
                switch (aCellCreateType[iCol])
                {
                case TlmBase.CellCreateType.New: {
                    aTlmCell.SetCell(iCol, new TlmCell(col, col, this));
                    break;
                }

                case TlmBase.CellCreateType.MergedV: {
                    if (tlmRow_Prev == null)
                    {
                        throw new ReportException("First row cannot be merged vertically.");
                    }
                    TlmCell cell_Prev = tlmRow_Prev.aTlmCell[iCol];
                    if (cell_Prev.tlmColumn_Start.iIndex != iCol)
                    {
                        throw new ReportException("Vertically merged cells must start in the same column.");
                    }
                    Debug.Assert(cell_Prev.tlmRow_End.iIndex == tlmRow_Prev.iIndex);
                    cell_Prev.tlmRow_End = this;
                    while (true)
                    {
                        aTlmCell.SetCell(iCol, cell_Prev);
                        if (iCol >= cell_Prev.tlmColumn_End.iIndex)
                        {
                            break;
                        }
                        iCol++;
                        if (aCellCreateType[iCol] != TlmBase.CellCreateType.MergedH)
                        {
                            throw new ReportException("Invalid cell create type of column " + iCol.ToString() + "; 'MergedH' expected");
                        }
                    }
                    break;
                }

                case TlmBase.CellCreateType.MergedH: {
                    if (iCol == 0)
                    {
                        throw new ReportException("First column cannot be merged horizonally.");
                    }
                    TlmCell cell_Left = aTlmCell[iCol - 1];
                    if (!Object.ReferenceEquals(cell_Left.tlmRow_Start, this))
                    {
                        throw new ReportException("Horizontally merged cells must start in the same row.");
                    }
                    aTlmCell.SetCell(iCol, cell_Left);
                    Debug.Assert(cell_Left.tlmColumn_End.iIndex + 1 == iCol);
                    cell_Left.tlmColumn_End = col;
                    break;
                }

                case TlmBase.CellCreateType.Empty: {
                    break;
                }

                default: {
                    Debug.Fail("unknown cell create type");
                    break;
                }
                }
            }
            tlmBase.InsertRow(tlmRow_Prev, this);

            tlmBase.OnNewRow(this);
        }