C2017-008 Formats now have a grouping allowing us to change a symbol character’s font family, size, style, and/or the actual character
This commit is contained in:
		@@ -1977,6 +1977,15 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
			}
 | 
			
		||||
			set { _ReplaceStrList = value; }
 | 
			
		||||
		}
 | 
			
		||||
		private ReplaceSymbolCharList _ReplaceSymbolCharList;
 | 
			
		||||
		public ReplaceSymbolCharList ReplaceSymbolCharList
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return (_ReplaceSymbolCharList == null) ? _ReplaceSymbolCharList = new ReplaceSymbolCharList(SelectNodes("ReplaceSymbolChars/ReplaceChar")) : _ReplaceSymbolCharList;
 | 
			
		||||
			}
 | 
			
		||||
			set { _ReplaceSymbolCharList = value; }
 | 
			
		||||
		}
 | 
			
		||||
		private LazyLoad<int?> _SectionTitleLength;
 | 
			
		||||
		public int? SectionTitleLength
 | 
			
		||||
		{ 
 | 
			
		||||
@@ -2999,6 +3008,90 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
		public ReplaceStrList(XmlNodeList xmlNodeList) : base(xmlNodeList) { }
 | 
			
		||||
	}
 | 
			
		||||
	#endregion
 | 
			
		||||
	#region ReplaceChar
 | 
			
		||||
	[TypeConverter(typeof(ExpandableObjectConverter))]
 | 
			
		||||
	public class ReplaceChar : vlnFormatItem
 | 
			
		||||
	{
 | 
			
		||||
		public ReplaceChar(XmlNode xmlNode) : base(xmlNode) { }
 | 
			
		||||
		public ReplaceChar() : base() { }
 | 
			
		||||
		[Category("Strings")]
 | 
			
		||||
		private LazyLoad<string> _Unicode;
 | 
			
		||||
		public string Unicode
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return LazyLoad(ref _Unicode, "@Unicode");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		[Category("Strings")]
 | 
			
		||||
		private LazyLoad<string> _Replace;
 | 
			
		||||
		public string Replace
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return LazyLoad(ref _Replace, "@Replace");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		[Category("Strings")]
 | 
			
		||||
		private LazyLoad<string> _Family;
 | 
			
		||||
		public string Family
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return LazyLoad(ref _Family, "@Family");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		[Category("FontStyle?")]
 | 
			
		||||
		private LazyLoad<E_Style?> _Style; // format has E_Style value.  The public will translate it to a systemdrawing.FontStyle used in printing
 | 
			
		||||
		public FontStyle? Style
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				E_Style? eStyle = LazyLoad(ref _Style, "@Style");
 | 
			
		||||
				if (eStyle == null) return null; // not set in the format, return null
 | 
			
		||||
				FontStyle sdfStyle = FontStyle.Regular;
 | 
			
		||||
				if (eStyle != E_Style.None)
 | 
			
		||||
				{
 | 
			
		||||
					if (((eStyle & E_Style.Bold) != 0) || ((eStyle & E_Style.MmBold) != 0))
 | 
			
		||||
						sdfStyle |= FontStyle.Bold;
 | 
			
		||||
					if ((eStyle & E_Style.Italics) != 0)
 | 
			
		||||
						sdfStyle |= FontStyle.Italic;
 | 
			
		||||
					if ((eStyle & E_Style.Underline) != 0)
 | 
			
		||||
						sdfStyle |= FontStyle.Underline;
 | 
			
		||||
				}
 | 
			
		||||
				return sdfStyle; // return systemdrawing.FontStyle
 | 
			
		||||
				//return LazyLoad(ref _Style, "@Style");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		[Category("float?")]
 | 
			
		||||
		private LazyLoad<float?> _Size;
 | 
			
		||||
		public float? Size
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return LazyLoad(ref _Size, "@Size");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		//public override string GetPDDisplayName()
 | 
			
		||||
		//{ return Unicode; }
 | 
			
		||||
		//public override string GetPDDescription()
 | 
			
		||||
		//{ return string.Format("Replace '{0}' with '{1}'", Unicode, Replace); }
 | 
			
		||||
		//public override string GetPDCategory()
 | 
			
		||||
		//{ return "Chars to Replace"; }
 | 
			
		||||
		//public override string ToString()
 | 
			
		||||
		//{
 | 
			
		||||
		//	return Replace;
 | 
			
		||||
		//}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	#endregion
 | 
			
		||||
	#region ReplaceSymbolCharList
 | 
			
		||||
	[TypeConverter(typeof(vlnListConverter<ReplaceSymbolCharList, ReplaceChar>))]
 | 
			
		||||
	public class ReplaceSymbolCharList : vlnFormatList<ReplaceChar> 
 | 
			
		||||
	{
 | 
			
		||||
		public ReplaceSymbolCharList(XmlNodeList xmlNodeList) : base(xmlNodeList) { }
 | 
			
		||||
	}
 | 
			
		||||
	#endregion
 | 
			
		||||
	#region StepSectionLayoutData
 | 
			
		||||
	public class StepSectionLayoutData : vlnFormatItem
 | 
			
		||||
	{
 | 
			
		||||
 
 | 
			
		||||
@@ -760,7 +760,7 @@ namespace Volian.Print.Library
 | 
			
		||||
			str = _StatRTB.Rtf;
 | 
			
		||||
			return str;
 | 
			
		||||
		}
 | 
			
		||||
		public static iTextSharp.text.Paragraph RtfToParagraph(string rtf, iTextSharp.text.Font mySymFont)
 | 
			
		||||
		private iTextSharp.text.Paragraph RtfToParagraph(string rtf, iTextSharp.text.Font mySymFont)
 | 
			
		||||
		{
 | 
			
		||||
			rtf=FixRTFToPrint(rtf);
 | 
			
		||||
			IRtfDocument rtfDoc = RtfInterpreterTool.BuildDoc(rtf);
 | 
			
		||||
@@ -777,15 +777,36 @@ namespace Volian.Print.Library
 | 
			
		||||
		/// </summary>
 | 
			
		||||
		/// <param name="rtf"></param>
 | 
			
		||||
		/// <returns></returns>
 | 
			
		||||
		private static string FixRTFToPrint(string rtf)
 | 
			
		||||
		private string FixRTFToPrint(string rtf)
 | 
			
		||||
		{
 | 
			
		||||
			// Only do this if the text contains symbols.
 | 
			
		||||
			if (rtf.Contains("VESymbFix"))
 | 
			
		||||
			{
 | 
			
		||||
				System.Windows.Forms.RichTextBox rtb = new System.Windows.Forms.RichTextBox();
 | 
			
		||||
				rtb.Rtf = rtf;
 | 
			
		||||
				rtb.Rtf = rtf.Replace(@"\u9586?", "<dblbs>");// rename backslash character to avoid RTF confusion
 | 
			
		||||
				string strRTF = rtf;
 | 
			
		||||
				bool changed = false;
 | 
			
		||||
				// C2017-008 - WCN wants the box symbol to look like their checkoff/signoff box
 | 
			
		||||
				// Check for a list of replacement character for symbols in the format file
 | 
			
		||||
				// ReplaceSymbolChars lets you do one or more of the following with a symbol character:
 | 
			
		||||
				// - change the point size
 | 
			
		||||
				// - change the style
 | 
			
		||||
				// - change the font family
 | 
			
		||||
				// - change the symbol character
 | 
			
		||||
				//
 | 
			
		||||
				// below is taken from the BaseAll format file - is currently commentout and there for reference
 | 
			
		||||
				// Wolf Creek (WCN) currently uses this to increase the size of the box symbol
 | 
			
		||||
				//
 | 
			
		||||
				//<!--example of replacing a symbol character (VESymbFix)-->
 | 
			
		||||
				//<!--ReplaceSymbolChars>
 | 
			
		||||
				//	<ReplaceChar Unicode=[decimal char #] Replace=[optional char #] Family=[option font family name] Style=[optional font style] Size=[optional font size]>
 | 
			
		||||
				//	<ReplaceChar Unicode="9633" Size="20"/> < this will resize the VESYMBFix box character to 20 point>
 | 
			
		||||
				//	<ReplaceChar Unicode="9633" Replace="0163" Family ="WingDings 2"  Size="16"/> <this will replace the VESYMBFix box char with a 16 point "WingDing 2" char>
 | 
			
		||||
				//</ReplaceSymbolChars-->
 | 
			
		||||
				//
 | 
			
		||||
				// get the list of symbol replacements
 | 
			
		||||
				FormatData fmtdata = (MyFlexGrid.MyDVI != null) ? MyFlexGrid.MyDVI.ActiveFormat.PlantFormat.FormatData : FormatInfo.PROMSBaseFormat.FormatData;
 | 
			
		||||
				ReplaceSymbolCharList SymReplaceList = (fmtdata != null && fmtdata.SectData.ReplaceSymbolCharList != null) ? fmtdata.SectData.ReplaceSymbolCharList : null;
 | 
			
		||||
				// Look at one character at a time
 | 
			
		||||
				for (int i = 0; i < rtb.TextLength; i++)
 | 
			
		||||
				{
 | 
			
		||||
@@ -806,8 +827,26 @@ namespace Volian.Print.Library
 | 
			
		||||
						rtb.SelectionFont = new System.Drawing.Font(DefaultFont, fnt.Style);
 | 
			
		||||
						changed = true;
 | 
			
		||||
					}
 | 
			
		||||
						if (rtb.SelectionFont.FontFamily.Name == "VESymbFix" && rtb.SelectedText.Length > 0)
 | 
			
		||||
						{
 | 
			
		||||
							foreach (ReplaceChar rc in SymReplaceList)
 | 
			
		||||
							{
 | 
			
		||||
								if (rc.Unicode != null)
 | 
			
		||||
								{
 | 
			
		||||
									char rc_uchar = Convert.ToChar(Convert.ToInt32(rc.Unicode));
 | 
			
		||||
									if (rc_uchar == rtb.SelectedText[0])
 | 
			
		||||
									{
 | 
			
		||||
										//use bolding underline italics from local font
 | 
			
		||||
										System.Drawing.Font fnt = rtb.SelectionFont;
 | 
			
		||||
										System.Drawing.Font fntw = new System.Drawing.Font((rc.Family != null) ? rc.Family : fnt.FontFamily.Name, (rc.Size != null) ? (float)rc.Size : fnt.Size, (rc.Style != null) ? (System.Drawing.FontStyle)rc.Style : fnt.Style);
 | 
			
		||||
										rtb.SelectionFont = fntw;
 | 
			
		||||
										changed = true;
 | 
			
		||||
									}
 | 
			
		||||
								}
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
				}
 | 
			
		||||
				if (changed) return rtb.Rtf;
 | 
			
		||||
				if (changed) return rtb.Rtf.Replace("<dblbs>", @"\u9586?");
 | 
			
		||||
			}
 | 
			
		||||
			return rtf;
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
@@ -4323,8 +4323,67 @@ namespace Volian.Print.Library
 | 
			
		||||
					Rtf = Rtf.Replace("{Backspace}", "");
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			Rtf = FixRTFToPrint(Rtf);
 | 
			
		||||
			ProfileTimer.Pop(profileDepth);
 | 
			
		||||
		}
 | 
			
		||||
		private string FixRTFToPrint(string rtf)
 | 
			
		||||
		{
 | 
			
		||||
			// Only do this if the text contains symbols.
 | 
			
		||||
			if (rtf.Contains("VESymbFix"))
 | 
			
		||||
			{
 | 
			
		||||
				System.Windows.Forms.RichTextBox rtb = new System.Windows.Forms.RichTextBox();
 | 
			
		||||
				rtb.Rtf = rtf.Replace(@"\\","<dblbs>"); // rename backslash character to avoid RTF confusion
 | 
			
		||||
				//string showRTF = rtf;
 | 
			
		||||
				bool changed = false;
 | 
			
		||||
				// C2017-008 - WCN wants the box symbol to look like their checkoff/signoff box
 | 
			
		||||
				// Check for a list of replacement character for symbols in the format file
 | 
			
		||||
				// ReplaceSymbolChars lets you do one or more of the following with a symbol character:
 | 
			
		||||
				// - change the point size
 | 
			
		||||
				// - change the style
 | 
			
		||||
				// - change the font family
 | 
			
		||||
				// - change the symbol character
 | 
			
		||||
				//
 | 
			
		||||
				// below is taken from the BaseAll format file - is currently commentout and there for reference
 | 
			
		||||
				// Wolf Creek (WCN) currently uses this to increase the size of the box symbol
 | 
			
		||||
				//
 | 
			
		||||
				//<!--example of replacing a symbol character (VESymbFix)-->
 | 
			
		||||
				//<!--ReplaceSymbolChars>
 | 
			
		||||
				//	<ReplaceChar Unicode=[decimal char #] Replace=[optional char #] Family=[option font family name] Style=[optional font style] Size=[optional font size]>
 | 
			
		||||
				//	<ReplaceChar Unicode="9633" Size="20"/> < this will resize the VESYMBFix box character to 20 point>
 | 
			
		||||
				//	<ReplaceChar Unicode="9633" Replace="0163" Family ="WingDings 2"  Size="16"/> <this will replace the VESYMBFix box char with a 16 point "WingDing 2" char>
 | 
			
		||||
				//</ReplaceSymbolChars-->
 | 
			
		||||
				//
 | 
			
		||||
				// get the list of symbol replacements
 | 
			
		||||
				FormatData fmtdata = (MyItemInfo.MyDocVersion != null) ? MyItemInfo.MyDocVersion.ActiveFormat.PlantFormat.FormatData : FormatInfo.PROMSBaseFormat.FormatData;
 | 
			
		||||
				ReplaceSymbolCharList SymReplaceList = (fmtdata != null && fmtdata.SectData.ReplaceSymbolCharList != null) ? fmtdata.SectData.ReplaceSymbolCharList : null;
 | 
			
		||||
				// Look at one character at a time
 | 
			
		||||
				for (int i = 0; i < rtb.TextLength; i++)
 | 
			
		||||
				{
 | 
			
		||||
					rtb.Select(i, 1);
 | 
			
		||||
					if (rtb.SelectionFont.FontFamily.Name == "VESymbFix" && rtb.SelectedText.Length > 0)
 | 
			
		||||
					{
 | 
			
		||||
						foreach (ReplaceChar rc in SymReplaceList)
 | 
			
		||||
						{
 | 
			
		||||
							if (rc.Unicode != null)
 | 
			
		||||
							{
 | 
			
		||||
								char rc_uchar = Convert.ToChar(Convert.ToInt32(rc.Unicode));
 | 
			
		||||
								if (rc_uchar == rtb.SelectedText[0])
 | 
			
		||||
								{
 | 
			
		||||
									//use bolding underline italics from local font
 | 
			
		||||
									System.Drawing.Font fnt = rtb.SelectionFont;
 | 
			
		||||
									System.Drawing.Font fntw = new System.Drawing.Font((rc.Family != null)?rc.Family:fnt.FontFamily.Name, (rc.Size != null)?(float)rc.Size:fnt.Size,  (rc.Style != null)?(System.Drawing.FontStyle)rc.Style:fnt.Style);
 | 
			
		||||
									rtb.SelectionFont = fntw;
 | 
			
		||||
									changed = true;
 | 
			
		||||
								}
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				if (changed) return rtb.Rtf.Replace("<dblbs>",@"\\"); // put back the backslash character
 | 
			
		||||
			}
 | 
			
		||||
			return rtf;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// for Calvert (BGE) alarms, some step text is kept on the same line as its parent.  This
 | 
			
		||||
		// is flagged by the -1 row in the template definition.
 | 
			
		||||
		private bool KeepOnParentLine(ItemInfo itemInfo)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user