Various FNP tabbing & template fixes

Get text for template steps
Template improvements & added AlignHLSTabWithSectOvride for FNP
Support for TitleWithTextRight step types
Support PSOnlyFirst docstyle flag for FNP
Printing of FNP’s component lists (templates), PSOnlyFirst docstyle, PrintNoTitle, subsection has own docstyle, and FNP tab locations
Support PSOnlyFirst docstyle, Like6_ButDoesntNeedSubsection numberingsequence & PrintNoTitle, for FNP
This commit is contained in:
Kathy Ruffing 2013-10-28 13:58:40 +00:00
parent c59264b027
commit fadac13f82
7 changed files with 243 additions and 46 deletions

View File

@ -2599,21 +2599,35 @@ namespace VEPROMS.CSLA.Library
else if (myparent.IsSection || myparent.IsHigh || myparent.IsSequential || (myparent.IsRNOPart && myparent.FormatStepData.NumberHighLevel && tbformat.ToUpper().Contains("WPAR")))
{
parentTab = myparent.MyTab.CleanText.Trim();
if (((MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_AddDotZeroStdHLS) == E_DocStructStyle.DSS_AddDotZeroStdHLS) && myparent.MyContent.Type == 20002)
parentTab = parentTab.Replace(".0", ""); // this was added in, remove for substeps.
tbformat = parentTab + (parentTab.EndsWith(".") ? "" : ".") + tbformat.TrimStart();
if (myparent.MyTab.AdjustTabSpace)
if (tbformat.EndsWith(" ")) tbformat = tbformat.Substring(0, tbformat.Length - 1);
}
}
// If the document style has the flag DSS_UnNumLikeRoman, don't do the normal tab, change to alpha,
// but only if there is a tab string for this step. (the High level step is numbered with roman numerals, so
// don't want to continue using the roman numeral concatenated with substep tabs.
if (!IsHigh && tbformat != null && tbformat != "" && (MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_UnNumLikeRoman) == E_DocStructStyle.DSS_UnNumLikeRoman)
tbformat = "{alpha}. ";
if (tbformat.IndexOf("#2#") > -1)
// but only if there is a tab string for this step and it includes the HLS/parent tab. The HLS is numbered
// with roman numerals, so don't want to continue using the roman numeral concatenated with substep tabs.
if (!IsHigh && (MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_UnNumLikeRoman) == E_DocStructStyle.DSS_UnNumLikeRoman)
{
int indxlb = tbformat.IndexOf("#");
string ofst = tbformat.Substring(indxlb + 1, 3);
_MyTab.Offset = Convert.ToInt32(ofst.Substring(0, 1)) * (int)FormatStepData.TabData.Font.CPI;
tbformat = tbformat.Replace("#2#", "");
// the parent has to have a roman numeral as its tab.
if (MyParent.FormatStepData.TabData.IdentPrint.ToUpper().Contains("ROMAN") &&
tbformat != null && tbformat != "" && tbformat.ToUpper().Contains("WPAR"))
tbformat = "{alpha}. ";
}
if (tbformat.IndexOf("#2#") > -1 || tbformat.IndexOf("#1#") > -1)
{
//16 bit code limits the #2# offset logic to the docstyle cannot have the DSS_ADDDOTZEROSTDHLS &
// its HLS is type std high:
if (!(((MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_AddDotZeroStdHLS) == E_DocStructStyle.DSS_AddDotZeroStdHLS) && this.MyHLS.MyContent.Type == 20002))
{
int indxlb = tbformat.IndexOf("#");
string ofst = tbformat.Substring(indxlb + 1, 3);
_MyTab.Offset = Convert.ToInt32(ofst.Substring(0, 1)) * (int)FormatStepData.TabData.Font.CPI;
}
tbformat = tbformat.Replace("#2#", "").Replace("#1#", "");
}
if (tbformat.IndexOf("{Pos") > -1)
{
@ -2643,9 +2657,19 @@ namespace VEPROMS.CSLA.Library
tbformat = tbformat.Replace("{alphaWpar}", alpha.ToLower());
tbformat = tbformat.Replace("{ALPHA}", alpha);
tbformat = tbformat.Replace("{ALPHAWpar}", alpha);
string roman = RomanNumbering(ordinal);
tbformat = tbformat.Replace("{roman}", roman.ToLower());
tbformat = tbformat.Replace("{ROMAN}", roman);
if (tbformat.ToUpper().Contains("ROMAN"))
{
string roman = RomanNumbering(ordinal);
tbformat = tbformat.Replace("{roman}", roman.ToLower());
tbformat = tbformat.Replace("{ROMAN}", roman);
tbformat = tbformat.Substring(0, tbformat.Length - ((roman.Length - 1)>0?(roman.Length - 1):0));
}
if (ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.VirtualDotInHLSTab && tbformat.Contains("numeric") & ordinal > 9) MyTab.AdjustTabSpace = true;
if (tbformat.Contains("{numeric}") && ((MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_AddDotZeroStdHLS) == E_DocStructStyle.DSS_AddDotZeroStdHLS) && MyContent.Type == 20002)
{
tbformat = tbformat.Replace("{numeric}", ordinal.ToString().PadLeft(2) + ".0");
tbformat = tbformat.Substring(0, tbformat.Length - 2);
}
tbformat = tbformat.Replace("{numeric}", trimTabStart ? ordinal.ToString() : FormatStepData.AtLeastTwoDigits ? ordinal.ToString().PadLeft(2, '0') : ordinal.ToString().PadLeft(2));
if (tbformate != null) tbformate = tbformate.Replace("{numeric}", trimTabStart ? ordinal.ToString() : FormatStepData.AtLeastTwoDigits ? ordinal.ToString().PadLeft(2, '0') : ordinal.ToString().PadLeft(2));
tbformat = tbformat.Replace("{numericWpar}", ordinal.ToString());
@ -2771,7 +2795,7 @@ namespace VEPROMS.CSLA.Library
OffsetTab = TopRNO.FormatStepData.NumberHighLevel?1:0;
_PrintBias = 0;
if (par.FormatStepData != null && par.FormatStepData.TabData.IdentPrint.Contains("{ALPHA}"))
level--;
level--;
// ImperfectStructure is used so that the sequential numbering for substeps under an RNO is not same
// numbering (alpha vs numeric), if the HLS has substeps - WCN uses this, as well as other plants.
@ -3174,9 +3198,15 @@ namespace VEPROMS.CSLA.Library
}
#endregion
#region UseSmartTemplate
public bool IsInTemplate()
{
if (IsStep && FormatStepData.MyFormat.PlantFormat.FormatData.TopTemplateTypes.ContainsKey((int)MyContent.Type - 20001)) return true;
return false;
}
public int GetSmartTemplateTopLevelIndx()
{
FormatData formatData = FormatStepData.MyFormat.PlantFormat.FormatData;
if (formatData.TopTemplateTypes == null || formatData.TopTemplateTypes.Count == 0) return -1;
ItemInfo tmp = this;
while (!tmp.IsSection)
{
@ -3188,6 +3218,7 @@ namespace VEPROMS.CSLA.Library
public int GetSmartTemplateIndex(int topIndx, int curStepType)
{
FormatData formatData = FormatStepData.MyFormat.PlantFormat.FormatData;
if (formatData.TopTemplateTypes == null || formatData.TopTemplateTypes.Count == 0) return -1;
int indx = topIndx;
int curType = curStepType - 20001;
while (indx < formatData.Templates.Count)
@ -3392,6 +3423,12 @@ namespace VEPROMS.CSLA.Library
get { return _RemovedStyleUnderline; }
set { _RemovedStyleUnderline = value; }
}
private bool _AdjustTabSpace = false;
public bool AdjustTabSpace
{
get { return _AdjustTabSpace; }
set { _AdjustTabSpace = value; }
}
public Tab(VE_Font font)
{
MyFont = font;

View File

@ -339,7 +339,7 @@ namespace VEPROMS.CSLA.Library
newItemID = siblingSmart.ItemID;
}
tmptext = FormatStepData.MyFormat.PlantFormat.FormatData.NewTemplateFormat ? " ": FormatStepData.MyFormat.PlantFormat.FormatData.Templates[tpIndx].text;
tmptext = /*FormatStepData.MyFormat.PlantFormat.FormatData.NewTemplateFormat ? " ": */FormatStepData.MyFormat.PlantFormat.FormatData.Templates[tpIndx].text;
tmp = NewItemInfoFetch(newItemID, addPart, null, tmptext, FormatStepData.MyFormat.PlantFormat.FormatData.Templates[tpIndx].type + 20001, (int ?)fromType, null, null, DateTime.Now, Volian.Base.Library.VlnSettings.UserID);
newItemID = tmp.ItemID;
if (level < prevlevel) siblingSmart = tmp;

View File

@ -179,6 +179,14 @@ namespace VEPROMS.CSLA.Library
return LazyLoad(ref _Name, "@Name");
}
}
private LazyLoad<bool> _ComponentTableFormat;
public bool ComponentTableFormat
{
get
{
return LazyLoad(ref _ComponentTableFormat, "@ComponentTableFormat");
}
}
// TPL represents Templates which are sizes of columns for 'table' type data. If the format
// has the 'UseSmartTemplate' format flag, this table will have starting location & widths, and
// other data for the listed step types. Data from this table overrides width data as specified
@ -249,6 +257,11 @@ namespace VEPROMS.CSLA.Library
while (cnt < NumTemplates)
{
tmpStrIndxEnd = TPL.IndexOf("\n", tmpStrIndxStart);
if (tmpStrIndxEnd < 0)
{
cnt++;
continue; // maybe extra newlines at end of string.
}
string tpl = TPL.Substring(tmpStrIndxStart, tmpStrIndxEnd-tmpStrIndxStart);
tmpStrIndxStart = tmpStrIndxEnd + 1;
int level = 0;
@ -268,6 +281,11 @@ namespace VEPROMS.CSLA.Library
else
{
string[] tmpNew = tpl.Split(",".ToCharArray());
if (tmpNew.Length < 5)
{
cnt++;
continue; // may be extra newlines at end of string
}
level = Convert.ToInt32(tmpNew[0]);
type = Convert.ToInt32(tmpNew[1]);
start = Convert.ToInt32(tmpNew[2]);
@ -3881,6 +3899,14 @@ namespace VEPROMS.CSLA.Library
return LazyLoad(ref _AlignNullTabWSectHead, "@AlignNullTabWSectHead");
}
}
private LazyLoad<bool> _AlignHLSTabWithSectOvride;
public bool AlignHLSTabWithSectOvride
{
get
{
return LazyLoad(ref _AlignHLSTabWithSectOvride, "@AlignHLSTabWithSectOvride");
}
}
private LazyLoad<bool> _TextSubFollowsTextStyle;
public bool TextSubFollowsTextStyle
{

View File

@ -2085,18 +2085,24 @@ namespace Volian.Controls.Library
// Paul Linn made the request on 6/4/12 to align the Component Description &
// Required Position under the Component Number.
ItemLocation = new Point(_MyParentEditItem.ItemLocation.X, _MyParentEditItem.Bottom);
else if (MyItemInfo.MyParent.FormatStepData.Type == "TitleWithTextRight")
ItemLocation = new Point(_MyParentEditItem.ItemLocation.X + _MyParentEditItem.ItemWidth, _MyParentEditItem.ItemLocation.Y);
else
ItemLocation = new Point(_MyParentEditItem.ContentLeft, _MyParentEditItem.Bottom);
if (MyItemInfo.FormatStepData.ReadOnly)
{
Graphics g = CreateGraphics();
SizeF sz = g.MeasureString(MyItemInfo.MyContent.Text, MyItemInfo.FormatStepData.Font.WindowsFont);
ItemWidth = (int)sz.Width;
}
else if (MyParentEditItem != null && MyParentEditItem.MyItemInfo.FormatStepData.ReadOnly)
else if (MyItemInfo.MyParent.FormatStepData.Type == "TitleWithTextRight")
{
ItemWidth = MyStepPanel.ToDisplay(MyStepSectionLayoutData.ColT) + MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidSTableEdit, 0);
ItemWidth = ItemWidth - ItemLocation.X;
}
else if (MyParentEditItem != null && MyParentEditItem.MyItemInfo.FormatStepData.ReadOnly)
ItemWidth = MyStepPanel.ToDisplay(MyStepSectionLayoutData.ColT) + MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidSTableEdit, 0);
else
ItemWidth = _MyParentEditItem.ContentWidth;
}

