Added some checks for null; improve/cleanup print of section header code; don’t add lines if doing HLStext as pagelist

This commit is contained in:
Kathy Ruffing 2013-07-25 13:27:26 +00:00
parent 62ba5c5c05
commit d9554317f3

View File

@ -123,7 +123,7 @@ namespace Volian.Print.Library
} }
Add(para); Add(para);
// para.YBottomMost will have y for bottom of any substeps that are also enclosed in the box. // para.YBottomMost will have y for bottom of any substeps that are also enclosed in the box.
if (childItemInfo.IsStep && childItemInfo.MyHLS.FormatStepData.UseSmartTemplate && para.ChildrenBelow.Count > 0 && para.ChildrenBelow[0].YBottomMost > para.YBottomMost) if (childItemInfo.IsStep && childItemInfo.MyHLS !=null && childItemInfo.MyHLS.FormatStepData.UseSmartTemplate && para.ChildrenBelow.Count > 0 && para.ChildrenBelow[0].YBottomMost > para.YBottomMost)
yoff = para.ChildrenBelow[0].YBottomMost; yoff = para.ChildrenBelow[0].YBottomMost;
else else
yoff = para.YBottomMost; yoff = para.YBottomMost;
@ -227,12 +227,12 @@ namespace Volian.Print.Library
if (MyItemInfo.IsSection) if (MyItemInfo.IsSection)
{ {
SectionConfig sch = MyItemInfo.MyConfig as SectionConfig; SectionConfig sch = MyItemInfo.MyConfig as SectionConfig;
if (!(ShowSectionTitles //if (!(ShowSectionTitles
&& !MyItemInfo.MyDocStyle.CancelSectTitle // && !MyItemInfo.MyDocStyle.CancelSectTitle
&& !MyItemInfo.MyDocStyle.SpecialStepsFoldout // && !MyItemInfo.MyDocStyle.SpecialStepsFoldout
&& !MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseMetaSections) // && !MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseMetaSections)
&& // &&
(sch != null && sch.Section_PrintHdr != "Y")) doprint = false; if (sch != null && sch.Section_PrintHdr != "Y") doprint = false;
} }
if (MyItemInfo.MyContent.MyGrid != null) if (MyItemInfo.MyContent.MyGrid != null)
retval = DrawGrid(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation); retval = DrawGrid(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation);
@ -777,7 +777,7 @@ namespace Volian.Print.Library
MyPageHelper.YMultiplier = 1; MyPageHelper.YMultiplier = 1;
// Now check if this is a template type step & if so, add the HLS's prefix/suffix to it. // Now check if this is a template type step & if so, add the HLS's prefix/suffix to it.
if (MyItemInfo.MyHLS.FormatStepData.UseSmartTemplate) if (MyItemInfo.MyHLS != null && MyItemInfo.MyHLS.FormatStepData.UseSmartTemplate)
{ {
vlnParagraph smartPara = new vlnParagraph(MyParent.MyParent, cb, MyItemInfo.MyHLS, MyParent.XOffset, 0, 0, 0, MyParent.MyItemInfo.ActiveFormat, null, " (Continued)"); vlnParagraph smartPara = new vlnParagraph(MyParent.MyParent, cb, MyItemInfo.MyHLS, MyParent.XOffset, 0, 0, 0, MyParent.MyItemInfo.ActiveFormat, null, " (Continued)");
float mytmpfloat = smartPara.ParagraphToPdf(cb, smartPara.Height, yTopMargin, yBottomMargin); // .ToPdf(cb, 0, yTopMargin, yBottomMargin); float mytmpfloat = smartPara.ParagraphToPdf(cb, smartPara.Height, yTopMargin, yBottomMargin); // .ToPdf(cb, 0, yTopMargin, yBottomMargin);
@ -1113,7 +1113,7 @@ namespace Volian.Print.Library
if (itemInfo.MyParent.IsCaution || itemInfo.MyParent.IsNote) if (itemInfo.MyParent.IsCaution || itemInfo.MyParent.IsNote)
XOffset += 72 * (itemInfo.FormatStepData.CautionOrNoteSubstepIndent == null ? 0 : (float)itemInfo.FormatStepData.CautionOrNoteSubstepIndent / (float)itemInfo.FormatStepData.Font.CPI); XOffset += 72 * (itemInfo.FormatStepData.CautionOrNoteSubstepIndent == null ? 0 : (float)itemInfo.FormatStepData.CautionOrNoteSubstepIndent / (float)itemInfo.FormatStepData.Font.CPI);
if (itemInfo.IsStep && itemInfo.MyHLS.FormatStepData.UseSmartTemplate && if (itemInfo.IsStep && itemInfo.MyHLS != null && itemInfo.MyHLS.FormatStepData.UseSmartTemplate &&
itemInfo.FormatStepData.StepLayoutData.AlignWithParentTab itemInfo.FormatStepData.StepLayoutData.AlignWithParentTab
|| (itemInfo.Steps != null && itemInfo.Steps.Count > 0 && itemInfo.Steps[0].FormatStepData.StepLayoutData.AlignWithParentTab)) || (itemInfo.Steps != null && itemInfo.Steps.Count > 0 && itemInfo.Steps[0].FormatStepData.StepLayoutData.AlignWithParentTab))
itemInfo.MyTab = null; itemInfo.MyTab = null;
@ -1131,7 +1131,7 @@ namespace Volian.Print.Library
&& !MyItemInfo.MyDocStyle.CancelSectTitle && !MyItemInfo.MyDocStyle.CancelSectTitle
&& !MyItemInfo.MyDocStyle.SpecialStepsFoldout) && !MyItemInfo.MyDocStyle.SpecialStepsFoldout)
&& &&
((sch != null && sch.Section_PrintHdr != "Y") || !MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseMetaSections)) (sch != null && sch.Section_PrintHdr != "Y")) // || !MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseMetaSections))
{ {
doprint = false; doprint = false;
YTopMost = 0; YTopMost = 0;
@ -1369,7 +1369,7 @@ namespace Volian.Print.Library
Width += 24; Width += 24;
Rtf = Rtf.Replace("{Backspace}", ""); Rtf = Rtf.Replace("{Backspace}", "");
} }
if (itemInfo.IsStep && itemInfo.MyHLS.FormatStepData.UseSmartTemplate) if (itemInfo.IsStep && itemInfo.MyHLS != null && itemInfo.MyHLS.FormatStepData.UseSmartTemplate)
{ {
if (itemInfo.FormatStepData.StepLayoutData.AlignWithParentTab if (itemInfo.FormatStepData.StepLayoutData.AlignWithParentTab
|| (itemInfo.Steps != null && itemInfo.Steps.Count > 0 && itemInfo.Steps[0].FormatStepData.StepLayoutData.AlignWithParentTab)) || (itemInfo.Steps != null && itemInfo.Steps.Count > 0 && itemInfo.Steps[0].FormatStepData.StepLayoutData.AlignWithParentTab))
@ -1423,11 +1423,11 @@ namespace Volian.Print.Library
} }
// If checklists, the substeps are printed in a row, need to keep track of the 'longest' in // If checklists, the substeps are printed in a row, need to keep track of the 'longest' in
// y direction (bottommost) across the row. // y direction (bottommost) across the row.
if (itemInfo.IsStep && itemInfo.MyHLS.FormatStepData.UseSmartTemplate && (TheStepLevel(itemInfo) >= 0)) if (itemInfo.IsStep && itemInfo.MyHLS != null && itemInfo.MyHLS.FormatStepData.UseSmartTemplate && (TheStepLevel(itemInfo) >= 0))
savCheckListBottomMost = yoff + Height + SixLinesPerInch; savCheckListBottomMost = yoff + Height + SixLinesPerInch;
// Get Y offset for regular steps, or if section title is output or if not within row (not last column of // Get Y offset for regular steps, or if section title is output or if not within row (not last column of
// text) for wcn checklist, i.e. // text) for wcn checklist, i.e.
if ((!itemInfo.IsStepSection && !itemInfo.MyHLS.FormatStepData.UseSmartTemplate) // regular step if ((!itemInfo.IsStepSection && itemInfo.MyHLS != null && !itemInfo.MyHLS.FormatStepData.UseSmartTemplate) // regular step
|| (ShowSectionTitles || (ShowSectionTitles
&& !MyItemInfo.MyDocStyle.CancelSectTitle && !MyItemInfo.MyDocStyle.CancelSectTitle
&& !MyItemInfo.MyDocStyle.SpecialStepsFoldout) && !MyItemInfo.MyDocStyle.SpecialStepsFoldout)
@ -1436,8 +1436,8 @@ namespace Volian.Print.Library
&& ((itemInfo.Steps == null || itemInfo.Steps.Count == 0) && ((itemInfo.Steps == null || itemInfo.Steps.Count == 0)
|| !itemInfo.Steps[0].FormatStepData.StepLayoutData.AlignWithParentTab))) || !itemInfo.Steps[0].FormatStepData.StepLayoutData.AlignWithParentTab)))
{ {
bool doprint = true; bool doprint = !(MyPageHelper.DidHLSText && MyItemInfo.ItemID == MyPageHelper.HasHLSTextId);
if (MyItemInfo.IsSection && formatInfo.PlantFormat.FormatData.SectData.UseMetaSections) // if on a section, be sure that section title should print. if (MyItemInfo.IsSection)
{ {
SectionConfig sch = MyItemInfo.MyConfig as SectionConfig; SectionConfig sch = MyItemInfo.MyConfig as SectionConfig;
if (sch != null && sch.Section_PrintHdr != "Y") doprint = false; if (sch != null && sch.Section_PrintHdr != "Y") doprint = false;
@ -2362,7 +2362,7 @@ namespace Volian.Print.Library
int? bxIndx = itemInfo.IsStep ? formatInfo.PlantFormat.FormatData.StepDataList[typ].StepLayoutData.STBoxindex : null; int? bxIndx = itemInfo.IsStep ? formatInfo.PlantFormat.FormatData.StepDataList[typ].StepLayoutData.STBoxindex : null;
float? widOvrd = 0; float? widOvrd = 0;
float xwid = 0; float xwid = 0;
if (itemInfo.IsStep && itemInfo.MyHLS.FormatStepData.UseSmartTemplate && (xwid = GetWidthFromTemplate(itemInfo, formatInfo)) > 0) if (itemInfo.IsStep && itemInfo.MyHLS != null && itemInfo.MyHLS.FormatStepData.UseSmartTemplate && (xwid = GetWidthFromTemplate(itemInfo, formatInfo)) > 0)
widOvrd = xwid; widOvrd = xwid;
else else
widOvrd = itemInfo.FormatStepData == null ? null : itemInfo.FormatStepData.WidthOverride; widOvrd = itemInfo.FormatStepData == null ? null : itemInfo.FormatStepData.WidthOverride;