public void AddCentered(Double rY, RepObj repObj)
 {
     repObj.matrixD.rDX = rWidth / 2;
     repObj.rAlignH     = RepObj.rAlignCenter;
     repObj.matrixD.rDY = rY;
     Add(repObj);
 }
        //----------------------------------------------------------------------------------------------------x
        /// <summary>Adds a report object to the container.</summary>
        /// <param name="rX">X-coordinate of the report object</param>
        /// <param name="rY">Y-coordinate of the report object</param>
        /// <param name="repObj">Report object to add to the container</param>
        public new void Add(Double rX, Double rY, RepObj repObj)
        {
            //Added By TechnoGuru - [email protected] - http://www.borie.org/
            //Here we handle image comosed of severals images
            if (repObj is RepImage)
            {
                RepImage repImage = repObj as RepImage;
                using (Image image = Image.FromStream(repImage.stream))
                {
                    if (image.RawFormat.Equals(ImageFormat.Tiff))
                    {
                        Guid objGuid = (image.FrameDimensionsList[0]);
                        System.Drawing.Imaging.FrameDimension objDimension = new System.Drawing.Imaging.FrameDimension(objGuid);
                        // Numbre of image in the tiff file
                        int totFrame = image.GetFrameCount(objDimension);
                        if (totFrame > 1)
                        {
                            // Saves every frame in a seperate file.
                            for (int i = 0; i < totFrame; i++)
                            {
                                image.SelectActiveFrame(objDimension, i);
                                string tempFile = Path.GetTempFileName() + ".tif";
                                if (image.PixelFormat.Equals(PixelFormat.Format1bppIndexed))
                                {
                                    ImageCodecInfo myImageCodecInfo;
                                    myImageCodecInfo = GetEncoderInfo("image/tiff");
                                    EncoderParameters myEncoderParameters;
                                    myEncoderParameters          = new EncoderParameters(1);
                                    myEncoderParameters.Param[0] = new
                                                                   EncoderParameter(Encoder.Compression, (long)EncoderValue.CompressionCCITT4);
                                    image.Save(tempFile, myImageCodecInfo, myEncoderParameters);
                                }
                                else
                                {
                                    image.Save(tempFile, ImageFormat.Tiff);
                                }
                                FileStream stream = new System.IO.FileStream(tempFile, FileMode.Open, FileAccess.Read);

                                if (i == 0)
                                {
                                    repImage.stream = stream;
                                    repObj          = repImage as RepObj;
                                }
                                else
                                {
                                    new Page(report);
                                    RepImage di = new RepImageMM(stream, Double.NaN, Double.NaN);
                                    report.page_Cur.AddMM(0, 0, di);
                                }
                            }
                        }
                    }
                }
            }
            base.Add(rX, rY, repObj);
        }
示例#3
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Advances the enumerator to the next report object of the container.</summary>
 /// <returns>true if the enumerator was successfully advanced to the next report object,
 /// false if the enumerator has passed the end of the collection.</returns>
 public bool MoveNext()
 {
     if (repObj_Cur == null)
     {
         repObj_Cur = container.repObj_First;
     }
     else
     {
         repObj_Cur = repObj_Cur.repObj_Next;
     }
     return(repObj_Cur != null);
 }
