Development #612
@@ -44,8 +44,12 @@ using System.Runtime.InteropServices;
|
|||||||
// Revision DHH (day - no leading zero, two digit hour - military time
|
// Revision DHH (day - no leading zero, two digit hour - military time
|
||||||
//
|
//
|
||||||
// ********* REMEMBER TO CHECK THE AssemblyConfiguration SETTING (ABOVE) ********
|
// ********* REMEMBER TO CHECK THE AssemblyConfiguration SETTING (ABOVE) ********
|
||||||
[assembly: AssemblyVersion("2.2.2508.2621")]
|
[assembly: AssemblyVersion("2.2.2508.2815")]
|
||||||
[assembly: AssemblyFileVersion("2.2.2508.2621")]
|
[assembly: AssemblyFileVersion("2.2.2508.2815")]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -269,8 +269,6 @@ namespace VEPROMS
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private E_UCFImportOptions _UCFImportOptionsFromSettings;
|
|
||||||
|
|
||||||
public frmVEPROMS()
|
public frmVEPROMS()
|
||||||
{
|
{
|
||||||
// The following Try/Catch was added to protect against a problem seen by Kathy and Michelle
|
// The following Try/Catch was added to protect against a problem seen by Kathy and Michelle
|
||||||
|
|||||||
@@ -273,8 +273,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion ReplaceStrData
|
#endregion ReplaceStrData
|
||||||
#region ReplaceStr
|
#region ReplaceStr
|
||||||
//[Flags]
|
//[Flags]
|
||||||
//public enum
|
//public enum E_ReplaceFlags : uint
|
||||||
//: uint
|
|
||||||
//{
|
//{
|
||||||
// High = 0x0001, // Do ReplaceWords in HIGH LEVEL STEPS
|
// High = 0x0001, // Do ReplaceWords in HIGH LEVEL STEPS
|
||||||
// RNO = 0x0002, // Do ReplaceWords in RNOS
|
// RNO = 0x0002, // Do ReplaceWords in RNOS
|
||||||
@@ -320,15 +319,15 @@ namespace VEPROMS.CSLA.Library
|
|||||||
get { return _State; }
|
get { return _State; }
|
||||||
set { _State = value; }
|
set { _State = value; }
|
||||||
}
|
}
|
||||||
private E_ReplaceFlagsUCF _Flag;
|
//private E_ReplaceFlags _Flag;
|
||||||
[Editor(typeof(FlagEnumUIEditor), typeof(System.Drawing.Design.UITypeEditor))]
|
//[Editor(typeof(FlagEnumUIEditor), typeof(System.Drawing.Design.UITypeEditor))]
|
||||||
[XmlAttribute("Flag")]
|
//[XmlAttribute("Flag")]
|
||||||
[DisplayName("Flags (Use In)")] // Note that [Description] is not used in collection items (that use collection editor)
|
//[DisplayName("Flags (Use In)")] // Note that [Description] is not used in collection items (that use collection editor)
|
||||||
public E_ReplaceFlagsUCF Flag
|
//public E_ReplaceFlags Flag
|
||||||
{
|
//{
|
||||||
get { return (E_ReplaceFlagsUCF)_Flag; }
|
// get { return (E_ReplaceFlags)_Flag; }
|
||||||
set { _Flag = value; }
|
// set { _Flag = value; }
|
||||||
}
|
//}
|
||||||
private string _ReplaceWord;
|
private string _ReplaceWord;
|
||||||
[XmlAttribute("ReplaceWord")]
|
[XmlAttribute("ReplaceWord")]
|
||||||
[DisplayName("Replace Word")]
|
[DisplayName("Replace Word")]
|
||||||
|
|||||||
@@ -1756,88 +1756,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
//#region UCF Clear Overwridden Formats
|
|
||||||
//private class ClearOverrideFormatsByFolderCriteria
|
|
||||||
//{
|
|
||||||
// public ClearOverrideFormatsByFolderCriteria(int folderID, int? formatID, int? newformatID)
|
|
||||||
// {
|
|
||||||
// _FormatID = formatID;
|
|
||||||
// _FolderID = folderID;
|
|
||||||
// _NewFormatID = newformatID;
|
|
||||||
// }
|
|
||||||
// private int? _FormatID;
|
|
||||||
// public int? FormatID
|
|
||||||
// {
|
|
||||||
// get { return _FormatID; }
|
|
||||||
// set { _FormatID = value; }
|
|
||||||
// }
|
|
||||||
// private int? _NewFormatID;
|
|
||||||
// public int? NewFormatID
|
|
||||||
// {
|
|
||||||
// get { return _NewFormatID; }
|
|
||||||
// set { _NewFormatID = value; }
|
|
||||||
// }
|
|
||||||
// private int _FolderID;
|
|
||||||
// public int FolderID
|
|
||||||
// {
|
|
||||||
// get { return _FolderID; }
|
|
||||||
// set { _FolderID = value; }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
//private void DataPortal_Fetch(ClearOverrideFormatsByFolderCriteria criteria)
|
|
||||||
//{
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
|
||||||
// {
|
|
||||||
// using (SqlCommand cm = cn.CreateCommand())
|
|
||||||
// {
|
|
||||||
// cm.CommandType = CommandType.StoredProcedure;
|
|
||||||
// cm.CommandText = "vesp_ClearOverrideFormatsByFolder";
|
|
||||||
// cm.Parameters.AddWithValue("@FolderID", criteria.FolderID);
|
|
||||||
// if (criteria.FormatID == null)
|
|
||||||
// cm.Parameters.AddWithValue("@FormatID", DBNull.Value);
|
|
||||||
// else
|
|
||||||
// cm.Parameters.AddWithValue("@FormatID", criteria.FormatID);
|
|
||||||
// if (criteria.NewFormatID == null)
|
|
||||||
// cm.Parameters.AddWithValue("@NewFormatID", DBNull.Value);
|
|
||||||
// else
|
|
||||||
// cm.Parameters.AddWithValue("@NewFormatID", criteria.NewFormatID);
|
|
||||||
// cm.CommandTimeout = Database.DefaultTimeout;
|
|
||||||
// using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
|
||||||
// {
|
|
||||||
// IsReadOnly = false;
|
|
||||||
// while (dr.Read())
|
|
||||||
// {
|
|
||||||
// ContentInfo contentInfo = new ContentInfo(dr);
|
|
||||||
// this.Add(contentInfo);
|
|
||||||
// }
|
|
||||||
// IsReadOnly = true;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// catch (Exception ex)
|
|
||||||
// {
|
|
||||||
// Database.LogException("ClearOverrideFormatsByFolderCriteria.DataPortal_Fetch", ex);
|
|
||||||
// throw new DbCslaException("ClearOverrideFormatsByFolderCriteria.DataPortal_Fetch", ex);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
//public static ContentInfoList ClearOverrideFormatsByFolder(int folderID, int? formatID, int? newformatID)
|
|
||||||
//{
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// ContentInfoList tmp = DataPortal.Fetch<ContentInfoList>(new ClearOverrideFormatsByFolderCriteria(folderID, formatID, newformatID));
|
|
||||||
// return tmp;
|
|
||||||
// }
|
|
||||||
// catch (Exception ex)
|
|
||||||
// {
|
|
||||||
// throw new DbCslaException("Error on ContentInfoList.ClearOverrideFormatsByFolder", ex);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
private class ClearOverrideFormatsByDocVersionCriteria
|
private class ClearOverrideFormatsByDocVersionCriteria
|
||||||
{
|
{
|
||||||
public ClearOverrideFormatsByDocVersionCriteria(string dvlist, int? formatID, int? newformatID)
|
public ClearOverrideFormatsByDocVersionCriteria(string dvlist, int? formatID, int? newformatID)
|
||||||
|
|||||||
@@ -2153,7 +2153,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
// return Text;
|
// return Text;
|
||||||
//}
|
//}
|
||||||
#endregion
|
#endregion
|
||||||
private static Dictionary<FormatConfig.ReplaceStr, Regex> dicReplaceRegex = new Dictionary<FormatConfig.ReplaceStr, Regex>();
|
private static Dictionary<ReplaceStr, Regex> dicReplaceRegex = new Dictionary<ReplaceStr, Regex>();
|
||||||
private static bool? _ProcessReplaceWords;
|
private static bool? _ProcessReplaceWords;
|
||||||
public static bool ProcessReplaceWords
|
public static bool ProcessReplaceWords
|
||||||
{
|
{
|
||||||
@@ -2178,7 +2178,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
// F2021-053: BNPP Alarm - need ability to have super/sub scripts in the text of Alarm Tables (ROs).
|
// F2021-053: BNPP Alarm - need ability to have super/sub scripts in the text of Alarm Tables (ROs).
|
||||||
// if doing replace words for Page List items, the current item is not a step, use _DoReplWordInPageList flags this
|
// if doing replace words for Page List items, the current item is not a step, use _DoReplWordInPageList flags this
|
||||||
if (_MyItemInfo.MyContent.Type < 20000 && !_DoReplWordInPageList) return Text; // for now only replace in steps.
|
if (_MyItemInfo.MyContent.Type < 20000 && !_DoReplWordInPageList) return Text; // for now only replace in steps.
|
||||||
FormatConfig.ReplaceStrData rsl = _MyFormat.PlantFormat.UCFandOrigReplaceStrData;
|
//FormatConfig.ReplaceStrData rsl = _MyFormat.PlantFormat.FormatConfig.UCFandReplaceStrData;
|
||||||
|
ReplaceStrList rsl = _MyFormat.PlantFormat.FormatData.SectData.ReplaceStrList;
|
||||||
if (rsl.Count == 1 && (rsl[0].ReplaceWord == null || rsl[0].ReplaceWord == "")) return Text;
|
if (rsl.Count == 1 && (rsl[0].ReplaceWord == null || rsl[0].ReplaceWord == "")) return Text;
|
||||||
|
|
||||||
// F2021-093: Handle partials first and then plain replace words. Need to do this so that the words don't get processed by plain replace
|
// F2021-093: Handle partials first and then plain replace words. Need to do this so that the words don't get processed by plain replace
|
||||||
@@ -2193,15 +2194,16 @@ namespace VEPROMS.CSLA.Library
|
|||||||
// Loop through text looking for words to be replaced
|
// Loop through text looking for words to be replaced
|
||||||
Dictionary<E_ReplaceFlags?, bool> shouldReplace = new Dictionary<E_ReplaceFlags?, bool>();
|
Dictionary<E_ReplaceFlags?, bool> shouldReplace = new Dictionary<E_ReplaceFlags?, bool>();
|
||||||
//int profileDepth = ProfileTimer.Push(">>>> DoReplaceWords2.ForLoop");
|
//int profileDepth = ProfileTimer.Push(">>>> DoReplaceWords2.ForLoop");
|
||||||
foreach (FormatConfig.ReplaceStr rs in rsl)
|
foreach (ReplaceStr rs in rsl)
|
||||||
{
|
{
|
||||||
bool dopartial = (E_ReplaceFlags)(rs.Flag) == E_ReplaceFlags.Partials;
|
//bool dopartial = (E_ReplaceFlags)(rs.Flag & E_ReplaceFlags.CaseInsens) == E_ReplaceFlags.Partials; // save it may need to be changed back to this code.
|
||||||
if (!dopartial) // F2021-093: Partials moved into their own method and done first
|
bool dopartial = (rs.Flag & E_ReplaceFlags.Partials) == E_ReplaceFlags.Partials; // from pre-UCF
|
||||||
|
if (!dopartial) // F2021-093: Partials moved into their own method and done first
|
||||||
{
|
{
|
||||||
bool onlyDoList = (E_ReplaceFlags)(rs.Flag) == E_ReplaceFlags.BeforeList; // C2021-045
|
bool onlyDoList = (E_ReplaceFlags)(rs.Flag & E_ReplaceFlags.BeforeList) == E_ReplaceFlags.BeforeList; // C2021-045, C2025-022 remove UFC
|
||||||
bool onlyIfFirstWord = (E_ReplaceFlags)(rs.Flag) == E_ReplaceFlags.FirstWord; // C2021-056
|
bool onlyIfFirstWord = (E_ReplaceFlags)(rs.Flag & E_ReplaceFlags.FirstWord) == E_ReplaceFlags.FirstWord; // C2021-056
|
||||||
bool doInPagelist = (E_ReplaceFlags)(rs.Flag) == E_ReplaceFlags.PageList; // B2021-132
|
bool doInPagelist = (E_ReplaceFlags)(rs.Flag & E_ReplaceFlags.PageList) == E_ReplaceFlags.PageList; // B2021-132
|
||||||
//B2021-132 only do replacewords in paglist if the replaceword pagelist flag is set
|
//B2021-132 only do replacewords in paglist if the replaceword pagelist flag is set
|
||||||
if (_DoReplWordInPageList && !doInPagelist) continue;
|
if (_DoReplWordInPageList && !doInPagelist) continue;
|
||||||
|
|
||||||
// note that the order of this check is important. Check in this order...
|
// note that the order of this check is important. Check in this order...
|
||||||
@@ -2228,7 +2230,9 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
if (!dicReplaceRegex.ContainsKey(rs))
|
if (!dicReplaceRegex.ContainsKey(rs))
|
||||||
{
|
{
|
||||||
RegexOptions myOptions = (E_ReplaceFlags)(rs.Flag) == E_ReplaceFlags.CaseInsens ? RegexOptions.IgnoreCase : RegexOptions.None;
|
RegexOptions myOptions = (E_ReplaceFlags)(rs.Flag & E_ReplaceFlags.CaseInsens) == E_ReplaceFlags.CaseInsens ? RegexOptions.IgnoreCase : RegexOptions.None;
|
||||||
|
//RegexOptions myOptions = (E_ReplaceFlags)(rs.Flag) == E_ReplaceFlags.CaseInsens ? RegexOptions.IgnoreCase : RegexOptions.None;
|
||||||
|
//RegexOptions myOptions = (rs.Flag & E_ReplaceFlags.CaseInsens) == E_ReplaceFlags.CaseInsens ? RegexOptions.IgnoreCase : RegexOptions.None;
|
||||||
//int profileDepth3 = ProfileTimer.Push(">>>> DoReplaceWords2.BuildMatch");
|
//int profileDepth3 = ProfileTimer.Push(">>>> DoReplaceWords2.BuildMatch");
|
||||||
// CASEINSENS: Do ReplaceWords for all words that match, regardless of case, and replace with the ReplaceWith string as is
|
// CASEINSENS: Do ReplaceWords for all words that match, regardless of case, and replace with the ReplaceWith string as is
|
||||||
//RegexOptions myOptions = (rs.Flag & E_ReplaceFlags.CaseInsens) == E_ReplaceFlags.CaseInsens ? RegexOptions.IgnoreCase & RegexOptions.Singleline : RegexOptions.None & RegexOptions.Singleline;
|
//RegexOptions myOptions = (rs.Flag & E_ReplaceFlags.CaseInsens) == E_ReplaceFlags.CaseInsens ? RegexOptions.IgnoreCase & RegexOptions.Singleline : RegexOptions.None & RegexOptions.Singleline;
|
||||||
@@ -2268,18 +2272,18 @@ namespace VEPROMS.CSLA.Library
|
|||||||
// F2021-093: separate out partial replace words so that they can all be done before normal replace words. Partials read in the 'repword', use
|
// F2021-093: separate out partial replace words so that they can all be done before normal replace words. Partials read in the 'repword', use
|
||||||
// it as-is as a dotnet regular expression to do replacement. Aside from the dotnet regular expression process, the rest of this
|
// it as-is as a dotnet regular expression to do replacement. Aside from the dotnet regular expression process, the rest of this
|
||||||
// code is similar to plain regular expressions, in terms of processing flags for which steps, etc.
|
// code is similar to plain regular expressions, in terms of processing flags for which steps, etc.
|
||||||
private string DoReplacePartials(string Text, FormatConfig.ReplaceStrData rsl)
|
private string DoReplacePartials(string Text, ReplaceStrList rsl)
|
||||||
{
|
{
|
||||||
Dictionary<FormatConfig.ReplaceStr, Regex> partialReplaceList = new Dictionary<FormatConfig.ReplaceStr, Regex>();
|
Dictionary<ReplaceStr, Regex> partialReplaceList = new Dictionary<ReplaceStr, Regex>();
|
||||||
Dictionary<E_ReplaceFlags?, bool> shouldReplace = new Dictionary<E_ReplaceFlags?, bool>();
|
Dictionary<E_ReplaceFlags?, bool> shouldReplace = new Dictionary<E_ReplaceFlags?, bool>();
|
||||||
foreach (FormatConfig.ReplaceStr rs in rsl)
|
foreach (ReplaceStr rs in rsl)
|
||||||
{
|
{
|
||||||
bool dopartial = (E_ReplaceFlags)(rs.Flag) == E_ReplaceFlags.Partials;
|
bool dopartial = (E_ReplaceFlags)(rs.Flag & E_ReplaceFlags.Partials) == E_ReplaceFlags.Partials;
|
||||||
if (dopartial)
|
if (dopartial)
|
||||||
{
|
{
|
||||||
bool onlyDoList = (E_ReplaceFlags)(rs.Flag) == E_ReplaceFlags.BeforeList; // C2021-045
|
bool onlyDoList = (E_ReplaceFlags)(rs.Flag & E_ReplaceFlags.BeforeList) == E_ReplaceFlags.BeforeList; // C2021-045
|
||||||
bool onlyIfFirstWord = (E_ReplaceFlags)(rs.Flag) == E_ReplaceFlags.FirstWord; // C2021-056
|
bool onlyIfFirstWord = (E_ReplaceFlags)(rs.Flag) == E_ReplaceFlags.FirstWord; // C2021-056
|
||||||
bool doInPagelist = (E_ReplaceFlags)(rs.Flag) == E_ReplaceFlags.PageList; // B2021-132
|
bool doInPagelist = (E_ReplaceFlags)(rs.Flag & E_ReplaceFlags.PageList) == E_ReplaceFlags.PageList; // B2021-132
|
||||||
//B2021-132 only do replacewords in paglist if the replaceword pagelist flag is set
|
//B2021-132 only do replacewords in paglist if the replaceword pagelist flag is set
|
||||||
if (_DoReplWordInPageList && !doInPagelist) continue;
|
if (_DoReplWordInPageList && !doInPagelist) continue;
|
||||||
|
|
||||||
@@ -2304,7 +2308,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
if (!dicReplaceRegex.ContainsKey(rs))
|
if (!dicReplaceRegex.ContainsKey(rs))
|
||||||
{
|
{
|
||||||
RegexOptions myOptions = (E_ReplaceFlags)(rs.Flag) == E_ReplaceFlags.CaseInsens ? RegexOptions.IgnoreCase : RegexOptions.None;
|
RegexOptions myOptions = (E_ReplaceFlags)(rs.Flag & E_ReplaceFlags.CaseInsens) == E_ReplaceFlags.CaseInsens ? RegexOptions.IgnoreCase : RegexOptions.None;
|
||||||
dicReplaceRegex.Add(rs, new Regex(rs.ReplaceWord, myOptions));
|
dicReplaceRegex.Add(rs, new Regex(rs.ReplaceWord, myOptions));
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
@@ -2320,7 +2324,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
Text = Text.Replace(@"\xA0", @"\u160?"); //replace hard space
|
Text = Text.Replace(@"\xA0", @"\u160?"); //replace hard space
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
foreach (FormatConfig.ReplaceStr prs in partialReplaceList.Keys)
|
foreach (ReplaceStr prs in partialReplaceList.Keys)
|
||||||
Text = partialReplaceList[prs].Replace(Text, prs.ReplaceWith);
|
Text = partialReplaceList[prs].Replace(Text, prs.ReplaceWith);
|
||||||
//if (partialReplaceList.Count>0) GC.Collect(); // microsoft had a memory leak in regular expression code - this REALLY slows it down though
|
//if (partialReplaceList.Count>0) GC.Collect(); // microsoft had a memory leak in regular expression code - this REALLY slows it down though
|
||||||
}
|
}
|
||||||
@@ -2486,7 +2490,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
_Font = font;
|
_Font = font;
|
||||||
_MyItemInfo = myItemInfo;
|
_MyItemInfo = myItemInfo;
|
||||||
}
|
}
|
||||||
public void Add(Regex myRegEx, FormatConfig.ReplaceStr myWord)
|
public void Add(Regex myRegEx, ReplaceStr myWord)
|
||||||
{
|
{
|
||||||
MatchCollection myMatches = myRegEx.Matches(_Text);
|
MatchCollection myMatches = myRegEx.Matches(_Text);
|
||||||
foreach (Match myMatch in myMatches)
|
foreach (Match myMatch in myMatches)
|
||||||
@@ -2529,7 +2533,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
public void Add(Match myMatch, FormatConfig.ReplaceStr myWord)
|
public void Add(Match myMatch, ReplaceStr myWord)
|
||||||
{
|
{
|
||||||
// If one already exists for this location, then don't add another.
|
// If one already exists for this location, then don't add another.
|
||||||
if (ContainsKey(myMatch.Index)) return;
|
if (ContainsKey(myMatch.Index)) return;
|
||||||
@@ -2563,12 +2567,12 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
// B2022-015 BNPPalr: Determine whether RO text should have Replace Words applied. InLinkAndNotInRoFlag checks
|
// B2022-015 BNPPalr: Determine whether RO text should have Replace Words applied. InLinkAndNotInRoFlag checks
|
||||||
// for flag on replace word item & checks that it is within and RO link
|
// for flag on replace word item & checks that it is within and RO link
|
||||||
bool InLinkAndNotInRoFlag = ((foundMatch.MyWord.Flag) != 0) ? VerifyWithinLink(text, foundMatch, offset) : false;
|
bool InLinkAndNotInRoFlag = ((foundMatch.MyWord.Flag & E_ReplaceFlags.NotInRO) != 0) ? VerifyWithinLink(text, foundMatch, offset) : false;
|
||||||
if (!InLinkAndNotInRoFlag && VerifyNoHardSpace(text, foundMatch, offset) && VerifyNoLink(text, foundMatch, offset))
|
if (!InLinkAndNotInRoFlag && VerifyNoHardSpace(text, foundMatch, offset) && VerifyNoLink(text, foundMatch, offset))
|
||||||
{
|
{
|
||||||
//if(offset != 0 || foundMatch.MyMatch.Index != 0 || !foundMatch.MyWord.ReplaceWith.StartsWith(@"{\par}"))
|
//if(offset != 0 || foundMatch.MyMatch.Index != 0 || !foundMatch.MyWord.ReplaceWith.StartsWith(@"{\par}"))
|
||||||
//{
|
//{
|
||||||
if (((foundMatch.MyWord.Flag) == 0) || DiffUnit(foundMatch.MyWord.ReplaceWord, _MyItemInfo, "UNIT "))
|
if (((foundMatch.MyWord.Flag & E_ReplaceFlags.DiffUnit) == 0) || DiffUnit(foundMatch.MyWord.ReplaceWord, _MyItemInfo, "UNIT "))
|
||||||
{
|
{
|
||||||
string with = foundMatch.MyWord.ReplaceWith;
|
string with = foundMatch.MyWord.ReplaceWith;
|
||||||
if (offset == 0 && with.StartsWith(@"{\par}"))
|
if (offset == 0 && with.StartsWith(@"{\par}"))
|
||||||
@@ -2723,13 +2727,13 @@ namespace VEPROMS.CSLA.Library
|
|||||||
get { return _MyMatch; }
|
get { return _MyMatch; }
|
||||||
set { _MyMatch = value; }
|
set { _MyMatch = value; }
|
||||||
}
|
}
|
||||||
private FormatConfig.ReplaceStr _MyWord;
|
private ReplaceStr _MyWord;
|
||||||
public FormatConfig.ReplaceStr MyWord
|
public ReplaceStr MyWord
|
||||||
{
|
{
|
||||||
get { return _MyWord; }
|
get { return _MyWord; }
|
||||||
set { _MyWord = value; }
|
set { _MyWord = value; }
|
||||||
}
|
}
|
||||||
public FoundMatch(Match myMatch, FormatConfig.ReplaceStr myWord)
|
public FoundMatch(Match myMatch, ReplaceStr myWord)
|
||||||
{
|
{
|
||||||
_MyMatch = myMatch;
|
_MyMatch = myMatch;
|
||||||
_MyWord = myWord;
|
_MyWord = myWord;
|
||||||
|
|||||||
@@ -594,70 +594,7 @@ public partial class FormatInfo : IFormatOrFormatInfo
|
|||||||
throw new DbCslaException("FormatInfo.DataPortal_Fetch", ex);
|
throw new DbCslaException("FormatInfo.DataPortal_Fetch", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Get format data, but do not resolve the 'Data' and 'Genmac' fields, i.e. keep empty if they are
|
|
||||||
// empty.
|
|
||||||
//public static FormatInfo GetFormatNoUCFByFormatID(int formatID)
|
|
||||||
//{
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// FormatInfo tmp = DataPortal.Fetch<FormatInfo>(new FormatIDNoUCFCriteria(formatID));
|
|
||||||
// if (tmp.ErrorMessage == "No Record Found")
|
|
||||||
// {
|
|
||||||
// tmp.Dispose(); // Clean-up FormatInfo
|
|
||||||
// tmp = null;
|
|
||||||
// }
|
|
||||||
// return tmp;
|
|
||||||
// }
|
|
||||||
// catch (Exception ex)
|
|
||||||
// {
|
|
||||||
// throw new DbCslaException("Error on FormatInfo.GetFormatNoUCFByFormatID", ex);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
//protected class FormatIDNoUCFCriteria
|
|
||||||
//{
|
|
||||||
// private int _FormatID;
|
|
||||||
// public int FormatID { get { return _FormatID; } }
|
|
||||||
// public FormatIDNoUCFCriteria(int formatID)
|
|
||||||
// {
|
|
||||||
// _FormatID = formatID;
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
//private void DataPortal_Fetch(FormatIDNoUCFCriteria criteria)
|
|
||||||
//{
|
|
||||||
// if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FormatInfo.DataPortal_Fetch", GetHashCode());
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
|
||||||
// {
|
|
||||||
// ApplicationContext.LocalContext["cn"] = cn;
|
|
||||||
// using (SqlCommand cm = cn.CreateCommand())
|
|
||||||
// {
|
|
||||||
// cm.CommandType = CommandType.StoredProcedure;
|
|
||||||
// cm.CommandText = "getFormatNoUCF";
|
|
||||||
// cm.Parameters.AddWithValue("@FormatID", criteria.FormatID);
|
|
||||||
// cm.CommandTimeout = Database.DefaultTimeout;
|
|
||||||
// using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
|
||||||
// {
|
|
||||||
// if (!dr.Read())
|
|
||||||
// {
|
|
||||||
// _ErrorMessage = "No Record Found";
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// ReadData(dr);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// // removing of item only needed for local data portal
|
|
||||||
// if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
|
||||||
// ApplicationContext.LocalContext.Remove("cn");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// catch (Exception ex)
|
|
||||||
// {
|
|
||||||
// if (_MyLog.IsErrorEnabled) _MyLog.Error("FormatInfo.DataPortal_Fetch", ex);
|
|
||||||
// _ErrorMessage = ex.Message;
|
|
||||||
// throw new DbCslaException("FormatInfo.DataPortal_Fetch", ex);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
#region PlantFormat
|
#region PlantFormat
|
||||||
[NonSerialized]
|
[NonSerialized]
|
||||||
private PlantFormat _PlantFormat;
|
private PlantFormat _PlantFormat;
|
||||||
|
|||||||
@@ -249,13 +249,5 @@ namespace VEPROMS.CSLA.Library
|
|||||||
SupInfoPdfPrint = 2,
|
SupInfoPdfPrint = 2,
|
||||||
Merge = 3
|
Merge = 3
|
||||||
}
|
}
|
||||||
public enum E_UCFImportOptions : uint
|
|
||||||
{
|
|
||||||
Ignore = 0,
|
|
||||||
LoadNotUsed = 1,
|
|
||||||
LoadOnlyImported = 2,
|
|
||||||
LoadUseAll = 3,
|
|
||||||
LoadForSetOnly = 4
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,72 +126,76 @@ namespace VEPROMS.CSLA.Library
|
|||||||
XmlNodeList nl = XmlDoc.SelectNodes(xpath);
|
XmlNodeList nl = XmlDoc.SelectNodes(xpath);
|
||||||
return nl.Count > 0;
|
return nl.Count > 0;
|
||||||
}
|
}
|
||||||
private FormatConfig.ReplaceStrData _UCFandOrigReplaceStrData = null;
|
//private FormatConfig.ReplaceStrData _UCFandOrigReplaceStrData = null;
|
||||||
// This will return a complete list of ReplaceWords, combining those in the original plant format
|
//// This will return a complete list of ReplaceWords, combining those in the original plant format
|
||||||
// with the ones added by the user via User Control of Format (UCF)
|
//// with the ones added by the user via User Control of Format (UCF)
|
||||||
public FormatConfig.ReplaceStrData UCFandOrigReplaceStrData
|
//public ReplaceStrData UCFandOrigReplaceStrData
|
||||||
{
|
//{
|
||||||
get
|
// get
|
||||||
{
|
// {
|
||||||
if (_UCFandOrigReplaceStrData != null) return _UCFandOrigReplaceStrData;
|
// if (_UCFandOrigReplaceStrData != null) return _UCFandOrigReplaceStrData;
|
||||||
_UCFandOrigReplaceStrData = GetMergedReplaceList(this);
|
// _UCFandOrigReplaceStrData = GetMergedReplaceList(this);
|
||||||
return _UCFandOrigReplaceStrData;
|
// return _UCFandOrigReplaceStrData;
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
private FormatConfig.ReplaceStrData GetMergedReplaceList(PlantFormat OriginalPlantFormat)
|
//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.
|
// 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
|
// 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)
|
// 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)
|
// 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
|
// 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;
|
// replace word has been overwridden by UCF data.If it exists, use it:
|
||||||
bool deleted = false;
|
|
||||||
// States for replacewords: 0 = no change, -1 deleted, 1 added, 2 modified
|
// ReplaceStr usethisone = null;
|
||||||
if (FormatConfig != null)
|
// bool deleted = false;
|
||||||
{
|
// States for replacewords: 0 = no change, -1 deleted, 1 added, 2 modified
|
||||||
foreach (FormatConfig.ReplaceStr ucfrepstr in FormatConfig.PlantFormat.FormatData.ReplaceStrData)
|
|
||||||
{
|
// if (FormatConfig != null)
|
||||||
if (ucfrepstr.ReplaceWord == origrepstr.ReplaceWord)
|
// {
|
||||||
{
|
// foreach (ReplaceStr ucfrepstr in FormatConfig.PlantFormat.FormatData.ReplaceStrData)
|
||||||
if (ucfrepstr.State == -1) deleted = true;
|
// {
|
||||||
else usethisone = ucfrepstr;
|
// if (ucfrepstr.ReplaceWord == origrepstr.ReplaceWord)
|
||||||
ucfrepstr.State = 2;
|
// {
|
||||||
inoriglist.Add(origrepstr.ReplaceWord);
|
// if (ucfrepstr.State == -1) deleted = true;
|
||||||
break;
|
// 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;
|
// if (!deleted && usethisone == null)
|
||||||
usethisone.State = 0; // no change
|
// {
|
||||||
usethisone.ReplaceWith = origrepstr.ReplaceWith;
|
// usethisone = new ReplaceStr();
|
||||||
usethisone.ReplaceWord = origrepstr.ReplaceWord;
|
// usethisone.Flag = (E_ReplaceFlags)origrepstr.Flag;
|
||||||
}
|
// usethisone.State = 0; // no change
|
||||||
if (!deleted) retlist.Add(usethisone);
|
// usethisone.ReplaceWith = origrepstr.ReplaceWith;
|
||||||
}
|
// usethisone.ReplaceWord = origrepstr.ReplaceWord;
|
||||||
// now add in any ucf only replacements, any that are not in the inoriglist
|
// }
|
||||||
if (FormatConfig != null)
|
// if (!deleted) retlist.Add(usethisone);
|
||||||
{
|
// }
|
||||||
foreach (FormatConfig.ReplaceStr ucfrepstr in FormatConfig.PlantFormat.FormatData.ReplaceStrData)
|
// now add in any ucf only replacements, any that are not in the inoriglist
|
||||||
{
|
|
||||||
if (!inoriglist.Contains(ucfrepstr.ReplaceWord))
|
// if (FormatConfig != null)
|
||||||
{
|
// {
|
||||||
FormatConfig.ReplaceStr newone = new FormatConfig.ReplaceStr();
|
// foreach (ReplaceStr ucfrepstr in PlantFormat.FormatData.ReplaceStrData)
|
||||||
newone.Flag = (FormatConfig.E_ReplaceFlagsUCF)ucfrepstr.Flag;
|
// {
|
||||||
newone.State = 1;
|
// if (!inoriglist.Contains(ucfrepstr.ReplaceWord))
|
||||||
newone.ReplaceWith = ucfrepstr.ReplaceWith;
|
// {
|
||||||
newone.ReplaceWord = ucfrepstr.ReplaceWord;
|
// ReplaceStr newone = new ReplaceStr();
|
||||||
retlist.Add(newone);
|
// newone.Flag = (E_ReplaceFlags)ucfrepstr.Flag;
|
||||||
}
|
// newone.State = 1;
|
||||||
}
|
// newone.ReplaceWith = ucfrepstr.ReplaceWith;
|
||||||
}
|
// newone.ReplaceWord = ucfrepstr.ReplaceWord;
|
||||||
return (retlist);
|
// retlist.Add(newone);
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return (retlist);
|
||||||
|
//}
|
||||||
|
|
||||||
//C2025-023 - Electronic Procedures - Modifications to PROMS
|
//C2025-023 - Electronic Procedures - Modifications to PROMS
|
||||||
// EPFormatFiles contains which Electronic Procedure Format files apply to this main format file.
|
// EPFormatFiles contains which Electronic Procedure Format files apply to this main format file.
|
||||||
|
|||||||
@@ -101,12 +101,6 @@
|
|||||||
<Compile Include="FrmPopupStatusMessage.Designer.cs">
|
<Compile Include="FrmPopupStatusMessage.Designer.cs">
|
||||||
<DependentUpon>FrmPopupStatusMessage.cs</DependentUpon>
|
<DependentUpon>FrmPopupStatusMessage.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="frmRtfEdit.cs">
|
|
||||||
<SubType>Form</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="frmRtfEdit.Designer.cs">
|
|
||||||
<DependentUpon>frmRtfEdit.cs</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="GenericSerializer.cs" />
|
<Compile Include="GenericSerializer.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="PropGridCollEditor.cs" />
|
<Compile Include="PropGridCollEditor.cs" />
|
||||||
@@ -126,9 +120,6 @@
|
|||||||
<EmbeddedResource Include="FrmPopupStatusMessage.resx">
|
<EmbeddedResource Include="FrmPopupStatusMessage.resx">
|
||||||
<DependentUpon>FrmPopupStatusMessage.cs</DependentUpon>
|
<DependentUpon>FrmPopupStatusMessage.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="frmRtfEdit.resx">
|
|
||||||
<DependentUpon>frmRtfEdit.cs</DependentUpon>
|
|
||||||
</EmbeddedResource>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
|||||||
-179
@@ -1,179 +0,0 @@
|
|||||||
namespace Volian.Base.Library
|
|
||||||
{
|
|
||||||
partial class frmRtfEdit
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.btnOK = new System.Windows.Forms.Button();
|
|
||||||
this.btnCancel = new System.Windows.Forms.Button();
|
|
||||||
this.rtfBox = new System.Windows.Forms.RichTextBox();
|
|
||||||
this.btnBold = new DevComponents.DotNetBar.ButtonX();
|
|
||||||
this.btnItalics = new DevComponents.DotNetBar.ButtonX();
|
|
||||||
this.btnUnderline = new DevComponents.DotNetBar.ButtonX();
|
|
||||||
this.btnSubscript = new DevComponents.DotNetBar.ButtonX();
|
|
||||||
this.btnSuperscript = new DevComponents.DotNetBar.ButtonX();
|
|
||||||
this.btnHardspace = new DevComponents.DotNetBar.ButtonX();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// btnOK
|
|
||||||
//
|
|
||||||
this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
|
|
||||||
this.btnOK.Location = new System.Drawing.Point(38, 144);
|
|
||||||
this.btnOK.Name = "btnOK";
|
|
||||||
this.btnOK.Size = new System.Drawing.Size(75, 23);
|
|
||||||
this.btnOK.TabIndex = 3;
|
|
||||||
this.btnOK.Text = "OK";
|
|
||||||
this.btnOK.UseVisualStyleBackColor = true;
|
|
||||||
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
|
|
||||||
//
|
|
||||||
// btnCancel
|
|
||||||
//
|
|
||||||
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
|
||||||
this.btnCancel.Location = new System.Drawing.Point(143, 144);
|
|
||||||
this.btnCancel.Name = "btnCancel";
|
|
||||||
this.btnCancel.Size = new System.Drawing.Size(75, 23);
|
|
||||||
this.btnCancel.TabIndex = 4;
|
|
||||||
this.btnCancel.Text = "Cancel";
|
|
||||||
this.btnCancel.UseVisualStyleBackColor = true;
|
|
||||||
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
|
|
||||||
//
|
|
||||||
// rtfBox
|
|
||||||
//
|
|
||||||
this.rtfBox.Location = new System.Drawing.Point(38, 73);
|
|
||||||
this.rtfBox.Name = "rtfBox";
|
|
||||||
this.rtfBox.Size = new System.Drawing.Size(214, 50);
|
|
||||||
this.rtfBox.TabIndex = 5;
|
|
||||||
this.rtfBox.Text = "";
|
|
||||||
this.rtfBox.SelectionChanged += new System.EventHandler(this.rtfBox_SelectionChanged);
|
|
||||||
//
|
|
||||||
// btnBold
|
|
||||||
//
|
|
||||||
this.btnBold.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
|
|
||||||
this.btnBold.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
|
|
||||||
this.btnBold.Location = new System.Drawing.Point(12, 12);
|
|
||||||
this.btnBold.Name = "btnBold";
|
|
||||||
this.btnBold.Size = new System.Drawing.Size(31, 24);
|
|
||||||
this.btnBold.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
|
||||||
this.btnBold.TabIndex = 6;
|
|
||||||
this.btnBold.Text = "B";
|
|
||||||
this.btnBold.Click += new System.EventHandler(this.btnBold_Click);
|
|
||||||
//
|
|
||||||
// btnItalics
|
|
||||||
//
|
|
||||||
this.btnItalics.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
|
|
||||||
this.btnItalics.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
|
|
||||||
this.btnItalics.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.btnItalics.Location = new System.Drawing.Point(43, 12);
|
|
||||||
this.btnItalics.Name = "btnItalics";
|
|
||||||
this.btnItalics.Size = new System.Drawing.Size(31, 24);
|
|
||||||
this.btnItalics.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
|
||||||
this.btnItalics.TabIndex = 7;
|
|
||||||
this.btnItalics.Text = "I";
|
|
||||||
this.btnItalics.Click += new System.EventHandler(this.btnItalics_Click);
|
|
||||||
//
|
|
||||||
// btnUnderline
|
|
||||||
//
|
|
||||||
this.btnUnderline.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
|
|
||||||
this.btnUnderline.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
|
|
||||||
this.btnUnderline.Location = new System.Drawing.Point(74, 12);
|
|
||||||
this.btnUnderline.Name = "btnUnderline";
|
|
||||||
this.btnUnderline.Size = new System.Drawing.Size(31, 24);
|
|
||||||
this.btnUnderline.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
|
||||||
this.btnUnderline.TabIndex = 8;
|
|
||||||
this.btnUnderline.Text = "U";
|
|
||||||
this.btnUnderline.Click += new System.EventHandler(this.btnUnderline_Click);
|
|
||||||
//
|
|
||||||
// btnSubscript
|
|
||||||
//
|
|
||||||
this.btnSubscript.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
|
|
||||||
this.btnSubscript.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
|
|
||||||
this.btnSubscript.Location = new System.Drawing.Point(12, 42);
|
|
||||||
this.btnSubscript.Name = "btnSubscript";
|
|
||||||
this.btnSubscript.Size = new System.Drawing.Size(75, 23);
|
|
||||||
this.btnSubscript.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
|
||||||
this.btnSubscript.TabIndex = 9;
|
|
||||||
this.btnSubscript.Text = "Subscript";
|
|
||||||
this.btnSubscript.Click += new System.EventHandler(this.btnSubscript_Click);
|
|
||||||
//
|
|
||||||
// btnSuperscript
|
|
||||||
//
|
|
||||||
this.btnSuperscript.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
|
|
||||||
this.btnSuperscript.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
|
|
||||||
this.btnSuperscript.Location = new System.Drawing.Point(90, 42);
|
|
||||||
this.btnSuperscript.Name = "btnSuperscript";
|
|
||||||
this.btnSuperscript.Size = new System.Drawing.Size(75, 23);
|
|
||||||
this.btnSuperscript.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
|
||||||
this.btnSuperscript.TabIndex = 10;
|
|
||||||
this.btnSuperscript.Text = "Superscript";
|
|
||||||
this.btnSuperscript.Click += new System.EventHandler(this.btnSuperscript_Click);
|
|
||||||
//
|
|
||||||
// btnHardspace
|
|
||||||
//
|
|
||||||
this.btnHardspace.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
|
|
||||||
this.btnHardspace.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
|
|
||||||
this.btnHardspace.Location = new System.Drawing.Point(150, 10);
|
|
||||||
this.btnHardspace.Name = "btnHardspace";
|
|
||||||
this.btnHardspace.Size = new System.Drawing.Size(37, 26);
|
|
||||||
this.btnHardspace.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
|
||||||
this.btnHardspace.TabIndex = 11;
|
|
||||||
this.btnHardspace.Text = "HS";
|
|
||||||
this.btnHardspace.Click += new System.EventHandler(this.btnHardspace_Click);
|
|
||||||
//
|
|
||||||
// frmRtfEdit
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(282, 198);
|
|
||||||
this.Controls.Add(this.btnHardspace);
|
|
||||||
this.Controls.Add(this.btnSuperscript);
|
|
||||||
this.Controls.Add(this.btnSubscript);
|
|
||||||
this.Controls.Add(this.btnUnderline);
|
|
||||||
this.Controls.Add(this.btnItalics);
|
|
||||||
this.Controls.Add(this.btnBold);
|
|
||||||
this.Controls.Add(this.rtfBox);
|
|
||||||
this.Controls.Add(this.btnCancel);
|
|
||||||
this.Controls.Add(this.btnOK);
|
|
||||||
this.Name = "frmRtfEdit";
|
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
|
||||||
this.Text = "Rich Text Edit";
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private System.Windows.Forms.Button btnOK;
|
|
||||||
private System.Windows.Forms.Button btnCancel;
|
|
||||||
private System.Windows.Forms.RichTextBox rtfBox;
|
|
||||||
private DevComponents.DotNetBar.ButtonX btnBold;
|
|
||||||
private DevComponents.DotNetBar.ButtonX btnItalics;
|
|
||||||
private DevComponents.DotNetBar.ButtonX btnUnderline;
|
|
||||||
private DevComponents.DotNetBar.ButtonX btnSubscript;
|
|
||||||
private DevComponents.DotNetBar.ButtonX btnSuperscript;
|
|
||||||
private DevComponents.DotNetBar.ButtonX btnHardspace;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,199 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using DevComponents.DotNetBar;
|
|
||||||
|
|
||||||
namespace Volian.Base.Library
|
|
||||||
{
|
|
||||||
// this is the form used in the UCF (User Control of Format) feature that displays text and allows the user to modify it to
|
|
||||||
// add/remove various text attributes: Underline, bold, italics, super/sub script & Hard space.
|
|
||||||
public partial class frmRtfEdit : Form
|
|
||||||
{
|
|
||||||
public frmRtfEdit()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
private static Regex regHyphen = new Regex(@"(?<!\\)(\\u8208\?|\\u8210\?|\\u8211\?|\\u8212\?|\\u8213\?|\\_|\\endash|\\emdash)");
|
|
||||||
// Value is used by the UITypeEditor, RtfEditor, to set/return the text that is being edited.
|
|
||||||
public string Value
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
string rtbString = regHyphen.Replace(RtfToDbText(rtfBox.Rtf).Replace("<BackSlash>", "\\\\"), @"\u8209?");
|
|
||||||
int indx = rtbString.IndexOf('-');
|
|
||||||
while (indx > -1)
|
|
||||||
{
|
|
||||||
if (indx > 2)
|
|
||||||
{
|
|
||||||
if (rtbString[indx - 1] != 'i' || rtbString[indx - 2] != 'f' || rtbString[indx - 3] != '\\')
|
|
||||||
{
|
|
||||||
rtbString = rtbString.Remove(indx, 1);
|
|
||||||
rtbString = rtbString.Insert(indx, @"\u8209?");
|
|
||||||
}
|
|
||||||
if (indx + 1 > rtbString.Length) indx = -1;
|
|
||||||
else indx = rtbString.IndexOf('-', indx + 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return rtbString;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
string makeRtf = @"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Microsoft Sans Serif;}}\viewkind4\uc1\pard\f0\fs16 " + value + @"\par}";
|
|
||||||
makeRtf = makeRtf.Replace(@"\xa0", "'");
|
|
||||||
rtfBox.Rtf = makeRtf;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// when saving text, keep all of the necessary rtf commands that are used to define the text attributes. The rest are removed
|
|
||||||
public static string StaticReplaceRTFClause(Match m)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
string token = m.Groups[1].Value;
|
|
||||||
switch (token[1])
|
|
||||||
{
|
|
||||||
case '\\':
|
|
||||||
return token;
|
|
||||||
case 'u':
|
|
||||||
if (Regex.IsMatch(token, @"^\\u[0-9]+$"))
|
|
||||||
return token; // Special Charcaters
|
|
||||||
if (Regex.IsMatch(token, @"^\\ulnone ?$"))
|
|
||||||
return token;
|
|
||||||
if (Regex.IsMatch(token, @"^\\ul.*$"))
|
|
||||||
return token; // Underline
|
|
||||||
if (Regex.IsMatch(token, @"^\\up[0-9] ?$"))
|
|
||||||
return token; // shift up (superscript)
|
|
||||||
break;
|
|
||||||
case 'd':
|
|
||||||
if (Regex.IsMatch(token, @"^\\dn[0-9] ?$"))
|
|
||||||
return token; // shift down (subscript)
|
|
||||||
break;
|
|
||||||
case '\'': // Special Character
|
|
||||||
return token;
|
|
||||||
case 'b': // Bold
|
|
||||||
return token;
|
|
||||||
case 'i': // Italics
|
|
||||||
return token;
|
|
||||||
case '{': // look for escape for curly braces:
|
|
||||||
return token;
|
|
||||||
case '}':
|
|
||||||
return token;
|
|
||||||
case 'l':
|
|
||||||
if (Regex.IsMatch(token, @"^\\line ?$")) return token;
|
|
||||||
if (Regex.IsMatch(token, @"^\\li[-0-9]+ ?$")) return token; // line indent
|
|
||||||
break;
|
|
||||||
case 'f':
|
|
||||||
if (Regex.IsMatch(token, @"^\\fi[-0-9]+ ?$")) return token; // first line indent
|
|
||||||
break;
|
|
||||||
case 'p':
|
|
||||||
if (Regex.IsMatch(token, @"^\\par ?$")) return @"{\par}";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine("StaticReplaceRTFClause {0} - {1}", ex.GetType().Name, ex.Message);
|
|
||||||
}
|
|
||||||
return "";//Strip All
|
|
||||||
}
|
|
||||||
// remove all of the rtf commands that are not needed to define the attributes of text that are supported:
|
|
||||||
private static Regex reg1 = new Regex(@"\\par\r\n(?!\\)");
|
|
||||||
private static Regex reg2 = new Regex(@"[\r\n]", RegexOptions.Singleline); // Strip Carriage Returns and Newlines
|
|
||||||
private static Regex reg3 = new Regex(@"^\{(.*)\}$", RegexOptions.Singleline); // Strip Opening and Closing Braces
|
|
||||||
private static Regex reg4 = new Regex(@"\{[^{]*?\}", RegexOptions.Singleline); // Strip Clauses - remove anything from curly braces
|
|
||||||
private static Regex reg5 = new Regex(@"\{[^{]*?\}", RegexOptions.Singleline); // Strip Clauses - remove anything from curly braces
|
|
||||||
private static Regex reg6 = new Regex(@"(\\[^' \\?\r\n\t]+)(?=\\)"); // add space after token if followed by token
|
|
||||||
private static Regex reg7 = new Regex(@"(\\[^' \\?\r\n\t]+ )"); // take backslash xyz and evaluates them
|
|
||||||
private static Regex reg8 = new Regex(@"(\\[^' \\?\r\n\t]+) (?=\\)"); // remove space between tokens
|
|
||||||
private static Regex reg9 = new Regex(@"(\\[^' \\?\r\n\t]+) (?=\r\n)"); // remove space before /r/n
|
|
||||||
private static Regex reg10 = new Regex(@"(\\[0-9a-z]+)$"); // end of text attribute needs a 'space'
|
|
||||||
private string RtfToDbText(string rtf)
|
|
||||||
{
|
|
||||||
// replace \{ & \} with (![ & (!] respectively and then redo at end. The curly braces
|
|
||||||
// are rtf so were getting removed and/or not handled correctly.
|
|
||||||
string retval = rtf.Replace(@"\{", @" (![");
|
|
||||||
retval = retval.Replace(@"\}", @" (!]");
|
|
||||||
|
|
||||||
// remove carriage return/newlines after \par commands (these are introduced by rtb
|
|
||||||
// for hard returns, goes into rtb as \par and comes out as \par\r\n):
|
|
||||||
retval = reg1.Replace(retval, "\\par ");
|
|
||||||
retval = retval.Replace("\\v0\r\n", "\\v0 "); // Replace Carriage Return and Newline after comment
|
|
||||||
retval = reg2.Replace(retval, ""); // Strip Carriage Returns and Newlines
|
|
||||||
retval = reg3.Replace(retval, "$1"); // Strip Opening and Closing Braces
|
|
||||||
retval = reg4.Replace(retval, ""); // Strip Clauses - remove anything from curly braces
|
|
||||||
retval = reg5.Replace(retval, ""); // Strip Clauses - remove anything from curly braces
|
|
||||||
retval = reg6.Replace(retval, "$1 "); // add space after token if followed by token
|
|
||||||
retval = reg7.Replace(retval, new MatchEvaluator(StaticReplaceRTFClause)); // take backslash xyz and evaluates them
|
|
||||||
retval = reg8.Replace(retval, "$1"); // remove space between tokens
|
|
||||||
retval = reg9.Replace(retval, "$1"); // remove space before /r/n
|
|
||||||
if (retval.EndsWith(@"{\par}")) retval = retval.Remove(retval.Length - 6, 6);
|
|
||||||
retval = reg10.Replace(retval, "$1 ");
|
|
||||||
// remove \r\n at end of string if the string has 2 or more characters
|
|
||||||
if (retval.EndsWith("\r\n")) retval = retval.Remove(retval.Length - 2, 2);
|
|
||||||
if (retval.Length == 0) return "";
|
|
||||||
if (retval.EndsWith(@"\v")) retval = retval.Remove(retval.Length - 2, 2);
|
|
||||||
retval = retval.Replace(@" (![", @"\{");
|
|
||||||
retval = retval.Replace(@" (!]", @"\}");
|
|
||||||
retval = retval.Replace("`",@"\xA0");
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
private void btnBold_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
RTBAPI.ToggleBold(!RTBAPI.IsBold(rtfBox), rtfBox, rtfBox.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION);
|
|
||||||
btnBold.Checked = RTBAPI.IsBold(rtfBox);
|
|
||||||
}
|
|
||||||
private void btnItalics_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
RTBAPI.ToggleItalic(!RTBAPI.IsItalic(rtfBox), rtfBox, rtfBox.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION);
|
|
||||||
btnItalics.Checked = RTBAPI.IsItalic(rtfBox);
|
|
||||||
}
|
|
||||||
private void btnUnderline_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
RTBAPI.ToggleUnderline(!RTBAPI.IsUnderline(rtfBox), rtfBox, rtfBox.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION);
|
|
||||||
btnUnderline.Checked = RTBAPI.IsUnderline(rtfBox);
|
|
||||||
}
|
|
||||||
private void btnSubscript_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
RTBAPI.ToggleSubscript(!RTBAPI.IsSubScript(rtfBox), rtfBox, rtfBox.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION);
|
|
||||||
btnSubscript.Checked = RTBAPI.IsSubScript(rtfBox);
|
|
||||||
}
|
|
||||||
private void btnSuperscript_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
RTBAPI.ToggleSuperscript(!RTBAPI.IsSuperScript(rtfBox), rtfBox, rtfBox.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION);
|
|
||||||
btnSuperscript.Checked = RTBAPI.IsSuperScript(rtfBox);
|
|
||||||
}
|
|
||||||
private void btnOK_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
private void btnCancel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
private void rtfBox_SelectionChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
btnBold.Checked = RTBAPI.IsBold(rtfBox);
|
|
||||||
btnItalics.Checked = RTBAPI.IsItalic(rtfBox);
|
|
||||||
btnUnderline.Checked = RTBAPI.IsUnderline(rtfBox);
|
|
||||||
}
|
|
||||||
private void btnHardspace_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
AddText("`");
|
|
||||||
}
|
|
||||||
private void AddText(string str)
|
|
||||||
{
|
|
||||||
// See comments in AddRtf(string str) to explain the font style setting
|
|
||||||
RTBAPI.E_FontStyle fs = RTBAPI.GetFontStyle(rtfBox);
|
|
||||||
int positionStart = rtfBox.SelectionStart;
|
|
||||||
rtfBox.SelectedText = str;
|
|
||||||
int positionAfter = rtfBox.SelectionStart;
|
|
||||||
rtfBox.Select(positionStart, positionAfter - positionStart);
|
|
||||||
RTBAPI.SetFontStyle(rtfBox, fs);
|
|
||||||
rtfBox.Select(positionAfter, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,120 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
||||||
Reference in New Issue
Block a user