Added gap in centerline for grid for processing VCSummer data

Changed how page length was determined when deciding how to paginate a procedure for processing VCSummer data
Utilized FixedMessage property for processing VCSummer data
Utilized DocStyle.LandscapePageList property for processing VCSummer data
Added gap in centerline for boxes for processing VCSummer data
Changed ToPdf method to pass yTopMargin and yBottomMargin by reference
		Chnaged calls to ToPdf method to pass yTopMargin and yBottomMargin by reference
Changed how vlnParagraph was processed with regards to Notes and Caution boxes to support nuances in VCSummer data
Added code to support macro substitutions in continue messages and end of procedure messages for processing VCSummer data
Added drawing centerline and handling gaps in centerline for processing VCSummer data
Added RomanNumbering of pages for processing VCSummer data
Added classes Gap and Gaps for processing VCSummer data
Utilized MacroTabAdjust property for processing VCSummer data
Changed how vlnText width was calculated for processing VCSummer data
This commit is contained in:
Rich 2013-06-11 18:47:47 +00:00
parent 8f962bc778
commit 7549f62ba9
8 changed files with 196 additions and 77 deletions

View File

@ -125,6 +125,8 @@ namespace Volian.Print.Library
public void ToPdf(iTextSharp.text.pdf.ColumnText myColumnText, float left, float top) public void ToPdf(iTextSharp.text.pdf.ColumnText myColumnText, float left, float top)
{ {
//ZoomGrid(myColumnText, left, top); //ZoomGrid(myColumnText, left, top);
VlnSvgPageHelper myPageHelper = myColumnText.Canvas.PdfWriter.PageEvent as VlnSvgPageHelper;
myPageHelper.AddGap(top, top - Height, left, left + Width);
MyCells.ToPdf(myColumnText, left, top); MyCells.ToPdf(myColumnText, left, top);
} }
private void ZoomGrid(iTextSharp.text.pdf.ColumnText myColumnText, float left, float top) private void ZoomGrid(iTextSharp.text.pdf.ColumnText myColumnText, float left, float top)

View File

