Browse Source

Merge branch 'reports'

pull/375/head
Daniel Grunwald 12 years ago
parent
commit
358ea923d4
  1. 27
      SharpDevelop.Tests.sln
  2. 20
      SharpDevelop.sln
  3. 2
      src/AddIns/Analysis/CodeQuality/CodeQuality.addin
  4. 8
      src/AddIns/Analysis/CodeQuality/CodeQuality.csproj
  5. 5
      src/AddIns/Analysis/CodeQuality/Gui/MainView.xaml
  6. 8
      src/AddIns/Analysis/CodeQuality/Gui/MainView.xaml.cs
  7. 4
      src/AddIns/Analysis/CodeQuality/Reporting/BaseReport.cs
  8. 308
      src/AddIns/Analysis/CodeQuality/Reporting/DependencyReport - Kopie.srd
  9. 33
      src/AddIns/Analysis/CodeQuality/Reporting/DependencyReport.cs
  10. 46
      src/AddIns/Analysis/CodeQuality/Reporting/DependencyReport.srd
  11. 75
      src/AddIns/Analysis/CodeQuality/Reporting/OverviewReport.cs
  12. 55
      src/AddIns/Analysis/CodeQuality/Reporting/Overviewreport.srd
  13. 2
      src/AddIns/DisplayBindings/Data/ICSharpCode.Data.SQLServer/SQLServerDatabaseDriver.cs
  14. 36
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/Commands/ViewCommands.cs
  15. 16
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/Configuration/AssemblyInfo.cs
  16. 64
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/DesignerBinding/DesignerBinding.cs
  17. 19
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/EmptyReport.xft
  18. 100
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/ICSharpCode.Reporting.Addin.csproj
  19. 181
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/ICSharpCode.Reporting.addin
  20. 87
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/ICSharpCode.Reporting.csproj
  21. 103
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Arrange/ArrangeStrategy.cs
  22. 34
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Arrange/MeasurementStrategy.cs
  23. 40
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/BaseClasses/BasicParameter.cs
  24. 110
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/BaseClasses/ExtensionMethods.cs
  25. 135
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/BaseClasses/Page.cs
  26. 72
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Collections.cs
  27. 233
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataManager/Listhandling/CollectionDataSource.cs
  28. 416
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataManager/Listhandling/CollectionSource.cs
  29. 4
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataManager/Listhandling/IndexList.cs
  30. 2
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataSource/Comparer/GroupComparer.cs
  31. 1
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataSource/Comparer/SortComparer.cs
  32. 6
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataSource/DataCollection.cs
  33. 2
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataSource/ExtendedPropertyDescriptor.cs
  34. 2
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataSource/ExtendedTypeDescriptor.cs
  35. 51
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataSource/FieldMemberAccessor.cs
  36. 58
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataSource/PropertyMemberAccessore.cs
  37. 104
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataSource/PropertyPath.cs
  38. 4
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataSource/PropertyTypeHash.cs
  39. 69
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataSource/ReflectionExtension.cs
  40. 30
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Events/SectionEvent.cs
  41. 186
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/ExportRenderer/FixedDocumentCreator.cs
  42. 6
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Exporter/BaseExporter.cs
  43. 34
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Exporter/DebugExporter.cs
  44. 65
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Exporter/Visitors/AbstractVisitor.cs
  45. 22
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Exporter/Visitors/DebugVisitor.cs
  46. 94
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Exporter/Visitors/ExpressionVisitor.cs
  47. 51
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Exporter/Visitors/FormatVisitor.cs
  48. 6
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Exporter/Visitors/IVisitor.cs
  49. 73
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Exporter/Visitors/WpfVisitor.cs
  50. 113
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Exporter/WpfExporter.cs
  51. 52
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Expressions/ExpressionHelper.cs
  52. 65
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Expressions/ExpressionRunner.cs
  53. 102
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Expressions/Irony/Ast/AstExtensions.cs
  54. 54
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Expressions/Irony/Ast/FieldsNode.cs
  55. 67
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Expressions/Irony/Ast/GlobalsNode.cs
  56. 53
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Expressions/Irony/Ast/ParametersCallNode.cs
  57. 73
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Expressions/Irony/ExpressionEvaluator.cs
  58. 99
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Expressions/Irony/Imports/ImportAggregates.cs
  59. 187
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Expressions/Irony/ReportingLanguageGrammer.cs
  60. 83
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Expressions/Irony/ReportingLanguageRuntime.cs
  61. 122
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Expressions/TypeNormalizer.cs
  62. 1
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Factories/ReportCreatorFactory.cs
  63. 2
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Globals/CreateGraphics.cs
  64. 7
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Globals/GlobalEnums.cs
  65. 21
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Globals/MeasurementService.cs
  66. 168
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Globals/StandardFormatter.cs
  67. 154
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Globals/StringHelper.cs
  68. 84
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Globals/TypeHelper.cs
  69. 32
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/Data/IDataSource.cs
  70. 3
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/Export/IExportColumn.cs
  71. 1
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/Export/IExportContainer.cs
  72. 1
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/Export/IPage.cs
  73. 3
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IPrintableObject.cs
  74. 2
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IReportContainer.cs
  75. 8
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IReportCreator.cs
  76. 12
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IReportModel.cs
  77. 12
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseDataItem.cs
  78. 20
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseRowItem.cs
  79. 8
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseSection.cs
  80. 35
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseTextItem.cs
  81. 46
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/Graphics/BaseCircleItem.cs
  82. 43
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/Graphics/BaseGraphics.cs
  83. 47
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/Graphics/BaseLineItem.cs
  84. 49
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/Graphics/BaseRectangleItem.cs
  85. 4
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/GroupColumn.cs
  86. 14
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/PrintableItem.cs
  87. 10
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportContainer.cs
  88. 9
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportModel.cs
  89. 15
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportSettings.cs
  90. 7
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/SortColumn.cs
  91. 185
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/BasePageBuilder.cs
  92. 59
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/Converter/ContainerConverter.cs
  93. 32
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/Converter/IContainerConverter.cs
  94. 219
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/DataPageBuilder.cs
  95. 54
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/ExportCircle.cs
  96. 17
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/ExportColumn.cs
  97. 16
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/ExportContainer.cs
  98. 64
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/ExportLine.cs
  99. 68
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/ExportPage.cs
  100. 55
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/ExportRectangle.cs
  101. Some files were not shown because too many files have changed in this diff Show More

27
SharpDevelop.Tests.sln

@ -1,7 +1,9 @@ @@ -1,7 +1,9 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
# SharpDevelop 5.0
VisualStudioVersion = 12.0.20827.3
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Main", "Main", "{256F5C28-532C-44C0-8AB8-D8EC5E492E01}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop.BuildWorker35", "src\Main\ICSharpCode.SharpDevelop.BuildWorker35\ICSharpCode.SharpDevelop.BuildWorker35.csproj", "{B5F54272-49F0-40DB-845A-8D837875D3BA}"
@ -148,6 +150,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Reports.Core.Te @@ -148,6 +150,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Reports.Core.Te
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Irony", "src\AddIns\Misc\Reports\Irony\Irony.csproj", "{D81F5C91-D7DB-46E5-BC99-49488FB6814C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Reporting", "src\AddIns\Misc\Reporting\ICSharpCode.Reporting\ICSharpCode.Reporting.csproj", "{40CA84D4-ACFC-4646-9CDD-B87262D34093}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Reporting.Test", "src\AddIns\Misc\Reporting\ICSharpCode.Reporting\Test\ICSharpCode.Reporting.Test\ICSharpCode.Reporting.Test.csproj", "{97CA9CE5-B966-48DF-BB59-F00FFC534B1F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Reporting.Addin", "src\AddIns\Misc\Reporting\ICSharpCode.Reporting.Addin\ICSharpCode.Reporting.Addin.csproj", "{0502FCF7-72F4-4587-936B-D0238CD0E072}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Display Bindings", "Display Bindings", "{11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AvalonEdit.AddIn", "src\AddIns\DisplayBindings\AvalonEdit.AddIn\AvalonEdit.AddIn.csproj", "{0162E499-42D0-409B-AA25-EED21F75336B}"
@ -490,6 +498,18 @@ Global @@ -490,6 +498,18 @@ Global
{D81F5C91-D7DB-46E5-BC99-49488FB6814C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D81F5C91-D7DB-46E5-BC99-49488FB6814C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D81F5C91-D7DB-46E5-BC99-49488FB6814C}.Release|Any CPU.Build.0 = Release|Any CPU
{40CA84D4-ACFC-4646-9CDD-B87262D34093}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{40CA84D4-ACFC-4646-9CDD-B87262D34093}.Debug|Any CPU.Build.0 = Debug|Any CPU
{40CA84D4-ACFC-4646-9CDD-B87262D34093}.Release|Any CPU.ActiveCfg = Release|Any CPU
{40CA84D4-ACFC-4646-9CDD-B87262D34093}.Release|Any CPU.Build.0 = Release|Any CPU
{97CA9CE5-B966-48DF-BB59-F00FFC534B1F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{97CA9CE5-B966-48DF-BB59-F00FFC534B1F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{97CA9CE5-B966-48DF-BB59-F00FFC534B1F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{97CA9CE5-B966-48DF-BB59-F00FFC534B1F}.Release|Any CPU.Build.0 = Release|Any CPU
{0502FCF7-72F4-4587-936B-D0238CD0E072}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0502FCF7-72F4-4587-936B-D0238CD0E072}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0502FCF7-72F4-4587-936B-D0238CD0E072}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0502FCF7-72F4-4587-936B-D0238CD0E072}.Release|Any CPU.Build.0 = Release|Any CPU
{0162E499-42D0-409B-AA25-EED21F75336B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0162E499-42D0-409B-AA25-EED21F75336B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0162E499-42D0-409B-AA25-EED21F75336B}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -717,6 +737,9 @@ Global @@ -717,6 +737,9 @@ Global
{4B2239FF-8FD6-431D-9D22-1B8049BA6917} = {FEDD3FD9-0480-43CC-913C-4E0876DDA852}
{E16B73CA-3603-47EE-915E-6F8B2A07304B} = {FEDD3FD9-0480-43CC-913C-4E0876DDA852}
{D81F5C91-D7DB-46E5-BC99-49488FB6814C} = {FEDD3FD9-0480-43CC-913C-4E0876DDA852}
{40CA84D4-ACFC-4646-9CDD-B87262D34093} = {FEDD3FD9-0480-43CC-913C-4E0876DDA852}
{97CA9CE5-B966-48DF-BB59-F00FFC534B1F} = {FEDD3FD9-0480-43CC-913C-4E0876DDA852}
{0502FCF7-72F4-4587-936B-D0238CD0E072} = {FEDD3FD9-0480-43CC-913C-4E0876DDA852}
{11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{0162E499-42D0-409B-AA25-EED21F75336B} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
{E618A9CD-A39F-4925-A538-E8A3FEF24E54} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}

20
SharpDevelop.sln

@ -1,7 +1,9 @@ @@ -1,7 +1,9 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
# SharpDevelop 5.0
VisualStudioVersion = 12.0.20827.3
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Main", "Main", "{256F5C28-532C-44C0-8AB8-D8EC5E492E01}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop.BuildWorker35", "src\Main\ICSharpCode.SharpDevelop.BuildWorker35\ICSharpCode.SharpDevelop.BuildWorker35.csproj", "{B5F54272-49F0-40DB-845A-8D837875D3BA}"
@ -117,6 +119,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Reports.Core", @@ -117,6 +119,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Reports.Core",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Irony", "src\AddIns\Misc\Reports\Irony\Irony.csproj", "{D81F5C91-D7DB-46E5-BC99-49488FB6814C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Reporting", "src\AddIns\Misc\Reporting\ICSharpCode.Reporting\ICSharpCode.Reporting.csproj", "{40CA84D4-ACFC-4646-9CDD-B87262D34093}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Reporting.Addin", "src\AddIns\Misc\Reporting\ICSharpCode.Reporting.Addin\ICSharpCode.Reporting.Addin.csproj", "{0502FCF7-72F4-4587-936B-D0238CD0E072}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Display Bindings", "Display Bindings", "{11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AvalonEdit.AddIn", "src\AddIns\DisplayBindings\AvalonEdit.AddIn\AvalonEdit.AddIn.csproj", "{0162E499-42D0-409B-AA25-EED21F75336B}"
@ -381,6 +387,10 @@ Global @@ -381,6 +387,10 @@ Global
{D81F5C91-D7DB-46E5-BC99-49488FB6814C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D81F5C91-D7DB-46E5-BC99-49488FB6814C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D81F5C91-D7DB-46E5-BC99-49488FB6814C}.Release|Any CPU.Build.0 = Release|Any CPU
{40CA84D4-ACFC-4646-9CDD-B87262D34093}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{40CA84D4-ACFC-4646-9CDD-B87262D34093}.Debug|Any CPU.Build.0 = Debug|Any CPU
{40CA84D4-ACFC-4646-9CDD-B87262D34093}.Release|Any CPU.ActiveCfg = Release|Any CPU
{40CA84D4-ACFC-4646-9CDD-B87262D34093}.Release|Any CPU.Build.0 = Release|Any CPU
{0162E499-42D0-409B-AA25-EED21F75336B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0162E499-42D0-409B-AA25-EED21F75336B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0162E499-42D0-409B-AA25-EED21F75336B}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -505,6 +515,10 @@ Global @@ -505,6 +515,10 @@ Global
{3DF4060F-5EE0-41CF-8096-F27355FD5511}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3DF4060F-5EE0-41CF-8096-F27355FD5511}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3DF4060F-5EE0-41CF-8096-F27355FD5511}.Release|Any CPU.Build.0 = Release|Any CPU
{0502FCF7-72F4-4587-936B-D0238CD0E072}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0502FCF7-72F4-4587-936B-D0238CD0E072}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0502FCF7-72F4-4587-936B-D0238CD0E072}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0502FCF7-72F4-4587-936B-D0238CD0E072}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -563,6 +577,8 @@ Global @@ -563,6 +577,8 @@ Global
{35D002D7-C78B-44FB-92AA-104BEB431678} = {4ABB8D1E-3439-44C8-ACCE-1FA678ABBFB3}
{4B2239FF-8FD6-431D-9D22-1B8049BA6917} = {4ABB8D1E-3439-44C8-ACCE-1FA678ABBFB3}
{D81F5C91-D7DB-46E5-BC99-49488FB6814C} = {4ABB8D1E-3439-44C8-ACCE-1FA678ABBFB3}
{40CA84D4-ACFC-4646-9CDD-B87262D34093} = {4ABB8D1E-3439-44C8-ACCE-1FA678ABBFB3}
{0502FCF7-72F4-4587-936B-D0238CD0E072} = {4ABB8D1E-3439-44C8-ACCE-1FA678ABBFB3}
{11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{0162E499-42D0-409B-AA25-EED21F75336B} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
{E618A9CD-A39F-4925-A538-E8A3FEF24E54} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}

2
src/AddIns/Analysis/CodeQuality/CodeQuality.addin

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
<Manifest>
<Identity name = "ICSharpCode.CodeQuality"/>
<Dependency addin="ICSharpCode.Reports.Addin" requirePreload="true" />
<Dependency addin="ICSharpCode.Reporting.Addin" requirePreload="true"></Dependency>
</Manifest>
<Runtime>

