This commit is contained in:
Kathy Ruffing 2012-06-26 15:30:07 +00:00
parent 1b3df2e536
commit 7bbf10f8f0

View File

@ -91,7 +91,10 @@ namespace Volian.Print.Library
}
Add(para);
// para.YBottomMost will have y for bottom of any substeps that are also enclosed in the box.
yoff = para.YBottomMost;
if (childItemInfo.IsStep && childItemInfo.MyHLS.FormatStepData.UseSmartTemplate && para.ChildrenBelow.Count>0 && para.ChildrenBelow[0].YBottomMost > para.YBottomMost)
yoff = para.ChildrenBelow[0].YBottomMost;
else
yoff = para.YBottomMost;
if (childItemInfo.FormatStepData != null && childItemInfo.FormatStepData.BoxIt)
{
box.Height = yoff - box.YOffset - (1.1F * vlnPrintObject.SixLinesPerInch);
@ -655,6 +658,7 @@ namespace Volian.Print.Library
private int COL_WID_ADJ = 6; // adjusts for incorrect use of WidSTable when breaking a line (it breaks 6 chars too short)
public vlnParagraph(vlnParagraph parent, PdfContentByte cb, ItemInfo itemInfo, float xoff, float yoff, int rnoLevel, int maxRNO, FormatInfo formatInfo)
{
float savCheckListBottomMost = 0;
//int[] problemIDs = { 889 };
//List<int> lProblemIDs = new List<int>(problemIDs);
//if (lProblemIDs.Contains(itemInfo.ItemID))
@ -694,8 +698,9 @@ namespace Volian.Print.Library
if (itemInfo.MyParent.IsCaution || itemInfo.MyParent.IsNote)
XOffset += 72 * (itemInfo.FormatStepData.CautionOrNoteSubstepIndent == null ? 0 : (float)itemInfo.FormatStepData.CautionOrNoteSubstepIndent / (float)itemInfo.FormatStepData.Font.CPI);
// research a better way - maybe add an xml tag or check printident vs editident:
if (MyItemInfo.ActiveFormat.Name == "WCNCKL" && (MyItemInfo.MyContent.Type == 20031 || MyItemInfo.MyContent.Type == 20030 || MyItemInfo.MyContent.Type == 20035))
if (itemInfo.IsStep && itemInfo.MyHLS.FormatStepData.UseSmartTemplate &&
itemInfo.FormatStepData.StepLayoutData.AlignWithParentTab
|| (itemInfo.Steps != null && itemInfo.Steps.Count > 0 && itemInfo.Steps[0].FormatStepData.StepLayoutData.AlignWithParentTab))
itemInfo.MyTab = null;
if (itemInfo.MyTab != null && itemInfo.MyTab.Text != null && itemInfo.MyTab.Text != "")
{
@ -717,7 +722,22 @@ namespace Volian.Print.Library
{
float offset = (float)itemInfo.MyDocStyle.Layout.LeftMargin;
if (formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Pos != null)
offset += (float)formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Pos;
{
// determine level of metasections. This level will be used to calculate the
// indent. DO I NEED THIS HERE????
int level = 0;
ItemInfo iilvl = itemInfo;
while (!iilvl.IsProcedure)
{
level++;
iilvl = iilvl.MyParent;
}
level = level <= 2 ? 1 : level - 1;
if (level == 1)
offset += (float)formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Pos;
else
offset += (level-1) * ((float)formatInfo.PlantFormat.FormatData.SectData.SectionHeader.Pos-(float)formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Pos);
}
localXOffset = offset;
}
}
@ -774,6 +794,7 @@ namespace Volian.Print.Library
}
else if (itemInfo.IsFigure) // if a figure we've got to determine the size:
{
string erMsg = null;
if (itemInfo.MyContent.Text != null)
{
ProcedureInfo proc = itemInfo.MyProcedure;
@ -781,37 +802,42 @@ namespace Volian.Print.Library
ROFstInfo rofst = dvi.DocVersionAssociations[0].MyROFst;
ROFSTLookup lookup = rofst.ROFSTLookup;
string linkInfoText = itemInfo.MyContent.Text.Replace(@"\v ", "");
Match m = Regex.Match(linkInfoText, @"(.*)[#]Link:([A-Za-z]*):(.*)");
string[] subs = m.Groups[3].Value.Split(" ".ToCharArray());
string roid = subs[1];
string val = lookup.GetRoValue(subs[1]);
if (val == null) val = lookup.GetRoValue(subs[1].Substring(0, 12));
if (val != null)
if (linkInfoText.Contains("?"))
erMsg = "RO was not found during data migration.";
else
{
string[] vals = val.Split("\n".ToCharArray());
Width = Int32.Parse(vals[3], System.Globalization.NumberStyles.AllowHexSpecifier) * MyItemInfo.FormatStepData.Font.CharsToTwips;
int lines = Int32.Parse(vals[2], System.Globalization.NumberStyles.AllowHexSpecifier);
Height = lines * SixLinesPerInch;
//yForCheckoff = yoff + Height - SixLinesPerInch;
if (dropCheckoff)
yForCheckoff += Height - SixLinesPerInch; // place checkoff on last row of text
yoff += (Height + (2 * SixLinesPerInch));
string erMsg = null;
try
Match m = Regex.Match(linkInfoText, @"(.*)[#]Link:([A-Za-z]*):(.*)");
string[] subs = m.Groups[3].Value.Split(" ".ToCharArray());
string roid = subs[1];
string val = lookup.GetRoValue(subs[1]);
if (val == null) val = lookup.GetRoValue(subs[1].Substring(0, 12));
if (val != null)
{
ROImageInfo roImage = ROImageInfo.GetByROFstID_FileName(rofst.ROFstID, vals[0]);
if (roImage != null)
ImageText = val;
else
erMsg = string.Format("Image {0} does not exist.", vals[0]);
}
string[] vals = val.Split("\n".ToCharArray());
Width = Int32.Parse(vals[3], System.Globalization.NumberStyles.AllowHexSpecifier) * MyItemInfo.FormatStepData.Font.CharsToTwips;
int lines = Int32.Parse(vals[2], System.Globalization.NumberStyles.AllowHexSpecifier);
Height = lines * SixLinesPerInch;
//yForCheckoff = yoff + Height - SixLinesPerInch;
if (dropCheckoff)
yForCheckoff += Height - SixLinesPerInch; // place checkoff on last row of text
yoff += (Height + (2 * SixLinesPerInch));
catch (Exception ex)
{
erMsg = string.Format("Image {0} does not exist, error = {1}.", vals[0], ex.Message);
try
{
ROImageInfo roImage = ROImageInfo.GetByROFstID_FileName(rofst.ROFstID, vals[0]);
if (roImage != null)
ImageText = val;
else
erMsg = string.Format("Image {0} does not exist.", vals[0]);
}
catch (Exception ex)
{
erMsg = string.Format("Image {0} does not exist, error = {1}.", vals[0], ex.Message);
}
}
if (erMsg != null) Rtf = GetRtf(erMsg, itemInfo.ActiveFormat.PlantFormat.FormatData.Font);
}
if (erMsg != null) Rtf = GetRtf(erMsg, itemInfo.ActiveFormat.PlantFormat.FormatData.Font);
CalculateXOffset(itemInfo, maxRNO, formatInfo);
}
}
@ -825,9 +851,10 @@ namespace Volian.Print.Library
Width += 24;
Rtf = Rtf.Replace("{Backspace}", "");
}
if (formatInfo.Name == "WCNCKL")
if (itemInfo.IsStep && itemInfo.MyHLS.FormatStepData.UseSmartTemplate)
{
if (itemInfo.IsStep && (MyItemInfo.MyContent.Type == 20031 || MyItemInfo.MyContent.Type == 20030 || MyItemInfo.MyContent.Type == 20035))
if (itemInfo.FormatStepData.StepLayoutData.AlignWithParentTab
|| (itemInfo.Steps != null && itemInfo.Steps.Count > 0 && itemInfo.Steps[0].FormatStepData.StepLayoutData.AlignWithParentTab))
{
int stplevl = TheStepLevel(itemInfo);
if (stplevl >= 0 && MyItemInfo.MyHLS.FormatStepData.VertPos[stplevl] > 0)
@ -848,17 +875,27 @@ namespace Volian.Print.Library
SectionConfig sc = itemInfo.MyConfig as SectionConfig;
if ((sc != null && sc.Section_PrintHdr == "Y") && itemInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseMetaSections) printMetaHdr = true;
}
// Determine if section title is output
if ((!itemInfo.IsStepSection && MyItemInfo.ActiveFormat.Name != "WCNCKL")
// If WCN 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.FormatStepData.UseSmartTemplate && (TheStepLevel(itemInfo)>0))
{
// do I need to get max of savCheckListBottomMost & (yoff+Height+SixLinesPerInch)
savCheckListBottomMost = yoff + Height + SixLinesPerInch;
}
// 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.FormatStepData.UseSmartTemplate)
|| printMetaHdr ||
(formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ShowSectionTitles
&& !MyItemInfo.MyDocStyle.CancelSectTitle
&& !MyItemInfo.MyDocStyle.SpecialStepsFoldout)
|| (MyItemInfo.ActiveFormat.Name=="WCNCKL" && !MyItemInfo.IsStepSection
&& itemInfo.MyContent.Type != 20031 && itemInfo.MyContent.Type != 20030)) // && itemInfo.MyContent.Type != 20035))
// In WCN Checklist: I don't have children or if I have children the first child doesn't alignwithparent.
|| (!itemInfo.IsStepSection && itemInfo.MyHLS.FormatStepData.UseSmartTemplate
&& ((itemInfo.Steps == null || itemInfo.Steps.Count == 0)
|| !itemInfo.Steps[0].FormatStepData.StepLayoutData.AlignWithParentTab)))
{
yoff += Height;
//yForCheckoff = yoff - SixLinesPerInch;
yoff += AdjustForBlankLines();
if (dropCheckoff)
yForCheckoff += Height - SixLinesPerInch; // place checkoff on last row of text
@ -917,10 +954,15 @@ namespace Volian.Print.Library
yoff += myRnoSep.Height + SixLinesPerInch;
}
YBottomMost = yoff;
// For WCN Checklist, the substeps are in rows of data. The YBottomMost is the bottom most for
// the row.
if (savCheckListBottomMost != 0 && savCheckListBottomMost>YBottomMost) YBottomMost = savCheckListBottomMost;
}
private int TheStepLevel(ItemInfo itemInfo)
{
if (itemInfo.IsHigh) return -1;
int lev = 0;
ItemInfo ii = itemInfo;
while (!ii.MyParent.IsHigh)
@ -1513,7 +1555,20 @@ namespace Volian.Print.Library
if (itemInfo.IsStepSection)
{
if (formatInfo.PlantFormat.FormatData.SectData.SectionHeader.Just == "PSLeft")
XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)formatInfo.PlantFormat.FormatData.SectData.SectionHeader.Pos;
{
int level = 0;
ItemInfo iilvl = itemInfo;
while (!iilvl.IsProcedure)
{
level++;
iilvl = iilvl.MyParent;
}
level = level <= 2 ? 1 : level - 1;
if (level==1)
XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (level * (float)formatInfo.PlantFormat.FormatData.SectData.SectionHeader.Pos);
else
XOffset = (float)formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[level].ColSByLevel;
}
return;
}
int typ = ((int)itemInfo.MyContent.Type) % 10000;
@ -1626,7 +1681,12 @@ namespace Volian.Print.Library
{
int typ = ((int)itemInfo.MyContent.Type) % 10000;
int? bxIndx = itemInfo.IsStep ? formatInfo.PlantFormat.FormatData.StepDataList[typ].StepLayoutData.STBoxindex : null;
float? widOvrd = itemInfo.FormatStepData == null ? null : itemInfo.FormatStepData.WidthOverride;
float? widOvrd = 0;
float xwid = 0;
if (itemInfo.IsStep && itemInfo.MyHLS.FormatStepData.UseSmartTemplate && (xwid = GetWidthFromTemplate(itemInfo, formatInfo))>0)
widOvrd = xwid;
else
widOvrd = itemInfo.FormatStepData == null ? null : itemInfo.FormatStepData.WidthOverride;
if ((widOvrd??0) != 0)
{
Width = (float)widOvrd;
@ -1723,6 +1783,47 @@ namespace Volian.Print.Library
Width = adjwidth + MyParent.Width - tabWidth + (myTab == null ? 0 : myTab.TabAlign);
}
}
private float GetWidthFromTemplate(ItemInfo itemInfo, FormatInfo formatInfo)
{
float rtnwid = 0;
int tpIndx = GetSmartTemplateIndex(itemInfo, itemInfo.MyContent.Type, formatInfo);
if (tpIndx != -1)
{
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;
}
return rtnwid;
}
private int GetSmartTemplateIndex(ItemInfo itemInfo, int? type, FormatInfo formatInfo)
{
int indx = 0;
// find the starting template in the list for the high level step type:
int highType = (int)itemInfo.MyHLS.MyContent.Type-20001;
while (indx < formatInfo.PlantFormat.FormatData.Templates.Count)
{
// level of 0 starts a new group.
if (formatInfo.PlantFormat.FormatData.Templates[indx].level == 0)
{
indx++;
// now see if we're on the high level step type, if so, look under this one
// for the step type that we're on. If found return the index of it.
if (formatInfo.PlantFormat.FormatData.Templates[indx].type == highType)
{
indx++;
while (indx < formatInfo.PlantFormat.FormatData.Templates.Count && formatInfo.PlantFormat.FormatData.Templates[indx].level != 0)
{
if (formatInfo.PlantFormat.FormatData.Templates[indx].type == type - 20001)
return indx;
indx++;
}
}
}
else
indx++;
}
return -1; // didn't find this step type in the template width override list.
}
private float AdjustForSectionLevelTab()
{