@ -29,14 +29,6 @@ namespace Volian.Print.Library
private int Paginate(float yLocation, float yTopMargin, float yBottomMargin) private int Paginate(float yLocation, float yTopMargin, float yBottomMargin)
{ {
float yPageSize = yTopMargin - yBottomMargin; float yPageSize = yTopMargin - yBottomMargin;
// yPageSizeNextPage is the page size of the 'next' page. A format variable exists off of the docstyle
// For UseOnFirstPage vs UseOnAllButFirstPage. If this is set for this format, and processing the FIRST
// page, the size of next page, which may be different, is used in pagination calculationstop.
// If this format flag is not set, or not printing the first page of the section with this flag,
// this next page size is the same as current page size.
float yPageSizeNextPage = yPageSize;
if (!MyPageHelper.DidFirstPageDocStyle && (MyItemInfo.MyActiveSection.MyDocStyle.StructureStyle.Where & E_DocStyleUse.UseOnFirstPage) > 0)
yPageSizeNextPage = GetYPageSizeUseOnAllButFirstPage();
// TODO: This does not account for a long step as the last step that would exceed more than one page and // TODO: This does not account for a long step as the last step that would exceed more than one page and
// that has an end message that needs to be accounted for in determining pagination. To do that the last // that has an end message that needs to be accounted for in determining pagination. To do that the last
@ -153,7 +145,6 @@ namespace Volian.Print.Library
float ySize7LPI = YSize; // +SixLinesPerInch; float ySize7LPI = YSize; // +SixLinesPerInch;
if (_Match16BitPagination) ySize7LPI += SixLinesPerInch; if (_Match16BitPagination) ySize7LPI += SixLinesPerInch;
string firstStep = "No"; string firstStep = "No";
if (MyItemInfo.IsHigh && MyItemInfo.MyPrevious == null) if (MyItemInfo.IsHigh && MyItemInfo.MyPrevious == null)
firstStep = "Yes"; firstStep = "Yes";
//if (!ManualPageBreak && mySize + yEndMsg <= yWithinMargins) // Don't Paginate if there is enough room, will fit on page //if (!ManualPageBreak && mySize + yEndMsg <= yWithinMargins) // Don't Paginate if there is enough room, will fit on page
@ -174,6 +165,16 @@ namespace Volian.Print.Library
// YSize includes a blank line after the step which we don't want to include in the page break test, thus the // YSize includes a blank line after the step which we don't want to include in the page break test, thus the
// YSize - SixLinesPerInch: // YSize - SixLinesPerInch:
// yPageSizeNextPage is the page size of the 'next' page. A format variable exists off of the docstyle
// For UseOnFirstPage vs UseOnAllButFirstPage. If this is set for this format, and processing the FIRST
// page, the size of next page, which may be different, is used in pagination calculationstop.
// If this format flag is not set, or not printing the first page of the section with this flag,
// this next page size is the same as current page size.
float yPageSizeNextPage = yPageSize;
//if (firstStep == "No")
// ResetDocStyleAndValues(ref yTopMargin, ref yBottomMargin);
if (MyPageHelper.DidFirstPageDocStyle && (MyItemInfo.MyActiveSection.MyDocStyle.StructureStyle.Where & E_DocStyleUse.UseOnAllButFirstPage) > 0)
yPageSizeNextPage = GetYPageSizeUseOnAllButFirstPage();
if (!KeepWithHeader && !KeepStepsOnPage && YSize - SixLinesPerInch + yEndMsg <= yPageSizeNextPage) // if the entire step can fit on one page, do a page break if (!KeepWithHeader && !KeepStepsOnPage && YSize - SixLinesPerInch + yEndMsg <= yPageSizeNextPage) // if the entire step can fit on one page, do a page break
{ {
// Don't want extra line before step // Don't want extra line before step

View File

@ -547,7 +547,7 @@ namespace Volian.Print.Library
float ylocation = cb.PdfDocument.PageSize.Height - ((float)mySection.MyDocStyle.Layout.TopMargin + locEndOfWordDoc * 72); // 72 - pts per inch. float ylocation = cb.PdfDocument.PageSize.Height - ((float)mySection.MyDocStyle.Layout.TopMargin + locEndOfWordDoc * 72); // 72 - pts per inch.
iTextSharp.text.Font fnt = VolianPdf.GetFont(mySection.MyDocStyle.End.Font.WindowsFont); iTextSharp.text.Font fnt = VolianPdf.GetFont(mySection.MyDocStyle.End.Font.WindowsFont);
fnt.Color = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Black)); fnt.Color = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Black));
iTextSharp.text.Paragraph para = new Paragraph(mySection.MyDocStyle.End.Message, fnt); iTextSharp.text.Paragraph para = new Paragraph(mySection.MyDocStyle.End.FixedMessage, fnt);
float wtpm = (float)mySection.MyDocStyle.Layout.PageWidth - (float)mySection.MyDocStyle.Layout.LeftMargin; float wtpm = (float)mySection.MyDocStyle.Layout.PageWidth - (float)mySection.MyDocStyle.Layout.LeftMargin;
float centerpos = (float)mySection.MyDocStyle.Layout.LeftMargin + (wtpm - (mySection.MyDocStyle.End.Message.Length * mySection.MyDocStyle.End.Font.CharsToTwips)) / 2; float centerpos = (float)mySection.MyDocStyle.Layout.LeftMargin + (wtpm - (mySection.MyDocStyle.End.Message.Length * mySection.MyDocStyle.End.Font.CharsToTwips)) / 2;
float yBottomMargin = Math.Max(0, (float)mySection.MyDocStyle.Layout.TopMargin - (float)mySection.MyDocStyle.Layout.PageLength - 2 * vlnPrintObject.SixLinesPerInch); float yBottomMargin = Math.Max(0, (float)mySection.MyDocStyle.Layout.TopMargin - (float)mySection.MyDocStyle.Layout.PageLength - 2 * vlnPrintObject.SixLinesPerInch);
@ -557,11 +557,16 @@ namespace Volian.Print.Library
OnStatusChanged("Merge MSWord", PromsPrinterStatusType.MergeMSWord); OnStatusChanged("Merge MSWord", PromsPrinterStatusType.MergeMSWord);
} }
OnStatusChanged("Before NewPage", PromsPrinterStatusType.Before); OnStatusChanged("Before NewPage", PromsPrinterStatusType.Before);
if (mySection.MyDocStyle.LandscapePageList)// && mySection.MyDocStyle.Layout.PageWidth > mySection.MyDocStyle.Layout.PageLength)
_MyHelper.IsLandscape = true;
else
_MyHelper.IsLandscape = false;
cb.PdfDocument.NewPage(); // Word Document cb.PdfDocument.NewPage(); // Word Document
// if this document style has another style that is for pages other than first, we need to // 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. // reset the document style off of this section AND reset docstyle values used.
_MyHelper.DidFirstPageDocStyle = true; _MyHelper.DidFirstPageDocStyle = true;
DebugPagination.WriteLine("CreateWordDocPdf");
if ((mySection.MyDocStyle.StructureStyle.Where & E_DocStyleUse.UseOnFirstPage) > 0) if ((mySection.MyDocStyle.StructureStyle.Where & E_DocStyleUse.UseOnFirstPage) > 0)
_MyHelper.MySection = mySection; // this resets the docstyle/pagestyle if pagehelper _MyHelper.MySection = mySection; // this resets the docstyle/pagestyle if pagehelper
OnStatusChanged("After NewPage", PromsPrinterStatusType.NewPage); OnStatusChanged("After NewPage", PromsPrinterStatusType.NewPage);

View File