示例#4
0
        //----------------------------------------------------------------------------------------------------x
        /// <summary>Adds a report object to the container.</summary>
        /// <param name="repObj">Report object that must be added to the container</param>
        /// <param name="repObj_Pos">The new report object will be inserted before the specified position.
        /// If the position is null it will be appended to the end of the list.</param>
        internal void Add(RepObj repObj, RepObj repObj_Pos)
        {
            if (repObj.container != null)
            {
                throw new ReportException("Report objects cannot be added to more than one container");
            }
            Debug.Assert(repObj.repObj_Next == null);
            Debug.Assert(repObj.repObj_Prev == null);

            if (repObj_First == null)
            {
                Debug.Assert(repObj_Last == null);
                repObj_First = repObj_Last = repObj;
            }
            else
            {
                if (repObj_Pos == null)
                {
                    repObj.repObj_Prev      = repObj_Last;
                    repObj_Last.repObj_Next = repObj;
                    repObj_Last             = repObj;
                }
                else
                {
                    if (repObj_Pos.container != this)
                    {
                        throw new ReportException("The report object indicating the position is not a member of the container");
                    }
                    repObj.repObj_Next = repObj_Pos;
                    if (repObj_Pos.repObj_Prev == null)
                    {
                        Debug.Assert(repObj_First == repObj_Pos);
                        repObj_First = repObj;
                    }
                    else
                    {
                        repObj_Pos.repObj_Prev.repObj_Next = repObj;
                    }

                    repObj.repObj_Prev     = repObj_Pos.repObj_Prev;
                    repObj_Pos.repObj_Prev = repObj;
                }
            }
            repObj.container = this;
            repObj.OnAdded();
        }
示例#5
0
        //----------------------------------------------------------------------------------------------------x
        /// <summary>Calculates the bottom position of the row.</summary>
        /// <param name="bCommitted">If <see langword="true"/>, the bottom position of the committed rows will be calculated, otherwise the bottom position of all rows will be calculated. </param>
        /// <returns>Bottom position (points, 1/72 inch)</returns>
        internal Double rCalculateMaxY(Boolean bCommitted)
        {
            Double rMaxY = 0;

            Debug.Assert(!bCommitted || (tlmBase.tlmRow_Committed.iIndex >= tlmRow_Start.iIndex && tlmBase.tlmRow_Committed.iIndex <= tlmRow_End.iIndex));
            Int32 iRepObjCount = (bCommitted ? tlmColumn_Start.iRepObjCommitted : this.iRepObjCount);

            for (Int32 iRepObj = 0; iRepObj < iRepObjCount; iRepObj++)
            {
                RepObj repObj     = repObj_Get(iRepObj);
                Double rPosBottom = repObj.rPosBottom;
                if (rPosBottom > rMaxY)
                {
                    rMaxY = rPosBottom;
                }
            }
            return(rMaxY + rIndentBottom);
        }
示例#6
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Adds a report object to the current cell.</summary>
 /// <param name="repObj">Report object that will be added to the current cell</param>
 private void AddRepObj(RepObj repObj)
 {
     if (oData == null)
     {
         oData = repObj;
     }
     else
     {
         ArrayList al_RepObj = oData as ArrayList;
         if (al_RepObj == null)
         {
             al_RepObj = new ArrayList(10);
             al_RepObj.Add(oData);
             oData = al_RepObj;
         }
         al_RepObj.Add(repObj);
     }
 }
示例#7
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Adds a report object to the container and sets the alignment.</summary>
 /// <param name="rX">X-coordinate of the report object</param>
 /// <param name="rY">Y-coordinate of the report object</param>
 /// <param name="repObj">Report object to add to the container</param>
 internal void AddCT(Double rX, Double rY, RepObj repObj)
 {
     AddAligned(rX, RepObj.rAlignCenter, rY, RepObj.rAlignTop, repObj);
 }
示例#8
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Adds a report object to the container.</summary>
 /// <param name="rX">X-coordinate of the report object</param>
 /// <param name="rY">Y-coordinate of the report object</param>
 /// <param name="repObj">Report object to add to the container</param>
 internal void Add(Double rX, Double rY, RepObj repObj)
 {
     repObj.matrixD.rDX = rX;
     repObj.matrixD.rDY = rY;
     Add(repObj);
 }