View File

@ -493,6 +493,7 @@ namespace Volian.Print.Library
else
CreateWordDocPdf(cb, mySection, ref readerWord, ref myPdfFile);
}
_MyHelper.PrintedSectionPage = 0;
}
if (_MyHelper != null && _MyHelper.BackgroundFile != null)
{

View File

@ -106,7 +106,22 @@ namespace Volian.Print.Library
get { return _PrintedAPage; }
set { _PrintedAPage = value; }
}
// the following two variables are used to handle the 'PSOnlyFirst' page list Justify flag.
// PSOnlyFirst signals that the pagelist token should only be processed for the first page of
// the section. It gets set when this token is processed, so that any remaining pages will
// not get the token. It's value is derived by taking the different the location of this token
// & the location of the previous token, so that this amount can be used to move the text up
// on the 'not first' pages of the section. It's used as an adjustment on the topmargin.
// This is used in FNP formats.
private int _sectLevelNumTtlDiff = 0;
private int _PrintedSectionPage = 0;
public int PrintedSectionPage
{
get { return _PrintedSectionPage; }
set { _PrintedSectionPage = value; }
}
private bool _AddBlankPagesForDuplexPrinting = false;
public bool AddBlankPagesForDuplexPrinting // Tells us if a the option to add a blank page is turn on (for procedures with duplex foldouts)
{
@ -673,6 +688,12 @@ namespace Volian.Print.Library
case E_NumberingSequence.WithinEachSection:
key = key + "." + MySection.ItemID;
break;
case E_NumberingSequence.Like6_ButDoesntNeedSubsection:
if (MySection.MyParent.IsSection)
key = key + "." + MySection.MyParent.ItemID;
else
key = key + "." + MySection.ItemID;
break;
case E_NumberingSequence.WithStepsAndSecondaryPageNumber:
// For this one, we'll do two keys and templates. One will go with the main steps
// section and one will be for this secondary section.
@ -1093,12 +1114,26 @@ namespace Volian.Print.Library
break;
case "{SECTIONLEVELTITLE}":
case "[SECTIONLEVELTITLE]":
plstr = SplitTitle(svgGroup, pageItem, section.DisplayText, section.ActiveFormat.PlantFormat.FormatData.SectData.SectionTitleLength, token, plstr);
bool printsectlevel = ((pageItem.Justify & VEPROMS.CSLA.Library.E_Justify.PSOnlyFirst) != VEPROMS.CSLA.Library.E_Justify.PSOnlyFirst) ||
(((pageItem.Justify & VEPROMS.CSLA.Library.E_Justify.PSOnlyFirst) == VEPROMS.CSLA.Library.E_Justify.PSOnlyFirst) && PrintedSectionPage==0);
// if there is 'no title' for the section, only print it if a format flag says to print it.
if (printsectlevel)
{
if (section.DisplayText.ToUpper().Contains("<NO TITLE>") && !section.ActiveFormat.PlantFormat.FormatData.ProcData.PrintNoTitle) printsectlevel = false;
}
if (printsectlevel)
{
plstr = SplitTitle(svgGroup, pageItem, section.DisplayText, section.ActiveFormat.PlantFormat.FormatData.SectData.SectionTitleLength, token, plstr);
PrintedSectionPage = (int)pageItem.Row - _sectLevelNumTtlDiff;
}
else
plstr = plstr.Replace(token, "");
//svgGroup.Add(PageItemToSvgText(pageItem, section.DisplayText));
break;
case "{SECTIONLEVELNUMBER}":
case "[SECTIONLEVELNUMBER]":
plstr = plstr.Replace(token, section.DisplayNumber);
_sectLevelNumTtlDiff = (int)pageItem.Row;
//svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token.Replace(token, section.DisplayNumber)));
break;
case "{UNITTEXT}":

View File

@ -57,8 +57,28 @@ namespace Volian.Print.Library
float yTop = yoff;
ItemInfo lastChild = null;
string lastHeader = null;
foreach (ItemInfo childItemInfo in itemInfoList)
bool didComponentTableRow = false;
float tableBottomMost = 0;
foreach (ItemInfo iChildItemInfo in itemInfoList)
{
ItemInfo childItemInfo = iChildItemInfo;
// if in a ComponentTableFormat (FNP sub format 1, component list), column headers are defined
// by the first level of children. The data for the column is the child of the column header.
// Sometimes the column will not have data, the following handles that case. Also, use
// the boolean didComponentTableRow to keep track of the bottom most yoff of the table row.
if ((childItemInfo.ActiveFormat.PlantFormat.FormatData.ComponentTableFormat) && childItemInfo.MyParent.IsInTemplate())
{
// childItemInfo = 'child' and set to use a template for defining size.
if (childItemInfo.Steps == null)
continue;
else
{
childItemInfo = childItemInfo.Steps[0];
didComponentTableRow = true;
}
}
if (childItemInfo.FormatStepData != null && childItemInfo.FormatStepData.TabData != null && childItemInfo.FormatStepData.TabData.IsTransition)
{
lastHeader = childItemInfo.DisplayText;
@ -155,6 +175,11 @@ namespace Volian.Print.Library
if (childItemInfo is SectionInfo) formatInfo = (childItemInfo as SectionInfo).LocalFormat ?? formatInfo;
if (rnoLevel < maxRNO && childItemInfo.RNOs != null) yoff = Math.Max(yoff, yoffRight);
vlnParagraph para = new vlnParagraph(Parent, cb, childItemInfo, xoff, yoff, rnoLevel, maxRNO, formatInfo, null, 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.
tableBottomMost = Math.Max(tableBottomMost, para.YBottomMost);
if (box != null && box.MyParent == null)
{
box.MyParent = para;
@ -164,7 +189,13 @@ namespace Volian.Print.Library
// para.YBottomMost will have y for bottom of any substeps that are also enclosed in the box.
if (childItemInfo.IsStep && childItemInfo.MyHLS != null && childItemInfo.MyHLS.FormatStepData.UseSmartTemplate && para.ChildrenBelow.Count > 0 && para.ChildrenBelow[0].YBottomMost > para.YBottomMost)
yoff = para.ChildrenBelow[0].YBottomMost;
else
// if doing the component list (FNP), yoff for the HLS (if it's the component in the list,
// i.e. the leftmost item in the table), the yoff is either the HLS bottom, or the bottom most
// of all of the other columns' data.
else if (childItemInfo.IsHigh && childItemInfo.FormatStepData.UseOldTemplate && formatInfo.PlantFormat.FormatData.ComponentTableFormat)
yoff = Math.Max(para.YBottom, para.YBottomMost) + vlnPrintObject.SixLinesPerInch;
// increment the y offset if not doing the ComponentTableFormat
else if (!para.UseTemplateKeepOnCurLine(childItemInfo))
yoff = para.YBottomMost;
if (childItemInfo.FormatStepData != null && childItemInfo.FormatStepData.BoxIt)
{
@ -192,6 +223,10 @@ namespace Volian.Print.Library
yoff += lastChild.ActiveFormat.PlantFormat.FormatData.StepDataList[2].StepLayoutData.STExtraSpace ?? 0;
}
}
// 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;
return yoff;
}
public float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin)
@ -674,11 +709,11 @@ namespace Volian.Print.Library
}
private void ResetDocStyleAndValues(ref float yTopMargin, ref float yBottomMargin)
{
float _PointsPerPage = 792;
// if this document style has another style that is for pages other than first, we need to
// reset the document style off of this section AND reset docstyle values used.
if ((MyItemInfo.MyActiveSection.MyDocStyle.StructureStyle.Where & E_DocStyleUse.UseOnFirstPage) > 0)
{
float _PointsPerPage = 792;
{
ItemInfo ii = (ItemInfo)MyItemInfo.MyActiveSection;
int indx = (int)MyItemInfo.MyActiveSection.MyDocStyle.IndexOtherThanFirstPage;
foreach (DocStyle ds in ii.ActiveFormat.PlantFormat.DocStyles.DocStyleList)
@ -698,6 +733,16 @@ namespace Volian.Print.Library
yTopMargin = _PointsPerPage - (float)MyItemInfo.MyActiveSection.MyDocStyle.Layout.TopMargin;
yBottomMargin = Math.Max(0, yTopMargin - (float)MyItemInfo.MyActiveSection.MyDocStyle.Layout.PageLength);
}
else if (MyPageHelper.PrintedSectionPage > 0)
{
MyPageHelper.ResetSvg();
if ((MyItemInfo.MyActiveSection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PrintSectOnFirst) == E_DocStructStyle.DSS_PrintSectOnFirst)
{
yTopMargin = _PointsPerPage - (float)MyItemInfo.MyActiveSection.MyDocStyle.Layout.TopMargin + MyPageHelper.PrintedSectionPage;
yBottomMargin = Math.Max(0, yTopMargin - (float)MyItemInfo.MyActiveSection.MyDocStyle.Layout.PageLength);
}
}
}
public override float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin)
{
@ -1190,6 +1235,8 @@ 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)
{
ShowSectionTitles = formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ShowSectionTitles || itemInfo.MyDocStyle.ShowSectionTitles;
if (itemInfo.IsSection && itemInfo.ActiveSection.DisplayText.ToUpper().Contains("<NO TITLE>") && !itemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.PrintNoTitle) ShowSectionTitles = false;
int MetaLevel = 0; // if meta section, stores what level this section is.
float savCheckListBottomMost = 0;
//int[] problemIDs = { 889 };
@ -1209,6 +1256,13 @@ namespace Volian.Print.Library
}
MyContentByte = cb;
if (!MyPageHelper.MyParagraphs.ContainsKey(itemInfo.ItemID)) MyPageHelper.MyParagraphs.Add(itemInfo.ItemID, this);
if (itemInfo.IsSection && itemInfo.MyParent.IsSection)
{
itemInfo.ActiveSection = null;
itemInfo.MyDocStyle = null;
MyPageHelper.MySection = itemInfo as SectionInfo;
MyPageHelper.ResetSvg();
}
MyItemInfo = itemInfo;
XOffset = xoff;
if (!MyItemInfo.IsStep && !MyItemInfo.IsStepSection)
@ -1334,8 +1388,9 @@ namespace Volian.Print.Library
if (adjusttab != 0) Width += (mytab.Width);
}
}
if(adjustAgain)
if(adjustAgain)
AdjustXOffsetForTab(itemInfo, maxRNO, formatInfo, mytab, xMetaAdj);
if (UseTemplateWidthOrXOff(itemInfo)) XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + GetWidthOrStartFromTemplate(itemInfo, itemInfo.ActiveFormat, false);
if (itemInfo.MyHeader != null && itemInfo.MyHeader.Text != null && !doSectTab)
yoff += SetHeader(this, cb, itemInfo, formatInfo);
float yoffLeft = yoff;
@ -1570,8 +1625,8 @@ namespace Volian.Print.Library
}
// If checklists, the substeps are printed in a row, need to keep track of the 'longest' in
// y direction (bottommost) across the row.
if (itemInfo.IsStep && itemInfo.MyHLS != null && itemInfo.MyHLS.FormatStepData.UseSmartTemplate && (TheStepLevel(itemInfo) >= 0))
savCheckListBottomMost = yoff + Height + SixLinesPerInch;
if (itemInfo.IsStep && itemInfo.MyHLS != null && (itemInfo.MyHLS.FormatStepData.UseSmartTemplate || (itemInfo.MyHLS.FormatStepData.UseOldTemplate && itemInfo.ActiveFormat.PlantFormat.FormatData.ComponentTableFormat)) && (TheStepLevel(itemInfo) >= 0))
savCheckListBottomMost = yoff + Height + (itemInfo.MyHLS.FormatStepData.UseSmartTemplate ? SixLinesPerInch : 0);
// Get Y offset for regular steps, or if section title is output or if not within row (not last column of
// text) for wcn checklist, i.e.
if ((!itemInfo.IsStepSection && itemInfo.MyHLS != null && !itemInfo.MyHLS.FormatStepData.UseSmartTemplate) // regular step
@ -1589,7 +1644,7 @@ namespace Volian.Print.Library
SectionConfig sch = MyItemInfo.MyConfig as SectionConfig;
if (sch != null && sch.Section_PrintHdr != "Y") doprint = false;
}
if (doprint)
if (doprint && !UseTemplateKeepOnCurLine(itemInfo))
{
yoff += Height;
yoff += AdjustForBlankLines();
@ -1691,8 +1746,7 @@ namespace Volian.Print.Library
// For Checklist, the substeps are in rows of data. The YBottomMost is the bottom most for
// the row.
if (savCheckListBottomMost != 0 && savCheckListBottomMost > YBottomMost)
YBottomMost = savCheckListBottomMost;
if (savCheckListBottomMost != 0) YBottomMost = Math.Max(savCheckListBottomMost, YBottomMost);
}
private string GetMacroName(string str)
@ -1881,7 +1935,7 @@ namespace Volian.Print.Library
// in the following calculation, the hls width (hls1.Width) == rno column width, so xUpperLimit is
// the around the right margin, i.e. 'hls xoffset' + 'location of rno (colR) * columnmode' + 'width of rno'
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)
XOffset = leftMargin + (pageWidth - leftMargin - Width) / 2;
@ -1919,7 +1973,7 @@ namespace Volian.Print.Library
// the amount of difference from a 10 CPI to a 12 CPI font. See comment above.
float posAdjust = (float)(itemInfo.FormatStepData.StepPrintData.PosAdjust ?? 0);
if (itemInfo.FormatStepData != null && itemInfo.FormatStepData.StepPrintData != null &&
posAdjust > 0)
posAdjust>0)
{
if (Width < hls1.Width - posAdjust)
XOffset += posAdjust;
@ -1928,7 +1982,7 @@ namespace Volian.Print.Library
}
}
// if the XOffset < High Level Step Text's XOffset, then align with the High Level Step Text
// if the XOffset < High Level Step Text's XOffset , then align with the High Level Step Text
if (XOffset < xLowerLimit && Width < (xUpperLimit - xLowerLimit))
XOffset = xLowerLimit;
@ -2165,7 +2219,7 @@ namespace Volian.Print.Library
xoff = XOffset; // XOffset has left margin included
vlnHeader myHeader = new vlnHeader(this, cb, itemInfo.MyHeader.Text, itemInfo.MyHeader.CleanText.TrimStart(" ".ToCharArray()), xoff, YOffset, itemInfo.MyHeader.MyFont);
PartsAbove.Add(myHeader);
return myHeader.Height + (!MyItemInfo.MyDocStyle.SpecialStepsFoldout || (MyItemInfo.MyDocStyle.ExtraLineHeader && (MyItemInfo.IsCaution || MyItemInfo.IsNote)) ? SixLinesPerInch : 0);
return myHeader.Height + (!MyItemInfo.MyDocStyle.SpecialStepsFoldout || (MyItemInfo.MyDocStyle.ExtraLineHeader&&(MyItemInfo.IsCaution||MyItemInfo.IsNote)) ? SixLinesPerInch : 0);
}
private float AdjustToCharPosition(float position, float? CPI)
{
@ -2427,9 +2481,11 @@ namespace Volian.Print.Library
else
{
XOffset += xoff;
if (myTab == null && itemInfo.FormatStepData.AlignNullTabWSectHead)
XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)formatInfo.PlantFormat.FormatData.SectData.SectionHeader.Pos;
if (myTab != null)
{
if (itemInfo.MyDocStyle.AlignHLSTabWithSect)
if (itemInfo.MyDocStyle.AlignHLSTabWithSect || itemInfo.FormatStepData.AlignHLSTabWithSectOvride)
{
myTab.XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)formatInfo.PlantFormat.FormatData.SectData.SectionHeader.Pos;
XOffset = myTab.XOffset + myTab.Width;
@ -2485,7 +2541,7 @@ namespace Volian.Print.Library
//{
// // don't adjust for rno
//}
else if (itemInfo.IsRNOPart && (colOvrd > 0 || !((ItemInfo)itemInfo.ActiveParent).IsHigh))
else if (itemInfo.IsRNOPart && (colOvrd > 0 || !((ItemInfo)itemInfo.ActiveParent).IsHigh) && itemInfo.FormatStepData.OffsetTab)
{
if (colOvrd > 0)
{
@ -2532,7 +2588,8 @@ namespace Volian.Print.Library
}
}
}
if (itemInfo.MyTab != null && itemInfo.MyTab.Offset != 0)
// if format had a tab adjustment for step type, use it
if (itemInfo.MyTab != null && itemInfo.MyTab.Offset != 0)
{
myTab.XOffset -= itemInfo.MyTab.Offset;
XOffset -= itemInfo.MyTab.Offset;
@ -2560,7 +2617,7 @@ namespace Volian.Print.Library
int? bxIndx = itemInfo.IsStep ? formatInfo.PlantFormat.FormatData.StepDataList[typ].StepLayoutData.STBoxindex : null;
float? widOvrd = 0;
float xwid = 0;
if (itemInfo.IsStep && itemInfo.MyHLS != null && itemInfo.MyHLS.FormatStepData.UseSmartTemplate && (xwid = GetWidthFromTemplate(itemInfo, formatInfo)) > 0)
if (itemInfo.IsStep && itemInfo.MyHLS != null && UseTemplateWidthOrXOff(itemInfo) && (xwid = GetWidthOrStartFromTemplate(itemInfo, formatInfo, true)) > 0)
widOvrd = xwid;
else
widOvrd = itemInfo.FormatStepData == null ? null : (float?)ToInt(itemInfo.FormatStepData.WidthOverride, maxRNO);
@ -2678,22 +2735,57 @@ namespace Volian.Print.Library
float adjwidth = 0;
if (itemInfo.IsRNOPart && itemInfo.ActiveFormat.MyStepSectionLayoutData.RNOWidthSameAsHighParent && itemInfo.MyParent.IsHigh)
Width = adjwidth + MyParent.Width;
else if (itemInfo.MyTab.Position != 0)
Width = adjwidth + MyParent.Width;
else
Width = adjwidth + MyParent.Width - tabWidth + (myTab == null ? 0 : myTab.TabAlign);
Width = adjwidth + MyParent.Width - tabWidth + (myTab == null ? 0 : myTab.TabAlign);
}
}
private float GetWidthFromTemplate(ItemInfo itemInfo, FormatInfo formatInfo)
// for Component Table, don't increment yoff unless last item in table that HAS data associated
// with it (there may be empty cells at end).
public bool UseTemplateKeepOnCurLine(ItemInfo itemInfo)
{
float rtnwid= 0;
int topIndx = itemInfo.GetSmartTemplateTopLevelIndx();
int tpIndx = itemInfo.GetSmartTemplateIndex(topIndx, (int)itemInfo.MyContent.Type);
if (tpIndx != -1)
if (!itemInfo.IsStep || !itemInfo.ActiveFormat.PlantFormat.FormatData.ComponentTableFormat) return false;
if (itemInfo.MyHLS.FormatStepData.UseOldTemplate) return true;
return false;
}
private bool UseTemplateWidthOrXOff(ItemInfo itemInfo)
{
if (!itemInfo.IsStep) return false;
if (itemInfo.MyHLS.FormatStepData.UseSmartTemplate) return false;
if (!itemInfo.ActiveFormat.PlantFormat.FormatData.ComponentTableFormat) return false;
if (itemInfo.MyHLS.FormatStepData.UseOldTemplate)
{
int ncol = formatInfo.PlantFormat.FormatData.Templates[tpIndx].width;
// now convert to the units for this format. The template width data is in number of columns.
rtnwid = ncol * itemInfo.FormatStepData.Font.CharsToTwips;
ItemInfo useForTemplate = itemInfo.IsHigh?itemInfo:itemInfo.MyParent;
int topIndx = useForTemplate.GetSmartTemplateTopLevelIndx();
int tpIndx = useForTemplate.GetSmartTemplateIndex(topIndx, (int)useForTemplate.MyContent.Type);
if (tpIndx > -1) return true;
}
return rtnwid;
return false;
}
private float GetWidthOrStartFromTemplate(ItemInfo itemInfo, FormatInfo formatInfo, bool bGetWidth)
{
int topIndx = itemInfo.GetSmartTemplateTopLevelIndx();
int tmplIndx = 0;
if (itemInfo.ActiveFormat.PlantFormat.FormatData.ComponentTableFormat && !itemInfo.IsHigh)
{
// The ComponentTable format (FNP component table as one example), uses a template
// where the items in the template below the HLS are all paragraphs (the intermediate steps
// are TitleWithTextRight). Find the ordinal of in this list to get the index. Use the ordinal
// as an offset from the HLS's index into the template.
tmplIndx = itemInfo.MyParent.Ordinal + topIndx;
if (tmplIndx < 0 || tmplIndx > formatInfo.PlantFormat.FormatData.Templates.Count - 1) return 0;
}
else
{
tmplIndx = itemInfo.GetSmartTemplateIndex(topIndx, (int)itemInfo.MyContent.Type);
if (tmplIndx == -1) return 0;
}
int ncol = bGetWidth ? formatInfo.PlantFormat.FormatData.Templates[tmplIndx].width : formatInfo.PlantFormat.FormatData.Templates[tmplIndx].start;
// now convert to the units for this format. The template width data is in number of columns.
return (ncol * itemInfo.FormatStepData.Font.CharsToTwips) + (bGetWidth ? 1 : 0); // + 1 is slight adjustment so column doesn't wrap
}
private float AdjustForSectionLevelTab()
{