Support PSNotOnFirst pagelist flag so that pagelist item not printed on first page of section

Adjustments for centerline y-positioning when there is a double box
Add check so that centering single item (note/caution) works for Calvert; fix pagelist Section/metasection titles usage for first metasection; adjust starting y-position if doing a doublebox; if the y location of bottom message would go below bottom margin, reset to bottom margin; do rno bottom continue message
Added Bottom continue message support for RNO column; Draw Horizontal line if no doublehls as first item on page; support pagenumbering GroupedByLevel; Support PSNotFirst pagelist flag; Don’t put out <NO TITLE> as pagelist item if formatflag is not No Title printing; process Procdescriptor for Calvert (only check 1st character of eopnum for ‘@’); handle @@ in pagelist items
This commit is contained in:
Kathy Ruffing 2014-04-16 15:19:42 +00:00
parent f51573672f
commit 7579601d79
4 changed files with 124 additions and 9 deletions

View File

@ -796,6 +796,7 @@ namespace Volian.Print.Library
if (retval == 0)
{
cb.PdfDocument.NewPage();
_MyHelper.ResetSvg(); // needed to reset so that PSNotFirst pagelist justify flag gets used for BGE
//_MyLog.InfoFormat("NewPage 5 {0}", cb.PdfWriter.CurrentPageNumber);
yLocation = lastyLocation = 0;
retval = Rtf2Pdf.TextAt(cb, myparagrapht, leftMargin + adjSecTitlePos, yPageStart - yLocation, width, height, "", yBottomMargin);

View File

@ -45,6 +45,12 @@ namespace Volian.Print.Library
get { return _BottomMessage; }
set { _BottomMessage = value; }
}
private vlnText _BottomMessageR; // Added if there are 2 messages, in AER AND RNO (for BGE)
public vlnText BottomMessageR
{
get { return _BottomMessageR; }
set { _BottomMessageR = value; }
}
Dictionary<int, vlnParagraph> _MyParagraphs = new Dictionary<int, vlnParagraph>();
public Dictionary<int, vlnParagraph> MyParagraphs
{
@ -159,13 +165,32 @@ namespace Volian.Print.Library
}
if (MySection.MyDocStyle.StructureStyle.Style==null || (MySection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DontCountInTabOfCont) == 0)
CurrentTOCPageNumber++;
if (MySection.MyDocStyle.CenterLineX != null && MySection.ColumnMode > 0)
DrawCenterLine(writer.DirectContent, MySection.MyDocStyle.Layout.LeftMargin + MySection.MyDocStyle.CenterLineX ?? 0, MySection.MyDocStyle.CenterLineYTop ?? 0, MySection.MyDocStyle.CenterLineYBottom ?? 0);
if (MySection.MyDocStyle.CenterLineX != null)
{
if ((MySection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DoubleBoxHLS) == E_DocStructStyle.DoubleBoxHLS)
DrawHorizontal(writer.DirectContent, (float)MySection.MyDocStyle.Layout.LeftMargin, (float)MySection.MyDocStyle.Layout.PageWidth, (float)MySection.MyDocStyle.CenterLineYTop);
if (MySection.ColumnMode > 0)
DrawCenterLine(writer.DirectContent, MySection.MyDocStyle.Layout.LeftMargin + MySection.MyDocStyle.CenterLineX ?? 0, MySection.MyDocStyle.CenterLineYTop ?? 0, MySection.MyDocStyle.CenterLineYBottom ?? 0);
}
PageListTopCheckOffHeader = null;
PageListLastCheckOffHeader = null;
YMultiplier = 1;
PrintedAPage = true;
}
private void DrawHorizontal(PdfContentByte cb, float left, float right, float yoff)
{
// if there are gaps, check to be sure top isn't a double line box. If it's a box, don't draw the top line.
if (MyGaps != null && MyGaps.Count > 0 && MyGaps[0].YTop == (float)MySection.MyDocStyle.CenterLineYTop) return;
cb.SaveState();
if (PageListLayer != null) cb.BeginLayer(PageListLayer);
cb.SetColorStroke(new Color(PrintOverride.SvgColor));
//cb.SetColorStroke(lineColor);
cb.MoveTo(left, yoff);
cb.LineTo(right, yoff);
cb.Stroke();
if (PageListLayer != null) cb.EndLayer();
cb.RestoreState();
}
private Gaps _MyGaps;
public Gaps MyGaps
{
@ -207,7 +232,7 @@ namespace Volian.Print.Library
// the end message for EOP procedure 15.2 was at the very bottom of the page.
// the remaining center line was drawn past the page boarder. there was no need
// to print it for cases like that
if (ylast > yBottom)
if (ylast > yBottom)
cb.LineTo(xLoc, yBottom);
cb.Stroke();
if (PageListLayer != null) cb.EndLayer();
@ -367,6 +392,11 @@ namespace Volian.Print.Library
BottomMessage.ToPdf(cb, 0, ref tmp, ref tmp);
BottomMessage = null; // Only output it once.
}
if (BottomMessageR != null)
{
BottomMessageR.ToPdf(cb, 0, ref tmp, ref tmp);
BottomMessageR = null; // Only output it once.
}
}
public void DrawBottomMessage(PdfContentByte cb)
{
@ -705,6 +735,7 @@ namespace Volian.Print.Library
case E_NumberingSequence.WithinEachSection:
key = key + "." + MySection.ItemID;
break;
case E_NumberingSequence.GroupedByLevel:
case E_NumberingSequence.Like6_ButDoesntNeedSubsection:
if (MySection.MyParent.IsSection)
key = key + "." + MySection.MyParent.ItemID;
@ -828,6 +859,14 @@ namespace Volian.Print.Library
//if (pageItem.Token.Contains("HLSTEXT"))
// Console.WriteLine("{0} - PageList Token", pageItem.Token);
// the pagelist 'justify="{PSNotFirst}"' flag only puts item out if not on first page of section, check for this
if (((pageItem.Justify & VEPROMS.CSLA.Library.E_Justify.PSNotFirst) == VEPROMS.CSLA.Library.E_Justify.PSNotFirst)
&& PrintedSectionPage == 0)
{
PrintedSectionPage++;
continue;
}
VE_Font useFontForCheckOffHeader = null;
if (forceLoad || (sPag == SectionConfig.SectionPagination.Separate || ((sPag == SectionConfig.SectionPagination.Continuous || sPag ==0 )&& (pageItem.Row < 0))))
{
@ -1069,8 +1108,13 @@ namespace Volian.Print.Library
//float linelen = (int)section.ActiveFormat.PlantFormat.FormatData.ProcData.TitleLength * (float)pageItem.Font.CPI / 12;
float linelen = tlen * (float)pageItem.Font.CPI / 12;
string title = section.MyProcedure.MyContent.Text;
if (section.ActiveFormat.PlantFormat.FormatData.ProcData.CapitalizeTitle) title = title.ToUpper();
plstr = SplitTitle(svgGroup, pageItem, title, (int)linelen, token, plstr); //,rowAdj);
if (title.Contains("<NO TITLE>") && !section.ActiveFormat.PlantFormat.FormatData.ProcData.PrintNoTitle)
plstr = "";
else
{
if (section.ActiveFormat.PlantFormat.FormatData.ProcData.CapitalizeTitle) title = title.ToUpper();
plstr = SplitTitle(svgGroup, pageItem, title, (int)linelen, token, plstr); //,rowAdj);
}
break;
case "{COVERTITLE1}":
case "[COVERTITLE1]":
@ -1224,6 +1268,17 @@ namespace Volian.Print.Library
}
if (pd.MatchProcNumber == "@")
{
// 16bit code looked like it only checked for the first character, but this code looks at
// all characters. It was not working correctly for BGE. Didn't want to change it for other
// plants that have been delivered - so added special code for BGE.
if (section.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert)
{
if (Regex.IsMatch(procnum.Substring(0,1),"[A-Za-z]"))
plstr = pd.ProcDescr1;
else
plstr = "";
break;
}
if (Regex.IsMatch(procnum, "^[A-Za-z]+$"))
plstr = pd.ProcDescr1;
else
@ -1389,13 +1444,22 @@ namespace Volian.Print.Library
if (len == null || len == 0 || ItemInfo.StripRtfFormatting(title).Length < len)
{
if (match == "{PROCTITLE2}" || match == "[PROCTITLE2]") return plstr.Replace(match, ""); // this would have been done in proctitle1
plstr = plstr.Replace(match, title);
plstr = plstr.Replace(match, title).Replace("@@","");
//svgGroup.Add(PageItemToSvgText(pageItem, title));
return plstr;
}
// BGE has a '@@' in its section number/title pagelist item for eops. If the title goes onto two lines,
// the '@@' marked the starting location for the title. Process this differently than other split titles:
if (plstr.Contains("@@"))
{
DoSpecialSectNumTitle(svgGroup, pageItem, title, len, match, plstr);
return ""; // all resolved pagelist items were already added to svgGroup for printing.
}
// Otherwise determine how many line to split the text into
List<string> titleLines = SplitText(title, (int)len);
// Adjust y location based on which pagelist token & how many lines. Proctitle1 is adjusted if
// there are more than 2 lines (proctitle1 should have it's own y location that is used if there are 1 or 2 lines.)
float yOffset = (pageItem.Token.Contains("1") && titleLines.Count <= 2) ? 0 : (-6 * (titleLines.Count - 1));
@ -1425,6 +1489,26 @@ namespace Volian.Print.Library
}
return plstr;
}
private void DoSpecialSectNumTitle(SvgGroup svgGroup, VEPROMS.CSLA.Library.PageItem pageItem, string title, int? len, string match, string plstr)
{
// first add anything up to the "@@" to the svgGroup:
string befAts = plstr.Substring(0, plstr.IndexOf("@@"));
svgGroup.Add(PageItemToSvgText(pageItem, befAts, 0));
// get the new xoffset. This will be the column value + the size of 'stuff' before the '@@'
float xoff = (float)pageItem.Col;
xoff += (befAts.Length * pageItem.Font.CharsToTwips);
float yoff = (float)pageItem.Row;
List<string> titleLines = SplitText(title, (int)len);
foreach (string line in titleLines)
{
svgGroup.Add(PageItemToSvgText(pageItem.Token, yoff, xoff, (E_Justify)pageItem.Justify, pageItem.Font, line, MySection));
yoff += (float)((pageItem.Font.Size > 14) ? pageItem.Font.Size : 12);
}
}
private string SplitTitleAndUnit(SvgGroup svgGroup, VEPROMS.CSLA.Library.PageItem pageItem, string title, int? len, string token, string plstr)
{
List<string> titleLines = SplitText(title, (int)len);

View File

@ -95,7 +95,19 @@ namespace Volian.Print.Library
right += myBoxLeftAdj;
iTextSharp.text.Color boxColor = new iTextSharp.text.Color(PrintOverride.OverrideBoxColor(System.Drawing.Color.Black));
cb.SetColorStroke(boxColor);
_MyPageHelper.MyGaps.Add(top, top - Height);
float gapTopBox = top;
float gapBottomBox = top - Height;
if (MyParent.MyItemInfo.MyDocStyle.CenterLineYTop!=null && DefBox == vlnBox.DOUBLEboxHLS)
{
// For top box, if at top of page, the first gap begins at the centerlineYTop, otherwise it starts where
// the box is drawn, with an adjustment to allow for the first line of text & the extra line above the box
gapTopBox = (top + 3*SixLinesPerInch > (float)MyParent.MyItemInfo.MyDocStyle.CenterLineYTop) ?
(float)MyParent.MyItemInfo.MyDocStyle.CenterLineYTop : top + 1.3f * vlnPrintObject.SixLinesPerInch;
// The bottom gap must be moved down just a little to account for the double box (bottom line of box)
gapBottomBox -= 3.2f;
}
if (MyParent.MyItemInfo.MyDocStyle.CenterLineYTop!=null)_MyPageHelper.MyGaps.Add(gapTopBox, gapBottomBox);
if (DefBox != null && DefBox != vlnBox.DOUBLEboxHLS)
{
cb.SetLineWidth(.6F);

View File

@ -683,7 +683,7 @@ namespace Volian.Print.Library
float retval = yLocation;
// 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.NextItem == null && Height < (1.2F * IParagraph.Leading))
if (!MyItemInfo.IsStepSection && MyItemInfo.FormatStepData.CenterOneLineOnly && ((MyItemInfo.MyPrevious == null && MyItemInfo.NextItem == null) || MyItemInfo.FormatStepData.SeparateBox) && 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
@ -831,6 +831,14 @@ namespace Volian.Print.Library
}
public override float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin)
{
// 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.
if (MyItemInfo.IsSection && MyItemInfo.MyPrevious == null && MyItemInfo.MyParent.IsSection)
{
MyPageHelper.MySection = MyItemInfo as SectionInfo;
MyPageHelper.ResetSvg();
}
if (IsWordDocPara)
{
PdfReader tmp = null;
@ -858,6 +866,8 @@ namespace Volian.Print.Library
MyPageHelper.PageBookmarks.Add(MyItemInfo, ((si.DisplayNumber ?? "") == "" ? "" : si.DisplayNumber + " - ") + si.DisplayText, null);
DoCheckOffHeader(cb, MyItemInfo, yLocation, yTopMargin, yPageStart);
}
if (MyItemInfo.IsHigh && MyItemInfo.MyPrevious != null && ((MyItemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DoubleBoxHLS) == E_DocStructStyle.DoubleBoxHLS))
yPageStart -= SixLinesPerInch;
break;
case 1: // Break on High Level Step
OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
@ -949,6 +959,7 @@ namespace Volian.Print.Library
break;
case E_ContBottomLoc.BtwnTextAndBottom: // place continue string between end of text & bottom of page
msg_yLocation = msg_yLocation + yLocation - ((yLocation - yBottomMargin) / 2); // +SixLinesPerInch; (need this for IP3)
if (msg_yLocation < yBottomMargin) msg_yLocation = yBottomMargin;
break;
case E_ContBottomLoc.BottomOfPage: // place continue message at bottom of page
//msg_yLocation = yBottomMargin + 2 * SixLinesPerInch + (float)docstyle.Layout.FooterLength; // 2 lines above bottom margin
@ -974,6 +985,13 @@ namespace Volian.Print.Library
float colR = float.Parse(MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColRTable.Split(",".ToCharArray())[MyItemInfo.ColumnMode]);
xoffB = colR + docstyle.Layout.LeftMargin + docstyle.Continue.Bottom.Margin ?? 0;
}
else if (MyItemInfo.IsInRNO && (docstyle.Continue.Bottom.MarginR ?? 0) > 0)
{
xoffB = (float)docstyle.Layout.LeftMargin + (float)docstyle.Continue.Bottom.MarginR;
MyPageHelper.BottomMessageR = new vlnText(cb, this, myMsg, myMsg, xoffB, msg_yLocation, docstyle.Continue.Bottom.Font);
xoffB = (float)docstyle.Layout.LeftMargin + (float)docstyle.Continue.Bottom.Margin;
}
// FloatingContinueMessage format flag:
// if breaking at the AER put continue message in left column,
// if breaking RNO put continue message in Right column.