示例#9
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Appends a report object to the container.</summary>
 /// <param name="repObj">Report object that must be added to the container</param>
 internal void Add(RepObj repObj)
 {
     Add(repObj, null);
 }
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Adds a report object to the container, right justified.</summary>
 /// <param name="rX">X-coordinate of the report object</param>
 /// <param name="rY">Y-coordinate of the report object</param>
 /// <param name="repObj">Report object to add to the container</param>
 public void AddRight(Double rX, Double rY, RepObj repObj)
 {
     AddAligned(rX, RepObj.rAlignRight, rY, RepObj.rAlignBottom, repObj);
 }
示例#11
0
        //----------------------------------------------------------------------------------------------------x
        /// <overloads>
        ///   <summary>Adds a report object to the cell.</summary>
        /// </overloads>
        ///
        /// <summary>Adds a report object to the cell at the current position with the specified offset (inch version).</summary>
        /// <remarks>
        /// The current horizontal position <see cref="TlmCell.rCurX"/> will be incremented by the width of the report object.
        /// <para>The horizontal offset <paramref name="rOfsH"/> can be used for example to make a space in front of the report object.
        /// The vertical offset <paramref name="rOfsV"/> can be used for example to adjust the vertical position of an image or to set super-/subscript fonts.</para>
        /// <para>For the metric version see <see cref="TlmCell.AddMM"/>.</para>
        /// </remarks>
        /// <param name="rOfsH">Horizontal offset (points, 1/72 inch)</param>
        /// <param name="rOfsV">Vertical offset (points, 1/72 inch)</param>
        /// <param name="repObj">Report object that will be added to the cell</param>
        /// <seealso cref="TlmCell.AddMM"/>
        public void Add(Double rOfsH, Double rOfsV, RepObj repObj)
        {
            RepString repString = repObj as RepString;

            if (RT.bEquals(rAngle, -90, 0.001)) // vertical
            {
                Debug.Assert(tlmRow_Start.iIndex == tlmRow_End.iIndex, "vertically merged cell are not supported");
                Double rPreferredHeight = tlmRow_Start.rPreferredHeight;
                Double rInnerHeight     = rPreferredHeight - rIndentTop - rIndentBottom;
                if (status == Status.Init)
                {
                    if (Double.IsNaN(rPreferredHeight))
                    {
                        throw new ReportException("The preferred height of the row must be set");
                    }
                    rCurX  = rIndentLeft + rInnerWidth * rAlignV;
                    rCurY  = rPreferredHeight - rIndentBottom - rInnerHeight * rAlignH;
                    status = Status.Open;
                }
                CheckStatus_Open("cannot add a report object.");

                Double rUsedWidth = 0;
                if (iFirstRepObjOfCurLine < iRepObjCount)
                {
                    RepObj ro = repObj_Get(iRepObjCount - 1);
                    rUsedWidth  = ro.rPosBottom;
                    ro          = repObj_Get(iFirstRepObjOfCurLine);
                    rUsedWidth -= ro.rPosTop;
                }
                rUsedWidth += rOfsH;

                Double rRemainingWidth = rInnerHeight - rUsedWidth;
                if (repString != null)
                {
                    if (status == Status.Open)
                    {
                        if (Double.IsNaN(rLineFeed))
                        {
                            rLineFeed = repString.fontProp.rLineFeed;
                        }
                        //rCurX -= repString.fontProp.rHeight() * rAlignV;
                        status = Status.OpenText;
                    }
                    if (textMode == TlmBase.TextMode.EllipsisCharacter)
                    {
                        repString.sText = repString.fontProp.sTruncateText(repString.sText, rRemainingWidth);
                        // ... !!!
                    }
                }

                if (repString != null && textMode == TlmBase.TextMode.MultiLine)
                {
                    Debug.Fail("not implemented");
                }
                else
                {
                    Double rOfs = (repObj.rWidth + rOfsH) * rAlignH;
                    for (Int32 i = iFirstRepObjOfCurLine; i < iRepObjCount; i++)
                    {
                        RepObj ro = repObj_Get(i);
                        ro.matrixD.rDY += rOfs;
                    }
                    repObj.RotateTransform(rAngle);
                    repObj.matrixD.rDX = rCurX - rOfsV;
                    repObj.rAlignH     = rAlignH;
                    repObj.matrixD.rDY = rCurY - rOfsH * (1 - rAlignH);
                    repObj.rAlignV     = rAlignV;
                    AddRepObj(repObj);
                    rCurY = repObj.rPosTop;
                }
            }
            else // horizontal
            {
                if (status == Status.Init)
                {
                    rCurX  = rIndentLeft + rInnerWidth * rAlignH;
                    rCurY  = rIndentTop;
                    status = Status.Open;
                }
                CheckStatus_Open("cannot add a report object.");

                Double rUsedWidth = 0;
                if (iFirstRepObjOfCurLine < iRepObjCount)
                {
                    RepObj ro = repObj_Get(iRepObjCount - 1);
                    rUsedWidth  = ro.rPosRight;
                    ro          = repObj_Get(iFirstRepObjOfCurLine);
                    rUsedWidth -= ro.rPosLeft;
                }
                rUsedWidth += rOfsH;

                Double rRemainingWidth = rInnerWidth - rUsedWidth;
                if (repString != null)
                {
                    if (status == Status.Open)
                    {
                        if (Double.IsNaN(rLineFeed))
                        {
                            rLineFeed = repString.fontProp.rLineFeed;
                        }
                        rCurY += repString.fontProp.rHeight();
                        status = Status.OpenText;
                    }
                    if (textMode == TlmBase.TextMode.EllipsisCharacter)
                    {
                        Double rWidth = repString.fontProp.rWidth(repString.sText);
                        if (rWidth > rRemainingWidth)
                        {
                            if (bCut)
                            {
                                return;
                            }
                            repString.sText = repString.fontProp.sTruncateText(repString.sText, rRemainingWidth);
                            bCut            = true;
                            rWidth          = repString.fontProp.rWidth(repString.sText);
                            if (rWidth >= rRemainingWidth)
                            {
                                if (iFirstRepObjOfCurLine < iRepObjCount)
                                {
                                    RepObj    ro = repObj_Get(iRepObjCount - 1);
                                    RepString rs = ro as RepString;
                                    if (rs != null)
                                    {
                                        rs.sText = rs.sText.Substring(0, rs.sText.Length - 1) + "...";
                                    }
                                }
                                return;
                            }
                        }
                    }
                }

                if (repString != null && textMode == TlmBase.TextMode.MultiLine)
                {
                    Double rWidth = rInnerWidth + rIndentLeft;
                    lock (al_RepObj) {
                        Debug.Assert(al_RepObj.Count == 0);
                        Double rCopy = rCurY;
                        Double rOfs  = rWidth * rAlignH;
                        rCurX -= rOfs;
                        tlmBase.FormatString(al_RepObj, repString, ref rCurX, rIndentLeft, rAlignH, ref _rCurY, rWidth);
                        rCurX += rOfs;
                        foreach (RepObj ro in al_RepObj)
                        {
                            AddRepObj(ro);
                        }
                        al_RepObj.Clear();
                        if (!RT.bEquals(rCopy, _rCurY, TlmBase.rTol))
                        {
                            rCurY = _rCurY; // trigger iFirstRepObjOfCurLine
                            iFirstRepObjOfCurLine = iRepObjCount - 1;
                        }
                    }
                }
                else
                {
                    Double rOfs = (repObj.rWidth + rOfsH) * rAlignH;
                    for (Int32 i = iFirstRepObjOfCurLine; i < iRepObjCount; i++)
                    {
                        RepObj ro = repObj_Get(i);
                        ro.matrixD.rDX -= rOfs;
                    }
                    repObj.matrixD.rDX = rCurX + rOfsH * (1 - rAlignH);
                    repObj.rAlignH     = rAlignH;
                    repObj.matrixD.rDY = rCurY + rOfsV;
                    AddRepObj(repObj);
                    rCurX = repObj.rPosRight;
                }
            }
        }
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Adds a report object to the container, horizontally centered.</summary>
 /// <param name="rY">Y-coordinate of the report object</param>
 /// <param name="repObj">Report object to add to the container</param>
 public void AddCB(Double rY, RepObj repObj)
 {
     base.AddCB(rWidth / 2.0, rY, repObj);
 }
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Adds a report object to the container, horizontally centered (metric version).</summary>
 /// <param name="rY">Y-coordinate of the report objectt in millimeter</param>
 /// <param name="repObj">Report object to add to the container</param>
 public void AddCB_MM(Double rY, RepObj repObj)
 {
     AddCB(RT.rMM(rY), repObj);
 }
