C2018-039: Upgrade – User Control of Format
This commit is contained in:
335
PROMS/VEPROMS.CSLA.Library/Format/Comparator.cs
Normal file
335
PROMS/VEPROMS.CSLA.Library/Format/Comparator.cs
Normal file
@@ -0,0 +1,335 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
public class Comparator
|
||||
{
|
||||
private XmlDocument _ResultsDoc;
|
||||
public XmlDocument ResultsDoc
|
||||
{
|
||||
get { return _ResultsDoc; }
|
||||
set { _ResultsDoc = value; }
|
||||
}
|
||||
private XmlDocument _XDoc1;
|
||||
public XmlDocument XDoc1
|
||||
{
|
||||
get { return _XDoc1; }
|
||||
set { _XDoc1 = value; }
|
||||
}
|
||||
private XmlDocument _XDoc2;
|
||||
public XmlDocument XDoc2
|
||||
{
|
||||
get { return _XDoc2; }
|
||||
set { _XDoc2 = value; }
|
||||
}
|
||||
public Comparator(XmlDocument xdoc1, XmlDocument xdoc2)
|
||||
{
|
||||
XDoc1 = xdoc1;
|
||||
XDoc2 = xdoc2;
|
||||
ResultsDoc = new XmlDocument();
|
||||
ResultsDoc.LoadXml(@"<PlantFormat></PlantFormat>");
|
||||
}
|
||||
public Comparator(string existingFC, string importedFC) //string fName1, string fName2)
|
||||
{
|
||||
XDoc1 = new XmlDocument();
|
||||
XDoc1.LoadXml(existingFC);
|
||||
XDoc2 = new XmlDocument();
|
||||
XDoc2.LoadXml(importedFC);
|
||||
ResultsDoc = new XmlDocument();
|
||||
ResultsDoc.LoadXml(@"<PlantFormat></PlantFormat>");
|
||||
}
|
||||
public XmlDocument Compare()
|
||||
{
|
||||
AllKeys = null;
|
||||
Compare(XDoc1.DocumentElement, XDoc2.DocumentElement, "");
|
||||
Console.WriteLine("results xml = \r\n{0}", ResultsDoc.InnerXml);
|
||||
return ResultsDoc;
|
||||
}
|
||||
public void Compare(XmlNode xn1, XmlNode xn2, string path)
|
||||
{
|
||||
if (xn1.OuterXml == xn2.OuterXml) return;
|
||||
Compare(xn1.Attributes, xn2.Attributes , path, xn1, xn2);
|
||||
xn1.Attributes.RemoveAll();
|
||||
xn2.Attributes.RemoveAll();
|
||||
|
||||
Dictionary<string, XmlNode> xns1 = new Dictionary<string, XmlNode>(); // child nodes, key = 'OuterXml', value = node itself
|
||||
Dictionary<string, XmlNode> xns2 = new Dictionary<string, XmlNode>();
|
||||
// xns1 starts out with all child nodes of xn1
|
||||
foreach (XmlNode xc1 in xn1.ChildNodes)
|
||||
xns1.Add(xc1.OuterXml + GetKey(xc1), xc1);
|
||||
// xns1 - remove any matching child nodes from xns2
|
||||
// xns2 - has nodes that are not in xns1
|
||||
foreach (XmlNode xc2 in xn2.ChildNodes)
|
||||
if (xns1.ContainsKey(xc2.OuterXml + GetKey(xc2)))
|
||||
xns1.Remove(xc2.OuterXml + GetKey(xc2));
|
||||
else
|
||||
xns2.Add(xc2.OuterXml+GetKey(xc2), xc2);
|
||||
|
||||
// xnss1 & xnss2 are dictionaries based on a unique key
|
||||
Dictionary<string, XmlNode> xnss1 = new Dictionary<string, XmlNode>();
|
||||
Dictionary<string, XmlNode> xnss2 = new Dictionary<string, XmlNode>();
|
||||
foreach (XmlNode xc1 in xns1.Values)
|
||||
xnss1.Add(GetKey(xc1), xc1);
|
||||
foreach (XmlNode xc2 in xns2.Values)
|
||||
if (xnss1.ContainsKey(GetKey(xc2)))
|
||||
Compare(xnss1[GetKey(xc2)], xc2, path + "/" + GetKey(xc2));
|
||||
else
|
||||
xnss2.Add(GetKey(xc2), xc2);
|
||||
// element differences, if counts are different. xns1 elements are not found in xns2 and xns2 elements are not found in xns1
|
||||
if (xns1.Count == 0 && xns2.Count == 0) return;
|
||||
xns1 = new Dictionary<string, XmlNode>(); // child nodes, key = 'OuterXml', value = node itself
|
||||
xns2 = new Dictionary<string, XmlNode>();
|
||||
// xns1 starts out with all child nodes of xn1
|
||||
foreach (XmlNode xc1 in xn1.ChildNodes)
|
||||
{
|
||||
xns1.Add(xc1.OuterXml+GetKey(xc1), xc1);
|
||||
}
|
||||
// xns1 - remove any matching child nodes from xns2
|
||||
// xns2 - has nodes that are not in xns1
|
||||
foreach (XmlNode xc2 in xn2.ChildNodes)
|
||||
if (xns1.ContainsKey(xc2.OuterXml + GetKey(xc2)))
|
||||
xns1.Remove(xc2.OuterXml + GetKey(xc2));
|
||||
else
|
||||
xns2.Add(xc2.OuterXml + GetKey(xc2), xc2);
|
||||
|
||||
// xnss1 & xnss2 are dictionaries based on a unique key
|
||||
xnss1 = new Dictionary<string, XmlNode>();
|
||||
xnss2 = new Dictionary<string, XmlNode>();
|
||||
foreach (XmlNode xc1 in xns1.Values)
|
||||
xnss1.Add(GetKey(xc1), xc1);
|
||||
foreach (XmlNode xc2 in xns2.Values)
|
||||
if (xnss1.ContainsKey(GetKey(xc2)))
|
||||
Compare(xnss1[GetKey(xc2)], xc2, path + "/" + GetKey(xc2));
|
||||
else
|
||||
xnss2.Add(GetKey(xc2), xc2);
|
||||
// element differences, if counts are different. xns1 elements are not found in xns2 and xns2 elements are not found in xns1
|
||||
if (xns1.Count == 0 && xns2.Count == 0) return;
|
||||
Console.WriteLine(" {0} {1} {2}", path + "/" + xn1.Name, xns1.Count, xns2.Count);
|
||||
foreach (string key in xnss1.Keys)
|
||||
{
|
||||
if (xnss1[key].Attributes.Count > 0 || xnss1[key].ChildNodes.Count > 0)
|
||||
{
|
||||
XmlNode xnr = MakeXPathFormat(path);
|
||||
if (xnr != null)
|
||||
{
|
||||
XmlNode cloned = xnss1[key].CloneNode(true);
|
||||
XmlNode importNode = ResultsDoc.ImportNode(cloned, true);
|
||||
XmlNode resnd = xnr.AppendChild(importNode);
|
||||
XmlAttribute xKey = ResultsDoc.CreateAttribute("Mode");
|
||||
xKey.Value = "Deleted";
|
||||
resnd.Attributes.Append(xKey);
|
||||
xKey = ResultsDoc.CreateAttribute("OldKey");
|
||||
xKey.Value = GetKey(xnss1[key]);
|
||||
resnd.Attributes.Append(xKey);
|
||||
xnr.AppendChild(resnd);
|
||||
if (resnd.ChildNodes.Count > 0)
|
||||
{
|
||||
foreach (XmlNode cxn in resnd.ChildNodes) if (cxn.Name == "Layout") SuffixAttributes("Old", cxn);
|
||||
}
|
||||
}
|
||||
}
|
||||
xnss1[key].ParentNode.RemoveChild(xnss1[key]);
|
||||
}
|
||||
|
||||
foreach (string key in xnss2.Keys)
|
||||
{
|
||||
if (xnss2[key].Attributes.Count > 0 || xnss2[key].ChildNodes.Count > 0)
|
||||
{
|
||||
XmlNode xnr = MakeXPathFormat(path);
|
||||
if (xnr != null)
|
||||
{
|
||||
XmlNode cloned = xnss2[key].CloneNode(true);
|
||||
XmlNode importNode = ResultsDoc.ImportNode(cloned, true);
|
||||
XmlNode resnd = xnr.AppendChild(importNode);
|
||||
|
||||
// if this has subnodes, add the 'Inserted' mode on them, otherwise, out it on this level
|
||||
if (resnd.ChildNodes.Count > 0)
|
||||
{
|
||||
foreach (XmlNode cxn in resnd.ChildNodes)
|
||||
{
|
||||
if (cxn.Name=="Layout") SuffixAttributes("New", cxn);
|
||||
XmlAttribute xKey = ResultsDoc.CreateAttribute("Mode");
|
||||
xKey.Value = "Inserted";
|
||||
if (cxn is XmlText)
|
||||
resnd.Attributes.Append(xKey);
|
||||
else
|
||||
cxn.Attributes.Append(xKey); // crashing here on a flag difference - trying to append this attribute to 'false'.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
XmlAttribute xKey = ResultsDoc.CreateAttribute("Mode");
|
||||
xKey.Value = "Inserted";
|
||||
resnd.Attributes.Append(xKey);
|
||||
}
|
||||
XmlAttribute xKey1 = ResultsDoc.CreateAttribute("NewKey");
|
||||
xKey1.Value = GetKey(xnss2[key]);
|
||||
resnd.Attributes.Append(xKey1);
|
||||
xnr.AppendChild(resnd);
|
||||
}
|
||||
}
|
||||
xnss2[key].ParentNode.RemoveChild(xnss2[key]);
|
||||
}
|
||||
}
|
||||
|
||||
private void SuffixAttributes(string suffix, XmlNode resnd)
|
||||
{
|
||||
Dictionary<string, string> renameList = new Dictionary<string, string>();
|
||||
foreach (XmlAttribute xa in resnd.Attributes) renameList.Add(xa.Name, xa.Value);
|
||||
foreach (string key in renameList.Keys)
|
||||
{
|
||||
resnd.Attributes.RemoveNamedItem(key);
|
||||
XmlAttribute xKey1 = ResultsDoc.CreateAttribute(key+suffix);
|
||||
xKey1.Value = renameList[key];
|
||||
resnd.Attributes.Append(xKey1);
|
||||
}
|
||||
}
|
||||
private Dictionary<XmlNode, string> _AllKeys;
|
||||
public Dictionary<XmlNode, string> AllKeys
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_AllKeys == null) _AllKeys = new Dictionary<XmlNode, string>();
|
||||
return _AllKeys;
|
||||
}
|
||||
set { _AllKeys = value; }
|
||||
}
|
||||
public string GetKey(XmlNode xn)
|
||||
{
|
||||
string key = GetKey1(xn);
|
||||
if (AllKeys.ContainsKey(xn)) return AllKeys[xn];
|
||||
AllKeys.Add(xn, key);
|
||||
return key;
|
||||
}
|
||||
// Get unique key, key is a string representing either the name itself or a combination of element name/attribute to make it unique
|
||||
public string GetKey1(XmlNode xn)
|
||||
{
|
||||
if (xn.Attributes == null) return xn.Name;
|
||||
XmlAttribute xi = xn.Attributes.GetNamedItem("Index") as XmlAttribute;
|
||||
if (xi != null)
|
||||
{
|
||||
XmlAttribute xa = xn.Attributes.GetNamedItem("Name") as XmlAttribute;
|
||||
if (xa != null) return string.Format("{0}[{1}]", xn.Name, xa.Value);
|
||||
return string.Format("{0}[{1}]", xn.Name, xi.Value);
|
||||
}
|
||||
XmlAttribute xt = xn.Attributes.GetNamedItem("Token") as XmlAttribute;
|
||||
if(xt != null) return string.Format("{0}[{1}]", xn.Name, xt.Value);
|
||||
XmlAttribute xw = xn.Attributes.GetNamedItem("ReplaceWord") as XmlAttribute;
|
||||
if(xw != null) return string.Format("{0}[{1}]", xn.Name, xw.Value);
|
||||
return xn.Name;
|
||||
}
|
||||
static private XmlNode makeXPath(XmlDocument doc, string xpath)
|
||||
{
|
||||
xpath = xpath.Replace(@"DocStyle[", @"DocStyle[@Name='");
|
||||
xpath = xpath.Replace(@"]", "']");
|
||||
return makeXPath(doc, doc as XmlNode, xpath);
|
||||
}
|
||||
|
||||
static private XmlNode makeXPath(XmlDocument doc, XmlNode parent, string xpath)
|
||||
{
|
||||
if (xpath.Contains("DocStyle")) Console.WriteLine("here");
|
||||
// grab the next node name in the xpath; or return parent if empty
|
||||
string[] partsOfXPath = xpath.Trim('/').Split('/');
|
||||
string nextNodeInXPath = partsOfXPath.First();
|
||||
if (string.IsNullOrEmpty(nextNodeInXPath))
|
||||
return parent;
|
||||
|
||||
XmlNode node = parent.SelectSingleNode(nextNodeInXPath);
|
||||
if (node == null)
|
||||
{
|
||||
if (nextNodeInXPath.Contains("@")) // element with an attribute, create both
|
||||
{
|
||||
// make element
|
||||
string elename = nextNodeInXPath.Substring(0, nextNodeInXPath.IndexOf("@") - 1);
|
||||
node = parent.AppendChild(doc.CreateElement(elename));
|
||||
// make attribute
|
||||
int indx = nextNodeInXPath.IndexOf("@")+1;
|
||||
string name = nextNodeInXPath.Substring(indx, nextNodeInXPath.IndexOf("=",indx)-indx);
|
||||
XmlAttribute xKeyd = doc.CreateAttribute(name);
|
||||
indx = nextNodeInXPath.IndexOf("='",indx)+2;
|
||||
string value = nextNodeInXPath.Substring(indx,nextNodeInXPath.IndexOf("'", indx) - indx);
|
||||
xKeyd.Value = nextNodeInXPath.Substring(indx,nextNodeInXPath.IndexOf("'",indx)-indx);
|
||||
node.Attributes.Append(xKeyd);
|
||||
}
|
||||
else
|
||||
node = parent.AppendChild(doc.CreateElement(nextNodeInXPath));
|
||||
}
|
||||
|
||||
// rejoin the remainder of the array as an xpath expression and recurse
|
||||
string rest = String.Join("/", partsOfXPath.Skip(1).ToArray());
|
||||
return makeXPath(doc, node, rest);
|
||||
}
|
||||
|
||||
private XmlNode MakeXPathFormat(string xpath)
|
||||
{
|
||||
// first find or make, if not found, the XmlElement within FormatData or DocStyles
|
||||
Console.WriteLine("path = {0}", xpath);
|
||||
return makeXPath(ResultsDoc, xpath);
|
||||
}
|
||||
#region Attributes
|
||||
private void Compare(XmlAttributeCollection atts1, XmlAttributeCollection atts2, string path, XmlNode atts1Par, XmlNode atts2Par)
|
||||
{
|
||||
// go through attributes in first xml document, see if they exist in the 2nd xml document & are identical attribute
|
||||
foreach (XmlAttribute xa1 in atts1)
|
||||
{
|
||||
XmlAttribute xa2 = atts2.GetNamedItem(xa1.Name) as XmlAttribute;
|
||||
if (xa2 == null)
|
||||
{
|
||||
XmlNode xnr = MakeXPathFormat(path);
|
||||
if (xnr != null)
|
||||
{
|
||||
XmlAttribute xKey = ResultsDoc.CreateAttribute(xa1.Name+"Old");
|
||||
xKey.Value = xa1.Value;
|
||||
xnr.Attributes.Append(xKey);
|
||||
xKey = ResultsDoc.CreateAttribute("OldKey");
|
||||
xKey.Value = GetKey(atts1Par);
|
||||
if (xKey.Value != null) xnr.Attributes.Append(xKey);
|
||||
}
|
||||
}
|
||||
else if (xa2.Value != xa1.Value)
|
||||
{
|
||||
XmlNode xnr = MakeXPathFormat(path);
|
||||
if (xnr != null)
|
||||
{
|
||||
XmlAttribute xKey = ResultsDoc.CreateAttribute(xa1.Name + "Old");
|
||||
xKey.Value = xa1.Value;
|
||||
xnr.Attributes.Append(xKey);
|
||||
XmlAttribute xKey2 = ResultsDoc.CreateAttribute(xa2.Name + "New");
|
||||
xKey2.Value = xa2.Value;
|
||||
xnr.Attributes.Append(xKey2);
|
||||
xKey = ResultsDoc.CreateAttribute("OldKey");
|
||||
xKey.Value = GetKey(atts1Par);
|
||||
if (xKey.Value != null) xnr.Attributes.Append(xKey);
|
||||
xKey = ResultsDoc.CreateAttribute("NewKey");
|
||||
xKey.Value = GetKey(atts2Par);
|
||||
if (xKey.Value != null) xnr.Attributes.Append(xKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
// go through attributes in 2nd xml document to see if they exist in the first xml document & are identical
|
||||
foreach (XmlAttribute xa2 in atts2)
|
||||
{
|
||||
XmlAttribute xa1 = atts1.GetNamedItem(xa2.Name) as XmlAttribute;
|
||||
if (xa1 == null)
|
||||
{
|
||||
XmlNode xnr = MakeXPathFormat(path);
|
||||
if (xnr != null)
|
||||
{
|
||||
XmlAttribute xKey = ResultsDoc.CreateAttribute(xa2.Name+"New");
|
||||
xKey.Value = xa2.Value;
|
||||
xnr.Attributes.Append(xKey);
|
||||
xKey = ResultsDoc.CreateAttribute("NewKey");
|
||||
xKey.Value = GetKey(atts2Par);
|
||||
if (xKey.Value != null) xnr.Attributes.Append(xKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
@@ -515,7 +515,29 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
return LazyLoad(ref _LeftMargin, "@LeftMargin");
|
||||
if (PlantFormat.IgnoreUCF) return LazyLoad(ref _LeftMargin, "@LeftMargin");
|
||||
if (MyFormat.PlantFormat.FormatConfig == null) return LazyLoad(ref _LeftMargin, "@LeftMargin");
|
||||
|
||||
// see if there is UCF data, need to match the index of the ucf data to that in the original format, and
|
||||
// also need to check that LeftMargin is not null, since other docstyle data may exist in UCF but not PageLength:
|
||||
XmlNode par = this.XmlNode.ParentNode;
|
||||
string indx = null;
|
||||
XmlElement ele = par as XmlElement;
|
||||
if (ele.HasAttribute("Index")) indx = ele.GetAttribute("Index");
|
||||
if (indx == null) return LazyLoad(ref _PageLength, "@LeftMargin");
|
||||
if (MyFormat.PlantFormat.FormatConfig != null && this.MyFormat.PlantFormat.FormatConfig.PlantFormat.DocStyles != null && MyFormat.PlantFormat.FormatConfig.PlantFormat.DocStyles.Count > 0)
|
||||
{
|
||||
foreach (FormatConfig.DocStyle ds in MyFormat.PlantFormat.FormatConfig.PlantFormat.DocStyles)
|
||||
{
|
||||
if (indx == ds.Index)
|
||||
{
|
||||
float? test = ds.Layout.LeftMargin;
|
||||
if (test != null) _LeftMargin = new LazyLoad<float?>(ds.Layout.LeftMargin);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return LazyLoad(ref _LeftMargin, "@LeftMargin");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -526,10 +548,33 @@ namespace VEPROMS.CSLA.Library
|
||||
[Description("Length of Page")]
|
||||
public float? PageLength
|
||||
{
|
||||
get
|
||||
{
|
||||
return LazyLoad(ref _PageLength, "@PageLength");
|
||||
}
|
||||
get
|
||||
{
|
||||
if (PlantFormat.IgnoreUCF) return LazyLoad(ref _PageLength, "@PageLength");
|
||||
if (MyFormat.PlantFormat.FormatConfig == null) return LazyLoad(ref _PageLength, "@PageLength");
|
||||
|
||||
// see if there is UCF data, need to match the index of the ucf data to that in the original format, and
|
||||
// also need to check that PageLength is not null, since other docstyle data may exist in UCF but not PageLength:
|
||||
XmlNode par = this.XmlNode.ParentNode;
|
||||
string indx = null;
|
||||
XmlElement ele = par as XmlElement;
|
||||
if (ele.HasAttribute("Index")) indx = ele.GetAttribute("Index");
|
||||
if (indx == null) return LazyLoad(ref _PageLength, "@PageLength");
|
||||
if (MyFormat.PlantFormat.FormatConfig != null && this.MyFormat.PlantFormat.FormatConfig.PlantFormat.DocStyles != null && MyFormat.PlantFormat.FormatConfig.PlantFormat.DocStyles.Count > 0)
|
||||
{
|
||||
foreach (FormatConfig.DocStyle ds in MyFormat.PlantFormat.FormatConfig.PlantFormat.DocStyles)
|
||||
{
|
||||
if (indx == ds.Index)
|
||||
{
|
||||
float? test = ds.Layout.PageLength;
|
||||
if (test != null) _PageLength = new LazyLoad<float?>(ds.Layout.PageLength);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return LazyLoad(ref _PageLength, "@PageLength");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region PageWidth
|
||||
|
@@ -247,5 +247,13 @@ namespace VEPROMS.CSLA.Library
|
||||
SupInfoPdfPrint = 2,
|
||||
Merge = 3
|
||||
}
|
||||
public enum E_UCFImportOptions : uint
|
||||
{
|
||||
Ignore = 0,
|
||||
LoadNotUsed = 1,
|
||||
LoadOnlyImported = 2,
|
||||
LoadUseAll = 3,
|
||||
LoadForSetOnly = 4
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
@@ -11,9 +11,56 @@ namespace VEPROMS.CSLA.Library
|
||||
[TypeConverter(typeof(ExpandableObjectConverter))]
|
||||
public class PlantFormat
|
||||
{
|
||||
public PlantFormat(IFormatOrFormatInfo format)
|
||||
public PlantFormat(IFormatOrFormatInfo format, string config)
|
||||
{
|
||||
_MyFormat = format;
|
||||
string str = null;
|
||||
if (format is Format) str = (format as Format).Config;
|
||||
else if (format is FormatInfo) str = (format as FormatInfo).Config;
|
||||
if (str != null && str != "") _FormatConfig = FormatConfig.Get(str);
|
||||
}
|
||||
private FormatConfig _FormatConfig;
|
||||
public FormatConfig FormatConfig
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_FormatConfig == null)
|
||||
{
|
||||
_FormatConfig = GetFormatConfig(_MyFormat);
|
||||
}
|
||||
return _FormatConfig;
|
||||
}
|
||||
set { _FormatConfig = value; }
|
||||
}
|
||||
// when IgnoreUCF is true, get the original data, i.e. don't apply any UCF changes to it
|
||||
private static bool _IgnoreUCF = false;
|
||||
public static bool IgnoreUCF
|
||||
{
|
||||
get { return PlantFormat._IgnoreUCF; }
|
||||
set { PlantFormat._IgnoreUCF = value; }
|
||||
}
|
||||
// flags that the User Control of Format setting for using additional UCF checkoffs is active
|
||||
private static bool _DoingUCFCheckOffs = false;
|
||||
public static bool DoingUCFCheckOffs
|
||||
{
|
||||
get { return PlantFormat._DoingUCFCheckOffs; }
|
||||
set { PlantFormat._DoingUCFCheckOffs = value; }
|
||||
}
|
||||
// flags the value that should be used (true/false) for using additional UCF checkoffs (used with DoingUCFCheckOffs)
|
||||
private static bool _DoingUCFCheckOffsUse = false;
|
||||
public static bool DoingUCFCheckOffsUse
|
||||
{
|
||||
get { return PlantFormat._DoingUCFCheckOffsUse; }
|
||||
set { PlantFormat._DoingUCFCheckOffsUse = value; }
|
||||
}
|
||||
public static FormatConfig GetFormatConfig(IFormatOrFormatInfo format)
|
||||
{
|
||||
FormatConfig fc = null;
|
||||
string str = null;
|
||||
if (format is Format) str = (format as Format).Config;
|
||||
else if (format is FormatInfo) str = (format as FormatInfo).Config;
|
||||
if (str != null && str != "") fc = FormatConfig.Get(str);
|
||||
return fc;
|
||||
}
|
||||
private IFormatOrFormatInfo _MyFormat;
|
||||
public IFormatOrFormatInfo MyFormat
|
||||
@@ -58,12 +105,76 @@ namespace VEPROMS.CSLA.Library
|
||||
return _DocStyles;
|
||||
}
|
||||
}
|
||||
public bool HasPageListToken(string token)
|
||||
{;
|
||||
string xpath = string.Format("/PlantFormat/PageStyles/PageStyle/Item[@Token = '{0}']", token);
|
||||
XmlNodeList nl = XmlDoc.SelectNodes(xpath);
|
||||
return nl.Count > 0;
|
||||
}
|
||||
public bool HasPageListToken(string token)
|
||||
{
|
||||
string xpath = string.Format("/PlantFormat/PageStyles/PageStyle/Item[@Token = '{0}']", token);
|
||||
XmlNodeList nl = XmlDoc.SelectNodes(xpath);
|
||||
return nl.Count > 0;
|
||||
}
|
||||
private FormatConfig.ReplaceStrData _UCFandOrigReplaceStrData = null;
|
||||
public FormatConfig.ReplaceStrData UCFandOrigReplaceStrData
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_UCFandOrigReplaceStrData != null) return _UCFandOrigReplaceStrData;
|
||||
_UCFandOrigReplaceStrData = GetMergedReplaceList(this);
|
||||
return _UCFandOrigReplaceStrData;
|
||||
}
|
||||
}
|
||||
private FormatConfig.ReplaceStrData GetMergedReplaceList(PlantFormat OriginalPlantFormat)
|
||||
{
|
||||
// need to compare the original format list with the list as it is stored for working with property grid.
|
||||
FormatConfig.ReplaceStrData retlist = new FormatConfig.ReplaceStrData(); // merged list
|
||||
List<string> inoriglist = new List<string>(); // use this list to find new items in formatconfig (see below)
|
||||
foreach (ReplaceStr origrepstr in OriginalPlantFormat.FormatData.SectData.ReplaceStrList)
|
||||
{
|
||||
// In the format config list (UCF), find the 'ReplaceWord'. This is the 'key' for defining whether the
|
||||
// replace word has been overwridden by UCF data. If it exists, use it:
|
||||
FormatConfig.ReplaceStr usethisone = null;
|
||||
bool deleted = false;
|
||||
// States for replacewords: 0 = no change, -1 deleted, 1 added, 2 modified
|
||||
if (FormatConfig != null)
|
||||
{
|
||||
foreach (FormatConfig.ReplaceStr ucfrepstr in FormatConfig.PlantFormat.FormatData.ReplaceStrData)
|
||||
{
|
||||
if (ucfrepstr.ReplaceWord == origrepstr.ReplaceWord)
|
||||
{
|
||||
if (ucfrepstr.State == -1) deleted = true;
|
||||
else usethisone = ucfrepstr;
|
||||
ucfrepstr.State = 2;
|
||||
inoriglist.Add(origrepstr.ReplaceWord);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!deleted && usethisone == null)
|
||||
{
|
||||
usethisone = new FormatConfig.ReplaceStr();
|
||||
usethisone.Flag = (FormatConfig.E_ReplaceFlagsUCF)origrepstr.Flag;
|
||||
usethisone.State = 0; // no change
|
||||
usethisone.ReplaceWith = origrepstr.ReplaceWith;
|
||||
usethisone.ReplaceWord = origrepstr.ReplaceWord;
|
||||
}
|
||||
if (!deleted) retlist.Add(usethisone);
|
||||
}
|
||||
// now add in any ucf only replacements, any that are not in the inoriglist
|
||||
if (FormatConfig != null)
|
||||
{
|
||||
foreach (FormatConfig.ReplaceStr ucfrepstr in FormatConfig.PlantFormat.FormatData.ReplaceStrData)
|
||||
{
|
||||
if (!inoriglist.Contains(ucfrepstr.ReplaceWord))
|
||||
{
|
||||
FormatConfig.ReplaceStr newone = new FormatConfig.ReplaceStr();
|
||||
newone.Flag = (FormatConfig.E_ReplaceFlagsUCF)ucfrepstr.Flag;
|
||||
newone.State = 1;
|
||||
newone.ReplaceWith = ucfrepstr.ReplaceWith;
|
||||
newone.ReplaceWord = ucfrepstr.ReplaceWord;
|
||||
retlist.Add(newone);
|
||||
}
|
||||
}
|
||||
}
|
||||
return (retlist);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region VE_Font
|
||||
@@ -71,12 +182,20 @@ namespace VEPROMS.CSLA.Library
|
||||
public class VE_Font : vlnFormatItem
|
||||
{
|
||||
public VE_Font(XmlNode xmlNode) : base(xmlNode) { }
|
||||
private string _ffam = null;
|
||||
private int _fsize = 0;
|
||||
private E_Style _fstyle = E_Style.None;
|
||||
private float _fcpi = 0;
|
||||
public VE_Font(string family, int size, E_Style style, float CPI)
|
||||
{
|
||||
_Family = new LazyLoad<string>(family);
|
||||
_Size = new LazyLoad<int?>(size);
|
||||
_Style = new LazyLoad<E_Style?>(style);
|
||||
_CPI = new LazyLoad<float?>(CPI);
|
||||
_ffam = family;
|
||||
_fsize = size;
|
||||
_fstyle = style;
|
||||
_fcpi = CPI;
|
||||
}
|
||||
private LazyLoad<string> _Family;
|
||||
private static Dictionary<string, Font> _WinFontLookup = new Dictionary<string, Font>();
|
||||
@@ -127,10 +246,15 @@ namespace VEPROMS.CSLA.Library
|
||||
style |= FontStyle.Underline;
|
||||
}
|
||||
// for now - check size to be 0 and set to 10 if so, error in fmtxml?
|
||||
if (Family == null) // Need to get inherited font
|
||||
_WindowsFont = GetFont("Arial", 10, FontStyle.Regular);
|
||||
else
|
||||
_WindowsFont = GetFont(Family, Size == 0 ? 10 : (float)Size, style);
|
||||
if (Family == null) // Need to get inherited font
|
||||
_WindowsFont = GetFont("Arial", 10, FontStyle.Regular);
|
||||
else
|
||||
{
|
||||
//if (_ffam != null)
|
||||
// _WindowsFont = GetFont(_ffam, (float)_fsize, style); // this needs work.
|
||||
//else
|
||||
_WindowsFont = GetFont(Family, Size == 0 ? 10 : (float)Size, style);
|
||||
}
|
||||
}
|
||||
return _WindowsFont;
|
||||
}
|
||||
@@ -1107,13 +1231,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[TypeConverter(typeof(ExpandableObjectConverter))]
|
||||
public class ProcData : vlnFormatItem
|
||||
{
|
||||
public ProcData(XmlNode xmlNode): base(xmlNode) {}
|
||||
public ProcData(XmlNode xmlNode) : base(xmlNode) { }
|
||||
private ProcedureSuffixList _ProcedureSuffixList;
|
||||
public ProcedureSuffixList ProcedureSuffixList
|
||||
{
|
||||
get
|
||||
{
|
||||
return _ProcedureSuffixList == null? _ProcedureSuffixList = new ProcedureSuffixList(SelectNodes("ProcedureSuffix/string")): _ProcedureSuffixList;
|
||||
return _ProcedureSuffixList == null ? _ProcedureSuffixList = new ProcedureSuffixList(SelectNodes("ProcedureSuffix/string")) : _ProcedureSuffixList;
|
||||
}
|
||||
set { _ProcedureSuffixList = value; }
|
||||
}
|
||||
@@ -1122,7 +1246,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
return _ChangeBarData == null? _ChangeBarData = new ChangeBarData(SelectSingleNode("ChangeBarData")):_ChangeBarData;
|
||||
return _ChangeBarData == null ? _ChangeBarData = new ChangeBarData(SelectSingleNode("ChangeBarData")) : _ChangeBarData;
|
||||
}
|
||||
}
|
||||
private CheckOffData _CheckOffData;
|
||||
@@ -1130,7 +1254,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
return _CheckOffData == null? _CheckOffData = new CheckOffData(SelectSingleNode("CheckOffData")):_CheckOffData;
|
||||
return _CheckOffData == null ? _CheckOffData = new CheckOffData(SelectSingleNode("CheckOffData")) : _CheckOffData;
|
||||
}
|
||||
}
|
||||
private PSI _PSI;
|
||||
@@ -1141,29 +1265,47 @@ namespace VEPROMS.CSLA.Library
|
||||
return _PSI == null ? _PSI = new PSI(SelectSingleNode("PSI")) : _PSI;
|
||||
}
|
||||
}
|
||||
private LazyLoad<bool> _CheckOffUCF;
|
||||
public bool CheckOffUCF
|
||||
{
|
||||
get
|
||||
{
|
||||
// The following line is used in UCF: this needs to be able to control a change in setting in UCF versus its use:
|
||||
// This is a special case since the original format, using the value in BaseAll, is always 'false'. And the value
|
||||
// should never be set in original volian plant format files, if the additional UCF checkoffs are to be used, this must
|
||||
// be set in the UCF user interface.
|
||||
if (PlantFormat.DoingUCFCheckOffs) return PlantFormat.DoingUCFCheckOffsUse;
|
||||
|
||||
if (PlantFormat.IgnoreUCF) return LazyLoad(ref _CheckOffUCF, "@CheckOffUCF");
|
||||
bool? localvalue = null; // comes to here if in edit or print - use any UCF data before going to original format.
|
||||
FormatConfig fc = PlantFormat.GetFormatConfig(MyFormat);
|
||||
if (fc != null) localvalue = fc.PlantFormat.FormatData.Flags.CheckOffUCF;
|
||||
return localvalue ?? LazyLoad(ref _CheckOffUCF, "@CheckOffUCF");
|
||||
}
|
||||
}
|
||||
private LazyLoad<int?> _TitleLength;
|
||||
public int? TitleLength
|
||||
{
|
||||
get
|
||||
{
|
||||
get
|
||||
{
|
||||
return LazyLoad(ref _TitleLength, "@TitleLength");
|
||||
}
|
||||
}
|
||||
}
|
||||
private LazyLoad<int?> _CoverTitleLength;
|
||||
public int? CoverTitleLength
|
||||
{
|
||||
get
|
||||
{
|
||||
get
|
||||
{
|
||||
return LazyLoad(ref _CoverTitleLength, "@CoverTitleLength");
|
||||
}
|
||||
}
|
||||
}
|
||||
private LazyLoad<string> _ProcedureSuffixFlags;
|
||||
public string ProcedureSuffixFlags
|
||||
{
|
||||
get
|
||||
{
|
||||
get
|
||||
{
|
||||
return LazyLoad(ref _ProcedureSuffixFlags, "@ProcedureSuffixFlags");
|
||||
}
|
||||
return LazyLoad(ref _ProcedureSuffixFlags, "@ProcedureSuffixFlags");
|
||||
}
|
||||
}
|
||||
private LazyLoad<bool> _CapitalizeTitle;
|
||||
public bool CapitalizeTitle
|
||||
@@ -1503,22 +1645,146 @@ namespace VEPROMS.CSLA.Library
|
||||
public class CheckOffData : vlnFormatItem
|
||||
{
|
||||
public CheckOffData(XmlNode xmlNode) : base(xmlNode) { }
|
||||
private CheckOffList _CheckOffList;
|
||||
private CheckOffList _CheckOffList = null;
|
||||
public CheckOffList CheckOffList
|
||||
{
|
||||
get
|
||||
{
|
||||
return _CheckOffList == null? _CheckOffList = new CheckOffList(SelectNodes("CheckOffList/CheckOff"),MyFormat):_CheckOffList;
|
||||
if (_CheckOffList != null) return _CheckOffList;
|
||||
|
||||
// Get a list of checkoffs that should be included:
|
||||
// if !UseCheckOffUCF (Baseall has it as false. User can change setting in UCF to true)
|
||||
// if !IgnoreUCF, i.e. use UCF changes, return original lists with only active items (Inactive = false)
|
||||
// if IgnoreUCF, return original lists with all items
|
||||
// if UseCheckOffUCF is true use the merged lists from current format and baseall.xml and
|
||||
// do the same processing for IgnoreUCF described above.
|
||||
|
||||
// UseCheckOffUCF is false or there is no FormatConfig (UCF) data:
|
||||
FormatConfig fc = PlantFormat.GetFormatConfig(MyFormat);
|
||||
if (!MyFormat.PlantFormat.FormatData.ProcData.CheckOffUCF || fc==null)
|
||||
{
|
||||
_CheckOffList = new CheckOffList(SelectNodes("CheckOffList/CheckOff"), MyFormat);
|
||||
// If Ignoring the UCF data, just return the entire list. Also, return entire list if there is no UCF data (fc == null)
|
||||
if (!PlantFormat.IgnoreUCF || fc == null) return _CheckOffList;
|
||||
// If not ignoring UCF settings, only return those that are active
|
||||
foreach (FormatConfig.CheckOff co in fc.PlantFormat.FormatData.CheckOffList)
|
||||
{
|
||||
foreach (CheckOff coo in _CheckOffList)
|
||||
{
|
||||
if ((int)coo.Index == Convert.ToInt32(co.Index) && !(bool)co.Active)
|
||||
{
|
||||
_CheckOffList.Remove(coo);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return _CheckOffList;
|
||||
}
|
||||
// UseCheckOfffUCF is true:
|
||||
// merge the checkoff list from the current format and the checkoff list from the base format
|
||||
_CheckOffList = new CheckOffList(SelectNodes("CheckOffList/CheckOff"), MyFormat);
|
||||
CheckOffList retlist2 = new CheckOffList(SelectNodes("../CheckOffDataUCF/CheckOffList/CheckOff"), MyFormat);
|
||||
if (retlist2 != null && retlist2.Count > 0) foreach (CheckOff co in retlist2) _CheckOffList.Add(co);
|
||||
if (PlantFormat.IgnoreUCF) return _CheckOffList;
|
||||
|
||||
// if applying UCF, then remove those that are inactive:
|
||||
foreach (FormatConfig.CheckOff co in fc.PlantFormat.FormatData.CheckOffList)
|
||||
{
|
||||
foreach (CheckOff coo in _CheckOffList)
|
||||
{
|
||||
if ((int)coo.Index == Convert.ToInt32(co.Index) && !(bool)co.Active)
|
||||
{
|
||||
_CheckOffList.Remove(coo);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return _CheckOffList;
|
||||
}
|
||||
}
|
||||
public void ClearCheckOffAndHeaderLists()
|
||||
{
|
||||
_CheckOffList = null;
|
||||
_CheckOffHeaderList = null;
|
||||
}
|
||||
private CheckOffHeaderList _CheckOffHeaderList;
|
||||
public CheckOffHeaderList CheckOffHeaderList
|
||||
{
|
||||
get
|
||||
{
|
||||
return _CheckOffHeaderList == null? _CheckOffHeaderList = new CheckOffHeaderList(SelectNodes("CheckOffHeaderList/CheckOffHeader"),MyFormat): _CheckOffHeaderList;
|
||||
if (_CheckOffHeaderList != null) return _CheckOffHeaderList;
|
||||
FormatConfig fc = PlantFormat.GetFormatConfig(MyFormat);
|
||||
if (!MyFormat.PlantFormat.FormatData.ProcData.CheckOffUCF || fc == null)
|
||||
{
|
||||
_CheckOffHeaderList = new CheckOffHeaderList(SelectNodes("CheckOffHeaderList/CheckOffHeader"), MyFormat);
|
||||
// Depending on the IgnoreUCF flag, either return this list with UCF Inactive flags set or return the
|
||||
// list as is.
|
||||
if (PlantFormat.IgnoreUCF || fc == null) return _CheckOffHeaderList;
|
||||
// If not ignoring UCF settings, only return those that are active
|
||||
foreach (FormatConfig.CheckOffHeader coh in fc.PlantFormat.FormatData.CheckOffHeaderList)
|
||||
{
|
||||
foreach (CheckOffHeader coo in _CheckOffHeaderList)
|
||||
{
|
||||
if ((int)coo.Index == Convert.ToInt32(coh.Index) && !(bool)coh.Active)
|
||||
{
|
||||
_CheckOffHeaderList.Remove(coo);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return _CheckOffHeaderList;
|
||||
}
|
||||
// merge the checkoff header lists from the current format and the list from the base
|
||||
_CheckOffHeaderList = new CheckOffHeaderList(SelectNodes("CheckOffHeaderList/CheckOffHeader"), MyFormat);
|
||||
CheckOffHeaderList retlist2 = new CheckOffHeaderList(SelectNodes("../CheckOffDataUCF/CheckOffHeaderList/CheckOffHeader"), MyFormat);
|
||||
if (retlist2 != null && retlist2.Count > 0) foreach (CheckOffHeader co in retlist2) _CheckOffHeaderList.Add(co);
|
||||
if (PlantFormat.IgnoreUCF) return _CheckOffHeaderList;
|
||||
|
||||
// if applying UCF, then remove those that are inactive.
|
||||
foreach (FormatConfig.CheckOffHeader coh in fc.PlantFormat.FormatData.CheckOffHeaderList)
|
||||
{
|
||||
foreach (CheckOffHeader cooh in _CheckOffHeaderList)
|
||||
{
|
||||
if ((int)cooh.Index == Convert.ToInt32(coh.Index) && !(bool)coh.Active)
|
||||
{
|
||||
_CheckOffHeaderList.Remove(cooh);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return _CheckOffHeaderList;
|
||||
}
|
||||
}
|
||||
public void CheckOffHeaderListRefresh(bool CheckOffUCF)
|
||||
{
|
||||
if (!CheckOffUCF)
|
||||
{
|
||||
_CheckOffHeaderList = new CheckOffHeaderList(SelectNodes("CheckOffHeaderList/CheckOffHeader"), MyFormat);
|
||||
// Depending on the IgnoreUCF flag, either return this list with UCF Inactive flags set or return the
|
||||
// list as is.
|
||||
FormatConfig fc = PlantFormat.GetFormatConfig(MyFormat);
|
||||
if (PlantFormat.IgnoreUCF || fc == null) return;
|
||||
// If not ignoring UCF settings, only return those that are active
|
||||
foreach (FormatConfig.CheckOffHeader coh in fc.PlantFormat.FormatData.CheckOffHeaderList)
|
||||
{
|
||||
foreach (CheckOffHeader coo in _CheckOffHeaderList)
|
||||
{
|
||||
if ((int)coo.Index == Convert.ToInt32(coh.Index) && !(bool)coh.Active)
|
||||
{
|
||||
_CheckOffHeaderList.Remove(coo);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
// if coming from the UCF dialog, then check for the 'ignoreUCF' this will flag whether to only
|
||||
// merge the checkoff header lists from the current format and the list from the base
|
||||
CheckOffHeaderList retlist = new CheckOffHeaderList(SelectNodes("CheckOffHeaderList/CheckOffHeader"), MyFormat);
|
||||
CheckOffHeaderList retlist2 = new CheckOffHeaderList(SelectNodes("../CheckOffDataUCF/CheckOffHeaderList/CheckOffHeader"), MyFormat);
|
||||
if (retlist2 != null && retlist2.Count > 0) foreach (CheckOffHeader co in retlist2) retlist.Add(co);
|
||||
_CheckOffHeaderList = retlist;
|
||||
}
|
||||
private LazyLoad<bool> _CheckOffHeaderInPagelist;
|
||||
public bool CheckOffHeaderInPagelist
|
||||
{
|
||||
@@ -1619,57 +1885,6 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
//#region RightCheckOffBox
|
||||
//[TypeConverter(typeof(ExpandableObjectConverter))]
|
||||
//public class RightCheckOffBox : vlnFormatItem, IVlnIndexedFormatItem
|
||||
//{
|
||||
// public RightCheckOffBox(XmlNode xmlNode) : base(xmlNode) { }
|
||||
// public RightCheckOffBox() : base() { }
|
||||
// private LazyLoad<int?> _Index;
|
||||
// public int? Index
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return LazyLoad(ref _Index, "@Index");
|
||||
// }
|
||||
// }
|
||||
// private LazyLoad<int?> _RightCheckOffBoxChar;
|
||||
// public int? RightCheckOffBoxChar
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return LazyLoad(ref _RightCheckOffBoxChar, "@RightCheckOffBoxChar");
|
||||
// }
|
||||
// }
|
||||
// public override string GetPDDisplayName()
|
||||
// { return string.Format("[{0}]", Index); }
|
||||
// public override string GetPDDescription()
|
||||
// { return string.Format("[{0}] - {1}", Index, RightCheckOffBoxChar); }
|
||||
// public override string GetPDCategory()
|
||||
// { return "RightCheckOffBox Data"; }
|
||||
// public override string ToString()
|
||||
// {
|
||||
// return RightCheckOffBoxChar.ToString();
|
||||
// }
|
||||
//}
|
||||
//#endregion
|
||||
//#region RightCheckOffBoxList
|
||||
//[TypeConverter(typeof(vlnIndexedListConverter<RightCheckOffBoxList, RightCheckOffBox>))]
|
||||
//public class RightCheckOffBoxList : vlnIndexedFormatList<RightCheckOffBox>
|
||||
//{
|
||||
// public RightCheckOffBoxList(XmlNodeList xmlNodeList,IFormatOrFormatInfo myFormat) : base(xmlNodeList,myFormat) { }
|
||||
// public override vlnIndexedFormatList<RightCheckOffBox> InheritedList
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// IFormatOrFormatInfo parentFormat = MyFormat.MyIParent;
|
||||
// if (parentFormat != null)
|
||||
// return parentFormat.PlantFormat.FormatData.ProcData.CheckOffData.RightCheckOffBoxList;
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//#endregion
|
||||
#region CheckOff
|
||||
[TypeConverter(typeof(ExpandableObjectConverter))]
|
||||
public class CheckOff : vlnFormatItem,IVlnIndexedFormatItem
|
||||
@@ -3531,7 +3746,11 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
return LazyLoad(ref _CompressSteps, "@CompressSteps");
|
||||
if (PlantFormat.IgnoreUCF) return LazyLoad(ref _CompressSteps, "@CompressSteps");
|
||||
bool? localvalue = null;
|
||||
FormatConfig fc = PlantFormat.GetFormatConfig(MyFormat);
|
||||
if (fc != null) localvalue = fc.PlantFormat.FormatData.Flags.CompressSteps;
|
||||
return localvalue ?? LazyLoad(ref _CompressSteps, "@CompressSteps");
|
||||
}
|
||||
}
|
||||
private LazyLoad<bool> _DoSTExtraAtTop;
|
||||
@@ -3718,7 +3937,11 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
return LazyLoad(ref _PartialStepCompression, "@PartialStepCompression");
|
||||
if (PlantFormat.IgnoreUCF) return LazyLoad(ref _PartialStepCompression, "@PartialStepCompression");
|
||||
bool? localvalue = null;
|
||||
FormatConfig fc = PlantFormat.GetFormatConfig(MyFormat);
|
||||
if (fc != null) localvalue = fc.PlantFormat.FormatData.Flags.PartialStepCompression;
|
||||
return localvalue ?? LazyLoad(ref _PartialStepCompression, "@PartialStepCompression");
|
||||
}
|
||||
}
|
||||
private LazyLoad<bool> _VirtualDotInHLSTab;
|
||||
@@ -5072,11 +5295,41 @@ namespace VEPROMS.CSLA.Library
|
||||
return LazyLoad(ref _Quoted, "@Quoted");
|
||||
}
|
||||
}
|
||||
private VE_Font GetUCFFontAsVE_Font()
|
||||
{
|
||||
// if formatconfig & step list, then go through to see if index exists, if so and if there is a font, use it:
|
||||
if (MyFormat.PlantFormat.FormatConfig != null && MyFormat.PlantFormat.FormatConfig.PlantFormat != null && MyFormat.PlantFormat.FormatConfig.PlantFormat.FormatData != null && MyFormat.PlantFormat.FormatConfig.PlantFormat.FormatData.StepData != null)
|
||||
{
|
||||
foreach (FormatConfig.Step stp in MyFormat.PlantFormat.FormatConfig.PlantFormat.FormatData.StepData)
|
||||
{
|
||||
if (Convert.ToInt32(stp.Index) == (int)Index && stp.FontDesc != null && stp.FontDesc.Font != null && stp.FontDesc.Font != "")
|
||||
{
|
||||
System.Drawing.FontConverter cvt = new System.Drawing.FontConverter();
|
||||
System.Drawing.Font windowsFont = cvt.ConvertFromString(stp.FontDesc.Font) as System.Drawing.Font;
|
||||
|
||||
E_Style myStyle = E_Style.None;
|
||||
if (windowsFont.Bold) myStyle |= E_Style.Bold;
|
||||
if (windowsFont.Underline) myStyle |= E_Style.Underline;
|
||||
if (windowsFont.Italic) myStyle |= E_Style.Italics;
|
||||
return (new VE_Font(windowsFont.Name, (int)windowsFont.Size, myStyle, windowsFont.SizeInPoints));
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private VE_Font _Font;
|
||||
public VE_Font Font
|
||||
{
|
||||
get
|
||||
{
|
||||
if (PlantFormat.IgnoreUCF) return (_Font == null) ?_Font = new VE_Font(base.XmlNode): _Font;
|
||||
if (_Font != null) return (_Font);
|
||||
VE_Font vef = GetUCFFontAsVE_Font();
|
||||
if (vef != null)
|
||||
{
|
||||
_Font = vef;
|
||||
return vef;
|
||||
}
|
||||
return (_Font == null) ?_Font = new VE_Font(base.XmlNode): _Font;
|
||||
}
|
||||
}
|
||||
|
@@ -642,6 +642,19 @@ namespace VEPROMS.CSLA.Library
|
||||
return max;
|
||||
}
|
||||
}
|
||||
public int MaxIndexNoInherit
|
||||
{
|
||||
get
|
||||
{
|
||||
int max = base.Count;
|
||||
foreach (T tmp in this)
|
||||
{
|
||||
if (tmp.Index >= max)
|
||||
max = ((int)tmp.Index) + 1;
|
||||
}
|
||||
return max;
|
||||
}
|
||||
}
|
||||
#region ICustomTypeDescriptor
|
||||
public String GetClassName()
|
||||
{ return TypeDescriptor.GetClassName(this, true); }
|
||||
|
Reference in New Issue
Block a user