F2021-053: BNPP Alarm – need ability to have super/sub scripts in the text of Alarm Tables (ROs)

This commit is contained in:
2021-10-25 12:18:49 +00:00
parent 6a10408a94
commit 2b25136036
6 changed files with 78 additions and 9 deletions

View File

@@ -302,7 +302,8 @@ namespace VEPROMS.CSLA.Library
Plackeep = 0x20000, // Do replace in PlaceKeepers
InSecTitle = 0x40000,
BeforeTrans = 0x80000, // Only do replace if the string occurs immediately before a transition.
BeforeList = 0x100000 // C2021-045 Only if the text ends with a colon ":"
BeforeList = 0x100000, // C2021-045 Only if the text ends with a colon ":"
PageList = 0x200000 // F2021-053 Do replace words for PageList items that are ROs
}
[Serializable]
[TypeConverter(typeof(ExpandableObjectConverter))]

View File

@@ -258,6 +258,28 @@ namespace VEPROMS.CSLA.Library
TextFont = vFont;
StartText = CreateRtf(colorLinks, text, false, false, false, false, false, false, E_EditPrintMode.Edit);
}
// F2021-053: BNPP Alarm - need ability to have super/sub scripts in the text of Alarm Tables (ROs). Added a
// constructor that allows for passing in a flag to set whether replace words should be done on page list. If doing
// on page list, the object has a section not a step associated with it.
private bool _DoReplWordInPageList = false;
public DisplayText(ItemInfo itemInfo, string text, bool colorLinks, bool dorepl)
{
_DoReplWordInPageList = dorepl;
_FieldToEdit = E_FieldToEdit.Text;
_MyItemInfo = itemInfo;
OriginalText = text;
TextFont = itemInfo.GetItemFont();
_MyFormat = itemInfo.ActiveFormat;
bool wordsShouldBeReplaced = true;
bool numbersShouldBeFormated = !_MyFormat.PlantFormat.FormatData.SectData.StepSectionData.FortranFormatNumbers;
int typ = ((int)itemInfo.MyContent.Type) % 10000;
bool ROsShouldBeAdjusted = wordsShouldBeReplaced; // same logical value
bool underlineAfterDashSpace = (itemInfo.FormatStepData == null) ? false : itemInfo.FormatStepData.UnderlineAfterDashSpace;
text = CreateRtf(colorLinks, text, false, wordsShouldBeReplaced, numbersShouldBeFormated, false, ROsShouldBeAdjusted, underlineAfterDashSpace, E_EditPrintMode.Edit);
StartText = text;
}
public DisplayText(ItemInfo itemInfo, string text, bool colorLinks)
{
_FieldToEdit = E_FieldToEdit.Text;
@@ -272,7 +294,7 @@ namespace VEPROMS.CSLA.Library
bool ROsShouldBeAdjusted = wordsShouldBeReplaced; // same logical value
bool underlineAfterDashSpace = (itemInfo.FormatStepData == null) ? false : itemInfo.FormatStepData.UnderlineAfterDashSpace;
text = CreateRtf(colorLinks, text, false, wordsShouldBeReplaced, numbersShouldBeFormated, false, ROsShouldBeAdjusted, underlineAfterDashSpace,E_EditPrintMode.Edit);
text = CreateRtf(colorLinks, text, false, wordsShouldBeReplaced, numbersShouldBeFormated, false, ROsShouldBeAdjusted, underlineAfterDashSpace, E_EditPrintMode.Edit);
StartText = text;
// Shearon Harris Tables are Bold
if (itemInfo.IsTable && (TextFont.Style & E_Style.Bold) == E_Style.Bold)
@@ -2036,8 +2058,11 @@ namespace VEPROMS.CSLA.Library
private string DoReplaceWords2(string Text)
{
if(!ProcessReplaceWords) return Text;
if (_MyItemInfo.MyContent.Type < 20000) return Text; // for now only replace in steps.
FoundMatches myMatches = new FoundMatches(Text,_MyItemInfo.FormatStepData.Font,_MyItemInfo);
// F2021-053: BNPP Alarm - need ability to have super/sub scripts in the text of Alarm Tables (ROs).
// if doing replace words for Page List items, the current item is not a step, use _DoReplWordInPageList flags this
if (_MyItemInfo.MyContent.Type < 20000 && !_DoReplWordInPageList) return Text; // for now only replace in steps.
VE_Font vf = _MyItemInfo.MyContent.Type >= 20000 ? _MyItemInfo.FormatStepData.Font : _MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font;
FoundMatches myMatches = new FoundMatches(Text,vf,_MyItemInfo);
// Exclude Link Text from Replace Word process
myMatches.AddLink(regFindLink, _MyFormat.PlantFormat.FormatData.SectData.ReplaceWordsInROs, _MyItemInfo.MyProcedure.MyDocVersion);
FormatConfig.ReplaceStrData rsl = _MyFormat.PlantFormat.UCFandOrigReplaceStrData;
@@ -2066,7 +2091,7 @@ namespace VEPROMS.CSLA.Library
// C2021-045 if the BeforeList ReplaceWords flag is set, only do the replace word if the text ends with a colon
if (replaceit && onlyDoList && !Text.EndsWith(":"))
replaceit = false; // text does not end with a colon so don't replace this word
if (!replaceit && _DoReplWordInPageList) replaceit = true; // F2021-053: Do replace words in page list
if (replaceit)
{
if (!dicReplaceRegex.ContainsKey(rs))

View File

@@ -228,7 +228,8 @@ namespace VEPROMS.CSLA.Library
Plackeep = 0x20000, // Do replace in PlaceKeepers
InSecTitle = 0x40000,
BeforeTrans = 0x80000, // Only do replace if the string occurs immediately before a transition.
BeforeList = 0x100000 // C2021-045 Only if the text ends with a colon ":"
BeforeList = 0x100000, // C2021-045 Only if the text ends with a colon ":"
PageList = 0x200000 // F2021-053: Do replace words in page list
}
public enum E_ArrowKeys : uint
{

View File

@@ -133,6 +133,14 @@ namespace VEPROMS.CSLA.Library
return LazyLoad<E_Justify>(ref _Justify, "@Justify");
}
}
private LazyLoad<bool> _RepWords; // F2021-053: Do replace words in page list
public bool RepWords
{
get
{
return LazyLoad(ref _RepWords, "@RepWords");
}
}
private LazyLoad<int?> _MaxWidth;
public int? MaxWidth
{