示例#14
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Adds a report object to the container and sets the alignment.</summary>
 /// <param name="rX">X-coordinate of the report object</param>
 /// <param name="rY">Y-coordinate of the report object</param>
 /// <param name="repObj">Report object to add to the container</param>
 internal void AddLT(Double rX, Double rY, RepObj repObj)
 {
     AddLT(rX, rY, repObj, null);
 }
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Adds a report object to the container and sets the alignment.</summary>
 /// <param name="rX">X-coordinate of the report object</param>
 /// <param name="rAlignH">Horizontal alignment of the report object relative to [X].</param>
 /// <param name="rY">Y-coordinate of the report object</param>
 /// <param name="rAlignV">Vertical alignment of the report object relative to [Y].</param>
 /// <param name="repObj">Report object to add to the container</param>
 public new void AddAligned(Double rX, Double rAlignH, Double rY, Double rAlignV, RepObj repObj)
 {
     repObj.matrixD.rDX = rX;
     repObj.rAlignH     = rAlignH;
     repObj.matrixD.rDY = rY;
     repObj.rAlignV     = rAlignV;
     Add(repObj);
 }
示例#16
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Adds a report object to the container and sets the alignment.</summary>
 /// <param name="rX">X-coordinate of the report object</param>
 /// <param name="rY">Y-coordinate of the report object</param>
 /// <param name="repObj">Report object to add to the container</param>
 /// <param name="repObj_Pos">The new report object will be inserted before the specified position.
 /// If the position is null it will be appended to the end of the list.</param>
 public void AddLT(Double rX, Double rY, RepObj repObj, RepObj repObj_Pos)
 {
     AddAligned(rX, RepObj.rAlignLeft, rY, RepObj.rAlignTop, repObj, repObj_Pos);
 }
