This commit is contained in:
Kathy Ruffing 2012-08-22 16:19:26 +00:00
parent 1ff8a696b8
commit 0e2ab11122

View File

@ -142,7 +142,7 @@ namespace Volian.Print.Library
float yLocation = CalculateYOffset(yPageStart, yTopMargin); 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); if (MyItemInfo.HasChangeBar && MyPageHelper.ChangeBarDefinition.MyChangeBarType != PrintChangeBar.Without) MyPageHelper.AddChangeBar(DoChangeBar(cb, MyItemInfo, MyPageHelper, XOffset, yLocation, MyPageHelper.MaxRNO, MyItemInfo.ActiveFormat), cbMess);
float retval = yLocation; float retval = yLocation;
if (MyItemInfo.IsFigure) if (MyItemInfo.IsFigure)
{ {
yLocation -= (SixLinesPerInch * MyPageHelper.YMultiplier); yLocation -= (SixLinesPerInch * MyPageHelper.YMultiplier);
@ -171,13 +171,17 @@ namespace Volian.Print.Library
if (MyItemInfo.MyContent.MyGrid != null) if (MyItemInfo.MyContent.MyGrid != null)
retval = DrawGrid(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation); retval = DrawGrid(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation);
else else
if (doprint)retval = DrawText(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation); if (doprint) retval = DrawText(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation);
if (MyItemInfo.IsHigh) if (MyItemInfo.IsHigh)
{ {
MyPageHelper.PageBookmarks.Add(MyItemInfo, MyItemInfo.MyTab.CleanText + " " + MyItemInfo.DisplayText, MyPageHelper.PageBookmarks.Add(MyItemInfo, MyItemInfo.MyTab.CleanText + " " + MyItemInfo.DisplayText,
new PdfDestination(PdfDestination.FITBH, yLocation + YVeryTop - YTopMost + SixLinesPerInch)); new PdfDestination(PdfDestination.FITBH, yLocation + YVeryTop - YTopMost + SixLinesPerInch));
} }
} }
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.WolfcreekCKLFormat)
{
WCN_DrawBoxLines(cb, MyItemInfo, yPageStart, yTopMargin, yBottomMargin, yLocation);
}
if (MyItemInfo.IsSection) if (MyItemInfo.IsSection)
{ {
SectionConfig sc = MyItemInfo.MyConfig as SectionConfig; SectionConfig sc = MyItemInfo.MyConfig as SectionConfig;
@ -201,7 +205,118 @@ namespace Volian.Print.Library
//if (localYPageStart != yPageStart) DebugText.WriteLine("ParToPdf-yPagestartDiff:{0},{1},{2}", MyItemInfo.ItemID, localYPageStart, yPageStart); //if (localYPageStart != yPageStart) DebugText.WriteLine("ParToPdf-yPagestartDiff:{0},{1},{2}", MyItemInfo.ItemID, localYPageStart, yPageStart);
return yPageStart; return yPageStart;
} }
// A few things need completed for the WCNCHK format check list boxes:
// 1) for HLS, draw enough vertical lines if the HLS is more than 1 line.
// 2) support pagination. This includes tacking on a continued message, breaking table where necessary
// and putting HLS on top of next page, along with its prefix/suffix.
// 3) support seven lines per inch - right now increments are hard coded at 12 = one line.
private void WCN_DrawBoxLines(PdfContentByte cb, ItemInfo ii, float yPageStart, float yTopMargin, float yBottomMargin, float yLocation)
{
if (!ii.IsStep || ii.IsCaution || ii.IsNote) return;
bool savedebug = Rtf2Pdf.PdfDebug;
Rtf2Pdf.PdfDebug = false;
System.Drawing.Font symbFont = new System.Drawing.Font("VESymbFix", 10);
iTextSharp.text.Font iSymblFont = Volian.Svg.Library.VolianPdf.GetFont(symbFont);
// The vertPos array from the format defines the column locations:
string[] vertPos = ii.MyHLS.FormatStepData.VertPos.Split(",".ToCharArray());
// Count how many vertical lines are in the checklist table:
int cntVertPos = vertPos.Length - 1;
while (vertPos[cntVertPos] == "0" && cntVertPos > 0) cntVertPos--;
cntVertPos++;
Paragraph paraVertLine = new Paragraph(ii.ActiveFormat.PlantFormat.FormatData.BoxList[0].BXVert, iSymblFont);
float lWidth = 100;
float csize = 6 - .3f; // added the .3 to make line up with 16bit.
// if High Level Step, just need to do edges for number of lines:
if (ii.IsHigh)
{
// get first and last vertpos for location of lines:
// for each line of text, draw the start & end box line:
// TODO: this needs to be in a loop to get enough of vertical lines if the HLS is more than 1 line:
// Note that, for loop, the top & bottom values for paragraph include the header text, i.e. the
// box and the table headers - so these can't be used to get number of lines.
Rtf2Pdf.TextAt(cb, paraVertLine, float.Parse(vertPos[0]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yLocation - 6, lWidth, 100, null, yBottomMargin);
Rtf2Pdf.TextAt(cb, paraVertLine, float.Parse(vertPos[cntVertPos - 1]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yLocation - 6, lWidth, 100, null, yBottomMargin);
}
else
{
Paragraph horzLine = new Paragraph(ii.ActiveFormat.PlantFormat.FormatData.BoxList[0].BXHorz, iSymblFont);
bool bottomOfTable = ii.NextItem == null || ii.NextItemCount == 0;
Box bx = ii.ActiveFormat.PlantFormat.FormatData.BoxList[0];
// if bottom of table use different cross/beg/end chars than if in middle of table.
Paragraph leftLine = new Paragraph(bottomOfTable ? bx.BXLLC : bx.BXMLS, iSymblFont);
Paragraph rightLine = new Paragraph(bottomOfTable ? bx.BXLRC : bx.BXMRS, iSymblFont);
// If this item is in the leftmost column in table, this is determined by looking at its parent,
// its parent must be a HLS, do the vertical lines since all cells have all vertical lines.
// Lines should be drawn from current to ybottommost. Also draw the bottom line.
if (ii.MyParent.IsHigh)
{
// first do the vertical bars.
float curY = yLocation;
while (curY > (yPageStart - this.YBottomMost + 12))
{
for (int i = 0; i < cntVertPos; i++)
Rtf2Pdf.TextAt(cb, paraVertLine, float.Parse(vertPos[i]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, curY + 3, lWidth, 100, null, yBottomMargin);
curY -= 12;
}
// Now do the bottom line for this item.
Paragraph crossLine = new Paragraph(bottomOfTable ? bx.BXLMID : bx.BXMID, iSymblFont);
float yloc = yPageStart - this.YBottomMost + 15;
Rtf2Pdf.TextAt(cb, leftLine, float.Parse(vertPos[0]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yloc, lWidth, 100, null, yBottomMargin);
float hPos = float.Parse(vertPos[0]) + csize;
int doHorizCnt = 0;
while (doHorizCnt < cntVertPos - 1)
{
while (hPos < float.Parse(vertPos[doHorizCnt + 1]))
{
Rtf2Pdf.TextAt(cb, horzLine, hPos + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yloc, lWidth, 100, null, yBottomMargin);
hPos += csize;
}
// put out middle piece, i.e. + (cross) lines or bottom line
hPos = float.Parse(vertPos[doHorizCnt + 1]);
if (doHorizCnt < cntVertPos - 2) // don't put out crossLine on last one.
Rtf2Pdf.TextAt(cb, crossLine, float.Parse(vertPos[doHorizCnt + 1]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yloc, lWidth, 100, null, yBottomMargin);
hPos += csize;
doHorizCnt++;
}
// put out the right side piece
Rtf2Pdf.TextAt(cb, rightLine, float.Parse(vertPos[cntVertPos - 1]) + (float)ii.MyDocStyle.Layout.LeftMargin - 6, yloc, lWidth, 100, null, yBottomMargin);
}
// Now handle middle parts of the table. For whatever sub level we're at, draw the cross character
// and the horizontal. This is case where the component number may have multiple descriptions,positions, etc. associated
// with it.
if (!ii.MyParent.IsHigh && ii.NextItem != null && ii.NextItemCount > 0)
{
// draw horizontally from this sublevel to the end.
int sublev = 0;
ItemInfo par = this.MyItemInfo;
while (!par.IsHigh)
{
sublev++;
par = par.MyParent;
}
sublev--;
float ylocs = yPageStart - this.YBottomMost + 15;
for (int i = sublev; i < cntVertPos - 1; i++)
{
float hPos = float.Parse(vertPos[i])+csize;
Rtf2Pdf.TextAt(cb, leftLine, float.Parse(vertPos[i]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, ylocs, lWidth, 100, null, yBottomMargin);
while (hPos < float.Parse(vertPos[i + 1]))
{
// do the horizontal line
Rtf2Pdf.TextAt(cb, horzLine, hPos + (float)ii.MyDocStyle.Layout.LeftMargin - csize, ylocs, lWidth, 100, null, yBottomMargin);
hPos += csize;
}
}
// Do the last cross character
Rtf2Pdf.TextAt(cb, rightLine, float.Parse(vertPos[cntVertPos - 1]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, ylocs, lWidth, 100, null, yBottomMargin);
}
}
Rtf2Pdf.PdfDebug = savedebug;
}
private float DrawGrid(PdfContentByte cb, ref float yPageStart, float yTopMargin, float yBottomMargin, ref float yLocation) private float DrawGrid(PdfContentByte cb, ref float yPageStart, float yTopMargin, float yBottomMargin, ref float yLocation)
{ {
//DebugText.WriteLine("{0},'{1}','{2}','<<END>>'", MyItemInfo.ItemID, MyItemInfo.ShortPath, FormattedText); //DebugText.WriteLine("{0},'{1}','{2}','<<END>>'", MyItemInfo.ItemID, MyItemInfo.ShortPath, FormattedText);
@ -443,6 +558,7 @@ namespace Volian.Print.Library
DoCheckOffHeader(cb, MyItemInfo, yLocation, yTopMargin, yPageStart); DoCheckOffHeader(cb, MyItemInfo, yLocation, yTopMargin, yPageStart);
break; break;
} }
yPageStart = ChildrenAbove.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin); yPageStart = ChildrenAbove.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin);
yPageStart = ChildrenLeft.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin); yPageStart = ChildrenLeft.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin);
yPageStart = ParagraphToPdf(cb, yPageStart, yTopMargin, yBottomMargin); yPageStart = ParagraphToPdf(cb, yPageStart, yTopMargin, yBottomMargin);
@ -1216,6 +1332,7 @@ namespace Volian.Print.Library
private float AdjustForBlankLines() private float AdjustForBlankLines()
{ {
if (MyItemInfo.MyDocStyle.SpecialStepsFoldout) return 0; if (MyItemInfo.MyDocStyle.SpecialStepsFoldout) return 0;
if (MyItemInfo.FormatStepData != null && MyItemInfo.FormatStepData.Prefix != null && MyItemInfo.FormatStepData.Suffix != null && MyItemInfo.FormatStepData.UseSmartTemplate) return 0;
int everyNLines = MyItemInfo.FormatStepData == null ? 1 : MyItemInfo.FormatStepData.StepLayoutData.EveryNLines ?? 1; int everyNLines = MyItemInfo.FormatStepData == null ? 1 : MyItemInfo.FormatStepData.StepLayoutData.EveryNLines ?? 1;
if (MyItemInfo.Ordinal % everyNLines == 0 || MyItemInfo.NextItem == null) return SixLinesPerInch; if (MyItemInfo.Ordinal % everyNLines == 0 || MyItemInfo.NextItem == null) return SixLinesPerInch;
return 0; return 0;