B2018-021: Pagination of Supplemental Information (this is an additional fix for a previous update on Feb 8)

This commit is contained in:
Kathy Ruffing 2018-02-16 13:20:43 +00:00
parent faeb407c59
commit 90510182a2

View File

@ -2284,29 +2284,32 @@ namespace Volian.Print.Library
// Find the step that has supplemental information from this step down page until a preferred page break is found
// or a regular page break.
// It is used to determine whether there is a supinfo facing page or if there should be a blank page.
private bool FoundStepPageBreak = false;
private int GetIdThatHasSupInfoItems(ItemInfo ii, int startid)
{
if (ii == null) return -1;
FoundStepPageBreak = false;
// if this item has supinfo, return its id
if (ii.SupInfos != null && ii.SupInfos.Count > 0) return ii.SupInfos[0].ItemID;
// see if any substeps of this item have supinfo, and if so, return the substep's id
int id = GetSubThatHasSupInfoItems(ii, startid);
if (id == -2) return -1;
if (id != -1) return id;
if (FoundStepPageBreak) return -1; // Set in GetSubThatHasSupInfoItems
// Now go to the next item, check if it or any of its substeps have supinfo, and if so, return the id
ItemInfo sib = ii.NextItem;
id = GetIdThatHasSupInfoItemsSibNext(sib, startid);
if (id != -1) return id;
if (FoundStepPageBreak) return -1; // Set in GetIdThatHasSupInfoItemsSibNext
// B2017-122: if this is a note or caution off substep, check if substep has supinfo:
if ((ii.IsNote || ii.IsCaution) && !ii.MyParent.IsHigh)
{
if (ii.MyParent.SupInfos != null && ii.MyParent.SupInfos.Count > 0) return ii.MyParent.SupInfos[0].ItemID;
int sbfromNC = GetSubThatHasSupInfoItems(ii.MyParent, startid);
if (sbfromNC == -2) return -1;
if (sbfromNC != -1) return sbfromNC;
if (FoundStepPageBreak) return -1; // Set in GetSubThatHasSupInfoItems
}
// Go to the parent, and find its next and check if it or any of its substeps or next steps or any of their substeps have supinfo,
@ -2339,7 +2342,11 @@ namespace Volian.Print.Library
if (supInfoSect == null) supInfoSect = SectionInfo.Get(ii.ActiveSection.ItemID);
// if there is a pagebreak on this step section step, quit looking for supinfos. The
// break has to occur here.
if (supInfoSect.StepSectPageBreaks.Contains(ii.ItemID)) return -1;
if (supInfoSect.StepSectPageBreaks.Contains(ii.ItemID))
{
FoundStepPageBreak = true;
return -1;
}
if (ii.SupInfos != null && ii.SupInfos.Count > 0)
{
// check if this is in the list of page breaks for supinfos, if not it may have one of its cautions/notes rather than its id:
@ -2377,12 +2384,20 @@ namespace Volian.Print.Library
{
foreach (ItemInfo iic in pi.MyItems)
{
if (iic.SupInfos != null && iic.SupInfos.Count > 0) return iic.SupInfos[0].ItemID;
// B2018-021: added code to be sure that check isn't on current step, i.e. startid != iic.ItemID
if (startid != iic.ItemID && supInfoSect.StepSectPageBreaks.Contains(iic.ItemID)) return -2; // B2017-192: -2 flags that a page break within substep was found, return
int id = GetSubThatHasSupInfoItems(iic, startid);
if (id == -2) return -1;
if (id != -1) return id;
// B2018-021: added code to be sure that check isn't on current step, i.e. startid != iic.ItemID &
// flag when the following page break is found so the next supplemental information page isn't printed
// on a step where the step is on the following page from the one we are looking for.
if (startid != iic.ItemID)
{
if (supInfoSect.StepSectPageBreaks.Contains(iic.ItemID))
{
FoundStepPageBreak = true;
return -1;
}
if (iic.SupInfos != null && iic.SupInfos.Count > 0) return iic.SupInfos[0].ItemID;
int id = GetSubThatHasSupInfoItems(iic, startid);
if (id != -1) return id;
}
}
}
}