From 00d7744d0db128fdc3a04b47f624d54958ae7ecc Mon Sep 17 00:00:00 2001 From: Kathy Date: Tue, 26 Aug 2008 13:55:41 +0000 Subject: [PATCH] --- .../CvtFont/CvtFont.csproj | 12 +- PROMS/fmtxml/App.ico | Bin 0 -> 1078 bytes PROMS/fmtxml/AssemblyInfo.cs | 58 + PROMS/fmtxml/EntireFormat.cs | 60 + PROMS/fmtxml/FmtFileToXml.cs | 4841 +++++++++++++++++ PROMS/fmtxml/FmtToXml.cs | 918 ++++ PROMS/fmtxml/Form1.cs | 337 ++ PROMS/fmtxml/Form1.resx | 123 + PROMS/fmtxml/GenToXml.cs | 151 + PROMS/fmtxml/GenXmlToSvg.cs | 769 +++ PROMS/fmtxml/SvgToPdf.cs | 191 + PROMS/fmtxml/XmlToPdf.cs | 188 + 12 files changed, 7640 insertions(+), 8 deletions(-) create mode 100644 PROMS/fmtxml/App.ico create mode 100644 PROMS/fmtxml/AssemblyInfo.cs create mode 100644 PROMS/fmtxml/EntireFormat.cs create mode 100644 PROMS/fmtxml/FmtFileToXml.cs create mode 100644 PROMS/fmtxml/FmtToXml.cs create mode 100644 PROMS/fmtxml/Form1.cs create mode 100644 PROMS/fmtxml/Form1.resx create mode 100644 PROMS/fmtxml/GenToXml.cs create mode 100644 PROMS/fmtxml/GenXmlToSvg.cs create mode 100644 PROMS/fmtxml/SvgToPdf.cs create mode 100644 PROMS/fmtxml/XmlToPdf.cs diff --git a/PROMS/Volian.Utils.Library/CvtFont/CvtFont.csproj b/PROMS/Volian.Utils.Library/CvtFont/CvtFont.csproj index 4d7ce5b6..3aec731a 100644 --- a/PROMS/Volian.Utils.Library/CvtFont/CvtFont.csproj +++ b/PROMS/Volian.Utils.Library/CvtFont/CvtFont.csproj @@ -9,14 +9,10 @@ Properties CvtFont CvtFont - - - - - - - - + SAK + SAK + SAK + SAK true diff --git a/PROMS/fmtxml/App.ico b/PROMS/fmtxml/App.ico new file mode 100644 index 0000000000000000000000000000000000000000..3a5525fd794f7a7c5c8e6187f470ea3af38cd2b6 GIT binary patch literal 1078 zcmeHHJr05}7=1t!Hp3A*8IHkVf+j?-!eHY14Gtcw1Eb*_9>Bq^zETJ@GKj{_2j4$w zo9}xCh!8{T3=X##Skq>ikMjsvB|y%crWBM2iW(4pI}c%z6%lW!=~4v77#3{z!dmB1 z__&l)-{KUYR+|8|;wB^R|9ET$J@(@=#rd^=)qs85?vAy(PSF5CyNkus435LVkZ$rj zNw|JG-P7^hF<(;#o*Vk}5R#e|^13tBbQkeF?djULtvqyxd3<{9 literal 0 HcmV?d00001 diff --git a/PROMS/fmtxml/AssemblyInfo.cs b/PROMS/fmtxml/AssemblyInfo.cs new file mode 100644 index 00000000..9f89a328 --- /dev/null +++ b/PROMS/fmtxml/AssemblyInfo.cs @@ -0,0 +1,58 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +// +[assembly: AssemblyTitle("")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.*")] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified, the assembly is not signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. KeyFile refers to a file which contains +// a key. +// (*) If the KeyFile and the KeyName values are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP, that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the KeyFile is installed into the CSP and used. +// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. +// When specifying the KeyFile, the location of the KeyFile should be +// relative to the project output directory which is +// %Project Directory%\obj\. For example, if your KeyFile is +// located in the project directory, you would specify the AssemblyKeyFile +// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] +[assembly: AssemblyKeyName("")] diff --git a/PROMS/fmtxml/EntireFormat.cs b/PROMS/fmtxml/EntireFormat.cs new file mode 100644 index 00000000..1fd1df7b --- /dev/null +++ b/PROMS/fmtxml/EntireFormat.cs @@ -0,0 +1,60 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text; +using System.Xml; + +namespace fmtxml +{ + class EntireFormat + { + public EntireFormat(string mxml) + { + XmlDocument xmldoc = new XmlDocument(); + XmlElement top = xmldoc.CreateElement("PlantFormat"); + xmldoc.AppendChild(top); + try + { + XmlReaderSettings settings = new XmlReaderSettings(); + settings.IgnoreWhitespace = true; + StreamReader strrdr = new StreamReader(mxml); + XmlTextReader rdr = new XmlTextReader(strrdr); + using (rdr) + { + rdr.MoveToContent(); + XmlNode fmt = xmldoc.ReadNode(rdr); + top.AppendChild(fmt); + } + rdr.Close(); + // load page xml + string pagename = mxml.Substring(0, mxml.Length - 5) + "p.xml"; + using (XmlReader reader = XmlReader.Create(pagename, settings)) + { + reader.MoveToContent(); + XmlNode pag = xmldoc.ReadNode(reader); + top.AppendChild(pag); + } + + string docname = mxml.Substring(0, mxml.Length - 5) + "d.xml"; + using (XmlReader reader = XmlReader.Create(docname, settings)) + { + reader.MoveToContent(); + XmlNode doc = xmldoc.ReadNode(reader); + top.AppendChild(doc); + } + XmlWriterSettings settingsout = new XmlWriterSettings(); + settingsout.Encoding = Encoding.Unicode; + string outname = "e:\\fmtall\\" + mxml.Substring(mxml.IndexOf("\\")+1,mxml.Length - 13) + "all.xml"; + XmlWriter xmlwrite = XmlWriter.Create(outname,settingsout); + xmldoc.WriteContentTo(xmlwrite); + xmlwrite.Close(); + } + catch (Exception ex) + { + Console.WriteLine("Error on merge, format = {0}, msg = {1}", mxml, ex.Message); + } + } + + + } +} diff --git a/PROMS/fmtxml/FmtFileToXml.cs b/PROMS/fmtxml/FmtFileToXml.cs new file mode 100644 index 00000000..f836b49d --- /dev/null +++ b/PROMS/fmtxml/FmtFileToXml.cs @@ -0,0 +1,4841 @@ +using System; +using System.Windows.Forms; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Text.RegularExpressions; +using System.Runtime.Serialization.Formatters.Binary; +using System.Xml.Xsl; +using System.Xml; +using System.Xml.Serialization; +using System.ComponentModel; + +#region StructDefinitions +// top of the format. + +// convert ALL rows & columns to points, i.e. a point = 1/72 inch +// the row is set based on 6 rows per inch, i.e. row = input * 72/6, row = input * 12 +// the column is 12 char/inch, i.e. col = input * 72/12, col = input * 6 +[Serializable] +public struct FormatData +{ + public string Name; + public string PurchaseOptions; + //public XtraFlgs XtraFlags; + public VE_Font FontData; + public Symbol[] Symbols; + public GeneralEditor EditData; + public GeneralPrint PrintData; + public Procedure ProcData; + public Section SectData; + public Step[] StepData; + public Box[] BoxData; + public Trans TransData; + public RO ROData; +} +[Flags] +public enum E_PurchaseOptions : uint +{ + ApproveOne = 0x0001, + AccPagination = 0x0002, + LibMaint = 0x0004, + Transfer = 0x0008, + STrees = 0x0010, + DateChgSumRpt = 0x0020, + SetpointUsage = 0x0040, + Replace = 0x0080, + FloppyTransfer = 0x0100, + ApproveGenericBack = 0x0200, + DistributeApproved = 0x0400, + OutsideTransitions = 0x0800, + EnhancedBackgrounds = 0x1000, + EnhancedDeviations = 0x2000, + AutoTableOfContents = 0x4000, + AutoPlacekeeper = 0x8000 +} +[Serializable] +public struct XtraFlgs +{ +#region xtraflags0 + public string DoubleRNOSpace; // from xtra_flag array 0 + public string MixCautionsAndNotes; + // public string MULTILEVELCAUTION; // not migrated used by: ano/bge/sum + public string AlwaysUseExtralines; + public string AlwaysTabNote; + public string AlwaysTabCaution; + // public string CHECKOFFEQUIPMENT; // not used by any format + public string SpecialPageBreakFlag; + // public string INSYNC; // not migraged used by: genplan & scedev + public string DontPaginateOnFirstSubStep; + // public string PRINTONESTEPPERPAGE; // not migrated used by: anos & genplan + public string ImperfectStructure; + public string DontUseHalfLines; + public string FortranFormatNumbers; + public string AllUnits; + public string CapsTransitions; +#endregion +#region xtraflags1 + public string CapTranStep; // from xtra_flag array 1 + // public string BOLDTRANSITIONS; // not migraged used by: ano1 & sum + public string TSTepNoFlag; + public string LowerCaseTranNumber; + //public string UNDERLINESTEPNUMBER // not migraged used by: cpla + public string CondensedChangeBar; + public string DoRevDate; + public string SeparateBox; + public string NumberHighLevelRNO; + // public string STUPIDBLANKRNONUMBERING; //not migrated used by: lpl + // public string BULLETINSTEADOFNUMBERRNO //not migrated used by: sce + // public string BIZZAREINDENTSAVE //not migrated used by: sce + public string AlternateFoldoutPages; + // public string ONLYEXTERNALBOLD; // not migrated pac & sce + //public string DONTSPLITTHESTEPATIF // not migrated used by: sce, vnp, vpe + public string DontTryToFillHalfOfPage; +#endregion +#region xtraflags2 + public string DontCapitalizeTitle; // from xtra_flag array 2 + // public string MOVEPARENSTOTOKEN // not migrated used by: scedev + public string NoSpaceDoubleRNO; + //public string SECTIONTITLES; // not used + public string DontOffsetTab; + public string UpSetpntAftrDash; + public string LowerCaseRevnum; + public string DoNotCompressSteps; + public string ReduceLineAfterNoteAndCaut; + public string RNOSameLevel; + //public string USENOTECAUTIONSEPARATOR; // not migrated: used in genplan + //public string TRUNCATEPROCNMAFTER1STSPACE // not migrated: used in paca & sce + //public string EXTRALINEBEFOREANDAFTERCAUT1 // not migrated: used in mya + public string BoldHighLevelRNO; + public string OneLineBeforeNoteCautionTab; + public string ContinuousChangeBars; +#endregion +#region xtraflags3 // from xtra_flag array 3 + // public string DONTDOLINEAFTERENDMESS // not migrated: used in ano1 + // public string ENDAFTERBOXEDSTEP // not migrated: used in ano1 + public string CheckOffOnAllSteps; + // public string SPECIALCHANGEBARID // not migrated: used in sce + // public string STEPTABBEFORENOTEANDSTEP // not migrated: used in ano1 + public string DontBoxAC; + //public string OKTOSEPARATESTEPANDTABLE; // no supporting code + public string UseTopContinueMessageAtEnd; + // public string ONLYUSEONELINEFORTOPOFPAGE; // not used + // public string ARROWONTRANS; // not migrated: used in mya + // public string PROCEEDMESS; // not migrated: used in mya + // public string UP1INDENTFOROPTEQUIPLIST; // not migrated: used in mya + // public string UPCASETHETRANSITIONSUBSTEPONLY; // not migrated: used in ano1, ano2 + public string UpcaseTranAnd; + public string UpcaseAllSetpointUnits; + // public string OBSERVENOTECAUTIONTRAN; // not used +#endregion +#region xtraflags4 + public string Dev_Format; // from xtra_flag array 4 + // public string UPURS; // not migrated: used in yae + public string DontDoSTExtraAtTop; + public string Xlines_StepFix; + public string ReBoxCautNote; + public string IMMStepSpcHdr; + // public string GENLESSONPLAN; // not migrated: used in genplan + public string FloatingContinueMessage; + // public string STATREESONACCPAGE; // not migrated: used in status tress (lots of formats) + public string AbsoluteFixedChangeColumn; + // public string QUESTIONTRANSSTEP; // not migrated: used in sce + public string LJBorderlessTable; + public string SuppressAndInTran; + public string CapHighSetpnt; + // public string CAPFIRSTLETTERINHIGHSP // not migrated: used in fpl + public string CapsPIFLastLower; +#endregion +#region xtraflags5 + public string AlternateFloatingFoldout; // from xtra_flag array 5 + public string WrapSameAsEdit; + public string KeepStepsOnPage; + public string SpecifiedSubstepsOnly; + public string ThreeBlanksAboveNotesCautions; + // public string DONTADDUNITTOREV // not migrated: used in paca + public string ImperfectSubstep; + public string DontBreakOnSections; + public string NoStepNumIfOnlyOneStep; + public string ShowSectionTitles; + public string LJTabs; + public string DontNumberRNOSubs; + // public string ALIGNNOTECAUTWTAB // not used + // public string RNOCONTINUESTEP // not migrated: used in sum + public string DropCheckOff; + public string NoCheckOffsInRNO; +#endregion +#region xtraflags6 + // from xtra_flag array 6 + public string ChgBarMessageFromEdit; + public string ChangeBarToRNOSep; + // public string SMALLACBOX // not migrated: used in lpl + public string ChangeStyleForEverySection; + public string SectionLevelFoldouts; + public string BoxContinousActions; + public string DoSectionTrans; + // public string DONTUSESECNUMBERS // not used + public string UpSpIfPrevUpper; + public string ContinueSectionHeader; + public string GlobalProcInfo; + public string CompressHPSub; + public string BulletOnContinuous; + public string CancelSecTitlesOnS2; + public string NoEndForSingle; + public string UseMetaSections; +#endregion +#region xtraflags7 + public string RNOContinueOnly; // from xtra_flag array 7 + public string Cap1stCharTrans; + public string DontPaginateOnFirstSubstep3X; + public string RNOSepAfterAER; + public string RevDateWithForwardSlash; + // public string UPSETPNTAFTRCAPS // not migrated: used in sum + public string UseAlternateStepBox; + public string CancelSecTitlesOnS1; + public string SpecialStepsFoldout; + public string UnderlineAfterDashSpace; + public string NoSpaceInNoteOrCaution; + public string UseXtraRevNumber; + public string UnderlineSetpoints; + public string DoSectionTransTypeB; + public string PaginateOnLowerStepLevel; + public string UseTransitionModifier; +#endregion +#region xtraflags8 + public string CustomSpacing; // from xtra_flag array 8 + public string EnhancedShortFormDev; + // public string NOHIGHLEVELREADONLY; // no supporting code + // public string NORNOREADONLY // not used + public string PageBreakOnHighLevelStep; + // public string CHANGEONLYGROUPEDTYPES // not used + public string PageBreakOnCautions; + public string PageBreakOnNotes; + public string AlignNullTabWSectHead; + public string DontUseSecTitles; + public string TextSubFollowsTextStyle; + public string TranProcTitleInParen; + public string HardSpTranProcNumb; + public string TreatAndOrAsSequential; + public string DontSplitStepInPrntStep; + public string LineAboveUnderSection; +#endregion +#region xtraflags9 + // public string REMOVEREDUNDANTSEPERATORS // from xtra_flag array 9 // not used + // public string UNINDENTTABSANDSEPERATORS // not migrated: used in bgeal bgealn bgevl + public string PicaIgnoreFiveSixths; + public string SpaceFoRNOSecNumb; + public string NonEditableSteps; + public string BoxedSubsteps; + public string DontNumberHighLevelSteps; + // public string ASTERISKONIMMEDIATE // not migrated: used in a number of bge fmts + // public string CONTINUEAFTERSTEPTEXT // not used + // public string FIXPAGELISTSPECIALCHARS // not migrated: used in a number of bge fmts + public string NoStepNumberForHighLevelRNO; + public string PromptForCautinType; + public string Caution1SameRowAsParent; + //public string DONTPAGINATEONCAUTION1; // no supporting code + public string WolfCreekBackgroundFormat; + public string EnhancedStepNumFromPrev; +#endregion +#region xtraflags10 + public string ControlUnderlineStyle; // from xtra_flag array 10 + // public string LANDSCAPEMODE // not used + // public string HORIZONTALSUBSTEPS // not migrated: used in ano2vlv & bgevl + public string MultipleChangeIds; + public string UseMultiLineSectionTitle; + // public string SECTIONNOTESCAUTIONS // not migrated: used in anono & various bge + public string PageBreakOnFirstBlankLine; + public string DontPrintNoTitle; + // public string PRINTCAUTION1CONTINUED // not migrated: used in bgeal + // public string USECHECKOFFSINS2 // not used + // public string NOTESTOFOOTNOTES // not migrated: used in ano2vlv, some bge, many rbnd + public string UndSpecialStepsFoldout; + // public string DONTAUTOENDFORMATTING // not migrated: used in various bge + // public string REMOVEBASISFROMTRANS // not migrated: used in various bge + public string PutOnPageByItself; + // public string USEPHONELIST // not migrated: used in bge +#endregion +#region xtraflags11 + public string SecTitleContinue; // from xtra_flag array 11 + public string CancelSecTitlesOnE0; + public string MetaSectEndMessage; + // public string RNONUMBERWITHLEVEL // not migrated: used in bgeeop + // public string FORCELETTEREDHLS // not migrated: used in bgestp + // public string CANCELSECTITLESONE1 // not migrated: used in bgeoid + public string CancelSecTitlesOnE2; + // public string USESECTITLECONTASIS // not used + // public string SMARTLETTEREDHLS // not migrated: used in various bge + // public string DOTWOMESSAGES // not migrated: used in bgeeop + // public string DONTBOLDINTABLES // not migrated: used in bgestp + // public string EXTRALINEAFTERSECTION // not migrated: used in bgestp + // public string BGESTPSPECIALFEAT // not migrated: used in bgestp + public string CompressHPSuper; + // public string PRETENDNOTPROPORTIONAL // not used + // public string DOINGPLACEKEEPERS // not used +#endregion +#region xtraflags12 + public string MatchUpRNOCautNote; // from xtra_flag array 12 + // public string NEWHLSTEPONENTER // not migrated: used in bgevl + // public string DONTSEPARATEMULTITEXT // not migrated: used in bgeop + public string PaginateAtHighestPaginLevel; + // public string DONTRESETINDENTONNEWLINE // not migrated: used in anonop & various bge + // public string CONTINUEMESSONNEXTLINE // not migrated: used in anoann + // public string CAP1STSECTIONTITLE // not migrated: used in anono + // public string DOUBLESPACEHLS // not migrated: used in anoann + public string UseLongProcTitles; + // public string INCLUDENOTEINPLACKEEP // not migrated: used in bgeeop + // public string OUTTRANTOSECTIONSTEP // not used + // public string ANOANNUNCIATORS // not migrated: used in anoann + public string SpecialLandscapeMode; + public string RNOInPagelist; + public string StpCautNoteTabInPagelist; + public string ReadOnlyTypeInContMsg; +#endregion +#region xtraflags13 + public string CenterOneLineOnly; // from xtra_flag array 13 + public string TieTabToLevel; + // public string LEFTJUSTIMMEDIATE // not migrated: used in anoann + public string AccessoryDocsInDuplex; + public string FoldoutsInDuplex; + // public string ABPAGE // not migrated: used in various ano + public string UseSTExtraRealValue; + public string SubTableGetSup1Level; + // public string DONTNUMBERNOTECAUT1 // not migrated: used in anonop + public string DontCountFoldoutPages; + // public string ANONOPHACKS // not migrated: used in anonop + // public string FLOATSECNUMPOS // not migrated: used in bgeoi bgestp + public string SearchAllReplaceWords; + // public string CALVERTCLIFFSFORMATS // not migrated: used in various bge + // public string NOSTUPIDSUBLOGIC // not migrated: used in anonop + // public string REMEMBERRNOSTEP // not migrated: used in bgeeop, rbndan, rbnd +#endregion +#region xtraflags14 + public string RememberCautionsAndNotes; // from xtra_flag array 14 + // public string PUTONPAGEAFTERHALFPAGE // not migrated: used in anonop + // public string FLOATINGSTEPS // not migrated: used in anonop + public string RtfAdjustments; + public string CenterOneLineAdjust; + public string CountAllSubLevels; + // public string AERCHGBARMSGRNOCHGBARNOMSG // not migrated: used in nae + public string DontReplaceWordsInROs; + public string HighLevelRNOBeforeAERSubStps; + public string UnderlineAllMetaTitles; + public string DontBreakCautionsOrNotes; + public string BoldOnlySectionZero; + public string DontBreakOnRNO; + public string RNOCheckOffSameAsParent; + public string UseStepTypeWidthOverride; + public string WolfcreekCKLFormat; +#endregion +#region xtraflags15 + public string DontPaginateOnFirstSubStep2X; // from xtra_flag array 15 + public string UseStepTypeWidthOverrideEditPrint; + public string PartialStepCompression; + public string UseSmartTemplate; + public string CheckoffOnHLSOnly; + // public string KEEPCHANGEIDFORCOPYSTEP // not migrated: used in various ANO + // public string RNOBELOWCHECKOFF // not migrated: used in various RBND + public string Caution2SameRowAsParent; + // public string DONTUNDERLINEMETATITLES // not migrated: used in various RBND + public string CenterTextWithinWidth; + public string DontBreakEquipmentList; + // public string USELOCALTEMPLATEFILE // not migrated: used in various RBND + public string AlwaysTabCaution2; + public string VirtualDotInHLSTab; + public string ImperfectStructurePlus4; + // public string RIVERBENDVALVESHEETS // not migrated: used in various RBND +#endregion +#region xtraflags16 + // public string RIVERBENDPUMPDATASHEET // from xtra_flag array 16 -not migrated: used in various RBND + public string UseRNOTypeInActable; + public string AbsoluteTransitionUpdate; + public string SeparateBoxCautions; + // public string RIVERBENDALARMFORMAT // not migrated: used in RBNDAN + public string HLSTextInPagelist; + // public string HLSCAUT2INPAGELIST // not migrated: used in RBNDAN + public string LowerCaseStepInTran; + // public string DONTCHANGELOWERLIMIT // not migrated: used in BGEALN PAC + // public string UPPERCASESECTIONTITLE // not migrated: used in various RBND + //public string ALGNCOMPRESSSUPERTABLE; // not migrated: no supporting code. + // public string RIVERBENDLINEUPFORMAT // not migrated: used in various RBND + public string ChangeBarsOnLinkedText; + public string QuotedSubsteps; + // public string PROPOVERFLOWLETITHANG // not migrated: used in BGEEOP + // public string TURKEYPOINTBACKGNDFORMAT // not migrated: used in FPLBCK +#endregion +#region xtraflags17 + // public string DRAWCENTERLINE // from xtra_flag array 17 -not migrated: used in BGEEOP + // public string DOVALVEDIVIDER // not migrated: used in ANO2VLV + // public string DOSECTIONOVERUNDERSTRING // not migrated: used in bgeeop, bgevl + public string OverrideEnhancedTabs; + // public string USEREALCOMPRESSED7LPI // not used + public string NoNewlineAfterRNO; + public string DoSectionSeparatorLine; + public string ParensOnExtPagenumTrans; + public string AtLeastTwoDigitsForHLS; + public string DontBreakOptEquipmentList; + public string PagelistChangeIDsWithCommas; + public string DontStartLineWithDash; + public string NoBlankLineBeforeSubstep; + public string DontBreakCautionsNotesOnSubstps; + public string DontConvertCaretToDelta; // handled in data migration +#endregion +#region xtraflags18 + // this was original veairflag, but an extra array element was added to the xtraflags, + // xtraflags[18], since some of the flags were used in other formats. + // public string NOTEAFTERAPPLIEDTEXT // from xtra_flag array 18 -not migrated: used in ata + public string NoRNO; + // public string ALTWFORWARNINGS // not migrated: used in ata, some bge & some rbnd + public string OnlySingleColumn; + // public string NULLBOX // not migrated: used in bgeeop + public string XChngTranSpForHard; + public string WolfcreekCKLBackgndFormat; +#endregion +} +[Serializable] +public struct Symbol +{ + public string Unicode; + public string Desc; +} +[Serializable] +public struct GeneralEditor +{ + public string EMode; + /* Format Flags */ + public string PromptForCautionType; + /* End of format flags */ +} +[Serializable] +public struct GeneralPrint +{ + public Int16 DoPrnDrvrAdjusts; + public string TopOfPageThing; + /* Format flags moved to here.... */ + public string DoRevDate; + public string AlternateFoldoutPages; + public string AlternateFloatingFoldout; + public string SectionLevelFoldouts; + public string RevDateWithForwardSlash; + public string SpecialStepsFoldout; + public string AccessoryDocsInDuplex; + public string FoldoutsInDuplex; + public string PagelistChangeIDsWithCommas; + /* end Format flags */ + public ProcDescr [] ProcDescrList; + public string[] VersionIdText; + public string DuplexBGDirectory; // this may go away?? + public string DuplexDDDirectory; // " " +} +[Serializable] +public struct ProcDescr +{ + public string MatchProcNumber; + public string ProcDescr1; + public string ProcDescr2; +} +//[Serializable] +//public struct GeneralLayout // no data in this category. Comment out +//{ // in case later some data moves to here. + +//} +[Serializable] +public struct Procedure +{ + public Int16 TitleLength; + public Int16 CoverTitleLength; + public string ProcForeColor; + public string ProcBackColor; + public string ProcedureSuffixFlags; + /* Format flags moved to here.... */ + public string CapitalizeTitle; + public string ChangeStyleForEverySection; + public string PrintNoTitle; + public string CountFoldoutPages; + /* End of Format flags */ + public string[] ProcedureSuffix; + public string PSInfFile; + public ChangeBar ChangeBarData; + public CheckOffData CheckOffData; +} +[Serializable] +public struct CheckOffData +{ + public int UseCheckOffsIn; + public sbyte CheckOffAdjustment; + /* Format flags ... */ + public string DropCheckOff; + public string CheckOffOnHLSOnly; //CheckoffOnHLSOnly + /* end of format flags */ + public RightCheckOffBx [] RightCheckOffBoxList; + public CheckOffHeader[] CheckOffHeaderList; + public CheckOff [] CheckOffList; +} +[Serializable] +public struct RightCheckOffBx +{ + public int Index; + public int RightCheckOffBox; +} +[Serializable] +public struct CheckOffHeader +{ + public int Index; + public VE_Font Font; + public string CheckOffHeading; +} +[Serializable] +public struct CheckOff +{ + public int Index; + public byte RightCheckOffChars; + public int CheckOffWidAdjust; + public string RightCheckOffPrompt; +} +[Serializable] +public struct ChangeBar +{ + public string ChangeBarMessage; + public Int16 FixedChangeColumn; // really flags not columns (don't convert to points + public Byte FixedAERChangeColumn; + public long ChangeSummaryStyle; // not really change bar - put here for now. + public long ChangeBarStyle; + public string SpecialChangeBar; + /* Format flags moved to here.... */ + public string CondensedChangeBar; + public string AbsoluteFixedChangeColumn; + public string ContinuousChangeBars; + public string ChgBarMessageFromEdit; + public string MultipleChangeIds; + public string ChangeBarToRNOSep; + public string ChangeBarsOnLinkedText; + /* End of Format flags */ +} +[Flags] +public enum E_ChangeBarMessage : uint +{ + DateAndUserId = 0, + RevNumber = 1, + UserId = 2, + Nothing = 3 +} +[Flags] +public enum E_EMode : uint +{ + Insert = 0, + Override = 1 +} +[Serializable] +public struct Section +{ + public Int16 SectionTitleLength; + public string SectForeColor; + public string SectBackColor; + /* Format Flags moved here... */ + public string CancelSecTitlesOnS1; + public string CancelSecTitlesOnS2; + public string CancelSecTitlesOnE0; + public string CancelSecTitlesOnE2; + public string MetaSectEndMessage; + public string ReadOnlyTypeInContMsg; + public string ReplaceWordsInROs; + public string UseMetaSections; + public string NonEditableSteps; + public string SearchAllReplaceWords; + public string SecTitleContinue; + public string ConvertCaretToDelta; + /* end of Format flags */ + public SectionNum SectionNumber; + public SectionHead SectionHeader; + public StepSection StepSectionData; + public AccSection AccSectionData; + public MetaSection [] MetaSectionData; + public ReplaceStr[] ReplaceStrData; + +} +[Serializable] +public struct SectionNum +{ + public Int16 Pos; + public string Just; + public VE_Font Font; +} +[Serializable] +public struct SectionHead +{ + public Int16 Pos; + public string Just; + public VE_Font Font; +} +[Serializable] +public struct StepSection +{ + public Int16 TopRow; + public byte IndentToken; + public byte NumberOfHighLevelSteps; + public byte NumberOfSubStepTypes; + public Int16 [] TextTypeValue; + public string[] TextType; + public string IdentB; + public string[] UnderlineTerminate; + public string [] ObserveNCString1; + public string[] ObserveNCString2; + /* Format flags moved to here.... */ + public string WolfCreekBackgroundFormat; + public string WolfcreekCKLFormat; + public string WolfcreekCKLBackgndFormat; + public string FortranFormatNumbers; + public string UseTopContinueMessageAtEnd; + public string FloatingContinueMessage; + public string WrapSameAsEdit; + public string ContinueSectionHeader; + public string CompressHPSub; + public string CompressHPSuper; + public string UndSpecialStepsFoldout; + public string UnderlineAllMetaTitles; + public string BoldOnlySectionZero; + public string ImperfectStructure; + public string ImperfectSubstep; + public string ImperfectStructurePlus4; + public string CountAllSubLevels; + public string UseMultiLineSectionTitle; // Need for data migration only + /* end of Format flags */ + public StepSectionLayout StpSectLayData; + public StepSectionEdit StpSectEditData; + public StepSectionPrint StpSectPrtData; + public SeqTabFmt[] SequentialTabFormat; +} +[Serializable] +public struct AccSection +{ + public int AutoContActSumSection; + public TOC TableOfContentsData; +} +[Serializable] +public struct TOC +{ + public Int16 TofCSecNumPos; + public Int16 TofCSecTitlePos; + public byte TofCSecTitleLen; + public Int16 TofCPageNumPos; + public byte TofCSpaceChar; + public byte TofCLineSpacing; + public VE_Font Font; +} +[Serializable] +public struct MetaSection +{ + public int Index; // do I need this to order them or will SecNumPositionAdj work? + public Int16 SecNumPositionAdj; + public Int16 SecTitlePositionAdj; + public Int16 ColSByLevel; + public Int16 TofCPositionAdj; + public Int16 WidSAdjByLevel; +} +[Serializable] +public struct StepSectionLayout +{ + public int LastLineToStartStep; + public Int16 LineDrawingOption; + public Int16 ColS; + public Int16 ColT; + public Int16 ColAbs; + public Int16 WidT; + public Int16 PMode; + public Int16 MaxRNO; + public string MaxRNOTable; + public string ColRTable; + public string WidSTableEdit; + public string WidSTablePrint; + public Int16 AdjRNOCol; + public Int16 EndMessagePos; + public string RNOWidthAlt; + public Int16 HLSWidthOVRD; + public Int16 SubPaginationWght; + public Int16 TextTitleAdjustment; + public string TableCenterPos; + public string LowerLimitDivisor; // pagination - should it be in print? + public string NonLinkedStepNumber; + public string NonLinkedCautNoteNumber; + public string NonLinkedRNONumber; + /* Format flags moved to here.... */ + public string Dev_Format; + public string EnhancedShortFormDev; + public string SpecialPageBreakFlag; + public string PaginateOnFirstSubstep; + public string PaginateOnFirstSubstep2X; + public string UseHalfLines; + public string TryToFillHalfOfPage; + public string CompressSteps; + public string DoSTExtraAtTop; + public string KeepStepsOnPage; + public string BreakOnSections; + public string ShowSectionTitles; + public string EndForSingle; + public string PaginateOnFirstSubstep3X; + public string PaginateOnLowerStepLevel; + public string CustomSpacing; + public string SplitStepInPrntStep; + public string LineAboveUnderSection; + public string PicaIgnoreFiveSixths; + public string SpaceForNoSecNumb; + public string PageBreakOnFirstBlankLine; + public string PutOnPageByItself; + public string PaginateAtHighestPaginLevel; + public string UseSTExtraRealValue; + public string DoSectionSeparatorLine; + public string TieTabToLevel; + public string HighLevelRNOBeforeAERSubsteps; + public string UseStepTypeWidthOverride; + public string UseStepTypeWidthOverrideEditPrint; + public string PartialStepCompression; + public string VirtualDotInHLSTab; + public string OverrideEnhancedTabs; + public string RNO; + public string OnlySingleColumn; + /* End of format flags */ + public VE_Font VertStyle; + public TopOfPg TopOfPage; + public Separtr Separator; +} +[Serializable] +public struct TopOfPg +{ + public Int16 Row; + public Int16 Col; + public VE_Font Font; +} +[Serializable] +public struct Separtr +{ + public Int16 SeparatorLocation; + public VE_Font Font; +} +[Serializable] +public struct StepSectionEdit +{ + public Int16 ColSScreenAdj; + public Int16 ScrnAdjRNOText; + public string ColRScreen; +} +[Serializable] +public struct SeqTabFmt +{ + public int Index; + public int LeftJustify; + public string TabFormat; +} +[Serializable] +public struct StepSectionPrint +{ + public Int16 ImmStepHdrCol; + public Int16 SecColHdrforActPMode; + public string RNOSepString; + public string HLStpSeparatorString; + public string HLRNOStpSeparatorString; + /* Format flags moved to here.... */ + public string LowerCaseRevNum; + public string UseXtraRevNumber; + public string SpecialLandscapeMode; + /* End of format flags */ + public VE_Font ModifiedTextStyle; + public VE_Font ImmStepHdrStyle; + public string[] ImmStepHdr; +} +[Serializable] +public struct ReplaceStr +{ + public string Flag; + public string ReplaceWord; + public string ReplaceWith; +} +[Flags] +public enum E_ReplaceStr : uint +{ + High =0x0001, // Do ReplaceWords in HIGH LEVEL STEPS + RNO =0x0002, // Do ReplaceWords in RNOS + Caution =0x0004, // Do ReplaceWords in CAUTIONS + Note =0x0008, // Do ReplaceWords in NOTES + Table =0x0010, // Do ReplaceWords in TABLES + Substep =0x0020, // Do ReplaceWords in SUBSTEPS + Attach =0x0040, // Do ReplaceWords in ATTACHMENTS + Bkgd =0x0080, // Do ReplaceWords in BACKGROUNDS + DiffUnit =0x0100, // Do ReplaceWords ONLY for different UNIT # + TOC =0x0200, // Do in auto table-of-contents + StatTree =0x0400, + HLSSetpnt =0x0800, // Do ReplaceWords in HighLevelStep SETPoiNTs + Trans =0x1000, // Do ReplaceWords in TRANSITIONS + Setpoint =0x2000, // Do ReplaceWords in SETPOINTS + + // Case Sensitivity Flags - default is off (Case Sensitive Replace) + CaseInsens =0x0000C000, // Do ReplaceWords for all words thatmatch, regardless of case, + // and replace with the ReplaceWith string as is + CaseInsensFirst = 0x4000, // Do ReplaceWords for all words thatexactly match the ReplaceWord, + // except the case of the first character may be different + CaseInsensAll = 0x8000, // Do ReplaceWords for all words that match the ReplaceWord, regardless of case + + Partials =0x10000, // Do replace even on partial matches + Plackeep =0x20000, // Do replace in PlaceKeepers + InSecTitle =0x40000 // replace words in section titles +} +[Serializable] +public struct Step +{ + public int Index; + public string Type; + public string ParentType; + public string StepTypeColOverride; + public string Sep; + public string AlternateName; + public string Prefix; + public string Suffix; + public string UnderlineTheseChar; + public string VertPos; + /* the following are xtraflags that have been moved, string is set to true if plant has flag */ + /* Flag name is listed as comment after each if different than name (change is made if generically used. */ + public string DoubleSpace; //DoubleRNOSpace + public string EnhancedStepNumFromPrev; + public string UseSmartTemplate; + public string AlwaysUseExtraLines; + public string SeparateBox; + public string SeparateBoxCautions; + public string SpaceDouble; // NoSpaceDoubleRNO + public string ReduceLineAfter; // ReduceLineAfterNoteAndCaut + public string SameLevel; // RNOSameLevel + public string BoldHighLevel; // BoldHighLevelRNO + public string OneLineBeforeTab; // OneLineBeforeNoteCautionTab + public string CheckOffOnAllSteps; + public string BoxIt; // DontBoxAC + public string Boxed; // BoxContinuousActions, BoxedSubsteps + public string XLines_StepFix; + public string Rebox; // ReboxCautNote + public string SpcHdr; // ImmStepSpcHdr + public string ContinueOnly; // RNOContinueOnly + public string SepAfterAER; // RNOSepAfterAER + public string UseAlternateStepBox; + public string UnderlineAfterDashSpace; + public string SpaceIn; // NoSpaceInNoteOrCaution + public string PageBreakOnStep; // PageBreakOnHighLevelStep, PageBreakOnCautions, PageBreakOnNotes + public string AlignNullTabWSectHead; + public string TextSubFollowsTextStyle; + public string TreatAsSequential; // TreatAND_ORasSequential + public string MatchUpRNO; // MatchUpRNOCautNote + public string InPageList; // RNOInPageList, StpCautNoteTabInPageList, HLSTextInPageList + public string CenterOneLineOnly; + public string SubTableGetsUp1Level; + public string Remember; // RememberCautionsAndNotes + public string CenterOneLineAdjust; + public string Break; // DontBreakCautionsOrNotes, DontBreakOnRNO, DontBreakOptEquiptmentList + public string BreakEquipmentList; // Need this one as separate from above because differentiate between DontBreakOptEquiptmentList + public string BreakCautionsNotesOnSubstps; + public string CenterTextWithinWidth; + public string NewlineAfter; // NoNewlineAfterRNO + public string StartLineWithDash; + public string BlankLineBeforeSubStep; + public string AlwaysTab; // AlwaysTabNote, AlwaysTabCaution, AlwaysTabCaution2 + public string MixCautionsAndNotes; + public string NumberHighLevel; // NumberHighLevelRNO + public string OffsetTab; + public string LeftJustifyBorderless; // LJBorderlessTable + public string StepNumIfOnlyOne; // NoStepNumIfOnlyOneStep + public string LJTabs; + public string NumberSubs; // DontNumberRNOSubs + public string Bullet; // BulletOnContinuous + public string StepNumberForHighLevel; // NoStepNumberForHighLevelRNO + public string SameRowAsParent; // Caution1SameRowAsParent, Caution2SameRowAsParent + public string CheckoffSameAsParent; // RNOCheckoffSameAsParent + public string AtLeastTwoDigits; // AtLeastTwoDigitsForHLS + public string UseInAcTable; // UseRNOTypeInAcTable + public string Number; // DontNumberHighLevelSteps + public string ThreeBlanksAbove; // ThreeBlanksAboveNotesCautions + public string CheckOffs; // NoCheckOffsInRNO + public string Quoted; // QuotedSubSteps + /* end of xtraflags */ + public VE_Font Font; + public Layout StepLayoutData; + public Edit StepEditData; + public Print StepPrintData; + public Tab TabData; +} +[Serializable] +public struct Edit +{ + public string ForeColor; + public string BackColor; + public string AcTable; +} +[Flags] + // acceptence list for adding Tables, Cautions, Notes, Substeps, Next, Previous and RNO +public enum E_AccStep : uint +{ + AddingCaution = 1, + AddingNote = 2, + AddingRNO = 4, + AddingSub = 8, + AddingTable = 16, + AddingNext = 32, + AddingPrev = 64 +} +[Serializable] +public struct Print +{ + public string ForeColor; + public string BackColor; + public string PosAdjust; +} +[Serializable] +public struct Layout +{ + public string ForeColor; + public string BackColor; + public string STExtraSpace; + public string STBoxindex; + public string EveryNLines; + public string SpaceBefore; // = 0 + public string SpaceAfter; // 1 line (in points) + public string AlwaysUpperCase; + public string PageBreakAtTypeChange; + public string AlignWithParentTab; + public string RtCheckOffGroups; + public string StepTypeWidthOverride; +} +[Serializable] +public struct Tab +{ + public string IdentEdit; + public string Ident; + public string RNOIdentEdit; + public string RNOIdent; + public string IdentEditWid; + public string IdentWid; + public string RNOIdentEditWid; + public string RNOIdentWid; + public string Justify; // from tbstyle - None, CENTER, LEFT, RIGHT + public string CheckOff; // from tbstyle - None, LEFT, RIGHT + public VE_Font Font; +} +[Serializable] +public struct Box +{ + public int Index; + public Int16 Start; + public int End; + public Int16 TxtStart; + public int TxtWidth; + public Int16 Height; + public Int16 TabPos; + public sbyte TxtRowAdj; + public string BXURC; // Upper Right Corner, etc. + public string BXHorz; + public string BXULC; + public string BXVert; + public string BXMLS; + public string BXMRS; + public string BXLRC; + public string BXLLC; + public string BXMID; + public string BXLHorz; + public string BXUMID; + public string BXLMID; + public VE_Font Font; +} +[Serializable] +public struct Trans +{ + public string DelimiterForTransitionTitle; + public string StepSubstepDelimeter; + public string ThroughString; + /* Format flags moved to here.... */ + public string SpecifiedSubstepsOnly; + public string CapsTransitions; + public string CapTranStep; + public string TStepNoFlag; + public string LowerCaseTranNumber; + public string UpcaseTranAnd; + public string SuppressAndInTran; + public string Cap1stCharTrans; + public string UseTransitionModifier; + public string UseSecTitles; + public string HardSpTranProcNumb; + public string XchngTranSpForHard; + public string AbsoluteTransitionUpdate; + public string LowerCaseStepInTran; + public string DoSectionTransitions; + /* End of Format flags */ + public TransTypes[] TransTypeData; +} +[Serializable] +public struct TransTypes +{ + public int Index; + public byte TransType; + public string TransFormat; + public string TransMenu; + public string TransUI; +} +[Serializable] +public struct RO +{ + /* Format flags moved to here.... */ + public string AllUnits; + public string UpRoAftrDash; //UpSetpntAftrDash; + public string UpcaseAllRoUnits; //UpcaseAllSetpointUnits; + public string CapHighRo; //CapHighSetpnt; + public string CapRoIfLastLower; //CapsPIFLastLower; + public string UpRoIfPrevUpper; //UpSpIfPrevUpper + public string UnderlineRo; //UnderlineSetpoints + /* End of Format flags */ +} +[Flags] +public enum E_TransitionMenus : uint +{ + None = 0, + ProcCur = 0x0001, + ProcMenu = 0x0002, + SectCur = 0x0004, + SectDefault = 0x0008, + SectMenuAny = 0x0010, + SectMenuStep = 0x0020, + StepAllowNone = 0x0040, + StepFirst = 0x0080, + StepLast = 0x0100 +} +[Flags] +public enum E_TransFormatXlate : uint +{ + None = 0, + Step = 1, + Range = 2, + Section = 4, + Procedure = 8, + Page = 16 +} + +#endregion + +/////////////////////////// +namespace fmtxml +{ + public class FmtFileToXml + { + #region localdata + public XtraFlgs BaseXtraFlags; // used to set up all flags for the Base format. + public XtraFlgs SubXtraFlags; + public static int MAXSTEPS = 47; + public static int MAXBOXES = 12; + public static int MAXTABS = 20; + public static int MAXTRANS = 15; + public static int MAXCHECKOFFS = 18; + public static int MAXCHKHEADINGS = 5; + public static int MAXSEQ = 9; + public static int MAXREPLACE = 60; + #region XtraFlagBits + // XtraFlag translation fields... + // + // XtraFlag[0] from 16-bit... + public static int DOUBLERNOSPACE = 0x0001; + public static int MIXCAUTIONSANDNOTES = 0x0002; + public static int ALWAYSUSEEXTRALINES = 0x0008; + public static int ALWAYSTABNOTE = 0x0010; + public static int ALWAYSTABCAUTION = 0x0020; + public static int SPECIALPAGEBREAKFLAG = 0x0080; + public static int DONTPAGINATEONFIRSTSUBSTEP = 0x0200; + public static int IMPERFECTSTRUCTURE = 0x0800; + public static int DONTUSEHALFLINES = 0x1000; + public static int FORTRANFORMATNUMBERS = 0x2000; + public static int ALLUNITS = 0x4000; + public static int CAPSTRANSITIONS = 0x8000; + + // XtraFlag[1] from 16-bit... + public static int CAPTRANSTEP = 0x0001; + public static int TSTEPNOFLAG = 0x0004; + public static int LOWERCASETRANNUMBER = 0x0008; + public static int CONDENSEDCHANGEBAR = 0x0020; + public static int DOREVDATE = 0x0040; + public static int SEPARATEBOX = 0x0080; + public static int NUMBERHIGHLEVELRNO = 0x0100; + public static int ALTERNATEFOLDOUTPAGES = 0x1000; + public static int DONTTRYTOFILLHALFOFPAGE = 0x8000; + + // XtraFlag[2] from 16-bit... + public static int DONTCAPITALIZETITLE = 0x0001; + public static int NOSPACEDOUBLERNO = 0x0004; + public static int DONTOFFSETTAB = 0x0010; + public static int UPSETPNTAFTRDASH = 0x0020; + public static int LOWERCASEREVNUM = 0x0040; + public static int DONOTCOMPRESSSTEPS = 0x0080; + public static int REDUCELINEAFTERNOTEANDCAUT = 0x0100; + public static int RNOSAMELEVEL = 0x0200; + public static int BOLDHIGHLEVELRNO = 0x2000; + public static int ONELINEBEFORENOTECAUTIONTAB = 0x4000; + public static int CONTINUOUSCHANGEBARS = 0x8000; + + // XtraFlag[3] from 16-bit... + public static int CHECKOFFONALLSTEPS = 0x0004; + public static int DONTBOXAC = 0x0020; + public static int USETOPCONTINUEMESSAGEATEND = 0x0080; + public static int UPCASETRANAND = 0x2000; + public static int UPCASEALLSETPOINTUNITS = 0x4000; + + // XtraFlag[4] from 16-bit... + public static int DEV_FORMAT = 0x0001; + public static int DONTDOSTEXTRAATTOP = 0x0004; + public static int XLINES_STEPFIX = 0x0008; + public static int REBOXCAUTNOTE = 0x0010; + public static int IMMSTEPSPCHDR = 0x0020; + public static int FLOATINGCONTINUEMESSAGE = 0x0080; + public static int ABSOLUTEFIXEDCHANGECOLUMN = 0x0200; + public static int LJBORDERLESSTABLE = 0x0800; + public static int SUPPRESSANDINTRAN = 0x1000; + public static int CAPHIGHSETPNT = 0x2000; + public static int CAPSPIFLASTLOWER = 0x8000; + + // XtraFlag[5] from 16-bit... + public static int ALTERNATEFLOATINGFOLDOUT = 0x0001; + public static int WRAPSAMEASEDIT = 0x0002; + public static int KEEPSTEPSONPAGE = 0x0004; + public static int SPECIFIEDSUBSTEPSONLY = 0x0008; + public static int THREEBLANKSABOVENOTESCAUTIONS = 0x0010; + public static int IMPERFECTSUBSTEP = 0x0040; + public static int DONTBREAKONSECTIONS = 0x0080; + public static int NOSTEPNUMIFONLYONESTEP = 0x0100; + public static int SHOWSECTIONTITLES = 0x0200; + public static int LJTABS = 0x0400; + public static int DONTNUMBERRNOSUBS = 0x0800; + public static int DROPCHECKOFF = 0x4000; + public static int NOCHECKOFFSINRNO = 0x8000; + + // XtraFlag[6] from 16-bit... + + public static int CHGBARMESSAGEFROMEDIT = 0x0001; + public static int CHANGEBARTORNOSEP = 0X0002; + public static int CHGSTYLEPERSECTION = 0x0008; + public static int SECTIONLEVELFOLDOUTS = 0x0010; + public static int BOXCONTACTIONS = 0x0020; + public static int DOSECTIONTRANS = 0x0040; + public static int UPSPIFPREVUPPER = 0x0100; + public static int CONTINUESECTIONHEADER = 0x0200; + public static int GLOBALPROCINFO = 0x0400; + public static int COMPRESSHPSUB = 0x0800; + public static int BULLETONCONTINUOUS = 0x1000; + public static int CANCELSECTITLESONS2 = 0x2000; + public static int NOENDFORSINGLE = 0x4000; + public static int USEMETASECTIONS = 0x8000; + + // XtraFlag[7] from 16-bit... + + public static int RNOCONTINUEONLY = 0x0001; + public static int CAP1STCHARTRANS = 0x0002; + public static int DONTPAGINATEONFIRSTSUBSTEP3X = 0x0004; + public static int RNOSEPAFTERAER = 0x0008; + public static int REVDATEWITHFORWARDSLASH = 0x0010; + public static int USEALTERNATESTEPBOX = 0x0040; + public static int CANCELSECTITLESONS1 = 0x0080; + public static int SPECIALSTEPSFOLDOUT = 0x0100; + public static int UNDERLINEAFTERDASHSPACE = 0x0200; + public static int NOSPACEINNOTEORCAUTION = 0x0400; + public static int USEXTRAREVNUMBER = 0x0800; + public static int UNDERLINESETPOINTS = 0x1000; + public static int DOSECTIONTRANSTYPEB = 0x2000; + public static int PAGINATEONLOWERSTEPLEVEL = 0x4000; + public static int USETRANSITIONMODIFIER = 0x8000; + + // XtraFlag[8] from 16-bit... + + public static int CUSTOMSPACING = 0x0001; + public static int ENHANCEDSHORTFORMDEV = 0x0002; + public static int PAGEBREAKONHIGHLEVELSTEP = 0x0010; + public static int PAGEBREAKONCAUTIONS = 0X0040; + public static int PAGEBREAKONNOTES = 0X0080; + public static int ALIGNNULLTABWSECTHEAD = 0X0100; + public static int DONTUSESECTITLES = 0x0200; + public static int TEXTSUBFOLLOWSTEXTSTYLE = 0x0400; + public static int TRANSPROCTITLEINPAREN = 0x0800; + public static int HARDSPTRANPROCNUMB = 0x1000; + public static int TREATANDORASSEQUENTIAL = 0x2000; + public static int DONTSPLITSTEPINPRNTSTEP = 0x4000; + public static int LINEABOVEUNDERSECTION = 0x8000; + + // XtraFlag[9] from 16-bit... + + public static int PICAIGNOREFIVESIXTHS = 0x0004; + public static int SPACEFORNOSECNUMB = 0x0008; + public static int NONEDITABLESTEPS = 0x0010; + public static int BOXEDSUBSTEPS = 0x0020; + public static int DONTNUMBERHIGHLEVELSTEPS = 0x0040; + public static int NOSTEPNUMBERFORHIGHLEVELRNO = 0x0400; + public static int PROMPTFORCAUTINTYPE = 0x0800; + public static int CAUTION1SAMEROWASPARENT = 0x1000; + public static int WOLFCREEKBACKGROUNDFORMAT = 0x4000; + public static int ENHANCEDSTEPNUMFROMPREV = 0x8000; + + // XtraFlag[10] from 16-bit... + + public static int CONTROLUNDERLINESTYLE = 0x0001; + public static int MULTIPLECHANGEIDS = 0x0008; + public static int USEMULTILINESECTIONTITLE = 0x0010; + public static int PAGEBREAKONFIRSTBLANKLINE = 0x0040; + public static int DONTPRINTNOTITLE = 0x0080; + public static int UNDSPECIALSTEPSFOLDOUT = 0x0800; + public static int PUTONPAGEBYITSELF = 0x4000; + + // XtraFlag[11] from 16-bit... + + public static int SECTITLECONTINUE = 0x0001; + public static int CANCELSECTITLESONE0 = 0x0002; + public static int METASECTENDMESSAGE = 0x0004; + public static int CANCELSECTITLESONE2 = 0x0040; + public static int COMPRESSHPSUPER = 0x2000; + + // XtraFlag[12] from 16-bit... + + public static int MATCHUPRNOCAUTNOTE = 0x0001; + public static int PAGINATEATHIGHESTPAGINLEVEL = 0x0008; + public static int USELONGPROCTITLES = 0x0100; + public static int SPECIALLANDSCAPEMODE = 0x1000; + public static int RNOINPAGELIST = 0x2000; + public static int STPCAUTNOTETABINPAGELIST = 0x4000; + public static int READONLYTYPEINCONTMSG = 0x8000; + + // XtraFlag[13] from 16-bit... + + public static int CENTERONELINEONLY = 0X0001; + public static int TIETABTOLEVEL = 0x0002; + public static int ACCESSORYDOCSINDUPLEX = 0x0008; + public static int FOLDOUTSINDUPLEX = 0x0010; + public static int USESTEXTRAREALVALUE = 0x0040; + public static int SUBTABLEGETSUP1LEVEL = 0x0080; + public static int DONTCOUNTFOLDOUTPAGES = 0x0200; + public static int SEARCHALLREPLACEWORDS = 0x1000; + + // XtraFlag[14] from 16-bit... + + public static int REMEMBERCAUTIONSANDNOTES = 0x0001; + public static int RTFADJUSTMENTS = 0x0008; + public static int CENTERONELINEADJUST = 0x0010; + public static int COUNTALLSUBLEVELS = 0x0020; + public static int DONTREPLACEWORDSINROS = 0x0080; + public static int HIGHLEVELRNOBEFOREAERSUBSTPS = 0x0100; + public static int UNDERLINEALLMETATITLES = 0x0200; + public static int DONTBREAKCAUTIONSORNOTES = 0x0400; + public static int BOLDONLYSECTIONZERO = 0x0800; + public static int DONTBREAKONRNO = 0x1000; + public static int RNOCHECKOFFSAMEASPARENT = 0x2000; + public static int USESTEPTYPEWIDTHOVERRRIDE = 0x4000; + public static int WOLFCREEKCKLFORMAT = 0x8000; + + // XtraFlag[15] from 16-bit... + + public static int DONTPAGINATEONFIRSTSUBSTEP2X = 0x0001; + public static int USESTEPTYPEWIDTHOVERRRIDEEDITPRINT = 0x0002; + public static int PARTIALSTEPCOMPRESSION = 0x0004; + public static int USESMARTTEMPLATE = 0x0008; + public static int CHECKOFFONHLSONLY = 0x0010; + public static int CAUTION2SAMEROWASPARENT = 0x0080; + public static int CENTERTEXTWITHINWIDTH = 0x0200; + public static int DONTBREAKEQUIPMENTLIST = 0x0400; + public static int ALWAYSTABCAUTION2 = 0x1000; + public static int VIRTUALDOTINHLSTAB = 0x2000; + public static int IMPERFECTSTRUCTUREPLUS4 = 0x4000; + + // XtraFlag[16] from 16-bit... + + public static int USERNOTYPEINACTABLE = 0x0002; + public static int ABSOLUTETRANSITIONUPDATE = 0x0004; + public static int SEPARATEBOXCAUTIONS = 0x0008; + public static int HLSTEXTINPAGELIST = 0x0020; + public static int LOWERCASESTEPINTRAN = 0x0080; + public static int CHANGEBARSONLINKEDTEXT = 0X1000; + public static int QUOTEDSUBSTEPS = 0x2000; + + // XtraFlag[17] from 16-bit... + + public static int OVERRIDEENHANCEDTABS = 0x0008; + public static int NONEWLINEAFTERRNO = 0x0020; + public static int DOSECTIONSEPARATORLINE = 0x0040; + public static int PARENSONEXTPAGENUMTRANS = 0x0080; + public static int ATLEASTTWODIGITSFORHLS = 0x0100; + public static int DONTBREAKOPTEQUIPMENTLIST = 0x0200; + public static int PAGELISTCHANGEIDSWITHCOMMAS = 0x0400; + public static int DONTSTARTLINEWITHDASH = 0x0800; + public static int NOBLANKLINEBEFORESUBSTEP = 0x1000; + public static int DONTBREAKCAUTIONSNOTESONSUBSTPS = 0x2000; + public static int DONTCONVERTCARETTODELTA = 0x4000; + + // XtraFlag[18] (was VEAIRFLAG) from 16-bit... + public static int NORNO = 0x0002; + public static int ONLYSINGLECOLUMN = 0x0008; + public static int XCHNGTRANSPFORHARD = 0x0020; + public static int WOLFCREEKCKLBACKGNDFORMAT = 0x0040; + #endregion + // use the following to define which step the AlternateStepType data is associated with. + // i.e. look in new.def to determine the #defines for the original step type associated + // with the name of the define. + // (ALT_HIGH, ALT_CONTINUOUS, ALT_IMMEDIATE, ALT_LOSSOFAC, ALT_HIGH5) + private int[] altsteps = { 1, 8, 2, 17, 40 }; + + // use the following to define which step the AlternateSubType data is associated with. + // (see above) (ALT_STANDARD, ALT_AND, ALT_OR, ALT_EQUIPMENTLIST, ALT_EQUIPMENTWBLANK, ALT_EXPLICITAND + private int[] altsubsteps = {0, 3, 4, 10, 13, 18, + // ALT_IMPLICITOR, ALT_PARAGRAPH, ALT_EQUIPMENTOPT, ALT_EQUIPMENTOPTWBLANK, ALT_TITLEWITHTEXTRIGHT + 34, 23, 29, 30, 41, + // ALT_TITLEWITHTEXTBELOW, ALT_CONTACSEQUENTIAL, ALT_CONTACAND, ALT_CONTACOR, ALT_CONTACPARAGRAPH + 42, 43, 44, 45, 46}; + + private string[] StepTypes = { + "Base", "Substep","High","Immediate","And","Or","Caution","Note","Table","Continuous", + "AERTable","EquipmentList","Title","PageNumber","EquipmentWBlank","ProcNumber", + "RevNumber","AccPages","LossOfAC","ExplicitAnd","Caution1","Caution2", + "Note1","Note2","Paragraph","Default","Note3","Caution3","Note4","Caution4", + "EquipmentOpt","EquipmentOptWBlank","Note5","BorderlessAERTable","BorderlessTable", + "ImplicitOr","Figure","AERFigure","BorderlessFigure","BorderlessAERFigure", + "RNOType","High5","TitleWithTextRight","TitleWithTextBelow", + "ContAcSequential","ContAcAnd","ContAcOr","ContAcParagraph" + }; + private string[] ParentTypes = { + "", "Base","Base","High","Base","Base","Base","Base","Base","High", + "Table","Base","Base","Title","EquipmentList","Title", + "Title","Base","High","And","Caution","Caution", + "Note","Note","Base","Base","Note","Caution","Note","Caution", + "EquipmentList","EquipmentWBlank","Note","AERTable","Table", + "Or","Table","Figure","Figure","AERFigure", + "Base","High","Title","Title", + "Base","And","Or","Paragraph" + }; + /* + * from the 16-bit code, the following step type attributes/strings were defined. This was found in \promnt\lib\edit\slectyp.c + * High level types: + * "High Level Step","Continuous Action Step","Immediate Action Step","Boxed High Level Step","Alternate High Level Step" + * int far HighTypeValue[]={HIGH,CONTINUOUS,IMMEDIATE,LOSSOFAC,HIGH5}; + * Substep types: + * char *SubType[NBRSUB]={ + * "Sequential", + * "AND", + * "OR", + * "Equipment List", + * "Equipment Preceded by Blank Line", + * "Explicit AND", + * "Implicit OR", + * "Paragraph", + * "Optional Equipment List", + * "Optional Equipment with Blank Line", + * "Continuous Action Sequential", + * "Continuous Action AND", + * "Continuous Action OR", + * "Continuous Action Paragraph", + * "Title With Text To The Right", + * "Title With Text Placed Below" + * int SubTypeValue[NBRSUB]={STANDARD,AND,OR,EQUIPMENTLIST,EQUIPMENTWBLANK,EXPLICITAND,IMPLICITOR,PARAGRAPH, + * EQUIPMENTOPT,EQUIPMENTOPTWBLANK,CONTACSEQUENTIAL,CONTACAND,CONTACOR,CONTACPARAGRAPH,TITLEWITHTEXTRIGHT,TITLEWITHTEXTBELOW + * + */ + private string[] WinColors = + { + "black","blue","green","cyan","red","magenta", + "brown","lightgray","darkgray","ligthblue", + "lightgreen","lightcyan","lightred","lightmagenta", + "yellow","white" + }; + /* + * The ?. characters have been added to the DefaultTransStr. This string is used in the + * code to determine the text that gets resolved for a transition. + * + * ?. means the following (for !section transitions) + * for proc - if current, don't put out text, if !current, put out text + * for sect - if curproc: if cursect, don't put out text; if !cursect, put out text + * if !curproc: if default sect, don't put out text; if !default sect, put out text + */ + private string[] DefaultTransStr = + { + "{Proc Num}, {Proc Title}, Step {First Step}", + "{First Step}", + "{First Step}, {.}, {.}, {.} and {Last Step}", + "{First Step} thru {Last Step} of {?.Proc Num}, {?.Proc Title}, {?.Sect Hdr}", + "{?.Sect Title}, Step {First Step}", + "{Proc Num}, {Proc Title}, {?.Sect Hdr}, Step {First Step}" + }; + + #region SectionTransitionVariables + private string DefaultSectionTransStrTypeB = "{Sect Num}, {Sect Title}, {First Step}"; + private string DefaultSectionTransStrTypeBNone = "{Sect Hdr}, Step {SectNum}{First Step}"; //original + private string[] DefaultSectionTransFormatStr = + { + "{Proc Num}, {Proc Title}, Step {Sect Num}{First Step}", + "{Sect Num}{First Step}", + "{Sect Num}{First Step}, {.}, {.}, {.} and {Sect Num}{Last Step}", + "{Sect Num}{First Step} thru {Sect Num}{Last Step}", + "{Sect Num}, Step {?.Sect Num}{First Step}", + "{Sect Hdr}, Step {SectNum}{First Step}" + }; + // made up the following strings so that the token processing for setting + // up the menu enums would work as expected. These are only used in this migration + // code to set up the enums. The above (DefaultSectionTransFormatStr) is used for + // the actual formatting of the strings in the new code. + private string[] DefaultSectionTransTokenStr = + { + "{Proc Num}, {Proc Title}, Step {First Step}", + "{First Step} ( Within the current section )", + "{First Step}, {.}, {.}, {.} and {Last Step}", + "{Sect Num}{First Step} thru {Sect Num}.{Last Step}", + "{Sect Num}{First Step} ( To a different section )", + "{Sect Num}{First Step}, {Sect Title} ( To a different section )" + }; + + #endregion + + private Int16[] Tabindx; + private BinaryReader brFmt; + private string fmtName; + + private static Dictionary dicChar; + #endregion + public FormatData BaseFormat; + public bool HasBase; + public FormatData MyFormat; + public FmtFileToXml(FmtFileToXml gendata, string nm) + { + if (gendata == null) + HasBase = false; + else + { + HasBase = true; + BaseFormat = gendata.MyFormat; + } + BuildDictionaryText(); + fmtName = nm; + //if (fmtName.ToUpper() != "OHLP" && fmtName.ToUpper() != "BASE") return; + try + { + LoadFormatFile(nm + ".fmt", ref SubXtraFlags); + } + catch (Exception ex) + { + MessageBox.Show("Format name FAILED = " + nm, ex.Message); + } + } + #region GetBinaryReaderData + private byte[] GetByteArray(BinaryReader br, int len) + { + byte[] input; // = new byte[len + 1]; + input = br.ReadBytes(len); + return input; + } + + public static Regex Reg2; + public static void BuildDictionaryText() + { + #region ExtraUnicodeConvert + dicChar = new Dictionary(); + // note that the following characters needed adjusted, i.e. the + // default conversion to unicode did not result in the desired letter, + // so an extra conversion was needed. + dicChar[966] = 216; // dist zero + dicChar[201] = 274; // capital E with macron (line above) + dicChar[127] = 916; // delta + dicChar[964] = 947; // little gamma + dicChar[920] = 952; // little theta + dicChar[915] = 961; // little rho + dicChar[191] = 964; // little tau + dicChar[8801] = 8773; // approx. equal + dicChar[8734] = 8857; // circle w/ dot + dicChar[7] = 9679; // bullet + dicChar[8976] = 9830; // diamond + // dicChar[15] = 167; // grave 15=F; 167=xA7 + #endregion + #region DefinedLineDrawChars + // do all of the box/line draw characters to unicode. These were part + // of the Volian Line Draw font. + dicChar[179] = 9474; // b3 + dicChar[180] = 9508; // b4 + dicChar[181] = 9569; + dicChar[182] = 9570; + dicChar[183] = 9558; + dicChar[184] = 9557; + dicChar[185] = 9571; // b9 + dicChar[186] = 9553; // ba + dicChar[187] = 9559; + dicChar[188] = 9565; + dicChar[189] = 9564; + dicChar[190] = 9563; + dicChar[191] = 9488; + dicChar[192] = 9492; // c0 + dicChar[193] = 9524; + dicChar[194] = 9516; + dicChar[195] = 9500; + dicChar[196] = 9472; + dicChar[197] = 9532; // C5 + dicChar[198] = 9566; + dicChar[199] = 9567; + dicChar[200] = 9562; + dicChar[201] = 9556; + dicChar[202] = 9577; // ca + dicChar[203] = 9574; + dicChar[204] = 9568; + dicChar[205] = 9552; + dicChar[206] = 9580; + dicChar[207] = 9575; + dicChar[208] = 9576; // d0 + dicChar[209] = 9572; + dicChar[210] = 9573; + dicChar[211] = 9561; + dicChar[212] = 9560; + dicChar[213] = 9554; // d5 + dicChar[214] = 9555; + dicChar[215] = 9579; + dicChar[216] = 9578; + dicChar[217] = 9496; + dicChar[218] = 9484; // da + dicChar[219] = 9608; + dicChar[220] = 9604; + dicChar[221] = 9612; + dicChar[222] = 9616; + dicChar[223] = 9600; + #endregion + #region StyleTokens + + /* + * char AttrOnList[7] = {0xd3,0xd5,0xae,0xb2,SUBSCRIPT_ON,SUPERSCRIPT_ON,0}; + char AttrOffList[7] = {0xd4,0xd6,0xaf,0xdd,SUBSCRIPT_OFF,SUPERSCRIPT_OFF,0}; + int AttrList[7] = {BUNDERLINE_WORD, BOLD_WORD, UNDERLINE_WORD, + ITALICS_WORD, SUBSCRIPT_WORD, SUPERSCRIPT_WORD,0}; + + dicChar[13] = 213; //bold on 13=D -> 213=xD5 + //bold off ?? -> 214=xD6 + dicChar[16] = 244; //underline on 16=x10 -> 244=xF4 + //underline off ?? -> 246=xF6 + //bold&uline on ?? -> 211=xD3 + //bold/uline off ?? -> 212=xD4 + dicChar[18] = 198; //superscript on 18=x12 -> 108=xC6 + //superscript off ?? -> 109=xc7 + dicChar[19] = 209; //subscript on 19=x13 -> 209=D9 + //subscript off ?? -> 166->xA6 + + + // see exe\edit\vestdstp.c for some of these.... + dicChar[1] = 161; //Bold word or toggle + dicChar[2] = 162; //Underline word + // not used except in TRANSITIONS dicChar[3] = 164; //Bold/Uline word + // not used except in TRANSITIONS dicChar[4] = 165; //Italics word + dicChar[5] = 111; //Bold/Italics word + dicChar[6] = 111; //Bold/Uline word + //dicChar[7] = 111; //Bold/Uline/Italics word + dicChar[8] = 111; //super word + dicChar[9] = 111; + dicChar[10] = 111; + dicChar[11] = 111; + dicChar[12] = 111; + dicChar[14] = 111; + // ... 9-15 + dicChar[16] = 111; //subscript word + dicChar[17] = 111; + // ... 17-31 + dicChar[20] = 162; + dicChar[21] = 162; + dicChar[22] = 162; // toggle underline + dicChar[25] = 163; //subscript on 25=x19; 163=xA3 + dicChar[24] = 122; //subscript off (0x18) + dicChar[23] = 123; // underline next word + dicChar[31] = 163; + dicChar[26] = 163; + dicChar[27] = 163; + dicChar[28] = 163; + dicChar[29] = 163; + dicChar[30] = 163; + * */ +#endregion + + char[] creg = new char[dicChar.Count]; + int i = 0; + foreach (int ic in dicChar.Keys) + { + creg[i] = (char)ic; + i++; + } + Reg2 = new Regex("[" + new string(creg) + "]"); + } + public static string ReplaceChars(Match m) + { + char[] cs = m.Value.ToCharArray(); + for (int i = 0; i < cs.Length; i++) + { + if (dicChar.ContainsKey((int)(cs[i]))) + { + int iKey = (int)cs[i]; + int iValue = dicChar[iKey]; + //if(iKey<32 && iKey!=7)Console.WriteLine(" {0} {1} {2} {3}", iKey, (char)iKey, iValue, (char)iValue); + cs[i] = (char)iValue; + } + } + return new string(cs); + } + public static string ConvertText(string s1) + { + string s2 = Reg2.Replace(s1, new MatchEvaluator(ReplaceChars)); + return s2; + } + private string GetStringFromByteNoConvert(Byte[] barray, int offset) + { + offset--; + StringBuilder inpstr = new StringBuilder(); + byte input = 0; + int cnt = 0; + bool stillread = true; + do + { + input = barray[offset++]; + if (input == 0) stillread = false; + inpstr.Append(Convert.ToChar(input)); + cnt++; + } while (stillread); + + string retstr = inpstr.ToString(); + retstr = retstr.Replace('<', '{'); + retstr = retstr.Replace('>', '}'); + //retstr = ConvertText(retstr); + if (retstr.Substring(retstr.Length - 1, 1) == "\0") return retstr.Substring(0, retstr.Length - 1); + return retstr; + } + private string GetStringFromByte(Byte[] barray, int offset) + { + offset--; + StringBuilder inpstr = new StringBuilder(); + byte input = 0; + int cnt = 0; + bool stillread = true; + do + { + input = barray[offset++]; + if (input == 0) stillread = false; + inpstr.Append(Convert.ToChar(input)); + cnt++; + } while (stillread); + + string retstr = inpstr.ToString(); + retstr = retstr.Replace('<', '{'); + retstr = retstr.Replace('>', '}'); + retstr = ConvertText(retstr); + if (retstr.Substring(retstr.Length - 1, 1) == "\0") return retstr.Substring(0, retstr.Length - 1); + return retstr; + } + private string GetStringUntilNull(BinaryReader br) + { + StringBuilder inpstr = new StringBuilder(); + byte input = 0; + int cnt = 0; + bool stillread = true; + do + { + try + { + input = br.ReadByte(); + if (input == 0) stillread = false; + inpstr.Append(Convert.ToChar(input)); + } + catch (System.IO.EndOfStreamException) + { + stillread = false; + } + cnt++; + } while (stillread); + + string retstr = inpstr.ToString(); + retstr = retstr.Replace('<', '{'); + retstr = retstr.Replace('>', '}'); + if (retstr.Substring(retstr.Length - 1, 1) == "\0") return retstr.Substring(0, retstr.Length - 1); + return retstr; + } + private string GetString(BinaryReader br, int len) + { + StringBuilder inpstr = new StringBuilder(); + byte input = 0; + int cnt = 0; + do + { + try + { + input = br.ReadByte(); + inpstr.Append(Convert.ToChar(input)); + } + catch (System.IO.EndOfStreamException) + { + input = 0; + while (cnt < len) + { + inpstr.Append(Convert.ToChar(input)); + cnt++; + } + } + cnt++; + } while (cnt < len); + + string retstr = inpstr.ToString(); + retstr = retstr.Replace('<', '{'); + retstr = retstr.Replace('>', '}'); + if (retstr.Substring(retstr.Length - 1, 1) == "\0") return retstr.Substring(0, retstr.Length - 1); + return retstr; + } + #endregion + private VE_Font LoadVE_Font() + { + UInt32 ui = brFmt.ReadUInt32(); + if (ui > 0) + { + VE_Font retval = new VE_Font(ui); + return retval; + } + return null; + } + private VE_Font LoadVE_FontByte() + { + byte bt = brFmt.ReadByte(); + if (bt > 0) + { + VE_Font retval = new VE_Font(Convert.ToUInt32(bt)); + return retval; + } + return null; + } + #region XtraFlags + private void AddFlags(ref XtraFlgs XtraFlags, int i, Int16 flg) + { + if (i == 0) + { + if ((flg & DOUBLERNOSPACE) > 0) XtraFlags.DoubleRNOSpace = true.ToString(); + if ((flg & MIXCAUTIONSANDNOTES) > 0) XtraFlags.MixCautionsAndNotes = true.ToString(); + if ((flg & ALWAYSUSEEXTRALINES) > 0) XtraFlags.AlwaysUseExtralines = true.ToString(); + if ((flg & ALWAYSTABNOTE) > 0) XtraFlags.AlwaysTabNote = true.ToString(); + if ((flg & ALWAYSTABCAUTION) > 0) XtraFlags.AlwaysTabCaution = true.ToString(); + if ((flg & SPECIALPAGEBREAKFLAG) > 0) XtraFlags.SpecialPageBreakFlag = true.ToString(); + if ((flg & DONTPAGINATEONFIRSTSUBSTEP) > 0) XtraFlags.DontPaginateOnFirstSubStep = true.ToString(); + if ((flg & IMPERFECTSTRUCTURE) > 0) XtraFlags.ImperfectStructure = true.ToString(); + if ((flg & DONTUSEHALFLINES) > 0) XtraFlags.DontUseHalfLines = true.ToString(); + if ((flg & FORTRANFORMATNUMBERS) > 0) XtraFlags.FortranFormatNumbers = true.ToString(); + if ((flg & ALLUNITS) > 0) XtraFlags.AllUnits = true.ToString(); + if ((flg & CAPSTRANSITIONS) > 0) XtraFlags.CapsTransitions = true.ToString(); + } + else if (i == 1) + { + if ((flg & CAPTRANSTEP) > 0) XtraFlags.CapTranStep = true.ToString(); + if ((flg & TSTEPNOFLAG) > 0) XtraFlags.TSTepNoFlag = true.ToString(); + if ((flg & LOWERCASETRANNUMBER) > 0) XtraFlags.LowerCaseTranNumber = true.ToString(); + if ((flg & CONDENSEDCHANGEBAR) > 0) XtraFlags.CondensedChangeBar = true.ToString(); + if ((flg & DOREVDATE) > 0) XtraFlags.DoRevDate = true.ToString(); + if ((flg & SEPARATEBOX) > 0) XtraFlags.SeparateBox = true.ToString(); + if ((flg & NUMBERHIGHLEVELRNO) > 0) XtraFlags.NumberHighLevelRNO = true.ToString(); + if ((flg & ALTERNATEFOLDOUTPAGES) > 0) XtraFlags.AlternateFoldoutPages = true.ToString(); + if ((flg & DONTTRYTOFILLHALFOFPAGE) > 0) XtraFlags.DontTryToFillHalfOfPage = true.ToString(); + } + else if (i == 2) + { + if ((flg & DONTCAPITALIZETITLE) > 0) XtraFlags.DontCapitalizeTitle = true.ToString(); + if ((flg & NOSPACEDOUBLERNO) > 0) XtraFlags.NoSpaceDoubleRNO = true.ToString(); + if ((flg & DONTOFFSETTAB) > 0) XtraFlags.DontOffsetTab = true.ToString(); + if ((flg & UPSETPNTAFTRDASH) > 0) XtraFlags.UpSetpntAftrDash = true.ToString(); + if ((flg & LOWERCASEREVNUM) > 0) XtraFlags.LowerCaseRevnum = true.ToString(); + if ((flg & DONOTCOMPRESSSTEPS) > 0) XtraFlags.DoNotCompressSteps = true.ToString(); + if ((flg & REDUCELINEAFTERNOTEANDCAUT) > 0) XtraFlags.ReduceLineAfterNoteAndCaut = true.ToString(); + if ((flg & RNOSAMELEVEL) > 0) XtraFlags.RNOSameLevel = true.ToString(); + if ((flg & BOLDHIGHLEVELRNO) > 0) XtraFlags.BoldHighLevelRNO = true.ToString(); + if ((flg & ONELINEBEFORENOTECAUTIONTAB) > 0) XtraFlags.OneLineBeforeNoteCautionTab = true.ToString(); + if ((flg & CONTINUOUSCHANGEBARS) > 0) XtraFlags.ContinuousChangeBars = true.ToString(); + } + else if (i == 3) + { + if ((flg & CHECKOFFONALLSTEPS) > 0) XtraFlags.CheckOffOnAllSteps = true.ToString(); + if ((flg & DONTBOXAC) > 0) XtraFlags.DontBoxAC = true.ToString(); + if ((flg & USETOPCONTINUEMESSAGEATEND) > 0) XtraFlags.UseTopContinueMessageAtEnd = true.ToString(); + if ((flg & UPCASETRANAND) > 0) XtraFlags.UpcaseTranAnd = true.ToString(); + if ((flg & UPCASEALLSETPOINTUNITS) > 0) XtraFlags.UpcaseAllSetpointUnits = true.ToString(); + } + else if (i == 4) + { + if ((flg & DEV_FORMAT) > 0) XtraFlags.Dev_Format = true.ToString(); + if ((flg & DONTDOSTEXTRAATTOP) > 0) XtraFlags.DontDoSTExtraAtTop = true.ToString(); + if ((flg & XLINES_STEPFIX) > 0) XtraFlags.Xlines_StepFix = true.ToString(); + if ((flg & REBOXCAUTNOTE) > 0) XtraFlags.ReBoxCautNote = true.ToString(); + if ((flg & IMMSTEPSPCHDR) > 0) XtraFlags.IMMStepSpcHdr = true.ToString(); + if ((flg & FLOATINGCONTINUEMESSAGE) > 0) XtraFlags.FloatingContinueMessage = true.ToString(); + if ((flg & ABSOLUTEFIXEDCHANGECOLUMN) > 0) XtraFlags.AbsoluteFixedChangeColumn = true.ToString(); + if ((flg & LJBORDERLESSTABLE) > 0) XtraFlags.LJBorderlessTable = true.ToString(); + if ((flg & SUPPRESSANDINTRAN) > 0) XtraFlags.SuppressAndInTran = true.ToString(); + if ((flg & CAPHIGHSETPNT) > 0) XtraFlags.CapHighSetpnt = true.ToString(); + if ((flg & CAPSPIFLASTLOWER) > 0) XtraFlags.CapsPIFLastLower = true.ToString(); + } + else if (i == 5) + { + if ((flg & ALTERNATEFLOATINGFOLDOUT) > 0) XtraFlags.AlternateFloatingFoldout = true.ToString(); + if ((flg & WRAPSAMEASEDIT) > 0) XtraFlags.WrapSameAsEdit = true.ToString(); + if ((flg & KEEPSTEPSONPAGE) > 0) XtraFlags.KeepStepsOnPage = true.ToString(); + if ((flg & SPECIFIEDSUBSTEPSONLY) > 0) XtraFlags.SpecifiedSubstepsOnly = true.ToString(); + if ((flg & THREEBLANKSABOVENOTESCAUTIONS) > 0) XtraFlags.ThreeBlanksAboveNotesCautions = true.ToString(); + if ((flg & IMPERFECTSUBSTEP) > 0) XtraFlags.ImperfectSubstep = true.ToString(); + if ((flg & DONTBREAKONSECTIONS) > 0) XtraFlags.DontBreakOnSections = true.ToString(); + if ((flg & NOSTEPNUMIFONLYONESTEP) > 0) XtraFlags.NoStepNumIfOnlyOneStep = true.ToString(); + if ((flg & SHOWSECTIONTITLES) > 0) XtraFlags.ShowSectionTitles = true.ToString(); + if ((flg & LJTABS) > 0) XtraFlags.LJTabs = true.ToString(); + if ((flg & DONTNUMBERRNOSUBS) > 0) XtraFlags.DontNumberRNOSubs = true.ToString(); + if ((flg & DROPCHECKOFF) > 0) XtraFlags.DropCheckOff = true.ToString(); + if ((flg & NOCHECKOFFSINRNO) > 0) XtraFlags.NoCheckOffsInRNO = true.ToString(); + } + else if (i == 6) + { + if ((flg & CHGBARMESSAGEFROMEDIT) > 0) XtraFlags.ChgBarMessageFromEdit = true.ToString(); + if ((flg & CHANGEBARTORNOSEP) > 0) XtraFlags.ChangeBarToRNOSep = true.ToString(); + if ((flg & CHGSTYLEPERSECTION) > 0) XtraFlags.ChangeStyleForEverySection = true.ToString(); + if ((flg & SECTIONLEVELFOLDOUTS) > 0) XtraFlags.SectionLevelFoldouts = true.ToString(); + if ((flg & BOXCONTACTIONS) > 0) XtraFlags.BoxContinousActions = true.ToString(); + if ((flg & DOSECTIONTRANS) > 0) XtraFlags.DoSectionTrans = true.ToString(); + if ((flg & UPSPIFPREVUPPER) > 0) XtraFlags.UpSpIfPrevUpper = true.ToString(); + if ((flg & CONTINUESECTIONHEADER) > 0) XtraFlags.ContinueSectionHeader = true.ToString(); + if ((flg & GLOBALPROCINFO) > 0) XtraFlags.GlobalProcInfo = true.ToString(); + if ((flg & COMPRESSHPSUB) > 0) XtraFlags.CompressHPSub = true.ToString(); + if ((flg & BULLETONCONTINUOUS) > 0) XtraFlags.BulletOnContinuous = true.ToString(); + if ((flg & CANCELSECTITLESONS2) > 0) XtraFlags.CancelSecTitlesOnS2 = true.ToString(); + if ((flg & NOENDFORSINGLE) > 0) XtraFlags.NoEndForSingle = true.ToString(); + if ((flg & USEMETASECTIONS) > 0) XtraFlags.UseMetaSections = true.ToString(); + } + else if (i == 7) + { + if ((flg & RNOCONTINUEONLY) > 0) XtraFlags.RNOContinueOnly = true.ToString(); + if ((flg & CAP1STCHARTRANS) > 0) XtraFlags.Cap1stCharTrans = true.ToString(); + if ((flg & DONTPAGINATEONFIRSTSUBSTEP3X) > 0) XtraFlags.DontPaginateOnFirstSubstep3X = true.ToString(); + if ((flg & RNOSEPAFTERAER) > 0) XtraFlags.RNOSepAfterAER = true.ToString(); + if ((flg & REVDATEWITHFORWARDSLASH) > 0) XtraFlags.RevDateWithForwardSlash = true.ToString(); + if ((flg & USEALTERNATESTEPBOX) > 0) XtraFlags.UseAlternateStepBox = true.ToString(); + if ((flg & CANCELSECTITLESONS1) > 0) XtraFlags.CancelSecTitlesOnS1 = true.ToString(); + if ((flg & SPECIALSTEPSFOLDOUT) > 0) XtraFlags.SpecialStepsFoldout = true.ToString(); + if ((flg & UNDERLINEAFTERDASHSPACE) > 0) XtraFlags.UnderlineAfterDashSpace = true.ToString(); + if ((flg & NOSPACEINNOTEORCAUTION) > 0) XtraFlags.NoSpaceInNoteOrCaution = true.ToString(); + if ((flg & USEXTRAREVNUMBER) > 0) XtraFlags.UseXtraRevNumber = true.ToString(); + if ((flg & UNDERLINESETPOINTS) > 0) XtraFlags.UnderlineSetpoints = true.ToString(); + if ((flg & DOSECTIONTRANSTYPEB) > 0) XtraFlags.DoSectionTransTypeB = true.ToString(); + if ((flg & PAGINATEONLOWERSTEPLEVEL) > 0) XtraFlags.PaginateOnLowerStepLevel = true.ToString(); + if ((flg & USETRANSITIONMODIFIER) > 0) XtraFlags.UseTransitionModifier = true.ToString(); + } + else if (i == 8) + { + if ((flg & CUSTOMSPACING) > 0) XtraFlags.CustomSpacing = true.ToString(); + if ((flg & ENHANCEDSHORTFORMDEV) > 0) XtraFlags.EnhancedShortFormDev = true.ToString(); + if ((flg & PAGEBREAKONHIGHLEVELSTEP) > 0) XtraFlags.PageBreakOnHighLevelStep = true.ToString(); + if ((flg & PAGEBREAKONCAUTIONS) > 0) XtraFlags.PageBreakOnCautions = true.ToString(); + if ((flg & PAGEBREAKONNOTES) > 0) XtraFlags.PageBreakOnNotes = true.ToString(); + if ((flg & ALIGNNULLTABWSECTHEAD) > 0) XtraFlags.AlignNullTabWSectHead = true.ToString(); + if ((flg & DONTUSESECTITLES) > 0) XtraFlags.DontUseSecTitles = true.ToString(); + if ((flg & TEXTSUBFOLLOWSTEXTSTYLE) > 0) XtraFlags.TextSubFollowsTextStyle = true.ToString(); + if ((flg & TRANSPROCTITLEINPAREN) > 0) XtraFlags.TranProcTitleInParen = true.ToString(); + if ((flg & HARDSPTRANPROCNUMB) > 0) XtraFlags.HardSpTranProcNumb = true.ToString(); + if ((flg & TREATANDORASSEQUENTIAL) > 0) XtraFlags.TreatAndOrAsSequential = true.ToString(); + if ((flg & DONTSPLITSTEPINPRNTSTEP) > 0) XtraFlags.DontSplitStepInPrntStep = true.ToString(); + if ((flg & LINEABOVEUNDERSECTION) > 0) XtraFlags.LineAboveUnderSection = true.ToString(); + } + else if (i == 9) + { + if ((flg & PICAIGNOREFIVESIXTHS) > 0) XtraFlags.PicaIgnoreFiveSixths = true.ToString(); + if ((flg & SPACEFORNOSECNUMB) > 0) XtraFlags.SpaceFoRNOSecNumb = true.ToString(); + if ((flg & NONEDITABLESTEPS) > 0) XtraFlags.NonEditableSteps = true.ToString(); + if ((flg & BOXEDSUBSTEPS) > 0) XtraFlags.BoxedSubsteps = true.ToString(); + if ((flg & DONTNUMBERHIGHLEVELSTEPS) > 0) XtraFlags.DontNumberHighLevelSteps = true.ToString(); + if ((flg & NOSTEPNUMBERFORHIGHLEVELRNO) > 0) XtraFlags.NoStepNumberForHighLevelRNO = true.ToString(); + if ((flg & PROMPTFORCAUTINTYPE) > 0) XtraFlags.PromptForCautinType = true.ToString(); + if ((flg & CAUTION1SAMEROWASPARENT) > 0) XtraFlags.Caution1SameRowAsParent = true.ToString(); + if ((flg & WOLFCREEKBACKGROUNDFORMAT) > 0) XtraFlags.WolfCreekBackgroundFormat = true.ToString(); + if ((flg & ENHANCEDSTEPNUMFROMPREV) > 0) XtraFlags.EnhancedStepNumFromPrev = true.ToString(); + } + else if (i == 10) + { + if ((flg & CONTROLUNDERLINESTYLE) > 0) XtraFlags.ControlUnderlineStyle = true.ToString(); + if ((flg & MULTIPLECHANGEIDS) > 0) XtraFlags.MultipleChangeIds = true.ToString(); + if ((flg & USEMULTILINESECTIONTITLE) > 0) XtraFlags.UseMultiLineSectionTitle = true.ToString(); + if ((flg & PAGEBREAKONFIRSTBLANKLINE) > 0) XtraFlags.PageBreakOnFirstBlankLine = true.ToString(); + if ((flg & DONTPRINTNOTITLE) > 0) XtraFlags.DontPrintNoTitle = true.ToString(); + if ((flg & UNDSPECIALSTEPSFOLDOUT) > 0) XtraFlags.UndSpecialStepsFoldout = true.ToString(); + if ((flg & PUTONPAGEBYITSELF) > 0) XtraFlags.PutOnPageByItself = true.ToString(); + } + else if (i == 11) + { + if ((flg & SECTITLECONTINUE) > 0) XtraFlags.SecTitleContinue = true.ToString(); + if ((flg & CANCELSECTITLESONE0) > 0) XtraFlags.CancelSecTitlesOnE0 = true.ToString(); + if ((flg & METASECTENDMESSAGE) > 0) XtraFlags.MetaSectEndMessage = true.ToString(); + if ((flg & CANCELSECTITLESONE2) > 0) XtraFlags.CancelSecTitlesOnE2 = true.ToString(); + if ((flg & COMPRESSHPSUPER) > 0) XtraFlags.CompressHPSuper = true.ToString(); + } + else if (i == 12) + { + if ((flg & MATCHUPRNOCAUTNOTE) > 0) XtraFlags.MatchUpRNOCautNote = true.ToString(); + if ((flg & PAGINATEATHIGHESTPAGINLEVEL) > 0) XtraFlags.PaginateAtHighestPaginLevel = true.ToString(); + if ((flg & USELONGPROCTITLES) > 0) XtraFlags.UseLongProcTitles = true.ToString(); + if ((flg & SPECIALLANDSCAPEMODE) > 0) XtraFlags.SpecialLandscapeMode = true.ToString(); + if ((flg & RNOINPAGELIST) > 0) XtraFlags.RNOInPagelist = true.ToString(); + if ((flg & STPCAUTNOTETABINPAGELIST) > 0) XtraFlags.StpCautNoteTabInPagelist = true.ToString(); + if ((flg & READONLYTYPEINCONTMSG) > 0) XtraFlags.ReadOnlyTypeInContMsg = true.ToString(); + } + else if (i == 13) + { + if ((flg & CENTERONELINEONLY) > 0) XtraFlags.CenterOneLineOnly = true.ToString(); + if ((flg & TIETABTOLEVEL) > 0) XtraFlags.TieTabToLevel = true.ToString(); + if ((flg & ACCESSORYDOCSINDUPLEX) > 0) XtraFlags.AccessoryDocsInDuplex = true.ToString(); + if ((flg & FOLDOUTSINDUPLEX) > 0) XtraFlags.FoldoutsInDuplex = true.ToString(); + if ((flg & USESTEXTRAREALVALUE) > 0) XtraFlags.UseSTExtraRealValue = true.ToString(); + if ((flg & SUBTABLEGETSUP1LEVEL) > 0) XtraFlags.SubTableGetSup1Level = true.ToString(); + if ((flg & DONTCOUNTFOLDOUTPAGES) > 0) XtraFlags.DontCountFoldoutPages = true.ToString(); + if ((flg & SEARCHALLREPLACEWORDS) > 0) XtraFlags.SearchAllReplaceWords = true.ToString(); + } + else if (i == 14) + { + if ((flg & REMEMBERCAUTIONSANDNOTES) > 0) XtraFlags.RememberCautionsAndNotes = true.ToString(); + if ((flg & RTFADJUSTMENTS) > 0) XtraFlags.RtfAdjustments = true.ToString(); + if ((flg & CENTERONELINEADJUST) > 0) XtraFlags.CenterOneLineAdjust = true.ToString(); + if ((flg & COUNTALLSUBLEVELS) > 0) XtraFlags.CountAllSubLevels = true.ToString(); + if ((flg & DONTREPLACEWORDSINROS) > 0) XtraFlags.DontReplaceWordsInROs = true.ToString(); + if ((flg & HIGHLEVELRNOBEFOREAERSUBSTPS) > 0) XtraFlags.HighLevelRNOBeforeAERSubStps = true.ToString(); + if ((flg & UNDERLINEALLMETATITLES) > 0) XtraFlags.UnderlineAllMetaTitles = true.ToString(); + if ((flg & DONTBREAKCAUTIONSORNOTES) > 0) XtraFlags.DontBreakCautionsOrNotes = true.ToString(); + if ((flg & BOLDONLYSECTIONZERO) > 0) XtraFlags.BoldOnlySectionZero = true.ToString(); + if ((flg & DONTBREAKONRNO) > 0) XtraFlags.DontBreakOnRNO = true.ToString(); + if ((flg & RNOCHECKOFFSAMEASPARENT) > 0) XtraFlags.RNOCheckOffSameAsParent = true.ToString(); + if ((flg & USESTEPTYPEWIDTHOVERRRIDE) > 0) XtraFlags.UseStepTypeWidthOverride = true.ToString(); + if ((flg & WOLFCREEKCKLFORMAT) > 0) XtraFlags.WolfcreekCKLFormat = true.ToString(); + } + else if (i == 15) + { + if ((flg & DONTPAGINATEONFIRSTSUBSTEP2X) > 0) XtraFlags.DontPaginateOnFirstSubStep2X = true.ToString(); + if ((flg & USESTEPTYPEWIDTHOVERRRIDEEDITPRINT) > 0) XtraFlags.UseStepTypeWidthOverrideEditPrint = true.ToString(); + if ((flg & PARTIALSTEPCOMPRESSION) > 0) XtraFlags.PartialStepCompression = true.ToString(); + if ((flg & USESMARTTEMPLATE) > 0) XtraFlags.UseSmartTemplate = true.ToString(); + if ((flg & CHECKOFFONHLSONLY) > 0) XtraFlags.CheckoffOnHLSOnly = true.ToString(); + if ((flg & CAUTION2SAMEROWASPARENT) > 0) XtraFlags.Caution2SameRowAsParent = true.ToString(); + if ((flg & CENTERTEXTWITHINWIDTH) > 0) XtraFlags.CenterTextWithinWidth = true.ToString(); + if ((flg & DONTBREAKEQUIPMENTLIST) > 0) XtraFlags.DontBreakEquipmentList = true.ToString(); + if ((flg & ALWAYSTABCAUTION2) > 0) XtraFlags.AlwaysTabCaution2 = true.ToString(); + if ((flg & VIRTUALDOTINHLSTAB) > 0) XtraFlags.VirtualDotInHLSTab = true.ToString(); + if ((flg & IMPERFECTSTRUCTUREPLUS4) > 0) XtraFlags.ImperfectStructurePlus4 = true.ToString(); + } + else if (i == 16) + { + if ((flg & USERNOTYPEINACTABLE) > 0) XtraFlags.UseRNOTypeInActable = true.ToString(); + if ((flg & ABSOLUTETRANSITIONUPDATE) > 0) XtraFlags.AbsoluteTransitionUpdate = true.ToString(); + if ((flg & SEPARATEBOXCAUTIONS) > 0) XtraFlags.SeparateBoxCautions = true.ToString(); + if ((flg & HLSTEXTINPAGELIST) > 0) XtraFlags.HLSTextInPagelist = true.ToString(); + if ((flg & LOWERCASESTEPINTRAN) > 0) XtraFlags.LowerCaseStepInTran = true.ToString(); + if ((flg & CHANGEBARSONLINKEDTEXT) > 0) XtraFlags.ChangeBarsOnLinkedText = true.ToString(); + if ((flg & QUOTEDSUBSTEPS) > 0) XtraFlags.QuotedSubsteps = true.ToString(); + } + else if (i == 17) + { + if ((flg & OVERRIDEENHANCEDTABS) > 0) XtraFlags.OverrideEnhancedTabs = true.ToString(); + if ((flg & NONEWLINEAFTERRNO) > 0) XtraFlags.NoNewlineAfterRNO = true.ToString(); + if ((flg & DOSECTIONSEPARATORLINE) > 0) XtraFlags.DoSectionSeparatorLine = true.ToString(); + if ((flg & PARENSONEXTPAGENUMTRANS) > 0) XtraFlags.ParensOnExtPagenumTrans = true.ToString(); + if ((flg & ATLEASTTWODIGITSFORHLS) > 0) XtraFlags.AtLeastTwoDigitsForHLS = true.ToString(); + if ((flg & DONTBREAKOPTEQUIPMENTLIST) > 0) XtraFlags.DontBreakEquipmentList = true.ToString(); + if ((flg & PAGELISTCHANGEIDSWITHCOMMAS) > 0) XtraFlags.PagelistChangeIDsWithCommas = true.ToString(); + if ((flg & DONTSTARTLINEWITHDASH) > 0) XtraFlags.DontStartLineWithDash = true.ToString(); + if ((flg & NOBLANKLINEBEFORESUBSTEP) > 0) XtraFlags.NoBlankLineBeforeSubstep = true.ToString(); + if ((flg & DONTBREAKCAUTIONSNOTESONSUBSTPS) > 0) XtraFlags.DontBreakCautionsNotesOnSubstps = true.ToString(); + if ((flg & DONTCONVERTCARETTODELTA) > 0) XtraFlags.DontConvertCaretToDelta = true.ToString(); + } + else if (i == 18) + { + if ((flg & NORNO) > 0) XtraFlags.NoRNO = true.ToString(); + if ((flg & ONLYSINGLECOLUMN) > 0) XtraFlags.OnlySingleColumn = true.ToString(); + if ((flg & XCHNGTRANSPFORHARD) > 0) XtraFlags.XChngTranSpForHard = true.ToString(); + if ((flg & WOLFCREEKCKLBACKGNDFORMAT) > 0) XtraFlags.WolfcreekCKLBackgndFormat = true.ToString(); + } + } + #endregion + #region ReadInFile + private int ColToPoints(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 + } + public bool ReadInFmtFile(ref FormatData fmtdata, ref XtraFlgs XtraFlags) + { + int[] tmpshort3 = new int[3]; + ArrayList stringoffsets = new ArrayList(); + byte tmpbyte; + Int16 tmpshort; + string tmpstr; + try + { + tmpshort = brFmt.ReadInt16(); + fmtdata.Name = GetStringUntilNull(brFmt); + for (int i = 0; i < 3; i++) + { + tmpshort = brFmt.ReadInt16(); + tmpstr = GetStringUntilNull(brFmt); + } + + short vnum = brFmt.ReadInt16(); // number of ints, etc. + long posatints = brFmt.BaseStream.Position; + long tstloc = vnum + posatints; + fmtdata.FontData = new VE_Font(0); + #region LoadInts + tmpbyte = brFmt.ReadByte(); // FirstChar + + // NOTE 16bit had xtraflag as 18 & had a VEAIRFlag. VEAIRFlag actually + // had some flags used in other formats besides it, so these were rolled + // into the xtraflag array just to make conversion easier. + Int16[] xtraflag = new Int16[19]; + for (int i = 0; i < 19; i++) + { + xtraflag[i] = brFmt.ReadInt16(); + AddFlags(ref XtraFlags, i, xtraflag[i]); + } + + fmtdata.PurchaseOptions = ((E_PurchaseOptions)brFmt.ReadInt16()).ToString(); + fmtdata.ProcData.ProcForeColor = "Black"; + fmtdata.ProcData.ProcBackColor = "White"; + fmtdata.EditData = new GeneralEditor(); + fmtdata.EditData.EMode = ((E_EMode)brFmt.ReadInt16()).ToString(); + fmtdata.SectData = new Section(); + fmtdata.SectData.SectForeColor = "Black"; + fmtdata.SectData.SectBackColor = "White"; + fmtdata.SectData.StepSectionData = new StepSection(); + fmtdata.SectData.StepSectionData.TopRow = (Int16)(RowToPoints(brFmt.ReadInt16())); + tmpshort = brFmt.ReadInt16(); // Appendlines - not used. + fmtdata.PrintData = new GeneralPrint(); + fmtdata.PrintData.DoPrnDrvrAdjusts = brFmt.ReadInt16(); + fmtdata.StepData = new Step[MAXSTEPS+1]; // add 1 for the 'BASE' + for (int i = 0; i < MAXSTEPS+1; i++) + { + fmtdata.StepData[i].Type = StepTypes[i]; + fmtdata.StepData[i].ParentType = ParentTypes[i]; + if (i>0)fmtdata.StepData[i].Font = LoadVE_Font(); + } + fmtdata.StepData[0].Font = fmtdata.StepData[1].Font; + for (int i = 1; i < MAXSTEPS+1; i++) + { + Int16 tmpcoli = brFmt.ReadInt16(); + int tmpcol = (tmpcoli & 0x0F00) >> 8; + if (tmpcol > 0 && tmpcol < WinColors.Length) + fmtdata.StepData[i].StepLayoutData.ForeColor = WinColors[tmpcol]; + else + fmtdata.StepData[i].StepLayoutData.ForeColor = "Black"; + tmpcol = (tmpcoli & 0xF); + if (tmpcol > 0 && tmpcol < WinColors.Length) + fmtdata.StepData[i].StepLayoutData.BackColor = WinColors[tmpcol]; + else + fmtdata.StepData[i].StepLayoutData.BackColor = "White"; + } + fmtdata.StepData[0].StepLayoutData.ForeColor = "Black"; + fmtdata.StepData[0].StepLayoutData.BackColor = "White"; + for (int i = 1; i < MAXSTEPS+1; i++) fmtdata.StepData[i].StepLayoutData.STExtraSpace = (RowToPoints(brFmt.ReadInt16())).ToString(); + for (int i = 1; i < MAXSTEPS+1; i++) fmtdata.StepData[i].StepLayoutData.STBoxindex = (brFmt.ReadInt16()).ToString(); + + // Read the tab indexes into a temporary array. Once the tab strings are read + // in the structure's data will be added. + Tabindx = new Int16[MAXSTEPS]; + for (int i = 0; i < MAXSTEPS; i++) Tabindx[i] = brFmt.ReadInt16(); + + for (int i = 1; i < MAXSTEPS+1; i++) + { + fmtdata.StepData[i].StepPrintData = new Print(); + fmtdata.StepData[i].StepPrintData.PosAdjust = ((Int16)(RowToPoints(brFmt.ReadInt16()))).ToString(); + } + + // NOTE a default is added for boxes for the default box for tables, if + // they are boxed. + fmtdata.BoxData = new Box[MAXBOXES+1]; + // 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 + // later + for (int i = 1; i < MAXBOXES+1; i++) fmtdata.BoxData[i].Start = (Int16)(ColToPoints(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++) 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++) 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++) 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++) 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++) tmpshort = brFmt.ReadInt16(); + tmpshort = brFmt.ReadInt16(); // TransitionCautionOffset + for (int i = 1; i < MAXBOXES+1; i++) fmtdata.BoxData[i].Font = LoadVE_Font(); + int tmpint; + for (int i = 1; i < MAXBOXES+1; i++) tmpint = brFmt.ReadInt32(); + for (int i = 0; i < MAXTABS; i++) + { + VE_Font st = LoadVE_Font(); + for (int j = 0; j < MAXSTEPS; j++) + { + if (Tabindx[j] == i) + { + fmtdata.StepData[j+1].TabData.Font = st == null ? null : st.Copy(); + fmtdata.StepData[j+1].TabData.Justify = st == null ? "None" : st.FontJustify; + fmtdata.StepData[j+1].TabData.CheckOff = st == null ? "None" : st.FontCheckOff; + } + } + } + for (int i = 1; i < MAXSTEPS+1; i++) + { + fmtdata.StepData[i].StepEditData.AcTable = ((E_AccStep)brFmt.ReadInt16()).ToString(); + if (fmtdata.StepData[i].StepEditData.AcTable == "0") + fmtdata.StepData[i].StepEditData.AcTable = null; + } + for (int i = 1; i < MAXSTEPS + 1; i++) fmtdata.StepData[i].StepLayoutData.EveryNLines = (brFmt.ReadInt16()).ToString(); + for (int i = 1; i < MAXSTEPS + 1; i++) fmtdata.StepData[i].StepLayoutData.SpaceBefore = "0"; + for (int i = 1; i < MAXSTEPS + 1; i++) fmtdata.StepData[i].StepLayoutData.SpaceAfter = (RowToPoints(1)).ToString(); + for (int i = 1; i < MAXSTEPS + 1; i++) fmtdata.StepData[i].StepLayoutData.AlwaysUpperCase = (brFmt.ReadInt16()).ToString(); + + fmtdata.SectData.StepSectionData.StpSectLayData = new StepSectionLayout(); + fmtdata.SectData.StepSectionData.StpSectLayData.TopOfPage = new TopOfPg(); + fmtdata.SectData.StepSectionData.StpSectLayData.TopOfPage.Font = LoadVE_Font(); + fmtdata.SectData.StepSectionData.StpSectLayData.TopOfPage.Row = (Int16)(RowToPoints(brFmt.ReadInt16())); + fmtdata.SectData.StepSectionData.StpSectLayData.TopOfPage.Col = (Int16)(ColToPoints(brFmt.ReadInt16())); + + fmtdata.SectData.StepSectionData.StpSectPrtData = new StepSectionPrint(); + fmtdata.SectData.StepSectionData.StpSectPrtData.ModifiedTextStyle = LoadVE_Font(); + fmtdata.SectData.StepSectionData.StpSectLayData.Separator = new Separtr(); + fmtdata.SectData.StepSectionData.StpSectLayData.Separator.Font = LoadVE_Font(); + fmtdata.SectData.StepSectionData.StpSectLayData.Separator.SeparatorLocation = brFmt.ReadInt16(); + + for (int i = 1; i < MAXSTEPS + 1; i++) fmtdata.StepData[i].StepLayoutData.PageBreakAtTypeChange = (brFmt.ReadInt16()).ToString(); + fmtdata.SectData.StepSectionData.StpSectLayData.LastLineToStartStep = RowToPoints(brFmt.ReadInt16()); + + /* To do TextTypeValue - not sure how this is used & where to store it, so temporarily read it in */ + fmtdata.SectData.StepSectionData.TextTypeValue = new Int16[10]; + for (int i = 0; i < 10; i++) fmtdata.SectData.StepSectionData.TextTypeValue[i] = brFmt.ReadInt16(); + + for (int i = 0; i < 10; i++) tmpint = brFmt.ReadInt32(); // DontPrintInSection - not used. + + tmpshort = brFmt.ReadInt16(); // LeftMarginReset - not used. + tmpshort = brFmt.ReadInt16(); // OmitErgEopUsage - not used. + + fmtdata.SectData.StepSectionData.StpSectLayData.LineDrawingOption = brFmt.ReadInt16(); + fmtdata.SectData.StepSectionData.StpSectLayData.ColS = (Int16)(ColToPoints(brFmt.ReadInt16())); + + fmtdata.SectData.StepSectionData.StpSectEditData = new StepSectionEdit(); + fmtdata.SectData.StepSectionData.StpSectEditData.ColSScreenAdj = (Int16)(ColToPoints(brFmt.ReadInt16())); + fmtdata.SectData.StepSectionData.StpSectEditData.ScrnAdjRNOText = (Int16)(ColToPoints(brFmt.ReadInt16())); + fmtdata.SectData.StepSectionData.StpSectLayData.ColT = (Int16)(ColToPoints(brFmt.ReadInt16())); + tmpshort = brFmt.ReadInt16(); // Coltincr - not used + tmpshort = brFmt.ReadInt16(); // ColTab - not used + fmtdata.SectData.StepSectionData.StpSectLayData.ColAbs = (Int16)(ColToPoints(brFmt.ReadInt16())); + fmtdata.SectData.StepSectionData.StpSectLayData.WidT = (Int16)(ColToPoints(brFmt.ReadInt16())); + tmpshort = brFmt.ReadInt16(); // WidTab - not used. + fmtdata.SectData.StepSectionData.StpSectLayData.PMode = brFmt.ReadInt16(); + + fmtdata.SectData.StepSectionData.StpSectLayData.MaxRNO = brFmt.ReadInt16(); + + // maxrnotable, colrtable, widstable, and colrscreen all have three values. + for (int i = 0; i < 3; i++) tmpshort3[i] = brFmt.ReadInt16(); + tmpstr = string.Format("{0},{1},{2}", tmpshort3[0], tmpshort3[1], tmpshort3[2]); + fmtdata.SectData.StepSectionData.StpSectLayData.MaxRNOTable = tmpstr; + + for (int i = 0; i < 3; i++) tmpshort3[i] = (Int16)(ColToPoints(brFmt.ReadInt16())); + tmpstr = string.Format("{0},{1},{2}", tmpshort3[0], tmpshort3[1], tmpshort3[2]); + fmtdata.SectData.StepSectionData.StpSectLayData.ColRTable = tmpstr; + + Int16[] tmpshort3a = new Int16[3]; + for (int i = 0; i < 3; i++) + { + tmpshort3[i] = (Int16)(ColToPoints(brFmt.ReadInt16())); + tmpshort3a[i] = (Int16)(ColToPoints(brFmt.ReadInt16())); + } + tmpstr = string.Format("{0},{1},{2}", tmpshort3[0], tmpshort3[1], tmpshort3[2]); + fmtdata.SectData.StepSectionData.StpSectLayData.WidSTableEdit = tmpstr; + tmpstr = string.Format("{0},{1},{2}", tmpshort3a[0], tmpshort3a[1], tmpshort3a[2]); + fmtdata.SectData.StepSectionData.StpSectLayData.WidSTablePrint = tmpstr; + + for (int i = 0; i < 3; i++) tmpshort3[i] = (Int16)(ColToPoints(brFmt.ReadInt16())); + tmpstr = string.Format("{0},{1},{2}", tmpshort3[0], tmpshort3[1], tmpshort3[2]); + fmtdata.SectData.StepSectionData.StpSectEditData.ColRScreen = tmpstr; + + fmtdata.SectData.StepSectionData.StpSectLayData.AdjRNOCol = (Int16)(ColToPoints(brFmt.ReadInt16())); + + ChangeBar cb = new ChangeBar(); + + cb.ChangeBarMessage = ((E_ChangeBarMessage)brFmt.ReadUInt16()).ToString(); + + cb.FixedChangeColumn = brFmt.ReadInt16(); + cb.FixedAERChangeColumn = brFmt.ReadByte(); + + //read in a number of format items that are not supported... + for (int i = 0; i < 3; i++) tmpshort3[i] = brFmt.ReadInt16(); // BD_PageNumOnCover - not used. + + tmpshort = brFmt.ReadInt16(); // VESearchLeftMargin - not used (same for rest that list varname. + tmpshort = brFmt.ReadInt16(); // VEStdPrtLeftMarE + tmpshort = brFmt.ReadInt16(); // VEStdPrtLeftMarP + + int tmplong = brFmt.ReadInt32(); // ImperfectSTructureSepStyle + tmpshort = brFmt.ReadInt16(); // FormsLPI + tmplong = brFmt.ReadInt32(); // FormsStyle + tmplong = brFmt.ReadInt32(); // FormsBoxStyle + tmpshort = brFmt.ReadInt16(); // FormsMargin + tmpshort = brFmt.ReadInt16(); // ChangeSummaryLPI + + cb.ChangeSummaryStyle = brFmt.ReadInt32(); // this may be moved into a different struct + cb.ChangeBarStyle = brFmt.ReadInt32(); + fmtdata.ProcData.ChangeBarData = cb; + + for (int i = 0; i < 30; i++) tmpshort = brFmt.ReadInt16(); // XPosition + + fmtdata.ProcData.TitleLength = brFmt.ReadInt16(); + fmtdata.ProcData.CoverTitleLength = brFmt.ReadInt16(); + + fmtdata.ProcData.CheckOffData = new CheckOffData(); + + fmtdata.ProcData.CheckOffData.RightCheckOffBoxList = new RightCheckOffBx[4]; + for (int i = 0; i < 4; i++) + { + fmtdata.ProcData.CheckOffData.RightCheckOffBoxList[i].Index = i; + fmtdata.ProcData.CheckOffData.RightCheckOffBoxList[i].RightCheckOffBox = brFmt.ReadInt16(); + } + tmpshort = brFmt.ReadInt16(); // TwoCheckOffs + fmtdata.ProcData.CheckOffData.CheckOffList = new CheckOff[MAXCHECKOFFS]; + 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].RightCheckOffChars = brFmt.ReadByte(); + for (int i = 0; i < MAXCHECKOFFS; i++) tmpbyte = 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++) tmpbyte = brFmt.ReadByte(); // CheckOffFeatures + 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].Font = LoadVE_Font(); + fmtdata.ProcData.CheckOffData.UseCheckOffsIn = brFmt.ReadInt32(); + tmplong = (int)brFmt.ReadUInt32(); + fmtdata.SectData.StepSectionData.StpSectLayData.EndMessagePos = brFmt.ReadInt16(); + tmpshort = brFmt.ReadInt16(); // CenterTableAdjustment + tmpshort = brFmt.ReadInt16(); // NumberOfLinesForNoteOrCaution + + //for (int i = 0; i < MAXSEQ; i++) fmtdata.SectData.StepSectionData.SeqStart[i] = brFmt.ReadByte(); + fmtdata.SectData.StepSectionData.SequentialTabFormat = new SeqTabFmt[MAXSEQ]; + for (int i = 0; i < MAXSEQ; i++) + { + fmtdata.SectData.StepSectionData.SequentialTabFormat[i].TabFormat = ConvertSeqStart(brFmt.ReadByte()); + } + + //fmtdata.SectData.StepSectionData.HighSeqStart = brFmt.ReadByte(); + tmpbyte = brFmt.ReadByte(); // HighSeqStart + fmtdata.SectData.StepSectionData.IndentToken = brFmt.ReadByte(); + + fmtdata.SectData.StepSectionData.StpSectPrtData.ImmStepHdrCol = (Int16)(ColToPoints(brFmt.ReadInt16())); + fmtdata.SectData.StepSectionData.StpSectPrtData.ImmStepHdrStyle = LoadVE_Font(); + + ReplaceStr[] repstr = new ReplaceStr[MAXREPLACE]; + fmtdata.SectData.ReplaceStrData = repstr; + for (int i = 0; i < 60; i++) repstr[i].Flag = ((E_ReplaceStr)brFmt.ReadUInt32()).ToString(); + + for (int i = 0; i < 2; i++) tmpshort3[i] = brFmt.ReadInt16(); + tmpstr = string.Format("{0},{1}", tmpshort3[0], tmpshort3[1]); + fmtdata.SectData.StepSectionData.StpSectLayData.RNOWidthAlt = tmpstr; + fmtdata.SectData.StepSectionData.StpSectLayData.HLSWidthOVRD = brFmt.ReadInt16(); + fmtdata.SectData.StepSectionData.StpSectPrtData.SecColHdrforActPMode = brFmt.ReadInt16(); + + for (int i = 0; i < MAXSTEPS+1; i++) fmtdata.StepData[i].Index = i; + for (int i = 1; i < MAXSTEPS+1; i++) fmtdata.StepData[i].StepLayoutData.AlignWithParentTab = (brFmt.ReadByte()).ToString(); + + fmtdata.SectData.SectionNumber = new SectionNum(); + fmtdata.SectData.SectionHeader = new SectionHead(); + fmtdata.SectData.SectionNumber.Font = LoadVE_Font(); + fmtdata.SectData.SectionHeader.Font = LoadVE_Font(); + fmtdata.SectData.SectionNumber.Pos = (Int16)(ColToPoints(brFmt.ReadInt16())); + fmtdata.SectData.SectionNumber.Just = ((E_PageStructMod)brFmt.ReadByte()).ToString(); + fmtdata.SectData.SectionHeader.Pos = (Int16)(ColToPoints(brFmt.ReadInt16())); + fmtdata.SectData.SectionHeader.Just = ((E_PageStructMod)brFmt.ReadByte()).ToString(); + + for (int i = 0; i < 10; i++) tmpbyte = brFmt.ReadByte(); // SecLevelDelta + fmtdata.SectData.SectionTitleLength = brFmt.ReadInt16(); + tmpshort = brFmt.ReadInt16(); + + for (int i = 1; i < MAXSTEPS+1; i++) fmtdata.StepData[i].StepLayoutData.RtCheckOffGroups = (brFmt.ReadInt16()).ToString(); + + for (int i = 0; i < 100; i++) tmpshort = brFmt.ReadInt16(); // TypeGroups + for (int i = 0; i < 20; i++) tmpshort = brFmt.ReadInt16(); // EnhancedSubTypes; + + fmtdata.SectData.StepSectionData.StpSectLayData.SubPaginationWght = brFmt.ReadInt16(); + fmtdata.SectData.StepSectionData.StpSectLayData.TextTitleAdjustment = brFmt.ReadInt16(); + + for (int i = 1; i < MAXSTEPS+1; i++) tmpshort = brFmt.ReadInt16(); // STAfterLines + + fmtdata.TransData.TransTypeData = new TransTypes[MAXTRANS]; + for (int i = 0; i < MAXTRANS; i++) + { + fmtdata.TransData.TransTypeData[i].TransType = brFmt.ReadByte(); + if (i < 6 && fmtdata.TransData.TransTypeData[i].TransType == 0) fmtdata.TransData.TransTypeData[i].TransType = (byte)i; + } + 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 < MAXSTEPS; i++) fmtdata.StepData[i].StepLayoutData.StepTypeWidthOverride = ((Int16)(ColToPoints(brFmt.ReadInt16()))).ToString(); + + // auto table of contents data + AccSection accsec = new AccSection(); + + TOC toc = new TOC(); + toc.TofCSecNumPos = (Int16)(ColToPoints(brFmt.ReadSByte())); + toc.TofCSecTitlePos = (Int16)(ColToPoints(brFmt.ReadSByte())); + tmpbyte = brFmt.ReadByte(); // TofCSecTitlePos2 + toc.TofCSecTitleLen = brFmt.ReadByte(); + toc.TofCPageNumPos = (Int16)(ColToPoints(brFmt.ReadSByte())); + toc.TofCSpaceChar = brFmt.ReadByte(); + toc.TofCLineSpacing = brFmt.ReadByte(); + toc.Font = LoadVE_FontByte(); ; + accsec.TableOfContentsData = toc; + for (int i = 0; i < MAXSTEPS; i++) tmpbyte = brFmt.ReadByte(); + + fmtdata.ProcData.CheckOffData.CheckOffAdjustment = brFmt.ReadSByte(); + + tmpshort = brFmt.ReadInt16(); // ColsAdjustInS2 + tmpbyte = brFmt.ReadByte(); // SeriesTitleLength; + + for (int i = 1; i < MAXSTEPS+1; i++) + { + sbyte[] vp = new sbyte[15]; + for (int j = 0; j < 15; j++) vp[j] = brFmt.ReadSByte(); + bool hasdata = false; + for (int j = 0; j < 15; j++) + { + if (vp[j] != '\0') + { + hasdata = true; + break; + } + } + if (!hasdata) + fmtdata.StepData[i].VertPos = null; + else + { + fmtdata.StepData[i].VertPos = null; + for (int j = 0; j<15; j++) + fmtdata.StepData[i].VertPos = fmtdata.StepData[i].VertPos + string.Format("{0},",vp[j]); + fmtdata.StepData[i].VertPos = fmtdata.StepData[i].VertPos.Substring(0, fmtdata.StepData[i].VertPos.Length - 1); // remove last "," + } + } + fmtdata.SectData.StepSectionData.StpSectLayData.VertStyle = LoadVE_Font(); + + sbyte[] tmpbyte3 = new sbyte[3]; + 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(); + MetaSection[] metsects = new MetaSection[10]; + fmtdata.SectData.MetaSectionData = metsects; + 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].SecTitlePositionAdj = (Int16)(ColToPoints(brFmt.ReadSByte())); + for (int i = 0; i < 10; i++) metsects[i].ColSByLevel = (Int16)(ColToPoints(brFmt.ReadSByte())); + for (int i = 0; i < 10; i++) metsects[i].TofCPositionAdj = (Int16)(ColToPoints(brFmt.ReadSByte())); + for (int i = 0; i < 10; i++) metsects[i].WidSAdjByLevel = (Int16)(ColToPoints(brFmt.ReadSByte())); + + fmtdata.SectData.StepSectionData.NumberOfHighLevelSteps = brFmt.ReadByte(); + + for (int i = 0; i < MAXBOXES+1; i++) fmtdata.BoxData[i].Index = i; + 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 < MAXSTEPS+1; i++) fmtdata.StepData[i].StepTypeColOverride = ((Int16)(ColToPoints(brFmt.ReadInt16()))).ToString(); + + fmtdata.SectData.StepSectionData.NumberOfSubStepTypes = brFmt.ReadByte(); + + accsec.AutoContActSumSection = brFmt.ReadInt32(); + fmtdata.SectData.AccSectionData = accsec; + #endregion + #region LoadStrings + long floc = brFmt.BaseStream.Position; + ////////////////// + // STRINGS NOW + ///////////////// + + brFmt.BaseStream.Seek(tstloc, SeekOrigin.Begin); + short numstr = brFmt.ReadInt16(); + short len = brFmt.ReadInt16(); + byte[] input = GetByteArray(brFmt, len); + + // now load in the offset info for data. + // read in the offsets from the begining of tmpstr + // this allows us to conserve on memory because duplicate strings + // will only be held once + // + Int16[] offset = new Int16[numstr]; + int indx; + for (int i = 0; i < numstr; i++) offset[i] = brFmt.ReadInt16(); + + // Add the default box characters to be used. + fmtdata.BoxData[0].BXULC = ConvertText("\x0DA"); + fmtdata.BoxData[0].BXHorz = ConvertText("\x0C4"); + fmtdata.BoxData[0].BXURC = ConvertText("\x0BF"); + fmtdata.BoxData[0].BXVert = ConvertText("\x0B3"); + fmtdata.BoxData[0].BXMLS = ConvertText("\x0C3"); + fmtdata.BoxData[0].BXMRS = ConvertText("\x0B4"); + fmtdata.BoxData[0].BXLLC = ConvertText("\x0C0"); + fmtdata.BoxData[0].BXLRC = ConvertText("\x0D9"); + fmtdata.BoxData[0].BXMID = ConvertText("\x0C5"); + fmtdata.BoxData[0].BXUMID = ConvertText("\x0C2"); + fmtdata.BoxData[0].BXLMID = ConvertText("\x0C1"); + + // using offsets, get data & put into fields. + int arcnt = 1; // use this to count into offset array for data. + for (int i = 1; i < MAXBOXES+1; i++) + { + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.BoxData[i].BXURC = GetStringFromByte(input, indx); + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.BoxData[i].BXHorz = GetStringFromByte(input, indx); + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.BoxData[i].BXULC = GetStringFromByte(input, indx); + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.BoxData[i].BXVert = GetStringFromByte(input, indx); + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.BoxData[i].BXMLS = GetStringFromByte(input, indx); + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.BoxData[i].BXMRS = GetStringFromByte(input, indx); + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.BoxData[i].BXLRC = GetStringFromByte(input, indx); + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.BoxData[i].BXLLC = GetStringFromByte(input, indx); + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.BoxData[i].BXMID = GetStringFromByte(input, indx); + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.BoxData[i].BXLHorz = GetStringFromByte(input, indx); + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.BoxData[i].BXUMID = GetStringFromByte(input, indx); + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.BoxData[i].BXLMID = GetStringFromByte(input, indx); + } + + // increment arcnt by 144 because there were 24 box possibilities in the + // 16bit the second 12 were rtf + arcnt = arcnt + 144; + + //tabs + string[,] tabstrings = new string[MAXTABS, 2]; + for (int i = 0; i < MAXTABS; i++) + { + indx = offset[arcnt]; + arcnt++; + if (indx > 0) tabstrings[i, 0] = GetStringFromByte(input, indx); + indx = offset[arcnt]; + arcnt++; + if (indx > 0) tabstrings[i, 1] = GetStringFromByte(input, indx); + } + for (int i = 0; i < MAXSTEPS; i++) + { + for (int j = 0; j < MAXTABS; j++) + { + if (Tabindx[i] == j) + { + fmtdata.StepData[i+1].TabData.IdentEdit = DoTabs(fmtdata.StepData[i].TabData.Font, fmtdata.PurchaseOptions, i, tabstrings[j, 0]); + fmtdata.StepData[i+1].TabData.IdentEditWid = CalculateTabWid(tabstrings[j, 0]).ToString(); + fmtdata.StepData[i+1].TabData.Ident = DoTabs(fmtdata.StepData[i].TabData.Font, fmtdata.PurchaseOptions, i, tabstrings[j, 1]); + fmtdata.StepData[i+1].TabData.IdentWid = CalculateTabWid(tabstrings[j, 1]).ToString(); + break; + } + } + } + + // separators + for (int i = 1; i < MAXSTEPS+1; i++) + { + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.StepData[i].Sep = DoReplaceTokens(GetStringFromByte(input, indx)); + } + + // Step prefix & suffix + for (int i = 1; i < MAXSTEPS+1; i++) + { + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.StepData[i].Prefix = DoReplaceTokens(GetStringFromByte(input, indx)); + } + for (int i = 1; i < MAXSTEPS+1; i++) + { + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.StepData[i].Suffix = DoReplaceTokens(GetStringFromByte(input, indx)); + } + + // IdentB & SeqTab + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.SectData.StepSectionData.IdentB = GetStringFromByte(input, indx); + for (int i = 0; i < MAXSEQ; i++) + { + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.SectData.StepSectionData.SequentialTabFormat[i].TabFormat = fmtdata.SectData.StepSectionData.SequentialTabFormat[i].TabFormat + GetStringFromByte(input, indx); + } + // replace word strings + for (int i = 0; i < MAXREPLACE; i++) + { + indx = offset[arcnt]; + arcnt++; + if (indx > 0) repstr[i].ReplaceWord = DoReplaceTokens(GetStringFromByteNoConvert(input, indx)); + } + for (int i = 0; i < MAXREPLACE; i++) + { + indx = offset[arcnt]; + arcnt++; + if (indx > 0) repstr[i].ReplaceWith = DoReplaceTokens(GetStringFromByte(input, indx)); + } + + // various proc matching/data + ProcDescr[] pd = new ProcDescr[10]; + for (int i = 0; i < 10; i++) + { + indx = offset[arcnt]; + arcnt++; + if (indx > 0) pd[i].MatchProcNumber = GetStringFromByte(input, indx); + } + + for (int i = 0; i < 10; i++) + { + indx = offset[arcnt]; + arcnt++; + if (indx > 0) pd[i].ProcDescr1 = GetStringFromByte(input, indx); + } + + for (int i = 0; i < 10; i++) + { + indx = offset[arcnt]; + arcnt++; + if (indx > 0) pd[i].ProcDescr2 = GetStringFromByte(input, indx); + } + fmtdata.PrintData.ProcDescrList = pd; + + string[] Versid = new string[5]; + for (int i = 0; i < 5; i++) + { + indx = offset[arcnt]; + arcnt++; + if (indx > 0) Versid[i] = GetStringFromByte(input, indx); + } + fmtdata.PrintData.VersionIdText = Versid; + + // a few transition strings + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.TransData.DelimiterForTransitionTitle = GetStringFromByte(input, indx); + + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.TransData.StepSubstepDelimeter = GetStringFromByte(input, indx); + + indx = offset[arcnt]; + arcnt++; + // Replace the ò with a blank, one of the formats (cpla - robinson) used this to flag + // an underline for step numbers in transitions, but this format is no longer used. + if (indx > 0) fmtdata.TransData.ThroughString = GetStringFromByte(input, indx).Replace('ò', ' '); + + // procedure suffix data + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.ProcData.ProcedureSuffixFlags = GetStringFromByte(input, indx); + + fmtdata.ProcData.ProcedureSuffix = new string[10]; + for (int i = 0; i < 10; i++) + { + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.ProcData.ProcedureSuffix[i] = GetStringFromByte(input, indx); + } + + // PlantDnLoad not used - skip it. + arcnt++; + + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.PrintData.TopOfPageThing = DoReplaceTokens(GetStringFromByte(input, indx)); + + // not used: xtitle[3][10] - skip 30 + arcnt = arcnt + 30; + + fmtdata.SectData.StepSectionData.TextType = new string[10]; + for (int i = 0; i < 10; i++) + { + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.SectData.StepSectionData.TextType[i] = GetStringFromByte(input, indx); + } + + // not used, SectionsToPrint - 10; SectionNumberMask - 10; SectionsToPrintTitle - 10; + // DocumentTitleExtensions - 10; DocumentFixFileExtensions - 10; + + arcnt = arcnt + 50; + + // some seqtab data. + + for (int i = 0; i < MAXSEQ; i++) + { + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.SectData.StepSectionData.SequentialTabFormat[i].TabFormat = GetStringFromByte(input, indx) + fmtdata.SectData.StepSectionData.SequentialTabFormat[i].TabFormat; + indx = offset[arcnt]; + arcnt++; + if (indx > 0) tmpstr = GetStringFromByte(input, indx).Replace("\x08", ""); + } + for (int i = 0; i < MAXSEQ; i++) + { + indx = offset[arcnt]; + arcnt++; + if (indx > 0) tmpstr = GetStringFromByte(input, indx).Replace("\x08", ""); + indx = offset[arcnt]; + arcnt++; + if (indx > 0) tmpstr = GetStringFromByte(input, indx).Replace("\x08", ""); + } + + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.SectData.StepSectionData.StpSectPrtData.RNOSepString = DoReplaceTokens(GetStringFromByte(input, indx)); + + fmtdata.SectData.StepSectionData.UnderlineTerminate = new string[10]; + for (int i = 0; i < 10; i++) + { + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.SectData.StepSectionData.UnderlineTerminate[i] = GetStringFromByte(input, indx); + } + + fmtdata.SectData.StepSectionData.StpSectPrtData.ImmStepHdr = new string[2]; + for (int i = 0; i < 2; i++) + { + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.SectData.StepSectionData.StpSectPrtData.ImmStepHdr[i] = GetStringFromByte(input, indx); + } + for (int i = 0; i < 5; i++) + { + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.StepData[altsteps[i]].AlternateName = GetStringFromByte(input, indx); + } + + for (int i = 0; i < 16; i++) + { + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.StepData[this.altsubsteps[i]].AlternateName = GetStringFromByte(input, indx); + } + + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.ProcData.ChangeBarData.SpecialChangeBar = DoReplaceTokens(GetStringFromByte(input, indx)); + + // not used - ImperfectStructureSeparator + arcnt++; + + fmtdata.SectData.StepSectionData.ObserveNCString1 = new string[4]; + fmtdata.SectData.StepSectionData.ObserveNCString2 = new string[4]; + for (int i = 0; i < 4; i++) + { + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.SectData.StepSectionData.ObserveNCString1[i] = DoReplaceTokens(GetStringFromByteNoConvert(input, indx)); + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.SectData.StepSectionData.ObserveNCString2[i] = DoReplaceTokens(GetStringFromByteNoConvert(input, indx)); + } + + for (int i = 1; i < MAXSTEPS+1; i++) + { + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.StepData[i].UnderlineTheseChar = GetStringFromByte(input, indx); + } + + // not used - SubScriptTheseChar + arcnt++; + + for (int i = 0; i < MAXCHECKOFFS; i++) + { + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.ProcData.CheckOffData.CheckOffList[i].RightCheckOffPrompt = GetStringFromByte(input, indx); + } + + for (int i = 0; i < MAXCHKHEADINGS; i++) + { + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.ProcData.CheckOffData.CheckOffHeaderList[i].CheckOffHeading = DoReplaceTokens(GetStringFromByte(input, indx)); + } + + // not used - WindEditFile + arcnt++; + + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.ProcData.PSInfFile = GetStringFromByte(input, indx); + + // not used - RNOPreSeqTab[9][2] + arcnt = arcnt + 18; + + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.SectData.StepSectionData.StpSectPrtData.HLStpSeparatorString = GetStringFromByte(input, indx); + + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.SectData.StepSectionData.StpSectPrtData.HLRNOStpSeparatorString = GetStringFromByte(input, indx); + + for (int i = 0; i < MAXTABS; i++) + { + indx = offset[arcnt]; + arcnt++; + if (indx > 0) tabstrings[i, 0] = GetStringFromByte(input, indx); + indx = offset[arcnt]; + arcnt++; + if (indx > 0) tabstrings[i, 1] = GetStringFromByte(input, indx); + } + for (int i = 0; i < MAXSTEPS; i++) + { + for (int j = 0; j < MAXTABS; j++) + { + if (Tabindx[i] == j) + { + fmtdata.StepData[i + 1].TabData.RNOIdentEdit = DoTabs(fmtdata.StepData[i].TabData.Font, fmtdata.PurchaseOptions, i, tabstrings[j, 0]); + fmtdata.StepData[i + 1].TabData.RNOIdentEditWid = CalculateTabWid(tabstrings[j, 0]).ToString(); + fmtdata.StepData[i + 1].TabData.RNOIdent = DoTabs(fmtdata.StepData[i].TabData.Font, fmtdata.PurchaseOptions, i, tabstrings[j, 1]); + fmtdata.StepData[i + 1].TabData.RNOIdentWid = CalculateTabWid(tabstrings[j, 1]).ToString(); + break; + } + } + } + + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.SectData.StepSectionData.StpSectLayData.LowerLimitDivisor = GetStringFromByte(input, indx); + + // If the DoSectionTrans flag is set, use DefaultSectionTransStr for defaults, + // otherwise use the DefaultTransStr. The DoSectionTransTypeB flags just + // replaces the [5] item in the DefaultSectionTransStr array. I'll reset + // if this flag isn't used since formats are processed in a loop and only want + // the change to the default for the current format if the flag is set in it. + if (XtraFlags.DoSectionTransTypeB == "True") + { + DefaultSectionTransTokenStr[5] = DefaultSectionTransStrTypeB; + DefaultSectionTransFormatStr[5] = DefaultSectionTransStrTypeB; + } + else // if flag not set, just reset default in case used in one of next formats. + { + DefaultSectionTransTokenStr[5] = DefaultSectionTransStrTypeBNone; + DefaultSectionTransFormatStr[5] = DefaultSectionTransStrTypeBNone; + } + + // If the plant uses the TransProcTitleInParen flag, then place parens + // around the proc & section titles. + if (XtraFlags.TranProcTitleInParen=="True") + { + DefaultTransStr[0] = "{Proc Num} ({Proc Title}) Step {First Step}"; + DefaultTransStr[3] = "{First Step} thru {Last Step} of {Proc Num} ({Proc Title}) ({Sect Hdr})"; + DefaultTransStr[4] = "({Sect Title}), Step {First Step}"; + DefaultTransStr[5] = "{Proc Num}, ({Proc Title}) ({Sect Hdr}), Step {First Step}"; + } + if (fmtdata.TransData.ThroughString != null && fmtdata.TransData.ThroughString != "") + { + DefaultTransStr[3] = DefaultTransStr[3].Replace(" thru ", fmtdata.TransData.ThroughString); + DefaultSectionTransTokenStr[3] = DefaultSectionTransTokenStr[3].Replace(" thru ", fmtdata.TransData.ThroughString); + DefaultSectionTransFormatStr[3] = DefaultSectionTransFormatStr[3].Replace(" thru ", fmtdata.TransData.ThroughString); + } + for (int i = 0; i < MAXTRANS; i++) + { + fmtdata.TransData.TransTypeData[i].Index = i; + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.TransData.TransTypeData[i].TransFormat = ConvertTransFormat(GetStringFromByteNoConvert(input, indx)); + else if (i < 6) + { + fmtdata.TransData.TransTypeData[i].TransFormat = XtraFlags.DoSectionTrans == "True" ? DefaultSectionTransFormatStr[i] : DefaultTransStr[i]; + fmtdata.TransData.TransTypeData[i].TransType = (byte)i; // reset type + } + } + + for (int i = 0; i < MAXTRANS; i++) + { + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.TransData.TransTypeData[i].TransMenu = ConvertTransFormat(GetStringFromByteNoConvert(input, indx)); + else if (i < 6) fmtdata.TransData.TransTypeData[i].TransMenu = XtraFlags.DoSectionTrans == "True" ? DefaultSectionTransTokenStr[i] : DefaultTransStr[i]; + fmtdata.TransData.TransTypeData[i].TransType = (byte)i; // reset type + } + for (int i = 0; i < MAXTRANS; i++) + { + if (fmtdata.TransData.TransTypeData[i].TransFormat != null && fmtdata.TransData.TransTypeData[i].TransMenu != null) fmtdata.TransData.TransTypeData[i].TransUI = GetTransUIEnum(fmtdata.TransData.TransTypeData[i].TransFormat, fmtdata.TransData.TransTypeData[i].TransMenu); + } + // if in dosectiontransitions, put the format/menu strings back to original + if (XtraFlags.DoSectionTrans == "True") + { + for (int i = 0; i < MAXTRANS; i++) + { + if (i < 6 && fmtdata.TransData.TransTypeData[i].TransMenu != null) + { + fmtdata.TransData.TransTypeData[i].TransFormat = DefaultSectionTransFormatStr[i]; + fmtdata.TransData.TransTypeData[i].TransMenu = DefaultSectionTransFormatStr[i]; + + } + } + } + arcnt = arcnt + MAXTRANS; + + // not used OutsideTransFmt & OutsideTransMenu + arcnt = arcnt + (MAXTRANS * 2); + + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.SectData.StepSectionData.StpSectLayData.NonLinkedStepNumber = GetStringFromByte(input, indx); + + //not used BldLstFile + arcnt++; + + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.SectData.StepSectionData.StpSectLayData.NonLinkedCautNoteNumber = GetStringFromByte(input, indx); + + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.PrintData.DuplexBGDirectory = GetStringFromByte(input, indx); + + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.PrintData.DuplexDDDirectory = GetStringFromByte(input, indx); + + indx = offset[arcnt]; + arcnt++; + if (indx > 0) fmtdata.SectData.StepSectionData.StpSectLayData.NonLinkedRNONumber = GetStringFromByte(input, indx); + + #endregion + } + catch (Exception ex) + { + Console.WriteLine("Error on read - format = {0}", fmtdata.Name); + Console.WriteLine(ex.Message); + Console.WriteLine(); + return false; + } + return AdjustFlags(ref fmtdata, ref XtraFlags); + } + + private bool AdjustFlags(ref FormatData fmtdata, ref XtraFlgs XtraFlags) + { + // do format flags here - this will get yucky!!! + #region StepFlags + for (int i = 0; i < MAXSTEPS+1; i++) + { + + // Do base here, commented out for now - need to do one step at a time for my own sanity... + if (i == 0) + { + // All types get this thru inheritance + if (XtraFlags.SeparateBox == "True") fmtdata.StepData[i].SeparateBox = "True"; + else fmtdata.StepData[i].SeparateBox = "False"; + // All types get this thru inheritance + if (XtraFlags.LJTabs == "True") fmtdata.StepData[i].LJTabs = "True"; + else fmtdata.StepData[i].LJTabs = "False"; + } + if (i == 1) // Sequential flags - new name will be substeps + { + if (XtraFlags.BoxedSubsteps == "True") fmtdata.StepData[i].Boxed = "True"; + else fmtdata.StepData[i].Boxed = "False"; + + if (XtraFlags.UnderlineAfterDashSpace == "True") fmtdata.StepData[i].UnderlineAfterDashSpace = "True"; + else fmtdata.StepData[i].UnderlineAfterDashSpace = "False"; + + if (XtraFlags.TextSubFollowsTextStyle == "True") fmtdata.StepData[i].TextSubFollowsTextStyle = "True"; + else fmtdata.StepData[i].TextSubFollowsTextStyle = "False"; + + if (XtraFlags.DontStartLineWithDash == "True") fmtdata.StepData[i].StartLineWithDash = "False"; + else fmtdata.StepData[i].StartLineWithDash = "True"; + + if (XtraFlags.NoBlankLineBeforeSubstep == "True") fmtdata.StepData[i].BlankLineBeforeSubStep = "False"; + else fmtdata.StepData[i].BlankLineBeforeSubStep = "True"; + } + else if (i == 2) // High + { + // All High get this thru inheritance + if (XtraFlags.EnhancedStepNumFromPrev == "True") fmtdata.StepData[i].EnhancedStepNumFromPrev = "True"; + else fmtdata.StepData[i].EnhancedStepNumFromPrev = "False"; + + // All High get this thru inheritance + if (XtraFlags.UseSmartTemplate == "True") fmtdata.StepData[i].UseSmartTemplate = "True"; + else fmtdata.StepData[i].UseSmartTemplate = "False"; + + // All High get this thru inheritance + if (XtraFlags.CheckOffOnAllSteps == "True") fmtdata.StepData[i].CheckOffOnAllSteps = "True"; + else fmtdata.StepData[i].CheckOffOnAllSteps = "False"; + + // All High get this thru inheritance + if (XtraFlags.BoxContinousActions == "True") fmtdata.StepData[i].Boxed = "True"; + else fmtdata.StepData[i].Boxed = "False"; + + // All High get this thru inheritance + if (XtraFlags.Xlines_StepFix == "True") fmtdata.StepData[i].XLines_StepFix = "True"; + else fmtdata.StepData[i].XLines_StepFix = "False"; + + // All High get this thru inheritance + if (XtraFlags.UseAlternateStepBox == "True") fmtdata.StepData[i].UseAlternateStepBox = "True"; + else fmtdata.StepData[i].UseAlternateStepBox = "False"; + + // All High get this thru inheritance + if (XtraFlags.UnderlineAfterDashSpace == "True") fmtdata.StepData[i].UnderlineAfterDashSpace = "True"; + else fmtdata.StepData[i].UnderlineAfterDashSpace = "False"; + + // All High get this thru inheritance + if (XtraFlags.PageBreakOnHighLevelStep == "True") fmtdata.StepData[i].PageBreakOnStep = "True"; + else fmtdata.StepData[i].PageBreakOnStep = "False"; + + // All High get this thru inheritance + if (XtraFlags.AlignNullTabWSectHead == "True") fmtdata.StepData[i].AlignNullTabWSectHead = "True"; + else fmtdata.StepData[i].AlignNullTabWSectHead = "False"; + + // All High get this thru inheritance + if (XtraFlags.HLSTextInPagelist == "True") fmtdata.StepData[i].InPageList = "True"; + else fmtdata.StepData[i].InPageList = "False"; + + // All High get this thru inheritance + if (XtraFlags.NoStepNumIfOnlyOneStep == "True") fmtdata.StepData[i].StepNumIfOnlyOne = "False"; + else fmtdata.StepData[i].StepNumIfOnlyOne = "True"; + + // All High get this thru inheritance + if (XtraFlags.AtLeastTwoDigitsForHLS == "True") fmtdata.StepData[i].AtLeastTwoDigits = "True"; + else fmtdata.StepData[i].AtLeastTwoDigits = "False"; + + // All High get this thru inheritance + if (XtraFlags.DontNumberHighLevelSteps == "True") fmtdata.StepData[i].Number = "False"; + else fmtdata.StepData[i].Number = "True"; + } + else if (i == 3) // Immediate + { + if (XtraFlags.IMMStepSpcHdr == "True") fmtdata.StepData[i].SpcHdr = "True"; + else fmtdata.StepData[i].SpcHdr = "False"; + } + else if (i == 4) // And + { + + // All And get this thru inheritance + if (XtraFlags.CheckOffOnAllSteps == "True") fmtdata.StepData[i].CheckOffOnAllSteps = "True"; + else fmtdata.StepData[i].CheckOffOnAllSteps = "False"; + + // All And get this thru inheritance + if (XtraFlags.UnderlineAfterDashSpace == "True") fmtdata.StepData[i].UnderlineAfterDashSpace = "True"; + else fmtdata.StepData[i].UnderlineAfterDashSpace = "False"; + + // All And get this thru inheritance + if (XtraFlags.TreatAndOrAsSequential == "True") fmtdata.StepData[i].TreatAsSequential = "True"; + else fmtdata.StepData[i].TreatAsSequential = "False"; + } + else if (i == 5) // Or + { + + // All Or get this thru inheritance + if (XtraFlags.CheckOffOnAllSteps == "True") fmtdata.StepData[i].CheckOffOnAllSteps = "True"; + else fmtdata.StepData[i].CheckOffOnAllSteps = "False"; + + // All Or get this thru inheritance + if (XtraFlags.UnderlineAfterDashSpace == "True") fmtdata.StepData[i].UnderlineAfterDashSpace = "True"; + else fmtdata.StepData[i].UnderlineAfterDashSpace = "False"; + + // All Or get this thru inheritance + if (XtraFlags.TreatAndOrAsSequential == "True") fmtdata.StepData[i].TreatAsSequential = "True"; + else fmtdata.StepData[i].TreatAsSequential = "False"; + + } + else if (i == 6) // Caution + { + // All Cautions get this thru inheritance + if (XtraFlags.EnhancedStepNumFromPrev == "True") fmtdata.StepData[i].EnhancedStepNumFromPrev = "True"; + else fmtdata.StepData[i].EnhancedStepNumFromPrev = "False"; + + // All Cautions get this thru inheritance + if (XtraFlags.AlwaysUseExtralines == "True") fmtdata.StepData[i].AlwaysUseExtraLines = "True"; + else fmtdata.StepData[i].AlwaysUseExtraLines = "False"; + + // All Cautions get this thru inheritance + if (XtraFlags.SeparateBoxCautions == "True") fmtdata.StepData[i].SeparateBoxCautions = "True"; + else fmtdata.StepData[i].SeparateBoxCautions = "False"; + + // All Cautions get this thru inheritance + if (XtraFlags.ReduceLineAfterNoteAndCaut == "True") fmtdata.StepData[i].ReduceLineAfter = "True"; + else fmtdata.StepData[i].ReduceLineAfter = "False"; + + // All Cautions get this thru inheritance + if (XtraFlags.OneLineBeforeNoteCautionTab == "True") fmtdata.StepData[i].OneLineBeforeTab = "True"; + else fmtdata.StepData[i].OneLineBeforeTab = "False"; + + // All Cautions get this thru inheritance + if (XtraFlags.CheckOffOnAllSteps == "True") fmtdata.StepData[i].CheckOffOnAllSteps = "True"; + else fmtdata.StepData[i].CheckOffOnAllSteps = "False"; + + // All Cautions get this thru inheritance + if (XtraFlags.ReBoxCautNote == "True") fmtdata.StepData[i].Rebox = "True"; + else fmtdata.StepData[i].Rebox = "False"; + + // All Cautions get this thru inheritance + if (XtraFlags.UnderlineAfterDashSpace == "True") fmtdata.StepData[i].UnderlineAfterDashSpace = "True"; + else fmtdata.StepData[i].UnderlineAfterDashSpace = "False"; + + // All Cautions get this thru inheritance + if (XtraFlags.NoSpaceInNoteOrCaution == "True") fmtdata.StepData[i].SpaceIn = "False"; + else fmtdata.StepData[i].SpaceIn = "True"; + + // All Cautions get this thru inheritance + if (XtraFlags.PageBreakOnCautions == "True") fmtdata.StepData[i].PageBreakOnStep = "True"; + else fmtdata.StepData[i].PageBreakOnStep = "False"; + + // All Cautions get this thru inheritance + if (XtraFlags.MatchUpRNOCautNote == "True") fmtdata.StepData[i].MatchUpRNO = "True"; + else fmtdata.StepData[i].MatchUpRNO = "False"; + + // All Cautions get this thru inheritance + if (XtraFlags.StpCautNoteTabInPagelist == "True") fmtdata.StepData[i].InPageList = "True"; + else fmtdata.StepData[i].InPageList = "False"; + + // All Cautions get this thru inheritance + if (XtraFlags.CenterOneLineOnly == "True") fmtdata.StepData[i].CenterOneLineOnly = "True"; + else fmtdata.StepData[i].CenterOneLineOnly = "False"; + + // All Cautions get this thru inheritance + if (XtraFlags.RememberCautionsAndNotes == "True") fmtdata.StepData[i].Remember = "True"; + else fmtdata.StepData[i].Remember = "False"; + + // All Cautions get this thru inheritance + if (XtraFlags.CenterOneLineAdjust == "True") fmtdata.StepData[i].CenterOneLineAdjust = "True"; + else fmtdata.StepData[i].CenterOneLineAdjust = "False"; + + // All Cautions get this thru inheritance + if (XtraFlags.DontBreakCautionsOrNotes == "True") fmtdata.StepData[i].Break = "False"; + else fmtdata.StepData[i].Break = "True"; + + // All Cautions get this thru inheritance + if (XtraFlags.CenterTextWithinWidth == "True") fmtdata.StepData[i].CenterTextWithinWidth = "True"; + else fmtdata.StepData[i].CenterTextWithinWidth = "False"; + + // All Cautions get this thru inheritance + if (XtraFlags.DontBreakCautionsNotesOnSubstps == "True") fmtdata.StepData[i].BreakCautionsNotesOnSubstps = "False"; + else fmtdata.StepData[i].BreakCautionsNotesOnSubstps = "True"; + + // All Cautions get this thru inheritance + if (XtraFlags.AlwaysTabCaution == "True") fmtdata.StepData[i].AlwaysTab = "True"; + else fmtdata.StepData[i].AlwaysTab = "False"; + + // All Cautions get this thru inheritance + if (XtraFlags.ThreeBlanksAboveNotesCautions == "True") fmtdata.StepData[i].ThreeBlanksAbove = "True"; + else fmtdata.StepData[i].ThreeBlanksAbove = "False"; + } + else if (i == 7) // Note + { + // All Notes get this thru inheritance + if (XtraFlags.EnhancedStepNumFromPrev == "True") fmtdata.StepData[i].EnhancedStepNumFromPrev = "True"; + else fmtdata.StepData[i].EnhancedStepNumFromPrev = "False"; + + // All Notes get this thru inheritance + if (XtraFlags.AlwaysUseExtralines == "True") fmtdata.StepData[i].AlwaysUseExtraLines = "True"; + else fmtdata.StepData[i].AlwaysUseExtraLines = "False"; + + // All Notes get this thru inheritance + if (XtraFlags.ReduceLineAfterNoteAndCaut == "True") fmtdata.StepData[i].ReduceLineAfter = "True"; + else fmtdata.StepData[i].ReduceLineAfter = "False"; + + // All Notes get this thru inheritance + if (XtraFlags.OneLineBeforeNoteCautionTab == "True") fmtdata.StepData[i].OneLineBeforeTab = "True"; + else fmtdata.StepData[i].OneLineBeforeTab = "False"; + + // All Notes get this thru inheritance + if (XtraFlags.CheckOffOnAllSteps == "True") fmtdata.StepData[i].CheckOffOnAllSteps = "True"; + else fmtdata.StepData[i].CheckOffOnAllSteps = "False"; + + // All Notes get this thru inheritance + if (XtraFlags.ReBoxCautNote == "True") fmtdata.StepData[i].Rebox = "True"; + else fmtdata.StepData[i].Rebox = "False"; + + // All Notes get this thru inheritance + if (XtraFlags.UnderlineAfterDashSpace == "True") fmtdata.StepData[i].UnderlineAfterDashSpace = "True"; + else fmtdata.StepData[i].UnderlineAfterDashSpace = "False"; + + // All Notes get this thru inheritance + if (XtraFlags.NoSpaceInNoteOrCaution == "True") fmtdata.StepData[i].SpaceIn = "False"; + else fmtdata.StepData[i].SpaceIn = "True"; + + // All Notes get this thru inheritance + if (XtraFlags.PageBreakOnNotes == "True") fmtdata.StepData[i].PageBreakOnStep = "True"; + else fmtdata.StepData[i].PageBreakOnStep = "False"; + + // All Notes get this thru inheritance + if (XtraFlags.MatchUpRNOCautNote == "True") fmtdata.StepData[i].MatchUpRNO = "True"; + else fmtdata.StepData[i].MatchUpRNO = "False"; + + // All Notes get this thru inheritance + if (XtraFlags.StpCautNoteTabInPagelist == "True") fmtdata.StepData[i].InPageList = "True"; + else fmtdata.StepData[i].InPageList = "False"; + + // All Notes get this thru inheritance + if (XtraFlags.CenterOneLineOnly == "True") fmtdata.StepData[i].CenterOneLineOnly = "True"; + else fmtdata.StepData[i].CenterOneLineOnly = "False"; + + // All Notes get this thru inheritance + if (XtraFlags.RememberCautionsAndNotes == "True") fmtdata.StepData[i].Remember = "True"; + else fmtdata.StepData[i].Remember = "False"; + + // All Notes get this thru inheritance + if (XtraFlags.CenterOneLineAdjust == "True") fmtdata.StepData[i].CenterOneLineAdjust = "True"; + else fmtdata.StepData[i].CenterOneLineAdjust = "False"; + + // All Notes get this thru inheritance + if (XtraFlags.DontBreakCautionsOrNotes == "True") fmtdata.StepData[i].Break = "False"; + else fmtdata.StepData[i].Break = "True"; + + // All Notes get this thru inheritance + if (XtraFlags.DontBreakCautionsNotesOnSubstps == "True") fmtdata.StepData[i].BreakCautionsNotesOnSubstps = "False"; + else fmtdata.StepData[i].BreakCautionsNotesOnSubstps = "True"; + + // All Notes get this thru inheritance + if (XtraFlags.CenterTextWithinWidth == "True") fmtdata.StepData[i].CenterTextWithinWidth = "True"; + else fmtdata.StepData[i].CenterTextWithinWidth = "False"; + + // All Notes get this thru inheritance + if (XtraFlags.AlwaysTabNote == "True") fmtdata.StepData[i].AlwaysTab = "True"; + else fmtdata.StepData[i].AlwaysTab = "False"; + + // All Notes get this thru inheritance + if (XtraFlags.ThreeBlanksAboveNotesCautions == "True") fmtdata.StepData[i].ThreeBlanksAbove = "True"; + else fmtdata.StepData[i].ThreeBlanksAbove = "False"; + } + else if (i == 8) // Table + { + // All Table get this thru inheritance + if (XtraFlags.CheckOffOnAllSteps == "True") fmtdata.StepData[i].CheckOffOnAllSteps = "True"; + else fmtdata.StepData[i].CheckOffOnAllSteps = "False"; + + // All Table get this thru inheritance + if (XtraFlags.SubTableGetSup1Level == "True") fmtdata.StepData[i].SubTableGetsUp1Level = "True"; + else fmtdata.StepData[i].SubTableGetsUp1Level = "False"; + } + else if (i == 9) // Continuous + { + if (XtraFlags.BulletOnContinuous == "True") fmtdata.StepData[i].Bullet = "True"; + else fmtdata.StepData[i].Bullet = "False"; + } + else if (i == 10) // AERTable + { + } + else if (i == 11) // EquipmentList + { + + // All EquipmentList get this thru inheritance + if (XtraFlags.CheckOffOnAllSteps == "True") fmtdata.StepData[i].CheckOffOnAllSteps = "True"; + else fmtdata.StepData[i].CheckOffOnAllSteps = "False"; + + // All EquipmentList get this thru inheritance + if (XtraFlags.UnderlineAfterDashSpace == "True") fmtdata.StepData[i].UnderlineAfterDashSpace = "True"; + else fmtdata.StepData[i].UnderlineAfterDashSpace = "False"; + + // Note that only equipment lists (and wblank) get this - no inherit - must be done in code! + if (XtraFlags.DontBreakEquipmentList == "True") fmtdata.StepData[i].BreakEquipmentList = "False"; + else fmtdata.StepData[i].BreakEquipmentList = "True"; + } + else if (i == 12) // Title + { + // All Title get this thru inheritance + if (XtraFlags.CheckOffOnAllSteps == "True") fmtdata.StepData[i].CheckOffOnAllSteps = "True"; + else fmtdata.StepData[i].CheckOffOnAllSteps = "False"; + + // All Title get this thru inheritance + if (XtraFlags.UnderlineAfterDashSpace == "True") fmtdata.StepData[i].UnderlineAfterDashSpace = "True"; + else fmtdata.StepData[i].UnderlineAfterDashSpace = "False"; + } + else if (i == 13) // PageNumber + { + } + else if (i == 14) // EquipmentWBlank + { + } + else if (i == 15) // ProcNumber + { + } + else if (i == 16) // RevNumber + { + } + else if (i == 17) // AccPages + { + if (XtraFlags.CheckOffOnAllSteps == "True") fmtdata.StepData[i].CheckOffOnAllSteps = "True"; + else fmtdata.StepData[i].CheckOffOnAllSteps = "False"; + + if (XtraFlags.UnderlineAfterDashSpace == "True") fmtdata.StepData[i].UnderlineAfterDashSpace = "True"; + else fmtdata.StepData[i].UnderlineAfterDashSpace = "False"; + } + else if (i == 18) // LossOfAC + { + if (XtraFlags.DontBoxAC == "True") fmtdata.StepData[i].BoxIt = "False"; + else fmtdata.StepData[i].BoxIt = "True"; + } + else if (i == 19) // ExplicitAnd + { + } + else if (i == 20) // Caution1 + { + if (XtraFlags.MixCautionsAndNotes == "True") fmtdata.StepData[i].MixCautionsAndNotes = "True"; + else fmtdata.StepData[i].MixCautionsAndNotes = "False"; + + if (XtraFlags.Caution1SameRowAsParent == "True") fmtdata.StepData[i].SameRowAsParent = "True"; + else fmtdata.StepData[i].SameRowAsParent = "False"; + } + else if (i == 21) // Caution2 + { + if (XtraFlags.AlwaysTabCaution2 == "True") fmtdata.StepData[i].AlwaysTab = "True"; + else fmtdata.StepData[i].AlwaysTab = "False"; + + if (XtraFlags.Caution2SameRowAsParent == "True") fmtdata.StepData[i].SameRowAsParent = "True"; + else fmtdata.StepData[i].SameRowAsParent = "False"; + } + else if (i == 22) // Note1 + { + if (XtraFlags.MixCautionsAndNotes == "True") fmtdata.StepData[i].MixCautionsAndNotes = "True"; + else fmtdata.StepData[i].MixCautionsAndNotes = "False"; + } + else if (i == 23) // Note2 + { + } + else if (i == 24) // Paragraph + { + if (XtraFlags.UnderlineAfterDashSpace == "True") fmtdata.StepData[i].UnderlineAfterDashSpace = "True"; + else fmtdata.StepData[i].UnderlineAfterDashSpace = "False"; + } + else if (i == 25) // Default + { + if (XtraFlags.CheckOffOnAllSteps == "True") fmtdata.StepData[i].CheckOffOnAllSteps = "True"; + else fmtdata.StepData[i].CheckOffOnAllSteps = "False"; + + if (XtraFlags.UnderlineAfterDashSpace == "True") fmtdata.StepData[i].UnderlineAfterDashSpace = "True"; + else fmtdata.StepData[i].UnderlineAfterDashSpace = "False"; + } + else if (i == 26) // Note3 + { + } + else if (i == 27) // Caution3 + { + } + else if (i == 28) // Note4 + { + } + else if (i == 29) // Caution4 + { + } + else if (i == 30) // EquipmentOpt + { + // All EquipmentOpt get this thru inheritance + if (XtraFlags.DontBreakCautionsOrNotes == "True") fmtdata.StepData[i].Break = "False"; + else fmtdata.StepData[i].Break = "True"; + + // All EquipmentOpt get this thru inheritance + if (XtraFlags.QuotedSubsteps == "True") fmtdata.StepData[i].Quoted = "True"; + else fmtdata.StepData[i].Quoted = "False"; + } + else if (i == 31) // EquipmentOptWBlank + { + } + else if (i == 32) // Note5 + { + } + else if (i == 33) // BorderlessAERTable + { + if (XtraFlags.LJBorderlessTable == "True") fmtdata.StepData[i].LeftJustifyBorderless = "True"; + else fmtdata.StepData[i].LeftJustifyBorderless = "False"; + } + else if (i == 34) // BorderlessTable + { + if (XtraFlags.LJBorderlessTable == "True") fmtdata.StepData[i].LeftJustifyBorderless = "True"; + else fmtdata.StepData[i].LeftJustifyBorderless = "False"; + } + else if (i == 35) // ImplicitOr + { + } + else if (i == 36) // Figure + { + } + else if (i == 37) // AERFigure + { + } + else if (i == 38) // BorderlessFigure + { + if (XtraFlags.LJBorderlessTable == "True") fmtdata.StepData[i].LeftJustifyBorderless = "True"; + else fmtdata.StepData[i].LeftJustifyBorderless = "False"; + } + else if (i == 39) // BorderlessAERFigure + { + if (XtraFlags.LJBorderlessTable == "True") fmtdata.StepData[i].LeftJustifyBorderless = "True"; + else fmtdata.StepData[i].LeftJustifyBorderless = "False"; + } + else if (i == 40) // RNOType + { + if (XtraFlags.DoubleRNOSpace == "True") fmtdata.StepData[i].DoubleSpace = "True"; + else fmtdata.StepData[i].DoubleSpace = "False"; + + if (XtraFlags.EnhancedStepNumFromPrev == "True") fmtdata.StepData[i].EnhancedStepNumFromPrev = "True"; + else fmtdata.StepData[i].EnhancedStepNumFromPrev = "False"; + + if (XtraFlags.NoSpaceDoubleRNO == "True") fmtdata.StepData[i].SpaceDouble = "False"; + else fmtdata.StepData[i].SpaceDouble = "True"; + + if (XtraFlags.RNOSameLevel == "True") fmtdata.StepData[i].SameLevel = "True"; + else fmtdata.StepData[i].SameLevel = "False"; + + if (XtraFlags.BoldHighLevelRNO == "True") fmtdata.StepData[i].BoldHighLevel = "True"; + else fmtdata.StepData[i].BoldHighLevel = "False"; + + if (XtraFlags.RNOContinueOnly == "True") fmtdata.StepData[i].ContinueOnly = "True"; + else fmtdata.StepData[i].ContinueOnly = "False"; + + if (XtraFlags.RNOSepAfterAER == "True") fmtdata.StepData[i].SepAfterAER = "True"; + else fmtdata.StepData[i].SepAfterAER = "False"; + + if (XtraFlags.UnderlineAfterDashSpace == "True") fmtdata.StepData[i].UnderlineAfterDashSpace = "True"; + else fmtdata.StepData[i].UnderlineAfterDashSpace = "False"; + + if (XtraFlags.RNOInPagelist == "True") fmtdata.StepData[i].InPageList = "True"; + else fmtdata.StepData[i].InPageList = "False"; + + if (XtraFlags.DontBreakOnRNO == "True") fmtdata.StepData[i].Break = "False"; + else fmtdata.StepData[i].Break = "True"; + + if (XtraFlags.NoNewlineAfterRNO == "True") fmtdata.StepData[i].NewlineAfter = "False"; + else fmtdata.StepData[i].NewlineAfter = "True"; + + if (XtraFlags.NumberHighLevelRNO == "True") fmtdata.StepData[i].NumberHighLevel = "True"; + else fmtdata.StepData[i].NumberHighLevel = "False"; + + if (XtraFlags.DontOffsetTab == "True") fmtdata.StepData[i].OffsetTab = "False"; + else fmtdata.StepData[i].OffsetTab = "True"; + + if (XtraFlags.DontNumberRNOSubs == "True") fmtdata.StepData[i].NumberSubs = "False"; + else fmtdata.StepData[i].NumberSubs = "True"; + + if (XtraFlags.NoStepNumberForHighLevelRNO == "True") fmtdata.StepData[i].StepNumberForHighLevel = "False"; + else fmtdata.StepData[i].StepNumberForHighLevel = "True"; + + if (XtraFlags.RNOCheckOffSameAsParent == "True") fmtdata.StepData[i].CheckoffSameAsParent = "True"; + else fmtdata.StepData[i].CheckoffSameAsParent = "False"; + + if (XtraFlags.UseRNOTypeInActable == "True") fmtdata.StepData[i].UseInAcTable = "True"; + else fmtdata.StepData[i].UseInAcTable = "False"; + + if (XtraFlags.NoCheckOffsInRNO == "True") fmtdata.StepData[i].CheckOffs = "False"; + else fmtdata.StepData[i].CheckOffs = "True"; + } + else if (i == 41) // High5 + { + } + else if (i == 42) // TitleWithTextRight + { + } + else if (i == 43) // TitleWithTextBelow + { + } + else if (i == 44) // ContAcSequential + { + if (XtraFlags.CheckOffOnAllSteps == "True") fmtdata.StepData[i].CheckOffOnAllSteps = "True"; + else fmtdata.StepData[i].CheckOffOnAllSteps = "False"; + + if (XtraFlags.UnderlineAfterDashSpace == "True") fmtdata.StepData[i].UnderlineAfterDashSpace = "True"; + else fmtdata.StepData[i].UnderlineAfterDashSpace = "False"; + } + else if (i == 45) // ContAcAnd + { + } + else if (i == 46) // ContAcOr + { + } + else if (i == 47) // ContAcParagraph + { + } + } + #endregion + #region StepStructLayout + if (XtraFlags.Dev_Format == "True") fmtdata.SectData.StepSectionData.StpSectLayData.Dev_Format = "True"; + else fmtdata.SectData.StepSectionData.StpSectLayData.Dev_Format = "False"; + if (XtraFlags.EnhancedShortFormDev == "True") fmtdata.SectData.StepSectionData.StpSectLayData.EnhancedShortFormDev = "True"; + else fmtdata.SectData.StepSectionData.StpSectLayData.EnhancedShortFormDev = "False"; + if (XtraFlags.SpecialPageBreakFlag == "True") fmtdata.SectData.StepSectionData.StpSectLayData.SpecialPageBreakFlag = "True"; + else fmtdata.SectData.StepSectionData.StpSectLayData.SpecialPageBreakFlag = "False"; + if (XtraFlags.DontPaginateOnFirstSubStep == "True") fmtdata.SectData.StepSectionData.StpSectLayData.PaginateOnFirstSubstep = "False"; + else fmtdata.SectData.StepSectionData.StpSectLayData.PaginateOnFirstSubstep = "True"; + if (XtraFlags.DontPaginateOnFirstSubStep2X == "True") fmtdata.SectData.StepSectionData.StpSectLayData.PaginateOnFirstSubstep2X = "False"; + else fmtdata.SectData.StepSectionData.StpSectLayData.PaginateOnFirstSubstep2X = "True"; + if (XtraFlags.DontUseHalfLines == "True") fmtdata.SectData.StepSectionData.StpSectLayData.UseHalfLines = "False"; + else fmtdata.SectData.StepSectionData.StpSectLayData.UseHalfLines = "True"; + if (XtraFlags.DontTryToFillHalfOfPage == "True") fmtdata.SectData.StepSectionData.StpSectLayData.TryToFillHalfOfPage = "False"; + else fmtdata.SectData.StepSectionData.StpSectLayData.TryToFillHalfOfPage = "True"; + if (XtraFlags.DoNotCompressSteps == "True") fmtdata.SectData.StepSectionData.StpSectLayData.CompressSteps = "False"; + else fmtdata.SectData.StepSectionData.StpSectLayData.CompressSteps = "True"; + if (XtraFlags.DontDoSTExtraAtTop == "True") fmtdata.SectData.StepSectionData.StpSectLayData.DoSTExtraAtTop = "False"; + else fmtdata.SectData.StepSectionData.StpSectLayData.DoSTExtraAtTop = "True"; + if (XtraFlags.KeepStepsOnPage == "True") fmtdata.SectData.StepSectionData.StpSectLayData.KeepStepsOnPage = "True"; + else fmtdata.SectData.StepSectionData.StpSectLayData.KeepStepsOnPage = "False"; + if (XtraFlags.DontBreakOnSections == "True") fmtdata.SectData.StepSectionData.StpSectLayData.BreakOnSections = "False"; + else fmtdata.SectData.StepSectionData.StpSectLayData.BreakOnSections = "True"; + if (XtraFlags.ShowSectionTitles == "True") fmtdata.SectData.StepSectionData.StpSectLayData.ShowSectionTitles = "True"; + else fmtdata.SectData.StepSectionData.StpSectLayData.ShowSectionTitles = "False"; + if (XtraFlags.NoEndForSingle == "True") fmtdata.SectData.StepSectionData.StpSectLayData.EndForSingle = "False"; + else fmtdata.SectData.StepSectionData.StpSectLayData.EndForSingle = "True"; + if (XtraFlags.DontPaginateOnFirstSubstep3X == "True") fmtdata.SectData.StepSectionData.StpSectLayData.PaginateOnFirstSubstep3X = "False"; + else fmtdata.SectData.StepSectionData.StpSectLayData.PaginateOnFirstSubstep3X = "True"; + if (XtraFlags.PaginateOnLowerStepLevel == "True") fmtdata.SectData.StepSectionData.StpSectLayData.PaginateOnLowerStepLevel = "True"; + else fmtdata.SectData.StepSectionData.StpSectLayData.PaginateOnLowerStepLevel = "False"; + if (XtraFlags.CustomSpacing == "True") fmtdata.SectData.StepSectionData.StpSectLayData.CustomSpacing = "True"; + else fmtdata.SectData.StepSectionData.StpSectLayData.CustomSpacing = "False"; + if (XtraFlags.DontSplitStepInPrntStep == "True") fmtdata.SectData.StepSectionData.StpSectLayData.SplitStepInPrntStep = "False"; + else fmtdata.SectData.StepSectionData.StpSectLayData.SplitStepInPrntStep = "True"; + if (XtraFlags.LineAboveUnderSection == "True") fmtdata.SectData.StepSectionData.StpSectLayData.LineAboveUnderSection = "True"; + else fmtdata.SectData.StepSectionData.StpSectLayData.LineAboveUnderSection = "False"; + if (XtraFlags.PicaIgnoreFiveSixths == "True") fmtdata.SectData.StepSectionData.StpSectLayData.PicaIgnoreFiveSixths = "True"; + else fmtdata.SectData.StepSectionData.StpSectLayData.PicaIgnoreFiveSixths = "False"; + if (XtraFlags.SpaceFoRNOSecNumb == "True") fmtdata.SectData.StepSectionData.StpSectLayData.SpaceForNoSecNumb = "True"; + else fmtdata.SectData.StepSectionData.StpSectLayData.SpaceForNoSecNumb = "False"; + if (XtraFlags.PageBreakOnFirstBlankLine == "True") fmtdata.SectData.StepSectionData.StpSectLayData.PageBreakOnFirstBlankLine = "True"; + else fmtdata.SectData.StepSectionData.StpSectLayData.PageBreakOnFirstBlankLine = "False"; + if (XtraFlags.PutOnPageByItself == "True") fmtdata.SectData.StepSectionData.StpSectLayData.PutOnPageByItself = "True"; + else fmtdata.SectData.StepSectionData.StpSectLayData.PutOnPageByItself = "False"; + if (XtraFlags.PaginateAtHighestPaginLevel == "True") fmtdata.SectData.StepSectionData.StpSectLayData.PaginateAtHighestPaginLevel = "True"; + else fmtdata.SectData.StepSectionData.StpSectLayData.PaginateAtHighestPaginLevel = "False"; + if (XtraFlags.UseSTExtraRealValue == "True") fmtdata.SectData.StepSectionData.StpSectLayData.UseSTExtraRealValue = "True"; + else fmtdata.SectData.StepSectionData.StpSectLayData.UseSTExtraRealValue = "False"; + if (XtraFlags.DoSectionSeparatorLine == "True") fmtdata.SectData.StepSectionData.StpSectLayData.DoSectionSeparatorLine = "True"; + else fmtdata.SectData.StepSectionData.StpSectLayData.DoSectionSeparatorLine = "False"; + if (XtraFlags.TieTabToLevel == "True") fmtdata.SectData.StepSectionData.StpSectLayData.TieTabToLevel = "True"; + else fmtdata.SectData.StepSectionData.StpSectLayData.TieTabToLevel = "False"; + if (XtraFlags.HighLevelRNOBeforeAERSubStps == "True") fmtdata.SectData.StepSectionData.StpSectLayData.HighLevelRNOBeforeAERSubsteps = "True"; + else fmtdata.SectData.StepSectionData.StpSectLayData.HighLevelRNOBeforeAERSubsteps = "False"; + if (XtraFlags.UseStepTypeWidthOverride == "True") fmtdata.SectData.StepSectionData.StpSectLayData.UseStepTypeWidthOverride = "True"; + else fmtdata.SectData.StepSectionData.StpSectLayData.UseStepTypeWidthOverride = "False"; + if (XtraFlags.UseStepTypeWidthOverrideEditPrint == "True") fmtdata.SectData.StepSectionData.StpSectLayData.UseStepTypeWidthOverrideEditPrint = "True"; + else fmtdata.SectData.StepSectionData.StpSectLayData.UseStepTypeWidthOverrideEditPrint = "False"; + if (XtraFlags.PartialStepCompression == "True") fmtdata.SectData.StepSectionData.StpSectLayData.PartialStepCompression = "True"; + else fmtdata.SectData.StepSectionData.StpSectLayData.PartialStepCompression = "False"; + if (XtraFlags.VirtualDotInHLSTab == "True") fmtdata.SectData.StepSectionData.StpSectLayData.VirtualDotInHLSTab = "True"; + else fmtdata.SectData.StepSectionData.StpSectLayData.VirtualDotInHLSTab = "False"; + if (XtraFlags.OverrideEnhancedTabs == "True") fmtdata.SectData.StepSectionData.StpSectLayData.OverrideEnhancedTabs = "True"; + else fmtdata.SectData.StepSectionData.StpSectLayData.OverrideEnhancedTabs = "False"; + if (XtraFlags.NoRNO == "True") fmtdata.SectData.StepSectionData.StpSectLayData.RNO = "False"; + else fmtdata.SectData.StepSectionData.StpSectLayData.RNO = "True"; + if (XtraFlags.OnlySingleColumn == "True") fmtdata.SectData.StepSectionData.StpSectLayData.OnlySingleColumn = "True"; + else fmtdata.SectData.StepSectionData.StpSectLayData.OnlySingleColumn = "False"; +#endregion + #region StepSection + if (XtraFlags.WolfCreekBackgroundFormat == "True") fmtdata.SectData.StepSectionData.WolfCreekBackgroundFormat = "True"; + else fmtdata.SectData.StepSectionData.WolfCreekBackgroundFormat = "False"; + if (XtraFlags.WolfcreekCKLFormat == "True") fmtdata.SectData.StepSectionData.WolfcreekCKLFormat = "True"; + else fmtdata.SectData.StepSectionData.WolfcreekCKLFormat = "False"; + if (XtraFlags.WolfcreekCKLBackgndFormat == "True") fmtdata.SectData.StepSectionData.WolfcreekCKLBackgndFormat = "True"; + else fmtdata.SectData.StepSectionData.WolfcreekCKLBackgndFormat = "False"; + if (XtraFlags.FortranFormatNumbers == "True") fmtdata.SectData.StepSectionData.FortranFormatNumbers = "True"; + else fmtdata.SectData.StepSectionData.FortranFormatNumbers = "False"; + if (XtraFlags.UseTopContinueMessageAtEnd == "True") fmtdata.SectData.StepSectionData.UseTopContinueMessageAtEnd = "True"; + else fmtdata.SectData.StepSectionData.UseTopContinueMessageAtEnd = "False"; + if (XtraFlags.FloatingContinueMessage == "True") fmtdata.SectData.StepSectionData.FloatingContinueMessage = "True"; + else fmtdata.SectData.StepSectionData.FloatingContinueMessage = "False"; + if (XtraFlags.WrapSameAsEdit == "True") fmtdata.SectData.StepSectionData.WrapSameAsEdit = "True"; + else fmtdata.SectData.StepSectionData.WrapSameAsEdit = "False"; + if (XtraFlags.ContinueSectionHeader == "True") fmtdata.SectData.StepSectionData.ContinueSectionHeader = "True"; + else fmtdata.SectData.StepSectionData.ContinueSectionHeader = "False"; + if (XtraFlags.CompressHPSub == "True") fmtdata.SectData.StepSectionData.CompressHPSub = "True"; + else fmtdata.SectData.StepSectionData.CompressHPSub = "False"; + if (XtraFlags.CompressHPSuper == "True") fmtdata.SectData.StepSectionData.CompressHPSuper = "True"; + else fmtdata.SectData.StepSectionData.CompressHPSuper = "False"; + if (XtraFlags.UndSpecialStepsFoldout == "True") fmtdata.SectData.StepSectionData.UndSpecialStepsFoldout = "True"; + else fmtdata.SectData.StepSectionData.UndSpecialStepsFoldout = "False"; + if (XtraFlags.UnderlineAllMetaTitles == "True") fmtdata.SectData.StepSectionData.UnderlineAllMetaTitles = "True"; + else fmtdata.SectData.StepSectionData.UnderlineAllMetaTitles = "False"; + if (XtraFlags.BoldOnlySectionZero == "True") fmtdata.SectData.StepSectionData.BoldOnlySectionZero = "True"; + else fmtdata.SectData.StepSectionData.BoldOnlySectionZero = "False"; + if (XtraFlags.ImperfectStructure == "True") fmtdata.SectData.StepSectionData.ImperfectStructure = "True"; + else fmtdata.SectData.StepSectionData.ImperfectStructure = "False"; + if (XtraFlags.ImperfectSubstep == "True") fmtdata.SectData.StepSectionData.ImperfectSubstep = "True"; + else fmtdata.SectData.StepSectionData.ImperfectSubstep = "False"; + if (XtraFlags.ImperfectStructurePlus4 == "True") fmtdata.SectData.StepSectionData.ImperfectStructurePlus4 = "True"; + else fmtdata.SectData.StepSectionData.ImperfectStructurePlus4 = "False"; + if (XtraFlags.CountAllSubLevels == "True") fmtdata.SectData.StepSectionData.CountAllSubLevels = "True"; + else fmtdata.SectData.StepSectionData.CountAllSubLevels = "False"; + if (XtraFlags.UseMultiLineSectionTitle == "True") fmtdata.SectData.StepSectionData.UseMultiLineSectionTitle = "True"; + else fmtdata.SectData.StepSectionData.UseMultiLineSectionTitle = "False"; +#endregion + #region ChangeBars + if (XtraFlags.CondensedChangeBar == "True") fmtdata.ProcData.ChangeBarData.CondensedChangeBar = "True"; + else fmtdata.ProcData.ChangeBarData.CondensedChangeBar = "False"; + if (XtraFlags.AbsoluteFixedChangeColumn == "True") fmtdata.ProcData.ChangeBarData.AbsoluteFixedChangeColumn = "True"; + else fmtdata.ProcData.ChangeBarData.AbsoluteFixedChangeColumn = "False"; + if (XtraFlags.ContinuousChangeBars == "True") fmtdata.ProcData.ChangeBarData.ContinuousChangeBars = "True"; + else fmtdata.ProcData.ChangeBarData.ContinuousChangeBars = "False"; + if (XtraFlags.ChgBarMessageFromEdit == "True") fmtdata.ProcData.ChangeBarData.ChgBarMessageFromEdit = "True"; + else fmtdata.ProcData.ChangeBarData.ChgBarMessageFromEdit = "False"; + if (XtraFlags.MultipleChangeIds == "True") fmtdata.ProcData.ChangeBarData.MultipleChangeIds = "True"; + else fmtdata.ProcData.ChangeBarData.MultipleChangeIds = "False"; + if (XtraFlags.ChangeBarToRNOSep == "True") fmtdata.ProcData.ChangeBarData.ChangeBarToRNOSep = "True"; + else fmtdata.ProcData.ChangeBarData.ChangeBarToRNOSep = "False"; + if (XtraFlags.ChangeBarsOnLinkedText == "True") fmtdata.ProcData.ChangeBarData.ChangeBarsOnLinkedText = "True"; + else fmtdata.ProcData.ChangeBarData.ChangeBarsOnLinkedText = "False"; + #endregion + #region GeneralPrint & GeneralEdit + if (XtraFlags.DoRevDate == "True") fmtdata.PrintData.DoRevDate = "True"; + else fmtdata.PrintData.DoRevDate = "False"; + if (XtraFlags.AlternateFoldoutPages == "True") fmtdata.PrintData.AlternateFoldoutPages = "True"; + else fmtdata.PrintData.AlternateFoldoutPages = "False"; + if (XtraFlags.AlternateFloatingFoldout == "True") fmtdata.PrintData.AlternateFloatingFoldout = "True"; + else fmtdata.PrintData.AlternateFloatingFoldout = "False"; + if (XtraFlags.SectionLevelFoldouts == "True") fmtdata.PrintData.SectionLevelFoldouts = "True"; + else fmtdata.PrintData.SectionLevelFoldouts = "False"; + if (XtraFlags.RevDateWithForwardSlash == "True") fmtdata.PrintData.RevDateWithForwardSlash = "True"; + else fmtdata.PrintData.RevDateWithForwardSlash = "False"; + if (XtraFlags.SpecialStepsFoldout == "True") fmtdata.PrintData.SpecialStepsFoldout = "True"; + else fmtdata.PrintData.SpecialStepsFoldout = "False"; + if (XtraFlags.AccessoryDocsInDuplex == "True") fmtdata.PrintData.AccessoryDocsInDuplex = "True"; + else fmtdata.PrintData.AccessoryDocsInDuplex = "False"; + if (XtraFlags.FoldoutsInDuplex == "True") fmtdata.PrintData.FoldoutsInDuplex = "True"; + else fmtdata.PrintData.FoldoutsInDuplex = "False"; + if (XtraFlags.PagelistChangeIDsWithCommas == "True") fmtdata.PrintData.PagelistChangeIDsWithCommas = "True"; + else fmtdata.PrintData.PagelistChangeIDsWithCommas = "False"; + if (XtraFlags.PromptForCautinType == "True") fmtdata.EditData.PromptForCautionType = "True"; + else fmtdata.EditData.PromptForCautionType = "False"; + #endregion + #region Procedure + if (XtraFlags.DontCapitalizeTitle == "True") fmtdata.ProcData.CapitalizeTitle = "False"; + else fmtdata.ProcData.CapitalizeTitle = "True"; + if (XtraFlags.ChangeStyleForEverySection == "True") fmtdata.ProcData.ChangeStyleForEverySection = "True"; + else fmtdata.ProcData.ChangeStyleForEverySection = "False"; + if (XtraFlags.DontPrintNoTitle == "True") fmtdata.ProcData.PrintNoTitle = "False"; + else fmtdata.ProcData.PrintNoTitle = "True"; + if (XtraFlags.DontCountFoldoutPages == "True") fmtdata.ProcData.CountFoldoutPages = "False"; + else fmtdata.ProcData.CountFoldoutPages = "True"; + #endregion + #region Section + if (XtraFlags.CancelSecTitlesOnS1 == "True") fmtdata.SectData.CancelSecTitlesOnS1 = "True"; + else fmtdata.SectData.CancelSecTitlesOnS1 = "False"; + if (XtraFlags.CancelSecTitlesOnS2 == "True") fmtdata.SectData.CancelSecTitlesOnS2 = "True"; + else fmtdata.SectData.CancelSecTitlesOnS2 = "False"; + if (XtraFlags.CancelSecTitlesOnE0 == "True") fmtdata.SectData.CancelSecTitlesOnE0 = "True"; + else fmtdata.SectData.CancelSecTitlesOnE0 = "False"; + if (XtraFlags.CancelSecTitlesOnE2 == "True") fmtdata.SectData.CancelSecTitlesOnE2 = "True"; + else fmtdata.SectData.CancelSecTitlesOnE2 = "False"; + if (XtraFlags.MetaSectEndMessage == "True") fmtdata.SectData.MetaSectEndMessage = "True"; + else fmtdata.SectData.MetaSectEndMessage = "False"; + if (XtraFlags.ReadOnlyTypeInContMsg == "True") fmtdata.SectData.ReadOnlyTypeInContMsg = "True"; + else fmtdata.SectData.ReadOnlyTypeInContMsg = "False"; + if (XtraFlags.DontReplaceWordsInROs == "True") fmtdata.SectData.ReplaceWordsInROs = "False"; + else fmtdata.SectData.ReplaceWordsInROs = "True"; + if (XtraFlags.UseMetaSections == "True") fmtdata.SectData.UseMetaSections = "True"; + else fmtdata.SectData.UseMetaSections = "False"; + if (XtraFlags.NonEditableSteps == "True") fmtdata.SectData.NonEditableSteps = "True"; + else fmtdata.SectData.NonEditableSteps = "False"; + if (XtraFlags.SearchAllReplaceWords == "True") fmtdata.SectData.SearchAllReplaceWords = "True"; + else fmtdata.SectData.SearchAllReplaceWords = "False"; + if (XtraFlags.SecTitleContinue == "True") fmtdata.SectData.SecTitleContinue = "True"; + else fmtdata.SectData.SecTitleContinue = "False"; + if (XtraFlags.DontConvertCaretToDelta == "True") fmtdata.SectData.ConvertCaretToDelta = "False"; + else fmtdata.SectData.ConvertCaretToDelta = "True"; + #endregion + #region StepSectionPrint + if (XtraFlags.LowerCaseRevnum == "True") fmtdata.SectData.StepSectionData.StpSectPrtData.LowerCaseRevNum = "True"; + else fmtdata.SectData.StepSectionData.StpSectPrtData.LowerCaseRevNum = "False"; + if (XtraFlags.UseXtraRevNumber == "True") fmtdata.SectData.StepSectionData.StpSectPrtData.UseXtraRevNumber = "True"; + else fmtdata.SectData.StepSectionData.StpSectPrtData.UseXtraRevNumber = "False"; + if (XtraFlags.SpecialLandscapeMode == "True") fmtdata.SectData.StepSectionData.StpSectPrtData.SpecialLandscapeMode = "True"; + else fmtdata.SectData.StepSectionData.StpSectPrtData.SpecialLandscapeMode = "False"; + #endregion + #region CheckOff + if (XtraFlags.DropCheckOff == "True") fmtdata.ProcData.CheckOffData.DropCheckOff = "True"; + else fmtdata.ProcData.CheckOffData.DropCheckOff = "False"; + if (XtraFlags.CheckoffOnHLSOnly == "True") fmtdata.ProcData.CheckOffData.CheckOffOnHLSOnly = "True"; + else fmtdata.ProcData.CheckOffData.CheckOffOnHLSOnly = "False"; + #endregion + #region Trans + if (XtraFlags.SpecifiedSubstepsOnly == "True") fmtdata.TransData.SpecifiedSubstepsOnly = "True"; + else fmtdata.TransData.SpecifiedSubstepsOnly = "False"; + if (XtraFlags.CapsTransitions == "True") fmtdata.TransData.CapsTransitions = "True"; + else fmtdata.TransData.CapsTransitions = "False"; + if (XtraFlags.CapTranStep == "True") fmtdata.TransData.CapTranStep = "True"; + else fmtdata.TransData.CapTranStep = "False"; + if (XtraFlags.TSTepNoFlag == "True") fmtdata.TransData.TStepNoFlag = "True"; + else fmtdata.TransData.TStepNoFlag = "False"; + if (XtraFlags.LowerCaseTranNumber == "True") fmtdata.TransData.LowerCaseTranNumber = "True"; + else fmtdata.TransData.LowerCaseTranNumber = "False"; + if (XtraFlags.UpcaseTranAnd == "True") fmtdata.TransData.UpcaseTranAnd = "True"; + else fmtdata.TransData.UpcaseTranAnd = "False"; + if (XtraFlags.SuppressAndInTran == "True") fmtdata.TransData.SuppressAndInTran = "True"; + else fmtdata.TransData.SuppressAndInTran = "False"; + if (XtraFlags.Cap1stCharTrans == "True") fmtdata.TransData.Cap1stCharTrans = "True"; + else fmtdata.TransData.Cap1stCharTrans = "False"; + if (XtraFlags.UseTransitionModifier == "True") fmtdata.TransData.UseTransitionModifier = "True"; + else fmtdata.TransData.UseTransitionModifier = "False"; + if (XtraFlags.DontUseSecTitles == "True") fmtdata.TransData.UseSecTitles = "False"; + else fmtdata.TransData.UseSecTitles = "True"; + if (XtraFlags.HardSpTranProcNumb == "True") fmtdata.TransData.HardSpTranProcNumb = "True"; + else fmtdata.TransData.HardSpTranProcNumb = "False"; + if (XtraFlags.XChngTranSpForHard == "True") fmtdata.TransData.XchngTranSpForHard = "True"; + else fmtdata.TransData.XchngTranSpForHard = "False"; + if (XtraFlags.AbsoluteTransitionUpdate == "True") fmtdata.TransData.AbsoluteTransitionUpdate = "True"; + else fmtdata.TransData.AbsoluteTransitionUpdate = "False"; + if (XtraFlags.LowerCaseStepInTran == "True") fmtdata.TransData.LowerCaseStepInTran = "True"; + else fmtdata.TransData.LowerCaseStepInTran = "False"; + if (XtraFlags.DoSectionTrans == "True") fmtdata.TransData.DoSectionTransitions = "True"; + else fmtdata.TransData.DoSectionTransitions = "False"; + #endregion + #region RO + if (XtraFlags.AllUnits == "True") fmtdata.ROData.AllUnits = "True"; + else fmtdata.ROData.AllUnits = "False"; + if (XtraFlags.UpSetpntAftrDash == "True") fmtdata.ROData.UpRoAftrDash = "True"; + else fmtdata.ROData.UpRoAftrDash = "False"; + if (XtraFlags.UpcaseAllSetpointUnits == "True") fmtdata.ROData.UpcaseAllRoUnits = "True"; + else fmtdata.ROData.UpcaseAllRoUnits = "False"; + if (XtraFlags.CapHighSetpnt == "True") fmtdata.ROData.CapHighRo = "True"; + else fmtdata.ROData.CapHighRo = "False"; + if (XtraFlags.CapsPIFLastLower == "True") fmtdata.ROData.CapRoIfLastLower = "True"; + else fmtdata.ROData.CapRoIfLastLower = "False"; + if (XtraFlags.UpSpIfPrevUpper == "True") fmtdata.ROData.UpRoIfPrevUpper = "True"; + else fmtdata.ROData.UpRoIfPrevUpper = "False"; + if (XtraFlags.UnderlineSetpoints == "True") fmtdata.ROData.UnderlineRo = "True"; + else fmtdata.ROData.UnderlineRo = "False"; + #endregion + return true; + } + + private string GetTransUIEnum(string format, string menu) + { + string transtrtmp = (menu == null || menu == "") ? format : menu; + E_TransFormatXlate xlt = TransFormat(transtrtmp); + // xlt has flags that say what is included in the transition menu + // string. Use this to set the enum that the 32-bit code will use + // to display menuing... + E_TransitionMenus transmenuflag = TransToMenuFlags(xlt); + return ((E_TransitionMenus)transmenuflag).ToString(); + } + private E_TransitionMenus TransToMenuFlags(E_TransFormatXlate xlt) + { + E_TransitionMenus result = E_TransitionMenus.None; + + // for procedures, if the menu string contains a 'procedure', then the + // selection will come from a menu, otherwise, it defaults to current procedure + // and the menu will be disabled. + result |= (xlt & E_TransFormatXlate.Procedure)== E_TransFormatXlate.Procedure ? E_TransitionMenus.ProcMenu : E_TransitionMenus.ProcCur; + + // for sections... + if ((xlt & E_TransFormatXlate.Section) == E_TransFormatXlate.Section) + { + if ((xlt & E_TransFormatXlate.Range) == E_TransFormatXlate.Range) + result |= E_TransitionMenus.SectMenuStep; + else + result |= E_TransitionMenus.SectMenuAny; + + } + else + { + if ((xlt & E_TransFormatXlate.Procedure) == E_TransFormatXlate.Procedure) + result |= E_TransitionMenus.SectDefault; + else + result |= E_TransitionMenus.SectCur; + } + + // now do steps... + if ((xlt & E_TransFormatXlate.Range) == E_TransFormatXlate.Range) + { + result |= E_TransitionMenus.StepFirst; + result |= E_TransitionMenus.StepLast; + } + else + result |= E_TransitionMenus.StepFirst; + if (((result & E_TransitionMenus.SectDefault) == E_TransitionMenus.SectDefault) || ((result & E_TransitionMenus.SectMenuAny)==E_TransitionMenus.SectMenuAny)) + result |= E_TransitionMenus.StepAllowNone; + + return result; + } + private static E_TransFormatXlate TransFormat(string str) + { + E_TransFormatXlate retval = E_TransFormatXlate.None; + if (HasRange(str)) retval |= E_TransFormatXlate.Range; + else if (HasStep(str)) retval |= E_TransFormatXlate.Step; + if (HasSection(str)) retval |= E_TransFormatXlate.Section; + if (HasProc(str)) retval |= E_TransFormatXlate.Procedure; + if (HasPage(str)) retval |= E_TransFormatXlate.Page; + return retval; + } + private static bool HasProc(string str) + { + return str.Contains("{Proc")||str.Contains("{?.Proc"); + } + private static bool HasPage(string str) + { + return str.Contains("{Page"); + } + private static bool HasSection(string str) + { + return str.Contains("{Sect")||str.Contains("{?.Sect"); + } + private static bool HasRange(string str) + { + return str.Contains("{Last"); + } + private static bool HasStep(string str) + { + if (str.Contains("{Step")) return true; + return str.Contains("{First Step"); + } + private string ConvertSeqStart(byte p) + { + if (p == 0 || p == 0x30) return "{numeric}"; + else if (p == 0x60) return "{alpha}"; + else if (p == 0x40) return "{ALPHA}"; + else return "{UNKNOWN}"; + } + #endregion + #region WriteOutXml + public bool WriteOutXml(FormatData fmtdata) + { + // First serialize files based on the above - then use xsl to transform + // into prefered xml. + if (!Directory.Exists("fmt_xml")) Directory.CreateDirectory("fmt_xml"); + if (!Directory.Exists("tmp_fmt_xml")) Directory.CreateDirectory("tmp_fmt_xml"); + XmlSerializer serializer = new XmlSerializer(typeof(FormatData)); + + string lfmtname = fmtName; + int findx = fmtName.IndexOf('.'); + // for subformats, make the name FMT_00 where FMT is format name & 00 is number + // from original name. This will allow the data load to know it's a sub. + if (findx > 0) + lfmtname = fmtName.Substring(0, fmtName.Length - 4) + "_" + fmtName.Substring(fmtName.Length - 2, 2); + string destfile = "tmp_fmt_xml\\" + lfmtname + "f.xml"; + if (File.Exists(destfile)) File.Delete(destfile); + TextWriter writer = new StreamWriter(destfile); + try + { + serializer.Serialize(writer, fmtdata); + writer.Close(); + XslCompiledTransform xsl = new XslCompiledTransform(); + xsl.Load(Application.StartupPath + "\\TranslateFmt.XSL"); + string sResults = "fmt_xml\\" + lfmtname + "f.xml"; + xsl.Transform(destfile, sResults); // Perform Transform + + xsl.Load(Application.StartupPath + "\\removeempty.XSL"); + string sResults2 = "fmt_xml\\" + lfmtname + "xf.xml"; + xsl.Transform(sResults, sResults2); + File.Delete(sResults); + xsl.Transform(sResults2, sResults); + File.Delete(sResults2); + } + + catch (Exception e) + { + Console.WriteLine("Error writing out xml or xsl - format = {0}", fmtdata.Name); + Console.WriteLine(e.Message); + Console.WriteLine(); + return false; + } + return true; + } + #endregion + #region OriginalNoBase + //public void LoadFormatFileOrig(string fname) + //{ + // FormatData fmtdata = new FormatData(); + + // // read in data & put into correct place of structures. + // // for test string fnm = "E:\\proms.net\\exe\\fmtxml\\" + fname; + // string fnm = "E:\\ve-proms\\format\\" + fname; + // brFmt = new BinaryReader(File.Open(fnm, System.IO.FileMode.Open, System.IO.FileAccess.ReadWrite, FileShare.ReadWrite)); + // bool success = ReadInFmtFile(ref fmtdata); + // #region FinishMainConvert + // if (success) + // { + // DoStepInheritance(ref fmtdata.StepData); + // success = WriteOutXml(fmtdata); + // } + // #endregion + // brFmt.Close(); + + // #region ProcessSubFormats + // // For each sub-format, load the entire file & compare to parent contents + // DirectoryInfo di = new DirectoryInfo("E:\\ve-proms\\format"); + // string substr = fname.Substring(0, fname.IndexOf('.')) + ".x*"; + // FileInfo [] fis = di.GetFiles(substr); + // foreach (FileInfo fi in fis) + // { + // //this.listBox1.Items.Add(fi.Name); + // fmtName = fi.Name; + // fnm = "E:\\ve-proms\\format\\" + fi.Name; + // brFmt = new BinaryReader(File.Open(fnm, System.IO.FileMode.Open, System.IO.FileAccess.ReadWrite, FileShare.ReadWrite)); + // FormatData subdata = new FormatData(); + // success = ReadInFmtFile(ref subdata); + // if (success) + // { + // DoStepInheritance(ref subdata.StepData); + // } + // // Now do entire format inheritance - then write out. + // success = CompareParentSub(fmtdata, ref subdata); + // success = WriteOutXml(subdata); + + // } + // #endregion + //} + #endregion + #region InheritBase + public void LoadFormatFile(string fname, ref XtraFlgs XtraFlags) + { + FormatData fmtdata = new FormatData(); + + // read in data & put into correct place of structures. + // for test string fnm = "E:\\proms.net\\exe\\fmtxml\\" + fname; + string fnm = "E:\\ve-proms\\format\\" + fname; + brFmt = new BinaryReader(File.Open(fnm, System.IO.FileMode.Open, System.IO.FileAccess.ReadWrite, FileShare.ReadWrite)); + bool success = ReadInFmtFile(ref fmtdata, ref BaseXtraFlags); + if (!HasBase) InitSymbols(ref fmtdata); + else fmtdata.Symbols = null; + if (success) + { + DoStepInheritance(ref fmtdata.StepData); + success = WriteOutXml(fmtdata); + } + brFmt.Close(); + + // Now compare with gen (if !gen). + if (HasBase == true) + { + success = CompareParentSub(BaseFormat, ref fmtdata); + success = WriteOutXml(fmtdata); + + // For each sub-format, load the entire file & compare to parent contents + DirectoryInfo di = new DirectoryInfo("E:\\ve-proms\\format"); + string substr = fname.Substring(0, fname.IndexOf('.')) + ".x*"; + FileInfo[] fis = di.GetFiles(substr); + foreach (FileInfo fi in fis) + { + //this.listBox1.Items.Add(fi.Name); + fmtName = fi.Name; + fnm = "E:\\ve-proms\\format\\" + fi.Name; + brFmt = new BinaryReader(File.Open(fnm, System.IO.FileMode.Open, System.IO.FileAccess.ReadWrite, FileShare.ReadWrite)); + FormatData subdata = new FormatData(); + success = ReadInFmtFile(ref subdata, ref SubXtraFlags); + if (success) + { + DoStepInheritance(ref subdata.StepData); + } + // Now do entire format inheritance - then write out. + success = CompareParentSub(fmtdata, ref subdata); + success = CompareParentSub(BaseFormat, ref subdata); + success = WriteOutXml(subdata); + } + } + MyFormat = fmtdata; + } + + private void InitSymbols(ref FormatData fmtdata) + { + fmtdata.Symbols = new Symbol[35]; + fmtdata.Symbols[0].Unicode="176"; + fmtdata.Symbols[0].Desc="degree"; + fmtdata.Symbols[1].Unicode="916"; + fmtdata.Symbols[1].Desc="delta"; + fmtdata.Symbols[2].Unicode="8805"; + fmtdata.Symbols[2].Desc="greater than or equal"; + fmtdata.Symbols[3].Unicode="8804"; + fmtdata.Symbols[3].Desc="less than or equal"; + fmtdata.Symbols[4].Unicode="177"; + fmtdata.Symbols[4].Desc="plus minus"; + fmtdata.Symbols[5].Unicode="176"; + fmtdata.Symbols[5].Desc="degree"; + fmtdata.Symbols[6].Unicode="931"; + fmtdata.Symbols[6].Desc="sigma"; + fmtdata.Symbols[7].Unicode="947"; + fmtdata.Symbols[7].Desc = "gamma"; + fmtdata.Symbols[8].Unicode="189"; + fmtdata.Symbols[8].Desc = "half"; + fmtdata.Symbols[9].Unicode="9604"; + fmtdata.Symbols[9].Desc = "accum"; + fmtdata.Symbols[10].Unicode="9679"; + fmtdata.Symbols[10].Desc = "bullet"; + fmtdata.Symbols[11].Unicode="8776"; + fmtdata.Symbols[11].Desc = "approx eq"; + fmtdata.Symbols[12].Unicode="8773"; + fmtdata.Symbols[12].Desc = "similar eq"; + fmtdata.Symbols[13].Unicode="247"; + fmtdata.Symbols[13].Desc = "division"; + fmtdata.Symbols[14].Unicode="8730"; + fmtdata.Symbols[14].Desc="square root"; + fmtdata.Symbols[15].Unicode="961"; + fmtdata.Symbols[15].Desc = "rho"; + fmtdata.Symbols[16].Unicode="960"; + fmtdata.Symbols[16].Desc = "pi"; + fmtdata.Symbols[17].Unicode="956"; + fmtdata.Symbols[17].Desc = "micro"; + fmtdata.Symbols[18].Unicode="948"; + fmtdata.Symbols[18].Desc = "lower case delta"; + fmtdata.Symbols[19].Unicode="963"; + fmtdata.Symbols[19].Desc = "lower case sigma"; + fmtdata.Symbols[20].Unicode="188"; + fmtdata.Symbols[20].Desc = "quarter"; + fmtdata.Symbols[21].Unicode="216"; + fmtdata.Symbols[21].Desc = "dist zero"; + fmtdata.Symbols[22].Unicode="274"; + fmtdata.Symbols[22].Desc = "energy"; + fmtdata.Symbols[23].Unicode="236"; + fmtdata.Symbols[23].Desc = "grave"; + fmtdata.Symbols[24].Unicode="9474"; + fmtdata.Symbols[24].Desc = "bar"; + fmtdata.Symbols[25].Unicode="949"; + fmtdata.Symbols[25].Desc = "epsilon"; + fmtdata.Symbols[26].Unicode="952"; + fmtdata.Symbols[26].Desc = "theta"; + fmtdata.Symbols[27].Unicode="8857"; + fmtdata.Symbols[27].Desc = "dot in oval"; + fmtdata.Symbols[28].Unicode="964"; + fmtdata.Symbols[28].Desc = "tau"; + fmtdata.Symbols[29].Unicode="9830"; + fmtdata.Symbols[29].Desc = "diamond"; + fmtdata.Symbols[30].Unicode="8594"; + fmtdata.Symbols[30].Desc = "right arrow"; + fmtdata.Symbols[31].Unicode="8592"; + fmtdata.Symbols[31].Desc = "left arrow"; + fmtdata.Symbols[32].Unicode="8593"; + fmtdata.Symbols[32].Desc = "up arrow"; + fmtdata.Symbols[33].Unicode="8595"; + fmtdata.Symbols[33].Desc = "down arrow"; + fmtdata.Symbols[34].Unicode="8711"; + fmtdata.Symbols[34].Desc = "unknown5"; + } + #endregion + #region TokenConvert + private string ConvertTransFormat(string p) + { + // parenflag puts paren around proc title AND sectitle. + p=p.Replace("\xff","\xA0"); + p=p.Replace("\x07","{First Step}"); + p=p.Replace("\x08","{Last Step}"); + p=p.Replace("\x04","{Sect Title}"); + p = p.Replace("\x06", "{Sect Title}"); + p=p.Replace("\x03","{Sect Num}"); + p = p.Replace("\x17", "{Sect Num}"); + p = p.Replace("\x02", "{Proc Title}"); + p = p.Replace("\x01", "{Proc Num}"); + p = p.Replace("\xF", "{Page Num}"); + p = p.Replace("\x1E", "{Page Num}"); + p = p.Replace("\x1D", "{Step Text}"); + p = p.Replace("\x0D", "Step {First Step}"); + + // the following are in cpl & she format Not sure what to do so just + // flag them + //if (p.Length==1 && (p.IndexOfAny("\x19\x1A".ToCharArray())>-1)) + //{ + p = p.Replace("\x19", "{TransFmt hex 19}"); + p = p.Replace("\x1A", "{TransFmt hex 1a}"); + //} + + p = ConvertText(p); + p = DoReplaceTokens(p); + return p; + } + private string DoReplaceTokens(string p) + { + if (p == null || p == "") return p; + string wkstr = p; + // use regular expressions to do the following... + + try + { + // replace newline with {par} + wkstr = wkstr.Replace("\n", "{par}"); + + // special change bar token (various cpl formats) + wkstr = wkstr.Replace("\x08\x08\x08\x08\x08\x05", "{CHG_BAR with Backspace Token}"); + + // special change bar token (various gpc formats) + wkstr = wkstr.Replace("\x05", "{CHG_BAR Token}"); + + // backspage - just flag for positioning if needed. + wkstr = wkstr.Replace("\x08", "{Backspace}"); + + //sub on/off + //sub on/off - stop at EOL, another token or a space. + wkstr = wkstr.Replace("\x19\x19", "\x19"); // replace double sub on with single + wkstr = wkstr.Replace("~~", "\x19"); + wkstr = Regex.Replace(wkstr, @"\x19([^\x19\x18 ]*?)(?:[\x19\x18]|(?= )|\Z)(.*?)", @"\sub $1\nosupersub $2"); + + //super on/off + //super on/off - stop at EOL, another token or a space. + wkstr = Regex.Replace(wkstr, @"\x18([^\x19\x18 ]*?)(?:[\x19\x18]|(?= )|\Z)(.*?)", @"\super $1\nosupersub $2"); + + //bold on/off - stop at end of line or another token. + wkstr = Regex.Replace(wkstr, @"\x01([^\x01]*?)(?:\x01|\Z)", @"\b $1\b0 "); + //OLD CODE (pre-10/2007): wkstr = Regex.Replace(wkstr, @"\x01([^\x01 ]*?)(?:[\x01]|(?= )|\Z)(.*?)", @"\b$1\b0$2"); + //bold on/off - stop at EOL, another token or a space + wkstr = Regex.Replace(wkstr, @"\x13([^\x13\xd6 ]*?)(?:[\x13\xd6]|(?= )|\Z)(.*?)", @"\b $1\b0 $2"); + + //underline on/off - look for 16 followed by non-sixteen (as many as there are) and followed by 16 or endofline + //OLD CODE (pre-10/2007): wkstr = Regex.Replace(wkstr, @"\x16([^\x16 ]*?)(?:[\x16]|(?= )|\Z)(.*?)", @"\ul$1\ul0$2"); + //underline on/off - stop at end of line or another token. + wkstr = Regex.Replace(wkstr, @"\x16([^\x16]*?)(?:\x16|\Z)", @"\ul $1\ul0 "); + + //narrator + wkstr = Regex.Replace(wkstr, @"\x86([^\x86 ]*?)(?:[\x86]|(?= )|\Z)(.*?)", @"\f{Narrator}$1\f0$2"); + + // remove hanging indent, vertical tab + wkstr = Regex.Replace(wkstr, @"\x02", @"\NonSupported Hanging Indent (Hex x02)"); + wkstr = Regex.Replace(wkstr, @"\x0B", @"\NonSupported Vertical Tab (Hex x0b"); + + // remove some unknown chars for ano & fpl - these plants are not supported + // as of conversion date. + wkstr = Regex.Replace(wkstr, @"\x95", @"\NonSupported Unknown (Hex x95)"); //ano2vlv + wkstr = Regex.Replace(wkstr, @"\x1bf1", @"\NonSupported Unknown (hex 1b f1)"); //fpl + wkstr = Regex.Replace(wkstr, @"\x1bf0", @"\NonSupported Unknown (hex 1b f0)"); //fpl + wkstr = Regex.Replace(wkstr, @"\x1bM1", @"\NonSupported Unknown (hex 1b M1)"); //fpl + wkstr = Regex.Replace(wkstr, @"\x1bM0", @"\NonSupported Unknown (hex 1b M0)"); //fpl + + // replace \xff with \xA0, i.e. hardspace + wkstr = Regex.Replace(wkstr, @"\xFF", @"\xA0"); + + // replace x10 & x11 in various ano tabs - not this needs fixed if ANO comes + // back into the program + wkstr = wkstr.Replace("\x10",""); + wkstr = wkstr.Replace("\x11", ""); + + // replace x15 with {RO} for now. + wkstr = wkstr.Replace("\x15","{RO}"); + } + catch (Exception ex) + { + Console.WriteLine("error replacing token (regex) = {0}", ex.Message); + } + + return wkstr; + } + private int CalculateTabWid(string p) + { + if (p == null || p.Length == 0) return 0; + int tablen = p.Length; + // don't count if macro.... + int tokb = p.IndexOf("{"); + if (tokb > -1) + { + if ((tokb = p.IndexOf("{!")) > -1) + { + int toke = p.IndexOf("}", tokb + 2); + tablen -= (toke - tokb + 1); + } + else + tablen -= 2; // "{}" + } + if ((tokb = p.IndexOf("\xA1")) > -1) tablen--; // flags circle macro + if ((tokb = p.IndexOf("##-3#"))> -1) tablen -= 5; // positioning + if ((tokb = p.IndexOf("\xAF")) > -1) tablen--; // indent + if ((tokb = p.IndexOf("\n")) > -1) tablen--; // newline - not sure what to do here + if ((tokb = p.IndexOf("ê")) > -1) tablen--; // box step flag + for (int i=0; i-1) || (po.IndexOf("ENHANCEDDEVIATIONS")>-1)) + { + wkstr = wkstr.Replace("#", "{LNK C/N Num}"); + wkstr = wkstr.Replace("~", "{LNK Step Num}"); + } + + // Insert seq & numeric for sequential & any high type if there are not other + // commands. + int indx = 0; + // if sequential or high, add the seq or numeric token + if (i == 0 && ((indx = wkstr.IndexOf("{")) < 0)) // sequential - put in "{seq}" + wkstr = wkstr.Insert(0, "{seq}"); + // high, immediate, continuous, lossofac, high5 - put in " {numeric} " + else if ((i == 1 || i == 2 || i == 8 || i == 17 || i == 40) && ((indx = wkstr.IndexOf("{")) < 0)) + wkstr = wkstr.Insert(1, "{numeric}"); + + //Section Numbers + // % - Prefix with section number (works string in 16 bit, ie.e For 4.3 the prefix becomes 4. + // wid that would be stored. + wkstr = Regex.Replace(wkstr, @"%", @"{Section Prefix}"); + + // Position offset + // \257 - Indent (CALLOWAY BACKGROUNDS) + // Newline within a tab (calbck) + wkstr = wkstr.Replace("\xAF", @"{indent}"); + wkstr = wkstr.Replace("\n", @"{par}"); + + //Macros + // - draws a diamond around the stepnumber + // - A macro + // + // <> - ignored + // \241 - circle macro around step, same as + // Also note, the format files had "<>", these get converted during input in this + // format converter code. + wkstr = wkstr.Replace("{!asterisk}", "\\fs10 \\b*\\b0"); // was font size 20 in 16-bit + wkstr = Regex.Replace(wkstr, @"{![.*?]}", @"{!$1}"); + wkstr = wkstr.Replace("{}", ""); + wkstr = wkstr.Replace("ñ", "{!C0}"); + if (vefont != null && vefont.HasCircleString2()) wkstr.Insert(0,"{!C0}"); + + // Symbols + // * - simply an asterisk (do nothing here) + // - - simlply a dash (do nothing here) + // \007 - bullet (gets translated + wkstr = wkstr.Replace("\007", "\x9679"); + wkstr = wkstr.Replace("ê", @"{Box Step}"); + wkstr = DoReplaceTokens(wkstr); + wkstr = ConvertText(wkstr); + return wkstr; + } + #endregion + #region DoEntireInherit + private bool CompareParentSub(FormatData mainFmt, ref FormatData subFmt) + { + // just compare all fields - clear the subformat if equal. + #region COMPAREACTIVE + if (mainFmt.FontData != null && subFmt.FontData != null) + { + if (mainFmt.FontData.FontFamily == subFmt.FontData.FontFamily) subFmt.FontData.FontFamily = null; + if (mainFmt.FontData.FontSize == subFmt.FontData.FontSize) subFmt.FontData.FontSize = null; + if (mainFmt.FontData.FontStyle == subFmt.FontData.FontStyle) subFmt.FontData.FontStyle = null; + } + if (mainFmt.PurchaseOptions == subFmt.PurchaseOptions) subFmt.PurchaseOptions = null; + if (mainFmt.EditData.EMode == subFmt.EditData.EMode) subFmt.EditData.EMode = null; + if (mainFmt.EditData.PromptForCautionType != null && mainFmt.EditData.PromptForCautionType == subFmt.EditData.PromptForCautionType) subFmt.EditData.PromptForCautionType = "null"; + if (mainFmt.SectData.StepSectionData.TopRow == subFmt.SectData.StepSectionData.TopRow) subFmt.SectData.StepSectionData.TopRow = 0; + if (mainFmt.PrintData.DoPrnDrvrAdjusts == subFmt.PrintData.DoPrnDrvrAdjusts) subFmt.PrintData.DoPrnDrvrAdjusts = 0; + if (mainFmt.PrintData.DoRevDate != null && mainFmt.PrintData.DoRevDate == subFmt.PrintData.DoRevDate) subFmt.PrintData.DoRevDate = "null"; + if (mainFmt.PrintData.AlternateFoldoutPages != null && mainFmt.PrintData.AlternateFoldoutPages == subFmt.PrintData.AlternateFoldoutPages) subFmt.PrintData.AlternateFoldoutPages = "null"; + if (mainFmt.PrintData.AlternateFloatingFoldout != null && mainFmt.PrintData.AlternateFloatingFoldout == subFmt.PrintData.AlternateFloatingFoldout) subFmt.PrintData.AlternateFloatingFoldout = "null"; + if (mainFmt.PrintData.SectionLevelFoldouts != null && mainFmt.PrintData.SectionLevelFoldouts == subFmt.PrintData.SectionLevelFoldouts) subFmt.PrintData.SectionLevelFoldouts = "null"; + if (mainFmt.PrintData.RevDateWithForwardSlash != null && mainFmt.PrintData.RevDateWithForwardSlash == subFmt.PrintData.RevDateWithForwardSlash) subFmt.PrintData.RevDateWithForwardSlash = "null"; + if (mainFmt.PrintData.SpecialStepsFoldout != null && mainFmt.PrintData.SpecialStepsFoldout == subFmt.PrintData.SpecialStepsFoldout) subFmt.PrintData.SpecialStepsFoldout = "null"; + if (mainFmt.PrintData.AccessoryDocsInDuplex != null && mainFmt.PrintData.AccessoryDocsInDuplex == subFmt.PrintData.AccessoryDocsInDuplex) subFmt.PrintData.AccessoryDocsInDuplex = "null"; + if (mainFmt.PrintData.FoldoutsInDuplex != null && mainFmt.PrintData.FoldoutsInDuplex == subFmt.PrintData.FoldoutsInDuplex) subFmt.PrintData.FoldoutsInDuplex = "null"; + if (mainFmt.PrintData.PagelistChangeIDsWithCommas != null && mainFmt.PrintData.PagelistChangeIDsWithCommas == subFmt.PrintData.PagelistChangeIDsWithCommas) subFmt.PrintData.PagelistChangeIDsWithCommas = "null"; + + // compare step data, step index by step index. This assumes that step data between + // the two indices is the same. + for (int i = 0; i < MAXSTEPS; i++) + { + Step mstp = mainFmt.StepData[i]; + Step sstp = subFmt.StepData[i]; + if (mstp.Font != null && sstp.Font != null) + { + if (mstp.Font.FontFamily == mstp.Font.FontFamily) subFmt.StepData[i].Font.FontFamily = null; + if (mstp.Font.FontSize == mstp.Font.FontSize) subFmt.StepData[i].Font.FontSize = null; + if (mstp.Font.FontStyle == mstp.Font.FontStyle) subFmt.StepData[i].Font.FontStyle = null; + } + if (mstp.StepLayoutData.ForeColor == sstp.StepLayoutData.ForeColor) subFmt.StepData[i].StepLayoutData.ForeColor = null; + if (mstp.StepLayoutData.BackColor == sstp.StepLayoutData.BackColor) subFmt.StepData[i].StepLayoutData.BackColor = null; + if (mstp.StepLayoutData.STExtraSpace == sstp.StepLayoutData.STExtraSpace) subFmt.StepData[i].StepLayoutData.STExtraSpace = null; + if (mstp.StepLayoutData.STBoxindex == sstp.StepLayoutData.STBoxindex) subFmt.StepData[i].StepLayoutData.STBoxindex = null; + if (mstp.StepPrintData.PosAdjust == sstp.StepPrintData.PosAdjust) subFmt.StepData[i].StepPrintData.PosAdjust = null; + if (mstp.StepEditData.AcTable == sstp.StepEditData.AcTable) subFmt.StepData[i].StepEditData.AcTable = null; + if (mstp.StepLayoutData.EveryNLines == sstp.StepLayoutData.EveryNLines) subFmt.StepData[i].StepLayoutData.EveryNLines = null; + if (mstp.StepLayoutData.SpaceBefore == sstp.StepLayoutData.SpaceBefore) subFmt.StepData[i].StepLayoutData.SpaceBefore = null; + if (mstp.StepLayoutData.SpaceAfter == sstp.StepLayoutData.SpaceAfter) subFmt.StepData[i].StepLayoutData.SpaceAfter = null; + if (mstp.StepLayoutData.AlwaysUpperCase == sstp.StepLayoutData.AlwaysUpperCase) subFmt.StepData[i].StepLayoutData.AlwaysUpperCase = null; + if (mstp.StepLayoutData.PageBreakAtTypeChange == sstp.StepLayoutData.PageBreakAtTypeChange) subFmt.StepData[i].StepLayoutData.PageBreakAtTypeChange = null; + if (mstp.StepLayoutData.AlignWithParentTab == sstp.StepLayoutData.AlignWithParentTab) subFmt.StepData[i].StepLayoutData.AlignWithParentTab = null; + if (mstp.StepLayoutData.RtCheckOffGroups == sstp.StepLayoutData.RtCheckOffGroups) subFmt.StepData[i].StepLayoutData.RtCheckOffGroups = null; + if (mstp.StepLayoutData.StepTypeWidthOverride == sstp.StepLayoutData.StepTypeWidthOverride) subFmt.StepData[i].StepLayoutData.StepTypeWidthOverride = null; + if (mstp.VertPos == sstp.VertPos) subFmt.StepData[i].VertPos = null; + if (mstp.DoubleSpace != null && mstp.DoubleSpace == sstp.DoubleSpace) subFmt.StepData[i].DoubleSpace = "null"; + if (mstp.EnhancedStepNumFromPrev != null && mstp.EnhancedStepNumFromPrev == sstp.EnhancedStepNumFromPrev) subFmt.StepData[i].EnhancedStepNumFromPrev = "null"; + if (mstp.UseSmartTemplate != null && mstp.UseSmartTemplate == sstp.UseSmartTemplate) subFmt.StepData[i].UseSmartTemplate = "null"; + if (mstp.AlwaysUseExtraLines != null && mstp.AlwaysUseExtraLines == sstp.AlwaysUseExtraLines) subFmt.StepData[i].AlwaysUseExtraLines = "null"; + if (mstp.SeparateBox != null && mstp.SeparateBox == sstp.SeparateBox) subFmt.StepData[i].SeparateBox = "null"; + if (mstp.SeparateBoxCautions != null && mstp.SeparateBoxCautions == sstp.SeparateBoxCautions) subFmt.StepData[i].SeparateBoxCautions = "null"; + if (mstp.SpaceDouble != null && mstp.SpaceDouble == sstp.SpaceDouble) subFmt.StepData[i].SpaceDouble = "null"; + if (mstp.ReduceLineAfter != null && mstp.ReduceLineAfter == sstp.ReduceLineAfter) subFmt.StepData[i].ReduceLineAfter = "null"; + if (mstp.SameLevel != null && mstp.SameLevel == sstp.SameLevel) subFmt.StepData[i].SameLevel = "null"; + if (mstp.BoldHighLevel != null && mstp.BoldHighLevel == sstp.BoldHighLevel) subFmt.StepData[i].BoldHighLevel = "null"; + if (mstp.OneLineBeforeTab != null && mstp.OneLineBeforeTab == sstp.OneLineBeforeTab) subFmt.StepData[i].OneLineBeforeTab = "null"; + if (mstp.CheckOffOnAllSteps != null && mstp.CheckOffOnAllSteps == sstp.DoubleSpace) subFmt.StepData[i].CheckOffOnAllSteps = "null"; + if (mstp.BoxIt != null && mstp.BoxIt == sstp.BoxIt) subFmt.StepData[i].BoxIt = "null"; + if (mstp.Boxed != null && mstp.Boxed == sstp.Boxed) subFmt.StepData[i].Boxed = "null"; + if (mstp.XLines_StepFix != null && mstp.XLines_StepFix == sstp.XLines_StepFix) subFmt.StepData[i].XLines_StepFix = "null"; + if (mstp.Rebox != null && mstp.Rebox == sstp.Rebox) subFmt.StepData[i].Rebox = "null"; + if (mstp.SpcHdr != null && mstp.SpcHdr == sstp.SpcHdr) subFmt.StepData[i].SpcHdr = "null"; + if (mstp.ContinueOnly != null && mstp.ContinueOnly == sstp.ContinueOnly) subFmt.StepData[i].ContinueOnly = "null"; + if (mstp.SepAfterAER != null && mstp.SepAfterAER == sstp.SepAfterAER) subFmt.StepData[i].SepAfterAER = "null"; + if (mstp.UseAlternateStepBox != null && mstp.UseAlternateStepBox == sstp.UseAlternateStepBox) subFmt.StepData[i].UseAlternateStepBox = "null"; + if (mstp.UnderlineAfterDashSpace != null && mstp.UnderlineAfterDashSpace == sstp.UnderlineAfterDashSpace) subFmt.StepData[i].UnderlineAfterDashSpace = "null"; + if (mstp.SpaceIn != null && mstp.SpaceIn == sstp.SpaceIn) subFmt.StepData[i].SpaceIn = "null"; + if (mstp.PageBreakOnStep != null && mstp.PageBreakOnStep == sstp.PageBreakOnStep) subFmt.StepData[i].PageBreakOnStep = "null"; + if (mstp.AlignNullTabWSectHead != null && mstp.AlignNullTabWSectHead == sstp.AlignNullTabWSectHead) subFmt.StepData[i].AlignNullTabWSectHead = "null"; + if (mstp.TextSubFollowsTextStyle != null && mstp.TextSubFollowsTextStyle == sstp.TextSubFollowsTextStyle) subFmt.StepData[i].TextSubFollowsTextStyle = "null"; + if (mstp.TreatAsSequential != null && mstp.TreatAsSequential == sstp.TreatAsSequential) subFmt.StepData[i].TreatAsSequential = "null"; + if (mstp.MatchUpRNO != null && mstp.MatchUpRNO == sstp.MatchUpRNO) subFmt.StepData[i].MatchUpRNO = "null"; + if (mstp.InPageList != null && mstp.InPageList == sstp.InPageList) subFmt.StepData[i].InPageList = "null"; + if (mstp.CenterOneLineOnly != null && mstp.CenterOneLineOnly == sstp.CenterOneLineOnly) subFmt.StepData[i].CenterOneLineOnly = "null"; + if (mstp.SubTableGetsUp1Level != null && mstp.SubTableGetsUp1Level == sstp.SubTableGetsUp1Level) subFmt.StepData[i].SubTableGetsUp1Level = "null"; + if (mstp.Remember != null && mstp.Remember == sstp.Remember) subFmt.StepData[i].Remember = "null"; + if (mstp.CenterOneLineAdjust != null && mstp.CenterOneLineAdjust == sstp.CenterOneLineAdjust) subFmt.StepData[i].CenterOneLineAdjust = "null"; + if (mstp.Break != null && mstp.Break == sstp.Break) subFmt.StepData[i].Break = "null"; + if (mstp.BreakEquipmentList != null && mstp.BreakEquipmentList == sstp.BreakEquipmentList) subFmt.StepData[i].BreakEquipmentList = "null"; + if (mstp.BreakCautionsNotesOnSubstps != null && mstp.BreakCautionsNotesOnSubstps == sstp.BreakCautionsNotesOnSubstps) subFmt.StepData[i].BreakCautionsNotesOnSubstps = "null"; + if (mstp.CenterTextWithinWidth != null && mstp.CenterTextWithinWidth == sstp.CenterTextWithinWidth) subFmt.StepData[i].CenterTextWithinWidth = "null"; + if (mstp.NewlineAfter != null && mstp.NewlineAfter == sstp.NewlineAfter) subFmt.StepData[i].NewlineAfter = "null"; + if (mstp.StartLineWithDash != null && mstp.StartLineWithDash == sstp.StartLineWithDash) subFmt.StepData[i].StartLineWithDash = "null"; + if (mstp.BlankLineBeforeSubStep != null && mstp.BlankLineBeforeSubStep == sstp.BlankLineBeforeSubStep) subFmt.StepData[i].BlankLineBeforeSubStep = "null"; + if (mstp.AlwaysTab != null && mstp.AlwaysTab == sstp.AlwaysTab) subFmt.StepData[i].AlwaysTab = "null"; + if (mstp.MixCautionsAndNotes != null && mstp.MixCautionsAndNotes == sstp.MixCautionsAndNotes) subFmt.StepData[i].MixCautionsAndNotes = "null"; + if (mstp.NumberHighLevel != null && mstp.NumberHighLevel == sstp.NumberHighLevel) subFmt.StepData[i].NumberHighLevel = "null"; + if (mstp.OffsetTab != null && mstp.OffsetTab == sstp.OffsetTab) subFmt.StepData[i].OffsetTab = "null"; + if (mstp.LeftJustifyBorderless != null && mstp.LeftJustifyBorderless == sstp.LeftJustifyBorderless) subFmt.StepData[i].LeftJustifyBorderless = "null"; + if (mstp.StepNumIfOnlyOne != null && mstp.StepNumIfOnlyOne == sstp.StepNumIfOnlyOne) subFmt.StepData[i].StepNumIfOnlyOne = "null"; + if (mstp.LJTabs != null && mstp.LJTabs == sstp.LJTabs) subFmt.StepData[i].LJTabs = "null"; + if (mstp.NumberSubs != null && mstp.NumberSubs == sstp.NumberSubs) subFmt.StepData[i].NumberSubs = "null"; + if (mstp.Bullet != null && mstp.Bullet == sstp.Bullet) subFmt.StepData[i].Bullet = "null"; + if (mstp.StepNumberForHighLevel != null && mstp.StepNumberForHighLevel == sstp.StepNumberForHighLevel) subFmt.StepData[i].StepNumberForHighLevel = "null"; + if (mstp.SameRowAsParent != null && mstp.SameRowAsParent == sstp.SameRowAsParent) subFmt.StepData[i].SameRowAsParent = "null"; + if (mstp.CheckoffSameAsParent != null && mstp.CheckoffSameAsParent == sstp.CheckoffSameAsParent) subFmt.StepData[i].CheckoffSameAsParent = "null"; + if (mstp.AtLeastTwoDigits != null && mstp.AtLeastTwoDigits == sstp.AtLeastTwoDigits) subFmt.StepData[i].AtLeastTwoDigits = "null"; + if (mstp.UseInAcTable != null && mstp.UseInAcTable == sstp.UseInAcTable) subFmt.StepData[i].UseInAcTable = "null"; + if (mstp.Number != null && mstp.Number == sstp.Number) subFmt.StepData[i].Number = "null"; + if (mstp.ThreeBlanksAbove != null && mstp.ThreeBlanksAbove == sstp.ThreeBlanksAbove) subFmt.StepData[i].ThreeBlanksAbove = "null"; + if (mstp.CheckOffs != null && mstp.CheckOffs == sstp.CheckOffs) subFmt.StepData[i].CheckOffs = "null"; + if (mstp.Quoted != null && mstp.Quoted == sstp.Quoted) subFmt.StepData[i].Quoted = "null"; + if (mstp.Sep == sstp.Sep) subFmt.StepData[i].Sep =null; + if (mstp.Prefix == sstp.Prefix) subFmt.StepData[i].Prefix =null; + if (mstp.Suffix == sstp.Suffix) subFmt.StepData[i].Suffix =null; + if (mstp.AlternateName == sstp.AlternateName) subFmt.StepData[i].AlternateName = null; + if (mstp.UnderlineTheseChar == sstp.UnderlineTheseChar) subFmt.StepData[i].UnderlineTheseChar = null; + if (mstp.TabData.Font != null && sstp.TabData.Font != null) + { + if (mstp.TabData.Font.FontFamily == sstp.TabData.Font.FontFamily) subFmt.StepData[i].TabData.Font.FontFamily = null; + if (mstp.TabData.Font.FontSize == sstp.TabData.Font.FontSize) subFmt.StepData[i].TabData.Font.FontSize = null; + if (mstp.TabData.Font.FontStyle == sstp.TabData.Font.FontStyle) subFmt.StepData[i].TabData.Font.FontStyle = null; + } + if (mstp.TabData.IdentEdit == sstp.TabData.IdentEdit) subFmt.StepData[i].TabData.IdentEdit = null; + if (mstp.TabData.Ident == sstp.TabData.Ident) subFmt.StepData[i].TabData.Ident = null; + if (mstp.TabData.RNOIdentEdit == sstp.TabData.RNOIdentEdit) subFmt.StepData[i].TabData.RNOIdentEdit = null; + if (mstp.TabData.RNOIdent == sstp.TabData.RNOIdent) subFmt.StepData[i].TabData.RNOIdent = null; + if (mstp.TabData.IdentEditWid == sstp.TabData.IdentEditWid) subFmt.StepData[i].TabData.IdentEditWid = null; + if (mstp.TabData.IdentWid == sstp.TabData.IdentWid) subFmt.StepData[i].TabData.IdentWid = null; + if (mstp.TabData.RNOIdentEditWid == sstp.TabData.RNOIdentEditWid) subFmt.StepData[i].TabData.RNOIdentEditWid = null; + if (mstp.TabData.RNOIdentWid == sstp.TabData.RNOIdentWid) subFmt.StepData[i].TabData.RNOIdentWid = null; + if (mstp.TabData.Justify == sstp.TabData.Justify) subFmt.StepData[i].TabData.Justify = null; + if (mstp.TabData.CheckOff == sstp.TabData.CheckOff) subFmt.StepData[i].TabData.CheckOff = null; + } + // box data... + for (int i=0; i dicSteps = BuildStepDic(stpdata); + Dictionary dicParents = BuildParentDic(stpdata, dicSteps); + for (int i = 1; i < MAXSTEPS; i++) + { + FixInheritance(ref stpdata[i], dicParents); + } + } + private void FixInheritance(ref Step step, Dictionary dicParents) + { + if (CheckInheritedStr(new StepPartStr(StepPartColOverride), step, dicParents)) step.StepTypeColOverride = null; + if (CheckInheritedStr(new StepPartStr(StepPartSep), step, dicParents)) step.Sep = null; + if (CheckInheritedStr(new StepPartStr(StepPartAlternateName), step, dicParents)) step.AlternateName = null; + if (CheckInheritedStr(new StepPartStr(StepPartPrefix), step, dicParents)) step.Prefix = null; + if (CheckInheritedStr(new StepPartStr(StepPartSuffix), step, dicParents)) step.Suffix = null; + if (CheckInheritedStr(new StepPartStr(StepPartUnderlineTheseChar), step, dicParents)) step.UnderlineTheseChar = null; + if (CheckInheritedStr(new StepPartStr(StepPartVertPos), step, dicParents)) step.VertPos = null; + // substructures - Font + if (step.Font != null && CheckInheritedStr(new StepPartStr(StepPartFontFamily), step, dicParents)) + step.Font.FontFamily = null; + if (step.Font != null && CheckInheritedStr(new StepPartStr(StepPartFontStyle), step, dicParents)) + step.Font.FontStyle = null; + if (step.Font != null && CheckInheritedStr(new StepPartStr(StepPartFontSize), step, dicParents)) + step.Font.FontSize = null; + if ((step.Font != null) && (step.Font.FontFamily == null) && (step.Font.FontStyle == null) && (step.Font.FontSize == null)) + step.Font = null; + // substructure - StepLayoutData + if (CheckInheritedStr(new StepPartStr(StepPartLayoutForeColor), step, dicParents)) step.StepLayoutData.ForeColor = null; + if (CheckInheritedStr(new StepPartStr(StepPartLayoutBackColor), step, dicParents)) step.StepLayoutData.BackColor = null; + if (CheckInheritedStr(new StepPartStr(StepPartLayoutSTExtraSpace), step, dicParents)) step.StepLayoutData.STExtraSpace = null; + if (CheckInheritedStr(new StepPartStr(StepPartLayoutSTBoxindex), step, dicParents)) step.StepLayoutData.STBoxindex = null; + if (CheckInheritedStr(new StepPartStr(StepPartLayoutEveryNLines), step, dicParents)) step.StepLayoutData.EveryNLines = null; + if (CheckInheritedStr(new StepPartStr(StepPartLayoutSpaceBefore), step, dicParents)) step.StepLayoutData.SpaceBefore = null; + if (CheckInheritedStr(new StepPartStr(StepPartLayoutSpaceAfter), step, dicParents)) step.StepLayoutData.SpaceAfter = null; + if (CheckInheritedStr(new StepPartStr(StepPartLayoutAlwaysUpperCase), step, dicParents)) step.StepLayoutData.AlwaysUpperCase = null; + if (CheckInheritedStr(new StepPartStr(StepPartLayoutPageBreakAtTypeChange), step, dicParents)) step.StepLayoutData.PageBreakAtTypeChange = null; + if (CheckInheritedStr(new StepPartStr(StepPartLayoutAlignWithParentTab), step, dicParents)) step.StepLayoutData.AlignWithParentTab = null; + if (CheckInheritedStr(new StepPartStr(StepPartLayoutRtCheckOffGroups), step, dicParents)) step.StepLayoutData.RtCheckOffGroups = null; + if (CheckInheritedStr(new StepPartStr(StepPartLayoutStepTypeWidthOverride), step, dicParents)) step.StepLayoutData.StepTypeWidthOverride = null; + // substructure - StepEditData + if (CheckInheritedStr(new StepPartStr(StepPartEditForeColor), step, dicParents)) step.StepEditData.ForeColor = null; + if (CheckInheritedStr(new StepPartStr(StepPartEditBackColor), step, dicParents)) step.StepEditData.BackColor = null; + if (CheckInheritedStr(new StepPartStr(StepPartEditAcTable), step, dicParents)) step.StepEditData.AcTable = null; + // substructure - StepPrintData + if (CheckInheritedStr(new StepPartStr(StepPartPrintForeColor), step, dicParents)) step.StepEditData.ForeColor = null; + if (CheckInheritedStr(new StepPartStr(StepPartPrintBackColor), step, dicParents)) step.StepEditData.BackColor = null; + if (CheckInheritedStr(new StepPartStr(StepPartPrintPosAdjust), step, dicParents)) step.StepPrintData.PosAdjust = null; + // substructure - TabData + if (CheckInheritedStr(new StepPartStr(StepPartTabIdentEdit), step, dicParents)) step.TabData.IdentEdit = null; + if (CheckInheritedStr(new StepPartStr(StepPartTabIdent), step, dicParents)) step.TabData.Ident = null; + if (CheckInheritedStr(new StepPartStr(StepPartTabRNOIdentEdit), step, dicParents)) step.TabData.RNOIdentEdit = null; + if (CheckInheritedStr(new StepPartStr(StepPartTabRNOIdent), step, dicParents)) step.TabData.RNOIdent = null; + if (CheckInheritedStr(new StepPartStr(StepPartTabIdentEditWid), step, dicParents)) step.TabData.IdentEditWid = null; + if (CheckInheritedStr(new StepPartStr(StepPartTabIdentWid), step, dicParents)) step.TabData.IdentWid = null; + if (CheckInheritedStr(new StepPartStr(StepPartTabRNOIdentEditWid), step, dicParents)) step.TabData.RNOIdentEditWid = null; + if (CheckInheritedStr(new StepPartStr(StepPartTabRNOIdentWid), step, dicParents)) step.TabData.RNOIdentWid = null; + if (CheckInheritedStr(new StepPartStr(StepPartTabJustify), step, dicParents)) step.TabData.Justify = null; + if (CheckInheritedStr(new StepPartStr(StepPartTabCheckOff), step, dicParents)) step.TabData.CheckOff = null; + + // substructures - Tab - Font + if (step.TabData.Font != null && CheckInheritedStr(new StepPartStr(StepPartTabFontFamily), step, dicParents)) + step.TabData.Font.FontFamily = null; + if (step.TabData.Font != null && CheckInheritedStr(new StepPartStr(StepPartTabFontStyle), step, dicParents)) + step.TabData.Font.FontStyle = null; + if (step.TabData.Font != null && CheckInheritedStr(new StepPartStr(StepPartTabFontSize), step, dicParents)) + step.TabData.Font.FontSize = null; + if ((step.TabData.Font != null) && (step.TabData.Font.FontFamily == null) && (step.TabData.Font.FontStyle == null) && (step.TabData.Font.FontSize == null)) + step.TabData.Font = null; + } + + private bool CheckInheritedStr(StepPartStr stepPartStr, Step step, Dictionary dicParents) + { + Step parent = step; + while ((stepPartStr(parent) == null) || (step.Type == parent.Type)) + { + if (!dicParents.ContainsKey(parent.Type)) return false; + parent = dicParents[parent.Type]; + if (stepPartStr(step) == stepPartStr(parent)) return true; + } + return false; + } + private Dictionary BuildStepDic(Step[] stpdata) + { + Dictionary dicSteps = new Dictionary(); + foreach (Step stp in stpdata) dicSteps[stp.Type] = stp; + return dicSteps; + } + private Dictionary BuildParentDic(Step[] stpdata, Dictionary dicSteps) + { + Dictionary dicParent = new Dictionary(); + foreach (Step stp in stpdata) + if (stp.ParentType != "") dicParent[stp.Type] = dicSteps[stp.ParentType]; + return dicParent; + } + #endregion + } +} \ No newline at end of file diff --git a/PROMS/fmtxml/FmtToXml.cs b/PROMS/fmtxml/FmtToXml.cs new file mode 100644 index 00000000..abed8621 --- /dev/null +++ b/PROMS/fmtxml/FmtToXml.cs @@ -0,0 +1,918 @@ +using System; +using System.Windows.Forms; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Runtime.Serialization.Formatters.Binary; // read in struct +using System.Xml.Xsl; +using System.Xml; +using System.Xml.Serialization; +using System.ComponentModel; + +#region Structs +// top of the page style list. +[Serializable] +public struct PageStyles +{ + public string Name; + public PageStyle [] PgStyles; +} +[Serializable] +public struct PageStyle +{ + public string Name; + public short Index; + public PSItem [] Items; +} +[Serializable] +public struct PSItem +{ + public int Row; + public int Col; + public E_PageStructMod Justify; + public VE_Font Style; + public string Token; +} +//// top of the doc style list. +[Serializable] +public struct DocStyles +{ + public string Name; + public DocStyle [] DcStyles; +} +[Serializable] +public struct DocStyle +{ + public string Name; + public short Index; + public short pagestyle; // Index into page style array + public VE_Font dstyle; // 'Printer driver styles' for the entire document + public int PTopRow; // First 'document text' row on printed page + public int FooterLen; // Number of lines required for footer + public int LeftMargin; // Size of left margin + public int PageLength; + public int PageWidth; + public short numberingsequence; // 0 - no page number + // 1 - included with steps + // 2 - within sections ie. document styles + // 3 - within each accessory document + public bool IsStepSection; // using oldtonew, determine whether is step + // section or word doc section (new to 32-bit) + public int oldtonew; // Bits for converting from old to new + // document style + public short ContTopHLS; // Flag for including High Level step + // as part of top continue message. + public int CTMargin; // Margin for top message + public int CBMargin; // Margin for bottom message + public short CBLoc; // 0 - place continue string at end of text + // 1 - between end of text & bottom of page + // 2 - place at bottom of page + // + public VE_Font ContStyle; // Style of continue messages + public short EndFlag; // Does end statement exist for this type + public VE_Font EndStyle; // Style of end message at end of page + public string ContTop; // Message at top of page + public string ContBottom; // Message at bottom of page + public string EndString; // String for end of document + public string FinalMsg; // Message for the final page of th text + public VE_DocStyle DocStructStyle; // Describe How / When structure is used +} +#endregion +#region ENums +[Flags] +public enum E_PageStructMod : uint +{ + PSCenter = 0, // Page style, center field + PSLeft = 1, // Page style, left justify + PSRight = 2, // Page style, right justify + // *** PS modifiers: *** + PSBottom = 4, // Page style, always use bottom half line + PSTop = 8, // Page style, always use top half line + PSTrue = 16, // page style, don't adjust per CPI* (not needed after 4.0) + PSNotFirst = 32, // page style, don't put this token on the first page of section + PSOnlyFirst = 64, // page style, only put this token on the first page of section + PSRelRow = 128, // place in RelPageList + PSNoHalfLine= 256, // DontDoHalflines for his paglist row item + PSNotLast = 0x200, // 512 - use this token on all but the last page of this section + PSRtfOnly = 0x400, // Only use this token when the driver is rtf + PSRtfNot = 0x800, // Do NOT use token when driver is rtf + PSGDIOnly = 0X1000, // Only use this token when the driver is GDI + PSGDINot = 0x2000, // Do NOT use token when driver is GDI + PSAdjBngRow = 0x4000 // If the pagelist item exceeds the row it's printed on, + // then adjust the starting row for the procedure body +}; +// Possible settings for DocStructStyle (DSS_) +// These styles describe How and When the defined Doc Style is used +[Flags] public enum E_DocStructStyle:uint +{ + UseOnAllPages = 0, // Default + UseOnFirstPage = 1, // Use only on the first page + UseOnAllButFirstPage = 2, // Use on all but the first page + UseOnLastPage = 4, // NO LOGIC exists for this selection. Use only on the last page + UseSectionFoldout = 8, // Attach section foldouts (only active if using SectionLevelFoldouts_ON + DontCountFoldoutPgs = 16, // Used with the USESECTIONFOLDOUT flag. Keeps foldout pages from + // being included in the section total page count. + TableOfContents = 32, + DontCountInTabOfCont = 64, + Placekeeper = 128, + Align1StLevSubWHLS = 0x00000100, // guess? + DoubleBoxHLS = 0x00000200, + UseAltCntrline = 0x00000400, + DontNumberInTOC = 0x00000800, // Don't include page number for this section in the Table of Contents + UseSpecialFigFrame = 0x00001000, // for use with stp55 and 55a in bge + HLSUseLetters = 0x00002000, // docstyles with this bit set in the DocStructStyle will + // default to using letters for HLSteps + NoSectionInStepContinue = 0x00004000, // don't include the section number in the step continue + BottomSectionContinue = 0x00008000, // print the continue message if the section continues + AlwaysDotStep = 0x00010000, // put the period after step number in the continue message + XBlankW1stLevSub = 0x00020000, // insert an extra blank line before a 1st level substep + AffectedPages = 0x00040000, + DSS_TreatAsTrueSectNum = 0x00080000, // in conjunction with tietabtolevel, takes section number + // from the last space and appends a period + SampleWatermark = 0x00100000, // Will force "SAMPLE" to be printed across the page + // on all pages in this section + DSS_PageBreakHLS = 0x00200000, // Page Breaks on all high level steps + DSS_NoChkIfContTypeHigh = 0x00400000, // Will suppress the checkoff if type is HIGH and the + // step is continued on the next page + DSS_WidthOvrdStdHLS = 0x00800000, // Width Override for Standard HLStep in this section + DSS_AddDotZeroStdHLS = 0x01000000, // Append .0 to the Standard HLStep for this section + DSS_SectionCompress = 0x02000000, // Compress all the steps of this section (i.e. use 7 LPI) + DSS_PrintSectOnFirst = 0x04000000, // Prints section title/number only on the first + // page of an attachment section, assuming numberingsequence is not 1 + DSS_UnNumLikeRoman = 0x08000000, // the substeps underneath unnumbered HLSteps will have same tabs as romans + DSS_DontChangeRomanLevel = 0x10000000, // Dont alter the the substep level for roman-numeral-tabbed hlsteps + DSS_SkipTwoStepLevels = 0x20000000, // Skip two step levels for this doc style + DSS_SkipOneStepLevel = 0x40000000, // Skip one step level for this doc style + DSS_SimpleTopSectionContinue = 0x80000000, // Use the Top continue message as the section continue */ +}; +public enum E_DocStyleUse:uint +{ + UseOnAllPages=0,UseOnFirstPage=1,UseOnAllButFirstPage=2,UseOnLastPage=4 +}; +[Flags] +public enum E_DocStyle:uint +{ + None=0,UseSectionFoldout=8,DontCountFoldoutPgs=16,TableOfContents=32, + DontCountInTabOfCont=64,Placekeeper=128,Align1StLevSubWHLS=0x00000100, + DoubleBoxHLS=0x00000200,UseAltCntrline=0x00000400,DontNumberInTOC=0x00000800, + UseSpecialFigFrame=0x00001000,HLSUseLetters=0x00002000,NoSectionInStepContinue=0x00004000, + BottomSectionContinue=0x00008000,AlwaysDotStep=0x00010000,XBlankW1stLevSub=0x00020000, + AffectedPages=0x00040000,DSS_TreatAsTrueSectNum=0x00080000,SampleWatermark=0x00100000, + DSS_PageBreakHLS=0x00200000,DSS_NoChkIfContTypeHigh=0x00400000,DSS_WidthOvrdStdHLS=0x00800000, + DSS_AddDotZeroStdHLS=0x01000000,DSS_SectionCompress=0x02000000,DSS_PrintSectOnFirst=0x04000000, + DSS_UnNumLikeRoman=0x08000000,DSS_DontChangeRomanLevel=0x10000000, + DSS_SkipTwoStepLevels=0x20000000,DSS_SkipOneStepLevel=0x40000000,DSS_SimpleTopSectionContinue=0x80000000 +}; +//[Flags] +//public enum E_Style:uint +//{ +// ELITE=0,PICA=1,SANSERIF=2,EXPANDED=4,PICA12=5,COMPRESSEDHVLPT18=8,HVLPT25=9,SPECIALCHARS=10,PT14=11,SANSERIF14=12,SANSERIF17=13, +// HVLPT12=14,NARRATOR=15,MEDUPUNIVERS=16,LGUPMED16=17,PROPT10=18,LG1275HP4SI=19, +// HVLPT10=20,HVLPT8=21,HVLPT14=22,SANSERIF25=23,EYECHART=24,TIMES11=25,SANSCOND=26, +// UNDERLINE=64,BOLD=128,LANDSCAPE=256,ITALICS=512,BOXED=1024,BOXELEMENT=0x00000800, +// TBCENTERED=4096,RTCHECKOFF=8192,LTCHECKOFF=16384,BIGSCRIPT=32768,HLTEXTHL=65536, +// RTCHECKOFFWITHASTERISK=131072,DB_UNDERLINE=262144,COLDOTS=524288, +// MMBOLD=1048576,RIGHTJUSTIFY=2097152,SUBSCRIPT=4194304,SUPERSCRIPT=8388608, +// PAGELISTITEM=16777216,PRINTONTOPOFLINE=33554432,HORZCENTER=67108864, +// CIRCLESTRING2=0x08000000,ALIGNWITHUP1=0x10000000,ALIGNWSECNUM=0x20000000, +// MATCHCOLUMNMODE=0x40000000,KEEPRNOSUBSTYLE=0x80000000 +//}; +public enum E_FontName:uint +{ + Elite=0,Pica=1,LnPrn=2,Condense=3,SanSerif=4,Pica12=5,Proportional=6, + Propt12=7,HvlPt18=8,HvlPt25=9,SpecialChars=10,Pt14=11,SanSerif14=12,SanSerif17=13, + HvlPt12=14,Narrator=15,MedUpUnivers=16,LgUpMed16=17,Propt10=18,Lg1275Hp4Si=19, + HvlPt10=20,HvlPt8=21,HvlPt14=22,SanSerif25=23,EyeChart=24,Times11=25,SansCond=26 + }; +//[Flags] +//public enum E_FontStyle:uint +//{ +// NONE=0,UNDERLINE=64,BOLD=128,LANDSCAPE=256,ITALICS=512,BOXED=1024,BOXELEMENT=0x00000800, +// TBCENTERED=4096,RTCHECKOFF=8192,LTCHECKOFF=16384,BIGSCRIPT=32768,HLTEXTHL=65536, +// RTCHECKOFFWITHASTERISK=131072,DB_UNDERLINE=262144,COLDOTS=524288, +// MMBOLD=1048576,RIGHTJUSTIFY=2097152,SUBSCRIPT=4194304,SUPERSCRIPT=8388608, +// PAGELISTITEM=16777216,PRINTONTOPOFLINE=33554432,HORZCENTER=67108864, +// CIRCLESTRING2=0x08000000,ALIGNWITHUP1=0x10000000,ALIGNWSECNUM=0x20000000, +// MATCHCOLUMNMODE=0x40000000,KEEPRNOSUBSTYLE=0x80000000 +//}; +[Flags] public enum E_FontStyle:uint +{ + None=0,Underline=64,Bold=128,Italics=512,BigScript=32768, + DbUnderline=262144,MmBold=1048576,Subscript=4194304,Superscript=8388608 +}; +public enum E_Justify : uint +{ + None=0, Center=1, Left=2, Right=3 +}; +public enum E_TabCheckOff : uint +{ + None=0, Left=1, Right=2 +}; +[Flags] public enum E_Style:uint +{ + None=0,Landscape=256,Boxed=1024,BoxElement=0x00000800,TbCentered=4096,RtCheckoff=8192, + LtCheckOff=16384,HlTextHl=65536,RtCheckoffWithAsterisk=131072,ColDots=524288, + RightJustify=2097152,PageListItem=16777216,PrintOnTopOfLine=33554432, + HorzCenter=67108864,CircleString2=0x08000000,AlighWithUp1=0x10000000, + AlignWSecNum=0x20000000,MatchColumnMode=0x40000000,KeepRNOSubStyle=0x80000000 +}; + +public enum E_OldToNewSteps : uint +{ + S0 = 1, S1 = 2, S2 = 4, E0 = 1048576, E1 = 2097152, E2 = 4194304, X0 = 67108864, X1 = 134217728, X2 = 268435456 +}; +#endregion +#region TypeConverters +[Serializable,TypeConverter(typeof(VE_DocStyleConverter))] +public class VE_DocStyle +{ + uint i; + public VE_DocStyle(string s) + { + + } + public VE_DocStyle(uint i) + { + this.i=i; + } + public VE_DocStyle() + { + this.i=0; + } + public E_DocStyleUse DocStyleUse + { + get{return (E_DocStyleUse)(i & 0x7);} + set{i = ((uint)value) | (i & 0xFFFFFFF8);} + } + public string DocStyle + { + get{return ((E_DocStyle)(i & 0xFFFFFFF8)).ToString();} + set{i = ((uint)Enum.Parse(typeof (E_DocStyle),value)) | (i & 0x7);} + } +} +internal class VE_DocStyleConverter:ExpandableObjectConverter +{ + public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) + { + if(sourceType == typeof(string)) + { + return false; + } + return base.CanConvertFrom(context,sourceType); + } + public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) + { + return base.ConvertFrom (context, culture, value); + } + public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) + { + if(destinationType==typeof(string)) + { + VE_DocStyle v = (VE_DocStyle)value; + return string.Format((v.DocStyle=="None"?"{0}":"{0}, {1}"),v.DocStyleUse,v.DocStyle); + } + return base.ConvertTo (context, culture, value, destinationType); + } +} + +[Serializable,TypeConverter(typeof(VE_FontConverter))] +public class VE_Font +{ + uint i; + + public VE_Font(string s) + { + + } + public VE_Font(uint i) + { + this.i=i; + } + public VE_Font() + { + this.i=0; + } + public VE_Font(XmlNode fxml) + { + XmlNode tmp = fxml.SelectSingleNode("Family"); + if (tmp!=null)FontFamily = tmp.InnerText; + tmp = fxml.SelectSingleNode("Size"); + if (tmp != null) FontSize = tmp.InnerText; + tmp = fxml.SelectSingleNode("Style"); + if (tmp != null) FontStyle = tmp.InnerText; + } + private string _FontFamily = null; + private bool _FontFamilySet = false; + + public string FontFamily + { + get + { + if ((!_FontFamilySet)&&(_FontFamily == null)) _FontFamily = CvtFont.CvtFont.ConvertToFamily(((E_FontName)(i & 0x3f)).ToString()); + _FontFamilySet = true; + return _FontFamily; + } + set {_FontFamily=value;} + } + private string _FontSize = null; + private bool _FontSizeSet = false; + public string FontSize + { + get + { + if ((!_FontSizeSet)&&(_FontSize == null)) _FontSize = CvtFont.CvtFont.ConvertToSize(((E_FontName)(i & 0x3f)).ToString()).ToString(); + _FontSizeSet = true; + return _FontSize; + } + set { _FontSize = value;} + //set { i = ((uint)value) | (i & 0xFFFFFFC0); } + } + //public E_FontName FontName + //{ + // get{return (E_FontName)(i & 0x3F);} + // set{i = ((uint)value) | (i & 0xFFFFFFC0);} + //} + private string _FontStyle = null; + private bool _FontStyleSet = false; + public string FontStyle + { + get{ + if ((!_FontStyleSet) && (_FontStyle == null)) _FontStyle = ((E_FontStyle)(i & 0xD482C0)).ToString(); + //if ((!_FontStyleSet) && (_FontStyle == null)) _FontStyle = ((E_FontStyle)(i & 0xFFFFFFC0)).ToString(); + _FontStyleSet = true; + return _FontStyle; + } + // return (E_FontStyle)(i & 0xFFFFFFC0);} + set { _FontStyle = value;} + //set{i = ((uint)value) | (i & 0x3F);} + } + private string _FontCheckOff = null; + private bool _FontCheckOffSet = false; + public string FontCheckOff + { + get + { + // 16-bit code had check offs in font style integer flag. 32-bit is converting this to its own + // xml attribute not part of the font. This code is used for the format -> xml conversion + // the 32-bit code should NOT have this as part of the font. RTCHECKOFF in 16-bit code = 8192 + // and LTCHECKOFF in 16-bit code = 16384 + if ((!_FontCheckOffSet) && (_FontCheckOff == null)) + { + if ((i & 8192)>0) _FontCheckOff = E_TabCheckOff.Right.ToString(); + else if ((i & 16384) > 0) _FontCheckOff = E_TabCheckOff.Left.ToString(); + else _FontCheckOff = E_TabCheckOff.None.ToString(); + } + _FontCheckOffSet = true; + return _FontCheckOff; + } + set { _FontCheckOff = value; } + } + private string _FontJustify = null; + private bool _FontJustifySet = false; + public string FontJustify + { + get + { + // 16-bit code had justify in font style integer flag. 32-bit is converting this to its own + // xml attribute not part of the font. This code is used for the format -> xml conversion + // the 32-bit code should NOT have this as part of the font. TBCENTERED in 16-bit code = 4096 + // and RIGHTJUSTIFY in 16-bit code = 2097152. Note 16-bit did not have a left justify. + if ((!_FontJustifySet) && (_FontJustify == null)) + { + if ((i & 4096) > 0) _FontJustify = E_Justify.Center.ToString(); + else if ((i & 2097152) > 0) _FontJustify = E_Justify.Right.ToString(); + else _FontJustify = E_Justify.None.ToString(); + } + _FontJustifySet = true; + return _FontJustify; + } + set { _FontJustify = value; } + } + //CIRCLESTRING2=0x08000000 + public bool HasCircleString2() + { + if ((i & 0x08000000)>0) return true; + else return false; + } + public VE_Font Copy() + { + VE_Font c = new VE_Font(i); + return c; + } +} +internal class VE_FontConverter:ExpandableObjectConverter +{ + public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) + { + if(sourceType == typeof(string)) + { + return false; + } + return base.CanConvertFrom(context,sourceType); + } + public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) + { + return base.ConvertFrom (context, culture, value); + } + public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) + { + if(destinationType==typeof(string)) + { + VE_Font v = (VE_Font)value; + return string.Format((v.FontStyle == "None" ? "Family={0} Size={1}" : "{0}, {1}, {2}"), v.FontFamily, v.FontSize, v.FontStyle); + } + return base.ConvertTo (context, culture, value, destinationType); + } +} +#endregion + + +/////////////////////////// +namespace fmtxml +{ + public class FmtToXml + { + private BinaryReader brFmt; + private string fmtName; + private VE_Font DefBaseFont; + private VE_Font DefPlantFont; + public FmtToXml(string nm) + { + fmtName = nm; + try + { + // get the default base & plant files to use when figuring out inheritance. + GetPlantBaseDefaultFonts(); + + // will have entire name, such as aep.x01 - use number to differentiate it. + int indx = nm.IndexOf('.'); + if (indx > 0) + { + LoadPageFile(nm); + LoadDocFile(nm); + } + else + { + LoadPageFile(nm + ".pag"); + LoadDocFile(nm + ".doc"); + } + } + catch (Exception ex) + { + MessageBox.Show("Format name = " + nm, ex.Message); + } + } + private int ColToPoints(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 + } + private string GetAsciiStringUntilNull(BinaryReader br) + { + StringBuilder inpstr = new StringBuilder(); + byte input = 0; + int cnt = 0; + bool stillread = true; + do + { + try + { + input = br.ReadByte(); + if (input==0) stillread=false; + inpstr.Append(Convert.ToChar(input)); + } + catch (System.IO.EndOfStreamException) + { + stillread=false; + } + cnt++; + }while (stillread); + + string retstr = inpstr.ToString(); + if (retstr.Substring(retstr.Length-1,1)=="\0") return retstr.Substring(0,retstr.Length-1); + return retstr; + } + private string GetAsciiString(BinaryReader br, int len) + { + StringBuilder inpstr = new StringBuilder(); + byte input = 0; + int cnt = 0; + do + { + try + { + input = br.ReadByte(); + inpstr.Append(Convert.ToChar(input)); + } + catch (System.IO.EndOfStreamException) + { + input = 0; + while (cnt < len) + { + inpstr.Append(Convert.ToChar(input)); + cnt++; + } + } + cnt++; + }while (cnt < len); + + string retstr = inpstr.ToString(); + if (retstr.Substring(retstr.Length-1,1)=="\0") return retstr.Substring(0,retstr.Length-1); + return retstr; + } + private VE_Font LoadVE_Font() + { + VE_Font retval=new VE_Font(brFmt.ReadUInt32()); + return retval; + } + private VE_DocStyle LoadVE_DocStyle() + { + VE_DocStyle retval=new VE_DocStyle(brFmt.ReadUInt32()); + return retval; + } + public void LoadPageFile(string fname) + { + ArrayList stringoffsets = new ArrayList(); + short strings = 0; + PageStyles pgstyles = new PageStyles(); + string str = null; + + // read in title. + string fnm = "E:\\ve-proms\\format\\"+fname; + Console.WriteLine(fname); + brFmt = new BinaryReader(File.Open(fnm,System.IO.FileMode.Open,System.IO.FileAccess.ReadWrite,FileShare.ReadWrite)); + short len = brFmt.ReadInt16(); + pgstyles.Name = GetAsciiString(brFmt,len); + + // read in struct name/def name/page file name + for (int i=0;i<3;i++) + { + len = brFmt.ReadInt16(); + str = GetAsciiString(brFmt,len); + } + + // Get the number of page styles, and create the array for them. + short numpgstyles = brFmt.ReadInt16(); + + PageStyle [] pgs = new PageStyle[numpgstyles]; + pgstyles.PgStyles = pgs; + + short offptr = brFmt.ReadInt16(); + short vnum = brFmt.ReadInt16(); + if (vnum!=0) + { + strings = vnum; + for(int i=0;i' with '}' + pi.Token = pi.Token.Replace('<', '{'); + pi.Token = pi.Token.Replace('>', '}'); + + 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; + } + pg.Items = psitms; + pgs[i] = pg; + } + brFmt.Close(); + DoPSFontInherit(ref pgstyles); + + // First serialize files based on the above - then use xsl to transform + // into prefered xml. + if (!Directory.Exists("fmt_xml")) Directory.CreateDirectory("fmt_xml"); + if (!Directory.Exists("tmp_fmt_xml")) Directory.CreateDirectory("tmp_fmt_xml"); + XmlSerializer serializer = new XmlSerializer(typeof(PageStyles)); + string lfmtname = fmtName; + // for subformats, make the name FMT_00 where FMT is format name & 00 is number + // from original name. This will allow the data load to know it's a sub. + int indx = fmtName.IndexOf('.'); + if (indx>0) + lfmtname = fmtName.Substring(0,fmtName.Length-4) + "_" + fmtName.Substring(fmtName.Length-2,2); + string destfile = "tmp_fmt_xml\\" + lfmtname + "p.xml"; + if (File.Exists(destfile)) File.Delete(destfile); + TextWriter writer = new StreamWriter(destfile); + try + { + serializer.Serialize(writer, pgstyles); + writer.Close(); + XslCompiledTransform xsl = new XslCompiledTransform(); + xsl.Load(Application.StartupPath + "\\TranslatePag.XSL"); + string sResults = "fmt_xml\\" + lfmtname + "p.xml"; + xsl.Transform(destfile, sResults); // Perform Transform + } + catch (Exception e) + { + Console.WriteLine(e.Message); + writer.Close(); + } + } + public void LoadDocFile(string fname) + { + ArrayList stringoffsets = new ArrayList(); + short strings = 0; + DocStyles dcstyles = new DocStyles(); + string str = null; + + // read in title. + string fnm = "E:\\ve-proms\\format\\"+fname; + Console.WriteLine(fname); + brFmt = new BinaryReader(File.Open(fnm,System.IO.FileMode.Open,System.IO.FileAccess.ReadWrite,FileShare.ReadWrite)); + short len = brFmt.ReadInt16(); + dcstyles.Name = GetAsciiString(brFmt,len); + + // read in struct name/def name/doc file name + for (int i=0;i<3;i++) + { + len = brFmt.ReadInt16(); + str = GetAsciiString(brFmt,len); + } + + // Get the number of page styles, and create the array for them. + short numdcstyles = brFmt.ReadInt16(); + DocStyle [] dcs = new DocStyle[numdcstyles]; + + short offptr = brFmt.ReadInt16(); // not sure what these bytes contain? + short vnum = brFmt.ReadInt16(); + if (vnum!=0) + { + strings = vnum; + for(int i=0;i 0) + lfmtname = fmtName.Substring(0, fmtName.Length - 4) + "_" + fmtName.Substring(fmtName.Length - 2, 2); + string destfile = "tmp_fmt_xml\\" + lfmtname + "d.xml"; + if (File.Exists(destfile)) File.Delete(destfile); + TextWriter writer = new StreamWriter(destfile); + try + { + serializer.Serialize(writer, dcstyles); + writer.Close(); + XslCompiledTransform xsl = new XslCompiledTransform(); + xsl.Load(Application.StartupPath + "\\TranslateDoc.XSL"); + string sResults = "fmt_xml\\" + lfmtname + "d.xml"; + xsl.Transform(destfile, sResults); // Perform Transform + } + catch (Exception e) + { + Console.WriteLine(e.Message); + writer.Close(); + } + } + + private bool ConvertToSectType(int p) + { + if (((p & (int)E_OldToNewSteps.S0) != 0) || ((p & (int)E_OldToNewSteps.S1) != 0) || ((p & (int)E_OldToNewSteps.S2) != 0) || + ((p & (int)E_OldToNewSteps.E0) != 0) || ((p & (int)E_OldToNewSteps.E1) != 0) || ((p & (int)E_OldToNewSteps.E2) != 0) || + ((p & (int)E_OldToNewSteps.X0) != 0) || ((p & (int)E_OldToNewSteps.X1) != 0) || ((p & (int)E_OldToNewSteps.X2) != 0)) + return true; + return false; + } + private string DoReplaceTokens(string p) + { + if (p == null || p == "") return p; + string wkstr = p; + // use regular expressions to do the following... + + try + { + // replace newline with {par} + wkstr = wkstr.Replace("\n", "{par}"); + + // special change bar token (various cpl formats) + wkstr = wkstr.Replace("\x08\x08\x08\x08\x08\x05", "{CHG_BAR with Backspace Token}"); + + // special change bar token (various gpc formats) + wkstr = wkstr.Replace("\x05", "{CHG_BAR Token}"); + + // backspage - just flag for positioning if needed. + wkstr = wkstr.Replace("\x08", "{Backspace}"); + + //sub on/off + wkstr = wkstr.Replace("\x19\x19", "\x19"); // replace double sub on with single + wkstr = wkstr.Replace("~~", "\x19"); + wkstr = Regex.Replace(wkstr, @"\x19([^\x19\x18 ]*?)(?:[\x19\x18]|(?= )|\Z)(.*?)", @"\sub$1\nosupersub$2"); + + //super on/off + wkstr = Regex.Replace(wkstr, @"\x18([^\x19\x18 ]*?)(?:[\x19\x18]|(?= )|\Z)(.*?)", @"\super$1\nosupersub$2"); + + //bold on/off + wkstr = Regex.Replace(wkstr, @"\x01([^\x01 ]*?)(?:[\x01]|(?= )|\Z)(.*?)", @"\b$1\b0$2"); + wkstr = Regex.Replace(wkstr, @"\x13([^\x13\xd6 ]*?)(?:[\x13\xd6]|(?= )|\Z)(.*?)", @"\b$1\b0$2"); + + //underline on/off + wkstr = Regex.Replace(wkstr, @"\x16([^\x16 ]*?)(?:[\x16]|(?= )|\Z)(.*?)", @"\ul$1\ul0$2"); + + //narrator + wkstr = Regex.Replace(wkstr, @"\x86([^\x86 ]*?)(?:[\x86]|(?= )|\Z)(.*?)", @"\f{Narrator}$1\f0$2"); + + // remove hanging indent, vertical tab + wkstr = Regex.Replace(wkstr, @"\x02", @"\NonSupported Hanging Indent (Hex x02)"); + wkstr = Regex.Replace(wkstr, @"\x0B", @"\NonSupported Vertical Tab (Hex x0b"); + + // remove some unknown chars for ano & fpl - these plants are not supported + // as of conversion date. + wkstr = Regex.Replace(wkstr, @"\x95", @"\NonSupported Unknown (Hex x95)"); //ano2vlv + wkstr = Regex.Replace(wkstr, @"\x1bf1", @"\NonSupported Unknown (hex 1b f1)"); //fpl + wkstr = Regex.Replace(wkstr, @"\x1bf0", @"\NonSupported Unknown (hex 1b f0)"); //fpl + wkstr = Regex.Replace(wkstr, @"\x1bM1", @"\NonSupported Unknown (hex 1b M1)"); //fpl + wkstr = Regex.Replace(wkstr, @"\x1bM0", @"\NonSupported Unknown (hex 1b M0)"); //fpl + + // ATA page?? + wkstr = Regex.Replace(wkstr, @"\x1b", @"{NonSupported Hex 1b}"); + // replace \xff with \xA0, i.e. hardspace + wkstr = Regex.Replace(wkstr, @"\xFF", @"\xA0"); + + // replace x10 & x11 in various ano tabs - not this needs fixed if ANO comes + // back into the program + wkstr = wkstr.Replace("\x10", ""); + wkstr = wkstr.Replace("\x11", ""); + + // replace x15 with {RO} for now. + wkstr = wkstr.Replace("\x15", "{RO}"); + } + catch (Exception ex) + { + Console.WriteLine("error replacing token (regex) = {0}", ex.Message); + } + + return wkstr; + } + + private void CompareFonts(VE_Font parFont, ref VE_Font subFont) + { + if (parFont != null && subFont != null) + { + if (parFont.FontFamily == subFont.FontFamily) subFont.FontFamily = null; + if (parFont.FontSize == subFont.FontSize) subFont.FontSize = null; + if (parFont.FontStyle == subFont.FontStyle) subFont.FontStyle = null; + } + } + private void DoPSFontInherit(ref PageStyles pagstyles) + { + for (int i=0; i 0) + lfmtName = fmtName.Substring(0, fmtName.Length - 4) + "_" + fmtName.Substring(fmtName.Length - 2, 2); + xdoc.Load("fmt_xml\\" + lfmtName + "f.xml"); + xfont = xdoc.SelectSingleNode("FormatData/Font"); + if (xfont!=null)DefPlantFont = new VE_Font(xfont); + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + return false; + } + return true; + } + + } +} diff --git a/PROMS/fmtxml/Form1.cs b/PROMS/fmtxml/Form1.cs new file mode 100644 index 00000000..d0f8efc1 --- /dev/null +++ b/PROMS/fmtxml/Form1.cs @@ -0,0 +1,337 @@ +using System; +using System.Drawing; +using System.Collections; +using System.ComponentModel; +using System.Windows.Forms; +using System.Data; +using System.IO; + +namespace fmtxml +{ + /// + /// Summary description for Form1. + /// + public class Form1 : System.Windows.Forms.Form + { + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.ListBox listBox1; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Button button4; + private System.Windows.Forms.Button button5; + private C1.C1Pdf.C1PdfDocument c1PdfDocument1; + private System.Windows.Forms.Button button6; + private Button button7; + private Button button8; + /// + /// Required designer variable. + /// + private System.ComponentModel.Container components = null; + + public Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if (components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.button1 = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.button2 = new System.Windows.Forms.Button(); + this.listBox1 = new System.Windows.Forms.ListBox(); + this.button3 = new System.Windows.Forms.Button(); + this.button4 = new System.Windows.Forms.Button(); + this.button5 = new System.Windows.Forms.Button(); + this.c1PdfDocument1 = new C1.C1Pdf.C1PdfDocument(); + this.button6 = new System.Windows.Forms.Button(); + this.button7 = new System.Windows.Forms.Button(); + this.button8 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(8, 8); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(144, 48); + this.button1.TabIndex = 0; + this.button1.Text = "Convert Page and Doc Styles in format directory (Step 2)"; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // label1 + // + this.label1.Location = new System.Drawing.Point(8, 144); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(168, 16); + this.label1.TabIndex = 1; + this.label1.Text = "Converted:"; + // + // button2 + // + this.button2.Location = new System.Drawing.Point(512, 24); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(64, 24); + this.button2.TabIndex = 2; + this.button2.Text = "Exit"; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // listBox1 + // + this.listBox1.Location = new System.Drawing.Point(8, 168); + this.listBox1.Name = "listBox1"; + this.listBox1.Size = new System.Drawing.Size(584, 407); + this.listBox1.TabIndex = 3; + // + // button3 + // + this.button3.Location = new System.Drawing.Point(168, 8); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(128, 48); + this.button3.TabIndex = 4; + this.button3.Text = "Convert genmac files to XML"; + this.button3.Click += new System.EventHandler(this.button3_Click); + // + // button4 + // + this.button4.Location = new System.Drawing.Point(320, 8); + this.button4.Name = "button4"; + this.button4.Size = new System.Drawing.Size(112, 48); + this.button4.TabIndex = 5; + this.button4.Text = "Convert Genmac_XML to SVG"; + this.button4.Click += new System.EventHandler(this.button4_Click); + // + // button5 + // + this.button5.Location = new System.Drawing.Point(320, 97); + this.button5.Name = "button5"; + this.button5.Size = new System.Drawing.Size(128, 48); + this.button5.TabIndex = 6; + this.button5.Text = "Convert Drawing Items XML to PDF"; + this.button5.Click += new System.EventHandler(this.button5_Click); + // + // button6 + // + this.button6.Location = new System.Drawing.Point(464, 97); + this.button6.Name = "button6"; + this.button6.Size = new System.Drawing.Size(112, 48); + this.button6.TabIndex = 7; + this.button6.Text = "Convert SVG Xml to PDF"; + this.button6.Click += new System.EventHandler(this.button6_Click); + // + // button7 + // + this.button7.Location = new System.Drawing.Point(11, 69); + this.button7.Name = "button7"; + this.button7.Size = new System.Drawing.Size(140, 51); + this.button7.TabIndex = 8; + this.button7.Text = "Convert Format in format directory (step 1)"; + this.button7.UseVisualStyleBackColor = true; + this.button7.Click += new System.EventHandler(this.button7_Click); + // + // button8 + // + this.button8.Location = new System.Drawing.Point(172, 70); + this.button8.Name = "button8"; + this.button8.Size = new System.Drawing.Size(106, 49); + this.button8.TabIndex = 9; + this.button8.Text = "Integrate Fmt, Doc & Pag (step 3)"; + this.button8.UseVisualStyleBackColor = true; + this.button8.Click += new System.EventHandler(this.button8_Click); + // + // Form1 + // + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.ClientSize = new System.Drawing.Size(712, 590); + this.Controls.Add(this.button8); + this.Controls.Add(this.button7); + this.Controls.Add(this.button6); + this.Controls.Add(this.button5); + this.Controls.Add(this.button4); + this.Controls.Add(this.button3); + this.Controls.Add(this.listBox1); + this.Controls.Add(this.button2); + this.Controls.Add(this.label1); + this.Controls.Add(this.button1); + this.Name = "Form1"; + this.Text = "Form1"; + this.ResumeLayout(false); + + } + #endregion + + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.Run(new Form1()); + } + + private void button1_Click(object sender, System.EventArgs e) + { + // get all of the files in the e:\ve-proms\format directory. + DirectoryInfo di = new DirectoryInfo("E:\\ve-proms\\format"); + FileInfo[] fis = di.GetFiles("*.pag"); + listBox1.Items.Clear(); + foreach (FileInfo fi in fis) + { + string fn = fi.Name.Substring(0,fi.Name.Length-4); + this.listBox1.Items.Add(fi.Name); + FmtToXml fx = new FmtToXml(fn); + } + fis = di.GetFiles("*.y*"); + foreach (FileInfo fi in fis) + { + this.listBox1.Items.Add(fi.Name); + FmtToXml fx = new FmtToXml(fi.Name); + } + MessageBox.Show("DONE Converting Page and Document Styles to XML"); + } + + private void button2_Click(object sender, System.EventArgs e) + { + Application.Exit(); + } + + private void button3_Click(object sender, System.EventArgs e) + { + // before doing the genmac change, use cpp -DRTF file after genmac.h + // has been emptied out on files in \promsnt\genmac. This creates + // precompiled files only, i.e. gets rid of some of the junk in the files. + // This conversion is done 1 time. After 32-bit print is done, the xml + // files will be used rather than the genmac. + + DirectoryInfo di = new DirectoryInfo("E:\\promsnt\\genmac\\preproc"); + FileInfo[] fis = di.GetFiles("*.i"); + listBox1.Items.Clear(); + foreach (FileInfo fi in fis) + { + // results go to e:\\proms.net\\genmac.xml\\convert + this.listBox1.Items.Add(fi.Name); + GenToXml gn = new GenToXml(fi.Name); + } + MessageBox.Show("DONE Converting genmacs to XML"); + } + + private void button4_Click(object sender, System.EventArgs e) + { + // delete current svg's + DirectoryInfo disvg = new DirectoryInfo("E:\\proms.net\\genmac.xml"); + FileInfo[] fissvg = disvg.GetFiles("*.svg"); + foreach (FileInfo fi in fissvg)fi.Delete(); + DirectoryInfo di = new DirectoryInfo("E:\\proms.net\\genmac.xml\\convert"); + FileInfo[] fis = di.GetFiles("*.xml"); + listBox1.Items.Clear(); + foreach (FileInfo fi in fis) + { + // results go to e:\proms.net\genmac.xml + this.listBox1.Items.Add(fi.Name); + GenXmlToSvg gn = new GenXmlToSvg(fi.Name); + } + MessageBox.Show("DONE Converting genmacs.xmls to drawing object.xmls"); + } + + private void button5_Click(object sender, System.EventArgs e) + { + + DirectoryInfo di = new DirectoryInfo("E:\\ve-proms.net\\genmac.xml"); + FileInfo[] fis = di.GetFiles("*.xml"); + listBox1.Items.Clear(); + foreach (FileInfo fi in fis) + { + this.listBox1.Items.Add(fi.Name); + XmlToPdf pdf = new XmlToPdf("E:\\ve-proms.net\\genmac.xml",fi.Name); + } + MessageBox.Show("DONE generating PDF files from XML"); + } + + private void button6_Click(object sender, System.EventArgs e) + { + DirectoryInfo di = new DirectoryInfo("E:\\proms.net\\genmac.xml"); + FileInfo[] fis = di.GetFiles("*.svg"); + listBox1.Items.Clear(); + foreach (FileInfo fi in fis) + { + this.listBox1.Items.Add(fi.Name); + SvgToPdf pdf = new SvgToPdf("E:\\proms.net\\genmac.xml",fi.Name); + } + MessageBox.Show("DONE generating PDF files from SVG"); + } + + private void button7_Click(object sender, EventArgs e) + { + // first convert base format - for now use genfmt. + FmtFileToXml gx = new FmtFileToXml(null,"BASE"); + + // get all of the format files in the e:\ve-proms\format directory. + DirectoryInfo di = new DirectoryInfo("E:\\ve-proms\\format"); + //DirectoryInfo di = new DirectoryInfo("E:\\proms.net\\exe\\fmtxml"); + FileInfo[] fis = di.GetFiles("*.fmt"); + listBox1.Items.Clear(); + foreach (FileInfo fi in fis) + { + string fn = fi.Name.Substring(0, fi.Name.Length - 4); + if (fn.ToLower() != "base") + { + this.listBox1.Items.Add(fi.Name); + this.listBox1.Refresh(); + FmtFileToXml fx = new FmtFileToXml(gx, fn); + } + } + MessageBox.Show("DONE Converting Formats to XML"); + } + + private void button8_Click(object sender, EventArgs e) + { + // get all of the generated xml format files in the fmt_xml directory and merge + // the fmt/doc/pag & subformats into one file. + DirectoryInfo di = new DirectoryInfo("fmt_xml"); + //testDirectoryInfo di = new DirectoryInfo("E:\\proms.net\\exe\\fmtxml"); + FileInfo[] fis = di.GetFiles("*f.xml"); + listBox1.Items.Clear(); + foreach (FileInfo fi in fis) + { + // see if all three, format, doc & pag exist - if not, print error, + // if so, process + string docname = "fmt_xml\\" + fi.Name.Substring(0, fi.Name.Length - 5) + "p.xml"; + string pagname = "fmt_xml\\" + fi.Name.Substring(0, fi.Name.Length - 5) + "d.xml"; + if (File.Exists(docname) && File.Exists(pagname)) + { + this.listBox1.Items.Add(fi.Name); + EntireFormat ef = new EntireFormat("fmt_xml\\" + fi.Name); + } + else + Console.WriteLine("For {0}, page or document file does not exist.", fi.Name); + } + MessageBox.Show("DONE Converting Formats to XML"); + } + } +} diff --git a/PROMS/fmtxml/Form1.resx b/PROMS/fmtxml/Form1.resx new file mode 100644 index 00000000..6236cf48 --- /dev/null +++ b/PROMS/fmtxml/Form1.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/PROMS/fmtxml/GenToXml.cs b/PROMS/fmtxml/GenToXml.cs new file mode 100644 index 00000000..f0bf73cc --- /dev/null +++ b/PROMS/fmtxml/GenToXml.cs @@ -0,0 +1,151 @@ +using System; +using System.IO; +using System.Text.RegularExpressions; +using System.Windows.Forms; + + + +namespace fmtxml +{ + /// + /// Summary description for GenToXml. + /// + public class GenToXml + { + private StreamWriter strGenXml; + private string genName; + + public GenToXml(string nm) + { + genName = nm; + try + { + OpenFiles(); + ConvertGenToXml(); + CloseFiles(); + } + catch (Exception ex) + { + MessageBox.Show("Genmac name = " + nm, ex.Message); + } + } + + public void OpenFiles() + { + if (!Directory.Exists("E:\\proms.net\\genmac.xml\\convert")) + Directory.CreateDirectory("E:\\proms.net\\genmac.xml\\convert"); + string fnm = "E:\\proms.net\\genmac.xml\\convert\\" + genName; + string outnm = fnm.Substring(0,fnm.LastIndexOf(".")) + ".xml"; + strGenXml = new StreamWriter(outnm,false,System.Text.Encoding.ASCII); + } + + public void CloseFiles() + { + strGenXml.Close(); + } + + public void ConvertGenToXml() + { + string linein; + try + { + // use regular expressions to read in the genmac C file and convert to XML. + StreamReader sr = new StreamReader("E:\\promsnt\\genmac\\preproc\\"+genName); + linein = sr.ReadToEnd(); + sr.Close(); + } + catch (Exception e) + { + // Let the user know what went wrong. + MessageBox.Show("File cannot be written " + genName + " error is " + e.Message); + return; + } + if (linein==null)return; + int indxb = linein.IndexOf("BEGIN"); + string line = linein.Substring(indxb,linein.Length-indxb); + linein=null; + // first Find defmac - endmac -> convert these do an element. + Regex defmacs = new Regex(@"DEFMAC(\s*|.*?)*ENDMAC",RegexOptions.IgnoreCase|RegexOptions.Compiled); + Match m; + strGenXml.Write("<" + genName.Substring(0,genName.LastIndexOf(".")) + "_GENMAC>\n"); + for (m = defmacs.Match(line); m.Success; m = m.NextMatch()) + { + strGenXml.Write(""); + string mt = line.Substring(m.Index,m.Length); + //Find the macro name, i.e. DEFMAC(xyz) + int indxend = mt.IndexOf(")"); + string macname = mt.Substring(7,indxend-7); + strGenXml.Write(macname+"\n\n"); + // the '+3' is to remove the \n\r also. The -9 is to account for the +3 & + // also remove the endmac + string macstr = mt.Substring(indxend+3,mt.Length-indxend-9); + // take x chars for the name & put out the name & definition. + string macnocomment = Regex.Replace(macstr, @"(\/\*(\s*|.*?)*\*\/)|(\/\/.*)", ""); + mt = Regex.Replace(macnocomment,";",""); + macnocomment = Regex.Replace(mt,@"\r\n",";"); + mt = Regex.Replace(macnocomment,@";+",";"); // eliminate multiple ';' + macnocomment = mt; + if (mt.IndexOf("&")>-1) + macnocomment = mt.Replace("&","&"); + strGenXml.Write(macnocomment); + strGenXml.Write("\n\n\n"); + } + // next find userdef - endmac -> convert these do an element. + defmacs = new Regex(@"USERDEF(\s*|.*?)*ENDMAC",RegexOptions.IgnoreCase|RegexOptions.Compiled); + for (m = defmacs.Match(line); m.Success; m = m.NextMatch()) + { + strGenXml.Write(""); + string mt = line.Substring(m.Index,m.Length); + //Find the macro name, i.e. USERDEF(xyz) + int indxend = mt.IndexOf(")"); + string macname = mt.Substring(8,indxend-8); + strGenXml.Write(macname+"\n\n\n"); + // the '+3' is to remove the \n\r also. The -9 is to account for the +3 & + // also remove the endmac + string macstr = mt.Substring(indxend+3,mt.Length-indxend-9); + // take x chars for the name & put out the name & definition. + string macnocomment = Regex.Replace(macstr, @"(\/\*(\s*|.*?)*\*\/)|(\/\/.*)", ""); + mt = Regex.Replace(macnocomment,";",""); + macnocomment = Regex.Replace(mt,@"\r\n",";"); + mt = Regex.Replace(macnocomment,@";+",";"); // eliminate multiple ';' + macnocomment = mt; + if (mt.IndexOf("&")>-1) + macnocomment = mt.Replace("&","&"); + strGenXml.Write(macnocomment); + strGenXml.Write("\n\n\n"); + } + // last find static functions - these have macro definitions too. + Regex defmacf = new Regex(@"static void (\s*|.*?)*}",RegexOptions.IgnoreCase|RegexOptions.Compiled); + for (m = defmacf.Match(line); m.Success; m = m.NextMatch()) + { + strGenXml.Write(""); + string mt = line.Substring(m.Index,m.Length); + //Find the function name, i.e. static void boxx. Parameters are on an different node(int i) + int indxbeg= mt.IndexOf("("); + string fnname = mt.Substring(12,indxbeg-12); + strGenXml.Write(fnname+"\n\""); + int indxend=mt.IndexOf(")"); + string param = null; + if (indxend-1==indxbeg) + param = "none"; + else + param = mt.Substring(indxbeg+1,indxend-1-indxbeg); + + strGenXml.Write(param+"\"\n\n"); + // now get past the opening curly. + indxbeg = mt.IndexOf("{"); + string fnstr = mt.Substring(indxbeg+2,mt.Length-indxbeg-3); + string macnocomment = Regex.Replace(fnstr, @"(\/\*(\s*|.*?)*\*\/)|(\/\/.*)", ""); // matches multi/single line comments: (\/\*(\s*|.*?)*\*\/)|(\/\/.*) + mt = Regex.Replace(macnocomment,";",""); + macnocomment = Regex.Replace(mt,@"\r\n",";"); + mt = Regex.Replace(macnocomment,@";+",";"); + if (mt.IndexOf("&")>-1) + mt = mt.Replace("&","&"); + strGenXml.Write(mt); + strGenXml.Write("\n\n\n"); + } + + strGenXml.Write(""); + } + } +} diff --git a/PROMS/fmtxml/GenXmlToSvg.cs b/PROMS/fmtxml/GenXmlToSvg.cs new file mode 100644 index 00000000..0c7a5bcf --- /dev/null +++ b/PROMS/fmtxml/GenXmlToSvg.cs @@ -0,0 +1,769 @@ +using System; +using System.IO; +using System.Xml; +using System.Text; +using System.Drawing; +using System.Windows.Forms; + +namespace fmtxml +{ + /// + /// 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. + /// + 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; + 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; + + public GenXmlToSvg(string nm) + { + genName = nm; + try + { + fontfam = new int[20]; + fontsiz = new int[20]; + PPx = new float[12]; + PPy = new float[12]; + ReadXml(); + ConvertGenXmlToDIXml(); + WriteXml(); + } + catch (Exception ex) + { + Console.WriteLine("Genmac.xml name = " + nm + ". Error is " + ex.Message); + } + } + + private float CPoint(float x) + { + if (Convertn == C) + { + // convert from x (in centimeters) to inches & then to points + return (float) (.3937 * x * 72); + } // convert from x (in inches) to points + else if (Convertn == I) + return (float)(x * 72); + else // convert from x (in dots) to twips & then points + return (float)(((4.8 * x + 0.5)/1440f)*72); + } + + private void WriteXml() + { + string path = "E:\\proms.net\\genmac.xml\\" + genName.Substring(0,genName.LastIndexOf(".")) + ".svg"; + XmlTextWriter writer = new XmlTextWriter(path,System.Text.Encoding.Unicode); + writer.Formatting=System.Xml.Formatting.Indented; + xmlOutDoc.Save(writer); + } + + private void ReadXml() + { + string fnm = "E:\\proms.net\\genmac.xml\\convert\\" + genName; + xmlDoc = new XmlDocument(); + XmlTextReader reader = new XmlTextReader(fnm); + xmlDoc.Load(reader); + reader.Close(); + } + private void ConvertGenXmlToDIXml() + { + // first create the document for the svg version of the macro files + // and add the top svg element. + xmlOutDoc = new XmlDocument(); + topOutElement = xmlOutDoc.CreateElement("svg"); + topOutElement.SetAttribute("width","8in"); + topOutElement.SetAttribute("height","10in"); + topOutElement.SetAttribute("viewBox","0 0 576 720"); + // topOutNode.Attributes.Append(attr); + // topOutNode.Attributes.Append + xmlOutDoc.AppendChild(topOutElement); + + // Next add the description node, which is the name of the plant format. + XmlElement descNode = xmlOutDoc.CreateElement("desc"); + descNode.InnerText = genName.Substring(0,genName.LastIndexOf(".")); + topOutElement.AppendChild(descNode); + XmlElement top = (XmlElement) xmlDoc.FirstChild; + XmlNode sv = top.SelectSingleNode("STATICVOID"); + XmlNodeList xmlNds = top.SelectNodes("MACRO"); + + // Now for each macro, create a svg group with the name given to + // it. Later we may change this to map to what was created in 16-bit + // proms (for example BOX1 -> B1) + foreach (XmlNode nd in xmlNds) + { + XmlNode name = nd.SelectSingleNode("NAME"); + XmlElement elm = (XmlElement) name; + XmlElement grp = xmlOutDoc.CreateElement("g"); + string cname = GetName(name.InnerText); + grp.SetAttribute("id",cname); + topOutElement.AppendChild(grp); + XmlNode definition = nd.SelectSingleNode("DEFINITION"); + try + { + string str = ProcessMacroDefinition(grp,definition,sv); + } + catch (Exception e) + { + MessageBox.Show("Error processing macro definition for " + this.genName, e.Message); + } + } + + xmlNds = top.SelectNodes("USERDEF"); + + // Now for each user defined macro, create a svg group with the + // name given to it. + foreach (XmlNode nd in xmlNds) + { + XmlNode name = nd.SelectSingleNode("NAME"); + XmlElement elm = (XmlElement) name; + XmlElement grp = xmlOutDoc.CreateElement("g"); + string tmpdebug = name.InnerText.Trim("\n".ToCharArray()); + grp.SetAttribute("id",tmpdebug); + topOutElement.AppendChild(grp); + XmlNode definition = nd.SelectSingleNode("DEFINITION"); + try + { + string str = ProcessMacroDefinition(grp,definition,sv); + } + catch (Exception e) + { + MessageBox.Show("Error processing macro definition for " + this.genName, e.Message); + } + } + + } + + // convert the macro names as was done in 16-bit code? + string GetName(string oname) + { + for (int i=0; i<51 ; i++) + { + if (oname == OldName[i]) return NewName[i]; + } + return "NONAME"; + } + + private void PushFont() + { + if( fidx < 19 ) + { + fontfam[fidx] = RTFFontFamily; + fontsiz[fidx] = RTFFontSize; + fidx++; + } + return; + } + private void PopFont() + { + if( fidx > 0 ) + { + fidx--; + RTFFontFamily = fontfam[fidx]; + RTFFontSize = fontsiz[fidx]; + } + return; + } + private void PushPos() + { + if (Sp < 11) + { + Sp++; + PPx[Sp] = cx; + PPy[Sp] = cy; + } + } + + private void PopPos() + { + if (Sp > -1) + { + cx = PPx[Sp]; + cy = PPy[Sp]; + Sp--; + } + } + + private XmlElement RTFAdjust(float x, float y) + { + // This was used for RTF export only. + return null; + } + private XmlElement GDIAdjust(float x, float y) + { + // can't quite figure out what this is doing + // KBR TODO: gdiadjust + return null; + } + + private float GetOneFloat(string cmd) + { + int indxlp = cmd.IndexOf("("); + int indxrp = cmd.IndexOf(")"); + string tmp = cmd.Substring(indxlp+1,indxrp-indxlp-1); + return (float) Convert.ToDouble(tmp); + } + + private void GetTwoFloats(string cmd, ref float x, ref float y) + { + int indxlp = cmd.IndexOf("("); + int indxcm = cmd.IndexOf(","); + int indxrp = cmd.IndexOfAny("),".ToCharArray(),indxcm+1); + x = (float) Convert.ToDouble(cmd.Substring(indxlp+1,indxcm-indxlp-1)); + y = (float) Convert.ToDouble(cmd.Substring(indxcm+1,indxrp-indxcm-1)); + } + + private XmlElement DefineMacro(string str) + { + byte x = Convert.ToByte(173); + cx=cy=0; + return null; + } + private XmlElement HorizontalLine(float X) + { + XmlElement box = this.xmlOutDoc.CreateElement("line"); + box.SetAttribute("x1",cx.ToString()); + box.SetAttribute("y1",cy.ToString()); + box.SetAttribute("x2",(cx+CPoint(X)).ToString()); + box.SetAttribute("y2",cy.ToString()); + box.SetAttribute("stroke-width",Wid.ToString()); + return box; + } + + private XmlElement VerticalLine(float Y) + { + XmlElement box = this.xmlOutDoc.CreateElement("line"); + box.SetAttribute("x1",cx.ToString()); + box.SetAttribute("y1",cy.ToString()); + box.SetAttribute("x2",cx.ToString()); + box.SetAttribute("y2",(cy+CPoint(Y)).ToString()); + box.SetAttribute("stroke-width",Wid.ToString()); + return box; + } + + private XmlElement DiagLine(float X, float Y) + { + XmlElement box = this.xmlOutDoc.CreateElement("line"); + box.SetAttribute("x1",cx.ToString()); + box.SetAttribute("y1",cy.ToString()); + box.SetAttribute("x2",(cx+CPoint(X)).ToString()); + box.SetAttribute("y2",(cy+CPoint(Y)).ToString()); + box.SetAttribute("stroke-width",Wid.ToString()); + return box; + } + + private XmlElement Box(float X, float Y) + { + XmlElement box = this.xmlOutDoc.CreateElement("rect"); + box.SetAttribute("x",cx.ToString()); + box.SetAttribute("y",cy.ToString()); + box.SetAttribute("width",CPoint(X).ToString()); + box.SetAttribute("height",CPoint(Y).ToString()); + box.SetAttribute("fill","none"); + box.SetAttribute("stroke","black"); + box.SetAttribute("stroke-width",Wid.ToString()); + return box; + } + + private XmlElement Ellipse(float X, float Y) + { + XmlElement ellipse = this.xmlOutDoc.CreateElement("ellipse"); + ellipse.SetAttribute("cx",cx.ToString()); + ellipse.SetAttribute("cy",cy.ToString()); + ellipse.SetAttribute("rx",(CPoint(X)).ToString()); + ellipse.SetAttribute("ry",(CPoint(Y)).ToString()); + ellipse.SetAttribute("fill","none"); + ellipse.SetAttribute("stroke","black"); + ellipse.SetAttribute("stroke-width",Wid.ToString()); + return ellipse; + } + + private XmlElement Text(float X, float Y, string str) + { + //text-decoration="underline" + //font-weight="bold" + //font-style="italic" + XmlElement text = this.xmlOutDoc.CreateElement("text"); + text.SetAttribute("x",(cx+CPoint(X)).ToString()); + text.SetAttribute("y",(cy+CPoint(Y)).ToString()); + text.SetAttribute("font-family",FontChoice[RTFFontFamily]); + text.SetAttribute("font-size",(RTFFontSize/2).ToString()); + if ((RTFBUI&BOLD)==1) text.SetAttribute("font-weight","bold"); + if ((RTFBUI&UNDERLINE)==1) text.SetAttribute("text-decoration", "underline"); + if ((RTFBUI&ITALICS)==1) text.SetAttribute("font-style","italic"); + text.InnerText = str; + return text; + } + + private XmlElement[] RTFBox3(float x, float y) + { + XmlElement[] elearr = new XmlElement[3]; + PushPos(); + elearr[0] = VerticalLine(y); + cy += CPoint(y); + elearr[1] = HorizontalLine(x); + cx += CPoint(x); + float ftmp = (float) (y*-1.0); + cy += CPoint(ftmp); + elearr[2] = VerticalLine(y); + PopPos(); + return elearr; + } + + private XmlElement BitMap(float X, float Y, string str) + { + XmlElement bmap = xmlOutDoc.CreateElement("image"); + bmap.SetAttribute("x",(cx+CPoint(X)).ToString()); + bmap.SetAttribute("y",(cy+CPoint(Y)).ToString()); + Bitmap bmp= new Bitmap(str); + bmap.SetAttribute("width",bmp.Width.ToString()+"px"); + bmap.SetAttribute("height",bmp.Height.ToString()+"px"); + //bmap.SetAttribute("xlink:href",str); + bmap.SetAttribute("bname",str); + return bmap; + } + + private void GetFont(string fontexp) + { + if (fontexp==null||fontexp=="") + { + RTFFontFamily = 3; + RTFFontSize = 20; + } + else if (fontexp.IndexOf("PICA")>-1) + { + RTFFontFamily = 4; + RTFFontSize = 24; + } + else if (fontexp.IndexOf("EXPANDED")>-1) + { + RTFFontSize = 24; + } + else if(fontexp.IndexOf("SANSERIF")>-1) + { + RTFFontFamily = 6; + RTFFontSize = 20; + } + else if (fontexp.IndexOf("PROPT12")>-1) + { + RTFFontFamily = 5; + RTFFontSize = 22; + } + else if (fontexp.IndexOf("COMPRESSED")>-1) + { + RTFFontFamily = 6; + RTFFontSize = 14; + } + if (fontexp.IndexOf("BOLD")>-1) RTFBUI |= BOLD; else RTFBUI &= 0xFFFE; + if (fontexp.IndexOf("UNDERLINE")>-1) RTFBUI |= UNDERLINE; else RTFBUI &= 0xFFFD; + if (fontexp.IndexOf("ITALICS")>-1) RTFBUI |= ITALICS; else RTFBUI &= 0xFFFB; + } + + private string ProcessMacroDefinition(XmlElement grp, XmlNode idef, XmlNode functions) + { + XmlElement elm = (XmlElement) idef; + string def = elm.InnerText; + StringBuilder str_result = new StringBuilder(); + + fidx=0; + cx = 0; + cy = 0; + Wid = 3; + RTFFontSize = 20; + RTFFontFamily = 3; + Sp = -1; + + // for each element, process the token for the element and add it to the + // xml tree (ProcessToken does both). + int lindx = 0; + int indx = def.IndexOf(";"); + while (indx>-1) + { + ProcessToken(grp, def, lindx, indx, functions); + lindx = indx+1; + indx = def.IndexOf(";",lindx); + } + return str_result.ToString(); + } + + private void ProcessToken(XmlElement grp, string def, int lindx, int indx, XmlNode functions) + { + + float x=0,y=0; + XmlElement retval = null; + //get the token, i.e. from last index to this one. + string token = def.Substring(lindx,indx-lindx).Trim(); + if (token==null||token=="")return; + string cmd = token; // cmd has the command without parens/values + if (token.IndexOf("(")>-1) cmd = token.Substring(0,token.IndexOf("(")); + if (token.IndexOf("RTFFontSize")>-1)cmd = "RTFFontSize"; + if (token.IndexOf("RTFFontFamily")>-1)cmd = "RTFFontFamily"; + if (token.IndexOf("RTFBUI")>-1) cmd = "RTFBUI"; + if (token.IndexOf("DEFMAC")>-1) cmd = "DEFMAC"; + if (token.IndexOf("HLINE")>-1) cmd = "HLINE"; + if (token.IndexOf("TEXT")>-1) cmd = "TEXT"; + if (token.IndexOf("BITMAP")>-1) cmd = "BITMAP"; + if (cmd==null)return; + try + { + switch (cmd) + { + case "DEFMAC": // command is DEFMAC(xyz) + MessageBox.Show("DEFMAC found, format = " + genName + " not converted - do manually"); + int indxl = token.IndexOf("("); + int indxr = token.IndexOf(")"); + string strx = token.Substring(indxl+1,indxr-indxl-1).Trim(); + retval = DefineMacro(strx); + break; + case "PUSHF": + PushFont(); + break; + case "POPF": + PopFont(); + break; + case "PUSHP": + PushPos(); + break; + case "POPP": + PopPos(); + break; + case "UNIT": + if (token.IndexOf("C")>-1)Convertn = C; + else if (token.IndexOf("I",4)>-1)Convertn = I; + else if (token.IndexOf("D")>-1)Convertn = D; + break; + case "RTFADJ": // command is RTFADJ(x,y) + GetTwoFloats(token, ref x, ref y); + retval = RTFAdjust(x, y); + break; + case "GDIADJ": // command is GDIADJ(x,y) + GetTwoFloats(token, ref x, ref y); + retval = GDIAdjust(x, y); + break; + case "FONT": //comand is FONT(FONTSTR) + GetFont(token); + break; + case "RTFFontSize": // command is RTFFontSize = x + int indxe = token.IndexOf("="); + string numstr = token.Substring(indxe+1,token.Length-indxe-1).Trim(); + if (numstr.IndexOf("*")>-1) + { + int i1 = Convert.ToInt32(numstr.Substring(0,numstr.IndexOf("*"))); + int i2 = Convert.ToInt32(numstr.Substring(numstr.IndexOf("*")+1,numstr.Length-numstr.IndexOf("*")-1)); + RTFFontSize = i1*i2; + } + else + RTFFontSize = Convert.ToInt32(numstr); + break; + case "RTFBUI": + // command either sets it '=' or ORs it '|= ', look for these. + int ieq = token.IndexOf("="); + string val = token.Substring(ieq+1,token.Length-ieq-1).Trim(); + int amt=0; + if (token.IndexOf("0x")<0) + amt = Convert.ToInt32(val); + else + amt = Convert.ToInt32(val,16); + int operor = token.IndexOf("|="); + int operand = token.IndexOf("&="); + if (operor<0 && operand<0) + RTFBUI = amt; + else if (operor>0) + RTFBUI |= amt; + else + RTFBUI &= amt; + break; + case "RTFFontFamily": // command is RTFFontFamily = x + indxe = token.IndexOf("="); + numstr = token.Substring(indxe+1,token.Length-indxe-1).Trim(); + RTFFontFamily = Convert.ToInt32(numstr); + break; + case "LNWID": // command is LNWID(w) + float w = GetOneFloat(token); + Wid = CPoint(w); + break; + case "MOVA": // command is MOVA(x, y) + GetTwoFloats(token,ref x, ref y); + cx = CPoint(x); + cy = CPoint(y); + break; + case "MOVR": // command is MOVR(x, y) + GetTwoFloats(token,ref x, ref y); + cx += CPoint(x); + cy += CPoint(y); + break; + case "HLINE": // command is HLINE(x) + x = GetOneFloat(token); + grp.AppendChild(HorizontalLine(x)); + break; + case "VLINE": // command is VLINE(y) + y = GetOneFloat(token); + grp.AppendChild(VerticalLine(y)); + break; + case "DLINE": // command is DLINE(x, y) + GetTwoFloats(token, ref x, ref y); + grp.AppendChild(DiagLine(x, y)); + break; + case "BOX": // command is BOX(x, y) + GetTwoFloats(token,ref x, ref y); + grp.AppendChild(Box(x,y)); + break; + case "BOX3SIDES": // command is BOX3SIDES(X,Y) + GetTwoFloats(token, ref x, ref y); + XmlElement [] bxsd = new XmlElement[3]; + bxsd = RTFBox3(x, y); + for (int ib = 0;ib < 3; ib++) grp.AppendChild(bxsd[ib]); + break; + case "DBOX": // * DBOX(X,Y,A) DoubleBox((double)X,(double)Y,(double)A); + MessageBox.Show("Not supported - ANO only"); + break; + case "CIRCLE": // command is CIRCLE(X,Y) + GetTwoFloats(token, ref x, ref y); + grp.AppendChild(Ellipse(x,y)); + break; + case "TEXT": // command is TEXT(x, y, str) + GetTwoFloats(token,ref x, ref y); + int indxrp = token.IndexOf(","); + indxrp = token.IndexOf(",",indxrp+1); + // this found the last argument, i.e. text - now find the " + indxrp = token.IndexOf("\"",indxrp+1); + string str = token.Substring(indxrp+1,token.LastIndexOf("\"")-indxrp-1); + // only trim if has characters? +// if (str!=null)str = str.Trim(); + if (str!=null && str!="") grp.AppendChild(Text(x, y, str)); + break; + case "BITMAP": + int ibm = token.IndexOf("BITMAP"); + int ibmq = token.IndexOf("\"",ibm); + string thestr = token.Substring(ibm,ibmq-ibm); + string [] bmap = thestr.Split(" ".ToCharArray(),4); + x=(float)Convert.ToDouble(bmap[1]); + y=(float)Convert.ToDouble(bmap[2]); + thestr=bmap[3]; + if (thestr.IndexOf("~FORMAT\\")>-1) thestr=thestr.Replace("~FORMAT","E:\\VE-PROMS\\FORMAT"); + grp.AppendChild(BitMap(x,y,thestr)); + break; + case "ABSOLUTE": // no-op ? + break; + default: // function calls + // see if in the STATICVOID list. The name is the function name + // without () or parameters... + + XmlNode parent = functions.ParentNode; + XmlNode foundsv = parent.SelectSingleNode("STATICVOID[NAME = \""+cmd+"\"]"); + if (foundsv==null) + Console.WriteLine("Name " + genName + " failed. The token is not in list, token = " +token); + else + { + XmlNode param = foundsv.SelectSingleNode("PARAMETERS"); + XmlNode deffn = foundsv.SelectSingleNode("DEFINITION"); + // get the argument value to pass in. + int ilp = token.IndexOf("("); + int irp = token.IndexOf(")"); + string aval=null; + if (ilp>0&&irp>0) aval = token.Substring(ilp+1,irp-ilp-1); + ProcessFunctions(grp, param.InnerText,functions, aval, deffn.InnerText); + } + break; + } + } + catch (Exception e) + { + Console.WriteLine("Name = " + genName + ". Error in token: " + token, e.Message); + retval = null; + } + return; + } + + private void ProcessFunctions(XmlElement grp, string param, XmlNode functions, string val, string fntext) + { + // Each function contains a series of commands that must be processed for the + // function. Results are added to the group element for this group (macro). + + string repstr=null; + // if there is a parameter, get the substitution string... + if (param.IndexOf("none")==-1) + { + int chrindx = param.IndexOf("char *"); + int end = -1; + if (chrindx>-1) + { + end = param.IndexOf("\"",chrindx); + repstr = param.Substring(chrindx+6,end-chrindx-6); + } + else + { + chrindx = param.IndexOf("int "); + if (chrindx>-1) + { + end = param.IndexOf("\"",chrindx); + repstr = param.Substring(chrindx+4,end-chrindx-4); + } + } + + } + + // find the function commands and include them here. + + string funstr = fntext; + if (repstr!=null)funstr = funstr.Replace(repstr,val); + // for each element, process commands. + int lindx = 0; + int indx = funstr.IndexOf(";"); + while (indx>-1) + { + + ProcessToken(grp, funstr, lindx, indx, functions); + lindx = indx+1; + indx = funstr.IndexOf(";",lindx); + } + } + } +} diff --git a/PROMS/fmtxml/SvgToPdf.cs b/PROMS/fmtxml/SvgToPdf.cs new file mode 100644 index 00000000..8b0c5448 --- /dev/null +++ b/PROMS/fmtxml/SvgToPdf.cs @@ -0,0 +1,191 @@ +using System; +using System.Text; +using System.Xml; +using System.Drawing; +using System.Windows.Forms; +using C1.C1Pdf; + +namespace fmtxml +{ + /// + /// Summary description for XmlToPdf. + /// + public class SvgToPdf + { + private float ConvertToPoints=72f; + private XmlDocument xmlDoc; + private string FileName; + private string FilePath; + private C1.C1Pdf.C1PdfDocument _c1pdf; + + 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 float LeftMargin; //todo: define in page info + private float VerticalOffset; //todo: define in page info + private bool Portrait; //todo: define in page info + + public SvgToPdf(string path, string fname) + { + LeftMargin=0.5f * ConvertToPoints; // KBR: TODO + VerticalOffset=0.5f * ConvertToPoints; // KBR: TODO + Portrait = true; // KBR: TODO + FileName = fname; + FilePath = path; + xmlDoc = new XmlDocument(); + XmlTextReader reader = new XmlTextReader(FilePath+"\\"+FileName); + xmlDoc.Load(reader); + reader.Close(); + try + { + GeneratePDFForFile(); + } + catch (Exception e) + { + MessageBox.Show("Error processing: " + fname, e.Message); + } + } + + private void GeneratePDFForFile() + { + _c1pdf = new C1.C1Pdf.C1PdfDocument(); + string rootname = FileName.Substring(0,FileName.Length-4); + // create a pdf file with a page for each macro (i.e. macro element in xml tree), + // put it into the pdf file. + XmlNode topnode = xmlDoc.LastChild; + XmlNodeList ndlist = topnode.SelectNodes("/g"); + for (int i=0;i + /// Summary description for XmlToPdf. + /// + public class XmlToPdf + { + private float ConvertToPoints=72f; + private XmlDocument xmlDoc; + private string FileName; + private string FilePath; + private C1.C1Pdf.C1PdfDocument _c1pdf; + + 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 float LeftMargin; //todo: define in page info + private float VerticalOffset; //todo: define in page info + private bool Portrait; //todo: define in page info + + public XmlToPdf(string path, string fname) + { + LeftMargin=0.5f * ConvertToPoints; // KBR: TODO + VerticalOffset=0.5f * ConvertToPoints; // KBR: TODO + Portrait = true; // KBR: TODO + FileName = fname; + FilePath = path; + xmlDoc = new XmlDocument(); + XmlTextReader reader = new XmlTextReader(FilePath+"\\"+FileName); + xmlDoc.Load(reader); + reader.Close(); + try + { + GeneratePDFForFile(); + } + catch (Exception e) + { + MessageBox.Show("Error processing: " + fname, e.Message); + } + } + + private void GeneratePDFForFile() + { + _c1pdf = new C1.C1Pdf.C1PdfDocument(); + string rootname = FileName.Substring(0,FileName.Length-4); + // create a pdf file & for each macro (i.e. macro element in xml tree), + // put it into the pdf file. + XmlElement top = (XmlElement) xmlDoc.SelectSingleNode(rootname + "_GENMAC"); + XmlNodeList xmlNds = top.SelectNodes("MACRO"); + foreach (XmlNode nd in xmlNds) + { + XmlNode name = nd.SelectSingleNode("NAME"); + XmlElement elm = (XmlElement) name; + XmlNode definition = nd.SelectSingleNode("DEFINITION"); + MacroGeneratePDF(definition); + _c1pdf.NewPage(); + } + string outname = "E:\\ve-proms.net\\genmac.xml\\testpdf\\" + rootname + ".pdf"; + _c1pdf.Save(outname); + } + + private void MacroGeneratePDF(XmlNode definition) + { + XmlElement elm = (XmlElement) definition; + string def = elm.InnerText; + int lindx = 0; + int indx = def.IndexOf(";"); + while (indx>-1) + { + string command = def.Substring(lindx,indx-lindx).Trim(); + DoPDF(command); + lindx = indx+1; + indx = def.IndexOf(";",lindx); + } + + } + + private void DoPDF(string cmdline) + { + string cmd = cmdline.Substring(0,cmdline.IndexOf(" ")); + int stx, sty, ex, ey = 0; + float fstx, fsty, fex, fey = 0; + int lw=0; + string restOfIt=null; + string [] parts; + + Pen pn = null; + switch (cmd) + { + case "BOX": + restOfIt = cmdline.Substring(4,cmdline.Length-4); + parts = restOfIt.Split(" ".ToCharArray(),5); + fstx = (float) System.Convert.ToDouble(parts[0]); + fsty = (float) System.Convert.ToDouble(parts[1]); + fex = (float) System.Convert.ToDouble(parts[2]); + fey = (float) System.Convert.ToDouble(parts[3]); + float flw = (float) System.Convert.ToDouble(parts[4]); + pn = new Pen(Brushes.Black,flw); + //KBR: TODO - storing page stuff such as portland, vertical offset, tab, etc. + RectangleF rc = new RectangleF(LeftMargin+fstx,VerticalOffset+fsty,fex,fey); + _c1pdf.DrawRectangle(pn,rc); + break; + case "LINE": // command is LINE startx, starty, endx, endy, lnwidth + restOfIt = cmdline.Substring(5,cmdline.Length-5); + parts = restOfIt.Split(" ".ToCharArray(),5); + fstx = (float) System.Convert.ToDouble(parts[0]); + fsty = (float) System.Convert.ToDouble(parts[1]); + fex = (float) System.Convert.ToDouble(parts[2]); + fey = (float) System.Convert.ToDouble(parts[3]); + float flw1 = (float) System.Convert.ToDouble(parts[4]); +//KBR: TODO - storing page stuff such as portland, vertical offset, tab, etc. +// startx = portland ? (vof + cy + adjy) : (cx + tab + adjx); +// starty = portland ? (tab - (cx + adjx)) : (cy + vof + adjy); + pn = new Pen(Brushes.Black,flw1); +//KBR: TODO - move ablsolute? +// if (MoveAbsolute) +// {tab = 0;vof = 0;} + _c1pdf.DrawLine(pn, LeftMargin+fstx, VerticalOffset+fsty, LeftMargin+fstx+fex, VerticalOffset+fsty+fey); + break; + case "TEXT": + int quote = cmdline.IndexOf("\""); + string txt = cmdline.Substring(quote+1,cmdline.LastIndexOf("\"")-quote-1); + restOfIt = cmdline.Substring(5,quote-6); + parts = restOfIt.Split(" ".ToCharArray(),5); + fstx = (float) System.Convert.ToDouble(parts[0]); + fsty = (float) System.Convert.ToDouble(parts[1]); + int FontSize = System.Convert.ToInt32(parts[2]); + FontSize = FontSize/2; + int FontFamily = System.Convert.ToInt32(parts[3]); + int bui = System.Convert.ToInt32(parts[4]); //kbr todo: use bui + Font myfont = new Font(this.FontChoice[FontFamily],FontSize); + rc = new Rectangle(); + rc.Size = _c1pdf.MeasureStringRtf(txt,myfont,500); // kbr todo: 500? + rc.X = LeftMargin+fstx; + rc.Y = VerticalOffset+fsty-FontSize; //-(rc.Size.Height/2); + _c1pdf.DrawStringRtf(txt,myfont,Brushes.Black,rc); + break; + case "GDIADJ": + break; + case "ELLIPSE": + restOfIt = cmdline.Substring(8,cmdline.Length-8); + parts = restOfIt.Split(" ".ToCharArray(),5); + stx = System.Convert.ToInt32(parts[0]); + sty = System.Convert.ToInt32(parts[1]); + ex = System.Convert.ToInt32(parts[2]); + ey = System.Convert.ToInt32(parts[3]); + lw = System.Convert.ToInt32(parts[4]); + _c1pdf.DrawEllipse(pn,LeftMargin+stx, VerticalOffset+sty, LeftMargin+ex, VerticalOffset+ey); + break; + case "BITMAP": + restOfIt = cmdline.Substring(8,cmdline.Length-7); + parts = restOfIt.Split(" ".ToCharArray(),3); + fstx = (float) System.Convert.ToDouble(parts[0]); + fsty = (float) System.Convert.ToDouble(parts[1]); + string fname = parts[2]; + Image img = Image.FromFile(fname); + rc = new RectangleF(); + rc.Height = img.Height; + rc.Width = img.Width; + rc.X = LeftMargin+fstx; + rc.Y = VerticalOffset+fsty-(rc.Size.Height/2); + _c1pdf.DrawImage(img, rc, ContentAlignment.MiddleCenter, ImageSizeModeEnum.Scale); + break; + case "ABSOLUTE": + break; + default: + break; + } + } + } +}