172 changed files with 8370 additions and 2191 deletions
@ -0,0 +1,308 @@
@@ -0,0 +1,308 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<ReportModel> |
||||
<ReportSettings> |
||||
<ReportSettings> |
||||
<ReportName>DependencyReport</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> |
||||
<GroupColumn> |
||||
<SortDirection>Ascending</SortDirection> |
||||
<CaseSensitive>False</CaseSensitive> |
||||
<ColumnName>Name</ColumnName> |
||||
<DataTypeName>System.String</DataTypeName> |
||||
</GroupColumn> |
||||
</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>157, 3</Location> |
||||
<Size>414, 40</Size> |
||||
<BackColor>White</BackColor> |
||||
<Font>Segoe UI, 18pt, style=Bold</Font> |
||||
<StringTrimming>None</StringTrimming> |
||||
<ContentAlignment>TopLeft</ContentAlignment> |
||||
<CanGrow>False</CanGrow> |
||||
<CanShrink>False</CanShrink> |
||||
<RTL>No</RTL> |
||||
<Text>SharpDevelop CodeQuality Analysis</Text> |
||||
<DrawBorder>False</DrawBorder> |
||||
<FrameColor>Black</FrameColor> |
||||
<ForeColor>Black</ForeColor> |
||||
<Name>BaseTextItem2147483637</Name> |
||||
</BaseTextItem> |
||||
</Items> |
||||
<FrameColor>Black</FrameColor> |
||||
<Name>ReportHeader</Name> |
||||
</BaseSection> |
||||
<BaseSection> |
||||
<Location>50, 125</Location> |
||||
<Size>727, 69</Size> |
||||
<BackColor>White</BackColor> |
||||
<SectionOffset>0</SectionOffset> |
||||
<SectionMargin>0</SectionMargin> |
||||
<DrawBorder>False</DrawBorder> |
||||
<PageBreakAfter>False</PageBreakAfter> |
||||
<Items> |
||||
<BaseLineItem> |
||||
<Location>22, 47</Location> |
||||
<Size>660, 10</Size> |
||||
<BackColor>White</BackColor> |
||||
<ForeColor>Black</ForeColor> |
||||
<FromPoint>10, 5</FromPoint> |
||||
<ToPoint>647, 5</ToPoint> |
||||
<StartLineCap>Flat</StartLineCap> |
||||
<EndLineCap>Flat</EndLineCap> |
||||
<DashLineCap>Flat</DashLineCap> |
||||
<DashStyle>Solid</DashStyle> |
||||
<Thickness>4</Thickness> |
||||
<Name>BaseLineItem1</Name> |
||||
</BaseLineItem> |
||||
<BaseTextItem> |
||||
<Location>222, 3</Location> |
||||
<Size>257, 26</Size> |
||||
<BackColor>White</BackColor> |
||||
<Font>Microsoft Sans Serif, 15.75pt</Font> |
||||
<StringTrimming>None</StringTrimming> |
||||
<ContentAlignment>TopLeft</ContentAlignment> |
||||
<CanGrow>False</CanGrow> |
||||
<CanShrink>False</CanShrink> |
||||
<DataType>System.String</DataType> |
||||
<RTL>No</RTL> |
||||
<Text>Analysis Overview Report</Text> |
||||
<DrawBorder>False</DrawBorder> |
||||
<FrameColor>Black</FrameColor> |
||||
<ForeColor>Black</ForeColor> |
||||
<Name>Overview</Name> |
||||
</BaseTextItem> |
||||
<BaseTextItem> |
||||
<Location>563, 3</Location> |
||||
<Size>100, 26</Size> |
||||
<BackColor>White</BackColor> |
||||
<Font>Segoe UI, 15.75pt</Font> |
||||
<StringTrimming>None</StringTrimming> |
||||
<ContentAlignment>TopLeft</ContentAlignment> |
||||
<CanGrow>False</CanGrow> |
||||
<CanShrink>False</CanShrink> |
||||
<RTL>No</RTL> |
||||
<Text>=Today()</Text> |
||||
<DrawBorder>False</DrawBorder> |
||||
<FrameColor>Black</FrameColor> |
||||
<ForeColor>ControlText</ForeColor> |
||||
<Name>BaseTextItem2147483638</Name> |
||||
</BaseTextItem> |
||||
</Items> |
||||
<FrameColor>Black</FrameColor> |
||||
<Name>ReportPageHeader</Name> |
||||
</BaseSection> |
||||
<BaseSection> |
||||
<Location>50, 209</Location> |
||||
<Size>727, 115</Size> |
||||
<BackColor>White</BackColor> |
||||
<SectionOffset>0</SectionOffset> |
||||
<SectionMargin>0</SectionMargin> |
||||
<DrawBorder>False</DrawBorder> |
||||
<PageBreakAfter>False</PageBreakAfter> |
||||
<Items> |
||||
<BaseRowItem> |
||||
<Location>31, 72</Location> |
||||
<Size>641, 30</Size> |
||||
<BackColor>White</BackColor> |
||||
<DrawBorder>False</DrawBorder> |
||||
<ForeColor>Black</ForeColor> |
||||
<FrameColor>Black</FrameColor> |
||||
<Items> |
||||
<BaseDataItem> |
||||
<Location>443, 4</Location> |
||||
<Size>71, 20</Size> |
||||
<BackColor>White</BackColor> |
||||
<Font>Segoe UI, 9pt</Font> |
||||
<StringTrimming>None</StringTrimming> |
||||
<ContentAlignment>MiddleRight</ContentAlignment> |
||||
<CanGrow>False</CanGrow> |
||||
<CanShrink>False</CanShrink> |
||||
<RTL>No</RTL> |
||||
<Text>BaseDataItem2147483646</Text> |
||||
<DrawBorder>False</DrawBorder> |
||||
<FrameColor>Black</FrameColor> |
||||
<ForeColor>Black</ForeColor> |
||||
<ColumnName>ReferenceCount</ColumnName> |
||||
<Name>BaseDataItem2147483646</Name> |
||||
</BaseDataItem> |
||||
<BaseDataItem> |
||||
<Location>254, 4</Location> |
||||
<Size>156, 20</Size> |
||||
<BackColor>White</BackColor> |
||||
<Font>Microsoft Sans Serif, 10pt</Font> |
||||
<StringTrimming>None</StringTrimming> |
||||
<ContentAlignment>TopLeft</ContentAlignment> |
||||
<CanGrow>False</CanGrow> |
||||
<CanShrink>False</CanShrink> |
||||
<RTL>No</RTL> |
||||
<Text>References</Text> |
||||
<DrawBorder>False</DrawBorder> |
||||
<FrameColor>Black</FrameColor> |
||||
<ForeColor>Black</ForeColor> |
||||
<ColumnName>References</ColumnName> |
||||
<Name>BaseDataItem2</Name> |
||||
</BaseDataItem> |
||||
</Items> |
||||
<AlternateBackColor /> |
||||
<ChangeBackColorEveryNRow>0</ChangeBackColorEveryNRow> |
||||
<Name>BaseRowItem1</Name> |
||||
</BaseRowItem> |
||||
<GroupHeader> |
||||
<Location>31, 22</Location> |
||||
<Size>641, 30</Size> |
||||
<BackColor>LightGray</BackColor> |
||||
<DrawBorder>False</DrawBorder> |
||||
<ForeColor>Black</ForeColor> |
||||
<FrameColor>Black</FrameColor> |
||||
<Items> |
||||
<BaseTextItem> |
||||
<Location>414, 7</Location> |
||||
<Size>100, 20</Size> |
||||
<BackColor>White</BackColor> |
||||
<Font>Segoe UI, 9.75pt</Font> |
||||
<StringTrimming>None</StringTrimming> |
||||
<ContentAlignment>MiddleRight</ContentAlignment> |
||||
<CanGrow>False</CanGrow> |
||||
<CanShrink>False</CanShrink> |
||||
<RTL>No</RTL> |
||||
<Text># of References</Text> |
||||
<DrawBorder>False</DrawBorder> |
||||
<FrameColor>Black</FrameColor> |
||||
<ForeColor>Black</ForeColor> |
||||
<Name>BaseTextItem2147483646</Name> |
||||
</BaseTextItem> |
||||
<BaseTextItem> |
||||
<Location>254, 2</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> |
||||
<RTL>No</RTL> |
||||
<Text>References</Text> |
||||
<DrawBorder>False</DrawBorder> |
||||
<FrameColor>Black</FrameColor> |
||||
<ForeColor>Black</ForeColor> |
||||
<Name>BaseTextItem2147483636</Name> |
||||
</BaseTextItem> |
||||
<BaseDataItem> |
||||
<Location>12, 3</Location> |
||||
<Size>211, 20</Size> |
||||
<BackColor>White</BackColor> |
||||
<Font>Microsoft Sans Serif, 10pt</Font> |
||||
<StringTrimming>None</StringTrimming> |
||||
<ContentAlignment>TopLeft</ContentAlignment> |
||||
<CanGrow>False</CanGrow> |
||||
<CanShrink>False</CanShrink> |
||||
<RTL>No</RTL> |
||||
<Text>BaseDataItem1</Text> |
||||
<DrawBorder>False</DrawBorder> |
||||
<FrameColor>Black</FrameColor> |
||||
<ForeColor>Black</ForeColor> |
||||
<ColumnName>Name</ColumnName> |
||||
<Name>BaseDataItem1</Name> |
||||
</BaseDataItem> |
||||
</Items> |
||||
<AlternateBackColor /> |
||||
<ChangeBackColorEveryNRow>0</ChangeBackColorEveryNRow> |
||||
<PageBreakOnGroupChange>False</PageBreakOnGroupChange> |
||||
<Name>GroupHeader1</Name> |
||||
</GroupHeader> |
||||
</Items> |
||||
<FrameColor>Black</FrameColor> |
||||
<Name>ReportDetail</Name> |
||||
</BaseSection> |
||||
<BaseSection> |
||||
<Location>50, 339</Location> |
||||
<Size>727, 36</Size> |
||||
<BackColor>White</BackColor> |
||||
<SectionOffset>0</SectionOffset> |
||||
<SectionMargin>0</SectionMargin> |
||||
<DrawBorder>False</DrawBorder> |
||||
<PageBreakAfter>False</PageBreakAfter> |
||||
<Items> |
||||
<BaseTextItem> |
||||
<Location>31, 5</Location> |
||||
<Size>555, 20</Size> |
||||
<BackColor>White</BackColor> |
||||
<Font>Segoe UI, 9.75pt</Font> |
||||
<StringTrimming>None</StringTrimming> |
||||
<ContentAlignment>TopLeft</ContentAlignment> |
||||
<CanGrow>False</CanGrow> |
||||
<CanShrink>False</CanShrink> |
||||
<RTL>No</RTL> |
||||
<Text>= Globals!ReportFolder + Globals!ReportName</Text> |
||||
<DrawBorder>False</DrawBorder> |
||||
<FrameColor>Black</FrameColor> |
||||
<ForeColor>ControlText</ForeColor> |
||||
<Name>BaseTextItem2147483641</Name> |
||||
</BaseTextItem> |
||||
<BaseTextItem> |
||||
<Location>624, 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>= 'Page : ' + 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, 390</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> |
@ -0,0 +1,36 @@
@@ -0,0 +1,36 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 17.02.2014 |
||||
* Time: 20:07 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Workbench; |
||||
|
||||
namespace ICSharpCode.Reporting.Addin.Commands |
||||
{ |
||||
/// <summary>
|
||||
/// Description of ViewCommands.
|
||||
/// </summary>
|
||||
public class CreateDesignerCommand : AbstractMenuCommand |
||||
{ |
||||
readonly OpenedFile openedFile; |
||||
|
||||
public CreateDesignerCommand (OpenedFile openedFile) { |
||||
if (openedFile == null) |
||||
throw new ArgumentNullException("openedFile"); |
||||
this.openedFile = openedFile; |
||||
} |
||||
|
||||
public override void Run(){ |
||||
// var generator = new ReportDesignerGenerator();
|
||||
// DesignerView = new ReportDesignerView(openedFile, generator);
|
||||
MessageService.ShowMessage("ReportDesigner not available at the Moment","New ReportDesigner"); |
||||
} |
||||
|
||||
// public ReportDesignerView DesignerView {get; private set;}
|
||||
} |
||||
} |
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 10.02.2014 |
||||
* Time: 20:24 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
|
||||
using System.Reflection; |
||||
|
||||
[assembly: AssemblyTitle("")] |
||||
[assembly: AssemblyDescription("")] |
||||
[assembly: AssemblyConfiguration("")] |
||||
[assembly: AssemblyTrademark("")] |
||||
[assembly: AssemblyCulture("")] |
@ -0,0 +1,64 @@
@@ -0,0 +1,64 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 11.02.2014 |
||||
* Time: 20:19 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
|
||||
using System; |
||||
using System.IO; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop; |
||||
using ICSharpCode.SharpDevelop.Workbench; |
||||
using ICSharpCode.Reporting.Addin.Commands; |
||||
|
||||
namespace ICSharpCode.Reporting.Addin.DesignerBinding { |
||||
|
||||
|
||||
public class ReportDesignerBinding:IDisplayBinding { |
||||
|
||||
|
||||
public bool IsPreferredBindingForFile(FileName fileName) |
||||
{ |
||||
return true; |
||||
} |
||||
|
||||
|
||||
public bool CanCreateContentForFile(FileName fileName) |
||||
{ |
||||
return Path.GetExtension(fileName).Equals(".srd", StringComparison.OrdinalIgnoreCase); |
||||
} |
||||
|
||||
|
||||
public double AutoDetectFileContent(FileName fileName, System.IO.Stream fileContent, string detectedMimeType) |
||||
{ |
||||
throw new System.NotImplementedException(); |
||||
} |
||||
|
||||
|
||||
public IViewContent CreateContentForFile(OpenedFile file) |
||||
{ |
||||
// MessageService.ShowMessage("ReportDesigner not available at the Moment","New ReportDesigner");
|
||||
// return null;
|
||||
|
||||
if (file.IsDirty) { |
||||
MessageService.ShowMessage("ReportWizard not available at the Moment","New ReportDesigner"); |
||||
return null; |
||||
// var cmd = new ReportWizardCommand(file);
|
||||
// cmd.Run();
|
||||
// if (cmd.Canceled) {
|
||||
// return null;
|
||||
// }
|
||||
// file.SetData(cmd.GeneratedReport.ToArray());
|
||||
} |
||||
|
||||
var viewCmd = new CreateDesignerCommand(file); |
||||
viewCmd.Run(); |
||||
// return viewCmd.DesignerView;
|
||||
return null; |
||||
|
||||
} |
||||
} |
||||
} |
@ -0,0 +1,19 @@
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0"?> |
||||
<Template author="Peter Forstmeier" version="2.1"> |
||||
|
||||
<Config |
||||
name = "${res:SharpReport.AddinName}" |
||||
icon = "Icons.32x32.TextFileIcon" |
||||
category = "${res:Templates.File.Categories.Misc}" |
||||
defaultname = "Report${Number}.srd" |
||||
language = "SharpDevelopReports"/> |
||||
|
||||
<Description>${res:Templates.SharpReport.NewReport}</Description> |
||||
|
||||
<Files> |
||||
<File name="${FullName}" language="SharpDevelopReports"/> |
||||
</Files> |
||||
|
||||
<AdditionalOptions/> |
||||
</Template> |
||||
|
@ -0,0 +1,100 @@
@@ -0,0 +1,100 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build"> |
||||
<PropertyGroup> |
||||
<ProjectGuid>{0502FCF7-72F4-4587-936B-D0238CD0E072}</ProjectGuid> |
||||
<ProjectTypeGuids>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> |
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||
<OutputType>Library</OutputType> |
||||
<RootNamespace>ICSharpCode.Reporting.Addin</RootNamespace> |
||||
<AssemblyName>ICSharpCode.Reporting.Addin</AssemblyName> |
||||
<AppDesignerFolder>Properties</AppDesignerFolder> |
||||
<NoWin32Manifest>False</NoWin32Manifest> |
||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
||||
<NoStdLib>False</NoStdLib> |
||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors> |
||||
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath> |
||||
<WarningLevel>4</WarningLevel> |
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> |
||||
<TargetFrameworkProfile /> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' "> |
||||
<PlatformTarget>x86</PlatformTarget> |
||||
<BaseAddress>4194304</BaseAddress> |
||||
<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>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="Microsoft.CSharp"> |
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System" /> |
||||
<Reference Include="System.Core"> |
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System.Data" /> |
||||
<Reference Include="System.Data.DataSetExtensions"> |
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System.Xml" /> |
||||
<Reference Include="System.Xml.Linq"> |
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||
</Reference> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Folder Include="Configuration" /> |
||||
<Folder Include="DesignerBinding" /> |
||||
<Folder Include="Commands" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Compile Include="..\..\..\..\Main\GlobalAssemblyInfo.cs"> |
||||
<Link>Configuration\GlobalAssemblyInfo.cs</Link> |
||||
</Compile> |
||||
<Compile Include="Configuration\AssemblyInfo.cs" /> |
||||
<Compile Include="Commands\ViewCommands.cs" /> |
||||
<Compile Include="DesignerBinding\DesignerBinding.cs" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<None Include="EmptyReport.xft"> |
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
||||
</None> |
||||
<None Include="ICSharpCode.Reporting.addin"> |
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
||||
</None> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<ProjectReference Include="..\..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj"> |
||||
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project> |
||||
<Name>ICSharpCode.SharpDevelop</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\..\..\..\Main\Core\Project\ICSharpCode.Core.csproj"> |
||||
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project> |
||||
<Name>ICSharpCode.Core</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\ICSharpCode.Reporting\ICSharpCode.Reporting.csproj"> |
||||
<Project>{40CA84D4-ACFC-4646-9CDD-B87262D34093}</Project> |
||||
<Name>ICSharpCode.Reporting</Name> |
||||
</ProjectReference> |
||||
</ItemGroup> |
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
||||
</Project> |
@ -0,0 +1,181 @@
@@ -0,0 +1,181 @@
|
||||
<AddIn name="New SharpDevelop-Reporting" |
||||
author="Forstmeier Peter" |
||||
url="http://www.sharpdevelopreports.net/" |
||||
description="Reporting Tool For SharpDevelop" |
||||
addInManagerHidden="preinstalled"> |
||||
|
||||
<Manifest> |
||||
<Identity name="ICSharpCode.Reporting.Addin" /> |
||||
<Dependency addin="SharpDevelop" /> |
||||
<Dependency addin="ICSharpCode.Data.Addin" requirePreload="true" /> |
||||
</Manifest> |
||||
|
||||
<Runtime> |
||||
<Import assembly="ICSharpCode.Reporting.dll" /> |
||||
<Import assembly="ICSharpCode.Reporting.Addin.dll"> |
||||
<Doozer name="ReportDialogPanel" class="ICSharpCode.Reports.Addin.ReportWizard.DialogPanelDoozer" /> |
||||
</Import> |
||||
</Runtime> |
||||
|
||||
<!-- DisplayBinding --> |
||||
<Path name="/SharpDevelop/Workbench/DisplayBindings"> |
||||
<DisplayBinding id="SharpDevelopReportsBinding" |
||||
insertbefore="Text" |
||||
fileNamePattern="\.(srd)$" |
||||
languagePattern="^SharpDevelopReports$" |
||||
class="ICSharpCode.Reporting.Addin.DesignerBinding.ReportDesignerBinding" /> |
||||
</Path> |
||||
|
||||
<!-- label = "${res:SharpReport.ReportGenerator}"--> |
||||
<!--<Path name="/SharpDevelop/Workbench/Tools"> |
||||
<MenuItem id="ReportGeneratorPad" |
||||
label="New Reporting" |
||||
class="ICSharpCode.Reporting.Addin.DesignerBinding.ReportDesignerBinding" /> |
||||
</Path>--> |
||||
|
||||
|
||||
<!-- File Filter --> |
||||
<Path name="/SharpDevelop/Workbench/FileFilter"> |
||||
<FileFilter id="SharpDevelopReports" |
||||
insertbefore="AllFiles" |
||||
name="SharpDevelop Reports (*.srd)" |
||||
extensions="*.srd" |
||||
mimeType="text/xml" /> |
||||
</Path> |
||||
|
||||
<!-- ReportExplorer --> |
||||
<!--<Path name="/SharpDevelop/Workbench/Pads"> |
||||
<Pad id="reportexplorer" |
||||
category="Tools" |
||||
icon="Icons.16x16.SharpQuery.Refresh" |
||||
title="ReportExplorer" |
||||
class="ICSharpCode.Reports.Addin.ReportExplorerPad" |
||||
defaultPosition="Right, Hidden" /> |
||||
</Path>--> |
||||
|
||||
<!--<Path name = "/SharpDevelop/ReportDesigner/ContextMenus/ContainerMenu"> |
||||
<MenuItem id = "ViewCode" |
||||
label = "${res:SharpDevelop.FormsDesigner.ContextMenus.ViewCodeCommand}" |
||||
icon = "Icons.16x16.FormsDesigner.ViewCode" |
||||
class = "ICSharpCode.Reports.Addin.Commands.ViewCode"/> |
||||
|
||||
<MenuItem id = "ShowProperties" |
||||
label = "${res:XML.MainMenu.FormatMenu.ShowProperties}" |
||||
icon = "Icons.16x16.Property" |
||||
class = "ICSharpCode.Reports.Addin.Commands.ShowProperties"/> |
||||
|
||||
<MenuItem id = "PageMarginSeparator" type = "Separator"/> |
||||
|
||||
<MenuItem id = "PageMargin" |
||||
label = "PageMargin" |
||||
icon = "Icons.16x16.Property" |
||||
class = "ICSharpCode.Reports.Addin.Commands.TogglePageMargin"/> |
||||
|
||||
<MenuItem id = "DesignerSeparator" type = "Separator"/> |
||||
|
||||
<MenuItem id = "Paste" |
||||
label = "${res:XML.MainMenu.EditMenu.Paste}" |
||||
icon = "Icons.16x16.PasteIcon" |
||||
command = "Paste"/> |
||||
|
||||
<MenuItem id = "DesignerVerbsSeparator" type = "Separator"/> |
||||
|
||||
<MenuItem id = "DesignerVerbsBuilder" |
||||
type = "Builder" |
||||
class = "ICSharpCode.Reports.Addin.Commands.DesignerVerbSubmenuBuilder" /> |
||||
</Path>--> |
||||
|
||||
|
||||
<!--<Path name = "/SharpDevelop/ReportDesigner/ContextMenus/TraySelectionMenu"> |
||||
<MenuItem id = "ViewCode" |
||||
label = "${res:SharpDevelop.FormsDesigner.ContextMenus.ViewCodeCommand}" |
||||
icon = "Icons.16x16.FormsDesigner.ViewCode" |
||||
class = "ICSharpCode.Reports.Addin.Commands.ViewCode"/> |
||||
|
||||
<MenuItem id = "ShowProperties" |
||||
label = "${res:XML.MainMenu.FormatMenu.ShowProperties}" |
||||
icon = "Icons.16x16.Property" |
||||
class = "ICSharpCode.Reports.Addin.Commands.ShowProperties"/> |
||||
|
||||
|
||||
<MenuItem id = "DesignerVerbsSeparator" type = "Separator"/> |
||||
|
||||
<MenuItem id = "DesignerVerbsBuilder" |
||||
type = "Builder" |
||||
class = "ICSharpCode.Reports.Addin.Commands.DesignerVerbSubmenuBuilder" /> |
||||
</Path>--> |
||||
|
||||
|
||||
<!--<Path name="/SharpDevelop/ReportDesigner/ContextMenus/SelectionMenu"> |
||||
<MenuItem id="ViewCode" label="${res:SharpDevelop.FormsDesigner.ContextMenus.ViewCodeCommand}" icon="Icons.16x16.FormsDesigner.ViewCode" class="ICSharpCode.Reports.Addin.Commands.ViewCode" /> |
||||
<MenuItem id="ShowProperties" label="${res:XML.MainMenu.FormatMenu.ShowProperties}" icon="Icons.16x16.Property" class="ICSharpCode.Reports.Addin.Commands.ShowProperties" /> |
||||
<MenuItem id="PropertySeparator" type="Separator" /> |
||||
<MenuItem id="Cut" label="${res:XML.MainMenu.EditMenu.Cut}" icon="Icons.16x16.CutIcon" command="Cut" /> |
||||
<MenuItem id="Copy" label="${res:XML.MainMenu.EditMenu.Copy}" icon="Icons.16x16.CopyIcon" command="Copy" /> |
||||
<MenuItem id="Paste" label="${res:XML.MainMenu.EditMenu.Paste}" icon="Icons.16x16.PasteIcon" command="Paste" /> |
||||
<MenuItem id="Delete" label="${res:XML.MainMenu.EditMenu.Delete}" icon="Icons.16x16.DeleteIcon" command="Delete" /> |
||||
<MenuItem id="DesignerVerbsSeparator" type="Separator" /> |
||||
<MenuItem id="DesignerVerbsBuilder" type="Builder" class="ICSharpCode.Reports.Addin.Commands.DesignerVerbSubmenuBuilder" /> |
||||
</Path>--> |
||||
|
||||
|
||||
<!-- ReportExplorer ContextMenu's --> |
||||
<!--<Path name="/SharpDevelopReports/ContextMenu/FieldsExplorer/SectionTreeNode"> |
||||
<MenuItem id="removenodes" label="${res:SharpReport.FieldsExplorer.ContextMenu.Section.Clear}" class="ICSharpCode.Reports.Addin.Commands.ClearSelectedNodeCommand" /> |
||||
</Path>--> |
||||
|
||||
<!-- Sorting --> |
||||
<!--<Path name="/SharpDevelopReports/ContextMenu/FieldsExplorer/ColumnSortTreeNode"> |
||||
<MenuItem id="toggle" label="${res:SharpReport.FieldsExplorer.ContextMenu.Columns.ToggleSort}" class="ICSharpCode.Reports.Addin.Commands.ToggleOrderCommand" /> |
||||
|
||||
<MenuItem id="removesortnode" label="${res:SharpReport.FieldsExplorer.ContextMenu.Columns.Remove}" class="ICSharpCode.Reports.Addin.Commands.RemoveSortNodeCommand" /> |
||||
</Path>--> |
||||
|
||||
<!-- Grouping --> |
||||
|
||||
<!--<Path name = "/SharpDevelopReports/ContextMenu/FieldsExplorer/ColumnGroupTreeNode"> |
||||
<MenuItem id="toggle" |
||||
label="${res:SharpReport.FieldsExplorer.ContextMenu.Columns.ToggleSort}" |
||||
class="ICSharpCode.Reports.Addin.Commands.ToggleOrderCommand"/> |
||||
|
||||
<MenuItem id="removegroupnode" |
||||
label="${res:SharpReport.FieldsExplorer.ContextMenu.Columns.Remove}" |
||||
class="ICSharpCode.Reports.Addin.Commands.RemoveGroupNodeCommand"/> |
||||
</Path>--> |
||||
|
||||
<!-- Run Expression Editor --> |
||||
<!--<Path name = "/SharpDevelopReports/ContextMenu/FieldsExplorer/ParameterNode"> |
||||
<MenuItem id="params" |
||||
label="${res:SharpReport.FieldsExplorer.Parameters}" |
||||
class="ICSharpCode.Reports.Addin.Commands.ParameterEditorCommand"/> |
||||
</Path>--> |
||||
|
||||
<!-- Start SharpDevelop Reports from MainMenu --> |
||||
<!--<Path name = "/SharpDevelop/Workbench/Tools"> |
||||
<MenuItem id = "ReportGeneratorPad" |
||||
label = "${res:SharpReport.ReportGenerator}" |
||||
|
||||
class = "ICSharpCode.Reports.Addin.Commands.StartViewCommand"/> |
||||
</Path>--> |
||||
|
||||
<!-- Report wizard --> |
||||
<!-- <Path name="/ReportGenerator/ReportGeneratorWizard"> |
||||
<ReportDialogPanel id="Base" label="${res:SharpReport.Wizard.BaseSettings}" class="ICSharpCode.Reports.Addin.ReportWizard.BaseSettingsPanel" /> |
||||
<ReportDialogPanel id="PushModel" label="${res:SharpReport.Wizard.PushModel}" class="ICSharpCode.Reports.Addin.ReportWizard.PushModelPanel" /> |
||||
<ReportDialogPanel id="PullModel" label="${res:SharpReport.Wizard.PullModel}" class="ICSharpCode.Reports.Addin.ReportWizard.PullModelPanel" /> |
||||
<ReportDialogPanel id="QueryResult" label="${res:SharpReport.Wizard.ShowQueryResult}" class="ICSharpCode.Reports.Addin.ReportWizard.ResultPanel" /> |
||||
<ReportDialogPanel id="Layout" label="Layout" class="ICSharpCode.Reports.Addin.ReportWizard.LayoutPanel" /> |
||||
</Path>--> |
||||
|
||||
<!-- ContextMenu Sections --> |
||||
<!-- Save Data from Resultpanel as *xsd File --> |
||||
<!-- <Path name ="/ReportGenerator/ResultPanel/ContextMenuDefault"> |
||||
<MenuItem id="xsdcomplete" label="${res:SharpReport.Wizard.ResultPanel.SaveXsdComplete}" class="ICSharpCode.Reports.Addin.ReportWizard.XsdSchemaAndDataCommand"/> |
||||
<MenuItem id="xsdschema" label="${res:SharpReport.Wizard.ResultPanel.SaveXsdSchemaOnly}" class="ICSharpCode.Reports.Addin.ReportWizard.XsdSchemaOnlyCommand"/> |
||||
</Path>--> |
||||
|
||||
<!-- Tell SharpDevelop to look for the file template (EmptyReport.xft) in the AddIn directory --> |
||||
<Path name="/SharpDevelop/BackendBindings/Templates"> |
||||
<TemplateFile id="ICSharpCode.Reporting" path="." /> |
||||
</Path> |
||||
</AddIn> |
@ -0,0 +1,40 @@
@@ -0,0 +1,40 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
namespace ICSharpCode.Reporting |
||||
{ |
||||
/// <summary>
|
||||
/// Description of BasicParameter.
|
||||
/// </summary>
|
||||
public class BasicParameter |
||||
{ |
||||
public BasicParameter (){ |
||||
} |
||||
|
||||
public BasicParameter(string parameterName,string parameterValue){ |
||||
this.ParameterName = parameterName; |
||||
this.ParameterValue = parameterValue; |
||||
} |
||||
|
||||
public string ParameterName {get;set;} |
||||
|
||||
public string Type {get;set;} |
||||
|
||||
public string ParameterValue {get;set;} |
||||
} |
||||
} |
@ -0,0 +1,110 @@
@@ -0,0 +1,110 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Windows; |
||||
using System.Windows.Media; |
||||
namespace ICSharpCode.Reporting.BaseClasses |
||||
{ |
||||
/// <summary>
|
||||
/// Description of ExtensionMethodes.
|
||||
/// Copy from D:\git_Sharpdevelop_Reporting\src\AddIns\Misc\Reports\ICSharpCode.Reports.Core\Project\WPF\ExtensionMethodes.cs
|
||||
/// </summary>
|
||||
/// <see cref="D:\git_Sharpdevelop_Reporting\src\AddIns\Misc\Reports\ICSharpCode.Reports.Core\Project\WPF\ExtensionMethodes.cs"
|
||||
|
||||
internal static class ExtensionMethodes |
||||
{ |
||||
#region Collections
|
||||
|
||||
public static void ForEach<T>(this IEnumerable<T> input, Action<T> action) |
||||
{ |
||||
if (input == null) |
||||
throw new ArgumentNullException("input"); |
||||
foreach (T element in input) { |
||||
action(element); |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region system.drawing -> Wpf
|
||||
|
||||
public static Point ToWpf(this System.Drawing.Point p) |
||||
{ |
||||
return new Point(p.X, p.Y); |
||||
} |
||||
|
||||
public static Size ToWpf(this System.Drawing.Size s) |
||||
{ |
||||
return new Size(s.Width, s.Height); |
||||
} |
||||
|
||||
public static Rect ToWpf(this System.Drawing.Rectangle rect) |
||||
{ |
||||
return new Rect(rect.Location.ToWpf(), rect.Size.ToWpf()); |
||||
} |
||||
|
||||
public static System.Windows.Media.Color ToWpf(this System.Drawing.Color c) |
||||
{ |
||||
return System.Windows.Media.Color.FromArgb(c.A, c.R, c.G, c.B); |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region DPI independence
|
||||
public static Rect TransformToDevice(this Rect rect, Visual visual) |
||||
{ |
||||
Matrix matrix = PresentationSource.FromVisual(visual).CompositionTarget.TransformToDevice; |
||||
return Rect.Transform(rect, matrix); |
||||
} |
||||
|
||||
public static Rect TransformFromDevice(this Rect rect, Visual visual) |
||||
{ |
||||
Matrix matrix = PresentationSource.FromVisual(visual).CompositionTarget.TransformFromDevice; |
||||
return Rect.Transform(rect, matrix); |
||||
} |
||||
|
||||
public static Size TransformToDevice(this Size size, Visual visual) |
||||
{ |
||||
Matrix matrix = PresentationSource.FromVisual(visual).CompositionTarget.TransformToDevice; |
||||
return new Size(size.Width * matrix.M11, size.Height * matrix.M22); |
||||
} |
||||
|
||||
public static Size TransformFromDevice(this Size size, Visual visual) |
||||
{ |
||||
Matrix matrix = PresentationSource.FromVisual(visual).CompositionTarget.TransformFromDevice; |
||||
return new Size(size.Width * matrix.M11, size.Height * matrix.M22); |
||||
} |
||||
|
||||
public static Point TransformToDevice(this Point point, Visual visual) |
||||
{ |
||||
Matrix matrix = PresentationSource.FromVisual(visual).CompositionTarget.TransformToDevice; |
||||
return new Point(point.X * matrix.M11, point.Y * matrix.M22); |
||||
} |
||||
|
||||
public static Point TransformFromDevice(this Point point, Visual visual) |
||||
{ |
||||
Matrix matrix = PresentationSource.FromVisual(visual).CompositionTarget.TransformFromDevice; |
||||
return new Point(point.X * matrix.M11, point.Y * matrix.M22); |
||||
} |
||||
#endregion
|
||||
|
||||
|
||||
} |
||||
} |
@ -1,135 +0,0 @@
@@ -1,135 +0,0 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
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,233 @@
@@ -0,0 +1,233 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using System.Collections; |
||||
using System.Collections.Generic; |
||||
using System.Collections.ObjectModel; |
||||
using System.ComponentModel; |
||||
using System.Linq; |
||||
|
||||
using ICSharpCode.Reporting.BaseClasses; |
||||
using ICSharpCode.Reporting.DataSource; |
||||
using ICSharpCode.Reporting.Interfaces; |
||||
using ICSharpCode.Reporting.Interfaces.Data; |
||||
using ICSharpCode.Reporting.Items; |
||||
|
||||
namespace ICSharpCode.Reporting.DataManager.Listhandling |
||||
{ |
||||
/// <summary>
|
||||
/// Description of DataSource.
|
||||
/// </summary>
|
||||
public enum OrderGroup { |
||||
AsIs, |
||||
Sorted, |
||||
Grouped |
||||
} |
||||
|
||||
public class CollectionDataSource:IDataSource |
||||
{ |
||||
readonly DataCollection<object> baseList; |
||||
readonly ReportSettings reportSettings; |
||||
// readonly Type elementType;
|
||||
readonly PropertyDescriptorCollection listProperties; |
||||
|
||||
|
||||
public CollectionDataSource(IEnumerable list, ReportSettings reportSettings) |
||||
{ |
||||
if (list == null) |
||||
throw new ArgumentNullException("list"); |
||||
if (reportSettings == null) |
||||
throw new ArgumentNullException("reportSettings"); |
||||
baseList = CreateBaseList(list); |
||||
CurrentList = baseList; |
||||
|
||||
this.reportSettings = reportSettings; |
||||
this.listProperties = this.baseList.GetItemProperties(null); |
||||
OrderGroup = OrderGroup.AsIs; |
||||
} |
||||
|
||||
|
||||
[Obsolete("use public CollectionDataSource(IEnumerable list, ReportSettings reportSettings")] |
||||
public CollectionDataSource(IEnumerable list, Type elementType, ReportSettings reportSettings) |
||||
{ |
||||
if (list == null) |
||||
throw new ArgumentNullException("list"); |
||||
if (reportSettings == null) |
||||
throw new ArgumentNullException("reportSettings"); |
||||
|
||||
baseList = CreateBaseList(list); |
||||
CurrentList = baseList; |
||||
this.reportSettings = reportSettings; |
||||
this.listProperties = this.baseList.GetItemProperties(null); |
||||
OrderGroup = OrderGroup.AsIs; |
||||
} |
||||
|
||||
|
||||
|
||||
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 IList <object> CurrentList {get;private set;} |
||||
|
||||
|
||||
public int Count { |
||||
get {return baseList.Count;} |
||||
} |
||||
|
||||
public object Current {get; private set;} |
||||
|
||||
public OrderGroup OrderGroup {get; private set;} |
||||
|
||||
public IEnumerable<object> SortedList {get; private set;} |
||||
|
||||
public IEnumerable<IGrouping<object, object>> GroupedList {get;private set;} |
||||
|
||||
#region Sort
|
||||
|
||||
void Sort() |
||||
{ |
||||
if (reportSettings.SortColumnsCollection.Count > 0) { |
||||
SortedList = SortInternal(); |
||||
OrderGroup = OrderGroup.Sorted; |
||||
} else { |
||||
OrderGroup = OrderGroup.AsIs; |
||||
SortedList = CurrentList; |
||||
} |
||||
|
||||
} |
||||
|
||||
|
||||
IEnumerable<object> SortInternal (){ |
||||
IEnumerable<object> sortedList = null; |
||||
var sortProperty = listProperties.Find(reportSettings.SortColumnsCollection[0].ColumnName,true); |
||||
if(reportSettings.SortColumnsCollection.Count == 1) { |
||||
sortedList = baseList.OrderBy(o => o.GetType().GetProperty(sortProperty.Name).GetValue(o, null) ); |
||||
} |
||||
return sortedList; |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Grouping
|
||||
|
||||
void Group() |
||||
{ |
||||
OrderGroup = OrderGroup.Grouped; |
||||
GroupedList = GroupInternal(); |
||||
} |
||||
|
||||
|
||||
IEnumerable<IGrouping<object, object>> GroupInternal () { |
||||
PropertyDescriptor sortProperty = null; |
||||
var groupProperty = listProperties.Find(reportSettings.GroupColumnsCollection[0].ColumnName,true); |
||||
var groupColumn = (GroupColumn)reportSettings.GroupColumnsCollection[0]; |
||||
|
||||
if (groupColumn.GroupSortColumn != null) { |
||||
sortProperty = listProperties.Find(groupColumn.GroupSortColumn.ColumnName,true); |
||||
} |
||||
IEnumerable<IGrouping<object, object>> groupedList; |
||||
if (sortProperty == null) { |
||||
groupedList = baseList.GroupBy(a => a.GetType().GetProperty(groupProperty.Name).GetValue(a, null)).OrderBy(c => c.Key); |
||||
} else { |
||||
groupedList = baseList.OrderBy(o => o.GetType().GetProperty(sortProperty.Name).GetValue(o, null) ) |
||||
.GroupBy(a => a.GetType().GetProperty(groupProperty.Name).GetValue(a, null)).OrderBy(c => c.Key); |
||||
} |
||||
return groupedList; |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
public void Bind() |
||||
{ |
||||
if (reportSettings.GroupColumnsCollection.Any()) { |
||||
Group(); |
||||
} else { |
||||
Sort(); |
||||
} |
||||
} |
||||
|
||||
|
||||
#region Fill
|
||||
|
||||
public void Fill (List<IPrintableObject> collection, object current) { |
||||
Current = current; |
||||
foreach (var element in collection) { |
||||
var container = element as ReportContainer; |
||||
if (container != null) { |
||||
FillFromList(container.Items); |
||||
} else { |
||||
FillInternal(element); |
||||
} |
||||
} |
||||
} |
||||
|
||||
void FillFromList(List<IPrintableObject> collection) |
||||
{ |
||||
foreach (IPrintableObject item in collection) { |
||||
FillInternal(item); |
||||
} |
||||
} |
||||
|
||||
|
||||
void FillInternal(IPrintableObject item) |
||||
{ |
||||
var dbItem = item as IDataItem; |
||||
if (dbItem != null) { |
||||
dbItem.DBValue = String.Empty; |
||||
dbItem.DBValue = ReadValueFromProperty(dbItem.ColumnName); |
||||
if (String.IsNullOrEmpty(dbItem.DataType)) { |
||||
dbItem.DataType = SetTypeFromProperty(dbItem.ColumnName).ToString(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
string ReadValueFromProperty (string columnName) { |
||||
var propertyPath = Current.ParsePropertyPath(columnName); |
||||
var val = propertyPath.Evaluate(Current); |
||||
return val.ToString(); |
||||
} |
||||
|
||||
|
||||
Type SetTypeFromProperty (string columnName) { |
||||
var p = listProperties.Find(columnName,true); |
||||
return p.PropertyType; |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
|
||||
static DataCollection<object> CreateBaseList(IEnumerable source) |
||||
{ |
||||
Type elementType = source.AsQueryable().ElementType; |
||||
var list = new DataCollection<object>(elementType); |
||||
list.AddRange(source); |
||||
return list; |
||||
} |
||||
} |
||||
} |
@ -1,416 +0,0 @@
@@ -1,416 +0,0 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
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,51 @@
@@ -0,0 +1,51 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using System.Reflection; |
||||
|
||||
namespace ICSharpCode.Reporting.DataSource |
||||
{ |
||||
/// <summary>
|
||||
/// Description of FieldMemberAccessor.
|
||||
/// </summary>
|
||||
public class FieldMemberAccessor : IMemberAccessor |
||||
{ |
||||
private readonly FieldInfo _field; |
||||
|
||||
public FieldMemberAccessor(FieldInfo field) |
||||
{ |
||||
_field = field; |
||||
} |
||||
|
||||
public object GetValue(object target) |
||||
{ |
||||
return _field.GetValue(target); |
||||
} |
||||
|
||||
public bool IsStatic |
||||
{ |
||||
get { return _field.IsStatic; } |
||||
} |
||||
|
||||
public Type MemberType |
||||
{ |
||||
get { return _field.FieldType;} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,58 @@
@@ -0,0 +1,58 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using System.Reflection; |
||||
|
||||
namespace ICSharpCode.Reporting.DataSource |
||||
{ |
||||
/// <summary>
|
||||
/// Description of PropertyMemberAccessore.
|
||||
/// </summary>
|
||||
public interface IMemberAccessor |
||||
{ |
||||
object GetValue(object target); |
||||
bool IsStatic { get; } |
||||
Type MemberType { get; } |
||||
} |
||||
|
||||
public class PropertyMemberAccessor : IMemberAccessor |
||||
{ |
||||
private readonly PropertyInfo _prop; |
||||
|
||||
public PropertyMemberAccessor(PropertyInfo prop) |
||||
{ |
||||
_prop = prop; |
||||
} |
||||
|
||||
public object GetValue(object target) |
||||
{ |
||||
return _prop.GetValue(target, null); |
||||
} |
||||
|
||||
public bool IsStatic |
||||
{ |
||||
get { return _prop.GetGetMethod().IsStatic; } |
||||
} |
||||
|
||||
public Type MemberType |
||||
{ |
||||
get { return _prop.PropertyType;} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,104 @@
@@ -0,0 +1,104 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using System.Text; |
||||
|
||||
namespace ICSharpCode.Reporting.DataSource |
||||
{ |
||||
public class PropertyPath |
||||
{ |
||||
private readonly Type _rootType; |
||||
private readonly IMemberAccessor[] _properties; |
||||
private readonly bool _rootIsStatic; |
||||
|
||||
private PropertyPath(Type rootType,IMemberAccessor[] props) |
||||
{ |
||||
_properties = props; |
||||
_rootType = rootType; |
||||
|
||||
if (_properties[0].IsStatic) |
||||
_rootIsStatic = true; |
||||
} |
||||
|
||||
public object Evaluate(object target) |
||||
{ |
||||
if (target == null && _rootIsStatic == false) |
||||
return null; |
||||
|
||||
// Type s = target.GetType();
|
||||
|
||||
if (target != null && _rootType.IsAssignableFrom(target.GetType()) == false) |
||||
return null; |
||||
|
||||
|
||||
object current = target; |
||||
foreach (IMemberAccessor prop in _properties) |
||||
{ |
||||
current = prop.GetValue(current); |
||||
if (current == null) |
||||
return null; |
||||
} |
||||
return current; |
||||
} |
||||
|
||||
public static PropertyPath Parse(Type targetType,string propPath) |
||||
{ |
||||
if (String.IsNullOrEmpty(propPath)) |
||||
return null; |
||||
|
||||
string[] parts = propPath.Split('.'); |
||||
return Compile(targetType, parts); |
||||
|
||||
} |
||||
|
||||
public static PropertyPath Compile(Type targetType,string[] pathParts) |
||||
{ |
||||
var accessors = new IMemberAccessor[pathParts.Length]; |
||||
|
||||
Type currentType = targetType; |
||||
for (int i = 0; i < pathParts.Length; i++) |
||||
{ |
||||
string part = pathParts[i]; |
||||
|
||||
IMemberAccessor accessor = currentType.FindAccessor(part); |
||||
if (accessor == null) |
||||
return null; |
||||
|
||||
|
||||
accessors[i] = accessor; |
||||
currentType = accessor.MemberType; |
||||
} |
||||
|
||||
return new PropertyPath(targetType, accessors); |
||||
} |
||||
|
||||
public static string GetCacheKey(Type targetType,string[] name) |
||||
{ |
||||
var key = new StringBuilder(); |
||||
key.Append(targetType.FullName); |
||||
foreach (string namePart in name) |
||||
key.Append(namePart); |
||||
return key.ToString(); |
||||
} |
||||
|
||||
|
||||
|
||||
} |
||||
|
||||
} |
@ -0,0 +1,69 @@
@@ -0,0 +1,69 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using System.Reflection; |
||||
|
||||
|
||||
namespace ICSharpCode.Reporting.DataSource |
||||
{ |
||||
/// <summary>
|
||||
/// Description of ReflectionExtension.
|
||||
/// </summary>
|
||||
///
|
||||
|
||||
|
||||
|
||||
public static class ReflectionExtensions |
||||
{ |
||||
public static PropertyPath ParsePropertyPath(this object target,string propertyPath) |
||||
{ |
||||
if (target == null || String.IsNullOrEmpty(propertyPath)) |
||||
return null; |
||||
|
||||
return PropertyPath.Parse(target.GetType(), propertyPath); |
||||
} |
||||
|
||||
|
||||
public static object EvaluatePropertyPath(this object target,string propertyPath) |
||||
{ |
||||
PropertyPath path = ParsePropertyPath(target, propertyPath); |
||||
if (path != null) |
||||
return path.Evaluate(target); |
||||
return null; |
||||
} |
||||
|
||||
|
||||
public static IMemberAccessor FindAccessor(this Type type, string accessorName) |
||||
{ |
||||
PropertyInfo prop = type.GetProperty(accessorName, |
||||
BindingFlags.IgnoreCase | BindingFlags.NonPublic | |
||||
BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance); |
||||
if (prop != null) |
||||
return new PropertyMemberAccessor(prop); |
||||
|
||||
FieldInfo field = type.GetField(accessorName, |
||||
BindingFlags.IgnoreCase | BindingFlags.NonPublic | |
||||
BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance); |
||||
if (field != null) |
||||
return new FieldMemberAccessor(field); |
||||
|
||||
return null; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,30 @@
@@ -0,0 +1,30 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: Peter Forstmeier |
||||
* Date: 05.02.2014 |
||||
* Time: 20:33 |
||||
* |
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||
*/ |
||||
using System; |
||||
using ICSharpCode.Reporting.Interfaces; |
||||
|
||||
namespace ICSharpCode.Reporting |
||||
{ |
||||
/// <summary>
|
||||
/// Description of SectionEvent.
|
||||
/// </summary>
|
||||
public class SectionEventArgs : EventArgs |
||||
{ |
||||
|
||||
|
||||
public SectionEventArgs(IReportContainer section){ |
||||
if (section == null) |
||||
throw new ArgumentNullException("section"); |
||||
Section = section; |
||||
} |
||||
|
||||
public IReportContainer Section {get;private set;} |
||||
|
||||
} |
||||
} |
@ -1,186 +0,0 @@
@@ -1,186 +0,0 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
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,94 @@
@@ -0,0 +1,94 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Globalization; |
||||
using ICSharpCode.Reporting.Expressions; |
||||
using ICSharpCode.Reporting.Expressions.Irony; |
||||
using ICSharpCode.Reporting.Expressions.Irony.Ast; |
||||
using ICSharpCode.Reporting.Items; |
||||
using ICSharpCode.Reporting.PageBuilder.ExportColumns; |
||||
|
||||
namespace ICSharpCode.Reporting.Exporter.Visitors |
||||
{ |
||||
/// <summary>
|
||||
/// Description of ExpressionVisitor.
|
||||
/// </summary>
|
||||
class ExpressionVisitor: AbstractVisitor |
||||
{ |
||||
readonly ReportingLanguageGrammer grammar; |
||||
readonly ReportingExpressionEvaluator evaluator; |
||||
|
||||
public ExpressionVisitor(ReportSettings reportSettings) { |
||||
grammar = new ReportingLanguageGrammer(); |
||||
evaluator = new ReportingExpressionEvaluator(grammar); |
||||
evaluator.AddReportSettings(reportSettings); |
||||
} |
||||
|
||||
|
||||
public void SetCurrentDataSource (IEnumerable<object> dataSource) { |
||||
evaluator.SetCurrentDataSource(dataSource); |
||||
} |
||||
|
||||
|
||||
public override void Visit(ExportPage page) |
||||
{ |
||||
evaluator.AddPageInfo(page.PageInfo); |
||||
base.Visit(page); |
||||
} |
||||
|
||||
|
||||
public override void Visit(ExportContainer exportContainer) |
||||
{ |
||||
evaluator.AddCurrentContainer(exportContainer); |
||||
base.Visit(exportContainer); |
||||
} |
||||
|
||||
|
||||
public override void Visit(ExportText exportColumn) |
||||
{ |
||||
if (ExpressionHelper.CanEvaluate(exportColumn.Text)) { |
||||
try { |
||||
object result = Evaluate(exportColumn); |
||||
exportColumn.Text = result.ToString(); |
||||
} catch (Exception e) { |
||||
var s = String.Format(CultureInfo.CurrentCulture,"SharpReport.Expressions -> {0} for {1}",e.Message,exportColumn.Text); |
||||
Console.WriteLine(s); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public override void Visit(ExportLine exportGraphics) |
||||
{ |
||||
// base.Visit(exportGraphics);
|
||||
} |
||||
|
||||
object Evaluate(ExportText exportColumn) |
||||
{ |
||||
var str = ExpressionHelper.ExtractExpressionPart(exportColumn.Text); |
||||
var result = evaluator.Evaluate(str); |
||||
return result; |
||||
} |
||||
|
||||
public ReportingExpressionEvaluator Evaluator { |
||||
get { return evaluator; } |
||||
} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,51 @@
@@ -0,0 +1,51 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using System.Collections.ObjectModel; |
||||
using ICSharpCode.Reporting.Globals; |
||||
using ICSharpCode.Reporting.PageBuilder.ExportColumns; |
||||
|
||||
namespace ICSharpCode.Reporting.Exporter.Visitors |
||||
{ |
||||
/// <summary>
|
||||
/// Description of FormatVisitor.
|
||||
/// </summary>
|
||||
class FormatVisitor: AbstractVisitor |
||||
{ |
||||
|
||||
|
||||
public override void Visit(ExportContainer exportContainer) |
||||
{ |
||||
foreach (var element in exportContainer.ExportedItems) { |
||||
var te = element as ExportText; |
||||
if (te != null) { |
||||
Visit(te); |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
public override void Visit(ExportText exportColumn) |
||||
{ |
||||
if (!String.IsNullOrEmpty(exportColumn.FormatString)) { |
||||
StandardFormatter.FormatOutput(exportColumn); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,73 +0,0 @@
@@ -1,73 +0,0 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
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;} |
||||
|
||||
} |
||||
} |
@ -1,113 +0,0 @@
@@ -1,113 +0,0 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
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,52 @@
@@ -0,0 +1,52 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using System.Globalization; |
||||
using ICSharpCode.Reporting.Globals; |
||||
using Irony.Interpreter.Ast; |
||||
|
||||
namespace ICSharpCode.Reporting.Expressions |
||||
{ |
||||
/// <summary>
|
||||
/// Description of ExpressionHelper.
|
||||
/// </summary>
|
||||
class ExpressionHelper |
||||
{ |
||||
|
||||
public static string ExtractExpressionPart (string src) |
||||
{ |
||||
char v = Convert.ToChar("=",CultureInfo.CurrentCulture ); |
||||
return StringHelper.RightOf(src,v).Trim(); |
||||
} |
||||
|
||||
|
||||
public static bool CanEvaluate (string expression) |
||||
{ |
||||
if ((!String.IsNullOrEmpty(expression)) && (expression.StartsWith("=",StringComparison.OrdinalIgnoreCase))) { |
||||
return true; |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
|
||||
public static string ComposeAstNodeError (string branch,AstNode node) { |
||||
return String.Format (CultureInfo.CurrentCulture,"Missing {0} <{1}>",branch,node.AsString); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,65 @@
@@ -0,0 +1,65 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System.Collections.ObjectModel; |
||||
using ICSharpCode.Reporting.DataManager.Listhandling; |
||||
using ICSharpCode.Reporting.Exporter.Visitors; |
||||
using ICSharpCode.Reporting.Items; |
||||
using ICSharpCode.Reporting.PageBuilder.ExportColumns; |
||||
|
||||
namespace ICSharpCode.Reporting.Expressions |
||||
{ |
||||
/// <summary>
|
||||
/// Description of ExpressionRunner.
|
||||
/// </summary>
|
||||
class ExpressionRunner |
||||
{ |
||||
|
||||
// http://www.killswtch.net/2013/08/01/time-arithmetic-with-irony/
|
||||
// http://blog.miraclespain.com/archive/2009/Oct-07.html
|
||||
//
|
||||
readonly Collection<ExportPage> pages; |
||||
readonly ReportSettings reportSettings; |
||||
readonly CollectionDataSource dataSource; |
||||
|
||||
public ExpressionRunner(Collection<ExportPage> pages,ReportSettings reportSettings,CollectionDataSource dataSource) |
||||
{ |
||||
this.pages = pages; |
||||
this.dataSource = dataSource; |
||||
this.reportSettings = reportSettings; |
||||
Visitor = new ExpressionVisitor(reportSettings); |
||||
} |
||||
|
||||
|
||||
public void Run() |
||||
{ |
||||
// Visitor = new ExpressionVisitor (reportSettings);
|
||||
if (dataSource != null) { |
||||
if (dataSource.SortedList != null) { |
||||
Visitor.SetCurrentDataSource(dataSource.SortedList); |
||||
} |
||||
if (dataSource.GroupedList != null) { |
||||
Visitor.SetCurrentDataSource(dataSource.GroupedList); |
||||
} |
||||
} |
||||
Visitor.Run(pages); |
||||
} |
||||
|
||||
public ExpressionVisitor Visitor {get; private set;} |
||||
} |
||||
} |
@ -0,0 +1,102 @@
@@ -0,0 +1,102 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using ICSharpCode.Reporting.DataManager.Listhandling; |
||||
using ICSharpCode.Reporting.Interfaces.Export; |
||||
using ICSharpCode.Reporting.Items; |
||||
using ICSharpCode.Reporting.PageBuilder.ExportColumns; |
||||
using Irony.Interpreter; |
||||
|
||||
namespace ICSharpCode.Reporting.Expressions.Irony.Ast |
||||
{ |
||||
/// <summary>
|
||||
/// Description of AstExtensions.
|
||||
/// </summary>
|
||||
public static class AstExtensions |
||||
{ |
||||
#region Globals
|
||||
public static void AddPageInfo (this ReportingExpressionEvaluator app,IPageInfo pageInfo) { |
||||
if (pageInfo == null) |
||||
throw new ArgumentNullException("pageInfo"); |
||||
|
||||
if (!app.Globals.ContainsKey("PageInfo")) { |
||||
app.Globals.Add("PageInfo",pageInfo); |
||||
} else { |
||||
app.Globals["PageInfo"] = pageInfo; |
||||
} |
||||
} |
||||
|
||||
|
||||
public static IPageInfo GetPageInfo (this ScriptThread thread){ |
||||
var pi = (IPageInfo)thread.App.Globals["PageInfo"]; |
||||
return pi; |
||||
} |
||||
#endregion
|
||||
|
||||
|
||||
#region Parameters
|
||||
|
||||
public static ParameterCollection GetParametersCollection (this ScriptThread thread){ |
||||
var rs = (ReportSettings)thread.App.Globals["ReportSettings"]; |
||||
return rs.ParameterCollection; |
||||
} |
||||
|
||||
|
||||
public static void AddReportSettings (this ReportingExpressionEvaluator app,ReportSettings reportSettings) { |
||||
if (reportSettings == null) |
||||
throw new ArgumentNullException("reportSettings"); |
||||
app.Globals.Add("ReportSettings",reportSettings); |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region current Container
|
||||
|
||||
public static void AddCurrentContainer (this ReportingExpressionEvaluator app,ExportContainer container){ |
||||
if (container == null) |
||||
throw new ArgumentNullException("container"); |
||||
if (!app.Globals.ContainsKey("CurrentContainer")) { |
||||
app.Globals.Add("CurrentContainer",container); |
||||
} else { |
||||
app.Globals["CurrentContainer"] = container; |
||||
} |
||||
} |
||||
|
||||
public static ExportContainer GetCurrentContainer (this ScriptThread thread){ |
||||
return (ExportContainer)thread.App.Globals["CurrentContainer"]; |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region DataSource
|
||||
|
||||
public static void SetCurrentDataSource (this ReportingExpressionEvaluator app,IEnumerable<object> dataSource){ |
||||
if (dataSource == null) |
||||
throw new ArgumentNullException("dataSource"); |
||||
if (!app.Globals.ContainsKey("DataSource")) { |
||||
app.Globals.Add("DataSource",dataSource); |
||||
} else { |
||||
app.Globals["DataSource"] = dataSource; |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
} |
||||
} |
@ -0,0 +1,54 @@
@@ -0,0 +1,54 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System.Linq; |
||||
using ICSharpCode.Reporting.PageBuilder.ExportColumns; |
||||
using Irony.Ast; |
||||
using Irony.Interpreter; |
||||
using Irony.Interpreter.Ast; |
||||
using Irony.Parsing; |
||||
|
||||
namespace ICSharpCode.Reporting.Expressions.Irony.Ast |
||||
{ |
||||
/// <summary>
|
||||
/// Description of FieldsNode.
|
||||
/// </summary>
|
||||
public class FieldsNode: AstNode |
||||
{ |
||||
AstNode fieldNode; |
||||
|
||||
public override void Init(AstContext context,ParseTreeNode treeNode) |
||||
{ |
||||
base.Init(context, treeNode); |
||||
var nodes = treeNode.GetMappedChildNodes(); |
||||
fieldNode = AddChild("Args", nodes[2]); |
||||
} |
||||
|
||||
|
||||
protected override object DoEvaluate(ScriptThread thread) |
||||
{ |
||||
thread.CurrentNode = this; //standard prolog
|
||||
var container = thread.GetCurrentContainer(); |
||||
var column = (ExportText)container.ExportedItems.Where(x => x.Name == fieldNode.AsString).FirstOrDefault(); |
||||
if (column == null) { |
||||
return ExpressionHelper.ComposeAstNodeError("Fields",fieldNode); |
||||
} |
||||
return column.Text; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,67 @@
@@ -0,0 +1,67 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using System.Linq; |
||||
using ICSharpCode.Reporting.PageBuilder.ExportColumns; |
||||
using Irony.Ast; |
||||
using Irony.Interpreter; |
||||
using Irony.Interpreter.Ast; |
||||
using Irony.Parsing; |
||||
|
||||
namespace ICSharpCode.Reporting.Expressions.Irony.Ast |
||||
{ |
||||
/// <summary>
|
||||
/// Description of GlobalsNode.
|
||||
/// </summary>
|
||||
public class GlobalsNode: AstNode |
||||
{ |
||||
AstNode globalNode; |
||||
|
||||
public override void Init(AstContext context, ParseTreeNode treeNode) |
||||
{ |
||||
base.Init(context, treeNode); |
||||
var nodes = treeNode.GetMappedChildNodes(); |
||||
globalNode = AddChild("Args", nodes[2]); |
||||
} |
||||
|
||||
|
||||
protected override object DoEvaluate(ScriptThread thread) |
||||
{ |
||||
thread.CurrentNode = this; //standard prolog
|
||||
var pi = thread.GetPageInfo(); |
||||
|
||||
var test = globalNode.AsString.ToLower(); |
||||
if ( test == "pagenumber") { |
||||
return pi.PageNumber; |
||||
} else if (test == "pages") { |
||||
return pi.TotalPages; |
||||
} else if (test == "reportname") { |
||||
return pi.ReportName; |
||||
} else if (test == "reportfolder") { |
||||
return pi.ReportFolder; |
||||
} else if (test == "reportfilename") { |
||||
return pi.ReportFileName; |
||||
} |
||||
|
||||
else { |
||||
return String.Format("Syntaxerror in Globals <{0}>",globalNode.AsString); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,53 @@
@@ -0,0 +1,53 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using Irony.Ast; |
||||
using Irony.Interpreter; |
||||
using Irony.Interpreter.Ast; |
||||
using Irony.Parsing; |
||||
using ICSharpCode.Reporting.BaseClasses; |
||||
|
||||
namespace ICSharpCode.Reporting.Expressions.Irony.Ast |
||||
{ |
||||
/// <summary>
|
||||
/// Description of ParametersCallNode.
|
||||
/// </summary>
|
||||
public class ParametersCallNode: AstNode |
||||
{ |
||||
AstNode parameterNode; |
||||
|
||||
public override void Init(AstContext context, ParseTreeNode treeNode) |
||||
{ |
||||
base.Init(context, treeNode); |
||||
var nodes = treeNode.GetMappedChildNodes(); |
||||
parameterNode = AddChild("Args", nodes[2]); |
||||
} |
||||
|
||||
|
||||
protected override object DoEvaluate(ScriptThread thread) |
||||
{ |
||||
BasicParameter result = null; |
||||
thread.CurrentNode = this; //standard prolog
|
||||
var parametersCollection = thread.GetParametersCollection(); |
||||
result = parametersCollection.Find(parameterNode.AsString); |
||||
if (result == null) |
||||
return ExpressionHelper.ComposeAstNodeError("Parameters",parameterNode); |
||||
return result.ParameterValue; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,73 @@
@@ -0,0 +1,73 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System.Collections.Generic; |
||||
using Irony.Interpreter; |
||||
using Irony.Parsing; |
||||
|
||||
namespace ICSharpCode.Reporting.Expressions.Irony |
||||
{ |
||||
/// <summary>
|
||||
/// Description of ReportingLanguageEvaluator.
|
||||
/// </summary>
|
||||
public class ReportingExpressionEvaluator |
||||
{ |
||||
public InterpretedLanguageGrammar Grammar {get; private set;} |
||||
public Parser Parser {get; private set;} |
||||
public LanguageData Language {get; private set;} |
||||
public LanguageRuntime Runtime {get; private set;} |
||||
public ScriptApp App {get; private set;} |
||||
|
||||
public IDictionary<string, object> Globals { |
||||
get { return App.Globals; } |
||||
} |
||||
|
||||
|
||||
//Default constructor, creates default evaluator
|
||||
public ReportingExpressionEvaluator(InterpretedLanguageGrammar grammar) { |
||||
Grammar = grammar; |
||||
Language = new LanguageData(Grammar); |
||||
Parser = new Parser(Language); |
||||
Runtime = Grammar.CreateRuntime(Language); |
||||
App = new ScriptApp(Runtime); |
||||
} |
||||
|
||||
public object Evaluate(string script) { |
||||
var result = App.Evaluate(script); |
||||
return result; |
||||
} |
||||
|
||||
public object Evaluate(ParseTree parsedScript) { |
||||
var result = App.Evaluate(parsedScript); |
||||
return result; |
||||
} |
||||
|
||||
//Evaluates again the previously parsed/evaluated script
|
||||
public object Evaluate() { |
||||
return App.Evaluate(); |
||||
} |
||||
/* |
||||
public void ClearOutput() { |
||||
App.ClearOutputBuffer(); |
||||
} |
||||
public string GetOutput() { |
||||
return App.GetOutput(); |
||||
} |
||||
*/ |
||||
} |
||||
} |
@ -0,0 +1,99 @@
@@ -0,0 +1,99 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
|
||||
using ICSharpCode.Reporting.DataSource; |
||||
using Irony.Interpreter; |
||||
using Irony.Interpreter.Ast; |
||||
|
||||
namespace ICSharpCode.Reporting.Expressions.Irony.Imports |
||||
{ |
||||
/// <summary>
|
||||
/// Description of ImportAggregates.
|
||||
/// </summary>
|
||||
public static class ImportExtensions |
||||
{ |
||||
public static IEnumerable<object> GetDataSource (this ScriptThread thread){ |
||||
return (IEnumerable<object>)thread.App.Globals["DataSource"]; |
||||
} |
||||
|
||||
|
||||
} |
||||
|
||||
static class ImportAggregateHelper { |
||||
|
||||
public static bool FieldExist (object current,string fieldName) { |
||||
var property1 = current.ParsePropertyPath(fieldName); |
||||
if (property1 == null) { |
||||
return false; |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
public static IEnumerable<IGrouping<object, object>> IsGrouped (IEnumerable<object> listToConvert) { |
||||
var grouped = listToConvert as IEnumerable<IGrouping<object, object>>; |
||||
if (grouped != null) { |
||||
return grouped; |
||||
} |
||||
return null; |
||||
} |
||||
} |
||||
|
||||
|
||||
public static class ImportAggregates |
||||
{ |
||||
public static object Sum(ScriptThread thread, AstNode[] childNodes) { |
||||
double sum = 0; |
||||
var fieldName = childNodes[0].Evaluate(thread).ToString(); |
||||
|
||||
var dataSource = thread.GetDataSource(); |
||||
|
||||
var grouped = ImportAggregateHelper.IsGrouped(dataSource); |
||||
|
||||
if (grouped != null) { |
||||
|
||||
foreach (var element in grouped) { |
||||
var s = element.Sum(o => { |
||||
var v = ReadValueFromObject(fieldName, o); |
||||
return TypeNormalizer.EnsureType<double>(v); |
||||
}); |
||||
sum = sum + s; |
||||
} |
||||
} else { |
||||
if (ImportAggregateHelper.FieldExist(dataSource.FirstOrDefault(),fieldName)) { |
||||
sum = dataSource.Sum(o => { |
||||
var v = ReadValueFromObject(fieldName, o); |
||||
return TypeNormalizer.EnsureType<double>(v); |
||||
}); |
||||
} |
||||
} |
||||
return sum.ToString(); |
||||
} |
||||
|
||||
|
||||
static object ReadValueFromObject(string fieldName, object currentObject) |
||||
{ |
||||
var propertyPath = currentObject.ParsePropertyPath(fieldName); |
||||
var evaluated = propertyPath.Evaluate(currentObject); |
||||
return evaluated; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,187 @@
@@ -0,0 +1,187 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using ICSharpCode.Reporting.Expressions.Irony.Ast; |
||||
using Irony.Interpreter; |
||||
using Irony.Interpreter.Ast; |
||||
using Irony.Parsing; |
||||
|
||||
namespace ICSharpCode.Reporting.Expressions.Irony |
||||
{ |
||||
/// <summary>
|
||||
/// Description of ReportingLanguageGrammer.
|
||||
/// </summary>
|
||||
public class ReportingLanguageGrammer:InterpretedLanguageGrammar |
||||
{ |
||||
private const string exclamationMark = "!"; |
||||
public ReportingLanguageGrammer() :base(caseSensitive : false) { |
||||
|
||||
this.GrammarComments = |
||||
@"Irony expression evaluator. Case-insensitive. Supports big integers, float data types, variables, assignments,
|
||||
arithmetic operations, augmented assignments (+=, -=), inc/dec (++,--), strings with embedded expressions; |
||||
bool operations &,&&, |, ||; ternary '?:' operator." ;
|
||||
|
||||
// 1. Terminals
|
||||
var number = new NumberLiteral("number"); |
||||
//Let's allow big integers (with unlimited number of digits):
|
||||
number.DefaultIntTypes = new TypeCode[] { TypeCode.Int32, TypeCode.Int64, NumberLiteral.TypeCodeBigInt }; |
||||
var identifier = new IdentifierTerminal("identifier"); |
||||
var comment = new CommentTerminal("comment", "#", "\n", "\r"); |
||||
//comment must be added to NonGrammarTerminals list; it is not used directly in grammar rules,
|
||||
// so we add it to this list to let Scanner know that it is also a valid terminal.
|
||||
base.NonGrammarTerminals.Add(comment); |
||||
var comma = ToTerm(","); |
||||
|
||||
//String literal with embedded expressions ------------------------------------------------------------------
|
||||
var stringLit = new StringLiteral("string", "\"", StringOptions.AllowsAllEscapes | StringOptions.IsTemplate); |
||||
stringLit.AddStartEnd("'", StringOptions.AllowsAllEscapes | StringOptions.IsTemplate); |
||||
stringLit.AstConfig.NodeType = typeof(StringTemplateNode); |
||||
var Expr = new NonTerminal("Expr"); //declare it here to use in template definition
|
||||
var templateSettings = new StringTemplateSettings(); //by default set to Ruby-style settings
|
||||
templateSettings.ExpressionRoot = Expr; //this defines how to evaluate expressions inside template
|
||||
this.SnippetRoots.Add(Expr); |
||||
stringLit.AstConfig.Data = templateSettings; |
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
// 2. Non-terminals
|
||||
var Term = new NonTerminal("Term"); |
||||
var BinExpr = new NonTerminal("BinExpr", typeof(BinaryOperationNode)); |
||||
var ParExpr = new NonTerminal("ParExsumpr"); |
||||
var UnExpr = new NonTerminal("UnExpr", typeof(UnaryOperationNode)); |
||||
var TernaryIfExpr = new NonTerminal("TernaryIf", typeof(IfNode)); |
||||
var ArgList = new NonTerminal("ArgList", typeof(ExpressionListNode)); |
||||
var FunctionCall = new NonTerminal("FunctionCall", typeof(FunctionCallNode)); |
||||
|
||||
// SharpReporting
|
||||
var ParametersSection = new NonTerminal("ParametersCall",typeof(ParametersCallNode)); |
||||
var FieldsSection = new NonTerminal("FieldsCall",typeof(FieldsNode)); |
||||
var GlobalSection = new NonTerminal("GlobalCall",typeof(GlobalsNode)); |
||||
|
||||
// end of SharpReporting
|
||||
|
||||
var MemberAccess = new NonTerminal("MemberAccess", typeof(MemberAccessNode)); |
||||
|
||||
|
||||
var IndexedAccess = new NonTerminal("IndexedAccess", typeof(IndexedAccessNode)); |
||||
var ObjectRef = new NonTerminal("ObjectRef"); // foo, foo.bar or f['bar']
|
||||
var UnOp = new NonTerminal("UnOp"); |
||||
var BinOp = new NonTerminal("BinOp", "operator"); |
||||
var PrefixIncDec = new NonTerminal("PrefixIncDec", typeof(IncDecNode)); |
||||
var PostfixIncDec = new NonTerminal("PostfixIncDec", typeof(IncDecNode)); |
||||
var IncDecOp = new NonTerminal("IncDecOp"); |
||||
var AssignmentStmt = new NonTerminal("AssignmentStmt", typeof(AssignmentNode)); |
||||
var AssignmentOp = new NonTerminal("AssignmentOp", "assignment operator"); |
||||
var Statement = new NonTerminal("Statement"); |
||||
var Program = new NonTerminal("Program", typeof(StatementListNode)); |
||||
|
||||
// 3. BNF rules
|
||||
Expr.Rule = Term | UnExpr | BinExpr | PrefixIncDec | PostfixIncDec | TernaryIfExpr |
||||
| ParametersSection |
||||
| GlobalSection |
||||
| FieldsSection; |
||||
|
||||
Term.Rule = number | ParExpr | stringLit | FunctionCall | identifier | MemberAccess | IndexedAccess; |
||||
|
||||
ParExpr.Rule = "(" + Expr + ")"; |
||||
UnExpr.Rule = UnOp + Term + ReduceHere(); |
||||
UnOp.Rule = ToTerm("+") | "-" | "!"; |
||||
BinExpr.Rule = Expr + BinOp + Expr; |
||||
BinOp.Rule = ToTerm("+") | "-" | "*" | "/" | "**" | "==" | "<" | "<=" | ">" | ">=" | "!=" | "&&" | "||" | "&" | "|"; |
||||
PrefixIncDec.Rule = IncDecOp + identifier; |
||||
PostfixIncDec.Rule = identifier + PreferShiftHere() + IncDecOp; |
||||
IncDecOp.Rule = ToTerm("++") | "--"; |
||||
TernaryIfExpr.Rule = Expr + "?" + Expr + ":" + Expr; |
||||
MemberAccess.Rule = Expr + PreferShiftHere() + "." + identifier; |
||||
AssignmentStmt.Rule = ObjectRef + AssignmentOp + Expr; |
||||
AssignmentOp.Rule = ToTerm("=") | "+=" | "-=" | "*=" | "/="; |
||||
Statement.Rule = AssignmentStmt | Expr | Empty; |
||||
ArgList.Rule = MakeStarRule(ArgList, comma, Expr); |
||||
FunctionCall.Rule = Expr + PreferShiftHere() + "(" + ArgList + ")"; |
||||
|
||||
// SharpReporting
|
||||
|
||||
ParametersSection.Rule = ToTerm("Parameters") + exclamationMark + identifier; |
||||
FieldsSection.Rule = ToTerm("Fields") + exclamationMark + identifier; |
||||
|
||||
GlobalSection.Rule = ToTerm("Globals") + exclamationMark + identifier; |
||||
|
||||
// end of SharpReporting
|
||||
|
||||
FunctionCall.NodeCaptionTemplate = "call #{0}(...)"; |
||||
|
||||
ObjectRef.Rule = identifier | MemberAccess | IndexedAccess; |
||||
IndexedAccess.Rule = Expr + PreferShiftHere() + "[" + Expr + "]"; |
||||
|
||||
Program.Rule = MakePlusRule(Program, NewLine, Statement); |
||||
|
||||
this.Root = Program; // Set grammar root
|
||||
|
||||
// 4. Operators precedence
|
||||
RegisterOperators(10, "?"); |
||||
RegisterOperators(15, "&", "&&", "|", "||"); |
||||
RegisterOperators(20, "==", "<", "<=", ">", ">=", "!="); |
||||
RegisterOperators(30, "+", "-"); |
||||
RegisterOperators(40, "*", "/"); |
||||
RegisterOperators(50, Associativity.Right, "**"); |
||||
RegisterOperators(60, "!"); |
||||
// For precedence to work, we need to take care of one more thing: BinOp.
|
||||
//For BinOp which is or-combination of binary operators, we need to either
|
||||
// 1) mark it transient or 2) set flag TermFlags.InheritPrecedence
|
||||
// We use first option, making it Transient.
|
||||
|
||||
// 5. Punctuation and transient terms
|
||||
MarkPunctuation("(", ")", "?", ":", "[", "]"); |
||||
RegisterBracePair("(", ")"); |
||||
RegisterBracePair("[", "]"); |
||||
MarkTransient(Term, Expr, Statement, BinOp, UnOp, IncDecOp, AssignmentOp, ParExpr, ObjectRef); |
||||
|
||||
// 7. Syntax error reporting
|
||||
MarkNotReported("++", "--"); |
||||
AddToNoReportGroup("(", "++", "--"); |
||||
AddToNoReportGroup(NewLine); |
||||
AddOperatorReportGroup("operator"); |
||||
AddTermsReportGroup("assignment operator", "=", "+=", "-=", "*=", "/="); |
||||
|
||||
//8. Console
|
||||
ConsoleTitle = "Irony Expression Evaluator"; |
||||
ConsoleGreeting = |
||||
@"Irony Expression Evaluator
|
||||
|
||||
Supports variable assignments, arithmetic operators (+, -, *, /), |
||||
augmented assignments (+=, -=, etc), prefix/postfix operators ++,--, string operations. |
||||
Supports big integer arithmetics, string operations. |
||||
Supports strings with embedded expressions : ""name: #{name}"" |
||||
|
||||
Press Ctrl-C to exit the program at any time. |
||||
";
|
||||
ConsolePrompt = "?"; |
||||
ConsolePromptMoreInput = "?"; |
||||
|
||||
//9. Language flags.
|
||||
// Automatically add NewLine before EOF so that our BNF rules work correctly when there's no final line break in source
|
||||
this.LanguageFlags = LanguageFlags.NewLineBeforeEOF | LanguageFlags.CreateAst | LanguageFlags.SupportsBigInt; |
||||
} |
||||
|
||||
|
||||
public override LanguageRuntime CreateRuntime(LanguageData language) |
||||
{ |
||||
return new ReportingLanguageRuntime(language); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,83 @@
@@ -0,0 +1,83 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using System.Linq; |
||||
using ICSharpCode.Reporting.Expressions.Irony.Imports; |
||||
using Irony.Interpreter; |
||||
using Irony.Parsing; |
||||
|
||||
namespace ICSharpCode.Reporting.Expressions.Irony |
||||
{ |
||||
/// <summary>
|
||||
/// Description of ReportingLanguageRuntime.
|
||||
/// </summary>
|
||||
public class ReportingLanguageRuntime:LanguageRuntime |
||||
{ |
||||
public ReportingLanguageRuntime(LanguageData language):base(language) |
||||
{ |
||||
} |
||||
|
||||
public override void Init() |
||||
{ |
||||
base.Init(); |
||||
//add built-in methods, special form IIF, import Math and Environment methods
|
||||
// BuiltIns.AddMethod(BuiltInPrintMethod, "print");
|
||||
// BuiltIns.AddMethod(BuiltInFormatMethod, "format");
|
||||
BuiltIns.AddSpecialForm(SpecialFormsLibrary.Iif, "iif", 3, 3); |
||||
BuiltIns.ImportStaticMembers(typeof(System.Math)); |
||||
BuiltIns.ImportStaticMembers(typeof(Environment)); |
||||
BuiltIns.ImportStaticMembers(typeof(System.DateTime)); |
||||
//Aggregates
|
||||
BuiltIns.AddSpecialForm(ImportAggregates.Sum,"sum",1,1); |
||||
} |
||||
|
||||
/* |
||||
private object BuiltInPrintMethod(ScriptThread thread, object[] args) { |
||||
string text = string.Empty; |
||||
switch(args.Length) { |
||||
case 1: |
||||
text = string.Empty + args[0]; //compact and safe conversion ToString()
|
||||
break; |
||||
case 0: |
||||
break; |
||||
default: |
||||
text = string.Join(" ", args); |
||||
break; |
||||
} |
||||
thread.App.WriteLine(text); |
||||
return null; |
||||
} |
||||
*/ |
||||
|
||||
/* |
||||
private object BuiltInFormatMethod(ScriptThread thread, object[] args) { |
||||
if (args == null || args.Length == 0) return null; |
||||
var template = args[0] as string; |
||||
if (template == null) |
||||
this.ThrowScriptError("Format template must be a string."); |
||||
if (args.Length == 1) return template; |
||||
//create formatting args array
|
||||
var formatArgs = args.Skip(1).ToArray(); |
||||
var text = string.Format(template, formatArgs); |
||||
return text; |
||||
|
||||
} |
||||
*/ |
||||
} |
||||
} |
@ -0,0 +1,122 @@
@@ -0,0 +1,122 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using System.Globalization; |
||||
|
||||
namespace ICSharpCode.Reporting.Expressions |
||||
{ |
||||
/// <summary>
|
||||
/// Description of TypeNormalizer.
|
||||
/// </summary>
|
||||
public class TypeNormalizer |
||||
{ |
||||
/* |
||||
public static void NormalizeTypes(ref object left,ref object right) |
||||
{ |
||||
NormalizeTypes(ref left,ref right,0); |
||||
} |
||||
|
||||
public static void NormalizeTypes(ref object left,ref object right,object nullValue) |
||||
{ |
||||
if (left == null) |
||||
left = 0; |
||||
if (right == null) |
||||
right = 0; |
||||
|
||||
if (left.GetType() == right.GetType()) |
||||
return; |
||||
|
||||
try |
||||
{ |
||||
right = Convert.ChangeType(right,left.GetType(),CultureInfo.CurrentCulture); |
||||
} |
||||
catch |
||||
{ |
||||
try |
||||
{ |
||||
left = Convert.ChangeType(left, right.GetType(),CultureInfo.CurrentCulture); |
||||
} |
||||
catch |
||||
{ |
||||
throw new Exception(String.Format("Error converting from {0} type to {1}", left.GetType().FullName, right.GetType().FullName)); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public static void EnsureTypes(ref object[] values,Type targetType) |
||||
{ |
||||
object nullValue = null; |
||||
if (targetType.IsValueType) |
||||
nullValue = Activator.CreateInstance(targetType); |
||||
EnsureTypes(ref values,targetType,nullValue); |
||||
|
||||
} |
||||
|
||||
public static void EnsureTypes(ref object[] values,Type targetType,object nullValue) |
||||
{ |
||||
for (int i=0;i<values.Length;i++) |
||||
{ |
||||
values[i] = EnsureType(values[i],targetType,nullValue); |
||||
} |
||||
} |
||||
*/ |
||||
public static T EnsureType<T>(object value) |
||||
{ |
||||
return EnsureType<T>(value, default(T)); |
||||
} |
||||
|
||||
public static T EnsureType<T>(object value,object nullValue) |
||||
{ |
||||
return (T) EnsureType(value, typeof (T), nullValue); |
||||
} |
||||
|
||||
public static object EnsureType(object value, Type targetType) |
||||
{ |
||||
if (value != null && value.GetType() == targetType) |
||||
return value; |
||||
|
||||
object defaultValue = null; |
||||
if (targetType.IsValueType) |
||||
defaultValue = Activator.CreateInstance(targetType); |
||||
return EnsureType(value, targetType, defaultValue); |
||||
} |
||||
|
||||
public static object EnsureType(object value,Type targetType,object nullValue) |
||||
{ |
||||
if (value == null) |
||||
return nullValue; |
||||
|
||||
if (targetType == typeof(object)) |
||||
return value; |
||||
|
||||
if (value.GetType() == targetType) |
||||
return value; |
||||
|
||||
try { |
||||
return Convert.ChangeType(value, targetType,CultureInfo.CurrentCulture); |
||||
} catch (Exception e) { |
||||
|
||||
Console.WriteLine("TypeNormalizer {0} - {1}",value.ToString(),e.Message); |
||||
return value.ToString(); |
||||
//throw new Exception()String.Format("TypeNormalizer for <{0}> - {1}",value.ToString(),e.Message));
|
||||
} |
||||
} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,168 @@
@@ -0,0 +1,168 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using System.Globalization; |
||||
using ICSharpCode.Reporting.PageBuilder.ExportColumns; |
||||
|
||||
namespace ICSharpCode.Reporting.Globals |
||||
{ |
||||
/// <summary>
|
||||
/// Description of StandardFormatter.
|
||||
/// </summary>
|
||||
class StandardFormatter |
||||
{ |
||||
public static void FormatOutput (IExportText textColumn) { |
||||
if (!String.IsNullOrEmpty(textColumn.FormatString)) { |
||||
TypeCode typeCode = TypeHelper.TypeCodeFromString(textColumn.DataType); |
||||
textColumn.Text = FormatItem(textColumn.Text,textColumn.FormatString,typeCode); |
||||
} |
||||
} |
||||
|
||||
/* |
||||
public static string FormatOutput(string valueToFormat,string format, |
||||
string dataType, string nullValue ) |
||||
{ |
||||
if (String.IsNullOrEmpty(format)) { |
||||
return valueToFormat; |
||||
} |
||||
|
||||
if (String.IsNullOrEmpty(valueToFormat)) { |
||||
return nullValue; |
||||
} |
||||
|
||||
TypeCode typeCode = TypeHelper.TypeCodeFromString(dataType); |
||||
return FormatItem(valueToFormat,format,typeCode,nullValue); |
||||
} |
||||
*/ |
||||
|
||||
// private static string FormatItem (string valueToFormat,string format,
|
||||
// TypeCode typeCode,string nullValue)
|
||||
private static string FormatItem (string valueToFormat,string format, |
||||
TypeCode typeCode) |
||||
{ |
||||
string retValue = String.Empty; |
||||
|
||||
switch (typeCode) { |
||||
case TypeCode.Int16: |
||||
case TypeCode.Int32: |
||||
retValue = FormatIntegers (valueToFormat,format); |
||||
break; |
||||
case TypeCode.DateTime: |
||||
retValue = FormatDate(valueToFormat,format); |
||||
break; |
||||
case TypeCode.Boolean: |
||||
retValue = FormatBool (valueToFormat); |
||||
break; |
||||
case TypeCode.Decimal: |
||||
retValue = FormatDecimal (valueToFormat,format); |
||||
break; |
||||
|
||||
case TypeCode.Double: |
||||
case TypeCode.Single: |
||||
break; |
||||
|
||||
case TypeCode.String: |
||||
case TypeCode.Char: |
||||
retValue = valueToFormat; |
||||
break; |
||||
default: |
||||
retValue = valueToFormat; |
||||
break; |
||||
} |
||||
|
||||
return retValue; |
||||
} |
||||
|
||||
|
||||
private static string FormatBool (string toFormat) |
||||
{ |
||||
if (CheckValue(toFormat)) { |
||||
bool b = bool.Parse (toFormat); |
||||
return b.ToString (CultureInfo.CurrentCulture); |
||||
} |
||||
return toFormat; |
||||
} |
||||
|
||||
private static string FormatIntegers(string toFormat, string format) |
||||
{ |
||||
string str = String.Empty; |
||||
if (CheckValue (toFormat)) { |
||||
int number = Int32.Parse(toFormat, System.Globalization.NumberStyles.Any, CultureInfo.CurrentCulture.NumberFormat); |
||||
str = number.ToString(format, CultureInfo.CurrentCulture); |
||||
return str; |
||||
} else { |
||||
str = (0.0M).ToString(CultureInfo.CurrentCulture); |
||||
} |
||||
return str; |
||||
} |
||||
|
||||
|
||||
private static string FormatDecimal(string toFormat, string format) |
||||
{ |
||||
string str = String.Empty; |
||||
if (CheckValue (toFormat)) { |
||||
try { |
||||
decimal dec = Decimal.Parse(toFormat, |
||||
System.Globalization.NumberStyles.Any, |
||||
CultureInfo.CurrentCulture.NumberFormat); |
||||
str = dec.ToString (format,CultureInfo.CurrentCulture); |
||||
|
||||
} catch (FormatException) { |
||||
throw ; |
||||
} |
||||
return str; |
||||
} else { |
||||
str = (0.0M).ToString(CultureInfo.CurrentCulture); |
||||
} |
||||
return str; |
||||
} |
||||
|
||||
// http://stackoverflow.com/questions/4710455/i-need-code-to-validate-any-time-in-c-sharp-in-hhmmss-format
|
||||
|
||||
private static string FormatDate(string toFormat, string format) |
||||
{ |
||||
DateTime date; |
||||
if (DateTime.TryParse(toFormat, out date)) |
||||
{ |
||||
string str = date.ToString(format, |
||||
DateTimeFormatInfo.CurrentInfo); |
||||
return str.Trim(); |
||||
} |
||||
|
||||
TimeSpan time; |
||||
bool valid = TimeSpan.TryParseExact(toFormat, |
||||
"g", |
||||
CultureInfo.CurrentCulture, |
||||
out time); |
||||
if (valid) { |
||||
return time.ToString("g",DateTimeFormatInfo.CurrentInfo); |
||||
} |
||||
return toFormat; |
||||
} |
||||
|
||||
|
||||
private static bool CheckValue (string toFormat) |
||||
{ |
||||
if (String.IsNullOrEmpty(toFormat)) { |
||||
return false; |
||||
} |
||||
return true; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,154 @@
@@ -0,0 +1,154 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
namespace ICSharpCode.Reporting.Globals |
||||
{ |
||||
/// <summary>
|
||||
/// Description of StringHelper.
|
||||
/// </summary>
|
||||
class StringHelper |
||||
{ |
||||
/// <summary>
|
||||
/// Left of the first occurance of c
|
||||
/// </summary>
|
||||
/// <param name="src"></param>
|
||||
/// <param name="c"></param>
|
||||
/// <returns></returns>
|
||||
public static string LeftOf(string src, char c) |
||||
{ |
||||
int idx=src.IndexOf(c); |
||||
if (idx==-1) |
||||
{ |
||||
return src; |
||||
} |
||||
|
||||
return src.Substring(0, idx); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Left of the n'th occurance of c
|
||||
/// </summary>
|
||||
/// <param name="src"></param>
|
||||
/// <param name="c"></param>
|
||||
/// <param name="n"></param>
|
||||
/// <returns></returns>
|
||||
public static string LeftOf(string src, char c, int n) |
||||
{ |
||||
int idx=-1; |
||||
while (n != 0) |
||||
{ |
||||
idx=src.IndexOf(c, idx+1); |
||||
if (idx==-1) |
||||
{ |
||||
return src; |
||||
} |
||||
--n; |
||||
} |
||||
return src.Substring(0, idx); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Right of the first occurance of c
|
||||
/// </summary>
|
||||
/// <param name="src"></param>
|
||||
/// <param name="c"></param>
|
||||
/// <returns></returns>
|
||||
public static string RightOf(string src, char c) |
||||
{ |
||||
int idx=src.IndexOf(c); |
||||
if (idx==-1) |
||||
{ |
||||
return ""; |
||||
} |
||||
|
||||
return src.Substring(idx+1); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Right of the n'th occurance of c
|
||||
/// </summary>
|
||||
/// <param name="src"></param>
|
||||
/// <param name="c"></param>
|
||||
/// <returns></returns>
|
||||
public static string RightOf(string src, char c, int n) |
||||
{ |
||||
int idx=-1; |
||||
while (n != 0) |
||||
{ |
||||
idx=src.IndexOf(c, idx+1); |
||||
if (idx==-1) |
||||
{ |
||||
return ""; |
||||
} |
||||
--n; |
||||
} |
||||
|
||||
return src.Substring(idx+1); |
||||
} |
||||
|
||||
public static string LeftOfRightmostOf(string src, char c) |
||||
{ |
||||
int idx=src.LastIndexOf(c); |
||||
if (idx==-1) |
||||
{ |
||||
return src; |
||||
} |
||||
return src.Substring(0, idx); |
||||
} |
||||
|
||||
public static string RightOfRightmostOf(string src, char c) |
||||
{ |
||||
int idx=src.LastIndexOf(c); |
||||
if (idx==-1) |
||||
{ |
||||
return src; |
||||
} |
||||
return src.Substring(idx+1); |
||||
} |
||||
|
||||
public static string Between(string src, char start, char end) |
||||
{ |
||||
string res=String.Empty; |
||||
int idxStart=src.IndexOf(start); |
||||
if (idxStart != -1) |
||||
{ |
||||
++idxStart; |
||||
int idxEnd=src.IndexOf(end, idxStart); |
||||
if (idxEnd != -1) |
||||
{ |
||||
res=src.Substring(idxStart, idxEnd-idxStart); |
||||
} |
||||
} |
||||
return res; |
||||
} |
||||
|
||||
public static int Count(string src, char find) |
||||
{ |
||||
int ret=0; |
||||
foreach(char s in src) |
||||
{ |
||||
if (s==find) |
||||
{ |
||||
++ret; |
||||
} |
||||
} |
||||
return ret; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,84 @@
@@ -0,0 +1,84 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using System.Data; |
||||
|
||||
namespace ICSharpCode.Reporting.Globals |
||||
{ |
||||
/// <summary>
|
||||
/// Description of TypeHelper.
|
||||
/// </summary>
|
||||
class TypeHelper |
||||
{ |
||||
public static DbType DbTypeFromStringRepresenation(string type) |
||||
{ |
||||
switch (type.ToLower()) |
||||
{ |
||||
case "int": |
||||
return DbType.Int16; |
||||
case "int16": |
||||
return DbType.Int16; |
||||
case "int32": |
||||
return DbType.Int32; |
||||
case "int64": |
||||
return DbType.Int64; |
||||
case "uint16": |
||||
return DbType.UInt16; |
||||
case "uint32": |
||||
return DbType.UInt32; |
||||
case "uint64": |
||||
return DbType.UInt64; |
||||
case "single": |
||||
return DbType.Single; |
||||
case "double": |
||||
return DbType.Double; |
||||
case "decimal": |
||||
return DbType.Decimal; |
||||
case "datetime" : |
||||
return DbType.DateTime; |
||||
case "datetime2" : |
||||
return DbType.DateTime2; |
||||
case "boolean" : |
||||
return DbType.Boolean; |
||||
case "nvarchar": |
||||
return DbType.String; |
||||
case "varchar": |
||||
return DbType.AnsiString; |
||||
case "binary": |
||||
return DbType.Binary; |
||||
case "currency": |
||||
return DbType.Currency; |
||||
case "guid": |
||||
return DbType.Guid; |
||||
case "xml": |
||||
return DbType.Xml; |
||||
default: |
||||
return DbType.Object; |
||||
} |
||||
} |
||||
|
||||
public static TypeCode TypeCodeFromString (string type) { |
||||
if (type == null) |
||||
type = "System.String"; |
||||
var x = Type.GetTypeCode( Type.GetType(type)); |
||||
|
||||
return x; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,46 @@
@@ -0,0 +1,46 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using ICSharpCode.Reporting.Interfaces.Export; |
||||
using ICSharpCode.Reporting.PageBuilder.ExportColumns; |
||||
|
||||
namespace ICSharpCode.Reporting.Items |
||||
{ |
||||
/// <summary>
|
||||
/// Description of BaseCircleItem.
|
||||
/// </summary>
|
||||
public class BaseCircleItem:BaseGraphics |
||||
{ |
||||
public BaseCircleItem() |
||||
{ |
||||
} |
||||
|
||||
public override IExportColumn CreateExportColumn() |
||||
{ |
||||
var ex = new ExportCircle(); |
||||
ex.Location = Location; |
||||
ex.ForeColor = ForeColor; |
||||
ex.BackColor = BackColor; |
||||
ex.Size = Size; |
||||
ex.DesiredSize = Size; |
||||
ex.Thickness = Thickness; |
||||
ex.DashStyle = DashStyle; |
||||
return ex; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,43 @@
@@ -0,0 +1,43 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System.Drawing.Drawing2D; |
||||
|
||||
namespace ICSharpCode.Reporting.Items |
||||
{ |
||||
/// <summary>
|
||||
/// Description of BaseGraphics.
|
||||
/// </summary>
|
||||
public class BaseGraphics:PrintableItem |
||||
{ |
||||
public BaseGraphics() |
||||
{ |
||||
this.Thickness = 1; |
||||
DashStyle = DashStyle.Solid; |
||||
} |
||||
|
||||
|
||||
public virtual int Thickness {get;set;} |
||||
|
||||
public virtual DashStyle DashStyle {get;set;} |
||||
|
||||
public virtual LineCap StartLineCap {get;set;} |
||||
|
||||
public virtual LineCap EndLineCap {get;set;} |
||||
} |
||||
} |
@ -0,0 +1,47 @@
@@ -0,0 +1,47 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using ICSharpCode.Reporting.Interfaces.Export; |
||||
using ICSharpCode.Reporting.PageBuilder.ExportColumns; |
||||
|
||||
namespace ICSharpCode.Reporting.Items{ |
||||
/// <summary>
|
||||
/// Description of BaseLineItem.
|
||||
/// </summary>
|
||||
public class BaseLineItem:BaseGraphics |
||||
{ |
||||
public BaseLineItem() |
||||
{ |
||||
} |
||||
|
||||
public override IExportColumn CreateExportColumn() |
||||
{ |
||||
var ex = new ExportLine(); |
||||
ex.Location = Location; |
||||
ex.ForeColor = ForeColor; |
||||
ex.BackColor = BackColor; |
||||
ex.Size = Size; |
||||
ex.DesiredSize = Size; |
||||
ex.Thickness = Thickness; |
||||
ex.DashStyle = DashStyle; |
||||
ex.StartLineCap = StartLineCap; |
||||
ex.EndLineCap = EndLineCap; |
||||
return ex; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,49 @@
@@ -0,0 +1,49 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using ICSharpCode.Reporting.Interfaces.Export; |
||||
using ICSharpCode.Reporting.PageBuilder.ExportColumns; |
||||
|
||||
namespace ICSharpCode.Reporting.Items |
||||
{ |
||||
/// <summary>
|
||||
/// Description of BaseRectangleItem.
|
||||
/// </summary>
|
||||
public class BaseRectangleItem:BaseGraphics |
||||
{ |
||||
public BaseRectangleItem() |
||||
{ |
||||
} |
||||
|
||||
|
||||
public override IExportColumn CreateExportColumn() |
||||
{ |
||||
var ex = new ExportRectangle(); |
||||
ex.Location = Location; |
||||
ex.ForeColor = ForeColor; |
||||
ex.BackColor = BackColor; |
||||
ex.Size = Size; |
||||
ex.DesiredSize = Size; |
||||
ex.Thickness = Thickness; |
||||
ex.DashStyle = DashStyle; |
||||
ex.StartLineCap = StartLineCap; |
||||
ex.EndLineCap = EndLineCap; |
||||
return ex; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,32 @@
@@ -0,0 +1,32 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using ICSharpCode.Reporting.Interfaces; |
||||
using ICSharpCode.Reporting.Interfaces.Export; |
||||
|
||||
namespace ICSharpCode.Reporting.PageBuilder.Converter |
||||
{ |
||||
internal interface IContainerConverter |
||||
{ |
||||
IExportContainer ConvertToExportContainer(IReportContainer reportContainer); |
||||
List<IExportColumn> CreateConvertedList(List<IPrintableObject> items); |
||||
void SetParent(IExportContainer parent, List<IExportColumn> convertedItems); |
||||
} |
||||
} |
@ -0,0 +1,54 @@
@@ -0,0 +1,54 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using System.Drawing.Drawing2D; |
||||
using ICSharpCode.Reporting.Exporter.Visitors; |
||||
|
||||
namespace ICSharpCode.Reporting.PageBuilder.ExportColumns |
||||
{ |
||||
/// <summary>
|
||||
/// Description of ExportCircle.
|
||||
/// </summary>
|
||||
public class ExportCircle:ExportColumn,IExportGraphics,IAcceptor |
||||
{ |
||||
public ExportCircle() |
||||
{ |
||||
} |
||||
|
||||
|
||||
public void Accept(IVisitor visitor) |
||||
{ |
||||
visitor.Visit(this); |
||||
} |
||||
|
||||
|
||||
public override ICSharpCode.Reporting.Arrange.IMeasurementStrategy MeasurementStrategy() |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public int Thickness {get;set;} |
||||
|
||||
public DashStyle DashStyle {get;set;} |
||||
|
||||
public LineCap StartLineCap {get;set;} |
||||
|
||||
public LineCap EndLineCap {get;set;} |
||||
} |
||||
} |
@ -0,0 +1,64 @@
@@ -0,0 +1,64 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using System.Drawing.Drawing2D; |
||||
using ICSharpCode.Reporting.Exporter.Visitors; |
||||
using ICSharpCode.Reporting.Interfaces.Export; |
||||
|
||||
namespace ICSharpCode.Reporting.PageBuilder.ExportColumns |
||||
{ |
||||
/// <summary>
|
||||
/// Description of ExportGraphics.
|
||||
/// </summary>
|
||||
///
|
||||
public interface IExportGraphics:IExportColumn { |
||||
int Thickness {get;set;} |
||||
DashStyle DashStyle {get;set;} |
||||
LineCap StartLineCap {get;set;} |
||||
LineCap EndLineCap {get;set;} |
||||
} |
||||
|
||||
|
||||
public class ExportLine:ExportColumn,IExportGraphics,IAcceptor |
||||
{ |
||||
public ExportLine() |
||||
{ |
||||
} |
||||
|
||||
|
||||
public void Accept(IVisitor visitor) |
||||
{ |
||||
visitor.Visit(this); |
||||
} |
||||
|
||||
|
||||
public override ICSharpCode.Reporting.Arrange.IMeasurementStrategy MeasurementStrategy() |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public int Thickness {get;set;} |
||||
|
||||
public DashStyle DashStyle {get;set;} |
||||
|
||||
public LineCap StartLineCap {get;set;} |
||||
|
||||
public LineCap EndLineCap {get;set;} |
||||
} |
||||
} |
@ -0,0 +1,68 @@
@@ -0,0 +1,68 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Drawing; |
||||
|
||||
using ICSharpCode.Reporting.Exporter.Visitors; |
||||
using ICSharpCode.Reporting.Interfaces.Export; |
||||
|
||||
namespace ICSharpCode.Reporting.PageBuilder.ExportColumns |
||||
{ |
||||
/// <summary>
|
||||
/// Description of Page.
|
||||
/// </summary>
|
||||
///
|
||||
|
||||
public class ExportPage:ExportColumn,IPage,IAcceptor |
||||
{ |
||||
public ExportPage(IPageInfo pageInfo,Size pageSize):base() |
||||
{ |
||||
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 bool CanShrink {get;set;} |
||||
|
||||
|
||||
public void Accept(IVisitor visitor) |
||||
{ |
||||
visitor.Visit(this as ExportPage); |
||||
} |
||||
|
||||
|
||||
List<IExportColumn> exportedItems; |
||||
|
||||
public List<IExportColumn> ExportedItems { |
||||
get { return exportedItems; } |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,55 @@
@@ -0,0 +1,55 @@
|
||||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using System.Drawing.Drawing2D; |
||||
using ICSharpCode.Reporting.Exporter.Visitors; |
||||
using ICSharpCode.Reporting.Interfaces.Export; |
||||
|
||||
namespace ICSharpCode.Reporting.PageBuilder.ExportColumns |
||||
{ |
||||
/// <summary>
|
||||
/// Description of ExportRectangle.
|
||||
/// </summary>
|
||||
public class ExportRectangle:ExportColumn,IExportGraphics,IAcceptor |
||||
{ |
||||
public ExportRectangle() |
||||
{ |
||||
} |
||||
|
||||
|
||||
public void Accept(IVisitor visitor) |
||||
{ |
||||
visitor.Visit(this); |
||||
} |
||||
|
||||
|
||||
public override ICSharpCode.Reporting.Arrange.IMeasurementStrategy MeasurementStrategy() |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public int Thickness {get;set;} |
||||
|
||||
public DashStyle DashStyle {get;set;} |
||||
|
||||
public LineCap StartLineCap {get;set;} |
||||
|
||||
public LineCap EndLineCap {get;set;} |
||||
} |
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue