Add text to checkbox for blank page printing

Improve pagination for SAMG facing page print
This commit is contained in:
2017-05-12 13:50:02 +00:00
parent d8f00ec197
commit bbbcdf946a
7 changed files with 166 additions and 43 deletions

View File

@@ -1532,6 +1532,15 @@ namespace Volian.Print.Library
bool firstHighLevelStep = MyItemInfo.IsHigh && (MyItemInfo.MyPrevious == null);
bool doSectionTitleContinued = false; // will add " Continued" to the section title if format flag is set
DocStyle docstyle = null;
// If SAMG facing page print & doing first pass to generate page break list of supplemental info and
// there was a page break in the step section, but not an associated supinfo item, do the page break when the
// next supinfo item is found:
SectionInfo supInfoSect = MyItemInfo.MyActiveSection as SectionInfo;
if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.DoPageBreaks && MyPromsPrinter.NeedSupInfoBreak && MyItemInfo.SupInfos != null && MyItemInfo.SupInfos.Count > 0)
{
supInfoSect.StepSectPageBreaksForSupInfo.Add(MyItemInfo.SupInfos[0].ItemID);
MyPromsPrinter.NeedSupInfoBreak = false;
}
switch (paginate)
{
// .oooooo. .oooo.
@@ -1555,6 +1564,21 @@ namespace Volian.Print.Library
yPageStart = _yPageStartForSupInfo - SixLinesPerInch;
yLocation = yPageStart - YTopMost;
}
// printing a procedure with section(s) that have supplemental information - determine facing page needed to be merged in:
if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge && !MyItemInfo.IsSection && MyItemInfo.IsHigh && MyItemInfo.MyPrevious == null && !MyItemInfo.IsInSupInfo && (MyItemInfo.MyActiveSection as SectionInfo).HasSupInfoSteps)
{
int sid = GetIdThatHasSupInfoItems(MyItemInfo, MyItemInfo.ItemID);
if (sid != -1)
{
MyPromsPrinter.DoSupInfoPage(cb, "TEMP", MyPageHelper.TextLayer, MyPageHelper, sid, true);
}
else
{
MyPageHelper.OnBlankPage = true;
cb.PdfDocument.Add(new iTextSharp.text.Table(1));
MyPromsPrinter.NewPage();
}
}
if (MyItemInfo.IsHigh && MyItemInfo.MyPrevious != null && ((MyItemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DoubleBoxHLS) == E_DocStructStyle.DoubleBoxHLS))
yPageStart -= SixLinesPerInch;
if (MyPageHelper.ParaBreaks.Count > 0 && MyPageHelper.ParaBreaks[0].CompressFirstPartOfStep)
@@ -1573,6 +1597,14 @@ 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
if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.DoPageBreaks)
{
// page break here, determine if there is caution/note above where the page break actually needs to go:
int aboveSupinfoId = ChildrenAboveHaveSupInfo();
if (MyItemInfo.SupInfos != null && MyItemInfo.SupInfos.Count > 0 && aboveSupinfoId > 0) supInfoSect.StepSectPageBreaksForSupInfo.Add(aboveSupinfoId);
else if (MyItemInfo.SupInfos != null && MyItemInfo.SupInfos.Count > 0) supInfoSect.StepSectPageBreaksForSupInfo.Add(MyItemInfo.SupInfos[0].ItemID);
else MyPromsPrinter.NeedSupInfoBreak = true;
}
YTopMost=OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
docstyle = MyItemInfo.MyDocStyle;
if (MyPageHelper.NotesToFootNotes != null && MyPageHelper.NotesToFootNotes.Count > 0) MyPageHelper.NotesToFootNotesYoffset = CalculateYLocation(yLocation, yTopMargin);
@@ -1619,7 +1651,7 @@ namespace Volian.Print.Library
// If there is supplemental information to be printed on the facing page, then get the id that has supinfo
// so that it can be retrieved from the pdf for the supinfos for this section. If there is one,
// use DoSupInfoPage to put out the page, otherwise do a blank page.
if (!MyItemInfo.IsSection && !MyItemInfo.IsInSupInfo && (MyItemInfo.MyActiveSection as SectionInfo).HasSupInfoSteps)
if (MyPromsPrinter.SupInfoPrintType==E_SupInfoPrintType.Merge && !MyItemInfo.IsSection && !MyItemInfo.IsInSupInfo && (MyItemInfo.MyActiveSection as SectionInfo).HasSupInfoSteps)
{
int sid = GetIdThatHasSupInfoItems(MyItemInfo, MyItemInfo.ItemID);
if (sid != -1)
@@ -1662,7 +1694,12 @@ namespace Volian.Print.Library
// 888 .oP"888 `"Y88b. 888ooo888 .dP'
// `88b ooo d8( 888 o. )88b 888 .o .oP .o
// `Y8bood8P' `Y888""8o 8""888P' `Y8bod8P' 8888888888
case 2: // Break within a Step
case 2: // Break within a Step'
if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.DoPageBreaks)
{
if (MyItemInfo.SupInfos != null && MyItemInfo.SupInfos.Count > 0) supInfoSect.StepSectPageBreaksForSupInfo.Add(MyItemInfo.SupInfos[0].ItemID);
else MyPromsPrinter.NeedSupInfoBreak = true;
}
YTopMost=OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
docstyle = MyItemInfo.MyDocStyle;
bool doAlarmBox = false;
@@ -1848,6 +1885,11 @@ namespace Volian.Print.Library
// `88b ooo d8( 888 o. )88b 888 .o o. .88P
// `Y8bood8P' `Y888""8o 8""888P' `Y8bod8P' `8bd88P'
case 3: // Break on High Level Step (SevenLinesPerInch)
if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.DoPageBreaks)
{
if (MyItemInfo.SupInfos != null && MyItemInfo.SupInfos.Count > 0) supInfoSect.StepSectPageBreaksForSupInfo.Add(MyItemInfo.SupInfos[0].ItemID);
else MyPromsPrinter.NeedSupInfoBreak = true;
}
if (!firstHighLevelStep)
{
YTopMost=OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
@@ -1874,6 +1916,23 @@ namespace Volian.Print.Library
MyPromsPrinter.NewPage();
//_MyLog.InfoFormat("NewPage 12 lpi blank {0}", cb.PdfWriter.CurrentPageNumber);
}
// If there is supplemental information to be printed on the facing page, then get the id that has supinfo
// so that it can be retrieved from the pdf for the supinfos for this section. If there is one,
// use DoSupInfoPage to put out the page, otherwise do a blank page.
if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge && !MyItemInfo.IsSection && !MyItemInfo.IsInSupInfo && (MyItemInfo.MyActiveSection as SectionInfo).HasSupInfoSteps)
{
int sid = GetIdThatHasSupInfoItems(MyItemInfo, MyItemInfo.ItemID);
if (sid != -1)
{
MyPromsPrinter.DoSupInfoPage(cb, "TEMP", MyPageHelper.TextLayer, MyPageHelper, sid, true);
}
else
{
MyPageHelper.OnBlankPage = true;
cb.PdfDocument.Add(new iTextSharp.text.Table(1));
MyPromsPrinter.NewPage();
}
}
if (MyItemInfo.MyDocStyle.LandscapePageList)
{
System.Drawing.Drawing2D.Matrix myMatrix = new System.Drawing.Drawing2D.Matrix(0, 1, -1, 0, cb.PdfDocument.PageSize.Height, 0);
@@ -2092,6 +2151,16 @@ namespace Volian.Print.Library
ProfileTimer.Pop(profileDepth);
return yPageStart;
}
private int ChildrenAboveHaveSupInfo()
{
if (ChildrenAbove == null || ChildrenAbove.Count < 1) return -1;
foreach (vlnParagraph p in ChildrenAbove)
{
if (p.MyItemInfo.SupInfos != null && p.MyItemInfo.SupInfos.Count > 0) return p.MyItemInfo.SupInfos[0].ItemID;
}
return -1;
}
// Find the step that has supplemental information from this step down page until a preferred page break is found.
// It is used to determine whether there is a supinfo facing page or if there should be a blank page.
private int GetIdThatHasSupInfoItems(ItemInfo ii, int startid)
@@ -2980,7 +3049,6 @@ namespace Volian.Print.Library
// Save step text information to be used to create a Continuous Action Summary
BuildContinuousActionSummary(parent, itemInfo);
if (itemInfo.ActiveFormat.MyStepSectionLayoutData.BoxLeftAdj != null)
_MyBoxLeftAdj = float.Parse(itemInfo.ActiveFormat.MyStepSectionLayoutData.BoxLeftAdj);
ShowSectionTitles = formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ShowSectionTitles || itemInfo.MyDocStyle.ShowSectionTitles;
@@ -3082,7 +3150,7 @@ namespace Volian.Print.Library
doprint = false;
}
// if printing the supplemental info facing page, don't put out the section title. ToPdf will put out 'Supplemental Information' title.
if (MyPageHelper.CreatingSupInfoPage && itemInfo.IsSection) doprint = false;
if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge && MyPageHelper.CreatingSupInfoPage && itemInfo.IsSection) doprint = false;
if (doprint && itemInfo.IsSection && !itemInfo.MyDocStyle.CancelSectTitle && itemInfo.MyTab.Text.ToUpper() != "FOLDOUT")
{
doSectTab = true;
@@ -3163,14 +3231,7 @@ namespace Volian.Print.Library
if (!itemInfo.IsSection || doSectTab)
{
if (itemInfo.IsSupInfoPart) // get combined tab if on a supinfo facing page:
{
string strmytab = null;
if (itemInfo.MyParent.IsHigh)
strmytab = itemInfo.MyTab.CleanText;
else
strmytab = ItemInfo.GetCombinedTab(itemInfo.MyParent, itemInfo.MyParent.MyParent.CombinedTab);
mytab = new vlnTab(cb, this, strmytab, strmytab, localXOffset, yoff, itemInfo.MyTab.MyFont, doSectTab, StepRTB.MySymbolFontName, itemInfo.MyTab.RemovedStyleUnderline);
}
mytab = GetSupInfoTab(cb, itemInfo, yoff, mytab, doSectTab, localXOffset);
else if (itemInfo.MyTab.AltPrintTab != null)
mytab = new vlnTab(cb, this, itemInfo.MyTab.AltPrintTab, itemInfo.MyTab.AltPrintTab, localXOffset, yoff, itemInfo.MyTab.MyFont, doSectTab, StepRTB.MySymbolFontName, itemInfo.MyTab.RemovedStyleUnderline);
else
@@ -3179,6 +3240,11 @@ namespace Volian.Print.Library
if (mytab.MyMacro != null) PartsLeft.Add(mytab.MyMacro);
}
}
else if (itemInfo.IsSupInfoPart) // if it was an empty tab - it may have been a caution/note
{
mytab = GetSupInfoTab(cb, itemInfo, yoff, mytab, doSectTab, XOffset);
PartsLeft.Add(mytab);
}
// 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:
AdjustWidth(itemInfo, maxRNO, formatInfo, mytab);
@@ -3235,7 +3301,7 @@ namespace Volian.Print.Library
}
}
if (itemInfo.IsSection && MyParent == null && itemInfo.MyDocStyle.SupplementalInformation)
if (itemInfo.IsSection && MyParent == null && itemInfo.MyDocStyle.SupplementalInformation && MyPromsPrinter.SupInfoPrintType==E_SupInfoPrintType.Merge)
{
_SupInfoSection = new vlnParagraph(this, cb, itemInfo, xoff, yoff, rnoLevel, maxRNO, formatInfo, null, null, yoffRightParent, false, pp);
MyPromsPrinter.SupInfoPdfPageCount = -1;
@@ -3314,12 +3380,11 @@ namespace Volian.Print.Library
}
}
if (itemInfo is StepInfo && ((itemInfo as StepInfo).MyConfig as StepConfig).Step_PreferredPagebreak) HasPrefPageBreak = true;
if (loadChildren && itemInfo.SupInfos != null)
if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge && loadChildren && itemInfo.SupInfos != null)
{
SupInfoSection.ChildrenBelow.Add(cb, itemInfo.SupInfos, XOffset, 0, 0, rnoLevel, maxRNO, formatInfo);
SupInfoSection.ChildrenBelow[SupInfoSection.ChildrenBelow.Count - 1].PrefPageBreak = HasPrefPageBreak;
HasPrefPageBreak = false;
}
// Without the following, BGE had gaps in y-direction if the AER/RNO both had cautions/notes.
// The only time this needs done is if caution/notes are printed in separate columns in dual
// column mode (used the DoubleBoxHLS BGE flag for this - if another plant needs this, make it
@@ -4024,6 +4089,21 @@ namespace Volian.Print.Library
if (XOffsetCenter != null) XOffset = (float)XOffsetCenter;
ProfileTimer.Pop(profileDepth);
}
private vlnTab GetSupInfoTab(PdfContentByte cb, ItemInfo itemInfo, float yoff, vlnTab mytab, bool doSectTab, float localXOffset)
{
string strmytab = null;
if (itemInfo.MyParent.IsHigh)
strmytab = itemInfo.MyTab.CleanText;
else if (itemInfo.MyParent.IsCaution)
strmytab = "Caution";
else if (itemInfo.MyParent.IsNote)
strmytab = "Note";
else
strmytab = ItemInfo.GetCombinedTab(itemInfo.MyParent, itemInfo.MyParent.MyParent.CombinedTab);
mytab = new vlnTab(cb, this, strmytab, strmytab, localXOffset, yoff, itemInfo.MyTab.MyFont, doSectTab, StepRTB.MySymbolFontName, itemInfo.MyTab.RemovedStyleUnderline);
return mytab;
}
private static VE_Font _AnnotationFont;
public static VE_Font AnnotationFont
{
@@ -5142,16 +5222,14 @@ namespace Volian.Print.Library
{
if (itemInfo.IsSupInfoPart)
{
int addForTab = itemInfo.MyParent.IsCaution || itemInfo.MyParent.IsNote ? 72 : 36;
XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + addForTab; // add in an inch to allow for enough space for Note/Caution tab
XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + 54; // add in 3/4 inch (54) to allow for enough space for Note/Caution tab
if (myTab != null)
{
myTab.XOffset = XOffset - ((myTab == null) ? 0 : myTab.Width) - 12;
if (!itemInfo.MyParent.IsHigh && !itemInfo.MyParent.IsCaution && !itemInfo.MyParent.IsNote) myTab.Width = 2 * myTab.Width;
myTab.Width = 2.5f * myTab.Width;
}
return;
}
float tabWidth = (myTab == null) ? 0 : myTab.Width;
if (itemInfo.IsStepSection)
{