diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index c80b8991..36442333 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -209,11 +209,10 @@ namespace Volian.Print.Library //if (localYPageStart != yPageStart) DebugText.WriteLine("ParToPdf-yPagestartDiff:{0},{1},{2}", MyItemInfo.ItemID, localYPageStart, yPageStart); return yPageStart; } - // A few things need completed for the WCNCHK format check list boxes: - // 1) for HLS, draw enough vertical lines if the HLS is more than 1 line. - // 2) support pagination. This includes tacking on a continued message, breaking table where necessary + // A few things need completed for the WCNCKL format check list boxes: + // 1) support pagination. This includes tacking on a continued message, breaking table where necessary // and putting HLS on top of next page, along with its prefix/suffix. - // 3) support seven lines per inch - right now increments are hard coded at 12 = one line. + // 2) support seven lines per inch - right now increments are hard coded at 12 = one line. private void WCN_DrawBoxLines(PdfContentByte cb, ItemInfo ii, float yPageStart, float yTopMargin, float yBottomMargin, float yLocation) { if (!ii.IsStep || ii.IsCaution || ii.IsNote) return; @@ -235,13 +234,34 @@ namespace Volian.Print.Library // if High Level Step, just need to do edges for number of lines: if (ii.IsHigh) { + // count # of '{\par} commands in prefix and suffix. + int countLine = 0; + string preSuf_Fix = (ii.FormatStepData.Prefix != null && ii.FormatStepData.Prefix != "") ? ii.FormatStepData.Prefix : null; + if (preSuf_Fix != null) countLine++; // account for a line of prefix (if no \par) + int hIndx = preSuf_Fix.IndexOf(@"{\par}"); + while (preSuf_Fix != null && hIndx >= 0) + { + hIndx = preSuf_Fix.IndexOf(@"{\par}", hIndx + 1); + countLine++; + } + preSuf_Fix = (ii.FormatStepData.Suffix != null && ii.FormatStepData.Suffix != "") ? ii.FormatStepData.Suffix : null; + if (preSuf_Fix != null) countLine++; // account for a line of suffix (if no \par) + hIndx = preSuf_Fix.IndexOf(@"{\par}"); + while (preSuf_Fix != null && hIndx >= 0) + { + hIndx = preSuf_Fix.IndexOf(@"{\par}", hIndx + 1); + countLine++; + } // get first and last vertpos for location of lines: // for each line of text, draw the start & end box line: - // TODO: this needs to be in a loop to get enough of vertical lines if the HLS is more than 1 line: - // Note that, for loop, the top & bottom values for paragraph include the header text, i.e. the - // box and the table headers - so these can't be used to get number of lines. - Rtf2Pdf.TextAt(cb, paraVertLine, float.Parse(vertPos[0]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yLocation - 6, lWidth, 100, null, yBottomMargin); - Rtf2Pdf.TextAt(cb, paraVertLine, float.Parse(vertPos[cntVertPos - 1]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yLocation - 6, lWidth, 100, null, yBottomMargin); + countLine = (int)(this.Height / 12) - countLine; + float yLocVertLine = yLocation - 6; + for (int i = 0; i < countLine; i++) + { + Rtf2Pdf.TextAt(cb, paraVertLine, float.Parse(vertPos[0]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yLocVertLine, lWidth, 100, null, yBottomMargin); + Rtf2Pdf.TextAt(cb, paraVertLine, float.Parse(vertPos[cntVertPos - 1]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yLocVertLine, lWidth, 100, null, yBottomMargin); + yLocVertLine -= 12; + } } else { @@ -567,6 +587,10 @@ namespace Volian.Print.Library MyPageHelper.TopMessage = new vlnText(cb, this, myMsg, myMsg, docstyle.Layout.LeftMargin + XOffsetBox + docstyle.Continue.Top.Margin ?? 0, yTopMargin + 0.1F, docstyle.Continue.Top.Font);// MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font); } 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) + yPageStart = this.MyParent.DrawText(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation); break; case 3: // Break on High Level Step (SevenLinesPerInch) if (!firstHighLevelStep) @@ -1093,6 +1117,19 @@ namespace Volian.Print.Library float xloc_co = (float)itemInfo.MyDocStyle.Layout.LeftMargin; if (formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.XLocation != null) xloc_co += (float)formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.XLocation; + // 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) + { + int cntspac = 0; + xloc_co = mytab.XOffset; + for (int c = 0; c < itemInfo.MyTab.CleanText.Length; c++) if (itemInfo.MyTab.CleanText[c] == ' ') cntspac++; + xloc_co = xloc_co - (cntspac * 6); + } + } + PartsRight.Add(new vlnMacro(xloc_co, yForCheckoff, co.Macro)); } float yOffRight = yoff; @@ -1102,7 +1139,7 @@ namespace Volian.Print.Library // use YOffRight rather than yoff if (itemInfo.Tables != null) { - bool aerTableOrFigure = itemInfo.FormatStepData.Type.Contains("AER"); + bool aerTableOrFigure = itemInfo.Tables[0].FormatStepData.Type.Contains("AER"); // get the first table & see if it is borderless. If borderless, 16bit code removed a // line (yoffset) before printing it: float yoffadj = 0; @@ -1110,11 +1147,13 @@ namespace Volian.Print.Library { VlnFlexGrid fg = new VlnFlexGrid(1, 1); fg.LoadGrid(itemInfo.Tables[0]); - if (fg.BorderStyle == C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.None) yoffadj = -SixLinesPerInch; + if (fg.BorderStyle == C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.None && !fg.TopRowHasBorder()) + yoffadj = -SixLinesPerInch; } - + + bool rightLonger = yOffRight > yoff; if(!aerTableOrFigure && itemInfo.RNOLevel == 0) // Centered Table - yoff = ChildrenBelow.Add(cb, itemInfo.Tables, XOffset, yOffRight + yoffadj, yOffRight + yoffadj, rnoLevel, maxRNO, formatInfo); + yoff = ChildrenBelow.Add(cb, itemInfo.Tables, XOffset, rightLonger?yOffRight:yoff + yoffadj, yOffRight + yoffadj, rnoLevel, maxRNO, formatInfo); else // AER or RNO Table yoff = ChildrenBelow.Add(cb, itemInfo.Tables, XOffset, yoff + yoffadj, yOffRight + yoffadj, rnoLevel, maxRNO, formatInfo); }