Ejemplo n.º 1
0
 protected double RealWidth(RepObj repObj)
 {
     if (repObj is RepRect)
     {
         RepRect repRect = (RepRect)repObj;
         return(repRect.rWidth + repRect.penProp.rWidth);
     }
     else if (repObj is RepImage)
     {
         RepImage repImage = (RepImage)repObj;
         if (Double.IsNaN(repImage.rWidth))
         {
             using (Image image = Image.FromStream(repImage.stream))
             {
                 if (Double.IsNaN(repImage.rHeight))
                 {
                     repImage.rWidth  = image.Width / image.HorizontalResolution * 72;
                     repImage.rHeight = image.Height / image.VerticalResolution * 72;
                 }
                 else
                 {
                     repImage.rWidth = image.Width * repImage.rHeight / image.Height;
                 }
             }
         }
         return(repImage.rWidth);
     }
     else
     {
         return(repObj.rWidth);
     }
 }
Ejemplo n.º 2
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");
            }
            if (Object.ReferenceEquals(this, repObj))
            {
                throw new ReportException("Report objects cannot be added to itself");
            }

            if (repObj_Pos == null)
            {
                list_RepObj.Add(repObj);
            }
            else
            {
                if (!Object.ReferenceEquals(repObj_Pos.container, this))
                {
                    throw new ReportException("The report object indicating the position is not a member of the container");
                }
                Int32 iIndex = list_RepObj.IndexOf(repObj_Pos);
                Debug.Assert(iIndex >= 0);
                list_RepObj.Insert(iIndex, repObj);
            }
            repObj.container = this;
            repObj.OnAdded();
        }
Ejemplo n.º 3
0
 public void AddCentered(Double rY, RepObj repObj)
 {
     repObj.matrixD.rDX = rWidth / 2;
     repObj.rAlignH     = RepObj.rAlignCenter;
     repObj.matrixD.rDY = rY;
     Add(repObj);
 }
Ejemplo n.º 4
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Applies the specified clipping path to this report object.</summary>
 /// <param name="rX">X-coordinate of the clip path.</param>
 /// <param name="rAlignH">Horizontal alignment of the report object relative to [X].</param>
 /// <param name="rY">Y-coordinate of the clip path.</param>
 /// <param name="rAlignV">Vertical alignment of the report object relative to [Y].</param>
 /// <param name="repObj">The clipping path.</param>
 public void SetClip(Double rX, Double rAlignH, Double rY, Double rAlignV, RepObj repObj)
 {
     this._clipPath             = repObj;
     this._clipPath.matrixD.rDX = rX;
     this._clipPath.rAlignH     = rAlignH;
     this._clipPath.matrixD.rDY = rY;
     this._clipPath.rAlignV     = rAlignV;
 }
Ejemplo n.º 5
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>
        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)
            {
#if !WindowsCE
                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);
                                }
                            }
                        }
                    }
                }
#endif
            }
            base.Add(rX, rY, repObj);
        }
Ejemplo n.º 6
0
 protected double RealX(RepObj repObj, double r_X)
 {
     if (repObj is RepRect)
     {
         RepRect repRect = (RepRect)repObj;
         return(r_X + repRect.penProp.rWidth / 2);
     }
     else
     {
         return(r_X);
     }
 }
Ejemplo n.º 7
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);
     }
 }
Ejemplo n.º 8
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);
        }
Ejemplo n.º 9
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);
 }
Ejemplo n.º 10
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);
 }
Ejemplo n.º 11
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);
 }
Ejemplo n.º 12
0
 //----------------------------------------------------------------------------------------------------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.rPointFromMM(rX), rAlignH, RT.rPointFromMM(rY), rAlignV, repObj);
 }
Ejemplo n.º 13
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);
 }
Ejemplo n.º 14
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary>This method will be called after the report object has been added to the container.</summary>
 public void Remove(RepObj repObj)
 {
     list_RepObj.Remove(repObj);
     repObj.container = null;
 }
Ejemplo n.º 15
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);
 }