8
src/AddIns/Analysis/CodeQuality/CodeQuality.csproj

@ -111,6 +111,7 @@ @@ -111,6 +111,7 @@
<EmbeddedResource Include="Reporting\Overviewreport.srd">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="Reporting\DependencyReport - Kopie.srd" />
</ItemGroup>
<ItemGroup>
<Folder Include="Engine\Dom" />
@ -172,10 +173,9 @@ @@ -172,10 +173,9 @@
<Name>ICSharpCode.SharpDevelop.Widgets</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\Misc\Reports\ICSharpCode.Reports.Core\ICSharpCode.Reports.Core.csproj">
<Project>{7C3579BC-2A64-4108-82B5-3D07ADA079E7}</Project>
<Name>ICSharpCode.Reports.Core</Name>
<Private>False</Private>
<ProjectReference Include="..\..\Misc\Reporting\ICSharpCode.Reporting\ICSharpCode.Reporting.csproj">
<Project>{40CA84D4-ACFC-4646-9CDD-B87262D34093}</Project>
<Name>ICSharpCode.Reporting</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />

5
src/AddIns/Analysis/CodeQuality/Gui/MainView.xaml

@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:gui="clr-namespace:ICSharpCode.CodeQuality.Gui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:rep="clr-namespace:ICSharpCode.Reports.Core.WpfReportViewer;assembly=ICSharpCode.Reports.Core">
xmlns:reporting="clr-namespace:ICSharpCode.Reporting.WpfReportViewer;assembly=ICSharpCode.Reporting">
<DockPanel>
<ToolBar DockPanel.Dock="Top">
@ -40,8 +40,7 @@ @@ -40,8 +40,7 @@
x:Name="reportTab"
Visibility="Hidden">
<Grid>
<rep:WpfReportViewer
x:Name="viewer" />
<reporting:WpfReportViewer x:Name="viewer" />
</Grid>
</TabItem>
</TabControl>

8
src/AddIns/Analysis/CodeQuality/Gui/MainView.xaml.cs

@ -19,18 +19,13 @@ @@ -19,18 +19,13 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using ICSharpCode.Reporting.WpfReportViewer;
using ICSharpCode.CodeQuality.Engine;
using ICSharpCode.CodeQuality.Engine.Dom;
using ICSharpCode.CodeQuality.Reporting;
using ICSharpCode.Reports.Core.WpfReportViewer;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Project;
using Microsoft.Win32;
@ -125,6 +120,7 @@ namespace ICSharpCode.CodeQuality.Gui @@ -125,6 +120,7 @@ namespace ICSharpCode.CodeQuality.Gui
var previewViewModel = new PreviewViewModel(dependencyReport.ReportSettings,reportCreator.Pages);
viewer.SetBinding(previewViewModel);
ActivateReportTab();
}
void ActivateReportTab()

4
src/AddIns/Analysis/CodeQuality/Reporting/BaseReport.cs

