This commit is contained in:
		| @@ -39,7 +39,9 @@ namespace fmtxml | ||||
| 				case "WCN2": | ||||
| 					AddWCN2(myDoc); | ||||
| 					break; | ||||
|  | ||||
| 				case "WCN1": | ||||
| 					AddWCN2(myDoc);   // same cover page box as wcn2 | ||||
| 					break;	 | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
|   | ||||
| @@ -44,12 +44,24 @@ namespace fmtxml | ||||
|                     XmlNode doc = xmldoc.ReadNode(reader); | ||||
|                     top.AppendChild(doc); | ||||
|                 } | ||||
|                 XmlWriterSettings settingsout = new XmlWriterSettings(); | ||||
|                 settingsout.Encoding = Encoding.Unicode; | ||||
|                 string outname = MyPath + @"\fmtall\" + mxml.Substring(mxml.IndexOf("\\")+1,mxml.Length - 13) + "all.xml"; | ||||
|                 XmlWriter xmlwrite = XmlWriter.Create(outname,settingsout); | ||||
|                 xmldoc.WriteContentTo(xmlwrite); | ||||
|                 xmlwrite.Close(); | ||||
| 				XmlWriterSettings settingsout = new XmlWriterSettings(); | ||||
| 				settingsout.Encoding = Encoding.Unicode; | ||||
| 				settingsout.Indent = true; | ||||
| 				settingsout.IndentChars = "\t"; | ||||
| 				XmlWriter xmlwrite = XmlWriter.Create(outname,settingsout); | ||||
| 				xmldoc.WriteContentTo(xmlwrite); | ||||
| 				xmlwrite.Close(); | ||||
| 				XmlDocument newDoc = new XmlDocument(); | ||||
| 				newDoc.Load(outname); | ||||
| 				XmlNodeReader xtr = new XmlNodeReader(newDoc); | ||||
| 				XmlTextWriter xtw = new XmlTextWriter(outname, Encoding.Unicode); | ||||
| 				xtw.Formatting = Formatting.Indented; | ||||
| 				xtw.Indentation = 1; | ||||
| 				xtw.IndentChar = '\t'; | ||||
| 				xtw.WriteNode(xtr, true); | ||||
| 				xtr.Close(); | ||||
| 				xtw.Close(); | ||||
|             } | ||||
|             catch (Exception ex) | ||||
|             { | ||||
|   | ||||
| @@ -513,7 +513,8 @@ public struct CheckOffData | ||||
| 	public string AllowSectEdit; | ||||
| 	public string AllowStepEdit; | ||||
|     public int UseCheckOffsIn; | ||||
|     public sbyte CheckOffAdjustment; | ||||
|     public float CheckOffAdjustment; | ||||
| 	public float XLocation; | ||||
| 	/* Format flags ... */ | ||||
| 	public string DropCheckOff; | ||||
| 	public string CheckOffOnHLSOnly; | ||||
| @@ -785,7 +786,6 @@ public struct StepSectionEdit | ||||
| public struct SeqTabFmt | ||||
| { | ||||
| 	public int Index; | ||||
| 	public int LeftJustify; | ||||
| 	public string TabToken; | ||||
| 	public string TabFormat; | ||||
| 	public string PrintTabFormat; | ||||
| @@ -805,9 +805,16 @@ public struct StepSectionPrint | ||||
| 	/* End of format flags */ | ||||
|     public VE_Font ModifiedTextStyle; | ||||
|     public VE_Font ImmStepHdrStyle; | ||||
| 	public LeftJustify[] LeftJustifyList; | ||||
|     public string[] ImmStepHdr; | ||||
| } | ||||
| [Serializable] | ||||
| public struct LeftJustify | ||||
| { | ||||
| 	public int Index; | ||||
| 	public float Size; | ||||
| } | ||||
| [Serializable] | ||||
| public struct ReplaceStr | ||||
| { | ||||
|     public string Flag; | ||||
| @@ -1546,7 +1553,7 @@ namespace fmtxml | ||||
| 			fmtName = alias; | ||||
| 			//if (fmtName.ToUpper() != "CPLS" && fmtName.ToUpper() != "BASE") return; | ||||
| 			//if (fmtName.ToUpper() != "OHLP" && fmtName.ToUpper() != "BASE" && fmtName.ToUpper() != "WCN2") return; | ||||
| 			//if (fmtName.ToUpper() != "WCN2" && fmtName.ToUpper() != "BASE") return; | ||||
| 			//if (fmtName.ToUpper() != "WCN1" && fmtName.ToUpper() != "BASE") return; | ||||
| 			try | ||||
| 			{ | ||||
| 				LoadFormatFile(nm + ".fmt", ref SubXtraFlags); | ||||
| @@ -2421,6 +2428,10 @@ namespace fmtxml | ||||
| 				for (int i = 0; i < MAXCHKHEADINGS; i++) fmtdata.ProcData.CheckOffData.CheckOffHeaderList[i].Index = i; | ||||
| 				for (int i = 0; i < MAXCHKHEADINGS; i++) fmtdata.ProcData.CheckOffData.CheckOffHeaderList[i].Font = LoadVE_Font(); | ||||
| 				fmtdata.ProcData.CheckOffData.UseCheckOffsIn = brFmt.ReadInt32(); | ||||
| 				// 16 bit code was defaulting to Elite when calculating the starting location of the check off line. | ||||
| 				//  so use elite: 72 points per inch, 12 chars per inch | ||||
| 				int tmpcolco = (rightCheckOffBox[3] & 0xFF) * 72/12; | ||||
| 				if (tmpcolco > 0) fmtdata.ProcData.CheckOffData.XLocation = (float)tmpcolco; // ColToPoints((float)tmpcolco, _PlantDefaultFontStyle); | ||||
| 				tmplong = (int)brFmt.ReadUInt32(); | ||||
| 				fmtdata.SectData.StepSectionData.StpSectLayData.EndMessagePos = brFmt.ReadInt16(); | ||||
| 				tmpshort = brFmt.ReadInt16();                           // CenterTableAdjustment | ||||
| @@ -2517,7 +2528,7 @@ namespace fmtxml | ||||
| 				accsec.TableOfContentsData = toc; | ||||
| 				for (int i = 0; i < MAXSTEPS; i++) tmpbyte = brFmt.ReadByte(); | ||||
|  | ||||
| 				fmtdata.ProcData.CheckOffData.CheckOffAdjustment = brFmt.ReadSByte(); | ||||
| 				fmtdata.ProcData.CheckOffData.CheckOffAdjustment = ColToPoints(Convert.ToInt16(brFmt.ReadSByte()), _PlantDefaultFontStyle); | ||||
|  | ||||
| 				tmpshort = brFmt.ReadInt16();       // ColsAdjustInS2 | ||||
| 				tmpbyte = brFmt.ReadByte();         // SeriesTitleLength; | ||||
| @@ -2551,13 +2562,14 @@ namespace fmtxml | ||||
| 				for (int i = 0; i < 3; i++) tmpbyte3[i] = brFmt.ReadSByte(); | ||||
| 				tmpstr = string.Format("{0}, {1}, {2}", tmpbyte3[0], tmpbyte3[1], tmpbyte3[2]); | ||||
| 				fmtdata.SectData.StepSectionData.StpSectLayData.TableCenterPos = tmpstr; | ||||
|  | ||||
| 				//short[] tmpint9 = new short[9]; | ||||
| 				//for (int i = 0; i < 9; i++) tmpint9[i] = brFmt.ReadInt16(); | ||||
| 				//tmpstr = string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8}", tmpint9[0], tmpint9[1], tmpint9[2], tmpint9[3], tmpint9[4], tmpint9[5], tmpint9[6], tmpint9[7], tmpint9[8]); | ||||
| 				//fmtdata.SectData.StepSectionData.LeftJustSeqTab = tmpstr; | ||||
| 				for (int i = 0; i < MAXSEQ; i++) fmtdata.SectData.StepSectionData.SequentialTabFormat[i].Index = i; | ||||
| 				for (int i = 0; i < MAXSEQ; i++) fmtdata.SectData.StepSectionData.SequentialTabFormat[i].LeftJustify = brFmt.ReadInt16(); | ||||
| 				LeftJustify[] lftjust = new LeftJustify[MAXSEQ]; | ||||
| 				fmtdata.SectData.StepSectionData.StpSectPrtData.LeftJustifyList = lftjust; | ||||
| 				for (int i = 0; i < MAXSEQ; i++) | ||||
| 				{ | ||||
| 					lftjust[i].Index = i; | ||||
| 					lftjust[i].Size = ColToPoints(brFmt.ReadInt16(), _PlantDefaultFontStyle); //brFmt.ReadInt16(); | ||||
| 				} | ||||
| 				MetaSection[] metsects = new MetaSection[10]; | ||||
| 				fmtdata.SectData.MetaSectionData = metsects; | ||||
| 				for (int i = 0; i < 10; i++) metsects[i].Index = i; | ||||
| @@ -4780,6 +4792,7 @@ namespace fmtxml | ||||
| 			if (mco.AllowSectEdit == sco.AllowSectEdit) subFmt.ProcData.CheckOffData.AllowSectEdit = "null"; | ||||
| 			if (mco.AllowStepEdit == sco.AllowStepEdit) subFmt.ProcData.CheckOffData.AllowStepEdit = "null"; | ||||
| 			if (mco.UseCheckOffsIn == sco.UseCheckOffsIn) subFmt.ProcData.CheckOffData.UseCheckOffsIn = 0; | ||||
| 			if (mco.XLocation == sco.XLocation) subFmt.ProcData.CheckOffData.XLocation = 0; | ||||
| 			if (mco.CheckOffAdjustment == sco.CheckOffAdjustment) subFmt.ProcData.CheckOffData.CheckOffAdjustment = 0; | ||||
| 			if (mco.DropCheckOff != null && mco.DropCheckOff == sco.DropCheckOff) subFmt.ProcData.CheckOffData.DropCheckOff = "null"; | ||||
| 			if (mco.CheckOffOnHLSOnly != null && mco.CheckOffOnHLSOnly == sco.CheckOffOnHLSOnly) subFmt.ProcData.CheckOffData.CheckOffOnHLSOnly = "null"; | ||||
|   | ||||
| @@ -61,6 +61,7 @@ public struct DocStyle | ||||
| 	public bool IsStepSection;	// using oldtonew, determine whether is step  | ||||
| 								//	section or word doc section  (new to 32-bit) | ||||
| 	public bool UseCheckOffs;	// This was originally in fmt. Load fmt to get | ||||
| 	public bool UseColSByLevel; // Didn't want a OldToNew Test in new proms, so set this if doc is an E2.  | ||||
| 	public int oldtonew;		// Bits for converting from old to new | ||||
| 								// document style | ||||
| 	public bool CancelSectTitle;	// Was format flags CancelSecTitlesOnS1 & CancelSecTitlesOnS2 | ||||
| @@ -484,7 +485,7 @@ namespace fmtxml | ||||
| 		{ | ||||
| 			MyPath = path; | ||||
| 			fmtName = nm; | ||||
| 			//if (!fmtName.ToUpper().StartsWith("TP") && fmtName.ToUpper() != "BASE") return; | ||||
| 			//if (!fmtName.ToUpper().StartsWith("WCN1") && fmtName.ToUpper() != "BASE") return; | ||||
| 			try | ||||
| 			{ | ||||
| 				// get the default base & plant files to use when figuring out inheritance. | ||||
| @@ -632,7 +633,7 @@ namespace fmtxml | ||||
| 				PSItem [] Fpsitms = null; | ||||
| 				bool isfirst=true; | ||||
| 				int cnt = 0; | ||||
| 				 | ||||
| 				uint prevstyleForcheckoff = 0; | ||||
| 				while ((vnum = brFmt.ReadInt16()) != 0) | ||||
| 				{ | ||||
| 					long fseek = brFmt.BaseStream.Position; | ||||
| @@ -651,13 +652,18 @@ namespace fmtxml | ||||
| 					if ((etmpjust & E_PageStructMod.PSLeft) == E_PageStructMod.PSLeft) adj = 0; | ||||
| 					if ((etmpjust & E_PageStructMod.PSRight) == E_PageStructMod.PSRight) adj *= 2; | ||||
| 					uint tmpstyle = brFmt.ReadUInt32(); | ||||
| 					 | ||||
| 					pi.Style = new VE_Font(tmpstyle); | ||||
| 					string tkn = DoReplaceTokens(GetAsciiStringUntilNull(brFmt)); | ||||
| 					// see if any initial line draw chars are in token (WCN2 and others).  If so, | ||||
| 					// remove the line draw & its following space.  Also adjust the column. | ||||
| 					int coladj = 0;		// see if any initial draw chars are included and if so remove. | ||||
| 					pi.Token = tkn==null||tkn==""?tkn:RemoveInitialLineDraw(tkn, ref coladj); | ||||
| 					pi.Col = ColToPoints(lcol + coladj + adj, tmpstyle); | ||||
| 					bool isChkOffHeading = false; | ||||
| 					if (pi.Token != null && pi.Token.Contains("CHKOFFHEADING")) isChkOffHeading = true; | ||||
| 					pi.Col = ColToPoints(lcol + coladj + adj, isChkOffHeading?prevstyleForcheckoff:tmpstyle); | ||||
| 					prevstyleForcheckoff = tmpstyle; | ||||
| 					//Console.WriteLine("{0}, pi.Col = {1}, style = {2}", pi.Token, pi.Col, tmpstyle); | ||||
| 					if (pi.Token != null) | ||||
| 					{ | ||||
| 						// replace the '<' with '{' & '>' with '}' | ||||
| @@ -860,6 +866,8 @@ namespace fmtxml | ||||
| 					dc.EndFlag = brFmt.ReadInt16(); | ||||
| 					dc.EndStyle = LoadVE_Font(); | ||||
| 					dc.UseCheckOffs = UseCheckOffsIn(fname.Substring(0, fname.Length - 4), dc.oldtonew); | ||||
| 					dc.UseColSByLevel = dc.oldtonew == 5; | ||||
|  | ||||
| 					// use the string offsets to read in the strings. | ||||
| 					int[] offst = new int[strings]; | ||||
| 					for (int j = 0; j < strings; j++) | ||||
|   | ||||
| @@ -109,7 +109,7 @@ namespace fmtxml | ||||
| 				else if (text.StartsWith("\xAD\xAD")) | ||||
| 					hasC0 |= AddGroupStart(sb, ref group, text).ToLower() == "c0"; | ||||
| 				else if (text == "END") | ||||
| 					group = AndGroupEnd(sb, group); | ||||
| 					group = AddGroupEnd(sb, group); | ||||
| 				else if (text != "") | ||||
| 					ProcessCommand(sb, text, file); | ||||
| 			} | ||||
| @@ -123,15 +123,17 @@ namespace fmtxml | ||||
| 			} | ||||
| 			sb.Append(string.Format("</svg>\r\n")); | ||||
| 		} | ||||
| 		private static bool AndGroupEnd(StringBuilder sb, bool group) | ||||
| 		private static bool AddGroupEnd(StringBuilder sb, bool group) | ||||
| 		{ | ||||
| 			if (group) sb.Append("  </g>\r\n"); | ||||
| 			group = false; | ||||
| 			_Xoff = 0; | ||||
| 			_Yoff = 0; | ||||
| 			return group; | ||||
| 		} | ||||
| 		private static string AddGroupStart(StringBuilder sb, ref bool group, string text) | ||||
| 		{ | ||||
| 			AndGroupEnd(sb, group); | ||||
| 			AddGroupEnd(sb, group); | ||||
| 			group = true; | ||||
| 			string grpID = text.Substring(2).ToUpper(); | ||||
| 			sb.Append(string.Format("  <g id=\"{0}\">\r\n", grpID)); | ||||
| @@ -193,9 +195,12 @@ namespace fmtxml | ||||
| 			Converters[(int)ECommand.RTFADJ] = new Converter(AddRtfAdj); | ||||
| 			Converters[(int)ECommand.ABSOLUTE] = new Converter(AddAbsolute); | ||||
| 		} | ||||
| 		private static Regex regGdiAdj = new Regex(@"GDIADJ ([-0-9]*) ([-0-9]*)$", RegexOptions.Multiline); | ||||
| 		private static void AddGdiAdj(StringBuilder sb, string text) | ||||
| 		{ | ||||
| 			// May need to do something with this | ||||
| 			Match gdiadjMatch = regGdiAdj.Match(text); | ||||
| 			_Xoff = int.Parse(gdiadjMatch.Groups[1].Value); | ||||
| 			_Yoff = int.Parse(gdiadjMatch.Groups[2].Value); | ||||
| 		} | ||||
| 		private static void AddAbsolute(StringBuilder sb, string text) | ||||
| 		{ | ||||
| @@ -216,8 +221,8 @@ namespace fmtxml | ||||
| 			string bmHeight = bmp.Height.ToString() + "px"; | ||||
| 			//Console.WriteLine("'{0}'", bmFileName); | ||||
| 			sb.Append(string.Format("    <image x=\"{0}\" y=\"{1}\" width=\"{2}\" height=\"{3}\" bname=\"{4}\"/>\r\n", | ||||
| 				TwipsToPoints(bitmapMatch.Groups[1].Value), | ||||
| 				TwipsToPoints(bitmapMatch.Groups[2].Value), | ||||
| 				TwipsToPointsX(bitmapMatch.Groups[1].Value), | ||||
| 				TwipsToPointsY(bitmapMatch.Groups[2].Value), | ||||
| 				bmWidth, | ||||
| 				bmHeight, | ||||
| 				bmFileName)); | ||||
| @@ -228,8 +233,8 @@ namespace fmtxml | ||||
| 			Match textMatch = regText.Match(text); | ||||
| 			 | ||||
| 			sb.Append(string.Format("    <text x=\"{0}\" y=\"{1}\" font-family=\"{3}\" font-size=\"{2}\" {4}>{5}</text>\r\n", | ||||
| 				TwipsToPoints(textMatch.Groups[1].Value), | ||||
| 				TwipsToPoints(textMatch.Groups[2].Value), | ||||
| 				TwipsToPointsX(textMatch.Groups[1].Value), | ||||
| 				TwipsToPointsY(textMatch.Groups[2].Value), | ||||
| 				FontSizeToPoints(textMatch.Groups[3].Value), | ||||
| 				FontToFamily(textMatch.Groups[4].Value), | ||||
| 				FontStyle(textMatch.Groups[5].Value), | ||||
| @@ -240,8 +245,8 @@ namespace fmtxml | ||||
| 		{ | ||||
| 			Match ellipseMatch = regEllipse.Match(text); | ||||
| 			sb.Append(string.Format("    <ellipse cx=\"{0}\" cy=\"{1}\" rx=\"{2}\" ry=\"{3}\" fill=\"none\" stroke=\"black\" stroke-width=\"{4}\" />\r\n", | ||||
| 				TwipsToPoints(ellipseMatch.Groups[1].Value), | ||||
| 				TwipsToPoints(ellipseMatch.Groups[2].Value), | ||||
| 				TwipsToPointsX(ellipseMatch.Groups[1].Value), | ||||
| 				TwipsToPointsY(ellipseMatch.Groups[2].Value), | ||||
| 				TwipsToPoints(ellipseMatch.Groups[3].Value), | ||||
| 				TwipsToPoints(ellipseMatch.Groups[4].Value), | ||||
| 				TwipsToPoints(ellipseMatch.Groups[5].Value))); | ||||
| @@ -251,21 +256,23 @@ namespace fmtxml | ||||
| 		{ | ||||
| 			Match boxMatch = regBox.Match(text); | ||||
| 			sb.Append(string.Format("    <rect x=\"{0}\" y=\"{1}\" width=\"{2}\" height=\"{3}\" fill=\"none\" stroke=\"black\" stroke-width=\"{4}\" />\r\n", | ||||
| 				TwipsToPoints(boxMatch.Groups[1].Value), | ||||
| 				TwipsToPoints(boxMatch.Groups[2].Value), | ||||
| 				TwipsToPointsX(boxMatch.Groups[1].Value), | ||||
| 				TwipsToPointsY(boxMatch.Groups[2].Value), | ||||
| 				TwipsToPoints(boxMatch.Groups[3].Value), | ||||
| 				TwipsToPoints(boxMatch.Groups[4].Value), | ||||
| 				TwipsToPoints(boxMatch.Groups[5].Value))); | ||||
| 		} | ||||
| 		private static int _Xoff = 0; | ||||
| 		private static int _Yoff = 0; | ||||
| 		private static Regex regLine = new Regex(@"LINE ([-0-9]*) ([-0-9]*) ([-0-9]*) ([-0-9]*) ([-0-9]*)", RegexOptions.Multiline); | ||||
| 		private static void AddLine(StringBuilder sb, string text) | ||||
| 		{ | ||||
| 			Match lineMatch = regLine.Match(text); | ||||
| 			sb.Append(string.Format("    <line x1=\"{0}\" y1=\"{1}\" x2=\"{2}\" y2=\"{3}\" stroke=\"black\" stroke-width=\"{4}\" />\r\n", | ||||
| 				TwipsToPoints(lineMatch.Groups[1].Value), | ||||
| 				TwipsToPoints(lineMatch.Groups[2].Value), | ||||
| 				TwipsToPoints(lineMatch.Groups[3].Value) + TwipsToPoints(lineMatch.Groups[1].Value), | ||||
| 				TwipsToPoints(lineMatch.Groups[4].Value) + TwipsToPoints(lineMatch.Groups[2].Value), | ||||
| 				TwipsToPointsX(lineMatch.Groups[1].Value), | ||||
| 				TwipsToPointsY(lineMatch.Groups[2].Value), | ||||
| 				TwipsToPoints(lineMatch.Groups[3].Value) + TwipsToPointsX(lineMatch.Groups[1].Value), | ||||
| 				TwipsToPoints(lineMatch.Groups[4].Value) + TwipsToPointsY(lineMatch.Groups[2].Value), | ||||
| 				TwipsToPoints(lineMatch.Groups[5].Value))); | ||||
| 		} | ||||
| 		private static string FontStyle(string style) | ||||
| @@ -315,6 +322,14 @@ namespace fmtxml | ||||
| 		{ | ||||
| 			return float.Parse(twips) / 20; | ||||
| 		} | ||||
| 		private static float TwipsToPointsX(string twips) | ||||
| 		{ | ||||
| 			return (_Xoff + float.Parse(twips)) / 20; | ||||
| 		} | ||||
| 		private static float TwipsToPointsY(string twips) | ||||
| 		{ | ||||
| 			return (_Yoff + float.Parse(twips)) / 20; | ||||
| 		} | ||||
| 		private static float FontSizeToPoints(string fontSize) | ||||
| 		{ | ||||
| 			return float.Parse(fontSize) / 2; | ||||
|   | ||||
| @@ -19,6 +19,7 @@ | ||||
| 		<xsl:apply-templates select="numberingsequence"/> | ||||
|     <xsl:apply-templates select="IsStepSection"/> | ||||
| 	<xsl:apply-templates select="UseCheckOffs"/> | ||||
| 		<xsl:apply-templates select ="UseColSByLevel"/> | ||||
| 	<xsl:apply-templates select="oldtonew"/> | ||||
| 	<xsl:apply-templates select="CancelSectTitle"/> | ||||
| 	<xsl:apply-templates select="SpecialStepsFoldout"/> | ||||
| @@ -39,6 +40,11 @@ | ||||
| 			<xsl:value-of select="."/> | ||||
| 		</xsl:attribute> | ||||
| 	</xsl:template> | ||||
| 	<xsl:template match="UseColSByLevel"> | ||||
| 		<xsl:attribute name="UseColSByLevel"> | ||||
| 			<xsl:value-of select="."/> | ||||
| 		</xsl:attribute> | ||||
| 	</xsl:template> | ||||
| 	<xsl:template match="oldtonew"> | ||||
| 		<xsl:attribute name="OldToNew"><xsl:value-of select="."/></xsl:attribute> | ||||
| 	</xsl:template> | ||||
|   | ||||
										
											Binary file not shown.
										
									
								
							
		Reference in New Issue
	
	Block a user