Changed NextItem property to use GetNextItem method when printing
Added Profile debug Added Command-line parameters (/X= and /Y=) to specify the offset used for Compare. Changed NextItem property to use GetNextItem method when printing. Remove PrintTimer which has been replaced with ProfileTimer Added Profile debug Added code to handle special characters when printing, Added Profile debug Changed NextItem property to use GetNextItem method when printing
This commit is contained in:
parent
d501a39a7b
commit
389c6575d0
@ -58,7 +58,7 @@ namespace Volian.Print.Library
|
||||
// The 3 was changed to 2 for the end line & the line below. The blank line below the step gives the blank
|
||||
// line above the end message, thus 2 not 3. This change was made on July 20, 2011 by RHM & KBR. The
|
||||
// procedure in questions was VEWCNEMG\EMGAPP.PRC, ES-01, Step 8.
|
||||
float yEndMsg = !_skipEndMessage && !MyItemInfo.IsSection && MyItemInfo.MyHLS != null && MyItemInfo.MyHLS.GetNextItem() == null && (MyItemInfo.MyDocStyle.End.Message ?? "") != "" ? 2 * SixLinesPerInch : 0;
|
||||
float yEndMsg = !_skipEndMessage && !MyItemInfo.IsSection && MyItemInfo.MyHLS != null && MyItemInfo.MyHLS.NextItem == null && (MyItemInfo.MyDocStyle.End.Message ?? "") != "" ? 2 * SixLinesPerInch : 0;
|
||||
|
||||
// also consider if there is a phone list at the bottom of the page, add the amount of space the phone
|
||||
// list requires onto yEndMsg to make it easier to figure out pagination (include an extra line for the
|
||||
@ -474,6 +474,7 @@ namespace Volian.Print.Library
|
||||
}
|
||||
private void BuildPageBreakList(float ySpaceOnCurPage, float yPageSize, bool KeepStepsOnPage, float yEndMsg)
|
||||
{
|
||||
int profileDepth = ProfileTimer.Push(">>>> BuildPageBreakList");
|
||||
// if this paragraph is flagged to pagebreakonstep (i.e. these are used by background documents
|
||||
// to get each hls/caution/note to be on its own page), then any of the children above should
|
||||
// also have the flag set and be added to the pagebreakonsteplist so that a break occurs.
|
||||
@ -554,7 +555,7 @@ namespace Volian.Print.Library
|
||||
float accountForSmartTemplateHeader = 0;
|
||||
if (MyItemInfo.FormatStepData.UseSmartTemplate)
|
||||
{
|
||||
if (((MyItemInfo.MyDocStyle.End.Message ?? "") == "") || MyItemInfo.MyHLS.GetNextItem() != null)
|
||||
if (((MyItemInfo.MyDocStyle.End.Message ?? "") == "") || MyItemInfo.MyHLS.NextItem != null)
|
||||
ySpaceOnCurPage += SixLinesPerInch;
|
||||
accountForSmartTemplateHeader = Height - (2 * SixLinesPerInch);
|
||||
}
|
||||
@ -782,6 +783,7 @@ namespace Volian.Print.Library
|
||||
if (_Match16BitPagination) yLowerLimit -= 1.5F * SixLinesPerInch; // 276 for HLP
|
||||
yStart = 0;
|
||||
}
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
}
|
||||
/// <summary>
|
||||
/// Finds the highest StepLevel (lowest StepLevel number, 0 = HLS, 1 = first substep) that
|
||||
@ -954,7 +956,7 @@ namespace Volian.Print.Library
|
||||
{
|
||||
vlnParagraph myPara = myList[stepLevel][yLoc];
|
||||
//DebugPagination.WriteLine("'MaxBreakLevel',{0},{1},'{2}'", myPara.MyItemInfo.ItemID, stepLevel, myPara.MyItemInfo.ShortPath);
|
||||
Console.WriteLine("'MaxBreakLevel',{0},{1},'{2}'", myPara.MyItemInfo.ItemID, stepLevel, myPara.MyItemInfo.ShortPath);
|
||||
//Console.WriteLine("'MaxBreakLevel',{0},{1},'{2}'", myPara.MyItemInfo.ItemID, stepLevel, myPara.MyItemInfo.ShortPath);
|
||||
|
||||
if (!myPara.HasAncestor(myParaBreak))
|
||||
maxLevel = stepLevel;
|
||||
|
@ -275,6 +275,7 @@ namespace Volian.Print.Library
|
||||
|
||||
private void CloseDocument(PdfContentByte cb, string fileName)
|
||||
{
|
||||
int profileDepth = ProfileTimer.Push(">>>> CloseDocument");
|
||||
try
|
||||
{
|
||||
cb.PdfDocument.Close();
|
||||
@ -287,6 +288,7 @@ namespace Volian.Print.Library
|
||||
if (OpenPDF)
|
||||
System.Diagnostics.Process.Start(fileName);
|
||||
OnStatusChanged("OpenPDF", PromsPrinterStatusType.OpenPDF);
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
}
|
||||
|
||||
private PdfContentByte OpenDoc(string outputFileName)
|
||||
@ -352,6 +354,7 @@ namespace Volian.Print.Library
|
||||
private static List<SectionInfo> _MyFoldoutSection = null;
|
||||
private string Print(ProcedureInfo myProcedure, string pdfFolder, bool makePlacekeeper)
|
||||
{
|
||||
int profileDepth = ProfileTimer.Push(">>>> PromsPrinter.Print");
|
||||
if (_TransPageNumProblems == null) _TransPageNumProblems = new List<string>();
|
||||
|
||||
if (_MyFoldoutReader != null) _MyFoldoutReader.Clear();
|
||||
@ -383,9 +386,14 @@ namespace Volian.Print.Library
|
||||
if (!OverWrite && File.Exists(outputFileName))
|
||||
{
|
||||
if (MessageBox.Show(outputFileName + " exists. Overwrite file?", "File Exists", MessageBoxButtons.YesNo) == DialogResult.No)
|
||||
{
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return PrintProcedureOrFoldout(myProcedure, null, outputFileName, makePlacekeeper);
|
||||
string retval = PrintProcedureOrFoldout(myProcedure, null, outputFileName, makePlacekeeper);
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
return retval;
|
||||
}
|
||||
|
||||
// See if the last non Foldout Section has a Final Message.
|
||||
@ -419,6 +427,7 @@ namespace Volian.Print.Library
|
||||
}
|
||||
private string PrintProcedureOrFoldout(ProcedureInfo myProcedure, SectionInfo myFoldoutSection, string outputFileName, bool makePlacekeeper)
|
||||
{
|
||||
int profileDepth = ProfileTimer.Push(">>>> PrintProcedureOrFoldout");
|
||||
Rtf2Pdf.TextAtCounter = 0;
|
||||
bool doingFoldout = myFoldoutSection != null;
|
||||
// The following line accounts for 16bit OverrideLeftMargin when the 'Absolute' attribute is used in the genmac.
|
||||
@ -447,7 +456,7 @@ namespace Volian.Print.Library
|
||||
foreach (SectionInfo mySection in myProcedure.Sections)
|
||||
{
|
||||
if (((mySection.MyContent.Number.ToUpper() == "FOLDOUT" && myProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.SectionLevelFoldouts)
|
||||
|| (myProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.AlternateFloatingFoldout && mySection.MyContent.Text.ToUpper().Contains("FOLDOUT")))
|
||||
|| (myProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.AlternateFloatingFoldout && mySection.MyContent.Text.ToUpper().Contains("FOLDOUT")))
|
||||
!= doingFoldout) continue;
|
||||
if (myFoldoutSection != null && myFoldoutSection.ItemID != mySection.ItemID) continue;
|
||||
PrintOverride.CompressSuper = mySection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.CompressHPSuper;
|
||||
@ -485,10 +494,16 @@ namespace Volian.Print.Library
|
||||
// X argument below: accounts for 16-bit pdf OverrideLeftMargin = -2 characters at the plant format's default Font's
|
||||
// characters per inch.
|
||||
// 16bit OverrideLeftMargin, defined as -2 in driver\drvin.rtf, - override took 2 characters out, so we're adding it back in:
|
||||
if (mySection.ActiveFormat.Name.ToUpper().StartsWith("WST") || _MyHelper.Back32BitPROMS) // compare folder contains PROMS generated PDF
|
||||
_MyHelper.BackgroundOffset = new PointF(0, 0);
|
||||
else
|
||||
_MyHelper.BackgroundOffset = new PointF(2 * 72F / (float)myProcedure.ActiveFormat.PlantFormat.FormatData.Font.CPI, -9.5F);
|
||||
float x = 0;
|
||||
float y = 0;
|
||||
if (!(mySection.ActiveFormat.Name.ToUpper().StartsWith("WST") || _MyHelper.Back32BitPROMS)) // compare folder contains PROMS generated PDF
|
||||
{
|
||||
x = 2 * 72F / (float)myProcedure.ActiveFormat.PlantFormat.FormatData.Font.CPI;
|
||||
y = -9.5F;
|
||||
}
|
||||
x += 72F * VlnSettings.GetCommandFloat("X", x);
|
||||
y -= 72F * VlnSettings.GetCommandFloat("Y", y);
|
||||
_MyHelper.BackgroundOffset = new PointF(x,y);
|
||||
_MyHelper.BackgroundPageOffset = 0;
|
||||
}
|
||||
_MyHelper.WatermarkLayer = _WatermarkLayer;
|
||||
@ -555,12 +570,12 @@ namespace Volian.Print.Library
|
||||
PdfReader readerWord = null;
|
||||
string myPdfFile = null;
|
||||
_MyHelper.FinalMessageSectionID = finalMessageSectionID; // set VlnSvgPageHelper with the finalMessageSectionID
|
||||
|
||||
|
||||
if (mySection.IsAutoTOCSection)
|
||||
GenerateTOC(mySection, myProcedure, cb, _TextLayer);
|
||||
// is this the right place for PlaceKeeper?
|
||||
// I think we need to check if the actual PlaceKeeper section has the PlaceKeeper flag set (for auto generation)
|
||||
// users can turn this off and edit the section manaully in 16-bit.
|
||||
// is this the right place for PlaceKeeper?
|
||||
// I think we need to check if the actual PlaceKeeper section has the PlaceKeeper flag set (for auto generation)
|
||||
// users can turn this off and edit the section manaully in 16-bit.
|
||||
//else if (mySection.IsPlacekeeperSection)
|
||||
// GeneratePlaceKeeper(mySection, myProcedure, cb, _TextLayer);
|
||||
else
|
||||
@ -590,7 +605,9 @@ namespace Volian.Print.Library
|
||||
CreateStepPdf(mySection, cb);
|
||||
}
|
||||
else
|
||||
{
|
||||
CreateWordDocPdf(cb, mySection, ref readerWord, ref myPdfFile);
|
||||
}
|
||||
}
|
||||
_MyHelper.PrintedSectionPage = 0;
|
||||
}
|
||||
@ -612,7 +629,7 @@ namespace Volian.Print.Library
|
||||
if (_MyHelper != null && makePlacekeeper)
|
||||
{
|
||||
// Setting the default font to Arial since that is what Calvert is currently using for their Placekeeper pages
|
||||
VE_Font pkFont = new VE_Font("Arial",11,E_Style.None,12); // default font info.
|
||||
VE_Font pkFont = new VE_Font("Arial", 11, E_Style.None, 12); // default font info.
|
||||
// Ideally, we should grab the font from the DocStyle used for the Placekeeper.
|
||||
// Note that Calvert has two Placekeeper docSyles (EOPs and AOPs) in the same format.
|
||||
// Both Placekeeper DocStyles use Arial 11 pt font, so there is no need to grab it from the format file.
|
||||
@ -625,11 +642,13 @@ namespace Volian.Print.Library
|
||||
new Placekeeper(_MyHelper.MyPlacekeepers, pkFont);
|
||||
}
|
||||
_MyHelper = null;
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
return outputFileName;
|
||||
}
|
||||
|
||||
public void CreateWordDocPdf(PdfContentByte cb, SectionInfo mySection, ref PdfReader readerWord, ref string myPdfFile)
|
||||
{
|
||||
int profileDepth = ProfileTimer.Push(">>>> CreateWordDocPdf");
|
||||
_MyHelper.MySection = mySection;
|
||||
myPdfFile = BuildMSWordPDF(mySection);
|
||||
try
|
||||
@ -705,7 +724,7 @@ namespace Volian.Print.Library
|
||||
}
|
||||
float yoff = 0;
|
||||
if (_MyHelper.DidFirstPageDocStyle) yoff = origYoff - (float)mySection.MyDocStyle.Layout.TopMargin;
|
||||
AddImportedPageToLayer(cb.PdfWriter.DirectContent, _MSWordLayer, fgPage, (float)(mySection.MyDocStyle.Layout.MSWordXAdj??0), (float)(mySection.MyDocStyle.Layout.MSWordYAdj??0)+yoff);
|
||||
AddImportedPageToLayer(cb.PdfWriter.DirectContent, _MSWordLayer, fgPage, (float)(mySection.MyDocStyle.Layout.MSWordXAdj ?? 0), (float)(mySection.MyDocStyle.Layout.MSWordYAdj ?? 0) + yoff);
|
||||
if(DebugPagination.IsOpen) DebugPagination.WriteLine("{0:D6},'{1}',{2}",
|
||||
_MyHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, mySection.ShortPath,pageNumber);
|
||||
|
||||
@ -774,6 +793,7 @@ namespace Volian.Print.Library
|
||||
{
|
||||
_MyHelper.IsLandscape = false; // reset landscape mode to false
|
||||
}
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
}
|
||||
private void GenerateTOC(SectionInfo tocSection, ProcedureInfo myProcedure, PdfContentByte cb, PdfLayer textLayer)
|
||||
{
|
||||
@ -783,7 +803,8 @@ namespace Volian.Print.Library
|
||||
float yBottomMargin = Math.Max(0, yTopMargin - (float)tocSection.MyDocStyle.Layout.PageLength); // - 2 * vlnPrintObject.SixLinesPerInch);
|
||||
if (textLayer != null) cb.BeginLayer(textLayer);
|
||||
TableOfContentsData tOfC = tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData;
|
||||
ItemInfo procItem = ItemInfo.Get(myProcedure.ItemID);
|
||||
//ItemInfo procItem = ItemInfo.Get(myProcedure.ItemID);
|
||||
ItemInfo procItem = myProcedure;
|
||||
lastyLocation = 0;
|
||||
AddSectionToTOC(tocSection, procItem, tOfC, cb, yTopMargin, 0);
|
||||
if (textLayer != null) cb.EndLayer();
|
||||
@ -1179,6 +1200,8 @@ namespace Volian.Print.Library
|
||||
private float _NoBreakYPageStart = 0;
|
||||
private void CreateStepPdf(SectionInfo section, PdfContentByte cb)
|
||||
{
|
||||
int profileDepth = ProfileTimer.Push(">>>> CreateStepPdf");
|
||||
//PrintTimer pt = new PrintTimer();
|
||||
iTextSharp.text.pdf.PdfWriter writer = cb.PdfWriter;
|
||||
ItemInfo myItemInfo = section as ItemInfo;
|
||||
// 792: 72 * 11 inches - TopRow - Top is high value
|
||||
@ -1187,7 +1210,7 @@ namespace Volian.Print.Library
|
||||
// the following line was modified to comment out the - 2 * SixLinesPerInch. this fixed a pagination problem with WCN EMG E-3.
|
||||
float yBottomMargin = Math.Max(0, yTopMargin - (float)myItemInfo.MyDocStyle.Layout.PageLength); // - 2 * vlnPrintObject.SixLinesPerInch);
|
||||
vlnParagraph.PathPrefix = myItemInfo.Path;
|
||||
Rtf2Pdf.PdfDebug = true;
|
||||
//Rtf2Pdf.PdfDebug = true;
|
||||
Rtf2Pdf.Offset = new PointF(0, 2.5F);
|
||||
if (section.MyDocStyle.LandscapePageList)
|
||||
{
|
||||
@ -1200,7 +1223,9 @@ namespace Volian.Print.Library
|
||||
else
|
||||
_MyHelper.IsLandscape = false;
|
||||
_MyHelper.ChangeBarDefinition = MyChangeBarDefinition;
|
||||
//pt.Description = "vlnParagrph";
|
||||
vlnParagraph myParagraph = new vlnParagraph(null, cb, myItemInfo, (float)myItemInfo.MyDocStyle.Layout.LeftMargin, _NoBreakYOffset, 0, myItemInfo.ColumnMode, myItemInfo.ActiveFormat, null, null, 0,true,this);
|
||||
//pt.Description = "After vlnParagrph";
|
||||
float localYPageStart = 0;
|
||||
float yPageStart = yTopMargin;
|
||||
if (myItemInfo.HasChildren || myItemInfo.MyDocVersion.DocVersionConfig.SelectedSlave > 0)
|
||||
@ -1212,7 +1237,7 @@ namespace Volian.Print.Library
|
||||
else if (!myItemInfo.MyDocStyle.OptionalSectionContent)
|
||||
PrintTextMessage(cb, "No Section Content", _TextLayer);
|
||||
SectionConfig.SectionPagination sp = SectionConfig.SectionPagination.Separate; // always the default
|
||||
ItemInfo nxtItem = section.GetNextItem();
|
||||
ItemInfo nxtItem = section.NextItem;
|
||||
if (nxtItem != null)
|
||||
{
|
||||
// if this section & the next section are not accessory pages, see if there is continuous pagination,
|
||||
@ -1259,8 +1284,9 @@ namespace Volian.Print.Library
|
||||
yPageStart = localYPageStart;
|
||||
Volian.Base.Library.DebugText.WriteLine("NOBREAK:{0},'{1}','{2}','{3}','{4}','{5}'", section.ItemID, tmplocal, yTopMargin, localYPageStart, _NoBreakYOffset, myParagraph.YBottomMost);
|
||||
}
|
||||
|
||||
OnStatusChanged("StepSection converted to PDF " + section.ShortPath, PromsPrinterStatusType.BuildStep);
|
||||
//pt.Description = "End";
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
}
|
||||
public static void DoFoldoutPage(PdfContentByte cb, string str, PdfLayer textLayer)
|
||||
{
|
||||
@ -1356,4 +1382,32 @@ namespace Volian.Print.Library
|
||||
return ms.ToArray();
|
||||
}
|
||||
}
|
||||
//public class PrintTimer
|
||||
//{
|
||||
// private DateTime _StartTime = DateTime.Now;
|
||||
|
||||
// public DateTime StartTime
|
||||
// {
|
||||
// get { return _StartTime; }
|
||||
// set { _StartTime = value; }
|
||||
// }
|
||||
// private string _Description = "Start";
|
||||
// public string Description
|
||||
// {
|
||||
// get { return _Description; }
|
||||
// set
|
||||
// {
|
||||
// DateTime dtNext = DateTime.Now;
|
||||
// //Console.WriteLine("{0},'{1}'", TimeSpan.FromTicks(dtNext.Ticks - LastTime.Ticks).TotalSeconds, Description);
|
||||
// _Description = value;
|
||||
// _LastTime = dtNext;
|
||||
// }
|
||||
// }
|
||||
// private DateTime _LastTime = DateTime.Now;
|
||||
// public DateTime LastTime
|
||||
// {
|
||||
// get { return _LastTime; }
|
||||
// set { _LastTime = value; }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ using Itenso.Rtf.Interpreter;
|
||||
//using Itenso.Rtf.Model;
|
||||
using Itenso.Rtf.Support;
|
||||
using Microsoft.Win32;
|
||||
using Volian.Base.Library;
|
||||
|
||||
namespace Volian.Print.Library
|
||||
{
|
||||
@ -115,11 +116,15 @@ namespace Volian.Print.Library
|
||||
}
|
||||
public Paragraph Convert()
|
||||
{
|
||||
int profileDepth = ProfileTimer.Push(">>>> Rtf2ITextSharp.Convert");
|
||||
_MyParagraph.Clear();
|
||||
_MyFont = null;
|
||||
foreach (IRtfVisual visual in _RtfDoc.VisualContent)
|
||||
{
|
||||
visual.Visit(this);
|
||||
}
|
||||
//_MyParagraph.SetLeading(0, 1);
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
return _MyParagraph;
|
||||
}
|
||||
// ----------------------------------------------------------------------
|
||||
@ -150,25 +155,34 @@ namespace Volian.Print.Library
|
||||
switch (visualSpecialChar.CharKind)
|
||||
{
|
||||
case RtfVisualSpecialCharKind.Bullet:
|
||||
_MyParagraph.Add(new Chunk("\u2022"));
|
||||
break;
|
||||
case RtfVisualSpecialCharKind.EmDash:
|
||||
_MyParagraph.Add(new Chunk("\u2014"));
|
||||
break;
|
||||
case RtfVisualSpecialCharKind.EmSpace:
|
||||
_MyParagraph.Add(new Chunk("\u2003"));
|
||||
break;
|
||||
case RtfVisualSpecialCharKind.EnDash:
|
||||
_MyParagraph.Add(new Chunk("\u2013"));
|
||||
break;
|
||||
case RtfVisualSpecialCharKind.EnSpace:
|
||||
_MyParagraph.Add(new Chunk(" "));
|
||||
break;
|
||||
case RtfVisualSpecialCharKind.LeftDoubleQuote:
|
||||
_MyParagraph.Add(new Chunk("\u201C"));
|
||||
break;
|
||||
case RtfVisualSpecialCharKind.LeftSingleQuote:
|
||||
_MyParagraph.Add(new Chunk("\u2018"));
|
||||
break;
|
||||
case RtfVisualSpecialCharKind.NonBreakingHyphen:
|
||||
_MyParagraph.Add(new Chunk("\u2011"));
|
||||
break;
|
||||
case RtfVisualSpecialCharKind.NonBreakingSpace:
|
||||
_MyParagraph.Add(new Chunk("\u00A0"));
|
||||
break;
|
||||
case RtfVisualSpecialCharKind.OptionalHyphen:
|
||||
_MyParagraph.Add(new Chunk("\u00AD"));
|
||||
break;
|
||||
case RtfVisualSpecialCharKind.ParagraphNumberBegin:
|
||||
break;
|
||||
@ -177,8 +191,10 @@ namespace Volian.Print.Library
|
||||
case RtfVisualSpecialCharKind.QmSpace:
|
||||
break;
|
||||
case RtfVisualSpecialCharKind.RightDoubleQuote:
|
||||
_MyParagraph.Add(new Chunk("\u201D"));
|
||||
break;
|
||||
case RtfVisualSpecialCharKind.RightSingleQuote:
|
||||
_MyParagraph.Add(new Chunk("\u2019"));
|
||||
break;
|
||||
case RtfVisualSpecialCharKind.Tabulator:
|
||||
break;
|
||||
@ -188,7 +204,12 @@ namespace Volian.Print.Library
|
||||
}
|
||||
protected override void DoVisitText(IRtfVisualText visualText)
|
||||
{
|
||||
if (visualText.Format.IsHidden) return;
|
||||
int profileDepth = ProfileTimer.Push(">>>> DoVisitText");
|
||||
if (visualText.Format.IsHidden)
|
||||
{
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
return;
|
||||
}
|
||||
iTextSharp.text.Font font = Volian.Svg.Library.VolianPdf.GetFont(visualText.Format.Font.Name, visualText.Format.FontSize,
|
||||
(visualText.Format.IsBold ? iTextSharp.text.Font.BOLD : 0) +
|
||||
(visualText.Format.IsItalic ? iTextSharp.text.Font.ITALIC : 0));
|
||||
@ -261,7 +282,7 @@ namespace Volian.Print.Library
|
||||
_MyParagraph.Font = _MyFont;
|
||||
}
|
||||
_MyParagraph.Add(chk);
|
||||
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
}
|
||||
|
||||
private string ShowSpecialCharacters(string p)
|
||||
|
@ -65,6 +65,7 @@ namespace Volian.Print.Library
|
||||
}
|
||||
public float Add(PdfContentByte cb, ItemInfoList itemInfoList, float xoff, float yoff, float yoffRight, int rnoLevel, int maxRNO, FormatInfo formatInfo, PromsPrinter pp)
|
||||
{
|
||||
int profileDepth = ProfileTimer.Push(">>>> vlnParagraphs.Add");
|
||||
bool bxHlsDraw = false;
|
||||
int? bxIndex = null;
|
||||
vlnBox box = null;
|
||||
@ -151,7 +152,7 @@ namespace Volian.Print.Library
|
||||
{
|
||||
if ((childItemInfo.IsCaution || childItemInfo.IsNote) &&
|
||||
childItemInfo.MyPrevious != null && childItemInfo.MyPrevious.MyContent.Type != childItemInfo.MyContent.Type &&
|
||||
childItemInfo.NextItemCount > 0 && childItemInfo.GetNextItem()!= null && childItemInfo.MyContent.Type == childItemInfo.GetNextItem().MyContent.Type)
|
||||
childItemInfo.NextItemCount > 0 && childItemInfo.NextItem!= null && childItemInfo.MyContent.Type == childItemInfo.NextItem.MyContent.Type)
|
||||
childItemInfo.SetupTags(); // added for V.C. Summer Transition caution in EOP-15.0 step 5.4
|
||||
if (lastHeader != null)
|
||||
{
|
||||
@ -364,6 +365,7 @@ namespace Volian.Print.Library
|
||||
// after the last child substep when doing a Component table row (FNP Component Lists), set the value
|
||||
// of the yoff to be the bottom most line in the table.
|
||||
if (didComponentTableRow) yoff = tableBottomMost;
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
return yoff;
|
||||
}
|
||||
public float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin)
|
||||
@ -499,13 +501,19 @@ namespace Volian.Print.Library
|
||||
if (sch != null && sch.Section_PrintHdr != "Y") doprint = false;
|
||||
}
|
||||
if (MyItemInfo.MyContent.MyGrid != null)
|
||||
{
|
||||
int profileDepth = ProfileTimer.Push(">>>> vlnParagraph.DrawDrid");
|
||||
retval = DrawGrid(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation);
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (doprint)
|
||||
{
|
||||
int profileDepth = ProfileTimer.Push(">>>> vlnParagraph.DrawText");
|
||||
retval = DrawText(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation);
|
||||
SectionContinuePrinted = true;
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
}
|
||||
}
|
||||
if (MyItemInfo.IsHigh)
|
||||
@ -692,8 +700,8 @@ namespace Volian.Print.Library
|
||||
{
|
||||
// This section of code draws the lines around the substeps (the actual table part)
|
||||
Paragraph horzLine = new Paragraph(ii.ActiveFormat.PlantFormat.FormatData.BoxList[0].BXHorz, iSymblFont);
|
||||
bool bottomOfTable = (ii.GetNextItem() == null || ii.NextItemCount == 0) ||
|
||||
(MyPageHelper.ParaBreaks.Count > 0 && MyPageHelper.ParaBreaks[0].MyItemInfo.ItemID == ii.GetNextItem().ItemID);
|
||||
bool bottomOfTable = (ii.NextItem == null || ii.NextItemCount == 0) ||
|
||||
(MyPageHelper.ParaBreaks.Count > 0 && MyPageHelper.ParaBreaks[0].MyItemInfo.ItemID == ii.NextItem.ItemID);
|
||||
// if bottom of table use different cross/beg/end chars than if in middle of table.
|
||||
Paragraph leftLine = new Paragraph(bottomOfTable ? bx.BXLLC : bx.BXMLS, iSymblFont);
|
||||
Paragraph rightLine = new Paragraph(bottomOfTable ? bx.BXLRC : bx.BXMRS, iSymblFont);
|
||||
@ -738,7 +746,7 @@ namespace Volian.Print.Library
|
||||
// Now handle middle parts of the table. For whatever sub level we're at, draw the cross character
|
||||
// and the horizontal. This is case where the component number may have multiple descriptions,positions, etc. associated
|
||||
// with it.
|
||||
if (!ii.MyParent.IsHigh && ii.GetNextItem() != null && ii.NextItemCount > 0)
|
||||
if (!ii.MyParent.IsHigh && ii.NextItem != null && ii.NextItemCount > 0)
|
||||
{
|
||||
// draw horizontally from this sublevel to the end.
|
||||
int sublev = 0;
|
||||
@ -791,12 +799,12 @@ namespace Volian.Print.Library
|
||||
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert && (MyItemInfo.IsCaution || MyItemInfo.IsNote || MyItemInfo.IsNote1))
|
||||
{
|
||||
bool diffAsPrev = MyItemInfo.MyPrevious == null || (MyItemInfo.MyPrevious != null && MyItemInfo.MyContent.Type != MyItemInfo.MyPrevious.MyContent.Type);
|
||||
bool diffAsNext = MyItemInfo.GetNextItem() == null || (MyItemInfo.GetNextItem() != null && MyItemInfo.MyContent.Type != MyItemInfo.GetNextItem().MyContent.Type);
|
||||
bool diffAsNext = MyItemInfo.NextItem == null || (MyItemInfo.NextItem != null && MyItemInfo.MyContent.Type != MyItemInfo.NextItem.MyContent.Type);
|
||||
if (diffAsPrev && diffAsNext) doAlign = true;
|
||||
}
|
||||
// Check if only one line, i.e. "Height < (1.2F * IParagraph.Leading". The Leading can be for six or seven lines per inch, so the 1.2
|
||||
// multiplier accounts for both.
|
||||
if (!MyItemInfo.IsStepSection && MyItemInfo.FormatStepData.CenterOneLineOnly && ((MyItemInfo.MyPrevious == null && MyItemInfo.GetNextItem() == null) || MyItemInfo.FormatStepData.SeparateBox || doAlign) && Height < (1.2F * IParagraph.Leading))
|
||||
if (!MyItemInfo.IsStepSection && MyItemInfo.FormatStepData.CenterOneLineOnly && ((MyItemInfo.MyPrevious == null && MyItemInfo.NextItem == null) || MyItemInfo.FormatStepData.SeparateBox || doAlign) && Height < (1.2F * IParagraph.Leading))
|
||||
IParagraph.Alignment = Element.ALIGN_CENTER;
|
||||
// if this step is centered, but not part of the checklist or valvelist format, use itextsharp to center it.
|
||||
// if it was part of the checklist or valvelist, then the centering is based on the column definitions for the table and
|
||||
@ -825,7 +833,9 @@ namespace Volian.Print.Library
|
||||
if (DebugPagination.IsOpen)
|
||||
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);
|
||||
if (retval == 0) // problem occurred - paragraph was not able to be printed on page
|
||||
{ // pagination logic needs to be fixed.
|
||||
ForcePagination(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation, ref retval);
|
||||
@ -950,6 +960,7 @@ namespace Volian.Print.Library
|
||||
//private bool _TextDebug = false; //true; this will turn on a writeline with debug in DrawText()
|
||||
private float DrawFigure(PdfContentByte cb, float yBottomMargin, float yLocation)
|
||||
{
|
||||
int profileDepth = ProfileTimer.Push("vlnParagraph.DrawFigure");
|
||||
float retval = yLocation;
|
||||
if (ImageText != null)
|
||||
{
|
||||
@ -966,12 +977,14 @@ namespace Volian.Print.Library
|
||||
retval = Rtf2Pdf.FigureAt(cb, it_image, XOffset + MyItemInfo.FormatStepData.Font.CharsToTwips, yLocation, Width * MyPageHelper.YMultiplier, Height * MyPageHelper.YMultiplier, DebugInfo, yBottomMargin, !MyItemInfo.FormatStepData.Type.Contains("Borderless"));
|
||||
}
|
||||
}
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
return retval;
|
||||
}
|
||||
private string DebugInfo
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!Rtf2Pdf.PdfDebug) return "No Path";
|
||||
return string.Format("DebugID = {0}, ID={1} Type={2} TypeName='{3}' StepLevel={4} ShortPath={5} Width={6} Left={7}",
|
||||
DebugId, MyItemInfo.ItemID, MyItemInfo.FormatStepType, MyItemInfo.FormatStepData == null ? "NoStepData" : MyItemInfo.FormatStepData.Type, MyItemInfo.StepLevel, MyItemInfo.ShortPath, Width, XOffset);
|
||||
}
|
||||
@ -1049,7 +1062,12 @@ namespace Volian.Print.Library
|
||||
private static bool DoSubs = true; // flag whether to print substeps (don't if doing continued checklist header)
|
||||
public override float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin)
|
||||
{
|
||||
if (MyItemInfo.IsFootnote && Processed) return yPageStart;
|
||||
int profileDepth = ProfileTimer.Push(">>>> vlnParagraph.ToPdf");
|
||||
if (MyItemInfo.IsFootnote && Processed)
|
||||
{
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
return yPageStart;
|
||||
}
|
||||
bool doThreeContinues = false;
|
||||
// For BGE, the very first subsection's pagelist items were not correct - the section/meta section titles were
|
||||
// at the wrong level. Reset the page helper's section.
|
||||
@ -1087,7 +1105,10 @@ namespace Volian.Print.Library
|
||||
//_MyLog.InfoFormat("NewPage 9 {0}", cb.PdfWriter.CurrentPageNumber);
|
||||
MyPageHelper.MyPromsPrinter.CreateWordDocPdf(cb, si, ref tmp, ref tmpstr);
|
||||
Processed = true;
|
||||
return yPageStart;
|
||||
{
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
return yPageStart;
|
||||
}
|
||||
}
|
||||
float yLocalypagestart = yPageStart;
|
||||
// yPageStart is offset into roll; YTopMost is offset of topmost of this paragraph.
|
||||
@ -1098,7 +1119,9 @@ namespace Volian.Print.Library
|
||||
MyPageHelper.OldTemplateContMsg = false;
|
||||
|
||||
if(DebugText.IsOpen) DebugText.WriteLine("ToPdf1:{0},'{1}',{2},{3},{4},{5}", MyItemInfo.ItemID, MyItemInfo.ShortPath, XOffset, yLocation, yPageStart, YTopMost);
|
||||
int profileDepth1 = ProfileTimer.Push(">>>> vlnParagraph.Paginate");
|
||||
int paginate = Paginate(yLocation, yTopMargin, yBottomMargin);
|
||||
ProfileTimer.Pop(profileDepth1);
|
||||
bool firstHighLevelStep = MyItemInfo.IsHigh && (MyItemInfo.MyPrevious == null);
|
||||
bool doSectionTitleContinued = false; // will add " Continued" to the section title if format flag is set
|
||||
DocStyle docstyle = null;
|
||||
@ -1374,7 +1397,6 @@ namespace Volian.Print.Library
|
||||
DoCheckOffHeader(cb, MyItemInfo, yLocation, yTopMargin, yPageStart);
|
||||
break;
|
||||
}
|
||||
|
||||
// If "doSectionTitleContinued" is true then print the section title with "(Continued)" appended to it
|
||||
// format must have ContinueSectinHeader format flag set to true
|
||||
if (doSectionTitleContinued)
|
||||
@ -1471,7 +1493,9 @@ namespace Volian.Print.Library
|
||||
MyPageHelper.AlarmYoffEnd = CalculateYOffset(yPageStart, yTopMargin) + (2 * SixLinesPerInch);
|
||||
}
|
||||
}
|
||||
int profileDepth2 = ProfileTimer.Push(">>>> vlnParagraph.ParagraphToPdf");
|
||||
yPageStart = ParagraphToPdf(cb, yPageStart, yTopMargin, yBottomMargin);
|
||||
ProfileTimer.Pop(profileDepth2);
|
||||
// If the yPageStart changes by more than a small amount (pagination) in the RNO (right column), then update
|
||||
// yPageStart for the AER (left column).
|
||||
float yPageStartRNO = ChildrenRight.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
|
||||
@ -1479,7 +1503,7 @@ namespace Volian.Print.Library
|
||||
yPageStart = yPageStartRNO;
|
||||
yPageStart = ChildrenBelow.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
|
||||
|
||||
if (MyItemInfo.IsHigh && MyItemInfo.GetNextItem() == null) // last hls, add the 'end' message, if there is one
|
||||
if (MyItemInfo.IsHigh && MyItemInfo.NextItem == null) // last hls, add the 'end' message, if there is one
|
||||
{
|
||||
docstyle = MyItemInfo.MyDocStyle;
|
||||
// if the EndForSingle format flag is set to false, then we do not print an End message if the section
|
||||
@ -1491,7 +1515,7 @@ namespace Volian.Print.Library
|
||||
if (si.MyActiveParent.IsSection) // is this meta/subsection. Only put end message out on last section
|
||||
{
|
||||
ItemInfo mysect = si as ItemInfo;
|
||||
if (mysect.GetNextItem() != null && !docstyle.End.EndMessageOnEachSubSection) _lastSect = false;
|
||||
if (mysect.NextItem != null && !docstyle.End.EndMessageOnEachSubSection) _lastSect = false;
|
||||
}
|
||||
string myMsg = (docstyle.End == null) ? null : docstyle.End.FixedMessage;
|
||||
if (myMsg != null && !_skipEndMessage && _lastSect)
|
||||
@ -1555,7 +1579,7 @@ namespace Volian.Print.Library
|
||||
// Pages that broke within pagination logic above had footnote location set during pagination code.
|
||||
if (MyPageHelper.NotesToFootNotes != null && MyPageHelper.NotesToFootNotes.Count > 0)
|
||||
MyPageHelper.NotesToFootNotesYoffset = CalculateYLocation(yPageStart - YBottomMost, yTopMargin);
|
||||
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
return yPageStart;
|
||||
}
|
||||
|
||||
@ -2168,6 +2192,7 @@ namespace Volian.Print.Library
|
||||
}
|
||||
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)
|
||||
{
|
||||
int profileDepth = ProfileTimer.Push(">>>> vlnParagraph");
|
||||
Prefix = prefix;
|
||||
Suffix = suffix;
|
||||
MyItemInfo = itemInfo;
|
||||
@ -2184,6 +2209,7 @@ namespace Volian.Print.Library
|
||||
MyPageHelper.NotesToFootNotesHLS.Add(itemInfo.MyHLS.ItemID, notesList);
|
||||
}
|
||||
Processed = true; // don't want to print during normal ToPdf/ParagraphToPdf cycle - print in vlnsvgpagehelper
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
return;
|
||||
}
|
||||
// do some 'setup' for Calvert Alarms:
|
||||
@ -2222,7 +2248,7 @@ namespace Volian.Print.Library
|
||||
MyTopRNO = MyParent.MyTopRNO;
|
||||
if (MyTopRNO != null) MyTopRNO.LastRNO = this;
|
||||
}
|
||||
|
||||
|
||||
if (!MyPageHelper.MyParagraphs.ContainsKey(itemInfo.ItemID) && !itemInfo.IsFootnote) MyPageHelper.MyParagraphs.Add(itemInfo.ItemID, this);
|
||||
|
||||
// if this a continuous subsection, refresh the style.
|
||||
@ -2238,6 +2264,7 @@ namespace Volian.Print.Library
|
||||
// that steps need put out on a page for the pagination logic, and since there are no steps
|
||||
// we don't want to have to worry about putting this out for pagination logic.
|
||||
Processed = true;
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
return;
|
||||
}
|
||||
YTopMost = YOffset = yoff;
|
||||
@ -2619,6 +2646,7 @@ namespace Volian.Print.Library
|
||||
bool dropCheckoff = itemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.DropCheckOff;
|
||||
if (itemInfo.MyContent.MyGrid != null)
|
||||
{
|
||||
int profileDepth1 = ProfileTimer.Push(">>>> Before vlnParagraph.Grid");
|
||||
//Use Static MyFlexGrid - BWD INST2 - FlexGrid Errors
|
||||
MyFlexGrid.LoadGrid(itemInfo);
|
||||
MyGrid = new vlnTable(MyFlexGrid, cb);
|
||||
@ -2649,9 +2677,11 @@ namespace Volian.Print.Library
|
||||
yoff += (Height + yoffForBorder); //(2 * SixLinesPerInch));
|
||||
CalculateXOffsetGridOrFigure(itemInfo, maxRNO, formatInfo);
|
||||
yoff = (float)Math.Ceiling(yoff);
|
||||
ProfileTimer.Pop(profileDepth1);
|
||||
}
|
||||
else if (itemInfo.IsFigure) // if a figure we've got to determine the size:
|
||||
{
|
||||
int profileDepth2 = ProfileTimer.Push(">>>> Before vlnParagraph.Figure");
|
||||
string erMsg = null;
|
||||
if (itemInfo.MyContent.Text != null)
|
||||
{
|
||||
@ -2712,6 +2742,7 @@ namespace Volian.Print.Library
|
||||
if (erMsg != null) Rtf = GetRtf(erMsg, itemInfo.ActiveFormat.PlantFormat.FormatData.Font);
|
||||
CalculateXOffsetGridOrFigure(itemInfo, maxRNO, formatInfo);
|
||||
}
|
||||
ProfileTimer.Pop(profileDepth2);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3059,6 +3090,7 @@ namespace Volian.Print.Library
|
||||
// the row.
|
||||
if (savCheckListBottomMost != 0) YBottomMost = Math.Max(savCheckListBottomMost, YBottomMost);
|
||||
if (XOffsetCenter != null) XOffset = (float)XOffsetCenter;
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
}
|
||||
public override string Rtf
|
||||
{
|
||||
@ -3071,6 +3103,7 @@ namespace Volian.Print.Library
|
||||
}
|
||||
private void BuildRtf()
|
||||
{
|
||||
int profileDepth = ProfileTimer.Push(">>>> BuildRtf");
|
||||
if (_Rtf == null)
|
||||
{
|
||||
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm && MyItemInfo.IsCaution1 &&
|
||||
@ -3091,6 +3124,7 @@ namespace Volian.Print.Library
|
||||
Rtf = Rtf.Replace("{Backspace}", "");
|
||||
}
|
||||
}
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
}
|
||||
// for Calvert (BGE) alarms, some step text is kept on the same line as its parent. This
|
||||
// is flagged by the -1 row in the template definition.
|
||||
@ -3410,14 +3444,14 @@ namespace Volian.Print.Library
|
||||
{
|
||||
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)
|
||||
&& (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.GetNextItem() != null && MyItemInfo.MyParent.GetNextItem().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.GetNextItem() == null) return SixLinesPerInch;
|
||||
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.
|
||||
//if (MyItemInfo.Ordinal % everyNLines == 0 || MyItemInfo.NextItem == null) return SixLinesPerInch;
|
||||
return 0;
|
||||
@ -3607,6 +3641,7 @@ namespace Volian.Print.Library
|
||||
private StringBuilder _RtfSB = null;
|
||||
public string GetRtf(ItemInfo itemInfo, string prefix, string suffix)
|
||||
{
|
||||
int profileDepth = ProfileTimer.Push(">>>> GetRtf");
|
||||
_RtfSB = new StringBuilder();
|
||||
DisplayText vlntxt = new DisplayText(itemInfo, E_EditPrintMode.Print, E_ViewMode.View, true, E_FieldToEdit.StepText, false, prefix, suffix);
|
||||
System.Drawing.Font myFont = vlntxt.TextFont.WindowsFont;
|
||||
@ -3651,7 +3686,7 @@ namespace Volian.Print.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
return rtf;
|
||||
}
|
||||
private float _XOffsetBox = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user