@ -18,10 +18,8 @@ @@ -18,10 +18,8 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using ICSharpCode.Reporting.Items;
using ICSharpCode.Reports.Core;
namespace ICSharpCode.CodeQuality.Reporting
{

308
src/AddIns/Analysis/CodeQuality/Reporting/DependencyReport - Kopie.srd

@ -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>

33
src/AddIns/Analysis/CodeQuality/Reporting/DependencyReport.cs

@ -19,10 +19,13 @@ @@ -19,10 +19,13 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Reflection;
using ICSharpCode.Reporting;
using ICSharpCode.Reporting.Interfaces;
using ICSharpCode.Reporting.Items;
using ICSharpCode.CodeQuality.Engine.Dom;
using ICSharpCode.Reports.Core;
namespace ICSharpCode.CodeQuality.Reporting
{
@ -31,7 +34,7 @@ namespace ICSharpCode.CodeQuality.Reporting @@ -31,7 +34,7 @@ namespace ICSharpCode.CodeQuality.Reporting
/// </summary>
public class DependencyReport:BaseReport
{
private const string overviewReport = "DependencyReport.srd";
const string overviewReport = "DependencyReport.srd";
public DependencyReport(List<string> fileNames):base(fileNames)
{
@ -39,26 +42,28 @@ namespace ICSharpCode.CodeQuality.Reporting @@ -39,26 +42,28 @@ namespace ICSharpCode.CodeQuality.Reporting
public IReportCreator Run(ReadOnlyCollection<AssemblyNode> list)
{
System.Reflection.Assembly asm = Assembly.GetExecutingAssembly();
System.IO.Stream stream = asm.GetManifestResourceStream("ICSharpCode.CodeQuality.Reporting.DependencyReport.srd");
var model = ReportEngine.LoadReportModel(stream);
ReportSettings = model.ReportSettings;
var newList = MakeList (list);
IReportCreator creator = ReportEngine.CreatePageBuilder(model,newList,null);
creator.BuildExportList();
return creator;
var asm = Assembly.GetExecutingAssembly();
var stream = asm.GetManifestResourceStream("ICSharpCode.CodeQuality.Reporting.DependencyReport.srd");
var reportingFactory = new ReportingFactory();
var reportCreator = reportingFactory.ReportCreator (stream,newList);
ReportSettings = reportingFactory.ReportModel.ReportSettings;
var groupColumn = (GroupColumn)ReportSettings.GroupColumnsCollection[0];
groupColumn.GroupSortColumn = new SortColumn() {
ColumnName = "ReferenceCount",
SortDirection = ListSortDirection.Ascending
};
reportCreator.BuildExportList();
return reportCreator;
}
private List <DependencyViewModel> MakeList (ReadOnlyCollection<AssemblyNode> list)
List <DependencyViewModel> MakeList (ReadOnlyCollection<AssemblyNode> list)
{
var newList = new List<DependencyViewModel>();
foreach (var baseNode in list) {
foreach (var element in list) {
if (baseNode.Name != element.Name) {
var referenceCount = baseNode.GetUses(element);
if (referenceCount > 0) {
newList.Add(new DependencyViewModel()
@ -76,7 +81,7 @@ namespace ICSharpCode.CodeQuality.Reporting @@ -76,7 +81,7 @@ namespace ICSharpCode.CodeQuality.Reporting
}
internal class DependencyViewModel:ReportViewModel
class DependencyViewModel:ReportViewModel
{
public DependencyViewModel()
{

46
src/AddIns/Analysis/CodeQuality/Reporting/DependencyReport.srd

@ -17,6 +17,7 @@ @@ -17,6 +17,7 @@
<GroupColumnsCollection>
<GroupColumn>
<SortDirection>Ascending</SortDirection>
<CaseSensitive>False</CaseSensitive>
<ColumnName>Name</ColumnName>
<DataTypeName>System.String</DataTypeName>
</GroupColumn>
@ -37,7 +38,6 @@ @@ -37,7 +38,6 @@
<Location>50, 50</Location>
<Size>727, 60</Size>
<BackColor>White</BackColor>
<VisibleInReport>False</VisibleInReport>
<SectionOffset>0</SectionOffset>
<SectionMargin>0</SectionMargin>
<DrawBorder>False</DrawBorder>
@ -47,7 +47,6 @@ @@ -47,7 +47,6 @@
<Location>157, 3</Location>
<Size>414, 40</Size>
<BackColor>White</BackColor>
<VisibleInReport>True</VisibleInReport>
<Font>Segoe UI, 18pt, style=Bold</Font>
<StringTrimming>None</StringTrimming>
<ContentAlignment>TopLeft</ContentAlignment>
@ -68,7 +67,6 @@ @@ -68,7 +67,6 @@
<Location>50, 125</Location>
<Size>727, 69</Size>
<BackColor>White</BackColor>
<VisibleInReport>False</VisibleInReport>
<SectionOffset>0</SectionOffset>
<SectionMargin>0</SectionMargin>
<DrawBorder>False</DrawBorder>
@ -78,7 +76,6 @@ @@ -78,7 +76,6 @@
<Location>22, 47</Location>
<Size>660, 10</Size>
<BackColor>White</BackColor>
<VisibleInReport>True</VisibleInReport>
<ForeColor>Black</ForeColor>
<FromPoint>10, 5</FromPoint>
<ToPoint>647, 5</ToPoint>
@ -93,7 +90,6 @@ @@ -93,7 +90,6 @@
<Location>222, 3</Location>
<Size>257, 26</Size>
<BackColor>White</BackColor>
<VisibleInReport>True</VisibleInReport>
<Font>Microsoft Sans Serif, 15.75pt</Font>
<StringTrimming>None</StringTrimming>
<ContentAlignment>TopLeft</ContentAlignment>
@ -111,14 +107,15 @@ @@ -111,14 +107,15 @@
<Location>563, 3</Location>
<Size>100, 26</Size>
<BackColor>White</BackColor>
<VisibleInReport>True</VisibleInReport>
<Font>Segoe UI, 15.75pt</Font>
<FormatString>dd/MM/yyyy</FormatString>
<StringTrimming>None</StringTrimming>
<ContentAlignment>TopLeft</ContentAlignment>
<CanGrow>False</CanGrow>
<CanShrink>False</CanShrink>
<DataType>System.DateTime</DataType>
<RTL>No</RTL>
<Text>=Today()</Text>
<Text>=Today</Text>
<DrawBorder>False</DrawBorder>
<FrameColor>Black</FrameColor>
<ForeColor>ControlText</ForeColor>
@ -132,26 +129,15 @@ @@ -132,26 +129,15 @@
<Location>50, 209</Location>
<Size>727, 115</Size>
<BackColor>White</BackColor>
<VisibleInReport>False</VisibleInReport>
<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>
<VisibleInReport>True</VisibleInReport>
<DrawBorder>False</DrawBorder>
<ForeColor>Black</ForeColor>
<FrameColor>Black</FrameColor>
<Items>
<BaseDataItem>
<Location>443, 4</Location>
<Location>445, 72</Location>
<Size>71, 20</Size>
<BackColor>White</BackColor>
<VisibleInReport>True</VisibleInReport>
<Font>Segoe UI, 9pt</Font>
<StringTrimming>None</StringTrimming>
<ContentAlignment>MiddleRight</ContentAlignment>
@ -166,10 +152,9 @@ @@ -166,10 +152,9 @@
<Name>BaseDataItem2147483646</Name>
</BaseDataItem>
<BaseDataItem>
<Location>254, 4</Location>
<Location>256, 72</Location>
<Size>156, 20</Size>
<BackColor>White</BackColor>
<VisibleInReport>True</VisibleInReport>
<Font>Microsoft Sans Serif, 10pt</Font>
<StringTrimming>None</StringTrimming>
<ContentAlignment>TopLeft</ContentAlignment>
@ -183,16 +168,10 @@ @@ -183,16 +168,10 @@
<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>
<VisibleInReport>True</VisibleInReport>
<DrawBorder>False</DrawBorder>
<ForeColor>Black</ForeColor>
<FrameColor>Black</FrameColor>
@ -201,7 +180,6 @@ @@ -201,7 +180,6 @@
<Location>414, 7</Location>
<Size>100, 20</Size>
<BackColor>White</BackColor>
<VisibleInReport>True</VisibleInReport>
<Font>Segoe UI, 9.75pt</Font>
<StringTrimming>None</StringTrimming>
<ContentAlignment>MiddleRight</ContentAlignment>
@ -218,7 +196,6 @@ @@ -218,7 +196,6 @@
<Location>254, 2</Location>
<Size>100, 20</Size>
<BackColor>White</BackColor>
<VisibleInReport>True</VisibleInReport>
<Font>Microsoft Sans Serif, 10pt</Font>
<StringTrimming>None</StringTrimming>
<ContentAlignment>TopLeft</ContentAlignment>
@ -235,7 +212,6 @@ @@ -235,7 +212,6 @@
<Location>12, 3</Location>
<Size>211, 20</Size>
<BackColor>White</BackColor>
<VisibleInReport>True</VisibleInReport>
<Font>Microsoft Sans Serif, 10pt</Font>
<StringTrimming>None</StringTrimming>
<ContentAlignment>TopLeft</ContentAlignment>
@ -263,7 +239,6 @@ @@ -263,7 +239,6 @@
<Location>50, 339</Location>
<Size>727, 36</Size>
<BackColor>White</BackColor>
<VisibleInReport>False</VisibleInReport>
<SectionOffset>0</SectionOffset>
<SectionMargin>0</SectionMargin>
<DrawBorder>False</DrawBorder>
@ -271,9 +246,8 @@ @@ -271,9 +246,8 @@
<Items>
<BaseTextItem>
<Location>31, 5</Location>
<Size>555, 20</Size>
<Size>365, 20</Size>
<BackColor>White</BackColor>
<VisibleInReport>True</VisibleInReport>
<Font>Segoe UI, 9.75pt</Font>
<StringTrimming>None</StringTrimming>
<ContentAlignment>TopLeft</ContentAlignment>
@ -287,10 +261,9 @@ @@ -287,10 +261,9 @@
<Name>BaseTextItem2147483641</Name>
</BaseTextItem>
<BaseTextItem>
<Location>624, 5</Location>
<Size>100, 20</Size>
<Location>526, 5</Location>
<Size>198, 20</Size>
<BackColor>White</BackColor>
<VisibleInReport>True</VisibleInReport>
<Font>Microsoft Sans Serif, 10pt</Font>
<StringTrimming>None</StringTrimming>
<ContentAlignment>TopLeft</ContentAlignment>
@ -312,7 +285,6 @@ @@ -312,7 +285,6 @@
<Location>50, 390</Location>
<Size>727, 60</Size>
<BackColor>White</BackColor>
<VisibleInReport>False</VisibleInReport>
<SectionOffset>0</SectionOffset>
<SectionMargin>0</SectionMargin>
<DrawBorder>False</DrawBorder>

75
src/AddIns/Analysis/CodeQuality/Reporting/OverviewReport.cs

@ -23,9 +23,11 @@ using System.IO; @@ -23,9 +23,11 @@ using System.IO;
using System.Linq;
using System.Reflection;
using ICSharpCode.CodeQuality.Engine.Dom;
using ICSharpCode.NRefactory.Utils;
using ICSharpCode.Reports.Core;
using ICSharpCode.Reporting;
using ICSharpCode.Reporting.Interfaces;
using ICSharpCode.Reporting.Items;
using ICSharpCode.CodeQuality.Engine.Dom;
namespace ICSharpCode.CodeQuality.Reporting
{
@ -35,6 +37,7 @@ namespace ICSharpCode.CodeQuality.Reporting @@ -35,6 +37,7 @@ namespace ICSharpCode.CodeQuality.Reporting
public class OverviewReport:BaseReport
{
private const string overviewReport = "OverviewReport.srd";
ReadOnlyCollection<AssemblyNode> list;
public OverviewReport(List<string> fileNames):base(fileNames)
{
@ -42,27 +45,69 @@ namespace ICSharpCode.CodeQuality.Reporting @@ -42,27 +45,69 @@ namespace ICSharpCode.CodeQuality.Reporting
public IReportCreator Run(ReadOnlyCollection<AssemblyNode> list)
{
System.Reflection.Assembly asm = Assembly.GetExecutingAssembly();
System.IO.Stream stream = asm.GetManifestResourceStream("ICSharpCode.CodeQuality.Reporting.Overviewreport.srd");
var model = ReportEngine.LoadReportModel(stream);
ReportSettings = model.ReportSettings;
this.list = list;
var asm = Assembly.GetExecutingAssembly();
var stream = asm.GetManifestResourceStream("ICSharpCode.CodeQuality.Reporting.Overviewreport.srd");
var viewModelList = CreateViewModel(list);
var reportingFactory = new ReportingFactory();
var reportCreator = reportingFactory.ReportCreator (stream,viewModelList);
ReportSettings = reportingFactory.ReportModel.ReportSettings;
// var reportParameters = new ParameterCollection();
// reportParameters.Add(new BasicParameter ("param1",base.FileNames[0]));
// reportParameters.Add(new BasicParameter ("param2",list.Count.ToString()));
//
// ReportSettings.ParameterCollection.AddRange(reportParameters);
reportCreator.SectionRendering += HandleSectionEvents;
reportCreator.BuildExportList();
return reportCreator;
}
static IEnumerable<OverviewViewModel> CreateViewModel(ReadOnlyCollection<AssemblyNode> list)
{
var newList = from c in list
select new OverviewViewModel {
Node = c
};
return newList;
}
void HandleSectionEvents(object sender, SectionEventArgs e)
{
var sectionName = e.Section.Name;
if (sectionName == ReportSectionNames.ReportHeader) {
var param1 = (BaseTextItem)e.Section.Items.FirstOrDefault(n => n.Name == "Param1");
// FileInfo fi =new FileInfo(FileNames[0]);
// var s = fi..Directory + fi.Name;
param1.Text = FileNames[0];
var param2 = (BaseTextItem)e.Section.Items.FirstOrDefault(n => n.Name == "Param2");
param2.Text = list.Count.ToString();
}
var r = from c in list
select new OverviewViewModel { Node = c};
else if (sectionName == ReportSectionNames.ReportPageHeader) {
Console.WriteLine("PushPrinting :" +ReportSectionNames .ReportPageHeader);
}
var p = new ReportParameters();
p.Parameters.Add(new BasicParameter ("param1",base.FileNames[0]));
p.Parameters.Add(new BasicParameter ("param2",list.Count.ToString()));
else if (sectionName == ReportSectionNames.ReportDetail){
// Console.WriteLine("PushPrinting :" + ReportSectionNames.ReportDetail);
}
IReportCreator creator = ReportEngine.CreatePageBuilder(model,r.ToList(),p);
creator.BuildExportList();
return creator;
else if (sectionName == ReportSectionNames.ReportPageFooter){
// Console.WriteLine("PushPrinting :" + ReportSectionNames.ReportPageFooter);
}
else if (sectionName == ReportSectionNames.ReportFooter){
// Console.WriteLine("PushPrinting :" + ReportSectionNames.ReportFooter);
}
}
}
internal class OverviewViewModel:ReportViewModel
class OverviewViewModel:ReportViewModel
{
public OverviewViewModel ()
{

55
src/AddIns/Analysis/CodeQuality/Reporting/Overviewreport.srd

@ -15,15 +15,7 @@ @@ -15,15 +15,7 @@
<AvailableFieldsCollection />
<SortColumnsCollection />
<GroupColumnsCollection />
<ParameterCollection>
<BasicParameter>
<ParameterName>param1</ParameterName>
<Type>System.String</Type>
</BasicParameter>
<BasicParameter>
<ParameterName>param2</ParameterName>
</BasicParameter>
</ParameterCollection>
<ParameterCollection />
<SqlParameters />
<ConnectionString />
<CommandText />
@ -39,7 +31,6 @@ @@ -39,7 +31,6 @@
<Location>50, 50</Location>
<Size>727, 168</Size>
<BackColor>White</BackColor>
<VisibleInReport>False</VisibleInReport>
<SectionOffset>0</SectionOffset>
<SectionMargin>0</SectionMargin>
<DrawBorder>False</DrawBorder>
@ -49,7 +40,6 @@ @@ -49,7 +40,6 @@
<Location>122, 13</Location>
<Size>414, 40</Size>
<BackColor>White</BackColor>
<VisibleInReport>True</VisibleInReport>
<Font>Segoe UI, 18pt, style=Bold</Font>
<StringTrimming>None</StringTrimming>
<ContentAlignment>TopLeft</ContentAlignment>
@ -64,16 +54,17 @@ @@ -64,16 +54,17 @@
</BaseTextItem>
<BaseTextItem>
<Location>601, 59</Location>
<Size>100, 26</Size>
<Size>100, 34</Size>
<BackColor>White</BackColor>
<VisibleInReport>True</VisibleInReport>
<Font>Segoe UI, 15.75pt</Font>
<FormatString>dd/MM/yyyy</FormatString>
<StringTrimming>None</StringTrimming>
<ContentAlignment>TopLeft</ContentAlignment>
<CanGrow>False</CanGrow>
<CanShrink>False</CanShrink>
<DataType>System.DateTime</DataType>
<RTL>No</RTL>
<Text>=Today()</Text>
<Text>=Today</Text>
<DrawBorder>False</DrawBorder>
<FrameColor>Black</FrameColor>
<ForeColor>ControlText</ForeColor>
@ -83,7 +74,6 @@ @@ -83,7 +74,6 @@
<Location>12, 145</Location>
<Size>680, 10</Size>
<BackColor>White</BackColor>
<VisibleInReport>True</VisibleInReport>
<ForeColor>ControlText</ForeColor>
<FromPoint>10, 5</FromPoint>
<ToPoint>669, 6</ToPoint>
@ -98,24 +88,22 @@ @@ -98,24 +88,22 @@
<Location>139, 118</Location>
<Size>108, 20</Size>
<BackColor>White</BackColor>
<VisibleInReport>True</VisibleInReport>
<Font>Segoe UI, 9pt</Font>
<StringTrimming>None</StringTrimming>
<ContentAlignment>TopLeft</ContentAlignment>
<CanGrow>False</CanGrow>
<CanShrink>False</CanShrink>
<RTL>No</RTL>
<Text>=Parameters!param2</Text>
<Text>Parameters!param2</Text>
<DrawBorder>False</DrawBorder>
<FrameColor>Black</FrameColor>
<ForeColor>ControlText</ForeColor>
<Name>BaseTextItem2147483639</Name>
<Name>Param2</Name>
</BaseTextItem>
<BaseTextItem>
<Location>27, 118</Location>
<Size>106, 20</Size>
<BackColor>White</BackColor>
<VisibleInReport>True</VisibleInReport>
<Font>Segoe UI, 9pt</Font>
<StringTrimming>None</StringTrimming>
<ContentAlignment>TopLeft</ContentAlignment>
@ -130,16 +118,15 @@ @@ -130,16 +118,15 @@
</BaseTextItem>
<BaseTextItem>
<Location>139, 91</Location>
<Size>438, 20</Size>
<Size>377, 20</Size>
<BackColor>White</BackColor>
<VisibleInReport>True</VisibleInReport>
<Font>Segoe UI, 9pt</Font>
<StringTrimming>None</StringTrimming>
<ContentAlignment>TopLeft</ContentAlignment>
<CanGrow>False</CanGrow>
<CanGrow>True</CanGrow>
<CanShrink>False</CanShrink>
<RTL>No</RTL>
<Text>=Parameters!param1</Text>
<Text>Parameters!param1</Text>
<DrawBorder>False</DrawBorder>
<FrameColor>Black</FrameColor>
<ForeColor>ControlText</ForeColor>
@ -149,7 +136,6 @@ @@ -149,7 +136,6 @@
<Location>27, 91</Location>
<Size>106, 20</Size>
<BackColor>White</BackColor>
<VisibleInReport>True</VisibleInReport>
<Font>Segoe UI, 9pt</Font>
<StringTrimming>None</StringTrimming>
<ContentAlignment>TopLeft</ContentAlignment>
@ -166,7 +152,6 @@ @@ -166,7 +152,6 @@
<Location>195, 59</Location>
<Size>257, 26</Size>
<BackColor>White</BackColor>
<VisibleInReport>True</VisibleInReport>
<Font>Microsoft Sans Serif, 15.75pt</Font>
<StringTrimming>None</StringTrimming>
<ContentAlignment>TopLeft</ContentAlignment>
@ -188,7 +173,6 @@ @@ -188,7 +173,6 @@
<Location>50, 233</Location>
<Size>727, 60</Size>
<BackColor>White</BackColor>
<VisibleInReport>False</VisibleInReport>
<SectionOffset>0</SectionOffset>
<SectionMargin>0</SectionMargin>
<DrawBorder>False</DrawBorder>
@ -198,7 +182,6 @@ @@ -198,7 +182,6 @@
<Location>14, 16</Location>
<Size>658, 30</Size>
<BackColor>LightGray</BackColor>
<VisibleInReport>True</VisibleInReport>
<DrawBorder>False</DrawBorder>
<ForeColor>ControlText</ForeColor>
<FrameColor>Black</FrameColor>
@ -207,7 +190,6 @@ @@ -207,7 +190,6 @@
<Location>571, 7</Location>
<Size>41, 20</Size>
<BackColor>White</BackColor>
<VisibleInReport>True</VisibleInReport>
<Font>Segoe UI, 9pt</Font>
<StringTrimming>None</StringTrimming>
<ContentAlignment>MiddleRight</ContentAlignment>
@ -224,7 +206,6 @@ @@ -224,7 +206,6 @@
<Location>501, 7</Location>
<Size>53, 20</Size>
<BackColor>White</BackColor>
<VisibleInReport>True</VisibleInReport>
<Font>Segoe UI, 9pt</Font>
<StringTrimming>None</StringTrimming>
<ContentAlignment>MiddleRight</ContentAlignment>
@ -241,7 +222,6 @@ @@ -241,7 +222,6 @@
<Location>425, 7</Location>
<Size>55, 20</Size>
<BackColor>White</BackColor>
<VisibleInReport>True</VisibleInReport>
<Font>Segoe UI, 9pt</Font>
<StringTrimming>None</StringTrimming>
<ContentAlignment>MiddleRight</ContentAlignment>
@ -258,7 +238,6 @@ @@ -258,7 +238,6 @@
<Location>347, 7</Location>
<Size>52, 20</Size>
<BackColor>White</BackColor>
<VisibleInReport>True</VisibleInReport>
<Font>Segoe UI, 9pt</Font>
<StringTrimming>None</StringTrimming>
<ContentAlignment>MiddleRight</ContentAlignment>
@ -275,7 +254,6 @@ @@ -275,7 +254,6 @@
<Location>267, 7</Location>
<Size>55, 20</Size>
<BackColor>White</BackColor>
<VisibleInReport>True</VisibleInReport>
<Font>Segoe UI, 9pt</Font>
<StringTrimming>None</StringTrimming>
<ContentAlignment>MiddleRight</ContentAlignment>
@ -292,7 +270,6 @@ @@ -292,7 +270,6 @@
<Location>4, 7</Location>
<Size>100, 20</Size>
<BackColor>White</BackColor>
<VisibleInReport>True</VisibleInReport>
<Font>Segoe UI, 9pt</Font>
<StringTrimming>None</StringTrimming>
<ContentAlignment>TopLeft</ContentAlignment>
@ -318,7 +295,6 @@ @@ -318,7 +295,6 @@
<Location>50, 308</Location>
<Size>727, 60</Size>
<BackColor>White</BackColor>
<VisibleInReport>False</VisibleInReport>
<SectionOffset>0</SectionOffset>
<SectionMargin>0</SectionMargin>
<DrawBorder>False</DrawBorder>
@ -328,7 +304,6 @@ @@ -328,7 +304,6 @@
<Location>14, 14</Location>
<Size>658, 30</Size>
<BackColor>White</BackColor>
<VisibleInReport>True</VisibleInReport>
<DrawBorder>False</DrawBorder>
<ForeColor>Black</ForeColor>
<FrameColor>Black</FrameColor>
@ -337,7 +312,6 @@ @@ -337,7 +312,6 @@
<Location>571, 3</Location>
<Size>41, 20</Size>
<BackColor>White</BackColor>
<VisibleInReport>True</VisibleInReport>
<Font>Segoe UI, 9pt</Font>
<StringTrimming>None</StringTrimming>
<ContentAlignment>MiddleRight</ContentAlignment>
@ -355,7 +329,6 @@ @@ -355,7 +329,6 @@
<Location>501, 3</Location>
<Size>53, 20</Size>
<BackColor>White</BackColor>
<VisibleInReport>True</VisibleInReport>
<Font>Segoe UI, 9pt</Font>
<StringTrimming>None</StringTrimming>
<ContentAlignment>MiddleRight</ContentAlignment>
@ -373,7 +346,6 @@ @@ -373,7 +346,6 @@
<Location>425, 3</Location>
<Size>55, 20</Size>
<BackColor>White</BackColor>
<VisibleInReport>True</VisibleInReport>
<Font>Segoe UI, 9pt</Font>
<StringTrimming>None</StringTrimming>
<ContentAlignment>MiddleRight</ContentAlignment>
@ -391,7 +363,6 @@ @@ -391,7 +363,6 @@
<Location>347, 3</Location>
<Size>52, 20</Size>
<BackColor>White</BackColor>
<VisibleInReport>True</VisibleInReport>
<Font>Segoe UI, 9pt</Font>
<StringTrimming>None</StringTrimming>
<ContentAlignment>MiddleRight</ContentAlignment>
@ -409,7 +380,6 @@ @@ -409,7 +380,6 @@
<Location>268, 3</Location>
<Size>54, 20</Size>
<BackColor>White</BackColor>
<VisibleInReport>True</VisibleInReport>
<Font>Segoe UI, 9pt</Font>
<FormatString>0</FormatString>
<StringTrimming>None</StringTrimming>
@ -429,7 +399,6 @@ @@ -429,7 +399,6 @@
<Location>4, 3</Location>
<Size>258, 20</Size>
<BackColor>White</BackColor>
<VisibleInReport>True</VisibleInReport>
<Font>Microsoft Sans Serif, 10pt</Font>
<StringTrimming>None</StringTrimming>
<ContentAlignment>TopLeft</ContentAlignment>
@ -456,7 +425,6 @@ @@ -456,7 +425,6 @@
<Location>50, 383</Location>
<Size>727, 37</Size>
<BackColor>White</BackColor>
<VisibleInReport>False</VisibleInReport>
<SectionOffset>0</SectionOffset>
<SectionMargin>0</SectionMargin>
<DrawBorder>False</DrawBorder>
@ -466,7 +434,6 @@ @@ -466,7 +434,6 @@
<Location>14, 3</Location>
<Size>573, 20</Size>
<BackColor>White</BackColor>
<VisibleInReport>True</VisibleInReport>
<Font>Segoe UI, 9.75pt</Font>
<StringTrimming>None</StringTrimming>
<ContentAlignment>TopLeft</ContentAlignment>
@ -483,7 +450,6 @@ @@ -483,7 +450,6 @@
<Location>614, 3</Location>
<Size>100, 20</Size>
<BackColor>White</BackColor>
<VisibleInReport>True</VisibleInReport>
<Font>Microsoft Sans Serif, 10pt</Font>
<StringTrimming>None</StringTrimming>
<ContentAlignment>TopLeft</ContentAlignment>
@ -505,7 +471,6 @@ @@ -505,7 +471,6 @@
<Location>50, 435</Location>
<Size>727, 60</Size>
<BackColor>White</BackColor>
<VisibleInReport>False</VisibleInReport>
<SectionOffset>0</SectionOffset>
<SectionMargin>0</SectionMargin>
<DrawBorder>False</DrawBorder>

2
src/AddIns/DisplayBindings/Data/ICSharpCode.Data.SQLServer/SQLServerDatabaseDriver.cs

@ -154,7 +154,9 @@ namespace ICSharpCode.Data.Core.DatabaseDrivers.SQLServer @@ -154,7 +154,9 @@ namespace ICSharpCode.Data.Core.DatabaseDrivers.SQLServer
public override string ODBCProviderName
{
// SqlServer 2012
get { return "SQLNCLI10.1"; }
// get { return "SQLNCLI11.0"; }
}
public override void PopulateDatasources()

36
src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/Commands/ViewCommands.cs

@ -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;}
}
}

16
src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/Configuration/AssemblyInfo.cs

@ -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("")]

64
src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/DesignerBinding/DesignerBinding.cs

@ -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;
}
}
}

19
src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/EmptyReport.xft

@ -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>

100
src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/ICSharpCode.Reporting.Addin.csproj

@ -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>

181
src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/ICSharpCode.Reporting.addin

@ -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>

87
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/ICSharpCode.Reporting.csproj

@ -44,6 +44,15 @@ @@ -44,6 +44,15 @@
<DefineConstants>TRACE</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Reference Include="Irony">
<HintPath>..\Libraries\Irony.dll</HintPath>
</Reference>
<Reference Include="Irony.Interpreter">
<HintPath>..\Libraries\Irony.Interpreter.dll</HintPath>
</Reference>
<Reference Include="PdfSharp">
<HintPath>..\Libraries\PdfSharp.dll</HintPath>
</Reference>
<Reference Include="PresentationCore">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
@ -54,6 +63,7 @@ @@ -54,6 +63,7 @@
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Presentation">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
@ -70,16 +80,18 @@ @@ -70,16 +80,18 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\..\..\Main\GlobalAssemblyInfo.cs">
<Link>Src\Configuration\GlobalAssemblyInfo.cs</Link>
</Compile>
<Compile Include="Src\Arrange\ArrangeStrategy.cs" />
<Compile Include="Src\Arrange\MeasurementStrategy.cs" />
<Compile Include="Src\BaseClasses\AbstractColumn.cs" />
<Compile Include="Src\BaseClasses\GroupColumn.cs" />
<Compile Include="Src\BaseClasses\Page.cs" />
<Compile Include="Src\BaseClasses\BasicParameter.cs" />
<Compile Include="Src\BaseClasses\ExtensionMethods.cs" />
<Compile Include="Src\BaseClasses\PageInfo.cs" />
<Compile Include="Src\BaseClasses\SortColumn.cs" />
<Compile Include="Src\Collections.cs" />
<Compile Include="Src\Configuration\AssemblyInfo.cs" />
<Compile Include="Src\DataManager\Listhandling\CollectionSource.cs" />
<Compile Include="Src\DataManager\Listhandling\CollectionDataSource.cs" />
<Compile Include="Src\DataManager\Listhandling\IndexList.cs" />
<Compile Include="Src\DataSource\Comparer\BaseComparer.cs" />
<Compile Include="Src\DataSource\Comparer\GroupComparer.cs" />
@ -88,22 +100,39 @@ @@ -88,22 +100,39 @@
<Compile Include="Src\DataSource\DataCollection.cs" />
<Compile Include="Src\DataSource\ExtendedPropertyDescriptor.cs" />
<Compile Include="Src\DataSource\ExtendedTypeDescriptor.cs" />
<Compile Include="Src\DataSource\FieldMemberAccessor.cs" />
<Compile Include="Src\DataSource\PropertyMemberAccessore.cs" />
<Compile Include="Src\DataSource\PropertyPath.cs" />
<Compile Include="Src\DataSource\PropertyTypeHash.cs" />
<Compile Include="Src\DataSource\ReflectionExtension.cs" />
<Compile Include="Src\Events\SectionEvent.cs" />
<Compile Include="Src\Exporter\BaseExporter.cs" />
<Compile Include="Src\Exporter\DebugExporter.cs" />
<Compile Include="Src\Exporter\WpfExporter.cs" />
<Compile Include="Src\Exporter\Visitors\ExpressionVisitor.cs" />
<Compile Include="Src\Exporter\Visitors\FormatVisitor.cs" />
<Compile Include="Src\Exporter\Visitors\AbstractVisitor.cs" />
<Compile Include="Src\Exporter\Visitors\IAcceptor.cs" />
<Compile Include="Src\Exporter\Visitors\IVisitor.cs" />
<Compile Include="Src\Exporter\Visitors\DebugVisitor.cs" />
<Compile Include="Src\Exporter\Visitors\WpfVisitor.cs" />
<Compile Include="Src\ExportRenderer\FixedDocumentCreator.cs" />
<Compile Include="Src\Expressions\ExpressionHelper.cs" />
<Compile Include="Src\Expressions\ExpressionRunner.cs" />
<Compile Include="Src\Expressions\Irony\Ast\AstExtensions.cs" />
<Compile Include="Src\Expressions\Irony\Ast\FieldsNode.cs" />
<Compile Include="Src\Expressions\Irony\Ast\GlobalsNode.cs" />
<Compile Include="Src\Expressions\Irony\Ast\ParametersCallNode.cs" />
<Compile Include="Src\Expressions\Irony\ExpressionEvaluator.cs" />
<Compile Include="Src\Expressions\Irony\Imports\ImportAggregates.cs" />
<Compile Include="Src\Expressions\Irony\ReportingLanguageGrammer.cs" />
<Compile Include="Src\Expressions\Irony\ReportingLanguageRuntime.cs" />
<Compile Include="Src\Expressions\TypeNormalizer.cs" />
<Compile Include="Src\Factories\ExportColumnFactory.cs" />
<Compile Include="Src\Factories\ReportCreatorFactory.cs" />
<Compile Include="Src\Factories\SectionFactory.cs" />
<Compile Include="Src\Globals\CreateGraphics.cs" />
<Compile Include="Src\Globals\MeasurementService.cs" />
<Compile Include="Src\Interfaces\Data\IDataViewHandling.cs" />
<Compile Include="Src\Globals\StandardFormatter.cs" />
<Compile Include="Src\Globals\StringHelper.cs" />
<Compile Include="Src\Globals\TypeHelper.cs" />
<Compile Include="Src\Interfaces\Data\IDataSource.cs" />
<Compile Include="Src\Interfaces\Export\IExportColumn.cs" />
<Compile Include="Src\Interfaces\Export\IExportContainer.cs" />
<Compile Include="Src\Interfaces\Export\IPage.cs" />
@ -113,24 +142,47 @@ @@ -113,24 +142,47 @@
<Compile Include="Src\Interfaces\IReportContainer.cs" />
<Compile Include="Src\Interfaces\IReportCreator.cs" />
<Compile Include="Src\Items\BaseDataItem.cs" />
<Compile Include="Src\Items\BaseRowItem.cs" />
<Compile Include="Src\Items\BaseSection.cs" />
<Compile Include="Src\Globals\GlobalEnums.cs" />
<Compile Include="Src\Globals\GlobalValues.cs" />
<Compile Include="Src\Interfaces\IReportModel.cs" />
<Compile Include="Src\Items\BaseTextItem.cs" />
<Compile Include="Src\Items\Graphics\BaseCircleItem.cs" />
<Compile Include="Src\Items\Graphics\BaseGraphics.cs" />
<Compile Include="Src\Items\Graphics\BaseLineItem.cs" />
<Compile Include="Src\Items\Graphics\BaseRectangleItem.cs" />
<Compile Include="Src\Items\GroupColumn.cs" />
<Compile Include="Src\Items\PrintableItem.cs" />
<Compile Include="Src\Items\ReportContainer.cs" />
<Compile Include="Src\Items\ReportModel.cs" />
<Compile Include="Src\Items\ReportSettings.cs" />
<Compile Include="Src\Items\SortColumn.cs" />
<Compile Include="Src\PageBuilder\BasePageBuilder.cs" />
<Compile Include="Src\PageBuilder\Converter\ContainerConverter.cs" />
<Compile Include="Src\PageBuilder\Converter\IContainerConverter.cs" />
<Compile Include="Src\PageBuilder\DataPageBuilder.cs" />
<Compile Include="Src\PageBuilder\ExportColumns\ExportCircle.cs" />
<Compile Include="Src\PageBuilder\ExportColumns\ExportColumn.cs" />
<Compile Include="Src\PageBuilder\ExportColumns\ExportContainer.cs" />
<Compile Include="Src\PageBuilder\ExportColumns\ExportLine.cs" />
<Compile Include="Src\PageBuilder\ExportColumns\ExportRectangle.cs" />
<Compile Include="Src\PageBuilder\ExportColumns\ExportText.cs" />
<Compile Include="Src\PageBuilder\ExportColumns\ExportPage.cs" />
<Compile Include="Src\PageBuilder\FormPageBuilder.cs" />
<Compile Include="Src\Pdf\PdfExporter.cs" />
<Compile Include="Src\Pdf\PdfExtensions.cs" />
<Compile Include="Src\Pdf\PdfHelper.cs" />
<Compile Include="Src\Pdf\PdfVisitor.cs" />
<Compile Include="Src\ReportingFactory.cs" />
<Compile Include="Src\ReportSectionNames.cs" />
<Compile Include="Src\Wpf\PreviewViewModel.cs" />
<Compile Include="Src\Wpf\Visitor\CanvasExtension.cs" />
<Compile Include="Src\Wpf\Visitor\CanvasHelper.cs" />
<Compile Include="Src\Wpf\Visitor\FixedDocumentCreator.cs" />
<Compile Include="Src\Wpf\Visitor\Graphics\ExtendedLine.cs" />
<Compile Include="Src\Wpf\Visitor\WpfExporter.cs" />
<Compile Include="Src\Wpf\Visitor\WpfVisitor.cs" />
<Compile Include="Src\Wpf\WpfReportViewer\WpfReportViewer.xaml.cs">
<DependentUpon>WpfReportViewer.xaml</DependentUpon>
<SubType>Code</SubType>
@ -141,6 +193,9 @@ @@ -141,6 +193,9 @@
<ItemGroup>
<Folder Include="Src\DataSource\Comparer" />
<Folder Include="Src\Exporter\Visitors" />
<Folder Include="Src\Expressions\Irony" />
<Folder Include="Src\Expressions\Irony\Ast" />
<Folder Include="Src\Expressions\Irony\Imports" />
<Folder Include="Src\Interfaces" />
<Folder Include="Src\Globals" />
<Folder Include="Src" />
@ -152,19 +207,31 @@ @@ -152,19 +207,31 @@
<Folder Include="Src\Factories" />
<Folder Include="Src\Exporter" />
<Folder Include="Src\Arrange" />
<Folder Include="Src\ExportRenderer" />
<Folder Include="Src\DataSource" />
<Folder Include="Src\DataManager" />
<Folder Include="Src\DataManager\Listhandling" />
<Folder Include="Src\Expressions" />
<Folder Include="Src\Items\Graphics" />
<Folder Include="Src\Events" />
<Folder Include="Src\Pdf" />
<Folder Include="Src\Wpf" />
<Folder Include="Src\PageBuilder" />
<Folder Include="Src\PageBuilder\Converter" />
<Folder Include="Src\PageBuilder\ExportColumns" />
<Folder Include="Src\Wpf\Visitor" />
<Folder Include="Src\Wpf\Visitor\Graphics" />
<Folder Include="Src\Wpf\WpfReportViewer" />
<Folder Include="Src\Xml" />
</ItemGroup>
<ItemGroup>
<Page Include="Src\Wpf\WpfReportViewer\WpfReportViewer.xaml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\Main\Core\Project\ICSharpCode.Core.csproj">
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project>
<Name>ICSharpCode.Core</Name>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

103
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Arrange/ArrangeStrategy.cs

@ -17,9 +17,10 @@ @@ -17,9 +17,10 @@
// DEALINGS IN THE SOFTWARE.
using System;
using System.Collections;
using System.Drawing;
using System.Linq;
using System.Collections.Generic;
using ICSharpCode.Reporting.Interfaces.Export;
namespace ICSharpCode.Reporting.Arrange
@ -36,58 +37,90 @@ namespace ICSharpCode.Reporting.Arrange @@ -36,58 +37,90 @@ namespace ICSharpCode.Reporting.Arrange
internal class ContainerArrangeStrategy:IArrangeStrategy
{
public ContainerArrangeStrategy()
{
}
public void Arrange(IExportColumn exportColumn)
{
public void Arrange(IExportColumn exportColumn){
if (exportColumn == null)
throw new ArgumentNullException("exportColumn");
var container = exportColumn as IExportContainer;
if ((container != null) && (container.ExportedItems.Count > 0)) {
List<IExportColumn> canGrowItems = CreateCanGrowList(container);
if (canGrowItems.Count > 0) {
var containerSize = ArrangeInternal(container);
if (containerSize.Height > container.DesiredSize.Height) {
container.DesiredSize = new Size(containerSize.Width,containerSize.Height);
}
}
}
}
static Size ArrangeInternal(IExportContainer container)
{
var containerRectangle = container.DisplayRectangle;
Rectangle elementRectangle = Rectangle.Empty;
FindBiggestRectangle(container);
var resizeable = from resize in container.ExportedItems
where ((resize.CanGrow == true))
select resize;
foreach (var element in container.ExportedItems) {
var con = element as IExportContainer;
if (con != null) {
var keep = containerRectangle;
con.DesiredSize = ArrangeInternal(con);
elementRectangle = AdujstRectangles(keep,con.DisplayRectangle);
containerRectangle = keep;
if (resizeable.Any()) {
if (!BiggestRectangle.IsEmpty) {
var containerRectangle = new Rectangle(container.Location,container.Size);
var desiredRectangle = Rectangle.Union(containerRectangle,BiggestRectangle);
container.DesiredSize = new Size(container.Size.Width,desiredRectangle.Size.Height + 5);
} else {
elementRectangle = AdujstRectangles(containerRectangle,element.DisplayRectangle);
}
if (!containerRectangle.Contains(elementRectangle)) {
containerRectangle = new Rectangle(containerRectangle.Left,
containerRectangle.Top ,
containerRectangle.Width,
element.Location.Y + elementRectangle.Size.Height + 5);
// containerRectangle = Rectangle.Union(containerRectangle,elementRectangle);
}
}
return containerRectangle.Size;
}
private void FindBiggestRectangle (IExportContainer container)
{
BiggestRectangle = Rectangle.Empty;
/*
foreach (var item in container.ExportedItems)
{
if (item.DesiredSize.Height > BiggestRectangle.Size.Height)
static Rectangle AdujstRectangles (Rectangle container,Rectangle element) {
return new Rectangle(container.Left + element.Left,
container.Top + element.Top,
element.Size.Width,
element.Size.Height);
}
static List<IExportColumn> CreateCanGrowList(IExportContainer container)
{
BiggestRectangle = new Rectangle(new Point(container.Location.X + item.Location.X,
container.Location.Y + item.Location.Y)
, item.DesiredSize);
var l1 = new List<IExportColumn>();
foreach (var element in container.Descendents()) {
if (element.CanGrow) {
l1.Add(element);
}
}
*/
foreach (var item in container.ExportedItems
.Where(item => item.DesiredSize.Height > BiggestRectangle.Size.Height))
{
BiggestRectangle = new Rectangle(new Point(container.Location.X + item.Location.X,
container.Location.Y + item.Location.Y)
,item.DesiredSize);
return l1;
}
}
public Rectangle BiggestRectangle {get; private set;}
}
static class Extensions {
public static IEnumerable<IExportColumn> Descendents(this IExportContainer node) {
if (node == null) throw new ArgumentNullException("node");
if(node.ExportedItems.Count > 0) {
foreach (var child in node.ExportedItems) {
var cont = child as IExportContainer;
if (cont != null) {
foreach (var desc in Descendents(cont)) {
yield return desc;
}
}
yield return child;
}
}
}
}
}

34
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Arrange/MeasurementStrategy.cs

@ -19,8 +19,8 @@ @@ -19,8 +19,8 @@
using System;
using System.Drawing;
using ICSharpCode.Reporting.Globals;
using ICSharpCode.Reporting.Interfaces;
using ICSharpCode.Reporting.Items;
using ICSharpCode.Reporting.Interfaces.Export;
using ICSharpCode.Reporting.PageBuilder.ExportColumns;
namespace ICSharpCode.Reporting.Arrange
{
@ -29,28 +29,38 @@ namespace ICSharpCode.Reporting.Arrange @@ -29,28 +29,38 @@ namespace ICSharpCode.Reporting.Arrange
/// </summary>
public interface IMeasurementStrategy
{
Size Measure(IPrintableObject reportItem,Graphics graphics);
Size Measure(IExportColumn exportColumn,Graphics graphics);
}
internal class ContainerMeasurementStrategy:IMeasurementStrategy
class ContainerMeasurementStrategy:IMeasurementStrategy
{
public ContainerMeasurementStrategy()
{
}
public Size Measure(IPrintableObject reportItem,Graphics graphics)
public Size Measure(IExportColumn exportColumn,Graphics graphics)
{
return reportItem.Size;
var items = ((ExportContainer)exportColumn).ExportedItems;
foreach (var element in items) {
if (element is IExportContainer) {
Measure(element,graphics);
}
var tbi = element as IExportText;
if (tbi != null) {
element.DesiredSize = MeasurementService.Measure(tbi,graphics);
}
}
exportColumn.DesiredSize = exportColumn.Size;
return exportColumn.DesiredSize;
}
}
internal class TextBasedMeasurementStrategy:IMeasurementStrategy
class TextBasedMeasurementStrategy:IMeasurementStrategy
{
public Size Measure(IPrintableObject reportItem, Graphics graphics)
public Size Measure(IExportColumn exportColumn, Graphics graphics)
{
return MeasurementService.Measure((ITextItem)reportItem,graphics);
return MeasurementService.Measure((IExportText)exportColumn,graphics);
}
}
}

40
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/BaseClasses/BasicParameter.cs

@ -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;}
}
}

110
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/BaseClasses/ExtensionMethods.cs

@ -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
}
}

135
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/BaseClasses/Page.cs

@ -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);
}
}
}
}

