Fixed logic to handle Fortran Formatted Numbers in word documents

Added StepLevel property to ItemInfo
Added StepLevel debug
This commit is contained in:
Rich
2010-07-26 13:39:28 +00:00
parent 0963dbb79c
commit ef26bcbdc4
3 changed files with 188 additions and 16 deletions

View File

@@ -169,7 +169,7 @@ namespace Volian.Print.Library
{
get
{
return string.Format("DebugID = {0}, ID={1} Type={2} TypeName='{3}' EveryNLines= {4}", DebugId, MyItemInfo.ItemID, MyItemInfo.FormatStepType, MyItemInfo.FormatStepData.Type, MyItemInfo.FormatStepData.StepLayoutData.EveryNLines);
return string.Format("DebugID = {0}, ID={1} Type={2} TypeName='{3}' EveryNLines={4} StepLevel={5}", DebugId, MyItemInfo.ItemID, MyItemInfo.FormatStepType, MyItemInfo.FormatStepData.Type, MyItemInfo.FormatStepData.StepLayoutData.EveryNLines, MyItemInfo.StepLevel);
}
}
public override float ToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin)
@@ -260,7 +260,50 @@ namespace Volian.Print.Library
vPara.ParagraphToPdf(cb, yPageStart, yTopMargin, yBottomMargin);
}
}
private static void WalkStepLevel(vlnParagraph para,float yTopMost)
{
foreach (vlnParagraph child in para.ChildrenAbove)
WalkStepLevel(child, yTopMost);
foreach (vlnParagraph child in para.ChildrenLeft)
WalkStepLevel(child, yTopMost);
ShowStepLevel(para,yTopMost);
foreach (vlnParagraph child in para.ChildrenRight)
WalkStepLevel(child, yTopMost);
foreach (vlnParagraph child in para.ChildrenBelow)
WalkStepLevel(child, yTopMost);
}
private static void ShowStepLevel(vlnParagraph para,float yTopMost)
{
ItemInfo item = para.MyItemInfo;
ItemInfo parent = item.ActiveParent as ItemInfo;
if (para.MyItemInfo.ItemID == 205)
Console.Write("");
Console.WriteLine("'StepLevel',{0},{1},{2},{3},{4},{5},{6},{7},{8},{9}", para.YVeryTop - yTopMost, para.YSize, para.YBottomMost-yTopMost, item.ItemID, item.DBSequence, item.StepLevel, item.MyContent.Type % 10000,
parent.MyContent.Type % 10000, item.HasCautionOrNote ? 1 : 0, parent.Cautions == null ? 0 : 1);
}
private float _YVeryTop = -1;
public float YVeryTop
{
get
{
if (_YVeryTop == -1)
{
_YVeryTop = YTop;
_YVeryTop = VeryTop(PartsAbove,_YVeryTop);
_YVeryTop = VeryTop(PartsContainer,_YVeryTop);
}
return _YVeryTop;
}
}
private float VeryTop(vlnPrintObjects parts, float yVeryTop)
{
if (parts != null)
foreach (vlnPrintObject part in parts)
if (part.YOffset < yVeryTop)
yVeryTop = part.YOffset;
return yVeryTop;
}
private int Paginate(float yLocation, float yTopMargin, float yBottomMargin)
{
float yPageSize = yTopMargin - yBottomMargin;
@@ -270,7 +313,7 @@ namespace Volian.Print.Library
if (mySize <= yWithinMargins)
{
if (MyItemInfo.IsHigh)
Console.WriteLine("1,'No','HLS will fit on page',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath);
Console.WriteLine("'PageBreak',1,'No','HLS will fit on page',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath);
return 0; // Don't Paginate if there is enough room
}
if (MyItemInfo.IsRNOPart && MyParent.XOffset < XOffset) return 0; // Don't paginate on an RNO to the right
@@ -278,12 +321,12 @@ namespace Volian.Print.Library
{
if (YSize < yPageSize) // if the entire step can fit on one page, do a page break
{
Console.WriteLine("2,'Yes','HLS will fit on 1 Page',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath);
Console.WriteLine("'PageBreak',2,'Yes','HLS will fit on 1 Page',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath);
return 1; // Paginate on High Level Steps
}
else if (YSize < (yPageSize * SixLinesPerInch / _SevenLinesPerInch))
{
Console.WriteLine("6,'Yes','HLS will fit on 1 Page at 7 LPI',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath);
Console.WriteLine("'PageBreak',6,'Yes','HLS will fit on 1 Page at 7 LPI',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath);
return 3; // High Level Step can fit at SevenLinesPerInch
}
else // The entire step cannot fit go ahead and kick to the next page
@@ -291,21 +334,25 @@ namespace Volian.Print.Library
if (yWithinMargins > yPageSize / 2)
{
// If High level Step will not fit, kick to the next page
Console.WriteLine("3,'No','HLS will have to split anyway',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath);
Console.WriteLine("'PageBreak',3.1,'No','HLS will have to split anyway',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath);
if (MyItemInfo.IsHigh)
WalkStepLevel(this,this.YTopMost);
return 0;// Otherwise stay on this page
}
Console.WriteLine("3,'Yes','HLS will have to split',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath);
Console.WriteLine("'PageBreak',3.2,'Yes','HLS will have to split',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath);
if (MyItemInfo.IsHigh)
WalkStepLevel(this,this.YTopMost);
return 1; // Paginate on High Level Steps
}
}
if (yWithinMargins > yPageSize / 2)
{
Console.WriteLine("4,'No','Not Half way down the page',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath);
Console.WriteLine("'PageBreak',4,'No','Not Half way down the page',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath);
return 0; // More than half way down the page
}
//if (ChildrenBelow.Count > 0 && ChildrenBelow[0].YSize < yWithinMargins)
// return 0;
Console.WriteLine("5,'Yes','At least half the page is filled',{0},{1},{2},{3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath);
Console.WriteLine("'PageBreak',5,'Yes','At least half the page is filled',{0},{1},{2},{3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath);
return 2;
}
private int COL_WID_ADJ = 6; // adjusts for incorrect use of WidSTable when breaking a line (it breaks 6 chars too short)