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:
2016-07-25 15:04:23 +00:00
parent 4feea15106
commit 146e1fb968
6 changed files with 58 additions and 8 deletions

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,8 +1344,15 @@ namespace Volian.Print.Library
else
AddTemplateTOCPageCounts(tOfC, yLocation, yPageStartAdj, leftMargin, secPagePos, height, mySection);
}
yLocation += (float)(tOfC.TofCLineSpacing ?? 1) * vlnPrintObject.SixLinesPerInch;
//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);