72
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Collections.cs

@ -27,15 +27,9 @@ using ICSharpCode.Reporting.Items; @@ -27,15 +27,9 @@ using ICSharpCode.Reporting.Items;
namespace ICSharpCode.Reporting
{
/// <summary>
/// Description of Collections.
/// </summary>
public class ColumnCollection: Collection<AbstractColumn>{
public ColumnCollection()
public class SortColumnCollection: Collection<AbstractColumn>
{
}
public AbstractColumn Find (string columnName)
{
@ -43,33 +37,22 @@ namespace ICSharpCode.Reporting @@ -43,33 +37,22 @@ namespace ICSharpCode.Reporting
throw new ArgumentNullException("columnName");
}
return this.FirstOrDefault(x => 0 == String.Compare(x.ColumnName,columnName,true,CultureInfo.InvariantCulture));
return this.FirstOrDefault(x => 0 == String.Compare(x.ColumnName,columnName,StringComparison.OrdinalIgnoreCase));
}
public void AddRange (IEnumerable<AbstractColumn> items)
public void AddRange (IEnumerable<SortColumn> items)
{
foreach (AbstractColumn item in items){
foreach (SortColumn item in items){
this.Add(item);
}
}
/// <summary>
/// The Culture is used for direct String Comparison
/// </summary>
public static CultureInfo Culture
{
get { return CultureInfo.CurrentCulture;}
}
}
public class SortColumnCollection: ColumnCollection
public class GroupColumnCollection: SortColumnCollection
{
public SortColumnCollection()
public GroupColumnCollection()
{
}
@ -79,49 +62,38 @@ namespace ICSharpCode.Reporting @@ -79,49 +62,38 @@ namespace ICSharpCode.Reporting
throw new ArgumentNullException("columnName");
}
return this.FirstOrDefault(x => 0 == String.Compare(x.ColumnName,columnName,true,CultureInfo.InvariantCulture));
}
public void AddRange (IEnumerable<SortColumn> items)
{
foreach (SortColumn item in items){
this.Add(item);
}
return this.FirstOrDefault(x => 0 == String.Compare(x.ColumnName,columnName,StringComparison.OrdinalIgnoreCase));
}
}
public class GroupColumnCollection: SortColumnCollection
{
public GroupColumnCollection()
{
}
public class ParameterCollection: Collection<BasicParameter>{
public new AbstractColumn Find (string columnName)
public ParameterCollection()
{
if (String.IsNullOrEmpty(columnName)) {
throw new ArgumentNullException("columnName");
}
return this.FirstOrDefault(x => 0 == String.Compare(x.ColumnName,columnName,true,CultureInfo.InvariantCulture));
public BasicParameter Find (string parameterName)
{
if (String.IsNullOrEmpty(parameterName)) {
throw new ArgumentNullException("parameterName");
}
return this.FirstOrDefault(x => 0 == String.Compare(x.ParameterName,parameterName,StringComparison.OrdinalIgnoreCase));
}
public class ReportItemCollection : Collection<PrintableItem>
public static CultureInfo Culture
{
// Trick to get the inner list as List<T> (InnerList always has that type because we only use
// the parameterless constructor on Collection<T>)
private List<PrintableItem> InnerList {
get { return (List<PrintableItem>)base.Items; }
get { return System.Globalization.CultureInfo.CurrentCulture; }
}
private void Sort(IComparer<PrintableItem> comparer)
public void AddRange (IEnumerable<BasicParameter> items)
{
InnerList.Sort(comparer);
foreach (BasicParameter item in items){
this.Add(item);
}
}
}
}

233
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataManager/Listhandling/CollectionDataSource.cs

@ -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;
}
}
}