@ -114,11 +114,51 @@ namespace Volian.Print.Library
} }
if (MySection.MyDocStyle.StructureStyle.Style==null || (MySection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DontCountInTabOfCont) == 0) if (MySection.MyDocStyle.StructureStyle.Style==null || (MySection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DontCountInTabOfCont) == 0)
CurrentTOCPageNumber++; CurrentTOCPageNumber++;
if (MySection.MyDocStyle.CenterLineX != null && MySection.ColumnMode > 0)
DrawCenterLine(writer.DirectContent, MySection.MyDocStyle.Layout.LeftMargin + MySection.MyDocStyle.CenterLineX ?? 0, MySection.MyDocStyle.CenterLineYTop ?? 0, MySection.MyDocStyle.CenterLineYBottom ?? 0);
PageListTopCheckOffHeader = null; PageListTopCheckOffHeader = null;
PageListLastCheckOffHeader = null; PageListLastCheckOffHeader = null;
YMultiplier = 1; YMultiplier = 1;
} }
private Gaps _MyGaps;
public Gaps MyGaps
{
get
{
if (_MyGaps == null)
_MyGaps = new Gaps();
return _MyGaps;
}
}
public void AddGap(float top, float bottom, float left, float right)
{
float center = MySection.MyDocStyle.Layout.LeftMargin + MySection.MyDocStyle.CenterLineX ?? 0;
if(center == 0) return;
if (center > right || center < left) return;
MyGaps.Add(top, bottom);
}
private void DrawCenterLine(PdfContentByte cb, float xLoc, float yTop, float yBottom)
{
cb.SaveState();
if (PageListLayer != null) cb.BeginLayer(PageListLayer);
cb.SetLineWidth(.95f);
cb.SetColorStroke(new Color(PrintOverride.SvgColor));
cb.MoveTo(xLoc, yTop);
if (_MyGaps != null)
{
foreach (Gap gap in MyGaps)
{
cb.LineTo(xLoc, gap.YTop);
cb.MoveTo(xLoc, gap.YTop - (gap.YTop - gap.YBottom) * YMultiplier);
}
_MyGaps = null;
}
cb.LineTo(xLoc, yBottom);
cb.Stroke();
if (PageListLayer != null) cb.EndLayer();
cb.RestoreState();
}
private void ResetDocStyleAndValues() private void ResetDocStyleAndValues()
{ {
@ -518,6 +558,10 @@ 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;
} }
if (args.MyText.Contains("{ROMANPAGE}"))
{
return args.MyText.Replace("{ROMANPAGE}", ItemInfo.RomanNumbering(1).ToLower());
}
if (args.MyText.Contains("{SECONDARYPAGE}") || args.MyText.Contains("{SECONDARYOF}")) if (args.MyText.Contains("{SECONDARYPAGE}") || args.MyText.Contains("{SECONDARYOF}"))
{ {
string key = "SecondaryPage." + MySection.ItemID; string key = "SecondaryPage." + MySection.ItemID;
@ -1590,4 +1634,31 @@ namespace Volian.Print.Library
_CheckOffHeaderFont = vf; _CheckOffHeaderFont = vf;
} }
} }
public class Gap
{
private float _YTop;
public float YTop
{
get { return _YTop; }
set { _YTop = value; }
}
private float _YBottom;
public float YBottom
{
get { return _YBottom; }
set { _YBottom = value; }
}
public Gap(float yTop, float yBottom)
{
_YTop = yTop;
_YBottom = yBottom;
}
}
public class Gaps : List<Gap>
{
public void Add(float yTop, float yBotttom)
{
this.Add(new Gap(yTop, yBotttom));
}
}
} }

View File