示例#17
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Adds a report object to the container and sets the alignment.</summary>
 /// <param name="rX">X-coordinate of the report object</param>
 /// <param name="rAlignH">Horizontal alignment of the report object relative to [X].</param>
 /// <param name="rY">Y-coordinate of the report object</param>
 /// <param name="rAlignV">Vertical alignment of the report object relative to [Y].</param>
 /// <param name="repObj">Report object to add to the container</param>
 internal void AddAligned(Double rX, Double rAlignH, Double rY, Double rAlignV, RepObj repObj)
 {
     AddAligned(rX, rAlignH, rY, rAlignV, repObj, null);
 }
示例#18
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Adds a report object to the container and sets the alignment.</summary>
 /// <param name="rX">X-coordinate of the report object</param>
 /// <param name="rAlignH">Horizontal alignment of the report object relative to [X].</param>
 /// <param name="rY">Y-coordinate of the report object</param>
 /// <param name="rAlignV">Vertical alignment of the report object relative to [Y].</param>
 /// <param name="repObj">Report object to add to the container</param>
 /// <param name="repObj_Pos">The new report object will be inserted before the specified position.
 /// If the position is null it will be appended to the end of the list.</param>
 internal void AddAligned(Double rX, Double rAlignH, Double rY, Double rAlignV, RepObj repObj, RepObj repObj_Pos)
 {
     repObj.matrixD.rDX = rX;
     repObj.rAlignH     = rAlignH;
     repObj.matrixD.rDY = rY;
     repObj.rAlignV     = rAlignV;
     Add(repObj, repObj_Pos);
 }
