C2024-003-Print-Sub-Section

This commit is contained in:
2024-02-22 16:54:56 -05:00
parent 77d31a4a99
commit dcfdf5f852
7 changed files with 978 additions and 879 deletions

View File

@@ -179,8 +179,8 @@ namespace Volian.Print.Library
get { return _PDFFile; }
set { _PDFFile = value; }
}
private int _prtSectID = -1;
public int PrtSectID
private int[] _prtSectID = new int[] { -1, -1, 0 };
public int[] PrtSectID
{
get { return _prtSectID; }
set { _prtSectID = value; }
@@ -323,7 +323,7 @@ namespace Volian.Print.Library
set { _MergedPdf = value; }
}
public PromsPrinter(ItemInfo myItem, string rev, string watermark, bool debugOutput, bool origPgBrk, string backgroundFolder, bool openPDF, bool overWrite,
ChangeBarDefinition cbd, String pdfFile, bool insertBlankPages, bool batchPrint, string prefix, bool saveLinks, int removeTrailngHardReturnsAndManualPageBreaks, string blankPageText, bool didAll, MergedPdf mergedPdf, string watermarkColor, int PrtSectID = -1)
ChangeBarDefinition cbd, String pdfFile, bool insertBlankPages, bool batchPrint, string prefix, bool saveLinks, int removeTrailngHardReturnsAndManualPageBreaks, string blankPageText, bool didAll, MergedPdf mergedPdf, string watermarkColor, int[] PrtSectID = null)
{
Prefix = prefix; // RHM20150506 Multiline ItemID TextBox
_MyItem = myItem;
@@ -341,6 +341,7 @@ namespace Volian.Print.Library
_BatchPrint = batchPrint;
_MyReaderHelper = new ReaderHelper(this);
_SaveLinks = saveLinks;
_prtSectID = PrtSectID;
// C2021-010: Remove trailing returns/spaces & manual page breaks & allow save.
if (removeTrailngHardReturnsAndManualPageBreaks == 1 || removeTrailngHardReturnsAndManualPageBreaks == 3) RemoveTrailingHardReturnsAndSpaces = new List<int>();
if (removeTrailngHardReturnsAndManualPageBreaks == 2 || removeTrailngHardReturnsAndManualPageBreaks == 3) RemoveManualPageBreaks = new List<int>();
@@ -348,7 +349,15 @@ namespace Volian.Print.Library
_DidAll = didAll;
_MergeNotIncluded = false;
_MergedPdf = mergedPdf;
_prtSectID = PrtSectID;
//if(Convert.ToBoolean(PrtSectID[0]))
// {
// }
// else
// {
// }
//_prtSectID = PrtSectID;
//_MyReaderHelper.LoadTree(myItem);
}
// Pass 1 PDF Name
@@ -368,7 +377,7 @@ namespace Volian.Print.Library
// B2019-152: MergedLandscapePages is a dictionary whose key is the pdf file name & values are all of the page numbers
// in that pdf that should have landscaped page numbers. These are added when the page is finished (onEndPage)
public static Dictionary<string, List<int>> MergedLandscapePages = null;
public string Print(string pdfFolder, bool makePlacekeeper, bool makeContinuousActionSummary, bool makeTimeCriticalActionSummary, int PrtSectID = -1)
public string Print(string pdfFolder, bool makePlacekeeper, bool makeContinuousActionSummary, bool makeTimeCriticalActionSummary, int[] PrtSectID = null)
{
if (_MyItem is ProcedureInfo)
{
@@ -804,23 +813,46 @@ namespace Volian.Print.Library
VlnItextFont.RegisterFontFolder(); //B2019-174 register the font folder so that symbols will display on auto TOC
if (myProcedure.Sections != null)
{
SectionInfo CurSection = null;
if (Convert.ToBoolean(PrtSectID[2])) // If section is a CurSection retrieved the CurSection.
{
foreach (SectionInfo si2 in myProcedure.Sections)
{
if (si2.ItemID == PrtSectID[0])
{
foreach (SectionInfo subsi in si2.Sections)
{
if (subsi.ItemID == PrtSectID[1])
{
CurSection = subsi;
}
}
}
}
}
int cnt = 0;
foreach (SectionInfo mySection in myProcedure.Sections)
{
if (PrtSectID == -1 || (PrtSectID > -1 && mySection.ItemID == PrtSectID))
if (PrtSectID[0] == -1 || (PrtSectID[0] > -1 && mySection.ItemID == PrtSectID[0]))
{
if (!mySection.MyDocStyle.IsStepSection && !mySection.IsAutoTOCSection)
if (!Convert.ToBoolean(PrtSectID[2])) // If section is not a Sub Section assign the iteration variable to CurSection
{
VEPROMS.CSLA.Library.Document.ConvertWordSectionToDOCX((ItemInfo)mySection); // B2023-093 Convert a Word section to the DOCX Word format if needed before printing
CurSection = mySection;
}
if (!CurSection.MyDocStyle.IsStepSection && !CurSection.IsAutoTOCSection)
{
VEPROMS.CSLA.Library.Document.ConvertWordSectionToDOCX((ItemInfo)CurSection); // B2023-093 Convert a Word section to the DOCX Word format if needed before printing
}
//C2019-042 Section_IsFoldout checks Section Number, Section Title, and use of check box
if ((myProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.SectionLevelFoldouts && (mySection.MyConfig as SectionConfig).Section_IsFoldout == "Y")
|| (myProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.AlternateFloatingFoldout && (mySection.MyConfig as SectionConfig).Section_IsFoldout == "Y"))
if ((myProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.SectionLevelFoldouts && (CurSection.MyConfig as SectionConfig).Section_IsFoldout == "Y")
|| (myProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.AlternateFloatingFoldout && (CurSection.MyConfig as SectionConfig).Section_IsFoldout == "Y"))
{
// if floating foldouts, need a list of sections & foldoutreaders. Just do first for now.
_MyFoldoutSection.Add(mySection);
string foldoutPdf = PrintProcedureOrFoldout(myProcedure, mySection, Volian.Base.Library.VlnSettings.TemporaryFolder + @"\Foldout" + cnt.ToString() + @".pdf", false, false, false);
_MyFoldoutSection.Add(CurSection);
string foldoutPdf = PrintProcedureOrFoldout(myProcedure, CurSection, Volian.Base.Library.VlnSettings.TemporaryFolder + @"\Foldout" + cnt.ToString() + @".pdf", false, false, false);
_MyFoldoutReader.Add(foldoutPdf != null ? new PdfReader(foldoutPdf) : null);
cnt++;
}
@@ -951,44 +983,66 @@ namespace Volian.Print.Library
string clr = pc.GetValue("PSI", "WATERMARKOVERRIDECLR");
if (clr != null && clr != "") WatermarkOverrideColor = clr.ToUpper().Contains("DEFAULT") ? "BLUE" : clr;
}
SectionInfo CurSection = null;
if (Convert.ToBoolean(PrtSectID[2]))
{
foreach (SectionInfo si2 in myProcedure.Sections)
{
if (si2.ItemID == PrtSectID[0])
{
foreach (SectionInfo subsi in si2.Sections)
{
if (subsi.ItemID == PrtSectID[1])
{
CurSection = subsi;
}
}
}
}
}
foreach (SectionInfo mySection in myProcedure.Sections)
{
if(PrtSectID == -1 || (PrtSectID > -1 && mySection.ItemID == PrtSectID) )
{
// B2020-115 Calculate maximum available space on a page for figures
vlnParagraph.hMax = ((float)mySection.MyDocStyle.Layout.PageLength);
vlnParagraph.wMax = ((float)mySection.MyDocStyle.Layout.PageWidth) - ((float)mySection.MyDocStyle.Layout.LeftMargin - 12);
if (PrtSectID[0] == -1 || (PrtSectID[0] > -1 && mySection.ItemID == PrtSectID[0]))
{
if (!Convert.ToBoolean(PrtSectID[2])) // If section is not a Sub Section assign the iteration variable to CurSection
{
CurSection = mySection;
}
// B2020-115 Calculate maximum available space on a page for figures
vlnParagraph.hMax = ((float)CurSection.MyDocStyle.Layout.PageLength);
vlnParagraph.wMax = ((float)CurSection.MyDocStyle.Layout.PageWidth) - ((float)CurSection.MyDocStyle.Layout.LeftMargin - 12);
NeedSupInfoBreak = true;
bool isFoldoutSection = (mySection.MyConfig as SectionConfig).Section_IsFoldout == "Y"; //C2019-042 Section_IsFoldout checks Section Number, Section Title, and use of check box
bool isFoldoutSection = (CurSection.MyConfig as SectionConfig).Section_IsFoldout == "Y"; //C2019-042 Section_IsFoldout checks Section Number, Section Title, and use of check box
if (((isFoldoutSection && myProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.SectionLevelFoldouts)
|| (myProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.AlternateFloatingFoldout && isFoldoutSection))
!= doingFoldout) continue;
if (myFoldoutSection != null && myFoldoutSection.ItemID != mySection.ItemID) continue;
PrintOverride.CompressSuper = mySection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.CompressHPSuper;
PrintOverride.CompressSub = mySection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.CompressHPSub;
PrintOverride.CompressPropSubSup = mySection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.CompressPropSubSup;
if (myFoldoutSection != null && myFoldoutSection.ItemID != CurSection.ItemID) continue;
PrintOverride.CompressSuper = CurSection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.CompressHPSuper;
PrintOverride.CompressSub = CurSection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.CompressHPSub;
PrintOverride.CompressPropSubSup = CurSection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.CompressPropSubSup;
OnStatusChanged((mySection.DisplayNumber ?? "") == "" ? mySection.DisplayText : mySection.DisplayNumber, PromsPrinterStatusType.Progress, progress++);
OnStatusChanged((CurSection.DisplayNumber ?? "") == "" ? CurSection.DisplayText : CurSection.DisplayNumber, PromsPrinterStatusType.Progress, progress++);
// Set up Helper for the particular Section
if (_MyHelper == null)
{
LastFmtName = mySection.ActiveFormat.Name;
lastDocStyle = (int)mySection.MyDocStyle.Index;
LastFmtName = CurSection.ActiveFormat.Name;
lastDocStyle = (int)CurSection.MyDocStyle.Index;
string hlsText = "";
int hlsItemId = 0;
if (mySection.IsStepSection && mySection.Steps != null && mySection.Steps.Count > 0)
if (CurSection.IsStepSection && CurSection.Steps != null && CurSection.Steps.Count > 0)
{
hlsItemId = mySection.Steps[0].ItemID;
hlsText = mySection.Steps[0].DisplayText; // save the High level step text for use in the page list
hlsItemId = CurSection.Steps[0].ItemID;
hlsText = CurSection.Steps[0].DisplayText; // save the High level step text for use in the page list
}
cb.PdfWriter.PageEvent = _MyHelper = new VlnSvgPageHelper(mySection, this, hlsText, hlsItemId, PrtSectID);
cb.PdfWriter.PageEvent = _MyHelper = new VlnSvgPageHelper(CurSection, this, hlsText, hlsItemId, PrtSectID);
_MyHelper.AllowAllWatermarks = AllowAllWatermarks;
_MyHelper.MyPdfWriter = cb.PdfWriter;
_MyHelper.CreatingFoldoutPage = doingFoldout;
_MyHelper.CreatingSupInfoPage = false;
_MyHelper.MyPdfContentByte = cb;
if (!mySection.IsStepSection) _MyHelper.PageBookmarks.Add((ItemInfo)mySection, ((mySection.DisplayNumber ?? "") == "" ? "" : mySection.DisplayNumber + " - ") + mySection.DisplayText, null);
if (!CurSection.IsStepSection) _MyHelper.PageBookmarks.Add((ItemInfo)CurSection, ((CurSection.DisplayNumber ?? "") == "" ? "" : CurSection.DisplayNumber + " - ") + CurSection.DisplayText, null);
if (DebugOutput)
{
// 16-bit background
@@ -999,7 +1053,7 @@ namespace Volian.Print.Library
_MyHelper.BackgroundFile = procedureFileName;
float x = 0;
float y = 0;
if (!(mySection.ActiveFormat.Name.ToUpper().StartsWith("WST") || _MyHelper.Back32BitPROMS)) // compare folder contains PROMS generated PDF
if (!(CurSection.ActiveFormat.Name.ToUpper().StartsWith("WST") || _MyHelper.Back32BitPROMS)) // compare folder contains PROMS generated PDF
{
// X value below = 16-bit pdf OverrideLeftMargin = -2 characters at the plant format's default Font's
// characters per inch.
@@ -1035,29 +1089,29 @@ namespace Volian.Print.Library
{
//added by jcb to reset mygaps when changing a section. found old section gaps were carrying over to new section
_MyHelper.MyGaps.Clear();
//Console.WriteLine("'{0}' PromsPrinter", mySection.DisplayText);
//Console.WriteLine("'{0}' PromsPrinter", CurSection.DisplayText);
// if pagination is separate or we've changed the format, we have not done the first page
// (if this format has the useonfirst page docstyle flag)
if (LastFmtName != mySection.ActiveFormat.Name || lastDocStyle != (int)mySection.MyDocStyle.Index || mySection.SectionConfig.Section_Pagination == SectionConfig.SectionPagination.Separate)
if (LastFmtName != CurSection.ActiveFormat.Name || lastDocStyle != (int)CurSection.MyDocStyle.Index || CurSection.SectionConfig.Section_Pagination == SectionConfig.SectionPagination.Separate)
{
_MyHelper.DidFirstPageDocStyle = false;
lastDocStyle = (int)mySection.MyDocStyle.Index;
LastFmtName = mySection.ActiveFormat.Name;
lastDocStyle = (int)CurSection.MyDocStyle.Index;
LastFmtName = CurSection.ActiveFormat.Name;
}
if (!mySection.IsStepSection) _MyHelper.PageBookmarks.Add((ItemInfo)mySection, ((mySection.DisplayNumber ?? "") == "" ? "" : mySection.DisplayNumber + " - ") + mySection.DisplayText, null);
_MyHelper.MySection = mySection;
if (!CurSection.IsStepSection) _MyHelper.PageBookmarks.Add((ItemInfo)CurSection, ((CurSection.DisplayNumber ?? "") == "" ? "" : CurSection.DisplayNumber + " - ") + CurSection.DisplayText, null);
_MyHelper.MySection = CurSection;
//OnStatusChanged("After Set Svg", PromsPrinterStatusType.SetSVG);
}
// if this format uses phonelists, see if this section has one. We need to know the number
//of lines to adjust the pagelength for pagination and printing.
_MyHelper.PhoneListHeight = 0;
if (mySection.ActiveFormat.PlantFormat.FormatData.SectData.PrintPhoneList)
if (CurSection.ActiveFormat.PlantFormat.FormatData.SectData.PrintPhoneList)
{
// get config for section
SectionConfig sc = mySection.MyConfig as SectionConfig;
SectionConfig sc = CurSection.MyConfig as SectionConfig;
if (sc.Section_PhoneList != null && sc.Section_PhoneList == "Y")
{
DocVersionConfig dvc = mySection.MyDocVersion.MyConfig as DocVersionConfig;
DocVersionConfig dvc = CurSection.MyDocVersion.MyConfig as DocVersionConfig;
if (dvc != null)
{
string phlist = dvc.Print_PhoneList;
@@ -1082,13 +1136,13 @@ namespace Volian.Print.Library
}
_MyHelper.FinalMessageSectionID = finalMessageSectionID; // set VlnSvgPageHelper with the finalMessageSectionID
if (mySection.IsAutoTOCSection)
if (CurSection.IsAutoTOCSection)
{
if (((cb.PdfWriter.CurrentPageNumber % 2 == 0 && !_MyHelper.CreatingFoldoutPage) || myProcedure.ProcHasSupInfoData) && InsertBlankPages) // Bug Fix: B2016-181 - add blank page if page count is even
{
InsertBlankPage(cb);
}
GenerateTOC(mySection, myProcedure, cb, _TextLayer);
GenerateTOC(CurSection, myProcedure, cb, _TextLayer);
// B2020-102: extra page printing after auto TOC for summer. Retested for Farley and was successful also
// F2018-033: Farley Auto TOC. If doing foldouts or supinfo facing pages, add a blank page after also:
//if (myProcedure.ProcHasSupInfoData && InsertBlankPages) // Bug Fix: B2016-181 - add blank page if page count is even
@@ -1098,21 +1152,21 @@ namespace Volian.Print.Library
}
else
{
if (mySection.IsStepSection)
if (CurSection.IsStepSection)
{
if (mySection.Steps != null && mySection.Steps.Count > 0)
if (CurSection.Steps != null && CurSection.Steps.Count > 0)
{
// get first step to send to floating foldout indx.&& MyItemInfo.FoldoutIndex>-1)
ItemInfo firstStep = mySection.Steps[0];
ItemInfo firstStep = CurSection.Steps[0];
// B2019-165 Don't print the duplex foldout (on the back of the page) if the Don't Include Duplex Foldout check box was checked in section properties
if (firstStep.FoldoutIndex() > -1 && (mySection.MyPrevious == null || !((mySection.MyPrevious.MyConfig as SectionConfig).Section_DontIncludeDuplexFoldout)))
if (firstStep.FoldoutIndex() > -1 && (CurSection.MyPrevious == null || !((CurSection.MyPrevious.MyConfig as SectionConfig).Section_DontIncludeDuplexFoldout)))
DoFoldoutPage(cb, "Beginning of Step Section", _TextLayer, _MyHelper, firstStep.FoldoutIndex(), InsertBlankPages);
else if (!_MyHelper.CreatingFoldoutPage && _MyFoldoutReader.Count > 0 && InsertBlankPages)
{
// if it is continuous pagination, don't do blank page - not sure if this is correct place for this:
// C2023-001 if the previous section has the flag to not insert blank pages,
// then don't insert a blank page between the previous section and this one
if (mySection.SectionConfig.Section_Pagination == SectionConfig.SectionPagination.Separate && !mySection.SearchPrev.MyDocStyle.DontInsertBlankPages)
if (CurSection.SectionConfig.Section_Pagination == SectionConfig.SectionPagination.Separate && !CurSection.SearchPrev.MyDocStyle.DontInsertBlankPages)
{
// only insert a blank page if this section does not have a foldout (but the procedure as a whole does)
// and the checkbox on the print dialog to add blank pages is checked
@@ -1124,18 +1178,18 @@ namespace Volian.Print.Library
{
// If the procedure has supplemental facing pages, but this section does not & it's the first section,
// need a blank 'facing page'. Sections after the first will get blank 'facing page' in print's pagination logic
if (SupInfoPrintType == E_SupInfoPrintType.Merge && !mySection.HasSupInfoSteps && firstStepSec && InsertBlankPages)
if (SupInfoPrintType == E_SupInfoPrintType.Merge && !CurSection.HasSupInfoSteps && firstStepSec && InsertBlankPages)
{
InsertBlankPage(cb);
}
}
}
firstStepSec = false;
CreateStepPdf(mySection, cb);
CreateStepPdf(CurSection, cb);
}
else
{
CreateWordDocPdf(cb, mySection);
CreateWordDocPdf(cb, CurSection);
}
}
_MyHelper.PrintedSectionPage = 0;
@@ -1582,19 +1636,43 @@ namespace Volian.Print.Library
// C2018-004 create meta file for baseline compares
Volian.Base.Library.BaselineMetaFile.WriteLine("TOC Ystart {0} LeftMar {1} ScNmPos {2} ScTtlPos {3} ScPgPos {4}", yPageStart, leftMargin, secNumPos, secTitlePos, secPagePos);
bool inGroup = false;
SectionInfo CurSection = null;
if (Convert.ToBoolean(PrtSectID[2]))
{
foreach (SectionInfo si2 in ii.Sections)
{
if (si2.ItemID == PrtSectID[0])
{
foreach (SectionInfo subsi in si2.Sections)
{
if (subsi.ItemID == PrtSectID[1])
{
CurSection = subsi;
}
}
}
}
}
foreach (SectionInfo mySection in ii.Sections)
{
if (PrtSectID == -1 || (PrtSectID > -1 && mySection.ItemID == PrtSectID))
if (PrtSectID[0] == -1 || (PrtSectID[0] > -1 && mySection.ItemID == PrtSectID[0]))
{
if (!Convert.ToBoolean(PrtSectID[2])) // If section is not a Sub Section assign the iteration variable to CurSection
{
CurSection = mySection;
}
sectCnt++;
SectionConfig sc = mySection.MyConfig as SectionConfig;
if ((mySection.MyDocStyle != null && mySection.MyDocStyle.IncludeInTOC && (sc == null || sc.Section_TOC != "Y"))
|| ((mySection.MyDocStyle == null || !mySection.MyDocStyle.IncludeInTOC) && (sc != null && sc.Section_TOC == "Y")))
SectionConfig sc = CurSection.MyConfig as SectionConfig;
if ((CurSection.MyDocStyle != null && CurSection.MyDocStyle.IncludeInTOC && (sc == null || sc.Section_TOC != "Y"))
|| ((CurSection.MyDocStyle == null || !CurSection.MyDocStyle.IncludeInTOC) && (sc != null && sc.Section_TOC == "Y")))
{
// for indenting of subsections, count up tree. Only start indenting
// at third level, i.e. not indent on 1.0 and 1.1, but indent on 1.1.1:
level = 0;
ItemInfo iilvl = mySection as ItemInfo;
ItemInfo iilvl = CurSection as ItemInfo;
while (!iilvl.IsProcedure)
{
level++;
@@ -1636,7 +1714,7 @@ namespace Volian.Print.Library
// need to do the section number, section title & page number. Page number
// has to be put on at end after number of page is known, so use a Template.
bool didGrp = false;
string tmptxt = mySection.MyContent.Number == null || mySection.MyContent.Number == "" ? " " : mySection.DisplayNumber;// B2017-019 - process "<u>" in section number
string tmptxt = CurSection.MyContent.Number == null || CurSection.MyContent.Number == "" ? " " : CurSection.DisplayNumber;// B2017-019 - process "<u>" in section number
if (tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCRemoveGrpNameInSects
&& tocGrpHeading.Length > 0 && tmptxt.ToUpper().Contains(tocGrpHeading))
{
@@ -1665,7 +1743,7 @@ namespace Volian.Print.Library
// logic put in for V.C. Summer who wants to their auto table of contents to print "OPERATOR ACTIONS" (set in the format) instead of "Procedure Steps"
// - note that Summer didn't want to change the section title because they want transition to say "procedure step" for the section title. 03/08/2016
string tocSecTitle = mySection.FormattedDisplayText;// B2017-019 - process "<u>" in section title
string tocSecTitle = CurSection.FormattedDisplayText;// B2017-019 - process "<u>" in section title
tocSecTitle = ConvertSpecialChars(tocSecTitle, ii.ActiveFormat.PlantFormat.FormatData); // B2019-172 process symbol characters
if (tocSecTitle.ToUpper() == "PROCEDURE STEPS" && tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCProcedureStepsTitle != "")
tocSecTitle = tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCProcedureStepsTitle;
@@ -1731,7 +1809,7 @@ namespace Volian.Print.Library
// adjust ylocation for pagenumber - the ylocation will get reset if the
// section title split on 2 lines and the page number needs to be on the 2nd line.
// Only do this if the title is not empty (the code was meant for if title spans more than a line)
if (retval != ttlRetval && mySection.MyContent.Text != null && mySection.MyContent.Text != "") yLocation += (retval - ttlRetval);
if (retval != ttlRetval && CurSection.MyContent.Text != null && CurSection.MyContent.Text != "") yLocation += (retval - ttlRetval);
// retval = the minimum (further down the page) between section number and
// title - this accounts for multi line title.
@@ -1739,7 +1817,7 @@ namespace Volian.Print.Library
lastyLocation = retval;
// check that the page number should be in the TOC (some BGE sections do not have the page number)
if (!((mySection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DontNumberInTOC) == E_DocStructStyle.DontNumberInTOC))
if (!((CurSection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DontNumberInTOC) == E_DocStructStyle.DontNumberInTOC))
{
// add a template for the page number:
// if the space character is not null & is not a space, the we've got to put out
@@ -1790,8 +1868,8 @@ namespace Volian.Print.Library
}
// if in the pre-table of content list, just put the page number out as text.
// otherwise, add a template _MyHelper.MyTOCPageCounts
string key = "TOC" + mySection.ItemID.ToString();
if (mySection.IsAutoTOCSection || _MyHelper.MyTOCPageNums.ContainsKey(key))
string key = "TOC" + CurSection.ItemID.ToString();
if (CurSection.IsAutoTOCSection || _MyHelper.MyTOCPageNums.ContainsKey(key))
{
string pnum = _MyHelper.MyTOCPageNums.ContainsKey(key) ? _MyHelper.MyTOCPageNums[key].ToString() : (_MyHelper.CurrentTOCPageNumber + 1).ToString();
rtfText = GetRtfToC(pnum, tOfC);
@@ -1805,10 +1883,10 @@ namespace Volian.Print.Library
//If the format wants single spacing within subsections (2nd level and lower), then need to figure out
// spacing (vcb1 table of contents)
//bool dosuby = (((tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCLineSpacingSub ?? 1) > 0)
// && (mySection.MyParent.IsSection && ((mySection.Sections != null && mySection.Sections.Count > 0) || (level > 0 && mySection.NextItem != null))))
// && (CurSection.MyParent.IsSection && ((CurSection.Sections != null && CurSection.Sections.Count > 0) || (level > 0 && CurSection.NextItem != null))))
// || didGrp;
doSubY = (((tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCLineSpacingSub ?? 1) > 0)
&& (mySection.MyParent.IsSection && (/* mySection.Sections == null && */ sectCnt < ii.Sections.Count))) // B2016-205
&& (CurSection.MyParent.IsSection && (/* CurSection.Sections == null && */ sectCnt < ii.Sections.Count))) // B2016-205
|| didGrp;
//float spc = (float)(tOfC.TofCLineSpacing ?? 1);
if (doSubY)
@@ -1837,12 +1915,12 @@ namespace Volian.Print.Library
}
// C2021-015: Barakah High Level Steps in Table of Contents - check to see if we need to add the high level steps on
// table of contents for this section, format flag & section has steps:
if (mySection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCAllowHLS &&
mySection.IsStepSection && mySection.Steps != null && mySection.Steps.Count > 0)
yLocation = AddHLSToTOC(tocSection, mySection, tOfC, cb, yPageStart, yLocation, doSubY, level + 1, adjSecTitlePos);
if (CurSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCAllowHLS &&
CurSection.IsStepSection && CurSection.Steps != null && CurSection.Steps.Count > 0)
yLocation = AddHLSToTOC(tocSection, CurSection, tOfC, cb, yPageStart, yLocation, doSubY, level + 1, adjSecTitlePos);
}
float savYLoc = yLocation;
yLocation = AddSectionToTOC(tocSection, mySection, tOfC, cb, yPageStart, yLocation, doSubY);
yLocation = AddSectionToTOC(tocSection, CurSection, tOfC, cb, yPageStart, yLocation, doSubY);
if (savYLoc == yLocation) // nothing was outputted i.e. the subsections are not included on the TOC // B2016-205
{
if (doSubY && sectCnt == ii.Sections.Count)
@@ -2941,11 +3019,28 @@ namespace Volian.Print.Library
private void LoadSectionTree(ItemInfo ii)
{
if (ii.Sections == null) return; // B2021-067 crash on null reference
foreach (SectionInfo si in ii.Sections)
SectionInfo SubSection = null;
if (Convert.ToBoolean(MyPromsPrinter.PrtSectID[2])) // If section is a sub section
{
if (MyPromsPrinter.PrtSectID == -1 || (MyPromsPrinter.PrtSectID > -1 && si.ItemID == MyPromsPrinter.PrtSectID))
foreach (SectionInfo si2 in ii.Sections)
{
if (si.IsStepSection)
if (si2.ItemID == MyPromsPrinter.PrtSectID[0])
{
foreach (SectionInfo subsi in si2.Sections)
{
if (subsi.ItemID == MyPromsPrinter.PrtSectID[0])
{
SubSection = subsi;
}
}
}
}
}
foreach (SectionInfo si in ii.Sections)
if (MyPromsPrinter.PrtSectID[0] == -1 || (MyPromsPrinter.PrtSectID[0] > -1 && si.ItemID == MyPromsPrinter.PrtSectID[0]))
{
if (si.IsStepSection)
{
if (si.Sections != null) LoadSectionTree(si);
}
@@ -2985,37 +3080,37 @@ namespace Volian.Print.Library
}
}
}
}
}
}
}
}
//public class PrintTimer
//{
// private DateTime _StartTime = DateTime.Now;
// public DateTime StartTime
// {
// get { return _StartTime; }
// set { _StartTime = value; }
// }
// private string _Description = "Start";
// public string Description
// {
// get { return _Description; }
// set
// {
// DateTime dtNext = DateTime.Now;
// //Console.WriteLine("{0},'{1}'", TimeSpan.FromTicks(dtNext.Ticks - LastTime.Ticks).TotalSeconds, Description);
// _Description = value;
// _LastTime = dtNext;
// }
// }
// private DateTime _LastTime = DateTime.Now;
// public DateTime LastTime
// {
// get { return _LastTime; }
// set { _LastTime = value; }
// }
//}
}
//public class PrintTimer
//{
// private DateTime _StartTime = DateTime.Now;
// public DateTime StartTime
// {
// get { return _StartTime; }
// set { _StartTime = value; }
// }
// private string _Description = "Start";
// public string Description
// {
// get { return _Description; }
// set
// {
// DateTime dtNext = DateTime.Now;
// //Console.WriteLine("{0},'{1}'", TimeSpan.FromTicks(dtNext.Ticks - LastTime.Ticks).TotalSeconds, Description);
// _Description = value;
// _LastTime = dtNext;
// }
// }
// private DateTime _LastTime = DateTime.Now;
// public DateTime LastTime
// {
// get { return _LastTime; }
// set { _LastTime = value; }
// }
//}