B2019-052: Pdf Links for each Referenced Object and Transition within a Step

This commit is contained in:
2019-04-25 13:07:19 +00:00
parent 456909e848
commit cd3656c955
3 changed files with 154 additions and 75 deletions

View File

@@ -1061,47 +1061,12 @@ namespace Volian.Print.Library
if (MyItemInfo.MyContent.Text.ToUpper().Contains("LINK:TR") && MyItemInfo.MyContent.ContentTransitionCount==0)
Console.WriteLine("Missing Transition {0}", MyItemInfo.ItemID);
chk1.SetLocalDestination(string.Format("ItemID={0}", MyItemInfo.ItemID)); // Destination
if (MyItemInfo.MyContent.ContentTransitionCount > 0)
{
TransitionInfo ti = MyItemInfo.MyContent.ContentTransitions[0];
ItemInfo tiDefault = GetDefaultItemInfo(ti.MyItemToID);
if (ti.MyItemToID.MyProcedure.ItemID == MyItemInfo.MyProcedure.ItemID &&
!MyItemInfo.ActiveSection.DisplayNumber.ToUpper().StartsWith("FOLDOUT"))
{ // Local Go To
if (ti.MyItemToID.MyContent.Type > 9999) // B2019-053: internal if going to a section, not just a step (changed from 19999 to 9999
// B2018-034 The following code previously used IParagraph rather than _IParagraph. See first Comment
foreach (Chunk chk in _IParagraph.Chunks)
{
//Console.WriteLine("\"LocalGoTo\"\t{0}", tiDefault.ItemID);
chk.SetLocalGoto(string.Format("ItemID={0}", tiDefault.ItemID));
chk.SetBackground(Color.CYAN);
chk.SetBackground(new Color(System.Drawing.Color.LightCyan));
}
}
else // Remote Go To
{
foreach (Chunk chk in IParagraph.Chunks)
{
//Console.WriteLine("\"RemoteGoTo\"\t{0}", tiDefault.ItemID);
chk.SetRemoteGoto(ti.MyItemToID.MyProcedure.DisplayNumber.Replace("/", "_") + ".pdf", string.Format("ItemID={0}", tiDefault.ItemID));
chk.SetBackground(new Color(System.Drawing.Color.PeachPuff));
}
}
}
if (MyItemInfo.MyContent.ContentRoUsageCount > 0)
{
RoUsageInfo ru = MyItemInfo.MyContent.ContentRoUsages[0];
// B2018-034 The following code previously used IParagraph rather than _IParagraph. See first Comment
foreach (Chunk chk in _IParagraph.Chunks)
{
if (ru.ROID.Substring(0, 4) != "FFFF")
{
chk.SetRemoteGoto("completeroreport.pdf", string.Format("ROID={0}", ru.ROID.Substring(0, 12).ToUpper()));
//Console.WriteLine("ROID={0},{1}", ru.ROID.Substring(0, 12).ToUpper(), chk.Content);
chk.SetBackground(new Color(System.Drawing.Color.LightGreen));
}
}
}
// B2019-052: If multiple ROs/Transitions within a step, each should have a their own link rather than all linking to same thing.
// Note the pdf link code that was here was moved to Rtf2iTextSharp.cs in DoVisitText so that each 'chunk' could have a link.
// The code that remained here was the code that marks the destination for each step & the code that does the pdf links for
// enhanced steps.
// Also, the method GetDefaultItemInfo was moved to Rtf2iTextSharp.cs also - it was only called from code that was moved.
StepConfig sc = new StepConfig(MyItemInfo.MyContent.Config);
DVEnhancedDocuments dveds = MyItemInfo.MyDocVersion.DocVersionConfig.MyEnhancedDocuments;
foreach (EnhancedDocument ed in sc.MyEnhancedDocuments)
@@ -1163,36 +1128,6 @@ namespace Volian.Print.Library
// chk.SetBackground(new Color(System.Drawing.Color.LemonChiffon));
//}
}
private ItemInfo GetDefaultItemInfo(ItemInfo myItemInfo)
{
if (myItemInfo.IsProcedure && myItemInfo.Sections != null)
{
SectionInfo siProcedureSteps = null;
foreach (SectionInfo si in myItemInfo.Sections)
{
if (si.IsDefaultSection)
{
if (si.Steps != null) return si.Steps[0];
if (si.Sections != null) return si.Sections[0];
return si;
}
if (si.DisplayText.Contains("Procedure Step"))
siProcedureSteps = si;
}
if (siProcedureSteps != null)
{
if (siProcedureSteps.Steps != null) return siProcedureSteps.Steps[0];
if (siProcedureSteps.Sections != null) return siProcedureSteps.Sections[0];
return siProcedureSteps;
}
}
if (myItemInfo.IsSection)
{
if (myItemInfo.Steps != null) return myItemInfo.Steps[0];
if (myItemInfo.Sections != null) return myItemInfo.Sections[0];
}
return myItemInfo;
}
private static bool _MissingInitials = false;
public static bool MissingInitials