This commit is contained in:
parent
b10ade8a14
commit
2830a93e24
@ -350,6 +350,22 @@ namespace VEPROMS.CSLA.Library
|
||||
OnPropertyChanged("Section_AutoGen");
|
||||
}
|
||||
}
|
||||
[Browsable(false)]
|
||||
[DisplayName("Section OriginalSteps")]
|
||||
[RefreshProperties(RefreshProperties.All)]
|
||||
[Description("Section OriginalSteps")]
|
||||
public string Section_OriginalSteps
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Xp["Section", "OriginalSteps"];
|
||||
}
|
||||
set
|
||||
{
|
||||
_Xp["Section", "OriginalSteps"] = value;
|
||||
OnPropertyChanged("Section_OriginalSteps");
|
||||
}
|
||||
}
|
||||
[Category("Section")]
|
||||
//PROPGRID: Hide Section NumPages
|
||||
[Browsable(false)]
|
||||
|
@ -296,7 +296,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
int ptr = str.IndexOf('<'); //nextDelimiter("<", str, l);
|
||||
int cptr = (ptr == -1) ? -1 : str.IndexOf('>'); //nextDelimiter(">", ptr, strlen(ptr));
|
||||
if (ptr == -1 || (ptr > -1 && cptr == -1))
|
||||
// jsj 2/5/10 added "|| (ptr > cptr)" to fix bug where rawvalue = "Insert token for ->Step<- to transition back to."
|
||||
if (ptr == -1 || (ptr > -1 && ((cptr == -1) || (ptr > cptr))))
|
||||
{
|
||||
//add(new seText(str, l));
|
||||
//str += l;
|
||||
|
@ -93,29 +93,36 @@ namespace VEPROMS.CSLA.Library
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
public ItemInfoList LibraryDocumentUsageList
|
||||
{
|
||||
get
|
||||
{
|
||||
bool first = true;
|
||||
ItemInfoList iil = null;
|
||||
if (DocumentEntries == null) return null;
|
||||
foreach (EntryInfo myEntry in DocumentEntries)
|
||||
{
|
||||
foreach (ItemInfo myitem in myEntry.MyContent.ContentItems)
|
||||
{
|
||||
if (first)
|
||||
{
|
||||
iil = new ItemInfoList(myitem);
|
||||
first = false;
|
||||
}
|
||||
else
|
||||
iil.AddItem(myitem);
|
||||
public ItemInfoList LibraryDocumentUsageList
|
||||
{
|
||||
get
|
||||
{
|
||||
bool first = true;
|
||||
ItemInfoList iil = null;
|
||||
if (DocumentEntries == null) return null;
|
||||
foreach (EntryInfo myEntry in DocumentEntries)
|
||||
{
|
||||
foreach (ItemInfo myitem in myEntry.MyContent.ContentItems)
|
||||
{
|
||||
if (first)
|
||||
{
|
||||
iil = new ItemInfoList(myitem);
|
||||
first = false;
|
||||
}
|
||||
else
|
||||
iil.AddItem(myitem);
|
||||
}
|
||||
}
|
||||
return iil;
|
||||
}
|
||||
}
|
||||
}
|
||||
return iil;
|
||||
}
|
||||
}
|
||||
#region DocumentConfig
|
||||
[NonSerialized]
|
||||
private DocumentConfig _DocumentConfig;
|
||||
public DocumentConfig DocumentConfig
|
||||
{ get { return (_DocumentConfig != null ? _DocumentConfig : _DocumentConfig = new DocumentConfig(this)); } }
|
||||
#endregion
|
||||
|
||||
}
|
||||
public partial class DocumentInfoList
|
||||
{
|
||||
@ -276,7 +283,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
_MyFile = new FileInfo(string.Format(@"{0}\tmp_{1}{2}{3}", TemporaryFolder, MyDocument.DocID, Unique, MyDocument.FileExtension));
|
||||
FileStream fs = _MyFile.Create();
|
||||
fs.Write(MyDocument.DocContent, 0, MyDocument.DocContent.Length);
|
||||
if(MyDocument.DocContent != null)fs.Write(MyDocument.DocContent, 0, MyDocument.DocContent.Length);
|
||||
fs.Close();
|
||||
_MyFile.CreationTime = _MyDocument.DTS;
|
||||
_MyFile.LastWriteTime = _MyDocument.DTS;
|
||||
|
@ -10,6 +10,7 @@ using System.Data.SqlClient;
|
||||
using System.Xml;
|
||||
using System.Drawing;
|
||||
using System.Text.RegularExpressions;
|
||||
using VEPROMS.CSLA.Library;
|
||||
|
||||
namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
@ -1074,6 +1075,86 @@ namespace VEPROMS.CSLA.Library
|
||||
retval = Regex.Replace(retval, @"\\'[0-9A-Fa-f][0-9A-Fa-f]", new MatchEvaluator(ReplaceSpecialHexCharacter));
|
||||
return retval;
|
||||
}
|
||||
|
||||
public VE_Font GetItemFont()
|
||||
{
|
||||
return GetItemFont(ActiveFormat);
|
||||
}
|
||||
|
||||
public VE_Font GetItemFont(FormatInfo fmt)
|
||||
{
|
||||
VE_Font font = null;
|
||||
try
|
||||
{
|
||||
FormatInfo format = (ActiveFormat != null || fmt == null) ? ActiveFormat : fmt;//_MyItemInfo.ActiveFormat;
|
||||
int type = (int)MyContent.Type;//_MyItemInfo.MyContent.Type;
|
||||
switch (type / 10000)
|
||||
{
|
||||
case 0: // procedure
|
||||
font = format.PlantFormat.FormatData.Font;
|
||||
break;
|
||||
case 1: // section
|
||||
font = format.PlantFormat.FormatData.SectData.SectionHeader.Font;
|
||||
break;
|
||||
case 2: // step types
|
||||
int typindx = type - 20000; // what to do for other types rather than steps
|
||||
font = format.PlantFormat.FormatData.StepDataList[typindx].Font;
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("GetItemFont(): {0} - {1}", ex.GetType(), ex.Message);
|
||||
}
|
||||
return font;
|
||||
}
|
||||
private string RemoveToken(string str, string token)
|
||||
{
|
||||
// if this token is preceeded by another token and followed by a space
|
||||
// leave the preceeding token the ending space
|
||||
string retval = Regex.Replace(str, @"(\\[^ \\?\r\n\t]*)" + token + " ", "$1 ");
|
||||
if (retval != str)
|
||||
Console.WriteLine("leave the preceeding token the ending space");
|
||||
// otherwise replace the token optionally followed by a space
|
||||
retval = Regex.Replace(retval, token + " ?", "");
|
||||
return retval;
|
||||
}
|
||||
public string RemoveRtfStyles(string rtf)
|
||||
{
|
||||
return RemoveRtfStyles(rtf, ActiveFormat);
|
||||
}
|
||||
public string RemoveRtfStyles(string rtf, FormatInfo fmt)
|
||||
{
|
||||
string retval = rtf;
|
||||
VE_Font TextFont = GetItemFont(fmt);
|
||||
if (TextFont != null)
|
||||
{
|
||||
// remove rtf commands for any styles that were added. Note that if
|
||||
// the entire item has a style, and also contains 'pieces' of text with
|
||||
// the same style, the underlying rtf box removes the embedded rtf commands,
|
||||
// for example, if the entire step is bolded, and 'THEN' has bold on/off
|
||||
// surrounding it, the rtf box removes the bold around the 'THEN'
|
||||
// These remove the command with a following space or the command alone,
|
||||
// either case may exist, because if there are rtf commands following the
|
||||
// style command, there will be no space character following the style command.
|
||||
if (((TextFont.Style & E_Style.Bold) > 0) || ((TextFont.Style & E_Style.MmBold) > 0))
|
||||
{
|
||||
retval = RemoveToken(retval, @"\\b0");
|
||||
retval = RemoveToken(retval, @"\\b");
|
||||
}
|
||||
if ((TextFont.Style & E_Style.Underline) > 0)
|
||||
{
|
||||
retval = RemoveToken(retval, @"\\ulnone");
|
||||
retval = RemoveToken(retval, @"\\ul");
|
||||
}
|
||||
if ((TextFont.Style & E_Style.Italics) > 0)
|
||||
{
|
||||
retval = RemoveToken(retval, @"\\i0");
|
||||
retval = RemoveToken(retval, @"\\i");
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
#endregion
|
||||
#region Path and Parent
|
||||
public string Path
|
||||
@ -1332,7 +1413,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
|
||||
public ItemInfo MyProcedure
|
||||
public ProcedureInfo MyProcedure
|
||||
{
|
||||
get
|
||||
{
|
||||
@ -1340,7 +1421,7 @@ namespace VEPROMS.CSLA.Library
|
||||
ItemInfo tmp = this;
|
||||
while (tmp.ActiveParent != null && tmp.ActiveParent.GetType() != typeof(DocVersionInfo))
|
||||
tmp = (ItemInfo)tmp.ActiveParent;
|
||||
return tmp;
|
||||
return ProcedureInfo.Get(tmp.ItemID);
|
||||
}
|
||||
}
|
||||
private IVEDrillDownReadOnly _ActiveParent = null;
|
||||
@ -1416,8 +1497,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_ActiveFormat == null)
|
||||
_ActiveFormat = (LocalFormat != null ? LocalFormat : ActiveParent.ActiveFormat);
|
||||
if (_ActiveFormat == null) // jsj added check for NULL ActiveParent
|
||||
_ActiveFormat = (LocalFormat != null ? LocalFormat : (ActiveParent != null)? ActiveParent.ActiveFormat : null);
|
||||
//Console.WriteLine("Active {0}", (_ActiveFormat == null) ? "_ActiveFormat is null" : _ActiveFormat.Name);
|
||||
return _ActiveFormat;
|
||||
}
|
||||
@ -2012,6 +2093,7 @@ namespace VEPROMS.CSLA.Library
|
||||
cm.Parameters.AddWithValue("@IncludeLinks", (int) criteria.IncludeLinks);
|
||||
cm.Parameters.AddWithValue("@IncludeRtfFormatting", criteria.IncludeRtfFormatting ? 1 : 0);
|
||||
cm.Parameters.AddWithValue("@IncludeSpecialCharacters", criteria.IncludeSpecialCharacters ? 1 : 0);
|
||||
cm.CommandTimeout = 120;
|
||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||
{
|
||||
while (dr.Read())
|
||||
|
@ -306,6 +306,7 @@ namespace VEPROMS.CSLA.Library
|
||||
_AppendMethods.Add("{?.Sect Hdr}", AddOptionalTranGetSectionHdr);
|
||||
_AppendMethods.Add("{Sect Title}", AddTranGetSectionHdr);
|
||||
_AppendMethods.Add("{?.Sect Title}", AddOptionalTranGetSectionHdr);
|
||||
_AppendMethods.Add("{Sect Num}", AddTranGetSectionNumber);
|
||||
}
|
||||
public static string GetResolvedText(ItemInfo fromInfo, int tranType, ItemInfo toItem, ItemInfo rangeItem)
|
||||
{
|
||||
@ -325,6 +326,8 @@ 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)
|
||||
tranType = 0;
|
||||
tb._TransFormat = tb._FormatData.TransData.TransTypeList[tranType].TransFormat;
|
||||
tb._TransUI = (E_TransUI)tb._FormatData.TransData.TransTypeList[tranType].TransUI;
|
||||
tb._FromItem = fromInfo;
|
||||
@ -342,10 +345,18 @@ namespace VEPROMS.CSLA.Library
|
||||
while ((index = tb._TransFormat.IndexOf("{", startIndex)) > -1)
|
||||
{
|
||||
if (index > startIndex) nonToken = tb._TransFormat.Substring(startIndex, index - startIndex);
|
||||
if (startIndex == 0 && nonToken != null && nonToken.Length > 0)
|
||||
{
|
||||
tb._Results.Append(nonToken);
|
||||
//textAdded = true;
|
||||
nonToken = "";
|
||||
}
|
||||
int endtokn = tb._TransFormat.IndexOf("}", index);
|
||||
string token = tb._TransFormat.Substring(index, endtokn - index + 1);
|
||||
if (_AppendMethods.ContainsKey(token))
|
||||
textAdded = _AppendMethods[token](textAdded, tb, token, nonToken);
|
||||
else
|
||||
tb._Results.Append("\\"+token.Substring(0,token.Length -1)+"\\}");
|
||||
startIndex = endtokn + 1;
|
||||
if (startIndex >= tb._TransFormat.Length) break;
|
||||
}
|
||||
@ -548,6 +559,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
return false;
|
||||
}
|
||||
private static bool AddTranGetSectionNumber(bool textAdded, TransitionBuilder tb, string token, string nonToken)
|
||||
{
|
||||
string retstr = TranGetSectionNumber(tb._ToItem);
|
||||
if (textAdded) Append(tb, nonToken, false);
|
||||
Append(tb, retstr, true);
|
||||
if (retstr != null && retstr != "") return true;
|
||||
return false;
|
||||
}
|
||||
private static string CapFirstLetterOnly(string retstr, int p)
|
||||
{
|
||||
string lretstr = retstr;
|
||||
|
@ -225,6 +225,14 @@ namespace VEPROMS.CSLA.Library
|
||||
return _TransData == null? _TransData = new TransData(SelectSingleNode("TransData")):_TransData;
|
||||
}
|
||||
}
|
||||
private ROData _ROData;
|
||||
public ROData ROData
|
||||
{
|
||||
get
|
||||
{
|
||||
return _ROData == null ? _ROData = new ROData(SelectSingleNode("ROData")) : _ROData;
|
||||
}
|
||||
}
|
||||
private StepDataList _StepDataList;
|
||||
public StepDataList StepDataList
|
||||
{
|
||||
@ -4446,9 +4454,9 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region RoData
|
||||
[TypeConverter(typeof(ExpandableObjectConverter))]
|
||||
public class RoData : vlnFormatItem
|
||||
public class ROData : vlnFormatItem
|
||||
{
|
||||
public RoData(XmlNode xmlNode) : base(xmlNode) { }
|
||||
public ROData(XmlNode xmlNode) : base(xmlNode) { }
|
||||
private LazyLoad<bool> _AllUnits;
|
||||
public bool AllUnits
|
||||
{
|
||||
|
@ -218,7 +218,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (xp != null)
|
||||
{
|
||||
XmlNodeList xl = xp.SelectNodes(path);
|
||||
if (xl != null)
|
||||
if (xl != null && xl.Count > 0)
|
||||
return xl;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user