B2022-098: ROs not being resolved in Word Sections
This commit is contained in:
@@ -129,7 +129,8 @@ namespace VEPROMS.CSLA.Library
|
||||
|
||||
public const string RoMissingDefaultValue = "[TBD]";
|
||||
|
||||
private static List<RoExtension> _extensions;
|
||||
private List<RoExtension> _extensions;
|
||||
private List<string> _baseAccPageKeys;
|
||||
|
||||
// RofstLookup/Conversion Variables
|
||||
private int _rofstID;
|
||||
@@ -197,6 +198,18 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
|
||||
public List<string> BaseAccPageKeys
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_baseAccPageKeys == null)
|
||||
{
|
||||
_baseAccPageKeys = GetBaseAccPageKeys();
|
||||
}
|
||||
|
||||
return _baseAccPageKeys;
|
||||
}
|
||||
}
|
||||
|
||||
public bool AutoCombineSingleRetValues
|
||||
{
|
||||
@@ -304,82 +317,34 @@ namespace VEPROMS.CSLA.Library
|
||||
|
||||
public string FormatAccPageKey(string accPageID)
|
||||
{
|
||||
if (string.IsNullOrEmpty(accPageID))
|
||||
return accPageID;
|
||||
string accPageBase = string.Empty;
|
||||
string accPageExt = string.Empty;
|
||||
|
||||
string spDefault = (MyDocVersionInfo != null && MyDocVersionInfo.DocVersionConfig != null) ? MyDocVersionInfo.DocVersionConfig.RODefaults_setpointprefix : string.Empty;
|
||||
string igDefault = (MyDocVersionInfo != null && MyDocVersionInfo.DocVersionConfig != null) ? MyDocVersionInfo.DocVersionConfig.RODefaults_graphicsprefix : string.Empty;
|
||||
|
||||
return FormatAccPageKey(accPageID, spDefault, igDefault);
|
||||
return FormatAccPageKeyWithExt(accPageID, spDefault, igDefault, ref accPageBase, ref accPageExt);
|
||||
}
|
||||
|
||||
public string FormatAccPageKey(string accPageID, ref string accPageBase, ref string accPageExt, bool useDefaultExt = true)
|
||||
public string FormatAccPageKey(string accPageID, ref string accPageBase, ref string accPageExt)
|
||||
{
|
||||
string accPageKey = FormatAccPageKey(accPageID);
|
||||
string spDefault = (MyDocVersionInfo != null && MyDocVersionInfo.DocVersionConfig != null) ? MyDocVersionInfo.DocVersionConfig.RODefaults_setpointprefix : string.Empty;
|
||||
string igDefault = (MyDocVersionInfo != null && MyDocVersionInfo.DocVersionConfig != null) ? MyDocVersionInfo.DocVersionConfig.RODefaults_graphicsprefix : string.Empty;
|
||||
|
||||
if (Regex.IsMatch(accPageKey, @".*\.[A-Z]"))
|
||||
{
|
||||
accPageBase = accPageKey.Substring(0, accPageKey.Length - 2);
|
||||
accPageExt = Convert.ToString(accPageKey.ToCharArray().LastOrDefault());
|
||||
}
|
||||
else
|
||||
{
|
||||
accPageBase = accPageKey;
|
||||
accPageExt = (!accPageKey.StartsWith("<U-") && useDefaultExt) ? "A" : string.Empty;
|
||||
}
|
||||
|
||||
return accPageKey;
|
||||
return FormatAccPageKeyWithExt(accPageID, spDefault, igDefault, ref accPageBase, ref accPageExt);
|
||||
}
|
||||
|
||||
public static string FormatAccPageKey(string accPageID, string spDefault, string igDefault)
|
||||
public string FormatAccPageKey(string accPageID, string spDefault, string igDefault)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(accPageID))
|
||||
{
|
||||
accPageID = accPageID.ToUpper();
|
||||
|
||||
if (!accPageID.StartsWith("<"))
|
||||
accPageID = string.Format("<{0}", accPageID);
|
||||
string accPageBase = string.Empty;
|
||||
string accPageExt = string.Empty;
|
||||
|
||||
if (!accPageID.EndsWith(">"))
|
||||
accPageID = string.Format("{0}>", accPageID);
|
||||
|
||||
accPageID = accPageID.Replace("<U>", "<U-NUMBER>");
|
||||
accPageID = accPageID.ToCleanString(); // Removes any spaces
|
||||
|
||||
// Clean up the AccPageID before using it to do a lookup
|
||||
if (!string.IsNullOrEmpty(spDefault))
|
||||
accPageID = accPageID.Replace("<SP-", "<" + spDefault + "-");
|
||||
|
||||
if (!string.IsNullOrEmpty(igDefault))
|
||||
accPageID = accPageID.Replace("<IG-", "<" + igDefault + "-");
|
||||
|
||||
if (!accPageID.StartsWith("<U-"))
|
||||
accPageID = accPageID.Trim("<>".ToCharArray()); // String < and >
|
||||
|
||||
accPageID = regRoKeyHigh.Replace(accPageID, "_HIGH$3");
|
||||
accPageID = regRoKeyLow.Replace(accPageID, "_LOW$3");
|
||||
accPageID = accPageID.ToUpper();
|
||||
}
|
||||
|
||||
return accPageID;
|
||||
return FormatAccPageKeyWithExt(accPageID, spDefault, igDefault, ref accPageBase, ref accPageExt);
|
||||
}
|
||||
|
||||
public static string FormatAccPageKey(string accPageID, string spDefault, string igDefault, ref string accPageBase, ref string accPageExt, bool useDefaultExt = true)
|
||||
public string FormatAccPageKey(string accPageID, string spDefault, string igDefault, ref string accPageBase, ref string accPageExt)
|
||||
{
|
||||
string accPageKey = FormatAccPageKey(accPageID, spDefault, igDefault);
|
||||
|
||||
if (Regex.IsMatch(accPageKey, @".*\.[A-Z]"))
|
||||
{
|
||||
accPageBase = accPageKey.Substring(0, accPageKey.Length - 2);
|
||||
accPageExt = Convert.ToString(accPageKey.ToCharArray().LastOrDefault());
|
||||
}
|
||||
else
|
||||
{
|
||||
accPageBase = accPageKey;
|
||||
accPageExt = (!accPageKey.StartsWith("<U-") && useDefaultExt) ? "A" : string.Empty;
|
||||
}
|
||||
|
||||
return accPageKey;
|
||||
return FormatAccPageKeyWithExt(accPageID, spDefault, igDefault, ref accPageBase, ref accPageExt);
|
||||
}
|
||||
|
||||
public ROFSTLookup.rochild GetROChildByAccPageID(string accPageID)
|
||||
@@ -392,16 +357,19 @@ namespace VEPROMS.CSLA.Library
|
||||
|
||||
public ROFSTLookup.rochild GetROChildByAccPageID(string accPageID, string spDefault, string igDefault)
|
||||
{
|
||||
string accPageBase = string.Empty;
|
||||
string accPageExt = string.Empty;
|
||||
|
||||
// Cleanup accPageID if necessary [Note* This will also handle any UnitInfo Ro Values (ex: "<U-NUMBER>")]
|
||||
string accPageKey = FormatAccPageKey(accPageID, spDefault, igDefault);
|
||||
string accPageKey = FormatAccPageKeyWithExt(accPageID, spDefault, igDefault, ref accPageBase, ref accPageExt);
|
||||
|
||||
ROFSTLookup.rochild rc = RofstDataGetChildByAccPageID(_rofstID, accPageID, spDefault, igDefault);
|
||||
ROFSTLookup.rochild rc = RofstDataGetChildByAccPageID(_rofstID, accPageBase);
|
||||
|
||||
if (!string.IsNullOrEmpty(rc.roid) && rc.roid.Length < 16 && Regex.IsMatch(accPageKey, @".*\.[A-Z]") && rc.children != null && rc.children.Count() > 0)
|
||||
//if (rc.ID >=0 && rc.roid.Length < 16 && Regex.IsMatch(accPageKey, @".*\.[A-Z]") && rc.children != null && rc.children.Count() > 0)
|
||||
if (rc.ID >= 0 && rc.roid.Length < 16 && !string.IsNullOrEmpty(accPageExt) && rc.children != null && rc.children.Count() > 0)
|
||||
{
|
||||
// Check if AccPageID/Key has a return value specific extension. Try to find the RoChild record with the specific return value type,
|
||||
// If not found Or the specific extension value is (Null or Empty), then just return the first/default return value type in the list of children
|
||||
var accPageExt = Convert.ToString(accPageKey.ToCharArray().LastOrDefault());
|
||||
var roExt = Extensions.Where(x => x.AccPageExt.Equals(accPageExt)).SingleOrDefault();
|
||||
|
||||
return (rc.children.Where(x => x.roid.Substring(12, 4) == roExt.RoidExt && !string.IsNullOrEmpty(x.value)).Any()) ? rc.children.Where(x => x.roid.Substring(12, 4) == roExt.RoidExt).Single() : rc.children.First();
|
||||
@@ -476,12 +444,12 @@ namespace VEPROMS.CSLA.Library
|
||||
|
||||
public string GetTranslatedRoValue(string roid, bool DoCaret, bool DoDOSSuperSubScript)
|
||||
{
|
||||
roid = FormatRoidKey(roid);
|
||||
roid = FormatRoidKey(roid, true);
|
||||
|
||||
string retval = GetRoChild(roid).value;
|
||||
|
||||
if (string.IsNullOrEmpty(retval))
|
||||
return string.Empty;
|
||||
return "?"; // Returning a "?" character indicates that the selected RO Value no longer exists or has been deleted.
|
||||
|
||||
retval = ReplaceUnicode(retval, DoCaret);
|
||||
retval = ConvertFortranFormatToScienctificNotation(retval);
|
||||
@@ -1216,6 +1184,40 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
|
||||
private List<string> GetBaseAccPageKeys()
|
||||
{
|
||||
try
|
||||
{
|
||||
List<string> lst = new List<string>();
|
||||
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
{
|
||||
using (SqlCommand cmd = cn.CreateCommand())
|
||||
{
|
||||
cmd.CommandTimeout = Database.DefaultTimeout;
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
cmd.CommandText = "vesp_RofstDataGetBaseAccPageKeys";
|
||||
|
||||
cmd.Parameters.Add(new SqlParameter("@RofstID", SqlDbType.Int)).Value = _rofstID;
|
||||
|
||||
using (SafeDataReader dr = new SafeDataReader(cmd.ExecuteReader()))
|
||||
{
|
||||
while (dr.Read())
|
||||
{
|
||||
lst.Add(dr.GetValue("BaseAccPageID").ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return lst;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new DbCslaException("RofstData.vesp_RofstDataGetBaseAccPageKeys", ex);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region (Core/Base logic for RO Values & UnitInfo RO Values)
|
||||
@@ -1263,17 +1265,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
|
||||
private ROFSTLookup.rochild RofstDataGetChildByAccPageID(int rofstID, string accPageID, string spDefault, string igDefault, bool loadChildren = false, bool loadAllChildren = false)
|
||||
private ROFSTLookup.rochild RofstDataGetChildByAccPageID(int rofstID, string accPageID)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Cleanup / Reformat the AccPageID if necessary (Note* This method also handles the UnitInfo Ro Values. ex: "<U-NUMBER>")
|
||||
string accPageKey = FormatAccPageKey(accPageID, spDefault, igDefault);
|
||||
|
||||
// Check if roid is for a Unit Information RO Value Tag
|
||||
if (!string.IsNullOrEmpty(accPageKey) && accPageKey.StartsWith("<U-"))
|
||||
if (!string.IsNullOrEmpty(accPageID) && accPageID.StartsWith("<U-"))
|
||||
{
|
||||
return GetUnitInfoRoChild(GetUnitInfoRoidByAccPageID(accPageKey));
|
||||
return GetUnitInfoRoChild(GetUnitInfoRoidByAccPageID(accPageID));
|
||||
}
|
||||
|
||||
// Lookup RO Value in the database based on the AccPageKey
|
||||
@@ -1286,13 +1285,13 @@ namespace VEPROMS.CSLA.Library
|
||||
cmd.CommandText = "vesp_RofstDataGetChildByAccPageID";
|
||||
|
||||
cmd.Parameters.Add(new SqlParameter("@RofstID", SqlDbType.Int)).Value = rofstID;
|
||||
cmd.Parameters.Add(new SqlParameter("@AccPageID", SqlDbType.VarChar)).Value = accPageKey;
|
||||
cmd.Parameters.Add(new SqlParameter("@AccPageID", SqlDbType.VarChar)).Value = accPageID;
|
||||
|
||||
using (SafeDataReader dr = new SafeDataReader(cmd.ExecuteReader()))
|
||||
{
|
||||
if (dr.Read())
|
||||
{
|
||||
return ConvertToRochildObject(dr, loadChildren, loadAllChildren);
|
||||
return ConvertToRochildObject(dr, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1306,6 +1305,53 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
|
||||
private string FormatAccPageKeyWithExt(string accPageID, string spDefault, string igDefault, ref string accPageBase, ref string accPageExt)
|
||||
{
|
||||
accPageBase = string.Empty;
|
||||
accPageExt = string.Empty;
|
||||
|
||||
if (!string.IsNullOrEmpty(accPageID))
|
||||
{
|
||||
accPageID = accPageID.ToUpper();
|
||||
|
||||
if (!accPageID.StartsWith("<")) accPageID = string.Format("<{0}", accPageID);
|
||||
if (!accPageID.EndsWith(">")) accPageID = string.Format("{0}>", accPageID);
|
||||
|
||||
accPageID = accPageID.Replace("<U>", "<U-NUMBER>");
|
||||
accPageID = accPageID.ToCleanString(); // Removes any spaces
|
||||
|
||||
// Clean up the AccPageID before using it to do a lookup
|
||||
if (accPageID.StartsWith("<U-"))
|
||||
{
|
||||
accPageBase = accPageID;
|
||||
accPageExt = string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrEmpty(spDefault)) accPageID = accPageID.Replace("<SP-", "<" + spDefault + "-");
|
||||
if (!string.IsNullOrEmpty(igDefault)) accPageID = accPageID.Replace("<IG-", "<" + igDefault + "-");
|
||||
|
||||
accPageID = regRoKeyHigh.Replace(accPageID, "_HIGH$3");
|
||||
accPageID = regRoKeyLow.Replace(accPageID, "_LOW$3");
|
||||
accPageID = accPageID.Trim("<>".ToCharArray()); // String < and >
|
||||
|
||||
// Check the end of the AccPageID to determine if its an extension or part of the base key
|
||||
// If the AccPageID doesn't have an extension then set to default
|
||||
if (!Regex.IsMatch(accPageID, @".*\.[A-Z]") || BaseAccPageKeys.Contains(accPageID))
|
||||
{
|
||||
// No Extension, set to default
|
||||
accPageID = string.Format("{0}.A", accPageID);
|
||||
}
|
||||
|
||||
// Set AccPage Base and Extension return values
|
||||
accPageBase = accPageID.Substring(0, (accPageID.Length - 2));
|
||||
accPageExt = Convert.ToString(accPageID.ToCharArray().LastOrDefault());
|
||||
}
|
||||
}
|
||||
|
||||
return (!string.IsNullOrEmpty(accPageID)) ? accPageID.ToUpper() : accPageID;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region (Parse/Load)
|
||||
|
@@ -955,6 +955,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
string fileNameOnly = null;
|
||||
|
||||
|
||||
//B2020-127 don't try to parse out a file name from "?" (happens with the RO figure no longer exists)
|
||||
// - this allows it to drop through and put an annotation on the step
|
||||
if (ii.IsFigure && Text != null && Text.Length > 0 && value != "?")
|
||||
|
@@ -947,17 +947,13 @@ namespace VEPROMS.CSLA.Library
|
||||
ROFstInfo rofst = null;
|
||||
ROFSTLookup lookup = null;
|
||||
|
||||
string igPrefix = null;
|
||||
string spPrefix = null;
|
||||
bool convertCaretToDeltaSymbol = (sect.ActiveSection != null) ? sect.ActiveSection.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta : false; // C2018-003 fixed use of getting the active section
|
||||
|
||||
if (dvi.DocVersionAssociationCount > 0)
|
||||
{
|
||||
hasRos = true;
|
||||
rofst = dvi.DocVersionAssociations[0].MyROFst;
|
||||
igPrefix = dvi.DocVersionConfig.RODefaults_graphicsprefix;
|
||||
spPrefix = dvi.DocVersionConfig.RODefaults_setpointprefix;
|
||||
|
||||
|
||||
// The following code sets the DocVersionInfo and the OtherChild properties for the current RofstLookup instance (lookup), and also enables Caching
|
||||
// When printing or converting word sections to pdf, any RoChild "value" is the Unit Specific Value for the SelectedSlave
|
||||
lookup = rofst.GetROFSTLookup(dvi, Convert.ToString(sect.MyDocVersion.DocVersionConfig.SelectedSlave));
|
||||
@@ -1161,8 +1157,10 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
if (Volian.Base.Library.BaselineMetaFile.IsOpen && Volian.Base.Library.BaselineMetaFile.IncludeWordSecText) roTokenForBaseline = sel.Text;
|
||||
if (statusChange != null) statusChange(VolianStatusType.Update, sel.Start, string.Format("{0} ROs Refreshed", roCount++));
|
||||
|
||||
ROFSTLookup.rochild roc = GetCachedRoByAccPageID(lookup, sel.Text, spPrefix, igPrefix, convertCaretToDeltaSymbol);
|
||||
|
||||
// B2022-088: [JPR] Find Doc Ro button not working in Word Sections
|
||||
// B2022-098: [JPR] ROs not being resolved in Word Sections
|
||||
ROFSTLookup.rochild roc = GetCachedRoByAccPageID(lookup, sel.Text, convertCaretToDeltaSymbol);
|
||||
|
||||
int roType = roc.type;
|
||||
string roValue = roc.value;
|
||||
@@ -1380,7 +1378,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
|
||||
private static ROFSTLookup.rochild GetCachedRoByAccPageID(ROFSTLookup lookup, string selText, string spPrefix, string igPrefix, bool convertCaretToDeltaSymbol)
|
||||
private static ROFSTLookup.rochild GetCachedRoByAccPageID(ROFSTLookup lookup, string selText, bool convertCaretToDeltaSymbol)
|
||||
{
|
||||
string accPageBase = string.Empty;
|
||||
string accPageExt = string.Empty;
|
||||
@@ -1389,13 +1387,13 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ROFSTLookup.rochild roc = ROFSTLookup.GetEmptyRoChild();
|
||||
|
||||
string accPageKey = ROFSTLookup.FormatAccPageKey(selText, spPrefix, igPrefix, ref accPageBase, ref accPageExt, true);
|
||||
string accPageKey = lookup.FormatAccPageKey(selText, ref accPageBase, ref accPageExt);
|
||||
|
||||
// Check if the Rochild is in the PrintCache (use base accPageID without specific extension)
|
||||
if (!RoPrintCache.ContainsKey(accPageBase))
|
||||
{
|
||||
// Lookup RoChild Info from database
|
||||
roc = lookup.GetROChildByAccPageID(accPageBase, spPrefix, igPrefix);
|
||||
roc = lookup.GetROChildByAccPageID(accPageBase);
|
||||
|
||||
// Check if RO is valid
|
||||
if (roc.ID < 0 || string.IsNullOrEmpty(roc.roid))
|
||||
@@ -1415,7 +1413,8 @@ namespace VEPROMS.CSLA.Library
|
||||
|
||||
|
||||
// All ROs at this point should have a specific accPageExt or the default (A/0041)
|
||||
roc = (roc.children.Where(x => x.appid.EndsWith(accPageExt) && !string.IsNullOrEmpty(x.value)).Any()) ? roc.children.Where(x => x.appid.EndsWith(accPageExt)).Single() : roc.children.First();
|
||||
if (roc.children != null && roc.children.Count() > 0)
|
||||
roc = (roc.children.Where(x => x.appid.EndsWith(accPageExt) && !string.IsNullOrEmpty(x.value)).Any()) ? roc.children.Where(x => x.appid.EndsWith(accPageExt)).Single() : roc.children.First();
|
||||
|
||||
// Check the RoType
|
||||
roc.type = ((roc.type & 4) == 4 && roc.value.StartsWith("<<G")) ? 4 : roc.type;
|
||||
@@ -2033,7 +2032,9 @@ namespace VEPROMS.CSLA.Library
|
||||
executeResult = find.Execute();
|
||||
// B2022-053 if the found text does not begin with a "<" and end with a ">", then
|
||||
// move past that text and try the Word Find function again.
|
||||
if (executeResult && !sel.Text.StartsWith("<") && !sel.Text.EndsWith(">"))
|
||||
// B2022-088: [JPR] Find Doc Ro button not working in Word Sections
|
||||
// B2022-098: [JPR] ROs not being resolved in Word Sections
|
||||
if (executeResult && !string.IsNullOrEmpty(sel.Text) && !sel.Text.StartsWith("<") && !sel.Text.EndsWith(">"))
|
||||
{
|
||||
sel.MoveStart(LBWdUnits.wdCharacter, sel.Text.Length - 1);
|
||||
tryagain = true;
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -530,21 +530,26 @@ namespace VEPROMS.CSLA.Library
|
||||
private static List<string> GetROIDsFromLookup(ROFstInfo rofst, List<string> ChangedFiles, DocVersionInfo docver)
|
||||
{
|
||||
List<string> roids = new List<string>();
|
||||
|
||||
ROFSTLookup myLookup = new ROFSTLookup(rofst.ROFstID, docver);
|
||||
// B2022-026 RO Memory Reduction code - get only the Image type of ROs
|
||||
ROFSTLookup.rochild[] children = myLookup.GetRoChildrenByType(E_ROValueType.Image);
|
||||
|
||||
if (children != null && children.Length > 0)
|
||||
|
||||
// B2022-088: [JPR] Find Doc Ro button not working in Word Sections
|
||||
// B2022-098: [JPR] ROs not being resolved in Word Sections
|
||||
if(rofst != null && ChangedFiles != null && ChangedFiles.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < children.Length; i++)
|
||||
{
|
||||
string filename = children[i].value;
|
||||
filename = filename.Substring(0, filename.IndexOf('\n'));
|
||||
ROFSTLookup myLookup = new ROFSTLookup(rofst.ROFstID, docver);
|
||||
// B2022-026 RO Memory Reduction code - get only the Image type of ROs
|
||||
ROFSTLookup.rochild[] children = myLookup.GetRoChildrenByType(E_ROValueType.Image);
|
||||
|
||||
if (ChangedFiles.Contains(filename))
|
||||
if (children != null && children.Length > 0)
|
||||
{
|
||||
for (int i = 0; i < children.Length; i++)
|
||||
{
|
||||
roids.Add(children[i].roid);
|
||||
string filename = children[i].value;
|
||||
filename = filename.Substring(0, filename.IndexOf('\n'));
|
||||
|
||||
if (ChangedFiles.Contains(filename))
|
||||
{
|
||||
roids.Add(children[i].roid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -600,11 +605,14 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
Dictionary<string, int> myRoImagesList = new Dictionary<string, int>();
|
||||
|
||||
foreach (ROImageInfo myROImage in myROImages)
|
||||
if (myROImages != null)
|
||||
{
|
||||
myRoImagesList.Add(ROImageKey(myROImage.FileName, myROImage.DTS), myROImage.ImageID);
|
||||
foreach (ROImageInfo myROImage in myROImages)
|
||||
{
|
||||
myRoImagesList.Add(ROImageKey(myROImage.FileName, myROImage.DTS), myROImage.ImageID);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return myRoImagesList;
|
||||
}
|
||||
|
||||
@@ -616,12 +624,18 @@ namespace VEPROMS.CSLA.Library
|
||||
private static string buildImageIDString(List<int> myROImageIDs)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
string sep = "";
|
||||
|
||||
foreach (int imageID in myROImageIDs)
|
||||
|
||||
// B2022-088: [JPR] Find Doc Ro button not working in Word Sections
|
||||
// B2022-098: [JPR] ROs not being resolved in Word Sections
|
||||
if (myROImageIDs != null)
|
||||
{
|
||||
sb.Append(sep + imageID.ToString());
|
||||
sep = ",";
|
||||
string sep = string.Empty;
|
||||
|
||||
foreach (int imageID in myROImageIDs)
|
||||
{
|
||||
sb.Append(sep + imageID.ToString());
|
||||
sep = ",";
|
||||
}
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
|
Reference in New Issue
Block a user