B2023-037: Handle <=, >=, +-, -> and <- symbols in ROs.

This commit is contained in:
2023-03-30 12:59:06 +00:00
parent 3e8556bac9
commit da05241df7
8 changed files with 81 additions and 30 deletions

View File

@@ -1616,7 +1616,7 @@ namespace VEPROMS.CSLA.Library
foreach (ContentRoUsage ro in cont.ContentRoUsages)
{
RoUsageInfo rou = RoUsageInfo.Get(ro.ROUsageID);
string myvalue = mylookup.GetTranslatedRoValue(rou.ROID, tmp.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, tmp.ActiveFormat.PlantFormat.FormatData.SectData.UseTildaPoundCharsForSuperSubScriptInROValues);
string myvalue = mylookup.GetTranslatedRoValue(rou.ROID, tmp.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, tmp.ActiveFormat.PlantFormat.FormatData.SectData.UseTildaPoundCharsForSuperSubScriptInROValues, false);
ROFSTLookup.rochild rocc = mylookup.GetRoChild(rou.ROID);
@@ -1843,7 +1843,7 @@ namespace VEPROMS.CSLA.Library
ROFSTLookup mylookup = myRoFst.GetROFSTLookup(tmp.ContentItems[0].MyProcedure.MyDocVersion);
foreach (RoUsageInfo rou in tmp.ContentRoUsages)
{
string myvalue = mylookup.GetTranslatedRoValue(rou.ROID, tmp.ContentItems[0].ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, tmp.ContentItems[0].ActiveFormat.PlantFormat.FormatData.SectData.UseTildaPoundCharsForSuperSubScriptInROValues);
string myvalue = mylookup.GetTranslatedRoValue(rou.ROID, tmp.ContentItems[0].ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, tmp.ContentItems[0].ActiveFormat.PlantFormat.FormatData.SectData.UseTildaPoundCharsForSuperSubScriptInROValues, false);
ROFSTLookup.rochild rocc = mylookup.GetRoChild(rou.ROID);
int mytype = rocc.type;
ctmp.FixContentText(rou, myvalue, mytype, myRoFst);

View File

@@ -693,6 +693,11 @@ namespace VEPROMS.CSLA.Library
if (isSetpoint) newvalue = ReplaceSpaceWithHardspace(newvalue);
// B2017-147: backquotes should be translated to degrees for edit/print:
newvalue = newvalue.Replace("`", @"\'b0");
// B2023-037: Handle <=, >=, +-, -> and <- symbols. If the format has flags to convert these RO symbols, it
// is done here so that output (print & edit/view) has symbol, not 2 characters.
if (_MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseDashGreaterLessThenForArrowsInROValue ||
_MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertGTELTEPMinROValue)
newvalue = ROFSTLookup.ROConvertSymbols(newvalue);
if (gg != newvalue)
text = text.Substring(0, myIndex) + newvalue + text.Substring(myIndex + myLength);

View File

@@ -900,7 +900,7 @@ namespace VEPROMS.CSLA.Library
{
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);
string roval = lookup.GetTranslatedRoValue(rousage.ROID, this.ActiveSection.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, this.ActiveSection.ActiveFormat.PlantFormat.FormatData.SectData.UseTildaPoundCharsForSuperSubScriptInROValues, false);
ROFSTLookup.rochild roch = lookup.GetRoChild(rousage.ROID);
this.MyContent.FixContentText(rousage, roval, roch.type, rofstinfo, this);
@@ -956,7 +956,7 @@ 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);
string roval = lookup.GetTranslatedRoValue(rousage.ROID, sectionInfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, sectionInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseTildaPoundCharsForSuperSubScriptInROValues, false);
ROFSTLookup.rochild roch = lookup.GetRoChild(rousage.ROID);
itemInfo.MyContent.FixContentText(rousage, roval, roch.type, origROFst, itemInfo);
@@ -1019,11 +1019,33 @@ namespace VEPROMS.CSLA.Library
***/
}
private static bool DifferentROtext(string newText, string oldText)
private static bool DifferentROtext(string newText, string oldText)
{
string nt = newText.Replace(@"\u8209?", "-").Replace(@"\u160?", " ").Replace("\xA0", " ");
string ot = oldText.Replace(@"\u8209?", "-").Replace(@"\u160?", " ").Replace("\xA0", " ");
if (nt.Equals(ot))
{
return false;
}
// B2023-037: Handle <=, >=, +-, -> and <- symbols. Previous code changes replaced these symbol pairs with their
// unicode representation, thus link text data may have the Unicode character. This code update keeps the double
// character sequences in the link text (the RO text as is) and just converts when needing the output. When
// updating ROs need to check for unicode characters too since some data may have that
nt = nt.Replace(@"\u8594?", "->"); // Right Arrow
ot = ot.Replace(@"\u8594?", "->"); // Right Arrow
nt = nt.Replace(@"\u8592?", "<-"); // Left Arrow
ot = ot.Replace(@"\u8592?", "<-"); // Left Arrow
nt = nt.Replace(@"\u8804?", "<="); // Less than or Equal
ot = ot.Replace(@"\u8804?", "<="); // Less than or Equal
nt = nt.Replace(@"\u8805?", ">="); // Greater than or Equal
ot = ot.Replace(@"\u8805?", ">="); // Greater than or Equal
nt = nt.Replace(@"\u8805?", ">="); // Greater than or Equal
ot = ot.Replace(@"\u8805?", ">="); // Greater than or Equal
nt = nt.Replace(@"\u8594?", "+-"); // plus minus
ot = ot.Replace(@"\u8594?", "+-"); // plus minus
nt = nt.Replace(@"\'b1", "+-");
ot = ot.Replace(@"\'b1", "+-");
if (nt.Equals(ot))
{
return false;
@@ -1151,7 +1173,8 @@ namespace VEPROMS.CSLA.Library
{
if (sectionInfo != null)
{
string roval = lookup.GetTranslatedRoValue(rousage.ROID, sectionInfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, sectionInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseTildaPoundCharsForSuperSubScriptInROValues);
// B2023-037: loading print text, resolve the RO symbols
string roval = lookup.GetTranslatedRoValue(rousage.ROID, sectionInfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, sectionInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseTildaPoundCharsForSuperSubScriptInROValues,sectionInfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertGTELTEPMinROValue|| sectionInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseDashGreaterLessThenForArrowsInROValue);
ROFSTLookup.rochild roch = lookup.GetRoChild(rousage.ROID);
itemInfo.MyContent.FixContentText(rousage, roval, roch.type, rofstinfo, itemInfo);
}

View File

@@ -746,7 +746,7 @@ namespace VEPROMS.CSLA.Library
{
foreach (ItemInfo ii in roUsg.MyContent.ContentItems)
{
string val = newLookup.GetTranslatedRoValue(padroid, ii.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, ii.ActiveFormat.PlantFormat.FormatData.SectData.UseTildaPoundCharsForSuperSubScriptInROValues);
string val = newLookup.GetTranslatedRoValue(padroid, ii.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, ii.ActiveFormat.PlantFormat.FormatData.SectData.UseTildaPoundCharsForSuperSubScriptInROValues, false);
content.FixContentText(roUsg, val, roch.type, origROFstInfo, true);
if (content.IsDirty)