diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index d0dc8a56..1abe4714 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -835,7 +835,13 @@ namespace VEPROMS.CSLA.Library level += item.ParentAndOrCount; // First substep, this is where it uses the orphan logic from above. - if (!item.IsRNOPart && !item.IsHigh && item.MyPrevious == null) + + // The check for the parent.IsNote was added for Calvert OI3/OI-1A, section 5, step H. This is a + // very long step with a very long note (multiple notes each having 1 or more ANDs). Without + // the addition of the parent.IsNote, the note was breaking between 2 ANDs (the 1st AND was a + // steplevel of 5, but the 2nd was a steplevel of 4). If something similar is seen with Cautions, + // that check could be added. + if (!item.IsRNOPart && !item.IsHigh && (item.MyPrevious == null || item.MyParent.IsNote)) level += firstInc; else firstInc = 0; diff --git a/PROMS/Volian.Print.Library/Pagination.cs b/PROMS/Volian.Print.Library/Pagination.cs index 979e55e4..9959d85b 100644 --- a/PROMS/Volian.Print.Library/Pagination.cs +++ b/PROMS/Volian.Print.Library/Pagination.cs @@ -571,7 +571,8 @@ namespace Volian.Print.Library paraBreak = FindPageBreak(yStart, ySpaceOnCurPage-accountForCalvertAlarmConditionResponseFooter, yLowerLimit, myList, lastBreak, yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace, myBottomMsgSpace,MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].ContinueOnly); - //Console.WriteLine("Break at {0}", paraBreak.MyItemInfo.ShortPath);//Comment Out before release + // Do Not Remove: The following is used for debug - useful place to debug + //if (paraBreak.MyItemInfo.InList(207, 211, 214, 219, 221, 216, 197)) Console.WriteLine("BUILD2: Break at {0}", paraBreak.MyItemInfo.ShortPath);//Comment Out before release //if (lastBreak != null && lastBreak.MyItemInfo.InList(80091, 1985)) // Console.WriteLine("After 80091 {0}",paraBreak.ToString()); if (paraBreak == null) @@ -878,7 +879,8 @@ namespace Volian.Print.Library } while (myPara.MyParent.YTop == myPara.YTop) myPara = myPara.MyParent; int everyNLines = myPara.MyItemInfo.MyPrevious != null && myPara.MyItemInfo.FormatStepData == null ? 1 : myPara.MyItemInfo.FormatStepData.StepLayoutData.EveryNLines ?? 1; - if (myPara.ChildrenAbove.Count==0 && wcnChkLstBorder - yLocation < yUpperLimit + yAddForBtmMsg || (everyNLines != 99 && (wcnChkLstBorder - yLocation == yUpperLimit + yAddForBtmMsg))) // Fix for OFN-RJ-23 + bool inSameBox = InSameBox(myPara, minPara2); // if this note/caution is in same box as the break, don't break within the notes/cautions in the same box + if (!inSameBox && myPara.ChildrenAbove.Count == 0 && wcnChkLstBorder - yLocation < yUpperLimit + yAddForBtmMsg || (everyNLines != 99 && (wcnChkLstBorder - yLocation == yUpperLimit + yAddForBtmMsg))) // Fix for OFN-RJ-23 //if (-yLocation < yUpperLimit) // Before //if (-yLocation < yWithinMargins && myList[stepLevel][yLocation].MyItemInfo.MyPrevious != null) { @@ -911,10 +913,30 @@ namespace Volian.Print.Library } //DebugPagination.Write(minBuff.ToString()); if (-yLocationMin > yUpperLimit && minPara2 != null) minPara = null; + + // if breaking at a note/caution - don't break within the same box. Clear minPara (like code above) + // so that minPara2 is used. + if (minPara != null && minPara2 != null && ((minPara2.MyItemInfo.IsCautionPart && minPara.MyItemInfo.IsCaution) || (minPara2.MyItemInfo.IsNotePart && minPara.MyItemInfo.IsNote)) + && minPara.MyItemInfo.FirstSibling.ItemID == minPara2.MyItemInfo.ItemID) minPara = null; + //if (minPara != null) DebugPagination.WriteLine("### 111111 {0}", minPara); //if(minPara2 != null) DebugPagination.WriteLine("### n222222 {0}", minPara2); return minPara ?? minPara2; } + private static bool InSameBox(vlnParagraph myPara, vlnParagraph minPara2) + { + // see if this paragraph is a note/caution or in a note/caution where its 1st sibling is the input minPara2 (this + // is the next best-case page break location. This was added for Calvert's OI3/OI-1A/Section 5/Step H.3. Without it + // the page break occurred in the middle of the list of notes. + if (minPara2 == null) return false; + if ((myPara.MyItemInfo.IsCaution || myPara.MyItemInfo.IsNote || myPara.MyItemInfo.MyParent.IsCaution || myPara.MyItemInfo.MyParent.IsNote) && minPara2 != null) + { + ItemInfo mync = (myPara.MyItemInfo.IsNote || myPara.MyItemInfo.IsCaution) ? myPara.MyItemInfo : myPara.MyItemInfo.MyParent; + if (mync == null) return false; + if (mync.FirstSibling.ItemID == minPara2.MyItemInfo.ItemID) return true; + } + return false; + } private static int MaxBreakLevel(float yLocation, StepLevelList myList, int maxLevel, vlnParagraph myParaBreak) { foreach (int stepLevel in myList.Keys) @@ -924,6 +946,8 @@ namespace Volian.Print.Library { vlnParagraph myPara = myList[stepLevel][yLoc]; //DebugPagination.WriteLine("'MaxBreakLevel',{0},{1},'{2}'", myPara.MyItemInfo.ItemID, stepLevel, myPara.MyItemInfo.ShortPath); + Console.WriteLine("'MaxBreakLevel',{0},{1},'{2}'", myPara.MyItemInfo.ItemID, stepLevel, myPara.MyItemInfo.ShortPath); + if (!myPara.HasAncestor(myParaBreak)) maxLevel = stepLevel; }