示例#1
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Creates a new string object.</summary>
 /// <param name="fontProp">Font properties of the string object</param>
 /// <param name="sText">Text of the string object</param>
 public RepString(FontProp fontProp, String sText) {
   this.fontProp = fontProp.fontProp_Registered;
   this.sText = (sText == null) ? "" : sText;
   if (fontProp.rAngle != 0) {
     RotateTransform(fontProp.rAngle);
   }
 }
示例#2
0
        //----------------------------------------------------------------------------------------------------x
        /// <summary>Gets the height of the font in 1/72 inches.</summary>
        /// <param name="fontProp">Font properties</param>
        /// <returns>Height of the font in 1/72 inches</returns>
        internal protected override Double rHeight(FontProp fontProp)
        {
            Single fCapHeight = afm.fCapHeight;

            if (Single.IsNaN(fCapHeight))
            {
                fCapHeight = afm.fFontBBox_ury - afm.fFontBBox_lly;
            }
            Debug.Assert(!(Single.IsNaN(fCapHeight)));
            return(rSizeFactor(fontProp) * fCapHeight / 1000F);
        }
示例#3
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Gets the size factor of the font.</summary>
 /// <param name="fontProp">Font properties</param>
 /// <returns>Size factor</returns>
 internal Double rSizeFactor(FontProp fontProp)
 {
     if (fontProp.fontDef.sFontName == "Symbol" || fontProp.fontDef.sFontName == "ZapfDingbats")
     {
         Type1FontData.CharMetrics afmCharMetrics = afm.afmCharMetrics(74);
         Debug.Assert(!(Single.IsNaN(afmCharMetrics.fBBox_ury)));
         Debug.Assert(!(Single.IsNaN(afmCharMetrics.fBBox_lly)));
         return(fontProp.rSize * 1000.0 / (afmCharMetrics.fBBox_ury - afmCharMetrics.fBBox_lly));
     }
     Debug.Assert(!(Single.IsNaN(afm.fCapHeight)));
     return(fontProp.rSize * 1000.0 / afm.fCapHeight);
 }
示例#4
0
   //----------------------------------------------------------------------------------------------------x
   /// <summary>Registers the specified font properties for this page.</summary>
   /// <param name="fontProp">Font properties</param>
   /// <seealso cref="PdfPageData.ht_FontProp"/>
   /// <seealso cref="PdfFontPropData.pdfPageData_Registered"/>
   internal void RegisterFontProp(FontProp fontProp)
   {
 #if (DEBUG)
       StackFrame sf = new StackFrame(1);
       Debug.Assert(sf.GetMethod().Name == "PrepareObjIdsForContainer");
 #endif
       PdfFontPropData pdfFontPropData = (PdfFontPropData)fontProp.fontPropData;
       if (pdfFontPropData.pdfPageData_Registered != this)
       {
           ht_FontProp.Add(pdfFontPropData.sKey, fontProp);
           pdfFontPropData.pdfPageData_Registered = this;
       }
   }
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Creates a column definition object.</summary>
 /// <param name="tlm">Table layout manager of this column</param>
 /// <param name="sHeader">Header of the column</param>
 /// <param name="rWidth">Width of the column</param>
 public Column(TableLayoutManager tlm, String sHeader, Double rWidth) : base(tlm, rWidth)
 {
     headerCellDef = new HeaderCellDef();
     this.sHeader  = sHeader;
     fp_Header     = tlm.fp_Header;
 }
示例#6
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Gets the width of the specified text with this font in 1/72 inches.</summary>
 /// <param name="fontProp">Font properties</param>
 /// <param name="sText">Text</param>
 /// <returns>Width of the text in 1/72 inches</returns>
 internal protected abstract Double rWidth(FontProp fontProp, String sText);
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Creates a new table layout manager.</summary>
 /// <param name="fp_Header">Font property of the header</param>
 public TableLayoutManager(FontProp fp_Header) : this(fp_Header.fontDef.report)
 {
     this.fp_Header = fp_Header;
 }
示例#8
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Creates a new Int32 object.</summary>
 /// <param name="fontProp">Font properties of the Int32 object</param>
 /// <param name="iVal">Int32 value</param>
 public RepInt32(FontProp fontProp, Int32 iVal) : base(fontProp, iVal.ToString()) {
 }
示例#9
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Gets the height of the font in 1/72 inches.</summary>
 /// <param name="fontProp">Font properties</param>
 /// <returns>Height of the font in 1/72 inches</returns>
 internal protected abstract Double rHeight(FontProp fontProp);
