This commit is contained in:
		@@ -345,7 +345,7 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
			pdfFile.Delete();
 | 
			
		||||
			Pdf.DeleteAll(doc.DocID); // clear the PDF table for DocID first
 | 
			
		||||
			DocStyle myDocStyle = myItemInfo.ActiveSection.MyDocStyle;
 | 
			
		||||
			using (Pdf myPdf = Pdf.MakePdf(doc, MSWordToPDF.DebugStatus, (int)myDocStyle.Layout.TopRow, (int)myDocStyle.Layout.PageLength,
 | 
			
		||||
			using (Pdf myPdf = Pdf.MakePdf(doc, MSWordToPDF.DebugStatus, (int)myDocStyle.Layout.TopMargin, (int)myDocStyle.Layout.PageLength,
 | 
			
		||||
				(int)myDocStyle.Layout.LeftMargin, (int)myDocStyle.Layout.PageWidth, (double)myItemInfo.MSWordPageCount, buf)) { ;}
 | 
			
		||||
			doc.UpdateDRoUsages(roids);
 | 
			
		||||
			doc.Save();
 | 
			
		||||
@@ -455,7 +455,7 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
			using (Document doc = docInfo.Get())
 | 
			
		||||
			{
 | 
			
		||||
				DocStyle myDocStyle = sect.ActiveSection.MyDocStyle;
 | 
			
		||||
				using (Pdf myPdf = Pdf.MakePdf(doc, MSWordToPDF.DebugStatus, (int)myDocStyle.Layout.TopRow, (int)myDocStyle.Layout.PageLength,
 | 
			
		||||
				using (Pdf myPdf = Pdf.MakePdf(doc, MSWordToPDF.DebugStatus, (int)myDocStyle.Layout.TopMargin, (int)myDocStyle.Layout.PageLength,
 | 
			
		||||
					(int)myDocStyle.Layout.LeftMargin, (int)myDocStyle.Layout.PageWidth, (double)sect.MSWordPageCount, buf)) { ;}
 | 
			
		||||
				doc.UpdateDRoUsages(roids);
 | 
			
		||||
				doc.Save();
 | 
			
		||||
@@ -534,25 +534,17 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
							float width = 72 * Int32.Parse(vals[3], System.Globalization.NumberStyles.AllowHexSpecifier) / 12.0F;
 | 
			
		||||
							int lines = Int32.Parse(vals[2], System.Globalization.NumberStyles.AllowHexSpecifier);
 | 
			
		||||
							float height = 72 * lines / 6.0F;
 | 
			
		||||
							//sel.MoveEnd(LBWdUnits.wdLine, lines);// The number of lines depends on the third parameter
 | 
			
		||||
							//sel.EndKey(LBWdUnits.wdLine, true);
 | 
			
		||||
							//sel.MoveEnd(LBWdUnits.wdCharacter, -1);
 | 
			
		||||
							//Console.WriteLine("Lines = {0}", lines);
 | 
			
		||||
							float x = (float)sel.get_Information(LBWdInformation.wdHorizontalPositionRelativeToTextBoundary);
 | 
			
		||||
							// 9.25 is the approximate offset of the base line of the font, i.e. doesn't include descender.
 | 
			
		||||
							float y = (float)sel.get_Information(LBWdInformation.wdVerticalPositionRelativeToTextBoundary) + ((sel.Font.Size * 9.25F) / 12);
 | 
			
		||||
							sel.Text = "";
 | 
			
		||||
							// TODO: Need to create a temporary file for printing.
 | 
			
		||||
							// TODO: Need a way to eliminate the temporary file when done printing.
 | 
			
		||||
							// LBInlineShape shape = sel.InlineShapes.AddPicture(@"C:\Plant\HLP\VEHLP\ro\No1Seal.bmp");
 | 
			
		||||
							float x = (float)sel.get_Information(LBWdInformation.wdHorizontalPositionRelativeToPage);
 | 
			
		||||
							float y = (float)sel.get_Information(LBWdInformation.wdVerticalPositionRelativeToPage);
 | 
			
		||||
							//LBInlineShape shape = sel.InlineShapes.AddPicture(pngFile);
 | 
			
		||||
							LBRange myRange = sel.Paragraphs.First.Range;
 | 
			
		||||
							float yTop = (float)myRange.get_Information(LBWdInformation.wdVerticalPositionRelativeToPage);
 | 
			
		||||
							LBShape shape = myDoc.Shapes.AddPicture(roImageFile.MyFile.FullName, x, y - yTop, sel.Range);
 | 
			
		||||
							// LBInlineShape shape = sel.InlineShapes.AddPicture(roImageFile.MyFile.FullName);
 | 
			
		||||
							//Console.WriteLine("{0} Shape Width {1} Height {2}", val.Replace("\n", "','"), shape.Width, shape.Height);
 | 
			
		||||
							LBShape shape = myDoc.Shapes.AddPicture(roImageFile.MyFile.FullName, x, y, sel.Range);
 | 
			
		||||
							shape.RelativeVerticalPosition = LBWdRelativeVerticalPosition.wdRelativeVerticalPositionMargin;
 | 
			
		||||
							shape.Top = y;		// Reset value after setting flag RelativeVerticalPosition
 | 
			
		||||
							shape.RelativeHorizontalPosition = LBWdRelativeHorizontalPosition.wdRelativeHorizontalPositionMargin;
 | 
			
		||||
							shape.Left = x;
 | 
			
		||||
							shape.Width = width;
 | 
			
		||||
							shape.Height = height;
 | 
			
		||||
							//Console.WriteLine("{0} Shape Width {1} Height {2}", val.Replace("\n", "','"), shape.Width, shape.Height);
 | 
			
		||||
							imageROTokenReplaced = true;
 | 
			
		||||
						}
 | 
			
		||||
						if (!imageROTokenReplaced)
 | 
			
		||||
@@ -563,7 +555,6 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
						try
 | 
			
		||||
						{
 | 
			
		||||
							val = val.Replace("`", "\xB0");
 | 
			
		||||
							//AddInfo("\tRO Found {0} = '{1}'", sel.Text, val);
 | 
			
		||||
							sel.Text = "";
 | 
			
		||||
							//float width = 72 * Int32.Parse(vals[3], System.Globalization.NumberStyles.AllowHexSpecifier) / 12.0F;
 | 
			
		||||
							//float height = 72 * lines / 6.0F;
 | 
			
		||||
@@ -628,7 +619,7 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
 | 
			
		||||
		public static void AdjustMargins(DocStyle myDocStyle, LBDocumentClass myDoc, bool printingMode)
 | 
			
		||||
		{
 | 
			
		||||
			float newTop = (float)myDocStyle.Layout.TopRow;
 | 
			
		||||
			float newTop = (float)myDocStyle.Layout.TopMargin;
 | 
			
		||||
			float newLeft = (float)myDocStyle.Layout.LeftMargin;
 | 
			
		||||
			float newLength = (float)myDocStyle.Layout.PageLength;
 | 
			
		||||
			float newWidth = (float)myDocStyle.Layout.PageWidth;
 | 
			
		||||
 
 | 
			
		||||
@@ -1996,15 +1996,45 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
			{
 | 
			
		||||
				int level = 0;
 | 
			
		||||
				ItemInfo par = this;
 | 
			
		||||
				ItemInfo LastRNO = null;
 | 
			
		||||
				while (!par.IsHigh)
 | 
			
		||||
				{
 | 
			
		||||
					// 16bit TODO: 
 | 
			
		||||
					//if (par.IsRNO) // do I need to save 'lastrnoptr'
 | 
			
		||||
					//if (!IsRNO(ptr) && (IsSequential(ptr) ||
 | 
			
		||||
					//        (!IsText(ptr) && CountAllSubLevels))) - Add this line of code for non-hlp
 | 
			
		||||
					if (!par.IsRNOPart && par.IsSequential) level++;
 | 
			
		||||
					if (par.IsRNOPart) LastRNO = par.MyParent;
 | 
			
		||||
					if (!par.IsRNOPart && (par.IsSequential || (!(par.IsCaution || par.IsNote) 
 | 
			
		||||
						&& ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.CountAllSubLevels)))
 | 
			
		||||
						level++;
 | 
			
		||||
					par = par.MyParent;
 | 
			
		||||
				}
 | 
			
		||||
				// ImperfectStructure is used so that the sequential numbering for substeps under an RNO is not same
 | 
			
		||||
				// numbering (alpha vs numeric), if the HLS has substeps - WCNS uses this, as well as other plants.
 | 
			
		||||
				if (ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ImperfectStructure && IsSequential 
 | 
			
		||||
					&& (LastRNO !=null) && LastRNO.IsHigh && LastRNO.HasChildren 
 | 
			
		||||
					&& LastRNO.FirstChild(E_FromType.Step) != null && LastRNO.FirstChild(E_FromType.Step).IsSequential)
 | 
			
		||||
				{
 | 
			
		||||
					if (ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ImperfectStructurePlus4) level += 2;
 | 
			
		||||
					if (ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ImperfectSubstep && !ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ImperfectStructurePlus4)
 | 
			
		||||
						level--;
 | 
			
		||||
				}
 | 
			
		||||
				// ImperfectStructure for substeps - only good for level 1 RNOs 
 | 
			
		||||
				else if (ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ImperfectSubstep && RNOLevel == 1)
 | 
			
		||||
				{
 | 
			
		||||
					par = this;
 | 
			
		||||
					while (!par.IsRNOPart) par = par.MyParent;  // get to the rno.
 | 
			
		||||
					if (par.MyParent.HasChildren)				// if hls has children?
 | 
			
		||||
					{
 | 
			
		||||
						ItemInfo tchild = par.FirstChild(E_FromType.Step);
 | 
			
		||||
						if (tchild != null)
 | 
			
		||||
						{
 | 
			
		||||
							int typ = (int)tchild.MyContent.Type - 20000;
 | 
			
		||||
							if (ActiveFormat.PlantFormat.FormatData.StepDataList[typ].TabData.IdentPrint.Contains("{seq}"))
 | 
			
		||||
							{
 | 
			
		||||
								level++;
 | 
			
		||||
								if (ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ImperfectStructurePlus4) level += 1;
 | 
			
		||||
								if (!ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ImperfectStructurePlus4) level -= 1;
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				SeqTabFmtList seqtabs = ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.SeqTabFmtList;
 | 
			
		||||
				tbformat = seqtabs[level % seqtabs.Count].PrintTabFormat;
 | 
			
		||||
				// If token includes 'Wpar', the parent tab prefix's the tab.
 | 
			
		||||
@@ -2045,11 +2075,15 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
			tbformat = tbformat.Replace("{numeric}", trimTabStart ? ordinal.ToString() : ordinal.ToString().PadLeft(2));
 | 
			
		||||
			tbformat = tbformat.Replace("{numericWpar}", ordinal.ToString());
 | 
			
		||||
 | 
			
		||||
			if (tbformat.IndexOf("{!C0}") > -1)
 | 
			
		||||
			if (tbformat.IndexOf("{!C0}") > -1)		// wolf creek uses this to get lines above/below step number
 | 
			
		||||
			{
 | 
			
		||||
				cltext = cltext == null ? tbformat.Replace("{!C0}", "") : cltext.Replace("{!C0}", "");
 | 
			
		||||
				cltext = cltext + " ";
 | 
			
		||||
			}
 | 
			
		||||
			if (FormatStepData.Sep != null && MyPrevious != null)
 | 
			
		||||
			// "{Null}" was introduced so that inheritance in format files could differentiate between an
 | 
			
		||||
			// empty string, and null.  And also, so that if a tab was null but it's parent had text in the
 | 
			
		||||
			// tab, don't inherit the parent's tab, use a null.
 | 
			
		||||
			if ((FormatStepData.Sep != null && FormatStepData.Sep !="{Null}")&& MyPrevious != null)
 | 
			
		||||
			{
 | 
			
		||||
				if (_MyHeader == null) _MyHeader = new MetaTag(FormatStepData.TabData.Font);
 | 
			
		||||
				_MyHeader.Text = FormatStepData.Sep;
 | 
			
		||||
@@ -2090,7 +2124,6 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
			//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("<22>", "{!C0}");
 | 
			
		||||
			//if (vefont != null && vefont.HasCircleString2()) wkstr.Insert(0,"{!C0}");
 | 
			
		||||
 | 
			
		||||
			//wkstr = wkstr.Replace("<22>", @"{Box Step}");
 | 
			
		||||
@@ -2134,9 +2167,18 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
				_MyHeader.Text = tbformat.Trim(); ;
 | 
			
		||||
				_MyHeader.CleanText = StripRtfFormatting(_MyHeader.Text);
 | 
			
		||||
				// if there is only step in the group - no bullet is used, if more that one replace the tab
 | 
			
		||||
				// with a bullet
 | 
			
		||||
				// with a bullet.  Also, if only one in group and tab text ends with 'S', remove it:
 | 
			
		||||
				if (MyPrevious == null && NextItem == null)
 | 
			
		||||
				{
 | 
			
		||||
					if (_MyHeader.CleanText.ToUpper().EndsWith("S"))
 | 
			
		||||
					{
 | 
			
		||||
						string origTxt = _MyHeader.CleanText;
 | 
			
		||||
						_MyHeader.CleanText = _MyHeader.CleanText.Substring(0, _MyHeader.CleanText.Length - 1);
 | 
			
		||||
						// Text may have rtf commands:
 | 
			
		||||
						_MyHeader.Text = _MyHeader.Text.Replace(origTxt, _MyHeader.CleanText);
 | 
			
		||||
					}
 | 
			
		||||
					tbformat = "";
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					if (MyPrevious != null) _MyHeader = null;
 | 
			
		||||
@@ -2301,7 +2343,6 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
		public ContentAlignment Justify = ContentAlignment.MiddleLeft;
 | 
			
		||||
		public string Text;				// may include tokens, such as macros for circles/diamonds, etc
 | 
			
		||||
		public string CleanText;		// all tokens removed
 | 
			
		||||
		//public bool _TagsSetup = false;
 | 
			
		||||
		public MetaTag()
 | 
			
		||||
		{
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
@@ -69,7 +69,7 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
			while (count < 2)
 | 
			
		||||
			{
 | 
			
		||||
				DocStyle myDocStyle = sect.ActiveSection.MyDocStyle;
 | 
			
		||||
				PdfInfo myPdf = Get(sect.MyContent.MyEntry.DocID, MSWordToPDF.DebugStatus, (int)myDocStyle.Layout.TopRow, (int)myDocStyle.Layout.PageLength,
 | 
			
		||||
				PdfInfo myPdf = Get(sect.MyContent.MyEntry.DocID, MSWordToPDF.DebugStatus, (int)myDocStyle.Layout.TopMargin, (int)myDocStyle.Layout.PageLength,
 | 
			
		||||
					(int)myDocStyle.Layout.LeftMargin, (int)myDocStyle.Layout.PageWidth);
 | 
			
		||||
				if (myPdf != null) return myPdf;
 | 
			
		||||
				if (count > 0) return null; // Could not find or create a pdf
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user