Ejemplo n.º 16
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);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Adds a line of report objects to the current container at the current position.
        /// </summary>
        /// <param name="repObjs">Array of report objects to add to the container</param>
        /// <returns>Leftover report objects that didn't fit in the line.</returns>
        public RepObj[] AddLine(RepObj[] repObjs)
        {
            if (status == Status.Init && _container_Cur == null)
            {
                CreateNewContainer();
            }
            double rMaxHeight       = 0;
            double rMaxStringHeight = 0;
            double rWidth           = 0;

            rX_Cur = 0;
            ArrayList line     = new ArrayList();
            ArrayList leftover = new ArrayList();

            foreach (RepObj repObj in repObjs)
            {
                if (rWidth + RealWidth(repObj) <= container_Cur.rWidth)
                {
                    line.Add(repObj);
                }
                else if (rWidth < container_Cur.rWidth && repObj is RepString)
                {
                    RepString repString = (RepString)repObj;
                    RepString repStringLeftover;
                    BreakByWord(ref repString, out repStringLeftover, container_Cur.rWidth - rWidth);
                    if (repString != null)
                    {
                        line.Add(repString);
                    }
                    if (repStringLeftover != null)
                    {
                        leftover.Add(repStringLeftover);
                    }
                }
                else
                {
                    leftover.Add(repObj);
                }
                rWidth += RealWidth(repObj);
            }
            // if line.Count is zero and leftover.count isn't, we've got a single RepObj bigger than
            // its container
            if (line.Count == 0 && leftover.Count > 0)
            {
                RepObj repObj = (RepObj)leftover[0];
                if (repObj is RepString)         // can't break by word, so break by letter
                {
                    RepString repStringLeftover;
                    RepString repString = (RepString)repObj;
                    BreakByLetter(ref repString, out repStringLeftover, container_Cur.rWidth);
                    if (repString != null)
                    {
                        line.Add(repString);
                    }
                    leftover.RemoveAt(0);
                    if (repStringLeftover != null)
                    {
                        leftover.Insert(0, repStringLeftover);
                    }
                }
                else
                {
                    line.Add(leftover[0]);
                    leftover.RemoveAt(0);
                }
            }
            // compute max hight and max line hight for alignment
            foreach (RepObj repObj in line)
            {
                if (repObj is RepString && RealHight(repObj) > rMaxStringHeight)
                {
                    rMaxStringHeight = RealHight(repObj);
                }
                if (RealHight(repObj) > rMaxHeight)
                {
                    rMaxHeight = RealHight(repObj);
                }
            }
            rY_Cur           += rMaxHeight;
            rMaxStringHeight /= 4;     // poor man's line leading
            if (rY_Cur > container_Cur.rHeight)
            {
                _container_Cur = null;
                CreateNewContainer();
                rY_Cur += rMaxHeight;
            }
            foreach (RepObj repObj in line)
            {
                if (repObj is RepString)
                {
                    container_Cur.Add(rX_Cur, rY_Cur - rMaxStringHeight, repObj);
                }
                else
                {
                    container_Cur.Add(RealX(repObj, rX_Cur), RealY(repObj, rY_Cur), repObj);
                }
                rX_Cur += RealWidth(repObj);
            }
            if (leftover.Count > 0)
            {
                return((RepObj[])leftover.ToArray(typeof(RepObj)));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 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>
 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);
 }
Ejemplo n.º 19
0
 //----------------------------------------------------------------------------------------------------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);
 }
Ejemplo n.º 20
0
 public void AddCenteredMM(Double rY, RepObj repObj)
 {
     AddCentered(RT.rMM(rY), repObj);
 }
Ejemplo n.º 21
0
 //----------------------------------------------------------------------------------------------------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.rPointFromMM(rY), repObj);
 }
Ejemplo n.º 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>
 internal void AddCB(Double rX, Double rY, RepObj repObj)
 {
     AddAligned(rX, RepObj.rAlignCenter, rY, RepObj.rAlignBottom, repObj);
 }
Ejemplo n.º 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 AddRT(Double rX, Double rY, RepObj repObj)
 {
     AddAligned(rX, RepObj.rAlignRight, rY, RepObj.rAlignTop, repObj);
 }
Ejemplo n.º 24
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(RT.rPointFromMM(rOfsH_MM), RT.rPointFromMM(rOfsV_MM), repObj);
 }
Ejemplo n.º 25
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 AddRC_MM(Double rX, Double rY, RepObj repObj)
 {
     AddRC(RT.rPointFromMM(rX), RT.rPointFromMM(rY), repObj);
 }
Ejemplo n.º 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="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);
 }
Ejemplo n.º 27
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);
 }
Ejemplo n.º 28
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);
 }
Ejemplo n.º 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 (status == Status.Init)
            {
                if (_container_Cur == null)
                {
                    CreateNewContainer();
                }
            }

            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_Cur.rHeight)
                    {
                        _container_Cur = null;
                        CreateNewContainer();
                    }
                    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_Cur.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_Cur.Add(rX_Cur, rY_Cur, repObj);
                        rX_Cur = rLineBreakPos;
                        break;
                    }
                    String sLine = sText.Substring(iLineStartIndex, iLineBreakIndex - iLineStartIndex);
                    container_Cur.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_Cur.Add(rX_Cur, rY_Cur, repObj);
            }
        }
Ejemplo n.º 30
0
 //----------------------------------------------------------------------------------------------------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);
 }