diff --git a/PROMS/Volian.Print.Library/Grid2Pdf.cs b/PROMS/Volian.Print.Library/Grid2Pdf.cs index ac9964b1..b4ab511a 100644 --- a/PROMS/Volian.Print.Library/Grid2Pdf.cs +++ b/PROMS/Volian.Print.Library/Grid2Pdf.cs @@ -125,6 +125,8 @@ namespace Volian.Print.Library public void ToPdf(iTextSharp.text.pdf.ColumnText myColumnText, float left, float top) { //ZoomGrid(myColumnText, left, top); + VlnSvgPageHelper myPageHelper = myColumnText.Canvas.PdfWriter.PageEvent as VlnSvgPageHelper; + myPageHelper.AddGap(top, top - Height, left, left + Width); MyCells.ToPdf(myColumnText, left, top); } private void ZoomGrid(iTextSharp.text.pdf.ColumnText myColumnText, float left, float top) diff --git a/PROMS/Volian.Print.Library/Pagination.cs b/PROMS/Volian.Print.Library/Pagination.cs index f13ed01f..fbe8c587 100644 --- a/PROMS/Volian.Print.Library/Pagination.cs +++ b/PROMS/Volian.Print.Library/Pagination.cs @@ -29,14 +29,6 @@ namespace Volian.Print.Library private int Paginate(float yLocation, float yTopMargin, float yBottomMargin) { float yPageSize = yTopMargin - yBottomMargin; - // yPageSizeNextPage is the page size of the 'next' page. A format variable exists off of the docstyle - // For UseOnFirstPage vs UseOnAllButFirstPage. If this is set for this format, and processing the FIRST - // page, the size of next page, which may be different, is used in pagination calculationstop. - // If this format flag is not set, or not printing the first page of the section with this flag, - // this next page size is the same as current page size. - float yPageSizeNextPage = yPageSize; - if (!MyPageHelper.DidFirstPageDocStyle && (MyItemInfo.MyActiveSection.MyDocStyle.StructureStyle.Where & E_DocStyleUse.UseOnFirstPage) > 0) - yPageSizeNextPage = GetYPageSizeUseOnAllButFirstPage(); // TODO: This does not account for a long step as the last step that would exceed more than one page and // that has an end message that needs to be accounted for in determining pagination. To do that the last @@ -153,7 +145,6 @@ namespace Volian.Print.Library float ySize7LPI = YSize; // +SixLinesPerInch; if (_Match16BitPagination) ySize7LPI += SixLinesPerInch; string firstStep = "No"; - if (MyItemInfo.IsHigh && MyItemInfo.MyPrevious == null) firstStep = "Yes"; //if (!ManualPageBreak && mySize + yEndMsg <= yWithinMargins) // Don't Paginate if there is enough room, will fit on page @@ -174,6 +165,16 @@ namespace Volian.Print.Library // YSize includes a blank line after the step which we don't want to include in the page break test, thus the // YSize - SixLinesPerInch: + // yPageSizeNextPage is the page size of the 'next' page. A format variable exists off of the docstyle + // For UseOnFirstPage vs UseOnAllButFirstPage. If this is set for this format, and processing the FIRST + // page, the size of next page, which may be different, is used in pagination calculationstop. + // If this format flag is not set, or not printing the first page of the section with this flag, + // this next page size is the same as current page size. + float yPageSizeNextPage = yPageSize; + //if (firstStep == "No") + // ResetDocStyleAndValues(ref yTopMargin, ref yBottomMargin); + if (MyPageHelper.DidFirstPageDocStyle && (MyItemInfo.MyActiveSection.MyDocStyle.StructureStyle.Where & E_DocStyleUse.UseOnAllButFirstPage) > 0) + yPageSizeNextPage = GetYPageSizeUseOnAllButFirstPage(); if (!KeepWithHeader && !KeepStepsOnPage && YSize - SixLinesPerInch + yEndMsg <= yPageSizeNextPage) // if the entire step can fit on one page, do a page break { // Don't want extra line before step diff --git a/PROMS/Volian.Print.Library/PromsPrinter.cs b/PROMS/Volian.Print.Library/PromsPrinter.cs index 77adb92b..c712d047 100644 --- a/PROMS/Volian.Print.Library/PromsPrinter.cs +++ b/PROMS/Volian.Print.Library/PromsPrinter.cs @@ -330,7 +330,7 @@ namespace Volian.Print.Library { SectionInfo mySection = myProcedure.Sections[i] as SectionInfo; if (!mySection.DisplayText.ToUpper().Contains("FOLDOUT")) - { + { if (mySection.MyDocStyle.Final != null && mySection.MyDocStyle.Final.Message != null && mySection.MyDocStyle.Final.Message.Length > 0) return mySection.ItemID; else @@ -424,7 +424,7 @@ namespace Volian.Print.Library { //Console.WriteLine("'{0}' PromsPrinter", mySection.DisplayText); if (mySection.SectionConfig.Section_Pagination == SectionConfig.SectionPagination.Separate) - _MyHelper.DidFirstPageDocStyle = false; + _MyHelper.DidFirstPageDocStyle = false; if (!mySection.IsStepSection) _MyHelper.PageBookmarks.Add((ItemInfo)mySection, ((mySection.DisplayNumber ?? "") == "" ? "" : mySection.DisplayNumber + " - ") + mySection.DisplayText, null); _MyHelper.MySection = mySection; OnStatusChanged("After Set Svg", PromsPrinterStatusType.SetSVG); @@ -547,7 +547,7 @@ namespace Volian.Print.Library float ylocation = cb.PdfDocument.PageSize.Height - ((float)mySection.MyDocStyle.Layout.TopMargin + locEndOfWordDoc * 72); // 72 - pts per inch. iTextSharp.text.Font fnt = VolianPdf.GetFont(mySection.MyDocStyle.End.Font.WindowsFont); fnt.Color = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Black)); - iTextSharp.text.Paragraph para = new Paragraph(mySection.MyDocStyle.End.Message, fnt); + iTextSharp.text.Paragraph para = new Paragraph(mySection.MyDocStyle.End.FixedMessage, fnt); float wtpm = (float)mySection.MyDocStyle.Layout.PageWidth - (float)mySection.MyDocStyle.Layout.LeftMargin; float centerpos = (float)mySection.MyDocStyle.Layout.LeftMargin + (wtpm - (mySection.MyDocStyle.End.Message.Length * mySection.MyDocStyle.End.Font.CharsToTwips)) / 2; float yBottomMargin = Math.Max(0, (float)mySection.MyDocStyle.Layout.TopMargin - (float)mySection.MyDocStyle.Layout.PageLength - 2 * vlnPrintObject.SixLinesPerInch); @@ -557,11 +557,16 @@ namespace Volian.Print.Library OnStatusChanged("Merge MSWord", PromsPrinterStatusType.MergeMSWord); } OnStatusChanged("Before NewPage", PromsPrinterStatusType.Before); + if (mySection.MyDocStyle.LandscapePageList)// && mySection.MyDocStyle.Layout.PageWidth > mySection.MyDocStyle.Layout.PageLength) + _MyHelper.IsLandscape = true; + else + _MyHelper.IsLandscape = false; cb.PdfDocument.NewPage(); // Word Document // if this document style has another style that is for pages other than first, we need to // reset the document style off of this section AND reset docstyle values used. _MyHelper.DidFirstPageDocStyle = true; + DebugPagination.WriteLine("CreateWordDocPdf"); if ((mySection.MyDocStyle.StructureStyle.Where & E_DocStyleUse.UseOnFirstPage) > 0) _MyHelper.MySection = mySection; // this resets the docstyle/pagestyle if pagehelper OnStatusChanged("After NewPage", PromsPrinterStatusType.NewPage); diff --git a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs index 216f826f..9cfcacf3 100644 --- a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs +++ b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs @@ -114,11 +114,51 @@ namespace Volian.Print.Library } if (MySection.MyDocStyle.StructureStyle.Style==null || (MySection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DontCountInTabOfCont) == 0) CurrentTOCPageNumber++; + if (MySection.MyDocStyle.CenterLineX != null && MySection.ColumnMode > 0) + DrawCenterLine(writer.DirectContent, MySection.MyDocStyle.Layout.LeftMargin + MySection.MyDocStyle.CenterLineX ?? 0, MySection.MyDocStyle.CenterLineYTop ?? 0, MySection.MyDocStyle.CenterLineYBottom ?? 0); PageListTopCheckOffHeader = null; PageListLastCheckOffHeader = null; YMultiplier = 1; } + private Gaps _MyGaps; + public Gaps MyGaps + { + get + { + if (_MyGaps == null) + _MyGaps = new Gaps(); + return _MyGaps; + } + } + public void AddGap(float top, float bottom, float left, float right) + { + float center = MySection.MyDocStyle.Layout.LeftMargin + MySection.MyDocStyle.CenterLineX ?? 0; + if(center == 0) return; + if (center > right || center < left) return; + MyGaps.Add(top, bottom); + } + private void DrawCenterLine(PdfContentByte cb, float xLoc, float yTop, float yBottom) + { + cb.SaveState(); + if (PageListLayer != null) cb.BeginLayer(PageListLayer); + cb.SetLineWidth(.95f); + cb.SetColorStroke(new Color(PrintOverride.SvgColor)); + cb.MoveTo(xLoc, yTop); + if (_MyGaps != null) + { + foreach (Gap gap in MyGaps) + { + cb.LineTo(xLoc, gap.YTop); + cb.MoveTo(xLoc, gap.YTop - (gap.YTop - gap.YBottom) * YMultiplier); + } + _MyGaps = null; + } + cb.LineTo(xLoc, yBottom); + cb.Stroke(); + if (PageListLayer != null) cb.EndLayer(); + cb.RestoreState(); + } private void ResetDocStyleAndValues() { @@ -518,6 +558,10 @@ namespace Volian.Print.Library MyPdfContentByte.AddTemplate(MyPageCounts.AddToTemplateList(key, MyPdfWriter, txt, args.MySvgText.Font, args.MySvgText.Align, args.MySvgText.FillColor), args.MySvgScale.X(args.MySvgText.X), args.MySvgScale.Y(MyPdfContentByte, args.MySvgText.Y)); return string.Empty; } + if (args.MyText.Contains("{ROMANPAGE}")) + { + return args.MyText.Replace("{ROMANPAGE}", ItemInfo.RomanNumbering(1).ToLower()); + } if (args.MyText.Contains("{SECONDARYPAGE}") || args.MyText.Contains("{SECONDARYOF}")) { string key = "SecondaryPage." + MySection.ItemID; @@ -931,7 +975,7 @@ namespace Volian.Print.Library if (unitnum.Length > 0) { if (unitnum.Contains("#")) - eopnum = unitnum.Replace("#", eopnum); + eopnum = unitnum.Replace("#", eopnum); if (unitnum.Contains("!")) eopnum = unitnum.Replace("!", unitname); } @@ -1590,4 +1634,31 @@ namespace Volian.Print.Library _CheckOffHeaderFont = vf; } } + public class Gap + { + private float _YTop; + public float YTop + { + get { return _YTop; } + set { _YTop = value; } + } + private float _YBottom; + public float YBottom + { + get { return _YBottom; } + set { _YBottom = value; } + } + public Gap(float yTop, float yBottom) + { + _YTop = yTop; + _YBottom = yBottom; + } + } + public class Gaps : List + { + public void Add(float yTop, float yBotttom) + { + this.Add(new Gap(yTop, yBotttom)); + } + } } diff --git a/PROMS/Volian.Print.Library/vlnBox.cs b/PROMS/Volian.Print.Library/vlnBox.cs index aa8a1766..c57e2564 100644 --- a/PROMS/Volian.Print.Library/vlnBox.cs +++ b/PROMS/Volian.Print.Library/vlnBox.cs @@ -67,6 +67,7 @@ namespace Volian.Print.Library float right = (float)MyParent.MyItemInfo.MyDocStyle.Layout.LeftMargin + (float)(MyBox.End ?? DefEnd); iTextSharp.text.Color boxColor = new iTextSharp.text.Color(PrintOverride.OverrideBoxColor(System.Drawing.Color.Black)); cb.SetColorStroke(boxColor); + _MyPageHelper.MyGaps.Add(top, top - Height); if (DefBox != null) { cb.SetLineWidth(.6F); @@ -138,62 +139,62 @@ namespace Volian.Print.Library private void DrawAsteriskTopBottom(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin, ref float top, ref float bottom, float left) { - // this box is not drawn, it is a series of asterisks drawn above and below text. - // For this box, there are no vertical edges (RGE uses this box type) - top = CalculateYOffset(yPageStart, yTopMargin); - // Bug fix B2013-091 - // added YMultiplier to handle compress pages - // bottom row of asterisks was in non-compressed line location + // this box is not drawn, it is a series of asterisks drawn above and below text. + // For this box, there are no vertical edges (RGE uses this box type) + top = CalculateYOffset(yPageStart, yTopMargin); + // Bug fix B2013-091 + // added YMultiplier to handle compress pages + // bottom row of asterisks was in non-compressed line location bottom = top - (Height * MyPageHelper.YMultiplier); // create a new font without any styles such as underline. VE_Font vf = new VE_Font(MyParent.MyItemInfo.FormatStepData.Font.Family, (int)MyParent.MyItemInfo.FormatStepData.Font.Size, E_Style.None, (float)MyParent.MyItemInfo.FormatStepData.Font.CPI); - + // To find the length of the line, account for the length of the upper right corner also (BXURC) int urcLen = MyBox.BXHorz[MyBox.BXHorz.Length - 1] == ' ' && MyBox.BXURC[0] == ' ' ? 1 : MyBox.BXURC.Length; float endHorz = (float)MyBox.End - (float)MyBox.Start - (float)(urcLen * (72 / vf.CPI)); // Do the top line first: - StringBuilder sb = new StringBuilder(); - sb.Append(MyBox.BXULC); - float size = (float)(MyBox.BXULC.Length * (72 / vf.CPI)); + StringBuilder sb = new StringBuilder(); + sb.Append(MyBox.BXULC); + float size = (float)(MyBox.BXULC.Length * (72/vf.CPI)); string bxstr = null; if (!ContainsPageBreak) // Only do top line if there is no page break. { while (size < endHorz) - { - sb.Append(MyBox.BXHorz); - size = size + (float)(MyBox.BXHorz.Length * (72 / vf.CPI)); - } + { + sb.Append(MyBox.BXHorz); + size = size + (float)(MyBox.BXHorz.Length * (72/vf.CPI)); + } // Tack on the right upper corner. For some formats, the upper right corner in the // had the first character as a space, this would put two spaces in a row at the // end of the string, so remove the space before tacking on the upper right corner: bxstr = sb.ToString(); if (bxstr[bxstr.Length - 1] == ' ' && MyBox.BXURC[0] == ' ') bxstr = bxstr.TrimEnd(); bxstr = bxstr + MyBox.BXURC; - size = size + (float)((MyBox.BXURC.Length) * (72 / vf.CPI)); - Rtf = GetRtf(bxstr, vf); - IParagraph = null; // set to null so that next access of IParagraph sets the Rtf. + size = size + (float)((MyBox.BXURC.Length) * (72/vf.CPI)); + Rtf = GetRtf(bxstr, vf); + IParagraph = null; // set to null so that next access of IParagraph sets the Rtf. Rtf2Pdf.TextAt(cb, IParagraph, left, top, size + 10, 100, "", yBottomMargin); } // Handle the bottom line now: if (bottom < yBottomMargin) return; // Box goes off page, i.e. page break, don't do bottom - - sb.Remove(0, sb.Length); - sb.Append(MyBox.BXLLC); - size = (float)(MyBox.BXLLC.Length * (72 / vf.CPI)); + + sb.Remove(0, sb.Length); + sb.Append(MyBox.BXLLC); + size = (float)(MyBox.BXLLC.Length * (72 / vf.CPI)); while (size < endHorz) - { - sb.Append(MyBox.BXHorz); - size = size + (float)(MyBox.BXHorz.Length * (72 / vf.CPI)); - } - bxstr = sb.ToString().TrimEnd() + MyBox.BXLRC; - size = size + (float)((MyBox.BXLRC.Length) * (72 / vf.CPI)); - Rtf = GetRtf(bxstr, vf); + { + sb.Append(MyBox.BXHorz); + size = size + (float)(MyBox.BXHorz.Length * (72 / vf.CPI)); + } + bxstr = sb.ToString().TrimEnd() + MyBox.BXLRC; + size = size + (float)((MyBox.BXLRC.Length) * (72/vf.CPI)); + Rtf = GetRtf(bxstr, vf); IParagraph = null; // set to null so that next access of IParagraph sets the Rtf. Rtf2Pdf.TextAt(cb, IParagraph, left, bottom, size + 10, 100, "", yBottomMargin); - } + } private void DrawAsteriskSide(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin, float top, float bottom, float left, float right) { // set the top & bottom of sides. If there is a page break in the middle of box, adjust these. @@ -206,8 +207,8 @@ namespace Volian.Print.Library else { // to calculate the bottom, don't adjust the top yet. - top = CalculateYOffset(yPageStart, yTopMargin); - bottom = top - (Height * MyPageHelper.YMultiplier); + top = CalculateYOffset(yPageStart, yTopMargin); + bottom = top - (Height * MyPageHelper.YMultiplier); top = yTopMargin; // reset top to top margin since there was a page break. } @@ -228,7 +229,7 @@ namespace Volian.Print.Library { Rtf2Pdf.TextAt(cb, IParagraph, left, vertDiff, width, height, "", yBottomMargin); vertDiff -= (SixLinesPerInch * MyPageHelper.YMultiplier); - } + } // right side: vertDiff = top - (SixLinesPerInch * MyPageHelper.YMultiplier); diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index 3a6764f3..98063146 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -50,7 +50,8 @@ namespace Volian.Print.Library yoff = Add(cb, childItemInfo.Notes, xoff, yoff, yoffRight, rnoLevel, maxRNO, formatInfo); int? bxIndx = childItemInfo.FormatStepData==null?-1:childItemInfo.FormatStepData.StepLayoutData.STBoxindex; bool boxHLS = false; - if ((bxIndx != -1 && (bxIndex != bxIndx || childItemInfo.FormatStepData.BoxIt))) + + if ((bxIndx ?? -1) != -1 && (bxIndex != bxIndx || childItemInfo.FormatStepData.BoxIt || childItemInfo.MyHeader != null)) { if (childItemInfo.FormatStepData.BoxIt) // this is a boxed HLS { @@ -81,7 +82,12 @@ namespace Volian.Print.Library { if (bxIndx != null) { - if (box != null) box.Height = yoff - box.YOffset; // new height, with children + if (box != null) + { + box.Height = yoff - box.YOffset; // new height, with children + if (childItemInfo.MyHeader != null) + yoff += vlnPrintObject.SixLinesPerInch * 2; + } box = new vlnBox(); box.MyBox = formatInfo.PlantFormat.FormatData.BoxList[(int)bxIndx]; int ln = 1; // a format flag determines whether there is a space before the note/caution. @@ -96,7 +102,6 @@ namespace Volian.Print.Library if (childItemInfo is SectionInfo) formatInfo = (childItemInfo as SectionInfo).LocalFormat ?? formatInfo; if (rnoLevel < maxRNO && childItemInfo.RNOs != null) yoff = Math.Max(yoff, yoffRight); vlnParagraph para = new vlnParagraph(Parent, cb, childItemInfo, xoff, yoff, rnoLevel, maxRNO, formatInfo, null, null); - if (box != null && box.MyParent == null) { box.MyParent = para; @@ -134,7 +139,7 @@ namespace Volian.Print.Library } return yoff; } - public float ToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin) + public float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin) { foreach (vlnParagraph child in this) { @@ -582,10 +587,8 @@ namespace Volian.Print.Library { get { - return string.Format("DebugID = {0}, ID={1} Type={2} TypeName='{3}' StepLevel={4} DBSequence={5} YTopMost={6} ", - DebugId, MyItemInfo.ItemID, MyItemInfo.FormatStepType, - MyItemInfo.FormatStepData==null?"NoStepData":MyItemInfo.FormatStepData.Type, - MyItemInfo.StepLevel, MyItemInfo.DBSequence,YTopMost); + return string.Format("DebugID = {0}, ID={1} Type={2} TypeName='{3}' StepLevel={4} DBSequence={5} Width={6} Left={7}", + DebugId, MyItemInfo.ItemID, MyItemInfo.FormatStepType, MyItemInfo.FormatStepData==null?"NoStepData":MyItemInfo.FormatStepData.Type, MyItemInfo.StepLevel, MyItemInfo.DBSequence, Width, XOffset); } } private void ResetDocStyleAndValues(ref float yTopMargin, ref float yBottomMargin) @@ -606,6 +609,7 @@ namespace Volian.Print.Library } } MyPageHelper.DidFirstPageDocStyle = true; + DebugPagination.WriteLine("ResetDocStyleAndValues"); MyPageHelper.MySection = (SectionInfo)MyItemInfo.MyActiveSection; yTopMargin = _PointsPerPage - (float)MyItemInfo.MyActiveSection.MyDocStyle.Layout.TopMargin; yBottomMargin = Math.Max(0, yTopMargin - (float)MyItemInfo.MyActiveSection.MyDocStyle.Layout.PageLength); @@ -629,7 +633,6 @@ namespace Volian.Print.Library DebugText.WriteLine("ToPdf1:{0},'{1}',{2},{3},{4},{5}", MyItemInfo.ItemID, MyItemInfo.ShortSearchPath, XOffset, yLocation, yPageStart, YTopMost); int paginate = Paginate(yLocation, yTopMargin, yBottomMargin); bool firstHighLevelStep = MyItemInfo.IsHigh && (MyItemInfo.MyPrevious == null); - switch (paginate) { case 0: // No page break @@ -643,6 +646,7 @@ namespace Volian.Print.Library case 1: // Break on High Level Step OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin); cb.PdfDocument.NewPage(); + if(MyItemInfo.IsHigh && MyItemInfo.MyPrevious != null) //do not reset for 1st step ResetDocStyleAndValues(ref yTopMargin, ref yBottomMargin); DebugText.WriteLine("Paginate1"); if (MyItemInfo.IsSection) @@ -664,9 +668,9 @@ namespace Volian.Print.Library if (myMsg != null && myMsg != "") { if (myMsg.IndexOf(@"%d") > -1) - myMsg = myMsg.Replace(@"%d", MyItemInfo.MyHLS.MyTab.CleanText.Trim()); + myMsg = myMsg.Replace(@"%d", MyItemInfo.MyHLS.MyTab.CleanTextNoSymbols.Trim()); if (myMsg.IndexOf(@"%2d") > -1) - myMsg = myMsg.Replace(@"%2d", MyItemInfo.MyHLS.MyTab.CleanText.Trim(" .".ToCharArray()).PadLeft(2)); + myMsg = myMsg.Replace(@"%2d", MyItemInfo.MyHLS.MyTab.CleanTextNoSymbols.Trim(" .".ToCharArray()).PadLeft(2)); float msg_yLocation = 0; if (myMsg.Contains("{par}")) { @@ -763,16 +767,16 @@ namespace Volian.Print.Library break; } - yPageStart = ChildrenAbove.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin); - yPageStart = ChildrenLeft.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin); + yPageStart = ChildrenAbove.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin); + yPageStart = ChildrenLeft.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin); yPageStart = ParagraphToPdf(cb, yPageStart, yTopMargin, yBottomMargin); - yPageStart = ChildrenRight.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin); - yPageStart = ChildrenBelow.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin); + yPageStart = ChildrenRight.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin); + yPageStart = ChildrenBelow.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin); if (MyItemInfo.IsHigh && MyItemInfo.NextItem == null) // last hls, add the 'end' message, if there is one { DocStyle docstyle = MyItemInfo.MyDocStyle; - string myMsg = (docstyle.End == null) ? null : docstyle.End.Message; + string myMsg = (docstyle.End == null) ? null : docstyle.End.FixedMessage; if (myMsg != null) { // If the flag is 0 or 1, just put the end message out right below this vlnParagraph: @@ -785,11 +789,16 @@ namespace Volian.Print.Library } if (myMsg.Contains("{Section Number}")) myMsg = myMsg.Replace("{Section Number}", MyItemInfo.ActiveSection.DisplayNumber); - + //jcb code + if(myMsg.Contains("%-8s")) + myMsg = myMsg.Replace("%-8s",MyItemInfo.MyProcedure.DisplayNumber.PadRight(8)); + //end jb code // center the message. float wtpm = (float)docstyle.Layout.PageWidth - (float)docstyle.Layout.LeftMargin; float centerpos = XOffsetBox + (float)docstyle.Layout.LeftMargin + (wtpm - (myMsg.Length * MyItemInfo.FormatStepData.Font.CharsToTwips)) / 2; + centerpos = Math.Max(centerpos, XOffsetBox + (float)docstyle.Layout.LeftMargin); MyPageHelper.BottomMessage = new vlnText(cb, this, myMsg, myMsg, centerpos, msg_yLocation, docstyle.End.Font); + MyPageHelper.MyGaps.Add(new Gap(msg_yLocation, msg_yLocation - MyPageHelper.BottomMessage.Height)); } } if (yLocalypagestart != yPageStart) DebugText.WriteLine("ToPdf-yPagestartDiff:{0},{1},{2},{3}", MyPageHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, MyItemInfo.ItemID, yLocalypagestart, yPageStart); @@ -1081,15 +1090,35 @@ namespace Volian.Print.Library } // if this is the High Level RNO step (MyTopRNO) and we are numbering the RNO, adjust the xoffset to start the tab // at the x location rather than starting the text at the x location: - if (!itemInfo.IsSection && itemInfo.FormatStepData.NumberHighLevel && itemInfo.IsRNOPart && itemInfo.ItemID == MyTopRNO.MyItemInfo.ItemID) + AdjustWidth(itemInfo, maxRNO, formatInfo, mytab); + bool adjustAgain = true; + if (!itemInfo.IsSection && itemInfo.FormatStepData.NumberHighLevel && itemInfo.IsRNOPart && (MyTopRNO == null || itemInfo.ItemID == MyTopRNO.MyItemInfo.ItemID)) { // adjust the x-offset of the RNO to include the tab. + if (itemInfo.ActiveFormat.MyStepSectionLayoutData.RNOWidthSameAsHighParent)// && !itemInfo.MyParent.IsHigh) + { + vlnParagraph hls = GetHighLevelParagraph(); + float RnoOffset1 = ToInt(formatInfo.MyStepSectionLayoutData.ColRTable, maxRNO); + float offset = hls.Width + RnoOffset1 + hls.XOffset; + vlnTab tb = hls.PartsLeft[0] as vlnTab; + //offset += tb.Width; + if (MyTopRNO == null) + Width -= (float)itemInfo.ActiveFormat.MyStepSectionLayoutData.SingleColumnRNOIndent; + offset -= Width; + float inc = offset - XOffset; + if(mytab != null) + mytab.XOffset += inc;// +(itemInfo.MyParent.IsHigh ? 6.8f : 0); + XOffset += inc; + adjustAgain = false; + } + else + { mytab.XOffset += mytab.Width; XOffset = mytab.XOffset + mytab.Width; } - AdjustWidth(itemInfo, maxRNO, formatInfo, mytab); + } + if(adjustAgain) AdjustXOffsetForTab(itemInfo, maxRNO, formatInfo, mytab, xMetaAdj); - if (itemInfo.MyHeader != null && itemInfo.MyHeader.Text != null && !doSectTab) yoff += SetHeader(this, cb, itemInfo, formatInfo); float yoffLeft = yoff; @@ -1105,7 +1134,7 @@ namespace Volian.Print.Library if (itemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format) yoffLeft = Math.Max(yoffLeft, ChildrenLeft.Add(cb, itemInfo.Notes, xoff + 6 + (float)(itemInfo.ActiveFormat.MyStepSectionLayoutData.WidT), yoff, yoff, rnoLevel, maxRNO, formatInfo)); else - yoff = ChildrenAbove.Add(cb, itemInfo.Notes, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo); + yoff = ChildrenAbove.Add(cb, itemInfo.Notes, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo); } // if this is a hls with a box, adjust the starting y location for the hls. this is done here @@ -1331,8 +1360,6 @@ namespace Volian.Print.Library if (co != null) { float xloc_co = (float)itemInfo.MyDocStyle.Layout.LeftMargin; - if (formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.XLocation != null) - xloc_co += (float)formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.XLocation; // if the format has 'SkipSpaces', look at the tab, and back up the macros to the number of // spaces in the tab. if (formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.SkipSpaces) @@ -1342,6 +1369,16 @@ namespace Volian.Print.Library else xloc_co = XOffset; //there's no tab - put checkoff at step's xoff. Macro should back up from step's x. } + else + { + if (formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.XLocation != null) + xloc_co += (float)formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.XLocation; + if (formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.RelXLocation != null) + { + float relX = (float)formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.RelXLocation; + xloc_co = XOffset + (relX > 0 ? Width : 0) + relX; + } + } PartsRight.Add(new vlnMacro(xloc_co, yForCheckoff, co.Macro)); } float yOffRight = yoff; @@ -2048,7 +2085,7 @@ namespace Volian.Print.Library iilvl = iilvl.MyParent; } level = level <= 2 ? 1 : level - 1; - if (level == 1) + if (level==1) XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (level * (float)formatInfo.PlantFormat.FormatData.SectData.SectionHeader.Pos); else { @@ -2067,11 +2104,11 @@ namespace Volian.Print.Library { float x = 0; float xoff = 0; - if ((colOvrd ?? 0) != 0) + if ((colOvrd??0)!=0) x = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)colOvrd; else x = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS; - + xoff = x - XOffset; // ColSByLevel will specify the column in which the High Level Step starts with // respect to the overall level calculation based on sections & meta-sections. @@ -2083,7 +2120,7 @@ namespace Volian.Print.Library float colsbylevel = (float)formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[indxLevel % formatInfo.PlantFormat.FormatData.SectData.MetaSectionList.Count].ColSByLevel; float seclvlindent = colsbylevel - (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS; float adjCols = (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS + seclvlindent; - float xtabcol = adjCols - ((myTab == null || myTab.Text == null) ? 0 : (myTab.Text.Length * 7.2f)); + float xtabcol = adjCols - ((myTab==null||myTab.Text==null)?0:(myTab.Text.Length * 7.2f)); if (indxLevel > 1 && myTab != null) myTab.XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + xtabcol; else if (myTab != null) myTab.XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + colsbylevel; if (myTab != null) @@ -2157,7 +2194,7 @@ namespace Volian.Print.Library } // if the step is within the rno and we're numbering the high level rno, we've got to account for the // indenting (increased x offset) for the top level rno's tab, if there is no top level rno: - if (itemInfo.FormatStepData.NumberHighLevel && (itemInfo.MyHLS.RNOs == null || itemInfo.MyHLS.RNOs.Count <= 0)) + if (itemInfo.FormatStepData.NumberHighLevel && (itemInfo.MyHLS.RNOs == null || itemInfo.MyHLS.RNOs.Count<=0)) { // add in the size that an RNO off HLS would take. XOffset += tabWidth; @@ -2174,7 +2211,7 @@ namespace Volian.Print.Library // the tab. The offset of text needs to be adjusted by the 'leftjustify' format variable // if it existed for this level. myTab.XOffset += tabWidth; - if (tableftadj != 0 && myTab.Width < tableftadj) + if (tableftadj != 0 && myTab.Width