示例#19
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Adds a report object to the cell at the current position with the specified offset (metric version).</summary>
 /// <remarks>
 /// The current horizontal position <see cref="TlmCell.rCurX"/> will be incremented by the width of the report object.
 /// <para>The horizontal offset <paramref name="rOfsH_MM"/> can be used for example to make a space in front of the report object.
 /// The vertical offset <paramref name="rOfsV_MM"/> can be used for example to adjust the vertical position of an image or to set super-/subscript fonts.</para>
 /// <para>For the inch version see <see cref="TlmCell.Add(System.Double,System.Double,RepObj)"/>.</para>
 /// </remarks>
 /// <param name="rOfsH_MM">Horizontal offset (mm)</param>
 /// <param name="rOfsV_MM">Vertical offset (mm)</param>
 /// <param name="repObj">Report object that will be added to the cell</param>
 /// <seealso cref="TlmCell.Add(System.Double,System.Double,RepObj)"/>
 public void AddMM(Double rOfsH_MM, Double rOfsV_MM, RepObj repObj)
 {
     Add(rOfsH_MM * RT.rMM_To_I72, rOfsV_MM * RT.rMM_To_I72, repObj);
 }
示例#20
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>
 public void Add(RepObj repObj)
 {
     Add(0, 0, repObj);
 }
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Adds a report object to the container and sets the alignment (metric versîon).</summary>
 /// <param name="rX">X-coordinate of the report objectt in millimeter</param>
 /// <param name="rAlignH">Horizontal alignment of the report object relative to [X].</param>
 /// <param name="rY">Y-coordinate of the report objectt in millimeter</param>
 /// <param name="rAlignV">Vertical alignment of the report object relative to [Y].</param>
 /// <param name="repObj">Report object to add to the container</param>
 public void AddAlignedMM(Double rX, Double rAlignH, Double rY, Double rAlignV, RepObj repObj)
 {
     AddAligned(RT.rMM(rX), rAlignH, RT.rMM(rY), rAlignV, repObj);
 }
示例#22
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Adds a report object to the container and sets the alignment.</summary>
 /// <param name="rX">X-coordinate of the report object</param>
 /// <param name="rY">Y-coordinate of the report object</param>
 /// <param name="repObj">Report object to add to the container</param>
 public void AddCC_MM(Double rX, Double rY, RepObj repObj)
 {
     AddCC(RT.rMM(rX), RT.rMM(rY), repObj);
 }
示例#23
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Adds a report object to the container and sets the alignment.</summary>
 /// <param name="rX">X-coordinate of the report object</param>
 /// <param name="rY">Y-coordinate of the report object</param>
 /// <param name="repObj">Report object to add to the container</param>
 internal void AddCB(Double rX, Double rY, RepObj repObj)
 {
     AddAligned(rX, RepObj.rAlignCenter, rY, RepObj.rAlignBottom, repObj);
 }
示例#24
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Adds a report object to the container and sets the alignment.</summary>
 /// <param name="rX">X-coordinate of the report object</param>
 /// <param name="rY">Y-coordinate of the report object</param>
 /// <param name="repObj">Report object to add to the container</param>
 internal void AddRT(Double rX, Double rY, RepObj repObj)
 {
     AddAligned(rX, RepObj.rAlignRight, rY, RepObj.rAlignTop, repObj);
 }
 public void AddCenteredMM(Double rY, RepObj repObj)
 {
     AddCentered(RT.rMM(rY), repObj);
 }
