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

@@ -50,7 +50,8 @@ namespace Volian.Print.Library
yoff = Add(cb, childItemInfo.Notes, xoff, yoff, yoffRight, rnoLevel, maxRNO, formatInfo);
int? bxIndx = childItemInfo.FormatStepData==null?-1:childItemInfo.FormatStepData.StepLayoutData.STBoxindex;
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
{
@@ -81,7 +82,12 @@ namespace Volian.Print.Library
{
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.MyBox = formatInfo.PlantFormat.FormatData.BoxList[(int)bxIndx];
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 (rnoLevel < maxRNO && childItemInfo.RNOs != null) yoff = Math.Max(yoff, yoffRight);
vlnParagraph para = new vlnParagraph(Parent, cb, childItemInfo, xoff, yoff, rnoLevel, maxRNO, formatInfo, null, null);
if (box != null && box.MyParent == null)
{
box.MyParent = para;
@@ -134,7 +139,7 @@ namespace Volian.Print.Library
}
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)
{
@@ -582,10 +587,8 @@ namespace Volian.Print.Library
{
get
{
return string.Format("DebugID = {0}, ID={1} Type={2} TypeName='{3}' StepLevel={4} DBSequence={5} YTopMost={6} ",
DebugId, MyItemInfo.ItemID, MyItemInfo.FormatStepType,
MyItemInfo.FormatStepData==null?"NoStepData":MyItemInfo.FormatStepData.Type,
MyItemInfo.StepLevel, MyItemInfo.DBSequence,YTopMost);
return string.Format("DebugID = {0}, ID={1} Type={2} TypeName='{3}' StepLevel={4} DBSequence={5} Width={6} Left={7}",
DebugId, MyItemInfo.ItemID, MyItemInfo.FormatStepType, MyItemInfo.FormatStepData==null?"NoStepData":MyItemInfo.FormatStepData.Type, MyItemInfo.StepLevel, MyItemInfo.DBSequence, Width, XOffset);
}
}
private void ResetDocStyleAndValues(ref float yTopMargin, ref float yBottomMargin)
@@ -606,6 +609,7 @@ namespace Volian.Print.Library
}
}
MyPageHelper.DidFirstPageDocStyle = true;
DebugPagination.WriteLine("ResetDocStyleAndValues");
MyPageHelper.MySection = (SectionInfo)MyItemInfo.MyActiveSection;
yTopMargin = _PointsPerPage - (float)MyItemInfo.MyActiveSection.MyDocStyle.Layout.TopMargin;
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);
int paginate = Paginate(yLocation, yTopMargin, yBottomMargin);
bool firstHighLevelStep = MyItemInfo.IsHigh && (MyItemInfo.MyPrevious == null);
switch (paginate)
{
case 0: // No page break
@@ -643,6 +646,7 @@ namespace Volian.Print.Library
case 1: // Break on High Level Step
OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
cb.PdfDocument.NewPage();
if(MyItemInfo.IsHigh && MyItemInfo.MyPrevious != null) //do not reset for 1st step
ResetDocStyleAndValues(ref yTopMargin, ref yBottomMargin);
DebugText.WriteLine("Paginate1");
if (MyItemInfo.IsSection)
@@ -664,9 +668,9 @@ namespace Volian.Print.Library
if (myMsg != null && myMsg != "")
{
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)
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;
if (myMsg.Contains("{par}"))
{
@@ -763,16 +767,16 @@ namespace Volian.Print.Library
break;
}
yPageStart = ChildrenAbove.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin);
yPageStart = ChildrenLeft.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin);
yPageStart = ChildrenAbove.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
yPageStart = ChildrenLeft.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
yPageStart = ParagraphToPdf(cb, yPageStart, yTopMargin, yBottomMargin);
yPageStart = ChildrenRight.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin);
yPageStart = ChildrenBelow.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin);
yPageStart = ChildrenRight.ToPdf(cb, yPageStart, ref yTopMargin, ref 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
{
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 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);
//jcb code
if(myMsg.Contains("%-8s"))
myMsg = myMsg.Replace("%-8s",MyItemInfo.MyProcedure.DisplayNumber.PadRight(8));
//end jb code
// center the message.
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;
centerpos = Math.Max(centerpos, XOffsetBox + (float)docstyle.Layout.LeftMargin);
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);
@@ -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
// 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.
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;
XOffset = mytab.XOffset + mytab.Width;
}
AdjustWidth(itemInfo, maxRNO, formatInfo, mytab);
}
if(adjustAgain)
AdjustXOffsetForTab(itemInfo, maxRNO, formatInfo, mytab, xMetaAdj);
if (itemInfo.MyHeader != null && itemInfo.MyHeader.Text != null && !doSectTab)
yoff += SetHeader(this, cb, itemInfo, formatInfo);
float yoffLeft = yoff;
@@ -1105,7 +1134,7 @@ namespace Volian.Print.Library
if (itemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format)
yoffLeft = Math.Max(yoffLeft, ChildrenLeft.Add(cb, itemInfo.Notes, xoff + 6 + (float)(itemInfo.ActiveFormat.MyStepSectionLayoutData.WidT), yoff, yoff, rnoLevel, maxRNO, formatInfo));
else
yoff = ChildrenAbove.Add(cb, itemInfo.Notes, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo);
yoff = ChildrenAbove.Add(cb, itemInfo.Notes, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo);
}
// if this is a hls with a box, adjust the starting y location for the hls. this is done here
@@ -1331,8 +1360,6 @@ namespace Volian.Print.Library
if (co != null)
{
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
// spaces in the tab.
if (formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.SkipSpaces)
@@ -1342,6 +1369,16 @@ namespace Volian.Print.Library
else
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));
}
float yOffRight = yoff;
@@ -2048,7 +2085,7 @@ namespace Volian.Print.Library
iilvl = iilvl.MyParent;
}
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);
else
{
@@ -2067,11 +2104,11 @@ namespace Volian.Print.Library
{
float x = 0;
float xoff = 0;
if ((colOvrd ?? 0) != 0)
if ((colOvrd??0)!=0)
x = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)colOvrd;
else
x = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS;
xoff = x - XOffset;
// ColSByLevel will specify the column in which the High Level Step starts with
// respect to the overall level calculation based on sections & meta-sections.
@@ -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 seclvlindent = colsbylevel - (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS;
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;
else if (myTab != null) myTab.XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + colsbylevel;
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
// 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.
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
// if it existed for this level.
myTab.XOffset += tabWidth;
if (tableftadj != 0 && myTab.Width < tableftadj)
if (tableftadj != 0 && myTab.Width<tableftadj)
tabWidth = myTab.Width = tableftadj;
XOffset += tabWidth;
myTab.Rtf = myTab.Rtf.Replace(myTab.Text, myTab.Text.TrimStart(" ".ToCharArray()));
@@ -2328,6 +2365,9 @@ namespace Volian.Print.Library
else
{
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);
}
}