Use vlnParagraph for footnotes so that Change Bars will print (rather than vlnText)

This commit is contained in:
Kathy Ruffing 2014-12-02 15:26:25 +00:00
parent 4ba00691c2
commit 234f55ea77
2 changed files with 49 additions and 30 deletions

View File

@ -84,8 +84,8 @@ namespace Volian.Print.Library
get { return _NotesToFootNotesHLS; }
set { _NotesToFootNotesHLS = value; }
}
private List<vlnText> _NotesToFootNotes = new List<vlnText>();
public List<vlnText> NotesToFootNotes
private List<vlnParagraph> _NotesToFootNotes = new List<vlnParagraph>();
public List<vlnParagraph> NotesToFootNotes
{
get { return _NotesToFootNotes; }
set { _NotesToFootNotes = value; }
@ -213,6 +213,7 @@ namespace Volian.Print.Library
AddBookmarks(writer);
MyPageCounts.CanIncrement = true;
base.OnEndPage(writer, document);
DrawFootnotes(writer.DirectContent);
DrawChangeBars(writer.DirectContent);
DrawMessages(writer.DirectContent);
if (!CreatingFoldoutPage)
@ -582,6 +583,28 @@ namespace Volian.Print.Library
}
PageBookmarks.Clear();
}
private void DrawFootnotes(PdfContentByte cb)
{
float tmp = 0;
if (NotesToFootNotes != null && NotesToFootNotes.Count > 0)
{
float _PointsPerPage = 792;
float yTopMargin = _PointsPerPage - (float)MySection.MyDocStyle.Layout.TopMargin;
float myYOff = NotesToFootNotesYoffset;
foreach (vlnParagraph ntfn in NotesToFootNotes)
{
// subtract from yTopMargin to take the location from the 'roll of paper'
// to the physical page location.
ntfn.YOffset = yTopMargin - myYOff;
ntfn.YTopMost = yTopMargin - myYOff;
ntfn.Processed = false; // process from here
ntfn.ToPdf(cb, yTopMargin, ref yTopMargin, ref tmp);
myYOff -= (ntfn.Height); // - vlnPrintObject.SixLinesPerInch);
}
NotesToFootNotes = null;
}
}
private void DrawMessages(PdfContentByte cb)
{
float tmp = 0;
@ -631,17 +654,6 @@ namespace Volian.Print.Library
BottomMessageA.ToPdf(cb, 0, ref tmp, ref tmp);
BottomMessageA = null; // Only output it once.
}
if (NotesToFootNotes != null)
{
float myYOff = NotesToFootNotesYoffset;
foreach (vlnText ntfn in NotesToFootNotes)
{
ntfn.YOffset = myYOff;
myYOff -= ntfn.Height;
ntfn.ToPdf(cb, 0, ref tmp, ref tmp);
}
NotesToFootNotes = null;
}
}
public void DrawBottomMessage(PdfContentByte cb)
{
@ -829,8 +841,8 @@ namespace Volian.Print.Library
float tolerance = vlnPrintObject.SixLinesPerInch;
if (cb.MyParent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm &&
(vcb.MyParent.MyItemInfo.IsTable || cb.MyParent.MyItemInfo.IsTable || cb.BottomIsTable)) tolerance *= 1.5f;
if (cb.MyParent.MyItemInfo.MyHLS.ItemID != vcb.MyParent.MyItemInfo.MyHLS.ItemID) return false;
bool bothFootnotes = cb.MyParent.MyItemInfo.IsFootnote && vcb.MyParent.MyItemInfo.IsFootnote;
if (!bothFootnotes && cb.MyParent.MyItemInfo.MyHLS.ItemID != vcb.MyParent.MyItemInfo.MyHLS.ItemID) return false;
// cb.Yoffset is within range of vcb:
if (cb.YOffset <= vcb.YOffset &&
cb.YOffset >= (vcb.YChangeBarBottomExtend - tolerance)) return true;

View File

@ -83,7 +83,7 @@ namespace Volian.Print.Library
if (iChildItemInfo.IsFootnote)
{
vlnParagraph para = new vlnParagraph(Parent, cb, iChildItemInfo, xoff, yoff, rnoLevel, maxRNO, formatInfo, null, null, yoffRight, true, iChildItemInfo.IsSection ? pp :null);
continue; // don't add it, vlnParagraph adds this item to the footnote vlntext list in ToPdf.
continue; // don't add it, vlnParagraph adds this item to the footnote list in ToPdf.
}
maxRNO = maxRnoSav;
if (iChildItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.DiffContActBox && iChildItemInfo.IsHigh) bxIndex = null;
@ -418,6 +418,7 @@ namespace Volian.Print.Library
// _MyLog.WarnFormat("NoteTab '{0}','{1}','{2}','{3}','{4}','{5}','{6}'", (PartsAbove[0] as vlnHeader).Text, (PartsLeft[0] as vlnTab).Text, MyItemInfo.MyProcedure.DisplayNumber, MyItemInfo.MyHLS.DisplayText,
// MyItemInfo.ShortPath, MyItemInfo.FormatStepData.TabData.IdentPrint, MyItemInfo.FormatStepData.TabData.IdentEdit);
//
if (MyItemInfo.IsFootnote && Processed) return yPageStart;
if (MyItemInfo.PageNumber == 0) MyItemInfo.PageNumber = MyPageHelper.CurrentPageNumber;
else if (MyItemInfo.PageNumberUsed != 0 && MyItemInfo.PageNumberUsed != MyPageHelper.CurrentPageNumber)
{
@ -1048,6 +1049,7 @@ namespace Volian.Print.Library
private static bool DoSubs = true; // flag whether to print substeps (don't if doing continued checklist header)
public override float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin)
{
if (MyItemInfo.IsFootnote && Processed) return yPageStart;
bool doThreeContinues = false;
// For BGE, the very first subsection's pagelist items were not correct - the section/meta section titles were
// at the wrong level. Reset the page helper's section.
@ -1110,7 +1112,7 @@ namespace Volian.Print.Library
case 1: // Break on High Level Step
OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
docstyle = MyItemInfo.MyDocStyle;
if (MyPageHelper.NotesToFootNotes != null) MyPageHelper.NotesToFootNotesYoffset = yLocation;
if (MyPageHelper.NotesToFootNotes != null && MyPageHelper.NotesToFootNotes.Count > 0) MyPageHelper.NotesToFootNotesYoffset = CalculateYLocation(yLocation, yTopMargin);
bool doSectionContinue = !MyItemInfo.IsSection && ((docstyle.StructureStyle.Style & E_DocStructStyle.BottomSectionContinue) == E_DocStructStyle.BottomSectionContinue);
if (doSectionContinue) DoBottomContinueMsg(cb, yBottomMargin, yLocation, docstyle, false);
cb.PdfDocument.NewPage();
@ -1196,7 +1198,7 @@ namespace Volian.Print.Library
}
}
}
if (MyPageHelper.NotesToFootNotes != null) MyPageHelper.NotesToFootNotesYoffset = yLocation;
if (MyPageHelper.NotesToFootNotes != null && MyPageHelper.NotesToFootNotes.Count > 0) MyPageHelper.NotesToFootNotesYoffset = CalculateYLocation(yLocation, yTopMargin);
DoBottomContinueMsg(cb, yBottomMargin, yLocation, docstyle, doThreeContinues);
cb.PdfDocument.NewPage();
if (MyItemInfo.IsStep && ((MyItemInfo.MyActiveSection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PageListSpBckgrnd) == E_DocStructStyle.DSS_PageListSpBckgrnd))
@ -1318,7 +1320,7 @@ namespace Volian.Print.Library
if (!firstHighLevelStep)
{
OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
if (MyPageHelper.NotesToFootNotes != null) MyPageHelper.NotesToFootNotesYoffset = yLocation;
if (MyPageHelper.NotesToFootNotes != null && MyPageHelper.NotesToFootNotes.Count > 0) MyPageHelper.NotesToFootNotesYoffset = CalculateYLocation(yLocation, yTopMargin);
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);
@ -1431,7 +1433,7 @@ namespace Volian.Print.Library
}
}
// see if this hls has footnotes, add to the footnote datastructure for processing at end of pgae.
// see if this hls has footnotes, add to the footnote datastructure for processing at end of page.
if (MyItemInfo.IsHigh && MyPageHelper.NotesToFootNotesHLS.ContainsKey(MyItemInfo.ItemID)) AddFootNote(cb);
yPageStart = ChildrenAbove.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
@ -1545,7 +1547,7 @@ namespace Volian.Print.Library
// if doing NotesToFootnotes (Calvert valve list format), get the bottom location so that
// footnotes will be printed after last text on page. This is used for the end of the section.
// Pages that broke within pagination logic above had footnote location set during pagination code.
if (MyPageHelper.NotesToFootNotes != null)
if (MyPageHelper.NotesToFootNotes != null && MyPageHelper.NotesToFootNotes.Count > 0)
MyPageHelper.NotesToFootNotesYoffset = CalculateYLocation(yPageStart - YBottomMost, yTopMargin);
return yPageStart;
@ -1558,16 +1560,16 @@ namespace Volian.Print.Library
List<int> myNotes = MyPageHelper.NotesToFootNotesHLS[MyItemInfo.ItemID];
foreach (int myNote in myNotes)
{
ItemInfo inote = ItemInfo.Get(myNote);
ItemInfo inote = StepInfo.Get(myNote);
// first check if this exact text is already in the foot note list. If it is
// in there, don't add it.
bool inlist = false;
if (MyPageHelper.NotesToFootNotes != null)
{
foreach (vlnText vt in MyPageHelper.NotesToFootNotes)
foreach (vlnParagraph vp in MyPageHelper.NotesToFootNotes)
{
if (vt.Text == inote.MyContent.Text)
if (vp.MyItemInfo.MyContent.Text == inote.MyContent.Text)
{
inlist = true;
break;
@ -1576,10 +1578,12 @@ namespace Volian.Print.Library
}
if (!inlist)
{
vlnText ntTxt = new vlnText(cb, null, inote.MyContent.Text, inote.MyContent.Text, (float)MyItemInfo.MyDocStyle.Layout.LeftMargin, 0, inote.FormatStepData.Font);
ntTxt.Width = (float)MyItemInfo.MyDocStyle.Layout.PageWidth - (float)MyItemInfo.MyDocStyle.Layout.LeftMargin;
if (MyPageHelper.NotesToFootNotes == null) MyPageHelper.NotesToFootNotes = new List<vlnText>();
MyPageHelper.NotesToFootNotes.Add(ntTxt);
vlnParagraph vpFNote = new vlnParagraph(null, cb, inote, (float)MyItemInfo.MyDocStyle.Layout.LeftMargin, 0, 0, 0, MyItemInfo.ActiveFormat, null, null, 0, false, null);
vpFNote.Width = (float)MyItemInfo.MyDocStyle.Layout.PageWidth - (float)MyItemInfo.MyDocStyle.Layout.LeftMargin;
vpFNote.Height = 0;
vpFNote.XOffset = (float)MyItemInfo.MyDocStyle.Layout.LeftMargin;
if (MyPageHelper.NotesToFootNotes == null) MyPageHelper.NotesToFootNotes = new List<vlnParagraph>();
MyPageHelper.NotesToFootNotes.Add(vpFNote);
}
}
MyPageHelper.NotesToFootNotesHLS.Remove(MyItemInfo.ItemID);
@ -2162,7 +2166,7 @@ namespace Volian.Print.Library
Suffix = suffix;
MyItemInfo = itemInfo;
MyContentByte = cb;
if (itemInfo.IsFootnote)
if (itemInfo.IsFootnote && loadChildren)
{
// notestofootnoteshls is a list, a hls can have more than one note
if (MyPageHelper.NotesToFootNotesHLS.ContainsKey(itemInfo.MyHLS.ItemID))
@ -2173,6 +2177,7 @@ namespace Volian.Print.Library
notesList.Add(itemInfo.ItemID);
MyPageHelper.NotesToFootNotesHLS.Add(itemInfo.MyHLS.ItemID, notesList);
}
Processed = true; // don't want to print during normal ToPdf/ParagraphToPdf cycle - print in vlnsvgpagehelper
return;
}
// do some 'setup' for Calvert Alarms:
@ -2211,7 +2216,7 @@ namespace Volian.Print.Library
if (MyTopRNO != null) MyTopRNO.LastRNO = this;
}
if (!MyPageHelper.MyParagraphs.ContainsKey(itemInfo.ItemID)) MyPageHelper.MyParagraphs.Add(itemInfo.ItemID, this);
if (!MyPageHelper.MyParagraphs.ContainsKey(itemInfo.ItemID) && !itemInfo.IsFootnote) MyPageHelper.MyParagraphs.Add(itemInfo.ItemID, this);
// if this a continuous subsection, refresh the style.
// This was commented out to fix a Westinghouse print issue 3-21-2014, orignally put in for Farley
@ -2254,6 +2259,8 @@ namespace Volian.Print.Library
float xMetaAdj = 0;
if (itemInfo.IsFootnote) itemInfo.MyTab = null;
if (itemInfo.MyTab != null && itemInfo.MyTab.Text != null && itemInfo.MyTab.Text != "")
{
float localXOffset = XOffset;