From 22ceb383259544b37988692e0c19f9a77972b094 Mon Sep 17 00:00:00 2001 From: Kathy Date: Thu, 22 Sep 2011 11:55:44 +0000 Subject: [PATCH] --- PROMS/Volian.Print.Library/vlnParagraph.cs | 39 ++++++++++++++++++---- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index 72d8cc5d..15e4c959 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -35,8 +35,8 @@ namespace Volian.Print.Library float yTop = yoff; foreach (ItemInfo childItemInfo in itemInfoList) { - int? bxIndx = childItemInfo.FormatStepData.StepLayoutData.STBoxindex; - if (bxIndex != bxIndx || childItemInfo.FormatStepData.BoxIt) + int? bxIndx = childItemInfo.FormatStepData==null?-1:childItemInfo.FormatStepData.StepLayoutData.STBoxindex; + if (bxIndx != -1 && (bxIndex != bxIndx || childItemInfo.FormatStepData.BoxIt)) { if (childItemInfo.FormatStepData.BoxIt) // this is a boxed HLS { @@ -81,7 +81,7 @@ namespace Volian.Print.Library Add(para); // para.YBottomMost will have y for bottom of any substeps that are also enclosed in the box. yoff = para.YBottomMost; - if (childItemInfo.FormatStepData.BoxIt) + if (childItemInfo.FormatStepData != null && childItemInfo.FormatStepData.BoxIt) { box.Height = yoff - box.YOffset - (1.1F * vlnPrintObject.SixLinesPerInch); box = null; // if doing boxed steps, only do single sibling at a time. @@ -111,7 +111,7 @@ namespace Volian.Print.Library get { return _MyGrid; } set { _MyGrid = value; } } - + public float SectYPageStart = 0; /// /// This variable is used to match 16 bit pagination /// @@ -119,11 +119,12 @@ namespace Volian.Print.Library public float ParagraphToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin) { if (Processed) return yPageStart; - + Processed = true; if (_PartsAbove != null && _PartsAbove.Count > 0) yPageStart = PartsAbove.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin); if (MyItemInfo.IsHigh && MyItemInfo.MyDocStyle.SpecialStepsFoldout) yPageStart -= SixLinesPerInch; float yLocation = CalculateYOffset(yPageStart, yTopMargin); + if (MyItemInfo.HasChangeBar && MyPageHelper.ChangeBarDefinition.MyChangeBarType != PrintChangeBar.Without) MyPageHelper.AddChangeBar(DoChangeBar(cb, MyItemInfo, MyPageHelper, XOffset, yLocation, MyPageHelper.MaxRNO, MyItemInfo.ActiveFormat), cbMess); float retval = yLocation; @@ -157,7 +158,6 @@ namespace Volian.Print.Library if (_PartsBelow != null && _PartsBelow.Count > 0) yPageStart = PartsBelow.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin); if (_PartsContainer != null && _PartsContainer.Count > 0) yPageStart = PartsContainer.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin); - return yPageStart; } @@ -182,6 +182,7 @@ namespace Volian.Print.Library if (retval == 0) // problem occurred - paragraph was not able to be printed on page { // pagination logic needs to be fixed. cb.PdfDocument.NewPage(); // pagination issue + DebugText.WriteLine("*****PaginateError"); yPageStart = yTopMargin + YVeryTop; yLocation = yPageStart - YOffset; //MyItemInfo.ItemID, YSize, yPageSize, yLocation @@ -283,7 +284,10 @@ namespace Volian.Print.Library } public override float ToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin) { + float yLocalypagestart = yPageStart; + // yPageStart is offset into roll; YTopMost is offset of topmost of this paragraph. float yLocation = yPageStart - YTopMost; + DebugText.WriteLine("ToPdf1:{0},'{1}',{2},{3},{4}", MyItemInfo.ItemID, MyItemInfo.ShortSearchPath, yLocation, yPageStart, YTopMost); int paginate = Paginate(yLocation, yTopMargin, yBottomMargin); bool firstHighLevelStep = MyItemInfo.IsHigh && (MyItemInfo.MyPrevious == null); switch (paginate) @@ -298,6 +302,7 @@ namespace Volian.Print.Library case 1: // Break on High Level Step OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin); cb.PdfDocument.NewPage(); + DebugText.WriteLine("Paginate1"); if (MyItemInfo.IsSection) { SectionInfo si = MyItemInfo as SectionInfo; @@ -337,6 +342,7 @@ namespace Volian.Print.Library MyPageHelper.BottomMessage = new vlnText(cb, this, myMsg, myMsg, docstyle.Layout.LeftMargin + XOffsetBox + docstyle.Continue.Bottom.Margin ?? 0, msg_yLocation, MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font); } cb.PdfDocument.NewPage(); + DebugText.WriteLine("Paginate2"); if ((MyItemInfo.ActiveSection.MyDocStyle.StructureStyle.Style ?? 0 & E_DocStructStyle.UseSectionFoldout) != 0) PromsPrinter.DoFoldoutPage(cb, "Break within Step", MyPageHelper.TextLayer, MyPageHelper); // temporary foldout @@ -360,6 +366,7 @@ namespace Volian.Print.Library { OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin); cb.PdfDocument.NewPage(); // HLS (7 lpi) breakif (MyItemInfo.IsSection) + DebugText.WriteLine("Paginate3"); if (MyItemInfo.IsSection) { SectionInfo si = MyItemInfo as SectionInfo; @@ -380,9 +387,16 @@ namespace Volian.Print.Library } yPageStart = ChildrenAbove.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin); yPageStart = ChildrenLeft.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin); + DebugText.WriteLine("Left:{0},{1},{2},{3},{4}", MyItemInfo.ItemID, yLocalypagestart, yPageStart, yTopMargin, yBottomMargin); yPageStart = ParagraphToPdf(cb, yPageStart, yTopMargin, yBottomMargin); + DebugText.WriteLine("Self:{0},{1},{2},{3},{4}", MyItemInfo.ItemID, yLocalypagestart, yPageStart, yTopMargin, yBottomMargin); + yPageStart = ChildrenRight.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin); + DebugText.WriteLine("Right:{0},{1},{2},{3},{4}", MyItemInfo.ItemID, yLocalypagestart, yPageStart, yTopMargin, yBottomMargin); + yPageStart = ChildrenBelow.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin); + DebugText.WriteLine("Below:{0},{1},{2},{3},{4}", MyItemInfo.ItemID, yLocalypagestart, yPageStart, yTopMargin, yBottomMargin); + if (MyItemInfo.IsHigh && MyItemInfo.NextItem == null) // last hls, add the 'end' message, if there is one { DocStyle docstyle = MyItemInfo.MyDocStyle; @@ -403,6 +417,7 @@ namespace Volian.Print.Library MyPageHelper.BottomMessage = new vlnText(cb, this, myMsg, myMsg, centerpos, msg_yLocation, docstyle.End.Font); } } + if (yLocalypagestart != yPageStart) DebugText.WriteLine("ToPdf-yPagestartDiff:{0},{1},{2}", MyItemInfo.ItemID, yLocalypagestart, yPageStart); return yPageStart; } private vlnParagraph TopMostChild @@ -539,7 +554,11 @@ namespace Volian.Print.Library // add the first child's size + (the section title's size) float ySizeIncludingFirst = firstChild.YSize + (firstChild.YTop - YTop); //if (ySizeIncludingFirst > (yLocation - yBottomMargin - SixLinesPerInch)) return 1; - if (ySizeIncludingFirst > (yLocation - yBottomMargin)) return 1; + if (ySizeIncludingFirst > (yLocation - yBottomMargin)) + { + ShowPageBreak(100, "Page Break Before Step Section", "Yes", YSize, yPageSize, yWithinMargins); + return 1; + } } return 0; // Don't Paginate (page break) on a Step Section if it's first thing on page } @@ -873,6 +892,12 @@ namespace Volian.Print.Library if (itemInfo.MyHeader != null && itemInfo.MyHeader.Text != null && !doSectTab) yoff += SetHeader(this, cb, itemInfo, formatInfo); YOffset = yoff; + + if (itemInfo.IsRNOPart) + { + // there may be other places that double space, but this supports it for RNOs (the DoubleRNOspace flag) + if (rnoLevel > maxRNO && itemInfo.FormatStepData.DoubleSpace) yoff = YOffset = yoff + SixLinesPerInch; + } AddMacros(itemInfo, mytab); if (mytab != null) {