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);
// 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;
else
yoff = para.YBottomMost;
@ -227,12 +227,12 @@ namespace Volian.Print.Library
if (MyItemInfo.IsSection)
{
SectionConfig sch = MyItemInfo.MyConfig as SectionConfig;
if (!(ShowSectionTitles
&& !MyItemInfo.MyDocStyle.CancelSectTitle
&& !MyItemInfo.MyDocStyle.SpecialStepsFoldout
&& !MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseMetaSections)
&&
(sch != null && sch.Section_PrintHdr != "Y")) doprint = false;
//if (!(ShowSectionTitles
// && !MyItemInfo.MyDocStyle.CancelSectTitle
// && !MyItemInfo.MyDocStyle.SpecialStepsFoldout
// && !MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseMetaSections)
// &&
if (sch != null && sch.Section_PrintHdr != "Y") doprint = false;
}
if (MyItemInfo.MyContent.MyGrid != null)
retval = DrawGrid(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation);
@ -777,7 +777,7 @@ namespace Volian.Print.Library
MyPageHelper.YMultiplier = 1;
// 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)");
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)
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.Steps != null && itemInfo.Steps.Count > 0 && itemInfo.Steps[0].FormatStepData.StepLayoutData.AlignWithParentTab))
itemInfo.MyTab = null;
@ -1131,7 +1131,7 @@ namespace Volian.Print.Library
&& !MyItemInfo.MyDocStyle.CancelSectTitle
&& !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;
YTopMost = 0;
@ -1369,7 +1369,7 @@ namespace Volian.Print.Library
Width += 24;
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
|| (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
// 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;
// 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.
if ((!itemInfo.IsStepSection && !itemInfo.MyHLS.FormatStepData.UseSmartTemplate) // regular step
if ((!itemInfo.IsStepSection && itemInfo.MyHLS != null && !itemInfo.MyHLS.FormatStepData.UseSmartTemplate) // regular step
|| (ShowSectionTitles
&& !MyItemInfo.MyDocStyle.CancelSectTitle
&& !MyItemInfo.MyDocStyle.SpecialStepsFoldout)
@ -1436,8 +1436,8 @@ namespace Volian.Print.Library
&& ((itemInfo.Steps == null || itemInfo.Steps.Count == 0)
|| !itemInfo.Steps[0].FormatStepData.StepLayoutData.AlignWithParentTab)))
{
bool doprint = true;
if (MyItemInfo.IsSection && formatInfo.PlantFormat.FormatData.SectData.UseMetaSections) // if on a section, be sure that section title should print.
bool doprint = !(MyPageHelper.DidHLSText && MyItemInfo.ItemID == MyPageHelper.HasHLSTextId);
if (MyItemInfo.IsSection)
{
SectionConfig sch = MyItemInfo.MyConfig as SectionConfig;
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;
float? widOvrd = 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;
else
widOvrd = itemInfo.FormatStepData == null ? null : itemInfo.FormatStepData.WidthOverride;