Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit 4760307

Browse files
Display DesignSurface
1 parent 74994bc commit 4760307

9 files changed

Lines changed: 334 additions & 28 deletions

File tree

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
<Folder Include="src\Designer" />
7171
<Folder Include="src\Globals" />
7272
<Folder Include="src\DesignableItems" />
73+
<Folder Include="src\TypeProvider" />
7374
<Folder Include="src\XML" />
7475
<Folder Include="src\Services" />
7576
<Folder Include="src\Views" />
@@ -102,7 +103,10 @@
102103
<Compile Include="src\Services\HelpService.cs" />
103104
<Compile Include="src\Services\ToolboxService.cs" />
104105
<Compile Include="src\Services\UIService.cs" />
106+
<Compile Include="src\TypeProvider\SectionItemTypeProvider.cs" />
107+
<Compile Include="src\TypeProvider\TypeProviderHelper.cs" />
105108
<Compile Include="src\Views\DesignerView.cs" />
109+
<Compile Include="src\Views\XmlView.cs" />
106110
<Compile Include="src\XML\MycroWriter.cs" />
107111
<Compile Include="src\XML\ReportDefinitionParser.cs" />
108112
<Compile Include="src\XML\ReportDesignerWriter.cs" />

src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignableItems/BaseSection.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,22 @@
99
using System;
1010
using System.ComponentModel;
1111
using System.Drawing;
12+
using ICSharpCode.Reporting.Addin.TypeProvider;
1213

