|
|
|
@ -37,13 +37,12 @@ namespace ICSharpCode.Reporting.Pdf
@@ -37,13 +37,12 @@ namespace ICSharpCode.Reporting.Pdf
|
|
|
|
|
XTextFormatter textFormatter; |
|
|
|
|
Point containerLocation; |
|
|
|
|
|
|
|
|
|
public PdfVisitor(PdfDocument pdfDocument) |
|
|
|
|
{ |
|
|
|
|
public PdfVisitor(PdfDocument pdfDocument){ |
|
|
|
|
this.pdfDocument = pdfDocument; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public override void Visit(ExportPage page) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
public override void Visit(ExportPage page){ |
|
|
|
|
PdfPage = pdfDocument.AddPage(); |
|
|
|
|
xGraphics = XGraphics.FromPdfPage(PdfPage); |
|
|
|
|
textFormatter = new XTextFormatter(xGraphics); |
|
|
|
@ -52,7 +51,6 @@ namespace ICSharpCode.Reporting.Pdf
@@ -52,7 +51,6 @@ namespace ICSharpCode.Reporting.Pdf
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override void Visit(ExportContainer exportContainer){ |
|
|
|
|
|
|
|
|
|
foreach (var element in exportContainer.ExportedItems) { |
|
|
|
|
if (IsContainer(element)) { |
|
|
|
|
var container = element as ExportContainer; |
|
|
|
@ -67,8 +65,7 @@ namespace ICSharpCode.Reporting.Pdf
@@ -67,8 +65,7 @@ namespace ICSharpCode.Reporting.Pdf
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void RenderRow(IExportContainer container) |
|
|
|
|
{ |
|
|
|
|
void RenderRow(IExportContainer container){ |
|
|
|
|
if (IsGraphicsContainer(container)) { |
|
|
|
|
RenderGraphicsContainer(container); |
|
|
|
|
} else { |
|
|
|
@ -77,8 +74,7 @@ namespace ICSharpCode.Reporting.Pdf
@@ -77,8 +74,7 @@ namespace ICSharpCode.Reporting.Pdf
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void RenderGraphicsContainer(IExportColumn column) |
|
|
|
|
{ |
|
|
|
|
void RenderGraphicsContainer(IExportColumn column){ |
|
|
|
|
var graphicsContainer = column as GraphicsContainer; |
|
|
|
|
if (graphicsContainer != null) { |
|
|
|
|
var rect = column as ExportRectangle; |
|
|
|
@ -97,8 +93,9 @@ namespace ICSharpCode.Reporting.Pdf
@@ -97,8 +93,9 @@ namespace ICSharpCode.Reporting.Pdf
|
|
|
|
|
void RenderDataRow (IExportContainer row) { |
|
|
|
|
var r = new Rectangle(containerLocation,row.DisplayRectangle.Size); |
|
|
|
|
PdfHelper.FillRectangle(r,row.BackColor,xGraphics); |
|
|
|
|
foreach (IAcceptor element in row.ExportedItems) { |
|
|
|
|
element.Accept(this); |
|
|
|
|
foreach (var element in row.ExportedItems) { |
|
|
|
|
var acceptor = element as IAcceptor; |
|
|
|
|
acceptor.Accept(this); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -117,34 +114,72 @@ namespace ICSharpCode.Reporting.Pdf
@@ -117,34 +114,72 @@ namespace ICSharpCode.Reporting.Pdf
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override void Visit(ExportLine exportLine) |
|
|
|
|
{ |
|
|
|
|
var columnLocation = containerLocation; |
|
|
|
|
columnLocation.Offset(exportLine.Location); |
|
|
|
|
var pen = PdfHelper.CreateDashedPen(exportLine); |
|
|
|
|
var pen = PdfHelper.CreatePen(exportLine); |
|
|
|
|
xGraphics.DrawLine(pen,columnLocation.ToXPoints(),new Point(exportLine.Size.Width,columnLocation.Y).ToXPoints()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override void Visit (ExportRectangle exportRectangle) { |
|
|
|
|
var pen = PdfHelper.CreateDashedPen(exportRectangle); |
|
|
|
|
xGraphics.DrawRectangle(pen, |
|
|
|
|
PdfHelper.CreateBrush(exportRectangle.BackColor), |
|
|
|
|
new XRect(containerLocation.ToXPoints(), |
|
|
|
|
exportRectangle.Size.ToXSize())); |
|
|
|
|
var savedLocation = containerLocation; |
|
|
|
|
xGraphics.DrawRectangle(PdfHelper.CreatePen(exportRectangle), |
|
|
|
|
PdfHelper.CreateBrush(exportRectangle.BackColor), |
|
|
|
|
new XRect(containerLocation.ToXPoints(), |
|
|
|
|
exportRectangle.Size.ToXSize())); |
|
|
|
|
|
|
|
|
|
if (exportRectangle.ExportedItems.Count > 0) { |
|
|
|
|
/* |
|
|
|
|
foreach (var element in exportRectangle.ExportedItems) { |
|
|
|
|
if (IsGraphicsContainer(element)) { |
|
|
|
|
var loc = new Point(containerLocation.X + element.Location.X, |
|
|
|
|
containerLocation.Y + element.Location.Y); |
|
|
|
|
|
|
|
|
|
containerLocation =loc; |
|
|
|
|
RenderGraphicsContainer(element); |
|
|
|
|
containerLocation = savedLocation; |
|
|
|
|
} else { |
|
|
|
|
var acceptor = AsAcceptor(element); |
|
|
|
|
acceptor.Accept(this); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
*/ |
|
|
|
|
RenderContainerInternal(exportRectangle,savedLocation); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override void Visit(ExportCircle exportCircle){ |
|
|
|
|
var pen = PdfHelper.CreateDashedPen(exportCircle); |
|
|
|
|
var savedLocation = containerLocation; |
|
|
|
|
var pen = PdfHelper.CreatePen(exportCircle); |
|
|
|
|
xGraphics.DrawEllipse(pen, |
|
|
|
|
PdfHelper.CreateBrush(exportCircle.BackColor) , |
|
|
|
|
new XRect(containerLocation.ToXPoints(), |
|
|
|
|
exportCircle.Size.ToXSize())); |
|
|
|
|
PdfHelper.CreateBrush(exportCircle.BackColor) , |
|
|
|
|
new XRect(containerLocation.ToXPoints(), |
|
|
|
|
exportCircle.Size.ToXSize())); |
|
|
|
|
if (exportCircle.ExportedItems.Count > 0) { |
|
|
|
|
RenderContainerInternal (exportCircle,savedLocation); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void RenderContainerInternal(IExportContainer graphicsContainer,Point savedLocation) |
|
|
|
|
{ |
|
|
|
|
foreach (var element in graphicsContainer.ExportedItems) { |
|
|
|
|
if (IsGraphicsContainer(element)) { |
|
|
|
|
var loc = new Point(containerLocation.X + element.Location.X, |
|
|
|
|
containerLocation.Y + element.Location.Y); |
|
|
|
|
containerLocation = loc; |
|
|
|
|
RenderGraphicsContainer(element); |
|
|
|
|
containerLocation = savedLocation; |
|
|
|
|
} else { |
|
|
|
|
var acceptor = AsAcceptor(element); |
|
|
|
|
acceptor.Accept(this); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public PdfPage PdfPage {get; private set;} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|