From 84d293dc345931ae5113de91632bc6139d25c598 Mon Sep 17 00:00:00 2001 From: Kathy Date: Thu, 16 Jun 2011 10:34:03 +0000 Subject: [PATCH] --- .../Extension/TransitionExt.cs | 25 ++++++++-- .../VEPROMS.CSLA.Library/Format/DocStyles.cs | 48 ++++++++++++++++--- 2 files changed, 64 insertions(+), 9 deletions(-) diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/TransitionExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/TransitionExt.cs index 116b5777..d4ee94be 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/TransitionExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/TransitionExt.cs @@ -378,6 +378,7 @@ namespace VEPROMS.CSLA.Library _AppendMethods.Add("{?.Sect Hdr}", AddOptionalTranGetSectionHdr); _AppendMethods.Add("{Sect Title}", AddTranGetSectionTitle); _AppendMethods.Add("{?.Sect Title}", AddOptionalTranGetSectionTitle); + _AppendMethods.Add("{?.Sect Num}", AddOptionalTranGetSectionNum); _AppendMethods.Add("{Sect Num}", AddTranGetSectionNumber); } public static string GetResolvedText(ItemInfo fromInfo, int tranType, ItemInfo toItem, ItemInfo rangeItem) @@ -417,6 +418,7 @@ namespace VEPROMS.CSLA.Library bool lastAdded = false; while ((index = tb._TransFormat.IndexOf("{", startIndex)) > -1) { + prefix = null; if (index > startIndex) prefix = tb._TransFormat.Substring(startIndex, index - startIndex); if (startIndex == 0 && prefix != null && prefix.Length > 0) { @@ -448,7 +450,6 @@ namespace VEPROMS.CSLA.Library return (tb.ToString()); } - // TODO: TStepNoFlag, i.e. include step number in range items. // TODO: TStepNoFlag, i.e. include step number in range items. // TODO: For hlp: LowerCaseTranNumber - lower case substep numbers in transitions private static bool AddTransitionProcNum(TransitionBuilder tb) // Coded for HLP @@ -458,6 +459,7 @@ namespace VEPROMS.CSLA.Library // LATER: Format Flag TruncateProcNmAfter1stSpace (dropped plants) // LATER: Format Flag HardSpTranProcNumb (active plants) tb.AppendPrefix(); + if (tb._FormatData.TransData.HardSpTranProcNumb) retstr = retstr.Replace(" ", @"\u160?"); tb.ReplaceToken(retstr); return (retstr != null && retstr != ""); } @@ -568,7 +570,7 @@ namespace VEPROMS.CSLA.Library { // check for transition that goes to a procedure step section with title of 'Procedure steps' followed // by ', Step'. This should output as 'Procedure step xyz' rather than 'Procedure steps, step xyz' - if (!tb._TransFormat.Contains("{Last Step}") && tb.Prefix.ToUpper().Contains(", STEP") && tb.ToString().ToUpper().EndsWith("PROCEDURE STEPS")) + if (!tb._TransFormat.Contains("{Last Step}") && tb.Prefix != null && tb.Prefix.ToUpper().Contains(", STEP") && tb.ToString().ToUpper().EndsWith("PROCEDURE STEPS")) { tb.Remove(tb.Length - 15, 15); // remove "procedure steps" tb.Append("procedure Step"); @@ -582,6 +584,12 @@ namespace VEPROMS.CSLA.Library tb.ReplaceToken(Tab(tb._ToItem)); return true; } + else if ((tb._ToItem.IsSection || tb._ToItem.IsProcedure) && ((tb._TransUI & E_TransUI.StepAllowNone) == E_TransUI.StepAllowNone)) + { + string tmpStr = tb.ToString(); + if (tmpStr.ToUpper().EndsWith(", STEP ")) tb.Remove(tb.Length - 7, 7); // 7 is length of ", Step " + return true; + } else return false; } @@ -683,12 +691,21 @@ namespace VEPROMS.CSLA.Library tb.ReplaceToken(retstr); return (retstr != null && retstr != ""); } + private static bool AddOptionalTranGetSectionNum(TransitionBuilder tb) + { + if (TranGetSectionItem(tb._FromItem).ItemID == TranGetSectionItem(tb._ToItem).ItemID) return false; + if (tb._ToItem.IsSection) return false; + tb.AppendPrefix(); + string retstr = TranGetSectionNumber(tb._ToItem); + tb.ReplaceToken(retstr); + return (retstr != null && retstr != ""); + } private static bool AddTranGetSectionTitle(TransitionBuilder tb) { // LATER: Cap1stSectionTitle, CapFirstLetterOnly if (tb._FormatData.TransData.UseSecTitles) { - string retstr = TranGetSectionTitle(tb,tb._FromItem); + string retstr = TranGetSectionTitle(tb,tb._ToItem); tb.AppendPrefix(); tb.ReplaceToken(retstr); return (retstr != null && retstr != ""); @@ -697,6 +714,7 @@ namespace VEPROMS.CSLA.Library } private static bool AddTranGetSectionNumber(TransitionBuilder tb) { + if (tb._TranType == 1 && tb._ToItem.ActiveSection.ItemID == tb._FromItem.ActiveSection.ItemID) return false; string retstr = TranGetSectionNumber(tb._ToItem); tb.AppendPrefix(); tb.ReplaceToken(retstr); @@ -718,6 +736,7 @@ namespace VEPROMS.CSLA.Library private static string TranGetSectionNumber(ItemInfo itminfo) { ItemInfo tmpitm = TranGetSectionItem(itminfo); + if (!tmpitm.IsSection) return ""; return (tmpitm.MyContent.Number); } private static string TranGetSectionTitle(TransitionBuilder tb, ItemInfo itminfo) diff --git a/PROMS/VEPROMS.CSLA.Library/Format/DocStyles.cs b/PROMS/VEPROMS.CSLA.Library/Format/DocStyles.cs index 4473231e..d591ec4c 100644 --- a/PROMS/VEPROMS.CSLA.Library/Format/DocStyles.cs +++ b/PROMS/VEPROMS.CSLA.Library/Format/DocStyles.cs @@ -118,6 +118,42 @@ namespace VEPROMS.CSLA.Library } } #endregion + #region CancelSectTitle + [Category("Miscellaneous")] + [Description("Section Cancel Section Title")] + private LazyLoad _CancelSectTitle; + public bool CancelSectTitle + { + get + { + return LazyLoad(ref _CancelSectTitle, "@CancelSectTitle"); + } + } + #endregion + #region SpecialStepsFoldout + [Category("Miscellaneous")] + [Description("Section Special Steps Foldout")] + private LazyLoad _SpecialStepsFoldout; + public bool SpecialStepsFoldout + { + get + { + return LazyLoad(ref _SpecialStepsFoldout, "@SpecialStepsFoldout"); + } + } + #endregion + #region UndSpecialStepsFoldout + [Category("Miscellaneous")] + [Description("Section Cancel Section Title")] + private LazyLoad _UndSpecialStepsFoldout; + public bool UndSpecialStepsFoldout + { + get + { + return LazyLoad(ref _UndSpecialStepsFoldout, "@UndSpecialStepsFoldout"); + } + } + #endregion #region pagestyle private PageStyle _pagestyle; [Category("Miscellaneous")] @@ -195,16 +231,16 @@ namespace VEPROMS.CSLA.Library { public Layout(XmlNode xmlNode) : base(xmlNode) { } public Layout() : base() { } - #region TopRow - private LazyLoad _TopRow; + #region TopMargin + private LazyLoad _TopMargin; [Category("Layout")] - [DisplayName("Top Row on Printed Page")] - [Description("Top Row on Printed Page")] - public float? TopRow + [DisplayName("Top Margin on Printed Page")] + [Description("Top Margin on Printed Page")] + public float? TopMargin { get { - return LazyLoad(ref _TopRow, "@TopRow"); + return LazyLoad(ref _TopMargin, "@TopMargin"); } } #endregion