1314
namespace ICSharpCode.Reporting.Addin.DesignableItems
1415
{
1516
/// <summary>
1617
/// Description of BaseSection.
1718
/// </summary>
18-
// [TypeDescriptionProvider(typeof(SectionItemTypeProvider))]
19+
[TypeDescriptionProvider(typeof(SectionItemTypeProvider))]
1920
[Designer(typeof(ICSharpCode.Reporting.Addin.Designer.SectionDesigner))]
2021
public class BaseSection:AbstractItem
2122
{
2223

2324
public BaseSection():base()
2425
{
2526
base.FrameColor = Color.Black;
26-
// TypeDescriptor.AddProvider(new SectionItemTypeProvider(), typeof(BaseSection));
27+
TypeDescriptor.AddProvider(new SectionItemTypeProvider(), typeof(BaseSection));
2728
}
2829

2930

src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/Designer/ReportRootDesigner.cs

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
using System.Windows.Forms.Design;
2929
using ICSharpCode.Core;
3030
using ICSharpCode.Reporting.Addin.DesignableItems;
31+
using ICSharpCode.Reporting.Addin.Globals;
32+
using ICSharpCode.Reporting.Addin.TypeProvider;
3133

3234
namespace ICSharpCode.Reporting.Addin.Designer
3335
{
@@ -49,13 +51,14 @@ public class ReportRootDesigner: DocumentDesigner
4951

5052
public ReportRootDesigner()
5153
{
52-
System.Console.WriteLine("Create RootDesigner");
54+
Console.WriteLine("Create RootDesigner");
55+
// Control.BackColor = Color.Chocolate;
5356
}
5457

5558

56-
private void ShowMessage(Exception e)
59+
void ShowMessage(Exception e)
5760
{
58-
base.DisplayError(e);
61+
DisplayError(e);
5962
var uiService = (IUIService)host.GetService(typeof(IUIService));
6063
if (uiService != null) {
6164
uiService.ShowError(e);
@@ -79,15 +82,15 @@ private void InitializeRootReportModel ()
7982
{
8083
rootReportModel = host.Container.Components[0] as RootReportModel;
8184
rootReportModel.PageMargin = CalculateMargins();
82-
rootReportModel.Page = new Rectangle(new Point(0,0),this.reportSettings.PageSize);
85+
rootReportModel.Page = new Rectangle(new Point(0,0), reportSettings.PageSize);
8386
rootReportModel.Landscape = this.reportSettings.Landscape;
8487
rootReportModel.Invalidate();
8588
}
8689

8790

88-
private Margins CalculateMargins ()
91+
Margins CalculateMargins ()
8992
{
90-
return new Margins(this.reportSettings.LeftMargin,reportSettings.RightMargin,
93+
return new Margins(reportSettings.LeftMargin,reportSettings.RightMargin,
9194
reportSettings.TopMargin,reportSettings.BottomMargin);
9295
}
9396

@@ -143,7 +146,7 @@ public override void Initialize(IComponent component)
143146
// strange (the property grid is empty).
144147
//
145148

146-
this.selectionService = (ISelectionService)GetService(typeof(ISelectionService));
149+
selectionService = (ISelectionService)GetService(typeof(ISelectionService));
147150
if (this.selectionService != null)
148151
{
149152
this.selectionService.SetSelectedComponents(new object[] {component}, SelectionTypes.Replace);
@@ -171,13 +174,14 @@ public override SelectionRules SelectionRules {
171174

172175
protected override void PostFilterProperties(IDictionary properties)
173176
{
174-
/*
175-
DesignerHelper.RemoveProperties(properties);
176-
string [] s = new string[]{"Visible","BackColor","Text","MaximumSize","MinimumSize","Size",
177-
"AutoScaleDimensions","DataBindings"};
178-
DesignerHelper.Remove(properties,s);
177+
178+
TypeProviderHelper.RemoveProperties(properties);
179+
var s = new string[]{"Visible","BackColor",
180+
"Text","MaximumSize","MinimumSize",
181+
"Size","AutoScaleDimensions",
182+
"DataBindings"};
183+
TypeProviderHelper.Remove(properties,s);
179184
base.PostFilterProperties(properties);
180-
*/
181185
}
182186

183187
#endregion
@@ -195,16 +199,17 @@ void OnSectionSizeChanged (object sender, EventArgs e)
195199
void RecalculateSections()
196200
{
197201
int locY = 50;
198-
if (this.reportSettings == null) {
202+
if (reportSettings == null) {
199203
reportSettings = host.Container.Components[1] as ICSharpCode.Reporting.Items.ReportSettings;
200204
}
201205

202-
foreach (BaseSection s in sections)
206+
foreach (BaseSection section in sections)
203207
{
204-
// s.Location = new Point(this.reportSettings.LeftMargin,locY);
205-
// locY = locY + s.Size.Height + GlobalsDesigner.GabBetweenSection;
208+
section.Location = new Point(reportSettings.LeftMargin,locY);
209+
locY = locY + section.Size.Height + DesignerGlobals.GabBetweenSection;
210+
section.Invalidate();
206211
}
207-
this.Control.Invalidate();
212+
Control.Invalidate();
208213
}
209214

210215

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace ICSharpCode.Reporting.Addin.DesignerBinding
2121
/// <summary>
2222
/// Description of DesignerGenerator.
2323
/// </summary>
24-
public class DesignerGenerator:IDesignerGenerator
24+
class DesignerGenerator:IDesignerGenerator
2525
{
2626
DesignerView viewContent;
2727

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public ReportModel LoadOrCreateReport()
7272
}
7373

7474

75-
private void UpdateStatusbar ()
75+
void UpdateStatusbar ()
7676
{
7777
string message;
7878
if (this.generator.ViewContent.PrimaryFile.IsDirty) {
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/*
2+
* Created by SharpDevelop.
3+
* User: Peter Forstmeier
4+
* Date: 17.03.2014
5+
* Time: 20:18
6+
*
7+
* To change this template use Tools | Options | Coding | Edit Standard Headers.
8+
*/
9+
using System;
10+
using System.Collections.Generic;
11+
using System.ComponentModel;
12+
using ICSharpCode.Reporting.Addin.DesignableItems;
13+
14+
namespace ICSharpCode.Reporting.Addin.TypeProvider
15+
{
16+
/// <summary>
17+
/// Description of SectionItemTypeProvider.
18+
/// </summary>
19+
internal class SectionItemTypeProvider : TypeDescriptionProvider
20+
{
21+
public SectionItemTypeProvider() : base(TypeDescriptor.GetProvider(typeof(AbstractItem)))
22+
{
23+
}
24+
25+
26+
public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance)
27+
{
28+
ICustomTypeDescriptor td = base.GetTypeDescriptor(objectType,instance);
29+
return new SectionItemDescriptor(td, instance);
30+
}
31+
}
32+
33+
34+
internal class SectionItemDescriptor : CustomTypeDescriptor
35+
{
36+
37+
38+
public SectionItemDescriptor(ICustomTypeDescriptor parent, object instance)
39+
: base(parent)
40+
{
41+
}
42+
43+
44+
public override PropertyDescriptorCollection GetProperties()
45+
{
46+
return GetProperties(null);
47+
}
48+
49+
50+
public override PropertyDescriptorCollection GetProperties(Attribute[] attributes)
51+
{
52+
PropertyDescriptorCollection props = base.GetProperties(attributes);
53+
List<PropertyDescriptor> allProperties = new List<PropertyDescriptor>();
54+
55+
TypeProviderHelper.AddDefaultProperties(allProperties,props);
56+
PropertyDescriptor prop = null;
57+
58+
prop = props.Find("SectionOffset",true);
59+
allProperties.Add(prop);
60+
61+
prop = props.Find("SectionMargin",true);
62+
allProperties.Add(prop);
63+
64+
prop = props.Find("DrawBorder",true);
65+
allProperties.Add(prop);
66+
67+
prop = props.Find("PageBreakAfter",true);
68+
allProperties.Add(prop);
69+
70+
prop = props.Find("Controls",true);
71+
allProperties.Add(prop);
72+
73+
prop = props.Find("FrameColor",true);
74+
allProperties.Add(prop);
75+
return new PropertyDescriptorCollection(allProperties.ToArray());
76+
}
77+
}
78+
}
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
/*
2+
* Created by SharpDevelop.
3+
* User: Peter Forstmeier
4+
* Date: 17.03.2014
5+
* Time: 20:20
6+
*
7+
* To change this template use Tools | Options | Coding | Edit Standard Headers.
8+
*/
9+
using System;
10+
using System.Collections;
11+
using System.Collections.Generic;
12+
using System.ComponentModel;
13+
14+
namespace ICSharpCode.Reporting.Addin.TypeProvider
15+
{
16+
/// <summary>
17+
/// Description of TypeProviderHelper.
18+
/// </summary>
19+
static class TypeProviderHelper
20+
{
21+
22+
public static void RemoveProperties (IDictionary properties)
23+
{
24+
if (properties == null){
25+
throw new ArgumentNullException("properties");
26+
}
27+
properties.Remove("AccessibleDescription");
28+
properties.Remove("AccessibleName");
29+
properties.Remove("AccessibleRole");
30+
properties.Remove("AllowDrop");
31+
properties.Remove("Anchor");
32+
properties.Remove("AutoScroll");
33+
properties.Remove("AutoSize");
34+
properties.Remove("BackgroundImage");
35+
properties.Remove("BackgroundImageLayout");
36+
properties.Remove("Cursor");
37+
properties.Remove("CausesValidation");
38+
properties.Remove("ContextMenuStrip");
39+
properties.Remove("DataBindings");
40+
properties.Remove("Dock");
41+
42+
properties.Remove("Enabled");
43+
44+
properties.Remove("ImeMode");
45+
properties.Remove("Locked");
46+
properties.Remove("Padding");
47+
properties.Remove("RightToLeft");
48+
properties.Remove("TabIndex");
49+
properties.Remove("TabStop");
50+
properties.Remove("Tag");
51+
properties.Remove("UseWaitCursor");
52+
properties.Remove("Visible");
53+
}
54+
55+
public static void Remove (IDictionary properties,string[] toRemove)
56+
{
57+
if (properties == null){
58+
throw new ArgumentNullException("properties");
59+
}
60+
if (toRemove == null) {
61+
throw new ArgumentNullException("toRemove");
62+
}
63+
foreach (String str in toRemove)
64+
{
65+
properties.Remove(str);
66+
}
67+
}
68+
69+
public static void AddDefaultProperties (List<PropertyDescriptor> allProperties,
70+
PropertyDescriptorCollection props )
71+
{
72+
PropertyDescriptor prop = props.Find("Location",true);
73+
allProperties.Add(prop);
74+
75+
prop = props.Find("Size",true);
76+
allProperties.Add(prop);
77+
78+
prop = props.Find("BackColor",true);
79+
allProperties.Add(prop);
80+
81+
// prop = props.Find ("VisibleInReport",true);
82+
// allProperties.Add(prop);
83+
84+
85+
// need this for Contextmenu's
86+
prop = props.Find("ContextMenu",true);
87+
allProperties.Add(prop);
88+
}
89+
90+
public static void AddTextBasedProperties (List<PropertyDescriptor> allProperties,
91+
PropertyDescriptorCollection props)
92+
{
93+
PropertyDescriptor prop = props.Find("Font",true);
94+
allProperties.Add(prop);
95+
96+
prop = props.Find("FormatString",true);
97+
allProperties.Add(prop);
98+
99+
prop = props.Find("StringTrimming",true);
100+
allProperties.Add(prop);
101+
102+
prop = props.Find("ContentAlignment",true);
103+
allProperties.Add(prop);
104+
105+
prop = props.Find("CanGrow",true);
106+
allProperties.Add(prop);
107+
108+
prop = props.Find("CanShrink",true);
109+
allProperties.Add(prop);
110+
111+
prop = props.Find("DataType",true);
112+
allProperties.Add(prop);
113+
114+
prop = props.Find("RTL",true);
115+
allProperties.Add(prop);
116+
}
117+
118+
public static void AddGraphicProperties (List<PropertyDescriptor> allProperties,
119+
PropertyDescriptorCollection props)
120+
{
121+
PropertyDescriptor prop = null;
122+
prop = props.Find("ForeColor",true);
123+
allProperties.Add(prop);
124+
125+
prop = props.Find("DashStyle",true);
126+
allProperties.Add(prop);
127+
128+
prop = props.Find("Thickness",true);
129+
allProperties.Add(prop);
130+
}
131+
}
132+
}

0 commit comments

Comments
 (0)