Generate Placekeeper logic

This commit is contained in:
John Jenko 2014-05-09 19:18:15 +00:00
parent f120b73883
commit b4a055327a
5 changed files with 397 additions and 30 deletions

View File

@ -0,0 +1,289 @@
using System;
using System.Collections.Generic;
using System.Text;
using LBWordLibrary;
using VEPROMS.CSLA.Library;
namespace Volian.Print.Library
{
public class Placekeeper : IDisposable
{
private LBApplicationClass _WordApp;
private LBDocumentClass _WordDoc;
private LBSelection _WordSel;
private LBTable _WordTbl;
private const string TheQuickBrownFox = "The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.";
public Placekeeper()
{
_WordApp = new LBApplicationClass();
_WordDoc = _WordApp.Documents.Add();
_WordSel = _WordApp.Selection;
}
//public Placekeeper(pkParagraph myPlacekeeper)
//{
// _WordApp = new LBApplicationClass();
// _WordDoc = _WordApp.Documents.Add();
// _WordSel = _WordApp.Selection;
// _WordApp.Visible = true;
// AddTable();
// AddHeader();
// AddSectionHeader(myPlacekeeper.MyParagraph.MyItemInfo.DisplayNumber, myPlacekeeper.MyParagraph.MyItemInfo.DisplayText);
// foreach (pkParagraph pgh in myPlacekeeper.MyChildren)
// {
// AddHighLevelStep(pgh.MyParagraph.MyItemInfo.MyTab.CleanText, pgh.MyParagraph.MyItemInfo.DisplayText, pgh.MyParagraph.MyItemInfo.FormatStepType==9 ? "C" : "", pgh.MyParagraph.MyItemInfo.PageNumber.ToString());
// if (pgh.MyChildren.Count > 0)
// {
// StartSubStep();
// foreach (pkParagraph cpgh in pgh.MyChildren)
// {
// ContinueSubStep(cpgh.MyParagraph.MyItemInfo.DisplayText, 1);
// foreach (pkParagraph ccpgh in cpgh.MyChildren)
// ContinueSubStep(ccpgh.MyParagraph.MyItemInfo.DisplayText, 2);
// }
// FinishSubstep("", "");
// }
// }
//}
public Placekeeper(pkParagraphs myPlacekeepers)
{
_WordApp = new LBApplicationClass();
_WordDoc = _WordApp.Documents.Add();
_WordSel = _WordApp.Selection;
_WordApp.Visible = true;
AddTable();
AddHeader();
foreach (pkParagraph myPlacekeeper in myPlacekeepers)
{
if(myPlacekeepers.Count > 1)
AddSectionHeader(myPlacekeeper.MyParagraph.MyItemInfo.DisplayNumber, myPlacekeeper.MyParagraph.MyItemInfo.DisplayText);
foreach (pkParagraph pgh in myPlacekeeper.MyChildren)
{
foreach (pkParagraph pghC in pgh.MyCautionsAndNotes)
{
StepConfig sc = pghC.MyParagraph.MyItemInfo.MyConfig as StepConfig;
string doneStr = (sc.Step_Placekeeper.ToUpper() == "C")? "C":"";
string NoteCautionTab = "NOTE: ";
if (pghC.MyParagraph.MyItemInfo.IsCaution) NoteCautionTab = "CAUTION: ";
AddCautionOrNote(NoteCautionTab, pghC.MyParagraph.MyItemInfo.DisplayText, doneStr, pghC.MyParagraph.MyItemInfo.PageNumber.ToString());
}
AddHighLevelStep(pgh.MyParagraph.MyItemInfo.MyTab.CleanText, pgh.MyParagraph.MyItemInfo.DisplayText, pgh.MyParagraph.MyItemInfo.FormatStepType == 9 ? "C" : "", pgh.MyParagraph.MyItemInfo.PageNumber.ToString());
if (pgh.MyChildren.Count > 0)
{
bool conAct = false;
StartSubStep();
AddChildren(pgh, 1, ref conAct);
FinishSubstep((conAct)?"C":"", "");
}
}
}
RepeatHeader();
}
private void AddChildren(pkParagraph pgh, int level, ref bool conAct)
{
foreach (pkParagraph cpgh in pgh.MyChildren)
{
if (cpgh.MyCautionsAndNotes.Count > 0)
AddNotesOrCautions(cpgh,level, ref conAct);
if (!conAct)
conAct = IsContinuousActionPlacekeeper(conAct, cpgh);
ContinueSubStep(cpgh.MyParagraph.MyItemInfo.DisplayText, level);
AddChildren(cpgh, level+1, ref conAct);
}
}
private void AddNotesOrCautions(pkParagraph pgh, int level, ref bool conAct)
{
foreach (pkParagraph cpgh in pgh.MyCautionsAndNotes)
{
if (!conAct)
conAct = IsContinuousActionPlacekeeper(conAct, cpgh);
ContinueNoteOrCaution(cpgh.MyParagraph.MyItemInfo, level);
}
}
private static bool IsContinuousActionPlacekeeper(bool conAct, pkParagraph pkPar)
{
StepConfig sc = pkPar.MyParagraph.MyItemInfo.MyConfig as StepConfig;
conAct = (sc.Step_Placekeeper.ToUpper() == "C");
return conAct;
}
private void ContinueNoteOrCaution(ItemInfo ii, int level)
{
string NoteCautionTab = "NOTE: ";
if (ii.IsCaution) NoteCautionTab = "CAUTION: ";
if (!_FirstLine) _WordSel.TypeParagraph();
_FirstLine = false;
SetIndent(.33F + (.31F * level), -.31F);
WriteCell(NoteCautionTab + ii.DisplayText, false, false);
}
public void BuildSample()
{
_WordSel.TypeText("Placekeeper");
_WordSel.TypeParagraph();
_WordApp.Visible = true;
AddTable();
AddHeader();
AddSectionHeader("Section VI", "Title for section VI");
AddHighLevelStep("A.", TheQuickBrownFox, "C", "5");
AddSubStep(TheQuickBrownFox, "C", "");
AddCautionOrNote("NOTE:", "The Note text has a hanging indent on all but the first line of text", "", "");
AddHighLevelStep("B.", TheQuickBrownFox, "C", "7");
StartSubStep();
ContinueSubStep(TheQuickBrownFox, 1);
ContinueSubStep(TheQuickBrownFox, 2);
ContinueSubStep(TheQuickBrownFox, 2);
ContinueSubStep(TheQuickBrownFox, 3);
ContinueSubStep(TheQuickBrownFox, 3);
ContinueSubStep(TheQuickBrownFox, 2);
ContinueSubStep(TheQuickBrownFox, 1);
FinishSubstep("", "");
AddHighLevelStep("C.", TheQuickBrownFox, "C", "8");
StartSubStep();
ContinueSubStep(TheQuickBrownFox, 1);
ContinueSubStep(TheQuickBrownFox, 2);
ContinueSubStep(TheQuickBrownFox, 2);
ContinueSubStep(TheQuickBrownFox, 3);
ContinueSubStep(TheQuickBrownFox, 3);
ContinueSubStep(TheQuickBrownFox, 2);
ContinueSubStep(TheQuickBrownFox, 1);
FinishSubstep("", "");
RepeatHeader();
}
private void RepeatHeader()
{
_WordTbl.Rows.First.Select();
_WordSel.Rows.HeadingFormat = -1;
}
private bool _FirstSection = true;
private void AddTable()
{
_FirstSection = true;
_WordTbl = _WordDoc.Tables.Add(_WordSel.Range, 1, 4, 1, 0);
_WordTbl.TopPadding = 6F;
_WordTbl.BottomPadding = 6F;
LBColumn col = _WordTbl.Columns.First;
//col.SetWidth(12F, LBWdRulerStyle.wdAdjustNone);
//col = col.Next;
col.SetWidth(72 * .81F, LBWdRulerStyle.wdAdjustNone);
col = col.Next;
col.SetWidth(72 * 4.1F, LBWdRulerStyle.wdAdjustNone);
col = col.Next;
col.SetWidth(72 * .81F, LBWdRulerStyle.wdAdjustNone);
col = col.Next;
col.SetWidth(72 * .81F, LBWdRulerStyle.wdAdjustNone);
_WordTbl.Rows.AllowBreakAcrossPages = 0;
}
private void AddHeader()
{
//Advance();
WriteCell("START", true, true);
SetIndent(0.32F, -0F);
WriteCell("FUNCTION", true, true);
WriteCell("DONE", true, true);
WriteCell("PAGE", true, false);
}
private void AddSectionHeader(string number, string title)
{
if (!_FirstSection)
{
Advance(5);
_WordSel.MoveLeft(LBWdUnits.wdCell, 1, false);
_WordSel.SelectRow();
_WordSel.Cells.Merge();
}
_FirstSection = false;
Advance(2);
SetIndent(0, 0);
WriteCell("SECTION " + number, true, false);
WriteCell(" " + title, false, true);
Advance();
}
private void AddHighLevelStep(string number, string text, string done, string page)
{
Advance(2);
SetIndent(.33F, -.33F);
WriteCell(number + "\t" + text, false, true);
SetAlignment(LBWdParagraphAlignment.wdAlignParagraphCenter, LBWdCellVerticalAlignment.wdCellAlignVerticalBottom);
WriteCell(done, false, true);
SetAlignment(LBWdParagraphAlignment.wdAlignParagraphCenter, LBWdCellVerticalAlignment.wdCellAlignVerticalBottom);
WriteCell(page, false, false);
}
private void AddSubStep(string text, string done, string page)
{
Advance(2);
SetIndent(.64F, -.31F);
//_WordSel.InsertSymbol(8226, _WordSel.Font, System.Reflection.Missing.Value, System.Reflection.Missing.Value);
WriteCell("\u2022" + "\t" + text, false, true);
SetAlignment(LBWdParagraphAlignment.wdAlignParagraphCenter, LBWdCellVerticalAlignment.wdCellAlignVerticalBottom);
WriteCell(done, false, true);
SetAlignment(LBWdParagraphAlignment.wdAlignParagraphCenter, LBWdCellVerticalAlignment.wdCellAlignVerticalBottom);
WriteCell(page, false, false);
}
private bool _FirstLine = false;
private void StartSubStep()
{
_FirstLine = true;
Advance(2);
SetIndent(.64F, -.31F);
}
private void ContinueSubStep(string text, int level)
{
if(!_FirstLine) _WordSel.TypeParagraph();
_FirstLine = false;
SetIndent(.33F + (.31F * level), -.31F);
WriteCell("\u2022" + "\t" + text, false, false);
}
private void FinishSubstep(string done, string page)
{
Advance();
SetAlignment(LBWdParagraphAlignment.wdAlignParagraphCenter, LBWdCellVerticalAlignment.wdCellAlignVerticalBottom);
WriteCell(done, false, true);
SetAlignment(LBWdParagraphAlignment.wdAlignParagraphCenter, LBWdCellVerticalAlignment.wdCellAlignVerticalBottom);
WriteCell(page, false, false);
}
private void AddCautionOrNote(string type, string text, string done, string page)
{
Advance(2);
SetIndent(.33F, -.33F);
WriteCell(type, true, false);
WriteCell(" " + text, false, true);
SetAlignment(LBWdParagraphAlignment.wdAlignParagraphCenter, LBWdCellVerticalAlignment.wdCellAlignVerticalBottom);
WriteCell(done, false, true);
SetAlignment(LBWdParagraphAlignment.wdAlignParagraphCenter, LBWdCellVerticalAlignment.wdCellAlignVerticalBottom);
WriteCell(page, false, false);
}
private void WriteCell(string text, bool bold, bool advance)
{
_WordSel.Font.Name = "Arial";
_WordSel.Font.Bold = bold ? 1 : 0;
_WordSel.TypeText(text);
if (advance) Advance();
}
private void SetIndent(float left, float first)
{
_WordSel.ParagraphFormat.LeftIndent = left * 72;
_WordSel.ParagraphFormat.FirstLineIndent = first * 72;
}
private void SetAlignment(LBWdParagraphAlignment hAlign, LBWdCellVerticalAlignment vAlign)
{
_WordSel.ParagraphFormat.Alignment = hAlign;
_WordSel.Cells.VerticalAlignment = vAlign;
}
private void Advance(int count)
{
_WordSel.MoveRight(LBWdUnits.wdCell, count, false);
}
private void Advance()
{
Advance(1);
}
public void Dispose()
{
_WordApp.Quit(false);
}
}
}

