This commit is contained in:
Kathy Ruffing 2010-08-10 10:51:21 +00:00
parent 430396e0d0
commit be20ad5e9c
3 changed files with 52 additions and 10 deletions

View File

@ -543,8 +543,8 @@ namespace VEPROMS.CSLA.Library
sel.ParagraphFormat.LineSpacingRule = LBWdLineSpacing.wdLineSpaceExactly; sel.ParagraphFormat.LineSpacingRule = LBWdLineSpacing.wdLineSpaceExactly;
sel.ParagraphFormat.LineSpacing = 12; sel.ParagraphFormat.LineSpacing = 12;
fileName = CreatePDF(fileName, openPdf); fileName = CreatePDF(fileName, openPdf);
MyApp.ActiveDocument.Close(); MyApp.ActiveDocument.Close(false);
MyApp.Quit(); MyApp.Quit(false);
_MyApp = null; _MyApp = null;
return fileName; return fileName;
} }

View File

@ -76,6 +76,14 @@ namespace VEPROMS.CSLA.Library
return MyParent.Description + " - " + Description + " (" + Name + ")"; return MyParent.Description + " - " + Description + " (" + Name + ")";
} }
} }
public StepSectionLayoutData MyStepSectionLayoutData
{
get { return PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData; }
}
public StepSectionPrintData MyStepSectionPrintData
{
get { return PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData; }
}
} }
public partial class FormatInfoList public partial class FormatInfoList
{ {

View File

@ -287,6 +287,15 @@ namespace VEPROMS.CSLA.Library
#region ItemInfo #region ItemInfo
public partial class ItemInfo:IVEDrillDownReadOnly public partial class ItemInfo:IVEDrillDownReadOnly
{ {
public bool IsFirstSubStep
{
get
{
if (!IsStepPart) return false;
if (IsHigh) return false;
return (MyPrevious == null);
}
}
#region StepLevel #region StepLevel
private int _StepLevel = -2;// Not yet calculated private int _StepLevel = -2;// Not yet calculated
public int StepLevel public int StepLevel
@ -355,41 +364,66 @@ namespace VEPROMS.CSLA.Library
{ {
if(item == null) return 0; if(item == null) return 0;
int id=0; int id=0;
if(item.ItemID == 507) // Determines the substep level.
id = item.ItemID;
int level = CountLevels(item); int level = CountLevels(item);
int firstInc = item.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.PaginateOnFirstSubstep ? 0 : 1;
// PaginateOnFirstSubstep allows orphans, first child can be separated from its parent.
int firstInc = item.ActiveFormat.MyStepSectionLayoutData.PaginateOnFirstSubstep ? 0 : 1;
ItemInfo parent = item.ActiveParent as ItemInfo; ItemInfo parent = item.ActiveParent as ItemInfo;
// TODO: Format flag 'TreatAsSequential':
// The following needs to account for use of format flag 'TreatAsSequential' when doing
// formats that have it.
if (item.IsExactType("And") || item.IsExactType("Or") || item.IsExactType("ImplicitOr")) if (item.IsExactType("And") || item.IsExactType("Or") || item.IsExactType("ImplicitOr"))
level++; level++;
if (parent != null && (parent.IsExactType("And") || parent.IsExactType("Or"))) if (parent != null && (parent.IsExactType("And") || parent.IsExactType("Or")))
level++; level++;
// First substep, this is where it uses the orphan logic from above.
if (!item.IsRNOPart && !item.IsHigh && item.MyPrevious == null) if (!item.IsRNOPart && !item.IsHigh && item.MyPrevious == null)
level+=firstInc; level += firstInc;
else
firstInc = 0;
// Try not to paginate on a step that has Cautions & Notes, keep the Caution/Note with
// the step.
if (item.IsStepPart) if (item.IsStepPart)
{ {
if (item.Cautions != null || item.Notes != null) if (item.Cautions != null || item.Notes != null)
level += 2; level += 2;
} }
// Paginate before first caution, not between cautions.
else if (item.IsCautionPart) else if (item.IsCautionPart)
{ {
if (item.MyPrevious == null) level-=(1 + firstInc); if (item.MyPrevious == null) level-=(1 + firstInc);
else level++; else level++;
} }
// Paginate before first note, if the step does not have a caution.
// Otherwise, try to keep the notes together.
else if (item.IsNotePart) else if (item.IsNotePart)
{ {
if (parent.Cautions == null && item.MyPrevious == null) level-=(1 + firstInc); if (parent.Cautions == null && item.MyPrevious == null) level-=(1 + firstInc);
else level++; else level++;
} }
// Try not to paginate on a table.
else if (item.IsTablePart) else if (item.IsTablePart)
{ {
level += 2; level += 2;
} }
// For an RNO to the right, make it the same level as the AER item.
else if(item.IsRNOPart) else if(item.IsRNOPart)
{ {
level = (item.ActiveParent as ItemInfo).StepLevel + item.RNOLevel - item.ColumnMode;
} }
return level; return level;
} }
/// <summary>
/// Count all levels, including substeps within RNOs. Ignore RNOs that are to the right of
/// the AER, but count those that are below higher level RNOs.
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
private static int CountLevels(ItemInfo item) private static int CountLevels(ItemInfo item)
{ {
int level = 0; int level = 0;
@ -399,7 +433,7 @@ namespace VEPROMS.CSLA.Library
if (ignoreRNOs > 0 && item.IsRNOPart) if (ignoreRNOs > 0 && item.IsRNOPart)
ignoreRNOs--; ignoreRNOs--;
else else
level++; // need logic to not increment for RNOs less than MaxRNO level++;
item = item.ActiveParent as ItemInfo; item = item.ActiveParent as ItemInfo;
} }
return level; return level;
@ -829,7 +863,7 @@ namespace VEPROMS.CSLA.Library
//if (si.SectionConfig.Section_ColumnMode != SectionConfig.SectionColumnMode.Default) //if (si.SectionConfig.Section_ColumnMode != SectionConfig.SectionColumnMode.Default)
return (int)si.SectionConfig.Section_ColumnMode - 1; return (int)si.SectionConfig.Section_ColumnMode - 1;
} }
return (ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.PMode ?? 2) -1; return (ActiveFormat.MyStepSectionLayoutData.PMode ?? 2) -1;
} }
} }
/// <summary> /// <summary>
@ -2147,7 +2181,7 @@ namespace VEPROMS.CSLA.Library
if (ii.MyContent.Type == MyContent.Type) count++; if (ii.MyContent.Type == MyContent.Type) count++;
ii = ii.NextItem; ii = ii.NextItem;
} }
if (count < macro.Grouping) addToList = false; if (count <= macro.Grouping) addToList = false;
} }
if (addToList) tmp.Add(macro); if (addToList) tmp.Add(macro);
} }