Use property to initialize (prevent null reference)

Added sup info pdf print to supinfo print enum
Use sup info pdf print from enum
fixed typo and use sup info pdf print from enum
B2017-136: Support section titles in proc step sections that have SAMG facing page supplemental info
This commit is contained in:
Kathy Ruffing 2017-07-10 12:10:58 +00:00
parent f204e513de
commit 92dfcf47ed
5 changed files with 49 additions and 35 deletions

View File

@ -6936,7 +6936,11 @@ namespace VEPROMS.CSLA.Library
private List<int> _StepSectPageBreaksForSupInfo = null;
public List<int> StepSectPageBreaksForSupInfo
{
get { return _StepSectPageBreaksForSupInfo; }
get
{
if (_StepSectPageBreaksForSupInfo == null) _StepSectPageBreaksForSupInfo = new List<int>();
return _StepSectPageBreaksForSupInfo;
}
set { _StepSectPageBreaksForSupInfo = value; }
}
// Keeps track of step section itemids where page breaks occur

View File

@ -244,7 +244,8 @@ namespace VEPROMS.CSLA.Library
{
None = 0,
DoPageBreaks = 1,
Merge = 2
SupInfoPdfPrint = 2,
Merge = 3
}
#endregion
}

View File

@ -80,7 +80,7 @@ namespace Volian.Print.Library
}
// If printing a supinfo pdf, see if there is a page break at this supinfo paragraph, i.e. an entry will
// exist in the list that contains the supinfo paragraph pagebreaks that was generated in the first pagebreak pass
if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge && MyPageHelper.CreatingSupInfoPage)
if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.SupInfoPdfPrint)
{
int retval = 0;
SectionInfo supInfoSect = MyItemInfo.MyActiveSection as SectionInfo;

View File

@ -1621,8 +1621,7 @@ namespace Volian.Print.Library
ItemInfo myItemInfo = section as ItemInfo;
if (SupInfoPrintType == E_SupInfoPrintType.DoPageBreaks)
{
if (section.StepSectPageBreaksForSupInfo == null) section.StepSectPageBreaksForSupInfo = new List<int>();
else section.StepSectPageBreaksForSupInfo.Clear();
section.StepSectPageBreaksForSupInfo.Clear();
section.StepSectPageBreaks.Clear();
}
// 792: 72 * 11 inches - TopRow - Top is high value
@ -1743,18 +1742,20 @@ namespace Volian.Print.Library
string SupInfoPdfName = Volian.Base.Library.VlnSettings.TemporaryFolder + @"\SupInfo" + vlnParagraph.MyItemInfo.ItemID.ToString() + @".pdf";
PdfContentByte cb = OpenDoc(SupInfoPdfName, PageSize.LETTER);
if (cb == null) return;
VlnSvgPageHelper myPageHealper = new VlnSvgPageHelper(vlnParagraph.MyItemInfo as SectionInfo, this, null, 0);
cb.PdfWriter.PageEvent = myPageHealper;
myPageHealper.AllowAllWatermarks = AllowAllWatermarks;
myPageHealper.MyPdfWriter = cb.PdfWriter;
myPageHealper.CreatingFoldoutPage = false;
myPageHealper.CreatingSupInfoPage = true;
myPageHealper.MyPdfContentByte = cb;
myPageHealper.ChangeBarDefinition = MyChangeBarDefinition;
VlnSvgPageHelper myPageHelper = new VlnSvgPageHelper(vlnParagraph.MyItemInfo as SectionInfo, this, null, 0);
cb.PdfWriter.PageEvent = myPageHelper;
myPageHelper.AllowAllWatermarks = AllowAllWatermarks;
myPageHelper.MyPdfWriter = cb.PdfWriter;
myPageHelper.CreatingFoldoutPage = false;
myPageHelper.CreatingSupInfoPage = true;
myPageHelper.MyPdfContentByte = cb;
myPageHelper.ChangeBarDefinition = MyChangeBarDefinition;
float yPageStart = yTopMargin;
vlnParagraph._yPageStartForSupInfo = yTopMargin;
SupInfoAjustGroupings(vlnParagraph,cb);
SupInfoPrintType = E_SupInfoPrintType.SupInfoPdfPrint;
vlnParagraph.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
SupInfoPrintType = E_SupInfoPrintType.Merge;
try
{
cb.PdfDocument.Close();

View File

@ -465,6 +465,9 @@ namespace Volian.Print.Library
public float ParagraphToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin)
{
// Don't print section titles for supplemental information because the title is 'Supplemental Information':
if (MyItemInfo.IsSection && MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.SupInfoPdfPrint) return yPageStart;
//if(PartsAbove.Count > 0 && PartsAbove[0] is vlnHeader)
// if (PartsLeft.Count > 0 && PartsLeft[0] is vlnTab)
// //if((PartsLeft[0] as vlnTab).Text[0] != '\u25CF')
@ -1604,13 +1607,17 @@ namespace Volian.Print.Library
// printing a procedure with section(s) that have supplemental information - determine facing page needed to be merged in. For
// case 0, it is typically at the beginning of the section since the page break occurred in the code that calls this.
// Note that if the procedure has any sections with supinfo, then the entire procedure will need facing pages, either blank page
// or supinfo steps.
if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge && !MyItemInfo.IsSection && MyItemInfo.IsHigh && MyItemInfo.MyPrevious == null && !MyItemInfo.IsInSupInfo && (MyItemInfo.MyProcedure as ProcedureInfo).ProcHasSupInfoData)
// or supinfo steps. Also, if the section title is printed, then need to get the facing page before the section title is printed and if
// this is the hls where the section title was printed, don't do the facing page.
bool titlePrinted = false;
if (MyItemInfo.IsSection || (MyItemInfo.IsHigh && MyItemInfo.MyPrevious == null))
{
// check if the item is printed, a step is always printed but a section title may or may not based on format flags. if it is not
// printed, don't put out facing page because it will be put out when there is printable text.
itemIsPrinted = IsPrintedStepItemForSupInfo();
if (itemIsPrinted)
// see if the section title is printed.
SectionConfig sch = MyItemInfo.ActiveSection.MyConfig as SectionConfig;
titlePrinted = (sch == null || sch.Section_PrintHdr == "Y") || !(MyItemInfo.MyActiveSection as SectionInfo).HasSupInfoSteps;
titlePrinted &= (ShowSectionTitles && !MyItemInfo.MyDocStyle.CancelSectTitle);
}
if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge && (MyItemInfo.ActiveSection as SectionInfo).HasSupInfoSteps && ((MyItemInfo.IsHigh && MyItemInfo.MyPrevious == null && !titlePrinted) || (MyItemInfo.IsStepSection && titlePrinted)) && !MyItemInfo.IsInSupInfo && (MyItemInfo.MyProcedure as ProcedureInfo).ProcHasSupInfoData)
{
// 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.
@ -1626,7 +1633,6 @@ namespace Volian.Print.Library
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)
@ -1699,7 +1705,7 @@ namespace Volian.Print.Library
}
// See comments under case 0 explaining supinfo/facing page processing.
itemIsPrinted = IsPrintedStepItemForSupInfo();
if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge && itemIsPrinted && !MyItemInfo.IsSection && !MyItemInfo.IsInSupInfo && (MyItemInfo.MyProcedure as ProcedureInfo).ProcHasSupInfoData)
if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge && !MyPageHelper.CreatingSupInfoPage && itemIsPrinted /*&& !MyItemInfo.IsSection*/ && !MyItemInfo.IsInSupInfo && (MyItemInfo.MyProcedure as ProcedureInfo).ProcHasSupInfoData)
{
int sid = GetIdThatHasSupInfoItems(MyItemInfo, MyItemInfo.ItemID);
if (sid != -1)
@ -1809,7 +1815,7 @@ namespace Volian.Print.Library
MyPromsPrinter.NewPage();
_MyLog.InfoFormat("NewPage Break within step blank {0}", cb.PdfWriter.CurrentPageNumber);
}
if (!MyItemInfo.IsSection && !MyItemInfo.IsInSupInfo && (MyItemInfo.MyProcedure as ProcedureInfo).ProcHasSupInfoData)
if (!MyPageHelper.CreatingSupInfoPage && !MyItemInfo.IsSection && !MyItemInfo.IsInSupInfo && (MyItemInfo.MyProcedure as ProcedureInfo).ProcHasSupInfoData)
{
int sid = GetIdThatHasSupInfoItems(MyItemInfo, MyItemInfo.ItemID);
if (sid != -1)
@ -1968,7 +1974,7 @@ namespace Volian.Print.Library
}
// See comments under case 0 explaining supinfo/facing page processing.
itemIsPrinted = IsPrintedStepItemForSupInfo();
if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge && itemIsPrinted && !MyItemInfo.IsSection && !MyItemInfo.IsInSupInfo && (MyItemInfo.MyProcedure as ProcedureInfo).ProcHasSupInfoData)
if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge && !MyPageHelper.CreatingSupInfoPage && itemIsPrinted /*&& !MyItemInfo.IsSection */ && !MyItemInfo.IsInSupInfo && (MyItemInfo.MyProcedure as ProcedureInfo).ProcHasSupInfoData)
{
int sid = GetIdThatHasSupInfoItems(MyItemInfo, MyItemInfo.ItemID);
if (sid != -1)
@ -3510,6 +3516,8 @@ namespace Volian.Print.Library
}
}
if (itemInfo is StepInfo && ((itemInfo as StepInfo).MyConfig as StepConfig).Step_PreferredPagebreak) HasPrefPageBreak = true;
// The following adds supplemental information items to the SupInfoSection list off of the section level paragraph for printing
// of the sup info pdf. The SupInfoSection list is just a flat list of all supplemental information within the section.
if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge && loadChildren && itemInfo.SupInfos != null)
{
SupInfoSection.ChildrenBelow.Add(cb, itemInfo.SupInfos, XOffset, 0, 0, rnoLevel, maxRNO, formatInfo);