416
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataManager/Listhandling/CollectionSource.cs

@ -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();
}
}
}

4
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataManager/Listhandling/IndexList.cs

@ -28,10 +28,6 @@ namespace ICSharpCode.Reporting.DataManager.Listhandling @@ -28,10 +28,6 @@ namespace ICSharpCode.Reporting.DataManager.Listhandling
public class IndexList :List<BaseComparer>
{
public IndexList()
{
}
public int CurrentPosition {get;set;}
}
}

2
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataSource/Comparer/GroupComparer.cs

@ -34,6 +34,6 @@ namespace ICSharpCode.Reporting.DataSource.Comparer @@ -34,6 +34,6 @@ namespace ICSharpCode.Reporting.DataSource.Comparer
IndexList = new IndexList();
}
public IndexList IndexList {get;set;}
public IndexList IndexList {get;private set;}
}
}

1
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataSource/Comparer/SortComparer.cs

@ -22,6 +22,7 @@ using System.ComponentModel; @@ -22,6 +22,7 @@ using System.ComponentModel;
using System.Globalization;
using ICSharpCode.Reporting.BaseClasses;
using ICSharpCode.Reporting.Items;
namespace ICSharpCode.Reporting.DataSource.Comparer
{

6
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataSource/DataCollection.cs

@ -30,7 +30,7 @@ namespace ICSharpCode.Reporting.DataSource @@ -30,7 +30,7 @@ namespace ICSharpCode.Reporting.DataSource
/// <summary>
/// Description of DataCollection.
/// </summary>
internal class DataCollection<T> : IList<T>,ITypedList
class DataCollection<T> : IList<T>,ITypedList
{
Collection<T> list = new Collection<T>();
Type elementType;
@ -89,7 +89,7 @@ namespace ICSharpCode.Reporting.DataSource @@ -89,7 +89,7 @@ namespace ICSharpCode.Reporting.DataSource
}
public void AddRange(IList range)
public void AddRange(IEnumerable range)
{
foreach(T t in range) {
Add(t);
@ -207,7 +207,7 @@ namespace ICSharpCode.Reporting.DataSource @@ -207,7 +207,7 @@ namespace ICSharpCode.Reporting.DataSource
}
[DebuggerStepThrough]
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return list.GetEnumerator();
}

2
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataSource/ExtendedPropertyDescriptor.cs

@ -26,7 +26,7 @@ namespace ICSharpCode.Reporting.DataSource @@ -26,7 +26,7 @@ namespace ICSharpCode.Reporting.DataSource
/// <summary>
/// Description of ExtendedPropertyDescriptor.
/// </summary>
internal class ExtendedPropertyDescriptor : PropertyDescriptor
class ExtendedPropertyDescriptor : PropertyDescriptor
{
Type componentType;

2
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataSource/ExtendedTypeDescriptor.cs

@ -26,7 +26,7 @@ namespace ICSharpCode.Reporting.DataSource @@ -26,7 +26,7 @@ namespace ICSharpCode.Reporting.DataSource
/// <summary>
/// Description of ExtendedTypeDescriptor.
/// </summary>
internal class ExtendedTypeDescriptor
class ExtendedTypeDescriptor
{
private static Hashtable collections = new Hashtable();

51
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataSource/FieldMemberAccessor.cs

@ -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;}
}
}
}

58
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataSource/PropertyMemberAccessore.cs

@ -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;}
}
}
}

104
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataSource/PropertyPath.cs

@ -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();
}
}
}

4
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataSource/PropertyTypeHash.cs

@ -24,7 +24,7 @@ namespace ICSharpCode.Reporting.DataSource @@ -24,7 +24,7 @@ namespace ICSharpCode.Reporting.DataSource
/// <summary>
/// Description of PropertyTypeHash.
/// </summary>
internal class PropertyTypeHash
class PropertyTypeHash
{
static PropertyTypeHash instance = new PropertyTypeHash();
@ -56,7 +56,7 @@ namespace ICSharpCode.Reporting.DataSource @@ -56,7 +56,7 @@ namespace ICSharpCode.Reporting.DataSource
}
}
private PropertyTypeHash()
PropertyTypeHash()
{
}
}

69
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataSource/ReflectionExtension.cs

@ -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;
}
}
}

30
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Events/SectionEvent.cs

@ -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;}
}
}

186
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/ExportRenderer/FixedDocumentCreator.cs

@ -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;
}
}
}
}

6
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Exporter/BaseExporter.cs

@ -18,7 +18,7 @@ @@ -18,7 +18,7 @@
using System;
using System.Collections.ObjectModel;
using ICSharpCode.Reporting.Interfaces.Export;
using ICSharpCode.Reporting.PageBuilder.ExportColumns;
namespace ICSharpCode.Reporting.Exporter
{
@ -27,7 +27,7 @@ namespace ICSharpCode.Reporting.Exporter @@ -27,7 +27,7 @@ namespace ICSharpCode.Reporting.Exporter
/// </summary>
public class BaseExporter
{
public BaseExporter(Collection<IPage> pages)
public BaseExporter(Collection<ExportPage> pages)
{
if (pages == null) {
throw new ArgumentException("pages");
@ -41,6 +41,6 @@ namespace ICSharpCode.Reporting.Exporter @@ -41,6 +41,6 @@ namespace ICSharpCode.Reporting.Exporter
}
protected Collection<IPage> Pages {get; set;}
protected Collection<ExportPage> Pages {get;private set;}
}
}

34
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Exporter/DebugExporter.cs

@ -17,53 +17,27 @@ @@ -17,53 +17,27 @@
// DEALINGS IN THE SOFTWARE.
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using ICSharpCode.Reporting.Exporter.Visitors;
using ICSharpCode.Reporting.Interfaces.Export;
using ICSharpCode.Reporting.PageBuilder.ExportColumns;
namespace ICSharpCode.Reporting.Exporter
{
/// <summary>
/// Description of DebugExporter.
/// </summary>
public class DebugExporter:BaseExporter
class DebugExporter:BaseExporter
{
private DebugVisitor visitor;
public DebugExporter(Collection<IPage> pages):base(pages)
public DebugExporter(Collection<ExportPage> pages):base(pages)
{
visitor = new DebugVisitor();
}
public override void Run () {
foreach (var page in Pages) {
ShowDebug(page);
}
}
void ShowDebug(IExportContainer container)
{
foreach (var item in container.ExportedItems) {
var exportContainer = item as IExportContainer;
var acceptor = item as IAcceptor;
if (exportContainer != null) {
if (acceptor != null) {
Console.WriteLine("--container--");
acceptor.Accept(visitor);
visitor.Run(Pages);
}
ShowDebug(item as IExportContainer);
} else {
if (acceptor != null) {
Console.WriteLine("..Item...");
acceptor.Accept(visitor);
}
}
}
}
}
}

65
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Exporter/Visitors/AbstractVisitor.cs

@ -17,7 +17,9 @@ @@ -17,7 +17,9 @@
// DEALINGS IN THE SOFTWARE.
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Drawing;
using ICSharpCode.Reporting.PageBuilder.ExportColumns;
namespace ICSharpCode.Reporting.Exporter.Visitors
@ -25,10 +27,63 @@ namespace ICSharpCode.Reporting.Exporter.Visitors @@ -25,10 +27,63 @@ namespace ICSharpCode.Reporting.Exporter.Visitors
/// <summary>
/// Description of AbstractVisitor.
/// </summary>
public abstract class AbstractVisitor : IVisitor
///
class AbstractVisitor : IVisitor{
public virtual void Run (Collection<ExportPage> pages) {
if (pages == null)
throw new ArgumentNullException("pages");
Pages = pages;
foreach (var page in pages) {
Visit(page);
}
}
public virtual void Visit (ExportPage page) {
foreach (var element in page.ExportedItems) {
var ac = element as IAcceptor;
ac.Accept(this);
}
}
public virtual void Visit (ExportContainer exportContainer) {
foreach (var element in exportContainer.ExportedItems) {
var ac = element as IAcceptor;
ac.Accept(this);
}
}
public virtual void Visit(ExportText exportColumn)
{
public abstract void Visit(ExportColumn exportColumn);
public abstract void Visit(ExportContainer exportColumn);
public abstract void Visit(ExportText exportColumn);
}
public virtual void Visit(ExportLine exportGraphics)
{
}
public virtual void Visit (ExportRectangle exportRectangle) {
}
public virtual void Visit (ExportCircle exportCircle) {
}
protected static bool ShouldSetBackcolor (ExportColumn exportColumn) {
return exportColumn.BackColor != Color.White;
}
protected Collection<ExportPage> Pages {get; private set;}
}
}

22
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Exporter/Visitors/DebugVisitor.cs

