From 17801bf257a7076efc16c21125e931143176e9c2 Mon Sep 17 00:00:00 2001 From: Kathy Date: Wed, 29 May 2013 14:59:00 +0000 Subject: [PATCH] For IP3, Use RNOSepLineLength to draw the separator line. --- PROMS/Volian.Print.Library/vlnRNOSeparator.cs | 44 ++++++++++++++++--- 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/PROMS/Volian.Print.Library/vlnRNOSeparator.cs b/PROMS/Volian.Print.Library/vlnRNOSeparator.cs index 263085bb..d242755f 100644 --- a/PROMS/Volian.Print.Library/vlnRNOSeparator.cs +++ b/PROMS/Volian.Print.Library/vlnRNOSeparator.cs @@ -22,6 +22,13 @@ namespace Volian.Print.Library get { return _ExtendChangeBar; } set { _ExtendChangeBar = value; } } + private float _XLength = 0; + public float XLength + { + get { return _XLength; } + set { _XLength = value; } + } + /* if flag set and separator defined then output separator */ /*if separator is a control-A use RNOSepLine*/ public vlnRNOSeparator(vlnParagraph parent, PdfContentByte cb, string sepStr, float xoffset, float yoffset, FormatInfo formatInfo, bool extendChangeBar) @@ -29,19 +36,44 @@ namespace Volian.Print.Library ExtendChangeBar = formatInfo.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeBarToRNOSep ? extendChangeBar : false; YOffset = yoffset; XOffset = xoffset; + XLength = formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.RNOSepLineLength??0; _MyParent = parent; - if (sepStr != null) - Rtf = GetRtf(sepStr, formatInfo.PlantFormat.FormatData.Font); - else - Rtf = "--------------------------"; //TODO - What should this be: is this Ctrl-A? MyFont = formatInfo.PlantFormat.FormatData.Font; - Width = sepStr.Length * MyFont.CharsToTwips + _WidthAdjust; + if (XLength == 0) + { + if (sepStr != null) + Rtf = GetRtf(sepStr, formatInfo.PlantFormat.FormatData.Font); + else + Rtf = "--------------------------"; //TODO - What should this be: is this Ctrl-A? + Width = sepStr.Length * MyFont.CharsToTwips + _WidthAdjust; + } + else + { + Width = XLength; + Height = SixLinesPerInch; + } } public override float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin) { MyContentByte = cb; float yLocation = CalculateYOffset(yPageStart, yTopMargin); - Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, "", yBottomMargin); + if (XLength != 0) + { + cb.SaveState(); + VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper; + PdfLayer textLayer = _MyPageHelper == null ? null : _MyPageHelper.TextLayer; + if (textLayer != null) cb.BeginLayer(textLayer); + iTextSharp.text.Color lineColor = new iTextSharp.text.Color(PrintOverride.OverrideChangeBarColor(System.Drawing.Color.Black)); + cb.SetColorStroke(lineColor); + cb.SetLineWidth(.5F); + cb.MoveTo(XOffset/* + xAdj */, yLocation-7); + cb.LineTo(XOffset + XLength, yLocation-7); + cb.Stroke(); + if (textLayer != null) cb.EndLayer(); + cb.RestoreState(); + } + else + Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, "", yBottomMargin); return yPageStart; } }