示例#26
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Adds a report object to the container and sets the alignment.</summary>
 /// <param name="rX">X-coordinate of the report object</param>
 /// <param name="rY">Y-coordinate of the report object</param>
 /// <param name="repObj">Report object to add to the container</param>
 internal void AddRC(Double rX, Double rY, RepObj repObj)
 {
     AddAligned(rX, RepObj.rAlignRight, rY, RepObj.rAlignCenter, repObj);
 }
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Adds a report object to the container, right justified (metric version).</summary>
 /// <param name="rX">X-coordinate of the report objectt in millimeter</param>
 /// <param name="rY">Y-coordinate of the report objectt in millimeter</param>
 /// <param name="repObj">Report object to add to the container</param>
 public void AddRightMM(Double rX, Double rY, RepObj repObj)
 {
     AddRight(RT.rMM(rX), RT.rMM(rY), repObj);
 }
示例#28
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Sets the enumerator to its initial position, which is before the first element in the collection.</summary>
 public void Reset()
 {
     repObj_Cur = null;
 }
示例#29
0
        //----------------------------------------------------------------------------------------------------x
        /// <summary>Adds a report object to the current container at the current position.</summary>
        /// <param name="repObj">Report object to add to the container</param>
        public void Add(RepObj repObj)
        {
            if (repObj is RepString)
            {
                RepString repString = (RepString)repObj;
                FontProp  fp        = repString.fontProp;
                String    sText     = repString.sText;

                Int32 iLineStartIndex = 0;
                Int32 iIndex          = 0;
                while (true)
                {
                    if (rY_Cur > container.rHeight)
                    {
                        NewContainer();
                    }
                    Int32  iLineBreakIndex = 0;
                    Double rPosX           = rX_Cur;
                    Double rLineBreakPos   = 0;
                    while (true)
                    {
                        if (iIndex >= sText.Length)
                        {
                            iLineBreakIndex = iIndex;
                            rLineBreakPos   = rPosX;
                            break;
                        }
                        Char c = sText[iIndex];
                        rPosX += fp.rWidth(Convert.ToString(c));
                        if (rPosX >= container.rWidth)
                        {
                            if (iLineBreakIndex == 0)
                            {
                                if (iIndex == iLineStartIndex) // at least one character must be printed
                                {
                                    iIndex++;
                                }
                                iLineBreakIndex = iIndex;
                                break;
                            }
                            iIndex = iLineBreakIndex;
                            break;
                        }
                        if (c == ' ')
                        {
                            iLineBreakIndex = iIndex + 1;
                            rLineBreakPos   = rPosX;
                        }
                        else if (c == '\n')
                        {
                            iLineBreakIndex = iIndex;
                            iIndex++;
                            break;
                        }
                        iIndex++;
                    }

                    if (iLineStartIndex == 0 && iIndex >= sText.Length) // add entire object
                    {
                        container.Add(rX_Cur, rY_Cur, repObj);
                        rX_Cur = rLineBreakPos;
                        break;
                    }
                    String sLine = sText.Substring(iLineStartIndex, iLineBreakIndex - iLineStartIndex);
                    container.Add(rX_Cur, rY_Cur, new RepString(fp, sLine));
                    if (iIndex >= sText.Length)
                    {
                        rX_Cur = rLineBreakPos;
                        break;
                    }
                    rX_Cur          = 0;
                    rY_Cur         += fp.rLineFeed;
                    iLineStartIndex = iIndex;
                }
            }
            else
            {
                Debug.Fail("Unknown object type");
                container.Add(rX_Cur, rY_Cur, repObj);
            }
        }
示例#30
0
        //----------------------------------------------------------------------------------------------------x
        #region Add/NewLine
        //----------------------------------------------------------------------------------------------------x

        //----------------------------------------------------------------------------------------------------x
        /// <summary>Adds a report object to the current cell.</summary>
        /// <remarks>The current cell is the cell that is within the current row (<see cref="TlmBase.tlmRow_Cur">TlmBase.tlmRow_Cur</see>) and this column.</remarks>
        /// <param name="repObj">Report object that will be added to the current cell.</param>
        /// <exception cref="ReportException">No row is available or the current row is not open.</exception>
        public void Add(RepObj repObj)
        {
            tlmBase.Add(iIndex, repObj);
        }