@ -17,7 +17,6 @@ @@ -17,7 +17,6 @@
// DEALINGS IN THE SOFTWARE.
using System;
using System.Collections.Generic;
using ICSharpCode.Reporting.PageBuilder.ExportColumns;
namespace ICSharpCode.Reporting.Exporter.Visitors
@ -28,24 +27,29 @@ namespace ICSharpCode.Reporting.Exporter.Visitors @@ -28,24 +27,29 @@ namespace ICSharpCode.Reporting.Exporter.Visitors
// http://www.remondo.net/strategy-pattern-example-csharp/
public class DebugVisitor : AbstractVisitor
class DebugVisitor : AbstractVisitor
{
public override void Visit(ExportColumn exportColumn)
public override void Visit(ExportPage page)
{
Console.WriteLine("Visit ExportColumn {0} - {1} - {2}", exportColumn.Name,exportColumn.Size,exportColumn.Location);
base.Visit(page);
}
public override void Visit(ExportContainer exportColumn)
public override void Visit(ExportContainer exportContainer)
{
Console.WriteLine("Visit ExportContainer {0} - {1} - {2}", exportColumn.Name,exportColumn.Size,exportColumn.Location);
base.Visit(exportContainer);
}
public override void Visit(ExportText exportColumn)
{
Console.WriteLine("Visit ExportText {0} - {1} - {2}", exportColumn.Name,exportColumn.Size,exportColumn.Location);
}
}
public override void Visit(ExportLine exportGraphics)
{
// base.Visit(exportGraphics);
Console.WriteLine("Line from {0} size {1}",exportGraphics.Location,exportGraphics.Size.Width);
}
}
}

94
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Exporter/Visitors/ExpressionVisitor.cs

@ -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; }
}
}
}

51
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Exporter/Visitors/FormatVisitor.cs

@ -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);
}
}
}
}

6
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Exporter/Visitors/IVisitor.cs

@ -17,15 +17,17 @@ @@ -17,15 +17,17 @@
// DEALINGS IN THE SOFTWARE.
using System;
using System.Collections.Generic;
using ICSharpCode.Reporting.PageBuilder.ExportColumns;
namespace ICSharpCode.Reporting.Exporter.Visitors
{
public interface IVisitor
{
void Visit(ExportColumn exportColumn);
void Visit(ExportPage page);
void Visit(ExportContainer exportColumn);
void Visit(ExportText exportColumn);
void Visit(ExportLine exportGraphics);
void Visit (ExportRectangle exportRectangle);
void Visit (ExportCircle exportCircle);
}
}

73
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Exporter/Visitors/WpfVisitor.cs

@ -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;}
}
}

113
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Exporter/WpfExporter.cs

@ -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);
}
}
}
}
}
}

52
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Expressions/ExpressionHelper.cs

@ -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);
}
}
}

65
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Expressions/ExpressionRunner.cs

@ -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;}
}
}

102
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Expressions/Irony/Ast/AstExtensions.cs

@ -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
}
}

54
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Expressions/Irony/Ast/FieldsNode.cs

@ -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;
}
}
}

67
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Expressions/Irony/Ast/GlobalsNode.cs

@ -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);
}
}
}
}

53
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Expressions/Irony/Ast/ParametersCallNode.cs

@ -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;
}
}
}

73
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Expressions/Irony/ExpressionEvaluator.cs

@ -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();
}
*/
}
}

99
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Expressions/Irony/Imports/ImportAggregates.cs

@ -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;
}
}
}

187
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Expressions/Irony/ReportingLanguageGrammer.cs

@ -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);
}
}
}

83
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Expressions/Irony/ReportingLanguageRuntime.cs

@ -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;
}
*/
}
}

122
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Expressions/TypeNormalizer.cs

@ -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));
}
}
}
}

1
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Factories/ReportCreatorFactory.cs

@ -46,6 +46,7 @@ namespace ICSharpCode.Reporting.Factories @@ -46,6 +46,7 @@ namespace ICSharpCode.Reporting.Factories
case GlobalEnums.PushPullModel.PushData:
{
break;
}

2
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Globals/CreateGraphics.cs

@ -24,7 +24,7 @@ namespace ICSharpCode.Reporting.Globals @@ -24,7 +24,7 @@ namespace ICSharpCode.Reporting.Globals
/// <summary>
/// Description of CreateGraphics.
/// </summary>
public class CreateGraphics
internal class CreateGraphics
{
public static Graphics FromSize (Size size){
if (size == null) {

7
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Globals/GlobalEnums.cs

@ -23,8 +23,11 @@ namespace ICSharpCode.Reporting.Globals @@ -23,8 +23,11 @@ namespace ICSharpCode.Reporting.Globals
/// <summary>
/// Description of GlobalEnums.
/// </summary>
public class GlobalEnums
public sealed class GlobalEnums
{
GlobalEnums() {
}
/*
public enum ReportSection {
ReportHeader,
ReportPageHeader,
@ -32,7 +35,7 @@ namespace ICSharpCode.Reporting.Globals @@ -32,7 +35,7 @@ namespace ICSharpCode.Reporting.Globals
ReportPageFooter,
ReportFooter
}
*/
///<summary>Technics to get the data
/// Push : report get's a ready filld dataset or something tah implements IList
/// Pull : report has to fill data by themself

21
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Globals/MeasurementService.cs

@ -18,36 +18,33 @@ @@ -18,36 +18,33 @@
using System;
using System.Drawing;
using ICSharpCode.Reporting.Items;
using ICSharpCode.Reporting.PageBuilder.ExportColumns;
namespace ICSharpCode.Reporting.Globals
{
/// <summary>
/// Description of MeasurementService.
/// </summary>
internal class MeasurementService
static class MeasurementService
{
public MeasurementService()
{
}
public static Size Measure (ITextItem item,Graphics graphics) {
public static Size Measure (IExportText item,Graphics graphics) {
if (!item.CanGrow) {
return item.Size;
}
var sf = new StringFormat();
sf.FormatFlags = StringFormatFlags.MeasureTrailingSpaces;
if (!String.IsNullOrEmpty(item.Text)) {
SizeF size = graphics.MeasureString(item.Text.TrimEnd(),
SizeF sizeF = graphics.MeasureString(item.Text.TrimEnd(),
item.Font,
item.Size.Width);
var i = (int)size.Height/item.Font.Height;
if (size.Height < item.Size.Height) {
if (sizeF.Height < item.Size.Height) {
return item.Size;
}
return new Size(item.Size.Width,(int)Math.Ceiling(size.Height));
return new Size(item.Size.Width,(int)Math.Ceiling(sizeF.Height));
}
return item.Size;
}
}

168
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Globals/StandardFormatter.cs

@ -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;
}
}
}

154
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Globals/StringHelper.cs

@ -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;
}
}
}

84
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Globals/TypeHelper.cs

@ -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;
}
}
}

32
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/Data/IDataViewHandling.cs → src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/Data/IDataSource.cs

@ -18,7 +18,9 @@ @@ -18,7 +18,9 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using ICSharpCode.Reporting.BaseClasses;
using ICSharpCode.Reporting.DataManager.Listhandling;
@ -28,34 +30,14 @@ namespace ICSharpCode.Reporting.Interfaces.Data @@ -28,34 +30,14 @@ namespace ICSharpCode.Reporting.Interfaces.Data
/// <summary>
/// Description of IDataViewHandling.
/// </summary>
public interface IDataViewHandling:IEnumerator{
void Sort ();
void Group();
public interface IDataSource{
void Bind();
// void Fill (int position,ReportItemCollection collection);
//rausnehmen
// void Fill (IDataItem item);
void Fill(ReportItemCollection collection);
IndexList IndexList {get;}
// object CurrentFromPosition(int pos);
// CurrentItemsCollection FillDataRow();
// CurrentItemsCollection FillDataRow(int pos);
//
void Fill(List<IPrintableObject> collection,object current);
Collection<AbstractColumn> AvailableFields {get;}
IList <object> CurrentList {get;}
int Count {get;}
int CurrentPosition {get;set;}
// IExpressionEvaluatorFacade ExpressionEvaluator {get;}
object Current {get;}
OrderGroup OrderGroup {get;}
}
}

3
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/Export/IExportColumn.cs

@ -19,8 +19,6 @@ @@ -19,8 +19,6 @@
using System;
using System.Drawing;
using ICSharpCode.Reporting.Arrange;
using ICSharpCode.Reporting.BaseClasses;
using ICSharpCode.Reporting.Exporter;
namespace ICSharpCode.Reporting.Interfaces.Export
{
@ -30,6 +28,7 @@ namespace ICSharpCode.Reporting.Interfaces.Export @@ -30,6 +28,7 @@ namespace ICSharpCode.Reporting.Interfaces.Export
public interface IExportColumn:IReportObject
{
IArrangeStrategy GetArrangeStrategy();
IMeasurementStrategy MeasurementStrategy ();
Size DesiredSize {get;set;}
IExportColumn Parent {get;set;}
Rectangle DisplayRectangle {get;}

1
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/Export/IExportContainer.cs

@ -18,7 +18,6 @@ @@ -18,7 +18,6 @@
using System;
using System.Collections.Generic;
using ICSharpCode.Reporting.PageBuilder.ExportColumns;
namespace ICSharpCode.Reporting.Interfaces.Export
{

1
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/Export/IPage.cs

@ -17,7 +17,6 @@ @@ -17,7 +17,6 @@
// DEALINGS IN THE SOFTWARE.
using System;
using System.Collections.Generic;
namespace ICSharpCode.Reporting.Interfaces.Export
{

3
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IPrintableObject.cs

@ -33,14 +33,13 @@ namespace ICSharpCode.Reporting.Interfaces @@ -33,14 +33,13 @@ namespace ICSharpCode.Reporting.Interfaces
Color ForeColor {get;set;}
Color BackColor {get;set;}
Color FrameColor{get;set;}
bool DrawBorder {get;set;}
bool CanGrow {get;set;}
}
public interface IPrintableObject:IReportObject {
IExportColumn CreateExportColumn();
IMeasurementStrategy MeasurementStrategy ();
}
}

2
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IReportContainer.cs

@ -18,8 +18,6 @@ @@ -18,8 +18,6 @@
using System;
using System.Collections.Generic;
using ICSharpCode.Reporting.Interfaces.Export;
using ICSharpCode.Reporting.Items;
namespace ICSharpCode.Reporting.Interfaces
{

8
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IReportCreator.cs

@ -17,11 +17,9 @@ @@ -17,11 +17,9 @@
// DEALINGS IN THE SOFTWARE.
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using ICSharpCode.Reporting.BaseClasses;
using ICSharpCode.Reporting.Interfaces.Export;
using ICSharpCode.Reporting.PageBuilder.ExportColumns;
namespace ICSharpCode.Reporting.Interfaces
{
@ -31,8 +29,8 @@ namespace ICSharpCode.Reporting.Interfaces @@ -31,8 +29,8 @@ namespace ICSharpCode.Reporting.Interfaces
public interface IReportCreator
{
void BuildExportList ();
Collection<IPage> Pages {get;}
Collection<ExportPage> Pages {get;}
event EventHandler<SectionEventArgs> SectionRendering;
// PagesCollection Pages{get;}
// event EventHandler<PageCreatedEventArgs> PageCreated;
// event EventHandler<SectionRenderEventArgs> SectionRendering;

12
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IReportModel.cs

@ -18,6 +18,8 @@ @@ -18,6 +18,8 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using ICSharpCode.Reporting.Items;
namespace ICSharpCode.Reporting.Interfaces
@ -28,16 +30,8 @@ namespace ICSharpCode.Reporting.Interfaces @@ -28,16 +30,8 @@ namespace ICSharpCode.Reporting.Interfaces
public interface IReportModel
{
ReportSettings ReportSettings {get;set;}
List<BaseSection> SectionCollection {get;}
/*
ISection ReportHeader {get;}
ISection PageHeader {get;}
ISection DetailSection {get;}
ISection PageFooter {get;}
ISection ReportFooter {get;}
Collection<BaseSection> SectionCollection {get;}
GlobalEnums.PushPullModel DataModel {get;}
*/
IReportContainer ReportHeader {get;}
IReportContainer PageHeader {get;}
IReportContainer DetailSection {get;}

12
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseDataItem.cs

@ -18,6 +18,8 @@ @@ -18,6 +18,8 @@
using System;
using ICSharpCode.Reporting.Interfaces;
using ICSharpCode.Reporting.Interfaces.Export;
using ICSharpCode.Reporting.PageBuilder.ExportColumns;
namespace ICSharpCode.Reporting.Items
{
@ -30,11 +32,19 @@ namespace ICSharpCode.Reporting.Items @@ -30,11 +32,19 @@ namespace ICSharpCode.Reporting.Items
{
}
public override IExportColumn CreateExportColumn()
{
var exCol = (IExportText)base.CreateExportColumn();
exCol.Text = DBValue;
return exCol;
}
public virtual string DBValue {get;set;}
public virtual string ColumnName {get;set;}
public string DataType {get;set;}
// public string DataType {get;set;}
}
}

20
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Factories/SectionFactory.cs → src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseRowItem.cs

@ -16,25 +16,21 @@ @@ -16,25 +16,21 @@
// 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.Items;
namespace ICSharpCode.Reporting.Factories
namespace ICSharpCode.Reporting.Items
{
/// <summary>
/// Description of SectionFactory.
/// Description of BaseRowItem.
/// </summary>
internal sealed class SectionFactory
public class BaseRowItem:ReportContainer
{
private SectionFactory ()
public BaseRowItem()
{
}
public static BaseSection Create(string sectionName) {
if (String.IsNullOrEmpty(sectionName)) {
throw new ArgumentException("sectionName");
}
return new BaseSection(sectionName);
public class GroupHeader :BaseRowItem
{
public GroupHeader() {
}
}
}

8
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseSection.cs

@ -17,10 +17,8 @@ @@ -17,10 +17,8 @@
// DEALINGS IN THE SOFTWARE.
using System;
using System.Collections.Generic;
using System.Drawing;
using ICSharpCode.Reporting.Interfaces;
using ICSharpCode.Reporting.Interfaces.Export;
using ICSharpCode.Reporting.PageBuilder.ExportColumns;
namespace ICSharpCode.Reporting.Items
{
@ -36,10 +34,6 @@ public class BaseSection:ReportContainer,IReportContainer @@ -36,10 +34,6 @@ public class BaseSection:ReportContainer,IReportContainer
{
}
public BaseSection (string name) {
Name = name;
}
#endregion
}
}

35
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseTextItem.cs

@ -18,7 +18,6 @@ @@ -18,7 +18,6 @@
using System;
using System.Drawing;
using ICSharpCode.Reporting.Arrange;
using ICSharpCode.Reporting.Globals;
using ICSharpCode.Reporting.Interfaces;
using ICSharpCode.Reporting.Interfaces.Export;
@ -33,6 +32,10 @@ namespace ICSharpCode.Reporting.Items @@ -33,6 +32,10 @@ namespace ICSharpCode.Reporting.Items
{
Font Font {get;set;}
string Text {get;set;}
ContentAlignment ContentAlignment {get;set;}
string FormatString {get;set;}
string DataType {get;set;}
}
public class BaseTextItem:PrintableItem,ITextItem
@ -47,6 +50,26 @@ namespace ICSharpCode.Reporting.Items @@ -47,6 +50,26 @@ namespace ICSharpCode.Reporting.Items
public string Text {get;set;}
public string FormatString {get;set;}
public ContentAlignment ContentAlignment {get;set;}
string dataType;
public string DataType
{
get {
if (String.IsNullOrEmpty(this.dataType)) {
this.dataType = typeof(System.String).ToString();
}
return dataType;
}
set {
dataType = value;
}
}
public override IExportColumn CreateExportColumn()
{
var ex = new ExportText();
@ -58,14 +81,12 @@ namespace ICSharpCode.Reporting.Items @@ -58,14 +81,12 @@ namespace ICSharpCode.Reporting.Items
ex.Size = Size;
ex.Font = Font;
ex.Text = Text;
ex.FormatString = FormatString;
ex.ContentAlignment = ContentAlignment;
ex.DataType = DataType;
ex.CanGrow = CanGrow;
ex.DrawBorder = DrawBorder;
return ex;
}
public override ICSharpCode.Reporting.Arrange.IMeasurementStrategy MeasurementStrategy()
{
return new TextBasedMeasurementStrategy();
}
}
}

46
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/Graphics/BaseCircleItem.cs

@ -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;
}
}
}

43
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/Graphics/BaseGraphics.cs

@ -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;}
}
}

