From 9023e7c89901af99e83fada0736ca77feb3fcca1 Mon Sep 17 00:00:00 2001 From: Kathy Date: Fri, 1 Feb 2013 15:01:02 +0000 Subject: [PATCH] --- PROMS/Volian.Print.Library/vlnParagraph.cs | 98 +++++++++++++--------- 1 file changed, 57 insertions(+), 41 deletions(-) diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index a0ac5a60..7928a5f8 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -194,7 +194,7 @@ namespace Volian.Print.Library if (MyPageHelper.MyTOCPageCounts.ContainsKey(tocKey)) { PageCount pc = MyPageHelper.MyTOCPageCounts[tocKey]; - pc.Total = MyPageHelper.CurrentPageNumber; + pc.Total = MyPageHelper.CurrentTOCPageNumber + 1; pc.DrawTemplates(); } } @@ -1016,7 +1016,7 @@ namespace Volian.Print.Library if (itemInfo.MyContent.Text != null) { ProcedureInfo proc = itemInfo.MyProcedure; -// DocVersionInfo dvi = proc.ActiveParent as DocVersionInfo; + // DocVersionInfo dvi = proc.ActiveParent as DocVersionInfo; DocVersionInfo dvi = proc.MyDocVersion; ROFstInfo rofst = dvi.DocVersionAssociations[0].MyROFst; rofst.docVer = dvi; @@ -1029,36 +1029,36 @@ namespace Volian.Print.Library } else { - string[] subs = m.Groups[3].Value.Split(" ".ToCharArray()); - string roid = subs[1]; - string val = lookup.GetRoValue(subs[1]); - if (val == null) val = lookup.GetRoValue(subs[1].Substring(0, 12)); - if (val != null) - { - string[] vals = val.Split("\n".ToCharArray()); - Width = Int32.Parse(vals[3], System.Globalization.NumberStyles.AllowHexSpecifier) * MyItemInfo.FormatStepData.Font.CharsToTwips; - int lines = Int32.Parse(vals[2], System.Globalization.NumberStyles.AllowHexSpecifier); - Height = lines * SixLinesPerInch; - //yForCheckoff = yoff + Height - SixLinesPerInch; - if (dropCheckoff) - yForCheckoff += Height - SixLinesPerInch; // place checkoff on last row of text + string[] subs = m.Groups[3].Value.Split(" ".ToCharArray()); + string roid = subs[1]; + string val = lookup.GetRoValue(subs[1]); + if (val == null) val = lookup.GetRoValue(subs[1].Substring(0, 12)); + if (val != null) + { + string[] vals = val.Split("\n".ToCharArray()); + Width = Int32.Parse(vals[3], System.Globalization.NumberStyles.AllowHexSpecifier) * MyItemInfo.FormatStepData.Font.CharsToTwips; + int lines = Int32.Parse(vals[2], System.Globalization.NumberStyles.AllowHexSpecifier); + Height = lines * SixLinesPerInch; + //yForCheckoff = yoff + Height - SixLinesPerInch; + if (dropCheckoff) + yForCheckoff += Height - SixLinesPerInch; // place checkoff on last row of text yoff += (Height + (SixLinesPerInch)); // RHM 20120925 - Eliminate extra space after Figure - try - { - ROImageInfo roImage = ROImageInfo.GetByROFstID_FileName(rofst.ROFstID, vals[0]); - if (roImage != null) - ImageText = val; - else - erMsg = string.Format("Image {0} does not exist.", vals[0]); - } + try + { + ROImageInfo roImage = ROImageInfo.GetByROFstID_FileName(rofst.ROFstID, vals[0]); + if (roImage != null) + ImageText = val; + else + erMsg = string.Format("Image {0} does not exist.", vals[0]); + } - catch (Exception ex) - { - erMsg = string.Format("Image {0} does not exist, error = {1}.", vals[0], ex.Message); + catch (Exception ex) + { + erMsg = string.Format("Image {0} does not exist, error = {1}.", vals[0], ex.Message); + } } } - } if (erMsg != null) Rtf = GetRtf(erMsg, itemInfo.ActiveFormat.PlantFormat.FormatData.Font); CalculateXOffset(itemInfo, maxRNO, formatInfo); } @@ -1091,13 +1091,15 @@ namespace Volian.Print.Library else if (itemInfo.FormatStepData != null && itemInfo.FormatStepData.StepPrintData != null) XOffset += (float)(itemInfo.FormatStepData.StepPrintData.PosAdjust ?? 0); - bool printMetaHdr = false; - if (itemInfo.Steps != null && itemInfo.IsSection && itemInfo.Sections != null && itemInfo.Sections.Count > 0) + if (itemInfo.IsSection && formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ShowSectionTitles + && !MyItemInfo.MyDocStyle.CancelSectTitle) { - SectionConfig sc = itemInfo.MyConfig as SectionConfig; - if ((sc != null && sc.Section_PrintHdr == "Y") && itemInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseMetaSections) printMetaHdr = true; + if (MyItemInfo.MyDocStyle.Layout.SectionMacro != null) + { + string macro = GetMacroName(MyItemInfo.MyDocStyle.Layout.SectionMacro); + PartsAbove.Add(new vlnMacro(xoff, yoff, macro)); + } } - // If WCN 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)) @@ -1106,10 +1108,9 @@ namespace Volian.Print.Library savCheckListBottomMost = yoff + Height + SixLinesPerInch; } // Get Y offset for regular steps, or if section title is output or if not within row (not last column of - // text) for wcn checklist, i.e. . - if ((!itemInfo.IsStepSection && !itemInfo.MyHLS.FormatStepData.UseSmartTemplate) - || printMetaHdr || - (formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ShowSectionTitles + // text) for wcn checklist, i.e. + if ((!itemInfo.IsStepSection && !itemInfo.MyHLS.FormatStepData.UseSmartTemplate) // regular step + || (formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ShowSectionTitles && !MyItemInfo.MyDocStyle.CancelSectTitle && !MyItemInfo.MyDocStyle.SpecialStepsFoldout) // In WCN Checklist: I don't have children or if I have children the first child doesn't alignwithparent. @@ -1117,11 +1118,19 @@ namespace Volian.Print.Library && ((itemInfo.Steps == null || itemInfo.Steps.Count == 0) || !itemInfo.Steps[0].FormatStepData.StepLayoutData.AlignWithParentTab))) { - yoff += Height; - yoff += AdjustForBlankLines(); - if (dropCheckoff) - yForCheckoff += Height - SixLinesPerInch; // place checkoff on last row of text - + bool doprint = true; + if (MyItemInfo.IsSection) // if on a section, be sure that section title should print. + { + SectionConfig sch = MyItemInfo.MyConfig as SectionConfig; + if (sch != null && sch.Section_PrintHdr != "Y") doprint = false; + } + if (doprint) + { + yoff += Height; + yoff += AdjustForBlankLines(); + if (dropCheckoff) + yForCheckoff += Height - SixLinesPerInch; // place checkoff on last row of text + } } } @@ -1209,6 +1218,13 @@ namespace Volian.Print.Library if (savCheckListBottomMost != 0 && savCheckListBottomMost > YBottomMost) YBottomMost = savCheckListBottomMost; } + private string GetMacroName(string str) + { + int mindx = str.IndexOf(@"{!"); + string macro = str.Substring(mindx + 2, str.Length - 3); + return macro; + } + private int TheStepLevel(ItemInfo itemInfo) { if (itemInfo.IsHigh) return -1;