From 30c1bcbdfbcaaf6f00f586b7178bdc6750e11320 Mon Sep 17 00:00:00 2001 From: Kathy Date: Thu, 14 Jul 2011 16:14:41 +0000 Subject: [PATCH] --- PROMS/Volian.Print.Library/vlnParagraph.cs | 86 ++++++++++++++++++---- 1 file changed, 71 insertions(+), 15 deletions(-) diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index 97d4700d..14ee0b4d 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -145,7 +145,7 @@ namespace Volian.Print.Library retval = DrawText(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation); if (MyItemInfo.IsHigh) { - MyPageHelper.VlnDestinations.Add(MyItemInfo.MyTab.CleanText + " " + MyItemInfo.DisplayText, + MyPageHelper.PageBookmarks.Add(MyItemInfo, MyItemInfo.MyTab.CleanText + " " + MyItemInfo.DisplayText, new PdfDestination(PdfDestination.FITBH, yLocation + YVeryTop - YTopMost + SixLinesPerInch)); } } @@ -287,9 +287,22 @@ namespace Volian.Print.Library bool firstHighLevelStep = MyItemInfo.IsHigh && (MyItemInfo.MyPrevious == null); switch (paginate) { + case 0: + if (MyItemInfo.IsSection) + { + SectionInfo si = MyItemInfo as SectionInfo; + MyPageHelper.PageBookmarks.Add(MyItemInfo, ((si.DisplayNumber ?? "") == "" ? "" : si.DisplayNumber + " - ") + si.DisplayText, null); + } + break; case 1: // Break on High Level Step OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin); cb.PdfDocument.NewPage(); + if (MyItemInfo.IsSection) + { + SectionInfo si = MyItemInfo as SectionInfo; + MyPageHelper.PageBookmarks.Add(MyItemInfo, ((si.DisplayNumber ?? "") == "" ? "" : si.DisplayNumber + " - ") + si.DisplayText, null); + } + if ((MyItemInfo.ActiveSection.MyDocStyle.StructureStyle.Style ?? 0 & E_DocStructStyle.UseSectionFoldout) != 0) PromsPrinter.DoFoldoutPage(cb, "HLS", MyPageHelper.TextLayer, MyPageHelper); yPageStart = yTopMargin + YTopMost; @@ -313,7 +326,10 @@ namespace Volian.Print.Library Console.WriteLine("Not done yet"); break; case E_ContBottomLoc.BottomOfPage: // place continue message at bottom of page - msg_yLocation = yBottomMargin + 2 * SixLinesPerInch; // 2 lines above bottom margin + msg_yLocation = yBottomMargin + 2 * SixLinesPerInch + (float)docstyle.Layout.FooterLength; // 2 lines above bottom margin + break; + default: + Console.WriteLine("**** BOTTOM CONTINUE MESSAGE NOT CODED*****"); break; } MyPageHelper.BottomMessage = new vlnText(cb, this, myMsg, myMsg, docstyle.Layout.LeftMargin + XOffsetBox + docstyle.Continue.Bottom.Margin ?? 0, msg_yLocation, MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font); @@ -341,7 +357,12 @@ namespace Volian.Print.Library if (!firstHighLevelStep) { OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin); - cb.PdfDocument.NewPage(); // HLS (7 lpi) break + cb.PdfDocument.NewPage(); // HLS (7 lpi) breakif (MyItemInfo.IsSection) + if (MyItemInfo.IsSection) + { + SectionInfo si = MyItemInfo as SectionInfo; + MyPageHelper.PageBookmarks.Add(MyItemInfo, ((si.DisplayNumber ?? "") == "" ? "" : si.DisplayNumber + " - ") + si.DisplayText, null); + } if ((MyItemInfo.ActiveSection.MyDocStyle.StructureStyle.Style ?? 0 & E_DocStructStyle.UseSectionFoldout) != 0) PromsPrinter.DoFoldoutPage(cb, "HLS (7 lpi) break", MyPageHelper.TextLayer, MyPageHelper); } @@ -486,13 +507,26 @@ namespace Volian.Print.Library return 0; // this is not an item with a break } float mySize = YSize * MyPageHelper.YMultiplier; + bool ManualPageBreak = false; if (MyItemInfo.IsStepSection) { if (yLocation < yTopMargin) // continuous section { if (ChildrenBelow == null) return 0; - // can the title and the first step fit vlnParagraph firstChild = ChildrenBelow[0]; + + // This is a continuous section. There may be cases where the user put a manual page + // break on the first step (child) in the section. if so, break on the section. The + // flag SectionPageBreak is set to true to flag that a pagebreak should not be done + // on that first step. + ManualPageBreak = (firstChild.MyItemInfo.MyConfig as StepConfig).Step_ManualPagebreak; + if (ManualPageBreak) + { + SectionPageBreak = true; + return 1; + } + + // can the title and the first step fit? // 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; @@ -500,7 +534,16 @@ namespace Volian.Print.Library return 0; // Don't Paginate (page break) on a Step Section if it's first thing on page } if (!MyItemInfo.IsHigh) return 0; // Don't Paginate on a Substep level - bool ManualPageBreak = (MyItemInfo.MyConfig as StepConfig).Step_ManualPagebreak; + ManualPageBreak = (MyItemInfo.MyConfig as StepConfig).Step_ManualPagebreak; + if (MyItemInfo.FirstSibling == MyItemInfo && ManualPageBreak) + { + // if parent/section used this pagebreak, skip it. + if (MyParent.SectionPageBreak) + { + ManualPageBreak = false; + MyParent.SectionPageBreak = false; + } + } if (_Match16BitPagination) mySize = YSize; float ySize7LPI = YSize + SixLinesPerInch; if (_Match16BitPagination) ySize7LPI += SixLinesPerInch; @@ -684,7 +727,6 @@ namespace Volian.Print.Library else AdjustYLocation.Add(-yLocation, yLocation); // order in ascending order } - //if (stepLevel == 3) Console.WriteLine("here"); foreach (float yLocation in CleanupListYLocation) myList[stepLevel].Remove(yLocation); foreach (float yLocation in AdjustYLocation.Keys) @@ -950,25 +992,33 @@ namespace Volian.Print.Library bool aerTableOrFigure = itemInfo.FormatStepData.Type.Contains("AER"); vlnParagraph hls1 = MyParent; while (hls1.MyParent != null && !hls1.MyItemInfo.IsHigh) hls1 = hls1.MyParent; - XOffset = hls1.XOffset + hls1.Width / 2 - Width / 2; // xoffset if AER column + // Determine center of hls + XOffset = hls1.XOffset + hls1.Width / 2; + // Determine left edge of the table by subtracting 1/2 of its width. + XOffset -= Width / 2; float colR = float.Parse(formatInfo.MyStepSectionLayoutData.ColRTable.Split(",".ToCharArray())[itemInfo.ColumnMode]); - float xLowerLimit = 6; // Adjusted for HLP VE-PROMS + float xLowerLimit = hls1.XOffset; // 6; // Adjusted for HLP VE-PROMS float xUpperLimit = hls1.XOffset + hls1.Width + colR * itemInfo.ColumnMode; // 20110429 RHM Adjusted for RNO Tables Removed +18; // Adjusted for HLP VE-PROMS - if (!aerTableOrFigure && itemInfo.RNOLevel == 0) // Centered Table of Figure + if (!aerTableOrFigure && itemInfo.RNOLevel == 0) // Centered Table or Figure { - // adjust for RNO + // Add in 1/2 of the width of all RNO columns XOffset += (colR * itemInfo.ColumnMode) / 2; - XOffset -= (hls1.XOffset - (float)itemInfo.MyDocStyle.Layout.LeftMargin) / 2; + XOffset -= 12; } else // AER or RNO XOffset = MyParent.XOffset + MyParent.Width / 2 - Width / 2; - //XOffset += colR * itemInfo.RNOLevel; + + // if the XOffset < High Level Step Text's XOffset, then align with the High Level Step Text if (XOffset < xLowerLimit) XOffset = xLowerLimit; + + // if the right margin exceeds the right edge of the rightmost RNO, then adjust right edge to match. if (XOffset + Width > xUpperLimit) XOffset = xUpperLimit - Width; + + // because of the above, if it pushes beyond the left margin, use the left margin. if (XOffset < (float)itemInfo.MyDocStyle.Layout.LeftMargin) - XOffsetBox = (float)itemInfo.MyDocStyle.Layout.LeftMargin; + XOffset = XOffsetBox = (float)itemInfo.MyDocStyle.Layout.LeftMargin; } private float AdjustForBlankLines() { @@ -1116,6 +1166,7 @@ namespace Volian.Print.Library float hdrWidth = (itemInfo.MyHeader.CleanText == null) ? 0 : itemInfo.MyHeader.CleanText.Length * 6; int typ = ((int)itemInfo.MyContent.Type) % 10000; int? bxIndx = formatInfo.PlantFormat.FormatData.StepDataList[typ].StepLayoutData.STBoxindex; + if (itemInfo.MyHeader.Justify == System.Drawing.ContentAlignment.MiddleCenter) { if (bxIndx != null) @@ -1142,8 +1193,15 @@ namespace Volian.Print.Library int iPosition = (int)position; int charsToTwips = (int)(72 / (CPI ?? 12)); iPosition = (iPosition / charsToTwips) * charsToTwips; + position = (position / 7.2F) * 7.2F; return (float)iPosition; } + private bool _SectionPageBreak = false; + public bool SectionPageBreak + { + get { return _SectionPageBreak; } + set { _SectionPageBreak = value; } + } private bool _Processed = false; public bool Processed { @@ -1187,8 +1245,6 @@ namespace Volian.Print.Library set { vlnParagraph vp = this as vlnParagraph; - //if (vp != null && vp.MyItemInfo != null && vp.MyItemInfo.ItemID == 55) - // Console.WriteLine("here"); _YTop = value; }