Files
SourceCode/PROMS/VEPROMS.CSLA.Library/Format/PageStyles.cs
T

185 lines
8.0 KiB
C#

using System.ComponentModel;
using System.Xml;
namespace VEPROMS.CSLA.Library
{
#region PageStyles
[TypeConverter(typeof(vlnListConverter<PageStyles, PageStyle>))]
public class PageStyles : vlnFormatList<PageStyle>
{
public PageStyles(XmlNodeList xmlNodeList) : base(xmlNodeList) { }
}
#endregion
#region PageStyle
public class PageStyle : vlnFormatItem
{
#region Constructor
public PageStyle(XmlNode xmlNode) : base(xmlNode) { }
public PageStyle() : base() { }
#endregion
#region Business Methods
// description to associate with a DocStyle
private LazyLoad<string> _Name;
[DisplayName("Name")]
[Description("Page Style Name")]
public string Name => LazyLoad(ref _Name, "@Name");
// a unuque number that is referenced from the DocStyles
private LazyLoad<int?> _Index;
[DisplayName("Index")]
[Description("Page Style Index")]
public int? Index => LazyLoad(ref _Index, "@Index");
private PageItems _PageItems;
public PageItems PageItems => _PageItems ?? (_PageItems = new PageItems(SelectNodes("Item")));
#endregion
#region Override ToString
public override string ToString() => string.Format("{0:D2} - {1}", Index, Name);
#endregion
}
#endregion
#region PageItems
[TypeConverter(typeof(vlnListConverter<PageItems, PageItem>))]
public class PageItems : vlnFormatList<PageItem>
{
public PageItems(XmlNodeList xmlNodeList) : base(xmlNodeList) { }
}
#endregion
#region PageItem
// this links up the <Item> group in <PageStyle>
public class PageItem : vlnFormatItem
{
#region Constructor
public PageItem(XmlNode xmlNode) : base(xmlNode) { }
public PageItem() : base() { }
#endregion
#region Business Methods
private VE_Font _Font;
[Category("Font")]
[DisplayName("Font")]
[Description("Font")]
public VE_Font Font => _Font ?? (_Font = new VE_Font(XmlNode));
private RelatedItem _RelatedItem;
public RelatedItem RelatedItem => _RelatedItem ?? (_RelatedItem = new RelatedItem(SelectSingleNode("RelatedItem")));
// this can be an actual token, in curly braces, that dynamically gets replaced with information, or just plain text
private LazyLoad<string> _Token;
[Category("Content")]
[DisplayName("Content")]
[Description("Item Content")]
public string Token => LazyLoad(ref _Token, "@Token");
// the row on the page to place the Item
private LazyLoad<float?> _Row;
[Category("Location")]
[DisplayName("Vertical Position")]
[Description("Vertical Position")]
public float? Row => LazyLoad(ref _Row, "@Row");
// the column on the page to place the Item
private LazyLoad<float?> _Col;
[Category("Location")]
[DisplayName("Horizontal Position")]
[Description("Horizontal Position")]
public float? Col => LazyLoad(ref _Col, "@Col");
// the justification at the Col position in which to print the Token information
private LazyLoad<E_Justify?> _Justify;
public E_Justify? Justify => LazyLoad<E_Justify>(ref _Justify, "@Justify");
//run the PROMS Replace Words logic on the resulting text of Token
private LazyLoad<bool> _RepWords; // F2021-053: Do replace words in page list
public bool RepWords => LazyLoad(ref _RepWords, "@RepWords");
//Flag to tell PROMS to get the alarm value information based on the specified Child applicability
private LazyLoad<bool> _ROLkUpMatch; // C2021-065 (BNPP Alarms format)
public bool ROLkUpMatch => LazyLoad(ref _ROLkUpMatch, "@ROLkUpMatch");
// Flag to specify if that PageStyle Item should be used in creating alarm point information
// for viewing in the PROMS step editor
// this information is displayed in a Note that it build on the fly when first opening an Alarm Point page
private LazyLoad<bool> _ROLkUpInEditor; // C2021-018 (BNPP Alarms format)
public bool ROLkUpInEditor => LazyLoad(ref _ROLkUpInEditor, "@ROLkUpInEditor");
// defines a maxium width before the resolved PSI token (procedure specific information) text is wrapped
// on to the next line
private LazyLoad<int?> _MaxWidth;
public int? MaxWidth => LazyLoad(ref _MaxWidth, "@MaxWidth");
// MaxWidth, above, flagged that, if there was more than 1 line, the topmargin would be adjusted by however
// many lines the PSI item contained (for wst alarms). The MaxWidthCurPage is used when that adjustment
// should not be made, the length of the PSI item is only relevant for the current page.
// (see AdjustTopMarginForMultiLinePageListItems variable and how it is used)
private LazyLoad<int?> _MaxWidthCurPage;
public int? MaxWidthCurPage => LazyLoad(ref _MaxWidthCurPage, "@MaxWidthCurPage");
// the resolved pagestype item font size will be reduce in order to fit within the defined width
private LazyLoad<int?> _FontShrinkAftLen; // F2021-066 & 070 (text len before shrinking font)
public int? FontShrinkAftLen => LazyLoad(ref _FontShrinkAftLen, "@FontShrinkAftLen");
// used in Alarm Point Table page style values with FontShrinkAftLen set, will display this message if the text cannot be shrunk enough (and be readable) to fit within the defined width
private LazyLoad<string> _FontTooSmallMsg; // F2021-066 message if can't shrink enough
public string FontTooSmallMsg => LazyLoad(ref _FontTooSmallMsg, "@FontTooSmallMsg");
// F2023-039 allow to select text color of a pagelist line
// sets a text color for the page style Item
private LazyLoad<string> _TextColor;
public string TextColor => LazyLoad(ref _TextColor, "@TextColor");
// set to a string, will remove the matching string from the end
// F2023-112 Vogtle Units 3 & Backgrounds - trim the ending "-B" from the procedure number (used in title box of page header)
private LazyLoad<string> _TrimEnding;
public string TrimEnding => LazyLoad(ref _TrimEnding, "@TrimEnding");
// C2025-033 to specify to print pagestyle item for a specific Child procedure
private LazyLoad<int?> _ChildNum;
public int? ChildNum => LazyLoad(ref _ChildNum, "@ChildNum");
#endregion
#region Override ToString
public override string ToString() => Token;
public override string GetPDDisplayName() => string.Format("({0},{1})", Row, Col);
#endregion
}
#endregion
#region RelatedItem
// RelatedItem was added to allow a PSI logical to have an associated PSI item, and if both are
// selected the RelatedItem data changes where the item prints. This was implemented for
// F2017-036 - VCS.
[TypeConverter(typeof(ExpandableObjectConverter))]
public class RelatedItem : vlnFormatItem
{
#region Constructor
public RelatedItem(XmlNode xmlNode) : base(xmlNode) { }
public RelatedItem() : base() { }
#endregion
#region Business Methods
// the name of the PSI logical token to check
private LazyLoad<string> _Token;
[Category("RelatedContent")]
[DisplayName("RelatedContent")]
[Description("Item RelatedContent")]
public string Token => LazyLoad(ref _Token, "@Token");
// new Row value to use for PageStyle Item
private LazyLoad<float?> _Row;
[Category("Location")]
[DisplayName("Vertical Position")]
[Description("Vertical Position")]
public float? Row => LazyLoad(ref _Row, "@Row");
// new Col value to use for PageStyle Item
private LazyLoad<float?> _Col;
[Category("Location")]
[DisplayName("Horizontal Position")]
[Description("Horizontal Position")]
public float? Col => LazyLoad(ref _Col, "@Col");
// new Justify value to use for PageStyle Item
private LazyLoad<E_Justify?> _Justify;
public E_Justify? Justify => LazyLoad<E_Justify>(ref _Justify, "@Justify");
#endregion
}
#endregion
}