From 764e5b2bbdd55e1479fb3e33c7212ef76c560d46 Mon Sep 17 00:00:00 2001 From: Kathy Date: Tue, 21 Mar 2023 15:12:34 +0000 Subject: [PATCH] F2023-035: WCN Supplemental information pages, when duplex print need left margin adjustment for hole punch --- PROMS/Formats/fmtall/WCNSAM_00all.xml | Bin 40814 -> 40856 bytes PROMS/Formats/fmtall/WCNSAMall.xml | Bin 90420 -> 90676 bytes .../VEPROMS.CSLA.Library/Format/DocStyles.cs | 12 +++++ PROMS/Volian.Print.Library/PromsPrinter.cs | 6 ++- .../Volian.Print.Library/VlnSvgPageHelper.cs | 48 ++++++++++-------- 5 files changed, 44 insertions(+), 22 deletions(-) diff --git a/PROMS/Formats/fmtall/WCNSAM_00all.xml b/PROMS/Formats/fmtall/WCNSAM_00all.xml index e17f346c87ba4157cd23395073e3bad2713e4f76..e0faeeb7b5fb0a0795cdfff627fb1f1ca194f785 100644 GIT binary patch delta 52 zcmaF2k7>q!rVTE$Rf8Ey844IY8S)s?81fl>84?+a7}6OW8B!Rs7;G7o7<3to84Nbt I&(>!F0FYP=#Q*>R delta 14 WcmbQSpXuE`rVTE$H|NdPVgUd)KL&vS diff --git a/PROMS/Formats/fmtall/WCNSAMall.xml b/PROMS/Formats/fmtall/WCNSAMall.xml index 24886b1ae07bd4f1f53d5f88759fce70db4765e2..87cf1295d8b1ca5599c8fcad870897b8fa3ff4ef 100644 GIT binary patch delta 304 zcmdmTh;_>m)`l&N3Tmps45bVO44w>m3~3Dc489DB3`Gp-42}#b3|S1e3`z{T48{xw z(+zbPk8gjZ#wf(7iCse`&;WEz6D=5}w{vMQ>aY-J%XXkG$waD!xG2n!F^-iu!$BHO RZm%$Bv?57EnJwc!WdOUVK2QJv delta 97 zcmdmTgmudy)`l&N3To4rcr$uU|6|Kov7JYqQHXK+1U*Kv?MWJpIxKLhs_iwpjI)^G b{EF>NMvQT+aDLTxKMO`H2!A`!C<_$;l0qS* diff --git a/PROMS/VEPROMS.CSLA.Library/Format/DocStyles.cs b/PROMS/VEPROMS.CSLA.Library/Format/DocStyles.cs index 56e820e3..54b34824 100644 --- a/PROMS/VEPROMS.CSLA.Library/Format/DocStyles.cs +++ b/PROMS/VEPROMS.CSLA.Library/Format/DocStyles.cs @@ -171,6 +171,18 @@ namespace VEPROMS.CSLA.Library return LazyLoad(ref _SupplementalInformation, "@SupplementalInformation"); } } + // F2023-035: WCN - allow for change in left margin for supplemental information pages by + // setting a value in the DocStyle for the adjustment. This is used when importing the vlnParagraph page + // page & when doing pagelist items + private LazyLoad _SupInfoMargAdj; + public float? SupInfoMargAdj + { + get + { + return LazyLoad(ref _SupInfoMargAdj, "@SupInfoMargAdj"); + } + } + #endregion #region LandscapePageList [Category("Miscellaneous")] diff --git a/PROMS/Volian.Print.Library/PromsPrinter.cs b/PROMS/Volian.Print.Library/PromsPrinter.cs index cd34b9a5..338b32bf 100644 --- a/PROMS/Volian.Print.Library/PromsPrinter.cs +++ b/PROMS/Volian.Print.Library/PromsPrinter.cs @@ -2618,7 +2618,11 @@ namespace Volian.Print.Library string SupInfoPdfName = Volian.Base.Library.VlnSettings.TemporaryFolder + @"\SupInfo" + myPageHelper.MySection.ItemID.ToString() + @".pdf"; PdfReader pdfreader = new PdfReader(SupInfoPdfName); sipage = cb.PdfWriter.GetImportedPage(pdfreader, getpage+1); - AddImportedPageToLayer(cb.PdfWriter.DirectContent, textLayer, sipage, 0, 0); + // F2023-035: WCN - allow for change in left margin for supplemental information pages by + // setting a value in the DocStyle for the adjustment. When importing the vlnParagraph page + // use this adjustment (note that page list items are done in VlnSvgPageHelper) + float lmargadj = myPageHelper.MySection.MyDocStyle.SupInfoMargAdj == null ? 0 : (float)myPageHelper.MySection.MyDocStyle.SupInfoMargAdj; + AddImportedPageToLayer(cb.PdfWriter.DirectContent, textLayer, sipage, lmargadj, 0); DoingFacingPage = true; myPageHelper.ResetSvg(); NewPage(); diff --git a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs index 57f0f6b6..957d63f5 100644 --- a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs +++ b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs @@ -1037,6 +1037,7 @@ i = 0; HLSText = hlsText; HasHLSTextId = hlsItemId; MyPromsPrinter = myPromsPrinter; + CreatingSupInfoPage = myPromsPrinter.DoingFacingPage; MySection = mySection; } private Volian.Svg.Library.Svg BuildSvg(VEPROMS.CSLA.Library.SectionInfo mySection, bool forceLoad) @@ -1345,6 +1346,10 @@ i = 0; bool usePSIvalue = false; // C2021-065 used with ROLkUpMatch pagelist flag (Barakah Alarms) string otherChildUnit = string.Empty; // C2021-065 used when OTHER applicability information is used for the ROLookUp + // F2023-035: WCN - allow for change in left margin for supplemental information pages by + // setting a value in the DocStyle for the adjustment. + float supInfoMargAdj = 0; + if (CreatingSupInfoPage || MyPromsPrinter.DoingFacingPage) supInfoMargAdj = MySection.MyDocStyle.SupInfoMargAdj == null ? 0 : (float)MySection.MyDocStyle.SupInfoMargAdj; foreach (VEPROMS.CSLA.Library.PageItem pageItem in pageStyle.PageItems) { if (pageItem.Token == null) continue; // can be null if token is dependent on PSI lookup! @@ -1392,7 +1397,7 @@ i = 0; foreach (Match m in sm) // resolve pagelist tokens that are parameters for ROLookup() { string tnk = m.Value; - ProcessPaglistToken(section, svgGroup, pageItem, ref useFontForCheckOffHeader, ref parms, tnk); + ProcessPaglistToken(section, svgGroup, pageItem, ref useFontForCheckOffHeader, ref parms, tnk, supInfoMargAdj); } string[] parts = parms.Split(",".ToCharArray());// split on comma // B2019-031 Support commas embedded in Alarm ID (Procedure Number) @@ -1515,7 +1520,7 @@ i = 0; foreach (Match subMatch in subMatches) { string subToken = subMatch.Value; - ProcessPaglistToken(section, svgGroup, pageItem, ref useFontForCheckOffHeader, ref plstr, subToken); + ProcessPaglistToken(section, svgGroup, pageItem, ref useFontForCheckOffHeader, ref plstr, subToken, supInfoMargAdj); } } } @@ -1570,7 +1575,7 @@ i = 0; foreach (Match subMatch in subMatches) { string subToken = subMatch.Value; - ProcessPaglistToken(section, svgGroup, pageItem, ref useFontForCheckOffHeader, ref plstr, subToken); + ProcessPaglistToken(section, svgGroup, pageItem, ref useFontForCheckOffHeader, ref plstr, subToken, supInfoMargAdj); } } } @@ -1578,19 +1583,19 @@ i = 0; else { - if (!ProcessPaglistToken(section, svgGroup, pageItem, ref useFontForCheckOffHeader, ref plstr, token)) break; + if (!ProcessPaglistToken(section, svgGroup, pageItem, ref useFontForCheckOffHeader, ref plstr, token, supInfoMargAdj)) break; } } // end foreach matches if (plstr != string.Empty) { if (useFontForCheckOffHeader != null) - svgGroup.Add(PageItemToSvgText(pageItem, plstr, useFontForCheckOffHeader, MySection)); + svgGroup.Add(PageItemToSvgText(pageItem, plstr, useFontForCheckOffHeader, MySection, supInfoMargAdj)); else - svgGroup.Add(PageItemToSvgText(pageItem, plstr, MySection)); + svgGroup.Add(PageItemToSvgText(pageItem, plstr, MySection, supInfoMargAdj)); } } else - svgGroup.Add(PageItemToSvgText(pageItem, pltok, MySection)); + svgGroup.Add(PageItemToSvgText(pageItem, pltok, MySection, supInfoMargAdj)); } } // Proms page numbering designed requires a "{PAGE}" token to increment the page counter. So the easiest way @@ -1698,7 +1703,7 @@ i = 0; /// true - if token is resolved /// false - if entire text is processed /// - private bool ProcessPaglistToken(VEPROMS.CSLA.Library.SectionInfo section, SvgGroup svgGroup, VEPROMS.CSLA.Library.PageItem pageItem, ref VE_Font useFontForCheckOffHeader, ref string plstr, string token) + private bool ProcessPaglistToken(VEPROMS.CSLA.Library.SectionInfo section, SvgGroup svgGroup, VEPROMS.CSLA.Library.PageItem pageItem, ref VE_Font useFontForCheckOffHeader, ref string plstr, string token, float supInfoMargAdj) { bool retval = true; @@ -1751,7 +1756,7 @@ i = 0; case "{BOX9}": case "[BOX9]": plstr = plstr.Replace(token, string.Empty); - svgGroup.Add(PageItemToSvgUse(pageItem, FirstAndLast(token))); + svgGroup.Add(PageItemToSvgUse(pageItem, FirstAndLast(token), supInfoMargAdj)); break; case "{PMODEBOX}": // need to set either 1 or 2 depending on number of columns case "[PMODEBOX]": @@ -1764,7 +1769,7 @@ i = 0; box = "2"; box = "{BOX" + box + "}"; plstr = plstr.Replace(token, string.Empty); - svgGroup.Add(PageItemToSvgUse(pageItem, FirstAndLast(box))); + svgGroup.Add(PageItemToSvgUse(pageItem, FirstAndLast(box), supInfoMargAdj)); break; case "{DRAFTPAGE}": //if (!AllowedWatermarks.Contains("Draft")) AllowedWatermarks.Add("Draft"); -- B2018-124 not needed anymore @@ -2059,7 +2064,7 @@ i = 0; 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); + PageListCheckOffHeader = PageItemToSvgText(pageItem, pageItem.Token, vf, section, 0); break; case "{HLSTEXT}": DidHLSText = true; @@ -2199,7 +2204,7 @@ i = 0; if (HLSTAB.Contains("{!Clock}")) // F2022-024 replace with the clock symbol defined in GenMac format file { HLSTAB = HLSTAB.Replace("{!Clock}",string.Empty).TrimStart(" ".ToCharArray()); - svgGroup.Add(PageItemToSvgUse(pageItem, "Clock")); + svgGroup.Add(PageItemToSvgUse(pageItem, "Clock", supInfoMargAdj)); } plstr = plstr.Replace(token, HLSTAB); break; @@ -2318,7 +2323,7 @@ i = 0; if (token.Contains(@"RO-")) { plstr = token.Replace("{",string.Empty).Replace("}",string.Empty); - svgGroup.Add(PageItemToSvgText(pageItem, plstr, MySection)); + svgGroup.Add(PageItemToSvgText(pageItem, plstr, MySection, 0)); } if (token.Contains(@"PS-")) { @@ -2379,7 +2384,7 @@ i = 0; { if (plstr != string.Empty) { - svgGroup.Add(PageItemToSvgText(pageItem, plstr, MySection)); + svgGroup.Add(PageItemToSvgText(pageItem, plstr, MySection, supInfoMargAdj)); plstr = string.Empty; } //svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token)); @@ -2734,21 +2739,21 @@ i = 0; } return len; } - private SvgPart PageItemToSvgUse(VEPROMS.CSLA.Library.PageItem pageItem, string templateName) + private SvgPart PageItemToSvgUse(VEPROMS.CSLA.Library.PageItem pageItem, string templateName, float supmargadj) { SvgUse svgUse = new SvgUse(); svgUse.UseID = templateName; - svgUse.X = new SvgMeasurement((float)(pageItem.Col ?? 0), E_MeasurementUnits.PT); + svgUse.X = new SvgMeasurement((float)(pageItem.Col ?? 0) + supmargadj, E_MeasurementUnits.PT); // F2023-035: Add in supplemental info margin adjust svgUse.Y = new SvgMeasurement((float)(pageItem.Row ?? 0), E_MeasurementUnits.PT); return svgUse; } - private static SvgText PageItemToSvgText(VEPROMS.CSLA.Library.PageItem pageItem, string text, VE_Font font, SectionInfo mySection) + private static SvgText PageItemToSvgText(VEPROMS.CSLA.Library.PageItem pageItem, string text, VE_Font font, SectionInfo mySection, float supmargadj) { - SvgText svgText = PageItemToSvgText(pageItem, text, mySection); + SvgText svgText = PageItemToSvgText(pageItem, text, mySection, supmargadj); svgText.Font = font.WindowsFont; return svgText; } - private static SvgText PageItemToSvgText(VEPROMS.CSLA.Library.PageItem pageItem, string text, SectionInfo mySection) + private static SvgText PageItemToSvgText(VEPROMS.CSLA.Library.PageItem pageItem, string text, SectionInfo mySection, float supmargadj) { SvgText svgText = new SvgText(); // F2021-053: Do replace words for Page List items. Send format items down to svgtext. @@ -2797,8 +2802,9 @@ i = 0; int dotsPerChar = (int)(2400 / (mySection.MyDocStyle.Layout.PageWidth / 6)); lcol = (lcol * 25) / dotsPerChar; } - - svgText.X = new SvgMeasurement((float)lcol - colAdj16bit, E_MeasurementUnits.PT); + // F2023-035: WCN - allow for change in left margin for supplemental information pages by + // setting a value in the DocStyle for the adjustment. + svgText.X = new SvgMeasurement((float)lcol - colAdj16bit + supmargadj, E_MeasurementUnits.PT); // F2023-035: Add in supplemental info margin adjust svgText.Y = new SvgMeasurement(row, E_MeasurementUnits.PT); if (svgText.Font.Underline && svgText.Text.EndsWith(" ")) svgText.Text = svgText.Text.Substring(0, svgText.Text.Length - 1) + "\xA0";// replace last space with a hardspace // C2018-004 create meta file for baseline compares