9 changed files with 334 additions and 28 deletions
@ -0,0 +1,78 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: Peter Forstmeier |
||||||
|
* Date: 17.03.2014 |
||||||
|
* Time: 20:18 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.ComponentModel; |
||||||
|
using ICSharpCode.Reporting.Addin.DesignableItems; |
||||||
|
|
||||||
|
namespace ICSharpCode.Reporting.Addin.TypeProvider |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Description of SectionItemTypeProvider.
|
||||||
|
/// </summary>
|
||||||
|
internal class SectionItemTypeProvider : TypeDescriptionProvider |
||||||
|
{ |
||||||
|
public SectionItemTypeProvider() : base(TypeDescriptor.GetProvider(typeof(AbstractItem))) |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance) |
||||||
|
{ |
||||||
|
ICustomTypeDescriptor td = base.GetTypeDescriptor(objectType,instance); |
||||||
|
return new SectionItemDescriptor(td, instance); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
internal class SectionItemDescriptor : CustomTypeDescriptor |
||||||
|
{ |
||||||
|
|
||||||
|
|
||||||
|
public SectionItemDescriptor(ICustomTypeDescriptor parent, object instance) |
||||||
|
: base(parent) |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public override PropertyDescriptorCollection GetProperties() |
||||||
|
{ |
||||||
|
return GetProperties(null); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public override PropertyDescriptorCollection GetProperties(Attribute[] attributes) |
||||||
|
{ |
||||||
|
PropertyDescriptorCollection props = base.GetProperties(attributes); |
||||||
|
List<PropertyDescriptor> allProperties = new List<PropertyDescriptor>(); |
||||||
|
|
||||||
|
TypeProviderHelper.AddDefaultProperties(allProperties,props); |
||||||
|
PropertyDescriptor prop = null; |
||||||
|
|
||||||
|
prop = props.Find("SectionOffset",true); |
||||||
|
allProperties.Add(prop); |
||||||
|
|
||||||
|
prop = props.Find("SectionMargin",true); |
||||||
|
allProperties.Add(prop); |
||||||
|
|
||||||
|
prop = props.Find("DrawBorder",true); |
||||||
|
allProperties.Add(prop); |
||||||
|
|
||||||
|
prop = props.Find("PageBreakAfter",true); |
||||||
|
allProperties.Add(prop); |
||||||
|
|
||||||
|
prop = props.Find("Controls",true); |
||||||
|
allProperties.Add(prop); |
||||||
|
|
||||||
|
prop = props.Find("FrameColor",true); |
||||||
|
allProperties.Add(prop); |
||||||
|
return new PropertyDescriptorCollection(allProperties.ToArray()); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,132 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: Peter Forstmeier |
||||||
|
* Date: 17.03.2014 |
||||||
|
* Time: 20:20 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
using System; |
||||||
|
using System.Collections; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.ComponentModel; |
||||||
|
|
||||||
|
namespace ICSharpCode.Reporting.Addin.TypeProvider |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Description of TypeProviderHelper.
|
||||||
|
/// </summary>
|
||||||
|
static class TypeProviderHelper |
||||||
|
{ |
||||||
|
|
||||||
|
public static void RemoveProperties (IDictionary properties) |
||||||
|
{ |
||||||
|
if (properties == null){ |
||||||
|
throw new ArgumentNullException("properties"); |
||||||
|
} |
||||||
|
properties.Remove("AccessibleDescription"); |
||||||
|
properties.Remove("AccessibleName"); |
||||||
|
properties.Remove("AccessibleRole"); |
||||||
|
properties.Remove("AllowDrop"); |
||||||
|
properties.Remove("Anchor"); |
||||||
|
properties.Remove("AutoScroll"); |
||||||
|
properties.Remove("AutoSize"); |
||||||
|
properties.Remove("BackgroundImage"); |
||||||
|
properties.Remove("BackgroundImageLayout"); |
||||||
|
properties.Remove("Cursor"); |
||||||
|
properties.Remove("CausesValidation"); |
||||||
|
properties.Remove("ContextMenuStrip"); |
||||||
|
properties.Remove("DataBindings"); |
||||||
|
properties.Remove("Dock"); |
||||||
|
|
||||||
|
properties.Remove("Enabled"); |
||||||
|
|
||||||
|
properties.Remove("ImeMode"); |
||||||
|
properties.Remove("Locked"); |
||||||
|
properties.Remove("Padding"); |
||||||
|
properties.Remove("RightToLeft"); |
||||||
|
properties.Remove("TabIndex"); |
||||||
|
properties.Remove("TabStop"); |
||||||
|
properties.Remove("Tag"); |
||||||
|
properties.Remove("UseWaitCursor"); |
||||||
|
properties.Remove("Visible"); |
||||||
|
} |
||||||
|
|
||||||
|
public static void Remove (IDictionary properties,string[] toRemove) |
||||||
|
{ |
||||||
|
if (properties == null){ |
||||||
|
throw new ArgumentNullException("properties"); |
||||||
|
} |
||||||
|
if (toRemove == null) { |
||||||
|
throw new ArgumentNullException("toRemove"); |
||||||
|
} |
||||||
|
foreach (String str in toRemove) |
||||||
|
{ |
||||||
|
properties.Remove(str); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public static void AddDefaultProperties (List<PropertyDescriptor> allProperties, |
||||||
|
PropertyDescriptorCollection props ) |
||||||
|
{ |
||||||
|
PropertyDescriptor prop = props.Find("Location",true); |
||||||
|
allProperties.Add(prop); |
||||||
|
|
||||||
|
prop = props.Find("Size",true); |
||||||
|
allProperties.Add(prop); |
||||||
|
|
||||||
|
prop = props.Find("BackColor",true); |
||||||
|
allProperties.Add(prop); |
||||||
|
|
||||||
|
// prop = props.Find ("VisibleInReport",true);
|
||||||
|
// allProperties.Add(prop);
|
||||||
|
|
||||||
|
|
||||||
|
// need this for Contextmenu's
|
||||||
|
prop = props.Find("ContextMenu",true); |
||||||
|
allProperties.Add(prop); |
||||||
|
} |
||||||
|
|
||||||
|
public static void AddTextBasedProperties (List<PropertyDescriptor> allProperties, |
||||||
|
PropertyDescriptorCollection props) |
||||||
|
{ |
||||||
|
PropertyDescriptor prop = props.Find("Font",true); |
||||||
|
allProperties.Add(prop); |
||||||
|
|
||||||
|
prop = props.Find("FormatString",true); |
||||||
|
allProperties.Add(prop); |
||||||
|
|
||||||
|
prop = props.Find("StringTrimming",true); |
||||||
|
allProperties.Add(prop); |
||||||
|
|
||||||
|
prop = props.Find("ContentAlignment",true); |
||||||
|
allProperties.Add(prop); |
||||||
|
|
||||||
|
prop = props.Find("CanGrow",true); |
||||||
|
allProperties.Add(prop); |
||||||
|
|
||||||
|
prop = props.Find("CanShrink",true); |
||||||
|
allProperties.Add(prop); |
||||||
|
|
||||||
|
prop = props.Find("DataType",true); |
||||||
|
allProperties.Add(prop); |
||||||
|
|
||||||
|
prop = props.Find("RTL",true); |
||||||
|
allProperties.Add(prop); |
||||||
|
} |
||||||
|
|
||||||
|
public static void AddGraphicProperties (List<PropertyDescriptor> allProperties, |
||||||
|
PropertyDescriptorCollection props) |
||||||
|
{ |
||||||
|
PropertyDescriptor prop = null; |
||||||
|
prop = props.Find("ForeColor",true); |
||||||
|
allProperties.Add(prop); |
||||||
|
|
||||||
|
prop = props.Find("DashStyle",true); |
||||||
|
allProperties.Add(prop); |
||||||
|
|
||||||
|
prop = props.Find("Thickness",true); |
||||||
|
allProperties.Add(prop); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,79 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: Peter Forstmeier |
||||||
|
* Date: 17.03.2014 |
||||||
|
* Time: 20:08 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
using System; |
||||||
|
using System.Windows.Forms; |
||||||
|
using ICSharpCode.SharpDevelop; |
||||||
|
using ICSharpCode.SharpDevelop.Workbench; |
||||||
|
using ICSharpCode.Reporting.Addin.DesignerBinding; |
||||||
|
|
||||||
|
|
||||||
|
namespace ICSharpCode.Reporting.Addin.Views |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Description of XmlView.
|
||||||
|
/// </summary>
|
||||||
|
class XmlView : AbstractSecondaryViewContent |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="System.Windows.Forms.Control"/> representing the view
|
||||||
|
/// </summary>
|
||||||
|
RichTextBox richTextBox = new RichTextBox(); |
||||||
|
IDesignerGenerator generator; |
||||||
|
|
||||||
|
public XmlView(IDesignerGenerator generator,IViewContent content):base(content){ |
||||||
|
if (generator == null) { |
||||||
|
throw new ArgumentNullException("generator"); |
||||||
|
} |
||||||
|
if (content == null) { |
||||||
|
throw new ArgumentNullException("content"); |
||||||
|
} |
||||||
|
this.generator = generator; |
||||||
|
this.TabPageText = "XmlView"; |
||||||
|
richTextBox.Dock = DockStyle.Fill; |
||||||
|
richTextBox.BackColor = System.Drawing.SystemColors.Desktop; |
||||||
|
richTextBox.ForeColor = System.Drawing.Color.White; |
||||||
|
} |
||||||
|
|
||||||
|
#region overrides
|
||||||
|
|
||||||
|
protected override void LoadFromPrimary() |
||||||
|
{ |
||||||
|
richTextBox.Text = generator.ViewContent.ReportFileContent; |
||||||
|
} |
||||||
|
|
||||||
|
protected override void SaveToPrimary() |
||||||
|
{ |
||||||
|
// throw new NotImplementedException();
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public override object Control { |
||||||
|
get { |
||||||
|
return richTextBox; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cleans up all used resources
|
||||||
|
/// </summary>
|
||||||
|
public sealed override void Dispose() |
||||||
|
{ |
||||||
|
try { |
||||||
|
if (this.richTextBox != null) { |
||||||
|
this.richTextBox.Dispose(); |
||||||
|
} |
||||||
|
} finally { |
||||||
|
base.Dispose(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
#endregion
|
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue