Made Status Change available to other print objects

Update status when moving through a section with subsections
Update status when moving through a section with subsections
GetSectionInfo use local value rather than using the cache
Used SectionInfo property HasStepCheckOffs to turn-on CheckOff header and narrow text width.
This commit is contained in:
Rich 2014-11-05 14:36:17 +00:00
parent 2d7c25d2d2
commit b89af73735
3 changed files with 48 additions and 36 deletions

View File

@ -81,18 +81,19 @@ namespace Volian.Print.Library
Before,
BuildStep,
Progress,
ProgressSetup
ProgressSetup,
LoadVlnParagraph
}
public class PromsPrinter
{
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public event PromsPrinterStatusEvent StatusChanged;
private void OnStatusChanged(object sender, PromsPrintStatusArgs args)
internal void OnStatusChanged(object sender, PromsPrintStatusArgs args)
{
if (StatusChanged != null)
StatusChanged(sender, args);
}
private void OnStatusChanged(string myStatus, PromsPrinterStatusType type)
internal void OnStatusChanged(string myStatus, PromsPrinterStatusType type)
{
OnStatusChanged(this, new PromsPrintStatusArgs(myStatus, type));
}
@ -100,7 +101,7 @@ namespace Volian.Print.Library
{
OnStatusChanged(this, new PromsPrintStatusArgs(msg, PromsPrinterStatusType.General));
}
private void OnStatusChanged(string myStatus, PromsPrinterStatusType type, int progress)
internal void OnStatusChanged(string myStatus, PromsPrinterStatusType type, int progress)
{
OnStatusChanged(this, new PromsPrintStatusArgs(myStatus, type, progress));
}
@ -1188,7 +1189,7 @@ namespace Volian.Print.Library
else
_MyHelper.IsLandscape = false;
_MyHelper.ChangeBarDefinition = MyChangeBarDefinition;
vlnParagraph myParagraph = new vlnParagraph(null, cb, myItemInfo, (float)myItemInfo.MyDocStyle.Layout.LeftMargin, _NoBreakYOffset, 0, myItemInfo.ColumnMode, myItemInfo.ActiveFormat, null, null, 0,true);
vlnParagraph myParagraph = new vlnParagraph(null, cb, myItemInfo, (float)myItemInfo.MyDocStyle.Layout.LeftMargin, _NoBreakYOffset, 0, myItemInfo.ColumnMode, myItemInfo.ActiveFormat, null, null, 0,true,this);
float localYPageStart = 0;
float yPageStart = yTopMargin;
if (myItemInfo.HasChildren || myItemInfo.MyDocVersion.DocVersionConfig.SelectedSlave > 0)

View File

@ -1692,10 +1692,11 @@ namespace Volian.Print.Library
case "{INITIALS}":
// For Calvert: if this section has checkoffs turned on, put out this pagelist item:
// Get SectionInfos to access specific section config items...
SectionInfo si = SectionInfo.Get(MySection.ItemID);
//SectionInfo si = SectionInfo.Get(MySection.ItemID);
SectionInfo si = MySection.GetSectionInfo();
SectionConfig sectCfg = si.MyConfig as SectionConfig;
int sc = sectCfg.Section_CheckoffListSelection;
if (sc < 2) plstr = plstr.Replace(token, "");
if (sc < 2 && !si.HasStepCheckOffs) plstr = plstr.Replace(token, "");
else plstr = plstr.Replace(token, "INITIALS");
break;
case "{REVUNIT}":

View File

@ -59,8 +59,11 @@ namespace Volian.Print.Library
{
return ((itminfo.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedDeviations) == E_PurchaseOptions.EnhancedDeviations);
}
public float Add(PdfContentByte cb, ItemInfoList itemInfoList, float xoff, float yoff, float yoffRight, int rnoLevel, int maxRNO, FormatInfo formatInfo)
{
return Add(cb, itemInfoList, xoff, yoff, yoffRight, rnoLevel, maxRNO, formatInfo, null);
}
public float Add(PdfContentByte cb, ItemInfoList itemInfoList, float xoff, float yoff, float yoffRight, int rnoLevel, int maxRNO, FormatInfo formatInfo, PromsPrinter pp)
{
bool bxHlsDraw = false;
int? bxIndex = null;
@ -75,9 +78,11 @@ namespace Volian.Print.Library
int maxRnoSav = maxRNO;
foreach (ItemInfo iChildItemInfo in itemInfoList)
{
if(pp != null) pp.OnStatusChanged((iChildItemInfo.DisplayNumber ?? "") == "" ? iChildItemInfo.DisplayText : iChildItemInfo.DisplayNumber, PromsPrinterStatusType.LoadVlnParagraph);
if (iChildItemInfo.IsNote && iChildItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.NotesToFootnotes)
{
vlnParagraph para = new vlnParagraph(Parent, cb, iChildItemInfo, xoff, yoff, rnoLevel, maxRNO, formatInfo, null, null, yoffRight, true);
vlnParagraph para = new vlnParagraph(Parent, cb, iChildItemInfo, xoff, yoff, rnoLevel, maxRNO, formatInfo, null, null, yoffRight, true, iChildItemInfo.IsSection ? pp :null);
continue; // don't add it, vlnParagraph adds this item to the footnote vlntext list in ToPdf.
}
maxRNO = maxRnoSav;
@ -279,7 +284,7 @@ namespace Volian.Print.Library
box = null;
yoff += 1 * vlnPrintObject.SixLinesPerInch;
}
vlnParagraph para = new vlnParagraph(Parent, cb, childItemInfo, xoff, yoff, rnoLevel, maxRNO, formatInfo, null, null, yoffRight,true);
vlnParagraph para = new vlnParagraph(Parent, cb, childItemInfo, xoff, yoff, rnoLevel, maxRNO, formatInfo, null, null, yoffRight,true,null);
// if doing the component list (FNP), keep track of the bottom most columns' data
// so this can be returned after the row is done.
@ -514,11 +519,11 @@ namespace Volian.Print.Library
if (pc.Total == 0)
{
pc.Total = MyPageHelper.CurrentTOCPageNumber + 1;
pc.DrawTemplates();
}
pc.DrawTemplates();
}
}
}
}
if (!doprint) return yPageStart;
if (_PartsLeft != null && _PartsLeft.Count > 0) yPageStart = PartsLeft.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
if (_PartsRight != null && _PartsRight.Count > 0) yPageStart = PartsRight.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
@ -963,14 +968,14 @@ namespace Volian.Print.Library
string thisTab = itemInfo.MyTab.CleanText.Trim();
if (!itemInfo.IsSection)
{
ItemInfo mypar = itemInfo.MyParent;
ItemInfo mypar = itemInfo.MyParent;
while (mypar != null && !mypar.IsProcedure)
{
string pTab = mypar.MyTab.CleanText.Trim();
{
string pTab = mypar.MyTab.CleanText.Trim();
if (char.IsLetterOrDigit(pTab[0]))
{
pTab = pTab.TrimEnd(" .".ToCharArray()) + ".";
prTab = pTab + prTab;
pTab = pTab.TrimEnd(" .".ToCharArray()) + ".";
prTab = pTab + prTab;
}
else
{
@ -1014,7 +1019,8 @@ namespace Volian.Print.Library
{
PdfReader tmp = null;
string tmpstr = null;
SectionInfo si = SectionInfo.Get(MyItemInfo.ItemID);
//SectionInfo si = SectionInfo.Get(MyItemInfo.ItemID);
SectionInfo si = MyItemInfo.GetSectionInfo();
cb.PdfDocument.NewPage();
//_MyLog.InfoFormat("NewPage 9 {0}", cb.PdfWriter.CurrentPageNumber);
MyPageHelper.MyPromsPrinter.CreateWordDocPdf(cb, si, ref tmp, ref tmpstr);
@ -1244,7 +1250,7 @@ namespace Volian.Print.Library
if (MyItemInfo.MyHLS != null && MyItemInfo.MyHLS.FormatStepData.UseSmartTemplate)
{
DoSubs = false;
vlnParagraph smartPara = new vlnParagraph(MyParent.MyParent, cb, MyItemInfo.MyHLS, MyParent.XOffset, yPageStart, 0, 0, MyParent.MyItemInfo.ActiveFormat, null, " (Continued)", 0,false);
vlnParagraph smartPara = new vlnParagraph(MyParent.MyParent, cb, MyItemInfo.MyHLS, MyParent.XOffset, yPageStart, 0, 0, MyParent.MyItemInfo.ActiveFormat, null, " (Continued)", 0,false,null);
smartPara.PrintHeader = true;
float mytmpfloat = smartPara.ParagraphToPdf(cb, yPageStart, yTopMargin, yBottomMargin);
yPageStart -= smartPara.Height;
@ -1332,7 +1338,7 @@ namespace Volian.Print.Library
secContinueXoff = fndTopSect.XOffset;
}
sectContPara = new vlnParagraph(MyParent.MyParent, cb, MyItemInfo.ActiveSection, MyParent.XOffset, 0, 0, 0, MyParent.MyItemInfo.ActiveFormat, null, (contMsg == null || contMsg == "") ? " (Continued)" : contMsg, 0, false);
sectContPara = new vlnParagraph(MyParent.MyParent, cb, MyItemInfo.ActiveSection, MyParent.XOffset, 0, 0, 0, MyParent.MyItemInfo.ActiveFormat, null, (contMsg == null || contMsg == "") ? " (Continued)" : contMsg, 0, false,null);
if (sectContPara.PartsLeft.Count > 0)
{
vlnTab vt = sectContPara.MyTab;
@ -1359,7 +1365,7 @@ namespace Volian.Print.Library
}
else
{
sectContPara = new vlnParagraph(MyParent.MyParent, cb, MyItemInfo.ActiveSection, MyParent.XOffset, 0, 0, 0, MyParent.MyItemInfo.ActiveFormat, null, (contMsg == null || contMsg == "") ? " (Continued)" : contMsg, 0, false);
sectContPara = new vlnParagraph(MyParent.MyParent, cb, MyItemInfo.ActiveSection, MyParent.XOffset, 0, 0, 0, MyParent.MyItemInfo.ActiveFormat, null, (contMsg == null || contMsg == "") ? " (Continued)" : contMsg, 0, false,null);
float mytmpfloat = sectContPara.ParagraphToPdf(cb, yTopMargin, yTopMargin, yBottomMargin);
if (sectContPara.SectionContinuePrinted)
yPageStart -= sectContPara.Height + SixLinesPerInch;
@ -1370,7 +1376,7 @@ namespace Volian.Print.Library
// see if this hls has footnotes, add to the footnote datastructure for processing at end of pgae.
if (MyItemInfo.IsHigh && MyPageHelper.NotesToFootNotesHLS.ContainsKey(MyItemInfo.ItemID)) AddFootNote(cb);
yPageStart = ChildrenAbove.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
yPageStart = ChildrenLeft.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
@ -2092,7 +2098,7 @@ namespace Volian.Print.Library
return (float)(MyItemInfo.MyDocStyle.Layout.PageLength - MyItemInfo.MyDocStyle.Layout.TopMargin - MyItemInfo.MyDocStyle.Layout.FooterLength);
}
}
public vlnParagraph(vlnParagraph parent, PdfContentByte cb, ItemInfo itemInfo, float xoff, float yoff, int rnoLevel, int maxRNO, FormatInfo formatInfo, string prefix, string suffix, float yoffRightParent, bool loadChildren)
public vlnParagraph(vlnParagraph parent, PdfContentByte cb, ItemInfo itemInfo, float xoff, float yoff, int rnoLevel, int maxRNO, FormatInfo formatInfo, string prefix, string suffix, float yoffRightParent, bool loadChildren, PromsPrinter pp)
{
Prefix = prefix;
Suffix = suffix;
@ -2923,7 +2929,7 @@ namespace Volian.Print.Library
}
if (itemInfo.Sections != null)
if (loadChildren)
yoff = ChildrenBelow.Add(cb, itemInfo.Sections, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo);
yoff = ChildrenBelow.Add(cb, itemInfo.Sections, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo, pp);
if (itemInfo.Procedures != null)
if (loadChildren)
yoff = ChildrenBelow.Add(cb, itemInfo.Procedures, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo);
@ -3071,7 +3077,8 @@ namespace Volian.Print.Library
// See if this section has a checkoffheading index - this value, if set is stored in the config field.
// -1 flags no entries in the format's CheckOffHeaderList & 0 flags the first
// entry which is always '{NO HEADING}'. So only continue if it's greater than 0.
SectionInfo si = SectionInfo.Get(itemInfo.ItemID); // sometimes the itemInfo isn't a section info
//SectionInfo si = SectionInfo.Get(itemInfo.ItemID); // sometimes the itemInfo isn't a section info
SectionInfo si = itemInfo.GetSectionInfo(); // sometimes the itemInfo isn't a section info
int sindx = si.CheckOffHeadingIndex();
// If there is a checkoff header for this section, see if this section has subsections.
@ -3132,9 +3139,11 @@ namespace Volian.Print.Library
// If subsections and starts at top of page, (on top of page, use pagelist code in VlnSvgPageHelper)
// Get SectionInfos to access specific section config items...
SectionInfo si = SectionInfo.Get(mySectionInfo.ItemID);
//SectionInfo si = SectionInfo.Get(mySectionInfo.ItemID);
SectionInfo si = mySectionInfo.GetSectionInfo();
int sindx = si.CheckOffHeadingIndex();
SectionInfo subi = mySubSectionInfo == null ? null : SectionInfo.Get(mySubSectionInfo.ItemID);
//SectionInfo subi = mySubSectionInfo == null ? null : SectionInfo.Get(mySubSectionInfo.ItemID);
SectionInfo subi = mySubSectionInfo == null ? null : mySubSectionInfo.GetSectionInfo();
int subindx = subi == null ? -1 : subi.CheckOffHeadingIndex();
// if there is no subsections & the main section doesn't use a header OR
@ -3307,14 +3316,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.GetNextItem() == null || MyItemInfo.MyContent.Type != MyItemInfo.GetNextItem().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.GetNextItem() == null || MyItemInfo.MyContent.Type != MyItemInfo.GetNextItem().MyContent.Type)) return 0;
if (everyNLines == 99 && MyItemInfo.GetNextItem() == null)
{
if (MyItemInfo.Steps != null && MyItemInfo.Steps.Count > 0 && MyItemInfo.Steps[0].MyContent.Type == MyItemInfo.MyContent.Type) return 0;
if (MyItemInfo.MyParent.GetNextItem() != null && MyItemInfo.MyParent.GetNextItem().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.GetNextItem() != null && MyItemInfo.MyParent.GetNextItem().MyContent.Type == MyItemInfo.MyContent.Type) return 0;
}
}
if (MyItemInfo.Ordinal % everyNLines == 0 || MyItemInfo.GetNextItem() == null) return SixLinesPerInch;
// Pagination issue to be used with yEndsWithBlankLine in Pagination code, but not checked in yet.
@ -4233,10 +4242,11 @@ namespace Volian.Print.Library
if (itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert)
{
// For Calvert STP/OP: see if this section has checkoffs by looking in the section config:
SectionInfo si = SectionInfo.Get(itemInfo.ActiveSection.ItemID);
//SectionInfo si= SectionInfo.Get(itemInfo.ActiveSection.ItemID);
SectionInfo si = itemInfo.ActiveSection.GetSectionInfo();
SectionConfig sectCfg = si.MyConfig as SectionConfig;
int sc = sectCfg.Section_CheckoffListSelection;
ChkOff = (sc >= 2);
ChkOff = (sc >= 2) || si.HasStepCheckOffs;
}
if (ChkOff)
{