Logic for more control over indenting and underlining on Auto Table of Contents

Added logic to prevent multiple numbers (on top of each other) from printing on the AutoTableOfContents, added logic to support format defined section continue text, logic to support EndMessageOnEachSubSection, logic to repeat high level step text as part of a continue message
Logic to support DidFirstPageDocStyle flag, logic to support {SECTIONLEVELNUMBER} {SECTIONLEVELTITLE} on the same line of a pagelist item when the section title goes to more than one line.
This commit is contained in:
2014-10-07 19:37:11 +00:00
parent 3162883a66
commit ea01b9bf71
3 changed files with 77 additions and 19 deletions

View File

@@ -478,7 +478,13 @@ namespace Volian.Print.Library
if (MyItemInfo.MyContent.MyGrid != null)
retval = DrawGrid(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation);
else
if (doprint) retval = DrawText(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation);
{
if (doprint)
{
retval = DrawText(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation);
SectionContinuePrinted = true;
}
}
if (MyItemInfo.IsHigh)
{
MyPageHelper.PageBookmarks.Add(MyItemInfo, (MyItemInfo.MyTab == null) ? "" : MyItemInfo.MyTab.CleanText + " " + MyItemInfo.DisplayText,
@@ -499,7 +505,8 @@ namespace Volian.Print.Library
if (MyPageHelper.MyTOCPageCounts.ContainsKey(tocKey))
{
PageCount pc = MyPageHelper.MyTOCPageCounts[tocKey];
pc.Total = MyPageHelper.CurrentTOCPageNumber + 1;
if (pc.Total == 0)
pc.Total = MyPageHelper.CurrentTOCPageNumber + 1;
pc.DrawTemplates();
}
}
@@ -513,6 +520,13 @@ namespace Volian.Print.Library
//if (localYPageStart != yPageStart) DebugText.WriteLine("ParToPdf-yPagestartDiff:{0},{1},{2}", MyItemInfo.ItemID, localYPageStart, yPageStart);
return yPageStart;
}
private bool _SectionContinuePrinted = false;
public bool SectionContinuePrinted
{
get { return _SectionContinuePrinted; }
set { _SectionContinuePrinted = value; }
}
private void DrawChkOrValveTableLines(PdfContentByte cb, ItemInfo ii, float yPageStart, float yTopMargin, float yBottomMargin, float yLocation)
{
if (!ii.IsStep || ii.IsCaution || ii.IsNote) return;
@@ -775,12 +789,13 @@ namespace Volian.Print.Library
}
}
// if printing checklist header, adjust ypagestart & ylocation so that won't get forced pagination (pagination is already ok)
//Console.WriteLine("'Q1',{0},'{1}',{2},{3},{4},{5},{6}", MyItemInfo.ItemID, MyItemInfo.ShortPath, yTopMargin, yPageStart, yLocation, YTopMost, YOffset);
if (PrintHeader)
{
yPageStart = yTopMargin + YVeryTop;
yLocation = yPageStart - YOffset; // yLocation is physical location from bottom of page.
}
if (yLocation - Height < 24) _MyLog.WarnFormat("Very Low {0},{1},{2},{3},{4},{5}",MyItemInfo.ShortPath,MyItemInfo.ItemID,yLocation,Height,yLocation-Height,yTopMargin - MyItemInfo.MyDocStyle.Layout.PageLength);
if (yLocation - Height < 24) _MyLog.WarnFormat("Very Low {0},{1},{2},{3},{4},{5}",MyItemInfo.ShortPath,MyItemInfo.ItemID,yLocation,Height,yLocation-Height,yTopMargin - MyItemInfo.MyDocStyle.Layout.PageLength);
retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, DebugInfo + string.Format(",YLines = {0}",YSize/SixLinesPerInch), yBottomMargin);
if (retval == 0) // problem occurred - paragraph was not able to be printed on page
{ // pagination logic needs to be fixed.
@@ -1002,7 +1017,11 @@ namespace Volian.Print.Library
yPageStart = yTopMargin;
}
else if (MyItemInfo.IsSection || (MyItemInfo.IsHigh && MyItemInfo.MyPrevious != null)) //do not reset for 1st step
{
//Console.WriteLine("'b1',{0},'{1}',{2},{3},{4},{5},{6}", MyItemInfo.ItemID, MyItemInfo.ShortPath, yTopMargin, yPageStart, yLocation, YTopMost, YOffset);
ResetDocStyleAndValues(ref yTopMargin, ref yBottomMargin);
//Console.WriteLine("'a1',{0},'{1}',{2},{3},{4},{5},{6}", MyItemInfo.ItemID, MyItemInfo.ShortPath, yTopMargin, yPageStart, yLocation, YTopMost, YOffset);
}
DebugText.WriteLine("Paginate1");
if (MyItemInfo.IsSection)
{
@@ -1084,7 +1103,10 @@ namespace Volian.Print.Library
}
}
//_MyLog.InfoFormat("NewPage 11 {0}", cb.PdfWriter.CurrentPageNumber);
//Console.WriteLine("'b2',{0},'{1}',{2},{3},{4},{5},{6}", MyItemInfo.ItemID, MyItemInfo.ShortPath, yTopMargin, yPageStart, yLocation, YTopMost, YOffset);
ResetDocStyleAndValues(ref yTopMargin, ref yBottomMargin);
//Console.WriteLine("'a2',{0},'{1}',{2},{3},{4},{5},{6}", MyItemInfo.ItemID, MyItemInfo.ShortPath, yTopMargin, yPageStart, yLocation, YTopMost, YOffset);
DebugText.WriteLine("Paginate2");
if (MyItemInfo.MyHLS.FoldoutIndex() > -1)
PromsPrinter.DoFoldoutPage(cb, "Break within Step", MyPageHelper.TextLayer, MyPageHelper, MyItemInfo.MyHLS.FoldoutIndex(), false); // temporary foldout
@@ -1169,7 +1191,9 @@ namespace Volian.Print.Library
OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
cb.PdfDocument.NewPage(); // HLS (7 lpi) breakif (MyItemInfo.IsSection)
//_MyLog.InfoFormat("NewPage 12 {0}", cb.PdfWriter.CurrentPageNumber);
//Console.WriteLine("'b3',{0},'{1}',{2},{3},{4},{5},{6}", MyItemInfo.ItemID, MyItemInfo.ShortPath, yTopMargin, yPageStart, yLocation, YTopMost, YOffset);
ResetDocStyleAndValues(ref yTopMargin, ref yBottomMargin);
//Console.WriteLine("'a3',{0},'{1}',{2},{3},{4},{5},{6}", MyItemInfo.ItemID, MyItemInfo.ShortPath, yTopMargin, yPageStart, yLocation, YTopMost, YOffset);
DebugText.WriteLine("Paginate3");
if (MyItemInfo.IsSection)
{
@@ -1213,9 +1237,12 @@ namespace Volian.Print.Library
// format must have ContinueSectinHeader format flag set to true
if (doSectionTitleContinued)
{
vlnParagraph sectContPara = new vlnParagraph(MyParent.MyParent, cb, MyItemInfo.ActiveSection, MyParent.XOffset, 0, 0, 0, MyParent.MyItemInfo.ActiveFormat, null, " (Continued)", 0);
vlnParagraph sectContPara;
string contMsg = MyItemInfo.MyActiveSection.MyDocStyle.Continue.SectionTitle.AppendToTitle;
sectContPara = new vlnParagraph(MyParent.MyParent, cb, MyItemInfo.ActiveSection, MyParent.XOffset, 0, 0, 0, MyParent.MyItemInfo.ActiveFormat, null, (contMsg == null ||contMsg == "")?" (Continued)":contMsg, 0);
float mytmpfloat = sectContPara.ParagraphToPdf(cb, yTopMargin, yTopMargin, yBottomMargin);
yPageStart -= sectContPara.Height * 2;
if (sectContPara.SectionContinuePrinted)
yPageStart -= sectContPara.Height * 2;
}
yPageStart = ChildrenAbove.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
yPageStart = ChildrenLeft.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
@@ -1267,7 +1294,7 @@ namespace Volian.Print.Library
if (si.MyActiveParent.IsSection) // is this meta/subsection. Only put end message out on last section
{
ItemInfo mysect = si as ItemInfo;
if (mysect.GetNextItem() != null) _lastSect = false;
if (mysect.GetNextItem() != null && !docstyle.End.EndMessageOnEachSubSection) _lastSect = false;
}
string myMsg = (docstyle.End == null) ? null : docstyle.End.FixedMessage;
if (myMsg != null && !_skipEndMessage && _lastSect)
@@ -1381,6 +1408,19 @@ namespace Volian.Print.Library
if (myMsg.IndexOf(@"%c") > -1)
myMsg = myMsg.Replace(@"%c", " ");
// Top Continue message includes high level step text
// - was going to use for V.C. Summer but ended up not needing it
// - leaving it here for future use - jsj 10/7/2014
//
//if ((docstyle.Continue.Top.HLS ?? 0) == 1)
//{
// string hlsText = "";
// ItemInfo parentStep = MyItemInfo;
// while (!parentStep.IsHigh && parentStep.MyParent != null && !parentStep.IsSection) parentStep = parentStep.MyParent;
// if (parentStep.IsHigh) hlsText = parentStep.FormattedDisplayText;// .DisplayText;
// myMsg = hlsText + myMsg;
//}
// Calvert Alarms, step description have the alarm number as part of the top continue message
// Also, if the break is within the CONDITION/RESPONSE, there are continue messages in both columns at the top
// of the table, note that the continue messages WITHIN table are only printed when the