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.LineSpacing = 12;
fileName = CreatePDF(fileName, openPdf);
MyApp.ActiveDocument.Close();
MyApp.Quit();
MyApp.ActiveDocument.Close(false);
MyApp.Quit(false);
_MyApp = null;
return fileName;
}

View File

@ -76,6 +76,14 @@ namespace VEPROMS.CSLA.Library
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
{

View File

@ -287,6 +287,15 @@ namespace VEPROMS.CSLA.Library
#region ItemInfo
public partial class ItemInfo:IVEDrillDownReadOnly
{
public bool IsFirstSubStep
{
get
{
if (!IsStepPart) return false;
if (IsHigh) return false;
return (MyPrevious == null);
}
}
#region StepLevel
private int _StepLevel = -2;// Not yet calculated
public int StepLevel
@ -355,41 +364,66 @@ namespace VEPROMS.CSLA.Library
{
if(item == null) return 0;
int id=0;
if(item.ItemID == 507)
id = item.ItemID;
// Determines the substep level.
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;
// 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"))
level++;
if (parent != null && (parent.IsExactType("And") || parent.IsExactType("Or")))
level++;
// First substep, this is where it uses the orphan logic from above.
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.Cautions != null || item.Notes != null)
level += 2;
}
else if (item.IsCautionPart)
// Paginate before first caution, not between cautions.
else if (item.IsCautionPart)
{
if (item.MyPrevious == null) level-=(1 + firstInc);
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)
{
if (parent.Cautions == null && item.MyPrevious == null) level-=(1 + firstInc);
else level++;
}
// Try not to paginate on a table.
else if (item.IsTablePart)
{
level += 2;
}
// For an RNO to the right, make it the same level as the AER item.
else if(item.IsRNOPart)
{
level = (item.ActiveParent as ItemInfo).StepLevel + item.RNOLevel - item.ColumnMode;
}
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)
{
int level = 0;
@ -399,7 +433,7 @@ namespace VEPROMS.CSLA.Library
if (ignoreRNOs > 0 && item.IsRNOPart)
ignoreRNOs--;
else
level++; // need logic to not increment for RNOs less than MaxRNO
level++;
item = item.ActiveParent as ItemInfo;
}
return level;
@ -829,7 +863,7 @@ namespace VEPROMS.CSLA.Library
//if (si.SectionConfig.Section_ColumnMode != SectionConfig.SectionColumnMode.Default)
return (int)si.SectionConfig.Section_ColumnMode - 1;
}
return (ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.PMode ?? 2) -1;
return (ActiveFormat.MyStepSectionLayoutData.PMode ?? 2) -1;
}
}
/// <summary>
@ -2147,7 +2181,7 @@ namespace VEPROMS.CSLA.Library
if (ii.MyContent.Type == MyContent.Type) count++;
ii = ii.NextItem;
}
if (count < macro.Grouping) addToList = false;
if (count <= macro.Grouping) addToList = false;
}
if (addToList) tmp.Add(macro);
}