diff --git a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs index f846c3c6..d6203224 100644 --- a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs +++ b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs @@ -25,11 +25,10 @@ namespace Volian.Print.Library get { return _PageBookmarks; } set { _PageBookmarks = value; } } - private PdfOutline _MyPdfOutline = null; - public PdfOutline MyPdfOutline + private List _MyPdfOutlines = new List(); + public List MyPdfOutlines { - get { return _MyPdfOutline; } - set { _MyPdfOutline = value; } + get { return _MyPdfOutlines; } } private ChkListBoxesHelper _CheckListBoxes = null; private ChkListBoxesHelper CheckListBoxes @@ -540,12 +539,23 @@ namespace Volian.Print.Library { foreach (PageBookmark pb in PageBookmarks) { - if (!pb.MyItemInfo.IsSection && MyPdfOutline != null) - new PdfOutline(MyPdfOutline, pb.PdfDestination,Regex.Replace(pb.Title, @"\\{Prerequisite Step: .*?\\}", ""), false); - else + int lev = pb.Level; + if (MyPdfOutlines.Count < lev || lev==0) { PdfDestination dest = new PdfDestination(PdfDestination.FIT); - MyPdfOutline = new PdfOutline(writer.DirectContent.RootOutline, dest, pb.Title, false); + PdfOutline pdo = new PdfOutline(writer.DirectContent.RootOutline, dest, pb.Title, false); + if (MyPdfOutlines.Count == lev) + MyPdfOutlines.Add(pdo); + else + MyPdfOutlines[lev] = pdo; + } + else + { + PdfOutline pdo = new PdfOutline(MyPdfOutlines[lev-1], pb.PdfDestination,Regex.Replace(pb.Title, @"\\{Prerequisite Step: .*?\\}", ""), false); + if (MyPdfOutlines.Count == lev) + MyPdfOutlines.Add(pdo); + else + MyPdfOutlines[lev] = pdo; } } PageBookmarks.Clear(); @@ -2138,6 +2148,29 @@ namespace Volian.Print.Library _Title = title; _PdfDestination = pdfDestination; } + internal bool IsTopLevel + { + get + { + ItemInfo parent = MyItemInfo.ActiveParent as ItemInfo; + if (parent == null || parent.IsProcedure) return true; + return false; + } + } + internal int Level + { + get + { + int level = 0; + ItemInfo parent = MyItemInfo.ActiveParent as ItemInfo; + while (parent != null && !parent.IsProcedure) + { + level++; + parent = parent.ActiveParent as ItemInfo; + } + return level; + } + } } public class ChangeBarDefinition // anything that is section level should go in here. {