diff --git a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs index 4fd585c7..d0621cda 100644 --- a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs +++ b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs @@ -109,11 +109,8 @@ namespace Volian.Print.Library if ((MySection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DontCountInTabOfCont) == 0) CurrentTOCPageNumber++; } - if (NegPageItems != null) - { - NegPageItems.Clear(); - NegPageItems = null; - } + PageListTopCheckOffHeader = null; + PageListLastCheckOffHeader = null; YMultiplier = 1; } private void DrawRuler(PdfContentByte cb) @@ -423,7 +420,6 @@ namespace Volian.Print.Library { VEPROMS.CSLA.Library.FormatInfo activeFormat = mySection.ActiveFormat; VEPROMS.CSLA.Library.DocStyle docStyle = mySection.MyDocStyle; - Volian.Svg.Library.Svg mySvg = null; mySvg = SvgSerializer.StringDeserialize(BuildMyText(activeFormat)); mySvg.ViewBox.Height = 1100; @@ -569,9 +565,20 @@ namespace Volian.Print.Library return token.Substring(1, 1) + token.Substring(token.Length - 2, 1); } private static Regex regexJustTokens = new Regex(@"^{([^{}]*}{)*[^{}]*}$"); - public Dictionary NegPageItems; + + // The following variables are used to keep track of whether a check off header should be printed + // if the {CHKOFFHEADING} pagelist item is found. PageListTopCheckOffHeader is the text that + // should be printed at the top of the page. PageListLastCheckOffHeader is the last header that was + // printed (if a header is on the page, and another is to be printed, it doesn't get printed if it + // is the same as the previous) and PageListCheckOffHeader is the page list item converted to a + // SvgText - this stores X/Y location, etc. + public string PageListTopCheckOffHeader = null; + public string PageListLastCheckOffHeader = null; + public SvgText PageListCheckOffHeader = null; + private void AddPageListItems(Volian.Svg.Library.Svg mySvg, VEPROMS.CSLA.Library.PageStyle pageStyle, VEPROMS.CSLA.Library.SectionInfo section) { + 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!!!! SectionConfig.SectionPagination sPag = SectionConfig.SectionPagination.Separate; @@ -589,6 +596,7 @@ namespace Volian.Print.Library //float rowAdj = 0; // = 18; foreach (VEPROMS.CSLA.Library.PageItem pageItem in pageStyle.PageItems) { + VE_Font useFontForCheckOffHeader = null; if (sPag == SectionConfig.SectionPagination.Separate || ((sPag == SectionConfig.SectionPagination.Continuous || sPag ==0 )&& pageItem.Row < 0)) { //if (PrevRow > 0) @@ -713,35 +721,14 @@ namespace Volian.Print.Library //svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token.Replace(token, MySection.MyDocVersion.DocVersionConfig.Unit_Text))); break; case "{CHKOFFHEADING}": + // unfortunately, the font is not stored on the page list item if there is an active + // check off header. It is stored with the checkoff data as defined by user selection + // of the selected header (selection stored in section config). int sindx = section.CheckOffHeadingIndex(); - // -1 flags no entires in the format's CheckOffHeaderList & 0 flags the first entry - // which is always '{NO HEADING}". - if (sindx > 0) - { - plstr = plstr.Replace(token, ""); - if (pageItem.Row < 0) - { - // for the checkoff header, use the font from the CheckOffData Checkoffheader, font to get the - // font style, i.e. bold - underline. - if (NegPageItems == null) NegPageItems = new Dictionary(); - - // now see if this same checkoff header is on the page, if so, don't - // add it to the list. We only want those that are different. - bool add = true; - foreach (CheckOffHeaderHelper h in NegPageItems.Values) - { - if (section.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffHeaderList[sindx].CheckOffHeading == h.SvgText.Text) add=false; - } - if (add) - { - SvgText svgt = PageItemToSvgText(pageItem, section.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffHeaderList[sindx].CheckOffHeading, section.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffHeaderList[sindx].Font, section); - CheckOffHeaderHelper hlp = new CheckOffHeaderHelper(svgt, section.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffHeaderList[sindx].Font); - NegPageItems.Add(section, hlp); - } - } - else - svgGroup.Add(PageItemToSvgText(pageItem, section.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffHeaderList[sindx].CheckOffHeading, section.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffHeaderList[sindx].Font, section)); - } + VE_Font vf = sindx <= 0 ?pageItem.Font: + section.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffHeaderList[sindx].Font; + useFontForCheckOffHeader = vf; + PageListCheckOffHeader = PageItemToSvgText(pageItem, pageItem.Token, vf, section); break; default: // see if it's a PSI token: @@ -797,8 +784,14 @@ namespace Volian.Print.Library break; } } // end foreach matches + if (plstr != "") - svgGroup.Add(PageItemToSvgText(pageItem, plstr, MySection)); + { + if (useFontForCheckOffHeader != null) + svgGroup.Add(PageItemToSvgText(pageItem, plstr, useFontForCheckOffHeader, MySection)); + else + svgGroup.Add(PageItemToSvgText(pageItem, plstr, MySection)); + } } else svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token, MySection)); @@ -1084,6 +1077,8 @@ namespace Volian.Print.Library // == to a ' ' (space) and if so, start Rev from second character. if (Rev !=null && Rev != "" && Rev[0] == ' ') return Rev.Substring(1, Rev.Length - 1); return Rev; + case "{CHKOFFHEADING}": + return PageListTopCheckOffHeader; } if (!_MissingTokens.Contains(match.Value)) {