Added MaxWidth property that allows for defining width of PSI data and supports multi-line text (introduced for wstalr)
Adjust top margin for multiline pagelist items (introduced for wstalr) Support multi-line PSI item, using ‘MaxWidth’ pagelist property (introduced for wstalr)
This commit is contained in:
parent
2521041932
commit
d6557f578a
@ -125,6 +125,14 @@ namespace VEPROMS.CSLA.Library
|
||||
return LazyLoad<E_Justify>(ref _Justify, "@Justify");
|
||||
}
|
||||
}
|
||||
private LazyLoad<int?> _MaxWidth;
|
||||
public int? MaxWidth
|
||||
{
|
||||
get
|
||||
{
|
||||
return (LazyLoad(ref _MaxWidth, "@MaxWidth"));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Override ToString
|
||||
public override string ToString()
|
||||
|
@ -1410,6 +1410,7 @@ namespace Volian.Print.Library
|
||||
// 792: 72 * 11 inches - TopRow - Top is high value
|
||||
float _PointsPerPage = 792;
|
||||
float yTopMargin = _PointsPerPage - (float)myItemInfo.MyDocStyle.Layout.TopMargin;
|
||||
yTopMargin -= _MyHelper.AdjustTopMarginForMultiLinePageListItems;
|
||||
// the following line was modified to comment out the - 2 * SixLinesPerInch. this fixed a pagination problem with WCN EMG E-3.
|
||||
float yBottomMargin = Math.Max(0, yTopMargin - (float)myItemInfo.MyDocStyle.Layout.PageLength); // - 2 * vlnPrintObject.SixLinesPerInch);
|
||||
vlnParagraph.PathPrefix = myItemInfo.Path;
|
||||
|
@ -463,7 +463,7 @@ namespace Volian.Print.Library
|
||||
private float? _YTopMargin = null;
|
||||
public float? YTopMargin
|
||||
{
|
||||
get { return _YTopMargin; }
|
||||
get { return _YTopMargin - _AdjustTopMarginForMultiLinePageListItems; }
|
||||
set { _YTopMargin = value; }
|
||||
}
|
||||
private void DrawRuler(PdfContentByte cb)
|
||||
@ -1322,6 +1322,12 @@ namespace Volian.Print.Library
|
||||
get { return _OldTemplateContMsg; }
|
||||
set { _OldTemplateContMsg = value; }
|
||||
}
|
||||
private float _AdjustTopMarginForMultiLinePageListItems = 0;
|
||||
public float AdjustTopMarginForMultiLinePageListItems
|
||||
{
|
||||
get { return _AdjustTopMarginForMultiLinePageListItems; }
|
||||
set { _AdjustTopMarginForMultiLinePageListItems = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
/// <param name="section"></param>
|
||||
@ -1797,6 +1803,50 @@ namespace Volian.Print.Library
|
||||
plstr = plstr.Replace(token, un);
|
||||
break;
|
||||
default:
|
||||
//The following code is to be used for Folder & DocVersion specific information.
|
||||
//It was commented out to put on other code, but should be uncommented for specific information.
|
||||
//if (token.Contains(@"SI-")) // folder or working draft specific information.
|
||||
//{
|
||||
// DocVersionConfig dvConfig = new DocVersionConfig(section.MyProcedure.MyDocVersion.Config);
|
||||
// FolderConfig folderConfig = new FolderConfig(section.MyProcedure.MyDocVersion.MyFolder.Config);
|
||||
// if (dvConfig != null || folderConfig != null)
|
||||
// {
|
||||
// int indx = token.IndexOf("-");
|
||||
// int qindx = token.IndexOf("?", indx);
|
||||
// string val = null;
|
||||
// if (qindx == -1)
|
||||
// {
|
||||
// val = GetInheritedSIValue(section.MyProcedure, token.Substring(4, token.Length - 5));
|
||||
// plstr = plstr.Replace(token, val);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// string pstok = token.Substring(indx + 1, qindx - indx - 1);
|
||||
// plstr = GetInheritedSIValue(section.MyProcedure, pstok);
|
||||
// //if (dvConfig != null)
|
||||
// // plstr = dvConfig.GetValue("SI", pstok);
|
||||
// //if ((plstr == null || plstr == "") && folderConfig != null)
|
||||
// // plstr = folderConfig.GetValue("SI", pstok);
|
||||
// // the first part of the string between the ? and ' ' is the other logical
|
||||
// // to see if it's on. If on, just use col and/or row as defined. Otherwise use
|
||||
// // value between = and |.
|
||||
// int sindx2 = token.IndexOf(" ", qindx);
|
||||
// string logcheck = token.Substring(qindx + 1, sindx2 - qindx - 1);
|
||||
// if (PgLogicals.ContainsKey(logcheck))
|
||||
// {
|
||||
// int bindx = token.IndexOf("|", indx);
|
||||
// string newval = token.Substring(sindx2 + 1, bindx - sindx2 - 1);
|
||||
// float col = pageItem.Col ?? 0;
|
||||
// if (newval.ToUpper().Contains("COL"))
|
||||
// {
|
||||
// col = System.Convert.ToInt32(newval.Substring(4));
|
||||
// }
|
||||
// svgGroup.Add(PageItemToSvgText(pageItem.Token, pageItem.Row ?? 0, col, pageItem.Justify ?? VEPROMS.CSLA.Library.E_Justify.PSLeft, pageItem.Font, plstr, MySection));
|
||||
// plstr = ""; // clear so it doesn't get added twice, i.e. in the method that calls this.
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
if (token.Contains(@"RO-"))
|
||||
{
|
||||
plstr = token.Replace("{","").Replace("}","");
|
||||
@ -1820,7 +1870,18 @@ namespace Volian.Print.Library
|
||||
if (qindx == -1)
|
||||
{
|
||||
val = procConfig.GetValue("PSI", token.Substring(4, token.Length - 5));
|
||||
plstr = plstr.Replace(token, val);
|
||||
|
||||
// MaxWidth is used to define width that the PSI text spans x-direction on page. If it is
|
||||
// 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)
|
||||
{
|
||||
int locwid = (int)pageItem.MaxWidth;
|
||||
AdjustTopMarginForMultiLinePageListItems = SplitTextMaxWidth(svgGroup, pageItem, val, locwid, token, ref plstr);
|
||||
}
|
||||
else
|
||||
plstr = plstr.Replace(token, val);
|
||||
//svgGroup.Add(PageItemToSvgText(pageItem, plstr, MySection));
|
||||
}
|
||||
else
|
||||
@ -1862,7 +1923,30 @@ namespace Volian.Print.Library
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
//The following code is to be used for Folder & DocVersion specific information.
|
||||
//It was commented out to put on other code, but should be uncommented for specific information.
|
||||
//private string GetInheritedSIValue(ProcedureInfo pi, string fieldName)
|
||||
//{
|
||||
// string val = null;
|
||||
// DocVersionConfig dvConfig = new DocVersionConfig(pi.MyDocVersion.Config);
|
||||
// if (dvConfig != null)
|
||||
// {
|
||||
// val = dvConfig.GetValue("SI", fieldName);
|
||||
// if (val != null && val != "") return val; // the value exists within the docversion level
|
||||
// }
|
||||
// FolderInfo fi = pi.MyDocVersion.MyFolder;
|
||||
// while (fi != null)
|
||||
// {
|
||||
// FolderConfig folderConfig = new FolderConfig(fi.Config);
|
||||
// if (folderConfig != null)
|
||||
// {
|
||||
// val = folderConfig.GetValue("SI", fieldName);
|
||||
// if (val != null && val != "") return val; // the value exists within this folder
|
||||
// }
|
||||
// fi = fi.ActiveParent as FolderInfo;
|
||||
// }
|
||||
// return val;
|
||||
//}
|
||||
private static ItemInfo ValveGetFirstStep(VEPROMS.CSLA.Library.SectionInfo section)
|
||||
{
|
||||
ItemInfo firstHigh = null;
|
||||
@ -1899,7 +1983,32 @@ namespace Volian.Print.Library
|
||||
svgGroup.Add(new SvgImage(new System.Drawing.PointF(x, y), new System.Drawing.SizeF(w, h),
|
||||
System.Windows.Forms.Application.StartupPath + @"\Resources\" + figure));
|
||||
}
|
||||
|
||||
private float SplitTextMaxWidth(SvgGroup svgGroup, VEPROMS.CSLA.Library.PageItem pageItem, string title, int? len, string match, ref string plstr)
|
||||
{
|
||||
List<string> titleLines = Volian.Base.Library.RtfTools.SplitText(title, (int)len);
|
||||
float yOffset = 0;
|
||||
int cnt = 0;
|
||||
foreach (string line in titleLines)
|
||||
{
|
||||
cnt++;
|
||||
if (cnt == 1 && yOffset == 0)
|
||||
plstr = plstr.Replace(match, line);
|
||||
else
|
||||
{
|
||||
if (cnt == 1)
|
||||
{
|
||||
plstr = plstr.Replace(match, line); // include preceeding text with the first line v.c. summer
|
||||
svgGroup.Add(PageItemToSvgText(pageItem, plstr, yOffset));
|
||||
plstr = "";
|
||||
}
|
||||
else
|
||||
svgGroup.Add(PageItemToSvgText(pageItem, line, yOffset));
|
||||
plstr = plstr.Replace(match, "");
|
||||
}
|
||||
yOffset += (float)((pageItem.Font.Size > 14) ? pageItem.Font.Size : 12);
|
||||
}
|
||||
return Math.Max(0, yOffset);
|
||||
}
|
||||
private string SplitTitle(SvgGroup svgGroup, VEPROMS.CSLA.Library.PageItem pageItem, string title, int? len, string match, string plstr)
|
||||
{
|
||||
if (match == "{PROCTITLE2}" || match == "[PROCTITLE2]") return plstr.Replace(match, "");
|
||||
|
Loading…
x
Reference in New Issue
Block a user