From 5d7d23f2927d7f7dc3e30b7e92285379a35b2112 Mon Sep 17 00:00:00 2001 From: Rich Date: Tue, 2 Jul 2013 15:33:57 +0000 Subject: [PATCH] Added code to use ShowSectionTitles property --- PROMS/Volian.Print.Library/vlnParagraph.cs | 84 ++++++++++++---------- 1 file changed, 47 insertions(+), 37 deletions(-) diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index 4f38c4a5..80583323 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -82,22 +82,22 @@ namespace Volian.Print.Library { if (bxIndx != null) { - if (box != null) - { - box.Height = yoff - box.YOffset; // new height, with children + if (box != null) + { + box.Height = yoff - box.YOffset; // new height, with children if (childItemInfo.MyHeader != null && childItemInfo.MyPrevious != null && ((childItemInfo.MyPrevious.IsCaution && childItemInfo.IsCaution) || (childItemInfo.MyPrevious.IsNote && childItemInfo.IsNote))) yoff += vlnPrintObject.SixLinesPerInch * 2; + } + box = new vlnBox(); + box.MyBox = formatInfo.PlantFormat.FormatData.BoxList[(int)bxIndx]; + int ln = 1; // a format flag determines whether there is a space before the note/caution. + if (childItemInfo.FormatStepData.OneLineBeforeTab) ln++; + if (childItemInfo.MixCautionNotesDiffType()) ln += 2; + box.YOffset = yoff + ((ln - 1) * vlnPrintObject.SixLinesPerInch); + yoff += ln * vlnPrintObject.SixLinesPerInch; } - box = new vlnBox(); - box.MyBox = formatInfo.PlantFormat.FormatData.BoxList[(int)bxIndx]; - int ln = 1; // a format flag determines whether there is a space before the note/caution. - if (childItemInfo.FormatStepData.OneLineBeforeTab) ln++; - if (childItemInfo.MixCautionNotesDiffType()) ln += 2; - box.YOffset = yoff + ((ln - 1) * vlnPrintObject.SixLinesPerInch); - yoff += ln * vlnPrintObject.SixLinesPerInch; - } } bxIndex = bxIndx; } @@ -170,6 +170,13 @@ namespace Volian.Print.Library get { return _IsWordDocPara; } set { _IsWordDocPara = value; } } + private bool _ShowSectionTitles; + public bool ShowSectionTitles + { + get { return _ShowSectionTitles; } + set { _ShowSectionTitles = value; } + } + public float ParagraphToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin) { if (Processed) return yPageStart; @@ -187,6 +194,8 @@ namespace Volian.Print.Library if (MyItemInfo.HasChangeBar && MyPageHelper.ChangeBarDefinition.MyChangeBarType != PrintChangeBar.Without) MyPageHelper.AddChangeBar(DoChangeBar(cb, MyItemInfo, MyPageHelper, XOffset, yLocation, MyPageHelper.MaxRNO, MyItemInfo.ActiveFormat), cbMess); float retval = yLocation; bool doprint = true; + if (MyItemInfo.ItemID == 25045) + Console.WriteLine("jcb"); if (MyItemInfo.IsFigure) { yLocation -= (SixLinesPerInch * MyPageHelper.YMultiplier); @@ -197,7 +206,7 @@ namespace Volian.Print.Library } else if (!MyItemInfo.IsStepSection - || (MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ShowSectionTitles + || (ShowSectionTitles && !MyItemInfo.MyDocStyle.CancelSectTitle && !MyItemInfo.MyDocStyle.SpecialStepsFoldout)) // Don't ouput the Step Section title { @@ -205,7 +214,7 @@ namespace Volian.Print.Library if (MyItemInfo.IsSection) { SectionConfig sch = MyItemInfo.MyConfig as SectionConfig; - if (!(MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ShowSectionTitles + if (!(ShowSectionTitles && !MyItemInfo.MyDocStyle.CancelSectTitle && !MyItemInfo.MyDocStyle.SpecialStepsFoldout && !MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseMetaSections) @@ -758,7 +767,7 @@ namespace Volian.Print.Library PromsPrinter.DoFoldoutPage(cb, "HLS (7 lpi) break", MyPageHelper.TextLayer, MyPageHelper, MyItemInfo.FoldoutIndex()); } if (MyItemInfo.MyParent != null && MyItemInfo.MyParent.IsStepSection && - MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ShowSectionTitles + ShowSectionTitles && !MyItemInfo.MyDocStyle.CancelSectTitle && !MyItemInfo.MyDocStyle.SpecialStepsFoldout) yPageStart = yPageStart; // if printing the section title, we already have the y location @@ -1015,6 +1024,7 @@ namespace Volian.Print.Library private int COL_WID_ADJ = 6; // adjusts for incorrect use of WidSTable when breaking a line (it breaks 6 chars too short) public vlnParagraph(vlnParagraph parent, PdfContentByte cb, ItemInfo itemInfo, float xoff, float yoff, int rnoLevel, int maxRNO, FormatInfo formatInfo, string prefix, string suffix) { + ShowSectionTitles = formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ShowSectionTitles || itemInfo.MyDocStyle.ShowSectionTitles; int MetaLevel = 0; // if meta section, stores what level this section is. float savCheckListBottomMost = 0; //int[] problemIDs = { 889 }; @@ -1068,7 +1078,7 @@ namespace Volian.Print.Library if (itemInfo.IsSection) { SectionConfig sch = MyItemInfo.MyConfig as SectionConfig; - if (!(MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ShowSectionTitles + if (!(ShowSectionTitles && !MyItemInfo.MyDocStyle.CancelSectTitle && !MyItemInfo.MyDocStyle.SpecialStepsFoldout) && @@ -1336,7 +1346,7 @@ namespace Volian.Print.Library else if (itemInfo.FormatStepData != null && itemInfo.FormatStepData.StepPrintData != null) XOffset += (float)(itemInfo.FormatStepData.StepPrintData.PosAdjust ?? 0); - if (itemInfo.IsSection && formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ShowSectionTitles + if (itemInfo.IsSection && ShowSectionTitles && !MyItemInfo.MyDocStyle.CancelSectTitle) { if (MyItemInfo.MyDocStyle.Layout.SectionMacro != null) @@ -1366,7 +1376,7 @@ namespace Volian.Print.Library // 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 - || (formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ShowSectionTitles + || (ShowSectionTitles && !MyItemInfo.MyDocStyle.CancelSectTitle && !MyItemInfo.MyDocStyle.SpecialStepsFoldout) // In Checklist: I don't have children or if I have children the first child doesn't alignwithparent. @@ -1397,28 +1407,28 @@ namespace Volian.Print.Library // checkoff - this was added for shearon harris: if (!(co.NotOnEmpty && itemInfo.MyContent.Text.Replace(@"\u160?"," ").TrimEnd() == "")) { - float xloc_co = (float)itemInfo.MyDocStyle.Layout.LeftMargin; - // if the format has 'SkipSpaces', look at the tab, and back up the macros to the number of - // spaces in the tab. - if (formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.SkipSpaces) - { - if (mytab != null) - xloc_co = mytab.XOffset; - else - xloc_co = XOffset; //there's no tab - put checkoff at step's xoff. Macro should back up from step's x. - } - else - { - if (formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.XLocation != null) - xloc_co += (float)formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.XLocation; - if (formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.RelXLocation != null) + float xloc_co = (float)itemInfo.MyDocStyle.Layout.LeftMargin; + // if the format has 'SkipSpaces', look at the tab, and back up the macros to the number of + // spaces in the tab. + if (formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.SkipSpaces) { - float relX = (float)formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.RelXLocation; - xloc_co = XOffset + (relX > 0 ? Width : 0) + relX; + if (mytab != null) + xloc_co = mytab.XOffset; + else + xloc_co = XOffset; //there's no tab - put checkoff at step's xoff. Macro should back up from step's x. } + else + { + if (formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.XLocation != null) + xloc_co += (float)formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.XLocation; + if (formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.RelXLocation != null) + { + float relX = (float)formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.RelXLocation; + xloc_co = XOffset + (relX > 0 ? Width : 0) + relX; + } + } + PartsRight.Add(new vlnMacro(xloc_co, yForCheckoff, co.Macro)); } - PartsRight.Add(new vlnMacro(xloc_co, yForCheckoff, co.Macro)); - } } float yOffRight = yoff; float RnoOffset = ToInt(formatInfo.MyStepSectionLayoutData.ColRTable, maxRNO); @@ -2325,7 +2335,7 @@ namespace Volian.Print.Library { if (sd.StepSectionData.StepSectionLayoutData.TieTabToLevel) { - if (itemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ShowSectionTitles + if (ShowSectionTitles && !itemInfo.MyDocStyle.CancelSectTitle && !(itemInfo.MyDocStyle.SpecialStepsFoldout && itemInfo.MyDocStyle.UseColSByLevel)) {