View File

@ -189,22 +189,22 @@ namespace Volian.Print.Library
_OriginalPageBreak = origPgBrk; _OriginalPageBreak = origPgBrk;
_InsertBlankPages = insertBlankPages; _InsertBlankPages = insertBlankPages;
} }
public string Print(string pdfFolder) public string Print(string pdfFolder, bool makePlacekeeper)
{ {
if (_MyItem is ProcedureInfo) if (_MyItem is ProcedureInfo)
{ {
if (!(_MyItem.ActiveFormat.PlantFormat.FormatData.TransData.UseTransitionModifier || if (!(_MyItem.ActiveFormat.PlantFormat.FormatData.TransData.UseTransitionModifier ||
_MyItem.ActiveFormat.PlantFormat.FormatData.TransData.UseSpecificTransitionModifier)) _MyItem.ActiveFormat.PlantFormat.FormatData.TransData.UseSpecificTransitionModifier))
return Print(_MyItem as ProcedureInfo, pdfFolder); return Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper);
else else
{ {
// if the plant uses transition modifiers and/or page num in transition format, // if the plant uses transition modifiers and/or page num in transition format,
// need to do two passes. First pass, sets the pagenumbers for each item, // need to do two passes. First pass, sets the pagenumbers for each item,
// 2nd pass fills in the page numbers in transitions. // 2nd pass fills in the page numbers in transitions.
string retstr = Print(_MyItem as ProcedureInfo, pdfFolder); string retstr = Print(_MyItem as ProcedureInfo, pdfFolder, false);
if (retstr == null) return null; if (retstr == null) return null;
ProcedureInfo.RefreshPageNumTransitions(_MyItem as ProcedureInfo); ProcedureInfo.RefreshPageNumTransitions(_MyItem as ProcedureInfo);
return Print(_MyItem as ProcedureInfo, pdfFolder); return Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper);
} }
} }
return ""; return "";
@ -332,7 +332,7 @@ namespace Volian.Print.Library
set { PromsPrinter._MyFoldoutReader = value; } set { PromsPrinter._MyFoldoutReader = value; }
} }
private static List<SectionInfo> _MyFoldoutSection = null; private static List<SectionInfo> _MyFoldoutSection = null;
private string Print(ProcedureInfo myProcedure, string pdfFolder) private string Print(ProcedureInfo myProcedure, string pdfFolder, bool makePlacekeeper)
{ {
if (_TransPageNumProblems == null) _TransPageNumProblems = new List<string>(); if (_TransPageNumProblems == null) _TransPageNumProblems = new List<string>();
@ -353,7 +353,7 @@ namespace Volian.Print.Library
// if floating foldouts, need a list of sections & foldoutreaders. Just do first for now. // if floating foldouts, need a list of sections & foldoutreaders. Just do first for now.
_MyFoldoutSection.Add(mySection); _MyFoldoutSection.Add(mySection);
string foldoutPdf = PrintProcedureOrFoldout(myProcedure, mySection, Volian.Base.Library.VlnSettings.TemporaryFolder + @"\Foldout" + cnt.ToString() + @".pdf"); string foldoutPdf = PrintProcedureOrFoldout(myProcedure, mySection, Volian.Base.Library.VlnSettings.TemporaryFolder + @"\Foldout" + cnt.ToString() + @".pdf", false);
_MyFoldoutReader.Add(foldoutPdf != null ? new PdfReader(foldoutPdf) : null); _MyFoldoutReader.Add(foldoutPdf != null ? new PdfReader(foldoutPdf) : null);
cnt++; cnt++;
} }
@ -367,7 +367,7 @@ namespace Volian.Print.Library
if (MessageBox.Show(outputFileName + " exists. Overwrite file?", "File Exists", MessageBoxButtons.YesNo) == DialogResult.No) if (MessageBox.Show(outputFileName + " exists. Overwrite file?", "File Exists", MessageBoxButtons.YesNo) == DialogResult.No)
return null; return null;
} }
return PrintProcedureOrFoldout(myProcedure, null, outputFileName); return PrintProcedureOrFoldout(myProcedure, null, outputFileName, makePlacekeeper);
} }
// See if the last non Foldout Section has a Final Message. // See if the last non Foldout Section has a Final Message.
@ -399,7 +399,7 @@ namespace Volian.Print.Library
get { return _AllowAllWatermarks; } get { return _AllowAllWatermarks; }
set { _AllowAllWatermarks = value; } set { _AllowAllWatermarks = value; }
} }
private string PrintProcedureOrFoldout(ProcedureInfo myProcedure, SectionInfo myFoldoutSection, string outputFileName) private string PrintProcedureOrFoldout(ProcedureInfo myProcedure, SectionInfo myFoldoutSection, string outputFileName, bool makePlacekeeper)
{ {
bool doingFoldout = myFoldoutSection != null; bool doingFoldout = myFoldoutSection != null;
// The following line accounts for 16bit OverrideLeftMargin when the 'Absolute' attribute is used in the genmac. // The following line accounts for 16bit OverrideLeftMargin when the 'Absolute' attribute is used in the genmac.
@ -556,6 +556,11 @@ namespace Volian.Print.Library
OnStatusChanged(myProcedure.DisplayNumber + " PDF Creation Completed", PromsPrinterStatusType.Progress, progress); OnStatusChanged(myProcedure.DisplayNumber + " PDF Creation Completed", PromsPrinterStatusType.Progress, progress);
if (DebugPagination.IsOpen) DebugPagination.TotalPages += cb.PdfWriter.CurrentPageNumber; if (DebugPagination.IsOpen) DebugPagination.TotalPages += cb.PdfWriter.CurrentPageNumber;
CloseDocument(cb, outputFileName); CloseDocument(cb, outputFileName);
if (_MyHelper != null && makePlacekeeper)
{
if (_MyHelper.MyPlacekeepers.Count > 0)
new Placekeeper(_MyHelper.MyPlacekeepers);
}
_MyHelper = null; _MyHelper = null;
return outputFileName; return outputFileName;
} }
@ -636,9 +641,9 @@ namespace Volian.Print.Library
} }
float yoff = 0; float yoff = 0;
if (_MyHelper.DidFirstPageDocStyle) yoff = origYoff - (float)mySection.MyDocStyle.Layout.TopMargin; if (_MyHelper.DidFirstPageDocStyle) yoff = origYoff - (float)mySection.MyDocStyle.Layout.TopMargin;
AddImportedPageToLayer(cb.PdfWriter.DirectContent, _MSWordLayer, fgPage, (float)(mySection.MyDocStyle.Layout.MSWordXAdj ?? 0), (float)(mySection.MyDocStyle.Layout.MSWordYAdj ?? 0) + yoff); AddImportedPageToLayer(cb.PdfWriter.DirectContent, _MSWordLayer, fgPage, (float)(mySection.MyDocStyle.Layout.MSWordXAdj??0), (float)(mySection.MyDocStyle.Layout.MSWordYAdj??0)+yoff);
if (DebugPagination.IsOpen) DebugPagination.WriteLine("{0:D6},'{1}',{2}", if(DebugPagination.IsOpen) DebugPagination.WriteLine("{0:D6},'{1}',{2}",
_MyHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, mySection.ShortPath, pageNumber); _MyHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, mySection.ShortPath,pageNumber);
} }
if (ii == sectPageCount - 1) if (ii == sectPageCount - 1)
@ -1064,9 +1069,13 @@ namespace Volian.Print.Library
float localYPageStart = 0; float localYPageStart = 0;
float yPageStart = yTopMargin; float yPageStart = yTopMargin;
if (myItemInfo.HasChildren || myItemInfo.MyDocVersion.DocVersionConfig.SelectedSlave > 0) if (myItemInfo.HasChildren || myItemInfo.MyDocVersion.DocVersionConfig.SelectedSlave > 0)
{
localYPageStart = myParagraph.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin); localYPageStart = myParagraph.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
else if(!myItemInfo.MyDocStyle.OptionalSectionContent) if (myParagraph.MyPlaceKeeper != null)
PrintTextMessage(cb, "No Section Content", _TextLayer); _MyHelper.MyPlacekeepers.Add(myParagraph.MyPlaceKeeper);
}
else if (!myItemInfo.MyDocStyle.OptionalSectionContent)
PrintTextMessage(cb, "No Section Content", _TextLayer);
SectionConfig.SectionPagination sp = SectionConfig.SectionPagination.Separate; // always the default SectionConfig.SectionPagination sp = SectionConfig.SectionPagination.Separate; // always the default
ItemInfo nxtItem = section.GetNextItem(); ItemInfo nxtItem = section.GetNextItem();
if (nxtItem != null) if (nxtItem != null)