示例#10
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Creates a new RepReal32 object.</summary>
 /// <param name="fontProp">Font properties of the Real32 object</param>
 /// <param name="fVal">Real32 (Single) value</param>
 public RepReal32(FontProp fontProp, Single fVal) : base(fontProp, fVal.ToString("0.00")) {
 }
示例#11
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Creates a new RepReal32 object.</summary>
 /// <param name="fontProp">Font properties of the Real32 object</param>
 /// <param name="fVal">Real32 (Single) value</param>
 /// <param name="sFormat">Provides the format information for the Int32 value (ms-help://MS.VSCC/MS.MSDNVS/cpguide/html/cpconcustomnumericformatstrings.htm)</param>
 public RepReal32(FontProp fontProp, Single fVal, String sFormat) : base(fontProp, fVal.ToString(sFormat)) {
 }
示例#12
0
        //----------------------------------------------------------------------------------------------------x
        /// <summary>Adds a report object to the current container at the current position.</summary>
        /// <param name="repString">Report object to add to the container</param>
        /// <param name="container">Container</param>
        /// <param name="rCurX"></param>
        /// <param name="rOfsX"></param>
        /// <param name="rCurY"></param>
        /// <param name="rWidth"></param>
        public void PrintString(RepString repString, Container container, ref Double rCurX, Double rOfsX, ref Double rCurY, Double rWidth)
        {
            FontProp fp    = repString.fontProp;
            String   sText = repString.sText;

            Int32 iLineStartIndex = 0;
            Int32 iIndex          = 0;

            while (true)
            {
                if (rCurY > container.rHeight)
                {
                    NextContainer();
                }
                Int32  iLineBreakIndex = 0;
                Double rPosX           = rCurX;
                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 >= 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(rOfsX + rCurX, rCurY, repString);
                    rCurX = rLineBreakPos;
                    break;
                }
                String sLine = sText.Substring(iLineStartIndex, iLineBreakIndex - iLineStartIndex);
                container.Add(rOfsX + rCurX, rCurY, new RepString(fp, sLine));
                if (iIndex >= sText.Length)
                {
                    rCurX = rLineBreakPos;
                    break;
                }
                rCurX           = 0;
                rCurY          += fp.rLineFeed;
                iLineStartIndex = iIndex;
            }
        }
示例#13
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Creates a new Int32 object.</summary>
 /// <param name="fontProp">Font properties of the Int32 object</param>
 /// <param name="iVal">Int32 value</param>
 /// <param name="nfi">Provides the format information for the Int32 value (ms-help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfSystemGlobalizationNumberFormatInfoClassTopic.htm)</param>
 //public RepInt32(FontProp fontProp, Int32 iVal, NumberFormatInfo nfi) : base(fontProp, iVal.ToString(nfi)) {
 public RepInt32(FontProp fontProp, Int32 iVal, NumberFormatInfo nfi) : base(fontProp, String.Format(nfi, "{0:N}", iVal)) {
 }
示例#14
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Creates a new DateTime object.</summary>
 /// <param name="fontProp">Font properties of the DateTime object</param>
 /// <param name="dt_Val">DateTime value</param>
 /// <param name="sFormat">Provides the format information for the DataTime value (ms-help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfSystemGlobalizationDateTimeFormatInfoClassTopic.htm)</param>
 public RepDateTime(FontProp fontProp, DateTime dt_Val, String sFormat) : base(fontProp, dt_Val.ToString(sFormat)) {
 }
示例#15
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Creates a new DateTime object.</summary>
 /// <param name="fontProp">Font properties of the DateTime object</param>
 /// <param name="dt_Val">DateTime value</param>
 public RepDateTime(FontProp fontProp, DateTime dt_Val) : base(fontProp, dt_Val.ToString()) {
 }
示例#16
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Creates a new RepReal64 object.</summary>
 /// <param name="fontProp">Font properties of the Real64 object</param>
 /// <param name="rVal">Real64 value</param>
 public RepReal64(FontProp fontProp, Double rVal) : base(fontProp, rVal.ToString("0.00")) {
 }
示例#17
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Creates a new RepReal64 object.</summary>
 /// <param name="fontProp">Font properties of the Real64 object</param>
 /// <param name="rVal">Real64 value</param>
 /// <param name="nfi">Provides the format information for the Int32 value (ms-help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfSystemGlobalizationNumberFormatInfoClassTopic.htm)</param>
 //public RepReal64(FontProp fontProp, Double rVal, NumberFormatInfo nfi) : base(fontProp, rVal.ToString(nfi)) {
 public RepReal64(FontProp fontProp, Double rVal, NumberFormatInfo nfi) : base(fontProp, String.Format(nfi, "{0:N}", rVal)) {
 }
