Equation Editor interface support
This commit is contained in:
@@ -389,6 +389,8 @@ namespace Volian.Print.Library
|
||||
string txt = null;
|
||||
if ((cai.Text==null || cai.Text=="") && (cai.Type == 20036 || cai.Type == 20037 || cai.Type == 20038 || cai.Type == 20039))
|
||||
txt = "Embedded Image";
|
||||
else if ((cai.Text == null || cai.Text == "") && (cai.Type > 20099))
|
||||
txt = "Equation";
|
||||
else
|
||||
txt = ItemInfo.ConvertToDisplayText(cai.Text);
|
||||
if (MyProc.MyDocVersion.MultiUnitCount > 1)
|
||||
|
@@ -271,5 +271,52 @@ namespace Volian.Print.Library
|
||||
cb.EndLayer();
|
||||
cb.RestoreState();
|
||||
}
|
||||
|
||||
internal static float RtfRawAt(PdfContentByte cb, System.Drawing.Image image, float XOffset, float yLocation, float Width, float Height, string debug, float yBottomMargin, bool hasBorder)
|
||||
{
|
||||
VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper;
|
||||
PdfLayer textLayer = _MyPageHelper == null ? null : _MyPageHelper.TextLayer;
|
||||
float left = XOffset + Offset.X;
|
||||
float top = yLocation + Offset.Y;
|
||||
float bottom = top - Height;
|
||||
float scale = .6f;
|
||||
iTextSharp.text.Image it_image=null;
|
||||
try
|
||||
{
|
||||
it_image = iTextSharp.text.Image.GetInstance(image,iTextSharp.text.Color.WHITE);
|
||||
float itxtWid = scale * Width * 300 / 72;
|
||||
float itxtHt = scale * Height * 300 / 72;
|
||||
it_image.ScaleAbsoluteWidth(scale * Width);
|
||||
it_image.ScaleAbsoluteHeight(scale * Height);
|
||||
it_image.SetAbsolutePosition(left, top-(scale*Height));
|
||||
cb.AddImage(it_image);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Exception {0}", ex.Message);
|
||||
}
|
||||
if (hasBorder)
|
||||
{
|
||||
iTextSharp.text.Color boxColor = new iTextSharp.text.Color(System.Drawing.Color.Black);
|
||||
cb.SetColorStroke(boxColor);
|
||||
cb.SetLineWidth(.85F);
|
||||
cb.Rectangle(left - 1.5F, top - (scale * Height) - 1.5F, (scale * Width) + 3, (scale * Height) + 3);
|
||||
cb.Stroke();
|
||||
}
|
||||
if (textLayer != null) cb.EndLayer();
|
||||
if (PdfDebug)
|
||||
{
|
||||
// be very careful around the following line, if the cursor 'touches'
|
||||
// NextTextAtCounter, it is incremented and the 'next' value may not be what
|
||||
// was seen as the UniqueNumber in the pdf.
|
||||
int next = NextTextAtCounter;
|
||||
// buffer (unnecessary comments) so
|
||||
// that cursor does NOT touch 'NextTextAtCounter'
|
||||
// as easily
|
||||
string dbt = string.Format("[{0}]{1}", next, debug ?? "");
|
||||
DrawPdfDebug(cb, left, top, left + (scale*Width), top-(scale*Height), dbt, 0);
|
||||
}
|
||||
return bottom;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -530,7 +530,10 @@ namespace Volian.Print.Library
|
||||
retval = DrawFigure(cb, yBottomMargin, yLocation, yPageStart, yTopMargin);
|
||||
else
|
||||
retval = DrawText(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation);
|
||||
|
||||
}
|
||||
else if (MyItemInfo.IsRtfRaw)
|
||||
{
|
||||
retval = DrawRaw(cb, yBottomMargin, yLocation, yPageStart, yTopMargin);
|
||||
}
|
||||
else if (!MyItemInfo.IsStepSection
|
||||
|| (ShowSectionTitles
|
||||
@@ -551,8 +554,8 @@ namespace Volian.Print.Library
|
||||
if (MyItemInfo.MyContent.MyGrid != null)
|
||||
{
|
||||
int profileDepth = ProfileTimer.Push(">>>> vlnParagraph.DrawDrid");
|
||||
// RHM20150507 Include Footer
|
||||
retval = DrawGrid(cb, ref yPageStart, yTopMargin, yBottomMargin + (float) MyItemInfo.MyDocStyle.Layout.FooterLength, ref yLocation); // RHM20150429 - Table Scrunch
|
||||
// RHM20150507 Include Footer
|
||||
retval = DrawGrid(cb, ref yPageStart, yTopMargin, yBottomMargin + (float)MyItemInfo.MyDocStyle.Layout.FooterLength, ref yLocation); // RHM20150429 - Table Scrunch
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
}
|
||||
else
|
||||
@@ -607,6 +610,30 @@ namespace Volian.Print.Library
|
||||
//if (localYPageStart != yPageStart) DebugText.WriteLine("ParToPdf-yPagestartDiff:{0},{1},{2}", MyItemInfo.ItemID, localYPageStart, yPageStart);
|
||||
return yPageStart;
|
||||
}
|
||||
|
||||
private float DrawRaw(PdfContentByte cb, float yBottomMargin, float yLocation, float yPageStart, float yTopMargin)
|
||||
{
|
||||
if (DebugText.IsOpen) DebugText.WriteLine("{0},'{1}','{2}','<<END>>'", MyItemInfo.ItemID, MyItemInfo.DBSequence, FormattedText);
|
||||
float retval = yLocation;
|
||||
System.Drawing.Size sz = RtfRawItem.GetRtfRawSize(MyItemInfo.MyContent.Text);
|
||||
Height = sz.Height;
|
||||
Width = sz.Width;
|
||||
Volian.Controls.Library.RTF myRtb = new RTF();
|
||||
myRtb.Size = sz;
|
||||
myRtb.Rtf = MyItemInfo.MyContent.Text;
|
||||
try
|
||||
{
|
||||
System.Drawing.Image image = new System.Drawing.Bitmap((int)Width, (int)Height);
|
||||
System.Drawing.Graphics gr = System.Drawing.Graphics.FromImage(image);
|
||||
myRtb.RenderClipped(gr, new System.Drawing.Rectangle(0, 0, (int)Width, (int)Height));
|
||||
retval = Rtf2Pdf.RtfRawAt(cb, image, XOffset + MyItemInfo.FormatStepData.Font.CharsToTwips, yLocation, Width * MyPageHelper.YMultiplier, Height * MyPageHelper.YMultiplier, DebugInfo, yBottomMargin, !MyItemInfo.FormatStepData.Type.ToUpper().Contains("BORDERLESS"));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return retval + 2 * SixLinesPerInch; // couldn't print equation, just print 2 blank lines.
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
private bool _SectionContinuePrinted = false;
|
||||
|
||||
public bool SectionContinuePrinted
|
||||
@@ -888,6 +915,12 @@ namespace Volian.Print.Library
|
||||
if(DebugText.IsOpen)DebugText.WriteLine("{0},'{1}','{2}','<<END>>'", MyItemInfo.ItemID, MyItemInfo.DBSequence, FormattedText);
|
||||
//Console.WriteLine("{0},{1},'{2}','<<END>>'", MyItemInfo.ItemID, MyItemInfo.DBSequence, IParagraph.Content);
|
||||
float retval = yLocation;
|
||||
if (MyItemInfo.IsRtfRaw)
|
||||
{
|
||||
retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, DebugInfo + string.Format(",YLines = {0}", YSize / SixLinesPerInch), yBottomMargin);
|
||||
return retval;
|
||||
}
|
||||
|
||||
// Calvert Alarms have a special case, center text if the next/previous is not the same type of caution or note.
|
||||
// Calvert Alarms have a note1 that is a warning. if a regular note preceeded it, this regular note was not centered.
|
||||
bool doAlign = false;
|
||||
@@ -2838,7 +2871,7 @@ namespace Volian.Print.Library
|
||||
BuildPlacekeeper(parent, itemInfo);
|
||||
|
||||
// Save step text information to be used to create a Continuous Action Summary
|
||||
BuildContinuousActionSummary(parent, itemInfo);
|
||||
BuildContinuousActionSummary(parent, itemInfo);
|
||||
|
||||
if (itemInfo.ActiveFormat.MyStepSectionLayoutData.BoxLeftAdj != null)
|
||||
_MyBoxLeftAdj = float.Parse(itemInfo.ActiveFormat.MyStepSectionLayoutData.BoxLeftAdj);
|
||||
@@ -2870,7 +2903,7 @@ namespace Volian.Print.Library
|
||||
// This was commented out to fix a Westinghouse print issue 3-21-2014, orignally put in for Farley
|
||||
//if (itemInfo.IsStepSection && !(itemInfo as SectionInfo).IsSeparatePagination() && itemInfo.MyParent.IsSection)
|
||||
// RefreshDocStyle();
|
||||
|
||||
|
||||
XOffset = xoff;
|
||||
if (!MyItemInfo.IsStep && !MyItemInfo.IsStepSection && MyItemInfo.MyContent.MyEntry != null)
|
||||
{
|
||||
@@ -3326,6 +3359,14 @@ namespace Volian.Print.Library
|
||||
yoff = (float)Math.Ceiling(yoff);
|
||||
ProfileTimer.Pop(profileDepth1);
|
||||
}
|
||||
else if (itemInfo.IsRtfRaw)
|
||||
{
|
||||
CalculateXOffsetGridOrFigure(itemInfo, maxRNO, formatInfo);
|
||||
YOffset = yoff;
|
||||
yoff += Height * .6f; // .6 is used as a scale factor in RtfRawAt (rtf2pdf). Use it here too for moving down page after equation.
|
||||
yoff = (float)Math.Ceiling(yoff);
|
||||
yoff += AdjustForBlankLines();
|
||||
}
|
||||
else if (itemInfo.IsFigure) // if a figure we've got to determine the size:
|
||||
{
|
||||
int profileDepth2 = ProfileTimer.Push(">>>> Before vlnParagraph.Figure");
|
||||
@@ -3437,7 +3478,7 @@ namespace Volian.Print.Library
|
||||
}
|
||||
yoff = AdjustLocIfLongerRNO(itemInfo, yoff, yoffRightParent);
|
||||
bool noborder = MyItemInfo.FormatStepData.Type.ToUpper().Contains("BORDERLESS");
|
||||
yoff += (Height + ((noborder ? 2 : 3) * SixLinesPerInch));
|
||||
yoff += (Height + ((noborder ? 2 : 3) * SixLinesPerInch));
|
||||
CalculateXOffsetGridOrFigure(itemInfo, maxRNO, formatInfo);
|
||||
}
|
||||
ProfileTimer.Pop(profileDepth2);
|
||||
@@ -3544,7 +3585,7 @@ namespace Volian.Print.Library
|
||||
|| (!itemInfo.IsStepSection && itemInfo.MyHLS != null && itemInfo.MyHLS.FormatStepData.UseSmartTemplate
|
||||
&& ((itemInfo.Steps == null || itemInfo.Steps.Count == 0)
|
||||
|| !itemInfo.Steps[0].FormatStepData.StepLayoutData.AlignWithParentTab))
|
||||
||((MyItemInfo.IsNote || MyItemInfo.IsCaution) && MyItemInfo.MyParent.IsSection)) // B2016-222 check if is a caution or note and parent is a section
|
||||
|| ((MyItemInfo.IsNote || MyItemInfo.IsCaution) && MyItemInfo.MyParent.IsSection)) // B2016-222 check if is a caution or note and parent is a section
|
||||
{
|
||||
bool doprint = !(MyPageHelper.DidHLSText && MyItemInfo.ItemID == MyPageHelper.HasHLSTextId);
|
||||
if (MyItemInfo.IsSection)
|
||||
@@ -4272,6 +4313,7 @@ namespace Volian.Print.Library
|
||||
}
|
||||
private void CalculateXOffsetGridOrFigure(ItemInfo itemInfo, int maxRNO, FormatInfo formatInfo)
|
||||
{
|
||||
float scale = itemInfo.IsRtfRaw ? 0.6f : 0;
|
||||
bool aerTableOrFigure = itemInfo.FormatStepData.Type.Contains("AER");
|
||||
vlnParagraph hls1 = MyParent;
|
||||
if (!formatInfo.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm)
|
||||
@@ -4306,7 +4348,7 @@ namespace Volian.Print.Library
|
||||
XOffset = XOffset - (this.Width / 2) + (float)itemInfo.MyDocStyle.Layout.LeftMargin;
|
||||
}
|
||||
else if (itemInfo.RNOLevel != 0) // RNO
|
||||
XOffset = MyParent.XOffset + MyParent.Width / 2 - Width / 2;
|
||||
XOffset = MyParent.XOffset + (MyParent.Width / 2) - ((scale * Width) / 2);
|
||||
else if (aerTableOrFigure)
|
||||
{
|
||||
// if in the BGE alarm format and the hls is a Window (upper right corner when it prints), use the parent of the table
|
||||
@@ -4325,7 +4367,7 @@ namespace Volian.Print.Library
|
||||
// Add in 1/2 of the width of all RNO columns
|
||||
XOffset += (colR * itemInfo.ColumnMode) / 2;
|
||||
|
||||
if (!aerTableOrFigure)
|
||||
if (!aerTableOrFigure && !MyItemInfo.IsRtfRaw)
|
||||
{
|
||||
// 05/14/12 - 16bit code adjusts the center depending upon the CPI of the table font.
|
||||
// Start with XOffset of table, then calculate the XOffset adjusted for the table font,
|
||||
@@ -4371,9 +4413,13 @@ namespace Volian.Print.Library
|
||||
XOffset = xLowerLimit;
|
||||
|
||||
// if the right margin exceeds the right edge of the rightmost RNO, then adjust right edge to match.
|
||||
if (XOffset + Width > xUpperLimit)
|
||||
// In lines below, the 12 was used for Wolf Creek 2 column format, the pagewidth goes beyond the right border line so that
|
||||
// the tables, figures & equations were beyond the border. -12 takes it enough so that if boxed, it won't print out of border
|
||||
// We know this is not ideal.
|
||||
if (MyItemInfo.IsRtfRaw && (XOffset + (scale * Width) > xUpperLimit-12))
|
||||
XOffset = xUpperLimit - (scale * Width) - 12;
|
||||
if (!MyItemInfo.IsRtfRaw && XOffset + Width > xUpperLimit)
|
||||
XOffset = xUpperLimit - Width;
|
||||
|
||||
// because of the above, if it pushes beyond the left margin, use the left margin.
|
||||
if (XOffset < (float)itemInfo.MyDocStyle.Layout.LeftMargin)
|
||||
XOffset = XOffsetBox = (float)itemInfo.MyDocStyle.Layout.LeftMargin;
|
||||
@@ -5526,6 +5572,13 @@ namespace Volian.Print.Library
|
||||
else
|
||||
Width = MyParent.Width;
|
||||
}
|
||||
else if (itemInfo.IsRtfRaw) // this needs to be before the check for 'IsTablePart' - the rtfraw may be a table part, but the size is defined by raw rtf
|
||||
{
|
||||
System.Drawing.Size sz = RtfRawItem.GetRtfRawSize(MyItemInfo.MyContent.Text);
|
||||
Height = sz.Height;
|
||||
Width = sz.Width;
|
||||
Rtf = MyItemInfo.MyContent.Text;
|
||||
}
|
||||
else if (itemInfo.IsTablePart)
|
||||
{
|
||||
Width = 72 * 7; // TODO: Need to determine the Width of the Table based upon the contents
|
||||
|
Reference in New Issue
Block a user