Improved accounting for bottom continue messages for pagination

Bottom Message (below text) fix and pagination improvements
Include RNO separator in ‘BottomContent’ calculation
Reset ‘BottomContent’ for each page & added ruler for bottom of page
This commit is contained in:
2015-06-02 15:09:57 +00:00
parent 65bfcdb9b8
commit 06ba7bf825
4 changed files with 105 additions and 19 deletions

View File

@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
//using System.Drawing;
using System.Text.RegularExpressions;
using System.IO;
using iTextSharp.text.pdf;
@@ -935,6 +935,7 @@ namespace Volian.Print.Library
// }
// MyPageHelper.BottomContent = yLocation - Height;
//if (MyItemInfo.InList(39048)) Console.WriteLine("Here");
MyPageHelper.BottomContent = yLocation - (Height * MyPageHelper.YMultiplier);
retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, DebugInfo + string.Format(",YLines = {0}", YSize / SixLinesPerInch), yBottomMargin);
ProfileTimer.Pop(profileDepth);
//}
@@ -1361,7 +1362,7 @@ namespace Volian.Print.Library
//`88b ooo d8( 888 o. )88b 888 .o 888
// `Y8bood8P' `Y888""8o 8""888P' `Y8bod8P' o888o
case 1: // Break on High Level Step
OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
YTopMost=OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
docstyle = MyItemInfo.MyDocStyle;
if (MyPageHelper.NotesToFootNotes != null && MyPageHelper.NotesToFootNotes.Count > 0) MyPageHelper.NotesToFootNotesYoffset = CalculateYLocation(yLocation, yTopMargin);
bool doSectionContinue = !MyItemInfo.IsSection && ((docstyle.StructureStyle.Style & E_DocStructStyle.BottomSectionContinue) == E_DocStructStyle.BottomSectionContinue);
@@ -1410,8 +1411,8 @@ namespace Volian.Print.Library
}
yPageStart = yTopMargin + YTopMost;
DoCheckOffHeader(cb, MyItemInfo, yLocation, yTopMargin, yPageStart);
if (doSectionContinue ) DoTopContinueMsg(cb, ref yPageStart, yTopMargin, docstyle , null);
// KBR for WCNTRN work: SectionTopMessage(cb, yTopMargin, yLocation);
if (doSectionContinue) DoTopContinueMsg(cb, ref yPageStart, yTopMargin, docstyle , null);
// If "ContinueSectionHeader" (format flag) is true then print the section title with "(Continued)" appended to it
if (!MyItemInfo.IsSection && MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ContinueSectionHeader && (!MyItemInfo.IsSection || MyItemInfo.IsSeparateSubsection))
{
@@ -1432,7 +1433,7 @@ namespace Volian.Print.Library
// `88b ooo d8( 888 o. )88b 888 .o .oP .o
// `Y8bood8P' `Y888""8o 8""888P' `Y8bod8P' 8888888888
case 2: // Break within a Step
OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
YTopMost=OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
docstyle = MyItemInfo.MyDocStyle;
bool doAlarmBox = false;
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm)
@@ -1549,6 +1550,7 @@ namespace Volian.Print.Library
doSectionTitleContinued = (sch == null || sch.Section_PrintHdr == "Y") && !MyItemInfo.MyDocStyle.CancelSectTitle;
}
}
// KBR for WCNTRN work:SectionTopMessage(cb, yTopMargin, yLocation);
if (!doSectionTitleContinued || !SectionShowTitles)
addExtraLines = DoTopContinueMsg(cb, ref yPageStart, yTopMargin, docstyle, doThreeContinues && MyItemInfo.MyParent != null && MyItemInfo.MyParent.MyTab != null ? MyItemInfo.MyParent.MyTab.CleanText : null);
@@ -1604,7 +1606,7 @@ namespace Volian.Print.Library
case 3: // Break on High Level Step (SevenLinesPerInch)
if (!firstHighLevelStep)
{
OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
YTopMost=OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
if (MyPageHelper.NotesToFootNotes != null && MyPageHelper.NotesToFootNotes.Count > 0) MyPageHelper.NotesToFootNotesYoffset = CalculateYLocation(yLocation, yTopMargin);
MyPromsPrinter.NewPage(); // HLS (7 lpi) breakif (MyItemInfo.IsSection)
//_MyLog.InfoFormat("NewPage 12 {0}", cb.PdfWriter.CurrentPageNumber);
@@ -1731,7 +1733,7 @@ namespace Volian.Print.Library
MyPageHelper.ParaBreaks[0] == this)
{
ShowPageBreak(1, CheckForCompression("PageBreakOnStep/Caution/Note HLS"), "Yes", YTop - YBottomMost, yTopMargin - yBottomMargin, yTopMargin - yBottomMargin, false);
OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
YTopMost=OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
MyPageHelper.BottomMessage = null;
MyPageHelper.TopMessage = null;
MyPromsPrinter.NewPage();
@@ -1846,6 +1848,29 @@ namespace Volian.Print.Library
ProfileTimer.Pop(profileDepth);
return yPageStart;
}
// KBR: WCNTRN work
//private void SectionTopMessage(PdfContentByte cb, float yTopMargin, float yLocation)
//{
// if (MyItemInfo.MyDocStyle.SectTop != null && MyItemInfo.MyDocStyle.SectTop.Message != null)
// {
// float sectMsgY = CalculateYLocation(YTop, yTopMargin);
// if (MyPageHelper.YMultiplier != 1)
// {
// sectMsgY = -1 + yTopMargin - (yTopMargin - yLocation) * MyPageHelper.YMultiplier;
// }
// VE_Font sctMsgFont = MyItemInfo.MyDocStyle.SectTop.Font;
// string scttop = null;
// if (!MyItemInfo.IsStepSection && MyItemInfo.MyDocStyle.SectTop.Message != null)
// scttop = MyItemInfo.MyDocStyle.SectTop.Message.Replace("%s", (MyItemInfo.ActiveSection as SectionInfo).DisplayNumber);
// else
// scttop = (MyItemInfo as SectionInfo).DisplayNumber;
// float scttopWidth = scttop.Length * 6;
// float ctr = (float)MyItemInfo.MyDocStyle.SectTop.Margin;
// float sctcntrX = (float)MyItemInfo.MyDocStyle.Layout.LeftMargin + ctr - (scttopWidth / 2);
// vlnText mySectMsg = new vlnText(cb, this, scttop, scttop, sctcntrX, sectMsgY, sctMsgFont);
// PartsLeft.Add(mySectMsg);
// }
//}
// Added to try to resolve a problem when printing FNP-1-FRP-I.3 Attachment 3 Table 1.
// May be needed to evaluate this problem in the future.
//private void CompareSectionInfo(SectionInfo si, SectionInfo si1)
@@ -2128,7 +2153,9 @@ namespace Volian.Print.Library
switch (docstyle.Continue.Bottom.Location)
{
case E_ContBottomLoc.EndOfText: // place continue string at end of text
msg_yLocation = msg_yLocation + yLocation - SixLinesPerInch;
// msg_yLocation accounts for extra lines in message from docstyle; and BottomContent is the actual
// location of the last line of text on page.
msg_yLocation = msg_yLocation + ((float)MyPageHelper.BottomContent - (SixLinesPerInch * MyPageHelper.YMultiplier));
float tableSpaceAvailable = TableSpaceAvailable;// RHM20150525 - Table Scrunch
if (yBottomMargin + (docstyle.Layout.FooterLength ?? 0) > msg_yLocation)
{ // Adjusted Continue Message Y Offset
@@ -2168,7 +2195,6 @@ namespace Volian.Print.Library
_MyLog.WarnFormat("**** BOTTOM CONTINUE MESSAGE NOT CODED FOR LOCATION {0}*****", docstyle.Continue.Bottom.Location);
break;
}
MyPageHelper.BottomContent = null;// RHM20150525 - Table Scrunch
if (!PageBreakOnStep)
{
float xoffB = 0;
@@ -2271,23 +2297,28 @@ namespace Volian.Print.Library
return true;
}
}
private void OutputOtherPageSteps(PdfContentByte cb, float YTopMost, float yPageStart, float yTopMargin, float yBottomMargin)
private float OutputOtherPageSteps(PdfContentByte cb, float YTopMost, float yPageStart, float yTopMargin, float yBottomMargin)
{
float retval = YTopMost;
// Find any items remaining in MyPageHelper.MyParagraphs that should be printed on this page.
vlnParagraphs process = new vlnParagraphs(null);
foreach (vlnParagraph vPara in MyPageHelper.MyParagraphs.Values)
{
if (vPara.MyItemInfo.InList(3351)) Console.WriteLine("here");
//if (!vPara.Processed && ((vPara.YOffset + vPara.Height) < YTopMost))
if (!vPara.Processed && ((vPara.YOffset) < YTopMost))
if (!vPara.Processed && ((vPara.YOffset + vPara.Height) < YTopMost))
if (this.MyItemInfo.ItemID != vPara.MyItemInfo.ItemID) // RHM20150507 Table Scrunch
process.Add(vPara);
else // RHM20150507 Table Scrunch
_MyLog.WarnFormat("Step Could Have Fit {0}, {1}",MyItemInfo.ItemID,MyItemInfo.ShortPath);
_MyLog.WarnFormat("Step Could Have Fit {0}, {1}", MyItemInfo.ItemID, MyItemInfo.ShortPath);
else if (!vPara.Processed && ((vPara.YOffset) < YTopMost))
retval = Math.Min(retval, vPara.YOffset);
}
foreach (vlnParagraph vPara in process)
{
vPara.ParagraphToPdf(cb, yPageStart, yTopMargin, yBottomMargin);
}
return retval;
}
private float _YVeryTop = -1;
public float YVeryTop
@@ -4060,20 +4091,20 @@ namespace Volian.Print.Library
{
stText = " ";
// turn underline off
myFont = new System.Drawing.Font(myFont.FontFamily, myFont.Size, FontStyle.Regular); //myFont.Style. | FontStyle.Underline);
myFont = new System.Drawing.Font(myFont.FontFamily, myFont.Size, System.Drawing.FontStyle.Regular); //myFont.Style. | FontStyle.Underline);
}
else
stText = vlntxt.StartText;
if (itemInfo.IsHigh && itemInfo.MyDocStyle.UndSpecialStepsFoldout)
{
myFont = new System.Drawing.Font(myFont.FontFamily, myFont.Size, myFont.Style | FontStyle.Underline);
myFont = new System.Drawing.Font(myFont.FontFamily, myFont.Size, myFont.Style | System.Drawing.FontStyle.Underline);
stText = stText.Replace(@"\ulnone ", "");
stText = stText.Replace(@"\ulnone", "");
}
if (stText.Contains("{IND}")) stText = stText.Replace("{IND}", "\x5");
if (itemInfo.IsSection && itemInfo.ActiveFormat.PlantFormat.FormatData.SectData.SectionNumber.Level0Big && itemInfo.MyParent.IsProcedure)
myFont = new System.Drawing.Font(myFont.FontFamily, 14, myFont.Style | FontStyle.Bold);
myFont = new System.Drawing.Font(myFont.FontFamily, 14, myFont.Style | System.Drawing.FontStyle.Bold);
_RtfSB.Append(AddFontTable(myFont));
_RtfSB.Append(stText);
if (_MyItemInfo.IsStep && !itemInfo.FormatStepData.UseSmartTemplate && _MyItemInfo.FormatStepData.Suffix != null && _MyItemInfo.FormatStepData.Suffix != "")