180 changed files with 6769 additions and 634 deletions
@ -0,0 +1,39 @@
@@ -0,0 +1,39 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 19.03.2013 |
||||
* Time: 19:14 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.IO; |
||||
using System.Reflection; |
||||
|
||||
using NUnit.Framework; |
||||
|
||||
namespace ICSharpCode.Reporting.Tests.Factory |
||||
{ |
||||
[TestFixture] |
||||
public class ReportingFactoryFixture |
||||
{ |
||||
private const string nS = "ICSharpCode.Reporting.Tests.TestReports."; |
||||
private const string reportName = "PlainModel.srd"; |
||||
private Stream stream; |
||||
|
||||
[Test] |
||||
public void CreateFormSheetBuilder() |
||||
{ |
||||
var r = new ReportingFactory(); |
||||
var x = r.CreatePageBuilder(stream); |
||||
Assert.That(x,Is.Null); |
||||
} |
||||
|
||||
[SetUp] |
||||
public void LoadFromStream() |
||||
{ |
||||
System.Reflection.Assembly asm = Assembly.GetExecutingAssembly(); |
||||
stream = asm.GetManifestResourceStream(nS + reportName); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,86 @@
@@ -0,0 +1,86 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 19.03.2013 |
||||
* Time: 19:58 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.IO; |
||||
using System.Reflection; |
||||
|
||||
using ICSharpCode.Reporting.Globals; |
||||
using NUnit.Framework; |
||||
|
||||
namespace ICSharpCode.Reporting.Tests.Model |
||||
{ |
||||
[TestFixture] |
||||
public class LoadPlainModelFixture |
||||
{ |
||||
private const string nS = "ICSharpCode.Reporting.Tests.TestReports."; |
||||
private const string reportName = "PlainModel.srd"; |
||||
private Stream stream; |
||||
|
||||
[Test] |
||||
public void CanLoadFromResource() |
||||
{ |
||||
Assert.IsNotNull(stream); |
||||
} |
||||
|
||||
|
||||
[Test] |
||||
public void LoadPlainModel() |
||||
{ |
||||
var rf = new ReportingFactory(); |
||||
var model = rf.LoadReportModel(stream); |
||||
Assert.IsNotNull(model); |
||||
} |
||||
|
||||
|
||||
[Test] |
||||
public void ReportSettingsFromPlainModel() |
||||
{ |
||||
var rf = new ReportingFactory(); |
||||
var model = rf.LoadReportModel(stream); |
||||
Assert.That(model.ReportSettings,Is.Not.Null); |
||||
} |
||||
|
||||
|
||||
[Test] |
||||
public void ReportSettingsReportName() |
||||
{ |
||||
var rf = new ReportingFactory(); |
||||
var model = rf.LoadReportModel(stream); |
||||
Assert.That(model.ReportSettings.ReportName,Is.EqualTo(Globals.GlobalValues.DefaultReportName)); |
||||
} |
||||
|
||||
|
||||
[Test] |
||||
public void ReportSettingsDataModelFormSheet() |
||||
{ |
||||
var rf = new ReportingFactory(); |
||||
var model = rf.LoadReportModel(stream); |
||||
Assert.That(model.ReportSettings.DataModel,Is.EqualTo(GlobalEnums.PushPullModel.FormSheet)); |
||||
} |
||||
|
||||
[Test] |
||||
public void ReportSettingsPageSize() |
||||
{ |
||||
var rf = new ReportingFactory(); |
||||
var model = rf.LoadReportModel(stream); |
||||
Assert.That(model.ReportSettings.PageSize,Is.EqualTo(Globals.GlobalValues.DefaultPageSize)); |
||||
} |
||||
|
||||
|
||||
|
||||
[SetUp] |
||||
public void LoadFromStream() |
||||
{ |
||||
System.Reflection.Assembly asm = Assembly.GetExecutingAssembly(); |
||||
stream = asm.GetManifestResourceStream(nS + reportName); |
||||
} |
||||
|
||||
|
||||
} |
||||
} |
@ -0,0 +1,48 @@
@@ -0,0 +1,48 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 19.03.2013 |
||||
* Time: 19:02 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using ICSharpCode.Reporting.Items; |
||||
using NUnit.Framework; |
||||
|
||||
namespace ICSharpCode.Reporting.Tests.Model |
||||
{ |
||||
[TestFixture] |
||||
public class ReportModelFixture |
||||
{ |
||||
private ReportModel model; |
||||
|
||||
[Test] |
||||
public void CanCreateReportModel() |
||||
{ |
||||
Assert.That(model,Is.Not.Null); |
||||
} |
||||
|
||||
|
||||
[Test] |
||||
public void ModelInitializeReportSettings() |
||||
{ |
||||
Assert.That(model.ReportSettings,Is.Not.Null); |
||||
} |
||||
|
||||
|
||||
[Test] |
||||
public void ModelReturnsPlainReportName() |
||||
{ |
||||
Assert.That(model.ReportSettings.ReportName,Is.EqualTo(Globals.GlobalValues.DefaultReportName)); |
||||
} |
||||
|
||||
|
||||
[SetUp] |
||||
public void CreateModel() |
||||
{ |
||||
model = ReportModel.Create(); |
||||
} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,51 @@
@@ -0,0 +1,51 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 19.03.2013 |
||||
* Time: 19:10 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Drawing; |
||||
using ICSharpCode.Reporting.Globals; |
||||
using ICSharpCode.Reporting.Items; |
||||
using NUnit.Framework; |
||||
|
||||
namespace ICSharpCode.Reporting.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class ReportSettingsFixture |
||||
{ |
||||
ReportSettings reportSettings; |
||||
|
||||
[Test] |
||||
public void DefaultConstructureShouldReturnStandardValues() |
||||
{ |
||||
Assert.IsNotNull(reportSettings,"Should not be 'null'"); |
||||
Assert.AreEqual(GlobalValues.DefaultReportName,reportSettings.ReportName); |
||||
} |
||||
|
||||
|
||||
[Test] |
||||
public void DefaultPageSize () |
||||
{ |
||||
Assert.AreEqual(GlobalValues.DefaultPageSize,reportSettings.PageSize); |
||||
} |
||||
|
||||
|
||||
[Test] |
||||
public void LandScape_True_Return_PageSize_For_LandScape () |
||||
{ |
||||
reportSettings.Landscape = true; |
||||
var landscapeSize = new Size(Globals.GlobalValues.DefaultPageSize.Height, |
||||
Globals.GlobalValues.DefaultPageSize.Width); |
||||
Assert.That(reportSettings.PageSize,Is.EqualTo(landscapeSize)); |
||||
} |
||||
|
||||
[SetUp] |
||||
public void Setup () { |
||||
reportSettings = new ReportSettings(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,86 @@
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<ReportModel> |
||||
<ReportSettings> |
||||
<ReportSettings> |
||||
<DefaultFont>Microsoft Sans Serif, 10pt</DefaultFont> |
||||
<DataModel>FormSheet</DataModel> |
||||
<FileName>D:\SharpDevelop3.0_CHECKOUT\SharpDevelop\bin\Raaaaaeport1.srd</FileName> |
||||
<RightMargin>50</RightMargin> |
||||
<UseStandardPrinter>True</UseStandardPrinter> |
||||
<SortColumnCollection /> |
||||
<AvailableFieldsCollection /> |
||||
<NoDataMessage>No Data for this Report</NoDataMessage> |
||||
<LeftMargin>50</LeftMargin> |
||||
<PageSize>827, 1169</PageSize> |
||||
<Padding>5, 5, 5, 5</Padding> |
||||
<BottomMargin>50</BottomMargin> |
||||
<CommandType>Text</CommandType> |
||||
<ParameterCollection /> |
||||
<Landscape>False</Landscape> |
||||
<ReportName>Report1</ReportName> |
||||
<TopMargin>50</TopMargin> |
||||
<GroupColumnsCollection /> |
||||
<GraphicsUnit>Millimeter</GraphicsUnit> |
||||
<CommandText /> |
||||
<ReportType>FormSheet</ReportType> |
||||
<ConnectionString /> |
||||
</ReportSettings> |
||||
</ReportSettings> |
||||
<SectionCollection> |
||||
<BaseSection> |
||||
<Size>727, 60</Size> |
||||
<Name>ReportHeader</Name> |
||||
<PageBreakAfter>False</PageBreakAfter> |
||||
<SectionMargin>0</SectionMargin> |
||||
<SectionOffset>0</SectionOffset> |
||||
<BackColor>White</BackColor> |
||||
<Items /> |
||||
<Location>50, 50</Location> |
||||
<DrawBorder>False</DrawBorder> |
||||
</BaseSection> |
||||
<BaseSection> |
||||
<Size>727, 60</Size> |
||||
<Name>ReportPageHeader</Name> |
||||
<PageBreakAfter>False</PageBreakAfter> |
||||
<SectionMargin>0</SectionMargin> |
||||
<SectionOffset>0</SectionOffset> |
||||
<BackColor>White</BackColor> |
||||
<Items /> |
||||
<Location>50, 125</Location> |
||||
<DrawBorder>False</DrawBorder> |
||||
</BaseSection> |
||||
<BaseSection> |
||||
<Size>727, 60</Size> |
||||
<Name>ReportDetail</Name> |
||||
<PageBreakAfter>False</PageBreakAfter> |
||||
<SectionMargin>0</SectionMargin> |
||||
<SectionOffset>0</SectionOffset> |
||||
<BackColor>White</BackColor> |
||||
<Items /> |
||||
<Location>50, 200</Location> |
||||
<DrawBorder>False</DrawBorder> |
||||
</BaseSection> |
||||
<BaseSection> |
||||
<Size>727, 60</Size> |
||||
<Name>ReportPageFooter</Name> |
||||
<PageBreakAfter>False</PageBreakAfter> |
||||
<SectionMargin>0</SectionMargin> |
||||
<SectionOffset>0</SectionOffset> |
||||
<BackColor>White</BackColor> |
||||
<Items /> |
||||
<Location>50, 275</Location> |
||||
<DrawBorder>False</DrawBorder> |
||||
</BaseSection> |
||||
<BaseSection> |
||||
<Size>727, 60</Size> |
||||
<Name>ReportFooter</Name> |
||||
<PageBreakAfter>False</PageBreakAfter> |
||||
<SectionMargin>0</SectionMargin> |
||||
<SectionOffset>0</SectionOffset> |
||||
<BackColor>White</BackColor> |
||||
<Items /> |
||||
<Location>50, 350</Location> |
||||
<DrawBorder>False</DrawBorder> |
||||
</BaseSection> |
||||
</SectionCollection> |
||||
</ReportModel> |
@ -0,0 +1,170 @@
@@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build"> |
||||
<PropertyGroup> |
||||
<ProjectGuid>{40CA84D4-ACFC-4646-9CDD-B87262D34093}</ProjectGuid> |
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||
<OutputType>Library</OutputType> |
||||
<RootNamespace>ICSharpCode.Reporting</RootNamespace> |
||||
<AssemblyName>ICSharpCode.Reporting</AssemblyName> |
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> |
||||
<TargetFrameworkProfile> |
||||
</TargetFrameworkProfile> |
||||
<AppDesignerFolder>Properties</AppDesignerFolder> |
||||
<NoWin32Manifest>False</NoWin32Manifest> |
||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
||||
<NoStdLib>False</NoStdLib> |
||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors> |
||||
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath> |
||||
<WarningLevel>4</WarningLevel> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' "> |
||||
<PlatformTarget>AnyCPU</PlatformTarget> |
||||
<BaseAddress>4194304</BaseAddress> |
||||
<Prefer32Bit>False</Prefer32Bit> |
||||
<RegisterForComInterop>False</RegisterForComInterop> |
||||
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> |
||||
<FileAlignment>4096</FileAlignment> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> |
||||
<OutputPath>..\..\..\..\..\AddIns\Misc\SharpDevelopReporting\</OutputPath> |
||||
<DebugSymbols>True</DebugSymbols> |
||||
<DebugType>Full</DebugType> |
||||
<Optimize>False</Optimize> |
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
||||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
||||
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
||||
<OutputPath>bin\Release\</OutputPath> |
||||
<DebugSymbols>False</DebugSymbols> |
||||
<DebugType>None</DebugType> |
||||
<Optimize>True</Optimize> |
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
||||
<DefineConstants>TRACE</DefineConstants> |
||||
</PropertyGroup> |
||||
<ItemGroup> |
||||
<Reference Include="PresentationCore"> |
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="PresentationFramework"> |
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System" /> |
||||
<Reference Include="System.Core"> |
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System.Drawing" /> |
||||
<Reference Include="System.Windows.Presentation"> |
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System.Xaml"> |
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System.Xml" /> |
||||
<Reference Include="System.Xml.Linq"> |
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="WindowsBase"> |
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
||||
</Reference> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Compile Include="Src\Arrange\ArrangeStrategy.cs" /> |
||||
<Compile Include="Src\Arrange\MeasurementStrategy.cs" /> |
||||
<Compile Include="Src\BaseClasses\AbstractColumn.cs" /> |
||||
<Compile Include="Src\BaseClasses\GroupColumn.cs" /> |
||||
<Compile Include="Src\BaseClasses\Page.cs" /> |
||||
<Compile Include="Src\BaseClasses\PageInfo.cs" /> |
||||
<Compile Include="Src\BaseClasses\SortColumn.cs" /> |
||||
<Compile Include="Src\Collections.cs" /> |
||||
<Compile Include="Src\Configuration\AssemblyInfo.cs" /> |
||||
<Compile Include="Src\DataManager\Listhandling\CollectionSource.cs" /> |
||||
<Compile Include="Src\DataManager\Listhandling\IndexList.cs" /> |
||||
<Compile Include="Src\DataSource\Comparer\BaseComparer.cs" /> |
||||
<Compile Include="Src\DataSource\Comparer\GroupComparer.cs" /> |
||||
<Compile Include="Src\DataSource\Comparer\SortComparer.cs" /> |
||||
<Compile Include="Src\DataSource\Comparer\SortExtension.cs" /> |
||||
<Compile Include="Src\DataSource\DataCollection.cs" /> |
||||
<Compile Include="Src\DataSource\ExtendedPropertyDescriptor.cs" /> |
||||
<Compile Include="Src\DataSource\ExtendedTypeDescriptor.cs" /> |
||||
<Compile Include="Src\DataSource\PropertyTypeHash.cs" /> |
||||
<Compile Include="Src\Exporter\BaseExporter.cs" /> |
||||
<Compile Include="Src\Exporter\DebugExporter.cs" /> |
||||
<Compile Include="Src\Exporter\WpfExporter.cs" /> |
||||
<Compile Include="Src\Exporter\Visitors\AbstractVisitor.cs" /> |
||||
<Compile Include="Src\Exporter\Visitors\IAcceptor.cs" /> |
||||
<Compile Include="Src\Exporter\Visitors\IVisitor.cs" /> |
||||
<Compile Include="Src\Exporter\Visitors\DebugVisitor.cs" /> |
||||
<Compile Include="Src\Exporter\Visitors\WpfVisitor.cs" /> |
||||
<Compile Include="Src\ExportRenderer\FixedDocumentCreator.cs" /> |
||||
<Compile Include="Src\Factories\ExportColumnFactory.cs" /> |
||||
<Compile Include="Src\Factories\ReportCreatorFactory.cs" /> |
||||
<Compile Include="Src\Factories\SectionFactory.cs" /> |
||||
<Compile Include="Src\Globals\CreateGraphics.cs" /> |
||||
<Compile Include="Src\Globals\MeasurementService.cs" /> |
||||
<Compile Include="Src\Interfaces\Data\IDataViewHandling.cs" /> |
||||
<Compile Include="Src\Interfaces\Export\IExportColumn.cs" /> |
||||
<Compile Include="Src\Interfaces\Export\IExportContainer.cs" /> |
||||
<Compile Include="Src\Interfaces\Export\IPage.cs" /> |
||||
<Compile Include="Src\Interfaces\Export\IPageInfo.cs" /> |
||||
<Compile Include="Src\Interfaces\IDataItem.cs" /> |
||||
<Compile Include="Src\Interfaces\IPrintableObject.cs" /> |
||||
<Compile Include="Src\Interfaces\IReportContainer.cs" /> |
||||
<Compile Include="Src\Interfaces\IReportCreator.cs" /> |
||||
<Compile Include="Src\Items\BaseDataItem.cs" /> |
||||
<Compile Include="Src\Items\BaseSection.cs" /> |
||||
<Compile Include="Src\Globals\GlobalEnums.cs" /> |
||||
<Compile Include="Src\Globals\GlobalValues.cs" /> |
||||
<Compile Include="Src\Interfaces\IReportModel.cs" /> |
||||
<Compile Include="Src\Items\BaseTextItem.cs" /> |
||||
<Compile Include="Src\Items\PrintableItem.cs" /> |
||||
<Compile Include="Src\Items\ReportContainer.cs" /> |
||||
<Compile Include="Src\Items\ReportModel.cs" /> |
||||
<Compile Include="Src\Items\ReportSettings.cs" /> |
||||
<Compile Include="Src\PageBuilder\BasePageBuilder.cs" /> |
||||
<Compile Include="Src\PageBuilder\Converter\ContainerConverter.cs" /> |
||||
<Compile Include="Src\PageBuilder\DataPageBuilder.cs" /> |
||||
<Compile Include="Src\PageBuilder\ExportColumns\ExportColumn.cs" /> |
||||
<Compile Include="Src\PageBuilder\ExportColumns\ExportContainer.cs" /> |
||||
<Compile Include="Src\PageBuilder\ExportColumns\ExportText.cs" /> |
||||
<Compile Include="Src\PageBuilder\FormPageBuilder.cs" /> |
||||
<Compile Include="Src\ReportingFactory.cs" /> |
||||
<Compile Include="Src\Wpf\PreviewViewModel.cs" /> |
||||
<Compile Include="Src\Wpf\WpfReportViewer\WpfReportViewer.xaml.cs"> |
||||
<DependentUpon>WpfReportViewer.xaml</DependentUpon> |
||||
<SubType>Code</SubType> |
||||
</Compile> |
||||
<Compile Include="Src\Xml\ModelLoader.cs" /> |
||||
<Compile Include="Src\Xml\MycroParser.cs" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Folder Include="Src\DataSource\Comparer" /> |
||||
<Folder Include="Src\Exporter\Visitors" /> |
||||
<Folder Include="Src\Interfaces" /> |
||||
<Folder Include="Src\Globals" /> |
||||
<Folder Include="Src" /> |
||||
<Folder Include="Src" /> |
||||
<Folder Include="Src\Interfaces\Export" /> |
||||
<Folder Include="Src\Interfaces\Data" /> |
||||
<Folder Include="Src\Items" /> |
||||
<Folder Include="Src\BaseClasses" /> |
||||
<Folder Include="Src\Factories" /> |
||||
<Folder Include="Src\Exporter" /> |
||||
<Folder Include="Src\Arrange" /> |
||||
<Folder Include="Src\ExportRenderer" /> |
||||
<Folder Include="Src\DataSource" /> |
||||
<Folder Include="Src\DataManager" /> |
||||
<Folder Include="Src\DataManager\Listhandling" /> |
||||
<Folder Include="Src\Wpf" /> |
||||
<Folder Include="Src\PageBuilder" /> |
||||
<Folder Include="Src\PageBuilder\Converter" /> |
||||
<Folder Include="Src\PageBuilder\ExportColumns" /> |
||||
<Folder Include="Src\Wpf\WpfReportViewer" /> |
||||
<Folder Include="Src\Xml" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Page Include="Src\Wpf\WpfReportViewer\WpfReportViewer.xaml" /> |
||||
</ItemGroup> |
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
||||
</Project> |
@ -0,0 +1,83 @@
@@ -0,0 +1,83 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 11.05.2013 |
||||
* Time: 19:56 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Drawing; |
||||
using System.Linq; |
||||
|
||||
using ICSharpCode.Reporting.Interfaces.Export; |
||||
|
||||
namespace ICSharpCode.Reporting.Arrange |
||||
{ |
||||
/// <summary>
|
||||
/// Description of ArrangeStrategy.
|
||||
/// </summary>
|
||||
///
|
||||
public interface IArrangeStrategy |
||||
{ |
||||
void Arrange(IExportColumn exportColumn); |
||||
} |
||||
|
||||
|
||||
internal class ContainerArrangeStrategy:IArrangeStrategy |
||||
{ |
||||
public ContainerArrangeStrategy() |
||||
{ |
||||
} |
||||
|
||||
|
||||
public void Arrange(IExportColumn exportColumn) |
||||
{ |
||||
if (exportColumn == null) |
||||
throw new ArgumentNullException("exportColumn"); |
||||
var container = exportColumn as IExportContainer; |
||||
if ((container != null) && (container.ExportedItems.Count > 0)) { |
||||
|
||||
|
||||
FindBiggestRectangle(container); |
||||
var resizeable = from resize in container.ExportedItems |
||||
where ((resize.CanGrow == true)) |
||||
select resize; |
||||
|
||||
if (resizeable.Any()) { |
||||
if (!BiggestRectangle.IsEmpty) { |
||||
var containerRectangle = new Rectangle(container.Location,container.Size); |
||||
var desiredRectangle = Rectangle.Union(containerRectangle,BiggestRectangle); |
||||
container.DesiredSize = new Size(container.Size.Width,desiredRectangle.Size.Height + 5); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
private void FindBiggestRectangle (IExportContainer container) |
||||
{ |
||||
BiggestRectangle = Rectangle.Empty; |
||||
/* |
||||
foreach (var item in container.ExportedItems) |
||||
{ |
||||
if (item.DesiredSize.Height > BiggestRectangle.Size.Height) |
||||
{ |
||||
BiggestRectangle = new Rectangle(new Point(container.Location.X + item.Location.X, |
||||
container.Location.Y + item.Location.Y) |
||||
, item.DesiredSize); |
||||
} |
||||
} |
||||
*/ |
||||
foreach (var item in container.ExportedItems |
||||
.Where(item => item.DesiredSize.Height > BiggestRectangle.Size.Height)) |
||||
{ |
||||
BiggestRectangle = new Rectangle(new Point(container.Location.X + item.Location.X, |
||||
container.Location.Y + item.Location.Y) |
||||
,item.DesiredSize); |
||||
} |
||||
} |
||||
|
||||
public Rectangle BiggestRectangle {get; private set;} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,46 @@
@@ -0,0 +1,46 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 22.04.2013 |
||||
* Time: 19:11 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Drawing; |
||||
using ICSharpCode.Reporting.Globals; |
||||
using ICSharpCode.Reporting.Interfaces; |
||||
using ICSharpCode.Reporting.Items; |
||||
|
||||
namespace ICSharpCode.Reporting.Arrange |
||||
{ |
||||
/// <summary>
|
||||
/// Description of ArrangeStrategy.
|
||||
/// </summary>
|
||||
public interface IMeasurementStrategy |
||||
{ |
||||
Size Measure(IPrintableObject reportItem,Graphics graphics); |
||||
} |
||||
|
||||
|
||||
internal class ContainerMeasurementStrategy:IMeasurementStrategy |
||||
{ |
||||
public ContainerMeasurementStrategy() |
||||
{ |
||||
} |
||||
|
||||
public Size Measure(IPrintableObject reportItem,Graphics graphics) |
||||
{ |
||||
return reportItem.Size; |
||||
} |
||||
} |
||||
|
||||
internal class TextBasedMeasurementStrategy:IMeasurementStrategy |
||||
{ |
||||
|
||||
public Size Measure(IPrintableObject reportItem, Graphics graphics) |
||||
{ |
||||
return MeasurementService.Measure((ITextItem)reportItem,graphics); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,57 @@
@@ -0,0 +1,57 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 21.05.2013 |
||||
* Time: 20:16 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Xml.Serialization; |
||||
|
||||
namespace ICSharpCode.Reporting.BaseClasses |
||||
{ |
||||
/// <summary>
|
||||
/// Description of AbstractColumn.
|
||||
/// </summary>
|
||||
public class AbstractColumn |
||||
{ |
||||
private Type dataType; |
||||
private string dataTypeName; |
||||
|
||||
public AbstractColumn() { |
||||
this.dataType = typeof(System.String); |
||||
} |
||||
|
||||
|
||||
public AbstractColumn(string columnName, Type dataType){ |
||||
this.ColumnName = columnName; |
||||
this.dataType = dataType; |
||||
} |
||||
|
||||
public string ColumnName {get;set;} |
||||
|
||||
|
||||
|
||||
public string DataTypeName { |
||||
get { |
||||
return this.dataType.ToString(); |
||||
} |
||||
set { |
||||
dataTypeName = value; |
||||
this.dataType = Type.GetType(dataTypeName,true,true); |
||||
} |
||||
} |
||||
|
||||
[XmlIgnoreAttribute] |
||||
public Type DataType { |
||||
get { |
||||
return dataType; |
||||
} |
||||
set { |
||||
dataType = value; |
||||
} |
||||
} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,38 @@
@@ -0,0 +1,38 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 24.05.2013 |
||||
* Time: 20:10 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.ComponentModel; |
||||
|
||||
namespace ICSharpCode.Reporting.BaseClasses |
||||
{ |
||||
/// <summary>
|
||||
/// Description of GroupColumn.
|
||||
/// </summary>
|
||||
public class GroupColumn : SortColumn |
||||
{ |
||||
|
||||
public GroupColumn():this("",0,ListSortDirection.Ascending) |
||||
{ |
||||
} |
||||
|
||||
public GroupColumn(string columnName,int groupLevel, ListSortDirection sortDirection):base(columnName,sortDirection) |
||||
{ |
||||
if (GroupLevel < 0) { |
||||
throw new ArgumentException("groupLevel"); |
||||
} |
||||
this.GroupLevel = groupLevel; |
||||
|
||||
} |
||||
|
||||
|
||||
public int GroupLevel {get;private set;} |
||||
|
||||
|
||||
} |
||||
} |
@ -0,0 +1,125 @@
@@ -0,0 +1,125 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 03.04.2013 |
||||
* Time: 20:35 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Drawing; |
||||
|
||||
using ICSharpCode.Reporting.Interfaces; |
||||
using ICSharpCode.Reporting.Interfaces.Export; |
||||
|
||||
namespace ICSharpCode.Reporting.BaseClasses |
||||
{ |
||||
/// <summary>
|
||||
/// Description of Page.
|
||||
/// </summary>
|
||||
///
|
||||
|
||||
public class Page:IExportContainer,IPage |
||||
{ |
||||
public Page(IPageInfo pageInfo,Size pageSize) |
||||
{ |
||||
if (pageInfo == null) { |
||||
throw new ArgumentNullException("pageInfo"); |
||||
} |
||||
PageInfo = pageInfo; |
||||
Name = "Page"; |
||||
Size = pageSize; |
||||
exportedItems = new List<IExportColumn>(); |
||||
} |
||||
|
||||
public bool IsFirstPage {get;set;} |
||||
|
||||
|
||||
public IPageInfo PageInfo {get;private set;} |
||||
|
||||
|
||||
public string Name {get;set;} |
||||
|
||||
|
||||
public System.Drawing.Size Size {get;set;} |
||||
|
||||
|
||||
public System.Drawing.Point Location {get;set;} |
||||
|
||||
|
||||
public List<IExportColumn> exportedItems; |
||||
|
||||
public List<IExportColumn> ExportedItems { |
||||
get { return exportedItems; } |
||||
} |
||||
|
||||
|
||||
public IExportContainer CreateExportColumn() |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public ICSharpCode.Reporting.Arrange.IArrangeStrategy GetArrangeStrategy() |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public Size DesiredSize { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
set { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public Color ForeColor { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
set { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public Color BackColor { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
set { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
|
||||
public Color FrameColor { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
set { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
|
||||
public IExportColumn Parent { |
||||
get { |
||||
return null; |
||||
} |
||||
set { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool CanGrow {get;set;} |
||||
|
||||
public bool CanShrink {get;set;} |
||||
|
||||
public Rectangle DisplayRectangle { |
||||
get { |
||||
return new Rectangle(Location,Size); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,50 @@
@@ -0,0 +1,50 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 05.04.2013 |
||||
* Time: 19:50 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using ICSharpCode.Reporting.Interfaces.Export; |
||||
|
||||
namespace ICSharpCode.Reporting.BaseClasses |
||||
{ |
||||
/// <summary>
|
||||
/// Description of PageInfo.
|
||||
/// </summary>
|
||||
///
|
||||
|
||||
|
||||
|
||||
public class PageInfo:IPageInfo |
||||
{ |
||||
public PageInfo() |
||||
{ |
||||
} |
||||
|
||||
public int PageNumber {get;set;} |
||||
|
||||
|
||||
|
||||
public int TotalPages {get;set;} |
||||
|
||||
|
||||
|
||||
public string ReportName {get;set;} |
||||
|
||||
|
||||
public string ReportFileName {get;set;} |
||||
|
||||
|
||||
public string ReportFolder { |
||||
get{ |
||||
return System.IO.Path.GetDirectoryName(this.ReportFileName); |
||||
} |
||||
} |
||||
|
||||
public DateTime ExecutionTime {get;set;} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,49 @@
@@ -0,0 +1,49 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 21.05.2013 |
||||
* Time: 20:20 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.ComponentModel; |
||||
|
||||
namespace ICSharpCode.Reporting.BaseClasses |
||||
{ |
||||
/// <summary>
|
||||
/// Description of SortColumn.
|
||||
/// </summary>
|
||||
public class SortColumn : AbstractColumn { |
||||
|
||||
private ListSortDirection sortDirection = ListSortDirection.Ascending; |
||||
private bool caseSensitive; |
||||
|
||||
|
||||
public SortColumn():this(String.Empty,ListSortDirection.Ascending,typeof(System.String),false) |
||||
{ |
||||
} |
||||
|
||||
|
||||
public SortColumn(string columnName,ListSortDirection sortDirection) |
||||
:this(columnName,sortDirection,typeof(System.String),false){ |
||||
} |
||||
|
||||
|
||||
public SortColumn(string columnName, ListSortDirection sortDirection, Type type,bool caseSensitive ):base (columnName,type) |
||||
{ |
||||
this.caseSensitive = caseSensitive; |
||||
this.sortDirection = sortDirection; |
||||
} |
||||
|
||||
#region properties
|
||||
|
||||
public ListSortDirection SortDirection {get;set;} |
||||
|
||||
|
||||
public bool CaseSensitive {get;private set;} |
||||
|
||||
|
||||
#endregion
|
||||
} |
||||
} |
@ -0,0 +1,117 @@
@@ -0,0 +1,117 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 21.05.2013 |
||||
* Time: 20:03 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Collections.ObjectModel; |
||||
using System.Globalization; |
||||
using System.Linq; |
||||
|
||||
using ICSharpCode.Reporting.BaseClasses; |
||||
using ICSharpCode.Reporting.Items; |
||||
|
||||
namespace ICSharpCode.Reporting |
||||
{ |
||||
/// <summary>
|
||||
/// Description of Collections.
|
||||
/// </summary>
|
||||
|
||||
public class ColumnCollection: Collection<AbstractColumn>{ |
||||
|
||||
public ColumnCollection() |
||||
{ |
||||
} |
||||
|
||||
public AbstractColumn Find (string columnName) |
||||
{ |
||||
if (String.IsNullOrEmpty(columnName)) { |
||||
throw new ArgumentNullException("columnName"); |
||||
} |
||||
|
||||
return this.FirstOrDefault(x => 0 == String.Compare(x.ColumnName,columnName,true,CultureInfo.InvariantCulture)); |
||||
} |
||||
|
||||
|
||||
public void AddRange (IEnumerable<AbstractColumn> items) |
||||
{ |
||||
foreach (AbstractColumn item in items){ |
||||
this.Add(item); |
||||
} |
||||
} |
||||
|
||||
|
||||
/// <summary>
|
||||
/// The Culture is used for direct String Comparison
|
||||
/// </summary>
|
||||
|
||||
public static CultureInfo Culture |
||||
{ |
||||
get { return CultureInfo.CurrentCulture;} |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
public class SortColumnCollection: ColumnCollection |
||||
{ |
||||
public SortColumnCollection() |
||||
{ |
||||
} |
||||
|
||||
public new AbstractColumn Find (string columnName) |
||||
{ |
||||
if (String.IsNullOrEmpty(columnName)) { |
||||
throw new ArgumentNullException("columnName"); |
||||
} |
||||
|
||||
return this.FirstOrDefault(x => 0 == String.Compare(x.ColumnName,columnName,true,CultureInfo.InvariantCulture)); |
||||
} |
||||
|
||||
|
||||
public void AddRange (IEnumerable<SortColumn> items) |
||||
{ |
||||
foreach (SortColumn item in items){ |
||||
this.Add(item); |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
public class GroupColumnCollection: SortColumnCollection |
||||
{ |
||||
public GroupColumnCollection() |
||||
{ |
||||
} |
||||
|
||||
public new AbstractColumn Find (string columnName) |
||||
{ |
||||
if (String.IsNullOrEmpty(columnName)) { |
||||
throw new ArgumentNullException("columnName"); |
||||
} |
||||
|
||||
return this.FirstOrDefault(x => 0 == String.Compare(x.ColumnName,columnName,true,CultureInfo.InvariantCulture)); |
||||
} |
||||
} |
||||
|
||||
|
||||
public class ReportItemCollection : Collection<PrintableItem> |
||||
{ |
||||
|
||||
// Trick to get the inner list as List<T> (InnerList always has that type because we only use
|
||||
// the parameterless constructor on Collection<T>)
|
||||
|
||||
private List<PrintableItem> InnerList { |
||||
get { return (List<PrintableItem>)base.Items; } |
||||
} |
||||
|
||||
private void Sort(IComparer<PrintableItem> comparer) |
||||
{ |
||||
InnerList.Sort(comparer); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,14 @@
@@ -0,0 +1,14 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 16.03.2013 |
||||
* Time: 20:24 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System.Security; |
||||
|
||||
[assembly: SecurityRules(SecurityRuleSet.Level1)] |
||||
|
||||
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("ICSharpCode.Reporting.Test")] |
||||
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("ICSharpCode.Reports.Addin")] |
@ -0,0 +1,406 @@
@@ -0,0 +1,406 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 21.05.2013 |
||||
* Time: 20:09 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections; |
||||
using System.Collections.Generic; |
||||
using System.Collections.ObjectModel; |
||||
using System.ComponentModel; |
||||
using System.Globalization; |
||||
using System.Linq; |
||||
using System.Reflection; |
||||
|
||||
using ICSharpCode.Reporting.BaseClasses; |
||||
using ICSharpCode.Reporting.DataManager.Listhandling; |
||||
using ICSharpCode.Reporting.DataSource; |
||||
using ICSharpCode.Reporting.DataSource.Comparer; |
||||
using ICSharpCode.Reporting.Interfaces; |
||||
using ICSharpCode.Reporting.Interfaces.Data; |
||||
using ICSharpCode.Reporting.Items; |
||||
|
||||
namespace ICSharpCode.Reporting.DataManager.Listhandling |
||||
{ |
||||
/// <summary>
|
||||
/// Description of CollectionHandling.
|
||||
/// </summary>
|
||||
internal class CollectionSource:IDataViewHandling |
||||
{ |
||||
|
||||
private PropertyDescriptorCollection listProperties; |
||||
private DataCollection<object> baseList; |
||||
private ReportSettings reportSettings; |
||||
private Type itemType; |
||||
|
||||
public CollectionSource(IList list,ReportSettings reportSettings) |
||||
{ |
||||
|
||||
if (list.Count > 0) { |
||||
itemType = list[0].GetType(); |
||||
this.baseList = new DataCollection <object>(itemType); |
||||
this.baseList.AddRange(list); |
||||
} |
||||
this.reportSettings = reportSettings; |
||||
this.listProperties = this.baseList.GetItemProperties(null); |
||||
IndexList = new IndexList(); |
||||
} |
||||
|
||||
public int Count |
||||
{ |
||||
get { |
||||
return this.baseList.Count; |
||||
} |
||||
} |
||||
|
||||
public Collection<AbstractColumn> AvailableFields { |
||||
get { |
||||
var availableFields = new Collection<AbstractColumn>(); |
||||
foreach (PropertyDescriptor p in this.listProperties){ |
||||
availableFields.Add (new AbstractColumn(p.Name,p.PropertyType)); |
||||
} |
||||
return availableFields; |
||||
} |
||||
} |
||||
|
||||
public object Current { |
||||
get { |
||||
return baseList[((BaseComparer)IndexList[CurrentPosition]).ListIndex]; |
||||
} |
||||
} |
||||
|
||||
|
||||
// public object CurrentFromPosition(int pos)
|
||||
// {
|
||||
// BaseComparer bc = GetComparer(value);
|
||||
// Current = baseList[bc.ListIndex];
|
||||
// return baseList[((BaseComparer)IndexList[CurrentPosition]).ListIndex];
|
||||
// }
|
||||
|
||||
|
||||
public int CurrentPosition { |
||||
|
||||
get { |
||||
return IndexList.CurrentPosition; |
||||
} |
||||
set { |
||||
if ((value > -1)|| (value > this.IndexList.Count)){ |
||||
this.IndexList.CurrentPosition = value; |
||||
} |
||||
|
||||
// BaseComparer bc = GetComparer(value);
|
||||
// Current = baseList[bc.ListIndex];
|
||||
|
||||
// current = this.baseList[((BaseComparer)IndexList[value]).ListIndex];
|
||||
} |
||||
} |
||||
|
||||
|
||||
public bool MoveNext() |
||||
{ |
||||
this.IndexList.CurrentPosition ++; |
||||
return this.IndexList.CurrentPosition<this.IndexList.Count; |
||||
} |
||||
|
||||
|
||||
public IndexList IndexList {get; private set;} |
||||
|
||||
|
||||
public void Bind() |
||||
{ |
||||
if (reportSettings.GroupColumnCollection.Any()) { |
||||
this.Group(); |
||||
} else { |
||||
this.Sort (); |
||||
} |
||||
} |
||||
|
||||
#region Fill
|
||||
/* |
||||
public void Fill(IDataItem item) |
||||
{ |
||||
|
||||
// PropertyInfo pi = itemType.GetProperty(item.ColumnName);
|
||||
// var pi1 = pi.GetValue(Current);
|
||||
|
||||
var p = listProperties.Find(item.ColumnName,true); |
||||
item.DBValue = p.GetValue(Current).ToString(); |
||||
if (String.IsNullOrEmpty(item.DataType)) { |
||||
item.DataType = p.PropertyType.ToString(); |
||||
} |
||||
} |
||||
*/ |
||||
|
||||
public void Fill(ReportItemCollection collection) |
||||
{ |
||||
foreach (IDataItem item in collection) |
||||
{ |
||||
FillInternal(item); |
||||
} |
||||
} |
||||
|
||||
void FillInternal (IDataItem item) { |
||||
var p = listProperties.Find(item.ColumnName,true); |
||||
item.DBValue = p.GetValue(Current).ToString(); |
||||
if (String.IsNullOrEmpty(item.DataType)) { |
||||
item.DataType = p.PropertyType.ToString(); |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Grouping
|
||||
|
||||
public void Group() |
||||
{ |
||||
var unsortedList = this.BuildIndexInternal(reportSettings.GroupColumnCollection); |
||||
// IndexList = BuildGroup(unsortedList,reportSettings.GroupColumnCollection);
|
||||
var sorted = unsortedList.OrderBy(a => a.ObjectArray[0]); |
||||
var x = sorted.GroupBy(a => a.ObjectArray[0]); |
||||
|
||||
Console.WriteLine("GroupBy()"); |
||||
foreach (var element in x) { |
||||
Console.WriteLine("{0} - {1} ",element.Key.ToString(),element is BaseComparer); |
||||
foreach (var xx in element) { |
||||
Console.WriteLine("...{0}",((BaseComparer)xx).ObjectArray[0].ToString()); |
||||
} |
||||
} |
||||
|
||||
Console.WriteLine("--------------- "); |
||||
|
||||
var aa = BuildGroup_1(unsortedList,reportSettings.GroupColumnCollection); |
||||
// ShowIndexList(IndexList);
|
||||
} |
||||
|
||||
|
||||
private Dictionary<string,IndexList> BuildGroup_1 (IndexList list,GroupColumnCollection groups) { |
||||
var dictionary = new Dictionary<string,IndexList>(); |
||||
PropertyDescriptor[] groupProperties = BuildSortProperties (groups); |
||||
foreach (var element in list) { |
||||
string groupValue = ExtractValue (element,groupProperties); |
||||
if (!dictionary.ContainsKey(groupValue)) { |
||||
dictionary[groupValue] = new IndexList(); |
||||
} |
||||
|
||||
dictionary[groupValue].Add(element); |
||||
} |
||||
|
||||
Console.WriteLine("Dictonary "); |
||||
foreach (var el in dictionary.Values) { |
||||
Console.WriteLine(el.Count.ToString()); |
||||
foreach (var element in el) { |
||||
Console.WriteLine("-- {0}",element.ToString()); |
||||
} |
||||
} |
||||
return dictionary; |
||||
} |
||||
|
||||
|
||||
private IndexList BuildGroup (IndexList source,GroupColumnCollection groups) |
||||
{ |
||||
string compareValue = String.Empty; |
||||
var idlist = new IndexList(); |
||||
|
||||
PropertyDescriptor[] groupProperties = BuildSortProperties (groups); |
||||
|
||||
GroupComparer groupComparer = null; |
||||
|
||||
foreach (BaseComparer element in source) { |
||||
var groupValue = ExtractValue(element,groupProperties); |
||||
// var query2 = idlist.FirstOrDefault( s => ((GroupComparer)s).ObjectArray[0] == groupValue) as GroupComparer;
|
||||
// if (query2 == null) {
|
||||
// groupComparer = CreateGroupHeader(element);
|
||||
// idlist.Add(groupComparer);
|
||||
// } else {
|
||||
// Console.WriteLine("xx");
|
||||
// }
|
||||
if (compareValue != groupValue) { |
||||
groupComparer = CreateGroupHeader(element); |
||||
idlist.Add(groupComparer); |
||||
} |
||||
groupComparer.IndexList.Add(element); |
||||
|
||||
compareValue = groupValue; |
||||
} |
||||
ShowGrouping(ref idlist); |
||||
return idlist; |
||||
} |
||||
|
||||
|
||||
void ShowGrouping(ref IndexList idlist) |
||||
{ |
||||
Console.WriteLine("----ShowGrouping---"); |
||||
foreach (GroupComparer el in idlist) { |
||||
Console.WriteLine("{0}", el.ToString()); |
||||
if (el.IndexList.Any()) { |
||||
foreach (var element in el.IndexList) { |
||||
Console.WriteLine("--{0}", element.ToString()); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
string ExtractValue(BaseComparer element,PropertyDescriptor[] groupProperties) |
||||
{ |
||||
var rowItem = baseList[element.ListIndex]; |
||||
var values = FillComparer(groupProperties, rowItem); |
||||
// return element.ObjectArray[0].ToString();
|
||||
return values[0].ToString(); |
||||
} |
||||
|
||||
|
||||
static GroupComparer CreateGroupHeader (BaseComparer sc) |
||||
{ |
||||
var gc = new GroupComparer(sc.ColumnCollection,sc.ListIndex,sc.ObjectArray); |
||||
gc.IndexList = new IndexList(); |
||||
return gc; |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region BuildIndexList
|
||||
|
||||
IndexList BuildSortIndex(Collection<AbstractColumn> sortColumnsCollection) |
||||
{ |
||||
|
||||
IndexList indexList = BuildIndexInternal(sortColumnsCollection); |
||||
|
||||
if (indexList[0].ObjectArray.GetLength(0) == 1) { |
||||
|
||||
IEnumerable<BaseComparer> sortedList = GenericSorter (indexList); |
||||
indexList.Clear(); |
||||
indexList.AddRange(sortedList); |
||||
} |
||||
else { |
||||
indexList.Sort(); |
||||
} |
||||
return indexList; |
||||
} |
||||
|
||||
|
||||
|
||||
IndexList BuildIndexInternal(Collection<AbstractColumn> sortColumnsCollection) |
||||
{ |
||||
var indexList = new IndexList(); |
||||
PropertyDescriptor[] sortProperties = BuildSortProperties(sortColumnsCollection); |
||||
for (int rowIndex = 0; rowIndex < this.baseList.Count; rowIndex++) { |
||||
var rowItem = this.baseList[rowIndex]; |
||||
var values = FillComparer(sortProperties, rowItem); |
||||
indexList.Add(new SortComparer(sortColumnsCollection, rowIndex, values)); |
||||
} |
||||
return indexList; |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Sorting delegates
|
||||
|
||||
public void Sort() |
||||
{ |
||||
if ((this.reportSettings.SortColumnsCollection != null)) { |
||||
if (this.reportSettings.SortColumnsCollection.Count > 0) { |
||||
IndexList = this.BuildSortIndex (reportSettings.SortColumnsCollection); |
||||
} else { |
||||
IndexList = this.BuildIndexInternal(reportSettings.SortColumnsCollection); |
||||
} |
||||
} |
||||
} |
||||
|
||||
static IEnumerable<BaseComparer> GenericSorter (List<BaseComparer> list) |
||||
{ |
||||
|
||||
List<BaseComparer> sortedList = null; |
||||
ListSortDirection sortDirection = GetSortDirection(list); |
||||
|
||||
sortedList = sortDirection == ListSortDirection.Ascending ? list.AsQueryable().AscendingOrder().ToList() : list.AsQueryable().DescendingOrder().ToList(); |
||||
return sortedList; |
||||
} |
||||
|
||||
|
||||
static ListSortDirection GetSortDirection(List<BaseComparer> list) |
||||
{ |
||||
BaseComparer bc = list[0]; |
||||
var sortColumn = bc.ColumnCollection[0] as SortColumn; |
||||
ListSortDirection sd = sortColumn.SortDirection; |
||||
return sd; |
||||
} |
||||
|
||||
|
||||
Object[] FillComparer(PropertyDescriptor[] sortProperties, object rowItem) |
||||
{ |
||||
object[] values = new object[sortProperties.Length]; |
||||
for (int criteriaIndex = 0; criteriaIndex < sortProperties.Length; criteriaIndex++) { |
||||
object value = sortProperties[criteriaIndex].GetValue(rowItem); |
||||
if (value != null && value != DBNull.Value) { |
||||
if (!(value is IComparable)) { |
||||
throw new InvalidOperationException("ReportDataSource:BuildSortArray - > This type doesn't support IComparable." + value.ToString()); |
||||
} |
||||
values[criteriaIndex] = value; |
||||
} |
||||
} |
||||
return values; |
||||
} |
||||
|
||||
private PropertyDescriptor[] BuildSortProperties (Collection<AbstractColumn> sortColumnCollection) |
||||
{ |
||||
var sortProperties = new PropertyDescriptor[sortColumnCollection.Count]; |
||||
var descriptorCollection = this.baseList.GetItemProperties(null); |
||||
|
||||
for (var criteriaIndex = 0; criteriaIndex < sortColumnCollection.Count; criteriaIndex++){ |
||||
var descriptor = descriptorCollection.Find (sortColumnCollection[criteriaIndex].ColumnName,true); |
||||
|
||||
if (descriptor == null){ |
||||
throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, |
||||
"Die Liste enthält keine Spalte [{0}].", |
||||
sortColumnCollection[criteriaIndex].ColumnName)); |
||||
} |
||||
sortProperties[criteriaIndex] = descriptor; |
||||
} |
||||
return sortProperties; |
||||
} |
||||
|
||||
|
||||
BaseComparer GetComparer(int position) |
||||
{ |
||||
var bc = (BaseComparer)IndexList[position]; |
||||
return bc; |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Debug Code
|
||||
|
||||
private static void ShowIndexList (IndexList list) |
||||
{ |
||||
foreach (BaseComparer element in list) { |
||||
var groupComparer = element as GroupComparer; |
||||
if (groupComparer == null) continue; |
||||
if (groupComparer.IndexList.Any()) { |
||||
var ss = String.Format("{0} with {1} Children",element.ObjectArray[0],groupComparer.IndexList.Count); |
||||
System.Console.WriteLine(ss); |
||||
foreach (BaseComparer c in groupComparer.IndexList) { |
||||
Console.WriteLine("---- {0}",c.ObjectArray[0]); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
static string WrongColumnName(string propertyName) |
||||
{ |
||||
return String.Format(CultureInfo.InvariantCulture, "Error : <{0}> missing!", propertyName); |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
|
||||
public void Reset() |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,27 @@
@@ -0,0 +1,27 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 21.05.2013 |
||||
* Time: 20:54 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using ICSharpCode.Reporting.DataSource.Comparer; |
||||
|
||||
namespace ICSharpCode.Reporting.DataManager.Listhandling |
||||
{ |
||||
/// <summary>
|
||||
/// Description of IndexList.
|
||||
/// </summary>
|
||||
public class IndexList :List<BaseComparer> |
||||
{ |
||||
|
||||
public IndexList() |
||||
{ |
||||
} |
||||
|
||||
public int CurrentPosition {get;set;} |
||||
} |
||||
} |
@ -0,0 +1,92 @@
@@ -0,0 +1,92 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 21.05.2013 |
||||
* Time: 20:57 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.ObjectModel; |
||||
using ICSharpCode.Reporting.BaseClasses; |
||||
|
||||
namespace ICSharpCode.Reporting.DataSource.Comparer |
||||
{ |
||||
/// <summary>
|
||||
/// Description of BaseComparer.
|
||||
/// </summary>
|
||||
public class BaseComparer : IComparable { |
||||
|
||||
private int listIndex; |
||||
private object[] objectArray; |
||||
|
||||
/// <summary>
|
||||
/// Default constructor - initializes all fields to default values
|
||||
/// </summary>
|
||||
|
||||
public BaseComparer(Collection<AbstractColumn> columnCollection , int listIndex, object[] values) { |
||||
this.ColumnCollection = columnCollection; |
||||
this.listIndex = listIndex; |
||||
this.objectArray = values; |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Interface method from IComparable
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Interface method from IComparable
|
||||
///
|
||||
/// </remarks>
|
||||
/// <param name='obj'>a <see cref="BaseComparer"></see></param>
|
||||
public virtual int CompareTo(object obj) { |
||||
return 0; |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Ausgeben der Werte als Pseudo-CSV
|
||||
/// </summary>
|
||||
public override string ToString() |
||||
{ |
||||
System.Text.StringBuilder builder = new System.Text.StringBuilder(); |
||||
builder.AppendFormat("{0};", this.listIndex); |
||||
foreach (object value in objectArray) |
||||
{ |
||||
if (value == null || value == DBNull.Value) |
||||
{ |
||||
builder.AppendFormat("<NULL>"); |
||||
} |
||||
else if (value.GetType() == typeof(string)) |
||||
{ |
||||
builder.AppendFormat("\"{0}\"", (string)value); |
||||
} |
||||
else if (value is IFormattable) |
||||
{ |
||||
builder.AppendFormat("{0}", ((IFormattable)value).ToString("g", System.Globalization.CultureInfo.InvariantCulture)); |
||||
} |
||||
else |
||||
{ |
||||
builder.AppendFormat("[{0}]", value.ToString()); |
||||
} |
||||
builder.Append(';'); |
||||
} |
||||
return builder.ToString(); |
||||
} |
||||
|
||||
|
||||
public int ListIndex { |
||||
get { |
||||
return listIndex; |
||||
} |
||||
} |
||||
|
||||
public object[] ObjectArray { |
||||
get { |
||||
return objectArray; |
||||
} |
||||
} |
||||
|
||||
|
||||
public Collection<AbstractColumn> ColumnCollection {get;private set;} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,29 @@
@@ -0,0 +1,29 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 24.05.2013 |
||||
* Time: 20:17 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.ObjectModel; |
||||
using ICSharpCode.Reporting.BaseClasses; |
||||
using ICSharpCode.Reporting.DataManager.Listhandling; |
||||
|
||||
namespace ICSharpCode.Reporting.DataSource.Comparer |
||||
{ |
||||
/// <summary>
|
||||
/// Description of GroupComparer.
|
||||
/// </summary>
|
||||
public class GroupComparer :SortComparer |
||||
{ |
||||
|
||||
public GroupComparer (Collection<AbstractColumn> owner, int listIndex, object[] values):base(owner,listIndex,values) |
||||
{ |
||||
IndexList = new IndexList(); |
||||
} |
||||
|
||||
public IndexList IndexList {get;set;} |
||||
} |
||||
} |
@ -0,0 +1,104 @@
@@ -0,0 +1,104 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 22.05.2013 |
||||
* Time: 20:06 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.ObjectModel; |
||||
using System.ComponentModel; |
||||
using System.Globalization; |
||||
|
||||
using ICSharpCode.Reporting.BaseClasses; |
||||
|
||||
namespace ICSharpCode.Reporting.DataSource.Comparer |
||||
{ |
||||
/// <summary>
|
||||
/// Description of SortComparer.
|
||||
/// </summary>
|
||||
public class SortComparer : BaseComparer { |
||||
|
||||
public SortComparer(Collection<AbstractColumn> owner, int listIndex, object[] values):base(owner,listIndex,values) |
||||
{ |
||||
} |
||||
|
||||
|
||||
internal int CompareTo(SortComparer value) |
||||
{ |
||||
// we shouldn't get to this point
|
||||
if (value == null) |
||||
throw new ArgumentNullException("value"); |
||||
|
||||
if (value.ObjectArray.Length != base.ObjectArray.Length) |
||||
throw new InvalidOperationException(); |
||||
|
||||
int compare = 0; |
||||
|
||||
for (int index = 0; index < base.ObjectArray.Length; index++) |
||||
{ |
||||
object leftValue = base.ObjectArray[index]; |
||||
|
||||
object rightValue = value.ObjectArray[index]; |
||||
|
||||
// Indizes sind hier deckungsgleich
|
||||
|
||||
SortColumn sortColumn = (SortColumn)base.ColumnCollection[index]; |
||||
|
||||
bool descending = (sortColumn.SortDirection == ListSortDirection.Descending); |
||||
|
||||
// null means equl
|
||||
if (leftValue == null || leftValue == System.DBNull.Value) |
||||
{ |
||||
if (rightValue != null && rightValue != System.DBNull.Value) |
||||
{ |
||||
return (descending) ? 1 : -1; |
||||
} |
||||
|
||||
// Beide Null
|
||||
continue; |
||||
} |
||||
|
||||
if (rightValue == null || rightValue == System.DBNull.Value) |
||||
{ |
||||
return (descending) ? -1 : 1; |
||||
} |
||||
|
||||
|
||||
if (leftValue.GetType() != rightValue.GetType()){ |
||||
string s = String.Format(CultureInfo.CurrentCulture, |
||||
"{0} {1} {2}",this.GetType().ToString(), |
||||
leftValue.GetType().ToString(), |
||||
rightValue.GetType().ToString()); |
||||
|
||||
throw new ArgumentException(s); |
||||
} |
||||
if (leftValue.GetType() == typeof(string)) |
||||
{ |
||||
compare = String.Compare((string)leftValue, (string)rightValue, |
||||
!sortColumn.CaseSensitive, CultureInfo.CurrentCulture); |
||||
} |
||||
else |
||||
{ |
||||
compare = ((IComparable)leftValue).CompareTo(rightValue); |
||||
} |
||||
|
||||
// Sind ungleich, tauschen je nach Richtung
|
||||
if (compare != 0) |
||||
{ |
||||
return (descending) ? -compare : compare; |
||||
} |
||||
} |
||||
|
||||
// Gleich Werte, dann Index bercksichtigen
|
||||
return this.ListIndex.CompareTo(value.ListIndex); |
||||
} |
||||
public override int CompareTo(object obj) { |
||||
base.CompareTo(obj); |
||||
return this.CompareTo((SortComparer)obj); |
||||
} |
||||
|
||||
|
||||
} |
||||
} |
@ -0,0 +1,32 @@
@@ -0,0 +1,32 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 23.05.2013 |
||||
* Time: 19:51 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Linq; |
||||
namespace ICSharpCode.Reporting.DataSource.Comparer |
||||
{ |
||||
/// <summary>
|
||||
/// Description of SortExtension.
|
||||
/// </summary>
|
||||
internal static class SortExtension |
||||
{ |
||||
|
||||
public static IOrderedQueryable<BaseComparer> AscendingOrder(this IQueryable<BaseComparer> source ) |
||||
{ |
||||
|
||||
return source.OrderBy(x => x.ObjectArray[0]); |
||||
} |
||||
|
||||
public static IOrderedQueryable<BaseComparer> DescendingOrder(this IQueryable<BaseComparer> source ) |
||||
{ |
||||
|
||||
return source.OrderByDescending(x => x.ObjectArray[0]); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,205 @@
@@ -0,0 +1,205 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 20.05.2013 |
||||
* Time: 17:55 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections; |
||||
using System.Collections.Generic; |
||||
using System.Collections.ObjectModel; |
||||
using System.ComponentModel; |
||||
using System.Diagnostics; |
||||
using System.Linq; |
||||
using System.Reflection; |
||||
|
||||
namespace ICSharpCode.Reporting.DataSource |
||||
{ |
||||
/// <summary>
|
||||
/// Description of DataCollection.
|
||||
/// </summary>
|
||||
internal class DataCollection<T> : IList<T>,ITypedList |
||||
{ |
||||
Collection<T> list = new Collection<T>(); |
||||
Type elementType; |
||||
|
||||
public DataCollection(Type elementType) |
||||
{ |
||||
this.elementType = elementType; |
||||
} |
||||
|
||||
public T this[int index] |
||||
{ |
||||
get { |
||||
return list[index]; |
||||
} |
||||
set { |
||||
T oldValue = list[index]; |
||||
if (!object.Equals(oldValue, value)) { |
||||
list[index] = value; |
||||
} |
||||
} |
||||
} |
||||
|
||||
public int Count |
||||
{ |
||||
[DebuggerStepThrough] |
||||
get { |
||||
return list.Count; |
||||
} |
||||
} |
||||
|
||||
public bool IsReadOnly |
||||
{ |
||||
get { |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
public int IndexOf(T item) |
||||
{ |
||||
return list.IndexOf(item); |
||||
} |
||||
|
||||
public void Insert(int index, T item) |
||||
{ |
||||
list.Insert(index, item); |
||||
} |
||||
|
||||
public void RemoveAt(int index) |
||||
{ |
||||
list.RemoveAt(index); |
||||
} |
||||
|
||||
public void Add(T item) |
||||
{ |
||||
list.Add(item); |
||||
} |
||||
|
||||
|
||||
public void AddRange(IList range) |
||||
{ |
||||
foreach(T t in range) { |
||||
Add(t); |
||||
} |
||||
} |
||||
|
||||
|
||||
public void Clear(){ |
||||
list = new Collection<T>(); |
||||
} |
||||
|
||||
public bool Contains(T item) |
||||
{ |
||||
return list.Contains(item); |
||||
} |
||||
|
||||
public void CopyTo(T[] array, int arrayIndex) |
||||
{ |
||||
list.CopyTo(array, arrayIndex); |
||||
} |
||||
|
||||
public bool Remove(T item) |
||||
{ |
||||
if (list.Remove(item)) { |
||||
return true; |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
#region ITypedList Member
|
||||
|
||||
public PropertyDescriptorCollection GetItemProperties(PropertyDescriptor[] listAccessors){ |
||||
if (listAccessors != null && listAccessors.Length > 0){ |
||||
var t = this.elementType; |
||||
|
||||
t = listAccessors.Aggregate(t, |
||||
(current, pd) => (Type) PropertyTypeHash.Instance[current, pd.Name]); |
||||
|
||||
// if t is null an empty list will be generated
|
||||
return ExtendedTypeDescriptor.GetProperties(t); |
||||
} |
||||
return ExtendedTypeDescriptor.GetProperties(elementType); |
||||
} |
||||
|
||||
|
||||
public string GetListName(PropertyDescriptor[] listAccessors){ |
||||
return elementType.Name; |
||||
} |
||||
|
||||
public static Type GetElementType(IList list, Type parentType, string propertyName) |
||||
{ |
||||
DataCollection<T> al = null; |
||||
object element = null; |
||||
al = CheckForArrayList(list); |
||||
if (al == null) |
||||
{ |
||||
if (list.Count > 0) |
||||
{ |
||||
element = list[0]; |
||||
} |
||||
} |
||||
if (al == null && element == null) |
||||
{ |
||||
var pi = parentType.GetProperty(propertyName); |
||||
if (pi != null) |
||||
{ |
||||
object parentObject = null; |
||||
try |
||||
{ |
||||
parentObject = Activator.CreateInstance(parentType); |
||||
} |
||||
catch(Exception) {} |
||||
if (parentObject != null) |
||||
{ |
||||
list = pi.GetValue(parentObject, null) as IList; |
||||
al = CheckForArrayList(list); |
||||
} |
||||
} |
||||
} |
||||
if (al != null) |
||||
{ |
||||
return al.elementType; |
||||
} |
||||
else if (element != null) |
||||
{ |
||||
return element.GetType(); |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
private static DataCollection<T> CheckForArrayList(object l) |
||||
{ |
||||
var list = l as IList; |
||||
if (list == null) |
||||
return null; |
||||
if (list.GetType().FullName == "System.Collections.ArrayList+ReadOnlyArrayList") |
||||
{ |
||||
var fi = list.GetType().GetField("_list", BindingFlags.NonPublic | BindingFlags.Instance); |
||||
if (fi != null) |
||||
{ |
||||
list = (IList) fi.GetValue(list); |
||||
} |
||||
} |
||||
// ReSharper disable SuspiciousTypeConversion.Global
|
||||
return list as DataCollection<T>; |
||||
// ReSharper restore SuspiciousTypeConversion.Global
|
||||
} |
||||
#endregion
|
||||
|
||||
|
||||
[DebuggerStepThrough] |
||||
public IEnumerator<T> GetEnumerator() |
||||
{ |
||||
return list.GetEnumerator(); |
||||
} |
||||
|
||||
[DebuggerStepThrough] |
||||
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() |
||||
{ |
||||
return list.GetEnumerator(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,96 @@
@@ -0,0 +1,96 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 20.05.2013 |
||||
* Time: 18:05 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections; |
||||
using System.ComponentModel; |
||||
using System.Reflection; |
||||
|
||||
namespace ICSharpCode.Reporting.DataSource |
||||
{ |
||||
/// <summary>
|
||||
/// Description of ExtendedPropertyDescriptor.
|
||||
/// </summary>
|
||||
internal class ExtendedPropertyDescriptor : PropertyDescriptor |
||||
{ |
||||
|
||||
Type componentType; |
||||
Type propertyType; |
||||
PropertyInfo prop; |
||||
|
||||
public ExtendedPropertyDescriptor (string name, Type componentType, Type propertyType) |
||||
: base (name, null) |
||||
{ |
||||
this.componentType = componentType; |
||||
this.propertyType = propertyType; |
||||
} |
||||
|
||||
|
||||
public override object GetValue (object component) |
||||
{ |
||||
var x = component.GetType(); |
||||
if (!componentType.IsAssignableFrom(component.GetType())){ |
||||
return null; |
||||
} |
||||
|
||||
if (prop == null) { |
||||
prop = componentType.GetProperty (Name); |
||||
} |
||||
|
||||
object obj = prop.GetValue (component, null); |
||||
if (obj != null) { |
||||
if (obj is IList){ |
||||
PropertyTypeHash.Instance[componentType, Name] = DataCollection<object>.GetElementType((IList)obj, componentType, Name); |
||||
} |
||||
} |
||||
return obj; |
||||
} |
||||
|
||||
|
||||
public override void SetValue(object component, object value) |
||||
{ |
||||
if (IsReadOnly){ |
||||
return; |
||||
} |
||||
if (prop == null){ |
||||
prop = componentType.GetProperty (Name); |
||||
} |
||||
prop.SetValue (component, value, null); |
||||
} |
||||
|
||||
public override void ResetValue(object component) |
||||
{ |
||||
return; |
||||
} |
||||
|
||||
public override bool CanResetValue(object component) |
||||
{ |
||||
return false; |
||||
} |
||||
|
||||
public override bool ShouldSerializeValue(object component) |
||||
{ |
||||
return false; |
||||
} |
||||
|
||||
public override Type ComponentType |
||||
{ |
||||
get { return componentType; } |
||||
} |
||||
|
||||
public override bool IsReadOnly |
||||
{ |
||||
get { return false; } |
||||
} |
||||
|
||||
public override Type PropertyType |
||||
{ |
||||
get { return propertyType; } |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,65 @@
@@ -0,0 +1,65 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 20.05.2013 |
||||
* Time: 17:59 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections; |
||||
using System.ComponentModel; |
||||
using System.Reflection; |
||||
|
||||
namespace ICSharpCode.Reporting.DataSource |
||||
{ |
||||
/// <summary>
|
||||
/// Description of ExtendedTypeDescriptor.
|
||||
/// </summary>
|
||||
internal class ExtendedTypeDescriptor |
||||
{ |
||||
private static Hashtable collections = new Hashtable(); |
||||
|
||||
private static bool IsAllowedProperty(string name) |
||||
{ |
||||
return true; // alle erlaubt
|
||||
} |
||||
|
||||
|
||||
public static PropertyDescriptorCollection GetProperties(Type memberType) |
||||
{ |
||||
if (memberType == null) |
||||
return PropertyDescriptorCollection.Empty; |
||||
|
||||
PropertyDescriptorCollection pdc; |
||||
if ((pdc = (PropertyDescriptorCollection) collections[memberType]) != null) |
||||
return (pdc); |
||||
|
||||
PropertyInfo[] allProps = memberType.GetProperties(); |
||||
int l = allProps.Length; |
||||
for (int i = 0; i < allProps.Length; i++) |
||||
{ |
||||
PropertyInfo pi = allProps[i]; |
||||
if (!IsAllowedProperty(pi.Name)) |
||||
{ |
||||
allProps[i] = null; |
||||
l--; |
||||
} |
||||
} |
||||
|
||||
PropertyDescriptor[] descriptors = new PropertyDescriptor[l]; |
||||
|
||||
int j = 0; |
||||
foreach(PropertyInfo pinfo in allProps) |
||||
{ |
||||
if (pinfo != null) |
||||
{ |
||||
descriptors[j++] = new ExtendedPropertyDescriptor(pinfo.Name, memberType, pinfo.PropertyType); |
||||
} |
||||
} |
||||
PropertyDescriptorCollection result = new PropertyDescriptorCollection(descriptors); |
||||
collections.Add(memberType, result); |
||||
return result; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,53 @@
@@ -0,0 +1,53 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 20.05.2013 |
||||
* Time: 18:02 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections; |
||||
|
||||
namespace ICSharpCode.Reporting.DataSource |
||||
{ |
||||
/// <summary>
|
||||
/// Description of PropertyTypeHash.
|
||||
/// </summary>
|
||||
internal class PropertyTypeHash |
||||
{ |
||||
static PropertyTypeHash instance = new PropertyTypeHash(); |
||||
|
||||
static public PropertyTypeHash Instance |
||||
{ |
||||
get { return instance; } |
||||
} |
||||
|
||||
Hashtable types = new Hashtable(); |
||||
|
||||
private static string MakeIndex(Type t, string name) |
||||
{ |
||||
return t.FullName + '.' + name; |
||||
} |
||||
|
||||
public object this[Type type, string fieldName] |
||||
{ |
||||
get |
||||
{ |
||||
return types[MakeIndex(type, fieldName)]; |
||||
} |
||||
set |
||||
{ |
||||
if (value == null) |
||||
return; |
||||
string key = MakeIndex(type, fieldName); |
||||
if (!types.Contains(key)) |
||||
types.Add(key, value); |
||||
} |
||||
} |
||||
|
||||
private PropertyTypeHash() |
||||
{ |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,176 @@
@@ -0,0 +1,176 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 05.05.2013 |
||||
* Time: 19:42 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
using System.Windows.Documents; |
||||
using System.Windows.Media; |
||||
|
||||
using ICSharpCode.Reporting.Items; |
||||
using ICSharpCode.Reporting.PageBuilder.ExportColumns; |
||||
using Brush = System.Windows.Media.Brush; |
||||
using FontFamily = System.Windows.Media.FontFamily; |
||||
using Image = System.Windows.Controls.Image; |
||||
using Pen = System.Windows.Media.Pen; |
||||
using Size = System.Windows.Size; |
||||
|
||||
namespace ICSharpCode.Reporting.ExportRenderer |
||||
{ |
||||
/// <summary>
|
||||
/// Description of FixedDocumentCreator.
|
||||
/// </summary>
|
||||
internal class FixedDocumentCreator |
||||
{ |
||||
BrushConverter brushConverter ; |
||||
ReportSettings reportSettings; |
||||
|
||||
public FixedDocumentCreator(ReportSettings reportSettings) |
||||
{ |
||||
if (reportSettings == null) |
||||
throw new ArgumentNullException("reportSettings"); |
||||
this.reportSettings = reportSettings; |
||||
Console.WriteLine("FixedDocumentCreator()"); |
||||
brushConverter = new BrushConverter(); |
||||
} |
||||
|
||||
|
||||
public UIElement CreateContainer(ExportContainer container) |
||||
{ |
||||
// http://tech.pro/tutorial/736/wpf-tutorial-creating-a-custom-panel-control
|
||||
|
||||
var canvas = CreateCanvas(container); |
||||
// canvas.Measure(new Size(reportSettings.PageSize.Width,reportSettings.PageSize.Height));
|
||||
|
||||
var size = new Size(container.DesiredSize.Width,container.DesiredSize.Height); |
||||
|
||||
canvas.Measure(size); |
||||
|
||||
// canvas.Arrange(new Rect(new System.Windows.Point(),new Size(reportSettings.PageSize.Width,reportSettings.PageSize.Height) ));
|
||||
|
||||
canvas.Arrange(new Rect(new System.Windows.Point(),size )); |
||||
|
||||
canvas.UpdateLayout(); |
||||
|
||||
return canvas; |
||||
|
||||
} |
||||
|
||||
public TextBlock CreateTextBlock(ExportText exportText) |
||||
{ |
||||
var textBlock = new TextBlock(); |
||||
textBlock.Text = exportText.Text; |
||||
textBlock.Foreground = ConvertBrush(exportText.ForeColor); |
||||
SetFont(textBlock,exportText); |
||||
textBlock.TextWrapping = TextWrapping.WrapWithOverflow; |
||||
|
||||
// string [] inlines = exportText.Text.Split(System.Environment.NewLine.ToCharArray());
|
||||
//string [] inlines = "jmb,.n,knn-.n.-n.n-.n.n.-";
|
||||
// for (int i = 0; i < inlines.Length; i++) {
|
||||
// if (inlines[i].Length > 0) {
|
||||
// textBlock.Inlines.Add(new Run(inlines[i]));
|
||||
//// textBlock.Inlines.Add(new LineBreak());
|
||||
// }
|
||||
// }
|
||||
// var li = textBlock.Inlines.LastInline;
|
||||
// textBlock.Inlines.Remove(li);
|
||||
// SetDimension(textBlock,exportText.StyleDecorator);
|
||||
// textBlock.Background = ConvertBrush(exportText.StyleDecorator.BackColor);
|
||||
// SetContendAlignment(textBlock,exportText.StyleDecorator);
|
||||
SetPosition(textBlock,exportText); |
||||
SetDimension(textBlock,exportText); |
||||
textBlock.Background = ConvertBrush(exportText.BackColor); |
||||
return textBlock; |
||||
} |
||||
|
||||
|
||||
Canvas CreateCanvas(ExportContainer container) |
||||
{ |
||||
var canvas = new Canvas(); |
||||
SetDimension(canvas, container); |
||||
SetPosition(canvas,container); |
||||
canvas.Background = ConvertBrush(System.Drawing.Color.Red); |
||||
return canvas; |
||||
} |
||||
|
||||
|
||||
static void SetDimension (FrameworkElement element,ExportColumn exportColumn) |
||||
{ |
||||
element.Width = exportColumn.DesiredSize.Width; |
||||
element.Height = exportColumn.DesiredSize.Height; |
||||
} |
||||
|
||||
|
||||
static void SetPosition (FrameworkElement element,ExportColumn exportColumn) { |
||||
FixedPage.SetLeft(element,exportColumn.Location.X ); |
||||
FixedPage.SetTop(element,exportColumn.Location.Y); |
||||
} |
||||
|
||||
void SetFont(TextBlock textBlock,ExportText exportText) |
||||
{ |
||||
textBlock.FontFamily = new FontFamily(exportText.Font.FontFamily.Name); |
||||
|
||||
textBlock.FontSize = exportText.Font.Size * 96/72; |
||||
|
||||
if (exportText.Font.Bold) { |
||||
textBlock.FontWeight = FontWeights.Bold; |
||||
} |
||||
if (exportText.Font.Underline) { |
||||
CreateUnderline(textBlock,exportText); |
||||
} |
||||
|
||||
if (exportText.Font.Italic) { |
||||
textBlock.FontStyle = System.Windows.FontStyles.Italic ; |
||||
} |
||||
if (exportText.Font.Strikeout) { |
||||
CreateStrikeout(textBlock,exportText); |
||||
} |
||||
} |
||||
|
||||
|
||||
void CreateStrikeout (TextBlock textBlock,ExportColumn exportColumn ) |
||||
{ |
||||
var strikeOut = new TextDecoration(); |
||||
strikeOut.Location = TextDecorationLocation.Strikethrough; |
||||
|
||||
Pen p = CreateWpfPen(exportColumn); |
||||
strikeOut.Pen = p ; |
||||
strikeOut.PenThicknessUnit = TextDecorationUnit.FontRecommended; |
||||
textBlock.TextDecorations.Add(strikeOut); |
||||
} |
||||
|
||||
|
||||
void CreateUnderline(TextBlock textBlock,ExportColumn exportColumn) |
||||
{ |
||||
var underLine = new TextDecoration(); |
||||
Pen p = CreateWpfPen(exportColumn); |
||||
underLine.Pen = p ; |
||||
underLine.PenThicknessUnit = TextDecorationUnit.FontRecommended; |
||||
textBlock.TextDecorations.Add(underLine); |
||||
} |
||||
|
||||
|
||||
Pen CreateWpfPen(ExportColumn exportColumn) |
||||
{ |
||||
var myPen = new Pen(); |
||||
myPen.Brush = ConvertBrush(exportColumn.ForeColor); |
||||
myPen.Thickness = 1.5; |
||||
return myPen; |
||||
} |
||||
|
||||
|
||||
Brush ConvertBrush(System.Drawing.Color color) |
||||
{ |
||||
if (brushConverter.IsValid(color.Name)){ |
||||
return brushConverter.ConvertFromString(color.Name) as SolidColorBrush; |
||||
} else{ |
||||
return brushConverter.ConvertFromString("Black") as SolidColorBrush; |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,36 @@
@@ -0,0 +1,36 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 28.04.2013 |
||||
* Time: 18:59 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.ObjectModel; |
||||
using ICSharpCode.Reporting.Interfaces.Export; |
||||
|
||||
namespace ICSharpCode.Reporting.Exporter |
||||
{ |
||||
/// <summary>
|
||||
/// Description of Baseexport.
|
||||
/// </summary>
|
||||
public class BaseExporter |
||||
{ |
||||
public BaseExporter(Collection<IPage> pages) |
||||
{ |
||||
if (pages == null) { |
||||
throw new ArgumentException("pages"); |
||||
} |
||||
|
||||
Pages = pages; |
||||
} |
||||
|
||||
public virtual void Run () { |
||||
|
||||
} |
||||
|
||||
|
||||
protected Collection<IPage> Pages {get; set;} |
||||
} |
||||
} |
@ -0,0 +1,59 @@
@@ -0,0 +1,59 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 18.04.2013 |
||||
* Time: 20:06 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Collections.ObjectModel; |
||||
|
||||
using ICSharpCode.Reporting.Exporter.Visitors; |
||||
using ICSharpCode.Reporting.Interfaces.Export; |
||||
|
||||
namespace ICSharpCode.Reporting.Exporter |
||||
{ |
||||
/// <summary>
|
||||
/// Description of DebugExporter.
|
||||
/// </summary>
|
||||
public class DebugExporter:BaseExporter |
||||
{ |
||||
private DebugVisitor visitor; |
||||
|
||||
public DebugExporter(Collection<IPage> pages):base(pages) |
||||
{ |
||||
visitor = new DebugVisitor(); |
||||
} |
||||
|
||||
|
||||
public override void Run () { |
||||
foreach (var page in Pages) { |
||||
ShowDebug(page); |
||||
} |
||||
} |
||||
|
||||
|
||||
void ShowDebug(IExportContainer container) |
||||
{ |
||||
foreach (var item in container.ExportedItems) { |
||||
var exportContainer = item as IExportContainer; |
||||
var acceptor = item as IAcceptor; |
||||
if (exportContainer != null) { |
||||
if (acceptor != null) { |
||||
Console.WriteLine("--container--"); |
||||
acceptor.Accept(visitor); |
||||
} |
||||
ShowDebug(item as IExportContainer); |
||||
} else { |
||||
if (acceptor != null) { |
||||
Console.WriteLine("..Item..."); |
||||
acceptor.Accept(visitor); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,24 @@
@@ -0,0 +1,24 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 28.04.2013 |
||||
* Time: 19:49 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using ICSharpCode.Reporting.PageBuilder.ExportColumns; |
||||
|
||||
namespace ICSharpCode.Reporting.Exporter.Visitors |
||||
{ |
||||
/// <summary>
|
||||
/// Description of AbstractVisitor.
|
||||
/// </summary>
|
||||
public abstract class AbstractVisitor : IVisitor |
||||
{ |
||||
public abstract void Visit(ExportColumn exportColumn); |
||||
public abstract void Visit(ExportContainer exportColumn); |
||||
public abstract void Visit(ExportText exportColumn); |
||||
} |
||||
} |
@ -0,0 +1,41 @@
@@ -0,0 +1,41 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 18.04.2013 |
||||
* Time: 20:09 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using ICSharpCode.Reporting.PageBuilder.ExportColumns; |
||||
|
||||
namespace ICSharpCode.Reporting.Exporter.Visitors |
||||
{ |
||||
|
||||
// http://www.remondo.net/visitor-pattern-example-csharp/
|
||||
// http://www.codeproject.com/Articles/42240/Visitor-Design-Pattern
|
||||
// http://www.remondo.net/strategy-pattern-example-csharp/
|
||||
|
||||
|
||||
public class DebugVisitor : AbstractVisitor |
||||
{ |
||||
public override void Visit(ExportColumn exportColumn) |
||||
{ |
||||
Console.WriteLine("Visit ExportColumn {0} - {1} - {2}", exportColumn.Name,exportColumn.Size,exportColumn.Location); |
||||
} |
||||
|
||||
|
||||
|
||||
public override void Visit(ExportContainer exportColumn) |
||||
{ |
||||
Console.WriteLine("Visit ExportContainer {0} - {1} - {2}", exportColumn.Name,exportColumn.Size,exportColumn.Location); |
||||
} |
||||
|
||||
public override void Visit(ExportText exportColumn) |
||||
{ |
||||
Console.WriteLine("Visit ExportText {0} - {1} - {2}", exportColumn.Name,exportColumn.Size,exportColumn.Location); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,20 @@
@@ -0,0 +1,20 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 20.04.2013 |
||||
* Time: 18:30 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
|
||||
namespace ICSharpCode.Reporting.Exporter.Visitors |
||||
{ |
||||
/// <summary>
|
||||
/// Description of IAcceptor.
|
||||
/// </summary>
|
||||
public interface IAcceptor |
||||
{ |
||||
void Accept(IVisitor visitor); |
||||
} |
||||
} |
@ -0,0 +1,21 @@
@@ -0,0 +1,21 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 18.04.2013 |
||||
* Time: 20:09 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using ICSharpCode.Reporting.PageBuilder.ExportColumns; |
||||
|
||||
namespace ICSharpCode.Reporting.Exporter.Visitors |
||||
{ |
||||
public interface IVisitor |
||||
{ |
||||
void Visit(ExportColumn exportColumn); |
||||
void Visit(ExportContainer exportColumn); |
||||
void Visit(ExportText exportColumn); |
||||
} |
||||
} |
@ -0,0 +1,63 @@
@@ -0,0 +1,63 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 06.05.2013 |
||||
* Time: 20:10 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
using System.Windows.Documents; |
||||
using System.Windows.Media; |
||||
|
||||
using ICSharpCode.Reporting.ExportRenderer; |
||||
using ICSharpCode.Reporting.Interfaces.Export; |
||||
using ICSharpCode.Reporting.Items; |
||||
using ICSharpCode.Reporting.PageBuilder.ExportColumns; |
||||
|
||||
namespace ICSharpCode.Reporting.Exporter.Visitors |
||||
{ |
||||
/// <summary>
|
||||
/// Description of WpfVisitor.
|
||||
/// </summary>
|
||||
internal class WpfVisitor: AbstractVisitor |
||||
{ |
||||
private readonly FixedDocumentCreator documentCreator; |
||||
private readonly ReportSettings reportSettings; |
||||
|
||||
public WpfVisitor(ReportSettings reportSettings) |
||||
{ |
||||
if (reportSettings == null) |
||||
throw new ArgumentNullException("reportSettings"); |
||||
this.reportSettings = reportSettings; |
||||
documentCreator = new FixedDocumentCreator(reportSettings); |
||||
} |
||||
|
||||
public override void Visit(ExportColumn exportColumn) |
||||
{ |
||||
// Console.WriteLine("Wpf-Visit ExportColumn {0} - {1} - {2}", exportColumn.Name,exportColumn.Size,exportColumn.Location);
|
||||
} |
||||
|
||||
|
||||
public override void Visit(ExportContainer exportColumn) |
||||
{ |
||||
// Console.WriteLine("Wpf-Visit ExportContainer {0} - {1} - {2}", exportColumn.Name,exportColumn.Size,exportColumn.Location);
|
||||
var canvas = documentCreator.CreateContainer(exportColumn); |
||||
UIElement = canvas; |
||||
} |
||||
|
||||
|
||||
public override void Visit(ExportText exportColumn) |
||||
{ |
||||
// Console.WriteLine("Wpf-Visit ExportText {0} - {1} - {2}", exportColumn.Name,exportColumn.Size,exportColumn.DesiredSize);
|
||||
var textBlock = documentCreator.CreateTextBlock(exportColumn); |
||||
UIElement = textBlock; |
||||
} |
||||
|
||||
|
||||
public UIElement UIElement {get; private set;} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,103 @@
@@ -0,0 +1,103 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 28.04.2013 |
||||
* Time: 18:01 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.ObjectModel; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
using System.Windows.Documents; |
||||
|
||||
using ICSharpCode.Reporting.Exporter.Visitors; |
||||
using ICSharpCode.Reporting.Interfaces.Export; |
||||
using ICSharpCode.Reporting.Items; |
||||
using ICSharpCode.Reporting.PageBuilder.ExportColumns; |
||||
|
||||
namespace ICSharpCode.Reporting.Exporter |
||||
{ |
||||
/// <summary>
|
||||
/// Description of PrintExporter.
|
||||
/// </summary>
|
||||
public class WpfExporter:BaseExporter |
||||
{ |
||||
private WpfVisitor visitor; |
||||
private ReportSettings reportSettings; |
||||
|
||||
public WpfExporter(ReportSettings reportSettings,Collection<IPage> pages):base(pages) |
||||
{ |
||||
if (reportSettings == null) |
||||
throw new ArgumentNullException("reportSettings"); |
||||
this.reportSettings = reportSettings; |
||||
visitor = new WpfVisitor(reportSettings); |
||||
} |
||||
|
||||
|
||||
public override void Run () { |
||||
InitFixedPage(); |
||||
foreach (var page in Pages) { |
||||
InternalRun(page); |
||||
} |
||||
} |
||||
|
||||
|
||||
void InitFixedPage() |
||||
{ |
||||
fixedPage = new FixedPage(); |
||||
fixedPage.Width = reportSettings.PageSize.Width; |
||||
fixedPage.Height = reportSettings.PageSize.Height; |
||||
} |
||||
|
||||
FixedPage fixedPage; |
||||
|
||||
public FixedPage FixedPage { |
||||
get { return fixedPage; } |
||||
} |
||||
|
||||
|
||||
void InternalRun(IExportContainer container) |
||||
{ |
||||
Canvas canvas = null ; |
||||
foreach (var item in container.ExportedItems) { |
||||
var exportContainer = item as IExportContainer; |
||||
var acceptor = item as IAcceptor; |
||||
if (exportContainer != null) { |
||||
if (acceptor != null) { |
||||
acceptor.Accept(visitor); |
||||
canvas = (Canvas)visitor.UIElement; |
||||
fixedPage.Children.Add(canvas); |
||||
foreach (IAcceptor element in exportContainer.ExportedItems) { |
||||
element.Accept(visitor); |
||||
var ui = visitor.UIElement; |
||||
Canvas.SetLeft(ui,((IExportColumn)element).Location.X); |
||||
Canvas.SetTop(ui, ((IExportColumn)element).Location.Y); |
||||
canvas.Children.Add(ui); |
||||
} |
||||
// var size = new Size(exportContainer.DesiredSize.Width,exportContainer.DesiredSize.Height);
|
||||
// canvas.Measure(size);
|
||||
// canvas.Arrange(new Rect(new System.Windows.Point(exportContainer.Location.X,exportContainer.Location.Y),size ));
|
||||
// canvas.UpdateLayout();
|
||||
// var exportArrange = exportContainer.GetArrangeStrategy();
|
||||
// exportArrange.Arrange(exportContainer);
|
||||
} |
||||
// InternalRun(item as IExportContainer);
|
||||
} else { |
||||
if (acceptor != null) { |
||||
Console.WriteLine("..Item..."); |
||||
acceptor.Accept(visitor); |
||||
var uiElement = visitor.UIElement; |
||||
if (canvas != null) { |
||||
Canvas.SetLeft(uiElement, item.Location.X - exportContainer.Location.X); |
||||
Canvas.SetTop(uiElement, item.Location.Y - exportContainer.Location.Y); |
||||
canvas.Children.Add(uiElement); |
||||
} |
||||
fixedPage.Children.Add(uiElement); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,32 @@
@@ -0,0 +1,32 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 09.04.2013 |
||||
* Time: 19:51 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using ICSharpCode.Reporting.BaseClasses; |
||||
using ICSharpCode.Reporting.Interfaces; |
||||
using ICSharpCode.Reporting.Interfaces.Export; |
||||
using ICSharpCode.Reporting.Items; |
||||
using ICSharpCode.Reporting.PageBuilder.ExportColumns; |
||||
|
||||
namespace ICSharpCode.Reporting.Factories |
||||
{ |
||||
/// <summary>
|
||||
/// Description of ExportColumnFactory.
|
||||
/// </summary>
|
||||
internal class ExportColumnFactory |
||||
{ |
||||
public ExportColumnFactory() |
||||
{ |
||||
} |
||||
|
||||
public static IExportColumn CreateItem (IPrintableObject item) { |
||||
var export = item.CreateExportColumn(); |
||||
return export; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,46 @@
@@ -0,0 +1,46 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 01.06.2013 |
||||
* Time: 18:59 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using ICSharpCode.Reporting.Globals; |
||||
using ICSharpCode.Reporting.Interfaces; |
||||
using ICSharpCode.Reporting.Items; |
||||
using ICSharpCode.Reporting.PageBuilder; |
||||
|
||||
namespace ICSharpCode.Reporting.Factories |
||||
{ |
||||
/// <summary>
|
||||
/// Description of ReportCreatorFactory.
|
||||
/// </summary>
|
||||
internal class ReportCreatorFactory { |
||||
|
||||
public static IReportCreator ExporterFactory(IReportModel reportModel) |
||||
{ |
||||
IReportCreator reportCreator = null; |
||||
switch (reportModel.ReportSettings.DataModel) { |
||||
case GlobalEnums.PushPullModel.FormSheet: |
||||
{ |
||||
reportCreator = new FormPageBuilder(reportModel); |
||||
break; |
||||
} |
||||
|
||||
case GlobalEnums.PushPullModel.PullData: |
||||
{ |
||||
break; |
||||
} |
||||
|
||||
case GlobalEnums.PushPullModel.PushData: |
||||
{ |
||||
break; |
||||
} |
||||
|
||||
} |
||||
return reportCreator; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,30 @@
@@ -0,0 +1,30 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 06.04.2013 |
||||
* Time: 20:08 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using ICSharpCode.Reporting.Items; |
||||
|
||||
namespace ICSharpCode.Reporting.Factories |
||||
{ |
||||
/// <summary>
|
||||
/// Description of SectionFactory.
|
||||
/// </summary>
|
||||
internal sealed class SectionFactory |
||||
{ |
||||
private SectionFactory () |
||||
{ |
||||
|
||||
} |
||||
public static BaseSection Create(string sectionName) { |
||||
if (String.IsNullOrEmpty(sectionName)) { |
||||
throw new ArgumentException("sectionName"); |
||||
} |
||||
return new BaseSection(sectionName); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,28 @@
@@ -0,0 +1,28 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 24.04.2013 |
||||
* Time: 19:53 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Drawing; |
||||
|
||||
namespace ICSharpCode.Reporting.Globals |
||||
{ |
||||
/// <summary>
|
||||
/// Description of CreateGraphics.
|
||||
/// </summary>
|
||||
public class CreateGraphics |
||||
{ |
||||
public static Graphics FromSize (Size size){ |
||||
if (size == null) { |
||||
throw new ArgumentNullException("size"); |
||||
} |
||||
Bitmap bitmap = new Bitmap(size.Width,size.Height); |
||||
var graphics = Graphics.FromImage(bitmap); |
||||
return graphics; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,50 @@
@@ -0,0 +1,50 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 17.03.2013 |
||||
* Time: 17:30 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
|
||||
namespace ICSharpCode.Reporting.Globals |
||||
{ |
||||
/// <summary>
|
||||
/// Description of GlobalEnums.
|
||||
/// </summary>
|
||||
public class GlobalEnums |
||||
{ |
||||
public enum ReportSection { |
||||
ReportHeader, |
||||
ReportPageHeader, |
||||
ReportDetail, |
||||
ReportPageFooter, |
||||
ReportFooter |
||||
} |
||||
|
||||
///<summary>Technics to get the data
|
||||
/// Push : report get's a ready filld dataset or something tah implements IList
|
||||
/// Pull : report has to fill data by themself
|
||||
/// FormSheet : FormSheet report, just labels and images are allowed
|
||||
/// </summary>
|
||||
///
|
||||
public enum PushPullModel { |
||||
PushData, |
||||
PullData, |
||||
FormSheet |
||||
} |
||||
|
||||
|
||||
/// <summary>
|
||||
/// FormSheet means a blank form with Labels, Lines and Checkboxes
|
||||
/// DataReport handles all Reports with Data
|
||||
/// </summary>
|
||||
public enum ReportType { |
||||
FormSheet, |
||||
DataReport, |
||||
} |
||||
|
||||
|
||||
} |
||||
} |
@ -0,0 +1,42 @@
@@ -0,0 +1,42 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 17.03.2013 |
||||
* Time: 17:57 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Drawing; |
||||
namespace ICSharpCode.Reporting.Globals |
||||
{ |
||||
/// <summary>
|
||||
/// Description of GlobalValues.
|
||||
/// </summary>
|
||||
public static class GlobalValues |
||||
{ |
||||
public static string ReportExtension {get {return ".srd";}} |
||||
|
||||
public static string DefaultReportName {get { return "Report1";}} |
||||
|
||||
public static Size DefaultPageSize {get {return new Size(827,1169);}} |
||||
|
||||
public static string PlainFileName |
||||
{ |
||||
get { |
||||
return DefaultReportName + ReportExtension; |
||||
} |
||||
} |
||||
|
||||
|
||||
public static Font DefaultFont |
||||
{ |
||||
get { |
||||
return new Font("Microsoft Sans Serif", |
||||
10, |
||||
FontStyle.Regular, |
||||
GraphicsUnit.Point); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,44 @@
@@ -0,0 +1,44 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 30.04.2013 |
||||
* Time: 19:44 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Drawing; |
||||
using ICSharpCode.Reporting.Items; |
||||
|
||||
namespace ICSharpCode.Reporting.Globals |
||||
{ |
||||
/// <summary>
|
||||
/// Description of MeasurementService.
|
||||
/// </summary>
|
||||
internal class MeasurementService |
||||
{ |
||||
|
||||
public MeasurementService() |
||||
{ |
||||
} |
||||
|
||||
public static Size Measure (ITextItem item,Graphics graphics) { |
||||
|
||||
if (!item.CanGrow) { |
||||
return item.Size; |
||||
} |
||||
if (!String.IsNullOrEmpty(item.Text)) { |
||||
SizeF size = graphics.MeasureString(item.Text.TrimEnd(), |
||||
item.Font, |
||||
item.Size.Width); |
||||
var i = (int)size.Height/item.Font.Height; |
||||
if (size.Height < item.Size.Height) { |
||||
return item.Size; |
||||
} |
||||
return new Size(item.Size.Width,(int)Math.Ceiling(size.Height)); |
||||
} |
||||
|
||||
return item.Size; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,51 @@
@@ -0,0 +1,51 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 21.05.2013 |
||||
* Time: 20:35 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections; |
||||
using System.Collections.ObjectModel; |
||||
|
||||
using ICSharpCode.Reporting.BaseClasses; |
||||
using ICSharpCode.Reporting.DataManager.Listhandling; |
||||
|
||||
namespace ICSharpCode.Reporting.Interfaces.Data |
||||
{ |
||||
/// <summary>
|
||||
/// Description of IDataViewHandling.
|
||||
/// </summary>
|
||||
public interface IDataViewHandling:IEnumerator{ |
||||
|
||||
void Sort (); |
||||
|
||||
void Group(); |
||||
|
||||
void Bind(); |
||||
|
||||
// void Fill (int position,ReportItemCollection collection);
|
||||
|
||||
//rausnehmen
|
||||
// void Fill (IDataItem item);
|
||||
|
||||
void Fill(ReportItemCollection collection); |
||||
|
||||
IndexList IndexList {get;} |
||||
|
||||
// object CurrentFromPosition(int pos);
|
||||
|
||||
// CurrentItemsCollection FillDataRow();
|
||||
// CurrentItemsCollection FillDataRow(int pos);
|
||||
//
|
||||
Collection<AbstractColumn> AvailableFields {get;} |
||||
|
||||
int Count {get;} |
||||
|
||||
int CurrentPosition {get;set;} |
||||
|
||||
// IExpressionEvaluatorFacade ExpressionEvaluator {get;}
|
||||
} |
||||
} |
@ -0,0 +1,27 @@
@@ -0,0 +1,27 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 08.04.2013 |
||||
* Time: 20:10 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Drawing; |
||||
using ICSharpCode.Reporting.Arrange; |
||||
using ICSharpCode.Reporting.BaseClasses; |
||||
using ICSharpCode.Reporting.Exporter; |
||||
|
||||
namespace ICSharpCode.Reporting.Interfaces.Export |
||||
{ |
||||
/// <summary>
|
||||
/// Description of IExportColumn.
|
||||
/// </summary>
|
||||
public interface IExportColumn:IReportObject |
||||
{ |
||||
IArrangeStrategy GetArrangeStrategy(); |
||||
Size DesiredSize {get;set;} |
||||
IExportColumn Parent {get;set;} |
||||
Rectangle DisplayRectangle {get;} |
||||
} |
||||
} |
@ -0,0 +1,23 @@
@@ -0,0 +1,23 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 12.04.2013 |
||||
* Time: 20:28 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using ICSharpCode.Reporting.PageBuilder.ExportColumns; |
||||
|
||||
namespace ICSharpCode.Reporting.Interfaces.Export |
||||
{ |
||||
/// <summary>
|
||||
/// Description of IExportContainer.
|
||||
/// </summary>
|
||||
public interface IExportContainer:IExportColumn |
||||
{ |
||||
List<IExportColumn> ExportedItems {get;} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,22 @@
@@ -0,0 +1,22 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 11.04.2013 |
||||
* Time: 19:58 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.Generic; |
||||
|
||||
namespace ICSharpCode.Reporting.Interfaces.Export |
||||
{ |
||||
/// <summary>
|
||||
/// Description of IPage.
|
||||
/// </summary>
|
||||
public interface IPage:IExportContainer |
||||
{ |
||||
bool IsFirstPage {get;set;} |
||||
IPageInfo PageInfo {get;} |
||||
} |
||||
} |
@ -0,0 +1,24 @@
@@ -0,0 +1,24 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 11.04.2013 |
||||
* Time: 19:59 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
|
||||
namespace ICSharpCode.Reporting.Interfaces.Export |
||||
{ |
||||
/// <summary>
|
||||
/// Description of IPageInfo.
|
||||
/// </summary>
|
||||
public interface IPageInfo |
||||
{ |
||||
int PageNumber {get;set;} |
||||
int TotalPages {get;set;} |
||||
string ReportName {get;set;} |
||||
string ReportFileName {get;set;} |
||||
string ReportFolder {get;} |
||||
} |
||||
} |
@ -0,0 +1,26 @@
@@ -0,0 +1,26 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 29.05.2013 |
||||
* Time: 20:10 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
|
||||
namespace ICSharpCode.Reporting.Interfaces |
||||
{ |
||||
/// <summary>
|
||||
/// Description of IDataItem.
|
||||
/// </summary>
|
||||
public interface IDataItem |
||||
{ |
||||
|
||||
string ColumnName { get; set; } |
||||
// string MappingName { get; }
|
||||
// string BaseTableName { get; set; }
|
||||
string DBValue {get;set;} |
||||
string Name {get;set;} |
||||
string DataType {get;set;} |
||||
} |
||||
} |
@ -0,0 +1,36 @@
@@ -0,0 +1,36 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 06.04.2013 |
||||
* Time: 19:55 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Drawing; |
||||
using ICSharpCode.Reporting.Arrange; |
||||
using ICSharpCode.Reporting.Interfaces.Export; |
||||
|
||||
namespace ICSharpCode.Reporting.Interfaces |
||||
{ |
||||
/// <summary>
|
||||
/// Description of IPrintObject.
|
||||
/// </summary>
|
||||
public interface IReportObject { |
||||
string Name{get;set;} |
||||
Size Size {get;set;} |
||||
Point Location {get;set;} |
||||
Color ForeColor {get;set;} |
||||
Color BackColor {get;set;} |
||||
Color FrameColor{get;set;} |
||||
bool CanGrow {get;set;} |
||||
} |
||||
|
||||
|
||||
public interface IPrintableObject:IReportObject { |
||||
IExportColumn CreateExportColumn(); |
||||
IMeasurementStrategy MeasurementStrategy (); |
||||
|
||||
} |
||||
|
||||
} |
@ -0,0 +1,23 @@
@@ -0,0 +1,23 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 16.04.2013 |
||||
* Time: 19:53 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using ICSharpCode.Reporting.Interfaces.Export; |
||||
using ICSharpCode.Reporting.Items; |
||||
|
||||
namespace ICSharpCode.Reporting.Interfaces |
||||
{ |
||||
/// <summary>
|
||||
/// Description of IReportContainer.
|
||||
/// </summary>
|
||||
public interface IReportContainer :IPrintableObject |
||||
{ |
||||
List<IPrintableObject> Items {get;} |
||||
} |
||||
} |
@ -0,0 +1,33 @@
@@ -0,0 +1,33 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 21.03.2013 |
||||
* Time: 20:06 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Collections.ObjectModel; |
||||
|
||||
using ICSharpCode.Reporting.BaseClasses; |
||||
using ICSharpCode.Reporting.Interfaces.Export; |
||||
|
||||
namespace ICSharpCode.Reporting.Interfaces |
||||
{ |
||||
/// <summary>
|
||||
/// Description of IReportCreator.
|
||||
/// </summary>
|
||||
public interface IReportCreator |
||||
{ |
||||
void BuildExportList (); |
||||
Collection<IPage> Pages {get;} |
||||
|
||||
// PagesCollection Pages{get;}
|
||||
// event EventHandler<PageCreatedEventArgs> PageCreated;
|
||||
// event EventHandler<SectionRenderEventArgs> SectionRendering;
|
||||
// event EventHandler<GroupHeaderEventArgs> GroupHeaderRendering;
|
||||
// event EventHandler<GroupFooterEventArgs> GroupFooterRendering;
|
||||
// event EventHandler<RowRenderEventArgs> RowRendering;
|
||||
} |
||||
} |
@ -0,0 +1,37 @@
@@ -0,0 +1,37 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 17.03.2013 |
||||
* Time: 17:20 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using ICSharpCode.Reporting.Items; |
||||
|
||||
namespace ICSharpCode.Reporting.Interfaces |
||||
{ |
||||
/// <summary>
|
||||
/// Description of IReportModel.
|
||||
/// </summary>
|
||||
public interface IReportModel |
||||
{ |
||||
ReportSettings ReportSettings {get;set;} |
||||
List<BaseSection> SectionCollection {get;} |
||||
/* |
||||
ISection ReportHeader {get;} |
||||
ISection PageHeader {get;} |
||||
ISection DetailSection {get;} |
||||
ISection PageFooter {get;} |
||||
ISection ReportFooter {get;} |
||||
|
||||
GlobalEnums.PushPullModel DataModel {get;} |
||||
*/ |
||||
IReportContainer ReportHeader {get;} |
||||
IReportContainer PageHeader {get;} |
||||
IReportContainer DetailSection {get;} |
||||
IReportContainer PageFooter {get;} |
||||
IReportContainer ReportFooter {get;} |
||||
} |
||||
} |
@ -0,0 +1,30 @@
@@ -0,0 +1,30 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 29.05.2013 |
||||
* Time: 20:08 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using ICSharpCode.Reporting.Interfaces; |
||||
|
||||
namespace ICSharpCode.Reporting.Items |
||||
{ |
||||
/// <summary>
|
||||
/// Description of BaseDataItem.
|
||||
/// </summary>
|
||||
public class BaseDataItem:BaseTextItem,IDataItem |
||||
{ |
||||
public BaseDataItem() |
||||
{ |
||||
} |
||||
|
||||
public virtual string DBValue {get;set;} |
||||
|
||||
public virtual string ColumnName {get;set;} |
||||
|
||||
public string DataType {get;set;} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,35 @@
@@ -0,0 +1,35 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 19.03.2013 |
||||
* Time: 20:19 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using ICSharpCode.Reporting.Interfaces; |
||||
using ICSharpCode.Reporting.Interfaces.Export; |
||||
using ICSharpCode.Reporting.PageBuilder.ExportColumns; |
||||
|
||||
namespace ICSharpCode.Reporting.Items |
||||
{ |
||||
/// <summary>
|
||||
/// Description of BaseSection.
|
||||
/// </summary>
|
||||
|
||||
public class BaseSection:ReportContainer,IReportContainer |
||||
{ |
||||
#region Constructors
|
||||
|
||||
public BaseSection() |
||||
{ |
||||
} |
||||
|
||||
public BaseSection (string name) { |
||||
Name = name; |
||||
} |
||||
|
||||
#endregion
|
||||
} |
||||
} |
@ -0,0 +1,61 @@
@@ -0,0 +1,61 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 07.04.2013 |
||||
* Time: 18:23 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Drawing; |
||||
using ICSharpCode.Reporting.Arrange; |
||||
using ICSharpCode.Reporting.Globals; |
||||
using ICSharpCode.Reporting.Interfaces; |
||||
using ICSharpCode.Reporting.Interfaces.Export; |
||||
using ICSharpCode.Reporting.PageBuilder.ExportColumns; |
||||
|
||||
namespace ICSharpCode.Reporting.Items |
||||
{ |
||||
/// <summary>
|
||||
/// Description of BaseTextItem.
|
||||
/// </summary>
|
||||
public interface ITextItem:IPrintableObject |
||||
{ |
||||
Font Font {get;set;} |
||||
string Text {get;set;} |
||||
} |
||||
|
||||
public class BaseTextItem:PrintableItem,ITextItem |
||||
{ |
||||
public BaseTextItem(){ |
||||
Name = "BaseTextItem"; |
||||
Font = GlobalValues.DefaultFont; |
||||
} |
||||
|
||||
|
||||
public Font Font {get;set;} |
||||
|
||||
public string Text {get;set;} |
||||
|
||||
public override IExportColumn CreateExportColumn() |
||||
{ |
||||
var ex = new ExportText(); |
||||
ex.Name = Name; |
||||
ex.Location = Location; |
||||
ex.ForeColor = ForeColor; |
||||
ex.BackColor = BackColor; |
||||
ex.FrameColor = FrameColor; |
||||
ex.Size = Size; |
||||
ex.Font = Font; |
||||
ex.Text = Text; |
||||
ex.CanGrow = CanGrow; |
||||
return ex; |
||||
} |
||||
|
||||
public override ICSharpCode.Reporting.Arrange.IMeasurementStrategy MeasurementStrategy() |
||||
{ |
||||
return new TextBasedMeasurementStrategy(); |
||||
} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,45 @@
@@ -0,0 +1,45 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 06.04.2013 |
||||
* Time: 20:15 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Drawing; |
||||
using ICSharpCode.Reporting.Arrange; |
||||
using ICSharpCode.Reporting.Interfaces; |
||||
using ICSharpCode.Reporting.Interfaces.Export; |
||||
|
||||
namespace ICSharpCode.Reporting.Items |
||||
{ |
||||
public class PrintableItem : IPrintableObject |
||||
{ |
||||
public string Name { get; set; } |
||||
|
||||
public Point Location { get; set; } |
||||
|
||||
public Size Size { get; set; } |
||||
|
||||
|
||||
public virtual IExportColumn CreateExportColumn() |
||||
{ |
||||
return null; |
||||
} |
||||
|
||||
public virtual IMeasurementStrategy MeasurementStrategy () |
||||
{ |
||||
return null; |
||||
} |
||||
|
||||
public Color ForeColor {get;set;} |
||||
|
||||
public Color BackColor {get;set;} |
||||
|
||||
public Color FrameColor {get;set;} |
||||
|
||||
public bool CanGrow {get;set;} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,53 @@
@@ -0,0 +1,53 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 16.04.2013 |
||||
* Time: 19:51 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using ICSharpCode.Reporting.Arrange; |
||||
using ICSharpCode.Reporting.Exporter; |
||||
using ICSharpCode.Reporting.Interfaces; |
||||
using ICSharpCode.Reporting.Interfaces.Export; |
||||
using ICSharpCode.Reporting.PageBuilder.ExportColumns; |
||||
|
||||
namespace ICSharpCode.Reporting.Items |
||||
{ |
||||
/// <summary>
|
||||
/// Description of ReportContainer.
|
||||
/// </summary>
|
||||
public class ReportContainer:PrintableItem,IReportContainer |
||||
{ |
||||
|
||||
public ReportContainer() |
||||
{ |
||||
items = new List<IPrintableObject>(); |
||||
} |
||||
|
||||
private List<IPrintableObject> items; |
||||
|
||||
public List<IPrintableObject> Items { |
||||
get { return items; } |
||||
} |
||||
|
||||
|
||||
public override IExportColumn CreateExportColumn() |
||||
{ |
||||
return new ExportContainer(){ |
||||
Name = this.Name, |
||||
Size = this.Size, |
||||
Location = this.Location, |
||||
CanGrow = this.CanGrow, |
||||
}; |
||||
} |
||||
|
||||
|
||||
public override IMeasurementStrategy MeasurementStrategy() |
||||
{ |
||||
return new ContainerMeasurementStrategy(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,88 @@
@@ -0,0 +1,88 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 17.03.2013 |
||||
* Time: 17:18 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using ICSharpCode.Reporting.Factories; |
||||
using ICSharpCode.Reporting.Globals; |
||||
using ICSharpCode.Reporting.Interfaces; |
||||
|
||||
namespace ICSharpCode.Reporting.Items |
||||
{ |
||||
/// <summary>
|
||||
/// Description of ReportModel.
|
||||
/// </summary>
|
||||
public class ReportModel :IReportModel |
||||
{ |
||||
|
||||
public ReportModel() { |
||||
SectionCollection = new List<BaseSection>(); |
||||
} |
||||
|
||||
|
||||
#region Sections
|
||||
|
||||
public IReportContainer ReportHeader |
||||
{ |
||||
get { |
||||
return (BaseSection)SectionCollection[0]; |
||||
} |
||||
} |
||||
|
||||
|
||||
public IReportContainer PageHeader |
||||
{ |
||||
get { |
||||
return (BaseSection)SectionCollection[1]; |
||||
} |
||||
} |
||||
|
||||
|
||||
public IReportContainer DetailSection |
||||
{ |
||||
get { |
||||
return (BaseSection)SectionCollection[2]; |
||||
} |
||||
} |
||||
|
||||
|
||||
public IReportContainer PageFooter |
||||
{ |
||||
get { |
||||
return (BaseSection)SectionCollection[3]; |
||||
} |
||||
} |
||||
|
||||
public IReportContainer ReportFooter |
||||
{ |
||||
get { |
||||
return (BaseSection)SectionCollection[4]; |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
|
||||
ReportSettings reportSettings ; |
||||
|
||||
public ReportSettings ReportSettings |
||||
{ |
||||
get { |
||||
if (this.reportSettings == null) { |
||||
this.reportSettings = new ReportSettings(); |
||||
} |
||||
return reportSettings; |
||||
} |
||||
set { |
||||
reportSettings = value; |
||||
} |
||||
} |
||||
|
||||
public List<BaseSection> SectionCollection {get; private set;} |
||||
} |
||||
} |
@ -0,0 +1,144 @@
@@ -0,0 +1,144 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 17.03.2013 |
||||
* Time: 17:41 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Drawing; |
||||
using System.IO; |
||||
|
||||
using ICSharpCode.Reporting.Globals; |
||||
|
||||
namespace ICSharpCode.Reporting.Items |
||||
{ |
||||
/// <summary>
|
||||
/// Description of ReportSettings.
|
||||
/// </summary>
|
||||
public class ReportSettings |
||||
{ |
||||
|
||||
|
||||
public ReportSettings() |
||||
{ |
||||
this.pageSize = Globals.GlobalValues.DefaultPageSize; |
||||
BaseValues(); |
||||
} |
||||
|
||||
|
||||
void BaseValues() |
||||
{ |
||||
|
||||
// this.UseStandardPrinter = true;
|
||||
// this.GraphicsUnit = GraphicsUnit.Pixel;
|
||||
// this.Padding = new Padding(5);
|
||||
// this.DefaultFont = GlobalValues.DefaultFont;
|
||||
this.ReportType = GlobalEnums.ReportType.FormSheet; |
||||
//
|
||||
this.DataModel = GlobalEnums.PushPullModel.FormSheet; |
||||
//
|
||||
// this.CommandType = System.Data.CommandType.Text;
|
||||
// this.ConnectionString = String.Empty;
|
||||
// this.CommandText = String.Empty;
|
||||
//
|
||||
// this.TopMargin = GlobalValues.DefaultPageMargin.Left;
|
||||
// this.BottomMargin = GlobalValues.DefaultPageMargin.Bottom;
|
||||
// this.LeftMargin = GlobalValues.DefaultPageMargin.Left;
|
||||
// this.RightMargin = GlobalValues.DefaultPageMargin.Right;
|
||||
//
|
||||
// this.availableFields = new AvailableFieldsCollection();
|
||||
// this.groupingsCollection = new GroupColumnCollection();
|
||||
this.SortColumnsCollection = new SortColumnCollection(); |
||||
GroupColumnCollection = new GroupColumnCollection(); |
||||
// this.sqlParameters = new SqlParameterCollection();
|
||||
// this.parameterCollection = new ParameterCollection();
|
||||
// this.NoDataMessage = "No Data for this Report";
|
||||
} |
||||
|
||||
|
||||
private string reportName; |
||||
|
||||
// [Category("Base Settings")]
|
||||
// [DefaultValueAttribute ("")]
|
||||
public string ReportName |
||||
{ |
||||
get { |
||||
if (string.IsNullOrEmpty(reportName)) { |
||||
reportName = Globals.GlobalValues.DefaultReportName; |
||||
} |
||||
return reportName; |
||||
} |
||||
set { |
||||
if (reportName != value) { |
||||
reportName = value; |
||||
} |
||||
} |
||||
} |
||||
|
||||
private string fileName; |
||||
// [Category("Base Settings")]
|
||||
// [XmlIgnoreAttribute]
|
||||
public string FileName |
||||
{ |
||||
get { |
||||
if (String.IsNullOrEmpty(fileName)) { |
||||
fileName = GlobalValues.PlainFileName; |
||||
} |
||||
return Path.GetFullPath(fileName); |
||||
} |
||||
set { |
||||
fileName = value; |
||||
} |
||||
} |
||||
|
||||
|
||||
// [Category("Page Settings")]
|
||||
public int BottomMargin {get;set;} |
||||
|
||||
|
||||
// [Category("Page Settings")]
|
||||
public int TopMargin {get;set;} |
||||
|
||||
|
||||
|
||||
// [Category("Page Settings")]
|
||||
public int LeftMargin {get;set;} |
||||
|
||||
|
||||
|
||||
// [Category("Page Settings")]
|
||||
public int RightMargin {get;set;} |
||||
|
||||
private Size pageSize; |
||||
|
||||
public Size PageSize { |
||||
get { |
||||
if (!Landscape) { |
||||
return pageSize; |
||||
} else { |
||||
return new Size(pageSize.Height,pageSize.Width); |
||||
} |
||||
} |
||||
set { pageSize = value; } |
||||
} |
||||
|
||||
// [Category("Page Settings")]
|
||||
// public Size PageSize {get;set;}
|
||||
|
||||
// [Category("Page Settings")]
|
||||
public bool Landscape {get;set;} |
||||
|
||||
// [Category("Data")]
|
||||
public GlobalEnums.PushPullModel DataModel {get;set;} |
||||
|
||||
|
||||
// [Browsable(true), Category("Base Settings")]
|
||||
public GlobalEnums.ReportType ReportType {get;set;} |
||||
|
||||
public SortColumnCollection SortColumnsCollection {get;private set;} |
||||
|
||||
public GroupColumnCollection GroupColumnCollection {get;private set;} |
||||
} |
||||
} |
@ -0,0 +1,155 @@
@@ -0,0 +1,155 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 03.04.2013 |
||||
* Time: 20:32 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Collections.ObjectModel; |
||||
using System.Drawing; |
||||
using System.Linq; |
||||
|
||||
using ICSharpCode.Reporting.BaseClasses; |
||||
using ICSharpCode.Reporting.Globals; |
||||
using ICSharpCode.Reporting.Interfaces; |
||||
using ICSharpCode.Reporting.Interfaces.Export; |
||||
using ICSharpCode.Reporting.PageBuilder.Converter; |
||||
|
||||
namespace ICSharpCode.Reporting.PageBuilder |
||||
{ |
||||
/// <summary>
|
||||
/// Description of BasePageBuilder.
|
||||
/// </summary>
|
||||
public class BasePageBuilder:IReportCreator |
||||
{ |
||||
Graphics graphics; |
||||
|
||||
public BasePageBuilder(IReportModel reportModel) |
||||
{ |
||||
if (reportModel == null) { |
||||
throw new ArgumentNullException("reportModel"); |
||||
} |
||||
ReportModel = reportModel; |
||||
Pages = new Collection<IPage>(); |
||||
graphics = CreateGraphics.FromSize(reportModel.ReportSettings.PageSize); |
||||
} |
||||
|
||||
|
||||
protected IPage InitNewPage(){ |
||||
var pi = CreatePageInfo(); |
||||
return new Page(pi,ReportModel.ReportSettings.PageSize); |
||||
} |
||||
|
||||
#region create Sections
|
||||
|
||||
protected void BuildReportHeader() |
||||
{ |
||||
if (Pages.Count == 0) { |
||||
var header = CreateSection(ReportModel.ReportHeader,CurrentLocation); |
||||
var r = new Rectangle(header.Location.X,header.Location.Y,header.Size.Width,header.Size.Height); |
||||
CurrentLocation = new Point (ReportModel.ReportSettings.LeftMargin,r.Bottom + 1); |
||||
AddSectionToPage(header); |
||||
} |
||||
} |
||||
|
||||
|
||||
protected void BuildPageHeader() |
||||
{ |
||||
|
||||
var pageHeader = CreateSection(ReportModel.PageHeader,CurrentLocation); |
||||
DetailStart = new Point(ReportModel.ReportSettings.LeftMargin,pageHeader.Location.Y + pageHeader.Size.Height +1); |
||||
AddSectionToPage(pageHeader); |
||||
} |
||||
|
||||
|
||||
protected void BuildPageFooter() |
||||
{ |
||||
Console.WriteLine("FormPageBuilder - Build PageFooter {0} - {1}",ReportModel.ReportSettings.PageSize.Height,ReportModel.ReportSettings.BottomMargin); |
||||
CurrentLocation = new Point(ReportModel.ReportSettings.LeftMargin, |
||||
ReportModel.ReportSettings.PageSize.Height - ReportModel.ReportSettings.BottomMargin - ReportModel.PageFooter.Size.Height); |
||||
|
||||
var pageFooter = CreateSection(ReportModel.PageFooter,CurrentLocation); |
||||
AddSectionToPage(pageFooter); |
||||
} |
||||
|
||||
|
||||
protected void BuildReportFooter() |
||||
{ |
||||
Console.WriteLine("FormPageBuilder - Build ReportFooter {0} - {1}",ReportModel.ReportSettings.PageSize.Height,ReportModel.ReportSettings.BottomMargin); |
||||
var lastSection = CurrentPage.ExportedItems.Last(); |
||||
CurrentLocation = new Point(ReportModel.ReportSettings.LeftMargin, |
||||
lastSection.Location.Y - lastSection.Size.Height - 1); |
||||
|
||||
var reportFooter = CreateSection(ReportModel.ReportFooter,CurrentLocation); |
||||
AddSectionToPage(reportFooter); |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
protected virtual void WritePages() |
||||
{ |
||||
CurrentPage = InitNewPage(); |
||||
CurrentLocation = new Point(ReportModel.ReportSettings.LeftMargin,ReportModel.ReportSettings.TopMargin); |
||||
this.BuildReportHeader(); |
||||
BuildPageHeader(); |
||||
BuildPageFooter(); |
||||
// BuilDetail();
|
||||
BuildReportFooter(); |
||||
// base.AddPage(CurrentPage);
|
||||
// Console.WriteLine("------{0}---------",ReportModel.ReportSettings.PageSize);
|
||||
} |
||||
|
||||
|
||||
protected IExportContainer CreateSection(IReportContainer section,Point location) |
||||
{ |
||||
var containerConverter = new ContainerConverter(graphics, section, location); |
||||
var header = containerConverter.Convert(); |
||||
return header; |
||||
} |
||||
|
||||
|
||||
protected void AddSectionToPage(IExportContainer header) |
||||
{ |
||||
header.Parent = CurrentPage; |
||||
CurrentPage.ExportedItems.Add(header); |
||||
} |
||||
|
||||
|
||||
IPageInfo CreatePageInfo() |
||||
{ |
||||
var pi = new PageInfo(); |
||||
pi.PageNumber = Pages.Count +1; |
||||
pi.ReportName = ReportModel.ReportSettings.ReportName; |
||||
pi.ReportFileName = ReportModel.ReportSettings.FileName; |
||||
return pi; |
||||
} |
||||
|
||||
|
||||
protected virtual void AddPage(IPage page) { |
||||
if (Pages.Count == 0) { |
||||
page.IsFirstPage = true; |
||||
} |
||||
Pages.Add(page); |
||||
} |
||||
|
||||
|
||||
public virtual void BuildExportList() |
||||
{ |
||||
this.Pages.Clear(); |
||||
} |
||||
|
||||
protected IReportModel ReportModel {get; private set;} |
||||
|
||||
protected Point CurrentLocation {get; set;} |
||||
|
||||
protected IPage CurrentPage {get; set;} |
||||
|
||||
protected Point DetailStart {get;private set;} |
||||
|
||||
public Collection<IPage> Pages {get; private set;} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,73 @@
@@ -0,0 +1,73 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 08.04.2013 |
||||
* Time: 19:49 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Drawing; |
||||
|
||||
using ICSharpCode.Reporting.Factories; |
||||
using ICSharpCode.Reporting.Interfaces; |
||||
using ICSharpCode.Reporting.Interfaces.Export; |
||||
using ICSharpCode.Reporting.PageBuilder.ExportColumns; |
||||
|
||||
namespace ICSharpCode.Reporting.PageBuilder.Converter |
||||
{ |
||||
/// <summary>
|
||||
/// Description of SectionConverter.
|
||||
/// </summary>
|
||||
internal class ContainerConverter |
||||
{ |
||||
private Graphics graphics; |
||||
|
||||
public ContainerConverter(Graphics graphics,IReportContainer reportContainer,Point currentLocation ) |
||||
{ |
||||
if (graphics == null) { |
||||
throw new ArgumentNullException("graphics"); |
||||
} |
||||
if (reportContainer == null) { |
||||
throw new ArgumentNullException("reportContainer"); |
||||
} |
||||
|
||||
this.graphics = graphics; |
||||
Container = reportContainer; |
||||
CurrentLocation = currentLocation; |
||||
} |
||||
|
||||
|
||||
public IExportContainer Convert() { |
||||
var containerStrategy = Container.MeasurementStrategy (); |
||||
var exportContainer = (ExportContainer)Container.CreateExportColumn(); |
||||
|
||||
exportContainer.Location = CurrentLocation; |
||||
exportContainer.DesiredSize = containerStrategy.Measure(Container,graphics); |
||||
|
||||
var itemsList = new List<IExportColumn>(); |
||||
|
||||
foreach (var element in Container.Items) { |
||||
var item = ExportColumnFactory.CreateItem(element); |
||||
item.Parent = exportContainer; |
||||
var measureStrategy = element.MeasurementStrategy(); |
||||
item.DesiredSize = measureStrategy.Measure(element,graphics); |
||||
|
||||
itemsList.Add(item); |
||||
Console.WriteLine("Size {0} DesiredSize {1}",item.Size,item.DesiredSize); |
||||
} |
||||
exportContainer.ExportedItems.AddRange(itemsList); |
||||
|
||||
Console.WriteLine("calling Container-Arrange"); |
||||
var exportArrange = exportContainer.GetArrangeStrategy(); |
||||
exportArrange.Arrange(exportContainer); |
||||
|
||||
return exportContainer; |
||||
} |
||||
|
||||
internal IReportContainer Container {get; private set;} |
||||
|
||||
internal Point CurrentLocation {get; private set;} |
||||
} |
||||
} |
@ -0,0 +1,56 @@
@@ -0,0 +1,56 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 06.06.2013 |
||||
* Time: 20:27 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using ICSharpCode.Reporting.Items; |
||||
|
||||
namespace ICSharpCode.Reporting.PageBuilder |
||||
{ |
||||
/// <summary>
|
||||
/// Description of DataPageBuilder.
|
||||
/// </summary>
|
||||
public class DataPageBuilder:BasePageBuilder |
||||
{ |
||||
public DataPageBuilder(ReportModel reportModel, IEnumerable<object> list):base(reportModel) |
||||
{ |
||||
List = list; |
||||
} |
||||
|
||||
|
||||
public override void BuildExportList() |
||||
{ |
||||
base.BuildExportList(); |
||||
WritePages (); |
||||
} |
||||
|
||||
|
||||
void BuilDetail() |
||||
{ |
||||
Console.WriteLine("FormPageBuilder - Build DetailSection {0} - {1} - {2}",ReportModel.ReportSettings.PageSize.Width,ReportModel.ReportSettings.LeftMargin,ReportModel.ReportSettings.RightMargin); |
||||
CurrentLocation = DetailStart; |
||||
|
||||
var detail = CreateSection(ReportModel.DetailSection,CurrentLocation); |
||||
detail.Parent = CurrentPage; |
||||
CurrentPage.ExportedItems.Insert(2,detail); |
||||
} |
||||
|
||||
|
||||
protected override void WritePages() |
||||
{ |
||||
base.WritePages(); |
||||
BuilDetail(); |
||||
base.AddPage(CurrentPage); |
||||
Console.WriteLine("------{0}---------",ReportModel.ReportSettings.PageSize); |
||||
} |
||||
|
||||
|
||||
|
||||
public IEnumerable<object> List {get; private set;} |
||||
} |
||||
} |
@ -0,0 +1,55 @@
@@ -0,0 +1,55 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 08.04.2013 |
||||
* Time: 20:09 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Drawing; |
||||
using ICSharpCode.Reporting.Arrange; |
||||
using ICSharpCode.Reporting.BaseClasses; |
||||
using ICSharpCode.Reporting.Exporter; |
||||
using ICSharpCode.Reporting.Interfaces; |
||||
using ICSharpCode.Reporting.Interfaces.Export; |
||||
|
||||
namespace ICSharpCode.Reporting.PageBuilder.ExportColumns |
||||
{ |
||||
/// <summary>
|
||||
/// Description of BaseExportColumn.
|
||||
/// </summary>
|
||||
public class ExportColumn:IExportColumn |
||||
{ |
||||
|
||||
public string Name {get;set;} |
||||
|
||||
public Size Size {get;set;} |
||||
|
||||
public Point Location {get;set;} |
||||
|
||||
public virtual IArrangeStrategy GetArrangeStrategy () |
||||
{ |
||||
return null; |
||||
} |
||||
|
||||
public Size DesiredSize {get;set;} |
||||
|
||||
public Color ForeColor {get;set;} |
||||
|
||||
public Color BackColor {get;set;} |
||||
|
||||
public Color FrameColor {get;set;} |
||||
|
||||
public IExportColumn Parent {get;set;} |
||||
|
||||
public bool CanGrow {get;set;} |
||||
|
||||
|
||||
public Rectangle DisplayRectangle { |
||||
get { |
||||
return new Rectangle(Location,Size); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,44 @@
@@ -0,0 +1,44 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 12.04.2013 |
||||
* Time: 20:27 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using ICSharpCode.Reporting.Arrange; |
||||
using ICSharpCode.Reporting.Exporter; |
||||
using ICSharpCode.Reporting.Exporter.Visitors; |
||||
using ICSharpCode.Reporting.Interfaces.Export; |
||||
|
||||
namespace ICSharpCode.Reporting.PageBuilder.ExportColumns |
||||
{ |
||||
/// <summary>
|
||||
/// Description of BaseExportContainer.
|
||||
/// </summary>
|
||||
public class ExportContainer:ExportColumn,IExportContainer,IAcceptor |
||||
{ |
||||
public ExportContainer() |
||||
{ |
||||
exportedItems = new List<IExportColumn>(); |
||||
} |
||||
|
||||
List<IExportColumn> exportedItems; |
||||
|
||||
public List<IExportColumn> ExportedItems { |
||||
get { return exportedItems; } |
||||
} |
||||
|
||||
public void Accept(IVisitor visitor) |
||||
{ |
||||
visitor.Visit(this); |
||||
} |
||||
|
||||
public override ICSharpCode.Reporting.Arrange.IArrangeStrategy GetArrangeStrategy() |
||||
{ |
||||
return new ContainerArrangeStrategy(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,45 @@
@@ -0,0 +1,45 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 10.04.2013 |
||||
* Time: 20:00 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Drawing; |
||||
using ICSharpCode.Reporting.Exporter; |
||||
using ICSharpCode.Reporting.Exporter.Visitors; |
||||
using ICSharpCode.Reporting.Interfaces.Export; |
||||
|
||||
namespace ICSharpCode.Reporting.PageBuilder.ExportColumns |
||||
{ |
||||
/// <summary>
|
||||
/// Description of ExportText.
|
||||
/// </summary>
|
||||
///
|
||||
public interface IExportText : IExportColumn |
||||
{ |
||||
Font Font {get;set;} |
||||
string Text {get;set;} |
||||
} |
||||
|
||||
|
||||
public class ExportText:ExportColumn,IExportText,IAcceptor |
||||
{ |
||||
public ExportText() |
||||
{ |
||||
} |
||||
|
||||
public void Accept(IVisitor visitor) |
||||
{ |
||||
visitor.Visit(this); |
||||
} |
||||
|
||||
public Font Font {get;set;} |
||||
|
||||
|
||||
public string Text {get;set;} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,60 @@
@@ -0,0 +1,60 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 03.04.2013 |
||||
* Time: 20:21 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Drawing; |
||||
using System.Linq; |
||||
|
||||
using ICSharpCode.Reporting.Globals; |
||||
using ICSharpCode.Reporting.Interfaces; |
||||
using ICSharpCode.Reporting.Interfaces.Export; |
||||
|
||||
namespace ICSharpCode.Reporting.PageBuilder |
||||
{ |
||||
/// <summary>
|
||||
/// Description of FormPageBuilder.
|
||||
/// </summary>
|
||||
public class FormPageBuilder:BasePageBuilder |
||||
{ |
||||
|
||||
public FormPageBuilder(IReportModel reportModel):base(reportModel) |
||||
{ |
||||
|
||||
} |
||||
|
||||
|
||||
public override void BuildExportList() |
||||
{ |
||||
base.BuildExportList(); |
||||
WritePages (); |
||||
} |
||||
|
||||
|
||||
|
||||
void BuilDetail() |
||||
{ |
||||
Console.WriteLine("FormPageBuilder - Build DetailSection {0} - {1} - {2}",ReportModel.ReportSettings.PageSize.Width,ReportModel.ReportSettings.LeftMargin,ReportModel.ReportSettings.RightMargin); |
||||
CurrentLocation = DetailStart; |
||||
|
||||
var detail = CreateSection(ReportModel.DetailSection,CurrentLocation); |
||||
detail.Parent = CurrentPage; |
||||
CurrentPage.ExportedItems.Insert(2,detail); |
||||
} |
||||
|
||||
|
||||
protected override void WritePages() |
||||
{ |
||||
base.WritePages(); |
||||
BuilDetail(); |
||||
base.AddPage(CurrentPage); |
||||
Console.WriteLine("------{0}---------",ReportModel.ReportSettings.PageSize); |
||||
} |
||||
|
||||
|
||||
} |
||||
} |
@ -0,0 +1,80 @@
@@ -0,0 +1,80 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 17.03.2013 |
||||
* Time: 17:09 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections; |
||||
using System.Collections.Generic; |
||||
using System.IO; |
||||
using System.Xml; |
||||
|
||||
using ICSharpCode.Reporting.Factories; |
||||
using ICSharpCode.Reporting.Globals; |
||||
using ICSharpCode.Reporting.Interfaces; |
||||
using ICSharpCode.Reporting.Items; |
||||
using ICSharpCode.Reporting.PageBuilder; |
||||
using ICSharpCode.Reporting.Xml; |
||||
|
||||
namespace ICSharpCode.Reporting |
||||
{ |
||||
/// <summary>
|
||||
/// Description of Reporting.
|
||||
/// </summary>
|
||||
public class ReportingFactory |
||||
{ |
||||
public ReportingFactory() |
||||
{ |
||||
} |
||||
|
||||
public IReportCreator ReportCreator (ReportModel reportModel) { |
||||
if (reportModel == null) |
||||
throw new ArgumentNullException("reportModel"); |
||||
IReportCreator builder = null; |
||||
if (reportModel.ReportSettings.DataModel == GlobalEnums.PushPullModel.FormSheet) { |
||||
builder = new FormPageBuilder(reportModel); |
||||
} |
||||
return builder; |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
internal IReportCreator ReportCreator (Stream stream) |
||||
{ |
||||
IReportModel reportModel = LoadReportModel (stream); |
||||
IReportCreator builder = null; |
||||
builder = ReportCreatorFactory.ExporterFactory(reportModel); |
||||
return builder; |
||||
} |
||||
|
||||
object ExporterFactory(IReportModel reportModel) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
|
||||
internal ReportModel LoadReportModel (Stream stream) |
||||
{ |
||||
var doc = new XmlDocument(); |
||||
doc.Load(stream); |
||||
var rm = LoadModel(doc); |
||||
return rm; |
||||
} |
||||
|
||||
static ReportModel LoadModel(XmlDocument doc) |
||||
{ |
||||
var loader = new ModelLoader(); |
||||
object root = loader.Load(doc.DocumentElement); |
||||
|
||||
var model = root as ReportModel; |
||||
if (model == null) { |
||||
// throw new IllegalFileFormatException("ReportModel");
|
||||
} |
||||
return model; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,72 @@
@@ -0,0 +1,72 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 05/04/2013 |
||||
* Time: 17:06 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.ObjectModel; |
||||
using System.ComponentModel; |
||||
using System.Diagnostics; |
||||
using System.Windows.Documents; |
||||
using System.Windows.Markup; |
||||
|
||||
using ICSharpCode.Reporting.Exporter; |
||||
using ICSharpCode.Reporting.ExportRenderer; |
||||
using ICSharpCode.Reporting.Interfaces.Export; |
||||
using ICSharpCode.Reporting.Items; |
||||
|
||||
namespace ICSharpCode.Reporting.WpfReportViewer |
||||
{ |
||||
/// <summary>
|
||||
/// Description of PreviewViewModel.
|
||||
/// </summary>
|
||||
public class PreviewViewModel:INotifyPropertyChanged |
||||
{ |
||||
|
||||
private FixedDocument document ; |
||||
|
||||
public PreviewViewModel(ReportSettings reportSettings, Collection<IPage> pages) |
||||
{ |
||||
if (pages == null) |
||||
throw new ArgumentNullException("pages"); |
||||
if (reportSettings == null) |
||||
throw new ArgumentNullException("reportSettings"); |
||||
Document = new FixedDocument(); |
||||
var s = Document.DocumentPaginator.PageSize; |
||||
Document.DocumentPaginator.PageSize = new System.Windows.Size(reportSettings.PageSize.Width,reportSettings.PageSize.Height); |
||||
var wpfExporter = new WpfExporter(reportSettings,pages); |
||||
wpfExporter.Run(); |
||||
var fixedPage = wpfExporter.FixedPage; |
||||
AddPageToDocument(Document,fixedPage); |
||||
} |
||||
|
||||
static void AddPageToDocument(FixedDocument fixedDocument,FixedPage page) |
||||
{ |
||||
var pageContent = new PageContent(); |
||||
((IAddChild)pageContent).AddChild(page); |
||||
fixedDocument.Pages.Add(pageContent); |
||||
} |
||||
|
||||
public FixedDocument Document |
||||
{ |
||||
get {return document;} |
||||
set { |
||||
this.document = value; |
||||
OnNotifyPropertyChanged ("Document"); |
||||
} |
||||
} |
||||
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged; |
||||
|
||||
void OnNotifyPropertyChanged(string num0) |
||||
{ |
||||
if (PropertyChanged != null) { |
||||
PropertyChanged(this,new PropertyChangedEventArgs(num0)); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,45 @@
@@ -0,0 +1,45 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 12.05.2011 |
||||
* Time: 21:01 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Windows.Controls; |
||||
using System.Windows.Documents; |
||||
|
||||
|
||||
namespace ICSharpCode.Reporting.WpfReportViewer |
||||
{ |
||||
|
||||
public interface IWpfReportViewer |
||||
{ |
||||
IDocumentPaginatorSource Document {set;} |
||||
void SetBinding (PreviewViewModel model); |
||||
} |
||||
/// <summary>
|
||||
/// Interaction logic for WpfReportViewer.xaml
|
||||
/// </summary>
|
||||
|
||||
public partial class WpfReportViewer : UserControl,IWpfReportViewer |
||||
{ |
||||
public WpfReportViewer() |
||||
{ |
||||
InitializeComponent(); |
||||
} |
||||
|
||||
public void SetBinding (PreviewViewModel model) |
||||
{ |
||||
this.DataContext = model; |
||||
} |
||||
|
||||
|
||||
public IDocumentPaginatorSource Document { |
||||
set { |
||||
this.DocumentViewer.Document = value; |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,30 @@
@@ -0,0 +1,30 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 19.03.2013 |
||||
* Time: 20:13 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using ICSharpCode.Reporting.Items; |
||||
|
||||
namespace ICSharpCode.Reporting.Xml |
||||
{ |
||||
/// <summary>
|
||||
/// Description of ModelLoader.
|
||||
/// </summary>
|
||||
internal class ModelLoader: MycroParser |
||||
{ |
||||
|
||||
protected override Type GetTypeByName(string ns, string name) |
||||
{ |
||||
// var b = typeof(BaseSection).Assembly.GetType("ICSharpCode.Reporting.Items" + "." + name);
|
||||
var s = typeof(BaseSection).Assembly.GetType(typeof(BaseSection).Namespace + "." + name); |
||||
Console.WriteLine("getTypeByname <{0}>",s.Name); |
||||
return typeof(BaseSection).Assembly.GetType(typeof(BaseSection).Namespace + "." + name); |
||||
|
||||
} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,233 @@
@@ -0,0 +1,233 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 19.03.2013 |
||||
* Time: 20:14 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.ComponentModel; |
||||
using System.Diagnostics; |
||||
using System.Collections; |
||||
using System.Collections.Generic; |
||||
using System.Xml; |
||||
using System.Reflection; |
||||
|
||||
namespace ICSharpCode.Reporting.Xml |
||||
{ |
||||
/// <summary>
|
||||
/// Description of MycroParser.
|
||||
/// </summary>
|
||||
public interface IMycroXaml |
||||
{ |
||||
void Initialize(object parent); |
||||
object ReturnedObject |
||||
{ |
||||
get; |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// See http://www.codeproject.com/dotnet/MycroXaml.asp
|
||||
/// </summary>
|
||||
internal abstract class MycroParser |
||||
{ |
||||
public object Load(XmlElement element) |
||||
{ |
||||
return ProcessNode(element, null); |
||||
} |
||||
|
||||
protected abstract Type GetTypeByName(string ns, string name); |
||||
|
||||
private object ProcessNode(XmlNode node, object parent) |
||||
{ |
||||
object ret=null; |
||||
if (node is XmlElement) |
||||
{ |
||||
// instantiate the class
|
||||
string ns=node.Prefix; |
||||
string cname=node.LocalName; |
||||
Console.WriteLine ("ProcessNode(XmlNode node, object parent) {0}",cname); |
||||
Type t=GetTypeByName(ns, cname); |
||||
if (t == null) { |
||||
Console.WriteLine("\t Not found {0}",t.FullName); |
||||
// t = GetTypeByName (ns,"ErrorItem");
|
||||
} |
||||
|
||||
Trace.Assert(t != null, "Type "+cname+" could not be determined."); |
||||
// Debug.WriteLine("Looking for " + cname + " and got " + t.FullName);
|
||||
Console.WriteLine("Looking for " + cname + " and got " + t.FullName); |
||||
try |
||||
{ |
||||
ret=Activator.CreateInstance(t); |
||||
} |
||||
catch(Exception e) |
||||
{ |
||||
Trace.Fail("Type "+cname+" could not be instantiated:\r\n"+e.Message); |
||||
} |
||||
|
||||
// support the ISupportInitialize interface
|
||||
if (ret is ISupportInitialize) { |
||||
((ISupportInitialize)ret).BeginInit(); |
||||
} |
||||
|
||||
// If the instance implements the IMicroXaml interface, then it may need
|
||||
// access to the parser.
|
||||
if (ret is IMycroXaml) { |
||||
((IMycroXaml)ret).Initialize(parent); |
||||
} |
||||
|
||||
// implements the class-property-class model
|
||||
ProcessAttributes(node, ret, t); |
||||
ProcessChildProperties(node, ret); |
||||
|
||||
// support the ISupportInitialize interface
|
||||
if (ret is ISupportInitialize) { |
||||
((ISupportInitialize)ret).EndInit(); |
||||
} |
||||
|
||||
// If the instance implements the IMicroXaml interface, then it has the option
|
||||
// to return an object that replaces the instance created by the parser.
|
||||
if (ret is IMycroXaml) { |
||||
ret=((IMycroXaml)ret).ReturnedObject; |
||||
} |
||||
|
||||
} |
||||
return ret; |
||||
} |
||||
|
||||
protected void ProcessChildProperties(XmlNode node, object parent) |
||||
{ |
||||
var t=parent.GetType(); |
||||
|
||||
// children of a class must always be properties
|
||||
foreach(XmlNode child in node.ChildNodes) |
||||
{ |
||||
if (!(child is XmlElement)) continue; |
||||
string pname=child.LocalName; |
||||
var pi=t.GetProperty(pname); |
||||
|
||||
if (pi==null) |
||||
{ |
||||
// Special case--we're going to assume that the child is a class instance
|
||||
// not associated with the parent object
|
||||
// Trace.Fail("Unsupported property: "+pname);
|
||||
System.Console.WriteLine("Unsupported property: "+pname); |
||||
continue; |
||||
} |
||||
|
||||
// a property can only have one child node unless it's a collection
|
||||
foreach(XmlNode grandChild in child.ChildNodes) |
||||
{ |
||||
if (grandChild is XmlText) { |
||||
SetPropertyToString(parent, pi, child.InnerText); |
||||
break; |
||||
} |
||||
else if (grandChild is XmlElement) |
||||
{ |
||||
var propObject=pi.GetValue(parent, null); |
||||
var obj=ProcessNode(grandChild, propObject); |
||||
|
||||
// A null return is valid in cases where a class implementing the IMicroXaml interface
|
||||
// might want to take care of managing the instance it creates itself. See DataBinding
|
||||
if (obj != null) |
||||
{ |
||||
|
||||
// support for ICollection objects
|
||||
if (propObject is ICollection) |
||||
{ |
||||
MethodInfo mi=t.GetMethod("Add", new Type[] {obj.GetType()}); |
||||
if (mi != null) |
||||
{ |
||||
try |
||||
{ |
||||
mi.Invoke(obj, new object[] {obj}); |
||||
} |
||||
catch(Exception e) |
||||
{ |
||||
Trace.Fail("Adding to collection failed:\r\n"+e.Message); |
||||
} |
||||
} |
||||
else if (propObject is IList) |
||||
{ |
||||
try |
||||
{ |
||||
((IList)propObject).Add(obj); |
||||
} |
||||
catch(Exception e) |
||||
{ |
||||
Trace.Fail("List/Collection add failed:\r\n"+e.Message); |
||||
} |
||||
} |
||||
} |
||||
else if (!pi.CanWrite) { |
||||
Trace.Fail("Unsupported read-only property: "+pname); |
||||
} |
||||
else |
||||
{ |
||||
// direct assignment if not a collection
|
||||
try |
||||
{ |
||||
pi.SetValue(parent, obj, null); |
||||
} |
||||
catch(Exception e) |
||||
{ |
||||
Trace.Fail("Property setter for "+pname+" failed:\r\n"+e.Message); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
private void ProcessAttributes(XmlNode node, object ret, Type type) |
||||
{ |
||||
// process attributes
|
||||
foreach(XmlAttribute attr in node.Attributes) |
||||
{ |
||||
string pname=attr.Name; |
||||
string pvalue=attr.Value; |
||||
|
||||
// it's either a property or an event
|
||||
PropertyInfo pi=type.GetProperty(pname); |
||||
|
||||
if (pi != null) |
||||
{ |
||||
// it's a property!
|
||||
SetPropertyToString(ret, pi, pvalue); |
||||
} |
||||
else |
||||
{ |
||||
// who knows what it is???
|
||||
Trace.Fail("Failed acquiring property information for "+pname); |
||||
} |
||||
} |
||||
} |
||||
|
||||
static void SetPropertyToString(object obj, PropertyInfo pi, string value) |
||||
{ |
||||
Console.WriteLine("MP - SetPropertyToString {0} - {1}",pi.Name,value.ToString()); |
||||
// it's string, so use a type converter.
|
||||
TypeConverter tc=TypeDescriptor.GetConverter(pi.PropertyType); |
||||
try |
||||
{ |
||||
if (tc.CanConvertFrom(typeof(string))) |
||||
{ |
||||
object val=tc.ConvertFromInvariantString(value); |
||||
pi.SetValue(obj, val, null); |
||||
} else if (pi.PropertyType == typeof(Type)) { |
||||
pi.SetValue(obj, Type.GetType(value), null); |
||||
} |
||||
} |
||||
catch(Exception e) |
||||
{ |
||||
String s = String.Format("Property setter for {0} failed {1}\r\n",pi.Name, |
||||
e.Message); |
||||
System.Console.WriteLine("MycroParser : {0}",s); |
||||
} |
||||
} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,99 @@
@@ -0,0 +1,99 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build"> |
||||
<PropertyGroup> |
||||
<ProjectGuid>{97CA9CE5-B966-48DF-BB59-F00FFC534B1F}</ProjectGuid> |
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||
<OutputType>Library</OutputType> |
||||
<RootNamespace>ICSharpCode.Reporting.Test</RootNamespace> |
||||
<AssemblyName>ICSharpCode.Reporting.Test</AssemblyName> |
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> |
||||
<TargetFrameworkProfile> |
||||
</TargetFrameworkProfile> |
||||
<AppDesignerFolder>Properties</AppDesignerFolder> |
||||
<NoWin32Manifest>False</NoWin32Manifest> |
||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
||||
<NoStdLib>False</NoStdLib> |
||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors> |
||||
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath> |
||||
<WarningLevel>4</WarningLevel> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' "> |
||||
<PlatformTarget>AnyCPU</PlatformTarget> |
||||
<BaseAddress>4194304</BaseAddress> |
||||
<Prefer32Bit>False</Prefer32Bit> |
||||
<RegisterForComInterop>False</RegisterForComInterop> |
||||
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> |
||||
<FileAlignment>4096</FileAlignment> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> |
||||
<OutputPath>..\..\..\..\..\..\..\bin\UnitTests\</OutputPath> |
||||
<DebugSymbols>True</DebugSymbols> |
||||
<DebugType>Full</DebugType> |
||||
<Optimize>False</Optimize> |
||||
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> |
||||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
||||
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
||||
<OutputPath>bin\Release\</OutputPath> |
||||
<DebugSymbols>False</DebugSymbols> |
||||
<DebugType>None</DebugType> |
||||
<Optimize>True</Optimize> |
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
||||
<DefineConstants>TRACE</DefineConstants> |
||||
</PropertyGroup> |
||||
<ItemGroup> |
||||
<Reference Include="nunit.framework"> |
||||
<HintPath>..\..\..\..\..\..\Tools\NUnit\nunit.framework.dll</HintPath> |
||||
</Reference> |
||||
<Reference Include="System" /> |
||||
<Reference Include="System.Core"> |
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System.Drawing" /> |
||||
<Reference Include="System.Xml" /> |
||||
<Reference Include="System.Xml.Linq"> |
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||
</Reference> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Compile Include="src\DataSource\ContributorsList.cs" /> |
||||
<Compile Include="src\DataSource\CollectionHandlingFixture.cs" /> |
||||
<Compile Include="src\Model\LoadPlainModelFixture.cs" /> |
||||
<Compile Include="src\Model\ReportModelFixture.cs" /> |
||||
<Compile Include="src\Model\ReportSettingsFixture.cs" /> |
||||
<Compile Include="src\Model\Report_TwoItemsFixture.cs" /> |
||||
<Compile Include="src\PageBuilder\ContainerArrangeStrategyFixture.cs" /> |
||||
<Compile Include="src\PageBuilder\BaseConvertFixture.cs" /> |
||||
<Compile Include="src\PageBuilder\ContainerConverterFixture.cs" /> |
||||
<Compile Include="src\PageBuilder\DataPageBuilderFixture.cs" /> |
||||
<Compile Include="src\PageBuilder\PageBuilderFixture.cs" /> |
||||
<Compile Include="src\PageBuilder\PageFixture.cs" /> |
||||
<Compile Include="src\PageBuilder\PageLayoutFixture.cs" /> |
||||
<Compile Include="src\Properties\AssemblyInfo.cs" /> |
||||
<Compile Include="src\ReportItems\TextItemFixture.cs" /> |
||||
<Compile Include="src\TestHelper.cs" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Folder Include="src" /> |
||||
<Folder Include="src\Model" /> |
||||
<Folder Include="src\DataSource" /> |
||||
<Folder Include="src\ReportItems" /> |
||||
<Folder Include="src\PageBuilder" /> |
||||
<Folder Include="src\TestReports" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<ProjectReference Include="..\..\ICSharpCode.Reporting.csproj"> |
||||
<Project>{40CA84D4-ACFC-4646-9CDD-B87262D34093}</Project> |
||||
<Name>ICSharpCode.Reporting</Name> |
||||
</ProjectReference> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<EmbeddedResource Include="src\TestReports\PlainModel.srd" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<EmbeddedResource Include="src\TestReports\ReportWithTwoItems.srd" /> |
||||
</ItemGroup> |
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
||||
</Project> |
@ -0,0 +1,196 @@
@@ -0,0 +1,196 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 20.05.2013 |
||||
* Time: 18:15 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.ComponentModel; |
||||
using System.Linq; |
||||
using ICSharpCode.Reporting.BaseClasses; |
||||
using ICSharpCode.Reporting.DataManager.Listhandling; |
||||
using ICSharpCode.Reporting.DataSource; |
||||
using ICSharpCode.Reporting.Items; |
||||
using NUnit.Framework; |
||||
|
||||
namespace ICSharpCode.Reporting.Test.DataSource |
||||
{ |
||||
[TestFixture] |
||||
public class CollectionHandlingFixture |
||||
{ |
||||
|
||||
private ContributorCollection list; |
||||
|
||||
[Test] |
||||
public void CanInitDataCollection() |
||||
{ |
||||
var collectionSource = new CollectionSource (list,new ReportSettings()); |
||||
Assert.That(collectionSource,Is.Not.Null); |
||||
} |
||||
|
||||
[Test] |
||||
public void CurrentpositionShouldZeroAfterBind () { |
||||
var collectionSource = new CollectionSource (list,new ReportSettings()); |
||||
collectionSource.Bind(); |
||||
Assert.That(collectionSource.CurrentPosition,Is.EqualTo(0)); |
||||
} |
||||
|
||||
[Test] |
||||
public void CurrentPositionIsTwo () { |
||||
var collectionSource = new CollectionSource (list,new ReportSettings()); |
||||
collectionSource.Bind(); |
||||
collectionSource.MoveNext(); |
||||
collectionSource.MoveNext(); |
||||
Assert.That(collectionSource.CurrentPosition,Is.EqualTo(2)); |
||||
} |
||||
|
||||
[Test] |
||||
public void CollectionCountIsEqualToListCount() { |
||||
var collectionSource = new CollectionSource (list,new ReportSettings()); |
||||
Assert.That(collectionSource.Count,Is.EqualTo(list.Count)); |
||||
} |
||||
|
||||
|
||||
[Test] |
||||
public void AvailableFieldsEqualContibutorsPropertyCount() { |
||||
var collectionSource = new CollectionSource (list,new ReportSettings()); |
||||
Assert.That(collectionSource.AvailableFields.Count,Is.EqualTo(6)); |
||||
} |
||||
|
||||
#region Fill
|
||||
|
||||
[Test] |
||||
public void TypeOfReportItemIsString () { |
||||
var ric = new ReportItemCollection(){ |
||||
new BaseDataItem(){ |
||||
ColumnName = "Lastname" |
||||
|
||||
}, |
||||
new BaseDataItem(){ |
||||
ColumnName = "Firstname" |
||||
} |
||||
}; |
||||
var collectionSource = new CollectionSource (list,new ReportSettings()); |
||||
collectionSource.Bind(); |
||||
collectionSource.Fill(ric); |
||||
foreach (BaseDataItem element in ric) { |
||||
Assert.That(element.DataType,Is.EqualTo("System.String")); |
||||
} |
||||
} |
||||
|
||||
|
||||
[Test] |
||||
public void FillReportItemCollection () { |
||||
var ric = new ReportItemCollection(){ |
||||
new BaseDataItem(){ |
||||
ColumnName = "Lastname" |
||||
|
||||
}, |
||||
new BaseDataItem(){ |
||||
ColumnName = "Firstname" |
||||
} |
||||
}; |
||||
var collectionSource = new CollectionSource (list,new ReportSettings()); |
||||
collectionSource.Bind(); |
||||
collectionSource.Fill(ric); |
||||
foreach (BaseDataItem element in ric) { |
||||
Assert.That(element.DBValue,Is.Not.EqualTo(String.Empty)); |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Grouping
|
||||
|
||||
[Test] |
||||
public void GroupbyOneColumn () { |
||||
var rs = new ReportSettings(); |
||||
rs.GroupColumnCollection.Add( new GroupColumn("GroupItem",1,ListSortDirection.Ascending)); |
||||
var collectionSource = new CollectionSource (list,rs); |
||||
collectionSource.Bind(); |
||||
} |
||||
|
||||
|
||||
[Test] |
||||
public void bla () { |
||||
var s = list.OrderBy(a => a.Lastname); |
||||
var x = s.GroupBy(y => y.GroupItem); |
||||
foreach (var group in x) { |
||||
Console.WriteLine("{0} - {1}",group.Key,group.GetType().ToString()); |
||||
foreach (var element in group) { |
||||
Console.WriteLine(element.Firstname); |
||||
} |
||||
} |
||||
} |
||||
#endregion
|
||||
|
||||
#region Sort
|
||||
|
||||
|
||||
[Test] |
||||
public void CreateUnsortedIndex() { |
||||
var collectionSource = new CollectionSource (list,new ReportSettings()); |
||||
collectionSource.Bind(); |
||||
Assert.That(collectionSource.IndexList.Count,Is.EqualTo(collectionSource.Count)); |
||||
Assert.That(collectionSource.IndexList.CurrentPosition,Is.EqualTo(0)); |
||||
} |
||||
|
||||
|
||||
[Test] |
||||
[ExpectedException(typeof(InvalidOperationException))] |
||||
public void SortColumnNotExist() { |
||||
var rs = new ReportSettings(); |
||||
rs.SortColumnsCollection.Add(new SortColumn("aa",ListSortDirection.Ascending)); |
||||
var collectionSource = new CollectionSource (list,rs); |
||||
collectionSource.Bind(); |
||||
Assert.That(collectionSource.IndexList,Is.Not.Null); |
||||
Assert.That(collectionSource.IndexList.Count,Is.EqualTo(0)); |
||||
} |
||||
|
||||
|
||||
[Test] |
||||
public void SortOneColumnAscending() { |
||||
var rs = new ReportSettings(); |
||||
rs.SortColumnsCollection.Add(new SortColumn("Lastname",ListSortDirection.Ascending)); |
||||
var collectionSource = new CollectionSource (list,rs); |
||||
collectionSource.Bind(); |
||||
string compare = collectionSource.IndexList[0].ObjectArray[0].ToString(); |
||||
foreach (var element in collectionSource.IndexList) { |
||||
string result = String.Format("{0} - {1}",element.ListIndex,element.ObjectArray[0]); |
||||
Console.WriteLine(result); |
||||
Assert.That(compare,Is.LessThanOrEqualTo(element.ObjectArray[0].ToString())); |
||||
compare = element.ObjectArray[0].ToString(); |
||||
} |
||||
} |
||||
|
||||
|
||||
[Test] |
||||
public void SortTwoColumnsAscending() { |
||||
var rs = new ReportSettings(); |
||||
rs.SortColumnsCollection.Add(new SortColumn("Lastname",ListSortDirection.Ascending)); |
||||
rs.SortColumnsCollection.Add(new SortColumn("RandomInt",ListSortDirection.Ascending)); |
||||
var collectionSource = new CollectionSource (list,rs); |
||||
collectionSource.Bind(); |
||||
string compare = collectionSource.IndexList[0].ObjectArray[0].ToString(); |
||||
foreach (var element in collectionSource.IndexList) { |
||||
string result = String.Format("{0} - {1} - {2}",element.ListIndex,element.ObjectArray[0],element.ObjectArray[1].ToString()); |
||||
Console.WriteLine(result); |
||||
Assert.That(compare,Is.LessThanOrEqualTo(element.ObjectArray[0].ToString())); |
||||
compare = element.ObjectArray[0].ToString(); |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
|
||||
[SetUp] |
||||
public void CreateList() { |
||||
var contributorList = new ContributorsList(); |
||||
list = contributorList.ContributorCollection; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,100 @@
@@ -0,0 +1,100 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 20.05.2013 |
||||
* Time: 18:09 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Collections.Generic; |
||||
|
||||
namespace ICSharpCode.Reporting.Test.DataSource |
||||
{ |
||||
/// <summary>
|
||||
/// Description of ContributorsList.
|
||||
/// </summary>
|
||||
public class ContributorsList |
||||
{ |
||||
ContributorCollection contributorCollection; |
||||
|
||||
public ContributorsList() |
||||
{ |
||||
this.contributorCollection = CreateContributorsList(); |
||||
} |
||||
|
||||
public ContributorCollection ContributorCollection { |
||||
get { return contributorCollection; } |
||||
} |
||||
|
||||
private ContributorCollection CreateContributorsList () { |
||||
|
||||
DateTime d1 = new DateTime(2000,11,11); |
||||
DateTime d2 = new DateTime(2000,01,01); |
||||
DateTime d3 = new DateTime(2000,12,24); |
||||
|
||||
ContributorCollection list = new ContributorCollection(); |
||||
|
||||
list.Add(new Contributor("Christoph","Wille","Senior Project Wrangler",17,new DateTime(1960,12,8),"F")); |
||||
list.Add(new Contributor("Bernhard","Spuida","Senior Project Wrangler",25,new DateTime(1962,2,24),"D")); |
||||
|
||||
|
||||
list.Add(new Contributor("Daniel","Grunwald","Technical Lead",12,d1,"F")); |
||||
|
||||
list.Add(new Contributor("Matt","Ward","NUnit",7,d1,"F")); |
||||
list.Add(new Contributor("David","Srbecky","Debugger",1,d1,"C")); |
||||
list.Add(new Contributor("Peter","Forstmeier","SharpDevelop.Reports",7,d1,"D")); |
||||
|
||||
list.Add(new Contributor("Alexander","Zeitler","SharpDevelop.Reports",3,d2,"D")); |
||||
list.Add(new Contributor("Markus","Palme","Prg.",6,d2,"R")); |
||||
list.Add(new Contributor("Georg","Brandl","Prg.",5,d2,"R")); |
||||
list.Add(new Contributor("Roman","Taranchenko","",2,d2,"U")); |
||||
list.Add(new Contributor("Denis","Erchoff","",13,d2,"U")); |
||||
|
||||
list.Add(new Contributor("Ifko","Kovacka","",31,d3,"A")); |
||||
list.Add(new Contributor("Nathan","Allen","",5,d3,"A")); |
||||
list.Add(new Contributor("Dickon","Field","DBTools",10,d3,"U")); |
||||
|
||||
list.Add(new Contributor("Troy","Simpson","Prg.",9,d3,"C")); |
||||
list.Add(new Contributor("David","Alpert","Prg.",6,d3,"C")); |
||||
return list; |
||||
} |
||||
} |
||||
|
||||
public class ContributorCollection: List<Contributor> |
||||
{ |
||||
} |
||||
|
||||
public class Contributor { |
||||
|
||||
|
||||
public Contributor(string lastname, string firstname,string job,int randomInt,DateTime randomDate,string groupItem) |
||||
{ |
||||
this.Lastname = lastname; |
||||
this.Firstname = firstname; |
||||
this.Job = job; |
||||
this.RandomDate = randomDate; |
||||
this.RandomInt = randomInt; |
||||
this.GroupItem = groupItem; |
||||
} |
||||
|
||||
|
||||
public string Lastname {get;private set;} |
||||
|
||||
|
||||
public string Firstname {get;private set;} |
||||
|
||||
|
||||
public string Job {get; private set;} |
||||
|
||||
|
||||
public int RandomInt {get; private set;} |
||||
|
||||
|
||||
public DateTime RandomDate {get;private set;} |
||||
|
||||
|
||||
public string GroupItem {get; private set;} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,69 @@
@@ -0,0 +1,69 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 07.04.2013 |
||||
* Time: 18:01 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Drawing; |
||||
using System.IO; |
||||
using System.Reflection; |
||||
|
||||
using ICSharpCode.Reporting.Items; |
||||
using NUnit.Framework; |
||||
|
||||
namespace ICSharpCode.Reporting.Test.Model |
||||
{ |
||||
[TestFixture] |
||||
public class ReportTwoItemsFixture |
||||
{ |
||||
|
||||
private ReportModel model; |
||||
|
||||
[Test] |
||||
public void LoadModelWithItems() |
||||
{ |
||||
Assert.That(model,Is.Not.Null); |
||||
} |
||||
|
||||
|
||||
[Test] |
||||
public void ReportHeaderOneItem () { |
||||
var section = model.ReportHeader; |
||||
Assert.That(section.Items.Count,Is.EqualTo(1)); |
||||
} |
||||
|
||||
|
||||
[Test] |
||||
public void PageHeaderOneItem () { |
||||
var section = model.ReportHeader; |
||||
Assert.That(section.Items.Count,Is.EqualTo(1)); |
||||
} |
||||
|
||||
|
||||
[Test] |
||||
public void ItemIsTextItem() { |
||||
var item = model.ReportHeader.Items[0]; |
||||
Assert.That(item,Is.AssignableFrom(typeof(BaseTextItem))); |
||||
} |
||||
|
||||
|
||||
[Test] |
||||
public void IsLocationSet() { |
||||
var item = model.ReportHeader.Items[0]; |
||||
Assert.That(item.Location,Is.Not.EqualTo(Point.Empty)); |
||||
} |
||||
|
||||
|
||||
[SetUp] |
||||
public void LoadModelFromStream() |
||||
{ |
||||
System.Reflection.Assembly asm = Assembly.GetExecutingAssembly(); |
||||
var stream = asm.GetManifestResourceStream(TestHelper.RepWithTwoItems); |
||||
var rf = new ReportingFactory(); |
||||
model = rf.LoadReportModel(stream); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,59 @@
@@ -0,0 +1,59 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 08.04.2013 |
||||
* Time: 20:20 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Reflection; |
||||
using ICSharpCode.Reporting.Interfaces; |
||||
using ICSharpCode.Reporting.PageBuilder; |
||||
using ICSharpCode.Reporting.PageBuilder.ExportColumns; |
||||
using NUnit.Framework; |
||||
|
||||
namespace ICSharpCode.Reporting.Test.PageBuilder |
||||
{ |
||||
[TestFixture] |
||||
public class BaseConvertFixture |
||||
{ |
||||
private IReportCreator reportCreator; |
||||
|
||||
|
||||
[Test] |
||||
public void CurrentPageContainFiveItems() { |
||||
reportCreator.BuildExportList(); |
||||
var page = reportCreator.Pages[0]; |
||||
Assert.That(page.ExportedItems.Count, Is.EqualTo(5)); |
||||
} |
||||
|
||||
|
||||
[Test] |
||||
public void PageItemIsBaseExportContainer() { |
||||
reportCreator.BuildExportList(); |
||||
var page = reportCreator.Pages[0]; |
||||
Assert.That(page.ExportedItems[0],Is.InstanceOf(typeof(ExportContainer))); |
||||
} |
||||
|
||||
|
||||
[Test] |
||||
public void ExportContainerContainsExportText() { |
||||
reportCreator.BuildExportList(); |
||||
var page = reportCreator.Pages[0]; |
||||
var firstItem = (ExportContainer)page.ExportedItems[0]; |
||||
var result = firstItem.ExportedItems[0]; |
||||
Assert.That(result,Is.InstanceOf(typeof(ExportText))); |
||||
} |
||||
|
||||
|
||||
[SetUp] |
||||
public void LoadFromStream() |
||||
{ |
||||
System.Reflection.Assembly asm = Assembly.GetExecutingAssembly(); |
||||
var stream = asm.GetManifestResourceStream(TestHelper.RepWithTwoItems); |
||||
var reportingFactory = new ReportingFactory(); |
||||
reportCreator = reportingFactory.ReportCreator(stream); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,144 @@
@@ -0,0 +1,144 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 15.05.2013 |
||||
* Time: 19:54 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Drawing; |
||||
using ICSharpCode.Reporting.Arrange; |
||||
using ICSharpCode.Reporting.Interfaces.Export; |
||||
using ICSharpCode.Reporting.PageBuilder.ExportColumns; |
||||
using NUnit.Framework; |
||||
|
||||
namespace ICSharpCode.Reporting.Test.PageBuilder |
||||
{ |
||||
[TestFixture] |
||||
public class ContainerArrangeStrategyFixture |
||||
{ |
||||
ContainerArrangeStrategy strategy; |
||||
|
||||
[Test] |
||||
public void ContainerNoChildren() { |
||||
var param = new ExportContainer(); |
||||
var size = param.Size; |
||||
strategy.Arrange(param); |
||||
Assert.That(param.Size, Is.EqualTo(size)); |
||||
} |
||||
|
||||
[Test] |
||||
public void ItemAtTopOfContainer() { |
||||
var container = CreateContainer(); |
||||
container.ExportedItems[0].Location = container.Location; |
||||
strategy.Arrange(container); |
||||
|
||||
var containerRect = new Rectangle(container.Location,container.DesiredSize); |
||||
var itemRect = new Rectangle(container.ExportedItems[0].Location,container.ExportedItems[0].Size); |
||||
|
||||
// Console.WriteLine("{0} - {1} - {2} - {3}",containerRect,containerRect.Bottom,itemRect,itemRect.Bottom);
|
||||
Assert.That(containerRect.Contains(itemRect)); |
||||
|
||||
} |
||||
|
||||
|
||||
[Test] |
||||
public void ItemAtTopBottomOfContainer() { |
||||
var container = CreateContainer(); |
||||
container.ExportedItems[0].Location = new Point (container.Location.X, |
||||
container.Location.Y + container.DesiredSize.Height - container.ExportedItems[0].Size.Height); |
||||
strategy.Arrange(container); |
||||
|
||||
var containerRect = new Rectangle(container.Location,container.DesiredSize); |
||||
var itemRect = new Rectangle(container.ExportedItems[0].Location,container.ExportedItems[0].Size); |
||||
|
||||
// Console.WriteLine("{0} - {1} - {2} - {3}",containerRect,containerRect.Bottom,itemRect,itemRect.Bottom);
|
||||
Assert.That(containerRect.Contains(itemRect)); |
||||
} |
||||
|
||||
|
||||
[Test] |
||||
public void FindBiggestRectangle () { |
||||
var container = CreateContainer(); |
||||
var secondItem = CreateCanGrowText(container); |
||||
container.ExportedItems.Add(secondItem); |
||||
|
||||
strategy.Arrange(container); |
||||
var expected = new Rectangle(new Point(container.Location.X + secondItem.Location.X, |
||||
container.Location.Y + secondItem.Location.Y), |
||||
secondItem.Size); |
||||
Assert.That(strategy.BiggestRectangle,Is.EqualTo(expected)); |
||||
} |
||||
|
||||
|
||||
[Test] |
||||
public void ContainerResizeIfItemCanGrow () { |
||||
var container = CreateContainer(); |
||||
|
||||
container.ExportedItems.Add(CreateCanGrowText(container)); |
||||
strategy.Arrange(container); |
||||
var containerRect = new Rectangle(container.Location,container.DesiredSize); |
||||
var arrangeRect = new Rectangle(new Point(container.Location.X + strategy.BiggestRectangle.Left, |
||||
strategy.BiggestRectangle.Top), |
||||
strategy.BiggestRectangle.Size); |
||||
|
||||
// Console.WriteLine("{0} - {1} - {2} - {3}",containerRect,containerRect.Bottom,strategy.BiggestRectangle,strategy.BiggestRectangle.Bottom);
|
||||
Assert.That(containerRect.Contains(arrangeRect)); |
||||
Assert.That(containerRect.Bottom,Is.EqualTo(arrangeRect.Bottom + 5)); |
||||
} |
||||
|
||||
[Test] |
||||
public void ResizedContainerExeed5Points() { |
||||
var container = CreateContainer(); |
||||
container.ExportedItems.Add(CreateCanGrowText(container)); |
||||
strategy.Arrange(container); |
||||
var containerRect = new Rectangle(container.Location,container.DesiredSize); |
||||
var arrangeRect = new Rectangle(new Point(container.Location.X + strategy.BiggestRectangle.Left, |
||||
strategy.BiggestRectangle.Top), |
||||
strategy.BiggestRectangle.Size); |
||||
|
||||
Assert.That(containerRect.Bottom,Is.EqualTo(arrangeRect.Bottom + 5)); |
||||
} |
||||
|
||||
|
||||
private IExportText CreateCanGrowText(IExportContainer container) { |
||||
var secondItem = new ExportText(){ |
||||
Name = "Item1", |
||||
Location = new Point(80,10), |
||||
Size = new Size (20,70), |
||||
DesiredSize = new Size (20,70), |
||||
CanGrow = true, |
||||
Parent = container |
||||
}; |
||||
return secondItem; |
||||
} |
||||
|
||||
|
||||
private IExportContainer CreateContainer () { |
||||
|
||||
var container = new ExportContainer(){ |
||||
Size = new Size (720,60), |
||||
Location = new Point(50,50), |
||||
Name ="Section" |
||||
}; |
||||
|
||||
var item1 = new ExportText(){ |
||||
Name = "Item1", |
||||
Location = new Point(10,10), |
||||
Size = new Size (60,20), |
||||
Parent = container |
||||
}; |
||||
|
||||
container.ExportedItems.Add(item1); |
||||
container.DesiredSize = container.Size; |
||||
return container; |
||||
} |
||||
|
||||
[TestFixtureSetUp] |
||||
public void Init() |
||||
{ |
||||
strategy = new ContainerArrangeStrategy(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,87 @@
@@ -0,0 +1,87 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 17.04.2013 |
||||
* Time: 20:14 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Drawing; |
||||
using ICSharpCode.Reporting.Interfaces; |
||||
using ICSharpCode.Reporting.Interfaces.Export; |
||||
using ICSharpCode.Reporting.Items; |
||||
using ICSharpCode.Reporting.PageBuilder.Converter; |
||||
using NUnit.Framework; |
||||
|
||||
namespace ICSharpCode.Reporting.Test.PageBuilder |
||||
{ |
||||
[TestFixture] |
||||
public class ContainerConverterFixture |
||||
{ |
||||
private IReportContainer container; |
||||
private Graphics graphics; |
||||
|
||||
[Test] |
||||
public void ConverterReturnExportContainer() { |
||||
var converter = new ContainerConverter(graphics,container,new Point(30,30)); |
||||
var result = converter.Convert(); |
||||
Assert.That(result,Is.InstanceOf(typeof(IExportContainer))); |
||||
} |
||||
|
||||
|
||||
[Test] |
||||
public void ConverterReturnExportContainerwithTwoItems() |
||||
{ |
||||
var converter = new ContainerConverter(graphics,container,new Point(30,30)); |
||||
var result = converter.Convert(); |
||||
Assert.That(result.ExportedItems.Count,Is.EqualTo(2)); |
||||
} |
||||
|
||||
|
||||
[Test] |
||||
public void LocationIsAdjusted() { |
||||
var location = new Point(30,30); |
||||
var converter = new ContainerConverter(graphics,container,location); |
||||
var result = converter.Convert(); |
||||
Assert.That(result.Location,Is.EqualTo(location)); |
||||
} |
||||
|
||||
[Test] |
||||
public void ParentInChildsIsSet () { |
||||
var converter = new ContainerConverter(graphics,container,container.Location); |
||||
var result = converter.Convert(); |
||||
foreach (var element in result.ExportedItems) { |
||||
Assert.That(element.Parent,Is.Not.Null); |
||||
} |
||||
} |
||||
|
||||
|
||||
[TestFixtureSetUp] |
||||
public void Init() |
||||
{ |
||||
container = new BaseSection(){ |
||||
Size = new Size (720,60), |
||||
Location = new Point(50,50), |
||||
Name ="Section" |
||||
}; |
||||
|
||||
var item1 = new BaseTextItem(){ |
||||
Name = "Item1", |
||||
Location = new Point(10,10), |
||||
Size = new Size (60,20) |
||||
}; |
||||
|
||||
var item2 = new BaseTextItem(){ |
||||
Name = "Item2", |
||||
Location = new Point(80,10), |
||||
Size = new Size (60,20) |
||||
}; |
||||
container.Items.Add(item1); |
||||
container.Items.Add(item2); |
||||
|
||||
Bitmap bitmap = new Bitmap(700,1000); |
||||
graphics = Graphics.FromImage(bitmap); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,61 @@
@@ -0,0 +1,61 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 06.06.2013 |
||||
* Time: 20:29 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Linq; |
||||
using System.Reflection; |
||||
using ICSharpCode.Reporting.Exporter; |
||||
using ICSharpCode.Reporting.Interfaces; |
||||
using ICSharpCode.Reporting.Items; |
||||
using ICSharpCode.Reporting.PageBuilder; |
||||
using ICSharpCode.Reporting.PageBuilder.ExportColumns; |
||||
using NUnit.Framework; |
||||
|
||||
namespace ICSharpCode.Reporting.Test.PageBuilder |
||||
{ |
||||
[TestFixture] |
||||
public class DataPageBuilderFixture |
||||
{ |
||||
private IReportCreator reportCreator; |
||||
|
||||
[Test] |
||||
public void CanInitDataPageBuilder() |
||||
{ |
||||
var dpb = new DataPageBuilder (new ReportModel(),new System.Collections.Generic.List<string>()); |
||||
// dpb.DataSource(new ReportModel(),new System.Collections.Generic.List<string>());
|
||||
Assert.That(dpb,Is.Not.Null); |
||||
} |
||||
|
||||
|
||||
[Test] |
||||
public void PageContainsFiveSections() |
||||
{ |
||||
reportCreator.BuildExportList(); |
||||
var x = reportCreator.Pages[0].ExportedItems; |
||||
var y = from s in x |
||||
where s.GetType() == typeof(ExportContainer) |
||||
select s; |
||||
Assert.That(y.ToList().Count,Is.EqualTo(5)); |
||||
Console.WriteLine("-------ShowDebug---------"); |
||||
var ex = new DebugExporter(reportCreator.Pages); |
||||
ex.Run(); |
||||
} |
||||
|
||||
|
||||
[SetUp] |
||||
public void LoadFromStream() |
||||
{ |
||||
System.Reflection.Assembly asm = Assembly.GetExecutingAssembly(); |
||||
var stream = asm.GetManifestResourceStream(TestHelper.RepWithTwoItems); |
||||
var reportingFactory = new ReportingFactory(); |
||||
// reportCreator = reportingFactory.ReportCreator(stream);
|
||||
var model = reportingFactory.LoadReportModel (stream); |
||||
reportCreator = new DataPageBuilder(model,new System.Collections.Generic.List<string>()); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,85 @@
@@ -0,0 +1,85 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 03.04.2013 |
||||
* Time: 20:09 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.IO; |
||||
using System.Reflection; |
||||
|
||||
using ICSharpCode.Reporting.BaseClasses; |
||||
using ICSharpCode.Reporting.Exporter; |
||||
using ICSharpCode.Reporting.Interfaces; |
||||
using ICSharpCode.Reporting.Interfaces.Export; |
||||
using ICSharpCode.Reporting.PageBuilder; |
||||
using NUnit.Framework; |
||||
|
||||
namespace ICSharpCode.Reporting.Test.PageBuilder |
||||
{ |
||||
[TestFixture] |
||||
public class PageBuilderFixture |
||||
{ |
||||
|
||||
private IReportCreator reportCreator; |
||||
|
||||
[Test] |
||||
public void CanCreateFormsPageBuilder() |
||||
{ |
||||
Assert.IsNotNull(reportCreator); |
||||
} |
||||
|
||||
|
||||
#region Pages
|
||||
|
||||
[Test] |
||||
public void PagesCountIsZero () { |
||||
Assert.That(reportCreator.Pages.Count,Is.EqualTo(0)); |
||||
} |
||||
|
||||
|
||||
[Test] |
||||
public void BuildExportPagesCountIsOne() { |
||||
reportCreator.BuildExportList(); |
||||
Assert.That(reportCreator.Pages.Count,Is.EqualTo(1)); |
||||
} |
||||
|
||||
|
||||
[Test] |
||||
public void CurrentPageIsSet() { |
||||
|
||||
reportCreator.BuildExportList(); |
||||
Assert.That(reportCreator.Pages[0],Is.Not.Null); |
||||
} |
||||
|
||||
|
||||
[Test] |
||||
public void CurrentPageIsFirstPage() { |
||||
reportCreator.BuildExportList(); |
||||
Assert.That(reportCreator.Pages[0].IsFirstPage,Is.True); |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
[Test] |
||||
public void ParentOfSectionsIsPage() { |
||||
reportCreator.BuildExportList(); |
||||
var page = reportCreator.Pages[0]; |
||||
foreach (var element in page.ExportedItems) { |
||||
Assert.That(element.Parent,Is.Not.Null); |
||||
Assert.That(element.Parent,Is.AssignableTo(typeof(IPage))); |
||||
} |
||||
} |
||||
|
||||
[SetUp] |
||||
public void LoadFromStream() |
||||
{ |
||||
System.Reflection.Assembly asm = Assembly.GetExecutingAssembly(); |
||||
var stream = asm.GetManifestResourceStream(TestHelper.RepWithTwoItems); |
||||
var reportingFactory = new ReportingFactory(); |
||||
reportCreator = reportingFactory.ReportCreator(stream); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,78 @@
@@ -0,0 +1,78 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 24.04.2013 |
||||
* Time: 19:55 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.IO; |
||||
using System.Reflection; |
||||
using System.Drawing; |
||||
using ICSharpCode.Reporting.Exporter; |
||||
using ICSharpCode.Reporting.Globals; |
||||
using ICSharpCode.Reporting.Interfaces; |
||||
using ICSharpCode.Reporting.Interfaces.Export; |
||||
using ICSharpCode.Reporting.PageBuilder; |
||||
using NUnit.Framework; |
||||
|
||||
namespace ICSharpCode.Reporting.Test.PageBuilder |
||||
{ |
||||
[TestFixture] |
||||
public class PageFixture |
||||
{ |
||||
|
||||
private IReportCreator reportCreator; |
||||
|
||||
[Test] |
||||
public void CreateGraphicsFromPageSize () { |
||||
reportCreator.BuildExportList(); |
||||
var page = reportCreator.Pages[0]; |
||||
Graphics g = CreateGraphics.FromSize(page.Size); |
||||
Assert.That(g,Is.Not.Null); |
||||
} |
||||
// http://www.dev102.com/2008/10/09/measure-string-size-in-pixels-c/
|
||||
//http://www.codeproject.com/Articles/2118/Bypass-Graphics-MeasureString-limitations
|
||||
//http://codebetter.com/patricksmacchia/2009/08/31/reveal-hidden-api-usage-tricks-from-any-net-application/
|
||||
|
||||
|
||||
[Test] |
||||
public void GraphicsIsSameSizeAsPage() { |
||||
reportCreator.BuildExportList(); |
||||
var page = reportCreator.Pages[0]; |
||||
var graphics = CreateGraphics.FromSize(page.Size); |
||||
Assert.That(graphics.VisibleClipBounds.Width,Is.EqualTo(page.Size.Width)); |
||||
Assert.That(graphics.VisibleClipBounds.Height,Is.EqualTo(page.Size.Height)); |
||||
} |
||||
|
||||
#region PageInfo
|
||||
|
||||
[Test] |
||||
public void PageInfoPageNumberIsOne() { |
||||
reportCreator.BuildExportList(); |
||||
var pageInfo = reportCreator.Pages[0].PageInfo; |
||||
Assert.That(pageInfo.PageNumber,Is.EqualTo(1)); |
||||
} |
||||
|
||||
|
||||
[Test] |
||||
public void PageInfoReportName() { |
||||
reportCreator.BuildExportList(); |
||||
var pi = reportCreator.Pages[0].PageInfo; |
||||
Assert.That(pi.ReportName,Is.EqualTo("Report1")); |
||||
} |
||||
|
||||
|
||||
#endregion
|
||||
|
||||
[SetUp] |
||||
public void LoadFromStream() |
||||
{ |
||||
System.Reflection.Assembly asm = Assembly.GetExecutingAssembly(); |
||||
var stream = asm.GetManifestResourceStream(TestHelper.RepWithTwoItems); |
||||
var reportingFactory = new ReportingFactory(); |
||||
reportCreator = reportingFactory.ReportCreator(stream); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,73 @@
@@ -0,0 +1,73 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 21.04.2013 |
||||
* Time: 18:18 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using System.Drawing; |
||||
using System.Linq; |
||||
using System.Reflection; |
||||
|
||||
using ICSharpCode.Reporting.Exporter; |
||||
using ICSharpCode.Reporting.Interfaces; |
||||
using ICSharpCode.Reporting.Interfaces.Export; |
||||
using ICSharpCode.Reporting.PageBuilder.ExportColumns; |
||||
using NUnit.Framework; |
||||
|
||||
namespace ICSharpCode.Reporting.Test.PageBuilder |
||||
{ |
||||
[TestFixture] |
||||
public class PageLayoutFixture |
||||
{ |
||||
private IReportCreator reportCreator; |
||||
|
||||
[Test] |
||||
public void PageContainsFiveSections() |
||||
{ |
||||
reportCreator.BuildExportList(); |
||||
var x = reportCreator.Pages[0].ExportedItems; |
||||
var y = from s in x |
||||
where s.GetType() == typeof(ExportContainer) |
||||
select s; |
||||
Assert.That(y.ToList().Count,Is.EqualTo(5)); |
||||
Console.WriteLine("-------ShowDebug---------"); |
||||
var ex = new DebugExporter(reportCreator.Pages); |
||||
ex.Run(); |
||||
} |
||||
|
||||
|
||||
[Test] |
||||
public void SectionsInPageDoNotOverlap() |
||||
{ |
||||
Point referencePoint = Point.Empty; |
||||
var referenceRect = Rectangle.Empty; |
||||
|
||||
reportCreator.BuildExportList(); |
||||
foreach (var item in reportCreator.Pages[0].ExportedItems) { |
||||
var p2 = new Point(item.Location.X,item.Location.Y); |
||||
|
||||
Console.WriteLine("{0} - {1} - {2}- <{3}>",p2,item.Size.Height,item.Name,item.DisplayRectangle); |
||||
if (item.Name != "ReportFooter") { |
||||
Assert.That(p2.Y,Is.GreaterThan(referencePoint.Y),item.Name); |
||||
var t = referenceRect.IntersectsWith(item.DisplayRectangle); |
||||
Assert.That(referenceRect.IntersectsWith(item.DisplayRectangle),Is.False); |
||||
} |
||||
referencePoint = new Point(item.Location.X,item.Location.Y + item.Size.Height); |
||||
referenceRect = item.DisplayRectangle; |
||||
} |
||||
} |
||||
|
||||
|
||||
[SetUp] |
||||
public void LoadFromStream() |
||||
{ |
||||
System.Reflection.Assembly asm = Assembly.GetExecutingAssembly(); |
||||
var stream = asm.GetManifestResourceStream(TestHelper.RepWithTwoItems); |
||||
var reportingFactory = new ReportingFactory(); |
||||
reportCreator = reportingFactory.ReportCreator(stream); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,31 @@
@@ -0,0 +1,31 @@
|
||||
#region Using directives
|
||||
|
||||
using System; |
||||
using System.Reflection; |
||||
using System.Runtime.InteropServices; |
||||
|
||||
#endregion
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("ICSharpCode.Reporting.Test")] |
||||
[assembly: AssemblyDescription("")] |
||||
[assembly: AssemblyConfiguration("")] |
||||
[assembly: AssemblyCompany("")] |
||||
[assembly: AssemblyProduct("ICSharpCode.Reporting.Test")] |
||||
[assembly: AssemblyCopyright("Copyright 2013")] |
||||
[assembly: AssemblyTrademark("")] |
||||
[assembly: AssemblyCulture("")] |
||||
|
||||
// This sets the default COM visibility of types in the assembly to invisible.
|
||||
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
|
||||
[assembly: ComVisible(false)] |
||||
|
||||
// The assembly version has following format :
|
||||
//
|
||||
// Major.Minor.Build.Revision
|
||||
//
|
||||
// You can specify all the values or you can use the default the Revision and
|
||||
// Build Numbers by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.*")] |
@ -0,0 +1,53 @@
@@ -0,0 +1,53 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 25.04.2013 |
||||
* Time: 19:45 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using ICSharpCode.Reporting.Globals; |
||||
using ICSharpCode.Reporting.Items; |
||||
using ICSharpCode.Reporting.PageBuilder.ExportColumns; |
||||
using NUnit.Framework; |
||||
|
||||
namespace ICSharpCode.Reporting.Test.ReportItems |
||||
{ |
||||
[TestFixture] |
||||
public class TextItemFixture |
||||
{ |
||||
[Test] |
||||
public void IsNameSetOnInitialize() { |
||||
var ti = new BaseTextItem(); |
||||
Assert.That (ti.Name,Is.EqualTo("BaseTextItem")); |
||||
} |
||||
|
||||
|
||||
[Test] |
||||
public void ChangeName() { |
||||
var newName = "changed"; |
||||
var ti = new BaseTextItem(); |
||||
ti.Name = newName; |
||||
Assert.That(ti.Name,Is.EqualTo(newName)); |
||||
} |
||||
|
||||
|
||||
[Test] |
||||
public void DefaultFontOnInitialize() { |
||||
var ti = new BaseTextItem(); |
||||
Assert.That(ti.Font,Is.EqualTo(GlobalValues.DefaultFont)); |
||||
} |
||||
|
||||
[Test] |
||||
public void CreateExportText() { |
||||
var ti = new BaseTextItem(); |
||||
var exportText = (ExportText)ti.CreateExportColumn(); |
||||
Assert.That(exportText.Name,Is.EqualTo(ti.Name)); |
||||
Assert.That(exportText.Location,Is.EqualTo(ti.Location)); |
||||
Assert.That(exportText.Size,Is.EqualTo(ti.Size)); |
||||
Assert.That(exportText.Font , Is.EqualTo(GlobalValues.DefaultFont)); |
||||
} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,57 @@
@@ -0,0 +1,57 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 03.04.2013 |
||||
* Time: 20:10 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using ICSharpCode.Reporting.Exporter; |
||||
using ICSharpCode.Reporting.Exporter.Visitors; |
||||
using ICSharpCode.Reporting.Interfaces.Export; |
||||
|
||||
namespace ICSharpCode.Reporting.Test |
||||
{ |
||||
/// <summary>
|
||||
/// Description of TestHelper.
|
||||
/// </summary>
|
||||
public static class TestHelper |
||||
{ |
||||
private const string nameSpace = "ICSharpCode.Reporting.Test.src.TestReports."; |
||||
private const string plainReportName = "PlainModel.srd"; |
||||
private const string rr = "ReportWithTwoItems.srd"; |
||||
|
||||
|
||||
public static string PlainReportFileName{ |
||||
get{return nameSpace + plainReportName;} |
||||
} |
||||
|
||||
public static string RepWithTwoItems { |
||||
get {return nameSpace + rr;} |
||||
} |
||||
|
||||
|
||||
public static void ShowDebug(IExportContainer exportContainer) |
||||
{ |
||||
var visitor = new DebugVisitor(); |
||||
foreach (var item in exportContainer.ExportedItems) { |
||||
var container = item as IExportContainer; |
||||
var acceptor = item as IAcceptor; |
||||
if (container != null) { |
||||
if (acceptor != null) { |
||||
Console.WriteLine("----"); |
||||
acceptor.Accept(visitor); |
||||
} |
||||
ShowDebug(container); |
||||
} else { |
||||
// var b = item as IAcceptor;
|
||||
if (acceptor != null) { |
||||
acceptor.Accept(visitor); |
||||
|
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,144 @@
@@ -0,0 +1,144 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<ReportModel> |
||||
<ReportSettings> |
||||
<ReportSettings> |
||||
<ReportName>Report1</ReportName> |
||||
<ReportType>FormSheet</ReportType> |
||||
<BottomMargin>50</BottomMargin> |
||||
<TopMargin>50</TopMargin> |
||||
<LeftMargin>50</LeftMargin> |
||||
<RightMargin>50</RightMargin> |
||||
<PageSize>827, 1169</PageSize> |
||||
<Landscape>False</Landscape> |
||||
<GraphicsUnit>Millimeter</GraphicsUnit> |
||||
<Padding>5, 5, 5, 5</Padding> |
||||
<AvailableFieldsCollection /> |
||||
<SortColumnsCollection /> |
||||
<GroupColumnsCollection /> |
||||
<ParameterCollection /> |
||||
<SqlParameters /> |
||||
<ConnectionString /> |
||||
<CommandText /> |
||||
<CommandType>Text</CommandType> |
||||
<DataModel>FormSheet</DataModel> |
||||
<NoDataMessage>No Data for this Report</NoDataMessage> |
||||
<DefaultFont>Microsoft Sans Serif, 10pt</DefaultFont> |
||||
<UseStandardPrinter>True</UseStandardPrinter> |
||||
</ReportSettings> |
||||
</ReportSettings> |
||||
<SectionCollection> |
||||
<BaseSection> |
||||
<Location>50, 50</Location> |
||||
<Size>727, 60</Size> |
||||
<BackColor>White</BackColor> |
||||
<SectionOffset>0</SectionOffset> |
||||
<SectionMargin>0</SectionMargin> |
||||
<DrawBorder>False</DrawBorder> |
||||
<PageBreakAfter>False</PageBreakAfter> |
||||
<Items> |
||||
<BaseTextItem> |
||||
<Location>313, 5</Location> |
||||
<Size>100, 20</Size> |
||||
<BackColor>White</BackColor> |
||||
<Font>Microsoft Sans Serif, 10pt</Font> |
||||
<StringTrimming>None</StringTrimming> |
||||
<ContentAlignment>TopLeft</ContentAlignment> |
||||
<CanGrow>False</CanGrow> |
||||
<CanShrink>False</CanShrink> |
||||
<DataType>System.String</DataType> |
||||
<RTL>No</RTL> |
||||
<Text>Report1</Text> |
||||
<DrawBorder>False</DrawBorder> |
||||
<FrameColor>Black</FrameColor> |
||||
<ForeColor>Black</ForeColor> |
||||
<Name>Report1</Name> |
||||
</BaseTextItem> |
||||
</Items> |
||||
<FrameColor>Black</FrameColor> |
||||
<Name>ReportHeader</Name> |
||||
</BaseSection> |
||||
<BaseSection> |
||||
<Location>50, 125</Location> |
||||
<Size>727, 60</Size> |
||||
<BackColor>White</BackColor> |
||||
<SectionOffset>0</SectionOffset> |
||||
<SectionMargin>0</SectionMargin> |
||||
<DrawBorder>False</DrawBorder> |
||||
<PageBreakAfter>False</PageBreakAfter> |
||||
<Items> |
||||
<BaseTextItem> |
||||
<Location>26, 22</Location> |
||||
<Size>100, 20</Size> |
||||
<BackColor>White</BackColor> |
||||
<Font>Microsoft Sans Serif, 10pt</Font> |
||||
<StringTrimming>None</StringTrimming> |
||||
<ContentAlignment>TopLeft</ContentAlignment> |
||||
<CanGrow>True</CanGrow> |
||||
<CanShrink>False</CanShrink> |
||||
<RTL>No</RTL> |
||||
<Text>TestText for Item in PageHeader</Text> |
||||
<DrawBorder>False</DrawBorder> |
||||
<FrameColor>Black</FrameColor> |
||||
<ForeColor>Black</ForeColor> |
||||
<Name>BaseTextItem2147483646</Name> |
||||
</BaseTextItem> |
||||
</Items> |
||||
<FrameColor>Black</FrameColor> |
||||
<Name>ReportPageHeader</Name> |
||||
</BaseSection> |
||||
<BaseSection> |
||||
<Location>50, 200</Location> |
||||
<Size>727, 60</Size> |
||||
<BackColor>White</BackColor> |
||||
<SectionOffset>0</SectionOffset> |
||||
<SectionMargin>0</SectionMargin> |
||||
<DrawBorder>False</DrawBorder> |
||||
<PageBreakAfter>False</PageBreakAfter> |
||||
<Items /> |
||||
<FrameColor>Black</FrameColor> |
||||
<Name>ReportDetail</Name> |
||||
</BaseSection> |
||||
<BaseSection> |
||||
<Location>50, 275</Location> |
||||
<Size>727, 60</Size> |
||||
<BackColor>White</BackColor> |
||||
<SectionOffset>0</SectionOffset> |
||||
<SectionMargin>0</SectionMargin> |
||||
<DrawBorder>False</DrawBorder> |
||||
<PageBreakAfter>False</PageBreakAfter> |
||||
<Items> |
||||
<BaseTextItem> |
||||
<Location>622, 5</Location> |
||||
<Size>100, 20</Size> |
||||
<BackColor>White</BackColor> |
||||
<Font>Microsoft Sans Serif, 10pt</Font> |
||||
<StringTrimming>None</StringTrimming> |
||||
<ContentAlignment>TopLeft</ContentAlignment> |
||||
<CanGrow>False</CanGrow> |
||||
<CanShrink>False</CanShrink> |
||||
<DataType>System.String</DataType> |
||||
<RTL>No</RTL> |
||||
<Text>=Globals!PageNumber</Text> |
||||
<DrawBorder>False</DrawBorder> |
||||
<FrameColor>Black</FrameColor> |
||||
<ForeColor>Black</ForeColor> |
||||
<Name>PageNumber1</Name> |
||||
</BaseTextItem> |
||||
</Items> |
||||
<FrameColor>Black</FrameColor> |
||||
<Name>ReportPageFooter</Name> |
||||
</BaseSection> |
||||
<BaseSection> |
||||
<Location>50, 350</Location> |
||||
<Size>727, 60</Size> |
||||
<BackColor>White</BackColor> |
||||
<SectionOffset>0</SectionOffset> |
||||
<SectionMargin>0</SectionMargin> |
||||
<DrawBorder>False</DrawBorder> |
||||
<PageBreakAfter>False</PageBreakAfter> |
||||
<Items /> |
||||
<FrameColor>Black</FrameColor> |
||||
<Name>ReportFooter</Name> |
||||
</BaseSection> |
||||
</SectionCollection> |
||||
</ReportModel> |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue