Support for background print output; fix printlevel for tab formatting (‘.’ Vs ‘)’);

This commit is contained in:
Kathy Ruffing 2013-09-25 16:07:00 +00:00
parent 7cbe3f651f
commit a65ca24837

View File

@ -393,7 +393,12 @@ namespace VEPROMS.CSLA.Library
tmpInfo.RefreshItemParts(); tmpInfo.RefreshItemParts();
} }
} }
private string _HighLevelStepTabPageList = null;
public string HighLevelStepTabPageList
{
get { return _HighLevelStepTabPageList; }
set { _HighLevelStepTabPageList = value; }
}
private bool _NewTransToUnNumberedItem = false; private bool _NewTransToUnNumberedItem = false;
public bool NewTransToUnNumberedItem public bool NewTransToUnNumberedItem
{ {
@ -514,7 +519,7 @@ namespace VEPROMS.CSLA.Library
{ {
if (_PrintLevel != 0) return _PrintLevel; if (_PrintLevel != 0) return _PrintLevel;
int _PrintBias = 0; int _PrintBias = 0;
_PrintLevel = GetStepLevel(ref _PrintBias); _PrintLevel = GetStepLevel(); //ref _PrintBias);
return _PrintLevel; return _PrintLevel;
} }
@ -2423,7 +2428,7 @@ namespace VEPROMS.CSLA.Library
_MyTab.Text = ""; _MyTab.Text = "";
_MyTab.CleanText = ""; _MyTab.CleanText = "";
return; return;
} }
int stepType = (int)(MyContent.Type % 10000); int stepType = (int)(MyContent.Type % 10000);
string tbformat = IsInRNO ? FormatStepData.TabData.RNOIdentPrint : FormatStepData.TabData.IdentPrint; string tbformat = IsInRNO ? FormatStepData.TabData.RNOIdentPrint : FormatStepData.TabData.IdentPrint;
if (ActiveFormat.Name.ToUpper() == "WCNCKL" || ActiveFormat.Name.ToUpper() == "WSTCKL") if (ActiveFormat.Name.ToUpper() == "WCNCKL" || ActiveFormat.Name.ToUpper() == "WSTCKL")
@ -2435,8 +2440,8 @@ namespace VEPROMS.CSLA.Library
{ {
if (tbformat.Contains("{LNK C/N Num}")) if (tbformat.Contains("{LNK C/N Num}"))
{ {
tbformat = tbformat.Replace("{LNK C/N Num}", Ordinal.ToString() + ":"); tbformat = tbformat.Replace("{LNK C/N Num}", Ordinal.ToString());
tbformat = tbformat.Replace("{LNK Step Num}", ""); //(ActiveParent as ItemInfo).Ordinal.ToString() + ":"); tbformat = tbformat.Replace("{LNK Step Num}", (ActiveParent as ItemInfo).Ordinal.ToString());
tbformat = tbformat.TrimStart(" ".ToCharArray()); tbformat = tbformat.TrimStart(" ".ToCharArray());
} }
if (tbformat.Contains("{LNK Step Num}")) if (tbformat.Contains("{LNK Step Num}"))
@ -2451,7 +2456,7 @@ namespace VEPROMS.CSLA.Library
{ {
_MyTab.CleanText = ((ItemInfo)ActiveParent).MyTab.CleanText; _MyTab.CleanText = ((ItemInfo)ActiveParent).MyTab.CleanText;
_MyTab.Text = ((ItemInfo)ActiveParent).MyTab.Text; _MyTab.Text = ((ItemInfo)ActiveParent).MyTab.Text;
_MyTab.RNOTabWidthAdjust = ((ItemInfo)ActiveParent).FormatStepData.TabData.RNOAdjustTabSize??0; _MyTab.RNOTabWidthAdjust = ((ItemInfo)ActiveParent).FormatStepData.TabData.RNOAdjustTabSize ?? 0;
if (((ItemInfo)ActiveParent).FormatStepData.TabData.RNOExcludeMacros) if (((ItemInfo)ActiveParent).FormatStepData.TabData.RNOExcludeMacros)
_MyTab.Text = Regex.Replace(_MyTab.Text, "{!.+?}", " "); _MyTab.Text = Regex.Replace(_MyTab.Text, "{!.+?}", " ");
if (((ItemInfo)ActiveParent).FormatStepData.TabData.RNOIdentPrint.Contains("{asterisk}")) if (((ItemInfo)ActiveParent).FormatStepData.TabData.RNOIdentPrint.Contains("{asterisk}"))
@ -2470,7 +2475,6 @@ namespace VEPROMS.CSLA.Library
_MyTab.CleanText = ""; _MyTab.CleanText = "";
return; return;
} }
// account for metasection indenting/tabbing in the 'PrintLevel', i.e. if we have metasection, we may be in // account for metasection indenting/tabbing in the 'PrintLevel', i.e. if we have metasection, we may be in
// a subsection. Index into the seqtabs array has to account for metasection level. // a subsection. Index into the seqtabs array has to account for metasection level.
int localPrintLevel = PrintLevel; int localPrintLevel = PrintLevel;
@ -2478,21 +2482,20 @@ namespace VEPROMS.CSLA.Library
bool doMeta = false; bool doMeta = false;
if (sd.StepSectionLayoutData.TieTabToLevel && ActiveFormat.PlantFormat.FormatData.SectData.UseMetaSections) if (sd.StepSectionLayoutData.TieTabToLevel && ActiveFormat.PlantFormat.FormatData.SectData.UseMetaSections)
{ {
if (sd.StepSectionLayoutData.ShowSectionTitles if (sd.StepSectionLayoutData.ShowSectionTitles
&& !MyDocStyle.CancelSectTitle && !MyDocStyle.CancelSectTitle
&& !(MyDocStyle.SpecialStepsFoldout && MyDocStyle.UseColSByLevel)) && !(MyDocStyle.SpecialStepsFoldout && MyDocStyle.UseColSByLevel))
localPrintLevel = PrintLevel + CurrentSectionLevel(); localPrintLevel = PrintLevel + CurrentSectionLevel();
doMeta = true; doMeta = true;
} }
SeqTabFmtList seqtabs = ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.SeqTabFmtList; SeqTabFmtList seqtabs = ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.SeqTabFmtList;
// Start with basic cases of alpha/numeric/seq: // Start with basic cases of alpha/numeric/seq:
// If we have metasections AND... // If we have metasections AND...
// If the seqtabs for this given level does not get a section number, use the seqtab rather than // If the seqtabs for this given level does not get a section number, use the seqtab rather than
// the ident of the step: // the ident of the step:
bool useSubStepTabs = false; bool useSubStepTabs = false;
if (doMeta && IsHigh if (doMeta && IsHigh
&& !seqtabs[(localPrintLevel<0?0:localPrintLevel) % seqtabs.Count].TabToken.Contains("{numericWpar}") && !seqtabs[(localPrintLevel < 0 ? 0 : localPrintLevel) % seqtabs.Count].TabToken.Contains("{numericWpar}")
&& tbformat.Contains("{")) useSubStepTabs = true; && tbformat.Contains("{")) useSubStepTabs = true;
// Check to be sure the parent tab should be included... If this sequential is within a note // Check to be sure the parent tab should be included... If this sequential is within a note
@ -2512,11 +2515,11 @@ namespace VEPROMS.CSLA.Library
tbformat = (lv == 0) ? "{numeric}." : "{alpha}."; tbformat = (lv == 0) ? "{numeric}." : "{alpha}.";
} }
bool trimTabStart = false; bool trimTabStart = false;
if (useSubStepTabs || tbformat.IndexOf("{seq}") > -1) if (useSubStepTabs || tbformat.IndexOf("{seq}") > -1)
{ {
int itmp = (localPrintLevel + PrintBias + OffsetTab) % seqtabs.Count; int itmp = (localPrintLevel + PrintBias + OffsetTab) % seqtabs.Count;
if (!tbformat.Contains(@"{!C")) if (!tbformat.Contains(@"{!C"))
tbformat = seqtabs[itmp].PrintTabFormat; // seqtab in 16bit, i.e. '. or )' etc. tbformat = seqtabs[itmp].PrintTabFormat; // seqtab in 16bit, i.e. '. or )' etc.
else else
tbformat = tbformat.Replace("{seq}", seqtabs[itmp].PrintTabFormat); tbformat = tbformat.Replace("{seq}", seqtabs[itmp].PrintTabFormat);
@ -2538,7 +2541,7 @@ namespace VEPROMS.CSLA.Library
// so that when the above code ran to reset the tab, it would crash because the // so that when the above code ran to reset the tab, it would crash because the
// printlevel was not recalculated. // printlevel was not recalculated.
PrintLevel = 0; PrintLevel = 0;
// If token includes 'Wpar', the parent tab prefix's the tab. // If token includes 'Wpar', the parent tab prefix's the tab.
if (localPrintLevel > 0 && (tbformat.IndexOf("{numericWpar}") > -1 || tbformat.IndexOf("{alphaWpar}") > -1 || tbformat.IndexOf("{ALPHAWpar}") > -1)) if (localPrintLevel > 0 && (tbformat.IndexOf("{numericWpar}") > -1 || tbformat.IndexOf("{alphaWpar}") > -1 || tbformat.IndexOf("{ALPHAWpar}") > -1))
{ {
@ -2562,13 +2565,13 @@ namespace VEPROMS.CSLA.Library
// If the document style has the flag DSS_UnNumLikeRoman, don't do the normal tab, change to alpha, // 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 // 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. // 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) if (!IsHigh && tbformat != null && tbformat != "" && (MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_UnNumLikeRoman) == E_DocStructStyle.DSS_UnNumLikeRoman)
tbformat = "{alpha}. "; tbformat = "{alpha}. ";
if (tbformat.IndexOf("#2#") > -1) if (tbformat.IndexOf("#2#") > -1)
{ {
int indxlb = tbformat.IndexOf("#"); int indxlb = tbformat.IndexOf("#");
string ofst = tbformat.Substring(indxlb+1, 3); string ofst = tbformat.Substring(indxlb + 1, 3);
_MyTab.Offset = Convert.ToInt32(ofst.Substring(0, 1)) * (int)FormatStepData.TabData.Font.CPI; _MyTab.Offset = Convert.ToInt32(ofst.Substring(0, 1)) * (int)FormatStepData.TabData.Font.CPI;
tbformat = tbformat.Replace("#2#", ""); tbformat = tbformat.Replace("#2#", "");
} }
@ -2576,9 +2579,9 @@ namespace VEPROMS.CSLA.Library
{ {
int begPos = tbformat.IndexOf("{Pos"); int begPos = tbformat.IndexOf("{Pos");
int endPos = tbformat.IndexOf("}"); int endPos = tbformat.IndexOf("}");
string ofst = tbformat.Substring(begPos + 4, endPos-begPos-4); string ofst = tbformat.Substring(begPos + 4, endPos - begPos - 4);
_MyTab.Position = -(Convert.ToInt32(ofst) * (int)FormatStepData.TabData.Font.CPI); _MyTab.Position = -(Convert.ToInt32(ofst) * (int)FormatStepData.TabData.Font.CPI);
tbformat = tbformat.Remove(begPos,endPos+1); tbformat = tbformat.Remove(begPos, endPos + 1);
} }
// if this is a caution/note type determine where 'NOTE/CAUTION' tab goes, as tab or as 'header' // if this is a caution/note type determine where 'NOTE/CAUTION' tab goes, as tab or as 'header'
// and also determine whether the tab itself gets converted to a bullet. // and also determine whether the tab itself gets converted to a bullet.
@ -2602,13 +2605,13 @@ namespace VEPROMS.CSLA.Library
string roman = RomanNumbering(ordinal); string roman = RomanNumbering(ordinal);
tbformat = tbformat.Replace("{roman}", roman.ToLower()); tbformat = tbformat.Replace("{roman}", roman.ToLower());
tbformat = tbformat.Replace("{ROMAN}", roman); tbformat = tbformat.Replace("{ROMAN}", roman);
tbformat = tbformat.Replace("{numeric}", trimTabStart ? ordinal.ToString() : FormatStepData.AtLeastTwoDigits ? ordinal.ToString().PadLeft(2,'0') : ordinal.ToString().PadLeft(2)); tbformat = tbformat.Replace("{numeric}", trimTabStart ? ordinal.ToString() : FormatStepData.AtLeastTwoDigits ? ordinal.ToString().PadLeft(2, '0') : ordinal.ToString().PadLeft(2));
tbformat = tbformat.Replace("{numericWpar}", ordinal.ToString()); tbformat = tbformat.Replace("{numericWpar}", ordinal.ToString());
if (tbformat.Contains("{asterisk}")) if (tbformat.Contains("{asterisk}"))
{ {
// if this has a checkoff - need to set location of the asterisk - because the asterisk has to come before // if this has a checkoff - need to set location of the asterisk - because the asterisk has to come before
// the checkoff. Otherwise, it doesn't matter // the checkoff. Otherwise, it doesn't matter
_MyTab.AsteriskOffset = - 10; _MyTab.AsteriskOffset = -10;
tbformat = tbformat.Replace("{asterisk}", ""); // the asteriskoffset flags a '*' to be printed at xloc - this. tbformat = tbformat.Replace("{asterisk}", ""); // the asteriskoffset flags a '*' to be printed at xloc - this.
} }
int macroindx = tbformat.IndexOf("{!C"); int macroindx = tbformat.IndexOf("{!C");
@ -2624,7 +2627,7 @@ namespace VEPROMS.CSLA.Library
{ {
// check if there is font information for the separator, use it. If not use the font information // check if there is font information for the separator, use it. If not use the font information
// that is associated with the tab. // that is associated with the tab.
VE_Font hdrFont = ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.Separator == null ? null : VE_Font hdrFont = ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.Separator == null ? null :
ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.Separator.Font; ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.Separator.Font;
if (hdrFont == null) hdrFont = FormatStepData.TabData.Font; if (hdrFont == null) hdrFont = FormatStepData.TabData.Font;
if (_MyHeader == null) _MyHeader = new MetaTag(hdrFont); if (_MyHeader == null) _MyHeader = new MetaTag(hdrFont);
@ -2635,20 +2638,7 @@ namespace VEPROMS.CSLA.Library
_MyHeader.Justify = ContentAlignment.MiddleCenter; _MyHeader.Justify = ContentAlignment.MiddleCenter;
} }
#region Non Converted Plants tab TODO #region Non Converted Plants tab TODO
// other possible 'tokens'
// Position offset - do this one here, so don't get background substitution below..
// ##-3# - Offset of -3 from Parent (FNP)
// "{Pos-3}"
// Background/Deviation Documents - check for E_PurchaseOptions.(ENHANCEDBACKGROUNDS or ENHANCEDDEVIATIONS)
// # - Related Caution or Note number
// ~ - Linked Step Number
//"{LNK C/N Num}"
//"{LNK Step Num}"
// Position offset // Position offset
// \257 - Indent (CALLOWAY BACKGROUNDS)
// Newline within a tab (calbck)
//"{indent}"); //"{indent}");
//"{par}"); //"{par}");
@ -2664,9 +2654,22 @@ namespace VEPROMS.CSLA.Library
//wkstr = Regex.Replace(wkstr, @"{![.*?]}", @"{!$1}"); //wkstr = Regex.Replace(wkstr, @"{![.*?]}", @"{!$1}");
//wkstr = wkstr.Replace("{}", ""); //wkstr = wkstr.Replace("{}", "");
//if (vefont != null && vefont.HasCircleString2()) wkstr.Insert(0,"{!C0}"); //if (vefont != null && vefont.HasCircleString2()) wkstr.Insert(0,"{!C0}");
//wkstr = wkstr.Replace("ê", @"{Box Step}"); //wkstr = wkstr.Replace("ê", @"{Box Step}");
#endregion #endregion
// if this has an alternate tab, use it. These have been used in background documents.
if (!IsSection && FormatStepData.TabData.IdentAltPrint != null && FormatStepData.TabData.IdentAltPrint != "")
{
string newtab = null;
int indxnewtab = FormatStepData.TabData.IdentAltPrint.LastIndexOf('\\');
if (indxnewtab >= 0)
{
newtab = FormatStepData.TabData.IdentAltPrint.Substring(indxnewtab + 1);
// also see if there is the 'pagelist' string in this tab:
HighLevelStepTabPageList = FormatStepData.TabData.IdentAltPrint.Substring(0, indxnewtab) + tbformat;
_MyTab.AltPrintTab = newtab;
}
}
_MyTab.Text = tbformat; _MyTab.Text = tbformat;
_MyTab.CleanText = cltext != null ? cltext : tbformat; _MyTab.CleanText = cltext != null ? cltext : tbformat;
} }
@ -2701,7 +2704,7 @@ namespace VEPROMS.CSLA.Library
return (tbformat.Substring(stindx, tbformat.IndexOf("}")-stindx+1)); return (tbformat.Substring(stindx, tbformat.IndexOf("}")-stindx+1));
} }
public int GetStepLevel(ref int bias) public int GetStepLevel() // ref int bias)
{ {
int level = 0; int level = 0;
ItemInfo par = this; ItemInfo par = this;
@ -2723,7 +2726,7 @@ namespace VEPROMS.CSLA.Library
// level RNOs - unless DontOffsetTab format flag is set // level RNOs - unless DontOffsetTab format flag is set
if (LastRNO != null && LastRNO.IsHigh && TopRNO.FormatStepData.NumberHighLevel && TopRNO.FormatStepData.OffsetTab) if (LastRNO != null && LastRNO.IsHigh && TopRNO.FormatStepData.NumberHighLevel && TopRNO.FormatStepData.OffsetTab)
OffsetTab = TopRNO.FormatStepData.NumberHighLevel?1:0; OffsetTab = TopRNO.FormatStepData.NumberHighLevel?1:0;
bias = 0; _PrintBias = 0;
if (par.FormatStepData != null && par.FormatStepData.TabData.IdentPrint.Contains("{ALPHA}")) if (par.FormatStepData != null && par.FormatStepData.TabData.IdentPrint.Contains("{ALPHA}"))
level--; level--;
@ -2736,7 +2739,7 @@ namespace VEPROMS.CSLA.Library
level++; // 16bit has this: I didn't and mine worked most of time. level++; // 16bit has this: I didn't and mine worked most of time.
if (ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ImperfectStructurePlus4) level += 2; if (ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ImperfectStructurePlus4) level += 2;
if (ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ImperfectSubstep && !ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ImperfectStructurePlus4) if (ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ImperfectSubstep && !ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ImperfectStructurePlus4)
bias = -1; PrintBias = -1;
} }
// ImperfectStructure for substeps - only good for level 1 RNOs // ImperfectStructure for substeps - only good for level 1 RNOs
else if (ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ImperfectSubstep && RNOLevel == 1) else if (ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ImperfectSubstep && RNOLevel == 1)
@ -2753,7 +2756,7 @@ namespace VEPROMS.CSLA.Library
{ {
level++; level++;
if (ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ImperfectStructurePlus4) level += 1; if (ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ImperfectStructurePlus4) level += 1;
if (!ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ImperfectStructurePlus4) bias = -1; if (!ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ImperfectStructurePlus4) PrintBias = -1;
} }
} }
} }
@ -3334,6 +3337,12 @@ namespace VEPROMS.CSLA.Library
} }
public class Tab : MetaTag public class Tab : MetaTag
{ {
private string _AltPrintTab = null;
public string AltPrintTab
{
get { return _AltPrintTab; }
set { _AltPrintTab = value; }
}
private bool _RemovedStyleUnderline = false; private bool _RemovedStyleUnderline = false;
public bool RemovedStyleUnderline public bool RemovedStyleUnderline
{ {