From f8ce3422572609a3dee1991d0e93b5f3579f7b31 Mon Sep 17 00:00:00 2001 From: Kathy Date: Fri, 27 Jan 2012 12:47:44 +0000 Subject: [PATCH] --- PROMS/Volian.Print.Library/vlnParagraph.cs | 135 +++++++++------------ 1 file changed, 55 insertions(+), 80 deletions(-) diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index b5710401..a8fe6c9d 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -151,10 +151,17 @@ namespace Volian.Print.Library && !MyItemInfo.MyDocStyle.CancelSectTitle && !MyItemInfo.MyDocStyle.SpecialStepsFoldout)) // Don't ouput the Step Section title { + bool doprint = true; + // if this is a section, then check the section config for printable header too. + if (MyItemInfo.IsSection) + { + SectionConfig sch = MyItemInfo.MyConfig as SectionConfig; + if (sch != null && sch.Section_PrintHdr != "Y") doprint = false; + } if (MyItemInfo.MyContent.MyGrid != null) retval = DrawGrid(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation); else - retval = DrawText(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation); + if (doprint)retval = DrawText(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation); if (MyItemInfo.IsHigh) { MyPageHelper.PageBookmarks.Add(MyItemInfo, MyItemInfo.MyTab.CleanText + " " + MyItemInfo.DisplayText, @@ -555,7 +562,7 @@ namespace Volian.Print.Library { if (yLocation < yTopMargin) // continuous section { - if (ChildrenBelow == null) return 0; + if (ChildrenBelow == null || ChildrenBelow.Count==0) return 0; vlnParagraph firstChild = ChildrenBelow[0]; // This is a continuous section. There may be cases where the user put a manual page @@ -902,7 +909,13 @@ namespace Volian.Print.Library if (itemInfo.MyTab != null && itemInfo.MyTab.Text != null && itemInfo.MyTab.Text != "") { float localXOffset = XOffset; - if (itemInfo.IsSection && !itemInfo.MyDocStyle.CancelSectTitle && itemInfo.MyTab.Text.ToUpper() != "FOLDOUT") + bool doprint = true; + if (itemInfo.IsSection) + { + SectionConfig sch = MyItemInfo.MyConfig as SectionConfig; + if (sch != null && sch.Section_PrintHdr != "Y") doprint = false; + } + if (doprint && itemInfo.IsSection && !itemInfo.MyDocStyle.CancelSectTitle && itemInfo.MyTab.Text.ToUpper() != "FOLDOUT") { doSectTab = true; if (itemInfo.IsStepSection && formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Just == "PSLeft") @@ -911,8 +924,6 @@ namespace Volian.Print.Library if (formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Pos != null) offset += (float)formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Pos; localXOffset = offset; - // jsj - 12Aug2011 - //localXOffset = (float)formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Pos + (float)itemInfo.MyDocStyle.Layout.LeftMargin; } } if (!itemInfo.IsSection || doSectTab) @@ -1018,9 +1029,15 @@ namespace Volian.Print.Library Width = GetTableWidth(cb, IParagraph, MyItemInfo.MyDocStyle.Layout.PageWidth); CalculateXOffset(itemInfo, maxRNO, formatInfo); } + bool printhdr = true; + if (itemInfo.Steps != null && itemInfo.IsSection && itemInfo.Sections != null && itemInfo.Sections.Count > 0) + { + SectionConfig sc = itemInfo.MyConfig as SectionConfig; + if (sc != null && sc.Section_PrintHdr != "Y") printhdr = false; + } // Determine if section title is output if (!itemInfo.IsStepSection - || (formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ShowSectionTitles + || (printhdr && formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ShowSectionTitles && !MyItemInfo.MyDocStyle.CancelSectTitle && !MyItemInfo.MyDocStyle.SpecialStepsFoldout)) { @@ -1057,10 +1074,10 @@ namespace Volian.Print.Library // Look for the meta section case where the 'Editable' flag is set to 'N', which means that // these steps should not be printed: bool printsteps = true; - if (itemInfo.Steps != null && itemInfo.IsSection) + if (itemInfo.Steps != null && itemInfo.IsSection && itemInfo.Sections!=null && itemInfo.Sections.Count>0) { SectionConfig sc = itemInfo.MyConfig as SectionConfig; - if (sc != null && sc.SubSection_Edit == "N") printsteps = false; + if (sc != null && sc.SubSection_Edit != "Y") printsteps = false; } if (itemInfo.Steps != null && printsteps) yoff = ChildrenBelow.Add(cb, itemInfo.Steps, XOffset, yoff, yOffRight, rnoLevel, maxRNO, formatInfo); @@ -1503,7 +1520,6 @@ namespace Volian.Print.Library float tabWidth = (myTab == null) ? 0 : myTab.Width; if (itemInfo.IsStepSection) { - if (itemInfo.MyDocStyle.CancelSectTitle) return; if (formatInfo.PlantFormat.FormatData.SectData.SectionHeader.Just == "PSLeft") XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)formatInfo.PlantFormat.FormatData.SectData.SectionHeader.Pos; return; @@ -1516,7 +1532,6 @@ namespace Volian.Print.Library Box bx = formatInfo.PlantFormat.FormatData.BoxList[(int)bxIndx]; if (bx == null) { - //float xoff = 0; if ((colOvrd??0)!=0) { // 16-bit code subtracted the left margin @@ -1528,21 +1543,13 @@ namespace Volian.Print.Library float tabOffset = (myTab == null?0: myTab.XOffset) - XOffset; XOffset = (float)colOvrd; - if (myTab != null) - { - //myTab.XOffset += (MyParent.XOffset - myTab.XOffset); - myTab.XOffset = XOffset + tabOffset; - //if (myTab.ScriptCaution) - // myTab.XOffset += 10.8F; - //myTab.XOffset += xoff; - } + if (myTab != null) myTab.XOffset = XOffset + tabOffset; return; } else XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + tabWidth + XOffsetBox; } else - //if (bx != null) XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)bx.TxtStart + tabWidth + XOffsetBox; if (myTab != null) myTab.XOffset = XOffset - tabWidth; } @@ -1551,54 +1558,37 @@ namespace Volian.Print.Library float x = 0; float xoff = 0; if ((colOvrd??0)!=0) - { x = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)colOvrd; - //xoff = (float)colOvrd; - //XOffset += xoff; - //if (myTab != null) myTab.XOffset += xoff; - } else - { x = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS; - } - - //float x = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS; - //float xoff = x - XOffset; - xoff = x - XOffset; - + + xoff = x - XOffset; // ColSByLevel will specify the column in which the High Level Step starts with // respect to the overall level calculation based on sections & meta-sections. // Only a few of the single column formats use this: WCN1, CAL1, RGEBCK - if (formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.TieTabToLevel - && itemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ShowSectionTitles - && !itemInfo.MyDocStyle.CancelSectTitle - && !(itemInfo.MyDocStyle.SpecialStepsFoldout && itemInfo.MyDocStyle.UseColSByLevel)) + if (formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.TieTabToLevel + && !(itemInfo.MyDocStyle.SpecialStepsFoldout && itemInfo.MyDocStyle.UseColSByLevel)) + { + int indxLevel = itemInfo.PrintLevel + itemInfo.CurrentSectionLevel(); + float colsbylevel = (float)formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[indxLevel % formatInfo.PlantFormat.FormatData.SectData.MetaSectionList.Count].ColSByLevel; + float seclvlindent = colsbylevel - (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS; + x = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS + seclvlindent; + xoff = x - XOffset; + if (myTab != null) myTab.XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + colsbylevel; + LeftJustifyList jstlst = formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.LeftJustifyList; + if (jstlst.Count > 0) { - int indxLevel = itemInfo.PrintLevel + itemInfo.CurrentSectionLevel(); - float colsbylevel = (float)formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[indxLevel % formatInfo.PlantFormat.FormatData.SectData.MetaSectionList.Count].ColSByLevel; - float seclvlindent = colsbylevel - (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS; - x = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS + seclvlindent; - xoff = x - XOffset; - if (myTab != null) myTab.XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + colsbylevel; - LeftJustifyList jstlst = formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.LeftJustifyList; - if (jstlst.Count > 0) - { - float leftJustifyTabSize = jstlst[indxLevel % jstlst.Count].Size ?? 0; - XOffset = myTab.XOffset + leftJustifyTabSize; - } - else - XOffset = myTab.XOffset + (myTab.Text.Length * (float)itemInfo.FormatStepData.Font.CPI) - colsbylevel; + float leftJustifyTabSize = jstlst[indxLevel % jstlst.Count].Size ?? 0; + XOffset = myTab.XOffset + leftJustifyTabSize; } - //else - //{ - // x = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS; - //} - //xoff = x - XOffset; else - { - XOffset += xoff; - if (myTab != null) myTab.XOffset += xoff; - } + XOffset = myTab.XOffset + (myTab.Text.Length * (float)itemInfo.FormatStepData.Font.CPI) - colsbylevel; + } + else + { + XOffset += xoff; + if (myTab != null) myTab.XOffset += xoff; + } } else if (itemInfo.IsRNOPart && !((ItemInfo)itemInfo.ActiveParent).IsHigh) { @@ -1608,23 +1598,24 @@ namespace Volian.Print.Library { if (myTab != null && itemInfo.IsSequential && formatInfo.PlantFormat.FormatData.SectData.UseMetaSections && formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.LeftJustifyList.Count > 0) { - int indxLevels = itemInfo.PrintLevel + itemInfo.CurrentSectionLevel(); + int indxLevels = itemInfo.PrintLevel + itemInfo.CurrentSectionLevel(); // kbr -1; LeftJustifyList jstlst = formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.LeftJustifyList; - bool foundleftj = false; float tableftadj = 0; foreach (LeftJustify lj in jstlst) { if (lj.Index == indxLevels) { - foundleftj = true; tableftadj = lj.Size ?? 0; break; } } - //float tableftadj = (jstlst[indxLevels >= jstlst.Count ? jstlst.Count - 1 : indxLevels].Size) ?? 0; - if (tableftadj != 0) tabWidth = myTab.Width = tableftadj; // (jstlst[indxLevels >= jstlst.Count ? jstlst.Count - 1 : indxLevels].Size) ?? 0; - XOffset += tabWidth; + // the order of this is important. First adjust the tab's xoffset for the width of + // the tab. The offset of text needs to be adjusted by the 'leftjustify' format variable + // if it existed for this level. myTab.XOffset += tabWidth; + if (tableftadj != 0 && myTab.Width