Print Library, Svg Library, Utils Library, XYPlots
This commit is contained in:
@@ -1395,7 +1395,7 @@ namespace VEPROMS
|
||||
DoCreatePDF(); // create indivitual pdfs
|
||||
if (_MergedPdfPath != null && _MergedPdfPath != PDFPath) PDFPath = _MergedPfd.Folder = _MergedPdfPath;
|
||||
// C2021-063 pass in whether to generate Alarm Point List text when a merge is done
|
||||
if (!_MergedPfd.DoTheMerge(PromsPrinter.MergedLandscapePages,cbxAlmPtTxt.Checked)) return; // merge them together.
|
||||
if (!_MergedPfd.DoTheMerge(cbxAlmPtTxt.Checked)) return; // merge them together.
|
||||
// if the property to show the file after printing is set (on the version dialog), display it. Otherwise do a dialog to let user know it's done
|
||||
if (_DocVersionConfig.Print_MergedPdfsViewAfter)
|
||||
{
|
||||
|
||||
@@ -1001,7 +1001,7 @@ namespace VEPROMS
|
||||
fs.Close();
|
||||
System.Diagnostics.Process.Start(fileName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
@@ -1767,7 +1767,7 @@ namespace VEPROMS
|
||||
}
|
||||
else if (args.TypesSelected == "Complete RO Report")
|
||||
{
|
||||
Volian.Print.Library.PDFReport myReport = new Volian.Print.Library.PDFReport(args.ReportTitle, args.RODataFile, Volian.Base.Library.VlnSettings.TemporaryFolder + @"\CompleteROReport.pdf", args.RofstLookup, args.CompleteROReport, args.ConvertCaretToDelta, args.IncludeEmptyROFields, args.PaperSize);
|
||||
Volian.Print.Library.PDFReport myReport = new Volian.Print.Library.PDFReport(args.ReportTitle, args.RODataFile, Volian.Base.Library.VlnSettings.TemporaryFolder + @"\CompleteROReport.pdf", args.RofstLookup, args.ConvertCaretToDelta, args.IncludeEmptyROFields, args.PaperSize);
|
||||
myReport.Build();
|
||||
}
|
||||
else if (args.TypesSelected == "RO Summary Report")
|
||||
|
||||
@@ -1,22 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml;
|
||||
using VEPROMS.CSLA.Library;
|
||||
|
||||
namespace Volian.Print.Library
|
||||
{
|
||||
public class CPSGen
|
||||
{
|
||||
private vlnParagraph _MyVlnParagraph;
|
||||
public vlnParagraph MyVlnParagraph
|
||||
{
|
||||
get { return _MyVlnParagraph; }
|
||||
set { _MyVlnParagraph = value; }
|
||||
}
|
||||
public vlnParagraph MyVlnParagraph { get; set; }
|
||||
public CPSGen(vlnParagraph myParagraph)
|
||||
{
|
||||
_MyVlnParagraph = myParagraph;
|
||||
MyVlnParagraph = myParagraph;
|
||||
}
|
||||
public void Generate(string fileName)
|
||||
{
|
||||
@@ -33,7 +25,6 @@ namespace Volian.Print.Library
|
||||
AddAttribute(xe, "FromType", fromType);
|
||||
AddAttribute(xe, "Ordinal", itm.Ordinal);
|
||||
AddAttribute(xe, "ParentID", (itm.ActiveParent as ItemInfo).ItemID);
|
||||
//AddAttribute(xe, "Xoffset", para.XOffset);
|
||||
AddAttribute(xe, "ItemID", itm.ItemID);
|
||||
AddAttribute(xe, "PreviousID", itm.PreviousID);
|
||||
AddAttribute(xe, "ContentID", itm.ContentID);
|
||||
@@ -45,41 +36,20 @@ namespace Volian.Print.Library
|
||||
AddAttribute(xe, "FormatID", itm.MyContent.FormatID);
|
||||
AddAttribute(xe, "Config", itm.MyContent.Config);
|
||||
AddAttribute(xe, "Rtf", para.Rtf);
|
||||
//AddParts(xe, "PartsAbove", para.PartsAbove);
|
||||
//AddParts(xe, "PartsLeft", para.PartsLeft);
|
||||
//AddParts(xe, "PartsRight", para.PartsRight);
|
||||
//AddParts(xe, "PartsBelow", para.PartsBelow);
|
||||
AddChildren(level,0, parent, "ChildrenAbove", para.ChildrenAbove);
|
||||
AddChildren(level,0, parent, "ChildrenLeft", para.ChildrenLeft);
|
||||
AddChildren(level,0, parent, "ChildrenRight", para.ChildrenRight);
|
||||
AddChildren(level,0, parent, "ChildrenBelow", para.ChildrenBelow);
|
||||
}
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Keeping fromType and name for Debugging")]
|
||||
private void AddChildren(int level, int fromType, XmlElement parent, string name, vlnParagraphs children)
|
||||
{
|
||||
if (children == null || children.Count == 0) return;
|
||||
//XmlElement xchildren = xe.OwnerDocument.AppendChild(xe.OwnerDocument.CreateElement(name)) as XmlElement;
|
||||
foreach(vlnParagraph child in children)
|
||||
{
|
||||
//XmlElement xechild = xe.ParentNode.AppendChild(xe.OwnerDocument.CreateElement("Item")) as XmlElement;
|
||||
Generate(level+1,0,parent,child);
|
||||
}
|
||||
}
|
||||
//private void AddParts(XmlElement xe, string name, vlnPrintObjects parts)
|
||||
//{
|
||||
// if (parts == null || parts.Count == 0) return;
|
||||
// XmlElement xpart = xe.AppendChild(xe.OwnerDocument.CreateElement(name)) as XmlElement;
|
||||
// foreach (vlnPrintObject part in parts)
|
||||
// {
|
||||
// XmlElement xechild = xpart.AppendChild(xe.OwnerDocument.CreateElement(part.GetType().Name)) as XmlElement;
|
||||
// Generate(xechild, part);
|
||||
// }
|
||||
//}
|
||||
//private void Generate(XmlElement xe, vlnPrintObject part)
|
||||
//{
|
||||
// AddAttribute(xe, "Xoffset", part.XOffset);
|
||||
// AddAttribute(xe, "Width", part.Width);
|
||||
// AddAttribute(xe, "Rtf", part.Rtf);
|
||||
//}
|
||||
private void AddAttribute(XmlElement xe, string attr, object val)
|
||||
{
|
||||
if (val == null) return;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
@@ -16,92 +15,53 @@ namespace Volian.Print.Library
|
||||
class CompleteROReport
|
||||
{
|
||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
//Dictionary<string, PdfDestination> _MyErrorBookMarks = new Dictionary<string, PdfDestination>();
|
||||
Headers Hdrs; // Header stack object.
|
||||
readonly Headers Hdrs; // Header stack object.
|
||||
RODataFile RO_df = null;
|
||||
int curheaderlen;
|
||||
string RODataFileName;
|
||||
iTextSharp.text.Document _pdfReportDoc = null;
|
||||
readonly string RODataFileName;
|
||||
readonly iTextSharp.text.Document _pdfReportDoc;
|
||||
PdfPTable datatable = null;
|
||||
|
||||
private iTextSharp.text.Font _f14; // = pdf.GetFont("Arial Unicode MS", 14, 1, Color.BLACK);
|
||||
public iTextSharp.text.Font F14 { get; set; }
|
||||
|
||||
public iTextSharp.text.Font F14
|
||||
{
|
||||
get { return _f14; }
|
||||
set { _f14 = value; }
|
||||
}
|
||||
private iTextSharp.text.Font _f10;
|
||||
public iTextSharp.text.Font F10 { get; set; }
|
||||
|
||||
public iTextSharp.text.Font F10
|
||||
{
|
||||
get { return _f10; }
|
||||
set { _f10 = value; }
|
||||
}
|
||||
private iTextSharp.text.Font _f12;
|
||||
public iTextSharp.text.Font F12 { get; set; }
|
||||
|
||||
public iTextSharp.text.Font F12
|
||||
{
|
||||
get { return _f12; }
|
||||
set { _f12 = value; }
|
||||
}
|
||||
private iTextSharp.text.Font _f10Bold;
|
||||
public iTextSharp.text.Font F10Bold { get; set; }
|
||||
|
||||
public iTextSharp.text.Font F10Bold
|
||||
{
|
||||
get { return _f10Bold; }
|
||||
set { _f10Bold = value; }
|
||||
}
|
||||
private iTextSharp.text.Font _f12Bold;
|
||||
public iTextSharp.text.Font F12Bold { get; set; }
|
||||
|
||||
public iTextSharp.text.Font F12Bold
|
||||
{
|
||||
get { return _f12Bold; }
|
||||
set { _f12Bold = value; }
|
||||
}
|
||||
public bool ConvertCaretToDelta { get; set; } = true;
|
||||
|
||||
private bool _ConvertCaretToDelta = true;
|
||||
public bool IncludeEmptyROFields { get; set; } = false;
|
||||
|
||||
public bool ConvertCaretToDelta
|
||||
{
|
||||
get { return _ConvertCaretToDelta; }
|
||||
set { _ConvertCaretToDelta = value; }
|
||||
}
|
||||
private bool _IncludeEmptyROFields = false;
|
||||
|
||||
public bool IncludeEmptyROFields
|
||||
{
|
||||
get { return _IncludeEmptyROFields; }
|
||||
set { _IncludeEmptyROFields = value; }
|
||||
}
|
||||
private int _ROFstID;
|
||||
|
||||
public int ROFstID
|
||||
{
|
||||
get { return _ROFstID; }
|
||||
set { _ROFstID = value; }
|
||||
}
|
||||
private string ReportTitle = "Complete Referenced Objects Report";
|
||||
private PdfWriter _MyPDFWriter;
|
||||
public int ROFstID { get; set; }
|
||||
private readonly string ReportTitle = "Complete Referenced Objects Report";
|
||||
private readonly PdfWriter _MyPDFWriter;
|
||||
|
||||
public CompleteROReport(PdfWriter mypdfwriter, iTextSharp.text.Document document, string dataFileName, bool convertCaretToDelta, bool includeEmptyROFields)
|
||||
{
|
||||
Hdrs = new Headers();
|
||||
_pdfReportDoc = document;
|
||||
RODataFileName = dataFileName;
|
||||
_ConvertCaretToDelta = convertCaretToDelta;
|
||||
ConvertCaretToDelta = convertCaretToDelta;
|
||||
_MyPDFWriter = mypdfwriter;
|
||||
_IncludeEmptyROFields = includeEmptyROFields;
|
||||
IncludeEmptyROFields = includeEmptyROFields;
|
||||
}
|
||||
public void StartNewDataTable()
|
||||
{
|
||||
datatable = new PdfPTable(1);
|
||||
datatable.TotalWidth = _pdfReportDoc.PageSize.Width - _pdfReportDoc.LeftMargin - _pdfReportDoc.RightMargin;
|
||||
datatable.LockedWidth = true;
|
||||
PdfPCell cell = new PdfPCell(new Phrase(ReportTitle, F14));
|
||||
cell.HorizontalAlignment = Element.ALIGN_CENTER;
|
||||
cell.BackgroundColor = Color.WHITE;
|
||||
cell.BorderColor = Color.WHITE;
|
||||
datatable = new PdfPTable(1)
|
||||
{
|
||||
TotalWidth = _pdfReportDoc.PageSize.Width - _pdfReportDoc.LeftMargin - _pdfReportDoc.RightMargin,
|
||||
LockedWidth = true
|
||||
};
|
||||
PdfPCell cell = new PdfPCell(new Phrase(ReportTitle, F14))
|
||||
{
|
||||
HorizontalAlignment = Element.ALIGN_CENTER,
|
||||
BackgroundColor = Color.WHITE,
|
||||
BorderColor = Color.WHITE
|
||||
};
|
||||
datatable.AddCell(cell);
|
||||
datatable.HeaderRows = 3;
|
||||
datatable.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
|
||||
@@ -113,33 +73,17 @@ namespace Volian.Print.Library
|
||||
PrintReport();
|
||||
RO_df.close();
|
||||
}
|
||||
private Dictionary<int, DocOutline> _MyDocOutline = new Dictionary<int, DocOutline>();
|
||||
|
||||
internal Dictionary<int, DocOutline> MyDocOutline
|
||||
{
|
||||
get { return _MyDocOutline; }
|
||||
set { _MyDocOutline = value; }
|
||||
}
|
||||
internal Dictionary<int, DocOutline> MyDocOutline { get; set; } = new Dictionary<int, DocOutline>();
|
||||
public class DocOutline
|
||||
{
|
||||
private PdfOutline _MyOutline;
|
||||
public PdfOutline MyOutline { get; set; }
|
||||
|
||||
public PdfOutline MyOutline
|
||||
{
|
||||
get { return _MyOutline; }
|
||||
set { _MyOutline = value; }
|
||||
}
|
||||
private string _MyHeader;
|
||||
|
||||
public string MyHeader
|
||||
{
|
||||
get { return _MyHeader; }
|
||||
set { _MyHeader = value; }
|
||||
}
|
||||
public string MyHeader { get; set; }
|
||||
public DocOutline(PdfOutline outline, string header)
|
||||
{
|
||||
_MyHeader = header;
|
||||
_MyOutline = outline;
|
||||
MyHeader = header;
|
||||
MyOutline = outline;
|
||||
}
|
||||
}
|
||||
private string ReplaceLineDrawCharsWithUnicode(string text)
|
||||
@@ -167,7 +111,6 @@ namespace Volian.Print.Library
|
||||
instr = instr.Replace("[RHO]", "\u03C1"); // C2016-018 rho symbol - is being read in as a line draw character, so users need to put "[RHO]" in their text for the rho symbol to print
|
||||
if (ConvertCaretToDelta)
|
||||
{
|
||||
//char[] ca = instr.ToCharArray(); // for debug
|
||||
instr = instr.Replace("^", "\u0394"); // delta
|
||||
}
|
||||
//instr = instr.Replace("\x94", "\u0394"); // delta - the delta symbol is being read in as character x94
|
||||
@@ -188,7 +131,7 @@ namespace Volian.Print.Library
|
||||
{
|
||||
string tstr = (instr.Substring(idx+uidx, m1.Index - uidx));
|
||||
if (tstr.EndsWith(" "))
|
||||
tstr = tstr.Substring(0, tstr.Length - 1) + "\xA0";
|
||||
tstr = $"{tstr.Substring(0, tstr.Length - 1)}\xA0";
|
||||
chk = new Chunk(tstr, fnt);
|
||||
if (underlineChunk)
|
||||
chk.SetUnderline(Color.BLACK, 0, 0.05F, 0, -.131F, PdfContentByte.LINE_CAP_ROUND);
|
||||
@@ -244,7 +187,7 @@ namespace Volian.Print.Library
|
||||
{
|
||||
string tstr = (strChk.Substring(uidx, m1.Index - uidx));
|
||||
if (tstr.EndsWith(" "))
|
||||
tstr = tstr.Substring(0, tstr.Length - 1) + "\xA0";
|
||||
tstr = $"{tstr.Substring(0, tstr.Length - 1)}\xA0";
|
||||
chk = new Chunk(tstr, fnt);
|
||||
if (underlineChunk)
|
||||
chk.SetUnderline(Color.BLACK, 0, 0.05F, 0, -.131F, PdfContentByte.LINE_CAP_ROUND);
|
||||
@@ -264,7 +207,7 @@ namespace Volian.Print.Library
|
||||
{
|
||||
string tstr = strChk.Substring(uidx);
|
||||
if (tstr.EndsWith(" "))
|
||||
tstr = tstr.Substring(0, tstr.Length - 1) + "\xA0";
|
||||
tstr = $"{tstr.Substring(0, tstr.Length - 1)}\xA0";
|
||||
chk = new Chunk(tstr, fnt);
|
||||
if (underlineChunk)
|
||||
chk.SetUnderline(Color.BLACK, 0, 0.05F, 0, -.131F, PdfContentByte.LINE_CAP_ROUND);
|
||||
@@ -276,10 +219,7 @@ namespace Volian.Print.Library
|
||||
return p;
|
||||
}
|
||||
|
||||
public void AddText(string txt, Font fnt)
|
||||
{
|
||||
AddText(txt, fnt, Color.BLACK);
|
||||
}
|
||||
public void AddText(string txt, Font fnt) => AddText(txt, fnt, Color.BLACK);
|
||||
|
||||
public void AddText(string txt, Font fnt, Color txtcolor)
|
||||
{
|
||||
@@ -289,10 +229,14 @@ namespace Volian.Print.Library
|
||||
string[] strlst = txt.Split(delim,StringSplitOptions.None);
|
||||
foreach (string str in strlst)
|
||||
{
|
||||
Font f = new Font(fnt);
|
||||
f.Color = txtcolor;
|
||||
PdfPCell cell = new PdfPCell(ConvertDOSSuperAndSubScripts(str, f));
|
||||
cell.BorderColor = Color.WHITE;
|
||||
Font f = new Font(fnt)
|
||||
{
|
||||
Color = txtcolor
|
||||
};
|
||||
PdfPCell cell = new PdfPCell(ConvertDOSSuperAndSubScripts(str, f))
|
||||
{
|
||||
BorderColor = Color.WHITE
|
||||
};
|
||||
if (strlst.Length > 1)
|
||||
cell.PaddingBottom = 6;
|
||||
datatable.AddCell(cell);
|
||||
@@ -301,10 +245,11 @@ namespace Volian.Print.Library
|
||||
|
||||
public void AddImage(string filename)
|
||||
{
|
||||
ROImageInfo roImage = ROImageInfo.GetByROFstID_FileName(_ROFstID, filename);
|
||||
if (roImage == null) roImage = ROFstInfo.Get(_ROFstID).GetROImageByFilename(filename, null);
|
||||
PdfPCell spaceCell = new PdfPCell();
|
||||
spaceCell.BorderColor = Color.WHITE;
|
||||
ROImageInfo roImage = ROImageInfo.GetByROFstID_FileName(ROFstID, filename) ?? ROFstInfo.Get(ROFstID).GetROImageByFilename(filename, null);
|
||||
PdfPCell spaceCell = new PdfPCell
|
||||
{
|
||||
BorderColor = Color.WHITE
|
||||
};
|
||||
datatable.AddCell(spaceCell);
|
||||
if (roImage != null)
|
||||
{
|
||||
@@ -318,7 +263,7 @@ namespace Volian.Print.Library
|
||||
it_image = iTextSharp.text.Image.GetInstance(dcnt);
|
||||
//iTextSharp.text.Image it_image = iTextSharp.text.Image.GetInstance(ROImageInfo.Decompress(roImage.Content, size));
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -342,8 +287,10 @@ namespace Volian.Print.Library
|
||||
}
|
||||
}
|
||||
it_image.ScaleToFit(_MyPDFWriter.DirectContent.PdfDocument.PageSize.Width - 144, _MyPDFWriter.DirectContent.PdfDocument.PageSize.Height - 216);
|
||||
PdfPCell cell = new PdfPCell(it_image);
|
||||
cell.BorderColor = Color.WHITE;
|
||||
PdfPCell cell = new PdfPCell(it_image)
|
||||
{
|
||||
BorderColor = Color.WHITE
|
||||
};
|
||||
datatable.AddCell(cell);
|
||||
roImage.Dispose();
|
||||
}
|
||||
@@ -364,16 +311,20 @@ namespace Volian.Print.Library
|
||||
if (ConvertCaretToDelta)
|
||||
plotlang = plotlang.Replace("^", "\x394"); // delta
|
||||
plotlang = plotlang.Replace("\x7F", "\x394"); //delta
|
||||
PdfPCell spaceCell = new PdfPCell();
|
||||
spaceCell.BorderColor = Color.WHITE;
|
||||
PdfPCell spaceCell = new PdfPCell
|
||||
{
|
||||
BorderColor = Color.WHITE
|
||||
};
|
||||
datatable.AddCell(spaceCell);
|
||||
try
|
||||
{
|
||||
System.Drawing.RectangleF plotRect = MSWordToPDF.CreatePlot(pngFile, plotlang, 600F, MSWordToPDF.FormForPlotGraphics);
|
||||
iTextSharp.text.Image it_image = iTextSharp.text.Image.GetInstance(pngFile);
|
||||
it_image.ScaleToFit(_MyPDFWriter.DirectContent.PdfDocument.PageSize.Width - 144, _MyPDFWriter.DirectContent.PdfDocument.PageSize.Height - 216);
|
||||
PdfPCell cell = new PdfPCell(it_image);
|
||||
cell.BorderColor = Color.WHITE;
|
||||
PdfPCell cell = new PdfPCell(it_image)
|
||||
{
|
||||
BorderColor = Color.WHITE
|
||||
};
|
||||
datatable.AddCell(cell);
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -386,18 +337,12 @@ namespace Volian.Print.Library
|
||||
}
|
||||
|
||||
private string processingRO = "";
|
||||
private string _MyROID = null;
|
||||
public string MyROID
|
||||
{
|
||||
get { return _MyROID; }
|
||||
set { _MyROID = value; }
|
||||
}
|
||||
|
||||
public string MyROID { get; set; } = null;
|
||||
|
||||
public void PrintReport()
|
||||
{
|
||||
bool StopPrinting = false;
|
||||
bool UserTerminate = false;
|
||||
Int16 iRecType = 0;
|
||||
VlnStatusBar showStatBar = new VlnStatusBar("Complete RO Report");
|
||||
try
|
||||
{
|
||||
@@ -405,6 +350,7 @@ namespace Volian.Print.Library
|
||||
{
|
||||
showStatBar.BarMax = (int)RO_df.GetFileLength();
|
||||
showStatBar.StatMsg = "Creating Report";
|
||||
short iRecType;
|
||||
// Loop until either printing is aborted or end of file.
|
||||
while (!StopPrinting && (iRecType = RO_df.ReadInteger16()) != -1)
|
||||
{
|
||||
@@ -454,7 +400,7 @@ namespace Volian.Print.Library
|
||||
case 104: // Multi End
|
||||
break;
|
||||
case 0: // nothing was entered in that field
|
||||
if (_IncludeEmptyROFields)
|
||||
if (IncludeEmptyROFields)
|
||||
NoInformatEntered();
|
||||
break;
|
||||
case 255:
|
||||
@@ -466,12 +412,11 @@ namespace Volian.Print.Library
|
||||
//Console.WriteLine("----------------------------------------------");
|
||||
break;
|
||||
default: // Problem
|
||||
//Console.WriteLine("Record Type: {0} Unrecognized record type", iRecType);
|
||||
StopPrinting = true;
|
||||
UserTerminate = true;
|
||||
MessageBox.Show(string.Format("Unrecognized record type [{0}]", iRecType), "Error Creating Complete RO Report", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
break;
|
||||
};
|
||||
}
|
||||
;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -502,20 +447,22 @@ namespace Volian.Print.Library
|
||||
// if there is lenght then we are in the mist of processing an RO
|
||||
string headers = erMsg;
|
||||
for (int iLoop = 0; iLoop < Hdrs.HdrCnt; iLoop++)
|
||||
headers += Hdrs.strHdrs[iLoop] + "\n ";
|
||||
headers += $"{Hdrs.strHdrs[iLoop]}\n ";
|
||||
if (processingRO.Length > 0)
|
||||
headers += processingRO;
|
||||
if (erMsg2 != null && erMsg2.Length > 0)
|
||||
headers += "\n" + erMsg2;
|
||||
//MessageBox.Show(headers, erMsg, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
if (e != null)
|
||||
_MyLog.Error(headers, e);
|
||||
else
|
||||
_MyLog.Error(headers);
|
||||
#pragma warning disable IDE0059 // Unnecessary assignment of a value - for debugging
|
||||
PdfOutline outl = new PdfOutline(MyErrorOutline, MyPdfDestPage, processingRO.Length > 0 ? processingRO : "Problem Reading Header");
|
||||
#pragma warning restore IDE0059 // Unnecessary assignment of a value
|
||||
//DestSample(outl);
|
||||
}
|
||||
|
||||
//For Debugging/Testing
|
||||
//private void DestSample(PdfOutline outl)
|
||||
//{
|
||||
// new PdfOutline(outl, new PdfDestination(PdfDestination.FIT), "FIT");
|
||||
@@ -531,27 +478,20 @@ namespace Volian.Print.Library
|
||||
public void AddErrorBookmarks()
|
||||
{
|
||||
if (_MyErrorOutline == null) return;
|
||||
//if (_MyErrorBookMarks.Count == 0) return;
|
||||
//PdfOutline outline = null;
|
||||
//foreach (string key in _MyErrorBookMarks.Keys)
|
||||
//{
|
||||
// if (outline == null) outline = new PdfOutline(_MyPDFWriter.DirectContent.RootOutline, _MyErrorBookMarks[key], "Errors");
|
||||
// new PdfOutline(outline, _MyErrorBookMarks[key], key);
|
||||
//}
|
||||
string emsg = "A Bookmark grouping named \"Errors\" was added to the PDF.\n\n Click on the RO in this grouping to jump to the report page which will contain an error message.\n\nThe error were also recorded in the PROMS error log.";
|
||||
MessageBox.Show(emsg, "Errors Found Creating Report", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
|
||||
}
|
||||
public void Multiple()
|
||||
{
|
||||
Int16 typ, i, j, nw = 0;
|
||||
short typ, i, j;
|
||||
string str, sep;
|
||||
string buff = "";
|
||||
int[] width;
|
||||
LastHeader();
|
||||
sep = "";
|
||||
// nw - number of fields
|
||||
nw = RO_df.ReadInteger16();
|
||||
short nw = RO_df.ReadInteger16();
|
||||
// allocate space for widths
|
||||
width = new int[nw];
|
||||
// loop through and load field widths and names
|
||||
@@ -645,7 +585,7 @@ namespace Volian.Print.Library
|
||||
//Console.WriteLine("Set Header");
|
||||
|
||||
// Get the number of header records
|
||||
Int16 iNewCnt = RO_df.ReadInteger16();
|
||||
short iNewCnt = RO_df.ReadInteger16();
|
||||
|
||||
//Console.WriteLine("Num Header Records: {0}", iNewCnt);
|
||||
|
||||
@@ -676,16 +616,11 @@ namespace Volian.Print.Library
|
||||
bool _LastWasName = false;//B2016-251 Don't change underscore to underline to Name value
|
||||
public void PushHeader()
|
||||
{
|
||||
//if (m_pPrinterOut->Row() > 55)
|
||||
//// m_pPrinterOut->newpage();
|
||||
//pdfReportDoc.NewPage();
|
||||
string pTmp = RO_df.ReadText();
|
||||
//Console.WriteLine("PH[{0}]", pTmp);
|
||||
curheaderlen = pTmp.Length;
|
||||
_LastWasName = (pTmp == "Name");//B2016-251 Don't change underscore to underline to Name value
|
||||
//Hdrs.strHdrs[Hdrs.HdrCnt] = pTmp;
|
||||
Hdrs.strHdrs.Add(pTmp);
|
||||
//Hdrs.repeatCount[Hdrs.HdrCnt] = 2;
|
||||
Hdrs.repeatCount.Add(2);
|
||||
Hdrs.HdrCnt++;
|
||||
Hdrs.printedLastHeader = false;
|
||||
@@ -704,15 +639,12 @@ namespace Volian.Print.Library
|
||||
// if the last header was pushed on header list
|
||||
// print eject the page if the page ran out, and
|
||||
// print the header with "none".
|
||||
//if (m_pPrinterOut->Row() > 55)
|
||||
// m_pPrinterOut->NewPage();
|
||||
LastHeader();
|
||||
//m_pPrinterOut->PutLine(0, "none");
|
||||
//m_pPrinterOut->NewLine(1);
|
||||
}
|
||||
// Remove the header
|
||||
Hdrs.HdrCnt--;
|
||||
//Hdrs.strHdrs[Hdrs.HdrCnt] = null;
|
||||
Hdrs.strHdrs.RemoveAt(Hdrs.HdrCnt);
|
||||
Hdrs.repeatCount.RemoveAt(Hdrs.HdrCnt);
|
||||
|
||||
@@ -722,7 +654,6 @@ namespace Volian.Print.Library
|
||||
|
||||
public void RROBegin()
|
||||
{
|
||||
//m_pPrinterOut->NewPage();
|
||||
//Console.WriteLine("RRO Begin");
|
||||
//Console.WriteLine("----------------------------------------------");
|
||||
// Start of a new RO, print out the headers
|
||||
@@ -730,12 +661,11 @@ namespace Volian.Print.Library
|
||||
{
|
||||
if (!MyDocOutline.ContainsKey(iLoop) || MyDocOutline[iLoop].MyHeader != Hdrs.strHdrs[iLoop])
|
||||
{
|
||||
PdfOutline parentOutline = null;
|
||||
PdfOutline parentOutline;
|
||||
if (iLoop == 0)
|
||||
parentOutline = MyRootOutline;//_MyPDFWriter.DirectContent.RootOutline;
|
||||
else
|
||||
parentOutline = MyDocOutline[iLoop - 1].MyOutline;
|
||||
//pdfDest = new PdfDestination(PdfDestination.FITH, _MyPDFWriter.DirectContent.PdfDocument.PageSize.Height);
|
||||
AddOutlineLevel(parentOutline, iLoop, Hdrs.strHdrs[iLoop], MyPdfDestPage);
|
||||
}
|
||||
// Change double underscore to spaces in header text
|
||||
@@ -748,18 +678,11 @@ namespace Volian.Print.Library
|
||||
{
|
||||
// FITH was acting strange and shifting towards bottom of the page as the number of pages increased
|
||||
//Console.WriteLine("Top = {0}, {1}", _Top, _MyPDFWriter.DirectContent.PdfDocument.PageSize.Height);
|
||||
//return new PdfDestination(PdfDestination.FITH, _Top);//_MyPDFWriter.DirectContent.PdfDocument.PageSize.Height);
|
||||
return new PdfDestination(PdfDestination.XYZ, 0, _MyPDFWriter.DirectContent.PdfDocument.PageSize.Height, 1.5f);
|
||||
}
|
||||
}
|
||||
|
||||
public PdfDestination MyPdfDestPage
|
||||
{
|
||||
get
|
||||
{
|
||||
return new PdfDestination(PdfDestination.FITV,0);
|
||||
}
|
||||
}
|
||||
public PdfDestination MyPdfDestPage => new PdfDestination(PdfDestination.FITV, 0);
|
||||
|
||||
private PdfOutline _MyErrorOutline = null;
|
||||
|
||||
@@ -787,7 +710,6 @@ namespace Volian.Print.Library
|
||||
return _MyRootOutline;
|
||||
}
|
||||
}
|
||||
private PdfDestination pdfDest = null;
|
||||
private void AddOutlineLevel(PdfOutline parentOutline, int iLoop, string hdr, PdfDestination pdfDest)
|
||||
{
|
||||
if (MyDocOutline.ContainsKey(iLoop))
|
||||
@@ -798,7 +720,6 @@ namespace Volian.Print.Library
|
||||
|
||||
public void RROEnd()
|
||||
{
|
||||
//m_pPrinterOut->PageEnd();
|
||||
// Remove any headers that are left over
|
||||
//Console.WriteLine("{0} headers cleaned up.", Hdrs.HdrCnt);
|
||||
//Console.WriteLine("RRO End");
|
||||
@@ -843,7 +764,7 @@ namespace Volian.Print.Library
|
||||
public void Text()
|
||||
{
|
||||
// Get the lenght of the text string and read it in
|
||||
Int16 iValue = RO_df.ReadInteger16();
|
||||
short iValue = RO_df.ReadInteger16();
|
||||
string szStr = "";
|
||||
// B2016-247 If size is zero it is an empty string.
|
||||
if (iValue > 0)
|
||||
@@ -867,11 +788,9 @@ namespace Volian.Print.Library
|
||||
|
||||
if (isXYPlot || (iValue + curheaderlen) > 72 || (szStr.IndexOf('\r') != -1))
|
||||
{
|
||||
// If the lenght of the string plus the field title is greater
|
||||
// If the length of the string plus the field title is greater
|
||||
// than 72 characters or has a carriage return character in it
|
||||
// then output the text on multiple lines
|
||||
//if (m_pPrinterOut->Row() > 55)
|
||||
// m_pPrinterOut->newpage();
|
||||
|
||||
// the header goes on its own line
|
||||
cell.AddElement(p);
|
||||
@@ -891,10 +810,6 @@ namespace Volian.Print.Library
|
||||
datatable.AddCell(cell);
|
||||
//m_pPrinterOut->SetNumberOfNewLines(0);
|
||||
//m_pPrinterOut->putline(0, temp);
|
||||
//if (m_pPrinterOut->Row() + 1 > 55)
|
||||
// Hdrs.repeatCount[Hdrs.HdrCnt] = 1;
|
||||
//else
|
||||
// m_pPrinterOut->newline(1);
|
||||
}
|
||||
//Console.WriteLine("Text");
|
||||
//Console.WriteLine("Value: {0}", iValue);
|
||||
@@ -906,8 +821,9 @@ namespace Volian.Print.Library
|
||||
{
|
||||
// use the key field as the PDF bookbark
|
||||
string szStr = RO_df.ReadText();
|
||||
//PdfDestination pdfDest = new PdfDestination(PdfDestination.FITH, _MyPDFWriter.DirectContent.PdfDocument.PageSize.Height);
|
||||
#pragma warning disable IDE0059 // Unnecessary assignment of a value - For Debugging
|
||||
PdfOutline outl = new PdfOutline(MyDocOutline[Hdrs.HdrCnt - 1].MyOutline, MyPdfDestTop, szStr);
|
||||
#pragma warning restore IDE0059 // Unnecessary assignment of a value
|
||||
//DestSample(outl);
|
||||
return szStr;
|
||||
//Console.WriteLine("Key Field");
|
||||
@@ -918,6 +834,7 @@ namespace Volian.Print.Library
|
||||
{
|
||||
// use the key field as the PDF bookbark
|
||||
string szStr = RO_df.ReadText();
|
||||
//For Dubugging
|
||||
//PdfDestination pdfDest = new PdfDestination(PdfDestination.FITH, _MyPDFWriter.DirectContent.PdfDocument.PageSize.Height);
|
||||
//PdfOutline outl = new PdfOutline(MyDocOutline[Hdrs.HdrCnt - 1].MyOutline, MyPdfDestTop, szStr);
|
||||
//DestSample(outl);
|
||||
@@ -931,8 +848,10 @@ namespace Volian.Print.Library
|
||||
public void ImageFile()
|
||||
{
|
||||
string fn = RO_df.ReadText();
|
||||
Int16 ht = RO_df.ReadInteger16();
|
||||
Int16 wd = RO_df.ReadInteger16();
|
||||
#pragma warning disable IDE0059 // Unnecessary assignment of a value - for Debugging
|
||||
short ht = RO_df.ReadInteger16();
|
||||
short wd = RO_df.ReadInteger16();
|
||||
#pragma warning restore IDE0059 // Unnecessary assignment of a value
|
||||
//m_pPrinterOut->PrintImage(fn, wd, ht);
|
||||
|
||||
//Console.WriteLine("ImageFile");
|
||||
@@ -946,10 +865,9 @@ namespace Volian.Print.Library
|
||||
public void XYPlot()
|
||||
{
|
||||
// Get the lenght of the text string and read it in
|
||||
Int16 iValue = RO_df.ReadInteger16();
|
||||
short iValue = RO_df.ReadInteger16();
|
||||
string szStr = RO_df.ReadText(iValue);
|
||||
string temp = szStr;
|
||||
Chunk chk = LastHeader(); // = new Chunk(m.Value, fnt);
|
||||
Chunk chk = LastHeader();
|
||||
Phrase p = new Phrase();
|
||||
PdfPCell cell = new PdfPCell();
|
||||
p.Add(chk); // add the header chunk
|
||||
@@ -997,7 +915,6 @@ namespace Volian.Print.Library
|
||||
chk = new Chunk(hdrtxt, F10Bold);
|
||||
Hdrs.printedLastHeader = true;
|
||||
return chk;
|
||||
//m_pPrinterOut->LastHeader();
|
||||
}
|
||||
|
||||
}// end CompSumROReport
|
||||
@@ -1005,9 +922,7 @@ namespace Volian.Print.Library
|
||||
|
||||
public class Headers
|
||||
{
|
||||
//public string[] strHdrs;
|
||||
public List<string> strHdrs;
|
||||
// public int[] repeatCount;
|
||||
public int HdrCnt;
|
||||
public List<int> repeatCount;
|
||||
public bool printedLastHeader;
|
||||
@@ -1022,8 +937,8 @@ namespace Volian.Print.Library
|
||||
|
||||
public class RODataFile
|
||||
{
|
||||
FileStream fs = null;
|
||||
BinaryReader br = null;
|
||||
readonly FileStream fs = null;
|
||||
readonly BinaryReader br = null;
|
||||
public RODataFile(string fname)
|
||||
{
|
||||
fs = new FileStream(fname,FileMode.Open);
|
||||
@@ -1034,15 +949,9 @@ namespace Volian.Print.Library
|
||||
br.Close();
|
||||
fs.Close();
|
||||
}
|
||||
public long GetFileLength()
|
||||
{
|
||||
return fs.Length;
|
||||
}
|
||||
public long GetFilePointerPosition()
|
||||
{
|
||||
return fs.Position;
|
||||
}
|
||||
// Read an integer value from the data file
|
||||
public long GetFileLength() => fs.Length;
|
||||
public long GetFilePointerPosition() => fs.Position;
|
||||
// Read an integer value from the data file
|
||||
public Int16 ReadInteger16()
|
||||
{
|
||||
try
|
||||
@@ -1055,18 +964,15 @@ namespace Volian.Print.Library
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
// Read a text string from the data file and returns it.
|
||||
// The calling program is responsible for free it
|
||||
// with the "delete" operator.
|
||||
// Read a text string from the data file and returns it.
|
||||
// The calling program is responsible for free it
|
||||
// with the "delete" operator.
|
||||
|
||||
public string ReadText()
|
||||
{
|
||||
return ReadText(-1);
|
||||
}
|
||||
public string ReadText() => ReadText(-1);
|
||||
|
||||
public string ReadText(Int16 i16CharCount)
|
||||
{
|
||||
Int16 i16DataSize;
|
||||
short i16DataSize;
|
||||
if (i16CharCount == -1)
|
||||
i16DataSize = ReadInteger16();
|
||||
else
|
||||
@@ -1082,15 +988,14 @@ namespace Volian.Print.Library
|
||||
for (int i = 0; i < i16DataSize; i++)
|
||||
str += Convert.ToChar(charbuff[i]).ToString();
|
||||
return (str);
|
||||
//return (Encoding.ASCII.GetString(charbuff, 0, i16DataSize)); // this didn't handle line draw chars
|
||||
}
|
||||
}
|
||||
|
||||
// Search through the file to find the next record
|
||||
public long NextRecord()
|
||||
{
|
||||
Int16 iType;
|
||||
Int16 RECORD_START = 255;
|
||||
short iType;
|
||||
short RECORD_START = 255;
|
||||
// While not the next record and not end of file get the next meta item
|
||||
while ((iType = ReadInteger16()) != RECORD_START && iType != -1)
|
||||
{
|
||||
@@ -1101,9 +1006,8 @@ namespace Volian.Print.Library
|
||||
// Get the next meta item and discard the data
|
||||
public long NextItem()
|
||||
{
|
||||
string pTmp;
|
||||
Int16 iRecType = ReadInteger16();
|
||||
Int16 iNewCnt;
|
||||
short iRecType = ReadInteger16();
|
||||
short iNewCnt;
|
||||
int iLoop;
|
||||
switch (iRecType)
|
||||
{
|
||||
@@ -1112,8 +1016,7 @@ namespace Volian.Print.Library
|
||||
for (iLoop = 0; iLoop < iNewCnt; iLoop++)
|
||||
{
|
||||
ReadInteger16();
|
||||
pTmp = ReadText();
|
||||
//delete pTmp;
|
||||
_ = ReadText();
|
||||
}
|
||||
break;
|
||||
case 2: // Push Header
|
||||
@@ -1121,8 +1024,7 @@ namespace Volian.Print.Library
|
||||
case 7: // Key Field
|
||||
case 100: // Text Field
|
||||
case 101: // Plot Field
|
||||
pTmp = ReadText();
|
||||
//delete pTmp;
|
||||
_ = ReadText();
|
||||
break;
|
||||
case 3: // Pop Header
|
||||
case 4: // RRO Begin
|
||||
@@ -1133,8 +1035,7 @@ namespace Volian.Print.Library
|
||||
// Do nothing
|
||||
break;
|
||||
case 102: // Image Field
|
||||
pTmp = ReadText();
|
||||
//delete pTmp;
|
||||
_ = ReadText();
|
||||
ReadInteger16();
|
||||
ReadInteger16();
|
||||
break;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using LBWordLibrary;
|
||||
using VEPROMS.CSLA.Library;
|
||||
using System.Text.RegularExpressions;
|
||||
@@ -10,12 +8,12 @@ namespace Volian.Print.Library
|
||||
{
|
||||
public class ContinuousActionSummary : IDisposable
|
||||
{
|
||||
private LBApplicationClass _WordApp;
|
||||
private LBDocumentClass _WordDoc;
|
||||
private LBSelection _WordSel;
|
||||
private readonly LBApplicationClass _WordApp;
|
||||
private readonly LBDocumentClass _WordDoc;
|
||||
private readonly 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.";
|
||||
private VE_Font _pkFont;
|
||||
private readonly VE_Font _pkFont;
|
||||
public ContinuousActionSummary()
|
||||
{
|
||||
_WordApp = new LBApplicationClass();
|
||||
@@ -41,7 +39,6 @@ namespace Volian.Print.Library
|
||||
_WordApp = new LBApplicationClass();
|
||||
_WordDoc = _WordApp.Documents.Add();
|
||||
_WordSel = _WordApp.Selection;
|
||||
//_WordApp.Visible = true;
|
||||
_pkFont = pkFont;
|
||||
AddTable();
|
||||
AddHeader(doingTimeCriticalSummary); // F2022-024 pass flag when creating a Time Critical Action Summary report
|
||||
@@ -72,11 +69,11 @@ namespace Volian.Print.Library
|
||||
if (txtPageNum == "") txtPageNum = (pghC.MyParagraph.MyItemInfo.PageNumber + 1).ToString();
|
||||
AddContinuousAction(NoteCautionTab, GetContActStepText(pghC.MyParagraph.MyItemInfo), doneStr, txtPageNum, 0, 0);
|
||||
}
|
||||
string stpTab = pgh.MyParagraph.MyItemInfo.MyTab.CleanText.Trim() + " "; // this is either the High Level step tab or the sub-step tab
|
||||
string stpTab = $"{pgh.MyParagraph.MyItemInfo.MyTab.CleanText.Trim()} "; // this is either the High Level step tab or the sub-step tab
|
||||
float preTabLen = 0;
|
||||
if (pgh.MyParagraph.MyItemInfo.IsNote || pgh.MyParagraph.MyItemInfo.IsCaution) // only the caution and/or note is on the CAS - high level step not selected
|
||||
{
|
||||
stpTab = string.Format("{0} ", hlsii.MyTab.Text.Trim()) + " " + stpTab;
|
||||
stpTab = $"{hlsii.MyTab.Text.Trim()} {stpTab}";
|
||||
}
|
||||
else if (!pgh.MyParagraph.MyItemInfo.IsHigh) // if the high level step was not included, adjust the tab for a sub-step/RNO
|
||||
{
|
||||
@@ -98,13 +95,13 @@ namespace Volian.Print.Library
|
||||
prevItemInfo = prevItemInfo.MyParent;
|
||||
}
|
||||
if (_FirstLine) // the first of a CAS on the report include the High Level Step tab
|
||||
sbTabPre.Insert(0, (hlsii != null) ? hlsii.MyTab.Text.Trim() + " " : "");
|
||||
sbTabPre.Insert(0, (hlsii != null) ? $"{hlsii.MyTab.Text.Trim()} " : "");
|
||||
tabPre = sbTabPre.ToString();
|
||||
if (!_FirstLine) // if not the first line we indent the size of high level step tab
|
||||
preTabLen = GetTextWidth(hlsii.MyTab.Text.Trim() + " ") / 72f;
|
||||
preTabLen = GetTextWidth($"{hlsii.MyTab.Text.Trim()} ") / 72f;
|
||||
if (pgh.MyParagraph.MyItemInfo.IsInRNO)
|
||||
{
|
||||
stpTab = stpTab.TrimEnd() + "[R] ";
|
||||
stpTab = $"{stpTab.TrimEnd()}[R] ";
|
||||
}
|
||||
stpTab = tabPre + stpTab;
|
||||
}
|
||||
@@ -135,7 +132,7 @@ namespace Volian.Print.Library
|
||||
string stpTab = cpgh.MyParagraph.MyItemInfo.MyTab.CleanText.Trim() + (cpgh.MyParagraph.MyItemInfo.IsInRNO ? "[R] ": " ");
|
||||
if (cpgh.MyParagraph.MyItemInfo.IsNote || cpgh.MyParagraph.MyItemInfo.IsCaution)
|
||||
{
|
||||
stpTab = string.Format("{0} ", cpgh.MyParagraph.MyParent.MyTab.Text.Trim()) + " " + stpTab;
|
||||
stpTab = $"{string.Format("{0} ", cpgh.MyParagraph.MyParent.MyTab.Text.Trim())} {stpTab}";
|
||||
}
|
||||
ItemInfo prevItmInfo = cpgh.MyParagraph.MyItemInfo.MyParent;
|
||||
// F2026-001 the while loop below will add the sub-step's parent tab if applicable
|
||||
@@ -154,17 +151,7 @@ namespace Volian.Print.Library
|
||||
}
|
||||
}
|
||||
|
||||
private string GetContActStepText(ItemInfo myItemInfo)
|
||||
{
|
||||
//string conActSumText = "";
|
||||
//StepConfig sc = myItemInfo.MyConfig as StepConfig;
|
||||
//if (sc != null && sc.Step_AlternateContActSumText != null)
|
||||
// conActSumText = sc.Step_AlternateContActSumText;
|
||||
//if (conActSumText == "")
|
||||
// conActSumText = myItemInfo.FormattedDisplayText;
|
||||
//return conActSumText;
|
||||
return myItemInfo.FormattedDisplayText;
|
||||
}
|
||||
private string GetContActStepText(ItemInfo myItemInfo) => myItemInfo.FormattedDisplayText;
|
||||
|
||||
private void AddNotesOrCautions(pkParagraph pgh, int level)
|
||||
{
|
||||
@@ -305,7 +292,7 @@ namespace Volian.Print.Library
|
||||
}
|
||||
_FirstLine = false;
|
||||
}
|
||||
static Regex rgx = new Regex(@"\\(b|ul|up[1-9]|dn0|up0|dn[1-9]|b0|ulnone)( |$|(?=\\))");
|
||||
static readonly Regex rgx = new Regex(@"\\(b|ul|up[1-9]|dn0|up0|dn[1-9]|b0|ulnone)( |$|(?=\\))");
|
||||
private void WriteRTF(string text)
|
||||
{
|
||||
Match m = rgx.Match(text);
|
||||
@@ -363,17 +350,8 @@ namespace Volian.Print.Library
|
||||
_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);
|
||||
}
|
||||
private void Advance(int count) => _WordSel.MoveRight(LBWdUnits.wdCell, count, false);
|
||||
private void Advance() => Advance(1);
|
||||
public void Dispose() => _WordApp.Quit(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// This file is used by Code Analysis to maintain SuppressMessage
|
||||
// attributes that are applied to this project.
|
||||
// Project-level suppressions either have no target or are given
|
||||
// a specific target and scoped to a namespace, type, member, etc.
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
[assembly: SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Not modifying Naming Styles")]
|
||||
@@ -2,12 +2,8 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using C1.Win.C1FlexGrid;
|
||||
using System.IO;
|
||||
using Itenso.Rtf;
|
||||
using Itenso.Rtf.Parser;
|
||||
using Itenso.Rtf.Interpreter;
|
||||
using Itenso.Rtf.Support;
|
||||
using Volian.Print.Library;
|
||||
using Volian.Controls.Library;
|
||||
using iTextSharp.text;
|
||||
using iTextSharp.text.pdf;
|
||||
@@ -19,137 +15,35 @@ namespace Volian.Print.Library
|
||||
#region Settings // RHM20150429 - Table Scrunch
|
||||
public partial class vlnTable
|
||||
{
|
||||
private string _DebugInfo = null; // RHM20150429 - Table Scrunch
|
||||
public string DebugInfo
|
||||
{
|
||||
get { return _DebugInfo; }
|
||||
set { _DebugInfo = value; }
|
||||
}
|
||||
private int _ItemID = 0;
|
||||
public int ItemID
|
||||
{
|
||||
get { return _ItemID; }
|
||||
set { _ItemID = value; }
|
||||
}
|
||||
private bool _ShowDetails = false;
|
||||
public bool ShowDetails
|
||||
{
|
||||
get { return _ShowDetails; }
|
||||
set { _ShowDetails = value; }
|
||||
}
|
||||
private bool _IsTooBig = false;
|
||||
public bool IsTooBig
|
||||
{
|
||||
get { return _IsTooBig; }
|
||||
set { _IsTooBig = value; }
|
||||
}
|
||||
}
|
||||
public partial class vlnCells
|
||||
{
|
||||
private static float YAdjust_HContent = 4; // 4
|
||||
private float YAdjust_SpacingAfter
|
||||
{
|
||||
get
|
||||
{
|
||||
return 8-8*MyTable.Adjustment;//0; // 8
|
||||
}
|
||||
}
|
||||
public string DebugInfo { get; set; } = null;
|
||||
public int ItemID { get; set; } = 0;
|
||||
public bool ShowDetails { get; set; } = false;
|
||||
public bool IsTooBig { get; set; } = false;
|
||||
}
|
||||
public partial class vlnCell
|
||||
{
|
||||
#region Log4Net
|
||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
#endregion
|
||||
public bool ShowDetails
|
||||
{ get { return MyTable.ShowDetails; } }
|
||||
private static float YAdjust_h = 0; // 0
|
||||
private float YAdjust_TextLocation
|
||||
{
|
||||
get
|
||||
{
|
||||
return 4 - 4 * MyTable.Adjustment; ;//0; // 4
|
||||
public bool ShowDetails => MyTable.ShowDetails;
|
||||
private static readonly float YAdjust_h = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
//public partial class vlnTable
|
||||
//{
|
||||
// private static float YAdjust_RowTop = 0;//8; // 0
|
||||
//}
|
||||
//public partial class vlnCells
|
||||
//{
|
||||
// private static float YAdjust_HContent = 4; // 4
|
||||
// private static float YAdjust_SpacingAfter = 8;//0; // 8
|
||||
//}
|
||||
//public partial class vlnCell
|
||||
//{
|
||||
// private static float YAdjust_h = 0; // 0
|
||||
// private static float YAdjust_TextLocation = 4;//0; // 4
|
||||
//}
|
||||
#endregion
|
||||
public partial class vlnTable
|
||||
{
|
||||
#region Properties
|
||||
// HContents: For each row, contains the largest height for all columns in that row.
|
||||
// Merged cells are accounted for. This is done in vlnCells:SetupCells
|
||||
private float[] _HContents;// RHM20150525 - Table Scrunch
|
||||
public float[] HContents
|
||||
{
|
||||
get { return _HContents; }
|
||||
set { _HContents = value; }
|
||||
}
|
||||
private float[] _RowTop;
|
||||
public float[] RowTop
|
||||
{
|
||||
get { return _RowTop; }
|
||||
set { _RowTop = value; }
|
||||
}
|
||||
private float[] _ColLeft;
|
||||
public float[] ColLeft
|
||||
{
|
||||
get { return _ColLeft; }
|
||||
set { _ColLeft = value; }
|
||||
}
|
||||
private VlnFlexGrid _MyFlexGrid;
|
||||
public VlnFlexGrid MyFlexGrid
|
||||
{
|
||||
get { return _MyFlexGrid; }
|
||||
set { _MyFlexGrid = value; }
|
||||
}
|
||||
private VlnBorders _MyBorders;
|
||||
public VlnBorders MyBorders
|
||||
{
|
||||
get { return _MyBorders; }
|
||||
set { _MyBorders = value; }
|
||||
}
|
||||
// C2021-004 Table cell shading
|
||||
private VlnGridCellShading _MyShading;
|
||||
public VlnGridCellShading MyShading
|
||||
{
|
||||
get { return _MyShading; }
|
||||
set { _MyShading = value; }
|
||||
}
|
||||
private iTextSharp.text.pdf.PdfContentByte _MyContentByte;
|
||||
public iTextSharp.text.pdf.PdfContentByte MyContentByte
|
||||
{
|
||||
get { return _MyContentByte; }
|
||||
set { _MyContentByte = value; }
|
||||
}
|
||||
private vlnCells _MyCells;
|
||||
public vlnCells MyCells
|
||||
{
|
||||
get { return _MyCells; }
|
||||
set { _MyCells = value; }
|
||||
}
|
||||
public float Height
|
||||
{ get
|
||||
{
|
||||
return RowTop[RowTop.Length - 1];
|
||||
} }
|
||||
public float Width
|
||||
{ get
|
||||
{
|
||||
return ColLeft[ColLeft.Length - 1];
|
||||
} }
|
||||
public float[] HContents { get; set; }
|
||||
public float[] RowTop { get; set; }
|
||||
public float[] ColLeft { get; set; }
|
||||
public VlnFlexGrid MyFlexGrid { get; set; }
|
||||
public VlnBorders MyBorders { get; set; }
|
||||
public VlnGridCellShading MyShading { get; set; }
|
||||
public iTextSharp.text.pdf.PdfContentByte MyContentByte { get; set; }
|
||||
public vlnCells MyCells { get; set; }
|
||||
public float Height => RowTop[RowTop.Length - 1];
|
||||
public float Width => ColLeft[ColLeft.Length - 1];
|
||||
|
||||
private static float _XOffset = -1; // This moves the borders with respect to the text
|
||||
public static float XOffset
|
||||
@@ -186,7 +80,7 @@ namespace Volian.Print.Library
|
||||
get { return (LineThicknessForThick - LineThicknessForDouble) / 2; }//LineThicknessForThick - 2 * LineThicknessForDouble; }
|
||||
}
|
||||
private float _TotalContentHeight = 0;// RHM20150525 - Table Scrunc
|
||||
// TotalContentHeight - height of just the content of all rows in the table.
|
||||
|
||||
public float TotalContentHeight
|
||||
{
|
||||
get
|
||||
@@ -199,20 +93,18 @@ namespace Volian.Print.Library
|
||||
return _TotalContentHeight;
|
||||
}
|
||||
}
|
||||
public float SpaceAvailable// RHM20150525 - Table Scrunc
|
||||
{
|
||||
|
||||
// RHM20150525 - Table Scrunc
|
||||
// SpaceAvailable is the amount of white space there is to work with. It uses the bottom location
|
||||
// of the table and subtracts how much height the actual contents take, TotalContentHeight. TotalContentHeight
|
||||
// includes size/height (font size - assumes 12, 6LPI) of text & leading (space between lines)
|
||||
get { return TotalContentHeight ==0 ? 0 : RowTop[RowTop.Length - 1] - TotalContentHeight; }
|
||||
}
|
||||
public float LeadingSpaceAvailable// B2018-085 - Table Scrunch Fix:
|
||||
{
|
||||
public float SpaceAvailable => TotalContentHeight == 0 ? 0 : RowTop[RowTop.Length - 1] - TotalContentHeight;
|
||||
|
||||
// B2018-085 - Table Scrunch Fix:
|
||||
// LeadingSpaceAvailable is the amount of 'blank' space between lines, this is included in TotalContentHeight.
|
||||
// 1.5 is difference between 12 and 13.5, 12 is the standard font size, i.e. 6LPI. 13.5 is line leading.
|
||||
// 1.5/13.5 is amount of space used by leading.
|
||||
get { return TotalContentHeight == 0 ? 0 : TotalContentHeight * 1.5F/13.5F; }
|
||||
}
|
||||
public float LeadingSpaceAvailable => TotalContentHeight == 0 ? 0 : TotalContentHeight * 1.5F / 13.5F;
|
||||
// TooBig is the amount that the grid is over the amount of space on the page. To start (value in TooBig), it is set to
|
||||
// (height of grid w/ compressed setting if needed + line) - (how much room on page), i.e. negative number if it can fit
|
||||
private float _TooBig;// RHM20150525 - Table Scrunc
|
||||
@@ -222,6 +114,7 @@ namespace Volian.Print.Library
|
||||
set
|
||||
{
|
||||
_TooBig = value;
|
||||
//Debugging
|
||||
//_Adjustment = Math.Min(1F, (_TooBig / (RowTop.Length - 1)) / 12);
|
||||
//if (ShowDetails) Console.WriteLine("TooBig\t{0}\t{1}", value, _Adjustment);
|
||||
//if(ShowDetails) Console.WriteLine("Before RowTop={0}", RowTop[RowTop.Length-1] );
|
||||
@@ -252,20 +145,9 @@ namespace Volian.Print.Library
|
||||
//if(ShowDetails) Console.WriteLine("After RowTop={0}", RowTop[RowTop.Length-1] );
|
||||
}
|
||||
}
|
||||
private float _Adjustment = 0;// RHM20150525 - Table Scrunc
|
||||
public float Adjustment
|
||||
{
|
||||
get { return _Adjustment; }
|
||||
set { _Adjustment = value; }
|
||||
}
|
||||
//private float _YAdjust_RowTop = 0;//8; // 0
|
||||
public float YAdjust_RowTop
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Adjustment * 12;
|
||||
}
|
||||
}
|
||||
|
||||
public float Adjustment { get; set; } = 0;
|
||||
public float YAdjust_RowTop => Adjustment * 12;
|
||||
private void DrawRuler(PdfContentByte cb, float x, float yTop, float height)// RHM20150525 - Table Scrunc
|
||||
{
|
||||
VlnSvgPageHelper myPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper;
|
||||
@@ -290,7 +172,7 @@ namespace Volian.Print.Library
|
||||
cb.LineTo(x, y);
|
||||
cb.Stroke();
|
||||
}
|
||||
i = 0;
|
||||
|
||||
cb.Stroke();
|
||||
cb.RestoreState();
|
||||
cb.EndLayer();
|
||||
@@ -321,13 +203,8 @@ namespace Volian.Print.Library
|
||||
myItemInfo.StepLevel, myItemInfo.ShortPath, Width, XOffset, YOffset);
|
||||
}
|
||||
#endregion
|
||||
private string _Path;
|
||||
|
||||
public string Path
|
||||
{
|
||||
get { return _Path; }
|
||||
set { _Path = value; }
|
||||
}
|
||||
public string Path { get; set; }
|
||||
|
||||
#region Constructors
|
||||
public vlnTable(VlnFlexGrid myFlexGrid, iTextSharp.text.pdf.PdfContentByte myContentByte)
|
||||
@@ -374,7 +251,7 @@ public string Path
|
||||
string myLPI = myPageHelper.YMultiplier == 1.0F ? ",6LPI" : ",7LPI";
|
||||
Rtf2Pdf.DrawPdfDebug(myColumnText.Canvas, left-2, top+1, left + Width, top-myPageHelper.YMultiplier *(Height+1),
|
||||
DebugInfo+", Height= " + (myPageHelper.YMultiplier * Height).ToString() + myLPI, 0);
|
||||
PdfLayer textLayer = myPageHelper == null ? null : myPageHelper.TextLayer; // RHM20150429 - Table Scrunch
|
||||
PdfLayer textLayer = myPageHelper?.TextLayer; // RHM20150429 - Table Scrunch
|
||||
if (textLayer != null) cb.BeginLayer(textLayer);
|
||||
myPageHelper.AddGap(top, top - Height, left, left + Width);
|
||||
MyCells.ToPdf(myColumnText, left, top);
|
||||
@@ -383,6 +260,7 @@ public string Path
|
||||
ShowRowTops("ToPDF2");
|
||||
if (ShowDetails) Console.WriteLine("^^^^^^ToPdf============{0}===============", ItemID);
|
||||
}
|
||||
//For Debugging
|
||||
private void ZoomGrid(iTextSharp.text.pdf.ColumnText myColumnText, float left, float top)
|
||||
{
|
||||
PdfDestination dest = new PdfDestination(PdfDestination.FITR, left - 4, top - Height - 4, left + Width, top + 4);
|
||||
@@ -396,26 +274,12 @@ public string Path
|
||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
#endregion
|
||||
#region Properties
|
||||
private VlnFlexGrid _MyFlexGrid;
|
||||
public VlnFlexGrid MyFlexGrid
|
||||
{
|
||||
get { return _MyFlexGrid; }
|
||||
set { _MyFlexGrid = value; }
|
||||
}
|
||||
private vlnTable _MyTable;
|
||||
public vlnTable MyTable
|
||||
{
|
||||
get { return _MyTable; }
|
||||
set { _MyTable = value; }
|
||||
}
|
||||
public VlnFlexGrid MyFlexGrid { get; set; }
|
||||
public vlnTable MyTable { get; set; }
|
||||
public bool ShowDetails// RHM20150525 - Table Scrunc
|
||||
{ get { return MyTable.ShowDetails; }}
|
||||
private iTextSharp.text.pdf.PdfContentByte _MyContentByte;
|
||||
public iTextSharp.text.pdf.PdfContentByte MyContentByte
|
||||
{
|
||||
get { return _MyContentByte; }
|
||||
set { _MyContentByte = value; }
|
||||
}
|
||||
|
||||
public iTextSharp.text.pdf.PdfContentByte MyContentByte { get; set; }
|
||||
#endregion
|
||||
#region Constructors
|
||||
public vlnCells(vlnTable myTable, VlnFlexGrid myFlexGrid, iTextSharp.text.pdf.PdfContentByte myContentByte)
|
||||
@@ -424,26 +288,11 @@ public string Path
|
||||
MyFlexGrid = myFlexGrid;
|
||||
MyContentByte = myContentByte;
|
||||
SetupCells();
|
||||
foreach(vlnCell cell in this)
|
||||
{
|
||||
myTable.MyShading = VlnGridCellShading.Get(myFlexGrid.MyShading.ConvertToString()); // C2021-004 Table Cell Shading
|
||||
myTable.MyBorders = VlnBorders.Get(myFlexGrid.MyBorders.ConvertToString());
|
||||
GridLinePattern glp = cell.AboveLeftSide;
|
||||
glp = cell.AboveRightSide;
|
||||
glp = cell.BelowLeftSide;
|
||||
glp = cell.BelowRightSide;
|
||||
glp = cell.RightOfBottomSide;
|
||||
glp = cell.RightOfTopSide;
|
||||
object ta = cell.TextAlign;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
private float _MyLeading = 13.5F; // B2018-085 AEP and APP worked with 13.5
|
||||
public float MyLeading
|
||||
{
|
||||
get { return _MyLeading; }
|
||||
set { _MyLeading = value; }
|
||||
}
|
||||
public float MyLeading { get; set; } = 13.5F;
|
||||
#region Private Methods
|
||||
private void SetupCells()
|
||||
{
|
||||
@@ -527,7 +376,7 @@ public string Path
|
||||
myColumnText1.AddElement(myPara);
|
||||
|
||||
float posBefore = myColumnText1.YLine; // position is y of top of paragraph since paragraph was just added
|
||||
int status = myColumnText1.Go(true); // 'puts out' text for info only
|
||||
_ = myColumnText1.Go(true); // 'puts out' text for info only
|
||||
float posAfter = myColumnText1.YLine; // posAfter is y of bottom of paragraph, really y top of line below this
|
||||
|
||||
float hContent = 4 + posBefore - posAfter;
|
||||
@@ -566,6 +415,7 @@ public string Path
|
||||
}
|
||||
}
|
||||
}
|
||||
//For Debugging:
|
||||
// This summarizes the Content heights per row
|
||||
//int i=0;
|
||||
//foreach (float h in MyTable.HContents)
|
||||
@@ -580,41 +430,6 @@ public string Path
|
||||
return total;
|
||||
}
|
||||
|
||||
// B2017-105 if a symbol character was set to a bigger font size, then the positioning of the larger symbol character was printing too high on the line
|
||||
// found with Wolf Creek use of the empty box symbol
|
||||
//private float BiggestFontSize(Paragraph myPara)
|
||||
//{
|
||||
// float fontSize = 12;
|
||||
// foreach (Chunk ck in myPara.Chunks)
|
||||
// {
|
||||
// fontSize = Math.Max(fontSize, ck.Font.Size);
|
||||
// if (ck.Font.Size > 12)
|
||||
// {
|
||||
// ck.SetTextRise(-2f);
|
||||
// //_MyLog.WarnFormat("set text rise");
|
||||
// }
|
||||
// }
|
||||
// return fontSize;
|
||||
//}
|
||||
// B2017-233, B2017-234 needed to get the smallest font size to help decide if a vertical adjustment of the text is needed in a table cell
|
||||
//private float SmallestFontSize(Paragraph myPara)
|
||||
//{
|
||||
// float fontSize = 30;
|
||||
// foreach (Chunk ck in myPara.Chunks)
|
||||
// {
|
||||
// fontSize = Math.Min(fontSize, ck.Font.Size);
|
||||
// }
|
||||
// return fontSize;
|
||||
//}
|
||||
//private void ShowChunks(System.Collections.ArrayList chunks) // RHM20150429 - Table Scrunch
|
||||
//{
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
// foreach (Chunk chk in chunks)
|
||||
// {
|
||||
// sb.Append(BuildChunks(chk.Content));
|
||||
// }
|
||||
// //if (ShowDetails) Console.WriteLine("Chunks = '{0}'", sb.ToString());
|
||||
//}
|
||||
private string BuildChunks(string str)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
@@ -625,32 +440,14 @@ public string Path
|
||||
else
|
||||
sb.Append(c);
|
||||
}
|
||||
return "{" + sb.ToString() + "}";
|
||||
return $"{{{sb}}}";
|
||||
}
|
||||
private void TrimNewlines(Paragraph myPara)
|
||||
{
|
||||
while (myPara.Count > 0 && ParaEndsWithNewLine(myPara))
|
||||
myPara.RemoveAt(myPara.Count - 1);
|
||||
}
|
||||
private bool ParaEndsWithNewLine(Paragraph myPara)
|
||||
{
|
||||
Chunk chk = myPara[myPara.Count - 1] as Chunk;
|
||||
if (chk == null) return false;
|
||||
if (chk.Content == "\n") return true;
|
||||
return false;
|
||||
}
|
||||
public class VlnSplitCharacter : ISplitCharacter
|
||||
{
|
||||
public bool IsSplitCharacter(int start, int current, int end, char[] cc, PdfChunk[] ck)
|
||||
{
|
||||
return (cc[current] == ' ');
|
||||
}
|
||||
public bool IsSplitCharacter(char c)
|
||||
{
|
||||
return (c == ' ');
|
||||
}
|
||||
}
|
||||
public static VlnSplitCharacter mySplitter = new VlnSplitCharacter();
|
||||
private bool ParaEndsWithNewLine(Paragraph myPara) => myPara[myPara.Count - 1] is Chunk chk && chk.Content == "\n";
|
||||
internal static void FixHyphens(Paragraph myPara, vlnTable myTable)
|
||||
{
|
||||
// Find chunk with hardhyphen
|
||||
@@ -658,10 +455,9 @@ public string Path
|
||||
// If a hard hyphen is found, the remove it and add a dash (keyboard minus sign) to the beginning
|
||||
// of the text that follows it.
|
||||
int hype=-1;
|
||||
Font fnt = null;
|
||||
while ((hype = GetHyphen(myPara)) > -1)
|
||||
{
|
||||
fnt = null;
|
||||
Font fnt = null;
|
||||
if (hype > 0)
|
||||
{
|
||||
Chunk chk1 = (Chunk)myPara[hype - 1];
|
||||
@@ -755,10 +551,9 @@ public string Path
|
||||
// If a backslash symbold is found, the remove it and add a backslash (keyboard char) to the beginning
|
||||
// of the text that follows it.
|
||||
int bckSlsh = -1;
|
||||
Font fnt = null;
|
||||
while ((bckSlsh = GetBackslash(myPara)) > -1)
|
||||
{
|
||||
fnt = null;
|
||||
Font fnt = null;
|
||||
if (bckSlsh > 0)
|
||||
{
|
||||
Chunk chk1 = (Chunk)myPara[bckSlsh - 1];
|
||||
@@ -850,15 +645,9 @@ public string Path
|
||||
// This piece of code checks for the existance of a font definition of \f1 which is need for the \u9999? indent character
|
||||
// If the a font definition of \f1 is not found then the indent character is removed. This will allow the procedure to print
|
||||
// but the text in that table cell will not be indented. - jsj 10/10/2014
|
||||
// add the symbol font and then surround the indent.
|
||||
//IRtfDocument rtfDoc2 = RtfInterpreterTool.BuildDoc(rtf.Replace(@"\'05", @"\f1 \u9999? \f0 "));
|
||||
IRtfDocument rtfDoc2 = null;
|
||||
//if (rtf.Contains(@"\f1\fnil\fcharset0 "))
|
||||
// rtfDoc2 = RtfInterpreterTool.BuildDoc(rtf.Replace(@"\'05", @"\f1 \u9999? \f0 "));
|
||||
//else
|
||||
//{
|
||||
// first add the symbol font and then surround the indent as above.
|
||||
rtfDoc2 = RtfInterpreterTool.BuildDoc(rtf.Replace(@"\'05", @"\par\u9999?\par"));
|
||||
//}
|
||||
IRtfDocument rtfDoc2 = RtfInterpreterTool.BuildDoc(rtf.Replace(@"\'05", @"\par\u9999?\par"));
|
||||
|
||||
Rtf2iTextSharp rtf2IText2 = new Rtf2iTextSharp(rtfDoc2);
|
||||
iTextSharp.text.Paragraph para2 = rtf2IText2.Convert();
|
||||
@@ -883,7 +672,7 @@ public string Path
|
||||
return chkW;
|
||||
}
|
||||
|
||||
private static StepRTB _StatRTB = new StepRTB();
|
||||
private static readonly StepRTB _StatRTB = new StepRTB();
|
||||
private string PreProcessRTF(float w, string str)
|
||||
{
|
||||
_StatRTB.Text = string.Empty;
|
||||
@@ -912,25 +701,7 @@ public string Path
|
||||
_StatRTB.Text = str;
|
||||
_StatRTB.SelectAll();
|
||||
_StatRTB.SelectionColor = PrintOverride.OverrideTextColor(System.Drawing.Color.Black);
|
||||
str = _StatRTB.Rtf;
|
||||
// RHM 20180607 The following lines calculated line spacing but it did not give consistent values
|
||||
//System.Drawing.Point location0 = _StatRTB.GetPositionFromCharIndex(0);
|
||||
//int ii = 1;
|
||||
//System.Drawing.Point locnext = location0;
|
||||
//while (ii < 1000 && (locnext = _StatRTB.GetPositionFromCharIndex(ii)).Y == location0.Y)
|
||||
// ii++;
|
||||
//if (ii < 1000)
|
||||
//{
|
||||
// myLeading = (locnext.Y - location0.Y) * 72.0F / 96.0F;
|
||||
// Console.WriteLine("{0} - {1}", _StatRTB.Font, myLeading);
|
||||
//}
|
||||
//else
|
||||
// myLeading = 12.0F;
|
||||
// myLeading = 13.5F; // RHM 20180607 This worked for AEP
|
||||
// RHM 20180607 The following did not work
|
||||
//RTBAPI.ParaFormatTwo pft = RTBAPI.GetParaFormat(_StatRTB);
|
||||
//myLeading = Math.Max(12.0F, pft.dyLineSpacing);
|
||||
return str;
|
||||
return _StatRTB.Rtf;
|
||||
}
|
||||
private iTextSharp.text.Paragraph RtfToParagraph(string rtf, iTextSharp.text.Font mySymFont,int r, int c)
|
||||
{
|
||||
@@ -940,10 +711,11 @@ public string Path
|
||||
rtf = rtf.Replace(@"\_", "-").Replace(@"\u8209?", "-");
|
||||
rtf = FixRTFToPrint(rtf, r, c);
|
||||
IRtfDocument rtfDoc = RtfInterpreterTool.BuildDoc(rtf);
|
||||
Rtf2iTextSharp rtf2IText = new Rtf2iTextSharp(rtfDoc);
|
||||
rtf2IText.DefaultFont = mySymFont;
|
||||
Rtf2iTextSharp rtf2IText = new Rtf2iTextSharp(rtfDoc)
|
||||
{
|
||||
DefaultFont = mySymFont
|
||||
};
|
||||
iTextSharp.text.Paragraph para = rtf2IText.Convert();
|
||||
//para.SetLeading(MyLeading , 0);// RHM 20180607 Not Needed - performed in SetupCells
|
||||
return para;
|
||||
}
|
||||
// The text font used in FixRTFToPrint for grid
|
||||
@@ -1011,7 +783,6 @@ public string Path
|
||||
// follow through in fixing an Out of Window Handles bug, use new function to see if
|
||||
// we can retrieve the font from a dictionary instead a doing a New and using another
|
||||
// window handle B2017-117
|
||||
//rtb.SelectionFont = new System.Drawing.Font(DefaultFont, fnt.Style);
|
||||
rtb.SelectionFont = VE_Font.GetWinSysFont(DefaultFont, fnt.Style);
|
||||
changed = true;
|
||||
}
|
||||
@@ -1027,8 +798,7 @@ public string Path
|
||||
{
|
||||
//use bolding underline italics from local font
|
||||
System.Drawing.Font fnt = rtb.SelectionFont;
|
||||
//System.Drawing.Font fntw = new System.Drawing.Font((rc.Family != null) ? rc.Family : fnt.FontFamily.Name, (rc.Size != null) ? (float)rc.Size : fnt.Size, (rc.Style != null) ? (System.Drawing.FontStyle)rc.Style : fnt.Style);
|
||||
System.Drawing.Font fntw = VE_Font.GetWinSysFont((rc.Family != null) ? rc.Family : fnt.FontFamily.Name, (rc.Size != null) ? (float)rc.Size : fnt.Size, (rc.Style != null) ? (System.Drawing.FontStyle)rc.Style : fnt.Style);
|
||||
System.Drawing.Font fntw = VE_Font.GetWinSysFont(rc.Family ?? fnt.FontFamily.Name, (rc.Size != null) ? (float)rc.Size : fnt.Size, (rc.Style != null) ? (System.Drawing.FontStyle)rc.Style : fnt.Style);
|
||||
rtb.SelectionFont = fntw;
|
||||
if (rc.Replace != null)
|
||||
{
|
||||
@@ -1047,7 +817,6 @@ public string Path
|
||||
}
|
||||
return rtf;
|
||||
}
|
||||
private static float _SixLinesPerInch = 12; // twips
|
||||
#endregion
|
||||
#region Public Methods
|
||||
// C2021-005 Get the largest font size being used.
|
||||
@@ -1117,56 +886,16 @@ public string Path
|
||||
public partial class vlnCell // RHM20150429 - Table Scrunch
|
||||
{
|
||||
#region Properties
|
||||
private vlnTable _MyTable;
|
||||
public vlnTable MyTable
|
||||
{
|
||||
get { return _MyTable; }
|
||||
set { _MyTable = value; }
|
||||
}
|
||||
public VlnBorders MyBorders
|
||||
{
|
||||
get { return _MyTable.MyBorders; }
|
||||
}
|
||||
private int _r1;
|
||||
public int r1
|
||||
{
|
||||
get { return _r1; }
|
||||
set { _r1 = value; }
|
||||
}
|
||||
private int _c1;
|
||||
public int c1
|
||||
{
|
||||
get { return _c1; }
|
||||
set { _c1 = value; }
|
||||
}
|
||||
private int _r2;
|
||||
public int r2
|
||||
{
|
||||
get { return _r2; }
|
||||
set { _r2 = value; }
|
||||
}
|
||||
private int _c2;
|
||||
public int c2
|
||||
{
|
||||
get { return _c2; }
|
||||
set { _c2 = value; }
|
||||
}
|
||||
private iTextSharp.text.Paragraph _MyPara;
|
||||
public iTextSharp.text.Paragraph MyPara
|
||||
{
|
||||
get { return _MyPara; }
|
||||
set { _MyPara = value; }
|
||||
}
|
||||
private float _HContent;
|
||||
public float HContent
|
||||
{
|
||||
get { return _HContent; }
|
||||
set { _HContent = value; }
|
||||
}
|
||||
public VlnGridCellShading MyShading
|
||||
{
|
||||
get { return _MyTable.MyShading; }
|
||||
}
|
||||
public vlnTable MyTable { get; set; }
|
||||
public VlnBorders MyBorders => MyTable.MyBorders;
|
||||
|
||||
public int r1 { get; set; }
|
||||
public int c1 { get; set; }
|
||||
public int r2 { get; set; }
|
||||
public int c2 { get; set; }
|
||||
public iTextSharp.text.Paragraph MyPara { get; set; }
|
||||
public float HContent { get; set; }
|
||||
public VlnGridCellShading MyShading => MyTable.MyShading;
|
||||
#endregion
|
||||
#region Line Pattern Diagram
|
||||
/*
|
||||
@@ -1410,22 +1139,22 @@ public string Path
|
||||
}
|
||||
#endregion
|
||||
#region Static Properties
|
||||
private static float XOffset { get { return vlnTable.XOffset; } }
|
||||
private static float YOffset { get { return vlnTable.YOffset; } }
|
||||
private static float LineThicknessForThin { get { return vlnTable.LineThicknessForThin; } }
|
||||
private static float LineThicknessForThick { get { return vlnTable.LineThicknessForThick; } }
|
||||
private static float LineThicknessForDouble { get { return vlnTable.LineThicknessForDouble; } }
|
||||
private static float DoubleLineOffset { get { return vlnTable.DoubleLineOffset; } }
|
||||
private static float XOffset => vlnTable.XOffset;
|
||||
private static float YOffset => vlnTable.YOffset;
|
||||
private static float LineThicknessForThin => vlnTable.LineThicknessForThin;
|
||||
private static float LineThicknessForThick => vlnTable.LineThicknessForThick;
|
||||
private static float LineThicknessForDouble => vlnTable.LineThicknessForDouble;
|
||||
private static float DoubleLineOffset => vlnTable.DoubleLineOffset;
|
||||
|
||||
// adjustments for line intersections:
|
||||
private static float ThickOverDouble { get { return ((2 * DoubleLineOffset) + LineThicknessForDouble - LineThicknessForThick) / 2; } }
|
||||
private static float ThickUnderDouble { get { return DoubleLineOffset + (LineThicknessForThick - LineThicknessForDouble) / 2; } }
|
||||
private static float ThickOverThin { get { return (LineThicknessForThin - LineThicknessForThick) / 2; } }
|
||||
private static float ThinOverThick { get { return (LineThicknessForThick - LineThicknessForThin) / 2; } }
|
||||
private static float ThinUnderDouble { get { return DoubleLineOffset + (LineThicknessForThin - LineThicknessForDouble) / 2; } }
|
||||
private static float ThinOverDouble { get { return (DoubleLineOffset + LineThicknessForThin - LineThicknessForDouble) / 2; } }
|
||||
private static float DoubleUnderThin { get { return (LineThicknessForThin - LineThicknessForDouble) / 2; } }
|
||||
private static float DoubleUnderThick { get { return (LineThicknessForThick - LineThicknessForDouble) / 2; } }
|
||||
private static float ThickOverDouble => ((2 * DoubleLineOffset) + LineThicknessForDouble - LineThicknessForThick) / 2;
|
||||
private static float ThickUnderDouble => DoubleLineOffset + (LineThicknessForThick - LineThicknessForDouble) / 2;
|
||||
private static float ThickOverThin => (LineThicknessForThin - LineThicknessForThick) / 2;
|
||||
private static float ThinOverThick => (LineThicknessForThick - LineThicknessForThin) / 2;
|
||||
private static float ThinUnderDouble => DoubleLineOffset + (LineThicknessForThin - LineThicknessForDouble) / 2;
|
||||
private static float ThinOverDouble => (DoubleLineOffset + LineThicknessForThin - LineThicknessForDouble) / 2;
|
||||
private static float DoubleUnderThin => (LineThicknessForThin - LineThicknessForDouble) / 2;
|
||||
private static float DoubleUnderThick => (LineThicknessForThick - LineThicknessForDouble) / 2;
|
||||
#endregion
|
||||
#region Constructors
|
||||
public vlnCell(int r1, int c1, int r2, int c2, vlnTable myTable, iTextSharp.text.Paragraph myPara, float hContent)
|
||||
@@ -1440,16 +1169,11 @@ public string Path
|
||||
}
|
||||
#endregion
|
||||
#region Public Methods
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0}:{1}", r1, c1);
|
||||
}
|
||||
// B2018-003 - RHM 20180319 Add
|
||||
public override string ToString() => string.Format("{0}:{1}", r1, c1);
|
||||
public void PdfDebug(iTextSharp.text.pdf.ColumnText myColumnText, float x, float bottom, float right, float y, string debugText, float yDescent)
|
||||
{
|
||||
PdfContentByte cb = myColumnText.Canvas;
|
||||
VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper;
|
||||
PdfLayer debugLayer = _MyPageHelper == null ? null : _MyPageHelper.DebugLayer;
|
||||
PdfLayer debugLayer = !(cb.PdfWriter.PageEvent is VlnSvgPageHelper _MyPageHelper) ? null : _MyPageHelper.DebugLayer;
|
||||
if (debugLayer == null) return;
|
||||
System.Drawing.Color sysColor = PrintOverride.OverrideDebugColor(System.Drawing.Color.Gray);
|
||||
cb.SaveState();
|
||||
@@ -1481,7 +1205,6 @@ public string Path
|
||||
cb.EndLayer();
|
||||
cb.RestoreState();
|
||||
}
|
||||
//RHM 20180319 End of Add
|
||||
// B2021-137 Added doShading parameter
|
||||
// We call this twice. The first time to print the shading the second time to print the borders and text
|
||||
public void ToPdf(iTextSharp.text.pdf.ColumnText myColumnText, float left, float top, int topPlacementAdjust, bool doShading)
|
||||
@@ -1518,7 +1241,6 @@ public string Path
|
||||
// B2019-093 missing table cell text when printing South Texas FSG-20 step 1
|
||||
// Added two more to the last parameter of SetSimplColun (it's the ury value - upper y value)
|
||||
// this will have the cell text print a little more toward the top of the cell
|
||||
//myColumnText1.SetSimpleColumn(1 + left + x, top - y - h, left + x + w - 2, 3 + top - y - hAdjust - adjustTextLocation); // 2 == Default Padding
|
||||
// B2019-109 Adjusted width of cell to match edit cell
|
||||
// B2020-034 - use the passed in topPlacementAdjust value which is set based on the font size.
|
||||
myColumnText1.SetSimpleColumn(.5F + left + x, top - y - h, left + x + w - 1.5F, topPlacementAdjust + top - y - hAdjust - adjustTextLocation); // 2 == Default Padding
|
||||
@@ -1566,7 +1288,6 @@ public string Path
|
||||
int cellStatus = myColumnText1.Go(); // B2019-109 Add to Error Log if cell too small
|
||||
if (cellStatus != 1)
|
||||
{
|
||||
//System.Windows.Forms.MessageBox.Show("Cell width too narrow \r\n" + MyTable.Path, "Narrow Cell", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
|
||||
_MyLog.WarnFormat("\r\n=-=-=-= Cell Width too narrow, text is wrapping ItemID={0} Location={1}, Row={2}, Col={3}, Status={4}",MyTable.ItemID, MyTable.Path, r1, c1, cellStatus);
|
||||
}
|
||||
float posAfter = myColumnText1.YLine; // RHM20150429 - Table Scrunch
|
||||
@@ -1606,7 +1327,6 @@ public string Path
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
private static float _SixLinesPerInch = 12; // twips
|
||||
public bool IsRangeStyleNull = false;
|
||||
private TextAlignEnum? _TextAlign = null;
|
||||
public TextAlignEnum? TextAlign
|
||||
@@ -1635,7 +1355,6 @@ public string Path
|
||||
private float VeritcalTextAlignment(float h, float mult)
|
||||
{
|
||||
float hAdjust = 0;
|
||||
//CellRange cr = MyTable.MyFlexGrid.GetCellRange(r1, c1, r2, c2);
|
||||
if (!IsRangeStyleNull)
|
||||
{
|
||||
switch (TextAlign)
|
||||
@@ -1913,28 +1632,10 @@ public string Path
|
||||
else if (linePattern == GridLinePattern.Dashed)
|
||||
cb.SetLineDash(4, 4, 0);
|
||||
}
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Keeping row and col for Debugging")]
|
||||
private static void SetLineColor(PdfContentByte cb, int row, int col, string side)
|
||||
{
|
||||
iTextSharp.text.Color lineColor = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Black));
|
||||
//switch (side)
|
||||
//{
|
||||
// case "Top":
|
||||
// if (col == 0) lineColor = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Blue));
|
||||
// else lineColor = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Cyan));
|
||||
// break;
|
||||
// case "Left":
|
||||
// if (row == 0) lineColor = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Red));
|
||||
// else lineColor = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Magenta));
|
||||
// break;
|
||||
// case "Bottom":
|
||||
// if (col == 0) lineColor = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Green));
|
||||
// else lineColor = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Cyan));
|
||||
// break;
|
||||
// case "Right":
|
||||
// if (row == 0) lineColor = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Orange));
|
||||
// else lineColor = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Magenta));
|
||||
// break;
|
||||
//}
|
||||
cb.SetColorStroke(lineColor);
|
||||
}
|
||||
private static void InitializeLineStyle(PdfContentByte cb)
|
||||
@@ -1946,8 +1647,10 @@ public string Path
|
||||
#region Debug Methods
|
||||
private static void SetOpacity(PdfContentByte cb, float opacity)
|
||||
{
|
||||
PdfGState gs = new PdfGState();
|
||||
gs.StrokeOpacity = opacity;
|
||||
PdfGState gs = new PdfGState
|
||||
{
|
||||
StrokeOpacity = opacity
|
||||
};
|
||||
cb.SetGState(gs);
|
||||
}
|
||||
private static void ZoomToCell(iTextSharp.text.pdf.ColumnText myColumnText, float xLeft, float yTop, float xRight, float yBottom)
|
||||
@@ -1956,141 +1659,5 @@ public string Path
|
||||
myColumnText.Canvas.SetAction(PdfAction.GotoLocalPage(myColumnText.Canvas.PdfWriter.CurrentPageNumber, dest, myColumnText.Canvas.PdfWriter), xLeft, yBottom, xRight, yTop);
|
||||
}
|
||||
#endregion
|
||||
#region Old Border Methods
|
||||
//private void DrawLeftLine(PdfContentByte cb, float xLeft, float yTop, float yBottom)
|
||||
//{
|
||||
// if (c1 == 0 && LineLeft != GridLinePattern.None)
|
||||
// {
|
||||
// InitializeLineStyle(cb);
|
||||
// SetLineColor(cb, r1, c1, "Left");
|
||||
// if (LineLeft == GridLinePattern.Double)
|
||||
// {
|
||||
// //Left Line
|
||||
// float dyTop = DoubleIntersectionLeft(LineTopLeft, LineTop, LineLeftAbove);
|
||||
// float dyBottom = -DoubleIntersectionRight(LineBottom, LineBottomLeft, LineLeftBelow);
|
||||
// DrawLine(cb, LineThicknessForDouble, xLeft - DoubleLineOffset, yTop + dyTop, xLeft - DoubleLineOffset, yBottom + dyBottom);
|
||||
// //Right Line
|
||||
// dyTop = DoubleIntersectionRight(LineTopLeft, LineTop, LineLeftAbove);
|
||||
// dyBottom = -DoubleIntersectionLeft(LineBottom, LineBottomLeft, LineLeftBelow);
|
||||
// DrawLine(cb, LineThicknessForDouble, xLeft + DoubleLineOffset, yTop + dyTop, xLeft + DoubleLineOffset, yBottom + dyBottom);
|
||||
// }
|
||||
// else if (LineLeft != GridLinePattern.Thick)
|
||||
// {
|
||||
// SetLinePattern(cb, LineLeft);
|
||||
// float dyTop = ThinIntersection(LineTopLeft, LineTop, LineLeftAbove);
|
||||
// float dyBottom = -ThinIntersection(LineBottom, LineBottomLeft, LineLeftBelow);
|
||||
// DrawLine(cb, LineThicknessForThin, xLeft, yTop + dyTop, xLeft, yBottom + dyBottom);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// float dyTop = ThickIntersection(LineTopLeft, LineTop, LineLeftAbove);
|
||||
// float dyBottom = -ThickIntersection(LineBottom, LineBottomLeft, LineLeftBelow);
|
||||
// DrawLine(cb, LineThicknessForThick, xLeft, yTop + dyTop, xLeft, yBottom + dyBottom);
|
||||
// }
|
||||
// cb.Stroke();
|
||||
// }
|
||||
//}
|
||||
//private void DrawRightLine(PdfContentByte cb, float xRight, float yTop, float yBottom)
|
||||
//{
|
||||
// if (LineRight != GridLinePattern.None)
|
||||
// {
|
||||
// InitializeLineStyle(cb);
|
||||
// SetLineColor(cb, r1, c1, "Right");
|
||||
// if (LineRight == GridLinePattern.Double)
|
||||
// {
|
||||
// //Left Line
|
||||
// float dyTop = DoubleIntersectionLeft(LineTop, LineTopRight, LineRightAbove);
|
||||
// float dyBottom = -DoubleIntersectionRight(LineBottomRight, LineBottom, LineRightBelow);
|
||||
// DrawLine(cb, LineThicknessForDouble, xRight - DoubleLineOffset, yTop + dyTop, xRight - DoubleLineOffset, yBottom + dyBottom);
|
||||
// //Right Line
|
||||
// dyTop = DoubleIntersectionRight(LineTop, LineTopRight, LineRightAbove);
|
||||
// dyBottom = -DoubleIntersectionLeft(LineBottomRight, LineBottom, LineRightBelow);
|
||||
// DrawLine(cb, LineThicknessForDouble, xRight + DoubleLineOffset, yTop + dyTop, xRight + DoubleLineOffset, yBottom + dyBottom);
|
||||
// }
|
||||
// else if (LineRight != GridLinePattern.Thick)
|
||||
// {
|
||||
// float dyTop = ThinIntersection(LineTop, LineTopRight, LineRightAbove);
|
||||
// float dyBottom = -ThinIntersection(LineBottomRight, LineBottom, LineRightBelow);
|
||||
// SetLinePattern(cb, LineRight);
|
||||
// DrawLine(cb, LineThicknessForThin, xRight, yTop + dyTop, xRight, yBottom + dyBottom);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// float dyTop = ThickIntersection(LineTop, LineTopRight, LineRightAbove);
|
||||
// float dyBottom = -ThickIntersection(LineBottomRight, LineBottom, LineRightBelow);
|
||||
// DrawLine(cb, LineThicknessForThick, xRight, yTop + dyTop, xRight, yBottom + dyBottom);
|
||||
// }
|
||||
// cb.Stroke();
|
||||
// }
|
||||
//}
|
||||
//private void DrawTopLine(PdfContentByte cb, float xLeft, float xRight, float yTop)
|
||||
//{
|
||||
// if (r1 == 0 && TopSide != GridLinePattern.None)
|
||||
// {
|
||||
// InitializeLineStyle(cb);
|
||||
// SetLineColor(cb, r1, c1, "Top");
|
||||
// if (TopSide == GridLinePattern.Double)
|
||||
// {
|
||||
// // Top Line
|
||||
// float dxLeft = -DoubleIntersectionRight(LeftSide, AboveLeftSide, LeftOfTopSide);
|
||||
// float dxRight = DoubleIntersectionLeft(AboveRightSide, RightSide, RightOfTopSide);
|
||||
// DrawLine(cb, LineThicknessForDouble, xLeft + dxLeft, yTop + DoubleLineOffset, xRight + dxRight, yTop + DoubleLineOffset);
|
||||
// // Bottom Line
|
||||
// dxLeft = -DoubleIntersectionLeft(LeftSide, AboveLeftSide, LeftOfTopSide);
|
||||
// dxRight = DoubleIntersectionRight(AboveRightSide, RightSide, RightOfTopSide);
|
||||
// DrawLine(cb, LineThicknessForDouble, xLeft + dxLeft, yTop - DoubleLineOffset, xRight + dxRight, yTop - DoubleLineOffset);
|
||||
// }
|
||||
// else if (TopSide != GridLinePattern.Thick)
|
||||
// {
|
||||
// SetLinePattern(cb, TopSide);
|
||||
// float dxLeft = -ThinIntersection(LeftSide, AboveLeftSide, LeftOfTopSide);
|
||||
// float dxRight = ThinIntersection(AboveRightSide, RightSide, RightOfTopSide);
|
||||
// DrawLine(cb, LineThicknessForThin, xLeft + dxLeft, yTop, xRight + dxRight, yTop);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// float dxLeft = -ThickIntersection(LeftSide, AboveLeftSide, LeftOfTopSide);
|
||||
// float dxRight = ThickIntersection(AboveRightSide, RightSide, RightOfTopSide);
|
||||
// if (c1 == 0)
|
||||
// Console.WriteLine("'{0}','{1}','{2}',{3},{4}", LeftSide, AboveLeftSide, LeftOfTopSide, dxLeft, ThickOverThin);
|
||||
// DrawLine(cb, LineThicknessForThick, xLeft + dxLeft, yTop, xRight + dxRight, yTop);
|
||||
// }
|
||||
// cb.Stroke();
|
||||
// }
|
||||
//}
|
||||
//private void DrawBottomLine(PdfContentByte cb, float xLeft, float xRight, float yBottom)
|
||||
//{
|
||||
// if (BottomSide != GridLinePattern.None)
|
||||
// {
|
||||
// InitializeLineStyle(cb);
|
||||
// SetLineColor(cb, r1, c1, "Bottom");
|
||||
// if (BottomSide == GridLinePattern.Double)
|
||||
// {
|
||||
// // Top Line
|
||||
// float dxLeft = -DoubleIntersectionRight(BelowLeftSide, LeftSide, LeftOfBottomSide);
|
||||
// float dxRight = DoubleIntersectionLeft(RightSide, BelowRightSide, RightOfBottomSide);
|
||||
// DrawLine(cb, LineThicknessForDouble, xLeft + dxLeft, yBottom + DoubleLineOffset, xRight + dxRight, yBottom + DoubleLineOffset);// Top Line
|
||||
// // Bottom Line
|
||||
// dxLeft = -DoubleIntersectionLeft(BelowLeftSide, LeftSide, LeftOfBottomSide);
|
||||
// dxRight = DoubleIntersectionRight(RightSide, BelowRightSide, RightOfBottomSide);
|
||||
// DrawLine(cb, LineThicknessForDouble, xLeft + dxLeft, yBottom - DoubleLineOffset, xRight + dxRight, yBottom - DoubleLineOffset);//Bottom Line
|
||||
// }
|
||||
// else if (BottomSide != GridLinePattern.Thick) // Bottom line is thin. Determine if intersecting with double:
|
||||
// {
|
||||
// SetLinePattern(cb, BottomSide);
|
||||
// float dxLeft = -ThinIntersection(BelowLeftSide, LeftSide, LeftOfBottomSide);
|
||||
// float dxRight = ThinIntersection(RightSide, BelowRightSide, RightOfBottomSide);
|
||||
// DrawLine(cb, LineThicknessForThin, xLeft + dxLeft, yBottom, xRight + dxRight, yBottom);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// float dxLeft = -ThickIntersection(BelowLeftSide, LeftSide, LeftOfBottomSide);
|
||||
// float dxRight = ThickIntersection(RightSide, BelowRightSide, RightOfBottomSide);
|
||||
// DrawLine(cb, LineThicknessForThick, xLeft + dxLeft, yBottom, xRight + dxRight, yBottom);
|
||||
// }
|
||||
// cb.Stroke();
|
||||
// }
|
||||
//}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
@@ -14,34 +13,15 @@ namespace Volian.Print.Library
|
||||
{
|
||||
public class MergedPdfProc
|
||||
{
|
||||
private string _Title;
|
||||
public string Title
|
||||
{
|
||||
get { return _Title; } // used for pdf outline
|
||||
set { _Title = value; }
|
||||
}
|
||||
private int _PageCount; // number of pages in the particular pdf, to aid in determining total page count for merged pdf
|
||||
public int PageCount
|
||||
{
|
||||
get { return _PageCount; }
|
||||
set { _PageCount = value; }
|
||||
}
|
||||
private string _PdfFileName; // used for finding the procedure's pdf file to merge
|
||||
public string PdfFileName
|
||||
{
|
||||
get { return _PdfFileName; }
|
||||
set { _PdfFileName = value; }
|
||||
}
|
||||
private bool _FirstPageNoPageNum = false;
|
||||
public bool FirstPageNoPageNum
|
||||
{
|
||||
get { return _FirstPageNoPageNum; }
|
||||
set { _FirstPageNoPageNum = value; }
|
||||
}
|
||||
public string Title { get; // used for pdf outline
|
||||
set; }
|
||||
public int PageCount { get; set; }
|
||||
public string PdfFileName { get; set; }
|
||||
public bool FirstPageNoPageNum { get; set; } = false;
|
||||
public MergedPdfProc(string title, string pfname)
|
||||
{
|
||||
_Title = title;
|
||||
_PdfFileName = pfname;
|
||||
Title = title;
|
||||
PdfFileName = pfname;
|
||||
}
|
||||
}
|
||||
// this class will manage the data & do subsequent merging of pdf files. It is used if the user
|
||||
@@ -49,25 +29,11 @@ namespace Volian.Print.Library
|
||||
public class MergedPdf
|
||||
{
|
||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private List<MergedPdfProc> _mergedPdfs = null; // This list has all procedure pdfs that will be included in the merged file.
|
||||
public List<MergedPdfProc> MergedPdfs
|
||||
{
|
||||
get { return _mergedPdfs; }
|
||||
set { _mergedPdfs = value; }
|
||||
}
|
||||
string _mergedFileName = null; // this is the name to be given the merged file
|
||||
public string MergedFileName
|
||||
{
|
||||
get { return _mergedFileName; }
|
||||
set { _mergedFileName = value; }
|
||||
}
|
||||
private string _folder; // this is folder to create the merged file in
|
||||
public string Folder
|
||||
{
|
||||
get { return _folder; }
|
||||
set { _folder = value; }
|
||||
}
|
||||
private DocVersionInfo _docVersionInfo;
|
||||
|
||||
public List<MergedPdfProc> MergedPdfs { get; set; } = null;
|
||||
public string MergedFileName { get; set; } = null;
|
||||
public string Folder { get; set; }
|
||||
private readonly DocVersionInfo _docVersionInfo;
|
||||
private string _pageof = null;
|
||||
private iTextSharp.text.Font _itextFont = null;
|
||||
private MergedPdfsPageNumCorner _corner;
|
||||
@@ -80,11 +46,11 @@ namespace Volian.Print.Library
|
||||
// the following constructs the class that contains data for merging a group of pdfs.
|
||||
public MergedPdf(string folder, DocVersionInfo dvi)
|
||||
{
|
||||
_folder = folder;
|
||||
Folder = folder;
|
||||
_docVersionInfo = dvi;
|
||||
}
|
||||
// the following merges the procedure pdfs into a single pdf
|
||||
public bool DoTheMerge(Dictionary<string, List<int>> MergedLandscapPages, bool generatePointListFile)
|
||||
public bool DoTheMerge(bool generatePointListFile)
|
||||
{
|
||||
if (MergedPdfs == null)
|
||||
{
|
||||
@@ -93,7 +59,7 @@ namespace Volian.Print.Library
|
||||
}
|
||||
iTextSharp.text.Document doc = new iTextSharp.text.Document();
|
||||
string slashReplace = _docVersionInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SlashReplace ?? "_";
|
||||
MergedFileName = _folder + @"\" + _docVersionInfo.MyFolder.Name.Replace("/", slashReplace).Replace("\\", slashReplace) + ".pdf";
|
||||
MergedFileName = Folder + @"\" + _docVersionInfo.MyFolder.Name.Replace("/", slashReplace).Replace("\\", slashReplace) + ".pdf";
|
||||
MergedFileName = ItemInfo.StripRtfFormatting(MergedFileName);
|
||||
// C2021-063 file name of Alarm Point List file containing Serial Number, Title, and merged Page Number
|
||||
StreamWriter sw = null;
|
||||
@@ -109,12 +75,12 @@ namespace Volian.Print.Library
|
||||
{
|
||||
writer = PdfWriter.GetInstance(doc, new FileStream(MergedFileName, FileMode.Create));
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendLine("Could not create");
|
||||
sb.AppendLine();
|
||||
sb.AppendLine(MergedFileName + ".");
|
||||
sb.AppendLine($"{MergedFileName}.");
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("If it is open, close and retry.");
|
||||
FlexibleMessageBox.Show(sb.ToString(), "Error on CreatePdf", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
@@ -136,7 +102,7 @@ namespace Volian.Print.Library
|
||||
// write Serial Number, Title, and Page Number in the Point List file
|
||||
sw.WriteLine("{0}\t{1}\t{2}", idxSerialNum++, mpp.Title, mergedPageNumber + 1);
|
||||
}
|
||||
string pdffilename = _folder + @"\" + mpp.PdfFileName;
|
||||
string pdffilename = $@"{Folder}\{mpp.PdfFileName}";
|
||||
if (!File.Exists(pdffilename))
|
||||
{
|
||||
FlexibleMessageBox.Show("Error in finding pdf files to merge. Cannot print with date/time as part of pdf name. Or check that individual pdfs were generated.", "Error on CreatePdf", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
@@ -154,7 +120,7 @@ namespace Volian.Print.Library
|
||||
PdfReader reader = null;
|
||||
try // B2019-041: added a try/catch for when a corrupt pdf was created for a procedure, just skip & add message to error log.
|
||||
{
|
||||
reader = new PdfReader(_folder + @"\" + mpp.PdfFileName);
|
||||
reader = new PdfReader($@"{Folder}\{mpp.PdfFileName}");
|
||||
int numPages = reader.NumberOfPages;
|
||||
int currentPageNumber = 0;
|
||||
PdfOutline outline = null;
|
||||
@@ -178,7 +144,7 @@ namespace Volian.Print.Library
|
||||
// if on the first page, add the pdfname & title as part of outline. If on remaining pages, just put out page number.
|
||||
// Later this may need expanded to put sections/steps/etc.
|
||||
if (currentPageNumber == 1)
|
||||
outline = new PdfOutline(canvas.RootOutline, dest, mpp.PdfFileName.Replace(".pdf", "") + " - " + mpp.Title, false);
|
||||
outline = new PdfOutline(canvas.RootOutline, dest, $"{mpp.PdfFileName.Replace(".pdf", "")} - {mpp.Title}", false);
|
||||
else
|
||||
new PdfOutline(outline, dest, "Page " + currentPageNumber.ToString(), false);
|
||||
canvas.AddTemplate(page, 0, 0); // adds the page to the combined pdf
|
||||
@@ -204,17 +170,13 @@ namespace Volian.Print.Library
|
||||
private void AddPageNumberToPage(PdfImportedPage page, PdfContentByte cb, string outputpage, bool landscape)
|
||||
{
|
||||
float pgright = page.BoundingBox.Right;
|
||||
float pgleft = page.BoundingBox.Left;
|
||||
float pgtop = page.BoundingBox.Top;
|
||||
float pgbot = page.BoundingBox.Bottom;
|
||||
MergedPdfsPageNumCorner cnr = _corner; // C2021-047: Allow for setting of Merged Pdf Landscape Page Number Location
|
||||
// B2019-152: Landscape page numbers when merging
|
||||
if (landscape)
|
||||
{
|
||||
pgright = page.BoundingBox.Top;
|
||||
pgleft = page.BoundingBox.Bottom;
|
||||
pgtop = page.BoundingBox.Right;
|
||||
pgbot = page.BoundingBox.Left;
|
||||
cnr = _landcorner; // C2021-047: Allow for setting of Merged Pdf Landscape Page Number Location
|
||||
}
|
||||
Phrase ph = new Phrase();
|
||||
@@ -281,7 +243,7 @@ namespace Volian.Print.Library
|
||||
private bool GetPageOfInfo()
|
||||
{
|
||||
DocVersionConfig dvc = (DocVersionConfig) _docVersionInfo.MyConfig;
|
||||
MergedPdfsPageOf po = dvc.Print_MergedPdfsPageOf;
|
||||
_ = dvc.Print_MergedPdfsPageOf;
|
||||
string tmp = EnumDescConverter.GetEnumDescription((Enum)dvc.Print_MergedPdfsPageOf);
|
||||
if (tmp == "None") return false; // no page number, return false so no page number is put out.
|
||||
|
||||
@@ -297,7 +259,7 @@ namespace Volian.Print.Library
|
||||
famtmp = _docVersionInfo.ActiveFormat.PlantFormat.FormatData.Font.Family;
|
||||
}
|
||||
tmp = dvc.Print_MergedPdfsPageNumFontSize;
|
||||
float? tmpi=0;
|
||||
float? tmpi;
|
||||
if (tmp == null || tmp == "")
|
||||
{
|
||||
// use the default from the format from this working draft
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6,35 +6,20 @@ using iTextSharp.text.pdf;
|
||||
using iTextSharp.text;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
using System.Linq;
|
||||
|
||||
namespace Volian.Print.Library
|
||||
{
|
||||
public class PDFConsistencyCheckReport
|
||||
{
|
||||
private DocVersionInfo _MyDocVersion;
|
||||
public DocVersionInfo MyDocVersion
|
||||
{
|
||||
get { return _MyDocVersion; }
|
||||
set { _MyDocVersion = value; }
|
||||
}
|
||||
private string _FileName;
|
||||
public string FileName
|
||||
{
|
||||
get { return _FileName; }
|
||||
set { _FileName = value; }
|
||||
}
|
||||
private ItemInfoList _MyItemInfoList;
|
||||
public ItemInfoList MyItemInfoList
|
||||
{
|
||||
get { return _MyItemInfoList; }
|
||||
set { _MyItemInfoList = value; }
|
||||
}
|
||||
public DocVersionInfo MyDocVersion { get; set; }
|
||||
public string FileName { get; set; }
|
||||
public ItemInfoList MyItemInfoList { get; set; }
|
||||
public PDFConsistencyCheckReport(string fileName, ItemInfoList myItemInfoList, DocVersionInfo myDocVersion)
|
||||
{
|
||||
_FileName = fileName;
|
||||
_MyItemInfoList = myItemInfoList;
|
||||
_MyDocVersion = myDocVersion; //B2020-020 needed to pass in DocVersion to get paper size from format
|
||||
FileName = fileName;
|
||||
MyItemInfoList = myItemInfoList;
|
||||
MyDocVersion = myDocVersion; //B2020-020 needed to pass in DocVersion to get paper size from format
|
||||
}
|
||||
public void BuildReport()
|
||||
{
|
||||
@@ -47,7 +32,6 @@ namespace Volian.Print.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
StringBuilder msg = new StringBuilder();
|
||||
document.Add(new Paragraph("Error:"));
|
||||
while (ex != null)
|
||||
{
|
||||
@@ -61,7 +45,7 @@ namespace Volian.Print.Library
|
||||
if (document.IsOpen())
|
||||
{
|
||||
document.Close();
|
||||
System.Diagnostics.Process.Start(_FileName);
|
||||
System.Diagnostics.Process.Start(FileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -73,13 +57,13 @@ namespace Volian.Print.Library
|
||||
// Try to open a file for creating the PDF.
|
||||
while (result == false)
|
||||
{
|
||||
string fileName = _FileName.ToLower().Replace(".pdf", suffix + ".pdf");
|
||||
string fileName = FileName.ToLower().Replace(".pdf", suffix + ".pdf");
|
||||
try
|
||||
{
|
||||
PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(fileName, FileMode.Create));
|
||||
document.SetMargins(36, 36, 36, 36);
|
||||
document.Open();
|
||||
_FileName = fileName;
|
||||
FileName = fileName;
|
||||
result = true;
|
||||
}
|
||||
catch (System.IO.IOException exIO)
|
||||
@@ -118,9 +102,11 @@ namespace Volian.Print.Library
|
||||
}
|
||||
private PdfPCell BlankCell(int colSpan)
|
||||
{
|
||||
PdfPCell c = new PdfPCell();
|
||||
c.Colspan = colSpan;
|
||||
c.Border = 0;
|
||||
PdfPCell c = new PdfPCell
|
||||
{
|
||||
Colspan = colSpan,
|
||||
Border = 0
|
||||
};
|
||||
return c;
|
||||
}
|
||||
private void BuildConsistencyReport(iTextSharp.text.Document doc)
|
||||
@@ -132,7 +118,6 @@ namespace Volian.Print.Library
|
||||
iTextSharp.text.Font f3 = pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 8, 0, Color.BLACK);
|
||||
iTextSharp.text.Font f4 = pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 10, 2, Color.BLACK);
|
||||
int cols = 5;
|
||||
int borders = 0;
|
||||
int paddingBottom = 6;
|
||||
// float[] widths;
|
||||
Csla.SortedBindingList<ItemInfo> sortedProcs = new Csla.SortedBindingList<ItemInfo>(MyItemInfoList);
|
||||
@@ -141,7 +126,7 @@ namespace Volian.Print.Library
|
||||
// B2019-024: First page of Report prints the title at the top and the remainder of the page is blank.
|
||||
// Check if procedure(s) are printed on that page and if not, change message to "No..." and don't do
|
||||
// pagebreak.
|
||||
foreach (ProcedureInfo pi in sortedProcs)
|
||||
foreach (ProcedureInfo pi in sortedProcs.OfType<ProcedureInfo>())
|
||||
{
|
||||
if (pi.IsSelected)
|
||||
{
|
||||
@@ -160,16 +145,20 @@ namespace Volian.Print.Library
|
||||
lbSrchResults.DataSource = sortedResults;
|
||||
*/
|
||||
|
||||
foreach (ProcedureInfo pi in sortedProcs)
|
||||
foreach (ProcedureInfo pi in sortedProcs.OfType<ProcedureInfo>())
|
||||
{
|
||||
if (pi.IsSelected)
|
||||
{
|
||||
PdfPTable tt = new PdfPTable(cols);
|
||||
tt.KeepTogether = true;
|
||||
PdfPTable tt = new PdfPTable(cols)
|
||||
{
|
||||
KeepTogether = true
|
||||
};
|
||||
tt.AddCell(AddSubTableCell(pi.DisplayNumber, f2, cols, paddingBottom));
|
||||
tt.AddCell(AddSubTableCell(pi.MyDifferencesText, f3, cols, paddingBottom));
|
||||
PdfPCell c = new PdfPCell(tt);
|
||||
c.Colspan = cols;
|
||||
PdfPCell c = new PdfPCell(tt)
|
||||
{
|
||||
Colspan = cols
|
||||
};
|
||||
t.AddCell(c);
|
||||
}
|
||||
}
|
||||
@@ -179,16 +168,20 @@ namespace Volian.Print.Library
|
||||
if (didSome) doc.NewPage();
|
||||
t = CreatePdfPTable(cols);
|
||||
CreatePageHeader(t, f1, f4, cols, paddingBottom, "Approval Consistency Report", "Procedures that should be selected to be approved in order to maintain consistency");
|
||||
foreach (ProcedureInfo pi in MyItemInfoList)
|
||||
foreach (ProcedureInfo pi in MyItemInfoList.OfType<ProcedureInfo>())
|
||||
{
|
||||
if (!pi.IsSelected)
|
||||
{
|
||||
PdfPTable tt = new PdfPTable(cols);
|
||||
tt.KeepTogether = true;
|
||||
PdfPTable tt = new PdfPTable(cols)
|
||||
{
|
||||
KeepTogether = true
|
||||
};
|
||||
tt.AddCell(AddSubTableCell(pi.DisplayNumber, f2, cols, paddingBottom));
|
||||
tt.AddCell(AddSubTableCell(pi.MyDifferencesText, f3, cols, paddingBottom));
|
||||
PdfPCell c = new PdfPCell(tt);
|
||||
c.Colspan = cols;
|
||||
PdfPCell c = new PdfPCell(tt)
|
||||
{
|
||||
Colspan = cols
|
||||
};
|
||||
t.AddCell(c);
|
||||
}
|
||||
}
|
||||
@@ -196,42 +189,54 @@ namespace Volian.Print.Library
|
||||
}
|
||||
private PdfPCell AddSubTableCell(string text, iTextSharp.text.Font f, int cols, float pb)
|
||||
{
|
||||
Phrase h = new Phrase();
|
||||
h.Font = f;
|
||||
Phrase h = new Phrase
|
||||
{
|
||||
Font = f
|
||||
};
|
||||
h.Add(text);
|
||||
PdfPCell c = new PdfPCell(h);
|
||||
c.Colspan = cols;
|
||||
c.HorizontalAlignment = Element.ALIGN_LEFT;
|
||||
c.PaddingBottom = pb;
|
||||
PdfPCell c = new PdfPCell(h)
|
||||
{
|
||||
Colspan = cols,
|
||||
HorizontalAlignment = Element.ALIGN_LEFT,
|
||||
PaddingBottom = pb
|
||||
};
|
||||
return c;
|
||||
}
|
||||
private void CreatePageHeader(PdfPTable t, iTextSharp.text.Font f1, iTextSharp.text.Font f2, int cols, float pb, string hdr1, string hdr2)
|
||||
{
|
||||
//report title
|
||||
Phrase h = new Phrase();
|
||||
h.Font = f1;
|
||||
Phrase h = new Phrase
|
||||
{
|
||||
Font = f1
|
||||
};
|
||||
h.Add(hdr1);
|
||||
PdfPCell c = new PdfPCell(h);
|
||||
c.Colspan = cols;
|
||||
c.HorizontalAlignment = Element.ALIGN_CENTER;
|
||||
c.PaddingBottom = pb;
|
||||
//c.Border = borders;
|
||||
PdfPCell c = new PdfPCell(h)
|
||||
{
|
||||
Colspan = cols,
|
||||
HorizontalAlignment = Element.ALIGN_CENTER,
|
||||
PaddingBottom = pb
|
||||
};
|
||||
t.AddCell(c);
|
||||
h = new Phrase();
|
||||
h.Font = f2;
|
||||
h = new Phrase
|
||||
{
|
||||
Font = f2
|
||||
};
|
||||
h.Add(hdr2);
|
||||
c = new PdfPCell(h);
|
||||
c.Colspan = cols;
|
||||
c.HorizontalAlignment = Element.ALIGN_CENTER;
|
||||
c.PaddingBottom = pb;
|
||||
//c.Border = borders;
|
||||
c = new PdfPCell(h)
|
||||
{
|
||||
Colspan = cols,
|
||||
HorizontalAlignment = Element.ALIGN_CENTER,
|
||||
PaddingBottom = pb
|
||||
};
|
||||
t.AddCell(c);
|
||||
t.AddCell(BlankCell(cols));
|
||||
}
|
||||
private PdfPTable CreatePdfPTable(int cols)
|
||||
{
|
||||
PdfPTable t = new PdfPTable(cols);
|
||||
t.HeaderRows = 3;
|
||||
PdfPTable t = new PdfPTable(cols)
|
||||
{
|
||||
HeaderRows = 3
|
||||
};
|
||||
t.DefaultCell.Padding = 4;
|
||||
t.WidthPercentage = 100;
|
||||
float[] widths = new float[] { 1f, 1f, 1f, 1f, 4f };
|
||||
@@ -251,7 +256,6 @@ namespace Volian.Print.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
StringBuilder msg = new StringBuilder();
|
||||
document.Add(new Paragraph("Error:"));
|
||||
while (ex != null)
|
||||
{
|
||||
@@ -265,7 +269,7 @@ namespace Volian.Print.Library
|
||||
if (document.IsOpen())
|
||||
{
|
||||
document.Close();
|
||||
System.Diagnostics.Process.Start(_FileName);
|
||||
System.Diagnostics.Process.Start(FileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -276,33 +280,40 @@ namespace Volian.Print.Library
|
||||
iTextSharp.text.Font f1 = pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 12, 1, Color.BLACK);
|
||||
iTextSharp.text.Font f2 = pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 10, 0, Color.BLACK);
|
||||
iTextSharp.text.Font f3 = pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 8, 0, Color.BLACK);
|
||||
iTextSharp.text.Font f4 = pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 10, 2, Color.BLACK);
|
||||
int cols = 3;
|
||||
int borders = 0;
|
||||
int paddingBottom = 6;
|
||||
PdfPTable t = new PdfPTable(cols);
|
||||
t.HeaderRows = 1;
|
||||
t.WidthPercentage = 100;
|
||||
PdfPTable t = new PdfPTable(cols)
|
||||
{
|
||||
HeaderRows = 1,
|
||||
WidthPercentage = 100
|
||||
};
|
||||
float[] widths = new float[] { 1f, 1f, 10f };
|
||||
t.SetWidths(widths);
|
||||
Phrase h = new Phrase();
|
||||
h.Font = f1;
|
||||
Phrase h = new Phrase
|
||||
{
|
||||
Font = f1
|
||||
};
|
||||
h.Add("Approved Procedures Inconsistencies Report");
|
||||
PdfPCell c = new PdfPCell(h);
|
||||
c.Colspan = cols;
|
||||
c.HorizontalAlignment = 1;
|
||||
PdfPCell c = new PdfPCell(h)
|
||||
{
|
||||
Colspan = cols,
|
||||
HorizontalAlignment = 1
|
||||
};
|
||||
t.AddCell(c);
|
||||
// C2021-013: Include the Procedure set name & date
|
||||
h = new Phrase();
|
||||
h.Font = f1;
|
||||
h = new Phrase
|
||||
{
|
||||
Font = f1
|
||||
};
|
||||
string tmp = MyDocVersion.MyFolder.Name + " " + DateTime.Now.ToString("M/d/yyyy");
|
||||
h.Add(tmp);
|
||||
c = new PdfPCell(h);
|
||||
c.Colspan = cols;
|
||||
c.HorizontalAlignment = 1;
|
||||
c = new PdfPCell(h)
|
||||
{
|
||||
Colspan = cols,
|
||||
HorizontalAlignment = 1
|
||||
};
|
||||
t.AddCell(c);
|
||||
Dictionary<int, string> types = new Dictionary<int, string>();
|
||||
foreach (ProcedureInfo pi in MyItemInfoList)
|
||||
foreach (ProcedureInfo pi in MyItemInfoList.OfType<ProcedureInfo>())
|
||||
{
|
||||
string type = pi.MyDifferences.ROConsistency.MyROChecks.Length > 0 ? "Reference Object Inconsistencies" : "";
|
||||
if (type != string.Empty && !types.ContainsKey(0))
|
||||
@@ -314,14 +325,17 @@ namespace Volian.Print.Library
|
||||
if (type != string.Empty && !types.ContainsKey(2))
|
||||
types.Add(2, type);
|
||||
}
|
||||
// types.Clear();
|
||||
if (types.Count == 0)
|
||||
{
|
||||
h = new Phrase();
|
||||
h.Font = f2;
|
||||
h = new Phrase
|
||||
{
|
||||
Font = f2
|
||||
};
|
||||
h.Add("No Inconsistencies");
|
||||
c = new PdfPCell(h);
|
||||
c.Colspan = cols;
|
||||
c = new PdfPCell(h)
|
||||
{
|
||||
Colspan = cols
|
||||
};
|
||||
t.AddCell(c);
|
||||
}
|
||||
else
|
||||
@@ -335,7 +349,7 @@ namespace Volian.Print.Library
|
||||
ROFSTLookup lu = rofst.GetROFSTLookup(dvi);
|
||||
if (types.ContainsKey(0))
|
||||
{
|
||||
foreach (ProcedureInfo pi in MyItemInfoList)
|
||||
foreach (ProcedureInfo pi in MyItemInfoList.OfType<ProcedureInfo>())
|
||||
{
|
||||
foreach (ROCheck roc in pi.MyDifferences.ROConsistency.MyROChecks)
|
||||
{
|
||||
@@ -364,7 +378,7 @@ namespace Volian.Print.Library
|
||||
//Dictionary<string, List<string>> trs = new Dictionary<string, List<string>>();
|
||||
if (types.ContainsKey(1))
|
||||
{
|
||||
foreach (ProcedureInfo pi in MyItemInfoList)
|
||||
foreach (ProcedureInfo pi in MyItemInfoList.OfType<ProcedureInfo>())
|
||||
{
|
||||
foreach (TransitionCheck trc in pi.MyDifferences.TransitionConsistency.MyTransitionChecks)
|
||||
{
|
||||
@@ -397,7 +411,7 @@ namespace Volian.Print.Library
|
||||
//Dictionary<string, List<string>> lds = new Dictionary<string, List<string>>();
|
||||
if (types.ContainsKey(2))
|
||||
{
|
||||
foreach (ProcedureInfo pi in MyItemInfoList)
|
||||
foreach (ProcedureInfo pi in MyItemInfoList.OfType<ProcedureInfo>())
|
||||
{
|
||||
foreach (LibDocCheck ldc in pi.MyDifferences.LibDocConsistency.MyLibDocChecks)
|
||||
{
|
||||
@@ -420,27 +434,37 @@ namespace Volian.Print.Library
|
||||
Color badColor = new Color(System.Drawing.Color.Khaki);
|
||||
if (types.ContainsKey(0))
|
||||
{
|
||||
h = new Phrase();
|
||||
h.Font = f2;
|
||||
h = new Phrase
|
||||
{
|
||||
Font = f2
|
||||
};
|
||||
h.Add(types[0]);
|
||||
c = new PdfPCell(h);
|
||||
c.Colspan = cols;
|
||||
c = new PdfPCell(h)
|
||||
{
|
||||
Colspan = cols
|
||||
};
|
||||
t.AddCell(c);
|
||||
foreach (string rotitle in ros.Keys)
|
||||
{
|
||||
t.AddCell(BlankCell(1));
|
||||
h = new Phrase();
|
||||
h.Font = f3;
|
||||
h = new Phrase
|
||||
{
|
||||
Font = f3
|
||||
};
|
||||
h.Add(rotitle);
|
||||
c = new PdfPCell(h);
|
||||
c.Colspan = cols - 1;
|
||||
c.BackgroundColor = goodColor;
|
||||
c = new PdfPCell(h)
|
||||
{
|
||||
Colspan = cols - 1,
|
||||
BackgroundColor = goodColor
|
||||
};
|
||||
t.AddCell(c);
|
||||
foreach (KeyValuePair<string,bool> d in ros[rotitle])
|
||||
{
|
||||
t.AddCell(BlankCell(2));
|
||||
h = new Phrase();
|
||||
h.Font = f3;
|
||||
h = new Phrase
|
||||
{
|
||||
Font = f3
|
||||
};
|
||||
h.Add(d.Key);
|
||||
c = new PdfPCell(h);
|
||||
if (d.Value)
|
||||
@@ -451,30 +475,39 @@ namespace Volian.Print.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
//jcb
|
||||
if (types.ContainsKey(1))
|
||||
{
|
||||
h = new Phrase();
|
||||
h.Font = f2;
|
||||
h = new Phrase
|
||||
{
|
||||
Font = f2
|
||||
};
|
||||
h.Add(types[1]);
|
||||
c = new PdfPCell(h);
|
||||
c.Colspan = cols;
|
||||
c = new PdfPCell(h)
|
||||
{
|
||||
Colspan = cols
|
||||
};
|
||||
t.AddCell(c);
|
||||
foreach (string trtitle in trs.Keys)
|
||||
{
|
||||
t.AddCell(BlankCell(1));
|
||||
h = new Phrase();
|
||||
h.Font = f3;
|
||||
h = new Phrase
|
||||
{
|
||||
Font = f3
|
||||
};
|
||||
h.Add(trtitle);
|
||||
c = new PdfPCell(h);
|
||||
c.Colspan = cols - 1;
|
||||
c.BackgroundColor = goodColor;
|
||||
c = new PdfPCell(h)
|
||||
{
|
||||
Colspan = cols - 1,
|
||||
BackgroundColor = goodColor
|
||||
};
|
||||
t.AddCell(c);
|
||||
foreach (KeyValuePair<string, bool> d in trs[trtitle])
|
||||
{
|
||||
t.AddCell(BlankCell(2));
|
||||
h = new Phrase();
|
||||
h.Font = f3;
|
||||
h = new Phrase
|
||||
{
|
||||
Font = f3
|
||||
};
|
||||
h.Add(d.Key);
|
||||
c = new PdfPCell(h);
|
||||
if (d.Value)
|
||||
@@ -488,27 +521,37 @@ namespace Volian.Print.Library
|
||||
//end jcb
|
||||
if (types.ContainsKey(2))
|
||||
{
|
||||
h = new Phrase();
|
||||
h.Font = f2;
|
||||
h = new Phrase
|
||||
{
|
||||
Font = f2
|
||||
};
|
||||
h.Add(types[2]);
|
||||
c = new PdfPCell(h);
|
||||
c.Colspan = cols;
|
||||
c = new PdfPCell(h)
|
||||
{
|
||||
Colspan = cols
|
||||
};
|
||||
t.AddCell(c);
|
||||
foreach (string ldtitle in lds.Keys)
|
||||
{
|
||||
t.AddCell(BlankCell(1));
|
||||
h = new Phrase();
|
||||
h.Font = f3;
|
||||
h = new Phrase
|
||||
{
|
||||
Font = f3
|
||||
};
|
||||
h.Add(ldtitle);
|
||||
c = new PdfPCell(h);
|
||||
c.Colspan = cols - 1;
|
||||
c.BackgroundColor = goodColor;
|
||||
c = new PdfPCell(h)
|
||||
{
|
||||
Colspan = cols - 1,
|
||||
BackgroundColor = goodColor
|
||||
};
|
||||
t.AddCell(c);
|
||||
foreach (KeyValuePair<string, bool> d in lds[ldtitle])
|
||||
{
|
||||
t.AddCell(BlankCell(2));
|
||||
h = new Phrase();
|
||||
h.Font = f3;
|
||||
h = new Phrase
|
||||
{
|
||||
Font = f3
|
||||
};
|
||||
h.Add(d.Key);
|
||||
c = new PdfPCell(h);
|
||||
if (d.Value)
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using VEPROMS.CSLA.Library;
|
||||
using System.Collections.Generic;
|
||||
using iTextSharp.text;
|
||||
|
||||
|
||||
@@ -12,7 +7,9 @@ namespace Volian.Print.Library
|
||||
public class PDFPageSize
|
||||
{
|
||||
// C2020-002 paper size is now set in the format files - this class is use to select the page size that PROMS should be using
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
|
||||
private static Dictionary<string, Rectangle> dicPDFPageSize = new Dictionary<string, Rectangle>();
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
|
||||
private static Dictionary<string, int> dicPDFPageSizePnts = new Dictionary<string, int>();
|
||||
private static void BuildPDFPageSizeDic()
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,7 @@ using VEPROMS.CSLA.Library;
|
||||
using iTextSharp.text.pdf;
|
||||
using iTextSharp.text;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Linq;
|
||||
|
||||
namespace Volian.Print.Library
|
||||
{
|
||||
@@ -13,26 +13,13 @@ namespace Volian.Print.Library
|
||||
public class PDFTransitionReport
|
||||
{
|
||||
public event TransitionReportEvent TransitionProcessed;
|
||||
private void OnTransitionProcessed(object sender, EventArgs args)
|
||||
{
|
||||
if (TransitionProcessed != null) TransitionProcessed(sender, args);
|
||||
}
|
||||
private void OnTransitionProcessed(object sender, EventArgs args) => TransitionProcessed?.Invoke(sender, args);
|
||||
public event TransitionReportEvent ProcedureProcessed;
|
||||
private void OnProcedureProcessed(object sender, EventArgs args)
|
||||
{
|
||||
if (ProcedureProcessed != null) ProcedureProcessed(sender, args);
|
||||
}
|
||||
private void OnProcedureProcessed(object sender, EventArgs args) => ProcedureProcessed?.Invoke(sender, args);
|
||||
public event TransitionReportEvent DocVersionProcessed;
|
||||
private void OnDocVersionProcessed(object sender, EventArgs args)
|
||||
{
|
||||
if (DocVersionProcessed != null) DocVersionProcessed(sender, args);
|
||||
}
|
||||
private string _FileName;
|
||||
public string FileName
|
||||
{
|
||||
get { return _FileName; }
|
||||
set { _FileName = value; }
|
||||
}
|
||||
private void OnDocVersionProcessed(object sender, EventArgs args) => DocVersionProcessed?.Invoke(sender, args);
|
||||
|
||||
public string FileName { get; set; }
|
||||
private PdfPCell _CurrentPageNumberCell = null;
|
||||
private int _CurrentPageNumber = 1;
|
||||
public int CurrentPageNumber
|
||||
@@ -51,41 +38,27 @@ namespace Volian.Print.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
private FolderInfo folderInfo;
|
||||
private readonly FolderInfo folderInfo;
|
||||
private ProcedureInfo procedureInfo;
|
||||
private TransitionInfoList transitionInfoList;
|
||||
private int _TransitionInfoCount;
|
||||
public int TransitionInfoCount
|
||||
{
|
||||
get { return _TransitionInfoCount; }
|
||||
set { _TransitionInfoCount = value; }
|
||||
}
|
||||
private List<DocVersionInfo> _MyDocVersionList;
|
||||
public List<DocVersionInfo> MyDocVersionList
|
||||
{
|
||||
get { return _MyDocVersionList; }
|
||||
set { _MyDocVersionList = value; }
|
||||
}
|
||||
private int _ProcedureCount;
|
||||
public int ProcedureCount
|
||||
{
|
||||
get { return _ProcedureCount; }
|
||||
set { _ProcedureCount = value; }
|
||||
}
|
||||
private string _PaperSize = "Letter";
|
||||
|
||||
public int TransitionInfoCount { get; set; }
|
||||
public List<DocVersionInfo> MyDocVersionList { get; set; }
|
||||
public int ProcedureCount { get; set; }
|
||||
private readonly string _PaperSize = "Letter";
|
||||
public PDFTransitionReport(FolderInfo fi, string fileName)
|
||||
{
|
||||
_FileName = fileName;
|
||||
FileName = fileName;
|
||||
folderInfo = fi;
|
||||
if (fi.ActiveFormat != null)
|
||||
_PaperSize = fi.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize; // C2020-002 paper size is now set in the format files
|
||||
}
|
||||
public PDFTransitionReport(ProcedureInfo pi, string fileName)
|
||||
{
|
||||
_FileName = fileName;
|
||||
FileName = fileName;
|
||||
procedureInfo = pi;
|
||||
transitionInfoList = TransitionInfoList.GetTransitionReportData(procedureInfo.MyDocVersion.VersionID, procedureInfo.ItemID);
|
||||
_TransitionInfoCount = transitionInfoList.Count;
|
||||
TransitionInfoCount = transitionInfoList.Count;
|
||||
_PaperSize = pi.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize; // C2020-002 paper size is now set in the format files
|
||||
}
|
||||
public void BuildTransitionReport()
|
||||
@@ -100,13 +73,13 @@ namespace Volian.Print.Library
|
||||
if (MyDocVersionList.Count == 1)
|
||||
{
|
||||
DocVersionInfo dvi = MyDocVersionList[0];
|
||||
foreach (ProcedureInfo pi in dvi.Procedures)
|
||||
foreach (ProcedureInfo pi in dvi.Procedures.OfType<ProcedureInfo>())
|
||||
{
|
||||
procedureInfo = pi;
|
||||
transitionInfoList = TransitionInfoList.GetTransitionReportData(dvi.VersionID, procedureInfo.ItemID);
|
||||
if (transitionInfoList.Count > 0)
|
||||
{
|
||||
_TransitionInfoCount = transitionInfoList.Count;
|
||||
TransitionInfoCount = transitionInfoList.Count;
|
||||
OnProcedureProcessed(this, new EventArgs());
|
||||
BuildProcedureReport(document);
|
||||
}
|
||||
@@ -122,11 +95,11 @@ namespace Volian.Print.Library
|
||||
{
|
||||
ProcedureCount = dvi.Procedures.Count;
|
||||
OnDocVersionProcessed(this, new EventArgs());
|
||||
foreach (ProcedureInfo pi in dvi.Procedures)
|
||||
foreach (ProcedureInfo pi in dvi.Procedures.OfType<ProcedureInfo>())
|
||||
{
|
||||
procedureInfo = pi;
|
||||
transitionInfoList = TransitionInfoList.GetTransitionReportData(dvi.VersionID, procedureInfo.ItemID);
|
||||
_TransitionInfoCount = transitionInfoList.Count;
|
||||
TransitionInfoCount = transitionInfoList.Count;
|
||||
OnProcedureProcessed(this, new EventArgs());
|
||||
BuildProcedureReport(document);
|
||||
}
|
||||
@@ -140,7 +113,6 @@ namespace Volian.Print.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
StringBuilder msg = new StringBuilder();
|
||||
document.Add(new Paragraph("Error:"));
|
||||
while (ex != null)
|
||||
{
|
||||
@@ -160,10 +132,12 @@ namespace Volian.Print.Library
|
||||
}
|
||||
PdfOutline outline = null;
|
||||
ProcedureInfo lastProcedureInfo = null;
|
||||
private PdfPTable BuildProcedurePDFTable(Dictionary<int, string> levels, Dictionary<int, iTextSharp.text.Font> fonts, int cols, int paddingBottom, int level, iTextSharp.text.Document doc)
|
||||
private PdfPTable BuildProcedurePDFTable(Dictionary<int, string> levels, Dictionary<int, iTextSharp.text.Font> fonts, int cols, int paddingBottom, int level)
|
||||
{
|
||||
PdfPTable t = new PdfPTable(cols);
|
||||
t.HeaderRows = 4;
|
||||
PdfPTable t = new PdfPTable(cols)
|
||||
{
|
||||
HeaderRows = 4
|
||||
};
|
||||
t.DefaultCell.Padding = 4;
|
||||
t.WidthPercentage = 100;
|
||||
float[] widths;
|
||||
@@ -173,30 +147,40 @@ namespace Volian.Print.Library
|
||||
widths = new float[] { 33f, 47f, 20f };
|
||||
t.SetWidths(widths);
|
||||
//report title
|
||||
Phrase h = new Phrase();
|
||||
h.Font = fonts[1];
|
||||
Phrase h = new Phrase
|
||||
{
|
||||
Font = fonts[1]
|
||||
};
|
||||
if (folderInfo != null)
|
||||
h.Add(string.Format("Procedure Set {0} Transition Report", folderInfo.Name));
|
||||
else
|
||||
h.Add("Transition Report");
|
||||
PdfPCell c = new PdfPCell(h);
|
||||
c.Colspan = cols-1;
|
||||
c.HorizontalAlignment = Element.ALIGN_LEFT;
|
||||
c.PaddingBottom = paddingBottom;
|
||||
c.BackgroundColor = new Color(System.Drawing.Color.DarkGoldenrod);
|
||||
PdfPCell c = new PdfPCell(h)
|
||||
{
|
||||
Colspan = cols - 1,
|
||||
HorizontalAlignment = Element.ALIGN_LEFT,
|
||||
PaddingBottom = paddingBottom,
|
||||
BackgroundColor = new Color(System.Drawing.Color.DarkGoldenrod)
|
||||
};
|
||||
t.AddCell(c);
|
||||
//date generated
|
||||
h = new Phrase();
|
||||
h.Font = fonts[4];
|
||||
h = new Phrase
|
||||
{
|
||||
Font = fonts[4]
|
||||
};
|
||||
h.Add(DateTime.Now.ToString("dddd MMMM d, yyyy @ h:mm tt"));
|
||||
c = new PdfPCell(h);
|
||||
c.HorizontalAlignment = Element.ALIGN_RIGHT;
|
||||
c.PaddingBottom = paddingBottom;
|
||||
c.BackgroundColor = new Color(System.Drawing.Color.DarkGoldenrod);
|
||||
c = new PdfPCell(h)
|
||||
{
|
||||
HorizontalAlignment = Element.ALIGN_RIGHT,
|
||||
PaddingBottom = paddingBottom,
|
||||
BackgroundColor = new Color(System.Drawing.Color.DarkGoldenrod)
|
||||
};
|
||||
t.AddCell(c);
|
||||
//procedure title
|
||||
h = new Phrase();
|
||||
h.Font = fonts[2];
|
||||
h = new Phrase
|
||||
{
|
||||
Font = fonts[2]
|
||||
};
|
||||
h.Add(string.Format("{0} - {1}", procedureInfo.DisplayNumber, procedureInfo.DisplayText));
|
||||
PdfDestination dest = new PdfDestination(PdfDestination.FITH, cb.PdfDocument.PageSize.Height);
|
||||
if (lastProcedureInfo != procedureInfo)
|
||||
@@ -204,19 +188,23 @@ namespace Volian.Print.Library
|
||||
outline = new PdfOutline(cb.RootOutline, dest, procedureInfo.DisplayNumber, false);
|
||||
lastProcedureInfo = procedureInfo;
|
||||
}
|
||||
c = new PdfPCell(h);
|
||||
c.Colspan = cols-1;
|
||||
c.HorizontalAlignment = Element.ALIGN_LEFT;
|
||||
c.PaddingBottom = paddingBottom;
|
||||
c.BackgroundColor = new Color(System.Drawing.Color.Goldenrod);
|
||||
c = new PdfPCell(h)
|
||||
{
|
||||
Colspan = cols - 1,
|
||||
HorizontalAlignment = Element.ALIGN_LEFT,
|
||||
PaddingBottom = paddingBottom,
|
||||
BackgroundColor = new Color(System.Drawing.Color.Goldenrod)
|
||||
};
|
||||
t.AddCell(c);
|
||||
//page number
|
||||
_CurrentPageNumberCell = BuildCell(1, string.Format("Page {0}",CurrentPageNumber), fonts[4], new Color(System.Drawing.Color.Goldenrod));
|
||||
_CurrentPageNumberCell.PaddingBottom = paddingBottom;
|
||||
t.AddCell(_CurrentPageNumberCell);
|
||||
//transition category
|
||||
h = new Phrase();
|
||||
h.Font = fonts[3];
|
||||
h = new Phrase
|
||||
{
|
||||
Font = fonts[3]
|
||||
};
|
||||
if (transitionInfoList.Count == 0)
|
||||
h.Add("N/A");
|
||||
else
|
||||
@@ -225,36 +213,50 @@ namespace Volian.Print.Library
|
||||
dest = new PdfDestination(PdfDestination.FITH, cb.PdfDocument.PageSize.Height);
|
||||
new PdfOutline(outline, dest, levels[level]);
|
||||
}
|
||||
c = new PdfPCell(h);
|
||||
c.Colspan = cols;
|
||||
c.HorizontalAlignment = Element.ALIGN_LEFT;
|
||||
c.PaddingBottom = paddingBottom;
|
||||
c.BackgroundColor = new Color(System.Drawing.Color.Khaki);
|
||||
c = new PdfPCell(h)
|
||||
{
|
||||
Colspan = cols,
|
||||
HorizontalAlignment = Element.ALIGN_LEFT,
|
||||
PaddingBottom = paddingBottom,
|
||||
BackgroundColor = new Color(System.Drawing.Color.Khaki)
|
||||
};
|
||||
t.AddCell(c);
|
||||
//add column headers
|
||||
h = new Phrase();
|
||||
h.Font = fonts[4];
|
||||
h = new Phrase
|
||||
{
|
||||
Font = fonts[4]
|
||||
};
|
||||
h.Add("From Procedure Location");
|
||||
c = new PdfPCell(h);
|
||||
c.HorizontalAlignment = Element.ALIGN_CENTER;
|
||||
c.PaddingBottom = paddingBottom;
|
||||
c.BackgroundColor = new Color(System.Drawing.Color.PaleGoldenrod);
|
||||
c = new PdfPCell(h)
|
||||
{
|
||||
HorizontalAlignment = Element.ALIGN_CENTER,
|
||||
PaddingBottom = paddingBottom,
|
||||
BackgroundColor = new Color(System.Drawing.Color.PaleGoldenrod)
|
||||
};
|
||||
t.AddCell(c);
|
||||
h = new Phrase();
|
||||
h.Font = fonts[4];
|
||||
h = new Phrase
|
||||
{
|
||||
Font = fonts[4]
|
||||
};
|
||||
h.Add("From Procedure Text");
|
||||
c = new PdfPCell(h);
|
||||
c.HorizontalAlignment = Element.ALIGN_CENTER;
|
||||
c.PaddingBottom = paddingBottom;
|
||||
c.BackgroundColor = new Color(System.Drawing.Color.PaleGoldenrod);
|
||||
c = new PdfPCell(h)
|
||||
{
|
||||
HorizontalAlignment = Element.ALIGN_CENTER,
|
||||
PaddingBottom = paddingBottom,
|
||||
BackgroundColor = new Color(System.Drawing.Color.PaleGoldenrod)
|
||||
};
|
||||
t.AddCell(c);
|
||||
h = new Phrase();
|
||||
h.Font = fonts[4];
|
||||
h = new Phrase
|
||||
{
|
||||
Font = fonts[4]
|
||||
};
|
||||
h.Add("To Procedure Location");
|
||||
c = new PdfPCell(h);
|
||||
c.HorizontalAlignment = Element.ALIGN_CENTER;
|
||||
c.PaddingBottom = paddingBottom;
|
||||
c.BackgroundColor = new Color(System.Drawing.Color.PaleGoldenrod);
|
||||
c = new PdfPCell(h)
|
||||
{
|
||||
HorizontalAlignment = Element.ALIGN_CENTER,
|
||||
PaddingBottom = paddingBottom,
|
||||
BackgroundColor = new Color(System.Drawing.Color.PaleGoldenrod)
|
||||
};
|
||||
t.AddCell(c);
|
||||
return t;
|
||||
}
|
||||
@@ -262,37 +264,45 @@ namespace Volian.Print.Library
|
||||
private void BuildProcedureReport(iTextSharp.text.Document doc)
|
||||
{
|
||||
Dictionary<int, string> tranTypes = FormatInfo.GetTransitionTypesByFormatID(procedureInfo.ActiveFormat.FormatID);
|
||||
Dictionary<int, string> levels = new Dictionary<int, string>();
|
||||
levels.Add(1, "Internal Transitions");
|
||||
levels.Add(2, "External From Transitions");
|
||||
levels.Add(3, "External To Transitions");
|
||||
levels.Add(4, "Outside From Transitions");
|
||||
levels.Add(5, "Outside To Transitions");
|
||||
Dictionary<int, iTextSharp.text.Font> fonts = new Dictionary<int, Font>();
|
||||
Dictionary<int, string> levels = new Dictionary<int, string>
|
||||
{
|
||||
{ 1, "Internal Transitions" },
|
||||
{ 2, "External From Transitions" },
|
||||
{ 3, "External To Transitions" },
|
||||
{ 4, "Outside From Transitions" },
|
||||
{ 5, "Outside To Transitions" }
|
||||
};
|
||||
Dictionary<int, iTextSharp.text.Font> fonts = new Dictionary<int, Font>
|
||||
{
|
||||
// C2017-036 get best available proportional font for symbols that looks close to Arial
|
||||
// Note that Microsoft no longer supplies Arial Unicode MS as of Word16
|
||||
fonts.Add(1, pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 12, 0, Color.BLACK));
|
||||
fonts.Add(2, pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 10, 0, Color.BLACK));
|
||||
fonts.Add(3, pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 8, 0, Color.BLACK));
|
||||
fonts.Add(4, pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 8, 0, Color.BLACK));
|
||||
{ 1, pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 12, 0, Color.BLACK) },
|
||||
{ 2, pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 10, 0, Color.BLACK) },
|
||||
{ 3, pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 8, 0, Color.BLACK) },
|
||||
{ 4, pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 8, 0, Color.BLACK) }
|
||||
};
|
||||
int lastLevel = transitionInfoList.Count > 0 ? transitionInfoList[0].Level : 0; //set level to first transition level
|
||||
#region buildtable
|
||||
int cols = 3;
|
||||
int paddingBottom = 6;
|
||||
if (folderInfo != null)
|
||||
doc.NewPage();
|
||||
PdfPTable t = BuildProcedurePDFTable(levels, fonts, cols, paddingBottom, lastLevel, doc);
|
||||
PdfPTable t = BuildProcedurePDFTable(levels, fonts, cols, paddingBottom, lastLevel);
|
||||
#endregion
|
||||
//gather data
|
||||
if (transitionInfoList.Count == 0)
|
||||
{
|
||||
Phrase h = new Phrase();
|
||||
h.Font = fonts[4];
|
||||
Phrase h = new Phrase
|
||||
{
|
||||
Font = fonts[4]
|
||||
};
|
||||
h.Add("This procedure contains no transitions");
|
||||
PdfPCell c = new PdfPCell(h);
|
||||
c.Colspan = cols;
|
||||
c.HorizontalAlignment = Element.ALIGN_LEFT;
|
||||
c.PaddingBottom = paddingBottom;
|
||||
PdfPCell c = new PdfPCell(h)
|
||||
{
|
||||
Colspan = cols,
|
||||
HorizontalAlignment = Element.ALIGN_LEFT,
|
||||
PaddingBottom = paddingBottom
|
||||
};
|
||||
t.AddCell(c);
|
||||
}
|
||||
else
|
||||
@@ -308,36 +318,48 @@ namespace Volian.Print.Library
|
||||
doc.Add(t);
|
||||
doc.NewPage();
|
||||
lastLevel = ti.Level;
|
||||
t = BuildProcedurePDFTable(levels, fonts, cols, paddingBottom, lastLevel, doc);
|
||||
t = BuildProcedurePDFTable(levels, fonts, cols, paddingBottom, lastLevel);
|
||||
}
|
||||
}
|
||||
//add from path
|
||||
Phrase h = new Phrase();
|
||||
h.Font = fonts[4];
|
||||
Phrase h = new Phrase
|
||||
{
|
||||
Font = fonts[4]
|
||||
};
|
||||
h.Add(StripProcInfo(ti.PathFrom, procedureInfo));
|
||||
PdfPCell c = new PdfPCell(h);
|
||||
c.HorizontalAlignment = Element.ALIGN_LEFT;
|
||||
c.PaddingBottom = paddingBottom;
|
||||
PdfPCell c = new PdfPCell(h)
|
||||
{
|
||||
HorizontalAlignment = Element.ALIGN_LEFT,
|
||||
PaddingBottom = paddingBottom
|
||||
};
|
||||
if (lastLevel > 1 && (!tranTypes[ti.TranType].Contains("{Proc") && !tranTypes[ti.TranType].Contains("other procedure"))) c.BackgroundColor = new Color(System.Drawing.Color.LightCoral);
|
||||
t.AddCell(c);
|
||||
//add from text
|
||||
h = new Phrase();
|
||||
h.Font = fonts[4];
|
||||
h = new Phrase
|
||||
{
|
||||
Font = fonts[4]
|
||||
};
|
||||
ItemInfo myItemInfo = ti.MyContent.ContentItems[0];
|
||||
h.Add(GetTextPath(myItemInfo, 0));
|
||||
c = new PdfPCell(h);
|
||||
c.HorizontalAlignment = Element.ALIGN_LEFT;
|
||||
c.PaddingBottom = paddingBottom;
|
||||
c = new PdfPCell(h)
|
||||
{
|
||||
HorizontalAlignment = Element.ALIGN_LEFT,
|
||||
PaddingBottom = paddingBottom
|
||||
};
|
||||
if (lastLevel > 1 && (!tranTypes[ti.TranType].Contains("{Proc") && !tranTypes[ti.TranType].Contains("other procedure"))) c.BackgroundColor = new Color(System.Drawing.Color.LightCoral);
|
||||
t.AddCell(c);
|
||||
//add to text
|
||||
h = new Phrase();
|
||||
h.Font = fonts[4];
|
||||
h = new Phrase
|
||||
{
|
||||
Font = fonts[4]
|
||||
};
|
||||
myItemInfo = ti.MyItemToID;
|
||||
h.Add(GetTextPath(myItemInfo, ti.Level));
|
||||
c = new PdfPCell(h);
|
||||
c.HorizontalAlignment = Element.ALIGN_LEFT;
|
||||
c.PaddingBottom = paddingBottom;
|
||||
c = new PdfPCell(h)
|
||||
{
|
||||
HorizontalAlignment = Element.ALIGN_LEFT,
|
||||
PaddingBottom = paddingBottom
|
||||
};
|
||||
if (lastLevel > 1 && (!tranTypes[ti.TranType].Contains("{Proc") && !tranTypes[ti.TranType].Contains("other procedure"))) c.BackgroundColor = new Color(System.Drawing.Color.LightCoral);
|
||||
t.AddCell(c);
|
||||
}
|
||||
@@ -357,16 +379,16 @@ namespace Volian.Print.Library
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (myItemInfo.IsProcedure)
|
||||
return myItemInfo.MyProcedure.DisplayNumber + " " + myItemInfo.MyProcedure.DisplayText;
|
||||
return $"{myItemInfo.MyProcedure.DisplayNumber} {myItemInfo.MyProcedure.DisplayText}";
|
||||
if (myItemInfo.IsSection)
|
||||
{
|
||||
if (level > 1)
|
||||
return myItemInfo.MyProcedure.DisplayNumber + " " + myItemInfo.MyProcedure.DisplayText + "\r\n " + myItemInfo.DisplayText;
|
||||
return $"{myItemInfo.MyProcedure.DisplayNumber} {myItemInfo.MyProcedure.DisplayText}\r\n {myItemInfo.DisplayText}";
|
||||
else
|
||||
return myItemInfo.DisplayText;
|
||||
}
|
||||
if (myItemInfo.IsHigh)
|
||||
return myItemInfo.ActiveSection.DisplayText + "\r\n " + myItemInfo.DisplayText;
|
||||
return $"{myItemInfo.ActiveSection.DisplayText}\r\n {myItemInfo.DisplayText}";
|
||||
else
|
||||
{
|
||||
string tmp = "";
|
||||
@@ -393,10 +415,6 @@ namespace Volian.Print.Library
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
public void BuildTransitionReport(FolderInfo fi)
|
||||
{
|
||||
System.Windows.Forms.MessageBox.Show("folder");
|
||||
}
|
||||
private bool CreateResultsPDF(iTextSharp.text.Document document)
|
||||
{
|
||||
bool result = false;
|
||||
@@ -404,26 +422,20 @@ namespace Volian.Print.Library
|
||||
int i = 0;
|
||||
// just for safety, the while loop expects to find a file extension
|
||||
// so make sure it has one before going into the loop
|
||||
if (!_FileName.ToUpper().EndsWith(".PDF"))
|
||||
_FileName += ".pdf";
|
||||
if (!FileName.ToUpper().EndsWith(".PDF"))
|
||||
FileName += ".pdf";
|
||||
// Try to open a file for creating the PDF.
|
||||
while (result == false)
|
||||
{
|
||||
string fileName = _FileName;
|
||||
// Bug fix: B2013-086
|
||||
// the folder path part of _FileName contained a folder name with a period
|
||||
// resulting is an invalid file location/file name.
|
||||
// Changed the IndexOf call to the LastIndexOf
|
||||
//int loc = fileName.IndexOf(".");
|
||||
string fileName = FileName;
|
||||
int loc = fileName.LastIndexOf(".");
|
||||
if (loc > -1)
|
||||
{
|
||||
string fname = fileName.Substring(0, loc);
|
||||
fileName = fname + suffix + ".pdf";
|
||||
fileName = $"{fname}{suffix}.pdf";
|
||||
}
|
||||
else
|
||||
fileName = fileName + suffix + ".pdf";
|
||||
// string fileName = _FileName.ToLower().Replace(".pdf", suffix + ".pdf");
|
||||
fileName = $"{fileName}{suffix}.pdf";
|
||||
try
|
||||
{
|
||||
PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(fileName, FileMode.Create));
|
||||
@@ -431,7 +443,7 @@ namespace Volian.Print.Library
|
||||
document.SetMargins(36, 36, 36, 36);
|
||||
document.Open();
|
||||
cb = writer.DirectContent;
|
||||
_FileName = fileName;
|
||||
FileName = fileName;
|
||||
result = true;
|
||||
}
|
||||
catch (System.IO.IOException exIO)
|
||||
@@ -468,28 +480,25 @@ namespace Volian.Print.Library
|
||||
}
|
||||
System.Windows.Forms.MessageBox.Show(msg.ToString(), "Error during PDF creation for search:", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
|
||||
}
|
||||
private PdfPCell BlankCell(int colSpan)
|
||||
{
|
||||
PdfPCell c = new PdfPCell();
|
||||
c.Colspan = colSpan;
|
||||
c.Border = 0;
|
||||
return c;
|
||||
}
|
||||
private PdfPCell BuildCell(int colspan, string txt, Font f, iTextSharp.text.Color clr)
|
||||
{
|
||||
Phrase h = new Phrase();
|
||||
h.Font = f;
|
||||
Phrase h = new Phrase
|
||||
{
|
||||
Font = f
|
||||
};
|
||||
h.Add(txt);
|
||||
PdfPCell c = new PdfPCell(h);
|
||||
c.HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT;
|
||||
c.Colspan = colspan;
|
||||
c.BackgroundColor = clr;
|
||||
PdfPCell c = new PdfPCell(h)
|
||||
{
|
||||
HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT,
|
||||
Colspan = colspan,
|
||||
BackgroundColor = clr
|
||||
};
|
||||
return c;
|
||||
}
|
||||
}
|
||||
public class MyPageEvent : PdfPageEventHelper
|
||||
{
|
||||
private PDFTransitionReport _rpt = null;
|
||||
private readonly PDFTransitionReport _rpt = null;
|
||||
public MyPageEvent(PDFTransitionReport rpt)
|
||||
{
|
||||
_rpt = rpt;
|
||||
|
||||
@@ -1,39 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using iTextSharp.text;
|
||||
using iTextSharp.text.pdf;
|
||||
using Volian.Svg.Library;
|
||||
|
||||
namespace Volian.Print.Library
|
||||
{
|
||||
public class PageCount
|
||||
{
|
||||
private bool _CanIncrement = true;
|
||||
public bool CanIncrement
|
||||
{
|
||||
get { return _CanIncrement; }
|
||||
set { _CanIncrement = value; }
|
||||
}
|
||||
public bool CanIncrement { get; set; } = true;
|
||||
private int Increment()
|
||||
{
|
||||
if (CanIncrement) Total++;
|
||||
CanIncrement = false;
|
||||
return Total;
|
||||
}
|
||||
private int _Total;
|
||||
public int Total
|
||||
{
|
||||
get { return _Total; }
|
||||
set { _Total = value; }
|
||||
}
|
||||
private string _FinalPageMessage;
|
||||
|
||||
public string FinalPageMessage
|
||||
{
|
||||
get { return _FinalPageMessage; }
|
||||
set { _FinalPageMessage = value; }
|
||||
}
|
||||
public int Total { get; set; }
|
||||
|
||||
public string FinalPageMessage { get; set; }
|
||||
private PageCountTemplates _MyTemplates; // (for each page that has this key)
|
||||
internal PageCountTemplates MyTemplates
|
||||
{
|
||||
@@ -53,10 +36,10 @@ namespace Volian.Print.Library
|
||||
foreach (PageCountTemplate pct in MyTemplates)
|
||||
{
|
||||
cnt++;
|
||||
string fstr = pct.Text.Replace("{OF}", _Total.ToString());
|
||||
string fstr = pct.Text.Replace("{OF}", Total.ToString());
|
||||
if (pct.Text.Contains("{TOCPAGE}"))
|
||||
{
|
||||
fstr = pct.Text.Replace("{TOCPAGE}", _Total.ToString());
|
||||
fstr = pct.Text.Replace("{TOCPAGE}", Total.ToString());
|
||||
}
|
||||
if (fstr.Contains("{FINALPAGE}"))
|
||||
{
|
||||
@@ -140,45 +123,21 @@ namespace Volian.Print.Library
|
||||
|
||||
public class PageCountTemplate
|
||||
{
|
||||
private string _Text;
|
||||
public string Text // "Page 1 of {OF}"
|
||||
{
|
||||
get { return _Text; }
|
||||
set { _Text = value; }
|
||||
}
|
||||
private System.Drawing.Font _MyFont;
|
||||
public System.Drawing.Font MyFont
|
||||
{
|
||||
get { return _MyFont; }
|
||||
set { _MyFont = value; }
|
||||
}
|
||||
private int _Alignment; // iTextSharp Element.<XYZ>
|
||||
public int Alignment
|
||||
{
|
||||
get { return _Alignment; }
|
||||
set { _Alignment = value; }
|
||||
}
|
||||
private System.Drawing.Color _MyColor;
|
||||
public System.Drawing.Color MyColor
|
||||
{
|
||||
get { return _MyColor; }
|
||||
set { _MyColor = value; }
|
||||
}
|
||||
private PdfTemplate _MyTemplate;
|
||||
public PdfTemplate MyTemplate
|
||||
{
|
||||
get { return _MyTemplate; }
|
||||
set { _MyTemplate = value; }
|
||||
}
|
||||
{ get; set; }
|
||||
public System.Drawing.Font MyFont { get; set; }
|
||||
public int Alignment { get; set; }
|
||||
public System.Drawing.Color MyColor { get; set; }
|
||||
public PdfTemplate MyTemplate { get; set; }
|
||||
public PageCountTemplate(PdfWriter pdfWriter, string text, System.Drawing.Font myFont, int alignment, System.Drawing.Color color)
|
||||
{
|
||||
// Create Template can be called with a small, i.e. 1, width/height because when
|
||||
// it is actually drawn, the bounding box overrides the CreateTemplate values.
|
||||
_MyTemplate = pdfWriter.DirectContent.CreateTemplate(1, 1);
|
||||
_Text = text;
|
||||
_MyFont = myFont;
|
||||
_MyColor = color;
|
||||
_Alignment = alignment;
|
||||
MyTemplate = pdfWriter.DirectContent.CreateTemplate(1, 1);
|
||||
Text = text;
|
||||
MyFont = myFont;
|
||||
MyColor = color;
|
||||
Alignment = alignment;
|
||||
}
|
||||
}
|
||||
public class PageCountTemplates : List<PageCountTemplate>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using VEPROMS.CSLA.Library;
|
||||
using Volian.Base.Library;
|
||||
using iTextSharp.text.pdf;
|
||||
@@ -10,40 +9,16 @@ namespace Volian.Print.Library
|
||||
{
|
||||
public partial class vlnParagraph
|
||||
{
|
||||
private string _PageBreakReason = null;
|
||||
public string PageBreakReason
|
||||
{
|
||||
get { return _PageBreakReason; }
|
||||
set { _PageBreakReason = value; }
|
||||
}
|
||||
private bool _CompressPartOfStep = false;
|
||||
public bool CompressPartOfStep
|
||||
{
|
||||
get { return _CompressPartOfStep; }
|
||||
set { _CompressPartOfStep = value; }
|
||||
}
|
||||
private bool _CompressFirstPartOfStep = false;
|
||||
public bool CompressFirstPartOfStep
|
||||
{
|
||||
get { return _CompressFirstPartOfStep; }
|
||||
set { _CompressFirstPartOfStep = value; }
|
||||
}
|
||||
private bool _BreakHighLevelStepWithSection = false;
|
||||
public bool BreakHighLevelStepWithSection
|
||||
{
|
||||
get { return _BreakHighLevelStepWithSection; }
|
||||
set { _BreakHighLevelStepWithSection = value; }
|
||||
}
|
||||
public string PageBreakReason { get; set; } = null;
|
||||
public bool CompressPartOfStep { get; set; } = false;
|
||||
public bool CompressFirstPartOfStep { get; set; } = false;
|
||||
public bool BreakHighLevelStepWithSection { get; set; } = false;
|
||||
/// <summary>
|
||||
/// This variable is used to match 16 bit pagination
|
||||
/// </summary>
|
||||
private bool _Match16BitPagination = false;
|
||||
private bool _CompressFoldout = false;
|
||||
public bool CompressFoldout
|
||||
{
|
||||
get { return _CompressFoldout; }
|
||||
set { _CompressFoldout = value; }
|
||||
}
|
||||
private readonly bool _Match16BitPagination = false;
|
||||
|
||||
public bool CompressFoldout { get; set; } = false;
|
||||
/// <summary>
|
||||
/// Dtermines if the current step is preceded by a Page Break
|
||||
/// </summary>
|
||||
@@ -85,8 +60,8 @@ namespace Volian.Print.Library
|
||||
if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.SupInfoPdfPrint)
|
||||
{
|
||||
int retval = 0;
|
||||
SectionInfo supInfoSect = MyItemInfo.ActiveSection as SectionInfo; // C2018-003 fixed use of getting the active section
|
||||
if (supInfoSect != null && supInfoSect.StepSectPageBreaksForSupInfo != null && supInfoSect.StepSectPageBreaksForSupInfo.Contains(MyItemInfo.ItemID))
|
||||
// C2018-003 fixed use of getting the active section
|
||||
if (MyItemInfo.ActiveSection is SectionInfo supInfoSect && supInfoSect.StepSectPageBreaksForSupInfo != null && supInfoSect.StepSectPageBreaksForSupInfo.Contains(MyItemInfo.ItemID))
|
||||
{
|
||||
MyPromsPrinter.SupInfoPdfPageCount++;
|
||||
retval = 1;
|
||||
@@ -141,13 +116,12 @@ namespace Volian.Print.Library
|
||||
if (MyItemInfo.MyParent.IsHigh && MyItemInfo.IsNote && (MyItemInfo.MyParent.Cautions == null || MyItemInfo.MyParent.Cautions.Count == 0) && MyItemInfo.MyPrevious == null) return 1;
|
||||
// if this is a substep that has a preferredpage break, and it has caution/note that is where the page break had to go
|
||||
if (MyItemInfo.IsSubStep && ChildrenAbove != null && ChildrenAbove.Count > 0) return 0;
|
||||
// B2017-228: The following flags a break within the step. Before returning a '2' (flags break within step), clear it out of the
|
||||
// ParaBreaks. Without the 'RemoveAt', a page break will occur after this step also.
|
||||
string reason = "Unknown";
|
||||
if (MyPageHelper.ParaBreaks != null && MyPageHelper.ParaBreaks.Count > 0 && this == MyPageHelper.ParaBreaks[0])
|
||||
{
|
||||
MyPageHelper.ParaBreaks.RemoveAt(0);
|
||||
reason = AddReason("Partial Step - Case 1");
|
||||
// B2017-228: The following flags a break within the step. Before returning a '2' (flags break within step), clear it out of the
|
||||
// ParaBreaks. Without the 'RemoveAt', a page break will occur after this step also.
|
||||
string reason = AddReason("Partial Step - Case 1");
|
||||
ShowPageBreak(1, reason, "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak);
|
||||
}
|
||||
return 2;
|
||||
@@ -157,8 +131,8 @@ namespace Volian.Print.Library
|
||||
// if the EndForSingle format flag is set to false, then we do not print an End message if the section
|
||||
// is a single column section.
|
||||
//bool _skipEndMessage = MyPageHelper.MySection.SectionConfig.Section_ColumnMode == SectionConfig.SectionColumnMode.One && !MyItemInfo.ActiveFormat.MyStepSectionLayoutData.EndForSingle;
|
||||
SectionInfo si = MyItemInfo.ActiveSection as SectionInfo; // C2018-003 fixed use of getting the active section
|
||||
bool _skipEndMessage = si != null && si.SectionConfig.Section_ColumnMode == SectionConfig.SectionColumnMode.One && !MyItemInfo.ActiveFormat.MyStepSectionLayoutData.EndForSingle;
|
||||
// C2018-003 fixed use of getting the active section
|
||||
bool _skipEndMessage = MyItemInfo.ActiveSection is SectionInfo si && si.SectionConfig.Section_ColumnMode == SectionConfig.SectionColumnMode.One && !MyItemInfo.ActiveFormat.MyStepSectionLayoutData.EndForSingle;
|
||||
|
||||
// TODO: This does not account for a long step as the last step that would exceed more than one page and
|
||||
// that has an end message that needs to be accounted for in determining pagination. To do that the last
|
||||
@@ -171,7 +145,7 @@ namespace Volian.Print.Library
|
||||
// line above the end message, thus 2 not 3. This change was made on July 20, 2011 by RHM & KBR. The
|
||||
// procedure in questions was VEWCNEMG\EMGAPP.PRC, ES-01, Step 8.
|
||||
//float yEndMsg = !_skipEndMessage && !MyItemInfo.IsSection && MyItemInfo.MyHLS != null && MyItemInfo.MyHLS.NextItem == null && (MyItemInfo.MyDocStyle.End.Message ?? "") != "" ? 2 * SixLinesPerInch : 0;
|
||||
float yEndMsg = (!_skipEndMessage && !MyItemInfo.IsSection && MyItemInfo.MyHLS != null && MyItemInfo.MyHLS.NextItem == null)? GetEndMessageHeight(MyItemInfo.MyDocStyle) : 0; // B2018-068 account for mult-line End Messages
|
||||
float yEndMsg = (!_skipEndMessage && !MyItemInfo.IsSection && MyItemInfo.MyHLS != null && MyItemInfo.MyHLS.NextItem == null)? GetEndMessageHeight() : 0; // B2018-068 account for mult-line End Messages
|
||||
|
||||
// also consider if there is a phone list at the bottom of the page, add the amount of space the phone
|
||||
// list requires onto yEndMsg to make it easier to figure out pagination (include an extra line for the
|
||||
@@ -196,7 +170,7 @@ namespace Volian.Print.Library
|
||||
// location of a pagebreak. ParaBreaks contains the paragraphs that break within a step.
|
||||
if (MyPageHelper.ParaBreaks.Count > 0)
|
||||
{
|
||||
string reason = "Unknown";
|
||||
string reason;
|
||||
// if on current step and it is also the substep that will cause a pagebreak, i.e. the top substep in pagebreaks[[0]:
|
||||
if (this == MyPageHelper.ParaBreaks[0])
|
||||
{
|
||||
@@ -230,14 +204,7 @@ namespace Volian.Print.Library
|
||||
// B2018-065 Calvert's continue message was not including the substep number in AOP-1A Attachment 1, added AERandRNO check
|
||||
else if (!MyPageHelper.ParaBreaks[0].PageBreakOnStep && this.YTopMost >= MyPageHelper.ParaBreaks[0].YTopMost && AERandRNO(this.MyItemInfo, MyPageHelper.ParaBreaks[0].MyItemInfo))
|
||||
{
|
||||
//vlnParagraph removed = MyPageHelper.ParaBreaks[0];// 2018-081 Remember where the page break was going to be
|
||||
MyPageHelper.ParaBreaks.RemoveAt(0);
|
||||
//if (MyParent == removed && MyItemInfo.IsRNOPart && MyParent.MyItemInfo.IsHigh)// B2018-081 If The High Level Step was going to break from the High Level RNO
|
||||
//{
|
||||
// reason = AddReason("Partial Step - Case 4B");
|
||||
// ShowPageBreak(1, reason, "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak);
|
||||
// return 0;
|
||||
//}
|
||||
reason = AddReason("Partial Step - Case 4");
|
||||
ShowPageBreak(1, reason, "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak);
|
||||
return 2; // break on this item within a step
|
||||
@@ -276,9 +243,8 @@ namespace Volian.Print.Library
|
||||
// flag SectionPageBreak is set to true to flag that a pagebreak should not be done
|
||||
// on that first step.
|
||||
StepConfig sc = firstChild.MyItemInfo.MyConfig as StepConfig;
|
||||
ManualPageBreak = MyPageHelper.OriginalPageBreak ? (sc == null ? false : sc.Step_ManualPagebreak) :
|
||||
sc == null ? false :
|
||||
(MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks == null)? sc.Step_NewManualPagebreak : false;
|
||||
ManualPageBreak = MyPageHelper.OriginalPageBreak ? (sc != null && sc.Step_ManualPagebreak) :
|
||||
sc != null && ((MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks == null) && sc.Step_NewManualPagebreak);
|
||||
// C2021-010: Remove trailing returns/spaces & manual page breaks & allow save.
|
||||
if (sc != null && sc.Step_NewManualPagebreak && MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks != null &&
|
||||
!MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks.Contains(firstChild.MyItemInfo.ItemID)) MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks.Add(firstChild.MyItemInfo.ItemID);
|
||||
@@ -290,10 +256,7 @@ namespace Volian.Print.Library
|
||||
}
|
||||
// can the title and the first step fit?
|
||||
// add the first child's size + (the section title's size)
|
||||
//if (ySizeIncludingFirst > (yLocation - yBottomMargin - SixLinesPerInch)) return 1;
|
||||
//if (ySizeIncludingFirst > (yLocation - yBottomMargin) && ySizeIncludingFirst < yPageSize)
|
||||
vlnParagraph firstStepChild = firstChild;
|
||||
//while (firstStepChild.MyItemInfo.IsSection && firstStepChild.ChildrenBelow.Count > 0) firstStepChild = firstStepChild.ChildrenBelow[0];
|
||||
if (firstStepChild.MyItemInfo.IsNumbered)
|
||||
while (firstStepChild.ChildrenBelow.Count > 0 && (firstStepChild.MyItemInfo.IsSection || firstStepChild.MyItemInfo.IsHigh))
|
||||
{
|
||||
@@ -308,13 +271,12 @@ namespace Volian.Print.Library
|
||||
firstStepChild = firstStepChild.MyParent.ChildrenBelow[firstStepChild.MyParent.ChildrenBelow.Count - 1];
|
||||
float ySizeIncludingFirstStep = firstStepChild.YSize + (firstStepChild.YTopMost - YTopMost);
|
||||
float ySizeBtmCtnMess = GetBottomContinueMessageSize(MyItemInfo.MyDocStyle);
|
||||
float ySizeBtmEndMess = GetBottomEndMessageSize(MyItemInfo.MyDocStyle);
|
||||
float ySizeBtmEndMess = GetBottomEndMessageSize();
|
||||
bool firstSubstepExceedsSpaceAvailable = ySizeIncludingFirstStep > (yWithinMargins - ySizeBtmCtnMess -ySizeBtmEndMess);
|
||||
if (KeepStepsOnPage && firstSubstepExceedsSpaceAvailable && !isFirstChild)
|
||||
KeepStepsOnPage = false;
|
||||
if (ySizeIncludingFirst == YSize) KeepStepsOnPage = false;
|
||||
//float ySectionEndMsg = !_skipEndMessage && MyItemInfo.IsSection && MyItemInfo.Steps != null && MyItemInfo.Steps.Count == 1 && (MyItemInfo.MyDocStyle.End.Message ?? "") != "" ? 2 * SixLinesPerInch : 0;
|
||||
float ySectionEndMsg = (!_skipEndMessage && MyItemInfo.IsSection && MyItemInfo.Steps != null && MyItemInfo.Steps.Count == 1) ? GetEndMessageHeight(MyItemInfo.MyDocStyle) : 0; // B2018-068 account for mult-line End Messages
|
||||
float ySectionEndMsg = (!_skipEndMessage && MyItemInfo.IsSection && MyItemInfo.Steps != null && MyItemInfo.Steps.Count == 1) ? GetEndMessageHeight() : 0; // B2018-068 account for mult-line End Messages
|
||||
if (MyPageHelper.NotesToFootNotes != null && MyPageHelper.NotesToFootNotes.Count > 0)
|
||||
{
|
||||
float vpHeight = SixLinesPerInch;
|
||||
@@ -401,11 +363,10 @@ namespace Volian.Print.Library
|
||||
return 1;
|
||||
}
|
||||
|
||||
//MyPageHelper.HLSText = MyItemInfo.DisplayText; // save the High Level Step Text
|
||||
//Console.WriteLine("{0} Paginate", MyPageHelper.HLSText);
|
||||
StepConfig sc1 = MyItemInfo.MyConfig as StepConfig;
|
||||
ManualPageBreak = MyPageHelper.OriginalPageBreak ? (sc1 == null ? false : sc1.Step_ManualPagebreak) :
|
||||
sc1 == null ? false : (MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks == null) ? sc1.Step_NewManualPagebreak : false;
|
||||
ManualPageBreak = MyPageHelper.OriginalPageBreak ? (sc1 != null && sc1.Step_ManualPagebreak) :
|
||||
sc1 != null && ((MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks == null) && sc1.Step_NewManualPagebreak);
|
||||
// C2021-010: Remove trailing returns/spaces & manual page breaks & allow save.
|
||||
if (sc1 != null && sc1.Step_NewManualPagebreak &&
|
||||
MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks != null && !MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks.Contains(MyItemInfo.ItemID)) MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks.Add(MyItemInfo.ItemID);
|
||||
@@ -423,7 +384,6 @@ namespace Volian.Print.Library
|
||||
string firstStep = "No";
|
||||
if (MyItemInfo.IsHigh && MyItemInfo.MyPrevious == null)
|
||||
firstStep = "Yes";
|
||||
//if (!ManualPageBreak && mySize + yEndMsg <= yWithinMargins) // Don't Paginate if there is enough room, will fit on page
|
||||
// Pagination Fix - Break1LineShort1
|
||||
float yExtra = (yWithinMargins == yPageSize ? 0 : SixLinesPerInch - MyItemInfo.MyDocStyle.Layout.FooterLength) ?? 0;
|
||||
// Adjust yExtra and mySize for Component List items.
|
||||
@@ -452,11 +412,10 @@ namespace Volian.Print.Library
|
||||
// B2017-254 Fixed Pagination Logic when checking to see if the current item is the last high level step
|
||||
if (MyItemInfo.IsHigh && mySize >= (2 * SixLinesPerInch) && MyItemInfo.MyDocStyle.Layout.FooterLength > 0 && (MyItemInfo.MyDocStyle.End.Message == null || MyItemInfo.MyDocStyle.End.Message == "") && MyItemInfo.NextItem == null && (MyItemInfo.Steps == null || MyItemInfo.Steps.Count == 0) && (MyItemInfo.RNOs == null || MyItemInfo.RNOs.Count == 0))
|
||||
mySize -= SixLinesPerInch;
|
||||
//// Account for extra lines in the end message (flag < 0)
|
||||
float adjMsgY = 0;
|
||||
if (MyItemInfo.IsHigh && MyItemInfo.NextItem == null && MyItemInfo.MyDocStyle.End.Flag < 0) // Adjust this many lines down the page.
|
||||
{
|
||||
adjMsgY = (float)-MyItemInfo.MyDocStyle.End.Flag * SixLinesPerInch;
|
||||
//// Account for extra lines in the end message (flag < 0)
|
||||
float adjMsgY = (float)-MyItemInfo.MyDocStyle.End.Flag * SixLinesPerInch;
|
||||
if (yEndMsg != 0) yEndMsg += adjMsgY;
|
||||
}
|
||||
// F2023-015 check if on the first step of a sub-section that starts on its own page (separate pagination)
|
||||
@@ -489,7 +448,6 @@ namespace Volian.Print.Library
|
||||
ShowPageBreak(-1, "HLS will fit on page", firstStep, YSize, yPageSize, yWithinMargins,ManualPageBreak);
|
||||
return 0;
|
||||
}
|
||||
// !MyItemInfo.IsHigh - if (MyItemInfo.IsRNOPart && MyParent.XOffset < XOffset) return 0; // Don't paginate on an RNO to the right
|
||||
|
||||
// YSize includes a blank line after the step which we don't want to include in the page break test, thus the
|
||||
// YSize - SixLinesPerInch:
|
||||
@@ -504,8 +462,6 @@ namespace Volian.Print.Library
|
||||
if (MyItemInfo.IsStep && MyItemInfo.MyHLS.FormatStepData.StepLayoutData.STBoxindex != null && MyItemInfo.MyHLS.FormatStepData.StepLayoutData.STBoxindex >= 0 &&
|
||||
(MyItemInfo.RNOs == null || MyItemInfo.RNOs.Count == 0))
|
||||
mySize += (2 * SixLinesPerInch);
|
||||
//if (firstStep == "No")
|
||||
// ResetDocStyleAndValues(ref yTopMargin, ref yBottomMargin);
|
||||
if (MyPageHelper.DidFirstPageDocStyle && MyItemInfo.ActiveSection != null && (MyItemInfo.ActiveSection.MyDocStyle.StructureStyle.Where & E_DocStyleUse.UseOnAllButFirstPage) > 0)// C2018-003 fixed use of getting the active section
|
||||
yPageSizeNextPage = GetYPageSizeUseOnAllButFirstPage();
|
||||
|
||||
@@ -532,33 +488,28 @@ namespace Volian.Print.Library
|
||||
|
||||
// Keep figure (the only figure, i.e. count==1) with its parent.
|
||||
if (ChildrenBelow.Count == 1 && ChildrenBelow[0].MyItemInfo.IsFigure) KeepStepsOnPage = false;
|
||||
float sectionSpace = 0;
|
||||
if (doSectionTitleContinued)
|
||||
{
|
||||
if (SectionShowTitles)
|
||||
{
|
||||
vlnParagraph paraSect = MyParent;
|
||||
while (!paraSect.MyItemInfo.IsSection) paraSect = paraSect.MyParent;
|
||||
float sectionSpace;
|
||||
if (paraSect.ContinueHeight > 24)
|
||||
sectionSpace = paraSect.ContinueHeight;
|
||||
else
|
||||
sectionSpace = 2 * SixLinesPerInch;
|
||||
// sectionSpace = 3 * SixLinesPerInch;// this should actuall use the physical size of the continue messsage.
|
||||
// this should actuall use the physical size of the continue messsage.
|
||||
// Fixing this caused problems with pagination ex Calvert Unit 2 IO-1l section 6.1.B step 2
|
||||
//if (MyItemInfo.ActiveSection.DisplayText.Length < 40) sectionSpace = SixLinesPerInch;
|
||||
yPageSizeNextPage -= sectionSpace;
|
||||
yExtra -= sectionSpace;
|
||||
//yExtra2 -= sectionSpace; // This was removed for Calvert STP O-73H-2 Section 6.3.O.4 and 6.3.R.3
|
||||
}
|
||||
}
|
||||
// Added for section that was breaking from steps this code was removed to fix B2020-112
|
||||
//if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert && yPageSizeNextPage < yWithinMargins + 3 * 72 && MyItemInfo.MyPrevious == null)
|
||||
// KeepStepsOnPage = true;
|
||||
float mySize7LPI = mySize; // +SixLinesPerInch;
|
||||
float mySize7LPI = mySize;
|
||||
if (_Match16BitPagination) mySize7LPI += SixLinesPerInch;
|
||||
float tableSpaceAvailable = TableSpaceAvailable;// RHM20150525 - Table Scrunch
|
||||
float ySizeBtmCtnMess1 = GetBottomContinueMessageSize(MyItemInfo.MyDocStyle);
|
||||
float ySizeBtmEndMess1 = GetBottomEndMessageSize(MyItemInfo.MyDocStyle);
|
||||
float ySizeBtmEndMess1 = GetBottomEndMessageSize();
|
||||
// B2017-154 Don't leave an orphan on the next page if the high level step and first sub-step will fit on the current page
|
||||
if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.NoOrphans1 && KeepStepsOnPage && ChildrenBelow.Count == 2)// Handle Orphans when there are two sub-steps and only one will fit.
|
||||
{
|
||||
@@ -604,7 +555,6 @@ namespace Volian.Print.Library
|
||||
|
||||
// ySize7LPI includes a blank line after the step which we don't want to include in the page break test.
|
||||
else if (!KeepStepsOnPage && MyItemInfo.ActiveFormat.MyStepSectionLayoutData.CompressSteps
|
||||
//&& (mySize7LPI - SixLinesPerInch + yEndMsg - tableSpaceAvailable) < (yPageSizeNextPage * SixLinesPerInch / _SevenLinesPerInch))// RHM20150525 - Table Scrunch
|
||||
// if this is the first step, then the step has to fit in the space that remains on the page
|
||||
// otherwise it needs to fit on a blank page
|
||||
// This was originally (10/12/2015) added for Farley Shared AOP 79 but was found to be unnecessary
|
||||
@@ -631,24 +581,9 @@ namespace Volian.Print.Library
|
||||
float myFirstPieceSize = GetFirstPieceSize(); //Case 0
|
||||
if (_Match16BitPagination) myFirstPieceSize += 2 * SixLinesPerInch;
|
||||
// TODO: Put this line back to case 0, i.e. previous line. This fixes a 16-bit vs 32-bit pagination diff in EO30 Step 20.
|
||||
//float myFirstPieceSize = GetFirstPieceSize() + 2 * SixLinesPerInch; //Case 10 - this is to match 16bit
|
||||
//Case 10 - this is to match 16bit
|
||||
//is the amount of space left (yWithinMargins) is greater than 1/2 of the current page (yPageSize / 2):
|
||||
// VCS EOP-4.3 Step 15
|
||||
// ***** Adjust yWithinMargins for the bottom continue message
|
||||
//DocStyle docstyle = MyItemInfo.MyDocStyle;
|
||||
//string myBottomMsg = docstyle.Continue.Bottom.Message;
|
||||
//float myBottomMsgSpace = ((myBottomMsg ?? "") != "") ? 2 * SixLinesPerInch : 0;
|
||||
//switch (docstyle.Continue.Bottom.Location)
|
||||
//{
|
||||
// case E_ContBottomLoc.BottomOfPage: // place continue message at bottom of page
|
||||
// // The following format flag was added for FNP, without the flag (which stops the reset of BottomMsgSpace)
|
||||
// // a number of FNP procedures had overwritten steps/bottom continue message. An example can be
|
||||
// // found in FNP = SAMGS;FNP-1-SACRG-2, step 1.
|
||||
// if (!docstyle.Continue.Bottom.NoOverrideSpace)
|
||||
// myBottomMsgSpace = 0;
|
||||
// break;
|
||||
//}
|
||||
//float yWithinMarginsCM = yWithinMargins - myBottomMsgSpace;
|
||||
//// **** Adjust yWithinMargins for the bottom continue message
|
||||
// B2018-080 Don't break if HLS and High Level RNO each have one line of text and there are substeps (keep single line HSL and High Level RNO with their substeps) AEP AOP Unit 1 016-004 steps 36 & 74
|
||||
// B2018-081 The previous fix caused a different issue
|
||||
@@ -668,8 +603,6 @@ namespace Volian.Print.Library
|
||||
ySpaceOnFirstPage = yWithinMargins; // Accounts for Section Title Line
|
||||
//ShowPageBreak(8, CheckForCompression("First HLS has to split on current page"), firstStep, YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak);
|
||||
//}
|
||||
//else
|
||||
// ShowPageBreak(6, CheckForCompression("HLS will have to split on current page"), "Special", YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak);
|
||||
//BuildPageBreakList(yWithinMargins + SixLinesPerInch, yPageSizeNextPage + yExtra2, KeepStepsOnPage); // Case 5 - Determine items where page break(s) occur
|
||||
// B2020-027: adjust for lines that may print on first page of section only, added MyPageHelper.PrintedSectionPage
|
||||
// B2020-108: The bug itself was related to keeping a table with its parent. However compression for some pages was
|
||||
@@ -695,7 +628,6 @@ namespace Volian.Print.Library
|
||||
// o888o
|
||||
if (firstStep == "Yes")
|
||||
{
|
||||
//ySpaceOnFirstPage = yWithinMargins; // Accounts for Section Title Line
|
||||
ShowPageBreak(8, CheckForFirstCompression("First HLS has to split on current page"), firstStep, YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak);
|
||||
}
|
||||
else
|
||||
@@ -754,6 +686,7 @@ namespace Volian.Print.Library
|
||||
ShowPageBreak(3, CheckForFirstCompression("HLS will have to split on new page"), "Yes", YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak);
|
||||
return 1; // Paginate on High Level Steps
|
||||
}
|
||||
//For Debugging:
|
||||
//if (yWithinMargins > yPageSize / 2)
|
||||
//{
|
||||
// Console.WriteLine("'PageBreak',4,'No','Not Half way down the page',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath);
|
||||
@@ -780,7 +713,7 @@ namespace Volian.Print.Library
|
||||
return hasAER && hasRNO;
|
||||
}
|
||||
// B2018-058 the the end message height accounting for multi-line end messages
|
||||
private float GetEndMessageHeight(DocStyle docstyle)
|
||||
private float GetEndMessageHeight()
|
||||
{
|
||||
float EndMsgHeight = 0;
|
||||
string endmsg = MyItemInfo.MyDocStyle.End.Message ?? "";
|
||||
@@ -791,12 +724,12 @@ namespace Volian.Print.Library
|
||||
}
|
||||
return EndMsgHeight;
|
||||
}
|
||||
private float GetBottomEndMessageSize(DocStyle docstyle)
|
||||
private float GetBottomEndMessageSize()
|
||||
{
|
||||
float myBottomMsgSpace = 0;
|
||||
if (MyItemInfo.IsHigh && MyItemInfo.NextItem == null && MyItemInfo.MyDocStyle.End.Flag < 0) // Adjust this many lines down the page.
|
||||
{
|
||||
docstyle = MyItemInfo.MyDocStyle;
|
||||
DocStyle docstyle = MyItemInfo.MyDocStyle;
|
||||
string myBottomMsg = docstyle.End.Message;
|
||||
myBottomMsgSpace = ((myBottomMsg ?? "") != "") ? 2 * SixLinesPerInch : 0;
|
||||
if (myBottomMsg != null && docstyle.End.Flag < 0) myBottomMsgSpace += (-(float)docstyle.End.Flag * SixLinesPerInch);
|
||||
@@ -806,20 +739,20 @@ namespace Volian.Print.Library
|
||||
private string CheckForFirstCompression(string reason)
|
||||
{
|
||||
if (MyPageHelper.ParaBreaks.Count > 0 && MyPageHelper.ParaBreaks[0].CompressFirstPartOfStep)
|
||||
return reason + " - 7 LPI";
|
||||
return $"{reason} - 7 LPI";
|
||||
return reason;
|
||||
}
|
||||
private string CheckForCompression(string reason)
|
||||
{
|
||||
if (CompressPartOfStep)
|
||||
return reason + " - 7 LPI";
|
||||
return $"{reason} - 7 LPI";
|
||||
return reason;
|
||||
}
|
||||
private string AddReason(string prefix)
|
||||
{
|
||||
string retval = prefix;
|
||||
if (PageBreakReason != null)
|
||||
retval += " - " + PageBreakReason;
|
||||
retval += $" - {PageBreakReason}";
|
||||
return retval;
|
||||
}
|
||||
private bool SectionShowTitles
|
||||
@@ -864,8 +797,6 @@ namespace Volian.Print.Library
|
||||
DebugText.WriteLine("*****PaginateError");
|
||||
yPageStart = yTopMargin + YVeryTop;
|
||||
yLocation = yPageStart - YOffset;
|
||||
//MyItemInfo.ItemID, YSize, yPageSize, yLocation
|
||||
//_MyLog.ErrorFormat("<<< ERROR >>> Forced Pagination - ItemID = {0}\r\nLocation = '{1}'", MyItemInfo.ItemID, MyItemInfo.ShortPath);
|
||||
_MyLog.ErrorFormat("<<< ERROR >>> Forced Pagination\r\n==>'Forced Pagination',{0},'{1}','{2}'"
|
||||
, MyItemInfo.ItemID, MyItemInfo.MyDocVersion.MyFolder.Name, MyItemInfo.ShortPath);
|
||||
if (DebugPagination.IsOpen) DebugPagination.WriteLine("=====>,'Yes','Forced Pagination',{0},{1},,{3},'{4}'", MyItemInfo.ItemID, YSize, 0, yLocation, MyItemInfo.ShortPath);
|
||||
@@ -927,10 +858,7 @@ namespace Volian.Print.Library
|
||||
return _AlternateBreaks;
|
||||
}
|
||||
}
|
||||
private void AddAlternateBreak(vlnParagraph vp)
|
||||
{
|
||||
AlternateBreaks.Add(vp);
|
||||
}
|
||||
private void AddAlternateBreak(vlnParagraph vp) => AlternateBreaks.Add(vp);
|
||||
private bool CheckAlternates(vlnParagraph vpBrk)
|
||||
{
|
||||
if (_AlternateBreaks == null) return false;
|
||||
@@ -957,7 +885,7 @@ namespace Volian.Print.Library
|
||||
public float yPageSizeForPagination = -1;
|
||||
private void BuildPageBreakList(float ySpaceOnCurPage, float yPageSize, bool KeepStepsOnPage, float yEndMsg, bool doSectionTitleContinued, bool onNewPage)
|
||||
{
|
||||
float topContinueHeight = 2 * SixLinesPerInch;
|
||||
float topContinueHeight; //Defaults to: 2 * SixLinesPerInch;
|
||||
int profileDepth = ProfileTimer.Push(">>>> BuildPageBreakList");
|
||||
// if this paragraph is flagged to pagebreakonstep (i.e. these are used by background documents
|
||||
// to get each hls/caution/note to be on its own page), then any of the children above should
|
||||
@@ -997,9 +925,8 @@ namespace Volian.Print.Library
|
||||
// the following logic was added to fix Pagination for VCS BDMG1 Step 4
|
||||
if (ChildrenRight.Count > 0 && ChildrenRight[0].YOffset == YOffset)
|
||||
{
|
||||
float myFirstPieceRNOSize = 0;
|
||||
myFirstPieceRNOSize = ChildrenRight[0].GetFirstPieceSize();
|
||||
if(myFirstPieceRNOSize < ySpaceOnCurPage)
|
||||
float myFirstPieceRNOSize = ChildrenRight[0].GetFirstPieceSize();
|
||||
if (myFirstPieceRNOSize < ySpaceOnCurPage)
|
||||
if (ChildrenBelow.Count > 0)
|
||||
{
|
||||
float myFirstPieceAERSize = ChildrenBelow[0].GetFirstPieceSize() + ChildrenBelow[0].YOffset - YOffset;
|
||||
@@ -1008,7 +935,6 @@ namespace Volian.Print.Library
|
||||
}
|
||||
}
|
||||
if (myFirstPieceSize < ySpaceOnCurPage) yLowerLimit = Math.Max(myFirstPieceSize + yStart, yLowerLimit);
|
||||
//while ((YSize - yTop) >= ySpaceOnCurPage)
|
||||
// Pagination Fix Break1LineShort3b
|
||||
DocStyle docstyle = MyItemInfo.MyDocStyle;
|
||||
float myBottomMsgSpace = GetBottomContinueMessageSize(docstyle);
|
||||
@@ -1052,21 +978,12 @@ namespace Volian.Print.Library
|
||||
// The following code determines space required by the Checklist header (Wolf Creek) if a break occurs
|
||||
// Their 2 HLS that define the checklists have 'UseSmartTemplate'.
|
||||
float accountForSmartTemplateHeader = 0;
|
||||
//if (MyItemInfo.InList(878)) Console.WriteLine("Here");
|
||||
if (MyItemInfo.FormatStepData.UseSmartTemplate)
|
||||
{
|
||||
if (((MyItemInfo.MyDocStyle.End.Message ?? "") == "") || MyItemInfo.MyHLS.NextItem != null)
|
||||
ySpaceOnCurPage += SixLinesPerInch;
|
||||
accountForSmartTemplateHeader = Height - (2 * SixLinesPerInch);
|
||||
}
|
||||
// This was added so that if a page break was immediately necessary the code would use the current step.
|
||||
// However, a better solution was found and put in Paginate()
|
||||
//if (YSize == Height + SixLinesPerInch && YSize + yEndMsg >= ySpaceOnCurPage)
|
||||
//{
|
||||
// _MyLog.WarnFormat("Would have been unable to break {0},{1}",MyItemInfo.ItemID, MyItemInfo.ShortPath);
|
||||
// MyPageHelper.ParaBreaks.Add(this);
|
||||
// return;
|
||||
//}
|
||||
// ooooo ooo . oooooooooo. oooo
|
||||
// `888b. `8' .o8 `888' `Y8b `888
|
||||
// 8 `88b. 8 .ooooo. oooo ooo .o888oo 888 888 oooo d8b .ooooo. .oooo. 888 oooo
|
||||
@@ -1170,7 +1087,8 @@ namespace Volian.Print.Library
|
||||
myBottomMsgSpace, MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].ContinueOnly, yTop);
|
||||
if (paraBreak2 != null && paraBreak != paraBreak2)
|
||||
{
|
||||
yLoc = ySpaceOnCurPage - (paraBreak2.YOffset - (YTopMost + yTop - paraBreak2.Height));
|
||||
//For Debugging:
|
||||
//yLoc = ySpaceOnCurPage - (paraBreak2.YOffset - (YTopMost + yTop - paraBreak2.Height));
|
||||
if (paraBreak.YOffset == paraBreak2.YOffset + paraBreak2.Height)
|
||||
{
|
||||
//_MyLog.WarnFormat("Fix Break when no blank line {0},{1},{2}", paraBreak2.MyItemInfo.ShortPath, paraBreak2.MyItemInfo.ItemID,yLoc);
|
||||
@@ -1211,10 +1129,7 @@ namespace Volian.Print.Library
|
||||
}
|
||||
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm) // only do the following for Calvert Alarms
|
||||
{
|
||||
//if (lastBreak != null && lastBreak.MyItemInfo.InList(42656,42923)) Console.WriteLine("here");
|
||||
// Or Step whose parent fits on a page should break at the parent step
|
||||
//if (MyItemInfo.InList(119826)) Console.WriteLine("here");
|
||||
//if (paraBreak.MyItemInfo.InList(40339))
|
||||
float ySpaceOnNextPage = yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace;
|
||||
if (paraBreak.MyItemInfo.IsOr && paraBreak.MyParent.YSize < ySpaceOnNextPage)
|
||||
{
|
||||
@@ -1307,7 +1222,8 @@ namespace Volian.Print.Library
|
||||
if (firstLevel.MyParent.ChildrenBelow != null && firstLevel.MyParent.ChildrenBelow.Count > 0 && firstLevel.MyParent.ChildrenBelow[0] != firstLevel &&
|
||||
firstLevel.YSize < yPageSize - (myTopMsgSpace + SixLinesPerInch))
|
||||
{
|
||||
vlnParagraph firstLevel1 = firstLevel;
|
||||
//For Debugging:
|
||||
//vlnParagraph firstLevel1 = firstLevel;
|
||||
if (firstLevel.ChildrenAbove != null && firstLevel.ChildrenAbove.Count > 0) // If the aerParent has caution or note
|
||||
firstLevel = firstLevel.ChildrenAbove[0];//, break on the caution or note.
|
||||
if (firstLevel != lastBreak && paraBreak != firstLevel)
|
||||
@@ -1320,14 +1236,10 @@ namespace Volian.Print.Library
|
||||
}
|
||||
// If the break is going to happen on a table, and the tables parent would fit on a page with the table
|
||||
// and the text in the parent includes the word table, then break on the parent
|
||||
//if (lastBreak != paraBreak.MyParent && paraBreak.MyItemInfo.IsTable && paraBreak.YSize < ySpaceOnCurPage && paraBreak.MyParent.MyItemInfo.DisplayText.ToUpper().Contains("TABLE"))
|
||||
// paraBreak = paraBreak.MyParent;
|
||||
//paraBreak.ShowPageBreak(999, paraBreak.MyItemInfo.ShortPath, "Yes",paraBreak.YTop, paraBreak.YSize, paraBreak.Height, false);
|
||||
//_MyLog.InfoFormat("Place to break\r\n==>'Place to Break',{0},'{1}','{2}'"
|
||||
//, paraBreak.MyItemInfo.ItemID, paraBreak.MyItemInfo.MyDocVersion.MyFolder.Name, paraBreak.MyItemInfo.ShortPath);
|
||||
// yTopNew is y Location of this page break. YTopMost is top of HLS, including any Cautions/Notes/Boxes/etc
|
||||
//float yTopNew = paraBreak.YVeryTop - YTopMost;
|
||||
//float yTopNew = paraBreak.YTopMost - YTopMost;
|
||||
if (JustATableThatWillFit(paraBreak, yPageSize - (myTopMsgSpace + yEndMsg)))
|
||||
paraBreak = paraBreak.ChildrenBelow[0];
|
||||
// B2020-112: complicated AER/RNO. yEndMsg was accounted for twice -> put endmsg part back in, it broke wcn and didn't affect bge
|
||||
@@ -1412,14 +1324,6 @@ namespace Volian.Print.Library
|
||||
PageBreakOnStepList.RemoveAt(0);
|
||||
yTopNew = paraBreak.YTop - YTopMost;
|
||||
}
|
||||
// The following code caused forced pagination for Catawba EOP BG - EP/1/A/5000/FR-C.1.SC..S16..N2..S4..S1.
|
||||
//else if(PageBreakOnStepList[0].YSize - yTop <= ySpaceOnCurPage)
|
||||
//{
|
||||
// DebugPagination.WriteLine("======>>>>> Other Condition");
|
||||
// paraBreak = PageBreakOnStepList[0];
|
||||
// PageBreakOnStepList.RemoveAt(0);
|
||||
// yTopNew = paraBreak.YTop - YTopMost;
|
||||
//}
|
||||
}
|
||||
RemoveProcessedParagraphs(myList, yTopNew - yTop);
|
||||
yTop = yTopNew;
|
||||
@@ -1440,13 +1344,6 @@ namespace Volian.Print.Library
|
||||
// B2017-252 Pagination Fix - RNP was not paginating correctly. Added logic to set ySPaceOnCurPage if ySpaceOnNextPage was larger
|
||||
if (!usedPageBreakOnStepList || ySpaceOnNextPage1 > ySpaceOnCurPage) ySpaceOnCurPage = ySpaceOnNextPage1;
|
||||
|
||||
//ySpaceOnCurPage = yPageSize - (myTopMsgSpace + SixLinesPerInch); // Allow for continue message and blank line.
|
||||
//if (paraBreak.YTopMost != paraBreak.YVeryTop && MyPageHelper.TopMessage == null && MyPageHelper.BottomMessage == null)
|
||||
// ySpaceOnCurPage = yPageSize;
|
||||
//ySpaceOnCurPage = yPageSize; // Allow for continue message and blank line.
|
||||
//DocStyle docstyle = MyItemInfo.MyDocStyle;
|
||||
//string myMsg = docstyle.Continue.Bottom.Message;
|
||||
//if ((myMsg ?? "") != "") ySpaceOnCurPage -= 2 * SixLinesPerInch; // Allow for continue message and blank line.
|
||||
yLowerLimit = ySpaceOnCurPage / 2;
|
||||
if (_Match16BitPagination) yLowerLimit -= 1.5F * SixLinesPerInch; // 276 for HLP
|
||||
yStart = 0;
|
||||
@@ -1505,7 +1402,6 @@ namespace Volian.Print.Library
|
||||
{
|
||||
// C2023-015: Pagination on a sub-step added. Do the code if supplemental info or if format supports sub-step pagination
|
||||
// C2023-018: Remove the supplemental info & alarm check, doing the possible page breaks on sub-steps
|
||||
//if (!MyItemInfo.MyDocStyle.SupplementalInformation && !MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.AlarmPagination) return null;
|
||||
SortedList<float, vlnParagraph> sdpara = null;
|
||||
foreach (int stepLevel in myList.Keys) // loop thru StepLevels, starting with lowest.
|
||||
{
|
||||
@@ -1534,8 +1430,7 @@ namespace Volian.Print.Library
|
||||
|
||||
private float GetBottomContinueMessageSize(DocStyle docstyle)
|
||||
{
|
||||
float myBottomMsgSpace = 0;
|
||||
docstyle = MyItemInfo.MyDocStyle;
|
||||
float myBottomMsgSpace;
|
||||
string myBottomMsg = docstyle.Continue.Bottom.Message;
|
||||
myBottomMsgSpace = ((myBottomMsg ?? "") != "") ? 2 * SixLinesPerInch : 0;
|
||||
if (myBottomMsg != null && myBottomMsg.Contains("par")) myBottomMsgSpace += SixLinesPerInch;
|
||||
@@ -1603,7 +1498,7 @@ namespace Volian.Print.Library
|
||||
float? yLocationMin=null;
|
||||
vlnParagraph minPara2 = null;
|
||||
float? yLocationMin2=null;
|
||||
float yAddForBtmMsg = 0;
|
||||
float yAddForBtmMsg;
|
||||
// useful for debugging pagination issues, lastbreak gets the paragraph at the top of the previous page, shows all
|
||||
// of the locations within 'range' on the next page.
|
||||
//if (lastBreak != null && lastBreak.MyItemInfo.InList(72481))
|
||||
@@ -1670,16 +1565,9 @@ namespace Volian.Print.Library
|
||||
// Note that this bug fix for WCN was commented out. Harry Julian wanted this on 11/15/19. A new bug will be written for the WCN error.
|
||||
// B2019-173 reintroduced the 'IsHigh' portion and added IsRNOPart, the HLS & RNOPart print at same location on page so code needs
|
||||
// to account for either. second iteration of this fix removed IsRNOPart (see code in Paginate)
|
||||
&& !myParent.MyItemInfo.IsHigh) /*|| myPara.MyItemInfo.IsRNOPart)) */// B2018-104: don't return if my parent is a high level - a top continue message was printing
|
||||
&& !myParent.MyItemInfo.IsHigh) // B2018-104: don't return if my parent is a high level - a top continue message was printing
|
||||
{
|
||||
//_MyLog.WarnFormat("\r\nMyParentBreak {0},{1},{2},{3},{4}", myParent, myParent.YSize, yUpperLimit, myParent.ChildrenRight[0].YSize, spaceOnPage);
|
||||
// Removed the following and moved logic to Paginate method for the second iteration of the bug fix. This code below AND the IsRNOPart above caused another
|
||||
// pagination problem. The insert and subsequent removal of this code are both done under bug B22019-173.
|
||||
// Initial code for B2019-173: make minPara2 the first step on next page
|
||||
//if (minPara2 != null && minPara2.MyParent == myParent && minPara2 != lastBreak && minPara2.MyItemInfo.Ordinal == 1)
|
||||
//{
|
||||
// return minPara2;
|
||||
//}
|
||||
if (myParent != lastBreak)
|
||||
return myParent;
|
||||
}
|
||||
@@ -1736,17 +1624,11 @@ namespace Volian.Print.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
//while (myPara.MyParent.YTop == myPara.YTop) myPara = myPara.MyParent;
|
||||
while (myPara.MyParent != null && myPara.MyParent.YTop == myPara.YTop) myPara = myPara.MyParent;
|
||||
int everyNLines = myPara.MyItemInfo.MyPrevious != null && myPara.MyItemInfo.FormatStepData == null ? 1 : myPara.MyItemInfo.FormatStepData.StepLayoutData.EveryNLines ?? 1;
|
||||
bool inSameBox = InSameBox(myPara, minPara2); // if this note/caution is in same box as the break, don't break within the notes/cautions in the same box
|
||||
if (!inSameBox && myPara.ChildrenAbove.Count == 0 && wcnChkLstBorder - yLocation < yUpperLimit + yAddForBtmMsg || (everyNLines != 99 && (wcnChkLstBorder - yLocation == yUpperLimit + yAddForBtmMsg))) // Fix for OFN-RJ-23
|
||||
//if (-yLocation < yUpperLimit) // Before
|
||||
//if (-yLocation < yWithinMargins && myList[stepLevel][yLocation].MyItemInfo.MyPrevious != null)
|
||||
{
|
||||
//ItemInfo prev = myList[stepLevel][yLocation].MyItemInfo.MyPrevious;
|
||||
//if (myList[stepLevel][yLocation].MyItemInfo.ItemID == 5609) Console.WriteLine("aer");
|
||||
//if (myList[stepLevel][yLocation].MyItemInfo.ItemID == 4312) Console.WriteLine("rno");
|
||||
// The top of this step is more than 1/2 way down the page
|
||||
if ((-yLocation + yStart) >= yLowerLimit)
|
||||
if (myPara != lastBreak)
|
||||
@@ -1825,6 +1707,7 @@ namespace Volian.Print.Library
|
||||
// B2020-081 was breaking on an AER substep that has an long RNO - should keep AER substep and part of RNO on the page = D.C. Cook "Current (Post FLEX) U1 NOP NOT [EOPs]" set, ES-0.1 step 1.
|
||||
// B2020-085 was breaking first child of second RNO (third IF in RNO) - should break on second child of second RNO - D.C. Cook AOP Unit 1 002-020 Step 15
|
||||
// B2020-099 was breaking on last sub-step of previous RNO - Calvert Approved Procedures; Abnormal Procedures – Unit 2; AOP-2A; Section VII; Step 11.RNO.11.1.c
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Keeping myList and stepLevel for Debugging")]
|
||||
private vlnParagraph HasSecondRNOThatWillFit(float yStart, float yLowerLimit, float yUpperLimit, StepLevelList myList, int stepLevel, float yTop)
|
||||
{
|
||||
// B2020-120: for calvert alarms/condition response table, don't run code for second rno
|
||||
@@ -1856,12 +1739,6 @@ namespace Volian.Print.Library
|
||||
if ((chld.YTopMost + yStart + yTop - yTopParent) < yUpperLimit)
|
||||
return chld; // second RNO will fit, use this instead of myPara
|
||||
|
||||
// check to see if there is AER substep children that would be split if we pagination on the RNO
|
||||
// B2020-150 commented out below. Found it is not needed for B2020-085 fix but it was what cause B2020-150
|
||||
//foreach (vlnParagraph chld in parent.ChildrenBelow)
|
||||
// if (chld.YOffset < this.YOffset && YBottomMostExcludingRNO(chld) > this.YTopMost) // B2020-085 Does AER child start before myPara and length greater than myPara start
|
||||
// return null; // the AER text positioning overlaps the RNO text positioning (caused AER sub-steps to be split onto next page (i.e. RO step) have pagination logic keep looking for place to break
|
||||
|
||||
return this; // current myPara is good
|
||||
}
|
||||
|
||||
@@ -1903,6 +1780,7 @@ namespace Volian.Print.Library
|
||||
}
|
||||
return false;
|
||||
}
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Keeping yLocation for Debugging")]
|
||||
private static int MaxBreakLevel(float yLocation, StepLevelList myList, int maxLevel, vlnParagraph myParaBreak)
|
||||
{
|
||||
foreach (int stepLevel in myList.Keys)
|
||||
@@ -1935,27 +1813,7 @@ namespace Volian.Print.Library
|
||||
if (MyParent == null || MyParent.MyItemInfo.IsHigh) return false;
|
||||
return MyParent.HasAncestor(myParaBreak);
|
||||
}
|
||||
//private void WalkStepLevel(float yTopMost)
|
||||
//{
|
||||
// foreach (vlnParagraph child in ChildrenAbove)
|
||||
// child.WalkStepLevel(yTopMost);
|
||||
// foreach (vlnParagraph child in ChildrenLeft)
|
||||
// child.WalkStepLevel(yTopMost);
|
||||
// ShowStepLevel(yTopMost);
|
||||
// foreach (vlnParagraph child in ChildrenRight)
|
||||
// child.WalkStepLevel(yTopMost);
|
||||
// foreach (vlnParagraph child in ChildrenBelow)
|
||||
// child.WalkStepLevel(yTopMost);
|
||||
//}
|
||||
//private void ShowStepLevel(float yTopMost)
|
||||
//{
|
||||
// ItemInfo item = MyItemInfo;
|
||||
// ItemInfo parent = item.ActiveParent as ItemInfo;
|
||||
// //if (para.MyItemInfo.ItemID == 205)
|
||||
// // Console.Write("");
|
||||
// DebugPagination.WriteLine("'StepLevel',{0},{1},{2},{3},{4},{5},{6},{7},{8},{9}", YVeryTop - yTopMost, YSize, YBottomMost - yTopMost, item.ItemID, item.DBSequence, item.StepLevel, item.MyContent.Type % 10000,
|
||||
// parent.MyContent.Type % 10000, item.HasCautionOrNote ? 1 : 0, parent.Cautions == null ? 0 : 1);
|
||||
//}
|
||||
|
||||
public float TableSpaceAvailable// RHM20150525 - Table Scrunch
|
||||
{
|
||||
get // B2019-111 Keep AER Table with parent when RNO extends past the end of the page.
|
||||
@@ -1992,18 +1850,7 @@ namespace Volian.Print.Library
|
||||
}
|
||||
public partial class VlnSvgPageHelper : SvgPageHelper
|
||||
{
|
||||
private bool _OriginalPageBreak; // use 16bit page breaks.
|
||||
public bool OriginalPageBreak
|
||||
{
|
||||
get { return _OriginalPageBreak; }
|
||||
set { _OriginalPageBreak = value; }
|
||||
}
|
||||
// This handles Page Breaks within a Step
|
||||
private List<vlnParagraph> _ParaBreaks = new List<vlnParagraph>();
|
||||
public List<vlnParagraph> ParaBreaks
|
||||
{
|
||||
get { return _ParaBreaks; }
|
||||
set { _ParaBreaks = value; }
|
||||
}
|
||||
public bool OriginalPageBreak { get; set; }
|
||||
public List<vlnParagraph> ParaBreaks { get; set; } = new List<vlnParagraph>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using LBWordLibrary;
|
||||
using VEPROMS.CSLA.Library;
|
||||
using System.Text.RegularExpressions;
|
||||
@@ -10,12 +7,12 @@ namespace Volian.Print.Library
|
||||
{
|
||||
public class Placekeeper : IDisposable
|
||||
{
|
||||
private LBApplicationClass _WordApp;
|
||||
private LBDocumentClass _WordDoc;
|
||||
private LBSelection _WordSel;
|
||||
private readonly LBApplicationClass _WordApp;
|
||||
private readonly LBDocumentClass _WordDoc;
|
||||
private readonly 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.";
|
||||
private VE_Font _pkFont;
|
||||
private readonly VE_Font _pkFont;
|
||||
public Placekeeper()
|
||||
{
|
||||
_WordApp = new LBApplicationClass();
|
||||
@@ -28,37 +25,11 @@ namespace Volian.Print.Library
|
||||
_WordApp.Visible = true;
|
||||
_WordApp.Activate();
|
||||
}
|
||||
//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, VE_Font pkFont)
|
||||
{
|
||||
_WordApp = new LBApplicationClass();
|
||||
_WordDoc = _WordApp.Documents.Add();
|
||||
_WordSel = _WordApp.Selection;
|
||||
//_WordApp.Visible = true;
|
||||
_pkFont = pkFont;
|
||||
AddTable();
|
||||
AddHeader();
|
||||
@@ -97,7 +68,7 @@ namespace Volian.Print.Library
|
||||
if (cpgh.MyCautionsAndNotes.Count > 0)
|
||||
AddNotesOrCautions(cpgh,level, ref conAct);
|
||||
if (!conAct)
|
||||
conAct = IsContinuousActionPlacekeeper(conAct, cpgh);
|
||||
conAct = IsContinuousActionPlacekeeper(cpgh);
|
||||
ContinueSubStep(cpgh.MyParagraph.MyItemInfo.FormattedDisplayText, level);
|
||||
AddChildren(cpgh, level+1, ref conAct);
|
||||
}
|
||||
@@ -108,17 +79,12 @@ namespace Volian.Print.Library
|
||||
foreach (pkParagraph cpgh in pgh.MyCautionsAndNotes)
|
||||
{
|
||||
if (!conAct)
|
||||
conAct = IsContinuousActionPlacekeeper(conAct, cpgh);
|
||||
conAct = IsContinuousActionPlacekeeper(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 static bool IsContinuousActionPlacekeeper(pkParagraph pkPar) => (pkPar.MyParagraph.MyItemInfo.MyConfig as StepConfig).Step_Placekeeper.ToUpper() == "C";
|
||||
|
||||
private void ContinueNoteOrCaution(ItemInfo ii, int level)
|
||||
{
|
||||
@@ -176,22 +142,17 @@ namespace Volian.Print.Library
|
||||
_WordTbl.TopPadding = 6F;
|
||||
_WordTbl.BottomPadding = 6F;
|
||||
LBColumn col = _WordTbl.Columns.First;
|
||||
//col.SetWidth(12F, LBWdRulerStyle.wdAdjustNone);
|
||||
//col = col.Next;
|
||||
col.SetWidth(72 * .91F, LBWdRulerStyle.wdAdjustNone);
|
||||
col = col.Next;
|
||||
col.SetWidth(72 * 4.1F, LBWdRulerStyle.wdAdjustNone);
|
||||
col = col.Next;
|
||||
//col.SetWidth(72 * .81F, LBWdRulerStyle.wdAdjustNone);
|
||||
col.SetWidth(72 * .76F, LBWdRulerStyle.wdAdjustNone);
|
||||
col = col.Next;
|
||||
//col.SetWidth(72 * .81F, LBWdRulerStyle.wdAdjustNone);
|
||||
col.SetWidth(72 * .76F, LBWdRulerStyle.wdAdjustNone);
|
||||
_WordTbl.Rows.AllowBreakAcrossPages = 0;
|
||||
}
|
||||
private void AddHeader()
|
||||
{
|
||||
//Advance();
|
||||
WriteCell("START", true, true);
|
||||
SetIndent(0.32F, -0F);
|
||||
WriteCell("FUNCTION", true, true);
|
||||
@@ -219,7 +180,6 @@ namespace Volian.Print.Library
|
||||
// follow through in fixing an Out of Window Handles bug, use new function to see if
|
||||
// we can retrieve the font from a dictionary instead a doing a New and using another
|
||||
// window handle B2017-117
|
||||
//System.Drawing.Font font = new System.Drawing.Font(_pkFont.Family, (float)_pkFont.Size);
|
||||
System.Drawing.Font font = VE_Font.GetWinSysFont(_pkFont.Family, (float)_pkFont.Size);
|
||||
iTextSharp.text.Font iFont = Volian.Svg.Library.VolianPdf.GetFont(font);
|
||||
float w = 0;
|
||||
@@ -227,8 +187,6 @@ namespace Volian.Print.Library
|
||||
{
|
||||
w += iFont.BaseFont.GetWidthPointKerned(c.ToString(), (float)_pkFont.Size);
|
||||
}
|
||||
// indented text didn't always line up doing it this way
|
||||
//float w = iFont.BaseFont.GetWidthPointKerned(txt, (float)_pkFont.Size);
|
||||
return w;
|
||||
}
|
||||
private void AddHighLevelStep(string number, string text, string done, string page)
|
||||
@@ -276,7 +234,6 @@ namespace Volian.Print.Library
|
||||
{
|
||||
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);
|
||||
@@ -316,7 +273,7 @@ namespace Volian.Print.Library
|
||||
SetAlignment(LBWdParagraphAlignment.wdAlignParagraphCenter, LBWdCellVerticalAlignment.wdCellAlignVerticalBottom);
|
||||
WriteCell(page, false, false);
|
||||
}
|
||||
static Regex rgx = new Regex(@"\\(b|ul|up[1-9]|dn0|up0|dn[1-9]|b0|ulnone)( |$|(?=\\))");
|
||||
static readonly Regex rgx = new Regex(@"\\(b|ul|up[1-9]|dn0|up0|dn[1-9]|b0|ulnone)( |$|(?=\\))");
|
||||
private void WriteRTF(string text)
|
||||
{
|
||||
//if (text.Contains("\\"))
|
||||
@@ -381,13 +338,7 @@ namespace Volian.Print.Library
|
||||
{
|
||||
_WordSel.MoveRight(LBWdUnits.wdCell, count, false);
|
||||
}
|
||||
private void Advance()
|
||||
{
|
||||
Advance(1);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_WordApp.Quit(false);
|
||||
}
|
||||
private void Advance() => Advance(1);
|
||||
public void Dispose() => _WordApp.Quit(false);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,12 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using iTextSharp.text;
|
||||
using iTextSharp.text.pdf;
|
||||
using iTextSharp.text.factories;
|
||||
using Itenso.Rtf;
|
||||
using Itenso.Rtf.Parser;
|
||||
using Itenso.Rtf.Interpreter;
|
||||
using Itenso.Rtf.Support;
|
||||
using System.IO;
|
||||
using VEPROMS.CSLA.Library;
|
||||
@@ -37,24 +32,14 @@ namespace Volian.Print.Library
|
||||
#region Log4Net
|
||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
#endregion
|
||||
private string _Rtf;
|
||||
|
||||
public string Rtf
|
||||
{
|
||||
get { return _Rtf; }
|
||||
set { _Rtf = value; }
|
||||
}
|
||||
private string _FileName;
|
||||
public string Rtf { get; set; }
|
||||
|
||||
public string FileName
|
||||
{
|
||||
get { return _FileName; }
|
||||
set { _FileName = value; }
|
||||
}
|
||||
public string FileName { get; set; }
|
||||
public Rtf2Pdf(string rtf, string fileName)
|
||||
{
|
||||
_Rtf = rtf;
|
||||
_FileName = fileName;
|
||||
Rtf = rtf;
|
||||
FileName = fileName;
|
||||
}
|
||||
public void Process()
|
||||
{
|
||||
@@ -83,66 +68,30 @@ namespace Volian.Print.Library
|
||||
yTop = newYTop;
|
||||
}
|
||||
}
|
||||
private static string _PaperSize = "LETTER"; // default paper size
|
||||
|
||||
public static string PaperSize // C2020-002 paper size is now set in the format files
|
||||
{
|
||||
get { return Rtf2Pdf._PaperSize; }
|
||||
set { Rtf2Pdf._PaperSize = value; }
|
||||
}
|
||||
private Rectangle _PaperSizeRec = PageSize.LETTER; // default paper size
|
||||
public Rectangle PaperSizeRec
|
||||
{
|
||||
get { return PDFPageSize.UsePaperSize(PaperSize); }
|
||||
}
|
||||
private static bool _PdfDebug = true;
|
||||
public static bool PdfDebug
|
||||
{
|
||||
get { return Rtf2Pdf._PdfDebug; }
|
||||
set { Rtf2Pdf._PdfDebug = value; }
|
||||
}
|
||||
{ get; set; } = "LETTER";
|
||||
public Rectangle PaperSizeRec => PDFPageSize.UsePaperSize(PaperSize); // default paper size = PageSize.LETTER
|
||||
|
||||
public static bool PdfDebug { get; set; } = true;
|
||||
private static System.Drawing.PointF _Offset = new System.Drawing.PointF(0, 0);
|
||||
public static System.Drawing.PointF Offset
|
||||
{
|
||||
get { return Rtf2Pdf._Offset; }
|
||||
set { Rtf2Pdf._Offset = value; }
|
||||
get { return _Offset; }
|
||||
set { _Offset = value; }
|
||||
}
|
||||
public static float FillWidth = 0; // max text width (used in autoToc code)
|
||||
private static int _TextAtCounter = 0;
|
||||
public static int TextAtCounter
|
||||
{
|
||||
get { return Rtf2Pdf._TextAtCounter; }
|
||||
set { Rtf2Pdf._TextAtCounter = value; }
|
||||
}
|
||||
private static int NextTextAtCounter
|
||||
{
|
||||
get
|
||||
{
|
||||
int retval = ++TextAtCounter;
|
||||
//if (InList(retval, 17)) Console.WriteLine("TextAt {0}", retval);
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
public static int TextAtCounter { get; set; } = 0;
|
||||
private static int NextTextAtCounter => ++TextAtCounter;
|
||||
public class VlnSplitCharacter : ISplitCharacter
|
||||
{
|
||||
public bool IsSplitCharacter(int start, int current, int end, char[] cc, PdfChunk[] ck)
|
||||
{
|
||||
return (cc[current] == ' ');
|
||||
}
|
||||
public bool IsSplitCharacter(char c)
|
||||
{
|
||||
return (c == ' ');
|
||||
}
|
||||
}
|
||||
private static TableScrunching _AllowTableScrunching = TableScrunching.AllPhases; // RHM20150507 Table Scrunch
|
||||
public static TableScrunching AllowTableScrunching
|
||||
{
|
||||
get { return Rtf2Pdf._AllowTableScrunching; }
|
||||
set { Rtf2Pdf._AllowTableScrunching = value; }
|
||||
}
|
||||
public static bool GetTableScrunchingStatus(TableScrunching val)
|
||||
{
|
||||
return (val & _AllowTableScrunching) == val;
|
||||
public bool IsSplitCharacter(int start, int current, int end, char[] cc, PdfChunk[] ck) => (cc[current] == ' ');
|
||||
public bool IsSplitCharacter(char c) => (c == ' ');
|
||||
}
|
||||
|
||||
public static TableScrunching AllowTableScrunching { get; set; } = TableScrunching.AllPhases;
|
||||
public static bool GetTableScrunchingStatus(TableScrunching val) => (val & AllowTableScrunching) == val;
|
||||
public static VlnSplitCharacter mySplitter = new VlnSplitCharacter();
|
||||
public static string ChunkTextAttributesInfo(Chunk chk1) // C2018-004 create meta file for baseline compares
|
||||
{
|
||||
@@ -180,10 +129,7 @@ namespace Volian.Print.Library
|
||||
return rtnval;
|
||||
}
|
||||
public static int _lastPageNum = 0; // C2018-004 create meta file for baseline compares
|
||||
public static float TextAt(PdfContentByte cb, Paragraph iParagraph, float x, float y, float width, float height, string debugText, float yBottomMargin)
|
||||
{
|
||||
return TextAt(cb, iParagraph, x, y, width, height, debugText, yBottomMargin, null);
|
||||
}
|
||||
public static float TextAt(PdfContentByte cb, Paragraph iParagraph, float x, float y, float width, float height, string debugText, float yBottomMargin) => TextAt(cb, iParagraph, x, y, width, height, debugText, yBottomMargin, null);
|
||||
public static float TextAt(PdfContentByte cb, Paragraph iParagraph, float x, float y, float width, float height, string debugText, float yBottomMargin, int? itmID)
|
||||
{
|
||||
if (cb.PdfDocument.PageNumber != _lastPageNum) // C2018-004 create meta file for baseline compares
|
||||
@@ -192,7 +138,7 @@ namespace Volian.Print.Library
|
||||
_lastPageNum = cb.PdfDocument.PageNumber;
|
||||
}
|
||||
VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper;
|
||||
PdfLayer textLayer = _MyPageHelper == null ? null : _MyPageHelper.TextLayer;
|
||||
PdfLayer textLayer = _MyPageHelper?.TextLayer;
|
||||
float left = x + Offset.X;
|
||||
float top = y + Offset.Y;
|
||||
// B2020-059 - Barakah 1T4-OP-EOP-AC-0001 Instructions and Contingency Actions section step 6 last table in RNO is compressed - cause first bullet substep in AER to print on top HLS text
|
||||
@@ -224,8 +170,6 @@ namespace Volian.Print.Library
|
||||
chk.Attributes.Add("NoSplit", false);
|
||||
}
|
||||
}
|
||||
float right = left + width;
|
||||
float bottom = top - height;
|
||||
ColumnText myColumnText = new ColumnText(cb);
|
||||
myColumnText.SetSimpleColumn(left, top, left + width, yBottomMargin);
|
||||
myColumnText.AddElement(iParagraph);
|
||||
@@ -259,21 +203,21 @@ namespace Volian.Print.Library
|
||||
}
|
||||
return myColumnText.YLine;
|
||||
}
|
||||
//For Debugging:
|
||||
private static bool InList(int value, params int [] examples)
|
||||
{
|
||||
foreach (int ex in examples)
|
||||
if (ex == value) return true;
|
||||
return false;
|
||||
}
|
||||
public static float FigureAt(PdfContentByte cb, iTextSharp.text.Image image, float x, float y, float width, float height, string debugText, float yBottommargin, bool hasBorder, int itmID, float sixLinesPerInch)
|
||||
public static float FigureAt(PdfContentByte cb, iTextSharp.text.Image image, float x, float y, float width, float height, string debugText, bool hasBorder, int itmID, float sixLinesPerInch)
|
||||
{
|
||||
if (cb.PdfDocument.PageNumber != _lastPageNum) // C2018-004 create meta file for baseline compares
|
||||
{
|
||||
Volian.Base.Library.BaselineMetaFile.WriteLine("Page Change from {0} to {1}", _lastPageNum, cb.PdfDocument.PageNumber);
|
||||
_lastPageNum = cb.PdfDocument.PageNumber;
|
||||
}
|
||||
VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper;
|
||||
PdfLayer textLayer = _MyPageHelper == null ? null : _MyPageHelper.TextLayer;
|
||||
PdfLayer textLayer = !(cb.PdfWriter.PageEvent is VlnSvgPageHelper _MyPageHelper) ? null : _MyPageHelper.TextLayer;
|
||||
float left = x + Offset.X;
|
||||
float top = y + Offset.Y + sixLinesPerInch;
|
||||
float bottom = top - height;
|
||||
@@ -309,12 +253,9 @@ namespace Volian.Print.Library
|
||||
|
||||
return bottom;
|
||||
}
|
||||
private static float _GridTopAdjust = -10;
|
||||
public static float GridTopAdjust
|
||||
{
|
||||
get { return _GridTopAdjust; }
|
||||
set { _GridTopAdjust = value; }
|
||||
}
|
||||
|
||||
public static float GridTopAdjust { get; set; } = -10;
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "debugText Kept For Debugging")]
|
||||
public static float GridAt(PdfContentByte cb, vlnTable myGrid, float x, float y, float width, float height, string debugText, float yBottomMargin, bool hasBorder)
|
||||
{
|
||||
if (cb.PdfDocument.PageNumber != _lastPageNum) // C2018-004 create meta file for baseline compares
|
||||
@@ -322,8 +263,6 @@ namespace Volian.Print.Library
|
||||
Volian.Base.Library.BaselineMetaFile.WriteLine("Page Change from {0} to {1}", _lastPageNum, cb.PdfDocument.PageNumber);
|
||||
_lastPageNum = cb.PdfDocument.PageNumber;
|
||||
}
|
||||
//VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper; // RHM20150507 Table Scrunch
|
||||
//PdfLayer textLayer = _MyPageHelper == null ? null : _MyPageHelper.TextLayer; // RHM20150507 Table Scrunch
|
||||
float left = x + Offset.X;
|
||||
float top = y + Offset.Y;
|
||||
float right = left + width;
|
||||
@@ -331,7 +270,6 @@ namespace Volian.Print.Library
|
||||
int paperSizePoints = PDFPageSize.PaperSizePoints(myGrid.MyFlexGrid.MyDVI.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // C2020-002 paper size is now set in the format files
|
||||
ColumnText myColumnText = new ColumnText(cb);
|
||||
myColumnText.SetSimpleColumn(left, top, left + width, yBottomMargin);
|
||||
//if (textLayer != null) cb.BeginLayer(textLayer); // RHM20150507 Table Scrunch
|
||||
// C2018-004 create meta file for baseline compares
|
||||
if (top + GridTopAdjust > paperSizePoints) // B2019-110 Table continued on the next page - off the top of page
|
||||
{
|
||||
@@ -340,13 +278,11 @@ namespace Volian.Print.Library
|
||||
}
|
||||
Volian.Base.Library.BaselineMetaFile.WriteLine("GD left={0} top={1} right={2} bottom={3} Mygrid.ItmID={4}", left, top + GridTopAdjust, right, bottom, myGrid.ItemID);
|
||||
myGrid.ToPdf(myColumnText, left, top + GridTopAdjust);
|
||||
//if (textLayer != null) cb.EndLayer(); // RHM20150507 Table Scrunch
|
||||
return bottom;
|
||||
}
|
||||
internal static void DrawPdfDebug(PdfContentByte cb, float left, float top, float right, float bottom, string debugText, float yDescent)
|
||||
{
|
||||
VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper;
|
||||
PdfLayer debugLayer = _MyPageHelper == null ? null : _MyPageHelper.DebugLayer;
|
||||
PdfLayer debugLayer = !(cb.PdfWriter.PageEvent is VlnSvgPageHelper _MyPageHelper) ? null : _MyPageHelper.DebugLayer;
|
||||
if (debugLayer == null) return;
|
||||
System.Drawing.Color sysColor = PrintOverride.OverrideDebugColor(System.Drawing.Color.Gray);
|
||||
cb.SaveState();
|
||||
@@ -374,18 +310,16 @@ namespace Volian.Print.Library
|
||||
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)
|
||||
internal static float RtfRawAt(PdfContentByte cb, System.Drawing.Image image, float XOffset, float yLocation, float Width, float Height, string debug, bool hasBorder)
|
||||
{
|
||||
VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper;
|
||||
PdfLayer textLayer = _MyPageHelper == null ? null : _MyPageHelper.TextLayer;
|
||||
PdfLayer textLayer = !(cb.PdfWriter.PageEvent is VlnSvgPageHelper _MyPageHelper) ? 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);
|
||||
iTextSharp.text.Image 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);
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using iTextSharp.text;
|
||||
using iTextSharp.text.pdf;
|
||||
using iTextSharp.text.factories;
|
||||
using Itenso.Rtf;
|
||||
using Itenso.Rtf.Parser;
|
||||
using Itenso.Rtf.Interpreter;
|
||||
//using Itenso.Rtf.Model;
|
||||
using Itenso.Rtf.Support;
|
||||
using Microsoft.Win32;
|
||||
using Volian.Base.Library;
|
||||
using System.Text.RegularExpressions;
|
||||
using VEPROMS.CSLA.Library;
|
||||
using System.Linq;
|
||||
|
||||
namespace Volian.Print.Library
|
||||
{
|
||||
@@ -21,17 +16,13 @@ namespace Volian.Print.Library
|
||||
public static bool CompressSub = false;
|
||||
public static bool CompressSuper = false;
|
||||
public static bool CompressPropSubSup = false;
|
||||
private static System.Drawing.Color _TextColor = System.Drawing.Color.Empty;
|
||||
public static System.Drawing.Color TextColor
|
||||
{
|
||||
get { return _TextColor; }
|
||||
set { _TextColor = value; }
|
||||
}
|
||||
|
||||
public static System.Drawing.Color TextColor { get; set; } = System.Drawing.Color.Empty;
|
||||
public static System.Drawing.Color OverrideTextColor(System.Drawing.Color color)
|
||||
{
|
||||
if (_TextColor == System.Drawing.Color.Empty)
|
||||
if (TextColor == System.Drawing.Color.Empty)
|
||||
return color;
|
||||
return _TextColor;
|
||||
return TextColor;
|
||||
}
|
||||
private static System.Drawing.Color _SvgColor = System.Drawing.Color.Empty;
|
||||
public static System.Drawing.Color SvgColor
|
||||
@@ -45,29 +36,21 @@ namespace Volian.Print.Library
|
||||
return color;
|
||||
return _SvgColor;
|
||||
}
|
||||
private static System.Drawing.Color _BoxColor = System.Drawing.Color.Empty;
|
||||
public static System.Drawing.Color BoxColor
|
||||
{
|
||||
get { return _BoxColor; }
|
||||
set { _BoxColor = value; }
|
||||
}
|
||||
|
||||
public static System.Drawing.Color BoxColor { get; set; } = System.Drawing.Color.Empty;
|
||||
public static System.Drawing.Color OverrideBoxColor(System.Drawing.Color color)
|
||||
{
|
||||
if (_BoxColor == System.Drawing.Color.Empty)
|
||||
if (BoxColor == System.Drawing.Color.Empty)
|
||||
return color;
|
||||
return _BoxColor;
|
||||
}
|
||||
private static System.Drawing.Color _ChangeBarColor = System.Drawing.Color.Empty;
|
||||
public static System.Drawing.Color ChangeBarColor
|
||||
{
|
||||
get { return _ChangeBarColor; }
|
||||
set { _ChangeBarColor = value; }
|
||||
return BoxColor;
|
||||
}
|
||||
|
||||
public static System.Drawing.Color ChangeBarColor { get; set; } = System.Drawing.Color.Empty;
|
||||
public static System.Drawing.Color OverrideChangeBarColor(System.Drawing.Color color)
|
||||
{
|
||||
if (_ChangeBarColor == System.Drawing.Color.Empty)
|
||||
if (ChangeBarColor == System.Drawing.Color.Empty)
|
||||
return color;
|
||||
return _ChangeBarColor;
|
||||
return ChangeBarColor;
|
||||
}
|
||||
private static System.Drawing.Color _DebugColor = System.Drawing.Color.Empty;
|
||||
public static System.Drawing.Color DebugColor
|
||||
@@ -93,42 +76,16 @@ namespace Volian.Print.Library
|
||||
public class Rtf2iTextSharp : RtfVisualVisitorBase
|
||||
{
|
||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private bool _HasIndent = false;
|
||||
public bool HasIndent
|
||||
{
|
||||
get { return _HasIndent; }
|
||||
set { _HasIndent = value; }
|
||||
}
|
||||
private IRtfDocument _RtfDoc;
|
||||
private Paragraph _MyParagraph = new Paragraph();
|
||||
|
||||
public bool HasIndent { get; set; } = false;
|
||||
private readonly IRtfDocument _RtfDoc;
|
||||
private readonly Paragraph _MyParagraph = new Paragraph();
|
||||
private iTextSharp.text.Font _MyFont;
|
||||
|
||||
// Allow for definition of a default font: if the font is not proportional, this gets set.
|
||||
// It is needed to set the chunk's font if the first character of a cell is a hardspace (or various
|
||||
// other special cases (see its use below). Without this, pdfs were using the Helvetica font,
|
||||
// which is a default itextsharp font (this was causing a problem for HLP, their pdfs could not
|
||||
// contain a Helvetica font when putting them in their production environment).
|
||||
private iTextSharp.text.Font _DefaultFont;
|
||||
public iTextSharp.text.Font DefaultFont
|
||||
{
|
||||
get { return _DefaultFont; }
|
||||
set { _DefaultFont = value; }
|
||||
}
|
||||
private string _MyDebugID = null;
|
||||
public string MyDebugID
|
||||
{
|
||||
get { return _MyDebugID; }
|
||||
set { _MyDebugID = value; }
|
||||
}
|
||||
public iTextSharp.text.Font DefaultFont { get; set; }
|
||||
public string MyDebugID { get; set; } = null;
|
||||
public bool DoPdfLinks = false;
|
||||
// public Rtf2iTextSharp(IRtfDocument rtfDoc, Document doc, PdfWriter writer)
|
||||
public Rtf2iTextSharp(IRtfDocument rtfDoc)
|
||||
{
|
||||
if (rtfDoc == null)
|
||||
throw new ArgumentNullException("rtfDoc");
|
||||
|
||||
_RtfDoc = rtfDoc;
|
||||
}
|
||||
public Rtf2iTextSharp(IRtfDocument rtfDoc) => _RtfDoc = rtfDoc ?? throw new ArgumentNullException("rtfDoc");
|
||||
public Paragraph Convert()
|
||||
{
|
||||
int profileDepth = ProfileTimer.Push(">>>> Rtf2ITextSharp.Convert");
|
||||
@@ -138,7 +95,6 @@ namespace Volian.Print.Library
|
||||
{
|
||||
visual.Visit(this);
|
||||
}
|
||||
//_MyParagraph.SetLeading(0, 1);
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
return _MyParagraph;
|
||||
}
|
||||
@@ -177,6 +133,7 @@ namespace Volian.Print.Library
|
||||
_lastWasLineBreak = 0; // B2017-191 reset hard return count
|
||||
break;
|
||||
}
|
||||
//For Debugging:
|
||||
//_MyParagraph.Add(string.Format("<{0}>", visualBreak.BreakKind.ToString()));
|
||||
}
|
||||
private void AddChunk(string str, iTextSharp.text.Font font)
|
||||
@@ -188,6 +145,7 @@ namespace Volian.Print.Library
|
||||
}
|
||||
protected override void DoVisitSpecial(IRtfVisualSpecialChar visualSpecialChar)
|
||||
{
|
||||
//For Debugging:
|
||||
//_MyParagraph.Add(string.Format("<special {0}>", visualSpecialChar.CharKind.ToString()));
|
||||
iTextSharp.text.Font activeFont = _MyFont ?? DefaultFont;
|
||||
switch (visualSpecialChar.CharKind)
|
||||
@@ -248,23 +206,15 @@ namespace Volian.Print.Library
|
||||
if (c <= '\x7F') return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
//For Debugging:
|
||||
private bool ContainsAnySymbols(string p)
|
||||
{
|
||||
foreach (char c in p)
|
||||
if (c > '\x7F' && c != '\xA0' && c != '\xB0') return true;
|
||||
return false;
|
||||
}
|
||||
// The funcction below was used for the first few lines of DoVisitText which have been commented-out
|
||||
//private object FixText(string str)
|
||||
//{
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
// foreach (char c in str)
|
||||
// if (c < ' ' || c > '\xFF')
|
||||
// sb.Append(string.Format("[{0}]", (int)c));
|
||||
// else
|
||||
// sb.Append(c);
|
||||
// return sb.ToString();
|
||||
//}
|
||||
|
||||
// ParseLink & GetDefaultItemInfo (which used to be in vlnParagraph) support coding that was added to DoVisitText for
|
||||
// doing pdflink for each transition/ro in a step, see bug B2019-052
|
||||
private RoUsageInfo _Roui = null;
|
||||
@@ -278,8 +228,9 @@ namespace Volian.Print.Library
|
||||
if (_LinkInfoText.Contains(@"\v"))
|
||||
throw new Exception("LinkText.ParseLink found RTF token");
|
||||
Match m = Regex.Match(_LinkInfoText, @"[#]Link:([A-Za-z]*):(.*)");
|
||||
string _MyValue = m.Groups[1].Value;
|
||||
string _MyLink = "#Link:" + m.Groups[2].Value + ":" + m.Groups[3].Value;
|
||||
//For Debugging:
|
||||
//string _MyValue = m.Groups[1].Value;
|
||||
//string _MyLink = "#Link:" + m.Groups[2].Value + ":" + m.Groups[3].Value;
|
||||
switch (m.Groups[1].Value)
|
||||
{
|
||||
case "ReferencedObject":
|
||||
@@ -319,7 +270,7 @@ namespace Volian.Print.Library
|
||||
if (myItemInfo.IsProcedure && myItemInfo.Sections != null)
|
||||
{
|
||||
SectionInfo siProcedureSteps = null;
|
||||
foreach (SectionInfo si in myItemInfo.Sections)
|
||||
foreach (SectionInfo si in myItemInfo.Sections.OfType<SectionInfo>())
|
||||
{
|
||||
if (si.IsDefaultSection)
|
||||
{
|
||||
@@ -347,7 +298,7 @@ namespace Volian.Print.Library
|
||||
private static int chkStart = -1;
|
||||
protected override void DoVisitText(IRtfVisualText visualText)
|
||||
{
|
||||
//Code to find text (non-symbol) being output with a symbol font
|
||||
//Debugging Code to find text (non-symbol) being output with a symbol font
|
||||
//if(visualText.Format.Font.Name=="VESymbFix" && visualText.Text.Length > 1)
|
||||
//{
|
||||
// string s = visualText.Text;
|
||||
@@ -375,8 +326,7 @@ namespace Volian.Print.Library
|
||||
{
|
||||
try
|
||||
{
|
||||
Chunk chk = _MyParagraph.Chunks[i] as Chunk;
|
||||
if (chk != null)
|
||||
if (_MyParagraph.Chunks[i] is Chunk chk)
|
||||
{
|
||||
if (_linkType == 2 && _Ti != null) // transition
|
||||
{
|
||||
@@ -398,7 +348,7 @@ namespace Volian.Print.Library
|
||||
{
|
||||
// C2024-009 add PDF file prefix and suffix if available to the PDF file name in the transition reference.
|
||||
DocVersionConfig dvc = _Ti.MyItemToID.MyProcedure.MyDocVersion.DocVersionConfig;
|
||||
string remotePDFName = dvc.Print_PDFFilePrefix + _Ti.MyItemToID.MyProcedure.DisplayNumber.Replace("/", "_") + dvc.Print_PDFFileSuffix + ".pdf";
|
||||
string remotePDFName = $"{dvc.Print_PDFFilePrefix}{_Ti.MyItemToID.MyProcedure.DisplayNumber.Replace("/", "_")}{dvc.Print_PDFFileSuffix}.pdf";
|
||||
chk.SetRemoteGoto(remotePDFName, string.Format("ItemID={0}", tiDefault.ItemID));
|
||||
chk.SetBackground(new Color(System.Drawing.Color.PeachPuff));
|
||||
}
|
||||
@@ -630,6 +580,7 @@ namespace Volian.Print.Library
|
||||
}
|
||||
}
|
||||
|
||||
//For Debugging:
|
||||
private string ShowSpecialCharacters(string p)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
@@ -642,31 +593,23 @@ namespace Volian.Print.Library
|
||||
sb.Append(c);
|
||||
}
|
||||
return sb.ToString();
|
||||
}// DoVisitText
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
protected override void DoVisitImage(IRtfVisualImage visualImage)
|
||||
{
|
||||
//_MyParagraph.Add(new Chunk("<Image>"));
|
||||
//DateTime dt1 = DateTime.Now;
|
||||
//System.Drawing.Image img2 = visualImage.ImageForDrawing;
|
||||
//Console.WriteLine("1 Time Span {0}", TimeSpan.FromTicks(DateTime.Now.Ticks - dt1.Ticks).TotalMilliseconds);
|
||||
//img2.Save(@"c:\datacvrt\x.png");
|
||||
System.IO.MemoryStream ms = new System.IO.MemoryStream();
|
||||
|
||||
//Console.WriteLine("2 Time Span {0}", TimeSpan.FromTicks(DateTime.Now.Ticks - dt1.Ticks).TotalMilliseconds);
|
||||
//Console.WriteLine("Size {0}", visualImage.ImageForDrawing.Size);
|
||||
using (System.IO.MemoryStream ms = new System.IO.MemoryStream())
|
||||
{
|
||||
visualImage.ImageForDrawing.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
|
||||
//Console.WriteLine("3 Time Span {0}", TimeSpan.FromTicks(DateTime.Now.Ticks - dt1.Ticks).TotalMilliseconds);
|
||||
ms.Seek(0, System.IO.SeekOrigin.Begin);
|
||||
//Console.WriteLine("4 Time Span {0}", TimeSpan.FromTicks(DateTime.Now.Ticks - dt1.Ticks).TotalMilliseconds);
|
||||
iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(ms);
|
||||
//Console.WriteLine("5 Time Span {0}", TimeSpan.FromTicks(DateTime.Now.Ticks - dt1.Ticks).TotalMilliseconds);
|
||||
_MyParagraph.Add(img);
|
||||
//Console.WriteLine("6 Time Span {0}", TimeSpan.FromTicks(DateTime.Now.Ticks - dt1.Ticks).TotalMilliseconds);
|
||||
}
|
||||
|
||||
_lastWasLineBreak = 0; // B2017-191 reset hard return count
|
||||
} // DoVisitImage
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -106,6 +106,7 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="CompleteRORpt.cs" />
|
||||
<Compile Include="CPSGen.cs" />
|
||||
<Compile Include="GlobalSuppressions.cs" />
|
||||
<Compile Include="Grid2Pdf.cs" />
|
||||
<Compile Include="MergedPdf.cs" />
|
||||
<Compile Include="PageCount.cs" />
|
||||
|
||||
@@ -1,46 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using iTextSharp.text;
|
||||
using iTextSharp.text.pdf;
|
||||
using System.IO;
|
||||
using Microsoft.Win32;
|
||||
using Volian.Base.Library;
|
||||
|
||||
namespace Volian.Print.Library
|
||||
{
|
||||
public class pdf
|
||||
{
|
||||
private Document _MyDocument;
|
||||
public Document MyDocument
|
||||
{
|
||||
get { return _MyDocument; }
|
||||
set { _MyDocument = value; }
|
||||
}
|
||||
private PdfWriter _MyWriter;
|
||||
public PdfWriter MyWriter
|
||||
{
|
||||
get { return _MyWriter; }
|
||||
set { _MyWriter = value; }
|
||||
}
|
||||
private string _MyFileName;
|
||||
public string MyFileName
|
||||
{
|
||||
get { return _MyFileName; }
|
||||
set { _MyFileName = value; }
|
||||
}
|
||||
public PdfContentByte ContentByte
|
||||
{
|
||||
get { return _MyWriter.DirectContent; }
|
||||
}
|
||||
public Document MyDocument { get; set; }
|
||||
public PdfWriter MyWriter { get; set; }
|
||||
public string MyFileName { get; set; }
|
||||
public PdfContentByte ContentByte => MyWriter.DirectContent;
|
||||
public pdf(string myFileName)
|
||||
{
|
||||
_MyFileName = myFileName;
|
||||
_MyDocument = new Document(PageSize.LETTER);
|
||||
MyFileName = myFileName;
|
||||
MyDocument = new Document(PageSize.LETTER);
|
||||
try
|
||||
{
|
||||
_MyWriter = PdfWriter.GetInstance(_MyDocument, new FileStream(myFileName, FileMode.Create));
|
||||
_MyWriter.SetAtLeastPdfVersion(PdfWriter.VERSION_1_7);
|
||||
MyWriter = PdfWriter.GetInstance(MyDocument, new FileStream(myFileName, FileMode.Create));
|
||||
MyWriter.SetAtLeastPdfVersion(PdfWriter.VERSION_1_7);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -49,24 +29,21 @@ namespace Volian.Print.Library
|
||||
}
|
||||
public pdf(string myFileName, Rectangle mySize)
|
||||
{
|
||||
_MyFileName = myFileName;
|
||||
_MyDocument = new Document(mySize);
|
||||
MyFileName = myFileName;
|
||||
MyDocument = new Document(mySize);
|
||||
try
|
||||
{
|
||||
_MyWriter = PdfWriter.GetInstance(_MyDocument, new FileStream(myFileName, FileMode.Create));
|
||||
_MyWriter.SetAtLeastPdfVersion(PdfWriter.VERSION_1_7);
|
||||
MyWriter = PdfWriter.GetInstance(MyDocument, new FileStream(myFileName, FileMode.Create));
|
||||
MyWriter.SetAtLeastPdfVersion(PdfWriter.VERSION_1_7);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("{0} - {1}\r\n{2}", ex.GetType().Name, ex.Message, ex.StackTrace);
|
||||
}
|
||||
}
|
||||
public void Close()
|
||||
{
|
||||
MyDocument.Close();
|
||||
}
|
||||
private Color _WatermarkColor = Color.BLUE;
|
||||
private float _WatermarkOpacity = .10F;
|
||||
public void Close() => MyDocument.Close();
|
||||
private readonly Color _WatermarkColor = Color.BLUE;
|
||||
private readonly float _WatermarkOpacity = .10F;
|
||||
public void WatermarkPageNumber(int pageNumber)
|
||||
{
|
||||
Rectangle pageSize = ContentByte.PdfWriter.PageSize; // Get page size
|
||||
@@ -84,8 +61,10 @@ namespace Volian.Print.Library
|
||||
ContentByte.SetLineWidth(.5F);
|
||||
ContentByte.SetFontAndSize(myBasefont, myFontSize);// Set font and size
|
||||
ContentByte.SetColorStroke(_WatermarkColor);
|
||||
PdfGState gs2 = new PdfGState();
|
||||
gs2.StrokeOpacity = _WatermarkOpacity;
|
||||
PdfGState gs2 = new PdfGState
|
||||
{
|
||||
StrokeOpacity = _WatermarkOpacity
|
||||
};
|
||||
ContentByte.SetGState(gs2);
|
||||
ContentByte.ShowTextAlignedKerned(PdfContentByte.ALIGN_CENTER, strPage, pageSize.Width / 2, 0, 0);// Draw the text
|
||||
ContentByte.EndText();
|
||||
@@ -108,8 +87,10 @@ namespace Volian.Print.Library
|
||||
{
|
||||
PdfPatternPainter myPatternPainter;
|
||||
myPatternPainter = ContentByte.CreatePattern(radius * 4, radius * 2, radius * 4, radius * 2);
|
||||
PdfGState gState = new PdfGState();
|
||||
gState.FillOpacity = _WatermarkOpacity;
|
||||
PdfGState gState = new PdfGState
|
||||
{
|
||||
FillOpacity = _WatermarkOpacity
|
||||
};
|
||||
myPatternPainter.SetGState(gState);
|
||||
myPatternPainter.SetColorFill(_WatermarkColor);
|
||||
myPatternPainter.Rectangle(0, 0, radius, radius);
|
||||
|
||||
@@ -1,26 +1,15 @@
|
||||
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; }
|
||||
}
|
||||
private readonly vlnParagraph _MyParagraph;
|
||||
public vlnParagraph MyParagraph => _MyParagraph;
|
||||
private readonly pkParagraphs _MyChildren;
|
||||
public pkParagraphs MyChildren => _MyChildren;
|
||||
private readonly pkParagraphs _MyCautionsAndNotes;
|
||||
public pkParagraphs MyCautionsAndNotes => _MyCautionsAndNotes;
|
||||
public pkParagraph(vlnParagraph myParagraph)
|
||||
{
|
||||
_MyParagraph = myParagraph;
|
||||
|
||||
@@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using iTextSharp.text.pdf;
|
||||
using iTextSharp.text;
|
||||
using VEPROMS.CSLA.Library;
|
||||
|
||||
|
||||
@@ -12,20 +11,8 @@ namespace Volian.Print.Library
|
||||
public partial class vlnBox : vlnPrintObject
|
||||
{
|
||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private int _LineType; /* how to represent?? */
|
||||
private System.Drawing.Color _Color;
|
||||
public System.Drawing.Color Color
|
||||
{
|
||||
get { return _Color; }
|
||||
set { _Color = value; }
|
||||
}
|
||||
private Box _MyBox;
|
||||
|
||||
public Box MyBox
|
||||
{
|
||||
get { return _MyBox; }
|
||||
set { _MyBox = value; }
|
||||
}
|
||||
public Box MyBox { get; set; }
|
||||
// the following two fields are used if 'boxed' step, thus
|
||||
// no 'Box' was defined in format file.
|
||||
public override float Height
|
||||
@@ -41,26 +28,13 @@ namespace Volian.Print.Library
|
||||
public string DefBox = null;
|
||||
public float DefEnd = 0;
|
||||
|
||||
private bool _ContainsPageBreak = false;
|
||||
public bool ContainsPageBreak
|
||||
{
|
||||
get { return _ContainsPageBreak; }
|
||||
set { _ContainsPageBreak = value; }
|
||||
}
|
||||
private bool _DoubleBoxHls = false; // BGE double lined box around HLS
|
||||
public bool DoubleBoxHls
|
||||
{
|
||||
get { return _DoubleBoxHls; }
|
||||
set { _DoubleBoxHls = value; }
|
||||
}
|
||||
public bool ContainsPageBreak { get; set; } = false;
|
||||
public bool DoubleBoxHls { get; set; } = false;
|
||||
public const string DOUBLEboxHLS = "DoubleBox";
|
||||
//private bool _DoBottom = true;
|
||||
public vlnBox()
|
||||
{
|
||||
}
|
||||
public vlnBox(vlnParagraph paragraph)
|
||||
{
|
||||
}
|
||||
public const string BoxThin = "\x2510.\x2500.\x250c.\x2502. . .\x2518.\x2514. .\x2500. . ";
|
||||
const string BoxThick = "\x2584.\x2584.\x2584.\x2588. . .\x2580.\x2580. .\x2580. . ";
|
||||
const string BoxDouble = "\x2557.\x2550.\x2554.\x2551. . .\x255D.\x255A. .\x2550. . ";
|
||||
@@ -95,10 +69,9 @@ namespace Volian.Print.Library
|
||||
if (MyBox == null) return yPageStart;
|
||||
cb.SaveState();
|
||||
VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper;
|
||||
PdfLayer textLayer = _MyPageHelper == null ? null : _MyPageHelper.TextLayer;
|
||||
PdfLayer textLayer = _MyPageHelper?.TextLayer;
|
||||
if (textLayer != null) cb.BeginLayer(textLayer);
|
||||
MyContentByte = cb;
|
||||
//Console.WriteLine("'{0}','{1}'", CharToAsc(MyBox.BoxStyle), MyParent.MyItemInfo.ShortPath);
|
||||
float top = CalculateYOffset(yPageStart, yTopMargin) - (7*MyPageHelper.YMultiplier);
|
||||
float bottom = top - (Height * MyPageHelper.YMultiplier);
|
||||
float left = (float)((MyBox.Start ?? 0) + MyParent.MyItemInfo.MyDocStyle.Layout.LeftMargin);
|
||||
@@ -157,7 +130,7 @@ namespace Volian.Print.Library
|
||||
else
|
||||
{
|
||||
const float llxOffset = 3;
|
||||
float lineThickness = 0;
|
||||
float lineThickness;
|
||||
switch (MyBox.BoxStyle)
|
||||
{
|
||||
case BoxThin:
|
||||
@@ -331,8 +304,6 @@ namespace Volian.Print.Library
|
||||
|
||||
// create a new font without any styles such as underline.
|
||||
E_Style es = ((vef.Style & E_Style.Bold) == E_Style.Bold) ? E_Style.Bold : E_Style.None;
|
||||
// if the box has a font, use it - otherwise use this item info's font
|
||||
VE_Font vf = null;
|
||||
bool UseBoxFont = false;
|
||||
try
|
||||
{
|
||||
@@ -341,6 +312,8 @@ namespace Volian.Print.Library
|
||||
catch // done this way in case one of the format properties is null in the previous statement, UseBoxFont will be false.
|
||||
{
|
||||
}
|
||||
// if the box has a font, use it - otherwise use this item info's font
|
||||
VE_Font vf;
|
||||
if (UseBoxFont)
|
||||
vf = new VE_Font(vef.Family, (int)vef.Size, es, (float)MyParent.MyItemInfo.FormatStepData.Font.CPI);
|
||||
else
|
||||
@@ -355,21 +328,21 @@ namespace Volian.Print.Library
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append(MyBox.BXULC);
|
||||
float size = GetTextWidth(vf, MyBox.BXULC); //(float)(MyBox.BXULC.Length * (72 / vf.CPI));
|
||||
string bxstr = null;
|
||||
string bxstr;
|
||||
if (!ContainsPageBreak) // Only do top line if there is no page break.
|
||||
{
|
||||
while (size < endHorz)
|
||||
{
|
||||
sb.Append(MyBox.BXHorz);
|
||||
size = size + bxHorzTextWidth; //(float)(MyBox.BXHorz.Length * (72 / vf.CPI));
|
||||
size += bxHorzTextWidth; //(float)(MyBox.BXHorz.Length * (72 / vf.CPI));
|
||||
}
|
||||
// Tack on the right upper corner. For some formats, the upper right corner in the
|
||||
// had the first character as a space, this would put two spaces in a row at the
|
||||
// end of the string, so remove the space before tacking on the upper right corner:
|
||||
bxstr = sb.ToString();
|
||||
if (bxstr[bxstr.Length - 1] == ' ' && MyBox.BXURC[0] == ' ') bxstr = bxstr.TrimEnd();
|
||||
bxstr = bxstr + MyBox.BXURC;
|
||||
size = size + GetTextWidth(vf, MyBox.BXURC);//(float)((MyBox.BXURC.Length) * (72 / vf.CPI));
|
||||
bxstr += MyBox.BXURC;
|
||||
size += GetTextWidth(vf, MyBox.BXURC);//(float)((MyBox.BXURC.Length) * (72 / vf.CPI));
|
||||
Rtf = GetRtf(bxstr, vf);
|
||||
IParagraph = null; // set to null so that next access of IParagraph sets the Rtf.
|
||||
Rtf2Pdf.TextAt(cb, IParagraph, left, top, size + 10, 100, "", yBottomMargin);
|
||||
@@ -384,15 +357,15 @@ namespace Volian.Print.Library
|
||||
while (size < endHorz)
|
||||
{
|
||||
sb.Append(MyBox.BXHorz);
|
||||
size = size + bxHorzTextWidth;//(float)(MyBox.BXHorz.Length * (72 / vf.CPI));
|
||||
size += bxHorzTextWidth;//(float)(MyBox.BXHorz.Length * (72 / vf.CPI));
|
||||
}
|
||||
bxstr = sb.ToString().TrimEnd() + MyBox.BXLRC;
|
||||
size = size + GetTextWidth(vf, MyBox.BXLRC); //(float)((MyBox.BXLRC.Length) * (72 / vf.CPI));
|
||||
size += GetTextWidth(vf, MyBox.BXLRC); //(float)((MyBox.BXLRC.Length) * (72 / vf.CPI));
|
||||
Rtf = GetRtf(bxstr, vf);
|
||||
IParagraph = null; // set to null so that next access of IParagraph sets the Rtf.
|
||||
Rtf2Pdf.TextAt(cb, IParagraph, left, bottom, size + 10, 100, "", yBottomMargin);
|
||||
}
|
||||
private string symblsStr = "\u25CF\u0394"; // string of possible symbol character in a tab
|
||||
private readonly string symblsStr = "\u25CF\u0394"; // string of possible symbol character in a tab
|
||||
// add symbol characters as needed
|
||||
// "\u25CF" - solid bullet
|
||||
// \x0394 - delta
|
||||
@@ -409,8 +382,6 @@ namespace Volian.Print.Library
|
||||
// follow through in fixing an Out of Window Handles bug, use new function to see if
|
||||
// we can retrieve the font from a dictionary instead a doing a New and using another
|
||||
// window handle
|
||||
//System.Drawing.Font font = new System.Drawing.Font(vefont.Family, (float)vefont.Size, GetSysFontStyle(vefont));
|
||||
//System.Drawing.Font symbFont = new System.Drawing.Font(symblFontName, (float)vefont.Size);
|
||||
System.Drawing.Font font = VE_Font.GetWinSysFont(vefont.Family, (float)vefont.Size, GetSysFontStyle(vefont));
|
||||
System.Drawing.Font symbFont = VE_Font.GetWinSysFont(symblFontName, (float)vefont.Size);
|
||||
iTextSharp.text.Font iFont = Volian.Svg.Library.VolianPdf.GetFont(font);
|
||||
@@ -424,9 +395,9 @@ namespace Volian.Print.Library
|
||||
else
|
||||
w += iFont.BaseFont.GetWidthPointKerned(c.ToString(), (float)vefont.Size);
|
||||
}
|
||||
//float w = iFont.BaseFont.GetWidthPointKerned(Text.Replace("\u25CF","@"), (float)vefont.Size);
|
||||
return w;
|
||||
}
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "top and bottom kept for debugging")]
|
||||
private void DrawAsteriskSide(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin, float top, float bottom, float left, float right, VE_Font vef)
|
||||
{
|
||||
// set the top & bottom of sides. If there is a page break in the middle of box, adjust these.
|
||||
@@ -453,8 +424,6 @@ namespace Volian.Print.Library
|
||||
|
||||
// create a new font without any styles such as underline.
|
||||
E_Style es = ((vef.Style & E_Style.Bold) == E_Style.Bold) ? E_Style.Bold : E_Style.None;
|
||||
// if the box has a font, use it - otherwise use this item info's font
|
||||
VE_Font vf = null;
|
||||
bool UseBoxFont = false;
|
||||
try
|
||||
{
|
||||
@@ -463,6 +432,8 @@ namespace Volian.Print.Library
|
||||
catch // done this way in case one of the format properties is null in the previous statement, UseBoxFont will be false.
|
||||
{
|
||||
}
|
||||
// if the box has a font, use it - otherwise use this item info's font
|
||||
VE_Font vf;
|
||||
if (UseBoxFont)
|
||||
vf = new VE_Font(vef.Family, (int)vef.Size, es, (float)MyParent.MyItemInfo.FormatStepData.Font.CPI);
|
||||
else
|
||||
@@ -503,17 +474,8 @@ namespace Volian.Print.Library
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
|
||||
private static List<string> _UnimplementedBoxStyles = new List<string>();
|
||||
private string CharToAsc(string p)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (char c in p)
|
||||
{
|
||||
if (c >= ' ' && c < 127) sb.Append(c);
|
||||
else sb.Append(string.Format("\\x{0:x}", (int)c));
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
private void DrawAsteriskTopBottomHLS(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin, ref float top, ref float bottom, float left, VE_Font vef)
|
||||
{
|
||||
// this box is not drawn, it is a series of asterisks drawn above and below text.
|
||||
@@ -527,8 +489,6 @@ namespace Volian.Print.Library
|
||||
bottom = ytmpbottom1;
|
||||
// create a new font without any styles such as underline.
|
||||
E_Style es = ((vef.Style & E_Style.Bold) == E_Style.Bold) ? E_Style.Bold : E_Style.None;
|
||||
// if the box has a font, use it - otherwise use this item info's font
|
||||
VE_Font vf = null;
|
||||
bool UseBoxFont = false;
|
||||
try
|
||||
{
|
||||
@@ -537,6 +497,8 @@ namespace Volian.Print.Library
|
||||
catch // done this way in case one of the format properties is null in the previous statement, UseBoxFont will be false.
|
||||
{
|
||||
}
|
||||
// if the box has a font, use it - otherwise use this item info's font
|
||||
VE_Font vf;
|
||||
if (UseBoxFont)
|
||||
vf = new VE_Font(vef.Family, (int)vef.Size, es, (float)MyParent.MyItemInfo.FormatStepData.Font.CPI);
|
||||
else
|
||||
@@ -550,22 +512,22 @@ namespace Volian.Print.Library
|
||||
// Do the top line first:
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append(MyBox.BXULC);
|
||||
float size = GetTextWidth(vf, MyBox.BXULC); //(float)(MyBox.BXULC.Length * (72 / vf.CPI));
|
||||
string bxstr = null;
|
||||
float size = GetTextWidth(vf, MyBox.BXULC);
|
||||
string bxstr;
|
||||
if (!ContainsPageBreak) // Only do top line if there is no page break.
|
||||
{
|
||||
while (size < endHorz)
|
||||
{
|
||||
sb.Append(MyBox.BXHorz);
|
||||
size = size + bxHorzTextWidth; //(float)(MyBox.BXHorz.Length * (72 / vf.CPI));
|
||||
size += bxHorzTextWidth;
|
||||
}
|
||||
// Tack on the right upper corner. For some formats, the upper right corner in the
|
||||
// had the first character as a space, this would put two spaces in a row at the
|
||||
// end of the string, so remove the space before tacking on the upper right corner:
|
||||
bxstr = sb.ToString();
|
||||
if (bxstr[bxstr.Length - 1] == ' ' && MyBox.BXURC[0] == ' ') bxstr = bxstr.TrimEnd();
|
||||
bxstr = bxstr + MyBox.BXURC;
|
||||
size = size + GetTextWidth(vf, MyBox.BXURC);//(float)((MyBox.BXURC.Length) * (72 / vf.CPI));
|
||||
bxstr += MyBox.BXURC;
|
||||
size += GetTextWidth(vf, MyBox.BXURC);//(float)((MyBox.BXURC.Length) * (72 / vf.CPI));
|
||||
Rtf = GetRtf(bxstr, vf);
|
||||
IParagraph = null; // set to null so that next access of IParagraph sets the Rtf.
|
||||
Rtf2Pdf.TextAt(cb, IParagraph, left, top, size + 10, 100, "", yBottomMargin);
|
||||
@@ -576,23 +538,24 @@ namespace Volian.Print.Library
|
||||
|
||||
sb.Remove(0, sb.Length);
|
||||
sb.Append(MyBox.BXLLC);
|
||||
size = GetTextWidth(vf, MyBox.BXLLC); //(float)(MyBox.BXLLC.Length * (72 / vf.CPI));
|
||||
size = GetTextWidth(vf, MyBox.BXLLC);
|
||||
while (size < endHorz)
|
||||
{
|
||||
sb.Append(MyBox.BXHorz);
|
||||
size = size + bxHorzTextWidth;//(float)(MyBox.BXHorz.Length * (72 / vf.CPI));
|
||||
size += bxHorzTextWidth;
|
||||
}
|
||||
bxstr = sb.ToString().TrimEnd() + MyBox.BXLRC;
|
||||
size = size + GetTextWidth(vf, MyBox.BXLRC); //(float)((MyBox.BXLRC.Length) * (72 / vf.CPI));
|
||||
size += GetTextWidth(vf, MyBox.BXLRC);
|
||||
Rtf = GetRtf(bxstr, vf);
|
||||
IParagraph = null; // set to null so that next access of IParagraph sets the Rtf.
|
||||
Rtf2Pdf.TextAt(cb, IParagraph, left, bottom, size + 10, 100, "", yBottomMargin);
|
||||
}
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "top and bottom kept for debugging")]
|
||||
private void DrawAsteriskSideHLS(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin, float top, float bottom, float left, float right, VE_Font vef)
|
||||
{
|
||||
// set the top & bottom of sides. If there is a page break in the middle of box, adjust these.
|
||||
// The vlnBox property, ContainsPageBreak, flags that a break occurred.
|
||||
float yOffBreak = 0;
|
||||
float yOffBreak;
|
||||
if (!ContainsPageBreak)
|
||||
{
|
||||
top = CalculateYOffset(yPageStart, yTopMargin);
|
||||
@@ -613,7 +576,10 @@ namespace Volian.Print.Library
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
#pragma warning disable IDE0059 // Unnecessary assignment of a value - Keeping top for Debugging
|
||||
top = CalculateYOffset(yPageStart, yTopMargin);
|
||||
#pragma warning restore IDE0059 // Unnecessary assignment of a value
|
||||
yOffBreak = MyPageHelper.ParaBreaks.Count > 0 ? MyPageHelper.ParaBreaks[0].YOffset : 0;
|
||||
if (yOffBreak > 0)
|
||||
bottom = (yPageStart - yOffBreak) * MyPageHelper.YMultiplier;
|
||||
@@ -636,8 +602,6 @@ namespace Volian.Print.Library
|
||||
|
||||
// create a new font without any styles such as underline.
|
||||
E_Style es = ((vef.Style & E_Style.Bold) == E_Style.Bold) ? E_Style.Bold : E_Style.None;
|
||||
// if the box has a font, use it - otherwise use this item info's font
|
||||
VE_Font vf = null;
|
||||
bool UseBoxFont = false;
|
||||
try
|
||||
{
|
||||
@@ -646,6 +610,8 @@ namespace Volian.Print.Library
|
||||
catch // done this way in case one of the format properties is null in the previous statement, UseBoxFont will be false.
|
||||
{
|
||||
}
|
||||
// if the box has a font, use it - otherwise use this item info's font
|
||||
VE_Font vf;
|
||||
if (UseBoxFont)
|
||||
vf = new VE_Font(vef.Family, (int)vef.Size, es, (float)MyParent.MyItemInfo.FormatStepData.Font.CPI);
|
||||
else
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using iTextSharp.text.pdf;
|
||||
using iTextSharp.text;
|
||||
using VEPROMS.CSLA.Library;
|
||||
@@ -10,44 +8,25 @@ namespace Volian.Print.Library
|
||||
{
|
||||
public class vlnChangeBarMessage
|
||||
{
|
||||
private float _ParentX;
|
||||
public float ParentX
|
||||
{
|
||||
get { return _ParentX; }
|
||||
set { _ParentX = value; }
|
||||
}
|
||||
private string _Message;
|
||||
public string Message
|
||||
{
|
||||
get { return _Message; }
|
||||
set { _Message = value; }
|
||||
}
|
||||
public float ParentX { get; set; }
|
||||
public string Message { get; set; }
|
||||
private static int _UniqueMessageId = 0;
|
||||
public static int UniqueMessageId
|
||||
{
|
||||
get { return vlnChangeBarMessage._UniqueMessageId++; }
|
||||
set { vlnChangeBarMessage._UniqueMessageId = value; }
|
||||
}
|
||||
private int _MessageId = UniqueMessageId;
|
||||
public int MessageId
|
||||
{
|
||||
get { return _MessageId; }
|
||||
set { _MessageId = value; }
|
||||
get { return _UniqueMessageId++; }
|
||||
set { _UniqueMessageId = value; }
|
||||
}
|
||||
|
||||
public int MessageId { get; set; } = UniqueMessageId;
|
||||
public vlnChangeBarMessage(float parentx, string msg)
|
||||
{
|
||||
_ParentX = parentx;
|
||||
_Message = msg;
|
||||
ParentX = parentx;
|
||||
Message = msg;
|
||||
}
|
||||
}
|
||||
public partial class vlnChangeBar : vlnPrintObject
|
||||
{
|
||||
private bool _HasChangeBar;
|
||||
public bool HasChangeBar
|
||||
{
|
||||
get { return _HasChangeBar; }
|
||||
set { _HasChangeBar = value; }
|
||||
}
|
||||
public bool HasChangeBar { get; set; }
|
||||
protected float _YChangeBarBottom;
|
||||
public float YChangeBarBottom
|
||||
{
|
||||
@@ -62,36 +41,15 @@ namespace Volian.Print.Library
|
||||
_Height = _YOffset - _YChangeBarBottom;
|
||||
}
|
||||
}
|
||||
private SortedDictionary<float, vlnChangeBarMessage> _Messages;
|
||||
public SortedDictionary<float, vlnChangeBarMessage> Messages
|
||||
{
|
||||
get { return _Messages; }
|
||||
set { _Messages = value; }
|
||||
}
|
||||
private int _MessageAlignment;
|
||||
public int MessageAlignment
|
||||
{
|
||||
get { return _MessageAlignment; }
|
||||
set { _MessageAlignment = value; }
|
||||
}
|
||||
private float _YExtendLine = 4.75F;
|
||||
public float YExtendLine
|
||||
{
|
||||
get { return _YExtendLine; }
|
||||
set {_YExtendLine = value; }
|
||||
}
|
||||
public float YChangeBarBottomExtend
|
||||
{
|
||||
get {return YChangeBarBottom - YExtendLine; }
|
||||
}
|
||||
private bool _BottomIsTable = false;
|
||||
public bool BottomIsTable
|
||||
{
|
||||
get { return _BottomIsTable; }
|
||||
set { _BottomIsTable = value; }
|
||||
}
|
||||
private bool _IsRev;
|
||||
private bool _MsgAtTop; // flags that message should be drawn at top of change bar
|
||||
|
||||
public SortedDictionary<float, vlnChangeBarMessage> Messages { get; set; }
|
||||
public int MessageAlignment { get; set; }
|
||||
public float YExtendLine { get; set; } = 4.75F;
|
||||
public float YChangeBarBottomExtend => YChangeBarBottom - YExtendLine;
|
||||
|
||||
public bool BottomIsTable { get; set; } = false;
|
||||
private readonly bool _IsRev;
|
||||
private readonly bool _MsgAtTop; // flags that message should be drawn at top of change bar
|
||||
public vlnChangeBar(PdfContentByte cb, vlnParagraph parent, float xoff, float yoff, int msgAlignment, bool isRev, bool msgAtTop)
|
||||
{
|
||||
// for grids, a y adjustment is made to match 16bit output, see the variable 'GridTopAdjust'. Take this
|
||||
@@ -113,7 +71,7 @@ namespace Volian.Print.Library
|
||||
{
|
||||
// see if any of children don't have changebar
|
||||
if ((vpo as vlnRNOSeparator).ExtendChangeBar)
|
||||
_YExtendLine = (vpo.Height + vpo.YOffset - ((scale * parent.Height) + parent.YOffset)) * MyPageHelper.YMultiplier;
|
||||
YExtendLine = (vpo.Height + vpo.YOffset - ((scale * parent.Height) + parent.YOffset)) * MyPageHelper.YMultiplier;
|
||||
}
|
||||
}
|
||||
foreach (vlnPrintObject vph in parent.PartsAbove)
|
||||
@@ -152,12 +110,9 @@ namespace Volian.Print.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
_MessageAlignment = msgAlignment;
|
||||
}
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("vlnChangeBar: X={0} Y={1} H={2} B={3} ID={4}", XOffset, YOffset, Height, YChangeBarBottom, MyParent.MyItemInfo.ItemID);
|
||||
MessageAlignment = msgAlignment;
|
||||
}
|
||||
public override string ToString() => string.Format("vlnChangeBar: X={0} Y={1} H={2} B={3} ID={4}", XOffset, YOffset, Height, YChangeBarBottom, MyParent.MyItemInfo.ItemID);
|
||||
public override float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin)
|
||||
{
|
||||
float? topMost = null;
|
||||
@@ -170,11 +125,9 @@ namespace Volian.Print.Library
|
||||
// calculate a new starting position for the change bar
|
||||
if (_MyParent is vlnParagraph)
|
||||
{
|
||||
vlnParagraph pgh = _MyParent as vlnParagraph;
|
||||
topMost = cb.PdfWriter.PageSize.Height - yPageStart;
|
||||
}
|
||||
VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper;
|
||||
PdfLayer textLayer = _MyPageHelper == null ? null : _MyPageHelper.TextLayer;
|
||||
PdfLayer textLayer = !(cb.PdfWriter.PageEvent is VlnSvgPageHelper _MyPageHelper) ? null : _MyPageHelper.TextLayer;
|
||||
if (textLayer != null) cb.BeginLayer(textLayer);
|
||||
float yAdj = -3.75F; //0.5F;
|
||||
float xAdj = 3F;
|
||||
@@ -226,8 +179,6 @@ namespace Volian.Print.Library
|
||||
// follow through in fixing an Out of Window Handles bug, use new function to see if
|
||||
// we can retrieve the font from a dictionary instead a doing a New and using another
|
||||
// window handle B21017-117
|
||||
//iTextSharp.text.Font iFont = _IsRev? Volian.Svg.Library.VolianPdf.GetFont(new System.Drawing.Font("Letter Gothic", 10F)):
|
||||
// Volian.Svg.Library.VolianPdf.GetFont(new System.Drawing.Font("Letter Gothic", 5.5F));
|
||||
iTextSharp.text.Font iFont = _IsRev? Volian.Svg.Library.VolianPdf.GetFont(VE_Font.GetWinSysFont("Letter Gothic", 10F)):
|
||||
Volian.Svg.Library.VolianPdf.GetFont(VE_Font.GetWinSysFont("Letter Gothic", 5.5F));
|
||||
|
||||
|
||||
@@ -1,20 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using iTextSharp.text.pdf;
|
||||
using iTextSharp.text;
|
||||
using VEPROMS.CSLA.Library;
|
||||
|
||||
namespace Volian.Print.Library
|
||||
{
|
||||
public partial class vlnHeader: vlnText
|
||||
{
|
||||
private string _OrigStr;
|
||||
public float HeaderWidth
|
||||
{
|
||||
get { return _WidthAdjust + (MyFont.CharsToTwips * Text.Length); }
|
||||
}
|
||||
private readonly string _OrigStr;
|
||||
public float HeaderWidth => _WidthAdjust + (MyFont.CharsToTwips * Text.Length);
|
||||
public vlnHeader(vlnParagraph myParent, PdfContentByte cb, string origStr, string cleanStr, float xoffset, float yoffset, VE_Font vFont)
|
||||
{
|
||||
MyParent = myParent;
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using iTextSharp.text.pdf;
|
||||
using iTextSharp.text;
|
||||
using VEPROMS.CSLA.Library;
|
||||
|
||||
namespace Volian.Print.Library
|
||||
{
|
||||
@@ -13,12 +7,7 @@ namespace Volian.Print.Library
|
||||
private bool _UseInternalY = false;
|
||||
// B2020-121: Account for Header on Caution or Note
|
||||
public bool UseInternalY { get => _UseInternalY; set => _UseInternalY = value; }
|
||||
private string _MacroDef;
|
||||
public string MacroDef
|
||||
{
|
||||
get { return _MacroDef; }
|
||||
set { _MacroDef = value; }
|
||||
}
|
||||
public string MacroDef { get; set; }
|
||||
public vlnMacro(float xoffset, float yoffset, string macroDef)
|
||||
{
|
||||
YOffset = yoffset;
|
||||
@@ -33,8 +22,7 @@ namespace Volian.Print.Library
|
||||
if (UseInternalY) yLocation = YOffset; // B2020-121: Account for Header on Caution or Note
|
||||
// Adjust the starting point for the Macro if the LPI is 7
|
||||
if (MyPageHelper.YMultiplier != 1) yLocation += SixLinesPerInch - _SevenLinesPerInch;
|
||||
VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper;
|
||||
PdfLayer textLayer = _MyPageHelper == null ? null : _MyPageHelper.TextLayer;
|
||||
PdfLayer textLayer = !(cb.PdfWriter.PageEvent is VlnSvgPageHelper _MyPageHelper) ? null : _MyPageHelper.TextLayer;
|
||||
if (textLayer != null) cb.BeginLayer(textLayer);
|
||||
MyContentByte = cb;
|
||||
System.Drawing.Color push = PrintOverride.SvgColor;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,14 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using iTextSharp.text.pdf;
|
||||
using iTextSharp.text;
|
||||
using Itenso.Rtf;
|
||||
using Itenso.Rtf.Parser;
|
||||
using Itenso.Rtf.Interpreter;
|
||||
using Itenso.Rtf.Support;
|
||||
using Volian.Controls.Library;
|
||||
using VEPROMS.CSLA.Library;
|
||||
using Volian.Base.Library;
|
||||
using System.Text.RegularExpressions;
|
||||
@@ -24,21 +20,13 @@ namespace Volian.Print.Library
|
||||
get { return _UniqueDebugId++; }
|
||||
set { _UniqueDebugId = value; }
|
||||
}
|
||||
private int _DebugId = UniqueDebugId;
|
||||
public int DebugId
|
||||
{
|
||||
get { return _DebugId; }
|
||||
set { _DebugId = value; }
|
||||
}
|
||||
|
||||
public int DebugId { get; set; } = UniqueDebugId;
|
||||
|
||||
protected static float _WidthAdjust = 1; // 1 Point - adjusted to match 16-bit line wrapping. For editting it's 3.
|
||||
protected static float _WidthAdjustBox = 6;
|
||||
private static float _SixLinesPerInch = 12; // twips
|
||||
public static float SixLinesPerInch
|
||||
{
|
||||
get { return vlnPrintObject._SixLinesPerInch; }
|
||||
set { vlnPrintObject._SixLinesPerInch = value; }
|
||||
}
|
||||
|
||||
public static float SixLinesPerInch { get; set; } = 12;
|
||||
protected static float _SevenLinesPerInch = 10.1F;//72F / 7F;
|
||||
|
||||
protected float _XOffset;
|
||||
@@ -64,30 +52,12 @@ namespace Volian.Print.Library
|
||||
set
|
||||
{
|
||||
_MyParent = value;
|
||||
if (_MyParent != null)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
private bool _HasIndent = false;
|
||||
public bool HasIndent
|
||||
{
|
||||
get { return _HasIndent; }
|
||||
set { _HasIndent = value; }
|
||||
}
|
||||
private bool _IsCompressed = false;
|
||||
public bool IsCompressed
|
||||
{
|
||||
get { return _IsCompressed; }
|
||||
set { _IsCompressed = value; }
|
||||
}
|
||||
private string _ImageText; // ro definition, value part of #Link in case of image/figure
|
||||
public string ImageText
|
||||
{
|
||||
get { return _ImageText; }
|
||||
set { _ImageText = value; }
|
||||
}
|
||||
public bool HasIndent { get; set; } = false;
|
||||
public bool IsCompressed { get; set; } = false;
|
||||
public string ImageText { get; set; }
|
||||
protected string _Rtf; // may become iTextSharp paragraph
|
||||
public virtual string Rtf
|
||||
{
|
||||
@@ -96,14 +66,8 @@ namespace Volian.Print.Library
|
||||
}
|
||||
public class VlnSplitCharacter : ISplitCharacter
|
||||
{
|
||||
public bool IsSplitCharacter(int start, int current, int end, char[] cc, PdfChunk[] ck)
|
||||
{
|
||||
return (cc[current] == ' ');
|
||||
}
|
||||
public bool IsSplitCharacter(char c)
|
||||
{
|
||||
return (c == ' ');
|
||||
}
|
||||
public bool IsSplitCharacter(int start, int current, int end, char[] cc, PdfChunk[] ck) => (cc[current] == ' ');
|
||||
public bool IsSplitCharacter(char c) => (c == ' ');
|
||||
}
|
||||
public static VlnSplitCharacter mySplitter = new VlnSplitCharacter();
|
||||
// B2018-034 Attributes were being lost when the IsCompressed flag was true.
|
||||
@@ -114,6 +78,7 @@ namespace Volian.Print.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
//For Debugging:
|
||||
// If the paragraph iscompressed, it may have been created as not compressed since compression
|
||||
// is not set when paragraph is initially created, it is set during pagination tests.
|
||||
//if (_IParagraph == null || IsCompressed)
|
||||
@@ -186,48 +151,9 @@ namespace Volian.Print.Library
|
||||
}
|
||||
set { _Height = value; }
|
||||
}
|
||||
public float GetParagraphHeight(PdfContentByte cb, Paragraph iParagraph, string suffix, float width)
|
||||
{
|
||||
return GetParagraphHeight(cb, iParagraph, suffix, width, true);
|
||||
}
|
||||
public float GetParagraphHeight(PdfContentByte cb, Paragraph iParagraph, string suffix, float width, bool throwException)
|
||||
{
|
||||
float heightAll = GetHeight(cb, iParagraph, suffix, width, throwException);
|
||||
return heightAll;
|
||||
}
|
||||
private static void RestoreLastCharacter(Paragraph iParagraph, Chunk chk)
|
||||
{
|
||||
iParagraph.RemoveAt(iParagraph.Count - 1);
|
||||
iParagraph.Add(chk);
|
||||
}
|
||||
private static Chunk RemoveLastCharacter(Paragraph iParagraph)
|
||||
{
|
||||
if (iParagraph.Count == 0)
|
||||
return null;
|
||||
object obj = iParagraph[iParagraph.Count-1];
|
||||
Chunk chk = obj as Chunk;
|
||||
if (chk == null)
|
||||
return null;
|
||||
string s = chk.Content;
|
||||
if (s.Length > 1 || iParagraph.Count > 1) // don't remove last character if it's the only one
|
||||
{
|
||||
iParagraph.RemoveAt(iParagraph.Count - 1);
|
||||
if (s.Length > 0)
|
||||
{
|
||||
if (s == "\xA0") // If this is a space at the end put it back
|
||||
{
|
||||
iParagraph.Add(chk);
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
s = s.Substring(0, s.Length - 1);
|
||||
iParagraph.Add(new Chunk(s, chk.Font));
|
||||
}
|
||||
}
|
||||
}
|
||||
return chk;
|
||||
}
|
||||
public float GetParagraphHeight(PdfContentByte cb, Paragraph iParagraph, string suffix, float width) => GetParagraphHeight(cb, iParagraph, suffix, width, true);
|
||||
public float GetParagraphHeight(PdfContentByte cb, Paragraph iParagraph, string suffix, float width, bool throwException) => (float)GetHeight(cb, iParagraph, suffix, width, throwException);
|
||||
|
||||
public static float GetHeight(PdfContentByte cb, Paragraph iParagraph, string suffix, float width, bool throwException)
|
||||
{
|
||||
ColumnText myColumnText = new ColumnText(cb);
|
||||
@@ -243,7 +169,6 @@ namespace Volian.Print.Library
|
||||
{
|
||||
myColumnText.AddElement(iParagraph);
|
||||
}
|
||||
//myColumnText.UseAscender = true;// Adjusts to the top of the text box.
|
||||
int status = myColumnText.Go(true); // Check to see if it will fit on the page.
|
||||
if (ColumnText.HasMoreText(status) && throwException)
|
||||
{
|
||||
@@ -255,7 +180,6 @@ namespace Volian.Print.Library
|
||||
iParagraph.IndentationLeft = 0;
|
||||
return GetHeight(cb, iParagraph, suffix, width, throwException);
|
||||
}
|
||||
//throw (new Exception("Paragraph longer than a page"));
|
||||
Console.WriteLine("Paragraph longer than a page");
|
||||
}
|
||||
return pgHeight - myColumnText.YLine; // This gives the height of the Paragraph // C2020-002 paper size is now set in the format files
|
||||
@@ -266,22 +190,18 @@ namespace Volian.Print.Library
|
||||
float h = GetParagraphHeight(cb, iParagraph, string.Empty, iWidth);
|
||||
int iWidthMax = iWidth; // maximum width in Characters
|
||||
int iDelta = iWidth / 2;
|
||||
iWidth = iWidth / 2;
|
||||
iWidth /= 2;
|
||||
while (iDelta > 0)
|
||||
{
|
||||
float h2 = GetParagraphHeight(cb, iParagraph, string.Empty, iWidth,false);
|
||||
iDelta = iDelta / 2;
|
||||
iDelta /= 2;
|
||||
if (h2 == h) iWidthMax = iWidth;
|
||||
iWidth += (h2>h ? 1: -1) * iDelta;
|
||||
}
|
||||
return (float) iWidthMax;
|
||||
}
|
||||
private PdfContentByte _MyContentByte;
|
||||
public PdfContentByte MyContentByte
|
||||
{
|
||||
get { return _MyContentByte; }
|
||||
set { _MyContentByte = value; }
|
||||
}
|
||||
|
||||
public PdfContentByte MyContentByte { get; set; }
|
||||
private VlnSvgPageHelper _MyPageHelper;
|
||||
public VlnSvgPageHelper MyPageHelper
|
||||
{
|
||||
@@ -301,45 +221,29 @@ namespace Volian.Print.Library
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static int ToInt(int value)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
public static int ToInt(int value) => value;
|
||||
/// <summary>
|
||||
/// No conversion necessary: int? twips -> int twips
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static int ToInt(int? value)
|
||||
{
|
||||
return ToInt((int)value);
|
||||
}
|
||||
public static int ToInt(int? value) => ToInt((int)value);
|
||||
/// <summary>
|
||||
/// No conversion necessary: string twips -> int twips
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static int ToInt(string value)
|
||||
{
|
||||
return ToInt((int)Convert.ToSingle(value));
|
||||
}
|
||||
public static int ToInt(string value) => ToInt((int)Convert.ToSingle(value));
|
||||
/// <summary>
|
||||
/// No conversion necessary: value from a list in a string, twips -> int twips
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static int ToInt(string value, int i)
|
||||
{
|
||||
string s = (value.Contains(",")) ? value.Split(",".ToCharArray())[i] : value;
|
||||
return ToInt(s);
|
||||
}
|
||||
public static int ToInt(string value, int i) => ToInt((value.Contains(",")) ? value.Split(",".ToCharArray())[i] : value);
|
||||
public static string GetRtf(string text, VE_Font vFont)
|
||||
{
|
||||
StringBuilder rtfSB = new StringBuilder();
|
||||
//DisplayText vlntxt = new DisplayText(text.TrimStart(" ".ToCharArray()), vFont, false);
|
||||
DisplayText vlntxt = new DisplayText(text, vFont, false);
|
||||
//rtfSB.Append(AddFontTable(vlntxt.TextFont.WindowsFont));
|
||||
//rtfSB.Append(AddFontTable(vFont.WindowsFont));
|
||||
rtfSB.Append(AddFontTable(vFont));
|
||||
rtfSB.Append(vlntxt.StartText);
|
||||
rtfSB.Append("}");
|
||||
@@ -413,10 +317,7 @@ namespace Volian.Print.Library
|
||||
float fE = iFont.BaseFont.GetWidthPointKerned("!", 12);
|
||||
return fW == fE;
|
||||
}
|
||||
public static iTextSharp.text.Paragraph RtfToParagraph(string rtf)
|
||||
{
|
||||
return RtfToParagraph(rtf, false, false);
|
||||
}
|
||||
public static iTextSharp.text.Paragraph RtfToParagraph(string rtf) => RtfToParagraph(rtf, false, false);
|
||||
public static iTextSharp.text.Paragraph RtfToParagraph(string rtf, bool hasIndent, bool doPdfLinks)
|
||||
{
|
||||
if (hasIndent)
|
||||
@@ -427,11 +328,13 @@ namespace Volian.Print.Library
|
||||
}
|
||||
|
||||
IRtfDocument rtfDoc = RtfInterpreterTool.BuildDoc(rtf);
|
||||
Rtf2iTextSharp rtf2IText = new Rtf2iTextSharp(rtfDoc);
|
||||
rtf2IText.DoPdfLinks = doPdfLinks;
|
||||
rtf2IText.HasIndent = hasIndent;
|
||||
Rtf2iTextSharp rtf2IText = new Rtf2iTextSharp(rtfDoc)
|
||||
{
|
||||
DoPdfLinks = doPdfLinks,
|
||||
HasIndent = hasIndent
|
||||
};
|
||||
iTextSharp.text.Paragraph para = rtf2IText.Convert();
|
||||
para.SetLeading(_SixLinesPerInch, 0);
|
||||
para.SetLeading(SixLinesPerInch, 0);
|
||||
if (rtf.Contains("\x05")) // note that this is for existing customer data as of August 2015.
|
||||
{
|
||||
// if there is a hanging indent, the iTextSharp paragraph properties must be set
|
||||
@@ -459,8 +362,7 @@ namespace Volian.Print.Library
|
||||
// Change the chunks to only split on spaces rather than spaces and hyphens
|
||||
foreach (object obj in para)//Fix the code to check for chunks before assuming chunks
|
||||
{
|
||||
Chunk chk = obj as Chunk;
|
||||
if (chk != null && (chk.Attributes==null || !chk.Attributes.ContainsKey("NoSplit")))
|
||||
if (obj is Chunk chk && (chk.Attributes == null || !chk.Attributes.ContainsKey("NoSplit")))
|
||||
{
|
||||
if (chk.Attributes == null) chk.Attributes = new System.Collections.Hashtable();
|
||||
chk.SetSplitCharacter(mySplitter);
|
||||
@@ -469,11 +371,7 @@ namespace Volian.Print.Library
|
||||
}
|
||||
return para;
|
||||
}
|
||||
private static string FixNumber(string num)
|
||||
{
|
||||
if (num == "") return ("0");
|
||||
return num;
|
||||
}
|
||||
private static string FixNumber(string num) => num == "" ? "0" : num;
|
||||
public static float CalculateHangingIndent(string rtf)
|
||||
{
|
||||
float chkW=0;
|
||||
@@ -515,8 +413,7 @@ namespace Volian.Print.Library
|
||||
}
|
||||
public void DebugPdf(PdfContentByte cb, float left, float top)
|
||||
{
|
||||
VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper;
|
||||
PdfLayer debugLayer = _MyPageHelper == null ? null : _MyPageHelper.DebugLayer;
|
||||
PdfLayer debugLayer = !(cb.PdfWriter.PageEvent is VlnSvgPageHelper _MyPageHelper) ? null : _MyPageHelper.DebugLayer;
|
||||
if (debugLayer == null) return;
|
||||
cb.SaveState();
|
||||
cb.BeginLayer(debugLayer);
|
||||
@@ -531,8 +428,7 @@ namespace Volian.Print.Library
|
||||
cb.EndLayer();
|
||||
cb.RestoreState();
|
||||
}
|
||||
public virtual float YBottom
|
||||
{ get { return YOffset + Height;} }
|
||||
public virtual float YBottom => YOffset + Height;
|
||||
}
|
||||
public partial class vlnPrintObjects : List<vlnPrintObject>
|
||||
{
|
||||
|
||||
@@ -1,40 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using iTextSharp.text.pdf;
|
||||
using iTextSharp.text;
|
||||
using VEPROMS.CSLA.Library;
|
||||
|
||||
namespace Volian.Print.Library
|
||||
{
|
||||
public partial class vlnRNOSeparator : vlnPrintObject
|
||||
{
|
||||
private VE_Font _MyFont;
|
||||
public VE_Font MyFont
|
||||
{
|
||||
get { return _MyFont; }
|
||||
set { _MyFont = value; }
|
||||
}
|
||||
private bool _ExtendChangeBar;
|
||||
public bool ExtendChangeBar
|
||||
{
|
||||
get { return _ExtendChangeBar; }
|
||||
set { _ExtendChangeBar = value; }
|
||||
}
|
||||
private float _XLength = 0;
|
||||
public float XLength
|
||||
{
|
||||
get { return _XLength; }
|
||||
set { _XLength = value; }
|
||||
}
|
||||
public VE_Font MyFont { get; set; }
|
||||
public bool ExtendChangeBar { get; set; }
|
||||
public float XLength { get; set; } = 0;
|
||||
|
||||
/* if flag set and separator defined then output separator */
|
||||
/*if separator is a control-A use RNOSepLine*/
|
||||
public vlnRNOSeparator(vlnParagraph parent, PdfContentByte cb, string sepStr, float xoffset, float yoffset, FormatInfo formatInfo, bool extendChangeBar)
|
||||
{
|
||||
MyContentByte = cb; // B2019-091: crash when printing (note moved from the 'ToPdf' method)
|
||||
ExtendChangeBar = formatInfo.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeBarToRNOSep ? extendChangeBar : false;
|
||||
ExtendChangeBar = formatInfo.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeBarToRNOSep && extendChangeBar;
|
||||
YOffset = yoffset;
|
||||
XOffset = xoffset;
|
||||
XLength = formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.RNOSepLineLength??0;
|
||||
@@ -60,8 +40,7 @@ namespace Volian.Print.Library
|
||||
if (XLength != 0)
|
||||
{
|
||||
cb.SaveState();
|
||||
VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper;
|
||||
PdfLayer textLayer = _MyPageHelper == null ? null : _MyPageHelper.TextLayer;
|
||||
PdfLayer textLayer = !(cb.PdfWriter.PageEvent is VlnSvgPageHelper _MyPageHelper) ? null : _MyPageHelper.TextLayer;
|
||||
if (textLayer != null) cb.BeginLayer(textLayer);
|
||||
iTextSharp.text.Color lineColor = new iTextSharp.text.Color(PrintOverride.OverrideChangeBarColor(System.Drawing.Color.Black));
|
||||
cb.SetColorStroke(lineColor);
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using iTextSharp.text.pdf;
|
||||
using iTextSharp.text;
|
||||
using VEPROMS.CSLA.Library;
|
||||
|
||||
namespace Volian.Print.Library
|
||||
@@ -59,35 +55,21 @@ namespace Volian.Print.Library
|
||||
return (float)_TabOffset * MyFont.CharsToTwips;
|
||||
}
|
||||
}
|
||||
private vlnMacro _MyMacro;
|
||||
public vlnMacro MyMacro
|
||||
{
|
||||
get { return _MyMacro; }
|
||||
set { _MyMacro = value; }
|
||||
}
|
||||
|
||||
private string symblsStr = "\u25CF\u0394"; // string of possible symbol character in a tab
|
||||
public vlnMacro MyMacro { get; set; }
|
||||
|
||||
private readonly string symblsStr = "\u25CF\u0394"; // string of possible symbol character in a tab
|
||||
// add symbol characters as needed
|
||||
// "\u25CF" - solid bullet
|
||||
// \u0394 - delta
|
||||
|
||||
private System.Drawing.FontStyle GetSysFontStyle(VE_Font f)
|
||||
{
|
||||
if (f.Style == E_Style.Italics)
|
||||
return System.Drawing.FontStyle.Italic;
|
||||
return FontStyle.Regular;
|
||||
}
|
||||
public float GetTextWidth(VE_Font vefont, string txt)
|
||||
{
|
||||
return GetTextWidth(vefont, txt, SymbolFontName);
|
||||
}
|
||||
private System.Drawing.FontStyle GetSysFontStyle(VE_Font f) => f.Style == E_Style.Italics ? System.Drawing.FontStyle.Italic : FontStyle.Regular;
|
||||
public float GetTextWidth(VE_Font vefont, string txt) => GetTextWidth(vefont, txt, SymbolFontName);
|
||||
private float GetTextWidth(VE_Font vefont, string txt, string symblFontName)
|
||||
{
|
||||
// follow through in fixing an Out of Window Handles bug, use new function to see if
|
||||
// we can retrieve the font from a dictionary instead a doing a New and using another
|
||||
// window handle B2017-117
|
||||
//System.Drawing.Font font = new System.Drawing.Font(vefont.Family, (float)vefont.Size, GetSysFontStyle(vefont));
|
||||
//System.Drawing.Font symbFont = new System.Drawing.Font(symblFontName, (float)vefont.Size);
|
||||
System.Drawing.Font font = VE_Font.GetWinSysFont(vefont.Family, (float)vefont.Size, GetSysFontStyle(vefont));
|
||||
System.Drawing.Font symbFont = VE_Font.GetWinSysFont(symblFontName, (float)vefont.Size);
|
||||
iTextSharp.text.Font iFont = Volian.Svg.Library.VolianPdf.GetFont(font);
|
||||
@@ -101,29 +83,13 @@ namespace Volian.Print.Library
|
||||
else
|
||||
w += iFont.BaseFont.GetWidthPointKerned(c.ToString(), (float)vefont.Size);
|
||||
}
|
||||
//float w = iFont.BaseFont.GetWidthPointKerned(Text.Replace("\u25CF","@"), (float)vefont.Size);
|
||||
return w;
|
||||
}
|
||||
bool _ScriptCaution = false;
|
||||
|
||||
public bool ScriptCaution
|
||||
{
|
||||
get { return _ScriptCaution; }
|
||||
set { _ScriptCaution = value; }
|
||||
}
|
||||
bool _SeparateBullet = false;
|
||||
public bool ScriptCaution { get; set; } = false;
|
||||
|
||||
public bool SeparateBullet
|
||||
{
|
||||
get { return _SeparateBullet; }
|
||||
set { _SeparateBullet = value; }
|
||||
}
|
||||
private string _SymbolFontName;
|
||||
public string SymbolFontName
|
||||
{
|
||||
get { return _SymbolFontName; }
|
||||
set { _SymbolFontName = value; }
|
||||
}
|
||||
public bool SeparateBullet { get; set; } = false;
|
||||
public string SymbolFontName { get; set; }
|
||||
public vlnTab(PdfContentByte cb, vlnParagraph myparent, string origTab, string cleanTab, float xoffset, float yoffset, VE_Font vFont, bool doSectTab, string symblFontName, bool removedUnderline)
|
||||
{
|
||||
SymbolFontName = symblFontName;
|
||||
@@ -149,20 +115,14 @@ namespace Volian.Print.Library
|
||||
Width = 90;
|
||||
}
|
||||
else if ((myparent.MyItemInfo.FormatStepData != null) && (myparent.MyItemInfo.FormatStepData.TabData.IdentWidth ?? 0) > 0)
|
||||
//if ((myparent.MyItemInfo.FormatStepData != null) && (myparent.MyItemInfo.FormatStepData.TabData.IdentWidth ?? 0) > 0)
|
||||
Width = (float)myparent.MyItemInfo.FormatStepData.TabData.IdentWidth;
|
||||
else if (CCCs != IIIs)
|
||||
{
|
||||
float tPtPerChar = myparent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.TabPtsPerChar ?? 6;
|
||||
Width = (tPtPerChar == 0 ? 6 : tPtPerChar) * origTab.Length;
|
||||
// Check the following, it may be needed for FPL:
|
||||
//origTab1 = origTab1.TrimStart(" ".ToCharArray());
|
||||
// 6 = number of points per character. 4 characters between end of tab and beginning of text
|
||||
// origTab1.Trim... is number of non-space characters of the tab string.
|
||||
//Width = 6 * (4 + origTab1.Trim(" ".ToCharArray()).Length);
|
||||
}
|
||||
else
|
||||
Width = GetTextWidth(MyFont, (Text != null ? Text : origTab), symblFontName); //MyFont.CharsToTwips * (Text != null ? Text.Length : origTab.Length);
|
||||
Width = GetTextWidth(MyFont, (Text ?? origTab), symblFontName);
|
||||
|
||||
// Pairie Island (NSP) Caution and Note tabs use a larger font
|
||||
// When using a bullet, we need to use the font size of the Caution/Note text instead of the tab.
|
||||
@@ -195,7 +155,7 @@ namespace Volian.Print.Library
|
||||
Width = (float)myparent.MyItemInfo.FormatStepData.TabData.IdentWidth;
|
||||
else
|
||||
{
|
||||
origTab = origTab + " ";
|
||||
origTab += " ";
|
||||
origTab = origTab.TrimStart(" ".ToCharArray());
|
||||
if (mindx > 2) // ouch!
|
||||
Width = 6f * (origTab.Length - 1); // FPL (macro is after {numeric}) FPL is good with genmac output!
|
||||
@@ -204,7 +164,7 @@ namespace Volian.Print.Library
|
||||
}
|
||||
}
|
||||
else
|
||||
Width = GetTextWidth(MyFont, (cleanTab != null ? cleanTab : origTab), symblFontName);//MyFont.CharsToTwips * (cleanTab != null ? cleanTab.Length : origTab.Length);
|
||||
Width = GetTextWidth(MyFont, (cleanTab ?? origTab), symblFontName);//MyFont.CharsToTwips * (cleanTab != null ? cleanTab.Length : origTab.Length);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -219,8 +179,6 @@ namespace Volian.Print.Library
|
||||
int sep = origTab.IndexOfAny(". ".ToCharArray());
|
||||
string prefix = ((vFont.Style & E_Style.Bold) > 0) ? @"\b\ul " : @"\ul ";
|
||||
string suffix = ((vFont.Style & E_Style.Bold) > 0) ? @"\b0\ulnone " : @"\ulnone ";
|
||||
//origTab = @"\ul " + origTab.Substring(0, sep-1) + @"\ulnone" + origTab.Substring(sep-1);
|
||||
//origTab = @"\ul " + origTab.Substring(0, sep) + @"\ulnone" + origTab.Substring(sep);
|
||||
origTab = prefix + origTab.Substring(0, sep) + suffix + origTab.Substring(sep);
|
||||
}
|
||||
|
||||
@@ -238,7 +196,6 @@ namespace Volian.Print.Library
|
||||
// follow through in fixing an Out of Window Handles bug, use new function to see if
|
||||
// we can retrieve the font from a dictionary instead a doing a New and using another
|
||||
// window handle B2017-117
|
||||
//vFont.WindowsFont = new System.Drawing.Font(vFont.Family, (float)vFont.Size, style);
|
||||
vFont.WindowsFont = VE_Font.GetWinSysFont(vFont.Family, (float)vFont.Size, style);
|
||||
int indxC = origTab.IndexOf(":");
|
||||
origTab = @"\ul " + origTab.Substring(0, indxC) + @"\ulnone" + origTab.Substring(indxC);
|
||||
@@ -255,7 +212,6 @@ namespace Volian.Print.Library
|
||||
// follow through in fixing an Out of Window Handles bug, use new function to see if
|
||||
// we can retrieve the font from a dictionary instead a doing a New and using another
|
||||
// window handle B2017-117
|
||||
//vFont.WindowsFont = new System.Drawing.Font(vFont.Family, (float)vFont.Size, style);
|
||||
vFont.WindowsFont = VE_Font.GetWinSysFont(vFont.Family, (float)vFont.Size, style);
|
||||
int indxC = origTab.IndexOf(ut.Text);
|
||||
string prefix = ((vFont.Style & E_Style.Bold) > 0) ? @"\b\ul " : @"\ul ";
|
||||
@@ -294,7 +250,6 @@ namespace Volian.Print.Library
|
||||
(myparent.MyItemInfo.MyPrevious.MyContent.Type == myparent.MyItemInfo.MyContent.Type)))
|
||||
{
|
||||
//if (scriptCaution)
|
||||
// Rtf = Rtf.Replace("CAUTION ", @"\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?");
|
||||
Rtf = Rtf.Replace("Caution:", " ");
|
||||
Rtf = Rtf.Replace("Note:", " ");
|
||||
Rtf = Rtf.Replace("CAUTION:", " ");
|
||||
@@ -305,19 +260,6 @@ namespace Volian.Print.Library
|
||||
Rtf = Rtf.Replace("NOTE", " ");
|
||||
}
|
||||
}
|
||||
//if (ScriptCaution && Rtf.Contains("Caution"))
|
||||
//{
|
||||
// // NSP script caution
|
||||
// iTextSharp.text.Font myfont = pdf.GetFont(vFont.Family, 28, 0, iTextSharp.text.Color.BLACK);
|
||||
// if (!myfont.BaseFont.CharExists(0x43)) // Capital 'C' exists as text
|
||||
// {
|
||||
// //VE_Font vf = new VE_Font("VolianScript", 28, E_Style.Italics, 12);
|
||||
// // Capital 'C' exists as Symbol
|
||||
// Rtf = Rtf.Replace("Caution ", @"\u61507?\u61537?\u61557?\u61556?\u61545?\u61551?\u61550?\u61472?\u61472?");
|
||||
// }
|
||||
|
||||
//}
|
||||
|
||||
|
||||
// do positioning based on whether format has locations for section 'header'. If it's not centered, treat
|
||||
// it's location more like a 'tab'.
|
||||
@@ -343,7 +285,6 @@ namespace Volian.Print.Library
|
||||
// follow through in fixing an Out of Window Handles bug, use new function to see if
|
||||
// we can retrieve the font from a dictionary instead a doing a New and using another
|
||||
// window handle B2017-117
|
||||
//System.Drawing.Font font = new System.Drawing.Font(MyFont.Family, (float)MyFont.Size);
|
||||
System.Drawing.Font font = VE_Font.GetWinSysFont(MyFont.Family, (float)MyFont.Size);
|
||||
iTextSharp.text.Font iFont = Volian.Svg.Library.VolianPdf.GetFont(font);
|
||||
float w = iFont.BaseFont.GetWidthPointKerned(txt, (float)MyFont.Size);
|
||||
|
||||
@@ -1,31 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using iTextSharp.text.pdf;
|
||||
using iTextSharp.text;
|
||||
using VEPROMS.CSLA.Library;
|
||||
|
||||
namespace Volian.Print.Library
|
||||
{
|
||||
public partial class vlnText : vlnPrintObject
|
||||
{
|
||||
//public float Width
|
||||
//{
|
||||
// get { return _CharsToTwips * Text.Length; }
|
||||
//}
|
||||
private string _Text;
|
||||
public string Text
|
||||
{
|
||||
get { return _Text; }
|
||||
set { _Text = value; }
|
||||
}
|
||||
private VE_Font _MyFont;
|
||||
public VE_Font MyFont
|
||||
{
|
||||
get { return _MyFont; }
|
||||
set { _MyFont = value; }
|
||||
}
|
||||
public string Text { get; set; }
|
||||
public VE_Font MyFont { get; set; }
|
||||
public vlnText(PdfContentByte cb, vlnParagraph myparent, string origText, string cleanText, float xoffset, float yoffset, VE_Font vFont)
|
||||
{
|
||||
MyContentByte = cb;
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace Volian.Svg.Library
|
||||
{
|
||||
//public static class FontFind
|
||||
//{
|
||||
// public static string FileName(string fontName)
|
||||
// {
|
||||
// string baseFont = string.Empty;
|
||||
// Regex find = new Regex(fontName + @".* ?\(.*\)", RegexOptions.IgnoreCase);
|
||||
// RegistryKey regKey = Registry.LocalMachine.CreateSubKey(@"Software\Microsoft\Windows NT\CurrentVersion\Fonts");
|
||||
// string[] values = regKey.GetValueNames();
|
||||
// baseFont = regKey.GetValue(values[0]).ToString();
|
||||
// foreach (string valueName in regKey.GetValueNames())
|
||||
// {
|
||||
// if (find.IsMatch(valueName))
|
||||
// return regKey.GetValue(valueName).ToString();
|
||||
// }
|
||||
// return baseFont;
|
||||
// }
|
||||
// public static string FullFileName(string fontName)
|
||||
// {
|
||||
// return @"c:\windows\fonts\" + FileName(fontName);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
@@ -17,13 +17,6 @@ namespace Volian.Svg.Library
|
||||
}
|
||||
public partial class Svg : SvgGroup
|
||||
{
|
||||
public void Draw(Graphics graphics)
|
||||
{
|
||||
//SetupInheritance();
|
||||
//Console.WriteLine("{0}, DPI {1}", graphics.VisibleClipBounds, graphics.DpiX);
|
||||
SvgParts.Draw(graphics, new SvgScale(DeviceDPI(graphics), graphics.VisibleClipBounds, _Width, _Height, _ViewBox), this, this);
|
||||
//SvgParts.Draw(graphics, new SvgScale(100, graphics.VisibleClipBounds, _Width, _Height, _ViewBox));
|
||||
}
|
||||
public static float DeviceDPI(Graphics g)
|
||||
{
|
||||
PointF[] tmp = { new PointF(g.DpiX, g.DpiY) };
|
||||
@@ -36,7 +29,6 @@ namespace Volian.Svg.Library
|
||||
public override void Draw(System.Drawing.Graphics graphics, SvgScale scale, Svg mySvg, SvgPartInheritance myParent)
|
||||
{
|
||||
SetupInheritance(myParent.MyInheritedSettings);
|
||||
//_MyLineSettings.Scale = scale.M(1F);
|
||||
if (FillColor != Color.Transparent)
|
||||
using (Brush brush = new SolidBrush(FillColor))
|
||||
graphics.FillEllipse(brush, scale.X(CX - Radius), scale.Y(CY - Radius), scale.M(Radius * 2), scale.M(Radius * 2));
|
||||
@@ -50,7 +42,6 @@ namespace Volian.Svg.Library
|
||||
public override void Draw(System.Drawing.Graphics graphics, SvgScale scale, Svg mySvg, SvgPartInheritance myParent)
|
||||
{
|
||||
SetupInheritance(myParent.MyInheritedSettings);
|
||||
//_MyLineSettings.Scale = scale.M(1F);
|
||||
if (FillColor != Color.Transparent)
|
||||
using (Brush brush = new SolidBrush(FillColor))
|
||||
graphics.FillEllipse(brush, scale.X(CX - Radius), scale.Y(CY - Radius), scale.M(Radius * 2), scale.M(Radius * 2));
|
||||
@@ -64,7 +55,6 @@ namespace Volian.Svg.Library
|
||||
public override void Draw(Graphics graphics, SvgScale myScale, Svg mySvg, SvgPartInheritance myParent)
|
||||
{
|
||||
// Don't draw
|
||||
//_SvgParts.Draw(graphics, myScale);
|
||||
}
|
||||
}
|
||||
public partial class SvgEllipse : SvgShapePart
|
||||
@@ -85,7 +75,7 @@ namespace Volian.Svg.Library
|
||||
public override void Draw(Graphics graphics, SvgScale myScale, Svg mySvg, SvgPartInheritance myParent)
|
||||
{
|
||||
SetupInheritance(myParent.MyInheritedSettings);
|
||||
_SvgParts.Draw(graphics, myScale, mySvg, this);
|
||||
SvgParts.Draw(graphics, myScale, mySvg, this);
|
||||
}
|
||||
}
|
||||
public partial class SvgImage : SvgPart
|
||||
@@ -130,26 +120,9 @@ namespace Volian.Svg.Library
|
||||
graphics.DrawRectangle(pen, scale.X(X),scale.Y(Y), scale.M(Width), scale.M(Height));
|
||||
}
|
||||
}
|
||||
//public partial class SvgRtf : SvgShapePart
|
||||
//{
|
||||
// //private static float _Factor = 1.085F; // 20 point Arial Font
|
||||
// public override void Draw(System.Drawing.Graphics graphics, SvgScale scale, Svg mySvg, SvgPartInheritance myParent)
|
||||
// {
|
||||
// SetupInheritance(myParent.MyInheritedSettings);
|
||||
// _MyFontSettings.Scale = scale.M(1F);
|
||||
// }
|
||||
// private float YAdjustment(Graphics gr, Font fnt)
|
||||
// {
|
||||
// int yAsc = fnt.FontFamily.GetCellAscent(fnt.Style);
|
||||
// int yLS = fnt.FontFamily.GetLineSpacing(fnt.Style);
|
||||
// float gth = fnt.GetHeight(gr);
|
||||
// float fAsc = (yAsc * gth) / yLS;
|
||||
// return -fAsc;
|
||||
// }
|
||||
//}
|
||||
|
||||
public partial class SvgText : SvgShapePart
|
||||
{
|
||||
//private static float _Factor = 1.085F; // 20 point Arial Font
|
||||
public override void Draw(System.Drawing.Graphics graphics, SvgScale scale, Svg mySvg, SvgPartInheritance myParent)
|
||||
{
|
||||
SetupInheritance(myParent.MyInheritedSettings);
|
||||
@@ -175,8 +148,6 @@ namespace Volian.Svg.Library
|
||||
private float YAdjustment(Graphics gr, Font fnt)
|
||||
{
|
||||
int yAsc = fnt.FontFamily.GetCellAscent(fnt.Style);
|
||||
//int yDesc = fnt.FontFamily.GetCellDescent(fnt.Style);
|
||||
//int yEm = fnt.FontFamily.GetEmHeight(fnt.Style);
|
||||
int yLS = fnt.FontFamily.GetLineSpacing(fnt.Style);
|
||||
float gth = fnt.GetHeight(gr);
|
||||
float fh = fnt.Size;
|
||||
@@ -189,7 +160,7 @@ namespace Volian.Svg.Library
|
||||
public override void Draw(System.Drawing.Graphics graphics, SvgScale scale, Svg mySvg, SvgPartInheritance myParent)
|
||||
{
|
||||
SetupInheritance(myParent.MyInheritedSettings);
|
||||
mySvg[_UseID.Substring(1)].Draw(graphics, scale.AdjustOrigin(X, Y), mySvg, this);
|
||||
mySvg[UseID.Substring(1)].Draw(graphics, scale.AdjustOrigin(X, Y), mySvg, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
using System.ComponentModel;
|
||||
|
||||
@@ -39,82 +37,44 @@ namespace Volian.Svg.Library
|
||||
}
|
||||
#endregion
|
||||
#region Width
|
||||
private SvgMeasurement _Width = new SvgMeasurement();
|
||||
[XmlIgnore]
|
||||
public SvgMeasurement Width
|
||||
{
|
||||
get { return _Width; }
|
||||
set { _Width = value; }
|
||||
}
|
||||
public SvgMeasurement Width { get; set; } = new SvgMeasurement();
|
||||
[System.ComponentModel.DefaultValueAttribute("0")]
|
||||
[XmlAttribute("width")]
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public string Width_XmlSurrogate
|
||||
{
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(_Width); }
|
||||
set { _Width = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(Width); }
|
||||
set { Width = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
}
|
||||
//private string _Watermark="";
|
||||
//[XmlAttribute("watermark")]
|
||||
//public string Watermark
|
||||
//{
|
||||
// get { return _Watermark; }
|
||||
// set { _Watermark = value; }
|
||||
//}
|
||||
//public void SetValidWaterMark(string token, string watermark)
|
||||
//{
|
||||
// if (token == "{" + watermark.ToUpper() + "PAGE}" )
|
||||
// _Watermark = watermark;
|
||||
//}
|
||||
#endregion
|
||||
#region Height
|
||||
private SvgMeasurement _Height = new SvgMeasurement();
|
||||
[XmlIgnore]
|
||||
public SvgMeasurement Height
|
||||
{
|
||||
get { return _Height; }
|
||||
set { _Height = value; }
|
||||
}
|
||||
public SvgMeasurement Height { get; set; } = new SvgMeasurement();
|
||||
[System.ComponentModel.DefaultValueAttribute("0")]
|
||||
[XmlAttribute("height")]
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public string Height_XmlSurrogate
|
||||
{
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(_Height); }
|
||||
set { _Height = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(Height); }
|
||||
set { Height = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
}
|
||||
#endregion
|
||||
#region ViewBox
|
||||
private SvgViewBox _ViewBox = new SvgViewBox("0 0 0 0");
|
||||
[XmlIgnore]
|
||||
public SvgViewBox ViewBox
|
||||
{
|
||||
get { return _ViewBox; }
|
||||
set { _ViewBox = value; }
|
||||
}
|
||||
public SvgViewBox ViewBox { get; set; } = new SvgViewBox("0 0 0 0");
|
||||
[System.ComponentModel.DefaultValueAttribute("0 0 0 0")]
|
||||
[XmlAttribute("viewBox")]
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public string SVGViewBox_XmlSurrogate
|
||||
{
|
||||
get { return SvgXmlConverter<SvgViewBox>.GetString(_ViewBox); }
|
||||
set { _ViewBox = SvgXmlConverter<SvgViewBox>.GetObject(value); }
|
||||
get { return SvgXmlConverter<SvgViewBox>.GetString(ViewBox); }
|
||||
set { ViewBox = SvgXmlConverter<SvgViewBox>.GetObject(value); }
|
||||
}
|
||||
#endregion
|
||||
//#region Setup Inheritance
|
||||
//private void SetupInheritance()
|
||||
//{
|
||||
// SvgParts.SetupInheritance(_MyInheritedSettings);
|
||||
//}
|
||||
////override internal void SetupInheritance(SvgInheritedSettings myParentsSettings)
|
||||
////{
|
||||
//// _MyInheritedSettings.MyParentsSettings = myParentsSettings;
|
||||
//// SvgParts.SetupInheritance(_MyInheritedSettings);
|
||||
////}
|
||||
//#endregion
|
||||
#region Part Lookup
|
||||
private Dictionary<string, SvgPart> _LookUp;
|
||||
[XmlIgnore]
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
@@ -13,65 +10,48 @@ namespace Volian.Svg.Library
|
||||
public SvgArc() { ;}
|
||||
public SvgArc(PointF location, float radius, float startAngle, float endAngle, Color fillColor, Color lineColor, float lineWidth)
|
||||
{
|
||||
_CX.Value = location.X;
|
||||
_CY.Value = location.Y;
|
||||
_Radius.Value = radius;
|
||||
CX.Value = location.X;
|
||||
CY.Value = location.Y;
|
||||
Radius.Value = radius;
|
||||
FillColor = fillColor;
|
||||
LineColor = lineColor;
|
||||
LineWidth = new SvgMeasurement(lineWidth);
|
||||
}
|
||||
//XMLElementAttribute(ElementName = "PREFIX", IsNullable = false)
|
||||
#endregion
|
||||
#region Location
|
||||
private SvgMeasurement _CX = new SvgMeasurement();
|
||||
[XmlIgnore]
|
||||
public SvgMeasurement CX
|
||||
{
|
||||
get { return _CX; }
|
||||
set { _CX = value; }
|
||||
}
|
||||
public SvgMeasurement CX { get; set; } = new SvgMeasurement();
|
||||
[XmlAttribute("cx")]
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public string CX_XmlSurrogate
|
||||
{
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(_CX); }
|
||||
set { _CX = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(CX); }
|
||||
set { CX = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
}
|
||||
private SvgMeasurement _CY = new SvgMeasurement();
|
||||
|
||||
[XmlIgnore]
|
||||
public SvgMeasurement CY
|
||||
{
|
||||
get { return _CY; }
|
||||
set { _CY = value; }
|
||||
}
|
||||
public SvgMeasurement CY { get; set; } = new SvgMeasurement();
|
||||
[XmlAttribute("cy")]
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public string CY_XmlSurrogate
|
||||
{
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(_CY); }
|
||||
set { _CY = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(CY); }
|
||||
set { CY = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
}
|
||||
#endregion
|
||||
#region Radius
|
||||
private SvgMeasurement _Radius = new SvgMeasurement();
|
||||
[XmlIgnore]
|
||||
public SvgMeasurement Radius
|
||||
{
|
||||
get { return _Radius; }
|
||||
set { _Radius = value; }
|
||||
}
|
||||
public SvgMeasurement Radius { get; set; } = new SvgMeasurement();
|
||||
[XmlAttribute("r")]
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public string X_XmlSurrogate
|
||||
{
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(_Radius); }
|
||||
set { _Radius = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(Radius); }
|
||||
set { Radius = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
}
|
||||
#endregion
|
||||
#region Angles
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
@@ -13,62 +10,47 @@ namespace Volian.Svg.Library
|
||||
public SvgCircle() { ;}
|
||||
public SvgCircle(PointF location, float radius, Color fillColor, Color lineColor, float lineWidth)
|
||||
{
|
||||
_CX.Value = location.X;
|
||||
_CY.Value = location.Y;
|
||||
_Radius.Value = radius;
|
||||
CX.Value = location.X;
|
||||
CY.Value = location.Y;
|
||||
Radius.Value = radius;
|
||||
FillColor = fillColor;
|
||||
LineColor = lineColor;
|
||||
LineWidth = new SvgMeasurement(lineWidth);
|
||||
}
|
||||
//XMLElementAttribute(ElementName = "PREFIX", IsNullable = false)
|
||||
#endregion
|
||||
#region Location
|
||||
private SvgMeasurement _CX = new SvgMeasurement();
|
||||
[XmlIgnore]
|
||||
public SvgMeasurement CX
|
||||
{
|
||||
get { return _CX; }
|
||||
set { _CX = value; }
|
||||
}
|
||||
public SvgMeasurement CX { get; set; } = new SvgMeasurement();
|
||||
[XmlAttribute("cx")]
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public string CX_XmlSurrogate
|
||||
{
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(_CX); }
|
||||
set { _CX = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(CX); }
|
||||
set { CX = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
}
|
||||
private SvgMeasurement _CY = new SvgMeasurement();
|
||||
|
||||
[XmlIgnore]
|
||||
public SvgMeasurement CY
|
||||
{
|
||||
get { return _CY; }
|
||||
set { _CY = value; }
|
||||
}
|
||||
public SvgMeasurement CY { get; set; } = new SvgMeasurement();
|
||||
[XmlAttribute("cy")]
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public string CY_XmlSurrogate
|
||||
{
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(_CY); }
|
||||
set { _CY = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(CY); }
|
||||
set { CY = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
}
|
||||
#endregion
|
||||
#region Radius
|
||||
private SvgMeasurement _Radius = new SvgMeasurement();
|
||||
[XmlIgnore]
|
||||
public SvgMeasurement Radius
|
||||
{
|
||||
get { return _Radius; }
|
||||
set { _Radius = value; }
|
||||
}
|
||||
public SvgMeasurement Radius { get; set; } = new SvgMeasurement();
|
||||
[XmlAttribute("r")]
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public string X_XmlSurrogate
|
||||
{
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(_Radius); }
|
||||
set { _Radius = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(Radius); }
|
||||
set { Radius = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
|
||||
namespace Volian.Svg.Library
|
||||
{
|
||||
public partial class SvgDefine : SvgGroup
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
@@ -13,78 +10,59 @@ namespace Volian.Svg.Library
|
||||
public SvgEllipse() { ;}
|
||||
public SvgEllipse(PointF location, float radiusX, float radiusY, Color fillColor, Color lineColor, float lineWidth)
|
||||
{
|
||||
_CX.Value = location.X;
|
||||
_CY.Value = location.Y;
|
||||
_RX.Value = radiusX;
|
||||
_RY.Value = radiusY;
|
||||
CX.Value = location.X;
|
||||
CY.Value = location.Y;
|
||||
RX.Value = radiusX;
|
||||
RY.Value = radiusY;
|
||||
FillColor = fillColor;
|
||||
LineColor = lineColor;
|
||||
LineWidth = new SvgMeasurement(lineWidth);
|
||||
}
|
||||
//XMLElementAttribute(ElementName = "PREFIX", IsNullable = false)
|
||||
#endregion
|
||||
#region Location
|
||||
private SvgMeasurement _CX = new SvgMeasurement();
|
||||
[XmlIgnore]
|
||||
public SvgMeasurement CX
|
||||
{
|
||||
get { return _CX; }
|
||||
set { _CX = value; }
|
||||
}
|
||||
public SvgMeasurement CX { get; set; } = new SvgMeasurement();
|
||||
[XmlAttribute("cx")]
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public string CX_XmlSurrogate
|
||||
{
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(_CX); }
|
||||
set { _CX = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(CX); }
|
||||
set { CX = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
}
|
||||
private SvgMeasurement _CY = new SvgMeasurement();
|
||||
|
||||
[XmlIgnore]
|
||||
public SvgMeasurement CY
|
||||
{
|
||||
get { return _CY; }
|
||||
set { _CY = value; }
|
||||
}
|
||||
public SvgMeasurement CY { get; set; } = new SvgMeasurement();
|
||||
[XmlAttribute("cy")]
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public string CY_XmlSurrogate
|
||||
{
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(_CY); }
|
||||
set { _CY = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(CY); }
|
||||
set { CY = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
}
|
||||
#endregion
|
||||
#region Size
|
||||
private SvgMeasurement _RX = new SvgMeasurement();
|
||||
[XmlIgnore]
|
||||
public SvgMeasurement RX
|
||||
{
|
||||
get { return _RX; }
|
||||
set { _RX = value; }
|
||||
}
|
||||
public SvgMeasurement RX { get; set; } = new SvgMeasurement();
|
||||
[XmlAttribute("rx")]
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public string RX_RXmlSurrogate
|
||||
{
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(_RX); }
|
||||
set { _RX = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(RX); }
|
||||
set { RX = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
}
|
||||
private SvgMeasurement _RY = new SvgMeasurement();
|
||||
|
||||
[XmlIgnore]
|
||||
public SvgMeasurement RY
|
||||
{
|
||||
get { return _RY; }
|
||||
set { _RY = value; }
|
||||
}
|
||||
public SvgMeasurement RY { get; set; } = new SvgMeasurement();
|
||||
[XmlAttribute("ry")]
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public string RY_XmlSurrogate
|
||||
{
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(_RY); }
|
||||
set { _RY = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(RY); }
|
||||
set { RY = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
|
||||
namespace Volian.Svg.Library
|
||||
@@ -9,34 +6,18 @@ namespace Volian.Svg.Library
|
||||
{
|
||||
#region ctor
|
||||
public SvgFillSettings() { ;}
|
||||
public SvgFillSettings(Color myColor)
|
||||
{
|
||||
_Fill = ColorTranslator.ToHtml(myColor);
|
||||
}
|
||||
//public SvgFillSettings(string myFill)
|
||||
//{
|
||||
// _Fill = myFill;
|
||||
//}
|
||||
public SvgFillSettings(Color myColor) => Fill = ColorTranslator.ToHtml(myColor);
|
||||
#endregion
|
||||
#region Inheritance
|
||||
private SvgFillSettings _MyParentsSettings = null;
|
||||
public SvgFillSettings MyParentsSettings
|
||||
{
|
||||
get { return _MyParentsSettings; }
|
||||
set
|
||||
{
|
||||
_MyParentsSettings = value;
|
||||
}
|
||||
}
|
||||
public SvgFillSettings MyParentsSettings { get; set; } = null;
|
||||
#endregion
|
||||
#region Internal Inherited Properties
|
||||
protected string InheritedFill
|
||||
{
|
||||
get
|
||||
{
|
||||
// Fill = "", "0" - Default, otherwise the value
|
||||
if (_Fill != "" && _Fill != "0" && _Fill.ToLower() != "empty") return _Fill; // Current Value
|
||||
if (_MyParentsSettings != null) return _MyParentsSettings.InheritedFill; // Inherited
|
||||
if (Fill != "" && Fill != "0" && Fill.ToLower() != "empty") return Fill; // Current Value
|
||||
if (MyParentsSettings != null) return MyParentsSettings.InheritedFill; // Inherited
|
||||
return "Black"; // Default
|
||||
}
|
||||
}
|
||||
@@ -54,20 +35,12 @@ namespace Volian.Svg.Library
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == Color.Transparent || value == Color.Empty)
|
||||
_Fill = "none";
|
||||
else
|
||||
_Fill = ColorTranslator.ToHtml(value);
|
||||
Fill = value == Color.Transparent || value == Color.Empty ? "none" : ColorTranslator.ToHtml(value);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Properties
|
||||
private string _Fill = string.Empty; // Default value is None
|
||||
public string Fill
|
||||
{
|
||||
get { return _Fill; }
|
||||
set { _Fill = value; }
|
||||
}
|
||||
public string Fill { get; set; } = string.Empty;
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
|
||||
namespace Volian.Svg.Library
|
||||
@@ -17,25 +14,9 @@ namespace Volian.Svg.Library
|
||||
_FontWeight = ((myFont.Style & FontStyle.Bold) == FontStyle.Bold ? "bold" : "normal");
|
||||
_TextDecoration = ((myFont.Style & FontStyle.Underline) == FontStyle.Underline ? "underline" : "normal");
|
||||
}
|
||||
//public SvgFontSettings(string myFontFamily, string myFontSize, string mySvgStyle, string myFontWeight, string myTextDecoration)
|
||||
//{
|
||||
// _FontFamilyName = myFontFamily;
|
||||
// _FontSize = myFontSize;
|
||||
// _SVGFontStyle = mySvgStyle;
|
||||
// _FontWeight = myFontWeight;
|
||||
// _TextDecoration = myTextDecoration;
|
||||
//}
|
||||
#endregion
|
||||
#region Inheritance
|
||||
private SvgFontSettings _MyParentsSettings = null;
|
||||
public SvgFontSettings MyParentsSettings
|
||||
{
|
||||
get { return _MyParentsSettings; }
|
||||
set
|
||||
{
|
||||
_MyParentsSettings = value;
|
||||
}
|
||||
}
|
||||
public SvgFontSettings MyParentsSettings { get; set; } = null;
|
||||
#endregion
|
||||
#region Internal Inherited Properties
|
||||
protected string InheritedFontFamily
|
||||
@@ -43,7 +24,7 @@ namespace Volian.Svg.Library
|
||||
get
|
||||
{
|
||||
if (_FontFamily != "") return _FontFamily;
|
||||
if (_MyParentsSettings != null) return _MyParentsSettings.InheritedFontFamily; // Default
|
||||
if (MyParentsSettings != null) return MyParentsSettings.InheritedFontFamily; // Default
|
||||
return "Arial"; // Absolute Default
|
||||
}
|
||||
}
|
||||
@@ -52,7 +33,7 @@ namespace Volian.Svg.Library
|
||||
get
|
||||
{
|
||||
if (_FontSize != "") return _FontSize; // Current Value
|
||||
if (_MyParentsSettings != null) return _MyParentsSettings.InheritedFontSize; // Default
|
||||
if (MyParentsSettings != null) return MyParentsSettings.InheritedFontSize; // Default
|
||||
return "9PT"; // Absolute Default
|
||||
}
|
||||
}
|
||||
@@ -61,7 +42,7 @@ namespace Volian.Svg.Library
|
||||
get
|
||||
{
|
||||
if (_SVGFontStyle != "") return _SVGFontStyle; // Current Value
|
||||
if (_MyParentsSettings != null) return _MyParentsSettings.InheritedFontStyle;// Default
|
||||
if (MyParentsSettings != null) return MyParentsSettings.InheritedFontStyle;// Default
|
||||
return "normal"; // Absolute Default
|
||||
}
|
||||
}
|
||||
@@ -70,7 +51,7 @@ namespace Volian.Svg.Library
|
||||
get
|
||||
{
|
||||
if (_FontWeight != "") return _FontWeight;// Current Value
|
||||
if (_MyParentsSettings != null) return _MyParentsSettings.InheritedFontWeight;// Default
|
||||
if (MyParentsSettings != null) return MyParentsSettings.InheritedFontWeight;// Default
|
||||
return "normal"; // Absolute Default
|
||||
}
|
||||
}
|
||||
@@ -79,7 +60,7 @@ namespace Volian.Svg.Library
|
||||
get
|
||||
{
|
||||
if (_TextDecoration != "") return _TextDecoration;// Current Value
|
||||
if (_MyParentsSettings != null) return _MyParentsSettings.InheritedTextDecoration;// Default
|
||||
if (MyParentsSettings != null) return MyParentsSettings.InheritedTextDecoration;// Default
|
||||
return "normal"; // Absolute Default
|
||||
}
|
||||
}
|
||||
@@ -110,13 +91,6 @@ namespace Volian.Svg.Library
|
||||
}
|
||||
set
|
||||
{
|
||||
// This was disposing fonts that are saved in our static dictionary.
|
||||
// caused problems with the step editor display after printing (found with Wolf Creek Chem procedure RW-G02 Step 6.1.17) - jsj 7/14/2017
|
||||
//if (_Font != null)
|
||||
//{
|
||||
// Console.WriteLine("font dispose {0}, {1}", _Font, _Font.Style);
|
||||
// //_Font.Dispose();
|
||||
//}
|
||||
if (value != null)
|
||||
{
|
||||
_FontFamily = value.FontFamily.Name;
|
||||
|
||||
@@ -1,38 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
|
||||
namespace Volian.Svg.Library
|
||||
{
|
||||
public partial class SvgGroup : SvgPartInheritance
|
||||
{
|
||||
#region Description
|
||||
private string _Description = string.Empty;
|
||||
[System.ComponentModel.DefaultValueAttribute("")]
|
||||
[XmlElement("desc")]
|
||||
public string Description
|
||||
{
|
||||
get { return _Description; }
|
||||
set { _Description = value; }
|
||||
}
|
||||
public string Description { get; set; } = string.Empty;
|
||||
#endregion
|
||||
#region Title
|
||||
private string _Title = string.Empty;
|
||||
[System.ComponentModel.DefaultValueAttribute("")]
|
||||
[XmlElement("title")]
|
||||
public string Title
|
||||
{
|
||||
get { return _Title; }
|
||||
set { _Title = value; }
|
||||
}
|
||||
public string Title { get; set; } = string.Empty;
|
||||
#endregion
|
||||
#region Parts
|
||||
// SVG Parts
|
||||
SvgParts _SvgParts = new SvgParts();
|
||||
//[XmlElement("foreignObject", typeof(SvgRtf))]
|
||||
[XmlElement("use", typeof(SvgUse))]
|
||||
[XmlElement("image", typeof(SvgImage))]
|
||||
[XmlElement("text", typeof(SvgText))]
|
||||
@@ -43,22 +27,14 @@ namespace Volian.Svg.Library
|
||||
[XmlElement("svg", typeof(Svg))]
|
||||
[XmlElement("g", typeof(SvgGroup))]
|
||||
[XmlElement("defs", typeof(SvgDefine))]
|
||||
public SvgParts SvgParts
|
||||
{
|
||||
get { return _SvgParts; }
|
||||
set { _SvgParts = value; }
|
||||
}
|
||||
public SvgParts SvgParts { get; set; } = new SvgParts();
|
||||
public SvgPart Add(SvgPart svgPart)
|
||||
{
|
||||
_SvgParts.Add(svgPart);
|
||||
SvgParts.Add(svgPart);
|
||||
return svgPart;
|
||||
}
|
||||
public void RemoveAt(int i)
|
||||
{
|
||||
_SvgParts.RemoveAt(i);
|
||||
}
|
||||
public int Count
|
||||
{ get { return _SvgParts.Count; } }
|
||||
public void RemoveAt(int i) => SvgParts.RemoveAt(i);
|
||||
public int Count => SvgParts.Count;
|
||||
#endregion
|
||||
#region Dictionary of Parts
|
||||
internal override void AddLookup(Dictionary<string, SvgPart> lookUp)
|
||||
@@ -67,9 +43,6 @@ namespace Volian.Svg.Library
|
||||
SvgParts.AddLookup(lookUp);
|
||||
}
|
||||
#endregion
|
||||
public override string ToString()
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
public override string ToString() => ID;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,3 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
@@ -13,87 +10,64 @@ namespace Volian.Svg.Library
|
||||
public SvgImage() { ;}
|
||||
public SvgImage(PointF location, SizeF size, string path)
|
||||
{
|
||||
_X.Value = location.X;
|
||||
_Y.Value = location.Y;
|
||||
_Width.Value = size.Width;
|
||||
_Height.Value = size.Height;
|
||||
_ImagePath = path;
|
||||
X.Value = location.X;
|
||||
Y.Value = location.Y;
|
||||
Width.Value = size.Width;
|
||||
Height.Value = size.Height;
|
||||
ImagePath = path;
|
||||
}
|
||||
#endregion
|
||||
#region Location
|
||||
private SvgMeasurement _X = new SvgMeasurement();
|
||||
[XmlIgnore]
|
||||
public SvgMeasurement X
|
||||
{
|
||||
get { return _X; }
|
||||
set { _X = value; }
|
||||
}
|
||||
public SvgMeasurement X { get; set; } = new SvgMeasurement();
|
||||
[XmlAttribute("x")]
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public string X_XmlSurrogate
|
||||
{
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(_X); }
|
||||
set { _X = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(X); }
|
||||
set { X = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
}
|
||||
private SvgMeasurement _Y = new SvgMeasurement();
|
||||
|
||||
[XmlIgnore]
|
||||
public SvgMeasurement Y
|
||||
{
|
||||
get { return _Y; }
|
||||
set { _Y = value; }
|
||||
}
|
||||
public SvgMeasurement Y { get; set; } = new SvgMeasurement();
|
||||
[XmlAttribute("y")]
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public string Y_XmlSurrogate
|
||||
{
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(_Y); }
|
||||
set { _Y = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(Y); }
|
||||
set { Y = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
}
|
||||
#endregion
|
||||
#region Size
|
||||
private SvgMeasurement _Width = new SvgMeasurement();
|
||||
[XmlIgnore]
|
||||
public SvgMeasurement Width
|
||||
{
|
||||
get { return _Width; }
|
||||
set { _Width = value; }
|
||||
}
|
||||
public SvgMeasurement Width { get; set; } = new SvgMeasurement();
|
||||
[XmlAttribute("width")]
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public string Width_WidthmlSurrogate
|
||||
{
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(_Width); }
|
||||
set { _Width = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(Width); }
|
||||
set { Width = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
}
|
||||
private SvgMeasurement _Height = new SvgMeasurement();
|
||||
|
||||
[XmlIgnore]
|
||||
public SvgMeasurement Height
|
||||
{
|
||||
get { return _Height; }
|
||||
set { _Height = value; }
|
||||
}
|
||||
public SvgMeasurement Height { get; set; } = new SvgMeasurement();
|
||||
[XmlAttribute("height")]
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public string Height_XmlSurrogate
|
||||
{
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(_Height); }
|
||||
set { _Height = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(Height); }
|
||||
set { Height = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
}
|
||||
#endregion
|
||||
#region Path to Image File
|
||||
private string _ImagePath = null;
|
||||
[XmlAttribute(AttributeName = "href", Namespace = "http://www.w3.org/1999/xlink")]
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public string ImagePath
|
||||
{
|
||||
get { return _ImagePath; }
|
||||
set { _ImagePath = value; }
|
||||
}
|
||||
public string ImagePath { get; set; } = null;
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,3 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Volian.Svg.Library
|
||||
{
|
||||
internal class SvgInheritedSettings
|
||||
@@ -21,67 +17,52 @@ namespace Volian.Svg.Library
|
||||
}
|
||||
#endregion
|
||||
#region Line Settings
|
||||
private SvgLineSettings _MyLineSettings = new SvgLineSettings();
|
||||
public SvgLineSettings MyLineSettings
|
||||
{
|
||||
get { return _MyLineSettings; }
|
||||
set { _MyLineSettings = value; }
|
||||
}
|
||||
public SvgLineSettings MyLineSettings { get; set; } = new SvgLineSettings();
|
||||
public string Stroke
|
||||
{
|
||||
get { return _MyLineSettings.Stroke; }
|
||||
set { _MyLineSettings.Stroke = value; }
|
||||
get { return MyLineSettings.Stroke; }
|
||||
set { MyLineSettings.Stroke = value; }
|
||||
}
|
||||
public string StrokeWidth
|
||||
{
|
||||
get { return _MyLineSettings.StrokeWidth; }
|
||||
set { _MyLineSettings.StrokeWidth = value; }
|
||||
get { return MyLineSettings.StrokeWidth; }
|
||||
set { MyLineSettings.StrokeWidth = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Fill Settings
|
||||
private SvgFillSettings _MyFillSettings = new SvgFillSettings();
|
||||
internal SvgFillSettings MyFillSettings
|
||||
{
|
||||
get { return _MyFillSettings; }
|
||||
set { _MyFillSettings = value; }
|
||||
}
|
||||
internal SvgFillSettings MyFillSettings { get; set; } = new SvgFillSettings();
|
||||
public string Fill
|
||||
{
|
||||
get { return _MyFillSettings.Fill; }
|
||||
set { _MyFillSettings.Fill = value; }
|
||||
get { return MyFillSettings.Fill; }
|
||||
set { MyFillSettings.Fill = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Font Settings
|
||||
private SvgFontSettings _MyFontSettings = new SvgFontSettings();
|
||||
internal SvgFontSettings MyFontSettings
|
||||
{
|
||||
get { return _MyFontSettings; }
|
||||
set { _MyFontSettings = value; }
|
||||
}
|
||||
internal SvgFontSettings MyFontSettings { get; set; } = new SvgFontSettings();
|
||||
public string FontFamily
|
||||
{
|
||||
get { return _MyFontSettings.FontFamily; }
|
||||
set { _MyFontSettings.FontFamily = value; }
|
||||
get { return MyFontSettings.FontFamily; }
|
||||
set { MyFontSettings.FontFamily = value; }
|
||||
}
|
||||
public string FontSize
|
||||
{
|
||||
get { return _MyFontSettings.FontSize; }
|
||||
set { _MyFontSettings.FontSize = value; }
|
||||
get { return MyFontSettings.FontSize; }
|
||||
set { MyFontSettings.FontSize = value; }
|
||||
}
|
||||
public string SVGFontStyle
|
||||
{
|
||||
get { return _MyFontSettings.SVGFontStyle; }
|
||||
set { _MyFontSettings.SVGFontStyle = value; }
|
||||
get { return MyFontSettings.SVGFontStyle; }
|
||||
set { MyFontSettings.SVGFontStyle = value; }
|
||||
}
|
||||
public string FontWeight
|
||||
{
|
||||
get { return _MyFontSettings.FontWeight; }
|
||||
set { _MyFontSettings.FontWeight = value; }
|
||||
get { return MyFontSettings.FontWeight; }
|
||||
set { MyFontSettings.FontWeight = value; }
|
||||
}
|
||||
public string TextDecoration
|
||||
{
|
||||
get { return _MyFontSettings.TextDecoration; }
|
||||
set { _MyFontSettings.TextDecoration = value; }
|
||||
get { return MyFontSettings.TextDecoration; }
|
||||
set { MyFontSettings.TextDecoration = value; }
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
@@ -13,146 +11,72 @@ namespace Volian.Svg.Library
|
||||
public SvgLine() { ;}
|
||||
public SvgLine(PointF location1, PointF location2, Color lineColor, float lineWidth)
|
||||
{
|
||||
_X1.Value = location1.X;
|
||||
_Y1.Value = location1.Y;
|
||||
_X2.Value = location2.X;
|
||||
_Y2.Value = location2.Y;
|
||||
X1.Value = location1.X;
|
||||
Y1.Value = location1.Y;
|
||||
X2.Value = location2.X;
|
||||
Y2.Value = location2.Y;
|
||||
LineColor = lineColor;
|
||||
LineWidth = new SvgMeasurement(lineWidth);
|
||||
}
|
||||
//XMLElementAttribute(ElementName = "PREFIX", IsNullable = false)
|
||||
#endregion
|
||||
#region Location1
|
||||
private SvgMeasurement _X1 = new SvgMeasurement();
|
||||
[XmlIgnore]
|
||||
public SvgMeasurement X1
|
||||
{
|
||||
get { return _X1; }
|
||||
set { _X1 = value; }
|
||||
}
|
||||
public SvgMeasurement X1 { get; set; } = new SvgMeasurement();
|
||||
[XmlAttribute("x1")]
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public string X1_XmlSurrogate
|
||||
{
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(_X1); }
|
||||
set { _X1 = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(X1); }
|
||||
set { X1 = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
}
|
||||
private SvgMeasurement _Y1 = new SvgMeasurement();
|
||||
|
||||
[XmlIgnore]
|
||||
public SvgMeasurement Y1
|
||||
{
|
||||
get { return _Y1; }
|
||||
set { _Y1 = value; }
|
||||
}
|
||||
public SvgMeasurement Y1 { get; set; } = new SvgMeasurement();
|
||||
[XmlAttribute("y1")]
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public string Y1_XmlSurrogate
|
||||
{
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(_Y1); }
|
||||
set { _Y1 = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(Y1); }
|
||||
set { Y1 = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
}
|
||||
#endregion
|
||||
#region Location2
|
||||
private SvgMeasurement _X2 = new SvgMeasurement();
|
||||
[XmlIgnore]
|
||||
public SvgMeasurement X2
|
||||
{
|
||||
get { return _X2; }
|
||||
set { _X2 = value; }
|
||||
}
|
||||
public SvgMeasurement X2 { get; set; } = new SvgMeasurement();
|
||||
[XmlAttribute("x2")]
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public string X2_XmlSurrogate
|
||||
{
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(_X2); }
|
||||
set { _X2 = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(X2); }
|
||||
set { X2 = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
}
|
||||
private SvgMeasurement _Y2 = new SvgMeasurement();
|
||||
|
||||
[XmlIgnore]
|
||||
public SvgMeasurement Y2
|
||||
{
|
||||
get { return _Y2; }
|
||||
set { _Y2 = value; }
|
||||
}
|
||||
public SvgMeasurement Y2 { get; set; } = new SvgMeasurement();
|
||||
[XmlAttribute("y2")]
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public string Y_XmlSurrogate
|
||||
{
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(_Y2); }
|
||||
set { _Y2 = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(Y2); }
|
||||
set { Y2 = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
}
|
||||
#endregion
|
||||
#region Description
|
||||
private string _Description = string.Empty;
|
||||
[System.ComponentModel.DefaultValueAttribute("")]
|
||||
[XmlElement("desc")]
|
||||
public string Description
|
||||
{
|
||||
get { return _Description; }
|
||||
set { _Description = value; }
|
||||
}
|
||||
public string Description { get; set; } = string.Empty;
|
||||
#endregion
|
||||
#region LineColor
|
||||
//protected Color _LineColor = Color.Empty;
|
||||
//[XmlIgnoreAttribute()]
|
||||
//public Color LineColor
|
||||
//{
|
||||
// get { return _LineWidth.Value == 0 ? Color.LightGray : _LineColor == Color.Empty ? Color.Gray : _LineColor; }
|
||||
// set { _LineColor = value; }
|
||||
//}
|
||||
private Color AdjustColorForWidth(Color myColor, float myWidth)
|
||||
{
|
||||
if (myWidth > 1F) return myColor;
|
||||
//Console.WriteLine("Line Width = {0}, Alpha = {1}", myWidth, Convert.ToInt32(myWidth * 255));
|
||||
return Color.FromArgb(Convert.ToInt32(myWidth * 255), myColor);
|
||||
}
|
||||
// Serializes the 'BackgroundColor' Color to XML.
|
||||
//[System.ComponentModel.DefaultValueAttribute("none")]
|
||||
//[XmlAttribute("stroke")]
|
||||
//public string Stroke
|
||||
//{
|
||||
// get { return _LineColor == Color.Empty ? "none" : _LineColor == Color.Black ? "" : ColorTranslator.ToHtml(_LineColor); }
|
||||
// set { _LineColor = (value == "none" ? Color.Empty : (value == "" ? Color.Empty : ColorTranslator.FromHtml(value))); }
|
||||
//}
|
||||
#endregion
|
||||
#region LineWidth
|
||||
//private SvgMeasurement GetLineWidth()
|
||||
//{
|
||||
// if (_LineWidth.Value == -1) return new SvgMeasurement(1F);// Minimum Strokewidth
|
||||
// if (_LineWidth.Value == 0) return new SvgMeasurement(.01F);// Minimum Strokewidth
|
||||
// if (_LineColor == Color.Empty) return new SvgMeasurement( .01F);// No Color - Minimum Strokewidth
|
||||
// return _LineWidth;
|
||||
//}
|
||||
//private SvgMeasurement _LineWidth = new SvgMeasurement();
|
||||
//[XmlIgnore]
|
||||
//public SvgMeasurement LineWidth
|
||||
//{
|
||||
// get { return _LineWidth; }
|
||||
// set { _LineWidth = value; }
|
||||
//}
|
||||
//[XmlAttribute("stroke-width")]
|
||||
//[Browsable(false)]
|
||||
//[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
//public string LineWidth_XmlSurrogate
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// if (_LineWidth.Value == -1)
|
||||
// return "none";
|
||||
// return VolianXmlConverter<SvgMeasurement>.GetString(_LineWidth);
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// if (value == "none")
|
||||
// _LineWidth = VolianXmlConverter<SvgMeasurement>.GetObject("-1");
|
||||
// else
|
||||
// _LineWidth = VolianXmlConverter<SvgMeasurement>.GetObject(value);
|
||||
// }
|
||||
//}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.Xml.Serialization;
|
||||
using System.ComponentModel;
|
||||
@@ -52,10 +49,7 @@ namespace Volian.Svg.Library
|
||||
}
|
||||
#endregion
|
||||
#region Setup Inheritance
|
||||
override internal void SetupInheritance(SvgInheritedSettings myParentsSettings)
|
||||
{
|
||||
_MyLineSettings.MyParentsSettings = myParentsSettings.MyLineSettings;
|
||||
}
|
||||
override internal void SetupInheritance(SvgInheritedSettings myParentsSettings) => _MyLineSettings.MyParentsSettings = myParentsSettings.MyLineSettings;
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.ComponentModel;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Volian.Svg.Library
|
||||
{
|
||||
@@ -13,34 +8,20 @@ namespace Volian.Svg.Library
|
||||
public SvgLineSettings() { ;}
|
||||
public SvgLineSettings(Color myColor, SvgMeasurement myWidth)
|
||||
{
|
||||
_Stroke = ColorTranslator.ToHtml(myColor);
|
||||
_StrokeWidth = myWidth.ToString();
|
||||
Stroke = ColorTranslator.ToHtml(myColor);
|
||||
StrokeWidth = myWidth.ToString();
|
||||
}
|
||||
//public SvgLineSettings(string myStroke, string myStrokeWidth)
|
||||
//{
|
||||
// _Stroke = myStroke;
|
||||
// _StrokeWidth = myStrokeWidth;
|
||||
//}
|
||||
#endregion
|
||||
#region Inheritance
|
||||
private SvgLineSettings _MyParentsSettings = null;
|
||||
public SvgLineSettings MyParentsSettings
|
||||
{
|
||||
get { return _MyParentsSettings; }
|
||||
set
|
||||
{
|
||||
_MyParentsSettings = value;
|
||||
}
|
||||
}
|
||||
public SvgLineSettings MyParentsSettings { get; set; } = null;
|
||||
#endregion
|
||||
#region Internal Inherited Properties
|
||||
protected string InheritedStroke
|
||||
{
|
||||
get
|
||||
{
|
||||
// Stroke = "", "0" - Default, otherwise the value
|
||||
if (_Stroke != "" && _Stroke != "0") return _Stroke; // Current Value
|
||||
if (_MyParentsSettings != null) return _MyParentsSettings.InheritedStroke;// Inherited
|
||||
if (Stroke != "" && Stroke != "0") return Stroke; // Current Value
|
||||
if (MyParentsSettings != null) return MyParentsSettings.InheritedStroke;// Inherited
|
||||
return "None"; // Default
|
||||
}
|
||||
}
|
||||
@@ -49,68 +30,47 @@ namespace Volian.Svg.Library
|
||||
get
|
||||
{
|
||||
// StrokeWidth = "", "none" - Default, otherwise the value
|
||||
if (_StrokeWidth != "" && _StrokeWidth != "none") return _StrokeWidth; // Current Value
|
||||
if (_MyParentsSettings != null) return _MyParentsSettings.InheritedLineWidth; // Inherited
|
||||
if (StrokeWidth != "" && StrokeWidth != "none") return StrokeWidth; // Current Value
|
||||
if (MyParentsSettings != null) return MyParentsSettings.InheritedLineWidth; // Inherited
|
||||
return "1PX"; // Default
|
||||
}
|
||||
}
|
||||
//protected string InheritedOutlineWidth
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// // StrokeWidth = "", "none" - Default, otherwise the value
|
||||
// if (_StrokeWidth != "" && _StrokeWidth.ToLower() != "none") return _StrokeWidth; // Current Value
|
||||
// if (_MyParent != null) return _MyParent.InheritedLineWidth; // Inherited
|
||||
// return "1PX"; // Default
|
||||
// }
|
||||
//}
|
||||
#endregion
|
||||
#region Inherited Values
|
||||
public SvgMeasurement LineWidth
|
||||
{
|
||||
get
|
||||
{
|
||||
// Stroke = "None" - Light, otherwise the value
|
||||
// StrokeWidth = "None" Light, otherwise the value
|
||||
string myStroke = InheritedStroke;
|
||||
string myWidth = InheritedLineWidth;
|
||||
//if (myStroke.ToLower() == "none" || myWidth.ToLower() == "none") // Light
|
||||
// return new SvgMeasurement(.001F, E_MeasurementUnits.PX);
|
||||
SvgMeasurement myMeasurement = new SvgMeasurement(myWidth);
|
||||
//myMeasurement.Value *= _Scale;
|
||||
return myMeasurement;
|
||||
}
|
||||
set
|
||||
{
|
||||
_StrokeWidth = value.ToString();
|
||||
StrokeWidth = value.ToString();
|
||||
}
|
||||
}
|
||||
public SvgMeasurement OutlineWidth
|
||||
{
|
||||
get
|
||||
{
|
||||
// Stroke = "None" - Eliminate, otherwise the value
|
||||
// StrokeWidth = "0" Eliminate, otherwise the value
|
||||
string myStroke = InheritedStroke;
|
||||
//string myWidth = InheritedOutlineWidth;
|
||||
string myWidth = InheritedLineWidth;
|
||||
if (myStroke.ToLower() == "none" || myWidth == "0") // Eliminate
|
||||
return new SvgMeasurement(0, E_MeasurementUnits.PX);
|
||||
SvgMeasurement myMeasurement = new SvgMeasurement(myWidth);
|
||||
//myMeasurement.Value *= _Scale;
|
||||
return myMeasurement;
|
||||
}
|
||||
set
|
||||
{
|
||||
_StrokeWidth = value.ToString();
|
||||
StrokeWidth = value.ToString();
|
||||
}
|
||||
}
|
||||
public Color LineColor
|
||||
{
|
||||
get
|
||||
{
|
||||
// Stroke = "None" - Eliminate, otherwise the value
|
||||
// StrokeWidth = "None" Eliminate, otherwise the value
|
||||
string myStroke = InheritedStroke;
|
||||
string myWidth = InheritedLineWidth;
|
||||
if (myStroke.ToLower() == "none" || myWidth.ToLower() == "none" || myWidth == "0") // Light
|
||||
@@ -120,9 +80,9 @@ namespace Volian.Svg.Library
|
||||
set
|
||||
{
|
||||
if (value == Color.Empty)
|
||||
_Stroke = "none";
|
||||
Stroke = "none";
|
||||
else
|
||||
_Stroke = ColorTranslator.ToHtml(value);
|
||||
Stroke = ColorTranslator.ToHtml(value);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -130,10 +90,7 @@ namespace Volian.Svg.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
// Stroke = "None" - Eliminate, otherwise the value
|
||||
// StrokeWidth = "0" Eliminate, otherwise the value
|
||||
string myStroke = InheritedStroke;
|
||||
//string myWidth = InheritedOutlineWidth;
|
||||
string myWidth = InheritedLineWidth;
|
||||
if (myStroke.ToLower() == "none" || myWidth == "0") // Eliminate
|
||||
return Color.Empty;
|
||||
@@ -142,26 +99,16 @@ namespace Volian.Svg.Library
|
||||
set
|
||||
{
|
||||
if (value == Color.Empty)
|
||||
_Stroke = "none";
|
||||
Stroke = "none";
|
||||
else
|
||||
_Stroke = ColorTranslator.ToHtml(value);
|
||||
Stroke = ColorTranslator.ToHtml(value);
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
#region Properties
|
||||
private string _Stroke = string.Empty; // Default value is None
|
||||
public string Stroke
|
||||
{
|
||||
get { return _Stroke; }
|
||||
set { _Stroke = value; }
|
||||
}
|
||||
private string _StrokeWidth = string.Empty; // Default value is 1PX
|
||||
public string StrokeWidth
|
||||
{
|
||||
get { return _StrokeWidth; }
|
||||
set { _StrokeWidth = value; }
|
||||
}
|
||||
public string Stroke { get; set; } = string.Empty;
|
||||
public string StrokeWidth { get; set; } = string.Empty;
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Volian.Svg.Library
|
||||
@@ -57,24 +53,24 @@ namespace Volian.Svg.Library
|
||||
public SvgMeasurement() { ;}
|
||||
public SvgMeasurement(int value)
|
||||
{
|
||||
_Value = Convert.ToSingle(value);
|
||||
Value = Convert.ToSingle(value);
|
||||
_Units = E_MeasurementUnits.PX;
|
||||
}
|
||||
public SvgMeasurement(float value)
|
||||
{
|
||||
_Value = value;
|
||||
Value = value;
|
||||
_Units = E_MeasurementUnits.PX;
|
||||
}
|
||||
public SvgMeasurement(float value, E_MeasurementUnits units)
|
||||
{
|
||||
_Value = value;
|
||||
Value = value;
|
||||
_Units = units;
|
||||
}
|
||||
public SvgMeasurement(string val)
|
||||
{
|
||||
val = val.Replace("{size}", "10");// B2020-145 BWD SAMG TSG-6 Fix for Base Format {size} parameter rather than font size
|
||||
MatchCollection mc = Regex.Matches(val.ToLower(), "([+-]?[.0-9]+)|(in|cm|mm|em|ex|pc|pt|px|percentage)");
|
||||
_Value = Convert.ToSingle(mc[0].Value);
|
||||
Value = Convert.ToSingle(mc[0].Value);
|
||||
if (mc.Count == 2)
|
||||
{
|
||||
//Console.WriteLine("{0} - '{1}'", val, mc[1].Value.ToUpper());
|
||||
@@ -93,15 +89,11 @@ namespace Volian.Svg.Library
|
||||
{
|
||||
float tmp = GetSizeInPoints(DPI);
|
||||
_Units = value;
|
||||
_Value *= (tmp / GetSizeInPoints(DPI));
|
||||
Value *= (tmp / GetSizeInPoints(DPI));
|
||||
}
|
||||
}
|
||||
private float _Value;
|
||||
public float Value
|
||||
{
|
||||
get { return _Value; }
|
||||
set { _Value = value; }
|
||||
}
|
||||
|
||||
public float Value { get; set; }
|
||||
#endregion
|
||||
#region ToString
|
||||
public override string ToString()
|
||||
@@ -109,92 +101,43 @@ namespace Volian.Svg.Library
|
||||
switch (_Units)
|
||||
{
|
||||
case E_MeasurementUnits.PX: // Default
|
||||
return string.Format("{0}", _Value);
|
||||
return string.Format("{0}", Value);
|
||||
case E_MeasurementUnits.PERCENTAGE: // Precentage is preceded by a space
|
||||
return string.Format("{0} {1}", _Value, _Units);
|
||||
return string.Format("{0} {1}", Value, _Units);
|
||||
}
|
||||
return string.Format("{0}{1}", _Value, _Units);
|
||||
return string.Format("{0}{1}", Value, _Units);
|
||||
}
|
||||
#endregion
|
||||
//public float SizeInPixels
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// switch (_Units)
|
||||
// {
|
||||
// case E_MeasurementUnits.PT: //Points - 72 per inch
|
||||
// return _Value * DPI / 72F;
|
||||
// case E_MeasurementUnits.PC: //Picas - 6 per inch
|
||||
// return _Value * DPI / 6F;
|
||||
// case E_MeasurementUnits.IN: //inches
|
||||
// return _Value * DPI;
|
||||
// case E_MeasurementUnits.CM: // Centimeter
|
||||
// return _Value * DPI / 2.54F;
|
||||
// case E_MeasurementUnits.MM: // Millimeter
|
||||
// return _Value * DPI / 25.4F;
|
||||
// case E_MeasurementUnits.EM: // EMs
|
||||
// return _Value * DPI / 8;
|
||||
// case E_MeasurementUnits.EX: // EXs
|
||||
// return _Value * DPI / 16;
|
||||
// default:
|
||||
// return _Value;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
public float GetSizeInPoints(float myDPI)
|
||||
{
|
||||
switch (_Units)
|
||||
{
|
||||
case E_MeasurementUnits.PX: //Pixels myDPI per inch
|
||||
return _Value * 72F / myDPI;
|
||||
return Value * 72F / myDPI;
|
||||
case E_MeasurementUnits.PC: //Picas - 6 per inch
|
||||
return _Value * 72F / 6F;
|
||||
return Value * 72F / 6F;
|
||||
case E_MeasurementUnits.IN: //inches
|
||||
return _Value * 72F;
|
||||
return Value * 72F;
|
||||
case E_MeasurementUnits.CM: // Centimeter
|
||||
return _Value * 72F / 2.54F;
|
||||
return Value * 72F / 2.54F;
|
||||
case E_MeasurementUnits.MM: // Millimeter
|
||||
return _Value * 72F / 25.4F;
|
||||
return Value * 72F / 25.4F;
|
||||
case E_MeasurementUnits.EM: // EMs
|
||||
return _Value * 72F / 8;
|
||||
return Value * 72F / 8;
|
||||
case E_MeasurementUnits.EX: // EXs
|
||||
return _Value * 72F / 16;
|
||||
return Value * 72F / 16;
|
||||
default: // Points
|
||||
return _Value;
|
||||
return Value;
|
||||
}
|
||||
}
|
||||
//public float SizeInPoints
|
||||
//{ get { return SizeInPixels * 72 / DPI; } }
|
||||
//public float SizeInInches
|
||||
//{ get { return SizeInPixels / DPI; } }
|
||||
//public float SizeInCentimeters
|
||||
//{ get { return SizeInPixels * 2.54F / DPI; } }
|
||||
//public float SizeInMillimeters
|
||||
//{ get { return SizeInPixels * 25.4F / DPI; } }
|
||||
//public float SizeInEms
|
||||
//{ get { return SizeInPixels * 5 / (6 * DPI); } }
|
||||
//public float SizeInExs
|
||||
//{ get { return SizeInPixels * 5 / (6 * DPI); } }
|
||||
//public float SizeInPicas
|
||||
//{ get { return SizeInPixels * 6 / DPI; } }
|
||||
//public Unit SizeInUnits
|
||||
//{ get { return new Unit((double)SizeInPoints, UnitTypeEnum.Point); } }
|
||||
public float GetSizeInPixels(float myDPI)
|
||||
{ return GetSizeInPoints(myDPI) * myDPI / 72F;}
|
||||
public float GetSizeInInches(float myDPI)
|
||||
{ return GetSizeInPoints(myDPI) / 72F; }
|
||||
public float GetSizeInCentimeters(float myDPI)
|
||||
{ return GetSizeInPoints(myDPI) * 2.54F / 72F; }
|
||||
public float GetSizeInMillimeters(float myDPI)
|
||||
{ return GetSizeInPoints(myDPI) * 25.4F / 72F; }
|
||||
public float GetSizeInEms(float myDPI)
|
||||
{ return GetSizeInPoints(myDPI) * 5 / (6 * 72F); }
|
||||
public float GetSizeInExs(float myDPI)
|
||||
{ return GetSizeInPoints(myDPI) * 5 / (6 * 72F); }
|
||||
public float GetSizeInPicas(float myDPI)
|
||||
{ return GetSizeInPoints(myDPI) * 6 / 72F; }
|
||||
//public Unit GetSizeInUnits(float myDPI)
|
||||
//{ return new Unit((double)GetSizeInPoints(myDPI), UnitTypeEnum.Point); }
|
||||
public float GetSizeInPixels(float myDPI) => GetSizeInPoints(myDPI) * myDPI / 72F;
|
||||
public float GetSizeInInches(float myDPI) => GetSizeInPoints(myDPI) / 72F;
|
||||
public float GetSizeInCentimeters(float myDPI) => GetSizeInPoints(myDPI) * 2.54F / 72F;
|
||||
public float GetSizeInMillimeters(float myDPI) => GetSizeInPoints(myDPI) * 25.4F / 72F;
|
||||
public float GetSizeInEms(float myDPI) => GetSizeInPoints(myDPI) * 5 / (6 * 72F);
|
||||
public float GetSizeInExs(float myDPI) => GetSizeInPoints(myDPI) * 5 / (6 * 72F);
|
||||
public float GetSizeInPicas(float myDPI) => GetSizeInPoints(myDPI) * 6 / 72F;
|
||||
|
||||
public static float StringToPoints(string value)
|
||||
{
|
||||
SvgMeasurement tmp = new SvgMeasurement(value);
|
||||
@@ -226,26 +169,9 @@ namespace Volian.Svg.Library
|
||||
}
|
||||
public class MeasurementTypeConverter : ExpandableObjectConverter
|
||||
{
|
||||
public override bool CanConvertTo(ITypeDescriptorContext context, Type t)
|
||||
{
|
||||
return t == typeof(String);
|
||||
}
|
||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||
{
|
||||
if (destType == typeof(string) && value is SvgMeasurement)
|
||||
{
|
||||
return value.ToString();
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
public override bool CanConvertFrom(ITypeDescriptorContext context, Type t)
|
||||
{
|
||||
return t == typeof(String);
|
||||
}
|
||||
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object val)
|
||||
{
|
||||
SvgMeasurement measurement = new SvgMeasurement((string)val);
|
||||
return measurement;
|
||||
}
|
||||
public override bool CanConvertTo(ITypeDescriptorContext context, Type t) => t == typeof(String);
|
||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType) => destType == typeof(string) && value is SvgMeasurement ? value.ToString() : base.ConvertTo(context, culture, value, destType);
|
||||
public override bool CanConvertFrom(ITypeDescriptorContext context, Type t) => t == typeof(String);
|
||||
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object val) => new SvgMeasurement((string)val);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Xml.Serialization;
|
||||
using System.Drawing;
|
||||
using System.ComponentModel;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -21,28 +18,6 @@ namespace Volian.Svg.Library
|
||||
set { _ID = value; }
|
||||
}
|
||||
#endregion
|
||||
//#region Parent and Containing Svg
|
||||
//// ToDo: MyParent
|
||||
//private SvgPartGrouping _MyParent;
|
||||
//[XmlIgnore()]
|
||||
//public SvgPartGrouping MyParent
|
||||
//{
|
||||
// get { return _MyParent; }
|
||||
// set { _MyParent = value; }
|
||||
//}
|
||||
//// ToDo: MySvg
|
||||
//private Svg _MySvg;
|
||||
//public Svg MySvg
|
||||
//{
|
||||
// get { return _MySvg; }
|
||||
// set { _MySvg = value; }
|
||||
//}
|
||||
//internal void SetParent(SvgPartGrouping myParent)
|
||||
//{
|
||||
// _MyParent = myParent;
|
||||
// _MySvg = myParent.MySvg == null? MyParent : myParent.MySvg;
|
||||
//}
|
||||
//#endregion
|
||||
#region Setup Inheritance
|
||||
virtual internal void SetupInheritance(SvgInheritedSettings myParentsSettings) { ; }
|
||||
#endregion
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
|
||||
namespace Volian.Svg.Library
|
||||
{
|
||||
@@ -81,11 +76,7 @@ namespace Volian.Svg.Library
|
||||
#endregion
|
||||
#endregion
|
||||
#region Setup Inheritance
|
||||
override internal void SetupInheritance(SvgInheritedSettings myParentsSettings)
|
||||
{
|
||||
_MyInheritedSettings.MyParentsSettings = myParentsSettings;
|
||||
//_SvgParts.SetupInheritance(_MyInheritedSettings);
|
||||
}
|
||||
override internal void SetupInheritance(SvgInheritedSettings myParentsSettings) => _MyInheritedSettings.MyParentsSettings = myParentsSettings;
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.ComponentModel;
|
||||
using System.Text;
|
||||
|
||||
@@ -46,10 +45,7 @@ namespace Volian.Svg.Library
|
||||
/// <param name='value'>
|
||||
/// A <see cref='SVGPart'/> from which the contents are copied
|
||||
/// </param>
|
||||
public SvgParts(SvgParts value)
|
||||
{
|
||||
this.AddRange(value);
|
||||
}
|
||||
public SvgParts(SvgParts value) => this.AddRange(value);
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
@@ -59,10 +55,7 @@ namespace Volian.Svg.Library
|
||||
/// <param name='value'>
|
||||
/// A array of <see cref='SVGPart'/> objects with which to intialize the collection
|
||||
/// </param>
|
||||
public SvgParts(SvgPart[] value)
|
||||
{
|
||||
this.AddRange(value);
|
||||
}
|
||||
public SvgParts(SvgPart[] value) => this.AddRange(value);
|
||||
|
||||
/// <summary>
|
||||
/// <para>Represents the entry at the specified index of the <see cref='SVGPart'/>.</para>
|
||||
@@ -77,13 +70,6 @@ namespace Volian.Svg.Library
|
||||
get { return ((SvgPart)(List[index])); }
|
||||
set { List[index] = value; }
|
||||
}
|
||||
//#region SetupInheritance
|
||||
//internal void SetupInheritance(SvgInheritedSettings myParentsSettings)
|
||||
//{
|
||||
// foreach (SvgPart svgPart in List)
|
||||
// svgPart.SetupInheritance(myParentsSettings);
|
||||
//}
|
||||
//#endregion
|
||||
#region Dictionary of Parts
|
||||
internal void AddLookup(Dictionary<string, SvgPart> lookUp)
|
||||
{
|
||||
@@ -204,10 +190,7 @@ namespace Volian.Svg.Library
|
||||
/// <see cref='SVGPart'/>, if found; otherwise, -1.</para>
|
||||
/// </returns>
|
||||
/// <seealso cref='SVGParts.Contains'/>
|
||||
public int IndexOf(SvgPart value)
|
||||
{
|
||||
return List.IndexOf(value);
|
||||
}
|
||||
public int IndexOf(SvgPart value) => List.IndexOf(value);
|
||||
|
||||
/// <summary>
|
||||
/// <para>Inserts a <see cref='SVGPart'/> into the <see cref='SVGParts'/> at the specified index.</para>
|
||||
@@ -288,44 +271,24 @@ namespace Volian.Svg.Library
|
||||
/// Event arguments for the SVGParts collection class.
|
||||
public class SVGPartArgs : EventArgs
|
||||
{
|
||||
private SvgParts t;
|
||||
|
||||
/// Default constructor.
|
||||
public SVGPartArgs()
|
||||
{
|
||||
t = new SvgParts();
|
||||
}
|
||||
public SVGPartArgs() => SVGParts = new SvgParts();
|
||||
|
||||
/// Initializes with a SVGPart.
|
||||
/// Data object.
|
||||
public SVGPartArgs(SvgPart t)
|
||||
: this()
|
||||
{
|
||||
this.t.Add(t);
|
||||
}
|
||||
public SVGPartArgs(SvgPart t) : this() => this.SVGParts.Add(t);
|
||||
|
||||
/// Initializes with a collection of SVGPart objects.
|
||||
/// Collection of data.
|
||||
public SVGPartArgs(SvgParts ts)
|
||||
: this()
|
||||
{
|
||||
this.t.AddRange(ts);
|
||||
}
|
||||
public SVGPartArgs(SvgParts ts) : this() => this.SVGParts.AddRange(ts);
|
||||
|
||||
/// Initializes with an array of SVGPart objects.
|
||||
/// Array of data.
|
||||
public SVGPartArgs(SvgPart[] ts)
|
||||
: this()
|
||||
{
|
||||
this.t.AddRange(ts);
|
||||
}
|
||||
public SVGPartArgs(SvgPart[] ts) : this() => this.SVGParts.AddRange(ts);
|
||||
|
||||
/// Gets or sets the data of this argument.
|
||||
public SvgParts SVGParts
|
||||
{
|
||||
get { return t; }
|
||||
set { t = value; }
|
||||
}
|
||||
public SvgParts SVGParts { get; set; }
|
||||
}
|
||||
|
||||
/// SVGParts event handler.
|
||||
@@ -338,8 +301,7 @@ namespace Volian.Svg.Library
|
||||
{
|
||||
private SvgPart Item { get { return (SvgPart)_Item; } }
|
||||
public SvgPartsPropertyDescriptor(SvgParts collection, int index) : base(collection, index) { ;}
|
||||
public override string DisplayName
|
||||
{ get { return Item.GetType().Name; } }
|
||||
public override string DisplayName => Item.GetType().Name;
|
||||
}
|
||||
#endregion
|
||||
[Serializable()]
|
||||
@@ -347,32 +309,19 @@ namespace Volian.Svg.Library
|
||||
{
|
||||
protected object _Item = null;
|
||||
public vlnListPropertyDescriptor(System.Collections.IList collection, int index)
|
||||
: base("#" + index.ToString(), null)
|
||||
{ _Item = collection[index]; }
|
||||
public override bool CanResetValue(object component)
|
||||
{ return true; }
|
||||
public override Type ComponentType
|
||||
{ get { return _Item.GetType(); } }
|
||||
public override object GetValue(object component)
|
||||
{ return _Item; }
|
||||
public override bool IsReadOnly
|
||||
{ get { return false; } }
|
||||
public override Type PropertyType
|
||||
{ get { return _Item.GetType(); } }
|
||||
: base($"#{index}", null) => _Item = collection[index];
|
||||
public override bool CanResetValue(object component) => true;
|
||||
public override Type ComponentType => _Item.GetType();
|
||||
public override object GetValue(object component) => _Item;
|
||||
public override bool IsReadOnly => false;
|
||||
public override Type PropertyType => _Item.GetType();
|
||||
public override void ResetValue(object component)
|
||||
{ ;}
|
||||
public override bool ShouldSerializeValue(object component)
|
||||
{ return true; }
|
||||
public override void SetValue(object component, object value)
|
||||
{ /*_Item = value*/;}
|
||||
//public override AttributeCollection Attributes
|
||||
//{ get { return new AttributeCollection(null); } }
|
||||
public override string DisplayName
|
||||
{ get { return _Item.ToString(); } }
|
||||
public override string Description
|
||||
{ get { return _Item.ToString(); } }
|
||||
public override string Name
|
||||
{ get { return _Item.ToString(); } }
|
||||
public override bool ShouldSerializeValue(object component) => true;
|
||||
public override void SetValue(object component, object value) { /*_Item = value*/; }
|
||||
public override string DisplayName => _Item.ToString();
|
||||
public override string Description => _Item.ToString();
|
||||
public override string Name => _Item.ToString();
|
||||
|
||||
} // Class
|
||||
#region Converter
|
||||
@@ -383,7 +332,7 @@ namespace Volian.Svg.Library
|
||||
if (destType == typeof(string) && value is SvgParts)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((SvgParts)value).List.Count.ToString() + " SVG Drawing Parts";
|
||||
return $"{((SvgParts)value).List.Count} SVG Drawing Parts";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
@@ -13,88 +10,64 @@ namespace Volian.Svg.Library
|
||||
public SvgRectangle() { ;}
|
||||
public SvgRectangle(PointF location, SizeF size, Color fillColor, Color lineColor, float lineWidth)
|
||||
{
|
||||
_X.Value = location.X;
|
||||
_Y.Value = location.Y;
|
||||
_Width.Value = size.Width;
|
||||
_Height.Value = size.Height;
|
||||
X.Value = location.X;
|
||||
Y.Value = location.Y;
|
||||
Width.Value = size.Width;
|
||||
Height.Value = size.Height;
|
||||
FillColor = fillColor;
|
||||
LineColor = lineColor;
|
||||
LineWidth = new SvgMeasurement(lineWidth);
|
||||
}
|
||||
//XMLElementAttribute(ElementName = "PREFIX", IsNullable = false)
|
||||
#endregion
|
||||
#region Description
|
||||
private string _Description = string.Empty;
|
||||
[System.ComponentModel.DefaultValueAttribute("")]
|
||||
[XmlElement("desc")]
|
||||
public string Description
|
||||
{
|
||||
get { return _Description; }
|
||||
set { _Description = value; }
|
||||
}
|
||||
public string Description { get; set; } = string.Empty;
|
||||
#endregion
|
||||
#region Location
|
||||
private SvgMeasurement _X = new SvgMeasurement();
|
||||
[XmlIgnore]
|
||||
public SvgMeasurement X
|
||||
{
|
||||
get { return _X; }
|
||||
set { _X = value; }
|
||||
}
|
||||
public SvgMeasurement X { get; set; } = new SvgMeasurement();
|
||||
[XmlAttribute("x")]
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public string X_XmlSurrogate
|
||||
{
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(_X); }
|
||||
set { _X = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(X); }
|
||||
set { X = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
}
|
||||
private SvgMeasurement _Y = new SvgMeasurement();
|
||||
|
||||
[XmlIgnore]
|
||||
public SvgMeasurement Y
|
||||
{
|
||||
get { return _Y; }
|
||||
set { _Y = value; }
|
||||
}
|
||||
public SvgMeasurement Y { get; set; } = new SvgMeasurement();
|
||||
[XmlAttribute("y")]
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public string Y_XmlSurrogate
|
||||
{
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(_Y); }
|
||||
set { _Y = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(Y); }
|
||||
set { Y = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
}
|
||||
#endregion
|
||||
#region Size
|
||||
private SvgMeasurement _Width = new SvgMeasurement();
|
||||
[XmlIgnore]
|
||||
public SvgMeasurement Width
|
||||
{
|
||||
get { return _Width; }
|
||||
set { _Width = value; }
|
||||
}
|
||||
public SvgMeasurement Width { get; set; } = new SvgMeasurement();
|
||||
[XmlAttribute("width")]
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public string Width_WidthmlSurrogate
|
||||
{
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(_Width); }
|
||||
set { _Width = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(Width); }
|
||||
set { Width = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
}
|
||||
private SvgMeasurement _Height = new SvgMeasurement();
|
||||
|
||||
[XmlIgnore]
|
||||
public SvgMeasurement Height
|
||||
{
|
||||
get { return _Height; }
|
||||
set { _Height = value; }
|
||||
}
|
||||
public SvgMeasurement Height { get; set; } = new SvgMeasurement();
|
||||
[XmlAttribute("height")]
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public string Height_XmlSurrogate
|
||||
{
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(_Height); }
|
||||
set { _Height = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(Height); }
|
||||
set { Height = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -1,48 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
|
||||
namespace Volian.Svg.Library
|
||||
{
|
||||
public class SvgScale
|
||||
{
|
||||
private float _XLowerLimit;
|
||||
public float XLowerLimit
|
||||
{
|
||||
get { return _XLowerLimit; }
|
||||
set { _XLowerLimit = value; }
|
||||
}
|
||||
private float _YLowerLimit;
|
||||
public float YLowerLimit
|
||||
{
|
||||
get { return _YLowerLimit; }
|
||||
set { _YLowerLimit = value; }
|
||||
}
|
||||
public float XLowerLimit { get; set; }
|
||||
public float YLowerLimit { get; set; }
|
||||
private float _Scale; // Scale from Logical to Physical
|
||||
public float Scale
|
||||
{ get { return _Scale; } }
|
||||
public float Scale => _Scale;
|
||||
private float _Width; // Physical Width
|
||||
public float Width
|
||||
{ get { return _Width; } }
|
||||
public float Width => _Width;
|
||||
private float _Height; // Physical Height
|
||||
public float Height
|
||||
{ get { return _Height; } }
|
||||
public float XUpperLimit
|
||||
{ get { return _Width * _Scale + _XLowerLimit; } }
|
||||
public float YUpperLimit
|
||||
{ get { return _Height * _Scale + _YLowerLimit; } }
|
||||
public float Height => _Height;
|
||||
public float XUpperLimit => _Width * _Scale + XLowerLimit;
|
||||
public float YUpperLimit => _Height * _Scale + YLowerLimit;
|
||||
private float _DPI;
|
||||
public float DPI
|
||||
{ get { return _DPI; } }
|
||||
public float DPI => _DPI;
|
||||
private SvgScale(SvgScale tmp,SvgMeasurement newX, SvgMeasurement newY)
|
||||
{
|
||||
_DPI = tmp.DPI;
|
||||
_Scale = tmp.Scale;
|
||||
_Width = tmp.Width;
|
||||
_Height = tmp.Height;
|
||||
_XLowerLimit = tmp.XLowerLimit - newX.GetSizeInPixels(DPI);
|
||||
_YLowerLimit = tmp.YLowerLimit - newY.GetSizeInPixels(DPI);
|
||||
XLowerLimit = tmp.XLowerLimit - newX.GetSizeInPixels(DPI);
|
||||
YLowerLimit = tmp.YLowerLimit - newY.GetSizeInPixels(DPI);
|
||||
}
|
||||
public SvgScale(float myDPI, RectangleF bounds,SvgMeasurement width, SvgMeasurement height, SvgViewBox myViewBox)
|
||||
{
|
||||
@@ -62,27 +43,15 @@ namespace Volian.Svg.Library
|
||||
//Console.WriteLine("'Scale',{0}",_Scale);
|
||||
_Width = outputWidth / _Scale;
|
||||
_Height = outputHeight / _Scale;
|
||||
_XLowerLimit = myViewBox.X + (inputWidth - _Width) / 2;
|
||||
_YLowerLimit = myViewBox.Y + (inputHeight - _Height) / 2;
|
||||
XLowerLimit = myViewBox.X + (inputWidth - _Width) / 2;
|
||||
YLowerLimit = myViewBox.Y + (inputHeight - _Height) / 2;
|
||||
//if (myDPI != 96) Console.WriteLine("DPI {0}", myDPI);
|
||||
//Console.WriteLine("Scale,{0},{1},{2},{3},{4},{5},{6}", Scale, Width, Height, XLowerLimit, XUpperLimit, YLowerLimit, YUpperLimit);
|
||||
}
|
||||
public SvgScale AdjustOrigin(SvgMeasurement newX, SvgMeasurement newY)
|
||||
{
|
||||
return new SvgScale(this, newX, newY);
|
||||
}
|
||||
public float X(float x)
|
||||
{
|
||||
return _Scale * (x - XLowerLimit);
|
||||
}
|
||||
public float Y(float y)
|
||||
{
|
||||
return _Scale * (y - YLowerLimit);
|
||||
}
|
||||
public float AbsX(SvgMeasurement x)
|
||||
{
|
||||
return x.GetSizeInPixels(DPI) + Svg.AbsoluteOffset.X;
|
||||
}
|
||||
public SvgScale AdjustOrigin(SvgMeasurement newX, SvgMeasurement newY) => new SvgScale(this, newX, newY);
|
||||
public float X(float x) => _Scale * (x - XLowerLimit);
|
||||
public float Y(float y) => _Scale * (y - YLowerLimit);
|
||||
public float AbsX(SvgMeasurement x) => x.GetSizeInPixels(DPI) + Svg.AbsoluteOffset.X;
|
||||
public float AbsY(iTextSharp.text.pdf.PdfContentByte cb, SvgMeasurement y)
|
||||
{
|
||||
// the following line of code is 'taken' from the 16bit code: \promsnt\exe\wined\togdi.cpp
|
||||
@@ -91,36 +60,21 @@ namespace Volian.Svg.Library
|
||||
yOffset = yOffset / 20; // convert from twips to points (point = 1/72 inch)
|
||||
return cb.PdfDocument.PageSize.Height - y.GetSizeInPixels(DPI) + yOffset + Svg.AbsoluteOffset.Y;
|
||||
}
|
||||
public float Y(iTextSharp.text.pdf.PdfContentByte cb, float y)
|
||||
{
|
||||
return cb.PdfDocument.PageSize.Height - _Scale * (y - YLowerLimit);
|
||||
}
|
||||
public float M(float m)
|
||||
{
|
||||
return _Scale * m;
|
||||
}
|
||||
public float Y(iTextSharp.text.pdf.PdfContentByte cb, float y) => cb.PdfDocument.PageSize.Height - _Scale * (y - YLowerLimit);
|
||||
public float M(float m) => _Scale * m;
|
||||
public float X(SvgMeasurement x)
|
||||
{
|
||||
float retval = _Scale * (x.GetSizeInPixels(DPI) - XLowerLimit);
|
||||
return retval;
|
||||
}
|
||||
public float Y(SvgMeasurement y)
|
||||
{
|
||||
return _Scale * (y.GetSizeInPixels(DPI) - YLowerLimit);
|
||||
}
|
||||
public float Y(SvgMeasurement y) => _Scale * (y.GetSizeInPixels(DPI) - YLowerLimit);
|
||||
public float Y(iTextSharp.text.pdf.PdfContentByte cb, SvgMeasurement y)
|
||||
{
|
||||
float yOffset = 0; // = (cb.PdfWriter.CurrentPageNumber -1) * .8F * cb.PdfDocument.PageSize.Height;
|
||||
float myY = yOffset + cb.PdfDocument.PageSize.Height - _Scale * (y.GetSizeInPixels(DPI) - YLowerLimit);
|
||||
return myY;
|
||||
}
|
||||
public float YY(SvgMeasurement y)
|
||||
{
|
||||
return -_Scale * y.GetSizeInPixels(DPI);
|
||||
}
|
||||
public float M(SvgMeasurement m)
|
||||
{
|
||||
return _Scale * m.GetSizeInPixels(DPI);
|
||||
}
|
||||
public float YY(SvgMeasurement y) => -_Scale * y.GetSizeInPixels(DPI);
|
||||
public float M(SvgMeasurement m) => _Scale * m.GetSizeInPixels(DPI);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
using System.Xml;
|
||||
@@ -61,9 +60,7 @@ namespace Volian.Svg.Library
|
||||
public class NonXsiTextWriter : XmlTextWriter
|
||||
{
|
||||
public NonXsiTextWriter( TextWriter w ) : base( w ) {}
|
||||
public NonXsiTextWriter( Stream w, Encoding encoding ) : base( w, encoding ) {
|
||||
this.Formatting = Formatting.Indented;
|
||||
}
|
||||
public NonXsiTextWriter(Stream w, Encoding encoding) : base(w, encoding) => this.Formatting = Formatting.Indented;
|
||||
public NonXsiTextWriter( string filename, Encoding encoding ) : base( filename, encoding ) {}
|
||||
bool _skip = false;
|
||||
public override void WriteStartAttribute( string prefix, string localName, string ns )
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Xml.Serialization;
|
||||
using System.Drawing;
|
||||
using System.ComponentModel;
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
using System.Drawing;
|
||||
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Xml.Serialization;
|
||||
using System.ComponentModel;
|
||||
|
||||
@@ -14,8 +10,8 @@ namespace Volian.Svg.Library
|
||||
public SvgText() { ;}
|
||||
public SvgText(PointF location, string text, Font font, Color fillColor)
|
||||
{
|
||||
_X.Value = location.X;
|
||||
_Y.Value = location.Y;
|
||||
X.Value = location.X;
|
||||
Y.Value = location.Y;
|
||||
Text = text;
|
||||
Font = font;
|
||||
FillColor = fillColor;
|
||||
@@ -24,42 +20,28 @@ namespace Volian.Svg.Library
|
||||
}
|
||||
#endregion
|
||||
#region Location
|
||||
private SvgJustify _Justify = SvgJustify.Left;
|
||||
[XmlAttribute("Justify")]
|
||||
public SvgJustify Justify
|
||||
{
|
||||
get { return _Justify; }
|
||||
set { _Justify = value; }
|
||||
}
|
||||
private SvgMeasurement _X = new SvgMeasurement();
|
||||
public SvgJustify Justify { get; set; } = SvgJustify.Left;
|
||||
[XmlIgnore]
|
||||
public SvgMeasurement X
|
||||
{
|
||||
get { return _X; }
|
||||
set { _X = value; }
|
||||
}
|
||||
public SvgMeasurement X { get; set; } = new SvgMeasurement();
|
||||
[XmlAttribute("x")]
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public string X_XmlSurrogate
|
||||
{
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(_X); }
|
||||
set { _X = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(X); }
|
||||
set { X = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
}
|
||||
private SvgMeasurement _Y = new SvgMeasurement();
|
||||
|
||||
[XmlIgnore]
|
||||
public SvgMeasurement Y
|
||||
{
|
||||
get { return _Y; }
|
||||
set { _Y = value; }
|
||||
}
|
||||
public SvgMeasurement Y { get; set; } = new SvgMeasurement();
|
||||
[XmlAttribute("y")]
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public string Y_XmlSurrogate
|
||||
{
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(_Y); }
|
||||
set { _Y = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(Y); }
|
||||
set { Y = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
}
|
||||
#endregion
|
||||
#region Text
|
||||
@@ -126,14 +108,9 @@ namespace Volian.Svg.Library
|
||||
}
|
||||
#endregion
|
||||
#region Description
|
||||
private string _Description = string.Empty;
|
||||
[System.ComponentModel.DefaultValueAttribute("")]
|
||||
[XmlElement("desc")]
|
||||
public string Description
|
||||
{
|
||||
get { return _Description; }
|
||||
set { _Description = value; }
|
||||
}
|
||||
public string Description { get; set; } = string.Empty;
|
||||
#endregion
|
||||
#region Setup Inheritance
|
||||
override internal void SetupInheritance(SvgInheritedSettings myParentsSettings)
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
@@ -13,95 +10,66 @@ namespace Volian.Svg.Library
|
||||
public SvgUse() { ;}
|
||||
public SvgUse(PointF location, SizeF size, string id)
|
||||
{
|
||||
_X.Value = location.X;
|
||||
_Y.Value = location.Y;
|
||||
_Width.Value = size.Width;
|
||||
_Height.Value = size.Height;
|
||||
X.Value = location.X;
|
||||
Y.Value = location.Y;
|
||||
Width.Value = size.Width;
|
||||
Height.Value = size.Height;
|
||||
_ID = id;
|
||||
}
|
||||
#endregion
|
||||
#region Location
|
||||
private SvgMeasurement _X = new SvgMeasurement();
|
||||
[XmlIgnore]
|
||||
public SvgMeasurement X
|
||||
{
|
||||
get { return _X; }
|
||||
set { _X = value; }
|
||||
}
|
||||
public SvgMeasurement X { get; set; } = new SvgMeasurement();
|
||||
[XmlAttribute("x")]
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public string X_XmlSurrogate
|
||||
{
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(_X); }
|
||||
set { _X = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(X); }
|
||||
set { X = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
}
|
||||
private SvgMeasurement _Y = new SvgMeasurement();
|
||||
|
||||
[XmlIgnore]
|
||||
public SvgMeasurement Y
|
||||
{
|
||||
get { return _Y; }
|
||||
set { _Y = value; }
|
||||
}
|
||||
public SvgMeasurement Y { get; set; } = new SvgMeasurement();
|
||||
[XmlAttribute("y")]
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public string Y_XmlSurrogate
|
||||
{
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(_Y); }
|
||||
set { _Y = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(Y); }
|
||||
set { Y = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
}
|
||||
#endregion
|
||||
#region Size
|
||||
private SvgMeasurement _Width = new SvgMeasurement();
|
||||
[XmlIgnore]
|
||||
public SvgMeasurement Width
|
||||
{
|
||||
get { return _Width; }
|
||||
set { _Width = value; }
|
||||
}
|
||||
public SvgMeasurement Width { get; set; } = new SvgMeasurement();
|
||||
[XmlAttribute("width")]
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public string Width_WidthmlSurrogate
|
||||
{
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(_Width); }
|
||||
set { _Width = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(Width); }
|
||||
set { Width = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
}
|
||||
private SvgMeasurement _Height = new SvgMeasurement();
|
||||
|
||||
[XmlIgnore]
|
||||
public SvgMeasurement Height
|
||||
{
|
||||
get { return _Height; }
|
||||
set { _Height = value; }
|
||||
}
|
||||
public SvgMeasurement Height { get; set; } = new SvgMeasurement();
|
||||
[XmlAttribute("height")]
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public string Height_XmlSurrogate
|
||||
{
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(_Height); }
|
||||
set { _Height = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
get { return SvgXmlConverter<SvgMeasurement>.GetString(Height); }
|
||||
set { Height = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
|
||||
}
|
||||
#endregion
|
||||
#region ID to be used
|
||||
private string _UseID = null;
|
||||
[XmlAttribute(AttributeName = "href", Namespace = "http://www.w3.org/1999/xlink")]
|
||||
public string UseID
|
||||
{
|
||||
get { return _UseID; }
|
||||
set { _UseID = value; }
|
||||
}
|
||||
public string UseID { get; set; } = null;
|
||||
#endregion
|
||||
#region Setup Inheritance
|
||||
override internal void SetupInheritance(SvgInheritedSettings myParentsSettings)
|
||||
{
|
||||
_MyInheritedSettings.MyParentsSettings = myParentsSettings;
|
||||
}
|
||||
override internal void SetupInheritance(SvgInheritedSettings myParentsSettings) => _MyInheritedSettings.MyParentsSettings = myParentsSettings;
|
||||
#endregion
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("({0}, {1}) Template '{2}'", this.X, this.Y, this.UseID);
|
||||
}
|
||||
public override string ToString() => string.Format("({0}, {1}) Template '{2}'", this.X, this.Y, this.UseID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.ComponentModel;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Volian.Svg.Library
|
||||
{
|
||||
@@ -11,10 +9,7 @@ namespace Volian.Svg.Library
|
||||
{
|
||||
#region ctor
|
||||
public SvgViewBox() { ;}
|
||||
public SvgViewBox(float x, float y, float width, float height)
|
||||
{
|
||||
_MyRectangleF = new RectangleF(x, y, width, height);
|
||||
}
|
||||
public SvgViewBox(float x, float y, float width, float height) => _MyRectangleF = new RectangleF(x, y, width, height);
|
||||
public SvgViewBox(string val)
|
||||
{
|
||||
string[] parms = ((string)val).Split(' ');
|
||||
@@ -45,30 +40,14 @@ namespace Volian.Svg.Library
|
||||
}
|
||||
#endregion
|
||||
#region ToString
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0} {1} {2} {3}", X, Y, Width, Height);
|
||||
}
|
||||
public override string ToString() => string.Format("{0} {1} {2} {3}", X, Y, Width, Height);
|
||||
#endregion
|
||||
}
|
||||
public class ViewBoxTypeConverter : ExpandableObjectConverter
|
||||
{
|
||||
public override bool CanConvertTo(ITypeDescriptorContext context, Type t)
|
||||
{
|
||||
return t == typeof(String);
|
||||
}
|
||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||
{
|
||||
if (destType == typeof(string) && value is SvgViewBox)
|
||||
{
|
||||
return value.ToString();
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
public override bool CanConvertFrom(ITypeDescriptorContext context, Type t)
|
||||
{
|
||||
return t == typeof(String);
|
||||
}
|
||||
public override bool CanConvertTo(ITypeDescriptorContext context, Type t) => t == typeof(string);
|
||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType) => destType == typeof(string) && value is SvgViewBox ? value.ToString() : base.ConvertTo(context, culture, value, destType);
|
||||
public override bool CanConvertFrom(ITypeDescriptorContext context, Type t) => t == typeof(string);
|
||||
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object val)
|
||||
{
|
||||
string[] parms = ((string)val).Split(' ');
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Volian.Svg.Library
|
||||
@@ -13,10 +10,6 @@ namespace Volian.Svg.Library
|
||||
TypeConverter FontConverter = TypeDescriptor.GetConverter(typeof(T));
|
||||
return FontConverter.ConvertToInvariantString(myObject);
|
||||
}
|
||||
public static T GetObject(string value)
|
||||
{
|
||||
TypeConverter converter = TypeDescriptor.GetConverter(typeof(T));
|
||||
return (T)converter.ConvertFromInvariantString(value);
|
||||
}
|
||||
public static T GetObject(string value) => (T)TypeDescriptor.GetConverter(typeof(T)).ConvertFromInvariantString(value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +89,6 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="FontFind.cs" />
|
||||
<Compile Include="Graphics.cs" />
|
||||
<Compile Include="iTextSharp.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
|
||||
@@ -1,18 +1,10 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using iTextSharp.text;
|
||||
using iTextSharp.text.pdf;
|
||||
using iTextSharp.text.factories;
|
||||
using Itenso.Rtf;
|
||||
using Itenso.Rtf.Parser;
|
||||
using Itenso.Rtf.Interpreter;
|
||||
using Itenso.Rtf.Support;
|
||||
using Microsoft.Win32;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Xml;
|
||||
using System.IO;
|
||||
using Volian.Base.Library;
|
||||
|
||||
@@ -97,23 +89,14 @@ namespace Volian.Svg.Library
|
||||
{
|
||||
get { return _MyText; }
|
||||
}
|
||||
private SvgText _MySvgText;
|
||||
public SvgText MySvgText
|
||||
{
|
||||
get { return _MySvgText; }
|
||||
set { _MySvgText = value; }
|
||||
}
|
||||
private SvgScale _MySvgScale;
|
||||
public SvgScale MySvgScale
|
||||
{
|
||||
get { return _MySvgScale; }
|
||||
set { _MySvgScale = value; }
|
||||
}
|
||||
|
||||
public SvgText MySvgText { get; set; }
|
||||
public SvgScale MySvgScale { get; set; }
|
||||
public SvgProcessTextArgs(string myText, SvgText mySvgText, SvgScale mySvgScale)
|
||||
{
|
||||
_MyText = myText;
|
||||
_MySvgText = mySvgText;
|
||||
_MySvgScale = mySvgScale;
|
||||
MySvgText = mySvgText;
|
||||
MySvgScale = mySvgScale;
|
||||
}
|
||||
}
|
||||
public partial class Svg : SvgGroup
|
||||
@@ -121,7 +104,7 @@ namespace Volian.Svg.Library
|
||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
public void DrawMacro(string macroDef, float x, float y, PdfContentByte cb)
|
||||
{
|
||||
_MyContentByte = cb;
|
||||
MyContentByte = cb;
|
||||
SvgMeasurement X = new SvgMeasurement(x, E_MeasurementUnits.PT);
|
||||
SvgMeasurement Y = new SvgMeasurement(Height.GetSizeInPoints(72) - y, E_MeasurementUnits.PT);
|
||||
if (!this.LookUp.ContainsKey(macroDef)) return; // AEP - DU1 (missing C22 macro for AEP)
|
||||
@@ -157,25 +140,13 @@ namespace Volian.Svg.Library
|
||||
top = (yll > yul ? (yll > top ? yll : top) : (yul > top ? yul : top));
|
||||
tmp.BoundingBox = new iTextSharp.text.Rectangle(xll, yll, xul, yul);
|
||||
}
|
||||
private PdfContentByte _MyContentByte;
|
||||
|
||||
[XmlIgnore]
|
||||
public PdfContentByte MyContentByte
|
||||
{
|
||||
get { return _MyContentByte; }
|
||||
set { _MyContentByte = value; }
|
||||
}
|
||||
private float _LeftMargin = 0;
|
||||
public float LeftMargin
|
||||
{
|
||||
get { return _LeftMargin; }
|
||||
set { _LeftMargin = value; }
|
||||
}
|
||||
private float _TopMargin = 0;
|
||||
public float TopMargin
|
||||
{
|
||||
get { return _TopMargin; }
|
||||
set { _TopMargin = value; }
|
||||
}
|
||||
public PdfContentByte MyContentByte { get; set; }
|
||||
|
||||
public float LeftMargin { get; set; } = 0;
|
||||
|
||||
public float TopMargin { get; set; } = 0;
|
||||
private SvgScale _MyScale;
|
||||
public SvgScale MyScale
|
||||
{
|
||||
@@ -183,19 +154,17 @@ namespace Volian.Svg.Library
|
||||
{
|
||||
if (_MyScale == null)
|
||||
{
|
||||
_MyScale = new SvgScale(72, new System.Drawing.RectangleF(0, 0, _MyContentByte.PdfWriter.PageSize.Width, _MyContentByte.PdfWriter.PageSize.Height), _Width, _Height, _ViewBox);
|
||||
_MyScale.XLowerLimit -= _LeftMargin;
|
||||
_MyScale.YLowerLimit -= _TopMargin;
|
||||
_MyScale = new SvgScale(72, new System.Drawing.RectangleF(0, 0, MyContentByte.PdfWriter.PageSize.Width, MyContentByte.PdfWriter.PageSize.Height), Width, Height, ViewBox);
|
||||
_MyScale.XLowerLimit -= LeftMargin;
|
||||
_MyScale.YLowerLimit -= TopMargin;
|
||||
}
|
||||
return _MyScale;
|
||||
}
|
||||
}
|
||||
public void Draw(PdfContentByte cb)
|
||||
{
|
||||
//myPdf.Clear();
|
||||
_MyContentByte = cb;
|
||||
MyContentByte = cb;
|
||||
_Templates = new Dictionary<string, PdfTemplate>();
|
||||
//RegisterFonts();
|
||||
SvgParts.Draw(cb, MyScale, this, this); //72 - Points
|
||||
}
|
||||
public static iTextSharp.text.Font GetFont(string fontName)
|
||||
@@ -214,36 +183,6 @@ namespace Volian.Svg.Library
|
||||
VlnItextFont.RegisterFont(fontName);
|
||||
return FontFactory.GetFont(fontName, BaseFont.IDENTITY_H, BaseFont.EMBEDDED, size, style, new iTextSharp.text.Color(color));
|
||||
}
|
||||
//private static string _FontFolder = null;
|
||||
//public static string FontFolder
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// if (_FontFolder == null)
|
||||
// {
|
||||
// _FontFolder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Fonts);
|
||||
// if (_FontFolder == null) _FontFolder = (String)Registry.CurrentUser.OpenSubKey("Software").OpenSubKey("Microsoft").OpenSubKey("Windows").OpenSubKey("CurrentVersion").OpenSubKey("Explorer").OpenSubKey("Shell Folders").GetValue("Fontz");
|
||||
// _MyLog.WarnFormat("FontFolder set to {0}", _FontFolder);
|
||||
// }
|
||||
// return _FontFolder;
|
||||
// }
|
||||
//}
|
||||
private static int _StackTraceSkip = 1;
|
||||
private static DateTime _LastTime = DateTime.Now;
|
||||
private static DateTime _StartTime = DateTime.Now;
|
||||
public static void ResetWhen()
|
||||
{
|
||||
_StartTime = _LastTime = DateTime.Now;
|
||||
}
|
||||
public static void WhenAndWhere()
|
||||
{
|
||||
DateTime thisTime = DateTime.Now;
|
||||
System.Diagnostics.StackFrame sf = new System.Diagnostics.StackFrame(_StackTraceSkip, true);
|
||||
Console.WriteLine("{0:000000},{1:000000},'{2}',{3},'{4}'", TimeSpan.FromTicks(thisTime.Ticks - _StartTime.Ticks).TotalMilliseconds,
|
||||
TimeSpan.FromTicks(thisTime.Ticks - _LastTime.Ticks).TotalMilliseconds, sf.GetMethod().Name, sf.GetFileLineNumber()
|
||||
,sf.GetFileName());
|
||||
_LastTime = thisTime;
|
||||
}
|
||||
}
|
||||
public partial class SvgArc : SvgShapePart
|
||||
{
|
||||
@@ -326,18 +265,13 @@ namespace Volian.Svg.Library
|
||||
{
|
||||
// TODO: Could I try creating a template
|
||||
// Don't draw
|
||||
// SvgParts.Draw(cb, myScale, mySvg, myParent);
|
||||
PdfTemplate tmp = null;
|
||||
if (ID != "") tmp = mySvg.GetTemplate(ID, cb); // the size will be adjusted as items are added.
|
||||
SvgParts.Draw(tmp, myScale, mySvg, myParent);
|
||||
}
|
||||
public override void Draw(PdfTemplate tmp, SvgScale myScale, Svg mySvg, SvgPartInheritance myParent)
|
||||
{
|
||||
// TODO: Could I try creating a template
|
||||
// Don't draw
|
||||
// SvgParts.Draw(cb, myScale, mySvg, myParent);
|
||||
//PdfTemplate tmp2 = mySvg.GetTemplate(ID); // the size will be adjusted as items are added.
|
||||
//SvgParts.Draw(tmp2, myScale, mySvg, myParent);
|
||||
}
|
||||
}
|
||||
public partial class SvgUse : SvgPartInheritance
|
||||
@@ -348,24 +282,22 @@ namespace Volian.Svg.Library
|
||||
{
|
||||
// TODO: Could I use the template
|
||||
SetupInheritance(myParent.MyInheritedSettings);
|
||||
if (mySvg.LookUp.ContainsKey(_UseID))
|
||||
mySvg[_UseID].Draw(cb, scale.AdjustOrigin(X, Y), mySvg, this);
|
||||
if (mySvg.LookUp.ContainsKey(UseID))
|
||||
mySvg[UseID].Draw(cb, scale.AdjustOrigin(X, Y), mySvg, this);
|
||||
else
|
||||
{
|
||||
if (!_MissingMacros.Contains(_UseID))
|
||||
if (!_MissingMacros.Contains(UseID))
|
||||
{
|
||||
_MissingMacros.Add(_UseID);
|
||||
_MyLog.WarnFormat("Missing Macro '{0}'", _UseID);
|
||||
_MissingMacros.Add(UseID);
|
||||
_MyLog.WarnFormat("Missing Macro '{0}'", UseID);
|
||||
}
|
||||
}
|
||||
//cb.AddTemplate(mySvg.GetTemplate(_UseID.Substring(1),cb), scale.X(X), scale.Y(cb, Y));
|
||||
}
|
||||
public override void Draw(PdfTemplate tmp, SvgScale scale, Svg mySvg, SvgPartInheritance myParent)
|
||||
{
|
||||
// TODO: Could I use the template
|
||||
SetupInheritance(myParent.MyInheritedSettings);
|
||||
//mySvg[_UseID.Substring(1)].Draw(tmp, scale.AdjustOrigin(X, Y), mySvg, this);
|
||||
mySvg[_UseID].Draw(tmp, scale.AdjustOrigin(X, Y), mySvg, this);
|
||||
mySvg[UseID].Draw(tmp, scale.AdjustOrigin(X, Y), mySvg, this);
|
||||
}
|
||||
}
|
||||
public partial class SvgEllipse : SvgShapePart
|
||||
@@ -410,7 +342,7 @@ namespace Volian.Svg.Library
|
||||
public override void Draw(PdfContentByte cb, SvgScale myScale, Svg mySvg, SvgPartInheritance myParent)
|
||||
{
|
||||
SetupInheritance(myParent.MyInheritedSettings);
|
||||
_SvgParts.Draw(cb, myScale, mySvg, this);
|
||||
SvgParts.Draw(cb, myScale, mySvg, this);
|
||||
}
|
||||
public override void Draw(PdfTemplate tmp, SvgScale myScale, Svg mySvg, SvgPartInheritance myParent)
|
||||
{
|
||||
@@ -443,6 +375,7 @@ namespace Volian.Svg.Library
|
||||
{
|
||||
SetupInheritance(myParent.MyInheritedSettings);
|
||||
tmp.SaveState();
|
||||
#pragma warning disable CS0168 // Variable is declared but never used - ex kept for debugging
|
||||
try
|
||||
{
|
||||
if (ImagePath != null)
|
||||
@@ -457,6 +390,7 @@ namespace Volian.Svg.Library
|
||||
{
|
||||
//_MyLog.WarnFormat("SvgImage.Draw '{0}' {1} - {2}", ImagePath, ex.GetType().Name, ex.Message);
|
||||
}
|
||||
#pragma warning restore CS0168 // Variable is declared but never used
|
||||
tmp.RestoreState();
|
||||
}
|
||||
}
|
||||
@@ -581,27 +515,18 @@ namespace Volian.Svg.Library
|
||||
{
|
||||
case SvgJustify.Left:
|
||||
return Element.ALIGN_LEFT;
|
||||
break;
|
||||
case SvgJustify.Center:
|
||||
return Element.ALIGN_CENTER;
|
||||
break;
|
||||
case SvgJustify.Right:
|
||||
return Element.ALIGN_RIGHT;
|
||||
break;
|
||||
}
|
||||
return Element.ALIGN_LEFT;
|
||||
}
|
||||
}
|
||||
public class VlnSplitCharacter : ISplitCharacter
|
||||
{
|
||||
public bool IsSplitCharacter(int start, int current, int end, char[] cc, PdfChunk[] ck)
|
||||
{
|
||||
return (cc[current] == ' ');
|
||||
}
|
||||
public bool IsSplitCharacter(char c)
|
||||
{
|
||||
return (c == ' ');
|
||||
}
|
||||
public bool IsSplitCharacter(int start, int current, int end, char[] cc, PdfChunk[] ck) => (cc[current] == ' ');
|
||||
public bool IsSplitCharacter(char c) => (c == ' ');
|
||||
}
|
||||
public static VlnSplitCharacter mySplitter = new VlnSplitCharacter();
|
||||
// Draw's using PdfContentByte are for drawing PageList items.
|
||||
@@ -654,9 +579,6 @@ namespace Volian.Svg.Library
|
||||
}
|
||||
switch (Justify)
|
||||
{
|
||||
//case SvgJustify.Left:
|
||||
// x = x;
|
||||
// break;
|
||||
case SvgJustify.Center:
|
||||
x-=w/2;
|
||||
break;
|
||||
@@ -687,12 +609,6 @@ namespace Volian.Svg.Library
|
||||
public static bool CompressPropSubSup = false;
|
||||
private Phrase BuildPhrase(string text, float fontSize, int fontStyle, iTextSharp.text.Font font)
|
||||
{
|
||||
//if (text == "Caution")
|
||||
//{
|
||||
// if (iTextSharp.text.FontFactory.IsRegistered("VolianScript"))
|
||||
// Console.WriteLine("Is Registered");
|
||||
// Console.WriteLine("stop");
|
||||
//}
|
||||
bool fontUnderline = false;
|
||||
float fontTextRise = 0;
|
||||
|
||||
@@ -700,8 +616,6 @@ namespace Volian.Svg.Library
|
||||
text = Regex.Replace(text, @"\\'[0-9a-fA-F][0-9a-fA-F]", new MatchEvaluator(ReplaceHexCharacter));
|
||||
text += " ";
|
||||
|
||||
//if (text.Contains("\\")) -- these 2 lines made \ul and \ulnone in page list text not get resolved and would then print
|
||||
//text = text.Replace("\\", ((char)9586).ToString()); // B2016-155 convert backslash char to the unicode symbol - to allow processing rtf commands \ul, \up, \dn, etc.
|
||||
// B2016-167: handle backslashes but don't do if the backslash is an underline rtf command
|
||||
int stindx = text.IndexOf("\\");
|
||||
while (stindx != -1)
|
||||
@@ -892,170 +806,38 @@ namespace Volian.Svg.Library
|
||||
tmp.RestoreState();
|
||||
}
|
||||
}
|
||||
public class SvgPageTotal
|
||||
{
|
||||
public SvgPageTotal(System.Drawing.Font myFont, PdfContentByte cb)
|
||||
{
|
||||
_MyFont = myFont;
|
||||
_MyTemplate = cb.CreateTemplate(100, 100);
|
||||
_MyTemplate.BoundingBox= new Rectangle(-20, -20, 100, 100);
|
||||
}
|
||||
private int _PageCount=1;
|
||||
private System.Drawing.Font _MyFont;
|
||||
private PdfTemplate _MyTemplate;
|
||||
public PdfTemplate MyTemplate
|
||||
{
|
||||
get { return _MyTemplate; }
|
||||
}
|
||||
public void Draw()
|
||||
{
|
||||
// Output Page Count
|
||||
_MyTemplate.BeginText();
|
||||
iTextSharp.text.Font font = Svg.GetFont(_MyFont.Name);
|
||||
BaseFont baseFont = font.BaseFont;
|
||||
_MyTemplate.SetFontAndSize(baseFont,_MyFont.Size);
|
||||
_MyTemplate.SetTextMatrix(0, 0);
|
||||
_MyTemplate.ShowText(_PageCount.ToString());
|
||||
_MyTemplate.EndText();
|
||||
}
|
||||
}
|
||||
public class SvgPageHelper : PdfPageEventHelper
|
||||
{
|
||||
private bool _SpecialCAS; // B2023-005: CAS page, rotate watermark
|
||||
public bool SpecialCAS
|
||||
{
|
||||
get { return _SpecialCAS; }
|
||||
set { _SpecialCAS = value; }
|
||||
}
|
||||
private bool _IsLandscape;
|
||||
public bool IsLandscape
|
||||
{
|
||||
get { return _IsLandscape; }
|
||||
set { _IsLandscape = value; }
|
||||
}
|
||||
// B2019-145: added the following property so that the code would know that an adjustment should be made to print the watermark
|
||||
// in landscape mode. Note that 'IsLandscape' could not be used because it also does the pagelist items.
|
||||
private bool _IsWatermarkLandscape;
|
||||
public bool IsWatermarkLandscape
|
||||
{
|
||||
get { return _IsWatermarkLandscape; }
|
||||
set { _IsWatermarkLandscape = value; }
|
||||
}
|
||||
// B2018-124 we no longer need is list was not hanling "Information Only" water mark
|
||||
//private List<string> _AllowedWatermarks = new List<string>();
|
||||
//public List<string> AllowedWatermarks
|
||||
//{
|
||||
// get { return _AllowedWatermarks; }
|
||||
// set { _AllowedWatermarks = value; }
|
||||
//}
|
||||
private Svg _MySvg;
|
||||
public Svg MySvg
|
||||
{
|
||||
get { return _MySvg; }
|
||||
set { _MySvg = value; }
|
||||
}
|
||||
private PdfLayer _PageListLayer;
|
||||
public PdfLayer PageListLayer
|
||||
{
|
||||
get { return _PageListLayer; }
|
||||
set { _PageListLayer = value; }
|
||||
}
|
||||
private PdfLayer _WatermarkLayer;
|
||||
public PdfLayer WatermarkLayer
|
||||
{
|
||||
get { return _WatermarkLayer; }
|
||||
set { _WatermarkLayer = value; }
|
||||
}
|
||||
private string _Watermark=string.Empty;
|
||||
public string Watermark
|
||||
{
|
||||
get { return _Watermark; }
|
||||
set { _Watermark = value; }
|
||||
}
|
||||
private string _WatermarkColor = "BLUE";
|
||||
public string WatermarkColor
|
||||
{
|
||||
get { return _WatermarkColor; }
|
||||
set { _WatermarkColor = value; }
|
||||
}
|
||||
private PdfLayer _PROMSVersionLayer; //C2018-009 print PROMS version
|
||||
public PdfLayer PROMSVersionLayer
|
||||
{
|
||||
get { return _PROMSVersionLayer; }
|
||||
set { _PROMSVersionLayer = value; }
|
||||
}
|
||||
private string _PROMSVersion = string.Empty;
|
||||
public string PROMSVersion
|
||||
{
|
||||
get { return _PROMSVersion; }
|
||||
set { _PROMSVersion = value; }
|
||||
}
|
||||
private bool _DoZoomOMatic = false;
|
||||
public bool DoZoomOMatic
|
||||
{
|
||||
get { return _DoZoomOMatic; }
|
||||
set { _DoZoomOMatic = value; }
|
||||
}
|
||||
private int _CurrentPageNumber = 0;
|
||||
public int CurrentPageNumber
|
||||
{
|
||||
get { return _CurrentPageNumber; }
|
||||
set { _CurrentPageNumber = value; }
|
||||
}
|
||||
private int _CurrentPageNumberNoFoldouts = 0;
|
||||
public int CurrentPageNumberNoFoldouts
|
||||
{
|
||||
get { return _CurrentPageNumberNoFoldouts; }
|
||||
set { _CurrentPageNumberNoFoldouts = value; }
|
||||
}
|
||||
private int _CurrentTOCPageNumber = 0;
|
||||
public int CurrentTOCPageNumber
|
||||
{
|
||||
get { return _CurrentTOCPageNumber; }
|
||||
set { _CurrentTOCPageNumber = value; }
|
||||
}
|
||||
private bool _OnFoldoutPage = false;
|
||||
public bool OnFoldoutPage
|
||||
{
|
||||
get { return _OnFoldoutPage; }
|
||||
set { _OnFoldoutPage = value; }
|
||||
}
|
||||
private bool _CreatingFoldoutPage = false;
|
||||
public bool CreatingFoldoutPage
|
||||
{
|
||||
get { return _CreatingFoldoutPage; }
|
||||
set { _CreatingFoldoutPage = value; }
|
||||
}
|
||||
private bool _CreatingSupInfoPage = false;
|
||||
public bool CreatingSupInfoPage
|
||||
{
|
||||
get { return _CreatingSupInfoPage; }
|
||||
set { _CreatingSupInfoPage = value; }
|
||||
}
|
||||
public bool SpecialCAS { get; set; }
|
||||
public bool IsLandscape { get; set; }
|
||||
public bool IsWatermarkLandscape { get; set; }
|
||||
public Svg MySvg { get; set; }
|
||||
public PdfLayer PageListLayer { get; set; }
|
||||
public PdfLayer WatermarkLayer { get; set; }
|
||||
public string Watermark { get; set; } = string.Empty;
|
||||
public string WatermarkColor { get; set; } = "BLUE";
|
||||
public PdfLayer PROMSVersionLayer { get; set; }
|
||||
public string PROMSVersion { get; set; } = string.Empty;
|
||||
public bool DoZoomOMatic { get; set; } = false;
|
||||
public int CurrentPageNumber { get; set; } = 0;
|
||||
public int CurrentPageNumberNoFoldouts { get; set; } = 0;
|
||||
public int CurrentTOCPageNumber { get; set; } = 0;
|
||||
public bool OnFoldoutPage { get; set; } = false;
|
||||
public bool CreatingFoldoutPage { get; set; } = false;
|
||||
public bool CreatingSupInfoPage { get; set; } = false;
|
||||
public SvgPageHelper(Svg mySvg)
|
||||
{
|
||||
_MySvg = mySvg;
|
||||
MySvg = mySvg;
|
||||
}
|
||||
public SvgPageHelper()
|
||||
{
|
||||
}
|
||||
private int _BGPageOffset = 0;
|
||||
public int BackgroundPageOffset
|
||||
{
|
||||
get { return _BGPageOffset; }
|
||||
set { _BGPageOffset = value; }
|
||||
}
|
||||
protected virtual string ReplacePageListToken(Match match)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public int BackgroundPageOffset { get; set; } = 0;
|
||||
protected virtual string ReplacePageListToken(Match match) => string.Empty;
|
||||
|
||||
public override void OnOpenDocument(PdfWriter writer, Document document)
|
||||
{
|
||||
//base.OnOpenDocument(writer, document);
|
||||
//tmpTotal = writer.DirectContent.CreateTemplate(100, 100);
|
||||
//tmpTotal.BoundingBox = new Rectangle(-20, -20, 100, 100);
|
||||
//PdfContentByte cb = writer.DirectContent;
|
||||
}
|
||||
public override void OnEndPage(PdfWriter writer, Document document)
|
||||
{
|
||||
@@ -1093,8 +875,8 @@ namespace Volian.Svg.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_BackgroundReader == null && _BackgroundFile != null && File.Exists(_BackgroundFile))
|
||||
_BackgroundReader = new PdfReader(_BackgroundFile);
|
||||
if (_BackgroundReader == null && BackgroundFile != null && File.Exists(BackgroundFile))
|
||||
_BackgroundReader = new PdfReader(BackgroundFile);
|
||||
return _BackgroundReader;
|
||||
}
|
||||
}
|
||||
@@ -1106,28 +888,16 @@ namespace Volian.Svg.Library
|
||||
return BackgroundReader.Info["Producer"].ToString().StartsWith("iTextSharp");
|
||||
}
|
||||
}
|
||||
private string _BackgroundFile = null;
|
||||
public string BackgroundFile
|
||||
{
|
||||
get { return _BackgroundFile; }
|
||||
set { _BackgroundFile = value; }
|
||||
}
|
||||
private PdfLayer _BackgroundLayer = null;
|
||||
public PdfLayer BackgroundLayer
|
||||
{
|
||||
get { return _BackgroundLayer; }
|
||||
set { _BackgroundLayer = value; }
|
||||
}
|
||||
|
||||
public string BackgroundFile { get; set; } = null;
|
||||
public PdfLayer BackgroundLayer { get; set; } = null;
|
||||
private System.Drawing.PointF _BackgroundOffset = new System.Drawing.PointF(0, 0);
|
||||
public System.Drawing.PointF BackgroundOffset
|
||||
{
|
||||
get { return _BackgroundOffset; }
|
||||
set { _BackgroundOffset = value; }
|
||||
}
|
||||
public int BackgroundPageCount
|
||||
{
|
||||
get { return BackgroundReader == null ? 0 : BackgroundReader.NumberOfPages; }
|
||||
}
|
||||
public int BackgroundPageCount => BackgroundReader == null ? 0 : BackgroundReader.NumberOfPages;
|
||||
private PdfImportedPage GetBackgroundPage(PdfContentByte cb)
|
||||
{
|
||||
if (BackgroundReader == null) return null;
|
||||
@@ -1151,12 +921,8 @@ namespace Volian.Svg.Library
|
||||
ZoomOMatic(cb, 36);
|
||||
cb.RestoreState();
|
||||
}
|
||||
private bool _AllowAllWatermarks = false;
|
||||
public bool AllowAllWatermarks
|
||||
{
|
||||
get { return _AllowAllWatermarks; }
|
||||
set { _AllowAllWatermarks = value; }
|
||||
}
|
||||
|
||||
public bool AllowAllWatermarks { get; set; } = false;
|
||||
//C2022-004 This will return the system drawing color from either the color name or ARGB values
|
||||
public System.Drawing.Color GetWatermarkColor(string colorDescription)
|
||||
{
|
||||
@@ -1192,9 +958,8 @@ namespace Volian.Svg.Library
|
||||
private void DrawWatermark(PdfContentByte cb)
|
||||
{
|
||||
if (Watermark == null || Watermark.ToLower().Contains("none") || Watermark == "") return;
|
||||
//if (!AllowAllWatermarks && !AllowedWatermarks.Contains(Watermark)) return; -- B2018-124 not needed anymore with above if statement - this does not hanle "Information Only"
|
||||
cb.SaveState();
|
||||
if (_WatermarkLayer != null) cb.BeginLayer(_WatermarkLayer);
|
||||
if (WatermarkLayer != null) cb.BeginLayer(WatermarkLayer);
|
||||
// B2023-005: Beaver Valley, second page of CAS page is a 'foldout' on large paper - need to rotate the
|
||||
// watermark
|
||||
if (SpecialCAS)
|
||||
@@ -1207,16 +972,13 @@ namespace Volian.Svg.Library
|
||||
else if (IsLandscape || IsWatermarkLandscape) // B2019-145: Added for printing landscape watermark on step section pages.
|
||||
{
|
||||
// The watermark needs to be rotated back for landscape pagelist - B2016-191
|
||||
//double a = -33 * (Math.PI / 180);
|
||||
//System.Drawing.Drawing2D.Matrix myMatrix = new System.Drawing.Drawing2D.Matrix((float)Math.Cos(a), (float)Math.Sin(a), (float)-Math.Sin(a), (float)Math.Cos(a), -60, 320);
|
||||
double a = -90 * (Math.PI / 180);
|
||||
System.Drawing.Drawing2D.Matrix myMatrix = new System.Drawing.Drawing2D.Matrix((float)Math.Cos(a), (float)Math.Sin(a), (float)-Math.Sin(a), (float)Math.Cos(a), 0, cb.PdfDocument.PageSize.Height);
|
||||
cb.Transform(myMatrix);
|
||||
}
|
||||
SvgWatermark myWatermark = new SvgWatermark(cb, Watermark, GetWatermarkColor(WatermarkColor), .15F);
|
||||
//myWatermark.SetSquareDotPattern(.7F);
|
||||
myWatermark.Draw();
|
||||
if (_WatermarkLayer != null) cb.EndLayer();
|
||||
if (WatermarkLayer != null) cb.EndLayer();
|
||||
cb.RestoreState();
|
||||
}
|
||||
//C2018-009 print PROMS version
|
||||
@@ -1226,32 +988,22 @@ namespace Volian.Svg.Library
|
||||
string text = PROMSVersion;
|
||||
float textBase =cb.PdfDocument.Top + 19;
|
||||
float textLeft = cb.PdfDocument.Right - 15;
|
||||
if (_PROMSVersionLayer != null) cb.BeginLayer(_PROMSVersionLayer);
|
||||
if (PROMSVersionLayer != null) cb.BeginLayer(PROMSVersionLayer);
|
||||
cb.BeginText();
|
||||
cb.SetFontAndSize(BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.EMBEDDED), 6f);
|
||||
cb.SetTextMatrix(textLeft, textBase);
|
||||
cb.SetColorFill(new iTextSharp.text.Color(System.Drawing.Color.Indigo));
|
||||
cb.ShowText(text);
|
||||
cb.EndText();
|
||||
if (_PROMSVersionLayer != null) cb.EndLayer();
|
||||
if (PROMSVersionLayer != null) cb.EndLayer();
|
||||
cb.RestoreState();
|
||||
}
|
||||
private void DrawPageList(PdfContentByte cb)
|
||||
{
|
||||
if (_MySvg != null)
|
||||
if (MySvg != null)
|
||||
{
|
||||
cb.SaveState();
|
||||
if (_PageListLayer != null) cb.BeginLayer(_PageListLayer);
|
||||
// Do anything needed to finish off the page
|
||||
//System.Drawing.Drawing2D.Matrix myMatrix = new System.Drawing.Drawing2D.Matrix();
|
||||
//myMatrix.Rotate(90); // Rotate the Pagelist items by 90 Degrees.
|
||||
//// Translate by the Height of the page.
|
||||
//myMatrix.Translate(cb.PdfDocument.PageSize.Height, 0, System.Drawing.Drawing2D.MatrixOrder.Append);
|
||||
//// This was for fun
|
||||
//// myMatrix.Scale(.75F, .75F, System.Drawing.Drawing2D.MatrixOrder.Append);
|
||||
//cb.Transform(myMatrix);
|
||||
//// You can look at the value of the Matrix at this point, to create the matrix directly like I did below
|
||||
//OR
|
||||
if (PageListLayer != null) cb.BeginLayer(PageListLayer);
|
||||
// Rotate 90 Degrees and Translate by the Height of the Page
|
||||
|
||||
if (IsLandscape)
|
||||
@@ -1259,8 +1011,8 @@ namespace Volian.Svg.Library
|
||||
System.Drawing.Drawing2D.Matrix myMatrix = new System.Drawing.Drawing2D.Matrix(0, 1, -1, 0, cb.PdfDocument.PageSize.Height, 0);
|
||||
cb.Transform(myMatrix);
|
||||
}
|
||||
_MySvg.Draw(cb);
|
||||
if (_PageListLayer != null) cb.EndLayer();
|
||||
MySvg.Draw(cb);
|
||||
if (PageListLayer != null) cb.EndLayer();
|
||||
cb.RestoreState();
|
||||
}
|
||||
}
|
||||
@@ -1277,7 +1029,7 @@ namespace Volian.Svg.Library
|
||||
}
|
||||
public override void OnStartPage(PdfWriter writer, Document document)
|
||||
{
|
||||
//base.OnStartPage(writer, document);
|
||||
|
||||
}
|
||||
public override void OnCloseDocument(PdfWriter writer, Document document)
|
||||
{
|
||||
@@ -1289,137 +1041,24 @@ namespace Volian.Svg.Library
|
||||
private PdfContentByte _ContentByte;
|
||||
private string _Text;
|
||||
private System.Drawing.Color _Color;
|
||||
private PdfPatternPainter _PatternPainter;
|
||||
private BaseFont _Basefont;
|
||||
private float _Fontsize;
|
||||
private float _XOffset;
|
||||
private float _YOffset;
|
||||
private float _TextAngle;
|
||||
private float _Opacity;
|
||||
public SvgWatermark(PdfContentByte contentByte, string text, System.Drawing.Color color, float opacity)
|
||||
{
|
||||
_ContentByte = contentByte;
|
||||
_Text = text;
|
||||
//float radius = .5F;
|
||||
//float space = 3;
|
||||
// B2021-081: Blue was too intense with an alpha of 255 Read was too light with an alpha of 96
|
||||
if (color != System.Drawing.Color.Red)
|
||||
_Color = System.Drawing.Color.FromArgb(96, color);
|
||||
else
|
||||
_Color = color; // C2021-019: save color for color override
|
||||
_Opacity = opacity;
|
||||
//SetDotPattern(radius, space);
|
||||
//SetTextLayout();
|
||||
}
|
||||
#region commentedout
|
||||
//private void SetTextLayout()
|
||||
//{
|
||||
// Rectangle pageSize = _ContentByte.PdfWriter.PageSize; // Get page size
|
||||
// _Basefont = BaseFont.CreateFont(BaseFont.HELVETICA_BOLD, Encoding.ASCII.EncodingName, BaseFont.EMBEDDED);
|
||||
// float hgtA = _Basefont.GetAscentPoint(_Text, 12);
|
||||
// //float hgtD = basefont.GetDescentPoint(text,20);
|
||||
// float wid = _Basefont.GetWidthPointKerned(_Text, 12);
|
||||
// //Console.WriteLine("{0} {1} {2}",hgtA,hgtD,wid);
|
||||
// float rho = wid / hgtA;
|
||||
// float x2 = (rho * pageSize.Height - pageSize.Width) / (rho * rho - 1);
|
||||
// float y1 = x2 * rho;
|
||||
// float y2 = pageSize.Height - y1;
|
||||
// float x1 = pageSize.Width - x2;
|
||||
// _XOffset = x2 + x1 / 2;
|
||||
// _YOffset = y1 / 2;
|
||||
// _TextAngle = CalcAngle(y1, x1);
|
||||
// _Fontsize = (float)(10 * Math.Sqrt(x2 * x2 + y2 * y2) / hgtA);
|
||||
//}
|
||||
//public void SetDotPattern(float radius, float space)
|
||||
//{
|
||||
// _PatternPainter = _ContentByte.CreatePattern(radius * 2, radius * 2, radius * 2 + space, radius * 2 + space);
|
||||
// PdfGState gState = new PdfGState();
|
||||
// gState.FillOpacity = _Opacity;
|
||||
// _PatternPainter.SetGState(gState);
|
||||
// _PatternPainter.SetColorFill(_Color);
|
||||
// _PatternPainter.Circle(radius, radius, radius);
|
||||
// _PatternPainter.Fill();
|
||||
//}
|
||||
//public void SetSquareDotPattern(float radius)
|
||||
//{
|
||||
// _PatternPainter = _ContentByte.CreatePattern(radius * 4, radius * 2, radius * 4, radius * 2);
|
||||
// PdfGState gState = new PdfGState();
|
||||
// gState.FillOpacity = .5f * _Opacity;
|
||||
// _PatternPainter.SetGState(gState);
|
||||
// _PatternPainter.SetColorFill(_Color);
|
||||
// _PatternPainter.Rectangle(0, 0, radius, radius);
|
||||
// _PatternPainter.Rectangle(radius * 2, radius, radius, radius);
|
||||
// _PatternPainter.Fill();
|
||||
//}
|
||||
//public void SetHashPattern(float thickness, float size)
|
||||
//{
|
||||
// _PatternPainter = _ContentByte.CreatePattern(size, size, size, size);
|
||||
// PdfGState gState = new PdfGState();
|
||||
// gState.FillOpacity = _Opacity;
|
||||
// gState.StrokeOpacity = _Opacity;
|
||||
// _PatternPainter.SetGState(gState);
|
||||
// _PatternPainter.SetLineWidth(.01F);
|
||||
// _PatternPainter.SetColorStroke(_Color); // Set color
|
||||
// _PatternPainter.MoveTo(0, 0);
|
||||
// _PatternPainter.LineTo(size, size);
|
||||
// _PatternPainter.MoveTo(size, 0);
|
||||
// _PatternPainter.LineTo(0, size);
|
||||
// _PatternPainter.Stroke();
|
||||
//}
|
||||
//public void SetTextPattern(float fontSize, float space)
|
||||
//{
|
||||
// float hgtA = _Basefont.GetAscentPoint(_Text, fontSize) + _Basefont.GetDescentPoint(_Text, fontSize);
|
||||
// float wid = _Basefont.GetWidthPointKerned(_Text, fontSize);
|
||||
// _PatternPainter = _ContentByte.CreatePattern(wid, hgtA, wid + space, hgtA + space);
|
||||
// _PatternPainter.SetFontAndSize(_Basefont, fontSize);
|
||||
// _PatternPainter.BoundingBox = new Rectangle(-20, -20, 100, 100);
|
||||
// _PatternPainter.BeginText();
|
||||
// PdfGState gs1 = new PdfGState();
|
||||
// gs1.FillOpacity = _Opacity;
|
||||
// _PatternPainter.SetGState(gs1);
|
||||
// _PatternPainter.SetColorFill(_Color); // Set color
|
||||
// _PatternPainter.ShowText(_Text);
|
||||
// _PatternPainter.EndText();
|
||||
//}
|
||||
//public void SetTextPattern2(float fontSize)
|
||||
//{
|
||||
// BaseFont _Basefont2 = BaseFont.CreateFont(BaseFont.HELVETICA, Encoding.ASCII.EncodingName, BaseFont.EMBEDDED);
|
||||
// float hgtA = _Basefont2.GetAscentPoint(_Text, fontSize);
|
||||
// float wid = _Basefont2.GetWidthPointKerned(_Text, fontSize);
|
||||
// _PatternPainter = _ContentByte.CreatePattern(wid * 2, hgtA * 2, wid * 2, hgtA * 2);
|
||||
// _PatternPainter.SetFontAndSize(_Basefont2, fontSize);
|
||||
// _PatternPainter.BoundingBox = new Rectangle(-20, -20, 100, 100);
|
||||
// _PatternPainter.BeginText();
|
||||
// PdfGState gs1 = new PdfGState();
|
||||
// gs1.FillOpacity = _Opacity;
|
||||
// _PatternPainter.SetGState(gs1);
|
||||
// _PatternPainter.SetColorFill(_Color); // Set color
|
||||
// _PatternPainter.ShowText(_Text);
|
||||
// _PatternPainter.ShowTextAligned(PdfContentByte.ALIGN_LEFT, _Text, wid, hgtA, 0);
|
||||
// _PatternPainter.EndText();
|
||||
//}
|
||||
#endregion
|
||||
public void Draw()
|
||||
{
|
||||
_ContentByte.SaveState();
|
||||
//_ContentByte.BeginText();
|
||||
//_ContentByte.SetPatternFill(_PatternPainter);
|
||||
//_ContentByte.SetTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE);
|
||||
//_ContentByte.SetLineWidth(.5F);
|
||||
//_ContentByte.SetFontAndSize(_Basefont, _Fontsize);// Set font and size
|
||||
//_ContentByte.SetColorStroke(_Color);
|
||||
//PdfGState gs2 = new PdfGState();
|
||||
//gs2.StrokeOpacity = _Opacity;
|
||||
//_ContentByte.SetGState(gs2);
|
||||
//_ContentByte.ShowTextAlignedKerned(PdfContentByte.ALIGN_CENTER, _Text, _XOffset, _YOffset, _TextAngle);// Draw the text
|
||||
//_ContentByte.EndText();
|
||||
_ContentByte.AddImage(WatermarkImage);
|
||||
_ContentByte.RestoreState();
|
||||
}
|
||||
//private float CalcAngle(float opposite, float adjacent)
|
||||
//{
|
||||
// return (float)(Math.Atan2(opposite, adjacent) * (180 / Math.PI));
|
||||
//}
|
||||
private Image _WatermarkImage;
|
||||
public Image WatermarkImage
|
||||
{
|
||||
@@ -1452,7 +1091,6 @@ namespace Volian.Svg.Library
|
||||
_Color, System.Drawing.Color.Transparent);
|
||||
g.FillPath(aHatchBrush, gp);
|
||||
g.DrawPath(new System.Drawing.Pen(_Color), gp);
|
||||
//g.DrawRectangle(System.Drawing.Pens.Cyan, 0, 0, bnds.Width, bnds.Height);
|
||||
}
|
||||
_WatermarkImage = iTextSharp.text.Image.GetInstance(bmp, System.Drawing.Imaging.ImageFormat.Png);
|
||||
_WatermarkImage.SetAbsolutePosition(72, 72);
|
||||
@@ -1481,11 +1119,4 @@ namespace Volian.Svg.Library
|
||||
}
|
||||
|
||||
}
|
||||
public enum SvgWatermarkFill
|
||||
{
|
||||
Dots = 1,
|
||||
Text1 = 2,
|
||||
Text2 = 3,
|
||||
Hash = 4
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,108 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using LBWordLibrary;
|
||||
|
||||
namespace Volian.MSWord
|
||||
{
|
||||
public class WordDoc
|
||||
{
|
||||
private static LBApplicationClass _MyWordApp;
|
||||
public static LBApplicationClass MyWordApp
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_MyWordApp == null)
|
||||
_MyWordApp = new LBApplicationClass();
|
||||
return WordDoc._MyWordApp;
|
||||
}
|
||||
}
|
||||
private LBDocumentClass _MyWordDoc;
|
||||
public LBDocumentClass MyWordDoc
|
||||
{
|
||||
get
|
||||
{ return _MyWordDoc; }
|
||||
}
|
||||
private string _DocName;
|
||||
public string DocName
|
||||
{
|
||||
get { return _DocName; }
|
||||
set { _DocName = value; }
|
||||
}
|
||||
public WordDoc(string docName)
|
||||
{
|
||||
DocName = docName;
|
||||
_MyWordDoc = MyWordApp.Documents.Open(_DocName, false);
|
||||
}
|
||||
public string Save()
|
||||
{
|
||||
try
|
||||
{
|
||||
MyWordDoc.SaveAs(DocName, LBWdSaveFormat.wdFormatDocument);
|
||||
return "Successful Save";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return string.Format("Error during Doc save - {0}", ex.Message);
|
||||
}
|
||||
}
|
||||
public string Save(string docName)
|
||||
{
|
||||
DocName = docName;
|
||||
return Save();
|
||||
}
|
||||
public void Close()
|
||||
{
|
||||
MyWordDoc.Close(false);
|
||||
}
|
||||
public float SetLineSpacing(float linesPerInch) // if need landscape set too: , bool landscape)
|
||||
{
|
||||
float retval = 0;
|
||||
LBSelection selection = MyWordApp.Selection;
|
||||
selection.WholeStory();
|
||||
retval = selection.ParagraphFormat.LineSpacing;
|
||||
selection.ParagraphFormat.SpaceBefore = 0;
|
||||
selection.ParagraphFormat.SpaceAfter = 0;
|
||||
selection.ParagraphFormat.LineSpacingRule = LBWdLineSpacing.wdLineSpaceExactly;
|
||||
selection.ParagraphFormat.LineSpacing = 72 / linesPerInch;
|
||||
return retval;
|
||||
}
|
||||
public float Length
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return MyWordDoc.Length;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Error Getting Length, {0}", ex.Message);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
public static void CloseApp()
|
||||
{
|
||||
if(_MyWordApp != null)
|
||||
{
|
||||
TryToQuit();
|
||||
KillWordApps();
|
||||
}
|
||||
}
|
||||
|
||||
private static void TryToQuit()
|
||||
{
|
||||
try
|
||||
{
|
||||
_MyWordApp.Quit(false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("{0} - {1}", ex.GetType().Name, ex.Message);
|
||||
}
|
||||
_MyWordApp=null;
|
||||
}
|
||||
public static void KillWordApps()
|
||||
{
|
||||
try
|
||||
@@ -124,15 +25,8 @@ namespace Volian.MSWord
|
||||
if(proc.MainWindowTitle=="")
|
||||
proc.Kill();
|
||||
}
|
||||
_MyWordApp = null;
|
||||
}
|
||||
public static System.Diagnostics.Process[] WordProcesses
|
||||
{
|
||||
get
|
||||
{
|
||||
return System.Diagnostics.Process.GetProcessesByName("WINWORD");
|
||||
}
|
||||
}
|
||||
public static System.Diagnostics.Process[] WordProcesses => System.Diagnostics.Process.GetProcessesByName("WINWORD");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
using System.Xml;
|
||||
using System.Xml.Schema;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
@@ -21,10 +19,7 @@ namespace vlnObjectLibrary
|
||||
/* See if I need to do anything */
|
||||
}
|
||||
#region XML Serialization
|
||||
public void WriteXml(XmlWriter w)
|
||||
{
|
||||
WriteXml(w, true);
|
||||
}
|
||||
public void WriteXml(XmlWriter w) => WriteXml(w, true);
|
||||
public void WriteXml(XmlWriter w,bool bSaveParent)
|
||||
{
|
||||
w.WriteAttributeString("title", Title);
|
||||
@@ -74,10 +69,7 @@ namespace vlnObjectLibrary
|
||||
xr.Close();
|
||||
}
|
||||
|
||||
public XmlSchema GetSchema()
|
||||
{
|
||||
return (null);
|
||||
}
|
||||
public XmlSchema GetSchema() => (null);
|
||||
#endregion
|
||||
#region Constructors
|
||||
public vlnObject(vlnObject parent, string type, string title, string path)
|
||||
@@ -148,10 +140,7 @@ namespace vlnObjectLibrary
|
||||
vlnObject b = new vlnObject(this, type, title, path);
|
||||
return b;
|
||||
}
|
||||
public void AddProp(string name, string value)
|
||||
{
|
||||
PropArray[name.ToUpper()] = value;
|
||||
}
|
||||
public void AddProp(string name, string value) => PropArray[name.ToUpper()] = value;
|
||||
public void AddProp(XmlReader xr)
|
||||
{
|
||||
SkipToElement(xr);
|
||||
@@ -182,10 +171,7 @@ namespace vlnObjectLibrary
|
||||
m_Children = value;
|
||||
}
|
||||
}
|
||||
public void LoadChildren(string sXml)
|
||||
{
|
||||
LoadChildren(new XmlTextReader(new StringReader(sXml)));
|
||||
}
|
||||
public void LoadChildren(string sXml) => LoadChildren(new XmlTextReader(new StringReader(sXml)));
|
||||
public void LoadChildren(XmlReader xr)
|
||||
{
|
||||
m_Children = new List<vlnObject>();
|
||||
@@ -212,8 +198,6 @@ namespace vlnObjectLibrary
|
||||
}
|
||||
public string ProcessString(string s)
|
||||
{
|
||||
//string retval=s;
|
||||
//string retval = Regex.Replace(s, "{[.]*}", new MatchEvaluator(ReplaceKey));
|
||||
string retval = Regex.Replace(s, "{{.*?}}", new MatchEvaluator(ReplaceRow));
|
||||
retval = Regex.Replace(retval, "{.*?}", new MatchEvaluator(ReplaceDrv));
|
||||
return retval;
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using vlnObjectLibrary;
|
||||
using System.Xml;
|
||||
using System.IO;
|
||||
using System.Data;
|
||||
using System.Data.OleDb;
|
||||
using System.Reflection;
|
||||
|
||||
namespace vlnServerLibrary
|
||||
{
|
||||
@@ -16,16 +14,8 @@ namespace vlnServerLibrary
|
||||
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
#endregion
|
||||
#region Static Properties
|
||||
private static string m_XmlControlPath = "vlnControl.xml";
|
||||
private static XmlDocument m_XmlControl;
|
||||
public static string XMLControlPath
|
||||
{
|
||||
get { return m_XmlControlPath; }
|
||||
set
|
||||
{
|
||||
m_XmlControlPath = value;
|
||||
}
|
||||
}
|
||||
public static string XMLControlPath { get; set; } = "vlnControl.xml";
|
||||
public static XmlDocument XMLControl
|
||||
{
|
||||
get
|
||||
@@ -35,7 +25,7 @@ namespace vlnServerLibrary
|
||||
m_XmlControl = new XmlDocument();
|
||||
lock (m_XmlControl)
|
||||
{
|
||||
m_XmlControl.Load(m_XmlControlPath);
|
||||
m_XmlControl.Load(XMLControlPath);
|
||||
}
|
||||
}
|
||||
return m_XmlControl;
|
||||
@@ -75,10 +65,7 @@ namespace vlnServerLibrary
|
||||
string xPath = string.Format(".//dbObject[@type='{0}']/@{1}", o.Parent.Type, s);
|
||||
return LookUpX(o,xPath);
|
||||
}
|
||||
protected string LookUpX(vlnObject o,string xPath)
|
||||
{
|
||||
return LookUpX(o,xPath, XMLControl);
|
||||
}
|
||||
protected string LookUpX(vlnObject o, string xPath) => LookUpX(o, xPath, XMLControl);
|
||||
private void LoadChildrenFromDB(vlnObject o,string sSelect)
|
||||
{
|
||||
if (sSelect != "")
|
||||
@@ -89,7 +76,6 @@ namespace vlnServerLibrary
|
||||
OleDbConnectionStringBuilder csb = new OleDbConnectionStringBuilder(s);
|
||||
OleDbConnection dbConn = new OleDbConnection(csb.ConnectionString);
|
||||
string sTable = LookUp(o,"table");
|
||||
//if (dbConn.State != ConnectionState.Open) dbConn.Open();
|
||||
OleDbDataAdapter da = new OleDbDataAdapter(sSelect, dbConn);
|
||||
DataSet ds = new DataSet();
|
||||
da.Fill(ds, sTable);
|
||||
@@ -222,7 +208,7 @@ namespace vlnServerLibrary
|
||||
string sRetval = sDefault;
|
||||
if (sRetval[0] == '~')
|
||||
{
|
||||
string sTitlePath = sPath + "\\title";
|
||||
string sTitlePath = $"{sPath}\\title";
|
||||
if (File.Exists(sTitlePath))
|
||||
{
|
||||
StreamReader sr = File.OpenText(sTitlePath);
|
||||
|
||||
BIN
Binary file not shown.
+34
-137
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
@@ -19,34 +18,17 @@ namespace XYPlots
|
||||
// C2018-035 Added error Handling to provide more useful information when a plot fails
|
||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
#endregion
|
||||
static string _MyFontFamily = "Letter Gothic Tall";
|
||||
public static string MyFontFamily
|
||||
{
|
||||
get { return _MyFontFamily; }
|
||||
set { _MyFontFamily = value; }
|
||||
}
|
||||
public static string MyFontFamily { get; set; } = "Letter Gothic Tall";
|
||||
private static Color _BlackColor = Color.Red;
|
||||
public static Color BlackColor
|
||||
{
|
||||
get { return VG.VG.BlackColor; }
|
||||
set { VG.VG.BlackColor = value; }
|
||||
}
|
||||
public float Width
|
||||
{
|
||||
get { return 72 * (LeftMargin + RightMargin) + printerunits[0] * .05F; }
|
||||
}
|
||||
public float Height
|
||||
{
|
||||
get { return 72 * (TopMargin + BottomMargin) + printerunits[1] * .05F; }
|
||||
}
|
||||
public float PlotWidth
|
||||
{
|
||||
get { return (float) userunits[X]; }
|
||||
}
|
||||
public float PlotHeight
|
||||
{
|
||||
get { return (float) userunits[Y]; }
|
||||
}
|
||||
public float Width => 72 * (LeftMargin + RightMargin) + printerunits[0] * .05F;
|
||||
public float Height => 72 * (TopMargin + BottomMargin) + printerunits[1] * .05F;
|
||||
public float PlotWidth => (float)userunits[X];
|
||||
public float PlotHeight => (float)userunits[Y];
|
||||
private double ConvertToTwips = 4.8;
|
||||
static int MAX_XY_STACK = 8; /* this is max of CIE cursor/font stack */
|
||||
static int DPI = 1440; //300;
|
||||
@@ -146,7 +128,7 @@ namespace XYPlots
|
||||
private bool[,] doLOG10 = { { false, false }, { false, false } };
|
||||
public struct point
|
||||
{
|
||||
public int[] xyValue; //new int[Dimensions];
|
||||
public int[] xyValue;
|
||||
}
|
||||
public struct XyBox
|
||||
{
|
||||
@@ -162,22 +144,16 @@ namespace XYPlots
|
||||
private XyBoxes ActiveBoxes = new XyBoxes();
|
||||
public class DataPoint
|
||||
{
|
||||
public override string ToString() // Make it easier to Debug
|
||||
{
|
||||
return string.Format("{0},{1}", APoint.xyValue[X],APoint.xyValue[Y]);
|
||||
}
|
||||
// Make it easier to Debug
|
||||
public override string ToString() => string.Format("{0},{1}", APoint.xyValue[X], APoint.xyValue[Y]);
|
||||
private point m_APoint;
|
||||
public point APoint
|
||||
{
|
||||
get { return m_APoint; }
|
||||
set { m_APoint = value; }
|
||||
}
|
||||
private double m_slope; // slope of tangent to circle at this point
|
||||
public double slope
|
||||
{
|
||||
get { return m_slope; }
|
||||
set { m_slope = value; }
|
||||
}
|
||||
|
||||
public double slope { get; set; }
|
||||
}
|
||||
public class DataPoints : List<DataPoint>
|
||||
{
|
||||
@@ -211,40 +187,19 @@ namespace XYPlots
|
||||
result = (double)(val * val);
|
||||
return result;
|
||||
}
|
||||
private double FMin(double f1, double f2)
|
||||
{
|
||||
return ((f1 >= f2) ? f2 : f1);
|
||||
}
|
||||
private double FMax(double f1, double f2)
|
||||
{
|
||||
return ((f1 >= f2) ? f1 : f2);
|
||||
}
|
||||
private double atan_deg(double x)
|
||||
{
|
||||
return (Math.Atan(x) * 180.0 / PI);
|
||||
}
|
||||
private double cos_deg(double x)
|
||||
{
|
||||
return (Math.Cos(x * PI / 180.0));
|
||||
}
|
||||
private double tan_deg(double x)
|
||||
{
|
||||
return (Math.Tan(x * PI / 180.0));
|
||||
}
|
||||
private double sin_deg(double x)
|
||||
{
|
||||
return (Math.Sin(x * PI / 180.0));
|
||||
}
|
||||
private double FMin(double f1, double f2) => ((f1 >= f2) ? f2 : f1);
|
||||
private double FMax(double f1, double f2) => ((f1 >= f2) ? f1 : f2);
|
||||
private double atan_deg(double x) => (Math.Atan(x) * 180.0 / PI);
|
||||
private double cos_deg(double x) => (Math.Cos(x * PI / 180.0));
|
||||
private double tan_deg(double x) => (Math.Tan(x * PI / 180.0));
|
||||
private double sin_deg(double x) => (Math.Sin(x * PI / 180.0));
|
||||
/// <summary>
|
||||
/// the following function is pointed to by a function pointer
|
||||
/// and is provided for compatibility with log10() function usage
|
||||
/// </summary>
|
||||
/// <param name="x"></param>
|
||||
/// <returns></returns>
|
||||
private double linear(double x)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
private double linear(double x) => x;
|
||||
private bool isWhiteSpace(char cptr)
|
||||
{
|
||||
bool rtnval = false;
|
||||
@@ -332,10 +287,7 @@ namespace XYPlots
|
||||
BuffPtr = 0;
|
||||
return true;
|
||||
}
|
||||
private void LoadBuffFromString(string str)
|
||||
{
|
||||
Buff = str;
|
||||
}
|
||||
private void LoadBuffFromString(string str) => Buff = str;
|
||||
private int getint()
|
||||
{
|
||||
int retval;
|
||||
@@ -381,25 +333,14 @@ namespace XYPlots
|
||||
retval = Convert.ToDouble(NextPiece());
|
||||
return retval;
|
||||
}
|
||||
private char NextChar()
|
||||
{
|
||||
return Buff[BuffPtr++];
|
||||
}
|
||||
private char NextChar() => Buff[BuffPtr++];
|
||||
private char getchr()
|
||||
{
|
||||
string nxtstring = NextPiece();
|
||||
if (nxtstring.Equals(""))
|
||||
return '\0';
|
||||
else
|
||||
return nxtstring[0];
|
||||
}
|
||||
// C2018-035 Added error Handling to provide more useful information when a plot fails
|
||||
private string _XYPlotIssue;
|
||||
public string XYPlotIssue
|
||||
{
|
||||
get { return _XYPlotIssue; }
|
||||
set { _XYPlotIssue = value; }
|
||||
return nxtstring.Equals("") ? '\0' : nxtstring[0];
|
||||
}
|
||||
|
||||
public string XYPlotIssue { get; set; }
|
||||
private point GetPair(int flag)
|
||||
{
|
||||
point retval = new point();
|
||||
@@ -489,7 +430,6 @@ namespace XYPlots
|
||||
Buff = Buff.Substring(4);
|
||||
}
|
||||
// remove an extra spaces between ><
|
||||
//Buff = Regex.Replace(Buff, @"[ ]+<", "<");
|
||||
Buff = Buff.Replace(">\r ", ">\r\n ");
|
||||
Buff = Buff.Replace(">\n ", ">\r\n "); // C2022-003 if RO has symbols
|
||||
Buff = Regex.Replace(Buff, @"[ ]+<", "<");
|
||||
@@ -595,10 +535,7 @@ namespace XYPlots
|
||||
Offset[PLOT, Y] = -Scale[PLOT, Y] * Math.Log10(minimum[Y]);
|
||||
}
|
||||
}
|
||||
private void GetAxisTitle(int flag)
|
||||
{
|
||||
AxisTitles[flag] = GetString();
|
||||
}
|
||||
private void GetAxisTitle(int flag) => AxisTitles[flag] = GetString();
|
||||
private string stripSuperSub(string instr)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder(instr);
|
||||
@@ -749,27 +686,14 @@ namespace XYPlots
|
||||
SetPenDiameter(5);
|
||||
BoxRelative(printerunits[X], printerunits[Y], CurPenWidth, pg, vgOutput);
|
||||
if (GridOnFlag == 0) Visible = 0;
|
||||
//if (vgOutput is VGOut_Graphics)
|
||||
//{
|
||||
DoGrid(X, pg, vgOutput, 1);
|
||||
DoGrid(Y, pg, vgOutput, 1);
|
||||
DoGrid(X, pg, vgOutput, 2);
|
||||
DoGrid(Y, pg, vgOutput, 2);
|
||||
DoGrid(X, pg, vgOutput, 3);
|
||||
DoGrid(Y, pg, vgOutput, 3);
|
||||
//}
|
||||
//else if (vgOutput is VGOut_C1PDF)
|
||||
//{
|
||||
// DrawDirection = Y;
|
||||
// DoGrid(X, pg, vgOutput);
|
||||
// DrawDirection = X;
|
||||
// DoGrid(Y, pg, vgOutput);
|
||||
//}
|
||||
Visible = 1;
|
||||
RecallPosition();
|
||||
// Draw outline last to overlap any grid lines.
|
||||
//SetPenDiameter(5);
|
||||
//BoxRelative(printerunits[X], printerunits[Y], CurPenWidth, pg, vgOutput);
|
||||
}
|
||||
private void DoGrid(int flag, VG.Page pg, IVGOutput vgOutput)
|
||||
{
|
||||
@@ -890,7 +814,7 @@ namespace XYPlots
|
||||
{
|
||||
if (!SubLogValue)
|
||||
DrawGridRelative((int)(-30 * ConvertToTwips), 0, pg, vgOutput);
|
||||
// OLD: MoveRelative((int)(-(15 + 300 * size / (int)FontPitch) * ConvertToTwips), (int)(-15 * ConvertToTwips));
|
||||
|
||||
MoveRelative((int)(-(14 + 250 * size / (int)FontPitch) * ConvertToTwips), (int)(-16 * ConvertToTwips));
|
||||
if ((AxisLabel[1]) != 0)
|
||||
{
|
||||
@@ -1438,10 +1362,7 @@ namespace XYPlots
|
||||
CurPenWidth = (int)(pd * ConvertToTwips);
|
||||
}
|
||||
}
|
||||
private void PrintStackError(string relation, int limit)
|
||||
{
|
||||
MessageBox.Show(String.Format("Position Stack Pointer {0} {1}", relation, limit.ToString()), "Print Stack Error");
|
||||
}
|
||||
private void PrintStackError(string relation, int limit) => MessageBox.Show(String.Format("Position Stack Pointer {0} {1}", relation, limit.ToString()), "Print Stack Error");
|
||||
private void SavePosition()
|
||||
{
|
||||
if (stack >= MAX_XY_STACK) PrintStackError(">=", MAX_XY_STACK);
|
||||
@@ -1454,14 +1375,8 @@ namespace XYPlots
|
||||
Position[X] = SavedX[--stack];
|
||||
Position[Y] = SavedY[stack];
|
||||
}
|
||||
private void MoveTo(point pnt)
|
||||
{
|
||||
MoveAbsolute(pnt.xyValue[X], pnt.xyValue[Y]);
|
||||
}
|
||||
private void DrawTo(point pnt, VG.Page pg, IVGOutput vgOutput)
|
||||
{
|
||||
DrawAbsolute(pnt.xyValue[X], pnt.xyValue[Y], pg, vgOutput);
|
||||
}
|
||||
private void MoveTo(point pnt) => MoveAbsolute(pnt.xyValue[X], pnt.xyValue[Y]);
|
||||
private void DrawTo(point pnt, VG.Page pg, IVGOutput vgOutput) => DrawAbsolute(pnt.xyValue[X], pnt.xyValue[Y], pg, vgOutput);
|
||||
private void MoveAbsolute(int ptx, int pty)
|
||||
{
|
||||
int x, y;
|
||||
@@ -1483,10 +1398,7 @@ namespace XYPlots
|
||||
y = Position[Y] - pty;
|
||||
DrawGridRelative(x, y, pg, vgOutput);
|
||||
}
|
||||
private void relval(string ptr, int i)
|
||||
{
|
||||
ptr = string.Format("+{0}", i.ToString());
|
||||
}
|
||||
private void relval(string ptr, int i) => ptr = string.Format("+{0}", i.ToString());
|
||||
private void MoveRelative(int x, int y)
|
||||
{
|
||||
Position[X] += x;
|
||||
@@ -1760,14 +1672,8 @@ namespace XYPlots
|
||||
GraphText(tstr.ToString(), pg, vgOutput);
|
||||
RecallPosition();
|
||||
}
|
||||
private void FreeBoxList()
|
||||
{
|
||||
AllBoxes.Clear();
|
||||
}
|
||||
private void FreeLineList()
|
||||
{
|
||||
AllPlots.Clear();
|
||||
}
|
||||
private void FreeBoxList() => AllBoxes.Clear();
|
||||
private void FreeLineList() => AllPlots.Clear();
|
||||
private void Init_Graphic_Vars()
|
||||
{
|
||||
int i;
|
||||
@@ -1923,18 +1829,9 @@ namespace XYPlots
|
||||
//VG.VG_Arc.iColor = 0;
|
||||
//#endif
|
||||
}
|
||||
private int _OffsetX = 0;
|
||||
public int OffsetX
|
||||
{
|
||||
get { return _OffsetX; }
|
||||
set { _OffsetX = value; }
|
||||
}
|
||||
private int _OffsetY = 0;
|
||||
public int OffsetY
|
||||
{
|
||||
get { return _OffsetY; }
|
||||
set { _OffsetY = value; }
|
||||
}
|
||||
|
||||
public int OffsetX { get; set; } = 0;
|
||||
public int OffsetY { get; set; } = 0;
|
||||
public void Setup()
|
||||
{
|
||||
char Command, PrevCommand = ' ';
|
||||
@@ -2014,7 +1911,7 @@ namespace XYPlots
|
||||
step = "FreeLineList";FreeLineList();
|
||||
step = "CloseGraph";CloseGraph();
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
_MyLog.WarnFormat("X/Y Plot Error - {0} - {1} - {2}", step, XYPlotIssue ?? "Unknown Issue");
|
||||
throw new Exception(String.Format("X/Y Plot Error - {0} - {1}",step,XYPlotIssue ?? "Unknown Issue"));
|
||||
|
||||
@@ -1,17 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Drawing.Printing;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
using VG;
|
||||
//using XYPlots;
|
||||
|
||||
namespace XYPlots
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user