C2020-001: Allow changing of font sizes within table (added rtf method argument)

C2020-001: Allow changing of font sizes within table, keep font size rtf for tables
C2020-001: Allow changing of font sizes within table, user interface
C2020-001: Allow changing of font sizes within table, added icons
This commit is contained in:
2020-02-11 12:42:26 +00:00
parent 23354f3ed2
commit 448f2e5653
8 changed files with 1829 additions and 1721 deletions

View File

@@ -556,7 +556,7 @@ namespace VEPROMS.CSLA.Library
{
// B2018-088 - Added code to look for CROUSGID
Regex regRefObj = new Regex(@"\#Link\:ReferencedObject:([0-9]*|<NewID>|<CROUSGID=-?[0-9]+>) ([0-9a-zA-Z]*) ([0-9]*)", RegexOptions.Singleline);
string strippedText = StaticStripRtfCommands(text);
string strippedText = StaticStripRtfCommands(text, _MyItemInfo!=null?_MyItemInfo.IsTable:false);
// (\\[^v \\]+)* --> look for any rtf commands (first part of lookFor)
// \\v0 --> end of comment
// (\\[^v \\]+)* --> more rtf commands ended by a space
@@ -588,8 +588,8 @@ namespace VEPROMS.CSLA.Library
}
string gg = text.Substring(myIndex, myLength).TrimEnd(" ".ToCharArray());// RHM 20180608 - Found an issue where the value contained a trailing space
//System.Text.RegularExpressions.Group g = m.Groups[3];
string beforeRO = StaticStripRtfCommands(text.Substring(0, myIndex));
string afterRO = StaticStripRtfCommands(text.Substring(myIndex + myLength));
string beforeRO = StaticStripRtfCommands(text.Substring(0, myIndex), _MyItemInfo != null ? _MyItemInfo.IsTable : false);
string afterRO = StaticStripRtfCommands(text.Substring(myIndex + myLength), _MyItemInfo != null ? _MyItemInfo.IsTable : false);
Match myMatch = regRefObj.Match(m.ToString());
// B-2018-088 Made Error Log output more useful
if (m.ToString().ToUpper().Contains("<NEWID>") || m.ToString().ToUpper().Contains("<CROUSGID="))
@@ -698,7 +698,7 @@ namespace VEPROMS.CSLA.Library
{
int profileDepth = ProfileTimer.Push(">>>> DoTransitionAdjustments");
bool undtran = _MyItemInfo.ActiveFormat.PlantFormat.FormatData.TransData.Underline;
string strippedText = StaticStripRtfCommands(text);
string strippedText = StaticStripRtfCommands(text, _MyItemInfo != null ? _MyItemInfo.IsTable : false);
string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v'?{{}}~ \\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v'?{{}}~ \\]+)*\\v(\\[^v \\]+)* #Link:(ReferencedObject|Transition[^:]*?):[0-9]* ([0-9]*).*?\[END>");
MatchCollection matches = Regex.Matches(text, lookFor);
if (matches.Count == 0)
@@ -1311,6 +1311,8 @@ namespace VEPROMS.CSLA.Library
break;
case 'f':
if (Regex.IsMatch(token, @"^\\fi[-0-9]+ ?$")) return token; // first line indent
// C2020-001: only keep the font size rtf if in a table.
if (_fromTable && Regex.IsMatch(token, @"^\\fs[-0-9]+ ?$")) return token; // font size
break;
case 'p':
if (Regex.IsMatch(token, @"^\\par ?$")) return "\r\n";
@@ -1394,8 +1396,10 @@ namespace VEPROMS.CSLA.Library
private static Regex sreg9 = new Regex(@"(\\[^ \\?\r\n\t]+) (?=\r\n)"); // remove space before /r/n
// This is used in the DataLoader
public static string StaticStripRtfCommands(string rtf)
private static bool _fromTable = false; // C2020-001: Change Font Size in Tables - keep rtf '\fs##' for tables only
public static string StaticStripRtfCommands(string rtf, bool fromTable)
{
_fromTable = fromTable;
// 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(@"\{", @" (![");
@@ -1474,6 +1478,7 @@ namespace VEPROMS.CSLA.Library
// the indent character was translated in the richtextbox, change it back:
if (retval.IndexOf(@"\'05") > -1) retval = retval.Replace(@"\'05", "\x05");
_fromTable = false;
return retval;
}
#endregion