This commit is contained in:
		@@ -383,6 +383,7 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
			if (_MyDocument == null) return;
 | 
			
		||||
			Document doc = _MyDocument.Get();
 | 
			
		||||
			FileStream fs = _MyFile.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
 | 
			
		||||
			long savLen = _MyFile.Length;
 | 
			
		||||
			Byte[] buf = new byte[_MyFile.Length];
 | 
			
		||||
			fs.Read(buf, 0, buf.Length);
 | 
			
		||||
			fs.Close();
 | 
			
		||||
@@ -440,6 +441,7 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
			}
 | 
			
		||||
			doc.UpdateDRoUsages(roids);
 | 
			
		||||
			doc.Save();
 | 
			
		||||
			if (savLen != _MyFile.Length) _MyLog.ErrorFormat("DSO FRAMER: File size changed during Save for Word Document, beginSize = {0}, endSize = {1}", savLen, _MyFile.Length);
 | 
			
		||||
		}
 | 
			
		||||
		#endregion
 | 
			
		||||
		#region Constructors
 | 
			
		||||
@@ -673,6 +675,8 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
					pngFile = VlnSettings.TemporaryFolder + @"\XYPlot" + filecount.ToString() + @".png"; //@"C:\Temp\XYPlot1.png";
 | 
			
		||||
					//FileInfo fi = new FileInfo(pngFile);
 | 
			
		||||
					//_MyLog.WarnFormat("PNG Name = {0}, size = {1}", fi.Name, fi.Length);
 | 
			
		||||
					filecount++;
 | 
			
		||||
					RectangleF plotRect = CreatePlot(pngFile, xyplot, 600F, FormForPlotGraphics);
 | 
			
		||||
					
 | 
			
		||||
@@ -749,6 +753,9 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
							//float height = 72 * lines / 6.0F;
 | 
			
		||||
							pngFile = VlnSettings.TemporaryFolder + @"\XYPlot1.png"; //@"C:\Temp\XYPlot1.png";
 | 
			
		||||
							RectangleF plotRect = CreatePlot(pngFile, val, 600F, FormForPlotGraphics);
 | 
			
		||||
							//FileInfo fi = new FileInfo(pngFile);
 | 
			
		||||
							//_MyLog.WarnFormat("PNG Name = {0}, size = {1}", fi.Name, fi.Length);
 | 
			
		||||
 | 
			
		||||
							//LBShape shape = myDoc.Shapes.AddPicture(@"C:\Temp\XYPlot.png", 0, 0, sel.Range);
 | 
			
		||||
							float x = (float)sel.get_Information(LBWdInformation.wdHorizontalPositionRelativeToPage);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1254,6 +1254,7 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
				int iiForFoldout = sc != null ? sc.Step_FloatingFoldout : -1;
 | 
			
		||||
				if (iiForFoldout <= 0) return -1;
 | 
			
		||||
				int fldid = sc.Step_FloatingFoldout;
 | 
			
		||||
				if (fldid == 0) return 0;
 | 
			
		||||
				int indxOfFoldout = 0;
 | 
			
		||||
				foreach (ItemInfo sect in MyProcedure.Sections)
 | 
			
		||||
				{
 | 
			
		||||
 
 | 
			
		||||
@@ -150,15 +150,9 @@ namespace Volian.Controls.Library
 | 
			
		||||
						text = text + (!_MyItemInfo.FormatStepData.Font.FontIsProportional() ? ReplaceLinesWithUnicode(_MyItemInfo.FormatStepData.Suffix) :
 | 
			
		||||
							@"\par\par\par ");
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					if (_MyItemInfo.FormatStepData.Prefix != null && _MyItemInfo.FormatStepData.Prefix != "")
 | 
			
		||||
						text = _MyItemInfo.FormatStepData.Prefix + text;
 | 
			
		||||
					if (_MyItemInfo.FormatStepData.Suffix != null && _MyItemInfo.FormatStepData.Suffix != "")
 | 
			
		||||
						text = text + _MyItemInfo.FormatStepData.Suffix;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			text = CreateRtf(colorLinks, text, tableShouldBeOutlined, wordsShouldBeReplaced, numbersShouldBeFormated, tableHasBorder, ROsShouldBeAdjusted);
 | 
			
		||||
			
 | 
			
		||||
			StartText = text;
 | 
			
		||||
		}
 | 
			
		||||
		private string ReplaceLinesWithUnicode(string text)
 | 
			
		||||
 
 | 
			
		||||
