This commit is contained in:
Kathy Ruffing 2012-06-08 13:25:05 +00:00
parent 639895f46f
commit 0d8f8e4a39

View File

@ -41,7 +41,7 @@ namespace Volian.Print.Library
yoff = Add(cb, childItemInfo.Cautions, xoff, yoff, yoffRight, rnoLevel, maxRNO, formatInfo);
if (childItemInfo.Notes != null && (childItemInfo.IsCaution || childItemInfo.IsNote))
yoff = Add(cb, childItemInfo.Notes, xoff, yoff, yoffRight, rnoLevel, maxRNO, formatInfo);
int? bxIndx = childItemInfo.FormatStepData==null?-1:childItemInfo.FormatStepData.StepLayoutData.STBoxindex;
int? bxIndx = childItemInfo.FormatStepData == null ? -1 : childItemInfo.FormatStepData.StepLayoutData.STBoxindex;
if (bxIndx != -1 && (bxIndex != bxIndx || childItemInfo.FormatStepData.BoxIt))
{
if (childItemInfo.FormatStepData.BoxIt) // this is a boxed HLS
@ -52,7 +52,7 @@ namespace Volian.Print.Library
StepSectionLayoutData ssld = formatInfo.MyStepSectionLayoutData;
int colR = int.Parse(formatInfo.MyStepSectionLayoutData.ColRTable.Split(",".ToCharArray())[childItemInfo.ColumnMode]);
int widS = vlnPrintObject.ToInt(formatInfo.MyStepSectionLayoutData.WidSTablePrint, maxRNO);
box.DefEnd = (float)(ssld.ColS + colR + widS + (60/4.8));
box.DefEnd = (float)(ssld.ColS + colR + widS + (60 / 4.8));
box.YOffset = yoff - .75F * vlnPrintObject.SixLinesPerInch;
}
else if (bxIndex == null) // First boxed step
@ -81,8 +81,8 @@ namespace Volian.Print.Library
}
if (childItemInfo is SectionInfo) formatInfo = (childItemInfo as SectionInfo).LocalFormat ?? formatInfo;
if (rnoLevel < maxRNO && childItemInfo.RNOs != null) yoff = Math.Max(yoff, yoffRight);
vlnParagraph para = new vlnParagraph(Parent, cb, childItemInfo, xoff, yoff, rnoLevel, maxRNO, formatInfo);
if (box != null && box.MyParent == null)
{
@ -103,6 +103,7 @@ namespace Volian.Print.Library
box.Height = yoff - box.YOffset; // new height, with children
yoff += 2 * vlnPrintObject.SixLinesPerInch;
}
return yoff;
}
public float ToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin)
@ -127,6 +128,12 @@ namespace Volian.Print.Library
/// This variable is used to match 16 bit pagination
/// </summary>
private bool _Match16BitPagination = false;
private bool _IsWordDocPara = false;
public bool IsWordDocPara
{
get { return _IsWordDocPara; }
set { _IsWordDocPara = value; }
}
public float ParagraphToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin)
{
if (Processed) return yPageStart;
@ -214,6 +221,8 @@ namespace Volian.Print.Library
// multiplier accounts for both.
if (!MyItemInfo.IsStepSection && MyItemInfo.FormatStepData.CenterOneLineOnly && MyItemInfo.MyPrevious == null && MyItemInfo.NextItem == null && Height < (1.2F * IParagraph.Leading))
IParagraph.Alignment = Element.ALIGN_CENTER;
if (!MyItemInfo.IsStepSection && MyItemInfo.FormatStepData.StepPrintData.Justify == "Center")
IParagraph.Alignment = Element.ALIGN_CENTER;
retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, DebugInfo, yBottomMargin);
if (retval == 0) // problem occurred - paragraph was not able to be printed on page
{ // pagination logic needs to be fixed.
@ -320,6 +329,16 @@ namespace Volian.Print.Library
}
public override float ToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin)
{
if (IsWordDocPara)
{
PdfReader tmp = null;
string tmpstr = null;
SectionInfo si = SectionInfo.Get(MyItemInfo.ItemID);
cb.PdfDocument.NewPage();
MyPageHelper.MyPromsPrinter.CreateWordDocPdf(cb, si, ref tmp, ref tmpstr);
Processed = true;
return yPageStart;
}
float yLocalypagestart = yPageStart;
// yPageStart is offset into roll; YTopMost is offset of topmost of this paragraph.
float yLocation = yPageStart - YTopMost;
@ -922,6 +941,15 @@ namespace Volian.Print.Library
MyPageHelper.MyParagraphs.Add(itemInfo.ItemID, this);
MyItemInfo = itemInfo;
XOffset = xoff;
if (!MyItemInfo.IsStep && !MyItemInfo.IsStepSection)
{
IsWordDocPara = true;
// special case - this is a 'Word Doc' paragraph. The Processed flag is used to know
// that steps need put out on a page for the pagination logic, and since there are no steps
// we don't want to have to worry about putting this out for pagination logic.
Processed = true;
return;
}
// Set any position adjustment (defined in the format on a per type basis)
yoff += (MyItemInfo.FormatStepData == null) ? 0 : MyItemInfo.FormatStepData.StepLayoutData.STExtraSpace ?? 0;
YTopMost = YOffset = yoff;
@ -932,6 +960,10 @@ namespace Volian.Print.Library
// of characters.
if (itemInfo.MyParent.IsCaution || itemInfo.MyParent.IsNote)
XOffset += 72 * (itemInfo.FormatStepData.CautionOrNoteSubstepIndent == null ? 0 : (float)itemInfo.FormatStepData.CautionOrNoteSubstepIndent / (float)itemInfo.FormatStepData.Font.CPI);
// research a better way - maybe add an xml tag or check printident vs editident:
if (MyItemInfo.ActiveFormat.Name == "WCNCKL" && (MyItemInfo.MyContent.Type == 20031 || MyItemInfo.MyContent.Type == 20030 || MyItemInfo.MyContent.Type == 20035))
itemInfo.MyTab = null;
if (itemInfo.MyTab != null && itemInfo.MyTab.Text != null && itemInfo.MyTab.Text != "")
{
float localXOffset = XOffset;
@ -1054,12 +1086,21 @@ namespace Volian.Print.Library
{
Rtf = GetRtf(itemInfo);
// Need the following with some modifications for WCNCKL format:
//if (Rtf.Contains("{Backspace}"))
//{
// XOffset -= 18;
// Width += 24;
// Rtf = Rtf.Replace("{Backspace}", "");
//}
if (Rtf.Contains("{Backspace}"))
{
XOffset -= 22;
Width += 24;
Rtf = Rtf.Replace("{Backspace}", "");
}
if (formatInfo.Name == "WCNCKL")
{
if (itemInfo.IsStep && (MyItemInfo.MyContent.Type == 20031 || MyItemInfo.MyContent.Type == 20030 || MyItemInfo.MyContent.Type == 20035))
{
int stplevl = TheStepLevel(itemInfo);
if (stplevl >= 0 && MyItemInfo.MyHLS.FormatStepData.VertPos[stplevl] > 0)
XOffset = float.Parse(MyItemInfo.MyHLS.FormatStepData.VertPos.Split(",".ToCharArray())[stplevl]) + (float)itemInfo.MyDocStyle.Layout.LeftMargin;
}
}
if (itemInfo.IsTablePart) // Not for grid, this is for old-style tables.
{
Width = GetTableWidth(cb, IParagraph, MyItemInfo.MyDocStyle.Layout.PageWidth);
@ -1068,6 +1109,7 @@ 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)
{
@ -1075,11 +1117,13 @@ namespace Volian.Print.Library
if ((sc != null && sc.Section_PrintHdr == "Y") && itemInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseMetaSections) printMetaHdr = true;
}
// Determine if section title is output
if (!itemInfo.IsStepSection
if ((!itemInfo.IsStepSection && MyItemInfo.ActiveFormat.Name != "WCNCKL")
|| printMetaHdr ||
(formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ShowSectionTitles
&& !MyItemInfo.MyDocStyle.CancelSectTitle
&& !MyItemInfo.MyDocStyle.SpecialStepsFoldout))
&& !MyItemInfo.MyDocStyle.SpecialStepsFoldout)
|| (MyItemInfo.ActiveFormat.Name=="WCNCKL" && !MyItemInfo.IsStepSection
&& itemInfo.MyContent.Type != 20031 && itemInfo.MyContent.Type != 20030)) // && itemInfo.MyContent.Type != 20035))
{
yoff += Height;
//yForCheckoff = yoff - SixLinesPerInch;
@ -1143,6 +1187,18 @@ namespace Volian.Print.Library
YBottomMost = yoff;
}
private int TheStepLevel(ItemInfo itemInfo)
{
int lev = 0;
ItemInfo ii = itemInfo;
while (!ii.MyParent.IsHigh)
{
lev++;
ii = ii.MyParent;
}
return lev;
}
private string SectionHasCheckOffHeader(ItemInfo itemInfo, ref VE_Font font)
{
// If the passed in itemInfo is not a section, get it's parent section. This may be a subsection, so