From d9554317f3e265481a31d175da932f90a9fea1c7 Mon Sep 17 00:00:00 2001 From: Kathy Date: Thu, 25 Jul 2013 13:27:26 +0000 Subject: [PATCH] =?UTF-8?q?Added=20some=20checks=20for=20null;=20improve/c?= =?UTF-8?q?leanup=20print=20of=20section=20header=20code;=20don=E2=80=99t?= =?UTF-8?q?=20add=20lines=20if=20doing=20HLStext=20as=20pagelist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PROMS/Volian.Print.Library/vlnParagraph.cs | 32 +++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index 130c28e5..b2b14538 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -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;