From bce4130e0ee7208d1d2a1fcc16545a90a17f8947 Mon Sep 17 00:00:00 2001 From: Kathy Date: Fri, 26 Oct 2012 10:35:31 +0000 Subject: [PATCH] --- PROMS/Volian.Print.Library/vlnParagraph.cs | 75 +++++++++------------- 1 file changed, 30 insertions(+), 45 deletions(-) diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index a47b6ff2..2fc22f50 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -82,7 +82,6 @@ namespace Volian.Print.Library if (childItemInfo is SectionInfo) formatInfo = (childItemInfo as SectionInfo).LocalFormat ?? formatInfo; if (rnoLevel < maxRNO && childItemInfo.RNOs != null) yoff = Math.Max(yoff, yoffRight); - vlnParagraph para = new vlnParagraph(Parent, cb, childItemInfo, xoff, yoff, rnoLevel, maxRNO, formatInfo, null, null); if (box != null && box.MyParent == null) { @@ -216,18 +215,19 @@ namespace Volian.Print.Library private void WCN_DrawBoxLines(PdfContentByte cb, ItemInfo ii, float yPageStart, float yTopMargin, float yBottomMargin, float yLocation) { if (!ii.IsStep || ii.IsCaution || ii.IsNote) return; - + + float lpi = MyPageHelper.YMultiplier == 1.0 ? SixLinesPerInch : _SevenLinesPerInch; bool savedebug = Rtf2Pdf.PdfDebug; Rtf2Pdf.PdfDebug = false; System.Drawing.Font symbFont = new System.Drawing.Font("VESymbFix", 10); iTextSharp.text.Font iSymblFont = Volian.Svg.Library.VolianPdf.GetFont(symbFont); + iSymblFont.Color = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Black)); // The vertPos array from the format defines the column locations: string[] vertPos = ii.MyHLS.FormatStepData.VertPos.Split(",".ToCharArray()); // Count how many vertical lines are in the checklist table: int cntVertPos = vertPos.Length - 1; while (vertPos[cntVertPos] == "0" && cntVertPos > 0) cntVertPos--; cntVertPos++; - Paragraph paraVertLine = new Paragraph(ii.ActiveFormat.PlantFormat.FormatData.BoxList[0].BXVert, iSymblFont); float lWidth = 100; float csize = 6 - .3f; // added the .3 to make line up with 16bit. @@ -255,13 +255,13 @@ namespace Volian.Print.Library } // get first and last vertpos for location of lines: // for each line of text, draw the start & end box line: - countLine = (int)(this.Height / 12) - countLine; - float yLocVertLine = yLocation - 6; + countLine = (int)(this.Height / lpi) - countLine; + float yLocVertLine = yLocation - lpi/2; 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; + yLocVertLine -= lpi; } } else @@ -281,11 +281,11 @@ namespace Volian.Print.Library { // first do the vertical bars. float curY = yLocation; - while (curY > (yPageStart - this.YBottomMost + 12)) + while (curY > (yPageStart - this.YBottomMost + lpi)) { for (int i = 0; i < cntVertPos; i++) Rtf2Pdf.TextAt(cb, paraVertLine, float.Parse(vertPos[i]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, curY + 3, lWidth, 100, null, yBottomMargin); - curY -= 12; + curY -= lpi; } // Now do the bottom line for this item. Paragraph crossLine = new Paragraph(bottomOfTable ? bx.BXLMID : bx.BXMID, iSymblFont); @@ -519,7 +519,7 @@ namespace Volian.Print.Library MyPageHelper.PageBookmarks.Add(MyItemInfo, ((si.DisplayNumber ?? "") == "" ? "" : si.DisplayNumber + " - ") + si.DisplayText, null); } // Only do foldout page if not done for section break, i.e. check the there's a previous step. - if (MyItemInfo.MyPrevious != null && (MyItemInfo.ActiveSection.MyDocStyle.StructureStyle.Style ?? 0 & E_DocStructStyle.UseSectionFoldout) != 0) + if (MyItemInfo.MyPrevious != null && (((MyItemInfo.ActiveSection.MyDocStyle.StructureStyle.Style ?? 0 & E_DocStructStyle.UseSectionFoldout) != 0))) // || MyPageHelper.DoFloatingFoldout)) PromsPrinter.DoFoldoutPage(cb, "HLS", MyPageHelper.TextLayer, MyPageHelper); yPageStart = yTopMargin + YTopMost; DoCheckOffHeader(cb, MyItemInfo, yLocation, yTopMargin, yPageStart); @@ -571,7 +571,7 @@ namespace Volian.Print.Library MyPageHelper.MySection = currentSectionInfo; #endif DebugText.WriteLine("Paginate2"); - if ((MyItemInfo.ActiveSection.MyDocStyle.StructureStyle.Style ?? 0 & E_DocStructStyle.UseSectionFoldout) != 0) + if ((MyItemInfo.ActiveSection.MyDocStyle.StructureStyle.Style ?? 0 & E_DocStructStyle.UseSectionFoldout) != 0 || MyPageHelper.DoFloatingFoldout) PromsPrinter.DoFoldoutPage(cb, "Break within Step", MyPageHelper.TextLayer, MyPageHelper); // temporary foldout // If there is a box, adjust the yTopMost to include it. float yTopMost = YTopMost; @@ -593,7 +593,7 @@ namespace Volian.Print.Library // Now check if this is a template type step & if so, add the HLS's prefix/suffix to it. if (MyItemInfo.MyHLS.FormatStepData.UseSmartTemplate) { - vlnParagraph smartPara = new vlnParagraph(MyParent.MyParent, cb, MyItemInfo.MyHLS, MyParent.XOffset, 0, 0, 0, MyParent.MyItemInfo.ActiveFormat, null, " (continued)"); + vlnParagraph smartPara = new vlnParagraph(MyParent.MyParent, cb, MyItemInfo.MyHLS, MyParent.XOffset, 0, 0, 0, MyParent.MyItemInfo.ActiveFormat, null, " (Continued)"); float mytmpfloat = smartPara.ParagraphToPdf(cb, smartPara.Height, yTopMargin, yBottomMargin); // .ToPdf(cb, 0, yTopMargin, yBottomMargin); yPageStart -= smartPara.Height; } @@ -621,7 +621,7 @@ namespace Volian.Print.Library SectionInfo si = MyItemInfo as SectionInfo; MyPageHelper.PageBookmarks.Add(MyItemInfo, ((si.DisplayNumber ?? "") == "" ? "" : si.DisplayNumber + " - ") + si.DisplayText, null); } - if ((MyItemInfo.ActiveSection.MyDocStyle.StructureStyle.Style ?? 0 & E_DocStructStyle.UseSectionFoldout) != 0) + if ((MyItemInfo.ActiveSection.MyDocStyle.StructureStyle.Style ?? 0 & E_DocStructStyle.UseSectionFoldout) != 0) // || MyPageHelper.DoFloatingFoldout) PromsPrinter.DoFoldoutPage(cb, "HLS (7 lpi) break", MyPageHelper.TextLayer, MyPageHelper); } if (MyItemInfo.MyParent != null && MyItemInfo.MyParent.IsStepSection && @@ -947,6 +947,14 @@ namespace Volian.Print.Library if (mytab.MyMacro != null) PartsLeft.Add(mytab.MyMacro); } } + // if this is the High Level RNO step (MyTopRNO) and we are numbering the RNO, adjust the xoffset to start the tab + // at the x location rather than starting the text at the x location: + if (!itemInfo.IsSection && itemInfo.FormatStepData.NumberHighLevel && itemInfo.IsRNOPart && itemInfo.ItemID == MyTopRNO.MyItemInfo.ItemID) + { + // adjust the x-offset of the RNO to include the tab. + mytab.XOffset += mytab.Width; + XOffset = mytab.XOffset + mytab.Width; + } AdjustWidth(itemInfo, maxRNO, formatInfo, mytab); AdjustXOffsetForTab(itemInfo, maxRNO, formatInfo, mytab, xMetaAdj); if (itemInfo.MyHeader != null && itemInfo.MyHeader.Text != null && !doSectTab) @@ -1070,7 +1078,7 @@ namespace Volian.Print.Library // Need the following with some modifications for WCNCKL format: if (Rtf.Contains("{Backspace}")) { - XOffset -= 22; + XOffset -= 25; Width += 24; Rtf = Rtf.Replace("{Backspace}", ""); } @@ -1590,6 +1598,7 @@ namespace Volian.Print.Library System.Drawing.Font myFont = vlntxt.TextFont.WindowsFont; if (!itemInfo.IsTable && StepRTB.MyFontFamily != null) myFont = new System.Drawing.Font(StepRTB.MyFontFamily, myFont.Size, myFont.Style); + if (itemInfo.IsHigh && itemInfo.MyDocStyle.UndSpecialStepsFoldout) myFont = new System.Drawing.Font(myFont.FontFamily, myFont.Size, myFont.Style | FontStyle.Underline); _RtfSB.Append(AddFontTable(myFont)); _RtfSB.Append(vlntxt.StartText); @@ -1693,9 +1702,15 @@ namespace Volian.Print.Library } } + public float SmartTemplateAdjust + { + // If we're in a smart template (WCNCKL checklists) then account for the bottom line in the + // table. + get { return (MyItemInfo.IsHigh && MyItemInfo.FormatStepData.UseSmartTemplate) ? SixLinesPerInch : 0; } + } public float YSize // How big this paragraph is with all of its children { - get { return _YBottomMost - _YTopMost; } + get { return SmartTemplateAdjust + _YBottomMost - _YTopMost; } } private ItemInfo _MyItemInfo; public ItemInfo MyItemInfo @@ -2074,7 +2089,7 @@ namespace Volian.Print.Library private float GetWidthFromTemplate(ItemInfo itemInfo, FormatInfo formatInfo) { float rtnwid = 0; - int tpIndx = GetSmartTemplateIndex(itemInfo, itemInfo.MyContent.Type, formatInfo); + int tpIndx = itemInfo.GetSmartTemplateIndex(); if (tpIndx != -1) { int ncol = formatInfo.PlantFormat.FormatData.Templates[tpIndx].width; @@ -2083,36 +2098,6 @@ namespace Volian.Print.Library } return rtnwid; } - private int GetSmartTemplateIndex(ItemInfo itemInfo, int? type, FormatInfo formatInfo) - { - int indx = 0; - // find the starting template in the list for the high level step type: - int highType = (int)itemInfo.MyHLS.MyContent.Type-20001; - while (indx < formatInfo.PlantFormat.FormatData.Templates.Count) - { - // level of 0 starts a new group. - if (formatInfo.PlantFormat.FormatData.Templates[indx].level == 0) - { - indx++; - // now see if we're on the high level step type, if so, look under this one - // for the step type that we're on. If found return the index of it. - if (formatInfo.PlantFormat.FormatData.Templates[indx].type == highType) - { - indx++; - while (indx < formatInfo.PlantFormat.FormatData.Templates.Count && formatInfo.PlantFormat.FormatData.Templates[indx].level != 0) - { - if (formatInfo.PlantFormat.FormatData.Templates[indx].type == type - 20001) - return indx; - indx++; - } - } - } - else - indx++; - } - return -1; // didn't find this step type in the template width override list. - } - private float AdjustForSectionLevelTab() { string sectTab = MyItemInfo.ActiveSection.MyTab.CleanText.TrimEnd();