47
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/Graphics/BaseLineItem.cs

@ -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;
}
}
}

49
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/Graphics/BaseRectangleItem.cs

@ -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;
}
}
}

4
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/BaseClasses/GroupColumn.cs → src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/GroupColumn.cs

@ -19,7 +19,7 @@ @@ -19,7 +19,7 @@
using System;
using System.ComponentModel;
namespace ICSharpCode.Reporting.BaseClasses
namespace ICSharpCode.Reporting.Items
{
/// <summary>
/// Description of GroupColumn.
@ -43,6 +43,6 @@ namespace ICSharpCode.Reporting.BaseClasses @@ -43,6 +43,6 @@ namespace ICSharpCode.Reporting.BaseClasses
public int GroupLevel {get;private set;}
public SortColumn GroupSortColumn {get;set;}
}
}

14
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/PrintableItem.cs

@ -18,7 +18,6 @@ @@ -18,7 +18,6 @@
using System;
using System.Drawing;
using ICSharpCode.Reporting.Arrange;
using ICSharpCode.Reporting.Interfaces;
using ICSharpCode.Reporting.Interfaces.Export;
@ -26,6 +25,12 @@ namespace ICSharpCode.Reporting.Items @@ -26,6 +25,12 @@ namespace ICSharpCode.Reporting.Items
{
public class PrintableItem : IPrintableObject
{
public PrintableItem() {
ForeColor = Color.Black;
FrameColor = Color.Black;
BackColor = Color.White;
}
public string Name { get; set; }
public Point Location { get; set; }
@ -38,11 +43,6 @@ namespace ICSharpCode.Reporting.Items @@ -38,11 +43,6 @@ namespace ICSharpCode.Reporting.Items
return null;
}
public virtual IMeasurementStrategy MeasurementStrategy ()
{
return null;
}
public Color ForeColor {get;set;}
public Color BackColor {get;set;}
@ -51,5 +51,7 @@ namespace ICSharpCode.Reporting.Items @@ -51,5 +51,7 @@ namespace ICSharpCode.Reporting.Items
public bool CanGrow {get;set;}
public bool DrawBorder {get;set;}
}
}

10
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportContainer.cs

@ -18,8 +18,6 @@ @@ -18,8 +18,6 @@
using System;
using System.Collections.Generic;
using ICSharpCode.Reporting.Arrange;
using ICSharpCode.Reporting.Exporter;
using ICSharpCode.Reporting.Interfaces;
using ICSharpCode.Reporting.Interfaces.Export;
using ICSharpCode.Reporting.PageBuilder.ExportColumns;
@ -51,13 +49,9 @@ namespace ICSharpCode.Reporting.Items @@ -51,13 +49,9 @@ namespace ICSharpCode.Reporting.Items
Size = this.Size,
Location = this.Location,
CanGrow = this.CanGrow,
BackColor = this.BackColor,
DesiredSize = this.Size
};
}
public override IMeasurementStrategy MeasurementStrategy()
{
return new ContainerMeasurementStrategy();
}
}
}

9
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportModel.cs

@ -17,9 +17,8 @@ @@ -17,9 +17,8 @@
// DEALINGS IN THE SOFTWARE.
using System;
using System.Collections.Generic;
using ICSharpCode.Reporting.Factories;
using ICSharpCode.Reporting.Globals;
using System.Collections.ObjectModel;
using ICSharpCode.Reporting.Interfaces;
namespace ICSharpCode.Reporting.Items
@ -31,7 +30,7 @@ namespace ICSharpCode.Reporting.Items @@ -31,7 +30,7 @@ namespace ICSharpCode.Reporting.Items
{
public ReportModel() {
SectionCollection = new List<BaseSection>();
SectionCollection = new Collection<BaseSection>();
}
@ -93,6 +92,6 @@ namespace ICSharpCode.Reporting.Items @@ -93,6 +92,6 @@ namespace ICSharpCode.Reporting.Items
}
}
public List<BaseSection> SectionCollection {get; private set;}
public Collection<BaseSection> SectionCollection {get; private set;}
}
}

15
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportSettings.cs

@ -33,7 +33,7 @@ namespace ICSharpCode.Reporting.Items @@ -33,7 +33,7 @@ namespace ICSharpCode.Reporting.Items
public ReportSettings()
{
this.pageSize = Globals.GlobalValues.DefaultPageSize;
this.pageSize = GlobalValues.DefaultPageSize;
BaseValues();
}
@ -61,9 +61,9 @@ namespace ICSharpCode.Reporting.Items @@ -61,9 +61,9 @@ namespace ICSharpCode.Reporting.Items
// this.availableFields = new AvailableFieldsCollection();
// this.groupingsCollection = new GroupColumnCollection();
this.SortColumnsCollection = new SortColumnCollection();
GroupColumnCollection = new GroupColumnCollection();
this.GroupColumnsCollection = new GroupColumnCollection();
// this.sqlParameters = new SqlParameterCollection();
// this.parameterCollection = new ParameterCollection();
ParameterCollection = new ParameterCollection();
// this.NoDataMessage = "No Data for this Report";
}
@ -147,8 +147,15 @@ namespace ICSharpCode.Reporting.Items @@ -147,8 +147,15 @@ namespace ICSharpCode.Reporting.Items
// [Browsable(true), Category("Base Settings")]
public GlobalEnums.ReportType ReportType {get;set;}
// [Category("Parameters")]
// [EditorAttribute ( typeof(ParameterCollectionEditor),
// typeof(System.Drawing.Design.UITypeEditor) )]
public ParameterCollection ParameterCollection {get; private set;}
public SortColumnCollection SortColumnsCollection {get;private set;}
public GroupColumnCollection GroupColumnCollection {get;private set;}
public GroupColumnCollection GroupColumnsCollection {get;private set;}
}
}

7
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/BaseClasses/SortColumn.cs → src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/SortColumn.cs

