Support for Inactive document styles
Change ‘Count’ to ‘MaxIndex’ for ‘vlnIndexedFormatList’ Add Inactive flag
This commit is contained in:
parent
bd75e47b8b
commit
a98f4998da
@ -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;
|
||||
|
@ -1485,7 +1485,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if ((int)MyContent.Type < 20000) return false;
|
||||
int stepType = ((int)MyContent.Type) % 10000;
|
||||
StepDataList sdlist = ActiveFormat.PlantFormat.FormatData.StepDataList;
|
||||
if (stepType > sdlist.Count)
|
||||
if (stepType > sdlist.MaxIndex)
|
||||
{
|
||||
Console.WriteLine("Error getting type - contentid = {0}", MyContent.ContentID);
|
||||
return false;
|
||||
@ -1503,7 +1503,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if ((int)MyContent.Type < 20000) return false;
|
||||
int stepType = ((int)MyContent.Type) % 10000;
|
||||
StepDataList sdlist = ActiveFormat.PlantFormat.FormatData.StepDataList;
|
||||
if (stepType > sdlist.Count)
|
||||
if (stepType > sdlist.MaxIndex)
|
||||
{
|
||||
Console.WriteLine("Error getting type - contentid = {0}", MyContent.ContentID);
|
||||
return false;
|
||||
@ -3024,8 +3024,14 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
int typ = (int)ActiveSection.MyContent.Type;
|
||||
int subtyp = typ % 10000;
|
||||
if (subtyp >= ActiveFormat.PlantFormat.DocStyles.DocStyleList.Count) return ActiveFormat.PlantFormat.DocStyles.DocStyleList[0];
|
||||
if (ActiveFormat.PlantFormat.DocStyles.DocStyleList[subtyp] == null)
|
||||
foreach (DocStyle ds in ActiveFormat.PlantFormat.DocStyles.DocStyleList)
|
||||
{
|
||||
if (ActiveSection.MyContent.ContentEntryCount > 0 && !ds.IsStepSection) return _MyDocStyle = ds;
|
||||
else if (ds.IsStepSection) return _MyDocStyle = ds;
|
||||
}
|
||||
_MyDocStyle = ActiveFormat.PlantFormat.DocStyles.DocStyleList[subtyp];
|
||||
|
||||
}
|
||||
return _MyDocStyle;
|
||||
}
|
||||
@ -3335,7 +3341,7 @@ namespace VEPROMS.CSLA.Library
|
||||
// the ident of the step:
|
||||
bool useSubStepTabs = false;
|
||||
if (doMeta && IsHigh
|
||||
&& !seqtabs[(localPrintLevel < 0 ? 0 : localPrintLevel) % seqtabs.Count].TabToken.Contains("{numericWpar}")
|
||||
&& !seqtabs[(localPrintLevel < 0 ? 0 : localPrintLevel) % seqtabs.MaxIndex].TabToken.Contains("{numericWpar}")
|
||||
&& tbformat.Contains("{")) useSubStepTabs = true;
|
||||
|
||||
// Check to be sure the parent tab should be included... If this sequential is within a note
|
||||
@ -3374,12 +3380,12 @@ namespace VEPROMS.CSLA.Library
|
||||
else if (tbformat != null && tbformat != "" && myParentIdent == "")
|
||||
localPrintLevel += 5;
|
||||
}
|
||||
int itmp = (localPrintLevel + PrintBias + OffsetTab) % seqtabs.Count;
|
||||
int itmp = (localPrintLevel + PrintBias + OffsetTab) % seqtabs.MaxIndex;
|
||||
if (!tbformat.Contains(@"{!C"))
|
||||
tbformat = seqtabs[itmp].PrintTabFormat; // seqtab in 16bit, i.e. '. or )' etc.
|
||||
else
|
||||
tbformat = tbformat.Replace("{seq}", seqtabs[itmp].PrintTabFormat);
|
||||
string tbtoken = seqtabs[localPrintLevel % seqtabs.Count].TabToken; // seqstart in 16bit, number/letter
|
||||
string tbtoken = seqtabs[localPrintLevel % seqtabs.MaxIndex].TabToken; // seqstart in 16bit, number/letter
|
||||
|
||||
// if the tab has a character before the token, trim the front of tab:
|
||||
int br = tbformat.IndexOf("{");
|
||||
@ -3427,7 +3433,7 @@ namespace VEPROMS.CSLA.Library
|
||||
|
||||
// the following prevents the concatenation of parent tabs onto this once the indenting is
|
||||
// past the number of seqtabs.
|
||||
if (localPrintLevel < seqtabs.Count || (PrintLevel < seqtabs.Count && seqtabs[PrintLevel].TabToken.ToUpper().Contains("WPAR")))
|
||||
if (localPrintLevel < seqtabs.MaxIndex || (PrintLevel < seqtabs.MaxIndex && seqtabs[PrintLevel].TabToken.ToUpper().Contains("WPAR")))
|
||||
{
|
||||
ItemInfo mpar = myparent;
|
||||
while (mpar != null && !mpar.IsSection && !mpar.IsHigh && !mpar.IsSequential) mpar = (mpar.MyParent as ItemInfo);
|
||||
@ -4291,7 +4297,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
// first check if format has checkoff data, including checkoffheaders.
|
||||
ProcData pd = ActiveFormat.PlantFormat.FormatData.ProcData;
|
||||
if (pd.CheckOffData == null || pd.CheckOffData.CheckOffHeaderList == null || pd.CheckOffData.CheckOffHeaderList.Count <= 1) _SectionCheckOffHeader = string.Empty;
|
||||
if (pd.CheckOffData == null || pd.CheckOffData.CheckOffHeaderList == null || pd.CheckOffData.CheckOffHeaderList.MaxIndex <= 1) _SectionCheckOffHeader = string.Empty;
|
||||
else
|
||||
{
|
||||
SectionConfig sc = ActiveSection.MyConfig as SectionConfig;
|
||||
@ -4312,8 +4318,8 @@ namespace VEPROMS.CSLA.Library
|
||||
// To determine if the section has a checkoff...
|
||||
// Section won't have checkoffs if there is no checkofflist, or
|
||||
ProcData pd = ActiveFormat.PlantFormat.FormatData.ProcData;
|
||||
if (pd.CheckOffData == null || pd.CheckOffData.CheckOffList == null || pd.CheckOffData.CheckOffList.Count <= 0) return false;
|
||||
if (pd.CheckOffData.CheckOffHeaderList == null || pd.CheckOffData.CheckOffHeaderList.Count <= 1) return true;
|
||||
if (pd.CheckOffData == null || pd.CheckOffData.CheckOffList == null || pd.CheckOffData.CheckOffList.MaxIndex <= 0) return false;
|
||||
if (pd.CheckOffData.CheckOffHeaderList == null || pd.CheckOffData.CheckOffHeaderList.MaxIndex <= 1) return true;
|
||||
//if (pd.CheckOffData == null || pd.CheckOffData.CheckOffHeaderList == null || pd.CheckOffData.CheckOffHeaderList.Count <= 1) return false;
|
||||
|
||||
// To find whether the step has a checkoff, first check that the section
|
||||
@ -4343,7 +4349,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private int SectionDefaultCheckOffIndex()
|
||||
{
|
||||
ProcData pd = ActiveFormat.PlantFormat.FormatData.ProcData;
|
||||
if (pd.CheckOffData != null && pd.CheckOffData.CheckOffList != null && pd.CheckOffData.CheckOffList.Count == 2) return 0; // if only two items, first is macro - use it.
|
||||
if (pd.CheckOffData != null && pd.CheckOffData.CheckOffList != null && pd.CheckOffData.CheckOffList.MaxIndex == 2) return 0; // if only two items, first is macro - use it.
|
||||
SectionConfig sc = ActiveSection.MyConfig as SectionConfig;
|
||||
return sc.Section_CheckoffListSelection;
|
||||
}
|
||||
@ -4388,7 +4394,7 @@ namespace VEPROMS.CSLA.Library
|
||||
get
|
||||
{
|
||||
ProcData pd = ActiveFormat.PlantFormat.FormatData.ProcData;
|
||||
if (pd.CheckOffData != null && pd.CheckOffData.CheckOffList != null && pd.CheckOffData.CheckOffList.Count == 2 && pd.CheckOffData.CheckOffList[0].MenuItem == "Enabled")
|
||||
if (pd.CheckOffData != null && pd.CheckOffData.CheckOffList != null && pd.CheckOffData.CheckOffList.MaxIndex == 2 && pd.CheckOffData.CheckOffList[0].MenuItem == "Enabled")
|
||||
return true; // if only two items, first is macro - use it.
|
||||
return false;
|
||||
}
|
||||
@ -6191,7 +6197,7 @@ namespace VEPROMS.CSLA.Library
|
||||
// It returns a -1 if not set or none exist.
|
||||
public int CheckOffHeadingIndex()
|
||||
{
|
||||
if (ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffHeaderList == null || ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffHeaderList.Count == 0) return -1;
|
||||
if (ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffHeaderList == null || ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffHeaderList.MaxIndex == 0) return -1;
|
||||
SectionConfig sc = MyConfig as SectionConfig;
|
||||
if (sc == null) return -1;
|
||||
return sc.Section_CheckoffHeaderSelection;
|
||||
|
@ -127,9 +127,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
_MyDocStyleList = new SortedList<string, int>();
|
||||
foreach(DocStyle ds in _MySection.MySectionInfo.ActiveFormat.PlantFormat.DocStyles.DocStyleList)
|
||||
{
|
||||
_MyDocStyleList.Add(ds.Name,10000 + (int) ds.Index);
|
||||
}
|
||||
if (!ds.Inactive)_MyDocStyleList.Add(ds.Name,10000 + (int) ds.Index);
|
||||
}
|
||||
}
|
||||
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
|
||||
|
@ -784,7 +784,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
// The tranType parameter is really the index. For page number transitions, get the transition
|
||||
// type (holdover from 16bit, used to define whether transitions are range) for range transitions, the page number goes after the 1st step.
|
||||
int strantype = tranType < tb._FromItem.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList.Count ? (int)tb._FromItem.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[tranType].Type : 0;
|
||||
int strantype = tranType < tb._FromItem.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList.MaxIndex ? (int)tb._FromItem.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[tranType].Type : 0;
|
||||
if ((strantype == 1 || strantype == 2 || strantype == 4) && !tb._TransFormat.Contains("{Page Num}"))
|
||||
{
|
||||
// if range transition, the page number token needs to go after the first step, else it's at the end:
|
||||
@ -835,7 +835,7 @@ namespace VEPROMS.CSLA.Library
|
||||
tb._FormatData = formatInfo.PlantFormat.FormatData;
|
||||
// get the format of the transition string based on this transition's index into the TransData part of
|
||||
// format....
|
||||
if (tranType > tb._FormatData.TransData.TransTypeList.Count)
|
||||
if (tranType > tb._FormatData.TransData.TransTypeList.MaxIndex)
|
||||
tranType = 0;
|
||||
// Replace 3 tokens ", {.}, {.}, {.}" with a single token "{.}"
|
||||
tb._TransFormat = tb._FormatData.TransData.TransTypeList[tranType].TransFormat.Replace(", {.}, {.}, {.}", "{.}");
|
||||
|
@ -24,7 +24,17 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
return (_DocStyleList == null) ? _DocStyleList = new DocStyleList(SelectNodes("DocStyle")): _DocStyleList;
|
||||
if (_DocStyleList == null)
|
||||
{
|
||||
DocStyleList tmp = new DocStyleList(SelectNodes("DocStyle"));
|
||||
DocStyleList retval = new DocStyleList(null);
|
||||
foreach (DocStyle ds in tmp)
|
||||
{
|
||||
if (!ds.Inactive) retval.Add(ds);
|
||||
}
|
||||
_DocStyleList = retval;
|
||||
}
|
||||
return (_DocStyleList);
|
||||
}
|
||||
set { _DocStyleList = value; }
|
||||
}
|
||||
@ -34,7 +44,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region DocStyleAll
|
||||
#region DocStyle
|
||||
[TypeConverter(typeof(ExpandableObjectConverter))]
|
||||
public class DocStyle : vlnFormatItem
|
||||
public class DocStyle : vlnFormatItem, IVlnIndexedFormatItem
|
||||
{
|
||||
public DocStyle(XmlNode xmlNode) : base(xmlNode) { }
|
||||
public DocStyle() : base() { }
|
||||
@ -106,6 +116,18 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Inactive
|
||||
[Category("Miscellaneous")]
|
||||
[Description("Is Active Section Type")]
|
||||
private LazyLoad<bool> _Inactive;
|
||||
public bool Inactive
|
||||
{
|
||||
get
|
||||
{
|
||||
return LazyLoad(ref _Inactive, "@Inactive");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region LandscapePageList
|
||||
[Category("Miscellaneous")]
|
||||
[Description("Should PageList be landscape")]
|
||||
@ -393,9 +415,9 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region DocStyleList
|
||||
[TypeConverter(typeof(vlnListConverter<DocStyleList, DocStyle>))]
|
||||
public class DocStyleList : vlnFormatList<DocStyle>
|
||||
public class DocStyleList : vlnIndexedFormatList<DocStyle>
|
||||
{
|
||||
public DocStyleList(XmlNodeList xmlNodeList) : base(xmlNodeList) { }
|
||||
public DocStyleList(XmlNodeList xmlNodeList) : base(xmlNodeList, null) { }
|
||||
}
|
||||
#endregion
|
||||
#region Layout
|
||||
|
Loading…
x
Reference in New Issue
Block a user