diff --git a/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs b/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs index f0729510..f6582616 100644 --- a/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs +++ b/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs @@ -3348,6 +3348,14 @@ namespace VEPROMS.CSLA.Library return LazyLoad(ref _TofCLineSpacing, "@TofCLineSpacing"); } } + private LazyLoad _TofCNumLevels; + public int? TofCNumLevels + { + get + { + return LazyLoad(ref _TofCNumLevels, "@TofCNumLevels"); + } + } private VE_Font _Font; public VE_Font Font { diff --git a/PROMS/Volian.Print.Library/PromsPrinter.cs b/PROMS/Volian.Print.Library/PromsPrinter.cs index a29ce4ba..83f314df 100644 --- a/PROMS/Volian.Print.Library/PromsPrinter.cs +++ b/PROMS/Volian.Print.Library/PromsPrinter.cs @@ -613,6 +613,7 @@ namespace Volian.Print.Library float numwidth = width; float yBottomMargin = yPageStart - (float)tocSection.MyDocStyle.Layout.PageLength + (2 * vlnPrintObject.SixLinesPerInch); Rtf2Pdf.Offset = new PointF(0, 2.5F); + // for indenting of subsections, count up tree. Only start indenting // at third level, i.e. not indent on 1.0 and 1.1, but indent on 1.1.1: int level = 0; @@ -622,8 +623,13 @@ namespace Volian.Print.Library level++; iilvl = iilvl.MyParent; } + // check what level the plant wants the auto ToC indented: + int tofCNumLevels = tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCNumLevels ?? 0; + if (tofCNumLevels > 0 && level > tofCNumLevels) return yLocation; + level = level <= 2 ? 0 : level - 2; // no indenting until third level float indentOffset = (level * (secTitlePos - secNumPos)); + float retval = Rtf2Pdf.TextAt(cb, myparagraphn, leftMargin + secNumPos + indentOffset, yPageStart - yLocation, width * 1.3F, height, "", yBottomMargin); if (retval == 0) // do a newpage, it couldn't fit on current page. { diff --git a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs index a4f967e0..01fcbd1d 100644 --- a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs +++ b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs @@ -658,8 +658,12 @@ namespace Volian.Print.Library public string PageListLastCheckOffHeader = null; public SvgText PageListCheckOffHeader = null; + public Dictionary PgLogicals; private void AddPageListItems(Volian.Svg.Library.Svg mySvg, VEPROMS.CSLA.Library.PageStyle pageStyle, VEPROMS.CSLA.Library.SectionInfo section) { + if (PgLogicals == null) PgLogicals = new Dictionary(); + else PgLogicals.Clear(); + PageListCheckOffHeader = null; // If this is a continuous section, then the only pagelist items we want are section type since // we are still on the same page. - CHECK IF ON SAME PAGE!!!! @@ -724,6 +728,7 @@ namespace Volian.Print.Library int eindx = token.IndexOf("}", bindx); val = token.Substring(bindx + 1, eindx - bindx - 1); } + if (val != null && val != "") PgLogicals.Add(pstok, val != null); //if (val == null || val == "") //val = " "; if (val == null) @@ -951,20 +956,38 @@ namespace Volian.Print.Library if (procConfig != null) { int indx = token.IndexOf("-"); - string val = procConfig.GetValue("PSI", token.Substring(4, token.Length - 5)); - plstr = plstr.Replace(token, val); - //svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token.Replace(token, val))); + int qindx = token.IndexOf("?", indx); + string val = null; + if (qindx == -1) + { + val = procConfig.GetValue("PSI", token.Substring(4, token.Length - 5)); + plstr = plstr.Replace(token, val); + svgGroup.Add(PageItemToSvgText(pageItem, plstr, MySection)); + } + else + { + string pstok = token.Substring(indx + 1, qindx - indx - 1); + plstr = procConfig.GetValue("PSI", pstok); + // the first part of the string between the ? and ' ' is the other logical + // to see if it's on. If on, just use col and/or row as defined. Otherwise use + // value between = and |. + int sindx2 = token.IndexOf(" ", qindx); + string logcheck = token.Substring(qindx + 1, sindx2 - qindx - 1); + if (PgLogicals.ContainsKey(logcheck)) + { + int bindx = token.IndexOf("|", indx); + string newval = token.Substring(sindx2 + 1, bindx - sindx2 - 1); + float col = pageItem.Col ?? 0; + if (newval.ToUpper().Contains("COL")) + { + col = System.Convert.ToInt32(newval.Substring(4)); + } + svgGroup.Add(PageItemToSvgText(pageItem.Token, pageItem.Row ?? 0, col, pageItem.Justify ?? VEPROMS.CSLA.Library.E_Justify.PSLeft, pageItem.Font, plstr, MySection)); + plstr = ""; // clear so it doesn't get added twice, i.e. in the method that calls this. + } + } } } - //else if (token.Contains(@"{DRV:Lpi ")) - //{ - // int indx = token.IndexOf("{DRV:Lpi ") + 9; - // int endindx = token.IndexOf("}", indx); - // string str = token.Substring(indx, endindx - indx); - // curLPI = Convert.ToInt32(str) / 2; - // //PrevRow = (float)(pageItem.Row + rowAdj); - // PrevRow = (float)pageItem.Row; - //} else { if (plstr != "") @@ -1256,6 +1279,47 @@ namespace Volian.Print.Library if (svgText.Font.Underline && svgText.Text.EndsWith(" ")) svgText.Text = svgText.Text.Substring(0, svgText.Text.Length - 1) + "\xA0";// replace last space with a hardspace return svgText; } + private SvgPart PageItemToSvgText(string token, float row, float col, E_Justify just, VE_Font font, string text, SectionInfo MySection) + { + SvgText svgText = new SvgText(); + svgText.Text = text; + VEPROMS.CSLA.Library.E_Justify justify = just; + float colAdj16bit = 0; + if ((justify & VEPROMS.CSLA.Library.E_Justify.PSLeft) == VEPROMS.CSLA.Library.E_Justify.PSLeft) + svgText.Justify = SvgJustify.Left; + else if ((justify & VEPROMS.CSLA.Library.E_Justify.PSRight) == VEPROMS.CSLA.Library.E_Justify.PSRight) + svgText.Justify = SvgJustify.Right; + else + { + svgText.Justify = SvgJustify.Center; + if (((justify & VEPROMS.CSLA.Library.E_Justify.PSTrue) != VEPROMS.CSLA.Library.E_Justify.PSTrue) && + !MySection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.PicaIgnoreFiveSixths) + { + // the default CPI for Proms is 12, in 16bit 12 is the default - if a font wasn't defined + // or when doing a positioning calculation 12 was used. So we need to make an adjustment + // to handle non-12 CPI (12CPI will just cancel out in the following calculation). + + // Take the difference between the width in Points of a character at 12CPI and a character + // at the defined font's CPI. Multiply that times the length of title and divide by two + // to find the half-way point. + colAdj16bit = (1 + text.Length) * ((72 / (float)font.CPI) - (72 / 12)) / 2; + } + } + float lcol = col; + + // the column may need adjusted based on the document styles PageWidth. This was done in + // the 16bit code and was needed here to get the printed output to match. + if (font.FontIsProportional() && svgText.Justify == SvgJustify.Center) + { + int dotsPerChar = (int)(2400 / (MySection.MyDocStyle.Layout.PageWidth / 6)); + lcol = (lcol * 25) / dotsPerChar; + } + svgText.Font = font.WindowsFont; + svgText.X = new SvgMeasurement((float)lcol - colAdj16bit, E_MeasurementUnits.PT); // new SvgMeasurement((float)(pageItem.Col ?? 0), E_MeasurementUnits.PT); + svgText.Y = new SvgMeasurement(row, E_MeasurementUnits.PT); + if (svgText.Font.Underline && svgText.Text.EndsWith(" ")) svgText.Text = svgText.Text.Substring(0, svgText.Text.Length - 1) + "\xA0";// replace last space with a hardspace + return svgText; + } private static List _MissingTokens = new List(); protected override string ReplacePageListToken(Match match) { diff --git a/PROMS/fmtxml/WST1all.xml b/PROMS/fmtxml/WST1all.xml index 9ed43587..ad9de278 100644 Binary files a/PROMS/fmtxml/WST1all.xml and b/PROMS/fmtxml/WST1all.xml differ diff --git a/PROMS/fmtxml/WST2all.xml b/PROMS/fmtxml/WST2all.xml index db2c00b2..e92cde81 100644 Binary files a/PROMS/fmtxml/WST2all.xml and b/PROMS/fmtxml/WST2all.xml differ diff --git a/PROMS/fmtxml/WSTBCKall.xml b/PROMS/fmtxml/WSTBCKall.xml index 65773ea9..104e8bba 100644 Binary files a/PROMS/fmtxml/WSTBCKall.xml and b/PROMS/fmtxml/WSTBCKall.xml differ diff --git a/PROMS/fmtxml/WSTDCSall.xml b/PROMS/fmtxml/WSTDCSall.xml index 92e4ac17..922f1c80 100644 Binary files a/PROMS/fmtxml/WSTDCSall.xml and b/PROMS/fmtxml/WSTDCSall.xml differ