@@ -2172,13 +2172,31 @@ namespace Volian.Controls.Library
 | 
			
		||||
 | 
			
		||||
		public string GetPasteText(bool PasteNoReturnsSetting, IDataObject myDO)
 | 
			
		||||
		{
 | 
			
		||||
			// allowable symbols are those symbols between 127-256 that the proms editor supports that
 | 
			
		||||
			// can be pasted from word as is.  These symbols are (in the order they are in the following 
 | 
			
		||||
			// string): degree, plus/minus, exponent 2, exponent 3, micro, quarter, half, divide:
 | 
			
		||||
			char[] allowableSymbols = { '\xb0', '\xb1', '\xb2', '\xb3', '\xb5', '\xbc', '\xbd', '\xf7' };
 | 
			
		||||
			string ptext = myDO.GetData(DataFormats.Text).ToString();
 | 
			
		||||
			ptext = ptext.TrimEnd("\r\n\t ".ToCharArray());
 | 
			
		||||
			if (PasteNoReturnsSetting) ptext = ptext.Replace("\r\n", " ");
 | 
			
		||||
			StringBuilder sb = new StringBuilder(ptext);
 | 
			
		||||
			bool didCharReplace = false;
 | 
			
		||||
			for (int i = 0; i < ptext.Length; i++)
 | 
			
		||||
			{
 | 
			
		||||
				// if allowable, allow for it to pasted.  Otherwise, replace that character with a '?'.
 | 
			
		||||
				if ((sb[i] > 0x7e))
 | 
			
		||||
				if ((ptext.Substring(i, 1).IndexOfAny(allowableSymbols) < 0))
 | 
			
		||||
				{
 | 
			
		||||
					sb[i] = '?';
 | 
			
		||||
					didCharReplace = true;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			ptext = sb.ToString();
 | 
			
		||||
			ptext = ptext.Replace("\u2013", "-"); // Replace EN Dash with hyphen
 | 
			
		||||
			ptext = ptext.Replace("\u2014", "-"); // Replace EM Dash with hyphen
 | 
			
		||||
			ptext = ptext.Replace("\u2011", "-"); // Replace non-breaking hyphen with hyphen
 | 
			
		||||
			ptext = ptext.Replace((char)0xb7, '?');  // bullet comes in as a b7, which we don't support either
 | 
			
		||||
			if (didCharReplace)
 | 
			
		||||
				MessageBox.Show("Replacing pasted characters that are not supported by Proms with a '?'.");
 | 
			
		||||
			return ptext;
 | 
			
		||||
		}
 | 
			
		||||
		private void DoDeleteEndBetweenLinks()
 | 
			
		||||
 
 | 
			
		||||
@@ -1307,7 +1307,7 @@ namespace Volian.Controls.Library
 | 
			
		||||
			// pasted in.  But the hope is that this will happen less often than getting it from MS Word.
 | 
			
		||||
			if (myDO.GetDataPresent(DataFormats.Rtf) && (_PasteStepTextOvrRide || (!_PastePlainTextOvrRide && !PastePlainTextSetting)))
 | 
			
		||||
			{
 | 
			
		||||
				string tmpForLink = myDO.GetData(DataFormats.Rtf).ToString();
 | 
			
		||||
				string tmpForLink = myDO.GetData(DataFormats.Rtf).ToString().Replace("\r\n", "");
 | 
			
		||||
				if (tmpForLink.ToUpper().Contains(@"SCHEMAS.MICROSOFT.COM/OFFICE/WORD"))
 | 
			
		||||
					myRtb.SelectedText = _MyStepRTB.GetPasteText(PasteNoReturnsSetting, myDO);
 | 
			
		||||
				else
 | 
			
		||||
 
 | 
			
		||||
@@ -30,6 +30,14 @@ namespace Volian.Print.Library
 | 
			
		||||
		// no 'Box' was defined in format file.
 | 
			
		||||
		public string DefBox = null;
 | 
			
		||||
		public float DefEnd = 0;
 | 
			
		||||
 | 
			
		||||
		private bool _ContainsPageBreak = false;
 | 
			
		||||
		public bool ContainsPageBreak
 | 
			
		||||
		{
 | 
			
		||||
			get { return _ContainsPageBreak; }
 | 
			
		||||
			set { _ContainsPageBreak = value; }
 | 
			
		||||
		}
 | 
			
		||||
		//private bool _DoBottom = true;
 | 
			
		||||
		public vlnBox()
 | 
			
		||||
		{
 | 
			
		||||
		}
 | 
			
		||||
@@ -43,8 +51,7 @@ namespace Volian.Print.Library
 | 
			
		||||
		const string BoxFPLCaution = "\x2588.\x2580.\x2588.\x2588. . .\x2588.\x2588. .\x2584. . ";
 | 
			
		||||
		const string BoxAsterisk = " *.* .* . . . . *.* . .* . . ";
 | 
			
		||||
		const string BoxAsteriskWithSides1 = " *.* .* .* . . . *.* . .* . . ";	// ip2
 | 
			
		||||
		const string BoxAsteriskWithSides2 = "*. *.*.*. . .*.*. . *. . ";		// ip3 (sub 15)
 | 
			
		||||
 | 
			
		||||
		const string BoxAsteriskWithSides2 = " *. *.*.*. . . *.*. . *. . ";		// ip3
 | 
			
		||||
		public override float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin)
 | 
			
		||||
		{
 | 
			
		||||
			if (MyBox == null) return yPageStart;
 | 
			
		||||
@@ -137,35 +144,46 @@ namespace Volian.Print.Library
 | 
			
		||||
			// Bug fix B2013-091
 | 
			
		||||
			// added YMultiplier to handle compress pages
 | 
			
		||||
			// bottom row of asterisks was in non-compressed line location
 | 
			
		||||
			bottom = top - (Height * MyPageHelper.YMultiplier);//Height;
 | 
			
		||||
			bottom = top - (Height * MyPageHelper.YMultiplier);
 | 
			
		||||
 | 
			
		||||
			// create a new font without any styles such as underline.
 | 
			
		||||
			VE_Font vf = new VE_Font(MyParent.MyItemInfo.FormatStepData.Font.Family, (int)MyParent.MyItemInfo.FormatStepData.Font.Size, E_Style.None, (float)MyParent.MyItemInfo.FormatStepData.Font.CPI);
 | 
			
		||||
 | 
			
		||||
			// Top line first:
 | 
			
		||||
			// To find the length of the line, account for the length of the upper right corner also (BXURC)
 | 
			
		||||
			int urcLen = MyBox.BXHorz[MyBox.BXHorz.Length - 1] == ' ' && MyBox.BXURC[0] == ' ' ? 1 : MyBox.BXURC.Length;
 | 
			
		||||
			float endHorz = (float)MyBox.End - (float)MyBox.Start - (float)(urcLen * (72 / vf.CPI));
 | 
			
		||||
 | 
			
		||||
			// Do the top line first:
 | 
			
		||||
			StringBuilder sb = new StringBuilder();
 | 
			
		||||
			sb.Append(MyBox.BXULC);
 | 
			
		||||
			float size = (float)(MyBox.BXULC.Length * (72 / vf.CPI));
 | 
			
		||||
			while (size < (MyBox.End - MyBox.Start))
 | 
			
		||||
			string bxstr = null;
 | 
			
		||||
			if (!ContainsPageBreak)		// Only do top line if there is no page break.
 | 
			
		||||
			{
 | 
			
		||||
				sb.Append(MyBox.BXHorz);
 | 
			
		||||
				size = size + (float)(MyBox.BXHorz.Length * (72 / vf.CPI));
 | 
			
		||||
				while (size < endHorz)
 | 
			
		||||
				{
 | 
			
		||||
					sb.Append(MyBox.BXHorz);
 | 
			
		||||
					size = size + (float)(MyBox.BXHorz.Length * (72 / vf.CPI));
 | 
			
		||||
				}
 | 
			
		||||
				// Tack on the right upper corner. For some formats, the upper right corner in the
 | 
			
		||||
				// had the first character as a space, this would put two spaces in a row at the
 | 
			
		||||
				// end of the string, so remove the space before tacking on the upper right corner:
 | 
			
		||||
				bxstr = sb.ToString();
 | 
			
		||||
				if (bxstr[bxstr.Length - 1] == ' ' && MyBox.BXURC[0] == ' ') bxstr = bxstr.TrimEnd();
 | 
			
		||||
				bxstr = bxstr + MyBox.BXURC;
 | 
			
		||||
				size = size + (float)((MyBox.BXURC.Length) * (72 / vf.CPI));
 | 
			
		||||
				Rtf = GetRtf(bxstr, vf);
 | 
			
		||||
				IParagraph = null;	// set to null so that next access of IParagraph sets the Rtf.
 | 
			
		||||
				Rtf2Pdf.TextAt(cb, IParagraph, left, top, size + 10, 100, "", yBottomMargin);
 | 
			
		||||
			}
 | 
			
		||||
			// Tack on the right upper corner. For some reason, the upper right corner in the
 | 
			
		||||
			// formats had the first character as a space, this would put two spaces in a row
 | 
			
		||||
			// at the end of the string, so remove the space before tacking on the upper right
 | 
			
		||||
			// corner:
 | 
			
		||||
			string bxstr = sb.ToString().TrimEnd() + MyBox.BXURC;
 | 
			
		||||
			size = size + (float)((MyBox.BXURC.Length) * (72 / vf.CPI));
 | 
			
		||||
			Rtf = GetRtf(bxstr, vf);
 | 
			
		||||
			IParagraph = null;	// set to null so that next access of IParagraph sets the Rtf.
 | 
			
		||||
			Rtf2Pdf.TextAt(cb, IParagraph, left, top, size, 100, "", yBottomMargin);
 | 
			
		||||
 | 
			
		||||
			// Bottom line now 
 | 
			
		||||
			// Handle the bottom line now:
 | 
			
		||||
			if (bottom < yBottomMargin) return;    // Box goes off page, i.e. page break, don't do bottom
 | 
			
		||||
			
 | 
			
		||||
			sb.Remove(0, sb.Length);
 | 
			
		||||
			sb.Append(MyBox.BXLLC);
 | 
			
		||||
			size = (float)(MyBox.BXLLC.Length * (72 / vf.CPI));
 | 
			
		||||
			while (size < (MyBox.End-MyBox.Start))
 | 
			
		||||
			while (size < endHorz)
 | 
			
		||||
			{
 | 
			
		||||
				sb.Append(MyBox.BXHorz);
 | 
			
		||||
				size = size + (float)(MyBox.BXHorz.Length * (72 / vf.CPI));
 | 
			
		||||
@@ -174,14 +192,31 @@ namespace Volian.Print.Library
 | 
			
		||||
			size = size + (float)((MyBox.BXLRC.Length) * (72 / vf.CPI));
 | 
			
		||||
			Rtf = GetRtf(bxstr, vf);
 | 
			
		||||
			IParagraph = null;	// set to null so that next access of IParagraph sets the Rtf.
 | 
			
		||||
			Rtf2Pdf.TextAt(cb, IParagraph, left, bottom, size, 100, "", yBottomMargin);
 | 
			
		||||
			Rtf2Pdf.TextAt(cb, IParagraph, left, bottom, size + 10, 100, "", yBottomMargin);
 | 
			
		||||
		}
 | 
			
		||||
		private void DrawAsteriskSide(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin, float top, float bottom, float left, float right)
 | 
			
		||||
		{
 | 
			
		||||
			top = CalculateYOffset(yPageStart, yTopMargin);
 | 
			
		||||
			bottom = top - (Height * MyPageHelper.YMultiplier);
 | 
			
		||||
			// set the top & bottom of sides.  If there is a page break in the middle of box, adjust these.
 | 
			
		||||
			// The vlnBox property, ContainsPageBreak, flags that a break occurred.
 | 
			
		||||
			if (!ContainsPageBreak)		// if no page break, just use top as is.
 | 
			
		||||
			{
 | 
			
		||||
				top = CalculateYOffset(yPageStart, yTopMargin);
 | 
			
		||||
				bottom = top - (Height * MyPageHelper.YMultiplier);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				// to calculate the bottom, don't adjust the top yet.
 | 
			
		||||
				top = CalculateYOffset(yPageStart, yTopMargin);
 | 
			
		||||
				bottom = top - (Height * MyPageHelper.YMultiplier);
 | 
			
		||||
				top = yTopMargin;			// reset top to top margin since there was a page break.
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// Check that the bottom is within the bottom margin, if this step spans more than one page,
 | 
			
		||||
			// stop the side asterisks at the bottom margin. (pagination puts inserts a page break here)
 | 
			
		||||
			if (bottom < yBottomMargin) bottom = yBottomMargin;
 | 
			
		||||
 | 
			
		||||
			float height = (SixLinesPerInch * MyPageHelper.YMultiplier) + 4; // just add a little on so that height is a little bigger than character
 | 
			
		||||
			VE_Font vf = MyParent.MyItemInfo.FormatStepData.Font;
 | 
			
		||||
			VE_Font vf = new VE_Font(MyParent.MyItemInfo.FormatStepData.Font.Family, (int)MyParent.MyItemInfo.FormatStepData.Font.Size, E_Style.None, (float)MyParent.MyItemInfo.FormatStepData.Font.CPI);
 | 
			
		||||
 | 
			
		||||
			// Left side first:
 | 
			
		||||
			Rtf = GetRtf(MyBox.BXVert, vf);
 | 
			
		||||
 
 | 
			
		||||
@@ -50,7 +50,6 @@ namespace Volian.Print.Library
 | 
			
		||||
					yoff = Add(cb, childItemInfo.Notes, xoff, yoff, yoffRight, rnoLevel, maxRNO, formatInfo);
 | 
			
		||||
				int? bxIndx = childItemInfo.FormatStepData==null?-1:childItemInfo.FormatStepData.StepLayoutData.STBoxindex;
 | 
			
		||||
				bool boxHLS = false;
 | 
			
		||||
 | 
			
		||||
				if ((bxIndx != -1 && (bxIndex != bxIndx || childItemInfo.FormatStepData.BoxIt)))
 | 
			
		||||
				{
 | 
			
		||||
					if (childItemInfo.FormatStepData.BoxIt)   // this is a boxed HLS
 | 
			
		||||
@@ -74,7 +73,7 @@ namespace Volian.Print.Library
 | 
			
		||||
							box.YOffset = yoff;
 | 
			
		||||
							int ln = 1;	// a format flag determines whether there is a space before the note/caution.  
 | 
			
		||||
							if (childItemInfo.FormatStepData.OneLineBeforeTab) ln++;
 | 
			
		||||
							//if (boxHLS && !childItemInfo.HasCautionOrNote) 
 | 
			
		||||
							if (!boxHLS || (boxHLS && !childItemInfo.HasCautionOrNote))
 | 
			
		||||
								yoff += ln * vlnPrintObject.SixLinesPerInch;
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
@@ -116,8 +115,8 @@ namespace Volian.Print.Library
 | 
			
		||||
				}
 | 
			
		||||
				if (boxHLS)
 | 
			
		||||
				{
 | 
			
		||||
					box.YOffset = para.YTop;
 | 
			
		||||
					box.Height = para.YBottomMost - para.YTop - (1.1F * vlnPrintObject.SixLinesPerInch);
 | 
			
		||||
					box.YOffset = para.YTop - (2 * vlnPrintObject.SixLinesPerInch);
 | 
			
		||||
					box.Height = para.YBottomMost - box.YOffset; //  para.YTop - (1.1F * vlnPrintObject.SixLinesPerInch);
 | 
			
		||||
					box = null;
 | 
			
		||||
				}
 | 
			
		||||
				boxHLS = false;
 | 
			
		||||
@@ -697,6 +696,21 @@ namespace Volian.Print.Library
 | 
			
		||||
					DebugText.WriteLine("Paginate2");
 | 
			
		||||
					if (MyItemInfo.FoldoutIndex()>-1)
 | 
			
		||||
						PromsPrinter.DoFoldoutPage(cb, "Break within Step", MyPageHelper.TextLayer, MyPageHelper, MyItemInfo.FoldoutIndex());	// temporary foldout
 | 
			
		||||
					
 | 
			
		||||
					// if there is a 'container vlnbox' around the HLS, flag that the drawn box must also break:
 | 
			
		||||
					if (MyHighLevelParagraph != null && MyHighLevelParagraph.PartsContainer != null && MyHighLevelParagraph.PartsContainer.Count > 0)
 | 
			
		||||
					{
 | 
			
		||||
						foreach (vlnPrintObject vpo in MyHighLevelParagraph.PartsContainer)
 | 
			
		||||
						{
 | 
			
		||||
							vlnBox vb = vpo as vlnBox;
 | 
			
		||||
							if (vb != null)
 | 
			
		||||
							{
 | 
			
		||||
								vb.ContainsPageBreak = true;
 | 
			
		||||
								PartsContainer.Add(vb);
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
					// If there is a box, adjust the yTopMost to include it.
 | 
			
		||||
					float yTopMost = YTopMost;
 | 
			
		||||
					//if (YVeryTop < yTopMost) Console.WriteLine("{0},{1},{2}", MyItemInfo.DBSequence, yTopMost, YVeryTop);
 | 
			
		||||
@@ -1087,10 +1101,20 @@ namespace Volian.Print.Library
 | 
			
		||||
				yoff = ChildrenAbove.Add(cb, itemInfo.Cautions, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo);
 | 
			
		||||
			}
 | 
			
		||||
			if (itemInfo.Notes != null && !(itemInfo.IsCaution || itemInfo.IsNote))
 | 
			
		||||
			{
 | 
			
		||||
				if (itemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format)
 | 
			
		||||
					yoffLeft = Math.Max(yoffLeft, ChildrenLeft.Add(cb, itemInfo.Notes, xoff + 6 + (float)(itemInfo.ActiveFormat.MyStepSectionLayoutData.WidT), yoff, yoff, rnoLevel, maxRNO, formatInfo));
 | 
			
		||||
				else
 | 
			
		||||
				yoff = ChildrenAbove.Add(cb, itemInfo.Notes, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo);
 | 
			
		||||
					yoff = ChildrenAbove.Add(cb, itemInfo.Notes, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// if this is a hls with a box, adjust the starting y location for the hls.  this is done here
 | 
			
		||||
			// in case this hls had a boxed caution and/or note before it.  Also, this code is here rather
 | 
			
		||||
			// than in the vlnparagraphs.add code because the yoff in that code will position the box, but
 | 
			
		||||
			// this code positions the hls (in y direction), without this, the hls starts on the box line.
 | 
			
		||||
			int bxIndx = itemInfo.IsSection ? 0 : itemInfo.FormatStepData.StepLayoutData.STBoxindex ?? 0;
 | 
			
		||||
			if (itemInfo.IsHigh && bxIndx > 0) yoff += (2 * SixLinesPerInch);
 | 
			
		||||
 | 
			
		||||
			// If the format has that extra space should be put out before the step, then
 | 
			
		||||
			// handle this by using the 'PartsAbove' structure.  By using the parts above, the extra
 | 
			
		||||
			// space above will be done regardless of where page breaks fall.
 | 
			
		||||
@@ -1214,7 +1238,7 @@ namespace Volian.Print.Library
 | 
			
		||||
			{
 | 
			
		||||
				Rtf = GetRtf(itemInfo, prefix, suffix);
 | 
			
		||||
				// Need the following with some modifications for WCNCKL format:
 | 
			
		||||
				while (Rtf.Contains("{Backspace}"))
 | 
			
		||||
				if (Rtf.Contains("{Backspace}"))
 | 
			
		||||
				{
 | 
			
		||||
					XOffset -= 25;
 | 
			
		||||
					Width += 24;
 | 
			
		||||
@@ -1258,6 +1282,20 @@ namespace Volian.Print.Library
 | 
			
		||||
						PartsAbove.Add(new vlnMacro(xoff, yoff, macro));
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				// if this step has a prefix but it's not checklist...  do a partsleft for prefix
 | 
			
		||||
				if (_MyItemInfo.IsStep && !_MyItemInfo.FormatStepData.UseSmartTemplate)
 | 
			
		||||
				{
 | 
			
		||||
					if (_MyItemInfo.FormatStepData.Prefix != null && _MyItemInfo.FormatStepData.Prefix != "")
 | 
			
		||||
					{
 | 
			
		||||
						string pref = _MyItemInfo.FormatStepData.Prefix.Replace("{Backspace}", "");
 | 
			
		||||
						float xPref = XOffset - (pref.Length * (72 / (float)_MyItemInfo.FormatStepData.Font.CPI));
 | 
			
		||||
						E_Style es = (E_Style)_MyItemInfo.FormatStepData.Font.Style & E_Style.Bold;
 | 
			
		||||
						VE_Font tmpFont = new VE_Font(_MyItemInfo.FormatStepData.Font.Family, (int)_MyItemInfo.FormatStepData.Font.Size, es, (float)_MyItemInfo.FormatStepData.Font.CPI);
 | 
			
		||||
						PartsLeft.Add(new vlnText(cb, this, pref, pref, xPref, yoff, tmpFont));
 | 
			
		||||
					}
 | 
			
		||||
					
 | 
			
		||||
				}
 | 
			
		||||
				// If checklists, the substeps are printed in a row, need to keep track of the 'longest' in
 | 
			
		||||
				// y direction (bottommost) across the row.
 | 
			
		||||
				if (itemInfo.IsStep && itemInfo.MyHLS.FormatStepData.UseSmartTemplate && (TheStepLevel(itemInfo) >= 0))
 | 
			
		||||
@@ -1777,6 +1815,8 @@ namespace Volian.Print.Library
 | 
			
		||||
			if (itemInfo.IsHigh && itemInfo.MyDocStyle.UndSpecialStepsFoldout) myFont = new System.Drawing.Font(myFont.FontFamily, myFont.Size, myFont.Style | FontStyle.Underline);
 | 
			
		||||
			_RtfSB.Append(AddFontTable(myFont));
 | 
			
		||||
			_RtfSB.Append(vlntxt.StartText);
 | 
			
		||||
			if (_MyItemInfo.IsStep && !itemInfo.FormatStepData.UseSmartTemplate && _MyItemInfo.FormatStepData.Suffix != null && _MyItemInfo.FormatStepData.Suffix != "")
 | 
			
		||||
				_RtfSB.Append(_MyItemInfo.FormatStepData.Suffix.Replace("{ulnone}",@"\ulnone "));
 | 
			
		||||
			_RtfSB.Append("}");
 | 
			
		||||
			return _RtfSB.ToString();
 | 
			
		||||
		}
 | 
			
		||||
@@ -2008,7 +2048,7 @@ namespace Volian.Print.Library
 | 
			
		||||
						iilvl = iilvl.MyParent;
 | 
			
		||||
					}
 | 
			
		||||
					level = level <= 2 ? 1 : level - 1;
 | 
			
		||||
					if (level==1)
 | 
			
		||||
					if (level == 1)
 | 
			
		||||
						XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (level * (float)formatInfo.PlantFormat.FormatData.SectData.SectionHeader.Pos);
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
@@ -2022,37 +2062,12 @@ namespace Volian.Print.Library
 | 
			
		||||
			int typ = ((int)itemInfo.MyContent.Type) % 10000;
 | 
			
		||||
			int? bxIndx = formatInfo.PlantFormat.FormatData.StepDataList[typ].StepLayoutData.STBoxindex;
 | 
			
		||||
			float? colOvrd = formatInfo.PlantFormat.FormatData.StepDataList[typ].ColOverride;
 | 
			
		||||
			if (bxIndx != null)
 | 
			
		||||
			{
 | 
			
		||||
				Box bx = formatInfo.PlantFormat.FormatData.BoxList[(int)bxIndx];
 | 
			
		||||
				if (bx == null)
 | 
			
		||||
				{
 | 
			
		||||
					if ((colOvrd??0)!=0)
 | 
			
		||||
					{
 | 
			
		||||
						// 16-bit code subtracted the left margin
 | 
			
		||||
						//xoff = ((float)colOvrd - (float)itemInfo.MyDocStyle.Layout.LeftMargin) - XOffset;
 | 
			
		||||
						//XOffset += xoff;
 | 
			
		||||
						//if (myTab != null) myTab.XOffset += xoff;
 | 
			
		||||
						//xoff = MyParent.XOffset - myTab.XOffset;
 | 
			
		||||
						//XOffset += xoff;
 | 
			
		||||
						float tabOffset = (myTab == null?0: myTab.XOffset) - XOffset;
 | 
			
		||||
 | 
			
		||||
						XOffset = (float)colOvrd;
 | 
			
		||||
						if (myTab != null) myTab.XOffset = XOffset + tabOffset;
 | 
			
		||||
						return;
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
						XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + tabWidth + XOffsetBox;
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
					XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)bx.TxtStart + tabWidth + XOffsetBox;
 | 
			
		||||
				if (myTab != null) myTab.XOffset = XOffset - tabWidth;
 | 
			
		||||
			}
 | 
			
		||||
			else if (itemInfo.IsHigh)
 | 
			
		||||
			if (itemInfo.IsHigh)
 | 
			
		||||
			{
 | 
			
		||||
				float x = 0;
 | 
			
		||||
				float xoff = 0;
 | 
			
		||||
				if ((colOvrd??0)!=0)
 | 
			
		||||
				if ((colOvrd ?? 0) != 0)
 | 
			
		||||
					x = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)colOvrd;
 | 
			
		||||
				else
 | 
			
		||||
					x = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS;
 | 
			
		||||
@@ -2068,7 +2083,7 @@ namespace Volian.Print.Library
 | 
			
		||||
					float colsbylevel = (float)formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[indxLevel % formatInfo.PlantFormat.FormatData.SectData.MetaSectionList.Count].ColSByLevel;
 | 
			
		||||
					float seclvlindent = colsbylevel - (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS;
 | 
			
		||||
					float adjCols = (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS + seclvlindent;
 | 
			
		||||
					float xtabcol = adjCols - ((myTab==null||myTab.Text==null)?0:(myTab.Text.Length * 7.2f));
 | 
			
		||||
					float xtabcol = adjCols - ((myTab == null || myTab.Text == null) ? 0 : (myTab.Text.Length * 7.2f));
 | 
			
		||||
					if (indxLevel > 1 && myTab != null) myTab.XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + xtabcol;
 | 
			
		||||
					else if (myTab != null) myTab.XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + colsbylevel;
 | 
			
		||||
					if (myTab != null)
 | 
			
		||||
@@ -2099,6 +2114,32 @@ namespace Volian.Print.Library
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			else if (bxIndx != null)
 | 
			
		||||
			{
 | 
			
		||||
				Box bx = formatInfo.PlantFormat.FormatData.BoxList[(int)bxIndx];
 | 
			
		||||
				if (bx == null)
 | 
			
		||||
				{
 | 
			
		||||
					if ((colOvrd ?? 0) != 0)
 | 
			
		||||
					{
 | 
			
		||||
						// 16-bit code subtracted the left margin
 | 
			
		||||
						//xoff = ((float)colOvrd - (float)itemInfo.MyDocStyle.Layout.LeftMargin) - XOffset;
 | 
			
		||||
						//XOffset += xoff;
 | 
			
		||||
						//if (myTab != null) myTab.XOffset += xoff;
 | 
			
		||||
						//xoff = MyParent.XOffset - myTab.XOffset;
 | 
			
		||||
						//XOffset += xoff;
 | 
			
		||||
						float tabOffset = (myTab == null ? 0 : myTab.XOffset) - XOffset;
 | 
			
		||||
 | 
			
		||||
						XOffset = (float)colOvrd;
 | 
			
		||||
						if (myTab != null) myTab.XOffset = XOffset + tabOffset;
 | 
			
		||||
						return;
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
						XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + tabWidth + XOffsetBox;
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
					XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)bx.TxtStart + tabWidth + XOffsetBox;
 | 
			
		||||
				if (myTab != null) myTab.XOffset = XOffset - tabWidth;
 | 
			
		||||
			}
 | 
			
		||||
			//else if (itemInfo.IsRNOPart && !((ItemInfo)itemInfo.ActiveParent).IsHigh)
 | 
			
		||||
			//{
 | 
			
		||||
			//    // don't adjust for rno
 | 
			
		||||
@@ -2116,7 +2157,7 @@ namespace Volian.Print.Library
 | 
			
		||||
				}
 | 
			
		||||
				// if the step is within the rno and we're numbering the high level rno, we've got to account for the
 | 
			
		||||
				// indenting (increased x offset) for the top level rno's tab, if there is no top level rno:
 | 
			
		||||
				if (itemInfo.FormatStepData.NumberHighLevel && (itemInfo.MyHLS.RNOs == null || itemInfo.MyHLS.RNOs.Count<=0))
 | 
			
		||||
				if (itemInfo.FormatStepData.NumberHighLevel && (itemInfo.MyHLS.RNOs == null || itemInfo.MyHLS.RNOs.Count <= 0))
 | 
			
		||||
				{
 | 
			
		||||
					// add in the size that an RNO off HLS would take.
 | 
			
		||||
					XOffset += tabWidth;
 | 
			
		||||
@@ -2133,7 +2174,7 @@ namespace Volian.Print.Library
 | 
			
		||||
					// the tab. The offset of text needs to be adjusted by the 'leftjustify' format variable 
 | 
			
		||||
					// if it existed for this level.
 | 
			
		||||
					myTab.XOffset += tabWidth;
 | 
			
		||||
					if (tableftadj != 0 && myTab.Width<tableftadj) 
 | 
			
		||||
					if (tableftadj != 0 && myTab.Width < tableftadj)
 | 
			
		||||
						tabWidth = myTab.Width = tableftadj;
 | 
			
		||||
					XOffset += tabWidth;
 | 
			
		||||
					myTab.Rtf = myTab.Rtf.Replace(myTab.Text, myTab.Text.TrimStart(" ".ToCharArray()));
 | 
			
		||||
@@ -2190,22 +2231,8 @@ namespace Volian.Print.Library
 | 
			
		||||
				if (bxIndx == null) return;
 | 
			
		||||
			}
 | 
			
		||||
			float tabWidth = (myTab == null) ? 0 : myTab.Width;
 | 
			
		||||
			if (bxIndx != null)
 | 
			
		||||
			{
 | 
			
		||||
				Box bx = formatInfo.PlantFormat.FormatData.BoxList[(int)bxIndx];
 | 
			
		||||
				if (bx == null)
 | 
			
		||||
				{
 | 
			
		||||
					// NOT SURE IF WE NEED TO TEST FOR THE NULLBOX FORMAT FLAG, MAYBE "bx == null" IS THE SAME THING
 | 
			
		||||
					//if (formatInfo.MyStepSectionLayoutData.NullBox)
 | 
			
		||||
					if (widOvrd != 0)
 | 
			
		||||
						Width = (float)widOvrd - tabWidth;
 | 
			
		||||
					else
 | 
			
		||||
						Width = (float)formatInfo.MyStepSectionLayoutData.WidT - tabWidth;
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
					Width = _WidthAdjustBox + (float)bx.TxtWidth - tabWidth; // add 1 to get it to wrap like 16Bit
 | 
			
		||||
			}
 | 
			
		||||
			else if (itemInfo.IsHigh)
 | 
			
		||||
			
 | 
			
		||||
			if (itemInfo.IsHigh)
 | 
			
		||||
			{
 | 
			
		||||
				float CheckOffAdj = 0;
 | 
			
		||||
				if (itemInfo.MyDocStyle.UseCheckOffs)
 | 
			
		||||
@@ -2249,6 +2276,21 @@ namespace Volian.Print.Library
 | 
			
		||||
				if (itemInfo.MyDocStyle.AlignHLSTabWithSect)
 | 
			
		||||
					Width = Width - (float)formatInfo.PlantFormat.FormatData.SectData.SectionHeader.Pos;
 | 
			
		||||
			}
 | 
			
		||||
			else if (bxIndx != null)
 | 
			
		||||
			{
 | 
			
		||||
				Box bx = formatInfo.PlantFormat.FormatData.BoxList[(int)bxIndx];
 | 
			
		||||
				if (bx == null)
 | 
			
		||||
				{
 | 
			
		||||
					// NOT SURE IF WE NEED TO TEST FOR THE NULLBOX FORMAT FLAG, MAYBE "bx == null" IS THE SAME THING
 | 
			
		||||
					//if (formatInfo.MyStepSectionLayoutData.NullBox)
 | 
			
		||||
					if (widOvrd != 0)
 | 
			
		||||
						Width = (float)widOvrd - tabWidth;
 | 
			
		||||
					else
 | 
			
		||||
						Width = (float)formatInfo.MyStepSectionLayoutData.WidT - tabWidth;
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
					Width = _WidthAdjustBox + (float)bx.TxtWidth - tabWidth; // add 1 to get it to wrap like 16Bit
 | 
			
		||||
			}
 | 
			
		||||
			else if (itemInfo.IsCaution || itemInfo.IsNote)
 | 
			
		||||
			{
 | 
			
		||||
				float mycolT = (float)formatInfo.MyStepSectionLayoutData.ColT;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user