B2019-034 Added logic to handle when the user manually bolds and/or underlines a word that would normally be bolded and/or underlined via Replace Words
This commit is contained in:
parent
c0285dc3e1
commit
c9c26d235a
@ -2271,14 +2271,32 @@ namespace VEPROMS.CSLA.Library
|
|||||||
with = with.Replace(@"{\par}", "");
|
with = with.Replace(@"{\par}", "");
|
||||||
bool IsBold = ((_Font.Style & E_Style.Bold) == E_Style.Bold) ||
|
bool IsBold = ((_Font.Style & E_Style.Bold) == E_Style.Bold) ||
|
||||||
(_MyItemInfo.FormatStepData != null && _MyItemInfo.FormatStepData.BoldHighLevel && _MyItemInfo.IsRNOPart && _MyItemInfo.MyParent.IsHigh );
|
(_MyItemInfo.FormatStepData != null && _MyItemInfo.FormatStepData.BoldHighLevel && _MyItemInfo.IsRNOPart && _MyItemInfo.MyParent.IsHigh );
|
||||||
if (IsBold && with.Contains(@"\b "))
|
// B2019-034 If the word to be replaced in the procedure text was manually bolded, remove the bold on/off commands from the replacement word
|
||||||
|
if (!IsBold)
|
||||||
|
{
|
||||||
|
int repidxBoldOff = text.LastIndexOf(@"\b0", foundMatch.MyMatch.Index + offset);
|
||||||
|
int repidxBoldOn = text.LastIndexOf(@"\b", foundMatch.MyMatch.Index + offset);
|
||||||
|
if (repidxBoldOff > 0)
|
||||||
|
{
|
||||||
|
repidxBoldOn = text.Substring(repidxBoldOff + 3, foundMatch.MyMatch.Index + offset - (repidxBoldOff + 3)).LastIndexOf(@"\b");
|
||||||
|
if (repidxBoldOn >= 0)
|
||||||
|
repidxBoldOn += (repidxBoldOff + 3);
|
||||||
|
}
|
||||||
|
if (repidxBoldOn >= 0) IsBold = true;
|
||||||
|
}
|
||||||
|
// B2019-034 added more cases to look for and remove bold on/off from the ReplaceWith word
|
||||||
|
if (IsBold && (with.Contains(@"\b ") || with.Contains(@"\b\")))
|
||||||
{
|
{
|
||||||
with = with.Replace(@"\b ","");
|
with = with.Replace(@"\b ","");
|
||||||
|
with = with.Replace(@"\b\", @"\");
|
||||||
with = with.Replace(@"\b0 ","");
|
with = with.Replace(@"\b0 ","");
|
||||||
|
with = with.Replace(@"\b0\", @"\");
|
||||||
|
if (with.EndsWith(@"\b0"))
|
||||||
|
with = with.Replace(@"\b0","");
|
||||||
}
|
}
|
||||||
bool IsUnderline = (((_Font.Style & E_Style.Underline) == E_Style.Underline) && with.Contains(@"\ul "));
|
bool IsUnderline = (((_Font.Style & E_Style.Underline) == E_Style.Underline) && with.Contains(@"\ul "));
|
||||||
// handle where replace words replaces a string with 'underline on'string'underline off', for example Point Beach
|
// handle where replace words replaces a string with 'underline on'string'underline off', for example Point Beach
|
||||||
// had replaced OR's turning underline off in the middle of a transition, "EOP-0 UNIT 1, RACTORE TRIP OR SAFETY INJECTION".
|
// had replaced OR's turning underline off in the middle of a transition, "EOP-0 UNIT 1, REACTOR TRIP OR SAFETY INJECTION".
|
||||||
if (!IsUnderline)
|
if (!IsUnderline)
|
||||||
{
|
{
|
||||||
int repidxulnone = text.LastIndexOf(@"\ulnone", foundMatch.MyMatch.Index + offset);
|
int repidxulnone = text.LastIndexOf(@"\ulnone", foundMatch.MyMatch.Index + offset);
|
||||||
@ -2291,10 +2309,15 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
if (repidxst >= 0) IsUnderline = true;
|
if (repidxst >= 0) IsUnderline = true;
|
||||||
}
|
}
|
||||||
|
// B2019-034 added more cases to look for and remove underline on/off from the ReplaceWith word
|
||||||
if (IsUnderline)
|
if (IsUnderline)
|
||||||
{
|
{
|
||||||
with = with.Replace(@"\ul ", "");
|
with = with.Replace(@"\ul ", "");
|
||||||
|
with = with.Replace(@"\ul\", @"\");
|
||||||
with = with.Replace(@"\ulnone ", "");
|
with = with.Replace(@"\ulnone ", "");
|
||||||
|
with = with.Replace(@"\ulnone\", @"\");
|
||||||
|
if (with.EndsWith(@"\ulnone"))
|
||||||
|
with = with.Replace(@"\ulnone","");
|
||||||
}
|
}
|
||||||
string preceedingText = text.Substring(0, offset + foundMatch.MyMatch.Index);
|
string preceedingText = text.Substring(0, offset + foundMatch.MyMatch.Index);
|
||||||
int ndxBold = preceedingText.LastIndexOf(@"\b");
|
int ndxBold = preceedingText.LastIndexOf(@"\b");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user