New Table of Contents flags & MaxWidth for PSIs (for current page)

Improve message when format is changed and not certain if section type is valid. (part of B2016-165)
vcb1: Added MaxWidthCurPage for PSI text widths (use for current page)
vcb1: Table of Contents values for subsections line spacing and grouping section numbers
Table of Contents to handle single space subsections & Grouping section names remove group title
Use MaxWidthCurPage to handle max width, but don’t account for multiple lines when printing content
This commit is contained in:
Kathy Ruffing 2016-07-25 15:04:23 +00:00
parent 4feea15106
commit 146e1fb968
6 changed files with 58 additions and 8 deletions

Binary file not shown.

View File

@ -610,8 +610,8 @@ namespace VEPROMS
}
if (oldSelIndx > newDocStyles.Count)
{
string msg = string.Format("The section type that is set is not available in the new format, it was reset to '{0}'. Verify that it is appropriate.", newDocStyles.GetDocStyleItem(0).Name);
MessageBox.Show(msg, "Non-existent section");
string msg = string.Format("Since the format has been changed, the section type was also changed to '{0}'. Verify that it is appropriate and if not, select a new section type.", newDocStyles.GetDocStyleItem(0).Name);
MessageBox.Show(msg, "Verify section type");
selindx = 0;
}
}

View File

@ -133,6 +133,18 @@ namespace VEPROMS.CSLA.Library
return (LazyLoad(ref _MaxWidth, "@MaxWidth"));
}
}
// MaxWidth, above, flagged that, if there was more than 1 line, the topmargin would be adjusted by however
// many lines the PSI item contained (for wst alarms). The MaxWidthCurPage is used when that adjustment
// should not be made, the length of the PSI item is only relevant for the current page.
// (see AdjustTopMarginForMultiLinePageListItems variable and how it is used)
private LazyLoad<int?> _MaxWidthCurPage;
public int? MaxWidthCurPage
{
get
{
return (LazyLoad(ref _MaxWidthCurPage, "@MaxWidthCurPage"));
}
}
#endregion
#region Override ToString
public override string ToString()

View File

@ -3928,6 +3928,22 @@ namespace VEPROMS.CSLA.Library
return (tocProcStepsTitle == null || tocProcStepsTitle == "") ? "" : tocProcStepsTitle;
}
}
private LazyLoad<int?> _TofCLineSpacingSub;
public int? TofCLineSpacingSub
{
get
{
return LazyLoad(ref _TofCLineSpacingSub, "@TofCLineSpacingSub");
}
}
private LazyLoad<bool> _TofCRemoveGrpNameInSects;
public bool TofCRemoveGrpNameInSects
{
get
{
return LazyLoad(ref _TofCRemoveGrpNameInSects, "@TofCRemoveGrpNameInSects");
}
}
private VE_Font _Font;
public VE_Font Font
{

View File

@ -1180,11 +1180,25 @@ namespace Volian.Print.Library
yLocation = lastyLocation = 0;
rtnval = Rtf2Pdf.TextAt(cb, myparagraphtc, leftMargin + secNumPos, yPageStart - yLocation, w, height, "", yBottomMargin);
}
yLocation += (2 * vlnPrintObject.SixLinesPerInch); // new line
int lnaftergroup = ((tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCLineSpacingSub ?? 0) > 0) ? 1 : 2;
yLocation += (lnaftergroup * vlnPrintObject.SixLinesPerInch); // new line
}
// need to do the section number, section title & page number. Page number
// has to be put on at end after number of page is known, so use a Template.
bool didGrp = false;
string tmptxt = mySection.MyContent.Number == null || mySection.MyContent.Number == "" ? " " : mySection.MyContent.Number;
if (tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCRemoveGrpNameInSects
&& tocGrpHeading.Length > 0 && tmptxt.ToUpper().Contains(tocGrpHeading))
{
tmptxt = tmptxt.Replace(tocGrpHeading, "");
didGrp = true;
}
if (tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCRemoveGrpNameInSects
&& lastTOCGroupHeading.Length > 0 && tmptxt.ToUpper().Contains(lastTOCGroupHeading))
{
tmptxt = tmptxt.Replace(lastTOCGroupHeading, "");
didGrp = true;
}
string rtfText = GetRtfToC(tmptxt, tOfC);
Paragraph myparagraphn = vlnPrintObject.RtfToParagraph(rtfText);
float width = 0;
@ -1254,7 +1268,7 @@ namespace Volian.Print.Library
// is put out.
retval = Rtf2Pdf.TextAt(cb, myparagraphn, leftMargin + secNumPos + indentOffset, yPageStart - yLocation, numwidth * 1.3F, height, "", yBottomMargin);
float lSpace = (float)(tOfC.TofCLineSpacing ?? 1) * vlnPrintObject.SixLinesPerInch;
//float lSpace = (float)(tOfC.TofCLineSpacing ?? 1) * vlnPrintObject.SixLinesPerInch;
// adjust ylocation for pagenumber - the ylocation will get reset if the
// section title split on 2 lines and the page number needs to be on the 2nd line.
@ -1330,7 +1344,14 @@ namespace Volian.Print.Library
else
AddTemplateTOCPageCounts(tOfC, yLocation, yPageStartAdj, leftMargin, secPagePos, height, mySection);
}
//If the format wants single spacing within subsections (2nd level and lower), then need to figure out
// spacing (vcb1 table of contents)
bool dosuby = (((tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCLineSpacingSub ?? 1) > 0)
&& (mySection.MyParent.IsSection && ((mySection.Sections != null && mySection.Sections.Count > 0) || (level > 0 && mySection.NextItem != null))))
|| didGrp;
if (dosuby)
yLocation += (float)(tOfC.TofCLineSpacingSub ?? 1) * vlnPrintObject.SixLinesPerInch;
else
yLocation += (float)(tOfC.TofCLineSpacing ?? 1) * vlnPrintObject.SixLinesPerInch;
}
yLocation = AddSectionToTOC(tocSection, mySection, tOfC, cb, yPageStart, yLocation);

View File

@ -2000,10 +2000,11 @@ namespace Volian.Print.Library
// defined, see if the text is too wide for a single line (SplitTextMaxWidth). The
// AdjustTopMarginForMultLinePageListItem contains the y-adjustment that must be considered
// in the TopMargin if the PSI text split onto more than one line.
if ((pageItem.MaxWidth??0)>0)
if ((pageItem.MaxWidth??0)>0 || (pageItem.MaxWidthCurPage??0)>0)
{
int locwid = (int)pageItem.MaxWidth;
int locwid = ((pageItem.MaxWidth??0)>0)?(int)pageItem.MaxWidth:(int)pageItem.MaxWidthCurPage;
AdjustTopMarginForMultiLinePageListItems = SplitTextMaxWidth(svgGroup, pageItem, val, locwid, token, ref plstr);
if ((pageItem.MaxWidthCurPage ?? 0) > 0) AdjustTopMarginForMultiLinePageListItems = 0;
}
else
plstr = plstr.Replace(token, val);