B2022-098: ROs not being resolved in Word Sections
This commit is contained in:
@@ -882,10 +882,13 @@ namespace VEPROMS.CSLA.Library
|
||||
if (this.ActiveSection != null)
|
||||
{
|
||||
string oldText = this.MyContent.Text;
|
||||
|
||||
string roval = lookup.GetTranslatedRoValue(rousage.ROID, this.ActiveSection.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, this.ActiveSection.ActiveFormat.PlantFormat.FormatData.SectData.UseTildaPoundCharsForSuperSubScriptInROValues);
|
||||
ROFSTLookup.rochild roch = lookup.GetRoChild(rousage.ROID);
|
||||
|
||||
this.MyContent.FixContentText(rousage, roval, roch.type, rofstinfo, this);
|
||||
string newText = this.MyContent.Text;
|
||||
|
||||
if (newText != oldText)
|
||||
{
|
||||
Content content = Content.Get(this.MyContent.ContentID);
|
||||
@@ -936,8 +939,10 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ROCheckCount++;
|
||||
string oldText = itemInfo.MyContent.Text;
|
||||
|
||||
string roval = lookup.GetTranslatedRoValue(rousage.ROID, sectionInfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, sectionInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseTildaPoundCharsForSuperSubScriptInROValues);
|
||||
ROFSTLookup.rochild roch = lookup.GetRoChild(rousage.ROID);
|
||||
|
||||
itemInfo.MyContent.FixContentText(rousage, roval, roch.type, origROFst, itemInfo);
|
||||
string newText = itemInfo.MyContent.Text;
|
||||
|
||||
@@ -1901,7 +1906,6 @@ namespace VEPROMS.CSLA.Library
|
||||
return includeOnCAS;
|
||||
}
|
||||
}
|
||||
|
||||
// F2022-024 Time Critical Action Step
|
||||
// determine if the the current step should automatically be placed on the Time Critical Action Summary
|
||||
// Note, this logic only checks the format setting of the step. We will check the value of the Tag's Check Box later on.
|
||||
@@ -1933,7 +1937,6 @@ namespace VEPROMS.CSLA.Library
|
||||
return includeOnTCAS;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsSameType(ItemInfo cmpItmInfo)
|
||||
{
|
||||
return (((int)MyContent.Type) % 10000) == (((int)cmpItmInfo.MyContent.Type) % 10000);
|
||||
@@ -2967,68 +2970,94 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
//get { return ConvertToDisplayText(MyContent.Number); }
|
||||
}
|
||||
|
||||
// for step designators (a redefined caution type used in Comanche Peak with the SameRowAsParentMultiLines format flag)
|
||||
// we what to allow for a hard return to allow for multiple designator lines - jsj 5/21/2015
|
||||
public static string ConvertToMulitLineStepDesignatorDisplayText(string txt)
|
||||
{
|
||||
string retval = txt;
|
||||
retval = StripRtfFormatting(retval);
|
||||
retval = StripLinks(retval);
|
||||
retval = ReplaceSpecialCharacters(retval);
|
||||
retval = retval.Replace("\u2011", "-");
|
||||
retval = retval.Replace("\r\n", @"\line");
|
||||
retval = retval.Replace("\n", @"\line");
|
||||
|
||||
if (!string.IsNullOrEmpty(retval))
|
||||
{
|
||||
retval = StripRtfFormatting(retval);
|
||||
retval = StripLinks(retval);
|
||||
retval = ReplaceSpecialCharacters(retval);
|
||||
retval = retval.Replace("\u2011", "-");
|
||||
retval = retval.Replace("\r\n", @"\line");
|
||||
retval = retval.Replace("\n", @"\line");
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
public static string ConvertToDisplayText(string txt)
|
||||
{
|
||||
return ConvertToDisplayText(txt, true);
|
||||
}
|
||||
|
||||
public static string ConvertToDisplayText(string txt, bool stripRTF)
|
||||
{
|
||||
string retval = txt;
|
||||
if (stripRTF) retval = StripRtfFormatting(retval);
|
||||
retval = StripLinks(retval);
|
||||
retval = ReplaceSpecialCharacters(retval);
|
||||
retval = retval.Replace("\u2011", "-");
|
||||
retval = retval.Replace("\u2572", @"\"); // replace backslash symbol with a backslash
|
||||
retval = Regex.Replace(retval, @"\\line ?", ";"); // better handing of hard returns - replace with semi-colon for use on tree view
|
||||
retval = retval.Replace("\r\n", ";");
|
||||
retval = retval.Replace("\n", ";"); //added for consistency checking with approved version
|
||||
|
||||
if (!string.IsNullOrEmpty(retval))
|
||||
{
|
||||
if (stripRTF) retval = StripRtfFormatting(retval);
|
||||
retval = StripLinks(retval);
|
||||
retval = ReplaceSpecialCharacters(retval);
|
||||
retval = retval.Replace("\u2011", "-");
|
||||
retval = retval.Replace("\u2572", @"\"); // replace backslash symbol with a backslash
|
||||
retval = Regex.Replace(retval, @"\\line ?", ";"); // better handing of hard returns - replace with semi-colon for use on tree view
|
||||
retval = retval.Replace("\r\n", ";");
|
||||
retval = retval.Replace("\n", ";"); //added for consistency checking with approved version
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
public static string StripRtfFormatting(string rtf)
|
||||
{
|
||||
string retval = rtf;
|
||||
// B2022-082: underline/bold of word removes space between 2 words in DisplayText
|
||||
retval = Regex.Replace(retval, @"\\ulnone\\b0 ?", "");
|
||||
retval = Regex.Replace(retval, @"\\b0\\ulnone ?", "");
|
||||
retval = Regex.Replace(retval, @"\\b0 ?", "");
|
||||
retval = Regex.Replace(retval, @"\\b ?", "");
|
||||
retval = Regex.Replace(retval, @"\\ulnone ?", "");
|
||||
retval = Regex.Replace(retval, @"\\ul0 ?", "");
|
||||
retval = Regex.Replace(retval, @"\\ul ?", "");
|
||||
retval = Regex.Replace(retval, @"\\i0 ?", "");
|
||||
retval = Regex.Replace(retval, @"\\i ?", "");
|
||||
//retval = Regex.Replace(retval, @"\\super ?", "");
|
||||
//retval = Regex.Replace(retval, @"\\sub ?", "");
|
||||
//retval = Regex.Replace(retval, @"\\nosupersub ?", "");
|
||||
retval = Regex.Replace(retval, @"\\up[320] ?", "");
|
||||
retval = Regex.Replace(retval, @"\\dn[320] ?", "");
|
||||
retval = Regex.Replace(retval, @"\\li[0-9]+ ?", ""); // changed the * to a + to "\\line " for hard returns part of bug fix B2015-140
|
||||
retval = Regex.Replace(retval, @"\\fi-[0-9]+ ?", "");
|
||||
retval = Regex.Replace(retval, @"\\fs[0-9]+ ?", ""); // B2020-065: removed font size definition (introduced when allowing font sizes in tables)
|
||||
|
||||
if (!string.IsNullOrEmpty(retval))
|
||||
{
|
||||
// B2022-082: underline/bold of word removes space between 2 words in DisplayText
|
||||
retval = Regex.Replace(retval, @"\\ulnone\\b0 ?", "");
|
||||
retval = Regex.Replace(retval, @"\\b0\\ulnone ?", "");
|
||||
retval = Regex.Replace(retval, @"\\b0 ?", "");
|
||||
retval = Regex.Replace(retval, @"\\b ?", "");
|
||||
retval = Regex.Replace(retval, @"\\ulnone ?", "");
|
||||
retval = Regex.Replace(retval, @"\\ul0 ?", "");
|
||||
retval = Regex.Replace(retval, @"\\ul ?", "");
|
||||
retval = Regex.Replace(retval, @"\\i0 ?", "");
|
||||
retval = Regex.Replace(retval, @"\\i ?", "");
|
||||
//retval = Regex.Replace(retval, @"\\super ?", "");
|
||||
//retval = Regex.Replace(retval, @"\\sub ?", "");
|
||||
//retval = Regex.Replace(retval, @"\\nosupersub ?", "");
|
||||
retval = Regex.Replace(retval, @"\\up[320] ?", "");
|
||||
retval = Regex.Replace(retval, @"\\dn[320] ?", "");
|
||||
retval = Regex.Replace(retval, @"\\li[0-9]+ ?", ""); // changed the * to a + to "\\line " for hard returns part of bug fix B2015-140
|
||||
retval = Regex.Replace(retval, @"\\fi-[0-9]+ ?", "");
|
||||
retval = Regex.Replace(retval, @"\\fs[0-9]+ ?", ""); // B2020-065: removed font size definition (introduced when allowing font sizes in tables)
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
public static string StripLinks(string rtf)
|
||||
{
|
||||
string retval = rtf;
|
||||
retval = Regex.Replace(retval, @"\\v.*?\\v0 ?", "");
|
||||
retval = retval.Replace("\u252C", "");// Unicode 9516 Transition
|
||||
retval = retval.Replace("\u2566", "");// Unicode 9574 Transition
|
||||
retval = retval.Replace("\u0015", "");// Unicode 21 RO
|
||||
|
||||
if (!string.IsNullOrEmpty(retval))
|
||||
{
|
||||
retval = Regex.Replace(retval, @"\\v.*?\\v0 ?", "");
|
||||
retval = retval.Replace("\u252C", "");// Unicode 9516 Transition
|
||||
retval = retval.Replace("\u2566", "");// Unicode 9574 Transition
|
||||
retval = retval.Replace("\u0015", "");// Unicode 21 RO
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
private static string ReplaceSpecialCharacter(Match m)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
@@ -3036,6 +3065,7 @@ namespace VEPROMS.CSLA.Library
|
||||
sb.Append((char)i);
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
private static string ReplaceSpecialHexCharacter(Match m)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
@@ -3043,14 +3073,21 @@ namespace VEPROMS.CSLA.Library
|
||||
sb.Append((char)i);
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
private static string ReplaceSpecialCharacters(string rtf)
|
||||
{
|
||||
string retval = rtf;
|
||||
retval = retval.Replace("`", "\u00B0");// Degree
|
||||
retval = Regex.Replace(retval, @"\\u[0-9]+[?]", new MatchEvaluator(ReplaceSpecialCharacter));
|
||||
retval = Regex.Replace(retval, @"\\'[0-9A-Fa-f][0-9A-Fa-f]", new MatchEvaluator(ReplaceSpecialHexCharacter));
|
||||
|
||||
if (!string.IsNullOrEmpty(retval))
|
||||
{
|
||||
retval = retval.Replace("`", "\u00B0");// Degree
|
||||
retval = Regex.Replace(retval, @"\\u[0-9]+[?]", new MatchEvaluator(ReplaceSpecialCharacter));
|
||||
retval = Regex.Replace(retval, @"\\'[0-9A-Fa-f][0-9A-Fa-f]", new MatchEvaluator(ReplaceSpecialHexCharacter));
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
//public void ShowThis(string title)
|
||||
//{
|
||||
// Console.WriteLine("'{0}',,,,'i{1}','u{2}',{3},'{4}','{5}','{6}','{7}'", title, ItemID, MyItemInfoUnique, PreviousID, this, _MyPrevious, _MyParent, _ActiveParent);
|
||||
@@ -3174,38 +3211,47 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
return RemoveRtfStyles(rtf, ActiveFormat);
|
||||
}
|
||||
|
||||
public string RemoveRtfStyles(string rtf, FormatInfo fmt)
|
||||
{
|
||||
string retval = rtf;
|
||||
VE_Font TextFont = GetItemFont(fmt);
|
||||
if (TextFont != null)
|
||||
|
||||
if (!string.IsNullOrEmpty(retval))
|
||||
{
|
||||
// remove rtf commands for any styles that were added. Note that if
|
||||
// the entire item has a style, and also contains 'pieces' of text with
|
||||
// the same style, the underlying rtf box removes the embedded rtf commands,
|
||||
// for example, if the entire step is bolded, and 'THEN' has bold on/off
|
||||
// surrounding it, the rtf box removes the bold around the 'THEN'
|
||||
// These remove the command with a following space or the command alone,
|
||||
// either case may exist, because if there are rtf commands following the
|
||||
// style command, there will be no space character following the style command.
|
||||
if (((TextFont.Style & E_Style.Bold) > 0) || ((TextFont.Style & E_Style.MmBold) > 0))
|
||||
VE_Font TextFont = GetItemFont(fmt);
|
||||
|
||||
if (TextFont != null)
|
||||
{
|
||||
retval = RemoveToken(retval, @"\\b0");
|
||||
retval = RemoveToken(retval, @"\\b");
|
||||
}
|
||||
if ((TextFont.Style & E_Style.Underline) > 0)
|
||||
{
|
||||
retval = RemoveToken(retval, @"\\ulnone");
|
||||
retval = RemoveToken(retval, @"\\ul");
|
||||
}
|
||||
if ((TextFont.Style & E_Style.Italics) > 0)
|
||||
{
|
||||
retval = RemoveToken(retval, @"\\i0");
|
||||
retval = RemoveToken(retval, @"\\i");
|
||||
// remove rtf commands for any styles that were added. Note that if
|
||||
// the entire item has a style, and also contains 'pieces' of text with
|
||||
// the same style, the underlying rtf box removes the embedded rtf commands,
|
||||
// for example, if the entire step is bolded, and 'THEN' has bold on/off
|
||||
// surrounding it, the rtf box removes the bold around the 'THEN'
|
||||
// These remove the command with a following space or the command alone,
|
||||
// either case may exist, because if there are rtf commands following the
|
||||
// style command, there will be no space character following the style command.
|
||||
if (((TextFont.Style & E_Style.Bold) > 0) || ((TextFont.Style & E_Style.MmBold) > 0))
|
||||
{
|
||||
retval = RemoveToken(retval, @"\\b0");
|
||||
retval = RemoveToken(retval, @"\\b");
|
||||
}
|
||||
if ((TextFont.Style & E_Style.Underline) > 0)
|
||||
{
|
||||
retval = RemoveToken(retval, @"\\ulnone");
|
||||
retval = RemoveToken(retval, @"\\ul");
|
||||
}
|
||||
if ((TextFont.Style & E_Style.Italics) > 0)
|
||||
{
|
||||
retval = RemoveToken(retval, @"\\i0");
|
||||
retval = RemoveToken(retval, @"\\i");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
public bool SameRowAsParent
|
||||
{
|
||||
get
|
||||
@@ -4483,7 +4529,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
macroindx = tbformat.IndexOf("{!diamond1}");
|
||||
macroindx = tbformat.IndexOf("{!diamond1}");
|
||||
if (macroindx > -1) //i found it
|
||||
{
|
||||
cltext = cltext == null ? tbformat.Remove(macroindx, 11) : cltext.Remove(macroindx, 11);
|
||||
@@ -4578,7 +4624,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
else
|
||||
{
|
||||
newtab = @"\ul " + newtab.Substring(0, newtab.IndexOf(":") + 1) + @"\ulnone " + newtab.Substring(newtab.IndexOf(":") + 1);
|
||||
newtab = @"\ul " + newtab.Substring(0, newtab.IndexOf(":") + 1) + @"\ulnone " + newtab.Substring(newtab.IndexOf(":") + 1);
|
||||
}
|
||||
}
|
||||
// also see if there is the 'pagelist' string in this tab:
|
||||
@@ -5067,7 +5113,7 @@ namespace VEPROMS.CSLA.Library
|
||||
|
||||
private string ReplaceStepToken(string tbformat)
|
||||
{
|
||||
if (tbformat.Trim().EndsWith("`"))
|
||||
if (!string.IsNullOrEmpty(tbformat) && tbformat.Trim().EndsWith("`"))
|
||||
{
|
||||
ItemInfo tmp = this;
|
||||
string sep = string.Empty;
|
||||
@@ -5080,6 +5126,7 @@ namespace VEPROMS.CSLA.Library
|
||||
} while (!tmp.IsHigh);
|
||||
tbformat = tbformat.Replace("`", " " + hlsOrdinal);
|
||||
}
|
||||
|
||||
return tbformat;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user