|
|
|
@ -16,8 +16,10 @@
@@ -16,8 +16,10 @@
|
|
|
|
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
|
// DEALINGS IN THE SOFTWARE.
|
|
|
|
|
|
|
|
|
|
using System; |
|
|
|
|
using System.Drawing; |
|
|
|
|
using ICSharpCode.Reporting.Exporter.Visitors; |
|
|
|
|
using ICSharpCode.Reporting.Interfaces.Export; |
|
|
|
|
using ICSharpCode.Reporting.PageBuilder.ExportColumns; |
|
|
|
|
using PdfSharp.Drawing; |
|
|
|
|
using PdfSharp.Drawing.Layout; |
|
|
|
@ -49,27 +51,59 @@ namespace ICSharpCode.Reporting.Pdf
@@ -49,27 +51,59 @@ namespace ICSharpCode.Reporting.Pdf
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override void Visit(ExportContainer exportContainer) |
|
|
|
|
{ |
|
|
|
|
public override void Visit(ExportContainer exportContainer){ |
|
|
|
|
foreach (var element in exportContainer.ExportedItems) { |
|
|
|
|
var container = element as ExportContainer; |
|
|
|
|
if (container != null) { |
|
|
|
|
if (IsContainer(element)) { |
|
|
|
|
var container = element as ExportContainer; |
|
|
|
|
containerLocation = PdfHelper.LocationRelToParent(container); |
|
|
|
|
var r = new Rectangle(containerLocation,container.DisplayRectangle.Size); |
|
|
|
|
PdfHelper.FillRectangle(r,container.BackColor,gfx); |
|
|
|
|
Visit(container); |
|
|
|
|
RenderRow(container); |
|
|
|
|
} else { |
|
|
|
|
containerLocation = PdfHelper.LocationRelToParent(exportContainer); |
|
|
|
|
var acceptor = element as IAcceptor; |
|
|
|
|
acceptor.Accept(this); |
|
|
|
|
} |
|
|
|
|
containerLocation = PdfHelper.LocationRelToParent(exportContainer); |
|
|
|
|
var ac = element as IAcceptor; |
|
|
|
|
ac.Accept(this); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override void Visit(ExportText exportText) |
|
|
|
|
void RenderRow(IExportContainer container) |
|
|
|
|
{ |
|
|
|
|
var columnLocation = containerLocation; |
|
|
|
|
columnLocation.Offset(exportText.Location); |
|
|
|
|
if (IsGraphicsContainer(container)) { |
|
|
|
|
RenderGraphicsContainer(container); |
|
|
|
|
} else { |
|
|
|
|
RenderDataRow(container); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void RenderGraphicsContainer(IExportColumn column) |
|
|
|
|
{ |
|
|
|
|
var graphicsContainer = column as GraphicsContainer; |
|
|
|
|
if (graphicsContainer != null) { |
|
|
|
|
var rect = column as ExportRectangle; |
|
|
|
|
if (rect != null) { |
|
|
|
|
Visit(rect); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var circle = column as ExportCircle; |
|
|
|
|
if (circle != null) { |
|
|
|
|
Visit(circle); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void RenderDataRow (IExportContainer row) { |
|
|
|
|
|
|
|
|
|
System.Console.WriteLine("renderDataRow at {0} - {1}",containerLocation,row.Location); |
|
|
|
|
foreach (IAcceptor element in row.ExportedItems) { |
|
|
|
|
element.Accept(this); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override void Visit(ExportText exportText){ |
|
|
|
|
var columnLocation = new Point(containerLocation.X + exportText.Location.X,containerLocation.Y + exportText.Location.Y); |
|
|
|
|
if (ShouldSetBackcolor(exportText)) { |
|
|
|
|
var r = new Rectangle(columnLocation,exportText.DisplayRectangle.Size); |
|
|
|
|
PdfHelper.FillRectangle(r,exportText.BackColor,gfx); |
|
|
|
@ -92,22 +126,30 @@ namespace ICSharpCode.Reporting.Pdf
@@ -92,22 +126,30 @@ namespace ICSharpCode.Reporting.Pdf
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override void Visit (ExportRectangle exportRectangle) { |
|
|
|
|
var columnLocation = containerLocation; |
|
|
|
|
columnLocation.Offset(exportRectangle.Location); |
|
|
|
|
var pen = PdfHelper.PdfPen(exportRectangle); |
|
|
|
|
pen.DashStyle = PdfHelper.DashStyle(exportRectangle); |
|
|
|
|
gfx.DrawRectangle(pen,new XRect(columnLocation.ToXPoints(), |
|
|
|
|
// var columnLocation = containerLocation;
|
|
|
|
|
var pen = CreateDashedPen(exportRectangle); |
|
|
|
|
gfx.DrawRectangle(pen, |
|
|
|
|
PdfHelper.CreateBrush(exportRectangle.BackColor), |
|
|
|
|
new XRect(containerLocation.ToXPoints(), |
|
|
|
|
exportRectangle.Size.ToXSize())); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override void Visit(ExportCircle exportCircle){ |
|
|
|
|
var columnLocation = containerLocation; |
|
|
|
|
columnLocation.Offset(exportCircle.Location); |
|
|
|
|
var pen = PdfHelper.PdfPen(exportCircle); |
|
|
|
|
pen.DashStyle = PdfHelper.DashStyle(exportCircle); |
|
|
|
|
gfx.DrawEllipse(pen,new XRect(columnLocation.ToXPoints(), |
|
|
|
|
exportCircle.Size.ToXSize())); |
|
|
|
|
// var columnLocation = containerLocation;
|
|
|
|
|
var pen = CreateDashedPen(exportCircle); |
|
|
|
|
gfx.DrawEllipse(pen, |
|
|
|
|
PdfHelper.CreateBrush(exportCircle.BackColor) , |
|
|
|
|
new XRect(containerLocation.ToXPoints(), |
|
|
|
|
exportCircle.Size.ToXSize())); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static XPen CreateDashedPen(IExportGraphics exportRectangle) |
|
|
|
|
{ |
|
|
|
|
var pen = PdfHelper.PdfPen(exportRectangle); |
|
|
|
|
pen.DashStyle = PdfHelper.DashStyle(exportRectangle); |
|
|
|
|
return pen; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|