This commit is contained in:
Kathy Ruffing 2011-05-19 13:18:48 +00:00
parent 6ca33e7e8f
commit f74ce841a5
4 changed files with 241 additions and 130 deletions

View File

@ -10,7 +10,6 @@ using System.Xml.Xsl;
using System.Xml; using System.Xml;
using System.Xml.Serialization; using System.Xml.Serialization;
using System.ComponentModel; using System.ComponentModel;
using System.Text.RegularExpressions;
#region StructDefinitions #region StructDefinitions
// top of the format. // top of the format.
@ -552,7 +551,7 @@ public struct CheckOff
public string MenuItem; public string MenuItem;
public string ExcludeInSectMenu; public string ExcludeInSectMenu;
public string Macro; public string Macro;
public int CheckOffWidAdjust; public float CheckOffWidAdjust;
public int CheckOffXtraLines; public int CheckOffXtraLines;
} }
[Serializable] [Serializable]
@ -620,14 +619,14 @@ public struct Section
[Serializable] [Serializable]
public struct SectionNum public struct SectionNum
{ {
public Int16 Pos; public float Pos;
public string Just; public string Just;
public VE_Font Font; public VE_Font Font;
} }
[Serializable] [Serializable]
public struct SectionHead public struct SectionHead
{ {
public Int16 Pos; public float Pos;
public string Just; public string Just;
public VE_Font Font; public VE_Font Font;
} }
@ -678,10 +677,10 @@ public struct AccSection
[Serializable] [Serializable]
public struct TOC public struct TOC
{ {
public Int16 TofCSecNumPos; public float TofCSecNumPos;
public Int16 TofCSecTitlePos; public float TofCSecTitlePos;
public byte TofCSecTitleLen; public byte TofCSecTitleLen;
public Int16 TofCPageNumPos; public float TofCPageNumPos;
public byte TofCSpaceChar; public byte TofCSpaceChar;
public byte TofCLineSpacing; public byte TofCLineSpacing;
public VE_Font Font; public VE_Font Font;
@ -690,28 +689,28 @@ public struct TOC
public struct MetaSection public struct MetaSection
{ {
public int Index; // do I need this to order them or will SecNumPositionAdj work? public int Index; // do I need this to order them or will SecNumPositionAdj work?
public Int16 SecNumPositionAdj; public float SecNumPositionAdj;
public Int16 SecTitlePositionAdj; public float SecTitlePositionAdj;
public Int16 ColSByLevel; public float ColSByLevel;
public Int16 TofCPositionAdj; public float TofCPositionAdj;
public Int16 WidSAdjByLevel; public float WidSAdjByLevel;
} }
[Serializable] [Serializable]
public struct StepSectionLayout public struct StepSectionLayout
{ {
public int LastLineToStartStep; public float LastLineToStartStep;
public Int16 LineDrawingOption; public Int16 LineDrawingOption;
public Int16 ColS; public float ColS;
public Int16 ColT; public float ColT;
public Int16 ColAbs; public float ColAbs;
public Int16 WidT; public float WidT;
public Int16 PMode; public Int16 PMode;
public Int16 MaxRNO; public Int16 MaxRNO;
public string MaxRNOTable; public string MaxRNOTable;
public string ColRTable; public string ColRTable;
public string WidSTableEdit; public string WidSTableEdit;
public string WidSTablePrint; public string WidSTablePrint;
public Int16 AdjRNOCol; public float AdjRNOCol;
public Int16 EndMessagePos; public Int16 EndMessagePos;
public string RNOWidthAlt; public string RNOWidthAlt;
public Int16 HLSWidthOVRD; public Int16 HLSWidthOVRD;
@ -765,8 +764,8 @@ public struct StepSectionLayout
[Serializable] [Serializable]
public struct TopOfPg public struct TopOfPg
{ {
public Int16 Row; public float Row;
public Int16 Col; public float Col;
public VE_Font Font; public VE_Font Font;
} }
[Serializable] [Serializable]
@ -778,8 +777,8 @@ public struct Separtr
[Serializable] [Serializable]
public struct StepSectionEdit public struct StepSectionEdit
{ {
public Int16 ColSScreenAdj; public float ColSScreenAdj;
public Int16 ScrnAdjRNOText; public float ScrnAdjRNOText;
public string ColRScreen; public string ColRScreen;
} }
[Serializable] [Serializable]
@ -793,7 +792,7 @@ public struct SeqTabFmt
[Serializable] [Serializable]
public struct StepSectionPrint public struct StepSectionPrint
{ {
public Int16 ImmStepHdrCol; public float ImmStepHdrCol;
public Int16 SecColHdrforActPMode; public Int16 SecColHdrforActPMode;
public string RNOSepString; public string RNOSepString;
public string HLStpSeparatorString; public string HLStpSeparatorString;
@ -1011,12 +1010,12 @@ public struct COMacro
public struct Box public struct Box
{ {
public int Index; public int Index;
public Int16 Start; public float Start;
public int End; public float End;
public Int16 TxtStart; public float TxtStart;
public int TxtWidth; public float TxtWidth;
public Int16 Height; public float Height;
public Int16 TabPos; public float TabPos;
public sbyte TxtRowAdj; public sbyte TxtRowAdj;
public string BXURC; // Upper Right Corner, etc. public string BXURC; // Upper Right Corner, etc.
public string BXHorz; public string BXHorz;
@ -1541,7 +1540,7 @@ namespace fmtxml
BuildDictionaryText(); BuildDictionaryText();
fmtName = alias; fmtName = alias;
//if (fmtName.ToUpper() != "CPLS" && fmtName.ToUpper() != "BASE") return; //if (fmtName.ToUpper() != "CPLS" && fmtName.ToUpper() != "BASE") return;
//if (fmtName.ToUpper() != "HLP" && fmtName.ToUpper() != "BASE") return; //if (fmtName.ToUpper() != "OHLP" && fmtName.ToUpper() != "BASE" && fmtName.ToUpper() != "WCN2") return;
//if (fmtName.ToUpper() != "AEP" && fmtName.ToUpper() != "BASE") return; //if (fmtName.ToUpper() != "AEP" && fmtName.ToUpper() != "BASE") return;
try try
{ {
@ -2085,17 +2084,18 @@ namespace fmtxml
} }
#endregion #endregion
#region ReadInFile #region ReadInFile
private int ColToPoints(int i) private float RowToPoints(int i)
{
return (i * 6); // col_in_points = input * 72/12, col = input * 6
}
private int RowToPoints(int i)
{ {
return (i * 12); // row_in_points = input * 72/6, row = input * 12 return (i * 12); // row_in_points = input * 72/6, row = input * 12
} }
private float ColToPoints(float f, uint style)
{
return 72 * (f / CvtFont.CvtFont.GetPrintPitch(style));
}
string _AlternateIndex = null; string _AlternateIndex = null;
int[] rtCheckOffGroups = new int[MAXSTEPS + 1]; int[] rtCheckOffGroups = new int[MAXSTEPS + 1];
private string _fmtFileName; private string _fmtFileName;
private uint _PlantDefaultFontStyle;
public bool ReadInFmtFile(ref FormatData fmtdata, ref XtraFlgs XtraFlags, string fname) public bool ReadInFmtFile(ref FormatData fmtdata, ref XtraFlgs XtraFlags, string fname)
{ {
_fmtFileName = fname; _fmtFileName = fname;
@ -2158,10 +2158,21 @@ namespace fmtxml
fmtdata.StepData[i].ParentType = ParentTypes[i]; fmtdata.StepData[i].ParentType = ParentTypes[i];
if (i == 1) if (i == 1)
{ {
fmtdata.StepData[0].Font = LoadVE_Font(); _PlantDefaultFontStyle = brFmt.ReadUInt32();
fmtdata.StepData[0].Font = new VE_Font(_PlantDefaultFontStyle);
fmtdata.FontData = fmtdata.StepData[0].Font.Copy();
//fmtdata.StepData[1].Font will inherit the Base Font //fmtdata.StepData[1].Font will inherit the Base Font
} }
if (i > 1) fmtdata.StepData[i].Font = LoadVE_Font(); if (i > 1)
{
uint tmpuint = brFmt.ReadUInt32();
if (i == 40 && tmpuint==0) // check if RNOtype's font = 0, if so use the plant default
{
fmtdata.StepData[i].Font = new VE_Font(_PlantDefaultFontStyle);
}
else
fmtdata.StepData[i].Font = new VE_Font(tmpuint);
}
} }
for (int i = 1; i < MAXSTEPS+1; i++) for (int i = 1; i < MAXSTEPS+1; i++)
{ {
@ -2203,17 +2214,19 @@ namespace fmtxml
// convert these to points. Also, each set of data had 24, not 12 box fields, the // convert these to points. Also, each set of data had 24, not 12 box fields, the
// second twelve for RTF. For now, I'm going to just skip these. They can be added in // second twelve for RTF. For now, I'm going to just skip these. They can be added in
// later // later
for (int i = 1; i < MAXBOXES+1; i++) fmtdata.BoxData[i].Start = (Int16)(ColToPoints(brFmt.ReadInt16())); // Note that the box start (we think) and the box end locations used ELITE, at 12 characters per inch,
// for locating the line draw/box drawing.
for (int i = 1; i < MAXBOXES + 1; i++) fmtdata.BoxData[i].Start = ColToPoints(brFmt.ReadInt16(), CvtFont.CvtFont.ELITE);
for (int i = 1; i < MAXBOXES+1; i++) tmpshort = brFmt.ReadInt16(); for (int i = 1; i < MAXBOXES+1; i++) tmpshort = brFmt.ReadInt16();
for (int i = 1; i < MAXBOXES+1; i++) fmtdata.BoxData[i].End = (int)(ColToPoints(brFmt.ReadInt16())); for (int i = 1; i < MAXBOXES + 1; i++) fmtdata.BoxData[i].End = ColToPoints(brFmt.ReadInt16(), CvtFont.CvtFont.ELITE);
for (int i = 1; i < MAXBOXES+1; i++) tmpshort = brFmt.ReadInt16(); for (int i = 1; i < MAXBOXES+1; i++) tmpshort = brFmt.ReadInt16();
for (int i = 1; i < MAXBOXES+1; i++) fmtdata.BoxData[i].TxtStart = (Int16)(ColToPoints(brFmt.ReadInt16())); for (int i = 1; i < MAXBOXES + 1; i++) fmtdata.BoxData[i].TxtStart = ColToPoints(brFmt.ReadInt16(), _PlantDefaultFontStyle);
for (int i = 1; i < MAXBOXES+1; i++) tmpshort = brFmt.ReadInt16(); for (int i = 1; i < MAXBOXES+1; i++) tmpshort = brFmt.ReadInt16();
for (int i = 1; i < MAXBOXES+1; i++) fmtdata.BoxData[i].TxtWidth = (int)(ColToPoints(brFmt.ReadInt16())); for (int i = 1; i < MAXBOXES + 1; i++) fmtdata.BoxData[i].TxtWidth = ColToPoints(brFmt.ReadInt16(), _PlantDefaultFontStyle);
for (int i = 1; i < MAXBOXES+1; i++) tmpshort = brFmt.ReadInt16(); for (int i = 1; i < MAXBOXES+1; i++) tmpshort = brFmt.ReadInt16();
for (int i = 1; i < MAXBOXES+1; i++) fmtdata.BoxData[i].Height = (Int16)(RowToPoints(brFmt.ReadInt16())); for (int i = 1; i < MAXBOXES+1; i++) fmtdata.BoxData[i].Height = RowToPoints(brFmt.ReadInt16());
for (int i = 1; i < MAXBOXES+1; i++) tmpshort = brFmt.ReadInt16(); for (int i = 1; i < MAXBOXES+1; i++) tmpshort = brFmt.ReadInt16();
for (int i = 1; i < MAXBOXES+1; i++) fmtdata.BoxData[i].TabPos = (Int16)(RowToPoints(brFmt.ReadInt16())); for (int i = 1; i < MAXBOXES+1; i++) fmtdata.BoxData[i].TabPos = RowToPoints(brFmt.ReadInt16());
for (int i = 1; i < MAXBOXES+1; i++) tmpshort = brFmt.ReadInt16(); for (int i = 1; i < MAXBOXES+1; i++) tmpshort = brFmt.ReadInt16();
tmpshort = brFmt.ReadInt16(); // TransitionCautionOffset tmpshort = brFmt.ReadInt16(); // TransitionCautionOffset
for (int i = 1; i < MAXBOXES+1; i++) fmtdata.BoxData[i].Font = LoadVE_Font(); for (int i = 1; i < MAXBOXES+1; i++) fmtdata.BoxData[i].Font = LoadVE_Font();
@ -2283,8 +2296,8 @@ namespace fmtxml
fmtdata.SectData.StepSectionData.StpSectLayData = new StepSectionLayout(); fmtdata.SectData.StepSectionData.StpSectLayData = new StepSectionLayout();
fmtdata.SectData.StepSectionData.StpSectLayData.TopOfPage = new TopOfPg(); fmtdata.SectData.StepSectionData.StpSectLayData.TopOfPage = new TopOfPg();
fmtdata.SectData.StepSectionData.StpSectLayData.TopOfPage.Font = LoadVE_Font(); fmtdata.SectData.StepSectionData.StpSectLayData.TopOfPage.Font = LoadVE_Font();
fmtdata.SectData.StepSectionData.StpSectLayData.TopOfPage.Row = (Int16)(RowToPoints(brFmt.ReadInt16())); fmtdata.SectData.StepSectionData.StpSectLayData.TopOfPage.Row = RowToPoints(brFmt.ReadInt16());
fmtdata.SectData.StepSectionData.StpSectLayData.TopOfPage.Col = (Int16)(ColToPoints(brFmt.ReadInt16())); fmtdata.SectData.StepSectionData.StpSectLayData.TopOfPage.Col = ColToPoints(brFmt.ReadInt16(), _PlantDefaultFontStyle);
fmtdata.SectData.StepSectionData.StpSectPrtData = new StepSectionPrint(); fmtdata.SectData.StepSectionData.StpSectPrtData = new StepSectionPrint();
fmtdata.SectData.StepSectionData.StpSectPrtData.ModifiedTextStyle = LoadVE_Font(); fmtdata.SectData.StepSectionData.StpSectPrtData.ModifiedTextStyle = LoadVE_Font();
@ -2308,16 +2321,16 @@ namespace fmtxml
tmpshort = brFmt.ReadInt16(); // OmitErgEopUsage - not used. tmpshort = brFmt.ReadInt16(); // OmitErgEopUsage - not used.
fmtdata.SectData.StepSectionData.StpSectLayData.LineDrawingOption = brFmt.ReadInt16(); fmtdata.SectData.StepSectionData.StpSectLayData.LineDrawingOption = brFmt.ReadInt16();
fmtdata.SectData.StepSectionData.StpSectLayData.ColS = (Int16)(ColToPoints(brFmt.ReadInt16())); fmtdata.SectData.StepSectionData.StpSectLayData.ColS = ColToPoints(brFmt.ReadInt16(), _PlantDefaultFontStyle);
fmtdata.SectData.StepSectionData.StpSectEditData = new StepSectionEdit(); fmtdata.SectData.StepSectionData.StpSectEditData = new StepSectionEdit();
fmtdata.SectData.StepSectionData.StpSectEditData.ColSScreenAdj = (Int16)(ColToPoints(brFmt.ReadInt16())); fmtdata.SectData.StepSectionData.StpSectEditData.ColSScreenAdj = ColToPoints(brFmt.ReadInt16(), _PlantDefaultFontStyle);
fmtdata.SectData.StepSectionData.StpSectEditData.ScrnAdjRNOText = (Int16)(ColToPoints(brFmt.ReadInt16())); fmtdata.SectData.StepSectionData.StpSectEditData.ScrnAdjRNOText = ColToPoints(brFmt.ReadInt16(), _PlantDefaultFontStyle);
fmtdata.SectData.StepSectionData.StpSectLayData.ColT = (Int16)(ColToPoints(brFmt.ReadInt16())); fmtdata.SectData.StepSectionData.StpSectLayData.ColT = ColToPoints(brFmt.ReadInt16(),0);
tmpshort = brFmt.ReadInt16(); // Coltincr - not used tmpshort = brFmt.ReadInt16(); // Coltincr - not used
tmpshort = brFmt.ReadInt16(); // ColTab - not used tmpshort = brFmt.ReadInt16(); // ColTab - not used
fmtdata.SectData.StepSectionData.StpSectLayData.ColAbs = (Int16)(ColToPoints(brFmt.ReadInt16())); fmtdata.SectData.StepSectionData.StpSectLayData.ColAbs = ColToPoints(brFmt.ReadInt16(), _PlantDefaultFontStyle);
fmtdata.SectData.StepSectionData.StpSectLayData.WidT = (Int16)(ColToPoints(brFmt.ReadInt16())); fmtdata.SectData.StepSectionData.StpSectLayData.WidT = ColToPoints(brFmt.ReadInt16(), _PlantDefaultFontStyle);
tmpshort = brFmt.ReadInt16(); // WidTab - not used. tmpshort = brFmt.ReadInt16(); // WidTab - not used.
fmtdata.SectData.StepSectionData.StpSectLayData.PMode = brFmt.ReadInt16(); fmtdata.SectData.StepSectionData.StpSectLayData.PMode = brFmt.ReadInt16();
@ -2328,26 +2341,27 @@ namespace fmtxml
tmpstr = string.Format("{0},{1},{2}", tmpshort3[0], tmpshort3[1], tmpshort3[2]); tmpstr = string.Format("{0},{1},{2}", tmpshort3[0], tmpshort3[1], tmpshort3[2]);
fmtdata.SectData.StepSectionData.StpSectLayData.MaxRNOTable = tmpstr; fmtdata.SectData.StepSectionData.StpSectLayData.MaxRNOTable = tmpstr;
for (int i = 0; i < 3; i++) tmpshort3[i] = (Int16)(ColToPoints(brFmt.ReadInt16())); float[] tmpfloat = new float[3];
tmpstr = string.Format("{0},{1},{2}", tmpshort3[0], tmpshort3[1], tmpshort3[2]); for (int i = 0; i < 3; i++) tmpfloat[i] = ColToPoints(brFmt.ReadInt16(), _PlantDefaultFontStyle);
tmpstr = string.Format("{0},{1},{2}", tmpfloat[0], tmpfloat[1], tmpfloat[2]);
fmtdata.SectData.StepSectionData.StpSectLayData.ColRTable = tmpstr; fmtdata.SectData.StepSectionData.StpSectLayData.ColRTable = tmpstr;
Int16[] tmpshort3a = new Int16[3]; float[] tmpfloata = new float[3];
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
{ {
tmpshort3[i] = (Int16)(ColToPoints(brFmt.ReadInt16())); tmpfloat[i] = ColToPoints(brFmt.ReadInt16(), _PlantDefaultFontStyle);
tmpshort3a[i] = (Int16)(ColToPoints(brFmt.ReadInt16())); tmpfloata[i] = ColToPoints(brFmt.ReadInt16(), _PlantDefaultFontStyle);
} }
tmpstr = string.Format("{0},{1},{2}", tmpshort3[0], tmpshort3[1], tmpshort3[2]); tmpstr = string.Format("{0},{1},{2}", tmpfloat[0], tmpfloat[1], tmpfloat[2]);
fmtdata.SectData.StepSectionData.StpSectLayData.WidSTableEdit = tmpstr; fmtdata.SectData.StepSectionData.StpSectLayData.WidSTableEdit = tmpstr;
tmpstr = string.Format("{0},{1},{2}", tmpshort3a[0], tmpshort3a[1], tmpshort3a[2]); tmpstr = string.Format("{0},{1},{2}", tmpfloata[0], tmpfloata[1], tmpfloata[2]);
fmtdata.SectData.StepSectionData.StpSectLayData.WidSTablePrint = tmpstr; fmtdata.SectData.StepSectionData.StpSectLayData.WidSTablePrint = tmpstr;
for (int i = 0; i < 3; i++) tmpshort3[i] = (Int16)(ColToPoints(brFmt.ReadInt16())); for (int i = 0; i < 3; i++) tmpfloat[i] = ColToPoints(brFmt.ReadInt16(), _PlantDefaultFontStyle);
tmpstr = string.Format("{0},{1},{2}", tmpshort3[0], tmpshort3[1], tmpshort3[2]); tmpstr = string.Format("{0},{1},{2}", tmpfloat[0], tmpfloat[1], tmpfloat[2]);
fmtdata.SectData.StepSectionData.StpSectEditData.ColRScreen = tmpstr; fmtdata.SectData.StepSectionData.StpSectEditData.ColRScreen = tmpstr;
fmtdata.SectData.StepSectionData.StpSectLayData.AdjRNOCol = (Int16)(ColToPoints(brFmt.ReadInt16())); fmtdata.SectData.StepSectionData.StpSectLayData.AdjRNOCol = ColToPoints(brFmt.ReadInt16(), _PlantDefaultFontStyle);
ChangeBar cb = new ChangeBar(); ChangeBar cb = new ChangeBar();
@ -2396,7 +2410,7 @@ namespace fmtxml
for (int i = 0; i < MAXCHECKOFFS; i++) fmtdata.ProcData.CheckOffData.CheckOffList[i].Index = i; for (int i = 0; i < MAXCHECKOFFS; i++) fmtdata.ProcData.CheckOffData.CheckOffList[i].Index = i;
for (int i = 0; i < MAXCHECKOFFS; i++) fmtdata.ProcData.CheckOffData.CheckOffList[i].UIMark = brFmt.ReadByte(); for (int i = 0; i < MAXCHECKOFFS; i++) fmtdata.ProcData.CheckOffData.CheckOffList[i].UIMark = brFmt.ReadByte();
for (int i = 0; i < MAXCHECKOFFS; i++) fmtdata.ProcData.CheckOffData.CheckOffList[i].CheckOffXtraLines = brFmt.ReadByte(); // CheckOffXtraLines for (int i = 0; i < MAXCHECKOFFS; i++) fmtdata.ProcData.CheckOffData.CheckOffList[i].CheckOffXtraLines = brFmt.ReadByte(); // CheckOffXtraLines
for (int i = 0; i < MAXCHECKOFFS; i++) fmtdata.ProcData.CheckOffData.CheckOffList[i].CheckOffWidAdjust = (int)(ColToPoints(brFmt.ReadSByte())); for (int i = 0; i < MAXCHECKOFFS; i++) fmtdata.ProcData.CheckOffData.CheckOffList[i].CheckOffWidAdjust = ColToPoints(brFmt.ReadSByte(), _PlantDefaultFontStyle);
for (int i = 0; i < MAXCHECKOFFS; i++) tmpbyte = brFmt.ReadByte(); // CheckOffFeatures for (int i = 0; i < MAXCHECKOFFS; i++) tmpbyte = brFmt.ReadByte(); // CheckOffFeatures
fmtdata.ProcData.CheckOffData.CheckOffHeaderList = new CheckOffHeader[MAXCHKHEADINGS]; fmtdata.ProcData.CheckOffData.CheckOffHeaderList = new CheckOffHeader[MAXCHKHEADINGS];
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].Index = i;
@ -2418,7 +2432,7 @@ namespace fmtxml
tmpbyte = brFmt.ReadByte(); // HighSeqStart tmpbyte = brFmt.ReadByte(); // HighSeqStart
fmtdata.SectData.StepSectionData.IndentToken = brFmt.ReadByte(); fmtdata.SectData.StepSectionData.IndentToken = brFmt.ReadByte();
fmtdata.SectData.StepSectionData.StpSectPrtData.ImmStepHdrCol = (Int16)(ColToPoints(brFmt.ReadInt16())); fmtdata.SectData.StepSectionData.StpSectPrtData.ImmStepHdrCol = ColToPoints(brFmt.ReadInt16(), _PlantDefaultFontStyle);
fmtdata.SectData.StepSectionData.StpSectPrtData.ImmStepHdrStyle = LoadVE_Font(); fmtdata.SectData.StepSectionData.StpSectPrtData.ImmStepHdrStyle = LoadVE_Font();
ReplaceStr[] repstr = new ReplaceStr[MAXREPLACE]; ReplaceStr[] repstr = new ReplaceStr[MAXREPLACE];
@ -2438,9 +2452,9 @@ namespace fmtxml
fmtdata.SectData.SectionHeader = new SectionHead(); fmtdata.SectData.SectionHeader = new SectionHead();
fmtdata.SectData.SectionNumber.Font = LoadVE_Font(); fmtdata.SectData.SectionNumber.Font = LoadVE_Font();
fmtdata.SectData.SectionHeader.Font = LoadVE_Font(); fmtdata.SectData.SectionHeader.Font = LoadVE_Font();
fmtdata.SectData.SectionNumber.Pos = (Int16)(ColToPoints(brFmt.ReadInt16())); fmtdata.SectData.SectionNumber.Pos = ColToPoints(brFmt.ReadInt16(), _PlantDefaultFontStyle);
fmtdata.SectData.SectionNumber.Just = ((E_PageStructMod)brFmt.ReadByte()).ToString(); fmtdata.SectData.SectionNumber.Just = ((E_PageStructMod)brFmt.ReadByte()).ToString();
fmtdata.SectData.SectionHeader.Pos = (Int16)(ColToPoints(brFmt.ReadInt16())); fmtdata.SectData.SectionHeader.Pos = ColToPoints(brFmt.ReadInt16(), _PlantDefaultFontStyle);
fmtdata.SectData.SectionHeader.Just = ((E_PageStructMod)brFmt.ReadByte()).ToString(); fmtdata.SectData.SectionHeader.Just = ((E_PageStructMod)brFmt.ReadByte()).ToString();
for (int i = 0; i < 10; i++) tmpbyte = brFmt.ReadByte(); // SecLevelDelta for (int i = 0; i < 10; i++) tmpbyte = brFmt.ReadByte(); // SecLevelDelta
@ -2481,17 +2495,17 @@ namespace fmtxml
for (int i = 0; i < MAXTRANS; i++) tmpbyte = brFmt.ReadByte(); // TransMode for (int i = 0; i < MAXTRANS; i++) tmpbyte = brFmt.ReadByte(); // TransMode
for (int i = 0; i < MAXTRANS; i++) tmpbyte = brFmt.ReadByte(); // OutsideTransType for (int i = 0; i < MAXTRANS; i++) tmpbyte = brFmt.ReadByte(); // OutsideTransType
for (int i = 0; i < MAXSTEPS; i++) fmtdata.StepData[i].StepLayoutData.StepTypeWidthOverride = ((Int16)(ColToPoints(brFmt.ReadInt16()))).ToString(); for (int i = 0; i < MAXSTEPS; i++) fmtdata.StepData[i].StepLayoutData.StepTypeWidthOverride = (ColToPoints(brFmt.ReadInt16(), _PlantDefaultFontStyle)).ToString();
// auto table of contents data // auto table of contents data
AccSection accsec = new AccSection(); AccSection accsec = new AccSection();
TOC toc = new TOC(); TOC toc = new TOC();
toc.TofCSecNumPos = (Int16)(ColToPoints(brFmt.ReadSByte())); toc.TofCSecNumPos = ColToPoints(brFmt.ReadSByte(), _PlantDefaultFontStyle);
toc.TofCSecTitlePos = (Int16)(ColToPoints(brFmt.ReadSByte())); toc.TofCSecTitlePos = ColToPoints(brFmt.ReadSByte(), _PlantDefaultFontStyle);
tmpbyte = brFmt.ReadByte(); // TofCSecTitlePos2 tmpbyte = brFmt.ReadByte(); // TofCSecTitlePos2
toc.TofCSecTitleLen = brFmt.ReadByte(); toc.TofCSecTitleLen = brFmt.ReadByte();
toc.TofCPageNumPos = (Int16)(ColToPoints(brFmt.ReadSByte())); toc.TofCPageNumPos = ColToPoints(brFmt.ReadSByte(), _PlantDefaultFontStyle);
toc.TofCSpaceChar = brFmt.ReadByte(); toc.TofCSpaceChar = brFmt.ReadByte();
toc.TofCLineSpacing = brFmt.ReadByte(); toc.TofCLineSpacing = brFmt.ReadByte();
toc.Font = LoadVE_FontByte(); ; toc.Font = LoadVE_FontByte(); ;
@ -2542,11 +2556,11 @@ namespace fmtxml
MetaSection[] metsects = new MetaSection[10]; MetaSection[] metsects = new MetaSection[10];
fmtdata.SectData.MetaSectionData = metsects; fmtdata.SectData.MetaSectionData = metsects;
for (int i = 0; i < 10; i++) metsects[i].Index = i; for (int i = 0; i < 10; i++) metsects[i].Index = i;
for (int i = 0; i < 10; i++) metsects[i].SecNumPositionAdj = (Int16)(ColToPoints(brFmt.ReadSByte())); for (int i = 0; i < 10; i++) metsects[i].SecNumPositionAdj = ColToPoints(brFmt.ReadSByte(), _PlantDefaultFontStyle);
for (int i = 0; i < 10; i++) metsects[i].SecTitlePositionAdj = (Int16)(ColToPoints(brFmt.ReadSByte())); for (int i = 0; i < 10; i++) metsects[i].SecTitlePositionAdj = ColToPoints(brFmt.ReadSByte(), _PlantDefaultFontStyle);
for (int i = 0; i < 10; i++) metsects[i].ColSByLevel = (Int16)(ColToPoints(brFmt.ReadSByte())); for (int i = 0; i < 10; i++) metsects[i].ColSByLevel = ColToPoints(brFmt.ReadSByte(), _PlantDefaultFontStyle);
for (int i = 0; i < 10; i++) metsects[i].TofCPositionAdj = (Int16)(ColToPoints(brFmt.ReadSByte())); for (int i = 0; i < 10; i++) metsects[i].TofCPositionAdj = ColToPoints(brFmt.ReadSByte(), _PlantDefaultFontStyle);
for (int i = 0; i < 10; i++) metsects[i].WidSAdjByLevel = (Int16)(ColToPoints(brFmt.ReadSByte())); for (int i = 0; i < 10; i++) metsects[i].WidSAdjByLevel = ColToPoints(brFmt.ReadSByte(), _PlantDefaultFontStyle);
fmtdata.SectData.StepSectionData.NumberOfHighLevelSteps = brFmt.ReadByte(); fmtdata.SectData.StepSectionData.NumberOfHighLevelSteps = brFmt.ReadByte();
@ -2554,7 +2568,7 @@ namespace fmtxml
for (int i = 1; i < MAXBOXES+1; i++) fmtdata.BoxData[i].TxtRowAdj = brFmt.ReadSByte(); for (int i = 1; i < MAXBOXES+1; i++) fmtdata.BoxData[i].TxtRowAdj = brFmt.ReadSByte();
for (int i = 1; i < MAXBOXES+1; i++) tmpshort = brFmt.ReadByte(); for (int i = 1; i < MAXBOXES+1; i++) tmpshort = brFmt.ReadByte();
for (int i = 1; i < MAXSTEPS+1; i++) fmtdata.StepData[i].StepTypeColOverride = ((Int16)(ColToPoints(brFmt.ReadInt16()))).ToString(); for (int i = 1; i < MAXSTEPS + 1; i++) fmtdata.StepData[i].StepTypeColOverride = (ColToPoints(brFmt.ReadInt16(), _PlantDefaultFontStyle)).ToString();
fmtdata.SectData.StepSectionData.NumberOfSubStepTypes = brFmt.ReadByte(); fmtdata.SectData.StepSectionData.NumberOfSubStepTypes = brFmt.ReadByte();
@ -4494,7 +4508,7 @@ namespace fmtxml
return wkstr; return wkstr;
} }
private int CalculateTabWid(string p) private float CalculateTabWid(string p)
{ {
if (p == null || p.Length == 0) return 0; if (p == null || p.Length == 0) return 0;
int tablen = p.Length; int tablen = p.Length;
@ -4518,7 +4532,7 @@ namespace fmtxml
for (int i=0; i<p.Length; i++) if (p[i] == 0x08) tablen--; // discount backspaces. for (int i=0; i<p.Length; i++) if (p[i] == 0x08) tablen--; // discount backspaces.
for (int i = 0; i < p.Length; i++) if (p[i] == 0x16) tablen--; // underline toggle tokens for (int i = 0; i < p.Length; i++) if (p[i] == 0x16) tablen--; // underline toggle tokens
if (tablen < 0) tablen = 0; if (tablen < 0) tablen = 0;
return ColToPoints(tablen); return ColToPoints(tablen,_PlantDefaultFontStyle);
} }
private string DoTabs(VE_Font vefont, string po, int i, string p, bool doNumeric) private string DoTabs(VE_Font vefont, string po, int i, string p, bool doNumeric)
{ {
@ -5111,9 +5125,10 @@ namespace fmtxml
if (inhFont.FontStyle == font.FontStyle) font.FontStyle = null; if (inhFont.FontStyle == font.FontStyle) font.FontStyle = null;
if (inhFont.FontJustify == font.FontJustify) font.FontJustify = null; if (inhFont.FontJustify == font.FontJustify) font.FontJustify = null;
if (inhFont.FontCheckOff == font.FontCheckOff) font.FontCheckOff = null; if (inhFont.FontCheckOff == font.FontCheckOff) font.FontCheckOff = null;
if (inhFont.CPI == font.CPI) font.CPI = null;
//if (_LookForChange && !font.CanInherit()) //if (_LookForChange && !font.CanInherit())
// Console.WriteLine("Change Happened"); // Console.WriteLine("Change Happened");
if (font.FontFamily == null && font.FontSize == null && font.FontStyle == null && font.FontJustify == null && font.FontCheckOff == null) if (font.FontFamily == null && font.FontSize == null && font.FontStyle == null && font.FontJustify == null && font.FontCheckOff == null && font.CPI == null)
font = null; font = null;
} }
return font; return font;
@ -5140,6 +5155,11 @@ namespace fmtxml
if (stp.Font == null) return null; if (stp.Font == null) return null;
return stp.Font.FontSize; return stp.Font.FontSize;
} }
private string StepPartFontCPI(Step stp)
{
if (stp.Font == null) return null;
return stp.Font.CPI;
}
private string StepPartFontStyle(Step stp) private string StepPartFontStyle(Step stp)
{ {
if (stp.Font == null) return null; if (stp.Font == null) return null;
@ -5197,6 +5217,11 @@ namespace fmtxml
if (stp.TabData.Font == null) return null; if (stp.TabData.Font == null) return null;
return stp.TabData.Font.FontSize; return stp.TabData.Font.FontSize;
} }
private string StepPartTabFontCPI(Step stp)
{
if (stp.TabData.Font == null) return null;
return stp.TabData.Font.CPI;
}
private string StepPartTabFontStyle(Step stp) private string StepPartTabFontStyle(Step stp)
{ {
if (stp.TabData.Font == null) return null; if (stp.TabData.Font == null) return null;
@ -5253,19 +5278,18 @@ namespace fmtxml
if (CheckInheritedStr(new StepPartStr(StepPartVertPos), step, dicParents)) step.VertPos = null; if (CheckInheritedStr(new StepPartStr(StepPartVertPos), step, dicParents)) step.VertPos = null;
// substructures - Font // substructures - Font
if (step.Font != null && CheckInheritedStr(new StepPartStr(StepPartFontFamily), step, dicParents)) if (step.Font != null && CheckInheritedStr(new StepPartStr(StepPartFontFamily), step, dicParents))
{
//Console.WriteLine("Step[{0}] {1} - {2}", step.Index, step.Type, step.Font.FontFamily);
step.Font.FontFamily = null; step.Font.FontFamily = null;
}
if (step.Font != null && CheckInheritedStr(new StepPartStr(StepPartFontStyle), step, dicParents)) if (step.Font != null && CheckInheritedStr(new StepPartStr(StepPartFontStyle), step, dicParents))
step.Font.FontStyle = null; step.Font.FontStyle = null;
if (step.Font != null && CheckInheritedStr(new StepPartStr(StepPartFontSize), step, dicParents)) if (step.Font != null && CheckInheritedStr(new StepPartStr(StepPartFontSize), step, dicParents))
step.Font.FontSize = null; step.Font.FontSize = null;
if (step.Font != null && CheckInheritedStr(new StepPartStr(StepPartFontCPI), step, dicParents))
step.Font.CPI = null;
if (step.Font != null && CheckInheritedStr(new StepPartStr(StepPartFontJustify), step, dicParents)) if (step.Font != null && CheckInheritedStr(new StepPartStr(StepPartFontJustify), step, dicParents))
step.Font.FontJustify = null; step.Font.FontJustify = null;
if (step.Font != null && CheckInheritedStr(new StepPartStr(StepPartFontCheckOff), step, dicParents)) if (step.Font != null && CheckInheritedStr(new StepPartStr(StepPartFontCheckOff), step, dicParents))
step.Font.FontCheckOff = null; step.Font.FontCheckOff = null;
if ((step.Font != null) && (step.Font.FontFamily == null) && (step.Font.FontStyle == null) && (step.Font.FontSize == null) && (step.Font.FontJustify == null) && (step.Font.FontCheckOff == null)) if ((step.Font != null) && (step.Font.FontFamily == null) && (step.Font.FontStyle == null) && (step.Font.FontSize == null) && (step.Font.FontJustify == null) && (step.Font.FontCheckOff == null) && (step.Font.CPI == null))
step.Font = null; step.Font = null;
// substructure - StepLayoutData // substructure - StepLayoutData
if (CheckInheritedStr(new StepPartStr(StepPartLayoutForeColor), step, dicParents)) step.StepLayoutData.ForeColor = null; if (CheckInheritedStr(new StepPartStr(StepPartLayoutForeColor), step, dicParents)) step.StepLayoutData.ForeColor = null;
@ -5315,11 +5339,13 @@ namespace fmtxml
step.TabData.Font.FontStyle = null; step.TabData.Font.FontStyle = null;
if (step.TabData.Font != null && CheckInheritedStr(new StepPartStr(StepPartTabFontSize), step, dicParents)) if (step.TabData.Font != null && CheckInheritedStr(new StepPartStr(StepPartTabFontSize), step, dicParents))
step.TabData.Font.FontSize = null; step.TabData.Font.FontSize = null;
if (step.TabData.Font != null && CheckInheritedStr(new StepPartStr(StepPartTabFontCPI), step, dicParents))
step.TabData.Font.CPI = null;
if (step.TabData.Font != null && CheckInheritedStr(new StepPartStr(StepPartTabJustify), step, dicParents)) if (step.TabData.Font != null && CheckInheritedStr(new StepPartStr(StepPartTabJustify), step, dicParents))
step.TabData.Font.FontJustify = null; step.TabData.Font.FontJustify = null;
if (step.TabData.Font != null) // && CheckInheritedStr(new StepPartStr(StepPartTabCheckOff), step, dicParents)) if (step.TabData.Font != null) // && CheckInheritedStr(new StepPartStr(StepPartTabCheckOff), step, dicParents))
step.TabData.Font.FontCheckOff = null; step.TabData.Font.FontCheckOff = null;
if ((step.TabData.Font != null) && (step.TabData.Font.FontFamily == null) && (step.TabData.Font.FontStyle == null) && (step.TabData.Font.FontSize == null) && (step.TabData.Font.FontJustify == null)) if ((step.TabData.Font != null) && (step.TabData.Font.FontFamily == null) && (step.TabData.Font.FontStyle == null) && (step.TabData.Font.FontSize == null) && (step.TabData.Font.FontJustify == null) && (step.TabData.Font.CPI == null))
step.TabData.Font = null; step.TabData.Font = null;
// All macro list items must be identical from step to inherited parent in order to removeit. // All macro list items must be identical from step to inherited parent in order to removeit.

View File

@ -28,8 +28,8 @@ public struct PageStyle
[Serializable] [Serializable]
public struct PSItem public struct PSItem
{ {
public int Row; public float Row;
public int Col; public float Col;
//public E_PageStructMod Justify; //public E_PageStructMod Justify;
public string Justify; public string Justify;
public VE_Font Style; public VE_Font Style;
@ -49,11 +49,11 @@ public struct DocStyle
public short Index; public short Index;
public short pagestyle; // Index into page style array public short pagestyle; // Index into page style array
public VE_Font dstyle; // 'Printer driver styles' for the entire document public VE_Font dstyle; // 'Printer driver styles' for the entire document
public int PTopRow; // First 'document text' row on printed page public float PTopRow; // First 'document text' row on printed page
public int FooterLen; // Number of lines required for footer public float FooterLen; // Number of lines required for footer
public int LeftMargin; // Size of left margin public float LeftMargin; // Size of left margin
public int PageLength; public float PageLength;
public int PageWidth; public float PageWidth;
public short numberingsequence; // 0 - no page number public short numberingsequence; // 0 - no page number
// 1 - included with steps // 1 - included with steps
// 2 - within sections ie. document styles // 2 - within sections ie. document styles
@ -65,8 +65,8 @@ public struct DocStyle
// document style // document style
public short ContTopHLS; // Flag for including High Level step public short ContTopHLS; // Flag for including High Level step
// as part of top continue message. // as part of top continue message.
public int CTMargin; // Margin for top message public float CTMargin; // Margin for top message
public int CBMargin; // Margin for bottom message public float CBMargin; // Margin for bottom message
public short CBLoc; // 0 - place continue string at end of text public short CBLoc; // 0 - place continue string at end of text
// 1 - between end of text & bottom of page // 1 - between end of text & bottom of page
// 2 - place at bottom of page // 2 - place at bottom of page
@ -327,7 +327,6 @@ public class VE_Font
} }
set { CheckPartial(_FontFamily,value); _FontFamily = value; } set { CheckPartial(_FontFamily,value); _FontFamily = value; }
} }
private void CheckPartial(string member, string value) private void CheckPartial(string member, string value)
{ {
if (member != null && value == null) if (member != null && value == null)
@ -365,6 +364,21 @@ public class VE_Font
set { CheckPartial(_FontStyle, value); _FontStyle = value; } set { CheckPartial(_FontStyle, value); _FontStyle = value; }
//set{i = ((uint)value) | (i & 0x3F);} //set{i = ((uint)value) | (i & 0x3F);}
} }
private string _CPI;
private bool _CPISet = false;
public string CPI
{
get
{
if (!_CPISet)
{
_CPI = CvtFont.CvtFont.GetCPIs(i).ToString();
}
_CPISet = true;
return _CPI;
}
set { CheckPartial(_CPI, value); _CPI = value; }
}
private string _FontCheckOff = null; private string _FontCheckOff = null;
private bool _FontCheckOffSet = false; private bool _FontCheckOffSet = false;
public string FontCheckOff public string FontCheckOff
@ -490,14 +504,14 @@ namespace fmtxml
MessageBox.Show("Format name = " + nm, ex.Message); MessageBox.Show("Format name = " + nm, ex.Message);
} }
} }
private int ColToPoints(int i) private float RowToPoints(int i)
{
return (i * 6); // col_in_points = input * 72/12, col = input * 6
}
private int RowToPoints(int i)
{ {
return (i * 12); // row_in_points = input * 72/6, row = input * 12 return (i * 12); // row_in_points = input * 72/6, row = input * 12
} }
private float ColToPoints(float f, uint style)
{
return 72 * (f / CvtFont.CvtFont.GetCPIs(style));
}
private string GetAsciiStringUntilNull(BinaryReader br) private string GetAsciiStringUntilNull(BinaryReader br)
{ {
StringBuilder inpstr = new StringBuilder(); StringBuilder inpstr = new StringBuilder();
@ -569,7 +583,6 @@ namespace fmtxml
// read in title. // read in title.
string fnm = MyPath + @"\" + fname; string fnm = MyPath + @"\" + fname;
Console.WriteLine(fname);
brFmt = new BinaryReader(File.Open(fnm,System.IO.FileMode.Open,System.IO.FileAccess.ReadWrite,FileShare.ReadWrite)); brFmt = new BinaryReader(File.Open(fnm,System.IO.FileMode.Open,System.IO.FileAccess.ReadWrite,FileShare.ReadWrite));
pgstyles.Name = GetAsciiString(brFmt); pgstyles.Name = GetAsciiString(brFmt);
@ -599,7 +612,7 @@ namespace fmtxml
stringoffsets.Add(vnum); stringoffsets.Add(vnum);
} }
} }
bool didLineDraw = false;
for (short i=0;i<numpgstyles;i++) for (short i=0;i<numpgstyles;i++)
{ {
PageStyle pg = new PageStyle(); PageStyle pg = new PageStyle();
@ -620,11 +633,24 @@ namespace fmtxml
// the row is set based on 6 rows per inch // the row is set based on 6 rows per inch
// the column is 12 char/inch // the column is 12 char/inch
pi.Row = RowToPoints(brFmt.ReadInt16()); pi.Row = RowToPoints(brFmt.ReadInt16());
pi.Col = ColToPoints(brFmt.ReadInt16()); int lcol = brFmt.ReadInt16();
//pi.Justify = (E_PageStructMod)brFmt.ReadUInt16(); uint tmpjust = brFmt.ReadUInt16();
pi.Justify = ((E_PageStructMod)brFmt.ReadUInt16()).ToString(); E_PageStructMod etmpjust = (E_PageStructMod)tmpjust;
pi.Style = LoadVE_Font(); pi.Justify = ((E_PageStructMod)tmpjust).ToString();
pi.Token = DoReplaceTokens(GetAsciiStringUntilNull(brFmt)); float adj = 0.5F;
if ((etmpjust & E_PageStructMod.PSTrue) == 0) adj = -0.5F;
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);
if (pi.Token != null)
{
// replace the '<' with '{' & '>' with '}' // replace the '<' with '{' & '>' with '}'
pi.Token = pi.Token.Replace('<', '{'); pi.Token = pi.Token.Replace('<', '{');
pi.Token = pi.Token.Replace('>', '}'); pi.Token = pi.Token.Replace('>', '}');
@ -633,14 +659,35 @@ namespace fmtxml
if (!isfirst) if (!isfirst)
{ {
Fpsitms = new PSItem[cnt]; Fpsitms = new PSItem[cnt];
psitms.CopyTo(Fpsitms,0); psitms.CopyTo(Fpsitms, 0);
Fpsitms[cnt-1] = pi; Fpsitms[cnt - 1] = pi;
psitms = Fpsitms; psitms = Fpsitms;
} }
else else
psitms[0] = pi; psitms[0] = pi;
isfirst=false; isfirst = false;
}
else
{
if (!didLineDraw)
{
didLineDraw = true;
pi.Token = "{BOX9}";
cnt++;
if (!isfirst)
{
Fpsitms = new PSItem[cnt];
psitms.CopyTo(Fpsitms, 0);
Fpsitms[cnt - 1] = pi;
psitms = Fpsitms;
}
else
psitms[0] = pi;
isfirst = false;
}
}
brFmt.BaseStream.Position = fseek+vnum; brFmt.BaseStream.Position = fseek+vnum;
} }
pg.Items = psitms; pg.Items = psitms;
@ -680,6 +727,20 @@ namespace fmtxml
} }
} }
private string RemoveInitialLineDraw(string tkn, ref int coladj)
{
// if first two characters are line draw and space, remove them and adjust column.
if (tkn[0] == '\xB3' && tkn[1] == ' ')
{
coladj += 2;
tkn = tkn.Substring(2, tkn.Length - 2);
//trim any end line char too.
tkn = tkn.Replace('\xB3',' ');
tkn = tkn.TrimEnd(" ".ToCharArray());
}
return tkn;
}
private string GetAsciiString(BinaryReader brFmt) private string GetAsciiString(BinaryReader brFmt)
{ {
short len = brFmt.ReadInt16(); short len = brFmt.ReadInt16();
@ -693,7 +754,7 @@ namespace fmtxml
// read in title. // read in title.
string fnm = MyPath + @"\" + fname; string fnm = MyPath + @"\" + fname;
Console.WriteLine(fname); if (fname == "CPL.Y01") Console.WriteLine(fname);
brFmt = new BinaryReader(File.Open(fnm,System.IO.FileMode.Open,System.IO.FileAccess.ReadWrite,FileShare.ReadWrite)); brFmt = new BinaryReader(File.Open(fnm,System.IO.FileMode.Open,System.IO.FileAccess.ReadWrite,FileShare.ReadWrite));
dcstyles.Name = GetAsciiString(brFmt); dcstyles.Name = GetAsciiString(brFmt);
@ -757,12 +818,13 @@ namespace fmtxml
dc.Name = GetAsciiString(brFmt); dc.Name = GetAsciiString(brFmt);
vnum = brFmt.ReadInt16(); // not sure what this is! vnum = brFmt.ReadInt16(); // not sure what this is!
dc.pagestyle = brFmt.ReadInt16(); dc.pagestyle = brFmt.ReadInt16();
dc.dstyle = LoadVE_Font(); uint tmpstyle = brFmt.ReadUInt32();
dc.dstyle = new VE_Font(tmpstyle);
dc.PTopRow = RowToPoints(brFmt.ReadInt16()); dc.PTopRow = RowToPoints(brFmt.ReadInt16());
dc.FooterLen = RowToPoints(brFmt.ReadInt16()); dc.FooterLen = RowToPoints(brFmt.ReadInt16());
dc.LeftMargin = ColToPoints(brFmt.ReadInt16()); dc.LeftMargin = ColToPoints(brFmt.ReadInt16(), tmpstyle);
dc.PageLength = RowToPoints(brFmt.ReadInt16()); dc.PageLength = RowToPoints(brFmt.ReadInt16());
dc.PageWidth = ColToPoints(brFmt.ReadInt16()); dc.PageWidth = ColToPoints(brFmt.ReadInt16(), tmpstyle);
dc.numberingsequence = brFmt.ReadInt16(); dc.numberingsequence = brFmt.ReadInt16();
dc.oldtonew = brFmt.ReadInt32(); dc.oldtonew = brFmt.ReadInt32();
dc.IsStepSection = ConvertToSectType(dc.oldtonew); dc.IsStepSection = ConvertToSectType(dc.oldtonew);
@ -874,6 +936,8 @@ namespace fmtxml
string wkstr = p; string wkstr = p;
// use regular expressions to do the following... // use regular expressions to do the following...
// first see if entire string is line draw type chars, if so, just don't include it.
if (AllDrawChars(wkstr)) return null;
try try
{ {
// replace newline with {par} // replace newline with {par}
@ -931,6 +995,7 @@ namespace fmtxml
// replace x15 with {RO} for now. // replace x15 with {RO} for now.
wkstr = wkstr.Replace("\x15", "{RO}"); wkstr = wkstr.Replace("\x15", "{RO}");
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -940,6 +1005,14 @@ namespace fmtxml
return wkstr; return wkstr;
} }
private bool AllDrawChars(string wkstr)
{
foreach (char c in wkstr)
{
if (c < '\xB3' || c > '\xDF') return false;
}
return true;
}
private void CompareFonts(VE_Font parFont, ref VE_Font subFont) private void CompareFonts(VE_Font parFont, ref VE_Font subFont)
{ {
if (parFont != null && subFont != null) if (parFont != null && subFont != null)

View File

@ -166,6 +166,18 @@ namespace fmtxml
private string MyResultPath; private string MyResultPath;
/*
* The following svg group must be added for WCN2 for its box on the cover page:
*
<g id="B9">
<rect x="25" y="-3" width="353" height="123" fill="none" stroke="black" stroke-width="1.2" />
<line x1="25" y1="20" x2="378" y2="20" stroke-width="1.2" />
<line x1="25" y1="45" x2="378" y2="45" stroke-width="1.2" />
<line x1="25" y1="69" x2="378" y2="69" stroke-width="1.2" />
<line x1="25" y1="93" x2="378" y2="93" stroke-width="1.2" />
<line x1="285" y1="-5" x2="285" y2="118" stroke-width="1.2" />
</g>
*/
public GenXmlToSvg(string nm, string resPath) public GenXmlToSvg(string nm, string resPath)
{ {
MyResultPath = resPath; MyResultPath = resPath;

Binary file not shown.