@ -18,8 +18,9 @@ @@ -18,8 +18,9 @@
using System;
using System.ComponentModel;
using ICSharpCode.Reporting.BaseClasses;
namespace ICSharpCode.Reporting.BaseClasses
namespace ICSharpCode.Reporting.Items
{
/// <summary>
/// Description of SortColumn.
@ -27,8 +28,6 @@ namespace ICSharpCode.Reporting.BaseClasses @@ -27,8 +28,6 @@ namespace ICSharpCode.Reporting.BaseClasses
public class SortColumn : AbstractColumn {
private ListSortDirection sortDirection = ListSortDirection.Ascending;
private bool caseSensitive;
public SortColumn():this(String.Empty,ListSortDirection.Ascending,typeof(System.String),false)
{
@ -42,7 +41,7 @@ namespace ICSharpCode.Reporting.BaseClasses @@ -42,7 +41,7 @@ namespace ICSharpCode.Reporting.BaseClasses
public SortColumn(string columnName, ListSortDirection sortDirection, Type type,bool caseSensitive ):base (columnName,type)
{
this.caseSensitive = caseSensitive;
CaseSensitive = caseSensitive;
this.sortDirection = sortDirection;
}

185
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/BasePageBuilder.cs

@ -17,16 +17,20 @@ @@ -17,16 +17,20 @@
// DEALINGS IN THE SOFTWARE.
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Drawing;
using System.Linq;
using ICSharpCode.Reporting.BaseClasses;
using ICSharpCode.Reporting.DataManager.Listhandling;
using ICSharpCode.Reporting.Exporter;
using ICSharpCode.Reporting.Expressions;
using ICSharpCode.Reporting.Globals;
using ICSharpCode.Reporting.Interfaces;
using ICSharpCode.Reporting.Interfaces.Export;
using ICSharpCode.Reporting.Items;
using ICSharpCode.Reporting.PageBuilder.Converter;
using ICSharpCode.Reporting.PageBuilder.ExportColumns;
namespace ICSharpCode.Reporting.PageBuilder
{
@ -35,28 +39,21 @@ namespace ICSharpCode.Reporting.PageBuilder @@ -35,28 +39,21 @@ namespace ICSharpCode.Reporting.PageBuilder
/// </summary>
public class BasePageBuilder:IReportCreator
{
Graphics graphics;
public BasePageBuilder(IReportModel reportModel)
{
public event EventHandler<SectionEventArgs> SectionRendering;
public BasePageBuilder(IReportModel reportModel){
if (reportModel == null) {
throw new ArgumentNullException("reportModel");
}
ReportModel = reportModel;
Pages = new Collection<IPage>();
graphics = CreateGraphics.FromSize(reportModel.ReportSettings.PageSize);
Pages = new Collection<ExportPage>();
Graphics = CreateGraphics.FromSize(reportModel.ReportSettings.PageSize);
}
#region create Report Sections
protected IPage InitNewPage(){
var pi = CreatePageInfo();
return new Page(pi,ReportModel.ReportSettings.PageSize);
}
#region create Sections
protected void BuildReportHeader()
{
void BuildReportHeader(){
if (Pages.Count == 0) {
var header = CreateSection(ReportModel.ReportHeader,CurrentLocation);
var r = new Rectangle(header.Location.X, header.Location.Y, header.Size.Width, header.Size.Height);
@ -65,71 +62,100 @@ namespace ICSharpCode.Reporting.PageBuilder @@ -65,71 +62,100 @@ namespace ICSharpCode.Reporting.PageBuilder
}
}
static void Raise <T>(EventHandler<T> handler, object sender, T e)
where T: EventArgs{
// Copy to a temporary variable to be thread-safe.
EventHandler<T> temp = handler;
protected void BuildPageHeader()
{
if (temp != null) {
temp(sender, e);
}
}
void BuildPageHeader(){
var pageHeader = CreateSection(ReportModel.PageHeader,CurrentLocation);
DetailStart = new Point(ReportModel.ReportSettings.LeftMargin,pageHeader.Location.Y + pageHeader.Size.Height +1);
DetailStart = new Point(ReportModel.ReportSettings.LeftMargin,pageHeader.Location.Y + pageHeader.DesiredSize.Height +1);
AddSectionToPage(pageHeader);
}
protected void BuildPageFooter()
{
Console.WriteLine("FormPageBuilder - Build PageFooter {0} - {1}",ReportModel.ReportSettings.PageSize.Height,ReportModel.ReportSettings.BottomMargin);
void BuildPageFooter(){
CurrentLocation = new Point(ReportModel.ReportSettings.LeftMargin,
ReportModel.ReportSettings.PageSize.Height - ReportModel.ReportSettings.BottomMargin - ReportModel.PageFooter.Size.Height);
var pageFooter = CreateSection(ReportModel.PageFooter,CurrentLocation);
DetailEnds = new Point(pageFooter.Location.X + pageFooter.Size.Width,pageFooter.Location.Y -1);
AddSectionToPage(pageFooter);
}
protected void BuildReportFooter()
{
Console.WriteLine("FormPageBuilder - Build ReportFooter {0} - {1}",ReportModel.ReportSettings.PageSize.Height,ReportModel.ReportSettings.BottomMargin);
void AddSectionToPage(IExportContainer header){
header.Parent = CurrentPage;
CurrentPage.ExportedItems.Add(header);
}
protected void BuildReportFooter(){
var lastSection = CurrentPage.ExportedItems.Last();
CurrentLocation = new Point(ReportModel.ReportSettings.LeftMargin,
lastSection.Location.Y - lastSection.Size.Height - 1);
lastSection.Location.Y - ReportModel.ReportFooter.Size.Height - 2);
var reportFooter = CreateSection(ReportModel.ReportFooter,CurrentLocation);
if (reportFooter.ExportedItems.Any()) {
AddSectionToPage(reportFooter);
}
}
#endregion
protected virtual void WritePages()
{
CurrentPage = InitNewPage();
CurrentLocation = new Point(ReportModel.ReportSettings.LeftMargin,ReportModel.ReportSettings.TopMargin);
this.BuildReportHeader();
protected void WriteStandardSections() {
BuildReportHeader();
BuildPageHeader();
BuildPageFooter();
// BuilDetail();
BuildReportFooter();
// base.AddPage(CurrentPage);
// Console.WriteLine("------{0}---------",ReportModel.ReportSettings.PageSize);
}
protected IExportContainer CreateSection(IReportContainer section,Point location)
{
var containerConverter = new ContainerConverter(graphics, section, location);
var header = containerConverter.Convert();
return header;
protected bool PageFull(IExportContainer container) {
return container.DisplayRectangle.Bottom > DetailEnds.Y;
}
#endregion
protected IExportContainer CreateSection(IReportContainer container,Point location){
var sea = new SectionEventArgs(container);
Raise<SectionEventArgs> (SectionRendering,this,sea);
var containerConverter = new ContainerConverter(location);
var convertedContainer = containerConverter.ConvertToExportContainer(container);
protected void AddSectionToPage(IExportContainer header)
{
header.Parent = CurrentPage;
CurrentPage.ExportedItems.Add(header);
var list = containerConverter.CreateConvertedList(container.Items);
containerConverter.SetParent(convertedContainer,list);
convertedContainer.ExportedItems.AddRange(list);
convertedContainer.DesiredSize = MeasureElement(convertedContainer);
ArrangeContainer(convertedContainer);
return convertedContainer;
}
#region Arrange and Measure
IPageInfo CreatePageInfo()
{
protected Size MeasureElement (IExportColumn element) {
var measureStrategy = element.MeasurementStrategy();
return measureStrategy.Measure(element, Graphics);
}
protected static void ArrangeContainer(IExportContainer exportContainer){
var exportArrange = exportContainer.GetArrangeStrategy();
exportArrange.Arrange(exportContainer);
}
#endregion
#region Pagehandling
IPageInfo CreatePageInfo(){
var pi = new PageInfo();
pi.PageNumber = Pages.Count +1;
pi.ReportName = ReportModel.ReportSettings.ReportName;
@ -137,8 +163,19 @@ namespace ICSharpCode.Reporting.PageBuilder @@ -137,8 +163,19 @@ namespace ICSharpCode.Reporting.PageBuilder
return pi;
}
ExportPage InitNewPage(){
var pi = CreatePageInfo();
return new ExportPage(pi,ReportModel.ReportSettings.PageSize);
}
protected virtual void AddPage(IPage page) {
protected virtual ExportPage CreateNewPage(){
var page = InitNewPage();
CurrentLocation = new Point(ReportModel.ReportSettings.LeftMargin,ReportModel.ReportSettings.TopMargin);
return page;
}
protected virtual void AddPage(ExportPage page) {
if (Pages.Count == 0) {
page.IsFirstPage = true;
}
@ -146,20 +183,60 @@ namespace ICSharpCode.Reporting.PageBuilder @@ -146,20 +183,60 @@ namespace ICSharpCode.Reporting.PageBuilder
}
public virtual void BuildExportList()
{
this.Pages.Clear();
public virtual void BuildExportList(){
Pages.Clear();
CurrentPage = CreateNewPage ();
WriteStandardSections();
CurrentLocation = DetailStart;
}
protected void UpdatePageInfo() {
foreach (var page in Pages) {
page.PageInfo.TotalPages = Pages.Count;
}
}
#endregion
#region Visitors
protected void SetupExpressionRunner (ReportSettings reportsettings,CollectionDataSource dataSource){
ExpressionRunner = new ExpressionRunner(Pages,reportsettings,dataSource);
}
protected void RunDebugVisitor(){
var debugExporter = new DebugExporter(Pages);
debugExporter.Run();
}
#endregion
protected IReportModel ReportModel {get; private set;}
protected Point CurrentLocation {get; set;}
protected IPage CurrentPage {get; set;}
protected ExportPage CurrentPage {get; set;}
protected Graphics Graphics {get;private set;}
internal Point DetailStart {get;private set;}
internal Point DetailEnds {get; private set;}
internal ExpressionRunner ExpressionRunner {get;private set;}
internal Rectangle DetailsRectangle {
get {
var s = new Size(DetailEnds.X - DetailStart.X,DetailEnds.Y - DetailStart.Y);
return new Rectangle(DetailStart,s);
}
}
protected Point DetailStart {get;private set;}
public Collection<IPage> Pages {get; private set;}
public Collection<ExportPage> Pages {get; private set;}
}
}

59
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/Converter/ContainerConverter.cs

@ -30,54 +30,45 @@ namespace ICSharpCode.Reporting.PageBuilder.Converter @@ -30,54 +30,45 @@ namespace ICSharpCode.Reporting.PageBuilder.Converter
/// <summary>
/// Description of SectionConverter.
/// </summary>
internal class ContainerConverter
class ContainerConverter : IContainerConverter
{
private Graphics graphics;
public ContainerConverter(Graphics graphics,IReportContainer reportContainer,Point currentLocation )
public ContainerConverter(Point currentLocation)
{
if (graphics == null) {
throw new ArgumentNullException("graphics");
}
if (reportContainer == null) {
throw new ArgumentNullException("reportContainer");
}
this.graphics = graphics;
Container = reportContainer;
CurrentLocation = currentLocation;
}
public IExportContainer Convert() {
var containerStrategy = Container.MeasurementStrategy ();
var exportContainer = (ExportContainer)Container.CreateExportColumn();
public virtual IExportContainer ConvertToExportContainer(IReportContainer reportContainer)
{
var exportContainer = (ExportContainer)reportContainer.CreateExportColumn();
exportContainer.Location = CurrentLocation;
exportContainer.DesiredSize = containerStrategy.Measure(Container,graphics);
return exportContainer;
}
var itemsList = new List<IExportColumn>();
foreach (var element in Container.Items) {
var item = ExportColumnFactory.CreateItem(element);
item.Parent = exportContainer;
var measureStrategy = element.MeasurementStrategy();
item.DesiredSize = measureStrategy.Measure(element,graphics);
public List<IExportColumn> CreateConvertedList(List<IPrintableObject> items){
var itemsList = new List<IExportColumn>();
foreach (var element in items) {
var exportColumn = ExportColumnFactory.CreateItem(element);
var ec = element as IReportContainer;
if (ec != null) {
var l = CreateConvertedList(ec.Items);
((IExportContainer)exportColumn).ExportedItems.AddRange(l);
}
itemsList.Add(item);
Console.WriteLine("Size {0} DesiredSize {1}",item.Size,item.DesiredSize);
itemsList.Add(exportColumn);
}
return itemsList;
}
exportContainer.ExportedItems.AddRange(itemsList);
Console.WriteLine("calling Container-Arrange");
var exportArrange = exportContainer.GetArrangeStrategy();
exportArrange.Arrange(exportContainer);
return exportContainer;
public void SetParent(IExportContainer parent, List<IExportColumn> convertedItems)
{
foreach (var item in convertedItems) {
item.Parent = parent;
}
}
internal IReportContainer Container {get; private set;}
internal Point CurrentLocation {get; private set;}
protected Point CurrentLocation { get; set; }
}
}

32
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/Converter/IContainerConverter.cs

@ -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);
}
}

219
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/DataPageBuilder.cs

@ -17,17 +17,30 @@ @@ -17,17 +17,30 @@
// DEALINGS IN THE SOFTWARE.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using ICSharpCode.Reporting.DataManager.Listhandling;
using ICSharpCode.Reporting.Exporter.Visitors;
using ICSharpCode.Reporting.Interfaces;
using ICSharpCode.Reporting.Interfaces.Export;
using ICSharpCode.Reporting.Items;
using ICSharpCode.Reporting.PageBuilder.Converter;
using ICSharpCode.Reporting.PageBuilder.ExportColumns;
namespace ICSharpCode.Reporting.PageBuilder
{
/// <summary>
/// Description of DataPageBuilder.
/// </summary>
public class DataPageBuilder:BasePageBuilder
{
public DataPageBuilder(ReportModel reportModel, IEnumerable<object> list):base(reportModel)
public DataPageBuilder(IReportModel reportModel,IEnumerable list):base(reportModel)
{
List = list;
}
@ -35,32 +48,212 @@ namespace ICSharpCode.Reporting.PageBuilder @@ -35,32 +48,212 @@ namespace ICSharpCode.Reporting.PageBuilder
public override void BuildExportList()
{
CreateDataSource();
SetupExpressionRunner(ReportModel.ReportSettings,DataSource);
base.BuildExportList();
WritePages ();
BuildDetail();
BuildReportFooter();
AddPage(CurrentPage);
UpdatePageInfo();
ExpressionRunner.Run();
var formatVisitor = new FormatVisitor();
formatVisitor.Run(Pages);
var dv = new DebugVisitor();
dv.Run(Pages);
}
void BuilDetail()
void BuildDetail()
{
Console.WriteLine("FormPageBuilder - Build DetailSection {0} - {1} - {2}",ReportModel.ReportSettings.PageSize.Width,ReportModel.ReportSettings.LeftMargin,ReportModel.ReportSettings.RightMargin);
CurrentSection = ReportModel.DetailSection;
if(DataSourceContainsData()) {
CurrentLocation = DetailStart;
var converter = new ContainerConverter(DetailStart);
if (IsGrouped()) {
BuildGroupedDetails(converter,DetailStart);
} else {
BuildSortedDetails(converter,DetailStart);
}
}
}
void BuildGroupedDetails (IContainerConverter converter,Point startPosition) {
var pagePosition = startPosition;
var sectionPosition = pagePosition;
foreach (IGrouping<object, object> grouping in DataSource.GroupedList) {
var groupHeader = (BaseRowItem)CurrentSection.Items.Where(p => p.GetType() == typeof(GroupHeader)).FirstOrDefault();
var sectionContainer = CreateContainerForSection(CurrentPage, pagePosition);
DataSource.Fill(groupHeader.Items,grouping.FirstOrDefault());
var headerRow = converter.ConvertToExportContainer(groupHeader);
headerRow.Location = new Point(headerRow.Location.X,groupHeader.Location.Y);
var headerItems = converter.CreateConvertedList(groupHeader.Items);
converter.SetParent(sectionContainer, headerItems);
headerRow.ExportedItems.AddRange(headerItems);
headerRow.Parent = sectionContainer;
sectionContainer.ExportedItems.Add(headerRow);
EvaluateExpressionsInGroups(sectionContainer,grouping);
pagePosition = new Point(CurrentSection.Location.X, pagePosition.Y + sectionContainer.DesiredSize.Height + 1);
// Set Position Child Elements
sectionPosition = new Point(pagePosition.X,headerRow.Location.Y + headerRow.Size.Height + 3);
//Childs
foreach (var child in grouping) {
var dataItems = CurrentSection.Items.Where(p => p.GetType() == typeof(BaseDataItem)).ToList();
List<IExportColumn> convertedItems = FillAndConvert(sectionContainer, child, dataItems, converter);
AdjustLocationInSection(sectionPosition, convertedItems);
sectionContainer.ExportedItems.AddRange(convertedItems);
MeasureAndArrangeContainer(sectionContainer);
if (PageFull(sectionContainer)) {
PerformPageBreak();
InsertContainer(sectionContainer);
pagePosition = DetailStart;
sectionContainer.Location = DetailStart;
}
sectionPosition = new Point(CurrentSection.Location.X, sectionPosition.Y + convertedItems[0].DisplayRectangle.Size.Height + 5);
sectionContainer.Size = new Size(sectionContainer.Size.Width,sectionContainer.Size.Height + convertedItems[0].Size.Height);
}
MeasureAndArrangeContainer(sectionContainer);
InsertContainer(sectionContainer);
pagePosition = new Point(pagePosition.X,sectionContainer.DisplayRectangle.Bottom + 1);
}
}
void EvaluateExpressionsInGroups(ExportContainer sectionContainer, IGrouping<object, object> grouping)
{
ExpressionRunner.Visitor.SetCurrentDataSource(grouping);
ExpressionRunner.Visitor.Visit(sectionContainer);
}
void BuildSortedDetails(IContainerConverter converter,Point startPosition){
var exportRows = new List<IExportContainer>();
var pagePosition = startPosition;
foreach (var element in DataSource.SortedList) {
var sectionContainer = CreateContainerForSection(CurrentPage, pagePosition);
var convertedItems = FillAndConvert(sectionContainer,element,ReportModel.DetailSection.Items,converter);
sectionContainer.ExportedItems.AddRange(convertedItems);
MeasureAndArrangeContainer(sectionContainer);
if (PageFull(sectionContainer)) {
InsertExportRows(exportRows);
exportRows.Clear();
PerformPageBreak();
pagePosition = DetailStart;
sectionContainer.Location = pagePosition;
}
exportRows.Add(sectionContainer);
pagePosition = new Point(CurrentSection.Location.X, pagePosition.Y + sectionContainer.DesiredSize.Height + 1);
}
InsertExportRows(exportRows);
}
void PerformPageBreak(){
CurrentPage.PageInfo.PageNumber = Pages.Count + 1;
Pages.Add(CurrentPage);
CurrentPage = CreateNewPage();
WriteStandardSections();
CurrentLocation = DetailStart;
}
var detail = CreateSection(ReportModel.DetailSection,CurrentLocation);
detail.Parent = CurrentPage;
CurrentPage.ExportedItems.Insert(2,detail);
bool IsGrouped(){
return DataSource.OrderGroup == OrderGroup.Grouped;
}
protected override void WritePages()
List<IExportColumn> FillAndConvert(ExportContainer parent, object current, List<IPrintableObject> dataItems, IContainerConverter converter)
{
base.WritePages();
BuilDetail();
base.AddPage(CurrentPage);
Console.WriteLine("------{0}---------",ReportModel.ReportSettings.PageSize);
DataSource.Fill(dataItems, current);
var convertedItems = converter.CreateConvertedList(dataItems.ToList());
converter.SetParent(parent, convertedItems);
return convertedItems;
}
void CreateDataSource(){
DataSource = new CollectionDataSource(List, ReportModel.ReportSettings);
if (DataSourceContainsData()) {
DataSource.Bind();
}
}
bool DataSourceContainsData () {
if (DataSource.Count > 0) {
return true;
}
return false;
}
static void AdjustLocationInSection(Point sectionPosition,List<IExportColumn> convertedItems)
{
foreach (var element in convertedItems) {
element.Location = new Point(element.Location.X, sectionPosition.Y);
}
}
void MeasureAndArrangeContainer(IExportContainer container){
container.DesiredSize = MeasureElement(container);
ArrangeContainer(container);
}
ExportContainer CreateContainerForSection(ExportPage parent,Point location ){
var detail = (ExportContainer)CurrentSection.CreateExportColumn();
detail.Location = location;
detail.Parent = parent;
return detail;
}
void InsertContainer(ExportContainer sectionContainer)
{
if (Pages.Count == 0) {
CurrentPage.ExportedItems.Insert(2, sectionContainer);
} else {
CurrentPage.ExportedItems.Insert(1, sectionContainer);
}
}
void InsertExportRows(List<IExportContainer> list){
if (Pages.Count == 0) {
CurrentPage.ExportedItems.InsertRange(2, list);
} else {
CurrentPage.ExportedItems.InsertRange(1, list);
}
}
internal CollectionDataSource DataSource {get; private set;}
internal IEnumerable List {get; private set;}
protected IReportContainer CurrentSection { get; private set; }
public IEnumerable<object> List {get; private set;}
}
}

54
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/ExportCircle.cs

@ -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;}
}
}

17
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/ExportColumn.cs

@ -19,9 +19,6 @@ @@ -19,9 +19,6 @@
using System;
using System.Drawing;
using ICSharpCode.Reporting.Arrange;
using ICSharpCode.Reporting.BaseClasses;
using ICSharpCode.Reporting.Exporter;
using ICSharpCode.Reporting.Interfaces;
using ICSharpCode.Reporting.Interfaces.Export;
namespace ICSharpCode.Reporting.PageBuilder.ExportColumns
@ -31,6 +28,12 @@ namespace ICSharpCode.Reporting.PageBuilder.ExportColumns @@ -31,6 +28,12 @@ namespace ICSharpCode.Reporting.PageBuilder.ExportColumns
/// </summary>
public class ExportColumn:IExportColumn
{
public ExportColumn() {
ForeColor = Color.Black;
FrameColor = Color.Black;
BackColor = Color.White;
}
public string Name {get;set;}
@ -55,11 +58,17 @@ namespace ICSharpCode.Reporting.PageBuilder.ExportColumns @@ -55,11 +58,17 @@ namespace ICSharpCode.Reporting.PageBuilder.ExportColumns
public bool CanGrow {get;set;}
public bool DrawBorder {get;set;}
public Rectangle DisplayRectangle {
get {
return new Rectangle(Location,Size);
return new Rectangle(Location,DesiredSize);
}
}
public virtual IMeasurementStrategy MeasurementStrategy()
{
throw new NotImplementedException();
}
}
}

16
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/ExportContainer.cs

@ -19,7 +19,6 @@ @@ -19,7 +19,6 @@
using System;
using System.Collections.Generic;
using ICSharpCode.Reporting.Arrange;
using ICSharpCode.Reporting.Exporter;
using ICSharpCode.Reporting.Exporter.Visitors;
using ICSharpCode.Reporting.Interfaces.Export;
@ -41,14 +40,21 @@ namespace ICSharpCode.Reporting.PageBuilder.ExportColumns @@ -41,14 +40,21 @@ namespace ICSharpCode.Reporting.PageBuilder.ExportColumns
get { return exportedItems; }
}
public void Accept(IVisitor visitor)
public override IArrangeStrategy GetArrangeStrategy()
{
visitor.Visit(this);
return new ContainerArrangeStrategy();
}
public override ICSharpCode.Reporting.Arrange.IArrangeStrategy GetArrangeStrategy()
public override IMeasurementStrategy MeasurementStrategy()
{
return new ContainerArrangeStrategy();
return new ContainerMeasurementStrategy();
}
public void Accept(IVisitor visitor)
{
visitor.Visit(this);
}
}
}

64
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/ExportLine.cs

@ -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;}
}
}

68
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/ExportPage.cs

@ -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; }
}
}
}

55
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/ExportRectangle.cs

@ -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…
Cancel
Save