Fixed a NULL reference issue

This commit is contained in:
John Jenko 2014-04-29 18:07:10 +00:00
parent f332618227
commit 637df99460

View File

@ -77,6 +77,10 @@ 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
@ -264,6 +268,14 @@ 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;
@ -1219,15 +1231,18 @@ namespace Volian.Print.Library
myMsg = myMsg.Replace("%-12s", MyItemInfo.MyProcedure.DisplayNumber.PadRight(12)); myMsg = myMsg.Replace("%-12s", MyItemInfo.MyProcedure.DisplayNumber.PadRight(12));
float xpos = 0; float xpos = 0;
if ((docstyle.End.Margin ?? 0) != 0) if ((docstyle.End.Margin ?? 0) != 0)
xpos = (float)docstyle.Layout.LeftMargin + (float)docstyle.End.Margin;
else
{ {
xpos = (float)docstyle.Layout.LeftMargin + (float)docstyle.End.Margin;
MyPageHelper.BottomMessage = new vlnText(cb, this, myMsg, myMsg, xpos, msg_yLocation, docstyle.End.Font);
}
else
{ // Center the bottom message
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.MyGaps.Add(new Gap(msg_yLocation, msg_yLocation - MyPageHelper.BottomMessage.Height)); MyPageHelper.MyGaps.Add(new Gap(msg_yLocation, msg_yLocation - MyPageHelper.BottomMessage.Height));
} }
MyPageHelper.BottomMessage = new vlnText(cb, this, myMsg, myMsg, xpos, msg_yLocation, docstyle.End.Font);
} }
} }
if (yLocalypagestart != yPageStart) DebugText.WriteLine("ToPdf-yPagestartDiff:{0},{1},{2},{3}", MyPageHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, MyItemInfo.ItemID, yLocalypagestart, yPageStart); if (yLocalypagestart != yPageStart) DebugText.WriteLine("ToPdf-yPagestartDiff:{0},{1},{2},{3}", MyPageHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, MyItemInfo.ItemID, yLocalypagestart, yPageStart);
@ -3068,7 +3083,11 @@ 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)