This commit is contained in:
Kathy Ruffing 2012-01-10 14:46:05 +00:00
parent 38ef93b9fd
commit a2bb293028
3 changed files with 34 additions and 5 deletions

View File

@ -64,6 +64,7 @@ namespace Volian.Print.Library
set set
{ {
MyPageCounts = new PageCounts(); MyPageCounts = new PageCounts();
MyTOCPageCounts = new PageCounts();
_MyPdfWriter = value; _MyPdfWriter = value;
} }
} }
@ -96,6 +97,8 @@ namespace Volian.Print.Library
DrawMessages(writer.DirectContent); DrawMessages(writer.DirectContent);
if (!CreatingFoldoutPage) if (!CreatingFoldoutPage)
DrawRuler(writer.DirectContent); DrawRuler(writer.DirectContent);
if ((MySection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DontCountInTabOfCont) == 0)
CurrentTOCPageNumber++;
} }
else else
{ {
@ -103,7 +106,8 @@ namespace Volian.Print.Library
base.OnEndPage(writer, document); base.OnEndPage(writer, document);
if (!CreatingFoldoutPage) if (!CreatingFoldoutPage)
DrawRuler(writer.DirectContent); DrawRuler(writer.DirectContent);
if ((MySection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DontCountInTabOfCont) == 0)
CurrentTOCPageNumber++;
} }
YMultiplier = 1; YMultiplier = 1;
} }
@ -418,6 +422,7 @@ namespace Volian.Print.Library
return mySvg; return mySvg;
} }
public PageCounts MyPageCounts = null; public PageCounts MyPageCounts = null;
public PageCounts MyTOCPageCounts = null;
private static Regex regexFindToken = new Regex("{[^{}]*}"); private static Regex regexFindToken = new Regex("{[^{}]*}");
private string mySvg_ProcessText(object sender, SvgProcessTextArgs args) 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)); 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; return string.Empty;
} }
string tocKey = "TOC" + MySection.ItemID.ToString();
if (args.MyText.Contains("{PAGE}") || args.MyText.Contains("{OF}")) if (args.MyText.Contains("{PAGE}") || args.MyText.Contains("{OF}"))
{ {
#region numberingseq #region numberingseq
@ -457,6 +463,7 @@ namespace Volian.Print.Library
// default for the key is to make it NumberingSequence. Then handle // default for the key is to make it NumberingSequence. Then handle
// specific cases. // specific cases.
string key = ((int)MySection.MyDocStyle.NumberingSequence).ToString(); string key = ((int)MySection.MyDocStyle.NumberingSequence).ToString();
E_NumberingSequence numseq = MySection.MyDocStyle.NumberingSequence??0; E_NumberingSequence numseq = MySection.MyDocStyle.NumberingSequence??0;
switch (numseq) 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); 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 // 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. // 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; return string.Empty;
} }
if (args.MyText.Contains("{FINALPAGE}")) if (args.MyText.Contains("{FINALPAGE}"))

View File

@ -161,6 +161,20 @@ namespace Volian.Print.Library
new PdfDestination(PdfDestination.FITBH, yLocation + YVeryTop - YTopMost + SixLinesPerInch)); 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; //Height = yLocation - retval;
if (_PartsLeft != null && _PartsLeft.Count > 0) yPageStart = PartsLeft.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin); 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); 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) 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; float? widOvrd = itemInfo.FormatStepData == null ? null : itemInfo.FormatStepData.WidthOverride;
if ((widOvrd??0) != 0) if ((widOvrd??0) != 0)
{ {
Width = (float)widOvrd; 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; 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) if (bxIndx != null)
{ {
Box bx = formatInfo.PlantFormat.FormatData.BoxList[(int)bxIndx]; Box bx = formatInfo.PlantFormat.FormatData.BoxList[(int)bxIndx];

View File

@ -858,6 +858,12 @@ namespace Volian.Svg.Library
get { return _CurrentPageNumber; } get { return _CurrentPageNumber; }
set { _CurrentPageNumber = value; } set { _CurrentPageNumber = value; }
} }
private int _CurrentTOCPageNumber = 0;
public int CurrentTOCPageNumber
{
get { return _CurrentTOCPageNumber; }
set { _CurrentTOCPageNumber = value; }
}
private bool _OnFoldoutPage = false; private bool _OnFoldoutPage = false;
public bool OnFoldoutPage public bool OnFoldoutPage
{ {