This commit is contained in:
2012-11-08 17:10:04 +00:00
parent daec29dc9a
commit e648a50e9b
12 changed files with 146 additions and 105 deletions

View File

@@ -111,7 +111,7 @@ namespace Volian.Print.Library
{
foreach (vlnParagraph child in this)
{
yPageStart = child.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin);
yPageStart = child.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
}
return yPageStart;
}
@@ -140,7 +140,7 @@ namespace Volian.Print.Library
if (Processed) return yPageStart;
//float localYPageStart = yPageStart;
Processed = true;
if (_PartsAbove != null && _PartsAbove.Count > 0) yPageStart = PartsAbove.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin);
if (_PartsAbove != null && _PartsAbove.Count > 0) yPageStart = PartsAbove.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
if (MyItemInfo.IsHigh && MyItemInfo.MyDocStyle.SpecialStepsFoldout) yPageStart -= SixLinesPerInch;
float yLocation = CalculateYOffset(yPageStart, yTopMargin);
if (MyItemInfo.HasChangeBar && MyPageHelper.ChangeBarDefinition.MyChangeBarType != PrintChangeBar.Without) MyPageHelper.AddChangeBar(DoChangeBar(cb, MyItemInfo, MyPageHelper, XOffset, yLocation, MyPageHelper.MaxRNO, MyItemInfo.ActiveFormat), cbMess);
@@ -200,10 +200,10 @@ namespace Volian.Print.Library
}
}
//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);
if (_PartsBelow != null && _PartsBelow.Count > 0) yPageStart = PartsBelow.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin);
if (_PartsContainer != null && _PartsContainer.Count > 0) yPageStart = PartsContainer.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin);
if (_PartsLeft != null && _PartsLeft.Count > 0) yPageStart = PartsLeft.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
if (_PartsRight != null && _PartsRight.Count > 0) yPageStart = PartsRight.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
if (_PartsBelow != null && _PartsBelow.Count > 0) yPageStart = PartsBelow.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
if (_PartsContainer != null && _PartsContainer.Count > 0) yPageStart = PartsContainer.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
//if (localYPageStart != yPageStart) DebugText.WriteLine("ParToPdf-yPagestartDiff:{0},{1},{2}", MyItemInfo.ItemID, localYPageStart, yPageStart);
return yPageStart;
@@ -462,12 +462,31 @@ namespace Volian.Print.Library
return string.Format("DebugID = {0}, ID={1} Type={2} TypeName='{3}' StepLevel={4} DBSequence={5}", DebugId, MyItemInfo.ItemID, MyItemInfo.FormatStepType, MyItemInfo.FormatStepData==null?"NoStepData":MyItemInfo.FormatStepData.Type, MyItemInfo.StepLevel, MyItemInfo.DBSequence);
}
}
public override float ToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin)
private void ResetDocStyleAndValues(ref float yTopMargin, ref float yBottomMargin)
{
// if this document style has another style that is for pages other than first, we need to
// reset the document style off of this section AND reset docstyle values used.
if ((MyItemInfo.MyActiveSection.MyDocStyle.StructureStyle.Where & E_DocStyleUse.UseOnFirstPage) > 0)
{
float _PointsPerPage = 792;
ItemInfo ii = (ItemInfo)MyItemInfo.MyActiveSection;
int indx = (int)MyItemInfo.MyActiveSection.MyDocStyle.IndexOtherThanFirstPage;
foreach (DocStyle ds in ii.ActiveFormat.PlantFormat.DocStyles.DocStyleList)
{
if (ds.Index == indx)
{
MyItemInfo.MyActiveSection.MyDocStyle = ds;
break;
}
}
MyPageHelper.DidFirstPageDocStyle = true;
MyPageHelper.MySection = (SectionInfo)MyItemInfo.MyActiveSection;
yTopMargin = _PointsPerPage - (float)MyItemInfo.MyActiveSection.MyDocStyle.Layout.TopMargin;
yBottomMargin = Math.Max(0, yTopMargin - (float)MyItemInfo.MyActiveSection.MyDocStyle.Layout.PageLength);
}
}
public override float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin)
{
#if AllButFirstPage
// 792: 72 * 11 inches - TopRow - Top is high value
float _PointsPerPage = 792;
#endif
if (IsWordDocPara)
{
PdfReader tmp = null;
@@ -484,9 +503,7 @@ namespace Volian.Print.Library
DebugText.WriteLine("ToPdf1:{0},'{1}',{2},{3},{4},{5}", MyItemInfo.ItemID, MyItemInfo.ShortSearchPath, XOffset, yLocation, yPageStart, YTopMost);
int paginate = Paginate(yLocation, yTopMargin, yBottomMargin);
bool firstHighLevelStep = MyItemInfo.IsHigh && (MyItemInfo.MyPrevious == null);
#if AllButFirstPage
SectionInfo currentSectionInfo = MyItemInfo.ActiveSection as SectionInfo;//MyItemInfo as SectionInfo;
#endif
switch (paginate)
{
case 0: // No page break
@@ -499,19 +516,8 @@ namespace Volian.Print.Library
break;
case 1: // Break on High Level Step
OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
#if AllButFirstPage
// need logic for AllButFirstPage
// recac yTopMargin, YBottomMargin, YTopMost???
currentSectionInfo.DidFirstPageDocStyle = true;
//MyItemInfo.DidFirstPageDocStyle = true;
yTopMargin = _PointsPerPage - (float)currentSectionInfo.MyDocStyle.Layout.TopMargin; //(float)MyItemInfo.MyDocStyle.Layout.TopMargin;
yBottomMargin = Math.Max(0, yTopMargin - (float)currentSectionInfo.MyDocStyle.Layout.PageLength); //(float)MyItemInfo.MyDocStyle.Layout.PageLength);
#endif
cb.PdfDocument.NewPage();
#if AllButFirstPage
MyPageHelper.MySection = currentSectionInfo;
#endif
ResetDocStyleAndValues(ref yTopMargin, ref yBottomMargin);
DebugText.WriteLine("Paginate1");
if (MyItemInfo.IsSection)
{
@@ -557,19 +563,8 @@ namespace Volian.Print.Library
}
MyPageHelper.BottomMessage = new vlnText(cb, this, myMsg, myMsg, docstyle.Layout.LeftMargin + XOffsetBox + docstyle.Continue.Bottom.Margin ?? 0, msg_yLocation, docstyle.Continue.Bottom.Font);// MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font);
}
#if AllButFirstPage
// need logic for AllButFirstPage
// recac yTopMargin, YBottomMargin, YTopMost???
//currentSectionInfo.DidFirstPageDocStyle = true;
currentSectionInfo.DidFirstPageDocStyle = true;
//MyItemInfo.DidFirstPageDocStyle = true;
yTopMargin = _PointsPerPage - (float)currentSectionInfo.MyDocStyle.Layout.TopMargin; //(float)MyItemInfo.MyDocStyle.Layout.TopMargin;
yBottomMargin = Math.Max(0, yTopMargin - (float)currentSectionInfo.MyDocStyle.Layout.PageLength); //(float)MyItemInfo.MyDocStyle.Layout.PageLength);
#endif
cb.PdfDocument.NewPage();
#if AllButFirstPage
MyPageHelper.MySection = currentSectionInfo;
#endif
ResetDocStyleAndValues(ref yTopMargin, ref yBottomMargin);
DebugText.WriteLine("Paginate2");
if ((MyItemInfo.ActiveSection.MyDocStyle.StructureStyle.Style ?? 0 & E_DocStructStyle.UseSectionFoldout) != 0 || MyPageHelper.DoFloatingFoldout)
PromsPrinter.DoFoldoutPage(cb, "Break within Step", MyPageHelper.TextLayer, MyPageHelper); // temporary foldout
@@ -602,19 +597,8 @@ namespace Volian.Print.Library
if (!firstHighLevelStep)
{
OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
#if AllButFirstPage
// need logic for AllButFirstPage
// recac yTopMargin, YBottomMargin, YTopMost???
currentSectionInfo.DidFirstPageDocStyle = true;
//MyItemInfo.DidFirstPageDocStyle = true;
yTopMargin = _PointsPerPage - (float)currentSectionInfo.MyDocStyle.Layout.TopMargin; //(float)MyItemInfo.MyDocStyle.Layout.TopMargin;
yBottomMargin = Math.Max(0, yTopMargin - (float)currentSectionInfo.MyDocStyle.Layout.PageLength); //(float)MyItemInfo.MyDocStyle.Layout.PageLength);
#endif
cb.PdfDocument.NewPage(); // HLS (7 lpi) breakif (MyItemInfo.IsSection)
#if AllButFirstPage
MyPageHelper.MySection = currentSectionInfo;
#endif
ResetDocStyleAndValues(ref yTopMargin, ref yBottomMargin);
DebugText.WriteLine("Paginate3");
if (MyItemInfo.IsSection)
{