From b205e6bb4d472256a71e18287b6d98025367f9df Mon Sep 17 00:00:00 2001 From: Kathy Date: Tue, 25 Mar 2014 12:07:45 +0000 Subject: [PATCH] Implement NumberWithLevel flag to create correct tabs in RNO column add NumberWithLevel format flag Handle double spacing (flag) in Table of Contents Draw double lined box around High Level Steps (only HLS, not substep) Double Lined box; Caution & Notes xoffsets and widths for printing in column (not across page); NumberWithLevel support (xoffsets); Align1StLevSubWHLS (format flag support); XBlankW1stLevSub adds extra line after 1st substep procdesr pagelist include check for dashes in procedure number --- .../VEPROMS.CSLA.Library/Extension/ItemExt.cs | 15 +++- .../Format/PlantFormat.cs | 8 ++ PROMS/Volian.Print.Library/PromsPrinter.cs | 9 +- .../Volian.Print.Library/VlnSvgPageHelper.cs | 7 +- PROMS/Volian.Print.Library/vlnBox.cs | 35 +++++++- PROMS/Volian.Print.Library/vlnParagraph.cs | 87 ++++++++++++++----- 6 files changed, 128 insertions(+), 33 deletions(-) diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index 4f0fbcae..0704b7ca 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -2597,11 +2597,24 @@ namespace VEPROMS.CSLA.Library { try { + // NumberWithLevel flag is used by BGE. It does tabbing in rno column by incrementing of rno and rno substeps + if (FormatStepData.NumberWithLevel) + { + int ord = Ordinal - 1; + string incSub = Ordinal.ToString(); + // get previous's tab & increment from it. + if (MyParent != null && MyParent.IsRNOPart) + ord = System.Convert.ToInt32(MyParent.MyTab.CleanText.Substring(MyParent.MyTab.CleanText.LastIndexOf(".") + 1)); + incSub = (ord + 1).ToString(); + _MyTab.CleanText = MyParent.MyTab.CleanText.Substring(0, MyParent.MyTab.CleanText.IndexOf(".") + 1) + incSub; + _MyTab.Text = MyParent.MyTab.CleanText.Substring(0, MyParent.MyTab.Text.IndexOf(".") + 1) + incSub; + return; + } if ((((ItemInfo)ActiveParent).IsHigh && FormatStepData.NumberHighLevel) || ((!((ItemInfo)ActiveParent).IsHigh) && ((tbformat == null || tbformat == "") && (RNOLevel <= ColumnMode)))) { _MyTab.CleanText = ((ItemInfo)ActiveParent).MyTab.CleanText; _MyTab.Text = ((ItemInfo)ActiveParent).MyTab.Text; - _MyTab.RNOTabWidthAdjust = ((ItemInfo)ActiveParent).FormatStepData.TabData.RNOAdjustTabSize??0; + _MyTab.RNOTabWidthAdjust = ((ItemInfo)ActiveParent).FormatStepData.TabData.RNOAdjustTabSize ?? 0; if (((ItemInfo)ActiveParent).MyTab.Offset != 0) _MyTab.Offset = ((ItemInfo)ActiveParent).MyTab.Offset; if (((ItemInfo)ActiveParent).FormatStepData.TabData.RNOExcludeMacros) _MyTab.Text = Regex.Replace(_MyTab.Text, "{!.+?}", " "); diff --git a/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs b/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs index 73836ef3..359b4296 100644 --- a/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs +++ b/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs @@ -4125,6 +4125,14 @@ namespace VEPROMS.CSLA.Library return LazyLoad(ref _NumberHighLevel, "@NumberHighLevel"); } } + private LazyLoad _NumberWithLevel; + public bool NumberWithLevel + { + get + { + return LazyLoad(ref _NumberWithLevel, "@NumberWithLevel"); + } + } private LazyLoad _OffsetTab; public bool OffsetTab { diff --git a/PROMS/Volian.Print.Library/PromsPrinter.cs b/PROMS/Volian.Print.Library/PromsPrinter.cs index 0c098cfd..b54e793b 100644 --- a/PROMS/Volian.Print.Library/PromsPrinter.cs +++ b/PROMS/Volian.Print.Library/PromsPrinter.cs @@ -775,8 +775,9 @@ namespace Volian.Print.Library width = secPagePos - adjSecTitlePos - 6; retval = Rtf2Pdf.TextAt(cb, myparagrapht, leftMargin + adjSecTitlePos, yPageStart - yLocation, width, height, "", yBottomMargin); // add a template for the page number: - if (lastyLocation != 0 && ((lastyLocation - retval) > vlnPrintObject.SixLinesPerInch)) - yLocation += (lastyLocation - retval - vlnPrintObject.SixLinesPerInch); + float lSpace = (tOfC.TofCLineSpacing == 2) ? 2 * vlnPrintObject.SixLinesPerInch : vlnPrintObject.SixLinesPerInch; + if (lastyLocation != 0 && ((lastyLocation - retval) > lSpace)) + yLocation += (lastyLocation - retval - lSpace); lastyLocation = retval; // if the space character is not null & is not a space, the we've got to put out @@ -817,8 +818,8 @@ namespace Volian.Print.Library } else AddTemplateTOCPageCounts(tOfC, yLocation, yPageStartAdj, leftMargin, secPagePos, height, mySection); - - yLocation += vlnPrintObject.SixLinesPerInch; + + yLocation += (tOfC.TofCLineSpacing == 2 ? 2 * vlnPrintObject.SixLinesPerInch : vlnPrintObject.SixLinesPerInch); } yLocation = AddSectionToTOC(tocSection, mySection, tOfC, cb, yPageStart, yLocation); } diff --git a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs index 296e47b7..7d35d3ab 100644 --- a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs +++ b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs @@ -1208,10 +1208,7 @@ namespace Volian.Print.Library ProcDescrList pdl = section.ActiveFormat.PlantFormat.FormatData.PrintData.ProcDescrList; if (pdl != null && pdl.Count > 0) { - // the following line is needed for FNP: a checkin needed to be done for Robinson and - // did not want to include the commented out lines in this 'case' statement group: - //string procnum = section.MyProcedure.MyContent.Number.Replace(@"\u8209?", "-"); // uncomment for FNP - string procnum = section.MyProcedure.MyContent.Number; + string procnum = section.MyProcedure.MyContent.Number.Replace(@"\u8209?", "-"); foreach (ProcDescr pd in pdl) { if (pd.MatchProcNumber != null) @@ -1243,7 +1240,7 @@ namespace Volian.Print.Library ProcDescrList pdl2 = section.ActiveFormat.PlantFormat.FormatData.PrintData.ProcDescrList; if (pdl2 != null && pdl2.Count > 0) { - string procnum = section.MyProcedure.MyContent.Number; + string procnum = section.MyProcedure.MyContent.Number.Replace(@"\u8209?", "-"); foreach (ProcDescr pd in pdl2) { if (pd.MatchProcNumber != null) diff --git a/PROMS/Volian.Print.Library/vlnBox.cs b/PROMS/Volian.Print.Library/vlnBox.cs index 62767e6e..c6a16828 100644 --- a/PROMS/Volian.Print.Library/vlnBox.cs +++ b/PROMS/Volian.Print.Library/vlnBox.cs @@ -47,6 +47,13 @@ namespace Volian.Print.Library get { return _ContainsPageBreak; } set { _ContainsPageBreak = value; } } + private bool _DoubleBoxHls = false; // BGE double lined box around HLS + public bool DoubleBoxHls + { + get { return _DoubleBoxHls; } + set { _DoubleBoxHls = value; } + } + public const string DOUBLEboxHLS = "DoubleBox"; //private bool _DoBottom = true; public vlnBox() { @@ -89,11 +96,15 @@ namespace Volian.Print.Library iTextSharp.text.Color boxColor = new iTextSharp.text.Color(PrintOverride.OverrideBoxColor(System.Drawing.Color.Black)); cb.SetColorStroke(boxColor); _MyPageHelper.MyGaps.Add(top, top - Height); - if (DefBox != null) + if (DefBox != null && DefBox != vlnBox.DOUBLEboxHLS) { cb.SetLineWidth(.6F); cb.Rectangle(left, bottom, right - left, Height * MyPageHelper.YMultiplier); } + else if (DefBox == vlnBox.DOUBLEboxHLS) + { + DrawDoubleHlsBox(cb, top, bottom, left, (float)MyParent.MyItemInfo.MyDocStyle.Layout.PageWidth); + } else { const float llxOffset = 3; @@ -170,6 +181,28 @@ namespace Volian.Print.Library return yPageStart; } + private static void DrawDoubleHlsBox(PdfContentByte cb, float top, float bottom, float left, float right) + { + float lineThickness = .6f; + float lnOff = 1.3f * vlnPrintObject.SixLinesPerInch; + cb.SetLineWidth(lineThickness); + // top (double line) + cb.MoveTo(left, top + lnOff); + cb.LineTo(right, top + lnOff); + cb.MoveTo(left + 3.6f, top + lnOff - 3); + cb.LineTo(right - 3.6f, top + lnOff - 3); + // bottom (double line) + cb.MoveTo(left, bottom - 2f); + cb.LineTo(right, bottom - 2f); + cb.MoveTo(left + 3.6f, bottom+1f); + cb.LineTo(right - 3.6f, bottom+1f); + // sides + cb.MoveTo(left + 3.6f, top + lnOff - 3); + cb.LineTo(left + 3.6f, bottom +1f); + cb.MoveTo(right - 3.6f, top + lnOff - 3); + cb.LineTo(right - 3.6f, bottom +1f); + } + private void DrawAsteriskTopBottom(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin, ref float top, ref float bottom, float left, VE_Font vef) { // this box is not drawn, it is a series of asterisks drawn above and below text. diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index e8f12ba0..54dd16a0 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -62,6 +62,7 @@ namespace Volian.Print.Library public float Add(PdfContentByte cb, ItemInfoList itemInfoList, float xoff, float yoff, float yoffRight, int rnoLevel, int maxRNO, FormatInfo formatInfo) { + bool bxHlsDraw = false; int? bxIndex = null; vlnBox box = null; float yTop = yoff; @@ -195,6 +196,15 @@ namespace Volian.Print.Library } bxIndex = bxIndx; } + // DoubleBoxHls is a format flag used by BGE to draw double lined boxes around their HLS + if (childItemInfo.IsHigh && ((childItemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DoubleBoxHLS) == E_DocStructStyle.DoubleBoxHLS)) + { + boxHLS = true; + box = new vlnBox(); + box.MyBox = new Box(); + box.DefBox = vlnBox.DOUBLEboxHLS; + bxHlsDraw = true; + } // Comanche peak or WCN bck Step designator if (childItemInfo.IsCaution2 && childItemInfo.SameRowAsParent || childItemInfo.IsCaution1 && childItemInfo.SameRowAsParent) @@ -237,7 +247,13 @@ namespace Volian.Print.Library box.Height = yoff - box.YOffset - (1.1F * vlnPrintObject.SixLinesPerInch); box = null; // if doing boxed steps, only do single sibling at a time. } - if (boxHLS) + if (bxHlsDraw) + { + box.YOffset = para.YTop; + box.Height = para.Height; + box = null; + } + else if (boxHLS) { // the following line controls whether there is 1 line or 2 lines between // the box line & the starting/ending yoffset of the HLS. WEP2 had no extra line between @@ -249,6 +265,8 @@ namespace Volian.Print.Library box = null; } } + if (childItemInfo.IsSequential && childItemInfo.NextItemCount > 0 && childItemInfo.MyParent.IsHigh && ((childItemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.XBlankW1stLevSub) == E_DocStructStyle.XBlankW1stLevSub)) + yoff += vlnPrintObject.SixLinesPerInch; boxHLS = false; lastChild = childItemInfo; } @@ -341,6 +359,8 @@ namespace Volian.Print.Library else yPageStart = PartsAbove.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin); } + + if (MyItemInfo.IsHigh && ((MyItemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DoubleBoxHLS) == E_DocStructStyle.DoubleBoxHLS)) yPageStart -= SixLinesPerInch; if (MyItemInfo.IsHigh && MyItemInfo.MyDocStyle.SpecialStepsFoldout) yPageStart -= SixLinesPerInch; if (MyItemInfo.IsHigh && !MyItemInfo.ActiveFormat.MyStepSectionLayoutData.DoSTExtraAtTop && (yPageStart - YTopMost == yTopMargin)) { @@ -984,7 +1004,8 @@ namespace Volian.Print.Library } // if there is a 'container vlnbox' around the HLS, flag that the drawn box must also break: - if (MyHighLevelParagraph != null && MyHighLevelParagraph.PartsContainer != null && MyHighLevelParagraph.PartsContainer.Count > 0) + if (MyHighLevelParagraph != null && MyHighLevelParagraph.PartsContainer != null && MyHighLevelParagraph.PartsContainer.Count > 0 && + !((MyHighLevelParagraph.MyItemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DoubleBoxHLS) == E_DocStructStyle.DoubleBoxHLS)) { foreach (vlnPrintObject vpo in MyHighLevelParagraph.PartsContainer) { @@ -1396,7 +1417,7 @@ namespace Volian.Print.Library public static VlnFlexGrid MyFlexGrid { get { return _MyFlexGrid; } - } + } public vlnParagraph(vlnParagraph parent, PdfContentByte cb, ItemInfo itemInfo, float xoff, float yoff, int rnoLevel, int maxRNO, FormatInfo formatInfo, string prefix, string suffix, float yoffRightParent) { if (itemInfo.ActiveFormat.MyStepSectionLayoutData.BoxLeftAdj != null) @@ -1584,6 +1605,19 @@ namespace Volian.Print.Library } if (adjustAgain) AdjustXOffsetForTab(itemInfo, maxRNO, formatInfo, mytab, xMetaAdj); + if ((itemInfo.IsCaution || itemInfo.IsNote) && (itemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DoubleBoxHLS) == E_DocStructStyle.DoubleBoxHLS) + { + if (itemInfo.IsInRNO) + { + XOffset = MyTopRNO.MyTab != null ? MyTopRNO.MyTab.XOffset : MyTopRNO.XOffset; + Width = MyTopRNO.Width + (MyTopRNO.MyTab != null ? MyTopRNO.MyTab.Width : 0); + } + else + { + XOffset = MyHighLevelParagraph.MyTab.XOffset; + Width = MyHighLevelParagraph.MyTab.Width + MyHighLevelParagraph.Width; + } + } if (UseTemplateWidthOrXOff(itemInfo)) XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + GetWidthOrStartFromTemplate(itemInfo, itemInfo.ActiveFormat, false); if (itemInfo.MyHeader != null && itemInfo.MyHeader.Text != null && !doSectTab) yoff += SetHeader(this, cb, itemInfo, formatInfo); @@ -1983,6 +2017,9 @@ namespace Volian.Print.Library YTopMost = ChildrenAbove[0].YOffset; } } + // if this hls had a box drawn, add a line for substeps. + if (itemInfo.IsHigh && ((itemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DoubleBoxHLS) == E_DocStructStyle.DoubleBoxHLS)) yoff += vlnPrintObject.SixLinesPerInch; + // Need code to determine if the table will overlap the Right Column if it does then // use YOffRight rather than yoff if (itemInfo.Tables != null) @@ -2584,6 +2621,10 @@ namespace Volian.Print.Library } else if (formatInfo.MyStepSectionLayoutData.Separator.Location > 0) xoff = XOffset + AdjustToCharPosition((float)((para.Width - hdrWidth) / formatInfo.MyStepSectionLayoutData.Separator.Location), itemInfo.MyHeader.MyFont.CPI); + else if (itemInfo.IsInRNO && itemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].NumberWithLevel) + xoff = XOffset + (para.Width / 2) - (hdrWidth / 2); + else if (itemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].NumberWithLevel) + xoff = XOffset + (para.Width / 2) - (hdrWidth / 2); else xoff = XOffset + (para.Width / 2) + (hdrWidth / 2); // XOffset has left margin included } @@ -2966,10 +3007,13 @@ namespace Volian.Print.Library XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)bx.TxtStart + _MyBoxLeftAdj + tabWidth + XOffsetBox; if (myTab != null) myTab.XOffset = XOffset - tabWidth; } - //else if (itemInfo.IsRNOPart && !((ItemInfo)itemInfo.ActiveParent).IsHigh) - //{ - // // don't adjust for rno - //} + else if (itemInfo.IsRNOPart && itemInfo.MyParent != null && itemInfo.MyParent.IsRNOPart && itemInfo.FormatStepData.NumberWithLevel) + { + // xoffset is same as parent RNO (this is a BGE format flag) + XOffset = MyParent.XOffset; + myTab.XOffset = MyParent.MyTab.XOffset; + return; + } else if (itemInfo.IsRNOPart && (colOvrd > 0 || !((ItemInfo)itemInfo.ActiveParent).IsHigh) && itemInfo.FormatStepData.OffsetTab) { if (colOvrd > 0) @@ -3007,6 +3051,11 @@ namespace Volian.Print.Library if (myTab.MyMacro != null && myTab.MyMacro.XOffset != 0) myTab.MyMacro.XOffset += tabWidth - myTab.TabAlign; } } + else if (itemInfo.IsSequential && itemInfo.MyParent.IsHigh && ((itemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.Align1StLevSubWHLS) == E_DocStructStyle.Align1StLevSubWHLS)) + { + XOffset = MyParent.XOffset; + if (myTab != null) myTab.XOffset = (MyParent.MyTab != null ? MyParent.MyTab.XOffset : XOffset); + } else 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(); @@ -3163,24 +3212,16 @@ namespace Volian.Print.Library float mycolT = (float)formatInfo.MyStepSectionLayoutData.ColT; if (formatInfo.MyStepSectionLayoutData.Dev_Format) Width = (float)formatInfo.MyStepSectionLayoutData.WidT + 1; - else if (itemInfo.IsInRNO)// && itemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.AdjustRNOCautionNoteWidth) + else if (itemInfo.IsInRNO) { - /* - float widadj = tabWidth; - ItemInfo pinfo = itemInfo.MyParent; - // walk up the parent nodes (but only in the RNO) and - // add the width of each tab (at each level) - // so that we can subtract it from the width of Note or Caution - // put in for Catawba and McGuire Notes/Cautions on RNO substeps - while (pinfo != null && pinfo.IsInRNO) + if (MyItemInfo.FormatStepData.CenterOneLineAdjust) { - widadj += (float)(pinfo.MyTab.Text.Length * pinfo.MyTab.MyFont.CharsToTwips); - pinfo = pinfo.MyParent; + int rnoOff = ToInt(formatInfo.MyStepSectionLayoutData.ColRTable, maxRNO); + XOffset = rnoOff + MyHighLevelParagraph.XOffset; + Width = MyParent.Width; } - Width = (float)vlnPrintObject.ToInt(formatInfo.MyStepSectionLayoutData.WidSTablePrint, maxRNO) - widadj; - //Width = (float)vlnPrintObject.ToInt(formatInfo.MyStepSectionLayoutData.WidSTablePrint, maxRNO) - tabWidth; - */ - Width = (MyParent.XOffset + MyParent.Width) - (XOffset + mycolT); + else + Width = (MyParent.XOffset + MyParent.Width) - (XOffset + mycolT); } else Width = (float)formatInfo.MyStepSectionLayoutData.WidT - 6 - mycolT; @@ -3233,6 +3274,8 @@ namespace Volian.Print.Library else Width = adjwidth + MyParent.Width - tabWidth + (myTab == null ? 0 : myTab.TabAlign); } + if (itemInfo.IsSequential && itemInfo.MyParent.IsHigh && ((itemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.Align1StLevSubWHLS) == E_DocStructStyle.Align1StLevSubWHLS)) + Width += 10; // FIX THIS!!! } // for Component Table, don't increment yoff unless last item in table that HAS data associated