Files
SourceCode/PROMS/fmtxml/GenXmlToSvg.cs
Rich 21301832e0 Changed code to update image reference to use href instead of bname attribute name
Added header information to xml for image link
Replace bname with xlink:href for image references
Added RNOWidthAdj flag for Braidwood
2014-01-08 20:05:45 +00:00

810 lines
22 KiB
C#

using System;
using System.IO;
using System.Xml;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
namespace fmtxml
{
/// <summary>
/// Convert genmac xml files to svg. svg (Scalar Vector Graphics
/// in XML format), so that genmac can be used in the 32-bit proms
/// system. The generated files will be used by developers and
/// customer service persons to do macros.
/// </summary>
public class GenXmlToSvg
{
private string genName;
private XmlDocument xmlDoc;
private XmlDocument xmlOutDoc;
private XmlElement topOutElement;
private int Convertn = 300, I = 300, C = 118, D = 1, N = 0;
private float Wid = 3;
private int RTFFontSize = 20;
private int RTFFontFamily = 3;
private string [] FontChoice =
{
"Times New Roman",
"VESymb XXXXXX",
"VolianDraw XXXXXX",
"Prestige Elite Tall",
"Courier New",
"Arial",
"Letter Gothic",
"Times New Roman",
"Letter Gothic Tall",
"Letter Gothic Tall",
"Gothic Ultra",
"VolianScript"
};
private string [] OldName =
{
"BOX1",
"BOX2",
"BOX3",
"BOX4",
"BOX5",
"HDR1",
"HDR2",
"HDR3",
"HDR4",
"HDR5",
"BOLDX",
"CNUM",
"CHKBOX",
"CHKBOX2",
"CHKBOX3",
"CHKBOX4",
"CHKBOX5",
"CHKBOX6",
"CHKBOX7",
"CHKBOX8",
"CHKBOX9",
"CHKBOX10",
"CHKBOX11",
"CHKBOX12",
"CHKBOX13",
"CHKBOX14",
"CHKBOX15",
"CHKBOX16",
"CHKBOX17",
"PLNTPLMAC",
"PLNTPLMAC2",
"GRAPHMAC0",
"GRAPHMAC1",
"RIGHTCHECKOFF",
"HPGLCOMMAND0",
"HPGLCOMMAND1",
"HPGLCOMMAND2",
"HPGLCOMMAND3",
"HPGLCOMMAND4",
"HPGLCOMMAND5",
"HPGLCOMMAND6",
"HPGLCOMMAND7",
"HPGLCOMMAND8",
"HPGLCOMMAND9",
"LTCO",
"SECDBLBXVERT",
"BOX6",
"BOX7",
"BOX8",
"ACAS_CHECKBOX",
"ACAS_CHECKLINE",
};
private string [] NewName =
{
"B1",
"B2",
"B3",
"B4",
"B5",
"H1",
"H2",
"H3",
"H4",
"H5",
"m33",
"C0",
"C1",
"C2",
"C3",
"C4",
"C5",
"C6",
"C7",
"C8",
"C9",
"C10",
"C11",
"C12",
"C13",
"C14",
"C15",
"C16",
"C17",
"m18",
"m19",
"m20",
"m21",
"C22",
"m23",
"m24",
"m25",
"m26",
"m27",
"m28",
"m29",
"m30",
"m31",
"m32",
"m20",
"m34",
"B6",
"B7",
"B8",
"m35",
"m36",
};
private int RTFBUI = 0;
private int Sp = -1;
private float cx = 0;
private float cy = 0;
private int fidx=0;
private int [] fontfam;
private int [] fontsiz;
private float [] PPx;
private float [] PPy;
// the following define RTFBUI values
private static int BOLD = 0x01;
private static int UNDERLINE = 0x02;
private static int ITALICS = 0x04;
private string MyResultPath;
/*
* The following svg group must be added for WCN2 for its box on the cover page:
*
<g id="B9">
<rect x="4" y="-3" width="352.5" height="120" fill="none" stroke="black" stroke-width="1.2" />
<line x1="4" y1="21" x2="355.5" y2="21" stroke-width="1.2" />
<line x1="4" y1="45" x2="355.5" y2="45" stroke-width="1.2" />