View File

@ -14,6 +14,11 @@ namespace Volian.Print.Library
public partial class VlnSvgPageHelper:SvgPageHelper public partial class VlnSvgPageHelper:SvgPageHelper
{ {
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private pkParagraphs _MyPlacekeepers = new pkParagraphs();
public pkParagraphs MyPlacekeepers
{
get { return _MyPlacekeepers; }
}
private PageBookmarks _PageBookmarks = new PageBookmarks(); private PageBookmarks _PageBookmarks = new PageBookmarks();
public PageBookmarks PageBookmarks public PageBookmarks PageBookmarks
{ {

View File

@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Volian.Print.Library
{
public class pkParagraph
{
private vlnParagraph _MyParagraph;
public vlnParagraph MyParagraph
{
get { return _MyParagraph; }
}
private pkParagraphs _MyChildren;
public pkParagraphs MyChildren
{
get { return _MyChildren; }
}
private pkParagraphs _MyCautionsAndNotes;
public pkParagraphs MyCautionsAndNotes
{
get { return _MyCautionsAndNotes; }
}
public pkParagraph(vlnParagraph myParagraph)
{
_MyParagraph = myParagraph;
_MyChildren = new pkParagraphs();
_MyCautionsAndNotes = new pkParagraphs();
}
public pkParagraph AddChild(vlnParagraph myParagraph)
{
pkParagraph tmp = new pkParagraph(myParagraph);
_MyChildren.Add(tmp);
return tmp;
}
public pkParagraph AddCautionsAndNotes(vlnParagraph myParagraph)
{
pkParagraph tmp = new pkParagraph(myParagraph);
_MyCautionsAndNotes.Add(tmp);
return tmp;
}
}
public class pkParagraphs:List<pkParagraph>
{
}
}

View File

@ -77,10 +77,6 @@ namespace Volian.Print.Library
if (iChildItemInfo.IsSection && (iChildItemInfo as SectionInfo).ColumnMode != maxRNO) if (iChildItemInfo.IsSection && (iChildItemInfo as SectionInfo).ColumnMode != maxRNO)
maxRNO = (iChildItemInfo as SectionInfo).ColumnMode; maxRNO = (iChildItemInfo as SectionInfo).ColumnMode;
ItemInfo childItemInfo = iChildItemInfo; ItemInfo childItemInfo = iChildItemInfo;
//if (childItemInfo.ItemID == 167601)
// Console.WriteLine("AER RNO Step");
//if (childItemInfo.ItemID == 167603)
// Console.WriteLine("stop");
int? bxIndx = childItemInfo.FormatStepData == null ? -1 : childItemInfo.FormatStepData.StepLayoutData.STBoxindex; int? bxIndx = childItemInfo.FormatStepData == null ? -1 : childItemInfo.FormatStepData.StepLayoutData.STBoxindex;
// if the Caution or Note is not boxed, then use ColT to set the starting column of the Note or Caution // if the Caution or Note is not boxed, then use ColT to set the starting column of the Note or Caution
@ -268,14 +264,6 @@ namespace Volian.Print.Library
box.Height = para.YBottomMost - box.YOffset - (boxLnAdjust * vlnPrintObject.SixLinesPerInch); // para.YTop - (1.1F * vlnPrintObject.SixLinesPerInch); box.Height = para.YBottomMost - box.YOffset - (boxLnAdjust * vlnPrintObject.SixLinesPerInch); // para.YTop - (1.1F * vlnPrintObject.SixLinesPerInch);
box = null; box = null;
} }
//else if (childItemInfo.ItemID == 167601)
//{
// boxHLS = true;
// int boxLnAdjust = iChildItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.DiffContActBox ? 1 : 2;
// box.Height = yoff - box.YOffset - (boxLnAdjust * vlnPrintObject.SixLinesPerInch); // new height, with children
// yoff += 1 * vlnPrintObject.SixLinesPerInch;
// box = null;
//}
} }
if (childItemInfo.IsSequential && childItemInfo.NextItemCount > 0 && childItemInfo.MyParent.IsHigh && ((childItemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.XBlankW1stLevSub) == E_DocStructStyle.XBlankW1stLevSub)) if (childItemInfo.IsSequential && childItemInfo.NextItemCount > 0 && childItemInfo.MyParent.IsHigh && ((childItemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.XBlankW1stLevSub) == E_DocStructStyle.XBlankW1stLevSub))
yoff += vlnPrintObject.SixLinesPerInch; yoff += vlnPrintObject.SixLinesPerInch;
@ -1240,7 +1228,7 @@ namespace Volian.Print.Library
float wtpm = (float)docstyle.Layout.PageWidth - (float)docstyle.Layout.LeftMargin; float wtpm = (float)docstyle.Layout.PageWidth - (float)docstyle.Layout.LeftMargin;
xpos = XOffsetBox + (float)docstyle.Layout.LeftMargin + (wtpm - (myMsg.Length * MyItemInfo.FormatStepData.Font.CharsToTwips)) / 2; xpos = XOffsetBox + (float)docstyle.Layout.LeftMargin + (wtpm - (myMsg.Length * MyItemInfo.FormatStepData.Font.CharsToTwips)) / 2;
xpos = Math.Max(xpos, XOffsetBox + (float)docstyle.Layout.LeftMargin); xpos = Math.Max(xpos, XOffsetBox + (float)docstyle.Layout.LeftMargin);
MyPageHelper.BottomMessage = new vlnText(cb, this, myMsg, myMsg, xpos, msg_yLocation, docstyle.End.Font); MyPageHelper.BottomMessage = new vlnText(cb, this, myMsg, myMsg, xpos, msg_yLocation, docstyle.End.Font);
MyPageHelper.MyGaps.Add(new Gap(msg_yLocation, msg_yLocation - MyPageHelper.BottomMessage.Height)); MyPageHelper.MyGaps.Add(new Gap(msg_yLocation, msg_yLocation - MyPageHelper.BottomMessage.Height));
} }
} }
@ -1491,8 +1479,21 @@ namespace Volian.Print.Library
{ {
get { return _MyFlexGrid; } get { return _MyFlexGrid; }
} }
private pkParagraph _MyPlaceKeeper = null;
public pkParagraph MyPlaceKeeper
{
get { return _MyPlaceKeeper; }
set { _MyPlaceKeeper = value; }
}
public static bool InList(int id, params int[] ids)
{
foreach (int listid in ids)
if (id == listid) 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, float yoffRightParent) public vlnParagraph(vlnParagraph parent, PdfContentByte cb, ItemInfo itemInfo, float xoff, float yoff, int rnoLevel, int maxRNO, FormatInfo formatInfo, string prefix, string suffix, float yoffRightParent)
{ {
BuildPlacekeeper(parent, itemInfo);
if (itemInfo.ActiveFormat.MyStepSectionLayoutData.BoxLeftAdj != null) if (itemInfo.ActiveFormat.MyStepSectionLayoutData.BoxLeftAdj != null)
_MyBoxLeftAdj = float.Parse(itemInfo.ActiveFormat.MyStepSectionLayoutData.BoxLeftAdj); _MyBoxLeftAdj = float.Parse(itemInfo.ActiveFormat.MyStepSectionLayoutData.BoxLeftAdj);
ShowSectionTitles = formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ShowSectionTitles || itemInfo.MyDocStyle.ShowSectionTitles; ShowSectionTitles = formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ShowSectionTitles || itemInfo.MyDocStyle.ShowSectionTitles;
@ -2196,6 +2197,27 @@ namespace Volian.Print.Library
if (XOffsetCenter != null) XOffset = (float)XOffsetCenter; if (XOffsetCenter != null) XOffset = (float)XOffsetCenter;
} }
private void BuildPlacekeeper(vlnParagraph parent, ItemInfo itemInfo)
{
if (itemInfo is SectionInfo && (itemInfo as SectionInfo).SectionConfig.Section_Placekeeper.ToUpper() != "N") // if is a section type and the section is marked to create placekeeper
{
MyPlaceKeeper = new pkParagraph(this);
if (parent != null && parent.MyItemInfo.IsSection)
parent.MyPlaceKeeper = MyPlaceKeeper;
}
else if (parent != null && parent.MyPlaceKeeper != null && itemInfo is StepInfo)//InList(parent.MyItemInfo.ItemID, 513, 514, 519, 520, 525))
{
StepConfig sc = itemInfo.MyConfig as StepConfig;
if (sc != null && sc.Step_Placekeeper.ToUpper() != "N")
{
if (itemInfo.IsCautionPart || itemInfo.IsNotePart)
MyPlaceKeeper = parent.MyPlaceKeeper.AddCautionsAndNotes(this);
else
MyPlaceKeeper = parent.MyPlaceKeeper.AddChild(this);
}
}
}
private vlnParagraph FindParentRNO() private vlnParagraph FindParentRNO()
{ {
if (ChildrenRight != null && ChildrenRight.Count > 0) return ChildrenRight[0]; if (ChildrenRight != null && ChildrenRight.Count > 0) return ChildrenRight[0];
@ -3088,11 +3110,7 @@ namespace Volian.Print.Library
XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + tabWidth + XOffsetBox; XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + tabWidth + XOffsetBox;
} }
else else
{
//if (itemInfo.ItemID == 167601)
// Console.WriteLine("AER RNO Step");
XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)bx.TxtStart + _MyBoxLeftAdj + tabWidth + XOffsetBox; XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)bx.TxtStart + _MyBoxLeftAdj + tabWidth + XOffsetBox;
}
if (myTab != null) myTab.XOffset = XOffset - tabWidth; if (myTab != null) myTab.XOffset = XOffset - tabWidth;
} }
else if (itemInfo.IsRNOPart && itemInfo.MyParent != null && itemInfo.MyParent.IsRNOPart && itemInfo.FormatStepData.NumberWithLevel) else if (itemInfo.IsRNOPart && itemInfo.MyParent != null && itemInfo.MyParent.IsRNOPart && itemInfo.FormatStepData.NumberWithLevel)