ReadOnly Step Property for Backgrounds

Support ReadOnly step property for rtb size
Support ReadOnly for rtb
Pagination for Background documents, i.e. HLS/Caution/Note have pagebreaks
Pagination for Backgrounds; Pagelist items for Backgrounds; tabs & offset for backgrounds & minor general Callaway
PageList items for Background documents (HLRNO & HLSTAB) and CURDATE & CURTIME (for fnpnmp)
This commit is contained in:
2013-09-25 16:09:15 +00:00
parent a65ca24837
commit 9bc84679d3
6 changed files with 206 additions and 16 deletions

View File

@@ -174,6 +174,12 @@ namespace Volian.Print.Library
{
return string.Format("{0} - {1} - {2} - '{3}'", this.MyItemInfo.ItemID, this.YTop, this.YSize, this.MyItemInfo.ShortPath);
}
private bool _PageBreakOnStep = false;
public bool PageBreakOnStep
{
get { return _PageBreakOnStep; }
set { _PageBreakOnStep = value; }
}
private vlnTable _MyGrid;
public vlnTable MyGrid
{
@@ -207,6 +213,17 @@ namespace Volian.Print.Library
if ((MyItemInfo.Cautions != null && MyItemInfo.Cautions[0].FormatStepData.AlwaysUseExtraLines) || (MyItemInfo.Notes != null && MyItemInfo.Notes[0].FormatStepData.AlwaysUseExtraLines))
yPageStart -= ((MyItemInfo.FormatStepData == null) ? 0 : MyItemInfo.FormatStepData.StepLayoutData.STExtraSpace ?? 0);
}
// Save the HLS & RNO string in case the pagelist item uses it (some of the backgrounds):
if (MyItemInfo.FormatStepData != null && MyItemInfo.FormatStepData.PageBreakOnStep)
{
MyPageHelper.HLSTAB = MyItemInfo.HighLevelStepTabPageList;
// find the rno and use it's tab for the HLRNO part.
ItemInfo rno = MyItemInfo.RNOs != null && MyItemInfo.RNOs.Count > 0 ? MyItemInfo.RNOs[0] : null;
string rnotab = (rno == null) ? MyItemInfo.MyTab.CleanText : rno.DisplayText;
MyPageHelper.HLRNO = MyItemInfo.FormatStepData.TabData.RNOIdent + rnotab;
MyPageHelper.ResetSvg();
}
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);
float retval = yLocation;
@@ -745,8 +762,10 @@ namespace Volian.Print.Library
Console.WriteLine("**** BOTTOM CONTINUE MESSAGE NOT CODED*****");
break;
}
MyPageHelper.BottomMessage = new vlnText(cb, this, myMsg, myMsg, docstyle.Layout.LeftMargin + XOffsetBox + docstyle.Continue.Bottom.Margin ?? 0, msg_yLocation, docstyle.Continue.Bottom.Font);// MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font);
if (!PageBreakOnStep)
MyPageHelper.BottomMessage = new vlnText(cb, this, myMsg, myMsg, docstyle.Layout.LeftMargin + XOffsetBox + docstyle.Continue.Bottom.Margin ?? 0, msg_yLocation, docstyle.Continue.Bottom.Font);// MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font);
}
if (PageBreakOnStep) MyPageHelper.BottomMessage = null;
cb.PdfDocument.NewPage();
//_MyLog.InfoFormat("NewPage 11 {0}", cb.PdfWriter.CurrentPageNumber);
ResetDocStyleAndValues(ref yTopMargin, ref yBottomMargin);
@@ -788,7 +807,10 @@ namespace Volian.Print.Library
yPageStart -= 2 * SixLinesPerInch;// Allow two lines for top continue message
if (myMsg.IndexOf(@"%d") > -1)
myMsg = myMsg.Replace(@"%d", MyItemInfo.MyHLS.MyTab.CleanTextNoSymbols.Trim(" .".ToCharArray()));
MyPageHelper.TopMessage = new vlnText(cb, this, myMsg, myMsg, docstyle.Layout.LeftMargin + XOffsetBox + docstyle.Continue.Top.Margin ?? 0, yTopMargin + 0.1F, docstyle.Continue.Top.Font);// MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font);
if (!PageBreakOnStep)
MyPageHelper.TopMessage = new vlnText(cb, this, myMsg, myMsg, docstyle.Layout.LeftMargin + XOffsetBox + docstyle.Continue.Top.Margin ?? 0, yTopMargin + 0.1F, docstyle.Continue.Top.Font);// MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font);
else
MyPageHelper.TopMessage = null;
}
// If "ContinueSectionHeader" (format flag) is true then print the section title with "(Continued)" appended to it
@@ -860,9 +882,21 @@ namespace Volian.Print.Library
float mytmpfloat = sectContPara.ParagraphToPdf(cb, yTopMargin, yTopMargin, yBottomMargin);
yPageStart -= sectContPara.Height * 2;
}
yPageStart = ChildrenAbove.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
yPageStart = ChildrenLeft.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
// Handle the PageBreakOnStep flag for a HLS. This will put out the page break right before
// a HLS. One example of this use is for backgrounds (CALBCK).
if (MyPageHelper.ParaBreaks != null && MyPageHelper.ParaBreaks.Count > 0 &&
MyPageHelper.ParaBreaks[0] == this)
{
OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
MyPageHelper.BottomMessage = null;
MyPageHelper.TopMessage = null;
cb.PdfDocument.NewPage();
MyPageHelper.ParaBreaks.RemoveAt(0);
yPageStart = yTopMargin + YTop;
}
yPageStart = ParagraphToPdf(cb, yPageStart, yTopMargin, yBottomMargin);
yPageStart = ChildrenRight.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
yPageStart = ChildrenBelow.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
@@ -1104,7 +1138,19 @@ namespace Volian.Print.Library
foreach (vlnParagraph child in ChildrenBelow)
child.BuildLocationList(yTopMost, myLocations);
}
private bool IsBackgroundStep()
{
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.WolfCreekBackgroundFormat &&
(MyItemInfo.IsHigh || MyItemInfo.IsCaution || MyItemInfo.IsNote)) return true;
return false;
}
private int COL_WID_ADJ = 6; // adjusts for incorrect use of WidSTable when breaking a line (it breaks 6 chars too short)
private bool IsTitleType(ItemInfo itm)
{
if (itm.FormatStepData != null && (itm.FormatStepData.Index == 42 || itm.FormatStepData.Index == 43)) return true;
return false;
}
public vlnParagraph(vlnParagraph parent, PdfContentByte cb, ItemInfo itemInfo, float xoff, float yoff, int rnoLevel, int maxRNO, FormatInfo formatInfo, string prefix, string suffix)
{
ShowSectionTitles = formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ShowSectionTitles || itemInfo.MyDocStyle.ShowSectionTitles;
@@ -1213,7 +1259,10 @@ namespace Volian.Print.Library
}
if (!itemInfo.IsSection || doSectTab)
{
mytab = new vlnTab(cb, this, itemInfo.MyTab.Text, itemInfo.MyTab.CleanText, localXOffset, yoff, itemInfo.MyTab.MyFont, doSectTab, StepRTB.MySymbolFontName, itemInfo.MyTab.RemovedStyleUnderline);
if (itemInfo.MyTab.AltPrintTab != null)
mytab = new vlnTab(cb, this, itemInfo.MyTab.AltPrintTab, itemInfo.MyTab.AltPrintTab, localXOffset, yoff, itemInfo.MyTab.MyFont, doSectTab, StepRTB.MySymbolFontName, itemInfo.MyTab.RemovedStyleUnderline);
else
mytab = new vlnTab(cb, this, itemInfo.MyTab.Text, itemInfo.MyTab.CleanText, localXOffset, yoff, itemInfo.MyTab.MyFont, doSectTab, StepRTB.MySymbolFontName, itemInfo.MyTab.RemovedStyleUnderline);
PartsLeft.Add(mytab);
if (mytab.MyMacro != null) PartsLeft.Add(mytab.MyMacro);
}
@@ -1221,7 +1270,7 @@ 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:
AdjustWidth(itemInfo, maxRNO, formatInfo, mytab);
bool adjustAgain = itemInfo.MyTab.Position == 0 ? true : false;
bool adjustAgain = (itemInfo.MyTab != null && itemInfo.MyTab.Position == 0) ? true : false;
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.
@@ -1325,6 +1374,10 @@ namespace Volian.Print.Library
mytab.YOffset = yoff;
if (mytab.MyMacro != null) mytab.MyMacro.YOffset = yoff;
}
// For background formats, HLS's or Caution or any Notes have tab on line and then text
// on line below (with space in between)
if (IsBackgroundStep()) yoff = YOffset = yoff + (2 * SixLinesPerInch);
float yForCheckoff = yoff; //0; - default checkoff row is same as FIRST line of text
// if dropCheckoff is true, then the checkoff is place on the same of row as the LAST line of text
bool dropCheckoff = itemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.DropCheckOff;
@@ -1528,7 +1581,9 @@ namespace Volian.Print.Library
}
float yOffRight = yoff;
float RnoOffset = ToInt(formatInfo.MyStepSectionLayoutData.ColRTable, maxRNO);
if (rnoLevel < maxRNO && itemInfo.RNOs != null) yOffRight = ChildrenRight.Add(cb, itemInfo.RNOs, XOffset + RnoOffset, YTop, YTop, rnoLevel + 1, maxRNO, formatInfo);
if (rnoLevel < maxRNO && itemInfo.RNOs != null)
yOffRight = ChildrenRight.Add(cb, itemInfo.RNOs, XOffset + RnoOffset, YTop, YTop, rnoLevel + 1, maxRNO, formatInfo);
// Need code to determine if the table will overlap the Right Column if it does then
// use YOffRight rather than yoff
if (itemInfo.Tables != null)
@@ -1563,7 +1618,8 @@ namespace Volian.Print.Library
if (itemInfo.Steps != null && printsteps) yoff = ChildrenBelow.Add(cb, itemInfo.Steps, XOffset, yoff, yOffRight, rnoLevel, maxRNO, formatInfo);
if (itemInfo.Sections != null) yoff = ChildrenBelow.Add(cb, itemInfo.Sections, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo);
if (itemInfo.Procedures != null) yoff = ChildrenBelow.Add(cb, itemInfo.Procedures, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo);
if (rnoLevel >= maxRNO && itemInfo.RNOs != null) yoff = ChildrenBelow.Add(cb, itemInfo.RNOs, XOffset, yoff, yoff, rnoLevel + 1, maxRNO, formatInfo);
// Don't add the RNO to print if doing backgrounds. That piece of data is part of the pagelist item.
if (rnoLevel >= maxRNO && itemInfo.RNOs != null && !itemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.WolfCreekBackgroundFormat) yoff = ChildrenBelow.Add(cb, itemInfo.RNOs, XOffset, yoff, yoff, rnoLevel + 1, maxRNO, formatInfo);
yoff = Math.Max(yoff, yOffRight);
// TODO - use RNOSepAfterAER flag too:
string tmpRnoSepStr = formatInfo.MyStepSectionPrintData.RNOSepString;
@@ -1760,6 +1816,7 @@ namespace Volian.Print.Library
private void CalculateXOffsetGridOrFigure(ItemInfo itemInfo, int maxRNO, FormatInfo formatInfo)
{
bool aerTableOrFigure = itemInfo.FormatStepData.Type.Contains("AER");
// if (itemInfo.ColumnMode == 0) aerTableOrFigure = true; // if in single column mode, treat as an AER table for centering
vlnParagraph hls1 = MyParent;
while (hls1.MyParent != null && !hls1.MyItemInfo.IsHigh) hls1 = hls1.MyParent;
float colR = float.Parse(formatInfo.MyStepSectionLayoutData.ColRTable.Split(",".ToCharArray())[itemInfo.ColumnMode]);
@@ -1768,7 +1825,7 @@ namespace Volian.Print.Library
float pageWidth = ((float)itemInfo.MyActiveSection.MyDocStyle.Layout.PageWidth);
float leftMargin = ((float)itemInfo.MyActiveSection.MyDocStyle.Layout.LeftMargin); //* (float)MyItemInfo.FormatStepData.Font.CPI / 12;
if (itemInfo.IsInRNO)
if (itemInfo.IsInRNO) // && itemInfo.ColumnMode != 0)
// if in rno column, the upper limit is width of the page (right margin). Subtract off size of a character
xUpperLimit = pageWidth - (72 / (float)MyItemInfo.FormatStepData.Font.CPI);
else
@@ -1779,7 +1836,13 @@ namespace Volian.Print.Library
XOffset = leftMargin + (pageWidth - leftMargin - Width) / 2;
else
{
if (aerTableOrFigure || itemInfo.RNOLevel != 0) // AER or RNO
//if (TableCenterPos != 0)
//{
// XOffset = TableCenterPos;
// XOffset = XOffset - (this.Width / 2) + (float)itemInfo.MyDocStyle.Layout.LeftMargin;
//}
//else if (aerTableOrFigure || itemInfo.RNOLevel != 0) // AER or RNO
if (aerTableOrFigure || itemInfo.RNOLevel != 0) // AER or RNO
XOffset = MyParent.XOffset + MyParent.Width / 2 - Width / 2;
else if (TableCenterPos != 0)
{
@@ -1843,7 +1906,12 @@ namespace Volian.Print.Library
{
foreach (Macro myMacro in myMacros)
{
if (myMacro.LocWithXOff ?? false) x = mytab == null ? XOffset : mytab.XOffset;
// if the format has the 'LocWithXOff' locate the macro along with the tab's offset.
// however, if the tab is more than 2 characters long, adjust so that it aligns with the
// last two characters, not the first 2.
string tabText = mytab == null ? null : mytab.Text.Trim(" .".ToCharArray());
int tablen = (tabText == null) ? 0 : (tabText.Length <= 2) ? 0 : tabText.Length - 2;
if (myMacro.LocWithXOff ?? false) x = mytab == null ? XOffset : ((float)mytab.XOffset + (tablen * (float)mytab.MyFont.CharsToTwips));
PartsLeft.Add(new vlnMacro(x, y, myMacro.MacroDef));
}
}
@@ -2249,6 +2317,23 @@ namespace Volian.Print.Library
int? bxIndx = formatInfo.PlantFormat.FormatData.StepDataList[typ].StepLayoutData.STBoxindex;
float? colOvrd = formatInfo.PlantFormat.FormatData.StepDataList[typ].ColOverride;
if (IsBackgroundStep())
{
myTab.XOffset = XOffset;
XOffset += (itemInfo.FormatStepData.Font.CharsToTwips * 2); // indent 2 characters for background steps
return;
}
else if (itemInfo.FormatStepData != null && itemInfo.FormatStepData.Type == "TitleWithTextBelow")
{
XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin;
return;
}
else if (itemInfo.MyParent.FormatStepData != null && itemInfo.MyParent.FormatStepData.Type == "TitleWithTextBelow")
{
XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (itemInfo.FormatStepData.Font.CharsToTwips * 2);
return;
}
if (itemInfo.IsHigh)
{
float x = 0;
@@ -2437,7 +2522,6 @@ namespace Volian.Print.Library
if (bxIndx == null) return;
}
float tabWidth = (myTab == null) ? 0 : myTab.Width;
if (itemInfo.IsHigh)
{
float CheckOffAdj = 0;