From 9bc84679d3048596a55b4fc0bab2c38b03bb74ec Mon Sep 17 00:00:00 2001 From: Kathy Date: Wed, 25 Sep 2013 16:09:15 +0000 Subject: [PATCH] ReadOnly Step Property for Backgrounds Support ReadOnly step property for rtb size Support ReadOnly for rtb Pagination for Background documents, i.e. HLS/Caution/Note have pagebreaks Pagination for Backgrounds; Pagelist items for Backgrounds; tabs & offset for backgrounds & minor general Callaway PageList items for Background documents (HLRNO & HLSTAB) and CURDATE & CURTIME (for fnpnmp) --- .../Format/PlantFormat.cs | 16 +++ PROMS/Volian.Controls.Library/EditItem.cs | 25 ++++- PROMS/Volian.Controls.Library/StepRTB.cs | 3 +- PROMS/Volian.Print.Library/Pagination.cs | 46 +++++++- .../Volian.Print.Library/VlnSvgPageHelper.cs | 26 +++++ PROMS/Volian.Print.Library/vlnParagraph.cs | 106 ++++++++++++++++-- 6 files changed, 206 insertions(+), 16 deletions(-) diff --git a/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs b/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs index b7d0464e..af10762c 100644 --- a/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs +++ b/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs @@ -3553,6 +3553,14 @@ namespace VEPROMS.CSLA.Library return LazyLoad(ref _ParentType, "@ParentType"); } } + private LazyLoad _ReadOnly; + public bool ReadOnly + { + get + { + return LazyLoad(ref _ReadOnly, "@ReadOnly"); + } + } private LazyLoad _Inactive; public bool Inactive { @@ -4588,6 +4596,14 @@ namespace VEPROMS.CSLA.Library return LazyLoad(ref _RNOIdentEdit, "TabData/@RNOIdentEdit"); } } + private LazyLoad _RNOIdent; + public string RNOIdent + { + get + { + return LazyLoad(ref _RNOIdent, "TabData/@RNOIdent"); + } + } private LazyLoad _RNOIdentPrint; public string RNOIdentPrint { diff --git a/PROMS/Volian.Controls.Library/EditItem.cs b/PROMS/Volian.Controls.Library/EditItem.cs index ea85001a..bb58a19a 100644 --- a/PROMS/Volian.Controls.Library/EditItem.cs +++ b/PROMS/Volian.Controls.Library/EditItem.cs @@ -2084,7 +2084,18 @@ namespace Volian.Controls.Library ItemLocation = new Point(_MyParentEditItem.ItemLocation.X, _MyParentEditItem.Bottom); else ItemLocation = new Point(_MyParentEditItem.ContentLeft, _MyParentEditItem.Bottom); - ItemWidth = _MyParentEditItem.ContentWidth; + if (MyItemInfo.FormatStepData.ReadOnly) + { + Graphics g = CreateGraphics(); + SizeF sz = g.MeasureString(MyItemInfo.MyContent.Text, MyItemInfo.FormatStepData.Font.WindowsFont); + ItemWidth = (int)sz.Width; + } + else if (MyParentEditItem != null && MyParentEditItem.MyItemInfo.FormatStepData.ReadOnly) + { + ItemWidth = MyStepPanel.ToDisplay(MyStepSectionLayoutData.ColT) + MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidSTableEdit, 0); + } + else + ItemWidth = _MyParentEditItem.ContentWidth; } break; } @@ -2196,7 +2207,17 @@ namespace Volian.Controls.Library } else { - Width = MyPreviousEditItem.Width; + if (MyItemInfo.FormatStepData != null && MyItemInfo.FormatStepData.ReadOnly) + { + Graphics g = CreateGraphics(); + SizeF sz = g.MeasureString(MyItemInfo.MyContent.Text, MyItemInfo.FormatStepData.Font.WindowsFont); + ItemWidth = (int)sz.Width; + } + else if (MyPreviousEditItem != null && MyPreviousEditItem.MyItemInfo.FormatStepData != null && MyPreviousEditItem.MyItemInfo.FormatStepData.ReadOnly) + ItemWidth = MyStepPanel.ToDisplay(MyStepSectionLayoutData.ColT) + MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidSTableEdit, 0); + else + Width = MyPreviousEditItem.Width; + if (TopMostEditItem == this) { if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format && (MyItemInfo.IsNote || MyItemInfo.IsCaution)) diff --git a/PROMS/Volian.Controls.Library/StepRTB.cs b/PROMS/Volian.Controls.Library/StepRTB.cs index e4e9c67e..06df800b 100644 --- a/PROMS/Volian.Controls.Library/StepRTB.cs +++ b/PROMS/Volian.Controls.Library/StepRTB.cs @@ -444,7 +444,8 @@ namespace Volian.Controls.Library } } RTBAPI.SetLineSpacing(this, RTBAPI.ParaSpacing.PFS_EXACT); - ReadOnly = VwMode == E_ViewMode.View || ActiveMode == false; + bool readOnlyStep = MyItemInfo == null || MyItemInfo.FormatStepData == null ? false : MyItemInfo.FormatStepData.ReadOnly; + ReadOnly = readOnlyStep || VwMode == E_ViewMode.View || ActiveMode == false; AddRtfText(vlntxt.StartText); //AddRtfStyles(); // set readonly based on initial modes, however, these may change if diff --git a/PROMS/Volian.Print.Library/Pagination.cs b/PROMS/Volian.Print.Library/Pagination.cs index f3ad2938..48c9eb1f 100644 --- a/PROMS/Volian.Print.Library/Pagination.cs +++ b/PROMS/Volian.Print.Library/Pagination.cs @@ -60,7 +60,7 @@ namespace Volian.Print.Library // location of a pagebreak. if (MyPageHelper.ParaBreaks.Count > 0) { - if (this == MyPageHelper.ParaBreaks[0] || this.YTopMost > MyPageHelper.ParaBreaks[0].YTopMost) + if (this == MyPageHelper.ParaBreaks[0] || (!MyPageHelper.ParaBreaks[0].PageBreakOnStep && this.YTopMost > MyPageHelper.ParaBreaks[0].YTopMost)) { MyPageHelper.ParaBreaks.RemoveAt(0); //Console.WriteLine("'PageBreak',6,'Yes','Page Break within Step',{0},{1},{2},{3}, {4},'{5}'", MyItemInfo.ItemID, YSize, 0, 0, 0, MyItemInfo.ShortPath); @@ -138,6 +138,16 @@ namespace Volian.Print.Library return 0; // Don't Paginate (page break) on a Step Section if it's first thing on page } if (!MyItemInfo.IsHigh) return 0; // Don't Paginate on a Substep level + + // if this is a step, see if it has the 'PageBreakOnStep' format flag set to true, if so, break here. + if (MyItemInfo.FormatStepData != null && MyItemInfo.FormatStepData.PageBreakOnStep) + { + // if this step contains Cautions or Notes page breaks have to be added for those. + if (TopMostChild != this) PageBreakOnStep = true; + BuildPageBreakList(yPageSize, yPageSize, KeepStepsOnPage); // Case 1 :Works for ES05 Step 15 SubStep 7 + return 1; + } + //MyPageHelper.HLSText = MyItemInfo.DisplayText; // save the High Level Step Text //Console.WriteLine("{0} Paginate", MyPageHelper.HLSText); StepConfig sc1 = MyItemInfo.MyConfig as StepConfig; @@ -305,6 +315,22 @@ namespace Volian.Print.Library } private void BuildPageBreakList(float ySpaceOnCurPage, float yPageSize, bool KeepStepsOnPage) { + // if this paragraph is flagged to pagebreakonstep (i.e. these are used by background documents + // to get each hls/caution/note to be on its own page), then any of the children above should + // also have the flag set and be added to the pagebreakonsteplist so that a break occurs. + List PageBreakOnStepList = new List(); + if (PageBreakOnStep) + { + foreach (vlnParagraph chldAbove in _ChildrenAbove) + { + if (TopMostChild != chldAbove) + { + chldAbove.PageBreakOnStep = true; + PageBreakOnStepList.Add(chldAbove); + } + } + PageBreakOnStepList.Add(this); + } ParagraphLocations myLocations = new ParagraphLocations(); BuildLocationList(YTopMost, myLocations); StepLevelList myList = myLocations.BuildStepLevelList(KeepStepsOnPage); @@ -337,7 +363,10 @@ namespace Volian.Print.Library } string myTopMsg = docstyle.Continue.Top.Message; float myTopMsgSpace = ((myTopMsg ?? "") != "") ? 2 * SixLinesPerInch : 0; - while ((YSize - yTop) > ySpaceOnCurPage) + + // while the amount to print is larger than one page, i.e. ((YSize - yTop) > ySpaceOnCurPage)) + // OR there are page breaks for HLS/cautions/notes remaining, typically for backgrounds (PageBreakOnStepList.Count > 0) + while (((YSize - yTop) > ySpaceOnCurPage) || PageBreakOnStepList.Count > 0) { ySpaceOnCurPage -= myBottomMsgSpace; vlnParagraph paraBreak = FindPageBreak(yStart, ySpaceOnCurPage, yLowerLimit, myList); @@ -351,6 +380,19 @@ namespace Volian.Print.Library //float yTopNew = paraBreak.YVeryTop - YTopMost; //float yTopNew = paraBreak.YTopMost - YTopMost; float yTopNew = Math.Min(paraBreak.YTopMost, paraBreak.YVeryTop) - YTopMost; + + // This is for formats that break on all HLS, Cautions & Notes (often backgrounds): + if (PageBreakOnStepList.Count > 0) + { + // If the next page break is beyond the next hls/caution/note, use the next + // hls/caution/note. + if (PageBreakOnStepList[0].YTop <= paraBreak.YTop) + { + paraBreak = PageBreakOnStepList[0]; + PageBreakOnStepList.RemoveAt(0); + yTopNew = paraBreak.YTop - YTopMost; + } + } RemoveProcessedParagraphs(myList, yTopNew - yTop); yTop = yTopNew; MyPageHelper.ParaBreaks.Add(paraBreak); diff --git a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs index 1f750aa4..97471622 100644 --- a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs +++ b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs @@ -922,6 +922,18 @@ namespace Volian.Print.Library _HLSText = value; } } + private string _HLSTAB = ""; + public string HLSTAB + { + get { return _HLSTAB; } + set { _HLSTAB = value; } + } + private string _HLRNO = ""; + public string HLRNO + { + get { return _HLRNO; } + set { _HLRNO = value; } + } private void ProcessPaglistToken(VEPROMS.CSLA.Library.SectionInfo section, SvgGroup svgGroup, VEPROMS.CSLA.Library.PageItem pageItem, ref VE_Font useFontForCheckOffHeader, ref string plstr, string token) { //Console.WriteLine("{0} ProcessPagelistToken", token); @@ -1113,6 +1125,20 @@ namespace Volian.Print.Library } } break; + case "{CURDATE}": + DateTime thisDate1 = DateTime.Today; + plstr = plstr.Replace(token, thisDate1.ToString("MMMM dd, yyyy")); + break; + case "{CURTIME}": + DateTime thisDate2 = DateTime.Now; + plstr = plstr.Replace(token, thisDate2.ToString("H:mm")); + break; + case "{HLRNO}": + plstr = plstr.Replace(token, HLRNO); + break; + case "{HLSTAB}": + plstr = plstr.Replace(token, HLSTAB); + break; default: if (token.Contains(@"RO-")) { diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index 06dc82fd..bc81a6bd 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -174,6 +174,12 @@ namespace Volian.Print.Library { return string.Format("{0} - {1} - {2} - '{3}'", this.MyItemInfo.ItemID, this.YTop, this.YSize, this.MyItemInfo.ShortPath); } + private bool _PageBreakOnStep = false; + public bool PageBreakOnStep + { + get { return _PageBreakOnStep; } + set { _PageBreakOnStep = value; } + } private vlnTable _MyGrid; public vlnTable MyGrid { @@ -207,6 +213,17 @@ namespace Volian.Print.Library if ((MyItemInfo.Cautions != null && MyItemInfo.Cautions[0].FormatStepData.AlwaysUseExtraLines) || (MyItemInfo.Notes != null && MyItemInfo.Notes[0].FormatStepData.AlwaysUseExtraLines)) yPageStart -= ((MyItemInfo.FormatStepData == null) ? 0 : MyItemInfo.FormatStepData.StepLayoutData.STExtraSpace ?? 0); } + // Save the HLS & RNO string in case the pagelist item uses it (some of the backgrounds): + if (MyItemInfo.FormatStepData != null && MyItemInfo.FormatStepData.PageBreakOnStep) + { + MyPageHelper.HLSTAB = MyItemInfo.HighLevelStepTabPageList; + // find the rno and use it's tab for the HLRNO part. + ItemInfo rno = MyItemInfo.RNOs != null && MyItemInfo.RNOs.Count > 0 ? MyItemInfo.RNOs[0] : null; + string rnotab = (rno == null) ? MyItemInfo.MyTab.CleanText : rno.DisplayText; + MyPageHelper.HLRNO = MyItemInfo.FormatStepData.TabData.RNOIdent + rnotab; + MyPageHelper.ResetSvg(); + } + float yLocation = CalculateYOffset(yPageStart, yTopMargin); if (MyItemInfo.HasChangeBar && MyPageHelper.ChangeBarDefinition.MyChangeBarType != PrintChangeBar.Without) MyPageHelper.AddChangeBar(DoChangeBar(cb, MyItemInfo, MyPageHelper, XOffset, yLocation, MyPageHelper.MaxRNO, MyItemInfo.ActiveFormat), cbMess); float retval = yLocation; @@ -745,8 +762,10 @@ namespace Volian.Print.Library Console.WriteLine("**** BOTTOM CONTINUE MESSAGE NOT CODED*****"); break; } - MyPageHelper.BottomMessage = new vlnText(cb, this, myMsg, myMsg, docstyle.Layout.LeftMargin + XOffsetBox + docstyle.Continue.Bottom.Margin ?? 0, msg_yLocation, docstyle.Continue.Bottom.Font);// MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font); + if (!PageBreakOnStep) + MyPageHelper.BottomMessage = new vlnText(cb, this, myMsg, myMsg, docstyle.Layout.LeftMargin + XOffsetBox + docstyle.Continue.Bottom.Margin ?? 0, msg_yLocation, docstyle.Continue.Bottom.Font);// MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font); } + if (PageBreakOnStep) MyPageHelper.BottomMessage = null; cb.PdfDocument.NewPage(); //_MyLog.InfoFormat("NewPage 11 {0}", cb.PdfWriter.CurrentPageNumber); ResetDocStyleAndValues(ref yTopMargin, ref yBottomMargin); @@ -788,7 +807,10 @@ namespace Volian.Print.Library yPageStart -= 2 * SixLinesPerInch;// Allow two lines for top continue message if (myMsg.IndexOf(@"%d") > -1) myMsg = myMsg.Replace(@"%d", MyItemInfo.MyHLS.MyTab.CleanTextNoSymbols.Trim(" .".ToCharArray())); - MyPageHelper.TopMessage = new vlnText(cb, this, myMsg, myMsg, docstyle.Layout.LeftMargin + XOffsetBox + docstyle.Continue.Top.Margin ?? 0, yTopMargin + 0.1F, docstyle.Continue.Top.Font);// MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font); + if (!PageBreakOnStep) + MyPageHelper.TopMessage = new vlnText(cb, this, myMsg, myMsg, docstyle.Layout.LeftMargin + XOffsetBox + docstyle.Continue.Top.Margin ?? 0, yTopMargin + 0.1F, docstyle.Continue.Top.Font);// MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font); + else + MyPageHelper.TopMessage = null; } // If "ContinueSectionHeader" (format flag) is true then print the section title with "(Continued)" appended to it @@ -860,9 +882,21 @@ namespace Volian.Print.Library float mytmpfloat = sectContPara.ParagraphToPdf(cb, yTopMargin, yTopMargin, yBottomMargin); yPageStart -= sectContPara.Height * 2; } - yPageStart = ChildrenAbove.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin); yPageStart = ChildrenLeft.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin); + + // Handle the PageBreakOnStep flag for a HLS. This will put out the page break right before + // a HLS. One example of this use is for backgrounds (CALBCK). + if (MyPageHelper.ParaBreaks != null && MyPageHelper.ParaBreaks.Count > 0 && + MyPageHelper.ParaBreaks[0] == this) + { + OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin); + MyPageHelper.BottomMessage = null; + MyPageHelper.TopMessage = null; + cb.PdfDocument.NewPage(); + MyPageHelper.ParaBreaks.RemoveAt(0); + yPageStart = yTopMargin + YTop; + } yPageStart = ParagraphToPdf(cb, yPageStart, yTopMargin, yBottomMargin); yPageStart = ChildrenRight.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin); yPageStart = ChildrenBelow.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin); @@ -1104,7 +1138,19 @@ namespace Volian.Print.Library foreach (vlnParagraph child in ChildrenBelow) child.BuildLocationList(yTopMost, myLocations); } + private bool IsBackgroundStep() + { + if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.WolfCreekBackgroundFormat && + (MyItemInfo.IsHigh || MyItemInfo.IsCaution || MyItemInfo.IsNote)) return true; + return false; + } + private int COL_WID_ADJ = 6; // adjusts for incorrect use of WidSTable when breaking a line (it breaks 6 chars too short) + private bool IsTitleType(ItemInfo itm) + { + if (itm.FormatStepData != null && (itm.FormatStepData.Index == 42 || itm.FormatStepData.Index == 43)) return true; + return false; + } public vlnParagraph(vlnParagraph parent, PdfContentByte cb, ItemInfo itemInfo, float xoff, float yoff, int rnoLevel, int maxRNO, FormatInfo formatInfo, string prefix, string suffix) { ShowSectionTitles = formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ShowSectionTitles || itemInfo.MyDocStyle.ShowSectionTitles; @@ -1213,7 +1259,10 @@ namespace Volian.Print.Library } if (!itemInfo.IsSection || doSectTab) { - mytab = new vlnTab(cb, this, itemInfo.MyTab.Text, itemInfo.MyTab.CleanText, localXOffset, yoff, itemInfo.MyTab.MyFont, doSectTab, StepRTB.MySymbolFontName, itemInfo.MyTab.RemovedStyleUnderline); + if (itemInfo.MyTab.AltPrintTab != null) + mytab = new vlnTab(cb, this, itemInfo.MyTab.AltPrintTab, itemInfo.MyTab.AltPrintTab, localXOffset, yoff, itemInfo.MyTab.MyFont, doSectTab, StepRTB.MySymbolFontName, itemInfo.MyTab.RemovedStyleUnderline); + else + mytab = new vlnTab(cb, this, itemInfo.MyTab.Text, itemInfo.MyTab.CleanText, localXOffset, yoff, itemInfo.MyTab.MyFont, doSectTab, StepRTB.MySymbolFontName, itemInfo.MyTab.RemovedStyleUnderline); PartsLeft.Add(mytab); if (mytab.MyMacro != null) PartsLeft.Add(mytab.MyMacro); } @@ -1221,7 +1270,7 @@ namespace Volian.Print.Library // if this is the High Level RNO step (MyTopRNO) and we are numbering the RNO, adjust the xoffset to start the tab // at the x location rather than starting the text at the x location: AdjustWidth(itemInfo, maxRNO, formatInfo, mytab); - bool adjustAgain = itemInfo.MyTab.Position == 0 ? true : false; + bool adjustAgain = (itemInfo.MyTab != null && itemInfo.MyTab.Position == 0) ? true : false; if (!itemInfo.IsSection && itemInfo.FormatStepData.NumberHighLevel && itemInfo.IsRNOPart && (MyTopRNO == null || itemInfo.ItemID == MyTopRNO.MyItemInfo.ItemID)) { // adjust the x-offset of the RNO to include the tab. @@ -1325,6 +1374,10 @@ namespace Volian.Print.Library mytab.YOffset = yoff; if (mytab.MyMacro != null) mytab.MyMacro.YOffset = yoff; } + // For background formats, HLS's or Caution or any Notes have tab on line and then text + // on line below (with space in between) + if (IsBackgroundStep()) yoff = YOffset = yoff + (2 * SixLinesPerInch); + float yForCheckoff = yoff; //0; - default checkoff row is same as FIRST line of text // if dropCheckoff is true, then the checkoff is place on the same of row as the LAST line of text bool dropCheckoff = itemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.DropCheckOff; @@ -1528,7 +1581,9 @@ namespace Volian.Print.Library } float yOffRight = yoff; float RnoOffset = ToInt(formatInfo.MyStepSectionLayoutData.ColRTable, maxRNO); - if (rnoLevel < maxRNO && itemInfo.RNOs != null) yOffRight = ChildrenRight.Add(cb, itemInfo.RNOs, XOffset + RnoOffset, YTop, YTop, rnoLevel + 1, maxRNO, formatInfo); + if (rnoLevel < maxRNO && itemInfo.RNOs != null) + yOffRight = ChildrenRight.Add(cb, itemInfo.RNOs, XOffset + RnoOffset, YTop, YTop, rnoLevel + 1, maxRNO, formatInfo); + // Need code to determine if the table will overlap the Right Column if it does then // use YOffRight rather than yoff if (itemInfo.Tables != null) @@ -1563,7 +1618,8 @@ namespace Volian.Print.Library if (itemInfo.Steps != null && printsteps) yoff = ChildrenBelow.Add(cb, itemInfo.Steps, XOffset, yoff, yOffRight, rnoLevel, maxRNO, formatInfo); if (itemInfo.Sections != null) yoff = ChildrenBelow.Add(cb, itemInfo.Sections, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo); if (itemInfo.Procedures != null) yoff = ChildrenBelow.Add(cb, itemInfo.Procedures, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo); - if (rnoLevel >= maxRNO && itemInfo.RNOs != null) yoff = ChildrenBelow.Add(cb, itemInfo.RNOs, XOffset, yoff, yoff, rnoLevel + 1, maxRNO, formatInfo); + // Don't add the RNO to print if doing backgrounds. That piece of data is part of the pagelist item. + if (rnoLevel >= maxRNO && itemInfo.RNOs != null && !itemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.WolfCreekBackgroundFormat) yoff = ChildrenBelow.Add(cb, itemInfo.RNOs, XOffset, yoff, yoff, rnoLevel + 1, maxRNO, formatInfo); yoff = Math.Max(yoff, yOffRight); // TODO - use RNOSepAfterAER flag too: string tmpRnoSepStr = formatInfo.MyStepSectionPrintData.RNOSepString; @@ -1760,6 +1816,7 @@ namespace Volian.Print.Library private void CalculateXOffsetGridOrFigure(ItemInfo itemInfo, int maxRNO, FormatInfo formatInfo) { bool aerTableOrFigure = itemInfo.FormatStepData.Type.Contains("AER"); + // if (itemInfo.ColumnMode == 0) aerTableOrFigure = true; // if in single column mode, treat as an AER table for centering vlnParagraph hls1 = MyParent; while (hls1.MyParent != null && !hls1.MyItemInfo.IsHigh) hls1 = hls1.MyParent; float colR = float.Parse(formatInfo.MyStepSectionLayoutData.ColRTable.Split(",".ToCharArray())[itemInfo.ColumnMode]); @@ -1768,7 +1825,7 @@ namespace Volian.Print.Library float pageWidth = ((float)itemInfo.MyActiveSection.MyDocStyle.Layout.PageWidth); float leftMargin = ((float)itemInfo.MyActiveSection.MyDocStyle.Layout.LeftMargin); //* (float)MyItemInfo.FormatStepData.Font.CPI / 12; - if (itemInfo.IsInRNO) + if (itemInfo.IsInRNO) // && itemInfo.ColumnMode != 0) // if in rno column, the upper limit is width of the page (right margin). Subtract off size of a character xUpperLimit = pageWidth - (72 / (float)MyItemInfo.FormatStepData.Font.CPI); else @@ -1779,7 +1836,13 @@ namespace Volian.Print.Library XOffset = leftMargin + (pageWidth - leftMargin - Width) / 2; else { - if (aerTableOrFigure || itemInfo.RNOLevel != 0) // AER or RNO + //if (TableCenterPos != 0) + //{ + // XOffset = TableCenterPos; + // XOffset = XOffset - (this.Width / 2) + (float)itemInfo.MyDocStyle.Layout.LeftMargin; + //} + //else if (aerTableOrFigure || itemInfo.RNOLevel != 0) // AER or RNO + if (aerTableOrFigure || itemInfo.RNOLevel != 0) // AER or RNO XOffset = MyParent.XOffset + MyParent.Width / 2 - Width / 2; else if (TableCenterPos != 0) { @@ -1843,7 +1906,12 @@ namespace Volian.Print.Library { foreach (Macro myMacro in myMacros) { - if (myMacro.LocWithXOff ?? false) x = mytab == null ? XOffset : mytab.XOffset; + // if the format has the 'LocWithXOff' locate the macro along with the tab's offset. + // however, if the tab is more than 2 characters long, adjust so that it aligns with the + // last two characters, not the first 2. + string tabText = mytab == null ? null : mytab.Text.Trim(" .".ToCharArray()); + int tablen = (tabText == null) ? 0 : (tabText.Length <= 2) ? 0 : tabText.Length - 2; + if (myMacro.LocWithXOff ?? false) x = mytab == null ? XOffset : ((float)mytab.XOffset + (tablen * (float)mytab.MyFont.CharsToTwips)); PartsLeft.Add(new vlnMacro(x, y, myMacro.MacroDef)); } } @@ -2249,6 +2317,23 @@ namespace Volian.Print.Library int? bxIndx = formatInfo.PlantFormat.FormatData.StepDataList[typ].StepLayoutData.STBoxindex; float? colOvrd = formatInfo.PlantFormat.FormatData.StepDataList[typ].ColOverride; + if (IsBackgroundStep()) + { + myTab.XOffset = XOffset; + XOffset += (itemInfo.FormatStepData.Font.CharsToTwips * 2); // indent 2 characters for background steps + return; + } + else if (itemInfo.FormatStepData != null && itemInfo.FormatStepData.Type == "TitleWithTextBelow") + { + XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin; + return; + } + else if (itemInfo.MyParent.FormatStepData != null && itemInfo.MyParent.FormatStepData.Type == "TitleWithTextBelow") + { + XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (itemInfo.FormatStepData.Font.CharsToTwips * 2); + return; + } + if (itemInfo.IsHigh) { float x = 0; @@ -2437,7 +2522,6 @@ namespace Volian.Print.Library if (bxIndx == null) return; } float tabWidth = (myTab == null) ? 0 : myTab.Width; - if (itemInfo.IsHigh) { float CheckOffAdj = 0;