From a65ca24837683629ec6c8f9576b45c611a44d43c Mon Sep 17 00:00:00 2001 From: Kathy Date: Wed, 25 Sep 2013 16:07:00 +0000 Subject: [PATCH] =?UTF-8?q?Support=20for=20background=20print=20output;=20?= =?UTF-8?q?fix=20printlevel=20for=20tab=20formatting=20(=E2=80=98.?= =?UTF-8?q?=E2=80=99=20Vs=20=E2=80=98)=E2=80=99);?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../VEPROMS.CSLA.Library/Extension/ItemExt.cs | 93 ++++++++++--------- 1 file changed, 51 insertions(+), 42 deletions(-) diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index 31b5a661..8bfe2c08 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -393,7 +393,12 @@ namespace VEPROMS.CSLA.Library tmpInfo.RefreshItemParts(); } } - + private string _HighLevelStepTabPageList = null; + public string HighLevelStepTabPageList + { + get { return _HighLevelStepTabPageList; } + set { _HighLevelStepTabPageList = value; } + } private bool _NewTransToUnNumberedItem = false; public bool NewTransToUnNumberedItem { @@ -514,7 +519,7 @@ namespace VEPROMS.CSLA.Library { if (_PrintLevel != 0) return _PrintLevel; int _PrintBias = 0; - _PrintLevel = GetStepLevel(ref _PrintBias); + _PrintLevel = GetStepLevel(); //ref _PrintBias); return _PrintLevel; } @@ -2423,7 +2428,7 @@ namespace VEPROMS.CSLA.Library _MyTab.Text = ""; _MyTab.CleanText = ""; return; - } + } int stepType = (int)(MyContent.Type % 10000); string tbformat = IsInRNO ? FormatStepData.TabData.RNOIdentPrint : FormatStepData.TabData.IdentPrint; if (ActiveFormat.Name.ToUpper() == "WCNCKL" || ActiveFormat.Name.ToUpper() == "WSTCKL") @@ -2435,8 +2440,8 @@ namespace VEPROMS.CSLA.Library { if (tbformat.Contains("{LNK C/N Num}")) { - tbformat = tbformat.Replace("{LNK C/N Num}", Ordinal.ToString() + ":"); - tbformat = tbformat.Replace("{LNK Step Num}", ""); //(ActiveParent as ItemInfo).Ordinal.ToString() + ":"); + tbformat = tbformat.Replace("{LNK C/N Num}", Ordinal.ToString()); + tbformat = tbformat.Replace("{LNK Step Num}", (ActiveParent as ItemInfo).Ordinal.ToString()); tbformat = tbformat.TrimStart(" ".ToCharArray()); } if (tbformat.Contains("{LNK Step Num}")) @@ -2451,7 +2456,7 @@ namespace VEPROMS.CSLA.Library { _MyTab.CleanText = ((ItemInfo)ActiveParent).MyTab.CleanText; _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) _MyTab.Text = Regex.Replace(_MyTab.Text, "{!.+?}", " "); if (((ItemInfo)ActiveParent).FormatStepData.TabData.RNOIdentPrint.Contains("{asterisk}")) @@ -2470,7 +2475,6 @@ namespace VEPROMS.CSLA.Library _MyTab.CleanText = ""; return; } - // 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. int localPrintLevel = PrintLevel; @@ -2478,21 +2482,20 @@ namespace VEPROMS.CSLA.Library bool doMeta = false; if (sd.StepSectionLayoutData.TieTabToLevel && ActiveFormat.PlantFormat.FormatData.SectData.UseMetaSections) { - if (sd.StepSectionLayoutData.ShowSectionTitles - && !MyDocStyle.CancelSectTitle - && !(MyDocStyle.SpecialStepsFoldout && MyDocStyle.UseColSByLevel)) - localPrintLevel = PrintLevel + CurrentSectionLevel(); - doMeta = true; + if (sd.StepSectionLayoutData.ShowSectionTitles + && !MyDocStyle.CancelSectTitle + && !(MyDocStyle.SpecialStepsFoldout && MyDocStyle.UseColSByLevel)) + localPrintLevel = PrintLevel + CurrentSectionLevel(); + doMeta = true; } SeqTabFmtList seqtabs = ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.SeqTabFmtList; // Start with basic cases of alpha/numeric/seq: // If we have metasections AND... // If the seqtabs for this given level does not get a section number, use the seqtab rather than // the ident of the step: - bool useSubStepTabs = false; 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; // 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}."; } bool trimTabStart = false; - + if (useSubStepTabs || tbformat.IndexOf("{seq}") > -1) { 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. else 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 // printlevel was not recalculated. PrintLevel = 0; - + // 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)) { @@ -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, // 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. - 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}. "; if (tbformat.IndexOf("#2#") > -1) { 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; tbformat = tbformat.Replace("#2#", ""); } @@ -2576,9 +2579,9 @@ namespace VEPROMS.CSLA.Library { int begPos = tbformat.IndexOf("{Pos"); 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); - 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' // and also determine whether the tab itself gets converted to a bullet. @@ -2602,13 +2605,13 @@ namespace VEPROMS.CSLA.Library string roman = RomanNumbering(ordinal); tbformat = tbformat.Replace("{roman}", roman.ToLower()); 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()); if (tbformat.Contains("{asterisk}")) { // 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 - _MyTab.AsteriskOffset = - 10; + _MyTab.AsteriskOffset = -10; tbformat = tbformat.Replace("{asterisk}", ""); // the asteriskoffset flags a '*' to be printed at xloc - this. } 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 // 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; if (hdrFont == null) hdrFont = FormatStepData.TabData.Font; if (_MyHeader == null) _MyHeader = new MetaTag(hdrFont); @@ -2635,20 +2638,7 @@ namespace VEPROMS.CSLA.Library _MyHeader.Justify = ContentAlignment.MiddleCenter; } #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 - // \257 - Indent (CALLOWAY BACKGROUNDS) - // Newline within a tab (calbck) //"{indent}"); //"{par}"); @@ -2664,9 +2654,22 @@ namespace VEPROMS.CSLA.Library //wkstr = Regex.Replace(wkstr, @"{![.*?]}", @"{!$1}"); //wkstr = wkstr.Replace("{}", ""); //if (vefont != null && vefont.HasCircleString2()) wkstr.Insert(0,"{!C0}"); - //wkstr = wkstr.Replace("ê", @"{Box Step}"); #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.CleanText = cltext != null ? cltext : tbformat; } @@ -2701,7 +2704,7 @@ namespace VEPROMS.CSLA.Library return (tbformat.Substring(stindx, tbformat.IndexOf("}")-stindx+1)); } - public int GetStepLevel(ref int bias) + public int GetStepLevel() // ref int bias) { int level = 0; ItemInfo par = this; @@ -2723,7 +2726,7 @@ namespace VEPROMS.CSLA.Library // level RNOs - unless DontOffsetTab format flag is set if (LastRNO != null && LastRNO.IsHigh && TopRNO.FormatStepData.NumberHighLevel && TopRNO.FormatStepData.OffsetTab) OffsetTab = TopRNO.FormatStepData.NumberHighLevel?1:0; - bias = 0; + _PrintBias = 0; if (par.FormatStepData != null && par.FormatStepData.TabData.IdentPrint.Contains("{ALPHA}")) level--; @@ -2736,7 +2739,7 @@ namespace VEPROMS.CSLA.Library 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.ImperfectSubstep && !ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ImperfectStructurePlus4) - bias = -1; + PrintBias = -1; } // ImperfectStructure for substeps - only good for level 1 RNOs else if (ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ImperfectSubstep && RNOLevel == 1) @@ -2753,7 +2756,7 @@ namespace VEPROMS.CSLA.Library { level++; 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 { + private string _AltPrintTab = null; + public string AltPrintTab + { + get { return _AltPrintTab; } + set { _AltPrintTab = value; } + } private bool _RemovedStyleUnderline = false; public bool RemovedStyleUnderline {