示例#18
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Creates a new RepReal64 object.</summary>
 /// <param name="fontProp">Font properties of the Real64 object</param>
 /// <param name="rVal">Real64 value</param>
 /// <param name="sFormat">Provides the format information for the Int32 value (ms-help://MS.VSCC/MS.MSDNVS/cpguide/html/cpconcustomnumericformatstrings.htm)</param>
 public RepReal64(FontProp fontProp, Double rVal, String sFormat) : base(fontProp, rVal.ToString(sFormat)) {
 }
示例#19
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Creates a font properties data object for this formatter.</summary>
 /// <param name="fontProp"></param>
 /// <returns></returns>
 internal protected abstract FontPropData fontPropData_CreateInstance(FontProp fontProp);
示例#20
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Gets the width of the specified text with this font in 1/72 inches.</summary>
 /// <param name="fontProp">Font properties</param>
 /// <param name="sText">Text</param>
 /// <returns>Width of the text in 1/72 inches</returns>
 internal protected override Double rWidth(FontProp fontProp, String sText)
 {
     return(rSizeFactor(fontProp) * afm.rWidth(sText) / 1000);
 }
示例#21
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);
            }
        }
示例#22
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Creates a new RepReal32 object.</summary>
 /// <param name="fontProp">Font properties of the Real32 object</param>
 /// <param name="fVal">Real32 (Single) value</param>
 /// <param name="nfi">Provides the format information for the Int32 value (ms-help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfSystemGlobalizationNumberFormatInfoClassTopic.htm)</param>
 public RepReal32(FontProp fontProp, Single fVal, NumberFormatInfo nfi) : base(fontProp, String.Format(nfi, "{0:N}", fVal)) {
 }
示例#23
0
        //----------------------------------------------------------------------------------------------------x
        /// <summary>Adds a report object to the current container at the current position.</summary>
        /// <param name="al_RepObj">Result array for the report objects</param>
        /// <param name="repString">Report object to add to the container</param>
        /// <param name="rCurX"></param>
        /// <param name="rOfsX"></param>
        /// <param name="rAlignH">Horizontal allignment</param>
        /// <param name="rCurY"></param>
        /// <param name="rWidth"></param>
        internal void FormatString(ArrayList al_RepObj, RepString repString, ref Double rCurX, Double rOfsX, Double rAlignH,
                                   ref Double rCurY, Double rWidth)
        {
            FontProp fp    = repString.fontProp;
            String   sText = repString.sText;

            Int32 iLineStartIndex = 0;
            Int32 iIndex          = 0;

            while (true)
            {
                Int32  iLineBreakIndex = 0;
                Double rPosX           = rCurX;
                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 >= rWidth)
                    {
                        if (iLineBreakIndex == 0 && rCurX <= rOfsX + 0.01)
                        {
                            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
                {
                    repString.matrixD.rDX = rCurX + (rWidth - rCurX) * rAlignH;
                    repString.rAlignH     = rAlignH;
                    repString.matrixD.rDY = rCurY;
                    repString.rAlignV     = RepObj.rAlignBottom;
                    al_RepObj.Add(repString);
                    rCurX = rLineBreakPos;
                    break;
                }
                if (iLineBreakIndex > iLineStartIndex && sText[iLineBreakIndex - 1] == ' ')
                {
                    iLineBreakIndex--;
                }
                String    sLine = sText.Substring(iLineStartIndex, iLineBreakIndex - iLineStartIndex);
                RepString rs    = new RepString(fp, sLine);
                rs.matrixD.rDX = rCurX + (rWidth - rCurX) * rAlignH;
                rs.rAlignH     = rAlignH;
                rs.matrixD.rDY = rCurY;
                rs.rAlignV     = RepObj.rAlignBottom;
                al_RepObj.Add(rs);
                if (iIndex >= sText.Length)
                {
                    rCurX = rLineBreakPos;
                    break;
                }
                rCurX           = rOfsX;
                rCurY          += fp.rLineFeed;
                iLineStartIndex = iIndex;
            }
        }
示例#24
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Creates a new Int32 object.</summary>
 /// <param name="fontProp">Font properties of the Int32 object</param>
 /// <param name="iVal">Int32 value</param>
 /// <param name="sFormat">Provides the format information for the Int32 value (ms-help://MS.VSCC/MS.MSDNVS/cpguide/html/cpconcustomnumericformatstrings.htm)</param>
 public RepInt32(FontProp fontProp, Int32 iVal, String sFormat) : base(fontProp, iVal.ToString(sFormat)) {
 }