@ -67,6 +67,7 @@ namespace Volian.Print.Library
float right = (float)MyParent.MyItemInfo.MyDocStyle.Layout.LeftMargin + (float)(MyBox.End ?? DefEnd); float right = (float)MyParent.MyItemInfo.MyDocStyle.Layout.LeftMargin + (float)(MyBox.End ?? DefEnd);
iTextSharp.text.Color boxColor = new iTextSharp.text.Color(PrintOverride.OverrideBoxColor(System.Drawing.Color.Black)); iTextSharp.text.Color boxColor = new iTextSharp.text.Color(PrintOverride.OverrideBoxColor(System.Drawing.Color.Black));
cb.SetColorStroke(boxColor); cb.SetColorStroke(boxColor);
_MyPageHelper.MyGaps.Add(top, top - Height);
if (DefBox != null) if (DefBox != null)
{ {
cb.SetLineWidth(.6F); cb.SetLineWidth(.6F);
@ -156,14 +157,14 @@ namespace Volian.Print.Library
// Do the top line first: // Do the top line first:
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.Append(MyBox.BXULC); sb.Append(MyBox.BXULC);
float size = (float)(MyBox.BXULC.Length * (72 / vf.CPI)); float size = (float)(MyBox.BXULC.Length * (72/vf.CPI));
string bxstr = null; string bxstr = null;
if (!ContainsPageBreak) // Only do top line if there is no page break. if (!ContainsPageBreak) // Only do top line if there is no page break.
{ {
while (size < endHorz) while (size < endHorz)
{ {
sb.Append(MyBox.BXHorz); sb.Append(MyBox.BXHorz);
size = size + (float)(MyBox.BXHorz.Length * (72 / vf.CPI)); size = size + (float)(MyBox.BXHorz.Length * (72/vf.CPI));
} }
// Tack on the right upper corner. For some formats, the upper right corner in the // Tack on the right upper corner. For some formats, the upper right corner in the
// had the first character as a space, this would put two spaces in a row at the // had the first character as a space, this would put two spaces in a row at the
@ -171,7 +172,7 @@ namespace Volian.Print.Library
bxstr = sb.ToString(); bxstr = sb.ToString();
if (bxstr[bxstr.Length - 1] == ' ' && MyBox.BXURC[0] == ' ') bxstr = bxstr.TrimEnd(); if (bxstr[bxstr.Length - 1] == ' ' && MyBox.BXURC[0] == ' ') bxstr = bxstr.TrimEnd();
bxstr = bxstr + MyBox.BXURC; bxstr = bxstr + MyBox.BXURC;
size = size + (float)((MyBox.BXURC.Length) * (72 / vf.CPI)); size = size + (float)((MyBox.BXURC.Length) * (72/vf.CPI));
Rtf = GetRtf(bxstr, vf); Rtf = GetRtf(bxstr, vf);
IParagraph = null; // set to null so that next access of IParagraph sets the Rtf. IParagraph = null; // set to null so that next access of IParagraph sets the Rtf.
Rtf2Pdf.TextAt(cb, IParagraph, left, top, size + 10, 100, "", yBottomMargin); Rtf2Pdf.TextAt(cb, IParagraph, left, top, size + 10, 100, "", yBottomMargin);
@ -189,7 +190,7 @@ namespace Volian.Print.Library
size = size + (float)(MyBox.BXHorz.Length * (72 / vf.CPI)); size = size + (float)(MyBox.BXHorz.Length * (72 / vf.CPI));
} }
bxstr = sb.ToString().TrimEnd() + MyBox.BXLRC; bxstr = sb.ToString().TrimEnd() + MyBox.BXLRC;
size = size + (float)((MyBox.BXLRC.Length) * (72 / vf.CPI)); size = size + (float)((MyBox.BXLRC.Length) * (72/vf.CPI));
Rtf = GetRtf(bxstr, vf); Rtf = GetRtf(bxstr, vf);
IParagraph = null; // set to null so that next access of IParagraph sets the Rtf. IParagraph = null; // set to null so that next access of IParagraph sets the Rtf.
Rtf2Pdf.TextAt(cb, IParagraph, left, bottom, size + 10, 100, "", yBottomMargin); Rtf2Pdf.TextAt(cb, IParagraph, left, bottom, size + 10, 100, "", yBottomMargin);

View File

@ -50,7 +50,8 @@ namespace Volian.Print.Library
yoff = Add(cb, childItemInfo.Notes, xoff, yoff, yoffRight, rnoLevel, maxRNO, formatInfo); yoff = Add(cb, childItemInfo.Notes, xoff, yoff, yoffRight, rnoLevel, maxRNO, formatInfo);
int? bxIndx = childItemInfo.FormatStepData==null?-1:childItemInfo.FormatStepData.StepLayoutData.STBoxindex; int? bxIndx = childItemInfo.FormatStepData==null?-1:childItemInfo.FormatStepData.StepLayoutData.STBoxindex;
bool boxHLS = false; bool boxHLS = false;
if ((bxIndx != -1 && (bxIndex != bxIndx || childItemInfo.FormatStepData.BoxIt)))
if ((bxIndx ?? -1) != -1 && (bxIndex != bxIndx || childItemInfo.FormatStepData.BoxIt || childItemInfo.MyHeader != null))
{ {
if (childItemInfo.FormatStepData.BoxIt) // this is a boxed HLS if (childItemInfo.FormatStepData.BoxIt) // this is a boxed HLS
{ {
@ -81,7 +82,12 @@ namespace Volian.Print.Library
{ {
if (bxIndx != null) if (bxIndx != null)
{ {
if (box != null) box.Height = yoff - box.YOffset; // new height, with children if (box != null)
{
box.Height = yoff - box.YOffset; // new height, with children
if (childItemInfo.MyHeader != null)
yoff += vlnPrintObject.SixLinesPerInch * 2;
}
box = new vlnBox(); box = new vlnBox();
box.MyBox = formatInfo.PlantFormat.FormatData.BoxList[(int)bxIndx]; box.MyBox = formatInfo.PlantFormat.FormatData.BoxList[(int)bxIndx];
int ln = 1; // a format flag determines whether there is a space before the note/caution. int ln = 1; // a format flag determines whether there is a space before the note/caution.
@ -96,7 +102,6 @@ namespace Volian.Print.Library
if (childItemInfo is SectionInfo) formatInfo = (childItemInfo as SectionInfo).LocalFormat ?? formatInfo; if (childItemInfo is SectionInfo) formatInfo = (childItemInfo as SectionInfo).LocalFormat ?? formatInfo;
if (rnoLevel < maxRNO && childItemInfo.RNOs != null) yoff = Math.Max(yoff, yoffRight); if (rnoLevel < maxRNO && childItemInfo.RNOs != null) yoff = Math.Max(yoff, yoffRight);
vlnParagraph para = new vlnParagraph(Parent, cb, childItemInfo, xoff, yoff, rnoLevel, maxRNO, formatInfo, null, null); vlnParagraph para = new vlnParagraph(Parent, cb, childItemInfo, xoff, yoff, rnoLevel, maxRNO, formatInfo, null, null);
if (box != null && box.MyParent == null) if (box != null && box.MyParent == null)
{ {
box.MyParent = para; box.MyParent = para;
@ -134,7 +139,7 @@ namespace Volian.Print.Library
} }
return yoff; return yoff;
} }
public float ToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin) public float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin)
{ {
foreach (vlnParagraph child in this) foreach (vlnParagraph child in this)
{ {
@ -582,10 +587,8 @@ namespace Volian.Print.Library
{ {
get get
{ {
return string.Format("DebugID = {0}, ID={1} Type={2} TypeName='{3}' StepLevel={4} DBSequence={5} YTopMost={6} ", return string.Format("DebugID = {0}, ID={1} Type={2} TypeName='{3}' StepLevel={4} DBSequence={5} Width={6} Left={7}",
DebugId, MyItemInfo.ItemID, MyItemInfo.FormatStepType, DebugId, MyItemInfo.ItemID, MyItemInfo.FormatStepType, MyItemInfo.FormatStepData==null?"NoStepData":MyItemInfo.FormatStepData.Type, MyItemInfo.StepLevel, MyItemInfo.DBSequence, Width, XOffset);
MyItemInfo.FormatStepData==null?"NoStepData":MyItemInfo.FormatStepData.Type,
MyItemInfo.StepLevel, MyItemInfo.DBSequence,YTopMost);
} }
} }
private void ResetDocStyleAndValues(ref float yTopMargin, ref float yBottomMargin) private void ResetDocStyleAndValues(ref float yTopMargin, ref float yBottomMargin)
@ -606,6 +609,7 @@ namespace Volian.Print.Library
} }
} }
MyPageHelper.DidFirstPageDocStyle = true; MyPageHelper.DidFirstPageDocStyle = true;
DebugPagination.WriteLine("ResetDocStyleAndValues");
MyPageHelper.MySection = (SectionInfo)MyItemInfo.MyActiveSection; MyPageHelper.MySection = (SectionInfo)MyItemInfo.MyActiveSection;
yTopMargin = _PointsPerPage - (float)MyItemInfo.MyActiveSection.MyDocStyle.Layout.TopMargin; yTopMargin = _PointsPerPage - (float)MyItemInfo.MyActiveSection.MyDocStyle.Layout.TopMargin;
yBottomMargin = Math.Max(0, yTopMargin - (float)MyItemInfo.MyActiveSection.MyDocStyle.Layout.PageLength); yBottomMargin = Math.Max(0, yTopMargin - (float)MyItemInfo.MyActiveSection.MyDocStyle.Layout.PageLength);
@ -629,7 +633,6 @@ namespace Volian.Print.Library
DebugText.WriteLine("ToPdf1:{0},'{1}',{2},{3},{4},{5}", MyItemInfo.ItemID, MyItemInfo.ShortSearchPath, XOffset, yLocation, yPageStart, YTopMost); DebugText.WriteLine("ToPdf1:{0},'{1}',{2},{3},{4},{5}", MyItemInfo.ItemID, MyItemInfo.ShortSearchPath, XOffset, yLocation, yPageStart, YTopMost);
int paginate = Paginate(yLocation, yTopMargin, yBottomMargin); int paginate = Paginate(yLocation, yTopMargin, yBottomMargin);
bool firstHighLevelStep = MyItemInfo.IsHigh && (MyItemInfo.MyPrevious == null); bool firstHighLevelStep = MyItemInfo.IsHigh && (MyItemInfo.MyPrevious == null);
switch (paginate) switch (paginate)
{ {
case 0: // No page break case 0: // No page break
@ -643,6 +646,7 @@ namespace Volian.Print.Library
case 1: // Break on High Level Step case 1: // Break on High Level Step
OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin); OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
cb.PdfDocument.NewPage(); cb.PdfDocument.NewPage();
if(MyItemInfo.IsHigh && MyItemInfo.MyPrevious != null) //do not reset for 1st step
ResetDocStyleAndValues(ref yTopMargin, ref yBottomMargin); ResetDocStyleAndValues(ref yTopMargin, ref yBottomMargin);
DebugText.WriteLine("Paginate1"); DebugText.WriteLine("Paginate1");
if (MyItemInfo.IsSection) if (MyItemInfo.IsSection)
@ -664,9 +668,9 @@ namespace Volian.Print.Library
if (myMsg != null && myMsg != "") if (myMsg != null && myMsg != "")
{ {
if (myMsg.IndexOf(@"%d") > -1) if (myMsg.IndexOf(@"%d") > -1)
myMsg = myMsg.Replace(@"%d", MyItemInfo.MyHLS.MyTab.CleanText.Trim()); myMsg = myMsg.Replace(@"%d", MyItemInfo.MyHLS.MyTab.CleanTextNoSymbols.Trim());
if (myMsg.IndexOf(@"%2d") > -1) if (myMsg.IndexOf(@"%2d") > -1)
myMsg = myMsg.Replace(@"%2d", MyItemInfo.MyHLS.MyTab.CleanText.Trim(" .".ToCharArray()).PadLeft(2)); myMsg = myMsg.Replace(@"%2d", MyItemInfo.MyHLS.MyTab.CleanTextNoSymbols.Trim(" .".ToCharArray()).PadLeft(2));
float msg_yLocation = 0; float msg_yLocation = 0;
if (myMsg.Contains("{par}")) if (myMsg.Contains("{par}"))
{ {
@ -763,16 +767,16 @@ namespace Volian.Print.Library
break; break;
} }
yPageStart = ChildrenAbove.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin); yPageStart = ChildrenAbove.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
yPageStart = ChildrenLeft.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin); yPageStart = ChildrenLeft.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
yPageStart = ParagraphToPdf(cb, yPageStart, yTopMargin, yBottomMargin); yPageStart = ParagraphToPdf(cb, yPageStart, yTopMargin, yBottomMargin);
yPageStart = ChildrenRight.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin); yPageStart = ChildrenRight.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
yPageStart = ChildrenBelow.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin); yPageStart = ChildrenBelow.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
if (MyItemInfo.IsHigh && MyItemInfo.NextItem == null) // last hls, add the 'end' message, if there is one if (MyItemInfo.IsHigh && MyItemInfo.NextItem == null) // last hls, add the 'end' message, if there is one
{ {
DocStyle docstyle = MyItemInfo.MyDocStyle; DocStyle docstyle = MyItemInfo.MyDocStyle;
string myMsg = (docstyle.End == null) ? null : docstyle.End.Message; string myMsg = (docstyle.End == null) ? null : docstyle.End.FixedMessage;
if (myMsg != null) if (myMsg != null)
{ {
// If the flag is 0 or 1, just put the end message out right below this vlnParagraph: // If the flag is 0 or 1, just put the end message out right below this vlnParagraph:
@ -785,11 +789,16 @@ namespace Volian.Print.Library
} }
if (myMsg.Contains("{Section Number}")) myMsg = myMsg.Replace("{Section Number}", MyItemInfo.ActiveSection.DisplayNumber); if (myMsg.Contains("{Section Number}")) myMsg = myMsg.Replace("{Section Number}", MyItemInfo.ActiveSection.DisplayNumber);
//jcb code
if(myMsg.Contains("%-8s"))
myMsg = myMsg.Replace("%-8s",MyItemInfo.MyProcedure.DisplayNumber.PadRight(8));
//end jb code
// center the message. // center the message.
float wtpm = (float)docstyle.Layout.PageWidth - (float)docstyle.Layout.LeftMargin; float wtpm = (float)docstyle.Layout.PageWidth - (float)docstyle.Layout.LeftMargin;
float centerpos = XOffsetBox + (float)docstyle.Layout.LeftMargin + (wtpm - (myMsg.Length * MyItemInfo.FormatStepData.Font.CharsToTwips)) / 2; float centerpos = XOffsetBox + (float)docstyle.Layout.LeftMargin + (wtpm - (myMsg.Length * MyItemInfo.FormatStepData.Font.CharsToTwips)) / 2;
centerpos = Math.Max(centerpos, XOffsetBox + (float)docstyle.Layout.LeftMargin);
MyPageHelper.BottomMessage = new vlnText(cb, this, myMsg, myMsg, centerpos, msg_yLocation, docstyle.End.Font); MyPageHelper.BottomMessage = new vlnText(cb, this, myMsg, myMsg, centerpos, msg_yLocation, docstyle.End.Font);
MyPageHelper.MyGaps.Add(new Gap(msg_yLocation, msg_yLocation - MyPageHelper.BottomMessage.Height));
} }
} }
if (yLocalypagestart != yPageStart) DebugText.WriteLine("ToPdf-yPagestartDiff:{0},{1},{2},{3}", MyPageHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, MyItemInfo.ItemID, yLocalypagestart, yPageStart); if (yLocalypagestart != yPageStart) DebugText.WriteLine("ToPdf-yPagestartDiff:{0},{1},{2},{3}", MyPageHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, MyItemInfo.ItemID, yLocalypagestart, yPageStart);
@ -1081,15 +1090,35 @@ namespace Volian.Print.Library
} }
// if this is the High Level RNO step (MyTopRNO) and we are numbering the RNO, adjust the xoffset to start the tab // if this is the High Level RNO step (MyTopRNO) and we are numbering the RNO, adjust the xoffset to start the tab
// at the x location rather than starting the text at the x location: // at the x location rather than starting the text at the x location:
if (!itemInfo.IsSection && itemInfo.FormatStepData.NumberHighLevel && itemInfo.IsRNOPart && itemInfo.ItemID == MyTopRNO.MyItemInfo.ItemID) AdjustWidth(itemInfo, maxRNO, formatInfo, mytab);
bool adjustAgain = true;
if (!itemInfo.IsSection && itemInfo.FormatStepData.NumberHighLevel && itemInfo.IsRNOPart && (MyTopRNO == null || itemInfo.ItemID == MyTopRNO.MyItemInfo.ItemID))
{ {
// adjust the x-offset of the RNO to include the tab. // adjust the x-offset of the RNO to include the tab.
if (itemInfo.ActiveFormat.MyStepSectionLayoutData.RNOWidthSameAsHighParent)// && !itemInfo.MyParent.IsHigh)
{
vlnParagraph hls = GetHighLevelParagraph();
float RnoOffset1 = ToInt(formatInfo.MyStepSectionLayoutData.ColRTable, maxRNO);
float offset = hls.Width + RnoOffset1 + hls.XOffset;
vlnTab tb = hls.PartsLeft[0] as vlnTab;
//offset += tb.Width;
if (MyTopRNO == null)
Width -= (float)itemInfo.ActiveFormat.MyStepSectionLayoutData.SingleColumnRNOIndent;
offset -= Width;
float inc = offset - XOffset;
if(mytab != null)
mytab.XOffset += inc;// +(itemInfo.MyParent.IsHigh ? 6.8f : 0);
XOffset += inc;
adjustAgain = false;
}
else
{
mytab.XOffset += mytab.Width; mytab.XOffset += mytab.Width;
XOffset = mytab.XOffset + mytab.Width; XOffset = mytab.XOffset + mytab.Width;
} }
AdjustWidth(itemInfo, maxRNO, formatInfo, mytab); }
if(adjustAgain)
AdjustXOffsetForTab(itemInfo, maxRNO, formatInfo, mytab, xMetaAdj); AdjustXOffsetForTab(itemInfo, maxRNO, formatInfo, mytab, xMetaAdj);
if (itemInfo.MyHeader != null && itemInfo.MyHeader.Text != null && !doSectTab) if (itemInfo.MyHeader != null && itemInfo.MyHeader.Text != null && !doSectTab)
yoff += SetHeader(this, cb, itemInfo, formatInfo); yoff += SetHeader(this, cb, itemInfo, formatInfo);
float yoffLeft = yoff; float yoffLeft = yoff;
@ -1331,8 +1360,6 @@ namespace Volian.Print.Library
if (co != null) if (co != null)
{ {
float xloc_co = (float)itemInfo.MyDocStyle.Layout.LeftMargin; float xloc_co = (float)itemInfo.MyDocStyle.Layout.LeftMargin;
if (formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.XLocation != null)
xloc_co += (float)formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.XLocation;
// if the format has 'SkipSpaces', look at the tab, and back up the macros to the number of // if the format has 'SkipSpaces', look at the tab, and back up the macros to the number of
// spaces in the tab. // spaces in the tab.
if (formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.SkipSpaces) if (formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.SkipSpaces)
@ -1342,6 +1369,16 @@ namespace Volian.Print.Library
else else
xloc_co = XOffset; //there's no tab - put checkoff at step's xoff. Macro should back up from step's x. xloc_co = XOffset; //there's no tab - put checkoff at step's xoff. Macro should back up from step's x.
} }
else
{
if (formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.XLocation != null)
xloc_co += (float)formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.XLocation;
if (formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.RelXLocation != null)
{
float relX = (float)formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.RelXLocation;
xloc_co = XOffset + (relX > 0 ? Width : 0) + relX;
}
}
PartsRight.Add(new vlnMacro(xloc_co, yForCheckoff, co.Macro)); PartsRight.Add(new vlnMacro(xloc_co, yForCheckoff, co.Macro));
} }
float yOffRight = yoff; float yOffRight = yoff;
@ -2048,7 +2085,7 @@ namespace Volian.Print.Library
iilvl = iilvl.MyParent; iilvl = iilvl.MyParent;
} }
level = level <= 2 ? 1 : level - 1; level = level <= 2 ? 1 : level - 1;
if (level == 1) if (level==1)
XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (level * (float)formatInfo.PlantFormat.FormatData.SectData.SectionHeader.Pos); XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (level * (float)formatInfo.PlantFormat.FormatData.SectData.SectionHeader.Pos);
else else
{ {
@ -2067,7 +2104,7 @@ namespace Volian.Print.Library
{ {
float x = 0; float x = 0;
float xoff = 0; float xoff = 0;
if ((colOvrd ?? 0) != 0) if ((colOvrd??0)!=0)
x = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)colOvrd; x = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)colOvrd;
else else
x = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS; x = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS;
@ -2083,7 +2120,7 @@ namespace Volian.Print.Library
float colsbylevel = (float)formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[indxLevel % formatInfo.PlantFormat.FormatData.SectData.MetaSectionList.Count].ColSByLevel; float colsbylevel = (float)formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[indxLevel % formatInfo.PlantFormat.FormatData.SectData.MetaSectionList.Count].ColSByLevel;
float seclvlindent = colsbylevel - (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS; float seclvlindent = colsbylevel - (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS;
float adjCols = (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS + seclvlindent; float adjCols = (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS + seclvlindent;
float xtabcol = adjCols - ((myTab == null || myTab.Text == null) ? 0 : (myTab.Text.Length * 7.2f)); float xtabcol = adjCols - ((myTab==null||myTab.Text==null)?0:(myTab.Text.Length * 7.2f));
if (indxLevel > 1 && myTab != null) myTab.XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + xtabcol; if (indxLevel > 1 && myTab != null) myTab.XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + xtabcol;
else if (myTab != null) myTab.XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + colsbylevel; else if (myTab != null) myTab.XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + colsbylevel;
if (myTab != null) if (myTab != null)
@ -2157,7 +2194,7 @@ namespace Volian.Print.Library
} }
// if the step is within the rno and we're numbering the high level rno, we've got to account for the // if the step is within the rno and we're numbering the high level rno, we've got to account for the
// indenting (increased x offset) for the top level rno's tab, if there is no top level rno: // indenting (increased x offset) for the top level rno's tab, if there is no top level rno:
if (itemInfo.FormatStepData.NumberHighLevel && (itemInfo.MyHLS.RNOs == null || itemInfo.MyHLS.RNOs.Count <= 0)) if (itemInfo.FormatStepData.NumberHighLevel && (itemInfo.MyHLS.RNOs == null || itemInfo.MyHLS.RNOs.Count<=0))
{ {
// add in the size that an RNO off HLS would take. // add in the size that an RNO off HLS would take.
XOffset += tabWidth; XOffset += tabWidth;
@ -2174,7 +2211,7 @@ namespace Volian.Print.Library
// the tab. The offset of text needs to be adjusted by the 'leftjustify' format variable // the tab. The offset of text needs to be adjusted by the 'leftjustify' format variable
// if it existed for this level. // if it existed for this level.
myTab.XOffset += tabWidth; myTab.XOffset += tabWidth;
if (tableftadj != 0 && myTab.Width < tableftadj) if (tableftadj != 0 && myTab.Width<tableftadj)
tabWidth = myTab.Width = tableftadj; tabWidth = myTab.Width = tableftadj;
XOffset += tabWidth; XOffset += tabWidth;
myTab.Rtf = myTab.Rtf.Replace(myTab.Text, myTab.Text.TrimStart(" ".ToCharArray())); myTab.Rtf = myTab.Rtf.Replace(myTab.Text, myTab.Text.TrimStart(" ".ToCharArray()));
@ -2328,6 +2365,9 @@ namespace Volian.Print.Library
else else
{ {
float adjwidth = 0; float adjwidth = 0;
if (itemInfo.IsRNOPart && itemInfo.ActiveFormat.MyStepSectionLayoutData.RNOWidthSameAsHighParent && itemInfo.MyParent.IsHigh)
Width = adjwidth + MyParent.Width;
else
Width = adjwidth + MyParent.Width - tabWidth + (myTab == null ? 0 : myTab.TabAlign); Width = adjwidth + MyParent.Width - tabWidth + (myTab == null ? 0 : myTab.TabAlign);
} }
} }

View File

@ -161,7 +161,7 @@ namespace Volian.Print.Library
// Width for placement of macro should be position in the string where the macro was located. // Width for placement of macro should be position in the string where the macro was located.
float lwidth = MyFont.CharsToTwips * (origTab.Length - meindx - 1); float lwidth = MyFont.CharsToTwips * (origTab.Length - meindx - 1);
MyMacro = new vlnMacro(xoffset - lwidth, yoffset, macro.Substring(2, macro.Length - 3)); MyMacro = new vlnMacro(xoffset - lwidth, yoffset, macro.Substring(2, macro.Length - 3));
xoffset += myparent.MyItemInfo.FormatStepData.TabData.MacroTabAdjust ?? 0;
origTab = origTab.Replace(macro, ""); origTab = origTab.Replace(macro, "");
cleanTab = origTab; cleanTab = origTab;
if (CCCs != IIIs) if (CCCs != IIIs)
@ -208,7 +208,6 @@ namespace Volian.Print.Library
int indxC = origTab.IndexOf(":"); int indxC = origTab.IndexOf(":");
origTab = @"\ul " + origTab.Substring(0, indxC) + @"\ulnone" + origTab.Substring(indxC); origTab = @"\ul " + origTab.Substring(0, indxC) + @"\ulnone" + origTab.Substring(indxC);
} }
Rtf = GetRtf(origTab, vFont); Rtf = GetRtf(origTab, vFont);
Rtf = Rtf.Replace("\u0394", @"\f1\u916?\f0 "); // delta 0x0394 Rtf = Rtf.Replace("\u0394", @"\f1\u916?\f0 "); // delta 0x0394
if (ScriptCaution) if (ScriptCaution)

View File

@ -35,7 +35,7 @@ namespace Volian.Print.Library
Rtf = GetRtf(origText, vFont); Rtf = GetRtf(origText, vFont);
XOffset = xoffset; XOffset = xoffset;
MyFont = vFont; MyFont = vFont;
Width = MyFont.CharsToTwips * (Text.Length + 2); Width = MyFont.CharsToTwips * (Text.Length + 5);
} }
public vlnText() public vlnText()
{ {