From a2bb2930284ccc9e0c5a31a56d3352e87680adb9 Mon Sep 17 00:00:00 2001 From: Kathy Date: Tue, 10 Jan 2012 14:46:05 +0000 Subject: [PATCH] --- .../Volian.Print.Library/VlnSvgPageHelper.cs | 11 ++++++++-- PROMS/Volian.Print.Library/vlnParagraph.cs | 22 ++++++++++++++++--- PROMS/Volian.Svg.Library/iTextSharp.cs | 6 +++++ 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs index 20408c1f..e9ed4f97 100644 --- a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs +++ b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs @@ -64,6 +64,7 @@ namespace Volian.Print.Library set { MyPageCounts = new PageCounts(); + MyTOCPageCounts = new PageCounts(); _MyPdfWriter = value; } } @@ -96,6 +97,8 @@ namespace Volian.Print.Library DrawMessages(writer.DirectContent); if (!CreatingFoldoutPage) DrawRuler(writer.DirectContent); + if ((MySection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DontCountInTabOfCont) == 0) + CurrentTOCPageNumber++; } else { @@ -103,7 +106,8 @@ namespace Volian.Print.Library base.OnEndPage(writer, document); if (!CreatingFoldoutPage) DrawRuler(writer.DirectContent); - + if ((MySection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DontCountInTabOfCont) == 0) + CurrentTOCPageNumber++; } YMultiplier = 1; } @@ -418,6 +422,7 @@ namespace Volian.Print.Library return mySvg; } public PageCounts MyPageCounts = null; + public PageCounts MyTOCPageCounts = null; private static Regex regexFindToken = new Regex("{[^{}]*}"); private string mySvg_ProcessText(object sender, SvgProcessTextArgs args) { @@ -434,6 +439,7 @@ namespace Volian.Print.Library MyPdfContentByte.AddTemplate(MyPageCounts.AddToTemplateList(key, MyPdfWriter, txt, args.MySvgText.Font, args.MySvgText.Align, args.MySvgText.FillColor), args.MySvgScale.X(args.MySvgText.X), args.MySvgScale.Y(MyPdfContentByte, args.MySvgText.Y)); return string.Empty; } + string tocKey = "TOC" + MySection.ItemID.ToString(); if (args.MyText.Contains("{PAGE}") || args.MyText.Contains("{OF}")) { #region numberingseq @@ -457,6 +463,7 @@ namespace Volian.Print.Library // default for the key is to make it NumberingSequence. Then handle // specific cases. string key = ((int)MySection.MyDocStyle.NumberingSequence).ToString(); + E_NumberingSequence numseq = MySection.MyDocStyle.NumberingSequence??0; switch (numseq) { @@ -484,7 +491,7 @@ namespace Volian.Print.Library PdfTemplate tmp = MyPageCounts.AddToTemplateList(key, MyPdfWriter, args.MyText, args.MySvgText.Font, args.MySvgText.Align, args.MySvgText.FillColor); // Proms page numbering designed requires a "{PAGE}" token to increment the page counter. So the easiest way // to do that was to add a "{PAGE}" token to every page that is flagged as not to be printed. - if(!args.MyText.StartsWith("Non-printing ")) MyPdfContentByte.AddTemplate(tmp, args.MySvgScale.X(args.MySvgText.X), args.MySvgScale.Y(MyPdfContentByte, args.MySvgText.Y)); + if (!args.MyText.StartsWith("Non-printing ")) MyPdfContentByte.AddTemplate(tmp, args.MySvgScale.X(args.MySvgText.X), args.MySvgScale.Y(MyPdfContentByte, args.MySvgText.Y)); return string.Empty; } if (args.MyText.Contains("{FINALPAGE}")) diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index fdc1af03..b5710401 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -161,6 +161,20 @@ namespace Volian.Print.Library new PdfDestination(PdfDestination.FITBH, yLocation + YVeryTop - YTopMost + SixLinesPerInch)); } } + if (MyItemInfo.IsSection) + { + SectionConfig sc = MyItemInfo.MyConfig as SectionConfig; + if (sc != null && sc.Section_TOC == "Y") + { + string tocKey = string.Format("TOC{0}", MyItemInfo.ItemID); + if (MyPageHelper.MyTOCPageCounts.ContainsKey(tocKey)) + { + PageCount pc = MyPageHelper.MyTOCPageCounts[tocKey]; + pc.Total = MyPageHelper.CurrentPageNumber; + pc.DrawTemplates(); + } + } + } //Height = yLocation - retval; if (_PartsLeft != null && _PartsLeft.Count > 0) yPageStart = PartsLeft.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin); if (_PartsRight != null && _PartsRight.Count > 0) yPageStart = PartsRight.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin); @@ -1639,15 +1653,17 @@ namespace Volian.Print.Library } public void AdjustWidth(ItemInfo itemInfo, int maxRNO, FormatInfo formatInfo, vlnTab myTab) { + int typ = ((int)itemInfo.MyContent.Type) % 10000; + int? bxIndx = itemInfo.IsStep ? formatInfo.PlantFormat.FormatData.StepDataList[typ].StepLayoutData.STBoxindex : null; float? widOvrd = itemInfo.FormatStepData == null ? null : itemInfo.FormatStepData.WidthOverride; if ((widOvrd??0) != 0) { Width = (float)widOvrd; - return; + // if there's a box, we may need to do an adjustment on the width, if the tab data was changed + // so don't return. + if (bxIndx == null) return; } float tabWidth = (myTab == null) ? 0 : myTab.Width; - int typ = ((int)itemInfo.MyContent.Type) % 10000; - int? bxIndx = itemInfo.IsStep ? formatInfo.PlantFormat.FormatData.StepDataList[typ].StepLayoutData.STBoxindex : null; if (bxIndx != null) { Box bx = formatInfo.PlantFormat.FormatData.BoxList[(int)bxIndx]; diff --git a/PROMS/Volian.Svg.Library/iTextSharp.cs b/PROMS/Volian.Svg.Library/iTextSharp.cs index e9377ea4..1400ec4d 100644 --- a/PROMS/Volian.Svg.Library/iTextSharp.cs +++ b/PROMS/Volian.Svg.Library/iTextSharp.cs @@ -858,6 +858,12 @@ namespace Volian.Svg.Library get { return _CurrentPageNumber; } set { _CurrentPageNumber = value; } } + private int _CurrentTOCPageNumber = 0; + public int CurrentTOCPageNumber + { + get { return _CurrentTOCPageNumber; } + set { _CurrentTOCPageNumber = value; } + } private bool _OnFoldoutPage = false; public bool OnFoldoutPage {