Support for Inactive document styles

Change ‘Count’ to ‘MaxIndex’ for ‘vlnIndexedFormatList’
Add Inactive flag
This commit is contained in:
2015-07-20 14:28:22 +00:00
parent bd75e47b8b
commit a98f4998da
5 changed files with 68 additions and 42 deletions

View File

@@ -94,10 +94,10 @@ namespace VEPROMS
PlantFormat pf = _SectionConfig.MyFormat != null ? _SectionConfig.MyFormat.PlantFormat : _SectionConfig.MyDefaultFormat.PlantFormat;
CheckOffList chkoffList = pf.FormatData.ProcData.CheckOffData.CheckOffList;
CheckOffHeaderList chkoffHeaderList = pf.FormatData.ProcData.CheckOffData.CheckOffHeaderList;
if (ppGpbxSignoffCheckoff.Enabled && (chkoffList != null && chkoffList.Count > 1)
if (ppGpbxSignoffCheckoff.Enabled && (chkoffList != null && chkoffList.MaxIndex > 1)
&& (ppCmbxCheckoffType.SelectedIndex != _SectionConfig.Section_CheckoffListSelection - (_hasSectionCheckoffDefault? 1:0)))
_SectionConfig.Section_CheckoffListSelection = ppCmbxCheckoffType.SelectedIndex + (_hasSectionCheckoffDefault? 1:0);
if (ppCmbxCheckoffHeading.Enabled && chkoffHeaderList != null && chkoffHeaderList.Count > 1)
if (ppCmbxCheckoffHeading.Enabled && chkoffHeaderList != null && chkoffHeaderList.MaxIndex > 1)
_SectionConfig.Section_CheckoffHeaderSelection = ppCmbxCheckoffHeading.SelectedIndex;
if (ppCmbxSectPagination.SelectedValue == null)
@@ -174,11 +174,11 @@ namespace VEPROMS
bool isWordSect = true;
int sectype = (int)sectinfo.MyContent.Type - 10000;
PlantFormat pf = sectinfo.ActiveFormat.PlantFormat;
for (int i = 0; i < pf.DocStyles.DocStyleList.Count; i++)
foreach (DocStyle ds in pf.DocStyles.DocStyleList)
{
if (pf.DocStyles.DocStyleList[i].Index == sectype)
if (ds.Index == sectype)
{
isWordSect = !pf.DocStyles.DocStyleList[i].IsStepSection;
isWordSect = !ds.IsStepSection;
break;
}
}
@@ -505,13 +505,13 @@ namespace VEPROMS
if (pf != opf)
{
oldDocStyles = new DocStyleList(null);
for (int i = 0; i < opf.DocStyles.DocStyleList.Count; i++)
foreach (DocStyle ds in opf.DocStyles.DocStyleList)
{
if (_isStepSection && opf.DocStyles.DocStyleList[i].IsStepSection)
oldDocStyles.Add(opf.DocStyles.DocStyleList[i]); // find only step section types
else if (!_isStepSection && !opf.DocStyles.DocStyleList[i].IsStepSection)
oldDocStyles.Add(opf.DocStyles.DocStyleList[i]); // find only accessory (MS Word) section types
if (_SectionConfig.SectionType == opf.DocStyles.DocStyleList[i].Index) oldSelIndx = oldDocStyles.Count - 1;
if (_isStepSection && ds.IsStepSection)
oldDocStyles.Add(ds); // find only step section types
else if (!_isStepSection && !ds.IsStepSection)
oldDocStyles.Add(ds); // find only accessory (MS Word) section types
if (_SectionConfig.SectionType == ds.Index) oldSelIndx = oldDocStyles.Count - 1;
}
}
if (oldSelIndx < 0) oldSelIndx = 0;
@@ -519,13 +519,13 @@ namespace VEPROMS
DocStyleList newDocStyles = new DocStyleList(null);
int selindx = -1;
for (int i = 0; i < pf.DocStyles.DocStyleList.Count; i++)
foreach (DocStyle nds in pf.DocStyles.DocStyleList)
{
if (_isStepSection && pf.DocStyles.DocStyleList[i].IsStepSection)
newDocStyles.Add(pf.DocStyles.DocStyleList[i]); // add only step section types
else if (!_isStepSection && !pf.DocStyles.DocStyleList[i].IsStepSection)
newDocStyles.Add(pf.DocStyles.DocStyleList[i]); // add only accessory (MS Word) section types
if (_SectionConfig.SectionType == pf.DocStyles.DocStyleList[i].Index) selindx = newDocStyles.Count - 1;
if (_isStepSection && nds.IsStepSection)
newDocStyles.Add(nds); // add only step section types
else if (!_isStepSection && !nds.IsStepSection)
newDocStyles.Add(nds); // add only accessory (MS Word) section types
if (_SectionConfig.SectionType == nds.Index) selindx = newDocStyles.Count - 1;
}
if (selindx < 0) selindx = 0;
// if changing format, check for valid type (see comment above)
@@ -563,7 +563,7 @@ namespace VEPROMS
PlantFormat pf = _SectionConfig.MyFormat!=null?_SectionConfig.MyFormat.PlantFormat:_SectionConfig.MyDefaultFormat.PlantFormat;
CheckOffList chkoffList = pf.FormatData.ProcData.CheckOffData.CheckOffList;
CheckOffHeaderList chkoffHeaderList = pf.FormatData.ProcData.CheckOffData.CheckOffHeaderList;
if (chkoffList != null && chkoffList.Count > 0 &&
if (chkoffList != null && chkoffList.MaxIndex > 0 &&
(pf.FormatData.ProcData.CheckOffData.Menu == "Signoff" || chkoffList[0].MenuItem.ToUpper().Equals("{SECTION DEFAULT}")))
{
if (SectionPropertyCheckOffList!=null)SectionPropertyCheckOffList.Clear();
@@ -571,7 +571,7 @@ namespace VEPROMS
// Don't put up the first item in the chkoffList, it is '{Section Default}'.
_hasSectionCheckoffDefault = false;
//for (int i = 1; i < chkoffList.Count; i++)
for (int i = 0; i < chkoffList.Count; i++)
for (int i = 0; i < chkoffList.MaxIndex; i++)
{
if (!chkoffList[i].MenuItem.ToUpper().Equals("{SECTION DEFAULT}"))
SectionPropertyCheckOffList.Add(chkoffList[i]);
@@ -586,7 +586,7 @@ namespace VEPROMS
{
ppGpbxSignoffCheckoff.Enabled = false;
}
if (chkoffHeaderList != null && chkoffHeaderList.Count > 1)
if (chkoffHeaderList != null && chkoffHeaderList.MaxIndex > 1)
{
lblCheckoffHeading.Enabled = true;
ppCmbxCheckoffHeading.Enabled = true;