Table shrinking support

This commit is contained in:
Rich
2015-05-27 18:48:14 +00:00
parent cf79062b90
commit 37e2227919
5 changed files with 430 additions and 43 deletions

View File

@@ -294,14 +294,14 @@ 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);
if (childItemInfo.ActiveSection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.ContActBoxOnSubSteps &&
if (childItemInfo.ActiveSection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.ContActBoxOnSubSteps &&
box != null && box.MyBox != null && bxIndx == null) // point beach boxed substeps
{
box.Height = yoff - box.YOffset - (1F * vlnPrintObject.SixLinesPerInch);
box = null;
yoff += 1 * vlnPrintObject.SixLinesPerInch;
}
vlnParagraph para = new vlnParagraph(Parent, cb, childItemInfo, xoff, yoff, rnoLevel, maxRNO, formatInfo, null, null, yoffRight, true, pp);
vlnParagraph para = new vlnParagraph(Parent, cb, childItemInfo, xoff, yoff, rnoLevel, maxRNO, formatInfo, null, null, yoffRight,true, pp);
// if doing the component list (FNP), keep track of the bottom most columns' data
// so this can be returned after the row is done.
@@ -331,7 +331,7 @@ namespace Volian.Print.Library
else if (!para.UseTemplateKeepOnCurLine(childItemInfo))
yoff = para.YBottomMost;
// don't adjust YBottomost until after yoff is set for the RNO Separator
para.YBottomMost += para.YBottomMostAdjust;
para.YBottomMost += para.YBottomMostAdjust;
if (box != null && childItemInfo.FormatStepData != null && childItemInfo.FormatStepData.BoxIt)
{
box.Height = yoff - box.YOffset - (1.1F * vlnPrintObject.SixLinesPerInch);
@@ -551,7 +551,8 @@ namespace Volian.Print.Library
if (MyItemInfo.MyContent.MyGrid != null)
{
int profileDepth = ProfileTimer.Push(">>>> vlnParagraph.DrawDrid");
retval = DrawGrid(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation);
// RHM20150507 Include Footer
retval = DrawGrid(cb, ref yPageStart, yTopMargin, yBottomMargin + (float) MyItemInfo.MyDocStyle.Layout.FooterLength, ref yLocation); // RHM20150429 - Table Scrunch
ProfileTimer.Pop(profileDepth);
}
else
@@ -828,11 +829,29 @@ namespace Volian.Print.Library
{
//DebugText.WriteLine("{0},'{1}','{2}','<<END>>'", MyItemInfo.ItemID, MyItemInfo.ShortPath, FormattedText);
if(DebugText.IsOpen)DebugText.WriteLine("{0},'{1}','{2}','<<END>>',{3}", MyItemInfo.ItemID, MyItemInfo.ShortPath, MyItemInfo.MyContent.Text, XOffset);
//if (MyItemInfo.InList(11019,11024,111026)) // RHM20150507 Table Scrunch
// Console.WriteLine("here");
float heightBefore = MyGrid.Height+4 * MyPageHelper.YMultiplier;
if (Rtf2Pdf.GetTableScrunchingStatus(TableScrunching.Phase1) && heightBefore > (yLocation - yBottomMargin))
{
//MyGrid.TooBig = (MyItemInfo.MyDocStyle.Layout.FooterLength ?? 0) + SixLinesPerInch + MyGrid.Height - (yLocation - yBottomMargin);
MyGrid.TooBig = SixLinesPerInch + MyGrid.Height * MyPageHelper.YMultiplier - (yLocation - yBottomMargin);
float heightAfter = MyGrid.Height + 4 * MyPageHelper.YMultiplier;
MyPageHelper.TableAdjustment += (heightBefore - heightAfter);
if (heightAfter < (yLocation - yBottomMargin))
{
_MyLog.ErrorFormat("<<< WARNING >>> Table is too big to fit on page, Vertical Padding adjusted to fit\r\n==>'Table Adjusted',{0},'{1}','{2}',{3},{4},{5}"
, MyItemInfo.ItemID, MyItemInfo.MyDocVersion.MyFolder.Name, MyItemInfo.ShortPath, heightBefore, MyGrid.Height, (yTopMargin - yBottomMargin));
}
else
MyGrid.IsTooBig = true;
}
MyPageHelper.BottomContent=yLocation-(MyGrid.Height + 4 * MyPageHelper.YMultiplier);
float retval = Rtf2Pdf.GridAt(cb, MyGrid, XOffset, yLocation, Width, 100, DebugInfo, yBottomMargin, !MyItemInfo.FormatStepData.Type.Contains("Borderless"));
if (MyGrid.Height > (yTopMargin - yBottomMargin))
{
_MyLog.ErrorFormat("<<< ERROR >>> Table is too big to fit on page, expect pagination problems\r\n==>'Table Too Big',{0},'{1}','{2}',{3},{4}"
, MyItemInfo.ItemID, MyItemInfo.MyDocVersion.MyFolder.Name, MyItemInfo.ShortPath, MyGrid.Height, (yTopMargin - yBottomMargin));
_MyLog.ErrorFormat("<<< ERROR >>> Table is too big to fit on page, expect pagination problems\r\n==>'Table Too Big',{0},'{1}','{2}',{3},{4},{5}" // RHM20150429 - Table Scrunch
, MyItemInfo.ItemID, MyItemInfo.MyDocVersion.MyFolder.Name, MyItemInfo.ShortPath, heightBefore, MyGrid.Height, (yTopMargin - yBottomMargin));
}
return retval;
}
@@ -883,8 +902,42 @@ namespace Volian.Print.Library
DebugPagination.WriteLine("Very Low {0},{1},{2},{3},{4},{5}", MyItemInfo.ShortPath, MyItemInfo.ItemID, yLocation, Height, yLocation - Height, yTopMargin - MyItemInfo.MyDocStyle.Layout.PageLength);
}
int profileDepth = ProfileTimer.Push(">>>> Rtf2Pdf.TextAt");
retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, DebugInfo + string.Format(",YLines = {0}",YSize/SixLinesPerInch), yBottomMargin);
ProfileTimer.Pop(profileDepth);
// ooooooooo. oooooooooo. oooooooooooo ooooooooooooo o8o . o8o
// `888 `Y88. `888' `Y8b `888' `8 8' 888 `8 `"' .o8 `"'
// 888 .d88' 888 888 888 888 oooo d8b .oooo. ooo. .oo. .oooo.o oooo .o888oo oooo .ooooo. ooo. .oo. .oooo.o
// 888ooo88P' 888 888 888oooo8 888 `888""8P `P )88b `888P"Y88b d88( "8 `888 888 `888 d88' `88b `888P"Y88b d88( "8
// 888 888 888 888 " 888 888 .oP"888 888 888 `"Y88b. 888 888 888 888 888 888 888 `"Y88b.
// 888 888 d88' 888 888 888 d8( 888 888 888 o. )88b 888 888 . 888 888 888 888 888 o. )88b
// o888o o888bood8P' o888o o888o d888b `Y888""8o o888o o888o 8""888P' o888o "888" o888o `Y8bod8P' o888o o888o 8""888P'
//
// Design Suggestion:
// During vlnParagraaph Constuctor Build an end point dictionary
// During toPdf check for end points before adding GoTos for Local
// Need to have a way to get to sections which do not have any output (header only)
// Need to have a way to identify procedures
//
//if (IParagraph.Chunks.Count > 0)
//{
// Chunk chk1 = IParagraph.Chunks[0] as Chunk;
// chk1.SetLocalDestination(string.Format("ItemID={0}", MyItemInfo.ItemID)); // Destination
// if (MyItemInfo.MyContent.ContentTransitionCount > 0)
// {
// TransitionInfo ti = MyItemInfo.MyContent.ContentTransitions[0];
// if (ti.MyItemToID.MyProcedure.ItemID == MyItemInfo.MyProcedure.ItemID)
// { // Local Go To
// if (ti.MyItemToID.MyContent.Type > 19999)
// foreach (Chunk chk in IParagraph.Chunks)
// chk.SetLocalGoto(string.Format("ItemID={0}", ti.ToID));
// }
// else // Remote Go To
// foreach (Chunk chk in IParagraph.Chunks)
// chk.SetRemoteGoto(ti.MyItemToID.MyProcedure.DisplayNumber.Replace("/", "_") + ".pdf", string.Format("ItemID={0}", ti.ToID));
// }
// MyPageHelper.BottomContent = yLocation - Height;
// if (MyItemInfo.InList(39048)) Console.WriteLine("Here");
retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, DebugInfo + string.Format(",YLines = {0}", YSize / SixLinesPerInch), yBottomMargin);
ProfileTimer.Pop(profileDepth);
//}
if (retval == 0) // problem occurred - paragraph was not able to be printed on page
{ // pagination logic needs to be fixed.
// oooooooooooo ooooooooo. o8o . o8o
@@ -2076,10 +2129,15 @@ namespace Volian.Print.Library
{
case E_ContBottomLoc.EndOfText: // place continue string at end of text
msg_yLocation = msg_yLocation + yLocation - SixLinesPerInch;
float tableSpaceAvailable = TableSpaceAvailable;// RHM20150525 - Table Scrunch
if (yBottomMargin + (docstyle.Layout.FooterLength ?? 0) > msg_yLocation)
{ // Adjusted Continue Message Y Offset
//DebugPagination.WriteLine("====>> {0},'{1}'", msg_yLocation, MyItemInfo.ShortPath);
msg_yLocation = yBottomMargin + (docstyle.Layout.FooterLength ?? 0);
//msg_yLocation = (float) MyPageHelper.BottomContent - SixLinesPerInch; // Account for how low the lowest Item is on the page
msg_yLocation = Math.Min(yBottomMargin +(docstyle.Layout.FooterLength ?? 0),(float) MyPageHelper.BottomContent - SixLinesPerInch);// RHM20150525 - Table Scrunch
float msg_yLocationOld = yBottomMargin + (docstyle.Layout.FooterLength ?? 0);
if (msg_yLocationOld != msg_yLocation)
_MyLog.WarnFormat("Continue Message Moved from {0} to {1} for {2}", msg_yLocationOld, msg_yLocation, this);// RHM20150525 - Table Scrunch
}
break;
case E_ContBottomLoc.BtwnTextAndBottom: // place continue string between end of text & bottom of page
@@ -2109,6 +2167,7 @@ namespace Volian.Print.Library
_MyLog.WarnFormat("**** BOTTOM CONTINUE MESSAGE NOT CODED FOR LOCATION {0}*****", docstyle.Continue.Bottom.Location);
break;
}
MyPageHelper.BottomContent = null;// RHM20150525 - Table Scrunch
if (!PageBreakOnStep)
{
float xoffB = 0;
@@ -2219,8 +2278,10 @@ namespace Volian.Print.Library
{
//if (!vPara.Processed && ((vPara.YOffset + vPara.Height) < YTopMost))
if (!vPara.Processed && ((vPara.YOffset) < YTopMost))
if (MyItemInfo.ItemID != vPara.MyItemInfo.ItemID)
if (this.MyItemInfo.ItemID != vPara.MyItemInfo.ItemID) // RHM20150507 Table Scrunch
process.Add(vPara);
else // RHM20150507 Table Scrunch
_MyLog.WarnFormat("Step Could Have Fit {0}, {1}",MyItemInfo.ItemID,MyItemInfo.ShortPath);
}
foreach (vlnParagraph vPara in process)
{
@@ -3788,14 +3849,14 @@ namespace Volian.Print.Library
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm ||
(MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert && MyItemInfo.IsStep && MyItemInfo.FormatStepData.StepLayoutData.STBoxindex != null))
{
if ((MyItemInfo.IsCaution || MyItemInfo.IsNote || MyItemInfo.MyParent.IsCaution || MyItemInfo.MyParent.IsNote) && !MyItemInfo.FormatStepData.SpaceIn
&& (MyItemInfo.Steps == null || MyItemInfo.Steps.Count == 0)
&& (MyItemInfo.NextItem == null || MyItemInfo.MyContent.Type != MyItemInfo.NextItem.MyContent.Type)) return 0;
if ((MyItemInfo.IsCaution || MyItemInfo.IsNote || MyItemInfo.MyParent.IsCaution || MyItemInfo.MyParent.IsNote) && !MyItemInfo.FormatStepData.SpaceIn
&& (MyItemInfo.Steps == null || MyItemInfo.Steps.Count == 0)
&& (MyItemInfo.NextItem == null || MyItemInfo.MyContent.Type != MyItemInfo.NextItem.MyContent.Type)) return 0;
if (everyNLines == 99 && MyItemInfo.NextItem == null)
{
if (MyItemInfo.Steps != null && MyItemInfo.Steps.Count > 0 && MyItemInfo.Steps[0].MyContent.Type == MyItemInfo.MyContent.Type) return 0;
if (MyItemInfo.MyParent.NextItem != null && MyItemInfo.MyParent.NextItem.MyContent.Type == MyItemInfo.MyContent.Type) return 0;
}
{
if (MyItemInfo.Steps != null && MyItemInfo.Steps.Count > 0 && MyItemInfo.Steps[0].MyContent.Type == MyItemInfo.MyContent.Type) return 0;
if (MyItemInfo.MyParent.NextItem != null && MyItemInfo.MyParent.NextItem.MyContent.Type == MyItemInfo.MyContent.Type) return 0;
}
}
if (MyItemInfo.Ordinal % everyNLines == 0 || MyItemInfo.NextItem == null) return SixLinesPerInch;
// Pagination issue to be used with yEndsWithBlankLine in Pagination code, but not checked in yet.
@@ -4844,11 +4905,11 @@ namespace Volian.Print.Library
XOffset += mycolT; // adjust caution/note text position
if (PartsLeft != null && PartsLeft.Count > 0)// adjust tab position
{
if (myTab != null && (itemInfo.IsNote || itemInfo.IsCaution))
if(myTab!=null && (itemInfo.IsNote || itemInfo.IsCaution))
Width -= myTab.Width;
foreach (vlnPrintObject vpo in PartsLeft)
vpo.XOffset += mycolT;
}
}
}
else if (itemInfo.IsSection)
{
@@ -4885,10 +4946,10 @@ namespace Volian.Print.Library
}
else if (itemInfo.MyParent.IsCaution || itemInfo.MyParent.IsNote)
{
if (itemInfo.ActiveFormat.MyStepSectionLayoutData.DevNoteOrCautionTabOffset != null)
if(itemInfo.ActiveFormat.MyStepSectionLayoutData.DevNoteOrCautionTabOffset != null)
Width = MyParent.MyParent.Width - tabWidth + (myTab == null ? 0 : myTab.TabAlign);
else
Width = MyParent.Width - tabWidth + (myTab == null ? 0 : myTab.TabAlign);
Width = MyParent.Width - tabWidth + (myTab == null ? 0 : myTab.TabAlign);
Width -= 72 * (itemInfo.FormatStepData.CautionOrNoteSubstepIndent == null ? 0 : (float)itemInfo.FormatStepData.CautionOrNoteSubstepIndent / (float)itemInfo.FormatStepData.Font.CPI);
}
else
@@ -4901,7 +4962,7 @@ namespace Volian.Print.Library
else if (MyParent.WidthNoLimit != 0)
Width = adjwidth + MyParent.WidthNoLimit - tabWidth + (myTab == null ? 0 : myTab.TabAlign);
else if ((itemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PageListSpBckgrnd) == E_DocStructStyle.DSS_PageListSpBckgrnd)
Width = adjwidth + MyParent.Width - (MyTab != null ? MyTab.Width : 0);
Width = adjwidth + MyParent.Width - (MyTab!=null?MyTab.Width:0);
else
Width = adjwidth + MyParent.Width - tabWidth + (myTab == null ? 0 : myTab.TabAlign);
}