This commit is contained in:
parent
11b26a4770
commit
0244952ba0
@ -137,7 +137,6 @@ namespace Volian.Print.Library
|
||||
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;
|
||||
if (MyItemInfo.FormatStepData != null && MyItemInfo.FormatStepData.StepPrintData != null) XOffset += (float)(MyItemInfo.FormatStepData.StepPrintData.PosAdjust??0);
|
||||
|
||||
if (MyItemInfo.IsFigure)
|
||||
{
|
||||
@ -201,7 +200,7 @@ namespace Volian.Print.Library
|
||||
private float DrawGrid(PdfContentByte cb, ref float yPageStart, float yTopMargin, float yBottomMargin, ref float yLocation)
|
||||
{
|
||||
//DebugText.WriteLine("{0},'{1}','{2}','<<END>>'", MyItemInfo.ItemID, MyItemInfo.ShortPath, FormattedText);
|
||||
DebugText.WriteLine("{0},'{1}','{2}','<<END>>'", MyItemInfo.ItemID, MyItemInfo.ShortPath,MyItemInfo.MyContent.Text);
|
||||
DebugText.WriteLine("{0},'{1}','{2}','<<END>>',{3}", MyItemInfo.ItemID, MyItemInfo.ShortPath,MyItemInfo.MyContent.Text,XOffset);
|
||||
float retval = Rtf2Pdf.GridAt(cb, MyGrid, XOffset, yLocation, Width, 100, DebugInfo, yBottomMargin, !MyItemInfo.FormatStepData.Type.Contains("Borderless"));
|
||||
return retval;
|
||||
}
|
||||
@ -324,10 +323,9 @@ namespace Volian.Print.Library
|
||||
float yLocalypagestart = yPageStart;
|
||||
// yPageStart is offset into roll; YTopMost is offset of topmost of this paragraph.
|
||||
float yLocation = yPageStart - YTopMost;
|
||||
DebugText.WriteLine("ToPdf1:{0},'{1}',{2},{3},{4}", MyItemInfo.ItemID, MyItemInfo.ShortSearchPath, yLocation, yPageStart, YTopMost);
|
||||
DebugText.WriteLine("ToPdf1:{0},'{1}',{2},{3},{4},{5}", MyItemInfo.ItemID, MyItemInfo.ShortSearchPath, XOffset, yLocation, yPageStart, YTopMost);
|
||||
int paginate = Paginate(yLocation, yTopMargin, yBottomMargin);
|
||||
bool firstHighLevelStep = MyItemInfo.IsHigh && (MyItemInfo.MyPrevious == null);
|
||||
|
||||
switch (paginate)
|
||||
{
|
||||
case 0:
|
||||
@ -335,6 +333,7 @@ namespace Volian.Print.Library
|
||||
{
|
||||
SectionInfo si = MyItemInfo as SectionInfo;
|
||||
MyPageHelper.PageBookmarks.Add(MyItemInfo, ((si.DisplayNumber ?? "") == "" ? "" : si.DisplayNumber + " - ") + si.DisplayText, null);
|
||||
DoCheckOffHeader(cb, MyItemInfo, yLocation, yTopMargin, yPageStart);
|
||||
}
|
||||
break;
|
||||
case 1: // Break on High Level Step
|
||||
@ -346,11 +345,12 @@ namespace Volian.Print.Library
|
||||
SectionInfo si = MyItemInfo as SectionInfo;
|
||||
MyPageHelper.PageBookmarks.Add(MyItemInfo, ((si.DisplayNumber ?? "") == "" ? "" : si.DisplayNumber + " - ") + si.DisplayText, null);
|
||||
}
|
||||
|
||||
if ((MyItemInfo.ActiveSection.MyDocStyle.StructureStyle.Style ?? 0 & E_DocStructStyle.UseSectionFoldout) != 0)
|
||||
// Only do foldout page if not done for section break, i.e. check the there's a previous step.
|
||||
if (MyItemInfo.MyPrevious != null && (MyItemInfo.ActiveSection.MyDocStyle.StructureStyle.Style ?? 0 & E_DocStructStyle.UseSectionFoldout) != 0)
|
||||
PromsPrinter.DoFoldoutPage(cb, "HLS", MyPageHelper.TextLayer, MyPageHelper);
|
||||
|
||||
|
||||
yPageStart = yTopMargin + YTopMost;
|
||||
DoCheckOffHeader(cb, MyItemInfo, yLocation, yTopMargin, yPageStart);
|
||||
MyPageHelper.YMultiplier = 1;
|
||||
break;
|
||||
case 2: // Break within a Step
|
||||
@ -384,12 +384,13 @@ namespace Volian.Print.Library
|
||||
DebugText.WriteLine("Paginate2");
|
||||
if ((MyItemInfo.ActiveSection.MyDocStyle.StructureStyle.Style ?? 0 & E_DocStructStyle.UseSectionFoldout) != 0)
|
||||
PromsPrinter.DoFoldoutPage(cb, "Break within Step", MyPageHelper.TextLayer, MyPageHelper); // temporary foldout
|
||||
|
||||
|
||||
// If there is a box, adjust the yTopMost to include it.
|
||||
float yTopMost = YTopMost;
|
||||
//if (YVeryTop < yTopMost) Console.WriteLine("{0},{1},{2}", MyItemInfo.DBSequence, yTopMost, YVeryTop);
|
||||
yTopMost = Math.Min(yTopMost,YVeryTop);
|
||||
yPageStart = yTopMargin + yTopMost;// -2 * SixLinesPerInch;
|
||||
DoCheckOffHeader(cb, MyItemInfo, yLocation, yTopMargin, yPageStart);
|
||||
if (EmptyTopMostPart) yPageStart += SixLinesPerInch;
|
||||
myMsg = docstyle.Continue.Top.Message;
|
||||
if (myMsg != null && myMsg != "")
|
||||
@ -423,6 +424,7 @@ namespace Volian.Print.Library
|
||||
else
|
||||
yPageStart = yTopMargin + YTopMost;
|
||||
MyPageHelper.YMultiplier = _SevenLinesPerInch / SixLinesPerInch;
|
||||
DoCheckOffHeader(cb, MyItemInfo, yLocation, yTopMargin, yPageStart);
|
||||
break;
|
||||
}
|
||||
yPageStart = ChildrenAbove.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin);
|
||||
@ -433,7 +435,6 @@ namespace Volian.Print.Library
|
||||
// from the high level step format regardless of what type of high level step it is. Also, if there
|
||||
// is caution or note above it, this space is not added:
|
||||
yPageStart -= ((!MyItemInfo.IsHigh || ChildrenAbove == null) ? 0 : MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[2].StepLayoutData.STExtraSpace ?? 0);
|
||||
|
||||
yPageStart = ParagraphToPdf(cb, yPageStart, yTopMargin, yBottomMargin);
|
||||
yPageStart = ChildrenRight.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin);
|
||||
yPageStart = ChildrenBelow.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin);
|
||||
@ -944,22 +945,6 @@ namespace Volian.Print.Library
|
||||
doSectTab = true;
|
||||
if (itemInfo.IsStepSection && formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Just == "PSLeft")
|
||||
{
|
||||
// NegPageItems stores pagelist items with a negative row and checkoff header tokens.
|
||||
// If they exist, they are actually put out by the section title. If the section
|
||||
// is the first on the page, put it out one line above, otherwise, it gets put out
|
||||
// on the same line as section title.
|
||||
if (MyPageHelper.NegPageItems != null && MyPageHelper.NegPageItems.Count > 0)
|
||||
{
|
||||
if (MyPageHelper.NegPageItems.ContainsKey(itemInfo as SectionInfo))
|
||||
{
|
||||
CheckOffHeaderHelper hlp = MyPageHelper.NegPageItems[itemInfo as SectionInfo];
|
||||
// if this section is first section on page, put the checkoff on line above
|
||||
// current line, otherwise put it on same line as section title.
|
||||
float chkOffY = yoff == 0 ? yoff - SixLinesPerInch : yoff;
|
||||
vlnText myCOHead = new vlnText(cb, this, hlp.SvgText.Text, hlp.SvgText.Text, hlp.SvgText.X.Value + (float)MyItemInfo.MyDocStyle.Layout.LeftMargin, chkOffY, hlp.CheckOffHeaderFont);
|
||||
PartsRight.Add(myCOHead);
|
||||
}
|
||||
}
|
||||
float offset = (float)itemInfo.MyDocStyle.Layout.LeftMargin;
|
||||
if (formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Pos != null)
|
||||
offset += (float)formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Pos;
|
||||
@ -1068,6 +1053,9 @@ namespace Volian.Print.Library
|
||||
Width = GetTableWidth(cb, IParagraph, MyItemInfo.MyDocStyle.Layout.PageWidth);
|
||||
CalculateXOffset(itemInfo, maxRNO, formatInfo);
|
||||
}
|
||||
else
|
||||
if (itemInfo.FormatStepData != null && itemInfo.FormatStepData.StepPrintData != null) XOffset += (float)(itemInfo.FormatStepData.StepPrintData.PosAdjust ?? 0);
|
||||
|
||||
bool printMetaHdr = false;
|
||||
if (itemInfo.Steps != null && itemInfo.IsSection && itemInfo.Sections != null && itemInfo.Sections.Count > 0)
|
||||
{
|
||||
@ -1142,6 +1130,132 @@ namespace Volian.Print.Library
|
||||
}
|
||||
YBottomMost = yoff;
|
||||
}
|
||||
|
||||
private string SectionHasCheckOffHeader(ItemInfo itemInfo, ref VE_Font font)
|
||||
{
|
||||
// If the passed in itemInfo is not a section, get it's parent section. This may be a subsection, so
|
||||
// it will be found here, versus using 'MyActiveSection'.
|
||||
while (!itemInfo.IsSection)
|
||||
{
|
||||
itemInfo = itemInfo.MyParent;
|
||||
}
|
||||
// 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
|
||||
int sindx = si.CheckOffHeadingIndex();
|
||||
|
||||
// If there is a checkoff header for this section, see if this section has subsections.
|
||||
// If this has a header but no subsections, put out the header.
|
||||
// Else if this section has a header AND subsections, don't put it out...
|
||||
// the subsection's checkoff header will be processed (or lack there of).
|
||||
bool doCheckoffHeader = sindx > 0 && (itemInfo.Sections == null || itemInfo.Sections.Count == 0);
|
||||
|
||||
// if doing it, then grab the string from the format.... CHECK if this works for subsection, it is
|
||||
// getting ActiveSection which may return the top section, not subsections.
|
||||
if (doCheckoffHeader && itemInfo.SectionCheckOffHeader != "")
|
||||
{
|
||||
font = itemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffHeaderList[sindx].Font;
|
||||
return itemInfo.SectionCheckOffHeader;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void DoCheckOffHeader(PdfContentByte cb, ItemInfo itemInfo, float yLocation, float yTopMargin, float yPageStart)
|
||||
{
|
||||
// CheckOffHeaders are handled in two different ways:
|
||||
// 1) Where the pagelist item puts them - this is at the 'top' of the page, when the current section on the
|
||||
// page has a checkoff header defined. Support for this is here AND in the VlnSvgPageHelper pagelist code.
|
||||
// 2) If a continuous section, and it doesn't start at 'top' of the page, then the checkoff header is
|
||||
// printed on the same line as the continuous section. Support for this is here, the check off header is added
|
||||
// to the 'PartRight' off of the section's VlnParagraph.
|
||||
|
||||
// First see if there is any checkoff data in the format file and that there
|
||||
// is a pagelist item for the checkoff header.
|
||||
if (itemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffList.Count <= 0) return;
|
||||
if (MyPageHelper.PageListCheckOffHeader == null) return;
|
||||
|
||||
VE_Font font = null;
|
||||
ItemInfo mySectionInfo = itemInfo.MyActiveSection;
|
||||
ItemInfo mySubSectionInfo = itemInfo;
|
||||
|
||||
// If the passed in itemInfo is not a section, get it's parent section. This may be a subsection, so
|
||||
// it will be found here, versus using 'MyActiveSection' which is the topmost section. The passed in
|
||||
// item may be a regular step, i.e. if a page break had occurred.
|
||||
if (!itemInfo.IsSection)
|
||||
{
|
||||
while (!mySubSectionInfo.IsSection)
|
||||
{
|
||||
mySubSectionInfo = mySubSectionInfo.MyParent;
|
||||
}
|
||||
}
|
||||
else
|
||||
mySubSectionInfo = (mySectionInfo.Sections == null)?null:mySectionInfo.Sections[0];
|
||||
|
||||
if (mySectionInfo == mySubSectionInfo) mySubSectionInfo = null;
|
||||
|
||||
// The following duplicates the 16bit logic. The 16bit logic only put out a header if:
|
||||
// there is no subsection and section has a header (from config);
|
||||
// OR there is a subsection and the first subsection has a header.
|
||||
// For locating the header in 16bit logic:
|
||||
// If no subsections, output with section
|
||||
// If subsections and continuous section, put out on same line as subsection. (done here)
|
||||
// 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);
|
||||
int sindx = si.CheckOffHeadingIndex();
|
||||
SectionInfo subi = mySubSectionInfo == null ? null : SectionInfo.Get(mySubSectionInfo.ItemID);
|
||||
int subindx = subi==null?-1:subi.CheckOffHeadingIndex();
|
||||
|
||||
// if there is no subsections & the main section doesn't use a header OR
|
||||
// if there is a subsection, & it does not use a header... Return.
|
||||
if ((subi==null&&sindx < 1) || (subi!=null&&subindx<1)) return;
|
||||
|
||||
// figure out location now:
|
||||
// if step, it uses pagelist logic to locate it (this is a page break condition).
|
||||
// if continuous, put out with subsection if there is one, otherwise section.
|
||||
// otherwise, use pagelist logic.
|
||||
bool usePageListCOHdr = false;
|
||||
|
||||
if (itemInfo.IsStep)
|
||||
usePageListCOHdr = true;
|
||||
else if (subi == null) //no subsection
|
||||
{
|
||||
if ((yPageStart - YOffset) == yTopMargin) usePageListCOHdr = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mySectionInfo == itemInfo && ((yPageStart - YOffset) == yTopMargin)) usePageListCOHdr = true;
|
||||
if (!usePageListCOHdr && mySubSectionInfo != itemInfo) return;
|
||||
}
|
||||
|
||||
// grab the string from the format, depending on whether it should get it from the section or subsection.
|
||||
string cohead = (mySubSectionInfo!=null)?mySubSectionInfo.SectionCheckOffHeader:mySectionInfo.SectionCheckOffHeader;
|
||||
if (cohead == "" || cohead == null) return;
|
||||
|
||||
// PageListCheckOffHeader is an svgtext - but really we only need the x/y location for this (pagelist support)
|
||||
// The actual text is from the checkoff header selection in the section config.
|
||||
if (cohead != MyPageHelper.PageListLastCheckOffHeader)
|
||||
{
|
||||
font = mySectionInfo.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffHeaderList[sindx].Font;
|
||||
float chkOffY = CalculateYLocation(YTopMost, yTopMargin);
|
||||
if (MyPageHelper.YMultiplier != 1)
|
||||
{
|
||||
chkOffY = -1 + yTopMargin - (yTopMargin - yLocation) * MyPageHelper.YMultiplier;
|
||||
if (Rtf != null)
|
||||
IParagraph.Leading = _SevenLinesPerInch;
|
||||
}
|
||||
if (!usePageListCOHdr)
|
||||
{
|
||||
vlnText myCOHead = new vlnText(cb, this, cohead, cohead, MyPageHelper.PageListCheckOffHeader.X.Value + (float)MyItemInfo.MyDocStyle.Layout.LeftMargin, chkOffY, font);
|
||||
PartsRight.Add(myCOHead);
|
||||
}
|
||||
else
|
||||
MyPageHelper.PageListTopCheckOffHeader = cohead;
|
||||
MyPageHelper.PageListLastCheckOffHeader = cohead;
|
||||
}
|
||||
}
|
||||
internal vlnParagraph BottomChild
|
||||
{
|
||||
get
|
||||
@ -1170,24 +1284,49 @@ namespace Volian.Print.Library
|
||||
bool aerTableOrFigure = itemInfo.FormatStepData.Type.Contains("AER");
|
||||
vlnParagraph hls1 = MyParent;
|
||||
while (hls1.MyParent != null && !hls1.MyItemInfo.IsHigh) hls1 = hls1.MyParent;
|
||||
// Determine center of hls
|
||||
XOffset = hls1.XOffset + hls1.Width / 2;
|
||||
// Determine left edge of the table by subtracting 1/2 of its width.
|
||||
XOffset -= Width / 2;
|
||||
float colR = float.Parse(formatInfo.MyStepSectionLayoutData.ColRTable.Split(",".ToCharArray())[itemInfo.ColumnMode]);
|
||||
float xLowerLimit = hls1.XOffset; // 6; // Adjusted for HLP VE-PROMS
|
||||
float xUpperLimit = hls1.XOffset + hls1.Width + colR * itemInfo.ColumnMode; // 20110429 RHM Adjusted for RNO Tables Removed +18; // Adjusted for HLP VE-PROMS
|
||||
if (!aerTableOrFigure && itemInfo.RNOLevel == 0) // Centered Table or Figure
|
||||
float xLowerLimit = hls1.XOffset;
|
||||
float xUpperLimit = hls1.XOffset + hls1.Width + colR * itemInfo.ColumnMode;
|
||||
float TableCenterPos = float.Parse(formatInfo.MyStepSectionLayoutData.TableCenterPos.Split(",".ToCharArray())[itemInfo.ColumnMode]);
|
||||
if (formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.TieTabToLevel)
|
||||
{
|
||||
// Add in 1/2 of the width of all RNO columns
|
||||
XOffset += (colR * itemInfo.ColumnMode) / 2;
|
||||
XOffset -= 12;
|
||||
float pageWidth = ((float)itemInfo.MyActiveSection.MyDocStyle.Layout.PageWidth); //* (float)MyItemInfo.FormatStepData.Font.CPI / 12;
|
||||
float leftMargin = ((float)itemInfo.MyActiveSection.MyDocStyle.Layout.LeftMargin); //* (float)MyItemInfo.FormatStepData.Font.CPI / 12;
|
||||
XOffset = leftMargin + (pageWidth - leftMargin - Width) / 2;
|
||||
}
|
||||
else // AER or RNO
|
||||
XOffset = MyParent.XOffset + MyParent.Width / 2 - Width / 2;
|
||||
else
|
||||
{
|
||||
// Determine center of hls
|
||||
XOffset = hls1.XOffset + hls1.Width / 2;
|
||||
// Determine left edge of the table by subtracting 1/2 of its width.
|
||||
XOffset -= Width / 2;
|
||||
if (aerTableOrFigure || itemInfo.RNOLevel != 0) // AER or RNO
|
||||
XOffset = MyParent.XOffset + MyParent.Width / 2 - Width / 2;
|
||||
else if (TableCenterPos != 0)
|
||||
XOffset = TableCenterPos;
|
||||
else // Centered Table or Figure
|
||||
{
|
||||
// Add in 1/2 of the width of all RNO columns
|
||||
XOffset += (colR * itemInfo.ColumnMode) / 2;
|
||||
if (!aerTableOrFigure)
|
||||
{
|
||||
// 05/14/12 - 16bit code adjusts the center depending upon the CPI of the table font.
|
||||
// Start with XOffset of table, then calculate the XOffset adjusted for the table font,
|
||||
// based on the default CPI of 12. Adjust the XOffset by the difference of these
|
||||
// two numbers.
|
||||
XOffset -= (XOffset - (XOffset * (float)MyItemInfo.FormatStepData.Font.CPI / 12));
|
||||
}
|
||||
XOffset -= 12; // This makes the 16bit & 32bit align very closely.
|
||||
}
|
||||
// 05/14/12 - The PosAdjust is a format flag from 16bit. For WCN2, it appears that this amount equals
|
||||
// the amount of difference from a 10 CPI to a 12 CPI font. See comment above.
|
||||
if (itemInfo.FormatStepData != null && itemInfo.FormatStepData.StepPrintData != null)
|
||||
XOffset += (float)(itemInfo.FormatStepData.StepPrintData.PosAdjust ?? 0);
|
||||
}
|
||||
|
||||
|
||||
// if the XOffset < High Level Step Text's XOffset, then align with the High Level Step Text
|
||||
if (XOffset < xLowerLimit)
|
||||
if (XOffset < xLowerLimit && Width < (xUpperLimit - xLowerLimit))
|
||||
XOffset = xLowerLimit;
|
||||
|
||||
// if the right margin exceeds the right edge of the rightmost RNO, then adjust right edge to match.
|
||||
|
Loading…
x
Reference in New Issue
Block a user