From c6821188c55a6aefd6f1d34a50c85c68067d65ce Mon Sep 17 00:00:00 2001 From: Kathy Date: Thu, 19 May 2011 13:24:03 +0000 Subject: [PATCH] --- .../VEPROMS.CSLA.Library/Extension/ItemExt.cs | 31 +++++++++++++++---- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index bf3acd93..d87fc3be 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -1370,7 +1370,7 @@ namespace VEPROMS.CSLA.Library myStyle |= isBold ? E_Style.Bold : 0; myStyle |= isMmBold ? E_Style.MmBold : 0; if (myStyle != font.Style) - font = new VE_Font(font.Family, (int)font.Size, myStyle); + font = new VE_Font(font.Family, (int)font.Size, myStyle, (float)font.CPI); } return font; } @@ -2026,7 +2026,14 @@ namespace VEPROMS.CSLA.Library if (IsCaution || IsNote) tbformat = CheckNoteCautionTab(tbformat); int ordinal = Ordinal; - if (!IsSection && !IsProcedure) tbformat = tbformat.Replace("{Section Prefix}", this.ActiveSection.MyTab.CleanText); + bool trimTabStart = false; + if (!IsSection && !IsProcedure && tbformat.IndexOf("{Section Prefix}") >= 0) + { + // if there is a section prefix, trim any spaces from the start of this tab, so we don't have + // a tab that looks like "1. 1" + if (ActiveSection.MyTab.CleanText != null && ActiveSection.MyTab.CleanText != "") trimTabStart = true; + tbformat = tbformat.Replace("{Section Prefix}", SectionPrefix(tbformat)); + } string alpha = AlphabeticalNumbering(ordinal); tbformat = tbformat.Replace("{alpha}", alpha.ToLower()); tbformat = tbformat.Replace("{alphaWpar}", alpha.ToLower()); @@ -2035,7 +2042,7 @@ namespace VEPROMS.CSLA.Library string roman = RomanNumbering(ordinal); tbformat = tbformat.Replace("{roman}", roman.ToLower()); tbformat = tbformat.Replace("{ROMAN}", roman); - tbformat = tbformat.Replace("{numeric}", ordinal.ToString().PadLeft(2)); + tbformat = tbformat.Replace("{numeric}", trimTabStart ? ordinal.ToString() : ordinal.ToString().PadLeft(2)); tbformat = tbformat.Replace("{numericWpar}", ordinal.ToString()); if (tbformat.IndexOf("{!C0}") > -1) @@ -2045,7 +2052,8 @@ namespace VEPROMS.CSLA.Library if (FormatStepData.Sep != null && MyPrevious != null) { if (_MyHeader == null) _MyHeader = new MetaTag(FormatStepData.TabData.Font); - _MyHeader.Text = _MyHeader.CleanText = FormatStepData.Sep; + _MyHeader.Text = FormatStepData.Sep; + _MyHeader.CleanText = StripRtfFormatting(_MyHeader.Text); _MyHeader.Justify = ContentAlignment.MiddleCenter; } #region Non HLP tab TODO @@ -2090,6 +2098,17 @@ namespace VEPROMS.CSLA.Library _MyTab.Text = tbformat; _MyTab.CleanText = cltext != null ? cltext : tbformat; } + + private string SectionPrefix(string tbformat) + { + // 16 bit has code that handles various levels of sections with a flag called TieTabToLevel. This + // code will need to be added at some point. For now, handle the basic case of just getting the + // section tab up to and including the '.'. + int indxs = ActiveSection.MyTab.CleanText.IndexOf("."); + // if the '.' is found, include it in the tab: + return indxs > 0 ? ActiveSection.MyTab.CleanText.Substring(0, indxs + 1) : ActiveSection.MyTab.CleanText.Trim(); + } + private string CheckNoteCautionTab(string tbformat) { string prevTbFormat = null; @@ -2112,8 +2131,8 @@ namespace VEPROMS.CSLA.Library if (FormatStepData.TabData.Justify == "Center") { _MyHeader.Justify = ContentAlignment.MiddleCenter; - _MyHeader.Text = _MyHeader.CleanText = tbformat.Trim(); ; - + _MyHeader.Text = tbformat.Trim(); ; + _MyHeader.CleanText = StripRtfFormatting(_MyHeader.Text); // if there is only step in the group - no bullet is used, if more that one replace the tab // with a bullet if (MyPrevious == null && NextItem == null)