From 7d3b8872c839101a677a2a745fe04365f828b103 Mon Sep 17 00:00:00 2001 From: Kathy Date: Thu, 13 Nov 2014 15:50:46 +0000 Subject: [PATCH] Added properties for IsSubsection, IsSubsectionNumber and IsSeparateSubsection Improved debug Calvert: Improved tab on Section Continue Message and print missing Section Continue Message --- .../VEPROMS.CSLA.Library/Extension/ItemExt.cs | 34 +++++++++++++++++++ PROMS/Volian.Print.Library/Rtf2Pdf.cs | 8 ++++- PROMS/Volian.Print.Library/vlnParagraph.cs | 18 +++++----- 3 files changed, 50 insertions(+), 10 deletions(-) diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index e1dc045b..f9d9745e 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -1625,6 +1625,40 @@ namespace VEPROMS.CSLA.Library return false; } } + public bool IsSubsection + { + get + { + if (!IsSection) return false; + ItemInfo par = ActiveParent as ItemInfo; + if (par == null || !par.IsSection) return false; + return true; + } + } + public bool IsSubsectionNumber + { + // returns whether the subsection number is derived from section number, + // for example 6.9 is subsectionnumber of 6.0. B is not a subsectionnumber of 6.9 + get + { + if (!IsSection) return false; + ItemInfo par = ActiveParent as ItemInfo; + if (par == null || !par.IsSection) return false; + string parNumber = par.DisplayNumber; + string myNumber = DisplayNumber; + if (parNumber == null || myNumber == null) return false; + if (!parNumber.EndsWith(".0")) return false; + return (myNumber.StartsWith(parNumber.Substring(0, parNumber.Length - 1))); + } + } + public bool IsSeparateSubsection + { + get + { + return (IsSubsection && !IsSubsectionNumber); + } + } + public bool IsFolder { get diff --git a/PROMS/Volian.Print.Library/Rtf2Pdf.cs b/PROMS/Volian.Print.Library/Rtf2Pdf.cs index 109fa615..cc19ede7 100644 --- a/PROMS/Volian.Print.Library/Rtf2Pdf.cs +++ b/PROMS/Volian.Print.Library/Rtf2Pdf.cs @@ -116,8 +116,14 @@ namespace Volian.Print.Library yDescent = -iParagraph.Font.BaseFont.GetDescentPoint("Almg", iParagraph.Font.Size); if (PdfDebug) { + // be very careful around the following line, if the cursor 'touches' + // NextTextAtCounter, it is incremented and the 'next' value may not be what + // was seen as the UniqueNumber in the pdf. int next = NextTextAtCounter; - //if (InList(next,1884,1985,1986,1987,1988,1989)) Console.WriteLine("here"); + // buffer (unnecessary comments) so + // that cursor does NOT touch 'NextTextAtCounter' + // as easily + //if (InList(next,2958, 2961)) Console.WriteLine("Stop at UniqueNumber"); string dbt = string.Format("[{0}]{1}", next, debugText ?? ""); DrawPdfDebug(cb, left, top, left + width, myColumnText.YLine, dbt, yDescent); } diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index 36ed1112..d5a835ba 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -1010,16 +1010,16 @@ namespace Volian.Print.Library if (!itemInfo.IsHigh && !itemInfo.IsSequential && !itemInfo.IsSection) itemInfo = itemInfo.ActiveParent as ItemInfo; string prTab = ""; string thisTab = itemInfo.MyTab.CleanText.Trim(); - if (!itemInfo.IsSection) + if (!itemInfo.IsSection || itemInfo.IsSeparateSubsection) { - ItemInfo mypar = itemInfo.MyParent; + ItemInfo mypar = itemInfo.MyParent; while (mypar != null && !mypar.IsProcedure) - { - string pTab = mypar.MyTab.CleanText.Trim(); + { + string pTab = mypar.MyTab.CleanText.Trim(); if (pTab.Length > 0 && char.IsLetterOrDigit(pTab[0])) { - pTab = pTab.TrimEnd(" .".ToCharArray()) + "."; - prTab = pTab + prTab; + pTab = pTab.TrimEnd(" .".ToCharArray()) + "."; + prTab = pTab + prTab; } else { @@ -1029,7 +1029,7 @@ namespace Volian.Print.Library prTab = ""; thisTab = ""; } - mypar = (mypar.IsSection)? null: mypar.MyParent; + mypar = (mypar.IsSection && !mypar.IsSeparateSubsection) ? null : mypar.MyParent; } } return (prTab + thisTab.Trim()).TrimEnd(".".ToCharArray()); @@ -1149,7 +1149,7 @@ namespace Volian.Print.Library if (doSectionContinue) DoTopContinueMsg(cb, ref yPageStart, yTopMargin, docstyle , null); // If "ContinueSectionHeader" (format flag) is true then print the section title with "(Continued)" appended to it - if (!MyItemInfo.IsSection && MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ContinueSectionHeader) + if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ContinueSectionHeader && (!MyItemInfo.IsSection || MyItemInfo.IsSeparateSubsection)) { SectionConfig sch = MyItemInfo.ActiveSection.MyConfig as SectionConfig; doSectionTitleContinued = (sch == null || sch.Section_PrintHdr == "Y") && !MyItemInfo.MyDocStyle.CancelSectTitle; @@ -2291,7 +2291,7 @@ namespace Volian.Print.Library { SectionConfig sc = itemInfo.MyParent.MyConfig as SectionConfig; offset = (sc != null && sc.SubSection_AutoIndent == "Y") ? MyParent.XOffset - : (MyParent.MyTab != null)?MyParent.MyTab.XOffset:XOffset; + : (MyParent != null && MyParent.MyTab != null)?MyParent.MyTab.XOffset:XOffset; } } else