B2022-098: ROs not being resolved in Word Sections

This commit is contained in:
Jake
2022-08-16 15:02:30 +00:00
parent 9bdaebadfc
commit ac8e8432b7
10 changed files with 913 additions and 302 deletions

View File

@@ -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;