diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index 3d69120c..f57de720 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -201,7 +201,7 @@ namespace Volian.Print.Library //if (localYPageStart != yPageStart) DebugText.WriteLine("ParToPdf-yPagestartDiff:{0},{1},{2}", MyItemInfo.ItemID, localYPageStart, yPageStart); return yPageStart; } - + private float DrawGrid(PdfContentByte cb, ref float yPageStart, float yTopMargin, float yBottomMargin, ref float yLocation) { //DebugText.WriteLine("{0},'{1}','{2}','<>'", MyItemInfo.ItemID, MyItemInfo.ShortPath, FormattedText); @@ -652,6 +652,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) { + int MetaLevel = 0; // if meta section, stores what level this section is. float savCheckListBottomMost = 0; //int[] problemIDs = { 889 }; //List lProblemIDs = new List(problemIDs); @@ -694,6 +695,8 @@ namespace Volian.Print.Library itemInfo.FormatStepData.StepLayoutData.AlignWithParentTab || (itemInfo.Steps != null && itemInfo.Steps.Count > 0 && itemInfo.Steps[0].FormatStepData.StepLayoutData.AlignWithParentTab)) itemInfo.MyTab = null; + + float xMetaAdj = 0; if (itemInfo.MyTab != null && itemInfo.MyTab.Text != null && itemInfo.MyTab.Text != "") { float localXOffset = XOffset; @@ -715,20 +718,31 @@ namespace Volian.Print.Library float offset = (float)itemInfo.MyDocStyle.Layout.LeftMargin; if (formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Pos != null) { - // determine level of metasections. This level will be used to calculate the - // indent. DO I NEED THIS HERE???? - int level = 0; ItemInfo iilvl = itemInfo; while (!iilvl.IsProcedure) { - level++; + // see if this metasection, walking up the tree, has its header printed, + // if so, indent for it. + SectionConfig sch1 = iilvl.MyConfig as SectionConfig; + if (sch1.Section_PrintHdr == "Y" || MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseMetaSections) MetaLevel++; iilvl = iilvl.MyParent; } - level = level <= 2 ? 1 : level - 1; - if (level == 1) + MetaLevel = MetaLevel <= 2 ? 1 : MetaLevel - 1; + if (MetaLevel == 1) offset += (float)formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Pos; else - offset += (level-1) * ((float)formatInfo.PlantFormat.FormatData.SectData.SectionHeader.Pos-(float)formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Pos); + { + xMetaAdj = (float)formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[0].ColSByLevel; + for (int i = 0; i < MetaLevel; i++) + { + xMetaAdj += (float)formatInfo.PlantFormat.FormatData.SectData.SectionHeader.Pos - (float)formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Pos; + xMetaAdj += (float)formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[i].SecNumPositionAdj; + + } + offset += xMetaAdj; + itemInfo.MyTab.Text = itemInfo.MyTab.Text.TrimEnd(" ".ToCharArray()); + itemInfo.MyTab.CleanText = itemInfo.MyTab.CleanText.TrimEnd(" ".ToCharArray()); + } } localXOffset = offset; } @@ -741,7 +755,7 @@ namespace Volian.Print.Library } } AdjustWidth(itemInfo, maxRNO, formatInfo, mytab); - AdjustXOffsetForTab(itemInfo, maxRNO, formatInfo, mytab); + AdjustXOffsetForTab(itemInfo, maxRNO, formatInfo, mytab, xMetaAdj); if (itemInfo.MyHeader != null && itemInfo.MyHeader.Text != null && !doSectTab) yoff += SetHeader(this, cb, itemInfo, formatInfo); if (itemInfo.Cautions != null && !(itemInfo.IsCaution || itemInfo.IsNote)) @@ -905,6 +919,7 @@ namespace Volian.Print.Library yoff += AdjustForBlankLines(); if (dropCheckoff) yForCheckoff += Height - SixLinesPerInch; // place checkoff on last row of text + } } CheckOff co = itemInfo.GetCheckOffStep(); @@ -1567,7 +1582,7 @@ namespace Volian.Print.Library return _ChildrenLeft; } } - public void AdjustXOffsetForTab(ItemInfo itemInfo, int maxRNO, FormatInfo formatInfo, vlnTab myTab) + public void AdjustXOffsetForTab(ItemInfo itemInfo, int maxRNO, FormatInfo formatInfo, vlnTab myTab, float xMetaAdj) { float tabWidth = (myTab == null) ? 0 : myTab.Width; if (itemInfo.IsStepSection) @@ -1582,10 +1597,14 @@ namespace Volian.Print.Library iilvl = iilvl.MyParent; } level = level <= 2 ? 1 : level - 1; - if (level==1) + if (level == 1) XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (level * (float)formatInfo.PlantFormat.FormatData.SectData.SectionHeader.Pos); else + { XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[level].ColSByLevel; + XOffset += (float)formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[level].SecTitlePositionAdj; + XOffset -= xMetaAdj; + } } return; } @@ -1637,15 +1656,14 @@ namespace Volian.Print.Library 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; - } + float adjCols = (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS + seclvlindent; + float xtabcol = adjCols - (myTab.Text.Length * 7.2f); + if (indxLevel > 1 && myTab != null) myTab.XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + xtabcol; + else if (myTab != null) myTab.XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + colsbylevel; + myTab.Rtf = myTab.Rtf.Replace(myTab.Text, myTab.Text.TrimStart(" ".ToCharArray())); + if (formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.LeftJustifyList != null && + formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.LeftJustifyList.Count > 0) + XOffset = myTab.XOffset + GetLeftJustify(formatInfo, indxLevel); else XOffset = myTab.XOffset + (myTab.Text.Length * (float)itemInfo.FormatStepData.Font.CPI) - colsbylevel; } @@ -1667,17 +1685,8 @@ 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(); // kbr -1; - LeftJustifyList jstlst = formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.LeftJustifyList; - float tableftadj = 0; - foreach (LeftJustify lj in jstlst) - { - if (lj.Index == indxLevels) - { - tableftadj = lj.Size ?? 0; - break; - } - } + int indxLevels = itemInfo.PrintLevel + itemInfo.CurrentSectionLevel(); + float tableftadj = GetLeftJustify(formatInfo, indxLevels); // 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. @@ -1695,6 +1704,21 @@ namespace Volian.Print.Library } } } + + private static float GetLeftJustify(FormatInfo formatInfo, int indxLevels) + { + LeftJustifyList jstlst = formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.LeftJustifyList; + float tableftadj = 0; + foreach (LeftJustify lj in jstlst) + { + if (lj.Index == indxLevels) + { + tableftadj = lj.Size ?? 0; + break; + } + } + return tableftadj; + } public void AdjustWidth(ItemInfo itemInfo, int maxRNO, FormatInfo formatInfo, vlnTab myTab) { int typ = ((int)itemInfo.MyContent.Type) % 10000; diff --git a/PROMS/Volian.Print.Library/vlnTab.cs b/PROMS/Volian.Print.Library/vlnTab.cs index 38ad47b6..50ed9201 100644 --- a/PROMS/Volian.Print.Library/vlnTab.cs +++ b/PROMS/Volian.Print.Library/vlnTab.cs @@ -245,7 +245,12 @@ namespace Volian.Print.Library // do positioning based on whether format has locations for section 'header'. If it's not centered, treat // it's location more like a 'tab'. if (doSectTab) + { XOffset = xoffset; + // the width was just a little small, so it was wrapping - but only if there were no spaces at end + // so use this condition to do minimal impact (WCN1 format, for section tabs with three places, i.e. 6.1.2 + if (!cleanTab.EndsWith(" "))Width += .1f; + } else { //if (MyFont.Family == "Arial" && MyFont.Size == 14)