diff --git a/PROMS/Volian.Controls.Library/DisplayTabControl.cs b/PROMS/Volian.Controls.Library/DisplayTabControl.cs index f6a19b3a..839c2b65 100644 --- a/PROMS/Volian.Controls.Library/DisplayTabControl.cs +++ b/PROMS/Volian.Controls.Library/DisplayTabControl.cs @@ -320,6 +320,12 @@ namespace Volian.Controls.Library { CleanUpClosedItems(); if (myItemInfo == null) return null; + // if this is an auto table of contents section, don't edit it: + if (myItemInfo.IsAutoTOCSection) + { + MessageBox.Show("This is an automatically generated 'Table of Contents' section. It is not editable. It is generated during Print.", "Item not Editable", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + return SelectedDisplayTabItem; + } _MyBar = GetParentBar(myItemInfo); // Get the docking bar associated with this item. if (myItemInfo.MyContent.MyEntry == null) // If it is a Word document open in step editor return OpenStepTabPage(myItemInfo); @@ -432,7 +438,12 @@ namespace Volian.Controls.Library public void CloseWordItem(ItemInfo myItemInfo, bool isBeingDeleted) { CleanUpClosedItems(); - string key = "Doc - " + myItemInfo.MyContent.MyEntry.MyDocument.DocID.ToString(); + string key = "Doc - "; + // there is no entry if it is an auto table of contents: + if (myItemInfo.MyContent.MyEntry != null) + key = key + myItemInfo.MyContent.MyEntry.MyDocument.DocID.ToString(); + else + key = key + "0"; DisplayTabItem myTabItem = null; if (_MyDisplayTabItems.ContainsKey(key)) // If page open, close it { diff --git a/PROMS/Volian.Controls.Library/EditItem.cs b/PROMS/Volian.Controls.Library/EditItem.cs index 0bd46719..bcb467c8 100644 --- a/PROMS/Volian.Controls.Library/EditItem.cs +++ b/PROMS/Volian.Controls.Library/EditItem.cs @@ -1581,7 +1581,11 @@ namespace Volian.Controls.Library // get the config item for the steps section. there is an 'editable' // flag used in metasections to define whether the steps should print. // this flag can be toggle on the section's properties dialog. - bool EditSteps = !(MyItemInfo.MyConfig is SectionConfig && (MyItemInfo.MyConfig as SectionConfig).SubSection_Edit == "N"); + // Only check the flag if the section has subsections because the + // default for the flag is not editable, and this would make non-metasections + // not editable. + bool hasMetaSubs = MyItemInfo.IsSection && MyItemInfo.Sections != null && MyItemInfo.Sections.Count>0; + bool EditSteps = !hasMetaSubs || (MyItemInfo.MyConfig is SectionConfig && (MyItemInfo.MyConfig as SectionConfig).SubSection_Edit == "Y"); if (EditSteps) AddChildAfter(MyItemInfo.Steps, expand); if (MyItemInfo.RNOs != null && MyItemInfo.RNOLevel >= MyItemInfo.ColumnMode)