No reports! Exception={ex.Message}");
return Content(html.ToString(), "text/html");
}
html.AppendLine("
Render(string reportFile, string type = "html")
{
this.RenderType = type;
await SetReportFile(reportFile);
var htmlContent = new StringBuilder();
if (_ReportFile == null)
{
this.AddError(8, "ReportFile not specified.");
return Content("", contentType);
}
else if (_ReportFile == STATISTICS)
{
DoStatistics(ref htmlContent);
return Content(htmlContent.ToString());
}
else if (_Html != null)
htmlContent.AppendLine(_Html);
else if (_Object != null)
{
return File(_Object, contentType);
}
else // we never generated anything!
{
if (_Errors != null)
{
htmlContent.AppendLine("");
htmlContent.AppendLine("");
htmlContent.AppendLine("| ");
htmlContent.AppendLine("Errors");
htmlContent.AppendLine(" | ");
htmlContent.AppendLine("
");
foreach (string e in _Errors)
{
htmlContent.AppendLine("");
htmlContent.AppendLine("| ");
htmlContent.AppendLine(e);
htmlContent.AppendLine(" | ");
htmlContent.AppendLine("
");
}
htmlContent.AppendLine("
");
}
}
return Content(htmlContent.ToString(), contentType);
}
///
/// When true report won't be shown but parameters (if any) will be
///
public bool NoShow
{
get { return _NoShow; }
set { _NoShow = value; }
}
public string RenderType
{
get
{
switch (_RenderType)
{
case OutputPresentationType.ASPHTML:
case OutputPresentationType.HTML:
return "html";
case OutputPresentationType.PDF:
return "pdf";
case OutputPresentationType.XML:
return "xml";
case OutputPresentationType.CSV:
return "csv";
case OutputPresentationType.ExcelTableOnly:
case OutputPresentationType.Excel2007:
return "xlsx";
case OutputPresentationType.RTF:
return "rtf";
default:
return "html";
}
}
set
{
_RenderType = this.GetRenderType(value);
}
}
public string ReportFile
{
get { return _ReportFile; }
}
private async Task SetReportFile(string value)
{
if (!value.EndsWith(".rdl"))
{
value += ".rdl"; // assume it's a rdl file
}
_ReportFile = FindReportFile(value);
// Clear out old report information (if any)
this._Errors = null;
this._MaxSeverity = 0;
_CSS = null;
_JavaScript = null;
_Html = null;
_ParameterHtml = null;
if (_ReportFile == STATISTICS)
{
var sb = new StringBuilder();
DoStatistics(ref sb);
_Html = sb.ToString();
return;
}
// Build the new report
string contentRootPath = _webHostEnvironment.ContentRootPath;
string pfile = Path.Combine(contentRootPath, _ReportFile);
await DoRender(pfile);
}
public string PassPhrase
{
set
{
_PassPhrase = value;
}
}
private string GetPassword()
{
return _PassPhrase;
}
public string Html
{
get
{
return _Html;
}
}
public string Xml
{
get
{
return _Xml;
}
}
public string CSV
{
get
{
return _Csv;
}
}
public byte[] Object
{
get
{
return _Object;
}
}
public ArrayList Errors
{
get { return _Errors; }
}
public int MaxErrorSeverity
{
get
{
return _MaxSeverity;
}
}
public string CSS
{
get
{
return _CSS;
}
}
public string JavaScript
{
get
{
return _JavaScript;
}
}
public string ParameterHtml
{
get
{
return _ParameterHtml;
}
}
// Render the report files with the requested types
private async Task DoRender(string file)
{
string source;
Report report = null;
var nvc = this.HttpContext.Request.Query; // parameters
ListDictionary ld = new ListDictionary();
try
{
foreach (var kvp in nvc)
{
ld.Add(kvp.Key, kvp.Value);
}
report = ReportHelper.GetCachedReport(file, _cache);
if (report == null) // couldn't obtain report definition from cache
{
// Obtain the source
source = ReportHelper.GetSource(file);
if (source == null)
return; // GetSource reported the error
// Compile the report
report = await this.GetReport(source, file);
if (report == null)
return;
ReportHelper.SaveCachedReport(report, file, _cache);
}
// Set the user context information: ID, language
ReportHelper.SetUserContext(report, this.HttpContext, new Rdl.NeedPassword(GetPassword));
// Obtain the data if report is being generated
if (!_NoShow)
{
await report.RunGetData(ld);
await Generate(report);
}
}
catch (Exception exe)
{
AddError(8, "Error: {0}", exe.Message);
}
if (_ParameterHtml == null)
_ParameterHtml =
ReportHelper.GetParameterHtml(report, ld, this.HttpContext, _ReportFile,
_NoShow); // build the parameter html
}
private void AddError(int severity, string err, params object[] args)
{
if (_MaxSeverity < severity)
_MaxSeverity = severity;
string error = string.Format(err, args);
if (_Errors == null)
_Errors = new ArrayList();
_Errors.Add(error);
}
private void AddError(int severity, IList errors)
{
if (_MaxSeverity < severity)
_MaxSeverity = severity;
if (_Errors == null)
{
// if we don't have any we can just start with this list
_Errors = new ArrayList(errors);
return;
}
// Need to copy all items in the errors array
foreach (string err in errors)
_Errors.Add(err);
}
private void DoStatistics(ref StringBuilder htmlContent)
{
RdlSession rs = _cache.Get(RdlSession.SessionStat) as RdlSession;
ReportHelper s = ReportHelper.Get(_cache);
IMemoryCache c = _cache;
int sessions = 0;
if (rs != null)
sessions = rs.Count;
var cacheEntries = GetCacheEntries(c);
htmlContent.AppendLine($"{sessions} sessions");
htmlContent.AppendLine($"
{cacheEntries.Count} items are in the cache");
htmlContent.AppendLine($"
{s.CacheHits} cache hits");
htmlContent.AppendLine($"
{s.CacheMisses} cache misses");
}
private List GetCacheEntries(IMemoryCache cache)
{
var field = cache.GetType()
.GetProperty("EntriesCollection", BindingFlags.NonPublic | BindingFlags.Instance);
var collection = field.GetValue(cache) as ICollection;
var items = new List();
if (collection != null)
foreach (var item in collection)
{
var methodInfo = item.GetType().GetProperty("Key");
var val = methodInfo.GetValue(item);
items.Add(val.ToString());
}
return items;
}
private async Task Generate(Report report)
{
MemoryStreamGen sg = null;
try
{
sg = new MemoryStreamGen("ShowFile?type=", null, this.RenderType);
await report.RunRender(sg, _RenderType, Guid.NewGuid().ToString());
_CSS = "";
_JavaScript = "";
switch (_RenderType)
{
case OutputPresentationType.ASPHTML:
case OutputPresentationType.HTML:
_CSS = report.CSS; //.Replace("position: relative;", "position: absolute;");
_JavaScript = report.JavaScript;
_Html = sg.GetText();
break;
case OutputPresentationType.XML:
_Xml = sg.GetText();
break;
case OutputPresentationType.CSV:
_Csv = sg.GetText();
break;
case OutputPresentationType.PDF:
{
MemoryStream ms = sg.MemoryList[0] as MemoryStream;
_Object = ms.ToArray();
break;
}
}
// Now save off the other streams in the session context for later use
IList strms = sg.MemoryList;
IList names = sg.MemoryNames;
for (int i = 1; i < sg.MemoryList.Count; i++) // we skip the first one
{
string n = names[i] as string;
MemoryStream ms = strms[i] as MemoryStream;
HttpContext.Session.Set(n, ms.ToArray());
}
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
finally
{
if (sg != null)
{
sg.CloseMainStream();
}
}
if (report.ErrorMaxSeverity > 0)
{
AddError(report.ErrorMaxSeverity, report.ErrorItems);
report.ErrorReset();
}
return;
}
private OutputPresentationType GetRenderType(string type)
{
switch (type.ToLower())
{
case "htm":
case "html":
contentType = "text/html";
return OutputPresentationType.HTML;
case "pdf":
contentType = "application/pdf";
return OutputPresentationType.PDF;
case "xml":
contentType = "text/xml";
return OutputPresentationType.XML;
case "csv":
contentType = "text/csv";
return OutputPresentationType.CSV;
case "xlsx":
contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
return OutputPresentationType.ExcelTableOnly;
case "rtf":
contentType = "application/rtf";
return OutputPresentationType.RTF;
default:
contentType = "text/html";
return OutputPresentationType.HTML;
}
}
private string FindReportFile(string file)
{
string foundFile = null;
foundFile = Path.Combine(_settings.ReportsFolder, file);
if (!System.IO.File.Exists(foundFile))
{
// recursively search for the file in the content root path
// This is a workaround for the case where the file might be in a subdirectory
// of the content root path, but the path provided is not absolute.
// TODO: read search directory from configuration
var di = new DirectoryInfo(_webHostEnvironment.ContentRootPath);
FileInfo[] files = di.GetFiles(file, SearchOption.AllDirectories);
if (files.Length > 0)
{
foundFile = files[0].FullName;
}
}
// If the file exists, return the full path
if (!System.IO.File.Exists(foundFile))
{
AddError(8, "Report file '{0}' does not exist.", foundFile);
return null;
}
return foundFile;
}
private async Task GetReport(string prog, string file)
{
// Now parse the file
RDLParser rdlp;
Report r;
try
{
// Make sure RdlEngine is configured before we ever parse a program
// The config file must exist in the Bin directory.
string[] searchDir =
[
this.ReportFile.StartsWith("~") ? "~/Bin" : "/Bin" + Path.DirectorySeparatorChar,
System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)
];
RdlEngineConfig.RdlEngineConfigInit(searchDir);
rdlp = new RDLParser(prog);
string folder = Path.GetDirectoryName(file);
if (folder == "")
folder = Environment.CurrentDirectory;
rdlp.Folder = folder;
rdlp.DataSourceReferencePassword = new NeedPassword(this.GetPassword);
r = await rdlp.Parse();
if (r.ErrorMaxSeverity > 0)
{
AddError(r.ErrorMaxSeverity, r.ErrorItems);
if (r.ErrorMaxSeverity >= 8)
r = null;
r.ErrorReset();
}
// If we've loaded the report; we should tell it where it got loaded from
if (r != null)
{
r.Folder = folder;
r.Name = Path.GetFileNameWithoutExtension(file);
r.GetDataSourceReferencePassword = new Rdl.NeedPassword(GetPassword);
}
}
catch (Exception e)
{
r = null;
AddError(8, "Exception parsing report {0}. {1}", file, e.Message);
}
return r;
}
}
}
================================================
FILE: RdlAsp.Mvc/RdlSession.cs
================================================
using System;
using System.Web;
using System.Collections;
using Majorsilence.Reporting.Rdl;
namespace Majorsilence.Reporting.RdlAsp
{
///
/// RdlSession holds some session specific information
///
public class RdlSession
{
public static readonly string SessionStat="SessionStat";
public int Count;
public RdlSession()
{
Count = 0;
}
}
}
================================================
FILE: RdlAsp.Mvc/ReportHelper.cs
================================================
using System;
using System.Web;
using System.IO;
using System.Collections;
using System.Collections.Specialized;
using System.Text;
using System.Web.Caching;
using Majorsilence.Reporting.Rdl;
using Microsoft.Extensions.Caching.Memory;
namespace Majorsilence.Reporting.RdlAsp
{
internal class ReportHelper
{
static internal bool DoCaching = true;
internal int CacheHits;
internal int CacheMisses;
private ReportHelper()
{
CacheHits = 0;
CacheMisses = 0;
}
static internal ReportHelper Get(IMemoryCache app)
{
ReportHelper s = app.Get("fyistats") as ReportHelper;
if (s == null)
{
s = new ReportHelper();
app.Set("fyistats", s);
}
return s;
}
static internal void IncrHits(IMemoryCache app)
{
ReportHelper s = Get(app);
lock (s)
{
s.CacheHits++;
}
}
static internal void IncrMisses(IMemoryCache app)
{
ReportHelper s = Get(app);
lock (s)
{
s.CacheMisses++;
}
}
static internal Report GetCachedReport(string file, IMemoryCache c)
{
if (!ReportHelper.DoCaching) // caching is disabled
{
ReportHelper.IncrMisses(c);
return null;
}
// Cache c = this.Context.Cache;
ReportDefn rd = c.Get(file) as ReportDefn;
if (rd == null)
{
ReportHelper.IncrMisses(c);
return null;
}
ReportHelper.IncrHits(c);
Report r = new Report(rd);
return r;
}
static internal void SaveCachedReport(Report r, string file, IMemoryCache c)
{
if (!ReportHelper.DoCaching) // caching is disabled
return;
c.Set(file, r.ReportDefinition);
return;
}
static internal ListDictionary GetParameters(string parms)
{
ListDictionary ld = new ListDictionary();
if (parms == null)
return ld; // dictionary will be empty in this case
// parms are separated by &
char[] breakChars = new char[] { '&' };
string[] ps = parms.Split(breakChars);
foreach (string p in ps)
{
int iEq = p.IndexOf("=");
if (iEq > 0)
{
string name = p.Substring(0, iEq);
string val = p.Substring(iEq + 1);
ld.Add(name, val);
}
}
return ld;
}
static internal string GetSource(string file)
{
StreamReader fs = null;
string prog = null;
try
{
fs = new StreamReader(file);
prog = fs.ReadToEnd();
}
finally
{
if (fs != null)
fs.Close();
}
return prog;
}
static internal void SetUserContext(Report r, HttpContext context, NeedPassword np)
{
r.GetDataSourceReferencePassword = np;
if (context == null) // may not always have a context
return;
HttpRequest req = context.Request;
if (req != null && req.UserLanguages!= null && req.UserLanguages.Length > 0)
{
string l = req.UserLanguages[0];
r.ClientLanguage = l;
}
if (context.User != null && context.User.Identity != null)
{
System.Security.Principal.IIdentity id = context.User.Identity;
if (id.IsAuthenticated)
{
r.UserID = id.Name;
}
}
return;
}
///
/// Returns the HTML needed to represent the parameters of a report.
///
static internal string GetParameterHtml(Report rpt, IDictionary pd, HttpContext context, string reportFile, bool bShow)
{
if (rpt == null)
return "";
StringBuilder pHtml = new StringBuilder();
pHtml.AppendFormat(""); // End of table, form, html
return pHtml.ToString();
}
static private void AppendExports(StringBuilder pHtml, HttpContext context, string reportFile)
{
StringBuilder args = new StringBuilder();
NameValueCollection nvc;
nvc = context.Request.QueryString; // parameters
foreach (var key in nvc.AllKeys)
{
if (!key.StartsWith("rs:"))
args.AppendFormat("&{0}={1}",
System.Web.HttpUtility.UrlEncode(key), System.Web.HttpUtility.UrlEncode(nvc[key]));
}
string sargs = args.ToString();
string lpdf =
$"PDF";
string lxml =
$"XML";
string lcsv =
$"CSV";
pHtml.AppendFormat("| {0} | {1} {2} |
",
lpdf, lxml, lcsv);
}
}
}
================================================
FILE: RdlAsp.Mvc/Settings.cs
================================================
namespace Majorsilence.Reporting.RdlAsp
{
public class Settings
{
public string ReportsFolder { get; set; } = "Reports/";
}
}
================================================
FILE: RdlCmd/GlobalSuppressions.cs
================================================
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.
using System.Diagnostics.CodeAnalysis;
#if !DRAWINGCOMPAT
[assembly: SuppressMessage("Interoperability", "CA1416:Validate platform compatibility",
Justification = "System.Drawing usage is intentional")]
#endif
================================================
FILE: RdlCmd/RdlCmd.cs
================================================
using System;
using System.IO;
using System.Collections;
using System.Collections.Specialized;
using System.Reflection;
#if DRAWINGCOMPAT
using Draw2 = Majorsilence.Drawing;
using Majorsilence.Drawing.Imaging;
#else
using Draw2 = System.Drawing;
using System.Drawing.Imaging;
#endif
using System.Text.RegularExpressions;
using System.Globalization;
using Majorsilence.Reporting.Rdl;
using System.Threading.Tasks;
namespace Majorsilence.Reporting.RdlCmd
{
///
/// RdlCmd is a batch report generation program. It takes a report definition
/// and renders it into the requested formats.
///
public class RdlCmd
{
///
/// RdlCmd takes a report definition and renders it in the specified formats.
///
///
private int returnCode=0; // return code
private string _DataSourcePassword;
private bool _ShowStats = false; // show statistics
private string _StampInfo=null; // PDF stamping information
private string _user = null; // Allow the user to be set via a command line param GJL AJM 12062008
[STAThread]
static public async Task Main(string[] args)
{
// Handle the arguments
if (args == null || args.Length==0)
{
WriteLicense();
return 8;
}
RdlCmd rc = new RdlCmd();
char[] breakChars = new char[] {'+'};
string[] files=null;
string[] types=null;
string dir=null;
int returnCode=0;
string connectionStringOverwrite = string.Empty;
foreach(string s in args)
{
string t = s.Substring(0,2);
switch (t)
{
case "/l":
case "-l":
WriteLicense();
return 0;
case "/f":
case "-f":
files = s.Substring(2).Split(breakChars);
break;
case "/o":
case "-o":
dir = s.Substring(2);
break;
case "/p":
case "-p":
rc._DataSourcePassword = s.Substring(2);
break;
case "/t":
case "-t":
types = s.Substring(2).Split(breakChars);
break;
case "--help":
case "-help":
case "-h":
case "--h":
case "/?":
case "-?":
WriteHelp();
return 0;
case "/s":
case "-s":
rc._ShowStats = true;
break;
case "/i":
case "-i":
rc._StampInfo = s.Substring(2);
break;
case "/u":
case "-u":
rc._user = s.Substring(2); // Allow the user to be set via a command line param (u) GJL AJM 12062008
break;
case "/c":
case "-c":
connectionStringOverwrite = s.Substring(2);
break;
default:
Console.WriteLine("Unknown command '{0}' ignored.", s);
returnCode = 4;
break;
}
}
if (files == null)
{
Console.WriteLine("/f parameter is required.");
return 8;
}
if (types == null)
{
Console.WriteLine("/t parameter is required.");
return 8;
}
if (dir == null)
{
dir = Environment.CurrentDirectory;
}
if (dir[dir.Length-1] != Path.DirectorySeparatorChar)
dir += Path.DirectorySeparatorChar;
rc.returnCode = returnCode;
await rc.DoRender(dir, files, types, connectionStringOverwrite);
return rc.returnCode;
}
private string GetPassword()
{
return this._DataSourcePassword;
}
// Render the report files with the requested types
private async Task DoRender(string dir, string[] files, string[] types, string connectionStringOverwrite)
{
string source;
Report report;
int index;
ListDictionary ld;
string file;
DateTime start = DateTime.Now;
foreach (string filename in files)
{
DateTime startF = DateTime.Now;
// Any parameters? e.g. file1.rdl?ordid=5
index = filename.LastIndexOf('?');
if (index >= 0)
{
ld = this.GetParameters(filename.Substring(index+1));
file = filename.Substring(0, index);
}
else
{
ld = null;
file = filename;
}
// Obtain the source
source = this.GetSource(file);
if (this._ShowStats)
{
DateTime temp = DateTime.Now;
Console.WriteLine("load file {0}: {1}", file, temp - startF);
startF = DateTime.Now;
}
if (source == null)
continue; // error: process the rest of the files
// Compile the report
report = await this.GetReport(source, file, connectionStringOverwrite);
report.UserID = _user; //Set the user of the report based on the parameter passed in GJL AJM 12062008
if (this._ShowStats)
{
DateTime temp = DateTime.Now;
Console.WriteLine("Compile: {0}", temp - startF);
startF = DateTime.Now;
}
if (report == null)
continue; // error: process the rest of the files
// Obtain the data
string fileNoExt=null;
if (ld != null)
{
fileNoExt = ld["rc:ofile"] as string;
if (fileNoExt != null)
ld.Remove("rc:ofile"); // don't pass this as an argument to the report
}
await report.RunGetData(ld);
if (this._ShowStats)
{
DateTime temp = DateTime.Now;
Console.WriteLine("Get Data: {0}", temp - startF);
startF = DateTime.Now;
}
// Render the report in each of the requested types
if (fileNoExt != null)
fileNoExt = dir + fileNoExt;
else
fileNoExt = dir + Path.GetFileNameWithoutExtension(file);
foreach (string stype in types)
{
await SaveAs(report, fileNoExt+"."+stype, stype);
if (this._ShowStats)
{
DateTime temp = DateTime.Now;
Console.WriteLine("Render {0}: {1}", stype, temp - startF);
startF = DateTime.Now;
}
}
} // end foreach files
if (this._ShowStats)
{
DateTime end = DateTime.Now;
Console.WriteLine("Total time: {0}", end - start);
}
}
private ListDictionary GetParameters(string parms)
{
ListDictionary ld= new ListDictionary();
if (parms == null)
return ld; // dictionary will be empty in this case
// parms are separated by &
char[] breakChars = new char[] {'&'};
string[] ps = parms.Split(breakChars);
foreach (string p in ps)
{
int iEq = p.IndexOf("=");
if (iEq > 0)
{
string name = p.Substring(0, iEq);
string val = p.Substring(iEq + 1);
ld.Add(name, val);
}
}
return ld;
}
private string GetSource(string file)
{
StreamReader fs=null;
string prog=null;
try
{
fs = new StreamReader(file);
prog = fs.ReadToEnd();
}
catch(Exception e)
{
prog = null;
Console.WriteLine(e.Message);
returnCode = 8;
}
finally
{
if (fs != null)
fs.Close();
}
return prog;
}
private async Task GetReport(string prog, string file, string connectionStringOverwrite)
{
// Now parse the file
RDLParser rdlp;
Report r;
try
{
rdlp = new RDLParser(prog);
string folder = Path.GetDirectoryName(file);
if (folder == "")
folder = Environment.CurrentDirectory;
rdlp.Folder = folder;
rdlp.DataSourceReferencePassword = new NeedPassword(this.GetPassword);
if (!string.IsNullOrWhiteSpace(connectionStringOverwrite))
{
rdlp.OverwriteConnectionString = connectionStringOverwrite;
}
r = await rdlp.Parse();
if (r.ErrorMaxSeverity > 0)
{
// have errors fill out the msgs
Console.WriteLine("{0} has the following errors:", file);
foreach (string emsg in r.ErrorItems)
{
Console.WriteLine(emsg); // output message to console
}
int severity = r.ErrorMaxSeverity;
r.ErrorReset();
if (severity > 4)
{
r = null; // don't return when severe errors
returnCode = 8;
}
}
// If we've loaded the report; we should tell it where it got loaded from
if (r != null)
{
r.Folder = folder;
r.Name = Path.GetFileNameWithoutExtension(file);
r.GetDataSourceReferencePassword = new Rdl.NeedPassword(GetPassword);
}
}
catch(Exception e)
{
r = null;
Console.WriteLine(e.Message);
returnCode = 8;
}
return r;
}
///
/// Save the file. The extension determines the type of file to save.
///
/// Name of the file to be saved to.
/// Type of file to save. Should be "pdf", "xml", "html", mht.
private async Task SaveAs(Report report, string FileName, string type)
{
string ext = type.ToLower();
OneFileStreamGen sg=null;
try
{
bool isOldPdf = false;
if (System.Environment.OSVersion.Platform == PlatformID.Unix && type=="pdf" ) {
if (System.IO.Directory.Exists("/usr/share/fonts/truetype/msttcorefonts")==false)
{
isOldPdf = true;
}
}
if (ext == "tifb")
FileName = FileName.Substring(0, FileName.Length - 1); // get rid of the 'b'
sg = new OneFileStreamGen(FileName, true); // overwrite with this name
switch(ext)
{
case "pdf":
if (this._StampInfo == null)
{
if (isOldPdf)
{
await report.RunRender(sg, OutputPresentationType.PDFOldStyle);
}
else
{
await report.RunRender(sg, OutputPresentationType.PDF);
}
}
else
await SaveAsPdf(report, sg);
break;
case "xml":
await report.RunRender(sg, OutputPresentationType.XML);
break;
case "mht":
await report.RunRender(sg, OutputPresentationType.MHTML);
break;
case "html": case "htm":
await report.RunRender(sg, OutputPresentationType.HTML);
break;
case "csv":
await report.RunRender(sg, OutputPresentationType.CSV);
break;
case "xlsx_table":
await report.RunRender(sg, OutputPresentationType.ExcelTableOnly);
break;
case "xlsx":
await report.RunRender(sg, OutputPresentationType.Excel2007);
break;
case "rtf":
await report.RunRender(sg, OutputPresentationType.RTF);
break;
case "tif": case "tiff":
await report.RunRender(sg, OutputPresentationType.TIF);
break;
case "tifb":
await report.RunRender(sg, OutputPresentationType.TIFBW);
break;
default:
Console.WriteLine("Unsupported file extension '{0}'. Must be 'pdf', 'xml', 'mht', 'csv', 'xslx', 'xlsx_table', 'rtf', 'tif', 'tifb' or 'html'", type);
returnCode = 8;
break;
}
}
catch(Exception e)
{
Console.WriteLine(e.Message);
returnCode = 8;
}
finally
{
if (sg != null)
{
sg.CloseMainStream();
}
}
if (report.ErrorMaxSeverity > 0)
{
// have errors fill out the msgs
Console.WriteLine("{0} has the following runtime errors:", FileName);
foreach (string emsg in report.ErrorItems)
{
Console.WriteLine(emsg); // output message to console
}
report.ErrorReset();
}
return;
}
private async Task SaveAsPdf(Report report, OneFileStreamGen sg)
{
Pages pgs = await report.BuildPages();
FileStream strm=null;
Draw2.Image im=null;
// Handle any parameters
float x = 0; // x position of image
float y = 0; // y position of image
float h = 0; // height of image
float w = 0; // width position of image
string fname=null;
int index = _StampInfo.LastIndexOf('?');
bool bClip=false; // we force clip if either height or width not specified
if (index >= 0)
{
// Get all the arguments for sizing the image
ListDictionary ld = this.GetParameters(_StampInfo.Substring(index+1));
fname = _StampInfo.Substring(0, index);
string ws = (string)ld["x"];
x = Size(ws);
ws = (string)ld["y"];
y = Size(ws);
ws = (string)ld["h"];
if (ws == null)
{
bClip = true;
ws = "12in"; // just give it a big value
}
h = Size(ws);
ws = (string)ld["w"];
if (ws == null)
{
bClip = true;
ws = "12in"; // just give it a big value
}
w = Size(ws);
}
else
{
fname = _StampInfo;
// force size
bClip = true;
h = Size("12in");
w = Size("12in");
}
// Stamp the first page
foreach (Page p in pgs) // we loop then break after obtaining one
{
try
{
strm = new FileStream(fname, System.IO.FileMode.Open, FileAccess.Read);
im = Draw2.Image.FromStream(strm);
int height = im.Height;
int width = im.Width;
MemoryStream ostrm = new MemoryStream();
/* Replaced with high quality JPEG encoder
* 06122007AJM */
ImageFormat imf = ImageFormat.Jpeg;
//im.Save(ostrm, imf);
Draw2.Imaging.ImageCodecInfo[] info;
info = ImageCodecInfo.GetImageEncoders();
EncoderParameters encoderParameters;
encoderParameters = new EncoderParameters(1);
encoderParameters.Param[0] = new EncoderParameter(Encoder.Quality, 100L);
Draw2.Imaging.ImageCodecInfo codec = null;
for (int i = 0; i < info.Length; i++)
{
if (info[i].FormatDescription == "JPEG")
{
codec = info[i];
break;
}
}
im.Save(ostrm, codec, encoderParameters);
// end change
byte[] ba = ostrm.ToArray();
ostrm.Close();
PageImage pi = new PageImage(imf, ba, width, height);
pi.SI = new StyleInfo(); // defaults are ok; don't want border, etc
// Set location, height and width
pi.X = x;
pi.Y = y;
pi.H = h;
pi.W = w;
pi.Sizing = bClip? ImageSizingEnum.Clip: ImageSizingEnum.FitProportional;
p.InsertObject(pi);
}
catch (Exception e)
{
// image failed to load, continue processing
Console.WriteLine("Stamping image failed. {0}", e.Message);
}
finally
{
if (strm != null)
strm.Close();
if (im != null)
im.Dispose();
}
break; // only stamp the first page
}
// Now create the PDF
await report.RunRenderPdf(sg, pgs);
}
private float Size(string t)
{
if (t == null)
return 0;
// Size is specified in CSS Length Units
// format is
// in -> inches (1 inch = 2.54 cm)
// cm -> centimeters (.01 meters)
// mm -> millimeters (.001 meters)
// pt -> points (1 point = 1/72.27 inches)
// pc -> Picas (1 pica = 12 points)
int size=0;
t = t.Trim();
int space = t.LastIndexOf(' ');
string n; // number string
string u; // unit string
decimal d; // initial number
try // Convert.ToDecimal can be very picky
{
if (space != -1) // any spaces
{
n = t.Substring(0,space).Trim(); // number string
u = t.Substring(space).Trim(); // unit string
}
else if (t.Length >= 3)
{
n = t.Substring(0, t.Length-2).Trim();
u = t.Substring(t.Length-2).Trim();
}
else
{
// Illegal unit
Console.WriteLine(string.Format("Illegal size '{0}' specified, assuming 0 length.", t));
return 0;
}
if (!Regex.IsMatch(n, @"\A[ ]*[-]?[0-9]*[.]?[0-9]*[ ]*\Z"))
{
Console.WriteLine(string.Format("Unknown characters in '{0}' specified. Number must be of form '###.##'. Local conversion will be attempted.", t));
d = Convert.ToDecimal(n, NumberFormatInfo.InvariantInfo); // initial number
}
else
d = Convert.ToDecimal(n, NumberFormatInfo.InvariantInfo); // initial number
}
catch (Exception ex)
{
// Illegal unit
Console.WriteLine("Illegal size '" + t + "' specified, assuming 0 length.\r\n"+ex.Message);
return 0;
}
switch(u) // convert to millimeters
{
case "in":
size = (int) (d * 2540m);
break;
case "cm":
size = (int) (d * 1000m);
break;
case "mm":
size = (int) (d * 100m);
break;
case "pt":
size = (int) (d * (2540m / 72.27m));
break;
case "pc":
size = (int) (d * (2540m / 72.27m * 12m));
break;
default:
// Illegal unit
Console.WriteLine("Unknown sizing unit '" + u + "' specified, assuming inches.");
size = (int) (d * 2540m);
break;
}
return (float) ((double) size / 2540.0 * 72.27f);
}
static private void WriteHelp()
{
Console.WriteLine("");
Console.WriteLine("Runs a RDL report file and creates a file for each type specified.");
Console.WriteLine("RdlCmd /ffile.rdl /tpdf [/ooutputdir]");
Console.WriteLine("/f is followed by a file or file list. e.g. /ffile1.rdl+file2.rdl");
Console.WriteLine(" Report arguments can optionally be passed by using '?' after the file.");
Console.WriteLine(" Multiple report arguments are separated by '&'.");
Console.WriteLine(" For example, /ffile1.rdl?parm1=XYZ Inc.&parm2=1000");
Console.WriteLine(" One special argument is 'rc:ofile' which names the output file.");
Console.WriteLine(" For example, /ffile1.rdl?parm1=XYZ Inc.&parm2=1000&rc:ofile=xyzfile");
Console.WriteLine("/t is followed by the type of output file: pdf, html, mht, xml, csv,");
Console.WriteLine(" xslx, xlsx_table, rtf, tif, tifb e.g /tpdf+xml");
Console.WriteLine("/o is followed by the output directory. The file name is the same as the");
Console.WriteLine(" input (or the rc:ofile parameter) except with the type as the extension.");
Console.WriteLine("/c is followed by the connection string");
Console.WriteLine(" This will overwrite the connection string in the report definition.");
Console.WriteLine("/p is followed by the pass phrase needed by reports using a shared data source.");
Console.WriteLine("/s displays elapsed time statistics");
Console.WriteLine("/i is followed by an image filename to be stamped onto first page of the PDF.");
Console.WriteLine(" Location arguments x, y, h, w can optionally be passed using '?'");
Console.WriteLine(" Arguments are separated by '&'. Only pdf files support this option.");
Console.WriteLine(" For example, /i\"copyright.gif?x=4in&y=3in&w=7cm&h=16pt\"");
Console.WriteLine("/u is followed by the report user ID.");
Console.WriteLine("/l outputs the license and warranty");
Console.WriteLine("/? outputs this text");
}
static private void WriteLicense()
{
Console.WriteLine(string.Format("RdlCmd Version {0}, Copyright (C) 2004-2008 fyiReporting Software, LLC",
Assembly.GetExecutingAssembly().GetName().Version.ToString()));
Console.WriteLine("");
Console.WriteLine("RdlCmd comes with ABSOLUTELY NO WARRANTY. This is free software,");
Console.WriteLine("and you are welcome to redistribute it under certain conditions.");
Console.WriteLine("");
Console.WriteLine("For help, type RdlCmd /?");
return;
}
}
}
================================================
FILE: RdlCmd/RdlCmd.csproj
================================================
App.ico
false
Exe
Majorsilence.Reporting.RdlCmd
OnBuildSuccess
true
Debug;Release;Debug-DrawingCompat;Release-DrawingCompat
net48;net8.0;net10.0
net8.0;net10.0
4014
System
System.Data
System.XML
================================================
FILE: RdlCmd/runtimeconfig.template.json
================================================
{
"properties": {
"runtimeOptions": {
}
},
"configProperties": {
"System.Drawing.EnableUnixSupport": true
}
}
================================================
FILE: RdlCreator/Body.cs
================================================
using System.Collections.Generic;
using System.Xml.Serialization;
using System;
namespace Majorsilence.Reporting.RdlCreator
{
public class Body
{
[XmlElement("ReportItems", typeof(ReportItemsBody))]
public ReportItemsBody ReportItems { get; set; }
[XmlElement(ElementName = "Height")]
public ReportItemSize Height { get; set; }
[XmlElement(ElementName = "Width")]
public ReportItemSize Width { get; set; }
}
}
================================================
FILE: RdlCreator/BorderColor.cs
================================================
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
public class BorderColor
{
[XmlElement(ElementName = "Bottom")]
public string Bottom { get; set; }
[XmlElement(ElementName = "Top")]
public string Top { get; set; }
[XmlElement(ElementName = "Left")]
public string Left { get; set; }
[XmlElement(ElementName = "Right")]
public string Right { get; set; }
}
}
================================================
FILE: RdlCreator/BorderStyle.cs
================================================
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
public class BorderStyle
{
[XmlElement(ElementName = "Default")]
public BorderStyleType Default { get; set; }
[XmlElement(ElementName = "Left")]
public BorderStyleType Left { get; set; }
[XmlElement(ElementName = "Right")]
public BorderStyleType Right { get; set; }
[XmlElement(ElementName = "Top")]
public BorderStyleType Top { get; set; }
[XmlElement(ElementName = "Bottom")]
public BorderStyleType Bottom { get; set; }
}
}
================================================
FILE: RdlCreator/BorderStyleType.cs
================================================
namespace Majorsilence.Reporting.RdlCreator
{
public class BorderStyleType
{
private string _value;
public BorderStyleType()
{
_value = "None";
}
public BorderStyleType(string value)
{
_value = value;
}
public static BorderStyleType None => new BorderStyleType("None");
public static BorderStyleType Solid => new BorderStyleType("Solid");
public static BorderStyleType Dashed => new BorderStyleType("Dashed");
public static implicit operator string(BorderStyleType borderStyleType)
{
return borderStyleType.ToString();
}
public override string ToString()
{
return _value;
}
}
}
================================================
FILE: RdlCreator/BorderWidth.cs
================================================
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
public class BorderWidth
{
[XmlElement(ElementName = "Top")]
public ReportItemSize Top { get; set; }
[XmlElement(ElementName = "Bottom")]
public ReportItemSize Bottom { get; set; }
[XmlElement(ElementName = "Left")]
public ReportItemSize Left { get; set; }
[XmlElement(ElementName = "Right")]
public ReportItemSize Right { get; set; }
}
}
================================================
FILE: RdlCreator/Card.cs
================================================
using System;
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
public class Card
{
private readonly Report _rpt = null;
public Card() { }
public Card(Report rpt)
{
_rpt = rpt;
}
[XmlElement(ElementName = "Value")] public Value Value { get; set; }
[XmlElement(ElementName = "Style")] public Style Style { get; set; }
[XmlAttribute(AttributeName = "Name")] public string Name { get; set; }
[XmlElement(ElementName = "Top")] public ReportItemSize Top { get; set; }
[XmlElement(ElementName = "Left")] public ReportItemSize Left { get; set; }
[XmlElement(ElementName = "Width")] public ReportItemSize Width { get; set; }
[XmlElement(ElementName = "Height")] public ReportItemSize Height { get; set; }
[XmlElement(ElementName = "CanGrow")] public bool CanGrow { get; set; }
public bool PageBreakAtEnd { get; set; }
public bool PageBreakAtStart { get; set; }
public void Add(Text text)
{
// Calculate the relative position of the Text
// TODO: Handle units other than "pt"
float relativeTop = this.Top.Value + text.Top.Value;
float relativeLeft = this.Left.Value + text.Left.Value;
// Set the Text's position relative to the Card
text.Top = relativeTop.ToString();
text.Left = relativeLeft.ToString();
_rpt?.Body?.ReportItems?.Text?.Add(text);
}
public void Add(CustomReportItems cri)
{
// Calculate the relative position of the Text
// TODO: Handle units other than "pt"
float relativeTop = this.Top.Value + cri.Top.Value;
float relativeLeft = this.Left.Value + cri.Left.Value;
// Set the Text's position relative to the Card
cri.Top = relativeTop.ToString();
cri.Left = relativeLeft.ToString();
_rpt?.Body?.ReportItems?.CustomReportItems?.Add(cri);
}
}
}
================================================
FILE: RdlCreator/ConnectionProperties.cs
================================================
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
public class ConnectionProperties
{
[XmlElement(ElementName = "DataProvider")]
public string DataProvider { get; set; }
[XmlElement(ElementName = "ConnectString")]
public string ConnectString { get; set; }
}
}
================================================
FILE: RdlCreator/Create.cs
================================================
using Majorsilence.Reporting.Rdl;
using MathNet.Numerics;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
public class Create
{
public async Task GenerateRdl(Report report)
{
var serializer = new XmlSerializer(typeof(Report));
string xml;
#if NET6_OR_GREATER
await using (var writer = new Utf8StringWriter())
{
serializer.Serialize(writer, report);
xml = writer.ToString();
}
#else
using (var writer = new Utf8StringWriter())
{
serializer.Serialize(writer, report);
xml = writer.ToString();
}
#endif
var rdlp = new RDLParser(xml);
var fyiReport = await rdlp.Parse();
ValidateReport(fyiReport);
return fyiReport;
}
private static void ValidateReport(Rdl.Report fyiReport)
{
if (fyiReport.ErrorMaxSeverity > 0)
{
if (fyiReport.ErrorMaxSeverity > 4)
{
var errorMessages = string.Join(Environment.NewLine, fyiReport.ErrorItems.Cast());
int severity = fyiReport.ErrorMaxSeverity;
fyiReport.ErrorReset();
throw new Exception($"Errors encountered with severity {severity}:{Environment.NewLine}{errorMessages}");
}
}
}
public async Task GenerateRdl(DataTable data,
string description = "",
string author = "",
string pageHeight = "11in",
string pageWidth = "8.5in",
string width = "7.5in",
string topMargin = ".25in",
string leftMargin = ".25in",
string rightMargin = ".25in",
string bottomMargin = ".25in",
string pageHeaderText = "",
string name="")
{
var headerTableCells = new List();
var bodyTableCells = new List();
var fields = new List();
for (int i = 0; i < data.Columns.Count; i++)
{
string colName = data.Columns[i].ColumnName;
TypeCode colType = Type.GetTypeCode(data.Columns[i].DataType);
headerTableCells.Add(new TableCell
{
ReportItems = new TableCellReportItems()
{
ReportItem = new Text
{
Name = $"TextboxH{colName}",
Value = new Value { Text = colName },
Style = new Style { TextAlign = "Center", FontWeight = "Bold" }
}
}
});
bodyTableCells.Add(new TableCell
{
ReportItems = new TableCellReportItems()
{
ReportItem = new Text
{
Name = $"TextBoxB{colName}",
Value = new Value { Text = $"=Fields!{colName}.Value" },
CanGrow = true
}
}
});
fields.Add(new Field
{
Name = colName,
DataField = colName,
TypeName = colType.ToString()
});
}
var xml = InternalReportCreation("", "",
"", description, author, pageHeight, pageWidth, width, topMargin, leftMargin,
rightMargin, bottomMargin, pageHeaderText, headerTableCells, bodyTableCells, fields, name);
var rdlp = new RDLParser(xml);
var fyiReport = await rdlp.Parse();
ValidateReport(fyiReport);
await fyiReport.DataSets["Data"].SetData(data);
return fyiReport;
}
public async Task GenerateRdl(IEnumerable data,
string description = "",
string author = "",
string pageHeight = "11in",
string pageWidth = "8.5in",
string width = "7.5in",
string topMargin = ".25in",
string leftMargin = ".25in",
string rightMargin = ".25in",
string bottomMargin = ".25in",
string pageHeaderText = "",
string name="")
{
var headerTableCells = new List();
var bodyTableCells = new List();
var fields = new List();
var properties = typeof(T).GetProperties();
for (int i = 0; i < properties.Length; i++)
{
string colName = properties[i].Name;
TypeCode colType = Type.GetTypeCode(properties[i].PropertyType);
headerTableCells.Add(new TableCell
{
ReportItems = new TableCellReportItems()
{
ReportItem = new Text
{
Name = $"TextboxH{colName}",
Value = new Value { Text = colName },
Style = new Style { TextAlign = "Center", FontWeight = "Bold" }
}
}
});
bodyTableCells.Add(new TableCell
{
ReportItems = new TableCellReportItems()
{
ReportItem = new Text
{
Name = $"TextBoxB{colName}",
Value = new Value { Text = $"=Fields!{colName}.Value" },
CanGrow = true
}
}
});
fields.Add(new Field
{
Name = colName,
DataField = colName,
TypeName = colType.ToString()
});
}
var xml = InternalReportCreation("", "",
"", description, author, pageHeight, pageWidth, width, topMargin, leftMargin,
rightMargin, bottomMargin, pageHeaderText, headerTableCells, bodyTableCells, fields, name);
var rdlp = new RDLParser(xml);
var fyiReport = await rdlp.Parse();
ValidateReport(fyiReport);
await fyiReport.DataSets["Data"].SetData(data);
return fyiReport;
}
private string GetDataProviderString(DataProviders dataProvider)
{
return dataProvider switch
{
DataProviders.SqlServer_MicrosoftDataSqlClient => "Microsoft.Data.SqlClient",
DataProviders.Oracle => "Oracle",
#if WINDOWS
DataProviders.OleDb => "OLEDB",
#endif
DataProviders.Odbc => "ODBC",
DataProviders.Xml => "XML",
DataProviders.Text => "Text",
DataProviders.MySql => "MySQL.NET",
DataProviders.PostgreSQL => "PostgreSQL",
DataProviders.SqlServer_SystemData => "SQL",
DataProviders.Firebird => "Firebird.NET 2.0",
DataProviders.SQLite_MicrosoftData => "Microsoft.Data.Sqlite",
DataProviders.SQLite_SystemData => "SQLite",
DataProviders.Json => "Json",
DataProviders.FileDirectory => "FileDirectory",
DataProviders.PostgreSQL_Devart => "PostgreSQL_Devart",
_ => throw new ArgumentOutOfRangeException(nameof(dataProvider), dataProvider, null)
};
}
public async Task GenerateRdl(DataProviders dataProvider,
string connectionString,
string commandText,
CommandType commandType = CommandType.Text,
string description = "",
string author = "",
string pageHeight = "11in",
string pageWidth = "8.5in",
string width = "7.5in",
string topMargin = ".25in",
string leftMargin = ".25in",
string rightMargin = ".25in",
string bottomMargin = ".25in",
string pageHeaderText = "",
string name = "")
{
string providerString = GetDataProviderString(dataProvider);
return await GenerateRdl(providerString,
connectionString,
commandText,
commandType,
description,
author,
pageHeight,
pageWidth,
width,
topMargin,
leftMargin,
rightMargin,
bottomMargin,
pageHeaderText,
name);
}
public async Task GenerateRdl(string dataProvider,
string connectionString,
string commandText,
CommandType commandType = CommandType.Text,
string description = "",
string author = "",
string pageHeight = "11in",
string pageWidth = "8.5in",
string width = "7.5in",
string topMargin = ".25in",
string leftMargin = ".25in",
string rightMargin = ".25in",
string bottomMargin = ".25in",
string pageHeaderText = "",
string name = "")
{
var headerTableCells = new List();
var bodyTableCells = new List();
var fields = new List();
using (var cn = RdlEngineConfig.GetConnection(dataProvider, connectionString))
{
cn.ConnectionString = connectionString;
cn.Open();
using (var cmd = cn.CreateCommand())
{
cmd.CommandText = commandText;
cmd.CommandType = commandType;
using (var dr = cmd.ExecuteReader(CommandBehavior.SchemaOnly))
{
for (int i = 0; i < dr.FieldCount; i++)
{
string colName = dr.GetName(i);
TypeCode colType = Type.GetTypeCode(dr.GetFieldType(i));
headerTableCells.Add(new TableCell
{
ReportItems = new TableCellReportItems()
{
ReportItem = new Text
{
Name = $"TextboxH{colName}",
Value = new Value { Text = colName },
Style = new Style { TextAlign = "Center", FontWeight = "Bold" }
}
}
});
bodyTableCells.Add(new TableCell
{
ReportItems = new TableCellReportItems()
{
ReportItem = new Text
{
Name = $"TextBoxB{colName}",
Value = new Value { Text = $"=Fields!{colName}.Value" },
CanGrow = true
}
}
});
fields.Add(new Field
{
Name = colName,
DataField = colName,
TypeName = colType.ToString()
});
}
}
}
}
var xml = InternalReportCreation(dataProvider, connectionString,
commandText, description, author, pageHeight, pageWidth, width, topMargin, leftMargin,
rightMargin, bottomMargin, pageHeaderText, headerTableCells, bodyTableCells, fields, name);
var rdlp = new RDLParser(xml);
var fyiReport = await rdlp.Parse();
ValidateReport(fyiReport);
return fyiReport;
}
private static string InternalReportCreation(string dataProvider, string connectionString,
string commandText, string description, string author, string pageHeight, string pageWidth,
string width, string topMargin, string leftMargin, string rightMargin, string bottomMargin,
string pageHeaderText, List headerTableCells, List bodyTableCells, List fields,
string name)
{
// Create a new instance of the Report class
var report = new Report
{
Description = description,
Author = author,
Name=name,
PageHeight = pageHeight,
PageWidth = pageWidth,
Width = width,
TopMargin = topMargin,
LeftMargin = leftMargin,
RightMargin = rightMargin,
BottomMargin = bottomMargin,
DataSources = new DataSources
{
DataSource = new DataSource
{
Name = "DS1",
ConnectionProperties = new ConnectionProperties
{
DataProvider = dataProvider,
ConnectString = connectionString
}
}
},
DataSets = new DataSets
{
DataSet = new DataSet
{
Name = "Data",
Query = new Query
{
DataSourceName = "DS1",
CommandText = commandText
},
Fields = new Fields
{
Field = fields
}
}
},
PageHeader = new PageHeader
{
Height = ".5in",
ReportItems = new ReportItemsHeader
{
Textbox = new Text
{
Name = "Textbox1",
Top = ".1in",
Left = ".1in",
Width = "6in",
Height = ".25in",
Value = new Value { Text = pageHeaderText },
Style = new Style { FontSize = "15pt", FontWeight = "Bold" }
}
},
PrintOnFirstPage = "true",
PrintOnLastPage = "true"
},
Body = new Body
{
ReportItems = new ReportItemsBody
{
Table = new Table
{
TableName = "Table1",
DataSetName = "Data",
NoRows = "Query returned no rows!",
TableColumns = new TableColumns
{
TableColumn = fields.Select(f => new TableColumn
{
Width = "1in" // You can adjust the width as needed
}).ToList()
},
Header = new Header
{
TableRows = new TableRows
{
TableRow = new TableRow
{
Height = "12pt",
TableCells = new TableCells()
{
TableCell = headerTableCells
}
}
},
RepeatOnNewPage = "true"
},
Details = new Details
{
TableRows = new TableRows
{
TableRow = new TableRow
{
Height = "12pt",
TableCells = new TableCells()
{
TableCell = bodyTableCells
}
}
}
}
}
},
Height = "36pt"
},
PageFooter = new PageFooter
{
Height = "14pt",
ReportItems = new ReportItemsFooter
{
Textbox = new Text
{
Name = "Textbox5",
Top = "1pt",
Left = "10pt",
Height = "12pt",
Width = "3in",
Value = new Value { Text = "=Globals!PageNumber + ' of ' + Globals!TotalPages" },
Style = new Style { FontSize = "10pt", FontWeight = "Normal" }
}
},
PrintOnFirstPage = "true",
PrintOnLastPage = "true"
}
};
var serializer = new XmlSerializer(typeof(Report));
string xml;
using (var writer = new Utf8StringWriter())
{
serializer.Serialize(writer, report);
xml = writer.ToString();
}
return xml;
}
}
public class Utf8StringWriter : StringWriter
{
public override Encoding Encoding => Encoding.UTF8;
}
}
================================================
FILE: RdlCreator/CustomProperties.cs
================================================
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
public class CustomProperties
{
[XmlElement(ElementName = "CustomProperty")]
public CustomProperty CustomProperty { get; set; }
}
}
================================================
FILE: RdlCreator/CustomProperty.cs
================================================
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
public class CustomProperty
{
[XmlElement(ElementName = "Name")]
public string Name { get; set; }
[XmlElement(ElementName = "Value")]
public string Value { get; set; }
}
}
================================================
FILE: RdlCreator/CustomReportItems.cs
================================================
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
public class CustomReportItems
{
public string Type { get; set; }
public ReportItemSize Height { get; set; }
public ReportItemSize Width { get; set; }
public ReportItemSize Left { get; set; }
public ReportItemSize Top { get; set; }
[XmlAttribute(AttributeName = "Name")]
public string Name { get; set; }
[XmlElement(ElementName = "CustomProperties")]
public CustomProperties CustomProperties { get; set; }
[XmlElement(ElementName = "Style")]
public Style Style { get; set; }
[XmlElement(ElementName = "CanGrow")]
public string CanGrow { get; set; }
[XmlElement(ElementName = "Source")]
public string Source { get; set; } = "Embedded";
}
}
================================================
FILE: RdlCreator/DataProviders.cs
================================================
namespace Majorsilence.Reporting.RdlCreator
{
public enum DataProviders
{
///
/// Microsoft.Data.SqlClient provider
///
SqlServer_MicrosoftDataSqlClient = 1,
Oracle = 2,
#if WINDOWS
OleDb = 3,
#endif
Odbc = 4,
///
/// Majorsilence.Reporting.DataProviders XML provider
///
Xml = 5,
///
/// Majorsilence.Reporting.DataProviders Text provider
///
Text = 6,
MySql = 7,
///
/// Npgsql provider
///
PostgreSQL = 8,
///
/// System.Data.SqlClient provider
///
SqlServer_SystemData = 9,
Firebird = 10,
///
/// Microsoft.Data.Sqlite provider
///
SQLite_MicrosoftData = 11,
///
/// System.Data.SQLite provider
///
SQLite_SystemData = 12,
///
/// Majorsilence.Reporting.DataProviders Json provider
///
Json = 13,
///
/// Majorsilence.Reporting.DataProviders FileDirectory provider
///
FileDirectory = 14,
///
/// PostgreSQL Devart dotConnect provider
///
PostgreSQL_Devart = 15
}
}
================================================
FILE: RdlCreator/DataSet.cs
================================================
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
public class DataSet
{
[XmlElement(ElementName = "Query")]
public Query Query { get; set; }
[XmlElement(ElementName = "Fields")]
public Fields Fields { get; set; }
[XmlAttribute(AttributeName = "Name")]
public string Name { get; set; }
}
}
================================================
FILE: RdlCreator/DataSets.cs
================================================
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
public class DataSets
{
[XmlElement(ElementName = "DataSet")]
public DataSet DataSet { get; set; }
}
}
================================================
FILE: RdlCreator/DataSource.cs
================================================
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
public class DataSource
{
[XmlElement(ElementName = "ConnectionProperties")]
public ConnectionProperties ConnectionProperties { get; set; }
[XmlAttribute(AttributeName = "Name")]
public string Name { get; set; }
}
}
================================================
FILE: RdlCreator/DataSources.cs
================================================
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
public class DataSources
{
[XmlElement(ElementName = "DataSource")]
public DataSource DataSource { get; set; }
}
}
================================================
FILE: RdlCreator/Details.cs
================================================
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
public class Details
{
[XmlElement(ElementName = "TableRows")]
public TableRows TableRows { get; set; }
}
}
================================================
FILE: RdlCreator/Document.cs
================================================
using iTextSharp.text.pdf;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
///
/// Programmatically create PDFs.
///
/// Internally it is a combination of RDL and https://github.com/VahidN/iTextSharp.LGPLv2.Core
[XmlRoot(ElementName = "Report", Namespace = "http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition")]
public class Document
{
public List Pages { get; private set; } = new List();
[XmlElement(ElementName = "Description")]
public string Description { get; set; }
[XmlElement(ElementName = "Author")]
public string Author { get; set; }
[XmlElement(ElementName = "Name")]
public string Name { get; set; }
[XmlElement(ElementName = "PageHeight")]
public ReportItemSize PageHeight { get; set; }
[XmlElement(ElementName = "PageWidth")]
public ReportItemSize PageWidth { get; set; }
[XmlElement(ElementName = "DataSources")]
public DataSources DataSources { get; set; }
//[XmlElement(ElementName = "Width")]
//public string Width { get; set; }
[XmlElement(ElementName = "TopMargin")]
public ReportItemSize TopMargin { get; set; }
[XmlElement(ElementName = "LeftMargin")]
public ReportItemSize LeftMargin { get; set; }
[XmlElement(ElementName = "RightMargin")]
public ReportItemSize RightMargin { get; set; }
[XmlElement(ElementName = "BottomMargin")]
public ReportItemSize BottomMargin { get; set; }
public PageFooter PageFooter { get; set; }
public Document WithDescription(string description)
{
Description = description;
return this;
}
public Document WithAuthor(string author)
{
Author = author;
return this;
}
public Document WithName(string name)
{
Name = name;
return this;
}
public Document WithPageHeight(string pageHeight)
{
PageHeight = pageHeight;
return this;
}
public Document WithPageWidth(string pageWidth)
{
PageWidth = pageWidth;
return this;
}
//public Document WithWidth(string width)
//{
// Width = width;
// return this;
//}
public Document WithTopMargin(string topMargin)
{
TopMargin = topMargin;
return this;
}
public Document WithLeftMargin(string leftMargin)
{
LeftMargin = leftMargin;
return this;
}
public Document WithRightMargin(string rightMargin)
{
RightMargin = rightMargin;
return this;
}
public Document WithBottomMargin(string bottomMargin)
{
BottomMargin = bottomMargin;
return this;
}
public Document WithPage(Page page)
{
Pages.Add(page);
return this;
}
public Document WithPage(Action options)
{
var p = new Page();
options(p);
Pages.Add(p);
return this;
}
public async TaskCreate()
{
using var ms = new MemoryStream();
await Create(ms);
return ms.ToArray();
}
public async Task Create(Stream output)
{
using var itextDocument = new iTextSharp.text.Document();
using var iTextCopy = new PdfCopy(itextDocument, output);
itextDocument.Open();
foreach (var page in Pages)
{
var report = new Report();
report
//.WithWidth(Width)
.WithTopMargin(TopMargin)
.WithLeftMargin(LeftMargin)
.WithRightMargin(RightMargin)
.WithBottomMargin(BottomMargin)
.WithPageHeader(page.PageHeader)
.WithPageFooter(page.PageFooter)
.WithBody(page.Body);
var create = new RdlCreator.Create();
var fyiReport = await create.GenerateRdl(report);
using var ms = new Majorsilence.Reporting.Rdl.MemoryStreamGen();
await fyiReport.RunGetData(null);
await fyiReport.RunRender(ms, Majorsilence.Reporting.Rdl.OutputPresentationType.PDF);
var pdf = ms.GetStream();
pdf.Position = 0;
using var reader = new PdfReader(pdf);
for (int i = 1; i <= reader.NumberOfPages; i++)
{
iTextCopy.AddPage(iTextCopy.GetImportedPage(reader, i));
}
iTextCopy.FreeReader(reader);
reader.Close();
}
itextDocument.AddAuthor(Author);
itextDocument.AddCreationDate();
itextDocument.AddCreator("Majorsilence Reporting - RenderPdf_iTextSharp");
itextDocument.AddSubject(Description);
itextDocument.AddTitle(Name);
itextDocument.Close();
}
}
}
================================================
FILE: RdlCreator/Field.cs
================================================
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
public class Field
{
[XmlElement(ElementName = "DataField")]
public string DataField { get; set; }
[XmlElement(ElementName = "TypeName", Namespace = "rd")]
public string TypeName { get; set; }
[XmlAttribute(AttributeName = "Name")]
public string Name { get; set; }
}
}
================================================
FILE: RdlCreator/Fields.cs
================================================
using System.Collections.Generic;
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
public class Fields
{
[XmlElement(ElementName = "Field")]
public List Field { get; set; }
}
}
================================================
FILE: RdlCreator/Header.cs
================================================
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
public class Header
{
[XmlElement(ElementName = "TableRows")]
public TableRows TableRows { get; set; }
[XmlElement(ElementName = "RepeatOnNewPage")]
public string RepeatOnNewPage { get; set; }
}
}
================================================
FILE: RdlCreator/Majorsilence.Reporting.RdlCreator.csproj
================================================
Library
RdlCreator
True
Majorsilence.Reporting.RdlCreator
Debug;Release;Debug-DrawingCompat;Release-DrawingCompat
net48;net8.0;net10.0
net8.0;net10.0
4014
Majorsilence.Reporting.RdlCreator.SkiaSharp
================================================
FILE: RdlCreator/Page.cs
================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
public class Page
{
[XmlElement(ElementName = "PageHeader")]
public PageHeader PageHeader { get; set; }
[XmlElement(ElementName = "Body")]
public Body Body { get; set; }
[XmlElement(ElementName = "PageFooter")]
public PageFooter PageFooter { get; set; }
public Page WithHeight(ReportItemSize height)
{
if (this.Body == null)
{
this.Body = new Body();
}
this.Body.Height = height;
return this;
}
public Page WithWidth(ReportItemSize width)
{
if (this.Body == null)
{
this.Body = new Body();
}
this.Body.Width = width;
return this;
}
public Page WithPageHeader(PageHeader pageHeader)
{
PageHeader = pageHeader;
return this;
}
public Page WithPageFooter(PageFooter pageFooter)
{
PageFooter = pageFooter;
return this;
}
public Page WithText(Text textbox)
{
InitReportItemBody(false);
this.Body.ReportItems.Text.Add(textbox);
return this;
}
public Page WithCard(Card card)
{
InitReportItemBody(false);
this.Body.ReportItems.Cards.Add(card);
return this;
}
public Page WithTableColumns(TableColumns tableColumns)
{
InitReportItemBody(true);
this.Body.ReportItems.Table.TableColumns = tableColumns;
return this;
}
public Page WithTableHeader(TableRow header, string repeatOnNewPage = "true")
{
InitReportItemBody(true);
this.Body.ReportItems.Table.Header = new Header()
{
TableRows = new TableRows()
{
TableRow = header
},
RepeatOnNewPage = repeatOnNewPage
};
return this;
}
public Page WithTableDetails(TableRow row)
{
InitReportItemBody(true);
this.Body.ReportItems.Table.Details = new Details();
this.Body.ReportItems.Table.Details.TableRows = new TableRows()
{
TableRow = row
};
return this;
}
public Page WithTableNoRows(string noRows)
{
InitReportItemBody(true);
this.Body.ReportItems.Table.NoRows = noRows;
return this;
}
public Page WithTableName(string tableName)
{
InitReportItemBody(true);
this.Body.ReportItems.Table.TableName = tableName;
return this;
}
public Page WithImage(ReportItemImage image)
{
InitReportItemBody(false);
if (this.Body.ReportItems.Images == null)
{
this.Body.ReportItems.Images = new List();
}
this.Body.ReportItems.Images.Add(image);
return this;
}
private void InitReportItemBody(bool includeTable)
{
if (this.Body == null)
{
this.Body = new Body();
}
if (this.Body.ReportItems == null)
{
this.Body.ReportItems = new ReportItemsBody()
{
Text = new List(),
Cards = new List(),
CustomReportItems = new List()
};
}
if (includeTable && this.Body.ReportItems.Table == null)
{
this.Body.ReportItems.Table = new Table();
}
}
}
}
================================================
FILE: RdlCreator/PageFooter.cs
================================================
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
public class PageFooter
{
[XmlElement(ElementName = "Height")]
public ReportItemSize Height { get; set; }
[XmlElement(ElementName = "ReportItems")]
public ReportItemsFooter ReportItems { get; set; }
[XmlElement(ElementName = "PrintOnFirstPage")]
public string PrintOnFirstPage { get; set; }
[XmlElement(ElementName = "PrintOnLastPage")]
public string PrintOnLastPage { get; set; }
}
}
================================================
FILE: RdlCreator/PageHeader.cs
================================================
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
public class PageHeader
{
[XmlElement(ElementName = "Height")]
public ReportItemSize Height { get; set; }
[XmlElement(ElementName = "ReportItems")]
public ReportItemsHeader ReportItems { get; set; }
[XmlElement(ElementName = "PrintOnFirstPage")]
public string PrintOnFirstPage { get; set; }
[XmlElement(ElementName = "PrintOnLastPage")]
public string PrintOnLastPage { get; set; }
}
}
================================================
FILE: RdlCreator/Query.cs
================================================
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
public class Query
{
[XmlElement(ElementName = "DataSourceName")]
public string DataSourceName { get; set; }
[XmlElement(ElementName = "CommandText")]
public string CommandText { get; set; }
}
}
================================================
FILE: RdlCreator/Report.cs
================================================
using Majorsilence.Reporting.Rdl;
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
// Report class representing the root element
[XmlRoot(ElementName = "Report", Namespace = "http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition")]
public class Report
{
[XmlElement(ElementName = "Description")]
public string Description { get; set; }
[XmlElement(ElementName = "Author")]
public string Author { get; set; }
[XmlElement(ElementName = "Name")]
public string Name { get; set; }
[XmlElement(ElementName = "PageHeight")]
public ReportItemSize PageHeight { get; set; }
[XmlElement(ElementName = "PageWidth")]
public ReportItemSize PageWidth { get; set; }
[XmlElement(ElementName = "DataSources")]
public DataSources DataSources { get; set; }
[XmlElement(ElementName = "Width")]
public ReportItemSize Width { get; set; }
[XmlElement(ElementName = "TopMargin")]
public ReportItemSize TopMargin { get; set; }
[XmlElement(ElementName = "LeftMargin")]
public ReportItemSize LeftMargin { get; set; }
[XmlElement(ElementName = "RightMargin")]
public ReportItemSize RightMargin { get; set; }
[XmlElement(ElementName = "BottomMargin")]
public ReportItemSize BottomMargin { get; set; }
[XmlElement(ElementName = "DataSets")]
public DataSets DataSets { get; set; }
[XmlElement(ElementName = "PageHeader")]
public PageHeader PageHeader { get; set; }
[XmlElement(ElementName = "Body")]
public Body Body { get; set; }
[XmlElement(ElementName = "PageFooter")]
public PageFooter PageFooter { get; set; }
// Fluid style methods
public Report WithDescription(string description)
{
Description = description;
return this;
}
public Report WithAuthor(string author)
{
Author = author;
return this;
}
public Report WithName(string name)
{
Name = name;
return this;
}
public Report WithPageHeight(ReportItemSize pageHeight)
{
PageHeight = pageHeight;
return this;
}
public Report WithPageWidth(ReportItemSize pageWidth)
{
PageWidth = pageWidth;
return this;
}
public Report WithDataSources(DataSources dataSources)
{
DataSources = dataSources;
return this;
}
public Report WithWidth(ReportItemSize width)
{
Width = width;
return this;
}
public Report WithTopMargin(ReportItemSize topMargin)
{
TopMargin = topMargin;
return this;
}
public Report WithLeftMargin(ReportItemSize leftMargin)
{
LeftMargin = leftMargin;
return this;
}
public Report WithRightMargin(ReportItemSize rightMargin)
{
RightMargin = rightMargin;
return this;
}
public Report WithBottomMargin(ReportItemSize bottomMargin)
{
BottomMargin = bottomMargin;
return this;
}
public Report WithDataSets(DataSets dataSets)
{
DataSets = dataSets;
return this;
}
public Report WithPageHeader(PageHeader pageHeader)
{
PageHeader = pageHeader;
return this;
}
public Report WithBody(ReportItemSize height)
{
Body = new Body()
{
Height = height
};
return this;
}
public Report WithBody(Body body)
{
Body = body;
return this;
}
public Report WithPageBreak()
{
return WithPageBreak("1pt");
}
public Report WithPageBreak(ReportItemSize yPos)
{
var pageBreakCard = new Card(this)
{
CanGrow = false,
Height = "0pt",
Width = "1pt",
PageBreakAtEnd = true,
Top=yPos
};
this.Body.ReportItems.Cards.Add(pageBreakCard);
return this;
}
public Report WithPageFooter(PageFooter pageFooter)
{
PageFooter = pageFooter;
return this;
}
public Report WithTable()
{
InitReportItemBody(true);
return this;
}
public Report WithReportText(Text textbox)
{
InitReportItemBody(false);
this.Body.ReportItems.Text.Add(textbox);
return this;
}
private void InitReportItemBody(bool includeTable)
{
if (this.Body.ReportItems == null)
{
this.Body.ReportItems = new ReportItemsBody()
{
Text = new List(),
Cards = new List(),
CustomReportItems = new List()
};
}
if (includeTable && this.Body.ReportItems.Table == null)
{
this.Body.ReportItems.Table = new Table();
}
}
public Report WithCard(Card card)
{
InitReportItemBody(false);
this.Body.ReportItems.Cards.Add(card);
return this;
}
public Report WithTableColumns(TableColumns tableColumns)
{
this.Body.ReportItems.Table.TableColumns = tableColumns;
return this;
}
public Report WithTableHeader(TableRow header, string repeatOnNewPage = "true")
{
this.Body.ReportItems.Table.Header = new Header()
{
TableRows = new TableRows()
{
TableRow = header
},
RepeatOnNewPage = repeatOnNewPage
};
return this;
}
public Report WithTableDetails(TableRow row)
{
this.Body.ReportItems.Table.Details = new Details();
this.Body.ReportItems.Table.Details.TableRows = new TableRows()
{
TableRow = row
};
return this;
}
public Report WithTableDataSetName(string dataSetName)
{
this.Body.ReportItems.Table.DataSetName = dataSetName;
return this;
}
public Report WithTableNoRows(string noRows)
{
this.Body.ReportItems.Table.NoRows = noRows;
return this;
}
public Report WithTableName(string tableName)
{
this.Body.ReportItems.Table.TableName = tableName;
return this;
}
public Report WithImage(ReportItemImage image)
{
InitReportItemBody(false);
if (this.Body.ReportItems.Images == null)
{
this.Body.ReportItems.Images = new List();
}
this.Body.ReportItems.Images.Add(image);
return this;
}
}
}
================================================
FILE: RdlCreator/ReportItemImage.cs
================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
public class ReportItemImage
{
[XmlAttribute(AttributeName = "Name")]
public string Name { get; set; }
[XmlElement(ElementName = "Height")]
public ReportItemSize Height { get; set; }
[XmlElement(ElementName = "Width")]
public ReportItemSize Width { get; set; }
[XmlElement(ElementName = "Left")]
public ReportItemSize Left { get; set; }
[XmlElement(ElementName = "Top")]
public ReportItemSize Top { get; set; }
[XmlElement(ElementName = "Source")]
public string Source { get; set; }
[XmlElement(ElementName = "Value")]
public string Value { get; set; }
[XmlElement(ElementName = "Sizing")]
public string Sizing { get; set; }
[XmlElement(ElementName = "Style")]
public Style ImageStyle { get; set; }
}
}
================================================
FILE: RdlCreator/ReportItemSize.cs
================================================
using System;
namespace Majorsilence.Reporting.RdlCreator
{
public class ReportItemSize : System.Xml.Serialization.IXmlSerializable
{
// implicitly convert from ReportItemSize to string
public static implicit operator string(ReportItemSize size)
{
return size.ToString();
}
// implicitly convert from string to ReportItemSize
public static implicit operator ReportItemSize(string sizeString)
{
ReportItemSize size = new ReportItemSize();
if (sizeString.EndsWith("in", StringComparison.OrdinalIgnoreCase))
{
size.Unit = SizeUnit.Inches;
#if NET6_0_OR_GREATER
size.Value = float.Parse(sizeString.Replace("in", "", StringComparison.OrdinalIgnoreCase));
#else
size.Value = float.Parse(sizeString.Replace("in", ""));
#endif
}
else if (sizeString.EndsWith("cm", StringComparison.OrdinalIgnoreCase))
{
size.Unit = SizeUnit.Centimeters;
#if NET6_0_OR_GREATER
size.Value = float.Parse(sizeString.Replace("cm", "", StringComparison.OrdinalIgnoreCase));
#else
size.Value = float.Parse(sizeString.Replace("cm", ""));
#endif
}
else if (sizeString.EndsWith("pt", StringComparison.OrdinalIgnoreCase))
{
size.Unit = SizeUnit.Points;
#if NET6_0_OR_GREATER
size.Value = float.Parse(sizeString.Replace("pt", "", StringComparison.OrdinalIgnoreCase));
#else
size.Value = float.Parse(sizeString.Replace("pt", ""));
#endif
}
else if (sizeString.EndsWith("pc", StringComparison.OrdinalIgnoreCase))
{
size.Unit = SizeUnit.Picas;
#if NET6_0_OR_GREATER
size.Value = float.Parse(sizeString.Replace("pc", "", StringComparison.OrdinalIgnoreCase));
#else
size.Value = float.Parse(sizeString.Replace("pc", ""));
#endif
}
else if (sizeString.EndsWith("mm", StringComparison.OrdinalIgnoreCase))
{
size.Unit = SizeUnit.Millimeters;
#if NET6_0_OR_GREATER
size.Value = float.Parse(sizeString.Replace("mm", "", StringComparison.OrdinalIgnoreCase));
#else
size.Value = float.Parse(sizeString.Replace("mm", ""));
#endif
}
else
{
// default to inches
size.Unit = SizeUnit.Inches;
size.Value = float.Parse(sizeString);
}
return size;
}
// this class is a strongly typed object to hold size information for report items
// that will then output to rdl text compatible strings formats
public float Value { get; set; }
public SizeUnit Unit { get; set; }
public override string ToString()
{
return Value.ToString("0.00") +
(Unit == SizeUnit.Inches ? "in" :
Unit == SizeUnit.Centimeters ? "cm" :
Unit == SizeUnit.Points ? "pt" :
Unit == SizeUnit.Picas ? "pc" :
Unit == SizeUnit.Millimeters ? "mm" : "in");
}
public static ReportItemSize FromInches(float inches)
{
return new ReportItemSize() { Value = inches, Unit = SizeUnit.Inches };
}
public static ReportItemSize FromCentimeters(float centimeters)
{
return new ReportItemSize() { Value = centimeters, Unit = SizeUnit.Centimeters };
}
public static ReportItemSize FromPoints(float points)
{
return new ReportItemSize() { Value = points, Unit = SizeUnit.Points };
}
public static ReportItemSize FromPicas(float picas)
{
return new ReportItemSize() { Value = picas, Unit = SizeUnit.Picas };
}
public static ReportItemSize FromMillimeters(float millimeters)
{
return new ReportItemSize() { Value = millimeters, Unit = SizeUnit.Millimeters };
}
System.Xml.Schema.XmlSchema System.Xml.Serialization.IXmlSerializable.GetSchema()
{
return null;
}
void System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader reader)
{
var s = reader.ReadElementContentAsString();
var tmp = (ReportItemSize)s;
this.Value = tmp.Value;
this.Unit = tmp.Unit;
}
void System.Xml.Serialization.IXmlSerializable.WriteXml(System.Xml.XmlWriter writer)
{
writer.WriteString(this.ToString());
}
}
}
================================================
FILE: RdlCreator/ReportItemsBody.cs
================================================
using System.Collections.Generic;
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
public class ReportItemsBody
{
[XmlElement(ElementName = "Table")]
public Table Table { get; set; }
[XmlElement("Textbox", typeof(Text))]
public List Text { get; set; }
[XmlElement("CustomReportItem", typeof(CustomReportItems))]
public List CustomReportItems { get; set; }
[XmlElement("Rectangle", typeof(Card))]
public List Cards { get; set; }
[XmlElement("Image", typeof(ReportItemImage))]
public List Images { get; set; }
}
}
================================================
FILE: RdlCreator/ReportItemsFooter.cs
================================================
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
public class ReportItemsFooter
{
[XmlElement(ElementName = "Textbox")]
public Text Textbox { get; set; }
}
}
================================================
FILE: RdlCreator/ReportItemsHeader.cs
================================================
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
public class ReportItemsHeader
{
[XmlElement(ElementName = "Textbox")]
public Text Textbox { get; set; }
}
}
================================================
FILE: RdlCreator/SizeUnit.cs
================================================
namespace Majorsilence.Reporting.RdlCreator
{
public enum SizeUnit
{
Inches = 1,
Centimeters = 2,
Points = 3,
Picas = 4,
Millimeters = 5
}
}
================================================
FILE: RdlCreator/Style.cs
================================================
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
public class Style
{
[XmlElement(ElementName = "FontSize")]
public ReportItemSize FontSize { get; set; }
[XmlElement(ElementName = "FontWeight")]
public string FontWeight { get; set; }
[XmlElement(ElementName = "TextAlign")]
public string TextAlign { get; set; }
[XmlElement(ElementName = "BorderStyle")]
public BorderStyle BorderStyle { get; set; }
[XmlElement(ElementName = "BorderColor")]
public BorderColor BorderColor { get; set; }
[XmlElement(ElementName = "BorderWidth")]
public BorderWidth BorderWidth { get; set; }
[XmlElement(ElementName = "BackgroundColor")]
public string BackgroundColor { get; set; }
}
}
================================================
FILE: RdlCreator/Table.cs
================================================
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
public class Table
{
[XmlElement(ElementName = "DataSetName")]
public string DataSetName { get; set; }
[XmlElement(ElementName = "NoRows")]
public string NoRows { get; set; }
[XmlElement(ElementName = "TableColumns")]
public TableColumns TableColumns { get; set; }
[XmlElement(ElementName = "Header")]
public Header Header { get; set; }
[XmlElement(ElementName = "Details")]
public Details Details { get; set; }
[XmlAttribute(AttributeName = "Name")]
public string TableName { get; set; }
}
}
================================================
FILE: RdlCreator/TableCell.cs
================================================
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
public class TableCell
{
[XmlElement(ElementName = "ReportItems")]
public TableCellReportItems ReportItems { get; set; }
}
}
================================================
FILE: RdlCreator/TableCellReportItems.cs
================================================
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
public class TableCellReportItems
{
[XmlElement("Textbox", typeof(Text))]
[XmlElement("CustomReportItem", typeof(CustomReportItems))]
public object ReportItem { get; set; }
}
}
================================================
FILE: RdlCreator/TableCells.cs
================================================
using System.Collections.Generic;
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
public class TableCells
{
[XmlElement(ElementName = "TableCell")]
public List TableCell { get; set; }
}
}
================================================
FILE: RdlCreator/TableColumn.cs
================================================
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
public class TableColumn
{
[XmlElement(ElementName = "Width")]
public ReportItemSize Width { get; set; }
}
}
================================================
FILE: RdlCreator/TableColumns.cs
================================================
using System.Collections.Generic;
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
public class TableColumns
{
[XmlElement(ElementName = "TableColumn")]
public List TableColumn { get; set; }
}
}
================================================
FILE: RdlCreator/TableRow.cs
================================================
using System.Collections.Generic;
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
public class TableRow
{
[XmlElement(ElementName = "Height")]
public ReportItemSize Height { get; set; }
[XmlElement(ElementName = "TableCells")]
public TableCells TableCells { get; set; }
}
}
================================================
FILE: RdlCreator/TableRows.cs
================================================
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
public class TableRows
{
[XmlElement(ElementName = "TableRow")]
public TableRow TableRow { get; set; }
}
}
================================================
FILE: RdlCreator/Text.cs
================================================
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
public class Text
{
[XmlElement(ElementName = "Value")]
public Value Value { get; set; }
[XmlElement(ElementName = "Style")]
public Style Style { get; set; }
[XmlAttribute(AttributeName = "Name")]
public string Name { get; set; }
[XmlElement(ElementName = "Top")]
public ReportItemSize Top { get; set; }
[XmlElement(ElementName = "Left")]
public ReportItemSize Left { get; set; }
[XmlElement(ElementName = "Width")]
public ReportItemSize Width { get; set; }
[XmlElement(ElementName = "Height")]
public ReportItemSize Height { get; set; }
[XmlElement(ElementName = "CanGrow")]
public bool CanGrow { get; set; }
}
}
================================================
FILE: RdlCreator/Value.cs
================================================
using System.Xml.Serialization;
namespace Majorsilence.Reporting.RdlCreator
{
public class Value
{
[XmlText]
public string Text { get; set; }
}
}
================================================
FILE: RdlCreator.Tests/Document_Test.cs
================================================
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using System;
using Majorsilence.Reporting.RdlCreator;
using NUnit.Framework;
using System.Text.RegularExpressions;
using Microsoft.Identity.Client;
using System.Threading.Tasks;
using UglyToad.PdfPig;
using System.Linq;
namespace Majorsilence.Reporting.RdlCreator.Tests
{
[TestFixture]
public class Document_Test
{
[Test]
public async Task SinglePagePdfDiskExport()
{
var document = GenerateData(1);
using var fileStream = new FileStream("SinglePagePdf.pdf", FileMode.Create, FileAccess.Write);
await document.Create(fileStream);
await fileStream.DisposeAsync();
using var pdfDocument = PdfDocument.Open("SinglePagePdf.pdf");
var text = string.Join(" ", pdfDocument.GetPages().SelectMany(page => page.GetWords()).Select(word => word.Text));
Assert.That(text, Is.Not.Null);
Assert.That(pdfDocument.NumberOfPages, Is.EqualTo(1));
Assert.That(text, Is.EqualTo("Test Header Text Area 1 Lorem ipsum. 0"));
}
[Test]
public async Task MultiPagePdfTest()
{
var document = GenerateData(2);
using var fileStream = new FileStream("MultiPagePdf.pdf", FileMode.Create, FileAccess.Write);
await document.Create(fileStream);
await fileStream.DisposeAsync();
using var pdfDocument = PdfDocument.Open("MultiPagePdf.pdf");
var text = string.Join(" ", pdfDocument.GetPages().SelectMany(page => page.GetWords()).Select(word => word.Text));
Assert.That(text, Is.Not.Null);
Assert.That(pdfDocument.NumberOfPages, Is.EqualTo(2));
Assert.That(text, Is.EqualTo("Test Header Text Area 1 Lorem ipsum. 0 Test Header Text Area 1 Lorem ipsum. 1"));
}
[Test]
[Ignore("This test is slow. Remove the ignore when you want to run it.")]
public async Task LoadTest()
{
var document = GenerateData(10000);
using var fileStream = new FileStream("LoadTestDocument.pdf", FileMode.Create, FileAccess.Write);
await document.Create(fileStream);
await fileStream.DisposeAsync();
using var pdfDocument = PdfDocument.Open("LoadTestDocument.pdf");
Assert.That(pdfDocument.NumberOfPages, Is.EqualTo(10000));
}
[Test]
public async Task ImageTestPdfDiskExport()
{
var document = GenerateImageDocument();
using var fileStream = new FileStream("ImageTestPdfDiskExport.pdf", FileMode.Create, FileAccess.Write);
await document.Create(fileStream);
await fileStream.DisposeAsync();
using var pdfDocument = PdfDocument.Open("ImageTestPdfDiskExport.pdf");
var text = string.Join(" ", pdfDocument.GetPages().SelectMany(page => page.GetWords()).Select(word => word.Text));
Assert.That(text, Is.Not.Null);
Assert.That(pdfDocument.NumberOfPages, Is.EqualTo(1));
Assert.That(text, Is.EqualTo("Test Header Text Area 1 Lorem ipsum. Hello World"));
}
[Test]
public async Task PdfInfoAddedTest()
{
var document = GenerateData(2);
document.Author = "Test Author";
document.Name = "Test Name";
document.Description = "Test Description";
using var fileStream = new FileStream("PdfInfoAddedTest.pdf", FileMode.Create, FileAccess.Write);
await document.Create(fileStream);
await fileStream.DisposeAsync();
// Majorsilence Reporting - RenderPdf_iTextSharp
using var pdfDocument = PdfDocument.Open("PdfInfoAddedTest.pdf");
var text = string.Join(" ", pdfDocument.GetPages().SelectMany(page => page.GetWords()).Select(word => word.Text));
Assert.Multiple(() =>
{
Assert.That(pdfDocument.Information.Author, Is.EqualTo("Test Author"));
Assert.That(pdfDocument.Information.Title, Is.EqualTo("Test Name"));
Assert.That(pdfDocument.Information.Subject, Is.EqualTo("Test Description"));
Assert.That(pdfDocument.Information.Creator, Is.EqualTo("Majorsilence Reporting - RenderPdf_iTextSharp"));
Assert.That(text, Is.Not.Null);
Assert.That(pdfDocument.NumberOfPages, Is.EqualTo(2));
});
}
private RdlCreator.Document GenerateData(int pageCount = 1)
{
var document = new Document
{
Description = "Sample report",
Author = "John Doe",
PageHeight = "11in",
PageWidth = "8.5in",
//Width = "7.5in",
TopMargin = ".25in",
LeftMargin = ".25in",
RightMargin = ".25in",
BottomMargin = ".25in"
};
for (int i = 0; i < pageCount; i++)
{
document.WithPage((option) =>
{
option.WithHeight("10in")
.WithWidth("7.5in")
.WithText(new Text
{
Name = "Textbox1",
Top = ".1in",
Left = ".1in",
Width = "6in",
Height = ".25in",
Value = new Value { Text = "Text Area 1" },
Style = new Style { FontSize = "12pt", FontWeight = "Bold" }
})
.WithText(new Text
{
Name = "Textbox2",
Top = "1in",
Left = "1in",
Width = "6in",
Height = "4in",
Value = new Value { Text = "Lorem ipsum." },
Style = new Style
{
FontSize = "12pt",
BackgroundColor = "gray"
}
});
option.WithPageFooter(new PageFooter
{
Height = "14pt",
ReportItems = new ReportItemsFooter
{
Textbox = new Text
{
Name = "Footer",
Top = "1pt",
Left = "10pt",
Height = "12pt",
Width = "3in",
Value = new Value { Text = $"{i}" },
Style = new Style { FontSize = "10pt", FontWeight = "Normal" }
}
},
PrintOnFirstPage = "true",
PrintOnLastPage = "true"
});
option.WithPageHeader(
new PageHeader
{
Height = ".5in",
ReportItems = new ReportItemsHeader
{
Textbox = new Text
{
Name = "Header",
Top = ".1in",
Left = ".1in",
Width = "6in",
Height = ".25in",
Value = new Value { Text = "Test Header" },
Style = new Style { FontSize = "15pt", FontWeight = "Bold" }
}
},
PrintOnFirstPage = "true",
PrintOnLastPage = "true"
});
});
}
return document;
}
private RdlCreator.Document GenerateImageDocument()
{
var document = new Document
{
Description = "Sample report",
Author = "John Doe",
PageHeight = "11in",
PageWidth = "8.5in",
//Width = "7.5in",
TopMargin = ".25in",
LeftMargin = ".25in",
RightMargin = ".25in",
BottomMargin = ".25in"
};
document.WithPage((option) =>
{
option.WithHeight("10in")
.WithWidth("7.5in")
.WithText(new Text
{
Name = "Textbox1",
Top = ".1in",
Left = ".1in",
Width = "6in",
Height = ".25in",
Value = new Value { Text = "Text Area 1" },
Style = new Style { FontSize = "12pt", FontWeight = "Bold" }
})
.WithText(new Text
{
Name = "Textbox2",
Top = "1in",
Left = "1in",
Width = "6in",
Height = "1in",
Value = new Value { Text = "Lorem ipsum." },
Style = new Style
{
FontSize = "12pt",
BackgroundColor = "gray"
}
});
option.WithImage(new ReportItemImage
{
Name = "Image1",
Top = "1in",
Left = "1in",
Width = "6in",
Height = "6in",
Value = "test-image.jpg",
Source = "External",
Sizing = "Fit"
});
option.WithPageFooter(new PageFooter
{
Height = "14pt",
ReportItems = new ReportItemsFooter
{
Textbox = new Text
{
Name = "Footer",
Top = "1pt",
Left = "10pt",
Height = "12pt",
Width = "3in",
Value = new Value { Text = $"Hello World" },
Style = new Style { FontSize = "10pt", FontWeight = "Normal" }
}
},
PrintOnFirstPage = "true",
PrintOnLastPage = "true"
});
option.WithPageHeader(
new PageHeader
{
Height = ".5in",
ReportItems = new ReportItemsHeader
{
Textbox = new Text
{
Name = "Header",
Top = ".1in",
Left = ".1in",
Width = "6in",
Height = ".25in",
Value = new Value { Text = "Test Header" },
Style = new Style { FontSize = "15pt", FontWeight = "Bold" }
}
},
PrintOnFirstPage = "true",
PrintOnLastPage = "true"
});
});
return document;
}
}
}
================================================
FILE: RdlCreator.Tests/NestedJsonData.json
================================================
[
{
"EmployeeID": 1,
"FirstName": "Nancy",
"LastName": "Davolio",
"ContactInfo": {
"Email": "nancy.davolio@example.com",
"Phone": "(206) 555-9857",
"Address": {
"Street": "507 - 20th Ave. E. Apt. 2A",
"City": "Seattle",
"Region": "WA",
"PostalCode": "98122",
"Country": "USA"
}
},
"Dependents": [
{
"Name": "John Davolio",
"Relationship": "Son",
"BirthDate": "2005-06-15"
},
{
"Name": "Lisa Davolio",
"Relationship": "Daughter",
"BirthDate": "2008-09-23"
}
]
},
{
"EmployeeID": 2,
"FirstName": "Andrew",
"LastName": "Fuller",
"ContactInfo": {
"Email": null,
"Phone": "(206) 555-9482",
"Address": {
"Street": "908 W. Capital Way",
"City": "Tacoma",
"Region": "WA",
"PostalCode": "98401",
"Country": "USA"
}
},
"Dependents": []
},
{
"EmployeeID": 3,
"FirstName": "Janet",
"LastName": "Leverling",
"ContactInfo": {
"Email": null,
"Phone": "(206) 555-3412",
"Address": {
"Street": "722 Moss Bay Blvd.",
"City": "Kirkland",
"Region": "WA",
"PostalCode": "98033",
"Country": "USA"
}
},
"Dependents": []
},
{
"EmployeeID": 4,
"FirstName": "Margaret",
"LastName": "Peacock",
"ContactInfo": {
"Email": null,
"Phone": "(206) 555-8122",
"Address": {
"Street": "4110 Old Redmond Rd.",
"City": "Redmond",
"Region": "WA",
"PostalCode": "98052",
"Country": "USA"
}
},
"Dependents": []
},
{
"EmployeeID": 5,
"FirstName": "Steven",
"LastName": "Buchanan",
"ContactInfo": {
"Email": null,
"Phone": "(71) 555-4848",
"Address": {
"Street": "14 Garrett Hill",
"City": "London",
"Region": null,
"PostalCode": "SW1 8JR",
"Country": "UK"
}
},
"Dependents": []
},
{
"EmployeeID": 6,
"FirstName": "Michael",
"LastName": "Suyama",
"ContactInfo": {
"Email": null,
"Phone": "(71) 555-7773",
"Address": {
"Street": "Coventry House\r\nMiner Rd.",
"City": "London",
"Region": null,
"PostalCode": "EC2 7JR",
"Country": "UK"
}
},
"Dependents": []
},
{
"EmployeeID": 8,
"FirstName": "Laura",
"LastName": "Callahan",
"ContactInfo": {
"Email": null,
"Phone": "(206) 555-1189",
"Address": {
"Street": "4726 - 11th Ave. N.E.",
"City": "Seattle",
"Region": "WA",
"PostalCode": "98105",
"Country": "USA"
}
},
"Dependents": []
},
{
"EmployeeID": 9,
"FirstName": "Anne",
"LastName": "Dodsworth",
"ContactInfo": {
"Email": null,
"Phone": "(71) 555-4444",
"Address": {
"Street": "7 Houndstooth Rd.",
"City": "London",
"Region": null,
"PostalCode": "WG2 7LT",
"Country": "UK"
}
},
"Dependents": []
}
]
================================================
FILE: RdlCreator.Tests/RdlCreator.Tests.csproj
================================================
Majorsilence.Reporting.RdlCreator.Tests
RdlCreator.Tests
Debug;Release;Debug-DrawingCompat;Release-DrawingCompat
net8.0;net10.0
4014
AnyCPU
PreserveNewest
PreserveNewest
PreserveNewest
================================================
FILE: RdlCreator.Tests/Reports_ChainedTest.cs
================================================
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using System;
using Majorsilence.Reporting.RdlCreator;
using NUnit.Framework;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using UglyToad.PdfPig;
using System.Linq;
#if DRAWINGCOMPAT
using Majorsilence.Drawing;
#else
using System.Drawing;
#endif
namespace Majorsilence.Reporting.RdlCreator.Tests
{
[TestFixture]
public class Reports_ChainedTest
{
string connectionString = "Data Source=sqlitetestdb2.db;";
string dataProvider = "Microsoft.Data.Sqlite";
[Test]
public async Task PdfStreamExport()
{
var create = new RdlCreator.Create();
var report = GenerateTestData();
report.Author = "Test Author";
report.Name = "Test Name";
report.Description = "Test Description";
var fyiReport = await create.GenerateRdl(report);
using var ms = new Majorsilence.Reporting.Rdl.MemoryStreamGen();
await fyiReport.RunGetData(null);
await fyiReport.RunRender(ms, Majorsilence.Reporting.Rdl.OutputPresentationType.PDF);
var pdfStream = ms.GetStream();
pdfStream.Position = 0;
using var pdfDocument = PdfDocument.Open(pdfStream);
var text = string.Join(" ",
pdfDocument.GetPages().SelectMany(page => page.GetWords()).Select(word => word.Text));
Assert.Multiple(() =>
{
Assert.That(pdfDocument.Information.Author, Is.EqualTo("Test Author"));
Assert.That(pdfDocument.Information.Title, Is.EqualTo("Test Name"));
Assert.That(pdfDocument.Information.Subject, Is.EqualTo("Test Description"));
Assert.That(pdfDocument.Information.Creator,
Is.EqualTo("Majorsilence Reporting - RenderPdf_iTextSharp"));
Assert.That(text, Is.Not.Null);
Assert.That(text,
Is.EqualTo(
"Test Data Set Report CategoryID CategoryName Description Beverages Soft drinks, coffees, teas, beers, and ales Condiments Sweet and savory sauces, relishes, spreads, and seasonings Confections Desserts, candies, and sweet breads Dairy Products Cheeses Grains/Cereals Breads, crackers, pasta, and cereal Meat/Poultry Prepared meats Produce Dried fruit and bean curd Seafood Seaweed and fish 1 of 1"));
});
}
[Test]
public async Task PdfDiskExport()
{
var create = new RdlCreator.Create();
var report = GenerateTestData();
var fyiReport = await create.GenerateRdl(report);
using var ms = new Majorsilence.Reporting.Rdl.MemoryStreamGen();
await fyiReport.RunGetData(null);
await fyiReport.RunRender(ms, Majorsilence.Reporting.Rdl.OutputPresentationType.PDF);
var pdfStream = ms.GetStream();
pdfStream.Position = 0;
using var fileStream = new FileStream("PdfChainedDiskExport.pdf", FileMode.Create, FileAccess.Write);
pdfStream.CopyTo(fileStream);
await fileStream.DisposeAsync();
using var pdfDocument = PdfDocument.Open("PdfChainedDiskExport.pdf");
var text = string.Join(" ",
pdfDocument.GetPages().SelectMany(page => page.GetWords()).Select(word => word.Text));
Assert.That(text, Is.Not.Null);
Assert.That(text,
Is.EqualTo(
"Test Data Set Report CategoryID CategoryName Description Beverages Soft drinks, coffees, teas, beers, and ales Condiments Sweet and savory sauces, relishes, spreads, and seasonings Confections Desserts, candies, and sweet breads Dairy Products Cheeses Grains/Cereals Breads, crackers, pasta, and cereal Meat/Poultry Prepared meats Produce Dried fruit and bean curd Seafood Seaweed and fish 1 of 1"));
}
[Test]
public async Task HtmlDiskExport()
{
var create = new RdlCreator.Create();
var report = GenerateTestData();
var fyiReport = await create.GenerateRdl(report);
using var ms = new Majorsilence.Reporting.Rdl.MemoryStreamGen();
await fyiReport.RunGetData(null);
await fyiReport.RunRender(ms, Majorsilence.Reporting.Rdl.OutputPresentationType.HTML);
var pdfStream = ms.GetStream();
pdfStream.Position = 0;
using var fileStream = new FileStream("HtmlChainedDiskExport.html", FileMode.Create, FileAccess.Write);
pdfStream.CopyTo(fileStream);
await fileStream.DisposeAsync();
var text = await System.IO.File.ReadAllTextAsync("HtmlChainedDiskExport.html");
Assert.That(text.Contains("seasonings"));
Assert.That(text.Contains("bean curd"));
}
private RdlCreator.Report GenerateTestData()
{
var report = new Report
{
Description = "Sample report",
Author = "John Doe",
PageHeight = "11in",
PageWidth = "8.5in",
Width = "7.5in",
TopMargin = ".25in",
LeftMargin = ".25in",
RightMargin = ".25in",
BottomMargin = ".25in"
}
.WithDataSources(
new DataSources
{
DataSource = new DataSource
{
Name = "DS1",
ConnectionProperties = new ConnectionProperties
{
DataProvider = dataProvider, ConnectString = connectionString
}
}
}
)
.WithDataSets(
new DataSets
{
DataSet = new DataSet
{
Name = "Data",
Query = new Query
{
DataSourceName = "DS1",
CommandText = "SELECT CategoryID, CategoryName, Description FROM Categories"
},
Fields = new Fields
{
Field = new List
{
new Field
{
Name = "CategoryID",
DataField = "CategoryID",
TypeName = "System.Int64"
},
new Field
{
Name = "CategoryName",
DataField = "CategoryName",
TypeName = "System.String"
},
new Field
{
Name = "Description",
DataField = "Description",
TypeName = "System.String"
}
}
}
}
}
)
.WithPageHeader(
new PageHeader
{
Height = ".5in",
ReportItems = new ReportItemsHeader
{
Textbox = new Text
{
Name = "Textbox1",
Top = ReportItemSize.FromInches(0.1f),
Left = ReportItemSize.FromInches(0.1f),
Width = ReportItemSize.FromInches(6.0f),
Height = ReportItemSize.FromInches(0.25f),
Value = new Value { Text = "Test Data Set Report" },
Style = new Style { FontSize = ReportItemSize.FromPoints(15), FontWeight = "Bold" }
}
},
PrintOnFirstPage = "true",
PrintOnLastPage = "true"
})
.WithPageFooter(new PageFooter
{
Height = "14pt",
ReportItems = new ReportItemsFooter
{
Textbox = new Text
{
Name = "Textbox5",
Top = "1pt",
Left = "10pt",
Height = "12pt",
Width = "3in",
Value = new Value { Text = "=Globals!PageNumber + ' of ' + Globals!TotalPages" },
Style = new Style { FontSize = "10pt", FontWeight = "Normal" }
}
},
PrintOnFirstPage = "true",
PrintOnLastPage = "true"
});
// Add a body to the report
report
.WithBody("36pt")
.WithTable()
.WithTableName("Table1")
.WithTableDataSetName("Data")
.WithTableNoRows("Query returned no rows!")
.WithTableHeader(
new TableRow
{
Height = "12pt",
TableCells = new TableCells()
{
TableCell = new List
{
new TableCell
{
ReportItems = new TableCellReportItems()
{
ReportItem = new Text
{
Name = "Textbox2",
Value = new Value { Text = "CategoryID" },
Style =
new Style { TextAlign = "Center", FontWeight = "Bold" }
}
}
},
new TableCell
{
ReportItems = new TableCellReportItems()
{
ReportItem = new Text
{
Name = "Textbox3",
Value = new Value { Text = "CategoryName" },
Style =
new Style { TextAlign = "Center", FontWeight = "Bold" }
}
}
},
new TableCell
{
ReportItems = new TableCellReportItems()
{
ReportItem = new Text
{
Name = "Textbox4",
Value = new Value { Text = "Description" },
Style = new Style { TextAlign = "Center", FontWeight = "Bold" }
}
}
}
}
}
}, repeatOnNewPage: "true")
.WithTableColumns(new TableColumns
{
TableColumn = new List
{
new TableColumn { Width = "1.25in" },
new TableColumn { Width = "1.5in" },
new TableColumn { Width = "1.375in" }
}
})
.WithTableDetails(new TableRow
{
Height = "12pt",
TableCells = new TableCells()
{
TableCell = new List
{
new TableCell
{
ReportItems = new TableCellReportItems()
{
ReportItem = new CustomReportItems()
{
Name = "QrCode",
Type = "QR Code",
Width = "35.91mm",
Height = "35.91mm",
CustomProperties =
new CustomProperties
{
CustomProperty = new CustomProperty()
{
Name = "QrCode", Value = "=Fields!CategoryID.Value"
}
},
CanGrow = "false",
Style =
new Style
{
BorderStyle =
new BorderStyle
{
Default = BorderStyleType.None,
Bottom = BorderStyleType.Solid
},
BorderColor =
new BorderColor { Bottom = Color.Green.Name },
BorderWidth =
new BorderWidth { Bottom = "1pt" }
},
Source = "Embedded"
}
}
},
new TableCell
{
ReportItems = new TableCellReportItems()
{
ReportItem = new Text
{
Name = "CategoryName",
Value =
new Value { Text = "=Fields!CategoryName.Value" },
CanGrow = true,
Style = new Style
{
BorderStyle =
new BorderStyle
{
Default = BorderStyleType.None, Bottom = BorderStyleType.Solid
},
BorderColor =
new BorderColor { Bottom = Color.Green.Name },
BorderWidth = new BorderWidth { Bottom = "1pt" }
}
}
}
},
new TableCell
{
ReportItems = new TableCellReportItems()
{
ReportItem = new Text
{
Name = "Description",
Value =
new Value { Text = "=Fields!Description.Value" },
CanGrow = true,
Style = new Style
{
BorderStyle =
new BorderStyle
{
Default = BorderStyleType.None, Bottom = BorderStyleType.Solid
},
BorderColor = new BorderColor { Bottom = Color.Green.Name },
BorderWidth = new BorderWidth { Bottom = "1pt" }
}
}
}
}
}
}
});
return report;
}
}
}
================================================
FILE: RdlCreator.Tests/Reports_DataProviderTest.cs
================================================
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using System;
using Majorsilence.Reporting.RdlCreator;
using NUnit.Framework;
using System.Text.RegularExpressions;
using Microsoft.Identity.Client;
using System.Threading.Tasks;
namespace Majorsilence.Reporting.RdlCreator.Tests
{
[TestFixture]
public class Reports_DataProviderTest
{
string connectionString = "Data Source=sqlitetestdb2.db;";
DataProviders dataProvider = DataProviders.SQLite_MicrosoftData;
[SetUp]
public void Setup()
{
var files = new[]
{
"TestMethodExcelLegacy.xls",
"TestMethodExcel.xlsx",
"TestMethodExcelDataOnly.xlsx",
"TestMethodPdf.pdf"
};
foreach (var file in files)
{
var filepath = System.IO.Path.Combine(Environment.CurrentDirectory, file);
if (System.IO.File.Exists(filepath))
{
System.IO.File.Delete(filepath);
}
}
}
[Test]
public async Task TestMethodCsv()
{
var create = new RdlCreator.Create();
var fyiReport = await create.GenerateRdl(dataProvider,
connectionString,
"SELECT CategoryID, CategoryName, Description FROM Categories",
pageHeaderText: "DataProviderTest TestMethod1");
var ms = new Majorsilence.Reporting.Rdl.MemoryStreamGen();
await fyiReport.RunGetData(null);
await fyiReport.RunRender(ms, Majorsilence.Reporting.Rdl.OutputPresentationType.CSV);
var text = ms.GetText();
Assert.That(text, Is.Not.Null);
Assert.That(NormalizeEOL(text), Is.EqualTo(NormalizeEOL(@"""DataProviderTest TestMethod1""
""CategoryID"",""CategoryName"",""Description""
1,""Beverages"",""Soft drinks, coffees, teas, beers, and ales""
2,""Condiments"",""Sweet and savory sauces, relishes, spreads, and seasonings""
3,""Confections"",""Desserts, candies, and sweet breads""
4,""Dairy Products"",""Cheeses""
5,""Grains/Cereals"",""Breads, crackers, pasta, and cereal""
6,""Meat/Poultry"",""Prepared meats""
7,""Produce"",""Dried fruit and bean curd""
8,""Seafood"",""Seaweed and fish""
""1 of 1""
")));
}
[Test]
public async Task TestMethodExcelLegacy()
{
var create = new RdlCreator.Create();
var fyiReport = await create.GenerateRdl(dataProvider,
connectionString,
"SELECT CategoryID, CategoryName, Description FROM Categories",
pageHeaderText: "DataProviderTest TestMethod1");
string filepath = System.IO.Path.Combine(Environment.CurrentDirectory, "TestMethodExcelLegacy.xls");
var ofs = new Majorsilence.Reporting.Rdl.OneFileStreamGen(filepath, true);
await fyiReport.RunGetData(null);
await fyiReport.RunRender(ofs, Majorsilence.Reporting.Rdl.OutputPresentationType.ExcelTableOnly);
Assert.Multiple(() =>
{
Assert.That(System.IO.File.Exists(filepath), Is.True);
Assert.That(new FileInfo(filepath).Length, Is.GreaterThan(0));
});
}
[Test]
public async Task TestMethodExcel2007()
{
var create = new RdlCreator.Create();
var fyiReport = await create.GenerateRdl(dataProvider,
connectionString,
"SELECT CategoryID, CategoryName, Description FROM Categories",
pageHeaderText: "DataProviderTest TestMethod1");
string filepath = System.IO.Path.Combine(Environment.CurrentDirectory, "TestMethodExcel.xlsx");
var ofs = new Majorsilence.Reporting.Rdl.OneFileStreamGen(filepath, true);
await fyiReport.RunGetData(null);
await fyiReport.RunRender(ofs, Majorsilence.Reporting.Rdl.OutputPresentationType.Excel2007);
Assert.That(System.IO.File.Exists(filepath), Is.True);
}
[Test]
public async Task TestMethodExcel2007DataOnly()
{
var create = new RdlCreator.Create();
var fyiReport = await create.GenerateRdl(dataProvider,
connectionString,
"SELECT CategoryID, CategoryName, Description FROM Categories",
pageHeaderText: "DataProviderTest TestMethod1");
string filepath = System.IO.Path.Combine(Environment.CurrentDirectory, "TestMethodExcelDataOnly.xlsx");
var ofs = new Majorsilence.Reporting.Rdl.OneFileStreamGen(filepath, true);
await fyiReport.RunGetData(null);
await fyiReport.RunRender(ofs, Majorsilence.Reporting.Rdl.OutputPresentationType.Excel2007DataOnly);
Assert.That(System.IO.File.Exists(filepath), Is.True);
}
[Test]
public async Task TestMethodPdf()
{
var create = new RdlCreator.Create();
var fyiReport = await create.GenerateRdl(dataProvider,
connectionString,
"SELECT CategoryID, CategoryName, Description FROM Categories",
pageHeaderText: "DataProviderTest TestMethod1");
string filepath = System.IO.Path.Combine(Environment.CurrentDirectory, "TestMethodPdf.pdf");
var ofs = new Majorsilence.Reporting.Rdl.OneFileStreamGen(filepath, true);
await fyiReport.RunGetData(null);
await fyiReport.RunRender(ofs, Majorsilence.Reporting.Rdl.OutputPresentationType.PDF);
Assert.Multiple(() =>
{
Assert.That(System.IO.File.Exists(filepath), Is.True);
Assert.That(new FileInfo(filepath).Length, Is.GreaterThan(0));
});
}
[Test]
public async Task TestReportFromDataTable()
{
var dt = new System.Data.DataTable();
dt.Columns.Add("CategoryID", typeof(int));
dt.Columns.Add("CategoryName", typeof(string));
dt.Columns.Add("Description", typeof(string));
dt.Rows.Add(1, "Beverages", "Soft drinks, coffees, teas, beers, and ales");
dt.Rows.Add(2, "Condiments", "Sweet and savory sauces, relishes, spreads, and seasonings");
dt.Rows.Add(3, "Confections", "Desserts, candies, and sweet breads");
dt.Rows.Add(4, "Dairy Products", "Cheeses");
dt.Rows.Add(5, "Grains/Cereals", "Breads, crackers, pasta, and cereal");
dt.Rows.Add(6, "Meat/Poultry", "Prepared meats");
dt.Rows.Add(7, "Produce", "Dried fruit and bean curd");
dt.Rows.Add(8, "Seafood", "Seaweed and fish");
var create = new RdlCreator.Create();
var fyiReport = await create.GenerateRdl(dt,
pageHeaderText: "DataProviderTest TestMethod1");
var ms = new Majorsilence.Reporting.Rdl.MemoryStreamGen();
await fyiReport.RunGetData(null);
await fyiReport.RunRender(ms, Majorsilence.Reporting.Rdl.OutputPresentationType.CSV);
var text = ms.GetText();
Assert.That(text, Is.Not.Null);
Assert.That(NormalizeEOL(text), Is.EqualTo(NormalizeEOL(@"""DataProviderTest TestMethod1""
""CategoryID"",""CategoryName"",""Description""
1,""Beverages"",""Soft drinks, coffees, teas, beers, and ales""
2,""Condiments"",""Sweet and savory sauces, relishes, spreads, and seasonings""
3,""Confections"",""Desserts, candies, and sweet breads""
4,""Dairy Products"",""Cheeses""
5,""Grains/Cereals"",""Breads, crackers, pasta, and cereal""
6,""Meat/Poultry"",""Prepared meats""
7,""Produce"",""Dried fruit and bean curd""
8,""Seafood"",""Seaweed and fish""
""1 of 1""
")));
}
class Category
{
public int CategoryID { get; set; }
public string CategoryName { get; set; }
public string Description { get; set; }
}
[Test]
public async Task TestReportFromEnumerable()
{
var data = new List
{
new Category { CategoryID = 1, CategoryName = "Beverages", Description = "Soft drinks, coffees, teas, beers, and ales" },
new Category { CategoryID = 2, CategoryName = "Condiments", Description = "Sweet and savory sauces, relishes, spreads, and seasonings" },
new Category { CategoryID = 3, CategoryName = "Confections", Description = "Desserts, candies, and sweet breads" },
new Category { CategoryID = 4, CategoryName = "Dairy Products", Description = "Cheeses" },
new Category { CategoryID = 5, CategoryName = "Grains/Cereals", Description = "Breads, crackers, pasta, and cereal" },
new Category { CategoryID = 6, CategoryName = "Meat/Poultry", Description = "Prepared meats" },
new Category { CategoryID = 7, CategoryName = "Produce", Description = "Dried fruit and bean curd" },
new Category { CategoryID = 8, CategoryName = "Seafood", Description = "Seaweed and fish" }
};
var create = new RdlCreator.Create();
var fyiReport = await create.GenerateRdl(data,
pageHeaderText: "DataProviderTest TestMethod1");
var ms = new Majorsilence.Reporting.Rdl.MemoryStreamGen();
await fyiReport.RunGetData(null);
await fyiReport.RunRender(ms, Majorsilence.Reporting.Rdl.OutputPresentationType.CSV);
var text = ms.GetText();
Assert.That(text, Is.Not.Null);
Assert.That(NormalizeEOL(text), Is.EqualTo(NormalizeEOL(@"""DataProviderTest TestMethod1""
""CategoryID"",""CategoryName"",""Description""
1,""Beverages"",""Soft drinks, coffees, teas, beers, and ales""
2,""Condiments"",""Sweet and savory sauces, relishes, spreads, and seasonings""
3,""Confections"",""Desserts, candies, and sweet breads""
4,""Dairy Products"",""Cheeses""
5,""Grains/Cereals"",""Breads, crackers, pasta, and cereal""
6,""Meat/Poultry"",""Prepared meats""
7,""Produce"",""Dried fruit and bean curd""
8,""Seafood"",""Seaweed and fish""
""1 of 1""
")));
}
private string NormalizeEOL(string input)
{
return Regex.Replace(input, @"\r\n|\n\r|\n|\r", "\r\n");
}
}
}
================================================
FILE: RdlCreator.Tests/Reports_JsonDataProviderTest.cs
================================================
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using System;
using Majorsilence.Reporting.RdlCreator;
using NUnit.Framework;
using System.Text.RegularExpressions;
using Microsoft.Identity.Client;
using System.Threading.Tasks;
namespace Majorsilence.Reporting.RdlCreator.Tests
{
[TestFixture]
public class Reports_JsonDataProviderTest
{
DataProviders dataProvider = DataProviders.Json;
// Add this inside your Reports_JsonDataProviderTest class
// This property provides test cases for the Test1 method
private static IEnumerable ConnectionStrings
{
get
{
yield return "file=TestData.json";
yield return "url=TestData.json;auth=Basic: PLACEHOLDER";
yield return "url=https://raw.githubusercontent.com/majorsilence/My-FyiReporting/refs/heads/master/RdlCreator.Tests/TestData.json;auth=basic: Placeholder";
}
}
private static IEnumerable NestedDataConnectionStrings
{
get
{
yield return "file=NestedJsonData.json";
yield return "url=NestedJsonData.json;auth=Basic: PLACEHOLDER";
yield return "url=https://raw.githubusercontent.com/majorsilence/My-FyiReporting/refs/heads/master/RdlCreator.Tests/NestedJsonData.json;auth=basic: Placeholder";
}
}
[SetUp]
public void Setup()
{
var files = new[]
{
"TestJsonMethodPdf.pdf"
};
foreach (var file in files)
{
var filepath = System.IO.Path.Combine(Environment.CurrentDirectory, file);
if (System.IO.File.Exists(filepath))
{
System.IO.File.Delete(filepath);
}
}
}
[Test]
[TestCaseSource(nameof(ConnectionStrings))]
public async Task TestConnectionStrings(string connectionString)
{
var create = new RdlCreator.Create();
var fyiReport = await create.GenerateRdl(dataProvider,
connectionString,
"columns=EmployeID,LastName,FirstName,Title",
pageHeaderText: "DataProviderTest TestMethod1");
var ms = new Majorsilence.Reporting.Rdl.MemoryStreamGen();
await fyiReport.RunGetData(null);
await fyiReport.RunRender(ms, Majorsilence.Reporting.Rdl.OutputPresentationType.CSV);
var text = ms.GetText();
Assert.That(text, Is.Not.Null);
Assert.That(NormalizeEOL(text), Is.EqualTo(NormalizeEOL(@"""DataProviderTest TestMethod1""
""EmployeID"",""LastName"",""FirstName"",""Title""
1,""Davolio"",""Nancy"",""Sales Representative""
2,""Fuller"",""Andrew"",""Vice President, Sales""
3,""Leverling"",""Janet"",""Sales Representative""
4,""Peacock"",""Margaret"",""Sales Representative""
5,""Buchanan"",""Steven"",""Sales Manager""
6,""Suyama"",""Michael"",""Sales Representative""
8,""Callahan"",""Laura"",""Inside Sales Coordinator""
9,""Dodsworth"",""Anne"",""Sales Representative""
""1 of 1""
")));
}
[Test]
[TestCaseSource(nameof(NestedDataConnectionStrings))]
public async Task NestedJson(string connectionString)
{
var create = new RdlCreator.Create();
var fyiReport = await create.GenerateRdl(dataProvider,
connectionString,
"columns=EmployeeID,LastName,FirstName,ContactInfo_Phone,ContactInfo_Email",
pageHeaderText: "DataProviderTest TestMethod1");
var ms = new Majorsilence.Reporting.Rdl.MemoryStreamGen();
await fyiReport.RunGetData(null);
await fyiReport.RunRender(ms, Majorsilence.Reporting.Rdl.OutputPresentationType.CSV);
var text = ms.GetText();
Assert.That(text, Is.Not.Null);
Assert.That(NormalizeEOL(text), Is.EqualTo(NormalizeEOL(@"""DataProviderTest TestMethod1""
""EmployeeID"",""LastName"",""FirstName"",""ContactInfo_Phone"",""ContactInfo_Email""
1,""Davolio"",""Nancy"",""(206) 555-9857"",""nancy.davolio@example.com""
2,""Fuller"",""Andrew"",""(206) 555-9482"",""""
3,""Leverling"",""Janet"",""(206) 555-3412"",""""
4,""Peacock"",""Margaret"",""(206) 555-8122"",""""
5,""Buchanan"",""Steven"",""(71) 555-4848"",""""
6,""Suyama"",""Michael"",""(71) 555-7773"",""""
8,""Callahan"",""Laura"",""(206) 555-1189"",""""
9,""Dodsworth"",""Anne"",""(71) 555-4444"",""""
""1 of 1""
")));
}
private string NormalizeEOL(string input)
{
return Regex.Replace(input, @"\r\n|\n\r|\n|\r", "\r\n");
}
}
}
================================================
FILE: RdlCreator.Tests/Reports_ManualDefinitionTest.cs
================================================
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using System;
using Majorsilence.Reporting.RdlCreator;
using NUnit.Framework;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using UglyToad.PdfPig;
using System.Linq;
#if DRAWINGCOMPAT
using Majorsilence.Drawing;
#else
using System.Drawing;
#endif
namespace Majorsilence.Reporting.RdlCreator.Tests
{
[TestFixture]
public class Reports_ManualDefinitionTest
{
string connectionString = "Data Source=sqlitetestdb2.db;";
string dataProvider = "Microsoft.Data.Sqlite";
[Test]
public async Task CsvExport()
{
var create = new RdlCreator.Create();
var report = GenerateTestData();
var fyiReport = await create.GenerateRdl(report);
using var ms = new Majorsilence.Reporting.Rdl.MemoryStreamGen();
await fyiReport.RunGetData(null);
await fyiReport.RunRender(ms, Majorsilence.Reporting.Rdl.OutputPresentationType.CSV);
var text = ms.GetText();
Assert.That(text, Is.Not.Null);
Assert.That(NormalizeEOL(text), Is.EqualTo(NormalizeEOL(@"""Test Data Set Report""
""CategoryID"",""CategoryName"",""Description""
""Beverages"",""Soft drinks, coffees, teas, beers, and ales""
""Condiments"",""Sweet and savory sauces, relishes, spreads, and seasonings""
""Confections"",""Desserts, candies, and sweet breads""
""Dairy Products"",""Cheeses""
""Grains/Cereals"",""Breads, crackers, pasta, and cereal""
""Meat/Poultry"",""Prepared meats""
""Produce"",""Dried fruit and bean curd""
""Seafood"",""Seaweed and fish""
""1 of 1""
")));
}
[Test]
public async Task HtmlExport()
{
var create = new RdlCreator.Create();
var report = GenerateTestData();
var fyiReport = await create.GenerateRdl(report);
using var ms = new Majorsilence.Reporting.Rdl.MemoryStreamGen();
await fyiReport.RunGetData(null);
await fyiReport.RunRender(ms, Majorsilence.Reporting.Rdl.OutputPresentationType.HTML);
var text = ms.GetText();
Assert.That(text, Is.Not.Null);
Assert.That(NormalizeEOL(text).Contains(NormalizeEOL(@"Dairy Products")));
}
[Test]
public async Task PdfStreamExport()
{
var create = new RdlCreator.Create();
var report = GenerateTestData();
var fyiReport = await create.GenerateRdl(report);
using var ms = new Majorsilence.Reporting.Rdl.MemoryStreamGen();
await fyiReport.RunGetData(null);
await fyiReport.RunRender(ms, Majorsilence.Reporting.Rdl.OutputPresentationType.PDF);
var pdfStream = ms.GetStream();
pdfStream.Position = 0;
using var pdfDocument = PdfDocument.Open(pdfStream);
var text = string.Join(" ", pdfDocument.GetPages().SelectMany(page => page.GetWords()).Select(word => word.Text));
Assert.That(text, Is.Not.Null);
Assert.That(text, Is.EqualTo("Test Data Set Report CategoryID CategoryName Description Beverages Soft drinks, coffees, teas, beers, and ales Condiments Sweet and savory sauces, relishes, spreads, and seasonings Confections Desserts, candies, and sweet breads Dairy Products Cheeses Grains/Cereals Breads, crackers, pasta, and cereal Meat/Poultry Prepared meats Produce Dried fruit and bean curd Seafood Seaweed and fish 1 of 1"));
}
[Test]
public async Task PdfDiskExport()
{
var create = new RdlCreator.Create();
var report = GenerateTestData();
var fyiReport = await create.GenerateRdl(report);
using var ms = new Majorsilence.Reporting.Rdl.MemoryStreamGen();
await fyiReport.RunGetData(null);
await fyiReport.RunRender(ms, Majorsilence.Reporting.Rdl.OutputPresentationType.PDF);
var pdfStream = ms.GetStream();
pdfStream.Position = 0;
using var fileStream = new FileStream("PdfDiskExport.pdf", FileMode.Create, FileAccess.Write);
pdfStream.CopyTo(fileStream);
await fileStream.DisposeAsync();
using var pdfDocument = PdfDocument.Open("PdfDiskExport.pdf");
var text = string.Join(" ", pdfDocument.GetPages().SelectMany(page => page.GetWords()).Select(word => word.Text));
Assert.That(text, Is.Not.Null);
Assert.That(text, Is.EqualTo("Test Data Set Report CategoryID CategoryName Description Beverages Soft drinks, coffees, teas, beers, and ales Condiments Sweet and savory sauces, relishes, spreads, and seasonings Confections Desserts, candies, and sweet breads Dairy Products Cheeses Grains/Cereals Breads, crackers, pasta, and cereal Meat/Poultry Prepared meats Produce Dried fruit and bean curd Seafood Seaweed and fish 1 of 1"));
}
private string NormalizeEOL(string input)
{
return Regex.Replace(input, @"\r\n|\n\r|\n|\r", "\r\n");
}
private RdlCreator.Report GenerateTestData()
{
// Create an instance of the Report class
var report = new Report
{
Description = "Sample report",
Author = "John Doe",
PageHeight = "11in",
PageWidth = new ReportItemSize()
{
Value = 8.5f,
Unit = SizeUnit.Inches
},
Width = ReportItemSize.FromInches(7.5f),
TopMargin = ".25in",
LeftMargin = ".25in",
RightMargin = ".25in",
BottomMargin = ".25in",
DataSources = new DataSources
{
DataSource = new DataSource
{
Name = "DS1",
ConnectionProperties = new ConnectionProperties
{
DataProvider = dataProvider,
ConnectString = connectionString
}
}
},
DataSets = new DataSets
{
DataSet = new DataSet
{
Name = "Data",
Query = new Query
{
DataSourceName = "DS1",
CommandText = "SELECT CategoryID, CategoryName, Description FROM Categories"
},
Fields = new Fields
{
Field = new List
{
new Field { Name = "CategoryID", DataField = "CategoryID", TypeName = "System.Int64" },
new Field { Name = "CategoryName", DataField = "CategoryName", TypeName = "System.String" },
new Field { Name = "Description", DataField = "Description", TypeName = "System.String" }
}
}
}
},
PageHeader = new PageHeader
{
Height = ".5in",
ReportItems = new ReportItemsHeader
{
Textbox = new Text
{
Name = "Textbox1",
Top = ".1in",
Left = ".1in",
Width = "6in",
Height = ".25in",
Value = new Value { Text = "Test Data Set Report" },
Style = new Style { FontSize = "15pt", FontWeight = "Bold" }
}
},
PrintOnFirstPage = "true",
PrintOnLastPage = "true"
},
Body = new Body
{
ReportItems = new ReportItemsBody
{
Table = new Table
{
TableName = "Table1",
DataSetName = "Data",
NoRows = "Query returned no rows!",
TableColumns = new TableColumns
{
TableColumn = new List
{
new TableColumn { Width = "1.25in" },
new TableColumn { Width = "1.5in" },
new TableColumn { Width = "1.375in" }
}
},
Header = new Header
{
TableRows = new TableRows
{
TableRow = new TableRow
{
Height = "12pt",
TableCells = new TableCells()
{
TableCell = new List
{
new TableCell { ReportItems= new TableCellReportItems(){ ReportItem = new Text { Name = "Textbox2",
Value = new Value { Text = "CategoryID" },
Style = new Style { TextAlign = "Center", FontWeight = "Bold" } } } },
new TableCell { ReportItems= new TableCellReportItems(){ReportItem = new Text { Name = "Textbox3",
Value = new Value { Text = "CategoryName" },
Style = new Style { TextAlign = "Center", FontWeight = "Bold" } } } },
new TableCell { ReportItems= new TableCellReportItems(){ReportItem = new Text { Name = "Textbox4",
Value = new Value { Text = "Description" },
Style = new Style { TextAlign = "Center", FontWeight = "Bold" } } } }
}
}
}
},
RepeatOnNewPage = "true"
},
Details = new Details
{
TableRows = new TableRows
{
TableRow = new TableRow
{
Height = "12pt",
TableCells = new TableCells()
{
TableCell = new List
{
new TableCell {
ReportItems= new TableCellReportItems()
{
ReportItem = new CustomReportItems()
{
Name = "QrCode",
Type = "QR Code",
Width = "35.91mm",
Height = "35.91mm",
CustomProperties = new CustomProperties
{
CustomProperty = new CustomProperty()
{
Name = "QrCode",
Value = "=Fields!CategoryID.Value"
}
},
CanGrow="true",
Style = new Style
{
BorderStyle= new BorderStyle
{
Default=BorderStyleType.None,
Bottom=BorderStyleType.Solid
},
BorderColor=new BorderColor
{
Bottom = Color.Green.Name
},
BorderWidth= new BorderWidth
{
Bottom="1pt"
}
}
}
}
},
new TableCell
{
ReportItems = new TableCellReportItems()
{
ReportItem = new Text {
Name = "CategoryName",
Value = new Value
{
Text = "=Fields!CategoryName.Value"
},
CanGrow = true,
Style = new Style
{
BorderStyle= new BorderStyle
{
Default=BorderStyleType.None,
Bottom=BorderStyleType.Solid
},
BorderColor=new BorderColor
{
Bottom = Color.Green.Name
},
BorderWidth= new BorderWidth
{
Bottom="1pt"
}
}
}
}
},
new TableCell
{
ReportItems= new TableCellReportItems()
{
ReportItem = new Text
{
Name = "Description",
Value = new Value
{
Text = "=Fields!Description.Value"
},
CanGrow = true,
Style = new Style
{
BorderStyle= new BorderStyle
{
Default=BorderStyleType.None,
Bottom=BorderStyleType.Solid
},
BorderColor=new BorderColor
{
Bottom = Color.Green.Name
},
BorderWidth= new BorderWidth
{
Bottom="1pt"
}
}
}
}
}
}
}
}
}
}
}
},
Height = "36pt"
},
PageFooter = new PageFooter
{
Height = "14pt",
ReportItems = new ReportItemsFooter
{
Textbox = new Text
{
Name = "Textbox5",
Top = "1pt",
Left = "10pt",
Height = "12pt",
Width = "3in",
Value = new Value { Text = "=Globals!PageNumber + ' of ' + Globals!TotalPages" },
Style = new Style { FontSize = "10pt", FontWeight = "Normal" }
}
},
PrintOnFirstPage = "true",
PrintOnLastPage = "true"
}
};
return report;
}
}
}
================================================
FILE: RdlCreator.Tests/TestData.json
================================================
[
{
"EmployeID": 1,
"LastName": "Davolio",
"FirstName": "Nancy",
"Title": "Sales Representative",
"TitleOfCourtesy": "Ms.",
"BirthDate": "1948-12-08 00:00:00",
"HireDate": "1992-05-01 00:00:00",
"Address": "507 - 20th Ave. E.\r\nApt. 2A",
"City": "Seattle",
"Region": "WA",
"PostalCode": "98122",
"Country": "USA",
"HomePhone": "(206) 555-9857",
"Extension": "5467",
"Notes": "Education includes a BA in psychology from Colorado State University in 1970. She also completed \"The Art of the Cold Call.\" Nancy is a member of Toastmasters International.",
"PhotoPath": "http://accweb/emmployees/davolio.bmp"
},
{
"EmployeID": 2,
"LastName": "Fuller",
"FirstName": "Andrew",
"Title": "Vice President, Sales",
"TitleOfCourtesy": "Dr.",
"BirthDate": "1952-02-19 00:00:00",
"HireDate": "1992-08-14 00:00:00",
"Address": "908 W. Capital Way",
"City": "Tacoma",
"Region": "WA",
"PostalCode": "98401",
"Country": "USA",
"HomePhone": "(206) 555-9482",
"Extension": "3457",
"Notes": "Andrew received his BTS commercial in 1974 and a Ph.D. in international marketing from the University of Dallas in 1981. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager in January 1992 and to vice president of sales in March 1993. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.",
"PhotoPath": "http://accweb/emmployees/fuller.bmp"
},
{
"EmployeID": 3,
"LastName": "Leverling",
"FirstName": "Janet",
"Title": "Sales Representative",
"TitleOfCourtesy": "Ms.",
"BirthDate": "1963-08-30 00:00:00",
"HireDate": "1992-04-01 00:00:00",
"Address": "722 Moss Bay Blvd.",
"City": "Kirkland",
"Region": "WA",
"PostalCode": "98033",
"Country": "USA",
"HomePhone": "(206) 555-3412",
"Extension": "3355",
"Notes": "Janet has a BS degree in chemistry from Boston College (1984). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate in 1991 and promoted to sales representative in February 1992.",
"PhotoPath": "http://accweb/emmployees/leverling.bmp"
},
{
"EmployeID": 4,
"LastName": "Peacock",
"FirstName": "Margaret",
"Title": "Sales Representative",
"TitleOfCourtesy": "Mrs.",
"BirthDate": "1937-09-19 00:00:00",
"HireDate": "1993-05-03 00:00:00",
"Address": "4110 Old Redmond Rd.",
"City": "Redmond",
"Region": "WA",
"PostalCode": "98052",
"Country": "USA",
"HomePhone": "(206) 555-8122",
"Extension": "5176",
"Notes": "Margaret holds a BA in English literature from Concordia College (1958) and an MA from the American Institute of Culinary Arts (1966). She was assigned to the London office temporarily from July through November 1992.",
"PhotoPath": "http://accweb/emmployees/peacock.bmp"
},
{
"EmployeID": 5,
"LastName": "Buchanan",
"FirstName": "Steven",
"Title": "Sales Manager",
"TitleOfCourtesy": "Mr.",
"BirthDate": "1955-03-04 00:00:00",
"HireDate": "1993-10-17 00:00:00",
"Address": "14 Garrett Hill",
"City": "London",
"Region": null,
"PostalCode": "SW1 8JR",
"Country": "UK",
"HomePhone": "(71) 555-4848",
"Extension": "3453",
"Notes": "Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree in 1976. Upon joining the company as a sales representative in 1992, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London. He was promoted to sales manager in March 1993. Mr. Buchanan has completed the courses \"Successful Telemarketing\" and \"International Sales Management.\" He is fluent in French.",
"PhotoPath": "http://accweb/emmployees/buchanan.bmp"
},
{
"EmployeID": 6,
"LastName": "Suyama",
"FirstName": "Michael",
"Title": "Sales Representative",
"TitleOfCourtesy": "Mr.",
"BirthDate": "1963-07-02 00:00:00",
"HireDate": "1993-10-17 00:00:00",
"Address": "Coventry House\r\nMiner Rd.",
"City": "London",
"Region": null,
"PostalCode": "EC2 7JR",
"Country": "UK",
"HomePhone": "(71) 555-7773",
"Extension": "428",
"Notes": "Michael is a graduate of Sussex University (MA, economics, 1983) and the University of California at Los Angeles (MBA, marketing, 1986). He has also taken the courses \"Multi-Cultural Selling\" and \"Time Management for the Sales Professional.\" He is fluent in Japanese and can read and write French, Portuguese, and Spanish.",
"PhotoPath": "http://accweb/emmployees/davolio.bmp"
},
{
"EmployeID": 8,
"LastName": "Callahan",
"FirstName": "Laura",
"Title": "Inside Sales Coordinator",
"TitleOfCourtesy": "Ms.",
"BirthDate": "1958-01-09 00:00:00",
"HireDate": "1994-03-05 00:00:00",
"Address": "4726 - 11th Ave. N.E.",
"City": "Seattle",
"Region": "WA",
"PostalCode": "98105",
"Country": "USA",
"HomePhone": "(206) 555-1189",
"Extension": "2344",
"Notes": "Laura received a BA in psychology from the University of Washington. She has also completed a course in business French. She reads and writes French.",
"PhotoPath": "http://accweb/emmployees/davolio.bmp"
},
{
"EmployeID": 9,
"LastName": "Dodsworth",
"FirstName": "Anne",
"Title": "Sales Representative",
"TitleOfCourtesy": "Ms.",
"BirthDate": "1966-01-27 00:00:00",
"HireDate": "1994-11-15 00:00:00",
"Address": "7 Houndstooth Rd.",
"City": "London",
"Region": null,
"PostalCode": "WG2 7LT",
"Country": "UK",
"HomePhone": "(71) 555-4444",
"Extension": "452",
"Notes": "Anne has a BA degree in English from St. Lawrence College. She is fluent in French and German.",
"PhotoPath": "http://accweb/emmployees/davolio.bmp"
}
]
================================================
FILE: RdlCri/AztecCode.cs
================================================
using System;
using System.Collections.Generic;
using System.Text;
using Majorsilence.Reporting.Rdl;
#if DRAWINGCOMPAT
using Draw2 = Majorsilence.Drawing;
#else
using Draw2 = System.Drawing;
#endif
using System.ComponentModel;
using System.Xml;
namespace Majorsilence.Reporting.Cri
{
public class AztecCode : ZxingBarcodes
{
public AztecCode() : base(35.91f, 35.91f) // Optimal width at mag 1
{
format = ZXing.BarcodeFormat.AZTEC;
}
}
}
================================================
FILE: RdlCri/BarCode128.cs
================================================
using System;
using System.Collections.Generic;
#if DRAWINGCOMPAT
using Draw2 = Majorsilence.Drawing;
#else
using Draw2 = System.Drawing;
#endif
using Majorsilence.Reporting.Rdl;
using System.Text;
using System.Xml;
using System.ComponentModel;
namespace Majorsilence.Reporting.Cri
{
public class BarCode128 : ZxingBarcodes
{
public BarCode128() : base(35.91f, 65.91f) // Optimal width at mag 1
{
format = ZXing.BarcodeFormat.CODE_128;
}
}
}
================================================
FILE: RdlCri/BarCode39.cs
================================================
using System;
using System.Collections.Generic;
using System.Text;
using Majorsilence.Reporting.Rdl;
#if DRAWINGCOMPAT
using Draw2 = Majorsilence.Drawing;
#else
using Draw2 = System.Drawing;
#endif
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Xml;
namespace Majorsilence.Reporting.Cri
{
public class BarCode39 : ZxingBarcodes
{
public BarCode39() : base(35.91f, 65.91f) // Optimal width at mag 1
{
format = ZXing.BarcodeFormat.CODE_39;
}
}
}
================================================
FILE: RdlCri/BarCodeBookland.cs
================================================
using System;
using System.Collections.Generic;
using System.Text;
#if DRAWINGCOMPAT
using Draw2 = Majorsilence.Drawing;
#else
using Draw2 = System.Drawing;
#endif
using System.ComponentModel; // need this for the properties metadata
using System.Xml;
using System.Text.RegularExpressions;
using Majorsilence.Reporting.Rdl;
namespace Majorsilence.Reporting.Cri
{
///
/// BarCodeBookland: create Bookland compatible BarCode images.
/// See http://www.barcodeisland.com/bookland.phtml for description of how to
/// construct a Bookland compatible barcode. In essence, Bookland is simply
/// EAN-13 barcode with a number system of 978.
///
public class BarCodeBookland: ICustomReportItem
{
string _ISBN; // ISBN number
BarCodeEAN13 _Ean13; // the EAN-13 barcode object
public BarCodeBookland() // Need to be able to create an instance
{
_Ean13 = new BarCodeEAN13();
}
#region ICustomReportItem Members
///
/// Runtime: Draw the BarCode
///
/// Bitmap to draw the barcode in.
public void DrawImage(ref Draw2.Bitmap bm)
{
_Ean13.DrawImage(ref bm);
}
///
/// Design time: Draw a hard coded BarCode for design time; Parameters can't be
/// relied on since they aren't available.
///
///
public void DrawDesignerImage(ref Draw2.Bitmap bm)
{
_Ean13.DrawImage(bm, "978015602732"); // Yann Martel-Life of Pi
}
///
/// BarCode isn't a DataRegion
///
///
public bool IsDataRegion()
{
return false;
}
///
/// Set the properties; No validation is done at this time.
///
///
public void SetProperties(IDictionary props)
{
try
{
string p;
if (props.TryGetValue("ISBN", out object codeValue))
{
// Backwards Compatibility: if the property is present, use it
p = codeValue.ToString();
}
else {
// fallback to standard "Code" property
p = props["Code"].ToString();
}
if (p == null)
throw new Exception("ISBN property must be a string.");
// remove any dashes
p = p.Replace("-", "");
if (p.Length > 9) // get rid of the ISBN checksum digit
p = p.Substring(0, 9);
if (!Regex.IsMatch(p, "^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$"))
throw new Exception("ISBN must have at least nine digits.");
_ISBN = p;
// Now set the properties of the EAN-13
IDictionary ean13_props = new Dictionary();
ean13_props.Add("NumberSystem", "97");
ean13_props.Add("ManufacturerCode", "8" + _ISBN.Substring(0, 4));
ean13_props.Add("ProductCode", _ISBN.Substring(4,5));
_Ean13.SetProperties(ean13_props);
}
catch (KeyNotFoundException )
{
throw new Exception("ISBN property must be specified");
}
return;
}
///
/// Design time call: return string with ... syntax for
/// the insert. The string contains a variable {0} which will be substituted with the
/// configuration name. This allows the name to be completely controlled by
/// the configuration file.
///
///
public string GetCustomReportItemXml()
{
return "{0}" +
string.Format("{0}mm{1}mm", BarCodeEAN13.OptimalHeight, BarCodeEAN13.OptimalWidth) +
"" +
"" +
"ISBN" +
"0-15-602732-1" + // Yann Martel- Life of Pi
"" +
"" +
"";
}
///
/// Return an instance of the class representing the properties.
/// This method is called at design time;
///
///
public object GetPropertiesInstance(XmlNode iNode)
{
BarCodeBooklandProperties bcp = new BarCodeBooklandProperties(this, iNode);
foreach (XmlNode n in iNode.ChildNodes)
{
if (n.Name != "CustomProperty")
continue;
string pname = this.GetNamedElementValue(n, "Name", "");
switch (pname)
{
case "ISBN":
bcp.SetISBN(GetNamedElementValue(n, "Value", "0-15-602732-1"));
break;
default:
break;
}
}
return bcp;
}
///
/// Set the custom properties given the properties object
///
///
///
public void SetPropertiesInstance(XmlNode node, object inst)
{
node.RemoveAll(); // Get rid of all properties
BarCodeBooklandProperties bcp = inst as BarCodeBooklandProperties;
if (bcp == null)
return;
// ISBN
CreateChild(node, "ISBN", bcp.ISBN);
}
void CreateChild(XmlNode node, string nm, string val)
{
XmlDocument xd = node.OwnerDocument;
XmlNode cp = xd.CreateElement("CustomProperty");
node.AppendChild(cp);
XmlNode name = xd.CreateElement("Name");
name.InnerText = nm;
cp.AppendChild(name);
XmlNode v = xd.CreateElement("Value");
v.InnerText = val;
cp.AppendChild(v);
}
public void Dispose()
{
_Ean13.Dispose();
return;
}
#endregion
///
/// Get the child element with the specified name. Return the InnerText
/// value if found otherwise return the passed default.
///
/// Parent node
/// Name of child node to look for
/// Default value to use if not found
/// Value the named child node
string GetNamedElementValue(XmlNode xNode, string name, string def)
{
if (xNode == null)
return def;
foreach (XmlNode cNode in xNode.ChildNodes)
{
if (cNode.NodeType == XmlNodeType.Element &&
cNode.Name == name)
return cNode.InnerText;
}
return def;
}
///
/// BarCodeProperties- All properties are type string to allow for definition of
/// a runtime expression.
///
public class BarCodeBooklandProperties
{
BarCodeBookland _bcbl;
XmlNode _node;
string _ISBN;
internal BarCodeBooklandProperties(BarCodeBookland bcbl, XmlNode node)
{
_bcbl = bcbl;
_node = node;
}
internal void SetISBN(string isbn)
{
_ISBN = isbn;
}
[Category("BarCode"),
Description("ISBN is the book's ISBN number.")]
public string ISBN
{
get { return _ISBN; }
set
{
_ISBN = value;
_bcbl.SetPropertiesInstance(_node, this);
}
}
}
}
}
================================================
FILE: RdlCri/BarCodeEAN13.cs
================================================
using System;
using System.Collections.Generic;
using System.Text;
#if DRAWINGCOMPAT
using Draw2 = Majorsilence.Drawing;
#else
using Draw2 = System.Drawing;
#endif
using System.ComponentModel; // need this for the properties metadata
using System.Xml;
using System.Text.RegularExpressions;
using Majorsilence.Reporting.Rdl;
namespace Majorsilence.Reporting.Cri
{
///
/// BarCode: create EAN-13 compatible BarCode images.
/// See http://www.barcodeisland.com/ean13.phtml for description of how to
/// construct a EAN-13 compatible barcode
/// See http://194.203.97.138/eanucc/ for the specification.
///
public class BarCodeEAN13 : ICustomReportItem
{
// Encoding arrays: digit encoding depends on whether it is on the
// right hand (product code side) or the left hand (manufacturer side).
// When on the left hand the first number of the system digit (country)
// determines the even/odd parity order.
// index RightHandEncoding when doing the product code side
static readonly string[] RightHandEncoding =
{
"1110010", "1100110", "1101100", "1000010", "1011100", "1001110", "1010000", "1000100", "1001000",
"1110100"
};
// index LeftHandEncodingOdd when the ParityOrdering char is odd '1'
static readonly string[] LeftHandEncodingOdd =
{
"0001101", "0011001", "0010011", "0111101", "0100011", "0110001", "0101111", "0111011", "0110111",
"0001011"
};
// index LeftHandEncodingEven when the ParityOrdering char is even '0'
static readonly string[] LeftHandEncodingEven =
{
"0100111", "0110011", "0011011", "0100001", "0011101", "0111001", "0000101", "0010001", "0001001",
"0010111"
};
// index ParityOrdering using the first number of the system digit
static readonly string[] ParityOrdering = // Convention: 1 is considered Odd, 0 is considered even
{
"111111", "110100", "110010", "110001", "101100", "100110", "100011", "101010", "101001", "100101"
};
string _NumberSystem; // Number system
string _ManufacturerCode; // Manufacturer code (assigned by number system authority)
string _ProductCode; // Product code (assigned by company)
// The EAN-13 Bar Code Symbol shall be made up as follows, reading from left to right:
//� A left Quiet Zone
//� A normal Guard Bar Pattern
//� Six symbol characters from number sets A and B (each 7 modules long)
//� A centre Guard Bar Pattern
//� Six symbol characters from number set C (each 7 modules long)
//� A normal Guard Bar Pattern
//� A right Quiet Zone
static public readonly float OptimalHeight = 25.91f; // Optimal height at magnification 1
static public readonly float OptimalWidth = 37.29f; // Optimal width at mag 1
static readonly float ModuleWidth = 0.33f; // module width in mm at mag factor 1
static readonly float FontHeight = 8; // Font height at mag factor 1
static readonly int LeftQuietZoneModules = 11; // # of modules in left quiet zone
static readonly int RightQuietZoneModules = 7; // # of modules in left quiet zone
static readonly int GuardModules = 3; // # of modules in left and right guard
static readonly int ManufacturingModules = 7 * 6; // # of modules in manufacturing
static readonly int CenterBarModules = 5; // # of modules in center bar
static readonly int ProductModules = 7 * 6; // # of modules in product + checksum
static readonly int ModulesToManufacturingStart =
LeftQuietZoneModules + GuardModules;
static readonly int ModulesToManufacturingEnd =
ModulesToManufacturingStart + ManufacturingModules;
static readonly int ModulesToProductStart =
ModulesToManufacturingEnd + CenterBarModules;
static readonly int ModulesToProductEnd =
ModulesToProductStart + ProductModules;
static readonly int TotalModules = ModulesToProductEnd + GuardModules + RightQuietZoneModules;
public BarCodeEAN13() // Need to be able to create an instance
{
}
#region ICustomReportItem Members
///
/// Runtime: Draw the BarCode
///
/// Bitmap to draw the barcode in.
public void DrawImage(ref Draw2.Bitmap bm)
{
string upcode = _NumberSystem + _ManufacturerCode + _ProductCode;
DrawImage(bm, upcode);
}
///
/// Design time: Draw a hard coded BarCode for design time; Parameters can't be
/// relied on since they aren't available.
///
///
public void DrawDesignerImage(ref Draw2.Bitmap bm)
{
DrawImage(bm, "00" + "12345" + "12345");
}
///
/// DrawImage given a Bitmap and a upcode does all the drawing work.
///
///
///
internal void DrawImage(Draw2.Bitmap bm, string upcode)
{
string barPattern = this.GetEncoding(upcode);
using Draw2.Graphics g = Draw2.Graphics.FromImage(bm);
float mag = PixelConversions.GetMagnification(g, bm.Width, bm.Height, OptimalHeight, OptimalWidth);
float barWidth = ModuleWidth * mag;
float barHeight = OptimalHeight * mag;
float fontHeight = FontHeight * mag;
float fontHeightMM = fontHeight / 72.27f * 25.4f;
g.PageUnit = Draw2.GraphicsUnit.Millimeter;
// Fill in the background with white
g.FillRectangle(Draw2.Brushes.White, 0, 0, bm.Width, bm.Height);
// Draw the bars
int barCount = LeftQuietZoneModules;
foreach (char bar in barPattern)
{
if (bar == '1')
{
float bh = ((barCount > ModulesToManufacturingStart && barCount < ModulesToManufacturingEnd) ||
(barCount > ModulesToProductStart && barCount < ModulesToProductEnd))
? barHeight - fontHeightMM
: barHeight;
g.FillRectangle(Draw2.Brushes.Black, barWidth * barCount, 0, barWidth, bh);
}
barCount++;
}
// Draw the human readable portion of the barcode
using var f = new Draw2.Font("Arial", fontHeight);
// Draw the left guard text (i.e. 2nd digit of the NumberSystem)
string wc = upcode.Substring(0, 1);
g.DrawString(wc, f, Draw2.Brushes.Black,
new Draw2.PointF(barWidth * LeftQuietZoneModules - g.MeasureString(wc, f).Width,
barHeight - fontHeightMM));
// Draw the manufacturing digits
wc = upcode.Substring(1, 6);
g.DrawString(wc, f, Draw2.Brushes.Black,
new Draw2.PointF(barWidth * ModulesToManufacturingEnd - g.MeasureString(wc, f).Width,
barHeight - fontHeightMM));
// Draw the product code + the checksum digit
wc = upcode.Substring(7, 5) + CheckSum(upcode).ToString();
g.DrawString(wc, f, Draw2.Brushes.Black,
new Draw2.PointF(barWidth * ModulesToProductEnd - g.MeasureString(wc, f).Width,
barHeight - fontHeightMM));
}
///
/// BarCode isn't a DataRegion
///
///
public bool IsDataRegion()
{
return false;
}
///
/// Set the properties; No validation is done at this time.
///
///
public void SetProperties(IDictionary props)
{
object pv;
try
{
pv = props["NumberSystem"];
if (pv is int || pv is long || pv is float || pv is double)
_NumberSystem = string.Format("{0:00}", pv);
else
_NumberSystem = pv.ToString();
}
catch (KeyNotFoundException)
{
throw new Exception("NumberSystem property must be specified");
}
if (!Regex.IsMatch(_NumberSystem, "^[0-9][0-9]$"))
throw new Exception("NumberSystem must be a 2 digit string.");
try
{
pv = props["ManufacturerCode"];
if (pv is int || pv is long || pv is float || pv is double)
_ManufacturerCode = string.Format("{0:00000}", pv);
else
_ManufacturerCode = pv.ToString();
}
catch (KeyNotFoundException)
{
throw new Exception("ManufacturerCode property must be specified");
}
if (!Regex.IsMatch(_ManufacturerCode, "^[0-9][0-9][0-9][0-9][0-9]$"))
throw new Exception("ManufacturerCode must be a 5 digit string.");
try
{
pv = props["ProductCode"];
if (pv is int || pv is long || pv is float || pv is double)
_ProductCode = string.Format("{0:00000}", pv);
else
_ProductCode = pv.ToString();
}
catch (KeyNotFoundException)
{
throw new Exception("ProductCode property must be specified.");
}
if (!Regex.IsMatch(_ProductCode, "^[0-9][0-9][0-9][0-9][0-9]$"))
throw new Exception("ProductCode must be a 5 digit string.");
return;
}
///
/// Design time call: return string with ... syntax for
/// the insert. The string contains a variable {0} which will be substituted with the
/// configuration name. This allows the name to be completely controlled by
/// the configuration file.
///
///
public string GetCustomReportItemXml()
{
return "{0}" +
string.Format("{0}mm{1}mm", OptimalHeight, OptimalWidth) +
"" +
"" +
"NumberSystem" +
"00" +
"" +
"" +
"ManufacturerCode" +
"12345" +
"" +
"" +
"ProductCode" +
"12345" +
"" +
"" +
"";
}
///
/// Return an instance of the class representing the properties.
/// This method is called at design time;
///
///
public object GetPropertiesInstance(XmlNode iNode)
{
BarCodeProperties bcp = new BarCodeProperties(this, iNode);
foreach (XmlNode n in iNode.ChildNodes)
{
if (n.Name != "CustomProperty")
continue;
string pname = this.GetNamedElementValue(n, "Name", "");
switch (pname)
{
case "ProductCode":
bcp.SetProductCode(GetNamedElementValue(n, "Value", "00000"));
break;
case "ManufacturerCode":
bcp.SetManufacturerCode(GetNamedElementValue(n, "Value", "00000"));
break;
case "NumberSystem":
bcp.SetNumberSystem(GetNamedElementValue(n, "Value", "00"));
break;
default:
break;
}
}
return bcp;
}
///
/// Set the custom properties given the properties object
///
///
///
public void SetPropertiesInstance(XmlNode node, object inst)
{
node.RemoveAll(); // Get rid of all properties
BarCodeProperties bcp = inst as BarCodeProperties;
if (bcp == null)
return;
// NumberSystem
CreateChild(node, "NumberSystem", bcp.NumberSystem);
// ManufacturerCode
CreateChild(node, "ManufacturerCode", bcp.ManufacturerCode);
// ProductCode
CreateChild(node, "ProductCode", bcp.ProductCode);
}
void CreateChild(XmlNode node, string nm, string val)
{
XmlDocument xd = node.OwnerDocument;
XmlNode cp = xd.CreateElement("CustomProperty");
node.AppendChild(cp);
XmlNode name = xd.CreateElement("Name");
name.InnerText = nm;
cp.AppendChild(name);
XmlNode v = xd.CreateElement("Value");
v.InnerText = val;
cp.AppendChild(v);
}
public void Dispose()
{
return;
}
#endregion
///
/// GetEncoding returns a string representing the on/off bars. It should be passed
/// a string of 12 characters: Country code 2 chars + Manufacturers code 5 chars +
/// Product code 5 chars.
///
///
///
string GetEncoding(string upccode)
{
if (upccode == null)
throw new ArgumentNullException("upccode");
else if (upccode.Length != 12)
throw new ArgumentException(
"UPC code must be 12 characters: country code 2 chars, mfg code 5 chars, product code 5 chars");
StringBuilder sb = new StringBuilder();
// Left guard bars
sb.Append("101");
int cc1digit = (int)Char.GetNumericValue(upccode[0]); // country code first digit
int digit;
string encode;
// 2nd Country code & Manufacturing code:
// loop thru second character of country code and 5 digits of manufacturers code
string parity = BarCodeEAN13.ParityOrdering[cc1digit];
for (int i = 1; i < 7; i++)
{
digit = (int)Char.GetNumericValue(upccode[i]); // get the current digit
if (parity[i - 1] == '1')
encode = BarCodeEAN13.LeftHandEncodingOdd[digit];
else
encode = BarCodeEAN13.LeftHandEncodingEven[digit];
sb.Append(encode);
}
// Centerbars
sb.Append("01010");
// Product code encoding: loop thru the 5 digits of the product code
for (int i = 7; i < 12; i++)
{
digit = (int)Char.GetNumericValue(upccode[i]); // get the current digit
encode = BarCodeEAN13.RightHandEncoding[digit];
sb.Append(encode);
}
// Checksum of the bar code
digit = CheckSum(upccode);
encode = BarCodeEAN13.RightHandEncoding[digit];
sb.Append(encode);
// Right guard bars
sb.Append("101");
return sb.ToString();
}
///
/// Calculate the checksum: (sum odd digits * 3 + sum even digits )
/// Checksum is the number that must be added to sum to make it
/// evenly divisible by 10
///
///
///
int CheckSum(string upccode)
{
int sum = 0;
bool bOdd = false;
foreach (char c in upccode)
{
int digit = (int)Char.GetNumericValue(c);
sum += (bOdd ? digit * 3 : digit);
bOdd = !bOdd; // switch every other character
}
int cs = 10 - (sum % 10);
return cs == 10 ? 0 : cs;
}
///
/// Get the child element with the specified name. Return the InnerText
/// value if found otherwise return the passed default.
///
/// Parent node
/// Name of child node to look for
/// Default value to use if not found
/// Value the named child node
string GetNamedElementValue(XmlNode xNode, string name, string def)
{
if (xNode == null)
return def;
foreach (XmlNode cNode in xNode.ChildNodes)
{
if (cNode.NodeType == XmlNodeType.Element &&
cNode.Name == name)
return cNode.InnerText;
}
return def;
}
///
/// BarCodeProperties- All properties are type string to allow for definition of
/// a runtime expression.
///
public class BarCodeProperties
{
string _NumberSystem;
string _ManufacturerCode;
string _ProductCode;
BarCodeEAN13 _bc;
XmlNode _node;
internal BarCodeProperties(BarCodeEAN13 bc, XmlNode node)
{
_bc = bc;
_node = node;
}
internal void SetNumberSystem(string ns)
{
_NumberSystem = ns;
}
[Category("BarCode"),
Description(
"The Number System consists of two (sometimes three) digits which identifies the country or region numbering authority which assigned the manufacturer code.")]
public string NumberSystem
{
get { return _NumberSystem; }
set
{
_NumberSystem = value;
_bc.SetPropertiesInstance(_node, this);
}
}
internal void SetManufacturerCode(string mc)
{
_ManufacturerCode = mc;
}
[Category("BarCode"),
Description(
"Manufacturer Code is a unique 5 digit code assiged by numbering authority indicated by the number system code.")]
public string ManufacturerCode
{
get { return _ManufacturerCode; }
set
{
_ManufacturerCode = value;
_bc.SetPropertiesInstance(_node, this);
}
}
internal void SetProductCode(string pc)
{
_ProductCode = pc;
}
[Category("BarCode"),
Description("Product Code is a unique 5 digit code assigned by the manufacturer.")]
public string ProductCode
{
get { return _ProductCode; }
set
{
_ProductCode = value;
_bc.SetPropertiesInstance(_node, this);
}
}
}
}
}
================================================
FILE: RdlCri/BarCodeEAN8.cs
================================================
using System;
using System.Collections.Generic;
using System.Text;
using Majorsilence.Reporting.Rdl;
#if DRAWINGCOMPAT
using Majorsilence.Drawing;
#else
using System.Drawing;
#endif
using System.ComponentModel;
using System.Xml;
namespace Majorsilence.Reporting.Cri
{
public class BarCodeEAN8 : ZxingBarcodes
{
public BarCodeEAN8() : base(35.91f, 65.91f) // Optimal width at mag 1
{
format = ZXing.BarcodeFormat.EAN_8;
}
}
}
================================================
FILE: RdlCri/BarCodeITF14.cs
================================================
using Majorsilence.Reporting.Rdl;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
#if DRAWINGCOMPAT
using Majorsilence.Drawing;
#else
using System.Drawing;
#endif
using System.Xml;
using System.Xml.XPath;
using System.ComponentModel;
using SkiaSharp;
using System.IO;
namespace Majorsilence.Reporting.Cri
{
public class BarCodeITF14 : ICustomReportItem
{
static public readonly float OptimalWidth = 78f; // Optimal width at mag 1
static public readonly float OptimalHeight = 39f; // use ratio of 2.5
private string _Itf14Data;
public void Dispose()
{
return;
}
public void DrawDesignerImage(ref Bitmap bm)
{
InternalDraw(ref bm, "1234567891011");
}
public void DrawImage(ref Bitmap bm)
{
InternalDraw(ref bm, _Itf14Data);
}
private void InternalDraw(ref Bitmap bm, string value)
{
var barcode = new BarcodeStandard.Barcode()
{
EncodedType = BarcodeStandard.Type.Itf14,
IncludeLabel = true,
// Width = (int)OptimalWidth,
// Height = (int)OptimalHeight
};
var v = barcode.Encode(value);
var img = Image.FromStream(v.Encode().AsStream());
bm = new Bitmap(img);
}
public string GetCustomReportItemXml()
{
return "{0}" +
string.Format("{0}mm{1}mm", OptimalHeight, OptimalWidth) +
"" +
"" +
"ITF14" +
"Enter Your Value" +
"" +
"" +
"";
}
public object GetPropertiesInstance(XmlNode iNode)
{
BarCodePropertiesItf14 bcp = new BarCodePropertiesItf14(this, iNode);
foreach (XmlNode n in iNode.ChildNodes)
{
if (n.Name != "CustomProperty")
continue;
string pname = XmlHelpers.GetNamedElementValue(n, "Name", "");
switch (pname)
{
case "ITF14":
bcp.SetITF14(XmlHelpers.GetNamedElementValue(n, "Value", ""));
break;
default:
break;
}
}
return bcp;
}
public bool IsDataRegion()
{
return false;
}
public void SetProperties(IDictionary props)
{
try
{
_Itf14Data = props["ITF14"].ToString();
if (_Itf14Data.Length < 13 || _Itf14Data.Length > 14)
throw new Exception("ITF 14 data must be of length 13 or 14");
}
catch (KeyNotFoundException)
{
throw new Exception("ITF14 property must be specified");
}
}
public void SetPropertiesInstance(XmlNode node, object inst)
{
node.RemoveAll(); // Get rid of all properties
var itfCode = inst as BarCodePropertiesItf14;
if (itfCode == null)
return;
XmlHelpers.CreateChild(node, "ITF14", itfCode.Itf24);
}
///
/// BarCodeProperties- All properties are type string to allow for definition of
/// a runtime expression.
///
public class BarCodePropertiesItf14
{
string _itf14Data;
BarCodeITF14 _itf14;
XmlNode _node;
internal BarCodePropertiesItf14(BarCodeITF14 bc, XmlNode node)
{
_itf14 = bc;
_node = node;
}
internal void SetITF14(string ns)
{
_itf14Data = ns;
}
[Category("ITF14"), Description("The text string to be encoded as a ITF14 Code.")]
public string Itf24
{
get { return _itf14Data; }
set { _itf14Data = value; _itf14.SetPropertiesInstance(_node, this); }
}
}
}
}
================================================
FILE: RdlCri/DataMatrix.cs
================================================
namespace Majorsilence.Reporting.Cri
{
public class DataMatrix : ZxingBarcodes
{
public DataMatrix() : base(35.91f, 65.91f) // Optimal width at mag 1
{
format = ZXing.BarcodeFormat.DATA_MATRIX;
}
}
}
================================================
FILE: RdlCri/GlobalSuppressions.cs
================================================
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.
using System.Diagnostics.CodeAnalysis;
#if !DRAWINGCOMPAT
[assembly: SuppressMessage("Interoperability", "CA1416:Validate platform compatibility",
Justification = "System.Drawing usage is intentional")]
#endif
================================================
FILE: RdlCri/Majorsilence.Reporting.RdlCri.csproj
================================================
Library
Majorsilence.Reporting.Cri
True
RdlCri
RDL Project CustomReportItem Library
false
Majorsilence.Reporting.RdlCri
Debug;Release;Debug-DrawingCompat;Release-DrawingCompat
net48;net8.0;net10.0
net8.0;net10.0
4014
Majorsilence.Reporting.RdlCri.SkiaSharp
================================================
FILE: RdlCri/Pdf417Barcode.cs
================================================
using System;
using System.Collections.Generic;
using System.Text;
using Majorsilence.Reporting.Rdl;
#if DRAWINGCOMPAT
using Draw2 = Majorsilence.Drawing;
#else
using Draw2 = System.Drawing;
#endif
using System.ComponentModel;
using System.Xml;
using ZXing;
namespace Majorsilence.Reporting.Cri
{
public class Pdf417Barcode : ZxingBarcodes
{
public Pdf417Barcode() : base(35.91f, 65.91f) // Optimal width at mag 1
{
format = ZXing.BarcodeFormat.PDF_417;
}
}
}
================================================
FILE: RdlCri/PixelConversions.cs
================================================
#if DRAWINGCOMPAT
using Majorsilence.Drawing;
#else
using System.Drawing;
#endif
namespace Majorsilence.Reporting.Cri
{
internal class PixelConversions
{
static public int MmXFromPixel(Graphics g, float x)
{
int mm = (int)(x / g.DpiX * 25.4f); // convert to pixels
return mm;
}
static public int MmYFromPixel(Graphics g, float y)
{
int mm = (int)(y / g.DpiY * 25.4f); // convert to pixels
return mm;
}
static public int PixelXFromMm(Graphics g, float x)
{
int pixels = (int)((x * g.DpiX) / 25.4f); // convert to pixels
return pixels;
}
static public int PixelYFromMm(Graphics g, float y)
{
int pixel = (int)((y * g.DpiY) / 25.4f); // convert to pixels
return pixel;
}
///
///
///
///
///
///
///
///
///
static public float GetMagnification(Graphics g, int width, int height, float OptimalHeight, float OptimalWidth)
{
float AspectRatio = OptimalHeight / OptimalWidth;
float r = (float)height / (float)width;
if (r <= AspectRatio)
{ // height is the limiting value
return MmYFromPixel(g, height) / OptimalHeight;
}
else
{ // width is the limiting value
return MmXFromPixel(g, width) / OptimalWidth;
}
}
}
}
================================================
FILE: RdlCri/QrCode.cs
================================================
using System;
using System.Collections.Generic;
using System.Text;
using Majorsilence.Reporting.Rdl;
#if DRAWINGCOMPAT
using Draw2 = Majorsilence.Drawing;
#else
using Draw2 = System.Drawing;
#endif
using System.ComponentModel;
using System.Xml;
using ZXing;
namespace Majorsilence.Reporting.Cri
{
public class QrCode : ZxingBarcodes
{
public QrCode() : base(35.91f, 35.91f) // Optimal width at mag 1
{
format = ZXing.BarcodeFormat.QR_CODE;
}
}
}
================================================
FILE: RdlCri/RdlCri.sln
================================================
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2012 for Web
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RdlCri", "RdlCri.csproj", "{9C9ECACA-0DEB-4517-8CF1-02C3D3EB128E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RdlEngine", "..\RdlEngine\RdlEngine.csproj", "{C97E91F4-B310-44E2-9B6C-96775395722D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9C9ECACA-0DEB-4517-8CF1-02C3D3EB128E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9C9ECACA-0DEB-4517-8CF1-02C3D3EB128E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9C9ECACA-0DEB-4517-8CF1-02C3D3EB128E}.Debug|x64.ActiveCfg = Debug|x64
{9C9ECACA-0DEB-4517-8CF1-02C3D3EB128E}.Debug|x64.Build.0 = Debug|x64
{9C9ECACA-0DEB-4517-8CF1-02C3D3EB128E}.Debug|x86.ActiveCfg = Debug|x86
{9C9ECACA-0DEB-4517-8CF1-02C3D3EB128E}.Debug|x86.Build.0 = Debug|x86
{9C9ECACA-0DEB-4517-8CF1-02C3D3EB128E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9C9ECACA-0DEB-4517-8CF1-02C3D3EB128E}.Release|Any CPU.Build.0 = Release|Any CPU
{9C9ECACA-0DEB-4517-8CF1-02C3D3EB128E}.Release|x64.ActiveCfg = Release|x64
{9C9ECACA-0DEB-4517-8CF1-02C3D3EB128E}.Release|x64.Build.0 = Release|x64
{9C9ECACA-0DEB-4517-8CF1-02C3D3EB128E}.Release|x86.ActiveCfg = Release|x86
{9C9ECACA-0DEB-4517-8CF1-02C3D3EB128E}.Release|x86.Build.0 = Release|x86
{C97E91F4-B310-44E2-9B6C-96775395722D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C97E91F4-B310-44E2-9B6C-96775395722D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C97E91F4-B310-44E2-9B6C-96775395722D}.Debug|x64.ActiveCfg = Debug|x64
{C97E91F4-B310-44E2-9B6C-96775395722D}.Debug|x64.Build.0 = Debug|x64
{C97E91F4-B310-44E2-9B6C-96775395722D}.Debug|x86.ActiveCfg = Debug|x86
{C97E91F4-B310-44E2-9B6C-96775395722D}.Debug|x86.Build.0 = Debug|x86
{C97E91F4-B310-44E2-9B6C-96775395722D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C97E91F4-B310-44E2-9B6C-96775395722D}.Release|Any CPU.Build.0 = Release|Any CPU
{C97E91F4-B310-44E2-9B6C-96775395722D}.Release|x64.ActiveCfg = Release|x64
{C97E91F4-B310-44E2-9B6C-96775395722D}.Release|x64.Build.0 = Release|x64
{C97E91F4-B310-44E2-9B6C-96775395722D}.Release|x86.ActiveCfg = Release|x86
{C97E91F4-B310-44E2-9B6C-96775395722D}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
================================================
FILE: RdlCri/XmlHelpers.cs
================================================
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
namespace Majorsilence.Reporting.Cri
{
public class XmlHelpers
{
///
/// Get the child element with the specified name. Return the InnerText
/// value if found otherwise return the passed default.
///
/// Parent node
/// Name of child node to look for
/// Default value to use if not found
/// Value the named child node
public static string GetNamedElementValue(XmlNode xNode, string name, string def)
{
if (xNode == null)
return def;
foreach (XmlNode cNode in xNode.ChildNodes)
{
if (cNode.NodeType == XmlNodeType.Element &&
cNode.Name == name)
return cNode.InnerText;
}
return def;
}
public static void CreateChild(XmlNode node, string nm, string val)
{
XmlDocument xd = node.OwnerDocument;
XmlNode cp = xd.CreateElement("CustomProperty");
node.AppendChild(cp);
XmlNode name = xd.CreateElement("Name");
name.InnerText = nm;
cp.AppendChild(name);
XmlNode v = xd.CreateElement("Value");
v.InnerText = val;
cp.AppendChild(v);
}
}
}
================================================
FILE: RdlCri/ZxingBarcodes.cs
================================================
using System;
using System.Collections.Generic;
using System.Text;
using Majorsilence.Reporting.Rdl;
#if DRAWINGCOMPAT
using Draw2 = Majorsilence.Drawing;
#else
using Draw2 = System.Drawing;
#endif
using System.ComponentModel;
using System.Xml;
using ZXing;
namespace Majorsilence.Reporting.Cri
{
public class ZxingBarcodes : ICustomReportItem
{
private readonly float OptimalHeight;
private readonly float OptimalWidth;
protected ZXing.BarcodeFormat format;
// special chars for datamatrix, gs1 128
protected string FrontMatter = "";
protected string EndMatter = "";
#region ICustomReportItem Members
// optimal height and width are set to 35.91mm, which is the default for most barcodes.
public ZxingBarcodes() : this(35.91f, 65.91f)
{
}
public ZxingBarcodes(float optimalHeight, float optimalWidth)
{
OptimalHeight = optimalHeight;
OptimalWidth = optimalWidth;
}
bool ICustomReportItem.IsDataRegion()
{
return false;
}
void ICustomReportItem.DrawImage(ref Draw2.Bitmap bm)
{
DrawImage(ref bm, _code);
}
///
/// Does the actual drawing of the image.
///
///
///
internal void DrawImage(ref Draw2.Bitmap bm, string qrcode)
{
#if DRAWINGCOMPAT
var writer = new ZXing.SkiaSharp.BarcodeWriter();
#elif NETSTANDARD2_0 || NET5_0_OR_GREATER
var writer = new ZXing.Windows.Compatibility.BarcodeWriter();
#else
var writer = new ZXing.BarcodeWriter();
#endif
writer.Format = format;
writer.Options.Hints[EncodeHintType.CHARACTER_SET] = "UTF-8";
using Draw2.Graphics g = Draw2.Graphics.FromImage(bm);
float mag = PixelConversions.GetMagnification(g, bm.Width, bm.Height, OptimalHeight, OptimalWidth);
int barHeight = PixelConversions.PixelXFromMm(g, OptimalHeight * mag);
int barWidth = PixelConversions.PixelYFromMm(g, OptimalWidth * mag);
writer.Options.Height = barHeight;
writer.Options.Width = barWidth;
try
{
// TODO: move to program startup
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
}
catch (InvalidOperationException)
{
// The provider has already been registered.
}
bm = writer.Write(qrcode);
}
///
/// Design time: Draw a hard coded BarCode for design time; Parameters can't be
/// relied on since they aren't available.
///
///
void ICustomReportItem.DrawDesignerImage(ref Draw2.Bitmap bm)
{
DrawImage(ref bm, "https://github.com/majorsilence/My-FyiReporting");
}
private string _code = "";
void ICustomReportItem.SetProperties(IDictionary props)
{
try
{
if (props.TryGetValue("AztecCode", out object codeValueA))
{
// Backwards Compatibility: if the property is present, use it
_code = codeValueA.ToString();
}
else if (props.TryGetValue("QrCode", out object codeValueQ))
{
// Backwards Compatibility: if the property is present, use it
_code = codeValueQ.ToString();
}
else {
// fallback to standard "Code" property
_code = props["Code"].ToString();
}
}
catch (KeyNotFoundException)
{
throw new Exception("Code property must be specified");
}
}
object ICustomReportItem.GetPropertiesInstance(System.Xml.XmlNode iNode)
{
ZxingBarCodeProperties bcp = new ZxingBarCodeProperties(this, iNode);
foreach (XmlNode n in iNode.ChildNodes)
{
if (n.Name != "CustomProperty")
continue;
string pname = XmlHelpers.GetNamedElementValue(n, "Name", "");
switch (pname)
{
case "Code":
bcp.SetCode(XmlHelpers.GetNamedElementValue(n, "Value", ""));
break;
default:
break;
}
}
return bcp;
}
public void SetPropertiesInstance(System.Xml.XmlNode node, object inst)
{
node.RemoveAll(); // Get rid of all properties
ZxingBarCodeProperties bcp = inst as ZxingBarCodeProperties;
if (bcp == null)
return;
XmlHelpers.CreateChild(node, "Code", bcp.Code);
}
///
/// Design time call: return string with ... syntax for
/// the insert. The string contains a variable {0} which will be substituted with the
/// configuration name. This allows the name to be completely controlled by
/// the configuration file.
///
///
string ICustomReportItem.GetCustomReportItemXml()
{
return "{0}" +
string.Format("{0}mm{1}mm", OptimalHeight, OptimalWidth) +
"" +
"" +
"Code" +
"Enter Your Value" +
"" +
"" +
"";
}
#endregion
#region IDisposable Members
void IDisposable.Dispose()
{
return;
}
#endregion
///
/// BarCodeProperties- All properties are type string to allow for definition of
/// a runtime expression.
///
public class ZxingBarCodeProperties
{
string _Code;
ZxingBarcodes _bc;
XmlNode _node;
internal ZxingBarCodeProperties(ZxingBarcodes bc, XmlNode node)
{
_bc = bc;
_node = node;
}
internal void SetCode(string ns)
{
_Code = ns;
}
[Category("Code"),
Description("The text string to be encoded as a PDF417 barcode.")]
public string Code
{
get { return _Code; }
set
{
_Code = value;
_bc.SetPropertiesInstance(_node, this);
}
}
}
}
}
================================================
FILE: RdlDesign/AssemblyInfo.cs
================================================
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("ReportTests")]
[assembly: InternalsVisibleTo("ReportTests.Windows")]
================================================
FILE: RdlDesign/BackgroundCtl.cs
================================================
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using System.Xml;
using Majorsilence.Reporting.RdlDesign.Resources;
namespace Majorsilence.Reporting.RdlDesign
{
///
/// Summary description for StyleCtl.
///
internal class BackgroundCtl : System.Windows.Forms.UserControl, IProperty
{
private List _ReportItems;
private DesignXmlDraw _Draw;
// flags for controlling whether syntax changed for a particular property
private bool fEndColor, fBackColor, fGradient, fBackImage;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button bBackColor;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Label label15;
private System.Windows.Forms.ComboBox cbEndColor;
private System.Windows.Forms.ComboBox cbBackColor;
private System.Windows.Forms.Button bEndColor;
private System.Windows.Forms.ComboBox cbGradient;
private System.Windows.Forms.Button bGradient;
private System.Windows.Forms.Button bExprBackColor;
private System.Windows.Forms.Button bExprEndColor;
private GroupBox groupBox2;
private Button bExternalExpr;
private Button bEmbeddedExpr;
private Button bMimeExpr;
private Button bDatabaseExpr;
private Button bEmbedded;
private Button bExternal;
private TextBox tbValueExternal;
private ComboBox cbValueDatabase;
private ComboBox cbMIMEType;
private ComboBox cbValueEmbedded;
private RadioButton rbDatabase;
private RadioButton rbEmbedded;
private RadioButton rbExternal;
private RadioButton rbNone;
private ComboBox cbRepeat;
private Label label1;
private Button bRepeatExpr;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
private string[] _names;
internal BackgroundCtl(DesignXmlDraw dxDraw, string[] names, List reportItems)
{
_ReportItems = reportItems;
_Draw = dxDraw;
_names = names;
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
// Initialize form using the style node values
InitValues(_ReportItems[0]);
}
private void InitValues(XmlNode node)
{
cbEndColor.Items.AddRange(StaticLists.ColorList);
cbBackColor.Items.AddRange(StaticLists.ColorList);
cbGradient.Items.AddRange(StaticLists.GradientList);
if (_names != null)
{
node = _Draw.FindCreateNextInHierarchy(node, _names);
}
XmlNode sNode = _Draw.GetNamedChildNode(node, "Style");
this.cbBackColor.Text = _Draw.GetElementValue(sNode, "BackgroundColor", "");
this.cbEndColor.Text = _Draw.GetElementValue(sNode, "BackgroundGradientEndColor", "");
this.cbGradient.Text = _Draw.GetElementValue(sNode, "BackgroundGradientType", "None");
if (node.Name != "Chart")
{ // only chart support gradients
this.cbEndColor.Enabled = bExprEndColor.Enabled =
cbGradient.Enabled = bGradient.Enabled =
this.bEndColor.Enabled = bExprEndColor.Enabled = false;
}
cbValueEmbedded.Items.AddRange(_Draw.ReportNames.EmbeddedImageNames);
string[] flds = _Draw.GetReportItemDataRegionFields(node, true);
if (flds != null)
this.cbValueDatabase.Items.AddRange(flds);
XmlNode iNode = _Draw.GetNamedChildNode(sNode, "BackgroundImage");
if (iNode != null)
{
string source = _Draw.GetElementValue(iNode, "Source", "Embedded");
string val = _Draw.GetElementValue(iNode, "Value", "");
switch (source)
{
case "Embedded":
this.rbEmbedded.Checked = true;
this.cbValueEmbedded.Text = val;
break;
case "Database":
this.rbDatabase.Checked = true;
this.cbValueDatabase.Text = val;
this.cbMIMEType.Text = _Draw.GetElementValue(iNode, "MIMEType", "image/png");
break;
case "External":
default:
this.rbExternal.Checked = true;
this.tbValueExternal.Text = val;
break;
}
this.cbRepeat.Text = _Draw.GetElementValue(iNode, "BackgroundRepeat", "Repeat");
}
else
this.rbNone.Checked = true;
rbSource_CheckedChanged(null, null);
// nothing has changed now
fEndColor = fBackColor = fGradient = fBackImage = false;
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Component Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BackgroundCtl));
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.bGradient = new System.Windows.Forms.Button();
this.bExprBackColor = new System.Windows.Forms.Button();
this.bExprEndColor = new System.Windows.Forms.Button();
this.bEndColor = new System.Windows.Forms.Button();
this.cbBackColor = new System.Windows.Forms.ComboBox();
this.cbEndColor = new System.Windows.Forms.ComboBox();
this.label15 = new System.Windows.Forms.Label();
this.cbGradient = new System.Windows.Forms.ComboBox();
this.label10 = new System.Windows.Forms.Label();
this.bBackColor = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.bRepeatExpr = new System.Windows.Forms.Button();
this.rbNone = new System.Windows.Forms.RadioButton();
this.cbRepeat = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.bExternalExpr = new System.Windows.Forms.Button();
this.bEmbeddedExpr = new System.Windows.Forms.Button();
this.bMimeExpr = new System.Windows.Forms.Button();
this.bDatabaseExpr = new System.Windows.Forms.Button();
this.bEmbedded = new System.Windows.Forms.Button();
this.bExternal = new System.Windows.Forms.Button();
this.tbValueExternal = new System.Windows.Forms.TextBox();
this.cbValueDatabase = new System.Windows.Forms.ComboBox();
this.cbMIMEType = new System.Windows.Forms.ComboBox();
this.cbValueEmbedded = new System.Windows.Forms.ComboBox();
this.rbDatabase = new System.Windows.Forms.RadioButton();
this.rbEmbedded = new System.Windows.Forms.RadioButton();
this.rbExternal = new System.Windows.Forms.RadioButton();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
resources.ApplyResources(this.groupBox1, "groupBox1");
this.groupBox1.Controls.Add(this.bGradient);
this.groupBox1.Controls.Add(this.bExprBackColor);
this.groupBox1.Controls.Add(this.bExprEndColor);
this.groupBox1.Controls.Add(this.bEndColor);
this.groupBox1.Controls.Add(this.cbBackColor);
this.groupBox1.Controls.Add(this.cbEndColor);
this.groupBox1.Controls.Add(this.label15);
this.groupBox1.Controls.Add(this.cbGradient);
this.groupBox1.Controls.Add(this.label10);
this.groupBox1.Controls.Add(this.bBackColor);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Name = "groupBox1";
this.groupBox1.TabStop = false;
//
// bGradient
//
resources.ApplyResources(this.bGradient, "bGradient");
this.bGradient.Name = "bGradient";
this.bGradient.Tag = "bgradient";
this.bGradient.Click += new System.EventHandler(this.bExpr_Click);
//
// bExprBackColor
//
resources.ApplyResources(this.bExprBackColor, "bExprBackColor");
this.bExprBackColor.Name = "bExprBackColor";
this.bExprBackColor.Tag = "bcolor";
this.bExprBackColor.Click += new System.EventHandler(this.bExpr_Click);
//
// bExprEndColor
//
resources.ApplyResources(this.bExprEndColor, "bExprEndColor");
this.bExprEndColor.Name = "bExprEndColor";
this.bExprEndColor.Tag = "bendcolor";
this.bExprEndColor.Click += new System.EventHandler(this.bExpr_Click);
//
// bEndColor
//
resources.ApplyResources(this.bEndColor, "bEndColor");
this.bEndColor.Name = "bEndColor";
this.bEndColor.Click += new System.EventHandler(this.bColor_Click);
//
// cbBackColor
//
resources.ApplyResources(this.cbBackColor, "cbBackColor");
this.cbBackColor.Name = "cbBackColor";
this.cbBackColor.SelectedIndexChanged += new System.EventHandler(this.cbBackColor_SelectedIndexChanged);
this.cbBackColor.TextChanged += new System.EventHandler(this.cbBackColor_SelectedIndexChanged);
//
// cbEndColor
//
resources.ApplyResources(this.cbEndColor, "cbEndColor");
this.cbEndColor.Name = "cbEndColor";
this.cbEndColor.SelectedIndexChanged += new System.EventHandler(this.cbEndColor_SelectedIndexChanged);
this.cbEndColor.TextChanged += new System.EventHandler(this.cbEndColor_SelectedIndexChanged);
//
// label15
//
resources.ApplyResources(this.label15, "label15");
this.label15.Name = "label15";
//
// cbGradient
//
resources.ApplyResources(this.cbGradient, "cbGradient");
this.cbGradient.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbGradient.Name = "cbGradient";
this.cbGradient.SelectedIndexChanged += new System.EventHandler(this.cbGradient_SelectedIndexChanged);
//
// label10
//
resources.ApplyResources(this.label10, "label10");
this.label10.Name = "label10";
//
// bBackColor
//
resources.ApplyResources(this.bBackColor, "bBackColor");
this.bBackColor.Name = "bBackColor";
this.bBackColor.Click += new System.EventHandler(this.bColor_Click);
//
// label3
//
resources.ApplyResources(this.label3, "label3");
this.label3.Name = "label3";
//
// groupBox2
//
resources.ApplyResources(this.groupBox2, "groupBox2");
this.groupBox2.Controls.Add(this.bRepeatExpr);
this.groupBox2.Controls.Add(this.rbNone);
this.groupBox2.Controls.Add(this.cbRepeat);
this.groupBox2.Controls.Add(this.label1);
this.groupBox2.Controls.Add(this.bExternalExpr);
this.groupBox2.Controls.Add(this.bEmbeddedExpr);
this.groupBox2.Controls.Add(this.bMimeExpr);
this.groupBox2.Controls.Add(this.bDatabaseExpr);
this.groupBox2.Controls.Add(this.bEmbedded);
this.groupBox2.Controls.Add(this.bExternal);
this.groupBox2.Controls.Add(this.tbValueExternal);
this.groupBox2.Controls.Add(this.cbValueDatabase);
this.groupBox2.Controls.Add(this.cbMIMEType);
this.groupBox2.Controls.Add(this.cbValueEmbedded);
this.groupBox2.Controls.Add(this.rbDatabase);
this.groupBox2.Controls.Add(this.rbEmbedded);
this.groupBox2.Controls.Add(this.rbExternal);
this.groupBox2.Name = "groupBox2";
this.groupBox2.TabStop = false;
//
// bRepeatExpr
//
resources.ApplyResources(this.bRepeatExpr, "bRepeatExpr");
this.bRepeatExpr.Name = "bRepeatExpr";
this.bRepeatExpr.Tag = "repeat";
//
// rbNone
//
resources.ApplyResources(this.rbNone, "rbNone");
this.rbNone.Name = "rbNone";
this.rbNone.CheckedChanged += new System.EventHandler(this.rbSource_CheckedChanged);
//
// cbRepeat
//
resources.ApplyResources(this.cbRepeat, "cbRepeat");
this.cbRepeat.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbRepeat.Items.AddRange(new object[] {
resources.GetString("cbRepeat.Items"),
resources.GetString("cbRepeat.Items1"),
resources.GetString("cbRepeat.Items2"),
resources.GetString("cbRepeat.Items3")});
this.cbRepeat.Name = "cbRepeat";
this.cbRepeat.SelectedIndexChanged += new System.EventHandler(this.BackImage_Changed);
this.cbRepeat.TextChanged += new System.EventHandler(this.BackImage_Changed);
//
// label1
//
resources.ApplyResources(this.label1, "label1");
this.label1.Name = "label1";
//
// bExternalExpr
//
resources.ApplyResources(this.bExternalExpr, "bExternalExpr");
this.bExternalExpr.Name = "bExternalExpr";
this.bExternalExpr.Tag = "external";
this.bExternalExpr.Click += new System.EventHandler(this.bExpr_Click);
//
// bEmbeddedExpr
//
resources.ApplyResources(this.bEmbeddedExpr, "bEmbeddedExpr");
this.bEmbeddedExpr.Name = "bEmbeddedExpr";
this.bEmbeddedExpr.Tag = "embedded";
this.bEmbeddedExpr.Click += new System.EventHandler(this.bExpr_Click);
//
// bMimeExpr
//
resources.ApplyResources(this.bMimeExpr, "bMimeExpr");
this.bMimeExpr.Name = "bMimeExpr";
this.bMimeExpr.Tag = "mime";
this.bMimeExpr.Click += new System.EventHandler(this.bExpr_Click);
//
// bDatabaseExpr
//
resources.ApplyResources(this.bDatabaseExpr, "bDatabaseExpr");
this.bDatabaseExpr.Name = "bDatabaseExpr";
this.bDatabaseExpr.Tag = "database";
this.bDatabaseExpr.Click += new System.EventHandler(this.bExpr_Click);
//
// bEmbedded
//
resources.ApplyResources(this.bEmbedded, "bEmbedded");
this.bEmbedded.Name = "bEmbedded";
this.bEmbedded.Click += new System.EventHandler(this.bEmbedded_Click);
//
// bExternal
//
resources.ApplyResources(this.bExternal, "bExternal");
this.bExternal.Name = "bExternal";
this.bExternal.Click += new System.EventHandler(this.bExternal_Click);
//
// tbValueExternal
//
resources.ApplyResources(this.tbValueExternal, "tbValueExternal");
this.tbValueExternal.Name = "tbValueExternal";
this.tbValueExternal.TextChanged += new System.EventHandler(this.BackImage_Changed);
//
// cbValueDatabase
//
resources.ApplyResources(this.cbValueDatabase, "cbValueDatabase");
this.cbValueDatabase.Name = "cbValueDatabase";
this.cbValueDatabase.SelectedIndexChanged += new System.EventHandler(this.BackImage_Changed);
this.cbValueDatabase.TextChanged += new System.EventHandler(this.BackImage_Changed);
//
// cbMIMEType
//
resources.ApplyResources(this.cbMIMEType, "cbMIMEType");
this.cbMIMEType.Items.AddRange(new object[] {
resources.GetString("cbMIMEType.Items"),
resources.GetString("cbMIMEType.Items1"),
resources.GetString("cbMIMEType.Items2"),
resources.GetString("cbMIMEType.Items3"),
resources.GetString("cbMIMEType.Items4")});
this.cbMIMEType.Name = "cbMIMEType";
this.cbMIMEType.SelectedIndexChanged += new System.EventHandler(this.BackImage_Changed);
this.cbMIMEType.TextChanged += new System.EventHandler(this.BackImage_Changed);
//
// cbValueEmbedded
//
resources.ApplyResources(this.cbValueEmbedded, "cbValueEmbedded");
this.cbValueEmbedded.Name = "cbValueEmbedded";
this.cbValueEmbedded.SelectedIndexChanged += new System.EventHandler(this.BackImage_Changed);
this.cbValueEmbedded.TextChanged += new System.EventHandler(this.BackImage_Changed);
//
// rbDatabase
//
resources.ApplyResources(this.rbDatabase, "rbDatabase");
this.rbDatabase.Name = "rbDatabase";
this.rbDatabase.CheckedChanged += new System.EventHandler(this.rbSource_CheckedChanged);
//
// rbEmbedded
//
resources.ApplyResources(this.rbEmbedded, "rbEmbedded");
this.rbEmbedded.Name = "rbEmbedded";
this.rbEmbedded.CheckedChanged += new System.EventHandler(this.rbSource_CheckedChanged);
//
// rbExternal
//
resources.ApplyResources(this.rbExternal, "rbExternal");
this.rbExternal.Name = "rbExternal";
this.rbExternal.CheckedChanged += new System.EventHandler(this.rbSource_CheckedChanged);
//
// BackgroundCtl
//
resources.ApplyResources(this, "$this");
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Name = "BackgroundCtl";
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.ResumeLayout(false);
}
#endregion
public bool IsValid()
{
return true;
}
public void Apply()
{
// take information in control and apply to all the style nodes
// Only change information that has been marked as modified;
// this way when group is selected it is possible to change just
// the items you want and keep the rest the same.
foreach (XmlNode riNode in this._ReportItems)
ApplyChanges(riNode);
// nothing has changed now
fEndColor = fBackColor = fGradient = fBackImage = false;
}
private void bColor_Click(object sender, System.EventArgs e)
{
ColorDialog cd = new ColorDialog();
cd.AnyColor = true;
cd.FullOpen = true;
cd.CustomColors = RdlDesigner.GetCustomColors();
try
{
if (cd.ShowDialog() != DialogResult.OK)
return;
RdlDesigner.SetCustomColors(cd.CustomColors);
if (sender == this.bEndColor)
cbEndColor.Text = ColorTranslator.ToHtml(cd.Color);
else if (sender == this.bBackColor)
cbBackColor.Text = ColorTranslator.ToHtml(cd.Color);
}
finally
{
cd.Dispose();
}
return;
}
private void cbBackColor_SelectedIndexChanged(object sender, System.EventArgs e)
{
fBackColor = true;
}
private void cbGradient_SelectedIndexChanged(object sender, System.EventArgs e)
{
fGradient = true;
}
private void cbEndColor_SelectedIndexChanged(object sender, System.EventArgs e)
{
fEndColor = true;
}
private void BackImage_Changed(object sender, System.EventArgs e)
{
fBackImage = true;
}
private void rbSource_CheckedChanged(object sender, System.EventArgs e)
{
fBackImage = true;
this.cbValueDatabase.Enabled = this.cbMIMEType.Enabled =
this.bDatabaseExpr.Enabled = this.rbDatabase.Checked;
this.cbValueEmbedded.Enabled = this.bEmbeddedExpr.Enabled =
this.bEmbedded.Enabled = this.rbEmbedded.Checked;
this.tbValueExternal.Enabled = this.bExternalExpr.Enabled =
this.bExternal.Enabled = this.rbExternal.Checked;
}
private void ApplyChanges(XmlNode rNode)
{
if (_names != null)
{
rNode = _Draw.FindCreateNextInHierarchy(rNode, _names);
}
XmlNode xNode = _Draw.GetNamedChildNode(rNode, "Style");
if (xNode == null)
{
_Draw.SetElement(rNode, "Style", "");
xNode = _Draw.GetNamedChildNode(rNode, "Style");
}
if (fEndColor)
{ _Draw.SetElement(xNode, "BackgroundGradientEndColor", cbEndColor.Text); }
if (fBackColor)
{ _Draw.SetElement(xNode, "BackgroundColor", cbBackColor.Text); }
if (fGradient)
{ _Draw.SetElement(xNode, "BackgroundGradientType", cbGradient.Text); }
if (fBackImage)
{
_Draw.RemoveElement(xNode, "BackgroundImage");
if (!rbNone.Checked)
{
XmlNode bi = _Draw.CreateElement(xNode, "BackgroundImage", null);
if (rbDatabase.Checked)
{
_Draw.SetElement(bi, "Source", "Database");
_Draw.SetElement(bi, "Value", cbValueDatabase.Text);
_Draw.SetElement(bi, "MIMEType", cbMIMEType.Text);
}
else if (rbExternal.Checked)
{
_Draw.SetElement(bi, "Source", "External");
_Draw.SetElement(bi, "Value", tbValueExternal.Text);
}
else if (rbEmbedded.Checked)
{
_Draw.SetElement(bi, "Source", "Embedded");
_Draw.SetElement(bi, "Value", cbValueEmbedded.Text);
}
_Draw.SetElement(bi, "BackgroundRepeat", cbRepeat.Text);
}
}
}
private void bExternal_Click(object sender, System.EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = Strings.BackgroundCtl_bExternal_Click_ImageFilesFilter;
ofd.FilterIndex = 6;
ofd.CheckFileExists = true;
try
{
if (ofd.ShowDialog(this) == DialogResult.OK)
{
tbValueExternal.Text = ofd.FileName;
}
}
finally
{
ofd.Dispose();
}
}
private void bEmbedded_Click(object sender, System.EventArgs e)
{
DialogEmbeddedImages dlgEI = new DialogEmbeddedImages(this._Draw);
dlgEI.StartPosition = FormStartPosition.CenterParent;
try
{
DialogResult dr = dlgEI.ShowDialog();
if (dr != DialogResult.OK)
return;
// Populate the EmbeddedImage names
cbValueEmbedded.Items.Clear();
cbValueEmbedded.Items.AddRange(_Draw.ReportNames.EmbeddedImageNames);
}
finally
{
dlgEI.Dispose();
}
}
private void bExpr_Click(object sender, System.EventArgs e)
{
Button b = sender as Button;
if (b == null)
return;
Control c = null;
bool bColor=false;
switch (b.Tag as string)
{
case "bcolor":
c = cbBackColor;
bColor = true;
break;
case "bgradient":
c = cbGradient;
break;
case "bendcolor":
c = cbEndColor;
bColor = true;
break;
case "database":
c = cbValueDatabase;
break;
case "embedded":
c = cbValueEmbedded;
break;
case "external":
c = tbValueExternal;
break;
case "repeat":
c = cbRepeat;
break;
case "mime":
c = cbMIMEType;
break;
}
if (c == null)
return;
XmlNode sNode = _ReportItems[0];
DialogExprEditor ee = new DialogExprEditor(_Draw, c.Text, sNode, bColor);
DialogResult dr = ee.ShowDialog();
if (dr == DialogResult.OK)
c.Text = ee.Expression;
return;
}
}
}
================================================
FILE: RdlDesign/BackgroundCtl.resx
================================================
text/microsoft-resx
2.0
System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
9
6
Arial, 8.25pt, style=Bold, Italic
bEmbedded
groupBox2
cbRepeat
MiddleLeft
groupBox2
MiddleLeft
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
groupBox2
16
4
MiddleLeft
Arial, 8.25pt, style=Bold, Italic
6, 87
groupBox2
22, 16
7
161, 40
13
22, 16
3
End Color
Repeat
MiddleLeft
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
87, 184
Arial, 8.25pt, style=Bold, Italic
0
8
System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
284, 20
rbEmbedded
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
groupBox1
0
402, 88
1
32, 16
9
rbDatabase
groupBox1
$this
Arial, 8.25pt, style=Bold, Italic
groupBox1
cbMIMEType
groupBox2
86, 151
14
fx
Gradient
3
404, 42
label1
NoRepeat
0
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
86, 55
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
9
...
groupBox1
fx
286, 40
bExternal
128, 42
284, 21
Color
3
bEndColor
groupBox2
fx
86, 87
2
fx
2
Arial, 8.25pt, style=Bold, Italic
102, 42
fx
4
6, 55
0
System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
groupBox2
16
System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
12
5
groupBox2
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
80, 24
22, 16
5
1
10
377, 42
System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
402, 56
4
image/bmp
fx
6
groupBox2
label10
System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
22, 16
System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
tbValueExternal
groupBox2
376, 152
1
groupBox2
cbValueEmbedded
$this
cbEndColor
cbValueDatabase
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
2
groupBox1
213, 184
22, 16
5
8, 40
groupBox2
5
253, 42
6
2
80, 24
System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
image/jpeg
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
88, 21
16, 8
5
RepeatX
cbBackColor
161, 24
bRepeatExpr
External
6
11
Database
bExprEndColor
System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
6, 119
7
13
bBackColor
14
8
8, 24
groupBox1
22, 16
7
image/x-png
image/png
image/gif
image/jpeg
472, 351
22, 16
System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
3
...
bDatabaseExpr
22, 16
groupBox2
3
88, 21
bGradient
0
376, 56
System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
MiddleLeft
284, 21
groupBox1
System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
label3
cbGradient
48, 16
MiddleLeft
bExternalExpr
Arial, 8.25pt, style=Bold, Italic
groupBox1
groupBox1
groupBox1
System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
...
286, 24
System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
59, 23
16, 109
1
groupBox2
RepeatY
Repeat
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
376, 88
8
fx
System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
0
groupBox1
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
MiddleLeft
12
3
None
groupBox1
0
rbExternal
Background
88, 21
4
1
11
Arial, 8.25pt, style=Bold, Italic
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
432, 80
22, 16
groupBox2
groupBox2
groupBox2
Arial, 8.25pt, style=Bold, Italic
10
22, 16
bMimeExpr
10
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
7
15
86, 119
bEmbeddedExpr
80, 24
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
bExprBackColor
182, 121
Background Image Source
Embedded
BackgroundCtl
56, 16
88, 21
80, 24
432, 219
label15
MiddleLeft
15
rbNone
22, 184
...
groupBox2
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
6, 25
fx
22, 16
22, 16
120, 21
True
================================================
FILE: RdlDesign/BackgroundCtl.ru-RU.resx
================================================
text/microsoft-resx
2.0
System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
88, 16
Конечний цвет
74, 16
Градиент
Цвет
Фон
Источник фонового изображения
228, 184
90, 24
Отсутствует
102, 184
74, 23
Повторение
198, 121
102, 55
268, 20
102, 151
268, 21
102, 119
102, 87
268, 21
90, 24
База данных
90, 24
Встроенный
Внешний
================================================
FILE: RdlDesign/BodyCtl.cs
================================================
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using System.Xml;
namespace Majorsilence.Reporting.RdlDesign
{
///
/// Summary description for BodyCtl.
///
internal class BodyCtl : System.Windows.Forms.UserControl, IProperty
{
private DesignXmlDraw _Draw;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox tbHeight;
private System.Windows.Forms.TextBox tbColumns;
private System.Windows.Forms.TextBox tbColumnSpacing;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
internal BodyCtl(DesignXmlDraw dxDraw)
{
_Draw = dxDraw;
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
// Initialize form using the style node values
InitValues();
}
private void InitValues()
{
XmlNode rNode = _Draw.GetReportNode();
XmlNode bNode = _Draw.GetNamedChildNode(rNode, "Body");
tbHeight.Text = _Draw.GetElementValue(bNode, "Height", "");
tbColumns.Text = _Draw.GetElementValue(bNode, "Columns", "1");
tbColumnSpacing.Text = _Draw.GetElementValue(bNode, "ColumnSpacing", "");
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Component Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BodyCtl));
this.DoubleBuffered = true;
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.tbHeight = new System.Windows.Forms.TextBox();
this.tbColumns = new System.Windows.Forms.TextBox();
this.tbColumnSpacing = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// label1
//
resources.ApplyResources(this.label1, "label1");
this.label1.Name = "label1";
//
// label2
//
resources.ApplyResources(this.label2, "label2");
this.label2.Name = "label2";
//
// label3
//
resources.ApplyResources(this.label3, "label3");
this.label3.Name = "label3";
//
// tbHeight
//
resources.ApplyResources(this.tbHeight, "tbHeight");
this.tbHeight.Name = "tbHeight";
//
// tbColumns
//
resources.ApplyResources(this.tbColumns, "tbColumns");
this.tbColumns.Name = "tbColumns";
//
// tbColumnSpacing
//
resources.ApplyResources(this.tbColumnSpacing, "tbColumnSpacing");
this.tbColumnSpacing.Name = "tbColumnSpacing";
//
// BodyCtl
//
resources.ApplyResources(this, "$this");
this.Controls.Add(this.tbColumnSpacing);
this.Controls.Add(this.tbColumns);
this.Controls.Add(this.tbHeight);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Name = "BodyCtl";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
public bool IsValid()
{
return true;
}
public void Apply()
{
XmlNode rNode = _Draw.GetReportNode();
XmlNode bNode = _Draw.GetNamedChildNode(rNode, "Body");
_Draw.SetElement(bNode, "Height", tbHeight.Text);
_Draw.SetElement(bNode, "Columns", tbColumns.Text);
if (tbColumnSpacing.Text.Length > 0)
_Draw.SetElement(bNode, "ColumnSpacing", tbColumnSpacing.Text);
else
_Draw.RemoveElement(bNode, "ColumnSpacing");
}
}
}
================================================
FILE: RdlDesign/BodyCtl.resx
================================================
text/microsoft-resx
2.0
System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
0
Columns
$this
tbColumns
3
tbColumnSpacing
2
56, 23
40, 60
System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Height
BodyCtl
$this
104, 25
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
40, 24
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
4
56, 23
$this
5
1
Column Spacing
label1
label2
0
100, 20
$this
104, 96
$this
88, 23
100, 20
System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
2
tbHeight
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
2
System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
1
8, 96
100, 20
1
0
104, 61
$this
System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
472, 288
label3
True
================================================
FILE: RdlDesign/BodyCtl.ru-RU.resx
================================================
text/microsoft-resx
2.0
System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119, 25
Высота
TopRight
119, 61
Столбцы
TopRight
NoControl
3, 96
172, 23
Расстояние между колонками
TopRight
181, 22
181, 58
181, 93
================================================
FILE: RdlDesign/ChartAxisCtl.cs
================================================
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using System.Xml;
namespace Majorsilence.Reporting.RdlDesign
{
///
/// Summary description for ChartCtl.
///
internal class ChartAxisCtl : System.Windows.Forms.UserControl, IProperty
{
private List _ReportItems;
private DesignXmlDraw _Draw;
// change flags
bool fMonth, fVisible, fMajorTickMarks, fMargin,fReverse,fInterlaced;
bool fMajorGLWidth,fMajorGLColor,fMajorGLStyle;
bool fMinorGLWidth,fMinorGLColor,fMinorGLStyle;
bool fMajorInterval, fMinorInterval,fMax,fMin;
bool fMinorTickMarks,fScalar,fLogScale,fMajorGLShow, fMinorGLShow, fCanOmit;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.CheckBox chkMonth;
private System.Windows.Forms.CheckBox chkVisible;
private System.Windows.Forms.ComboBox cbMajorTickMarks;
private System.Windows.Forms.CheckBox chkMargin;
private System.Windows.Forms.CheckBox chkReverse;
private System.Windows.Forms.CheckBox chkInterlaced;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TextBox tbMajorGLWidth;
private System.Windows.Forms.Button bMajorGLColor;
private System.Windows.Forms.ComboBox cbMajorGLColor;
private System.Windows.Forms.ComboBox cbMajorGLStyle;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.TextBox tbMinorGLWidth;
private System.Windows.Forms.Button bMinorGLColor;
private System.Windows.Forms.ComboBox cbMinorGLColor;
private System.Windows.Forms.ComboBox cbMinorGLStyle;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.TextBox tbMajorInterval;
private System.Windows.Forms.TextBox tbMinorInterval;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.TextBox tbMax;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.TextBox tbMin;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.ComboBox cbMinorTickMarks;
private System.Windows.Forms.CheckBox chkScalar;
private System.Windows.Forms.CheckBox chkLogScale;
private System.Windows.Forms.CheckBox chkMajorGLShow;
private System.Windows.Forms.CheckBox chkMinorGLShow;
private System.Windows.Forms.Button bMinorIntervalExpr;
private System.Windows.Forms.Button bMajorIntervalExpr;
private System.Windows.Forms.Button bMinExpr;
private System.Windows.Forms.Button bMaxExpr;
private CheckBox chkCanOmit;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
internal ChartAxisCtl(DesignXmlDraw dxDraw, List ris)
{
_ReportItems = ris;
_Draw = dxDraw;
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
// Initialize form using the style node values
InitValues();
}
private void InitValues()
{
cbMajorGLColor.Items.AddRange(StaticLists.ColorList);
cbMinorGLColor.Items.AddRange(StaticLists.ColorList);
XmlNode node = _ReportItems[0];
chkMonth.Checked = _Draw.GetElementValue(node, "fyi:Month", "false").ToLower() == "true" ? true : false; //added checkbox for month category axis WP 12 may 2008
chkVisible.Checked = _Draw.GetElementValue(node, "Visible", "false").ToLower() == "true"? true: false;
chkMargin.Checked = _Draw.GetElementValue(node, "Margin", "false").ToLower() == "true"? true: false;
chkReverse.Checked = _Draw.GetElementValue(node, "Reverse", "false").ToLower() == "true"? true: false;
chkInterlaced.Checked = _Draw.GetElementValue(node, "Interlaced", "false").ToLower() == "true"? true: false;
chkScalar.Checked = _Draw.GetElementValue(node, "Scalar", "false").ToLower() == "true"? true: false;
chkLogScale.Checked = _Draw.GetElementValue(node, "LogScale", "false").ToLower() == "true"? true: false;
chkCanOmit.Checked = _Draw.GetElementValue(node, "fyi:CanOmit", "false").ToLower() == "true" ? true : false;
cbMajorTickMarks.Text = _Draw.GetElementValue(node, "MajorTickMarks", "None");
cbMinorTickMarks.Text = _Draw.GetElementValue(node, "MinorTickMarks", "None");
// Major Grid Lines
InitGridLines(node, "MajorGridLines", chkMajorGLShow, cbMajorGLColor, cbMajorGLStyle, tbMajorGLWidth);
// Minor Grid Lines
InitGridLines(node, "MinorGridLines", chkMinorGLShow, cbMinorGLColor, cbMinorGLStyle, tbMinorGLWidth);
tbMajorInterval.Text = _Draw.GetElementValue(node, "MajorInterval", "");
tbMinorInterval.Text = _Draw.GetElementValue(node, "MinorInterval", "");
tbMax.Text = _Draw.GetElementValue(node, "Max", "");
tbMin.Text = _Draw.GetElementValue(node, "Min", "");
fMonth = fVisible = fMajorTickMarks = fMargin=fReverse=fInterlaced=
fMajorGLWidth=fMajorGLColor=fMajorGLStyle=
fMinorGLWidth=fMinorGLColor=fMinorGLStyle=
fMajorInterval= fMinorInterval=fMax=fMin=
fMinorTickMarks=fScalar=fLogScale=fMajorGLShow=fMinorGLShow=fCanOmit=false;
}
private void InitGridLines(XmlNode node, string type, CheckBox show, ComboBox color, ComboBox style, TextBox width)
{
XmlNode m = _Draw.GetNamedChildNode(node, type);
if (m != null)
{
show.Checked = _Draw.GetElementValue(m, "ShowGridLines", "false").ToLower() == "true"? true: false;
XmlNode st = _Draw.GetNamedChildNode(m, "Style");
if (st != null)
{
XmlNode work = _Draw.GetNamedChildNode(st, "BorderColor");
if (work != null)
color.Text = _Draw.GetElementValue(work, "Default", "Black");
work = _Draw.GetNamedChildNode(st, "BorderStyle");
if (work != null)
style.Text = _Draw.GetElementValue(work, "Default", "Solid");
work = _Draw.GetNamedChildNode(st, "BorderWidth");
if (work != null)
width.Text = _Draw.GetElementValue(work, "Default", "1pt");
}
}
if (color.Text.Length == 0)
color.Text = "Black";
if (style.Text.Length == 0)
style.Text = "Solid";
if (width.Text.Length == 0)
width.Text = "1pt";
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Component Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ChartAxisCtl));
this.DoubleBuffered = true;
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.cbMajorTickMarks = new System.Windows.Forms.ComboBox();
this.cbMinorTickMarks = new System.Windows.Forms.ComboBox();
this.chkVisible = new System.Windows.Forms.CheckBox();
this.chkMargin = new System.Windows.Forms.CheckBox();
this.chkReverse = new System.Windows.Forms.CheckBox();
this.chkInterlaced = new System.Windows.Forms.CheckBox();
this.chkScalar = new System.Windows.Forms.CheckBox();
this.chkLogScale = new System.Windows.Forms.CheckBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.chkMajorGLShow = new System.Windows.Forms.CheckBox();
this.tbMajorGLWidth = new System.Windows.Forms.TextBox();
this.bMajorGLColor = new System.Windows.Forms.Button();
this.cbMajorGLColor = new System.Windows.Forms.ComboBox();
this.cbMajorGLStyle = new System.Windows.Forms.ComboBox();
this.label7 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.chkMinorGLShow = new System.Windows.Forms.CheckBox();
this.tbMinorGLWidth = new System.Windows.Forms.TextBox();
this.bMinorGLColor = new System.Windows.Forms.Button();
this.cbMinorGLColor = new System.Windows.Forms.ComboBox();
this.cbMinorGLStyle = new System.Windows.Forms.ComboBox();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.tbMajorInterval = new System.Windows.Forms.TextBox();
this.tbMinorInterval = new System.Windows.Forms.TextBox();
this.label10 = new System.Windows.Forms.Label();
this.tbMax = new System.Windows.Forms.TextBox();
this.label11 = new System.Windows.Forms.Label();
this.tbMin = new System.Windows.Forms.TextBox();
this.label12 = new System.Windows.Forms.Label();
this.bMinorIntervalExpr = new System.Windows.Forms.Button();
this.bMajorIntervalExpr = new System.Windows.Forms.Button();
this.bMinExpr = new System.Windows.Forms.Button();
this.bMaxExpr = new System.Windows.Forms.Button();
this.chkCanOmit = new System.Windows.Forms.CheckBox();
this.chkMonth = new System.Windows.Forms.CheckBox();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// label1
//
resources.ApplyResources(this.label1, "label1");
this.label1.Name = "label1";
//
// label2
//
resources.ApplyResources(this.label2, "label2");
this.label2.Name = "label2";
//
// cbMajorTickMarks
//
resources.ApplyResources(this.cbMajorTickMarks, "cbMajorTickMarks");
this.cbMajorTickMarks.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbMajorTickMarks.Items.AddRange(new object[] {
resources.GetString("cbMajorTickMarks.Items"),
resources.GetString("cbMajorTickMarks.Items1"),
resources.GetString("cbMajorTickMarks.Items2"),
resources.GetString("cbMajorTickMarks.Items3")});
this.cbMajorTickMarks.Name = "cbMajorTickMarks";
this.cbMajorTickMarks.SelectedIndexChanged += new System.EventHandler(this.cbMajorTickMarks_SelectedIndexChanged);
//
// cbMinorTickMarks
//
resources.ApplyResources(this.cbMinorTickMarks, "cbMinorTickMarks");
this.cbMinorTickMarks.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbMinorTickMarks.Items.AddRange(new object[] {
resources.GetString("cbMinorTickMarks.Items"),
resources.GetString("cbMinorTickMarks.Items1"),
resources.GetString("cbMinorTickMarks.Items2"),
resources.GetString("cbMinorTickMarks.Items3")});
this.cbMinorTickMarks.Name = "cbMinorTickMarks";
this.cbMinorTickMarks.SelectedIndexChanged += new System.EventHandler(this.cbMinorTickMarks_SelectedIndexChanged);
//
// chkVisible
//
resources.ApplyResources(this.chkVisible, "chkVisible");
this.chkVisible.Name = "chkVisible";
this.chkVisible.CheckedChanged += new System.EventHandler(this.chkVisible_CheckedChanged);
//
// chkMargin
//
resources.ApplyResources(this.chkMargin, "chkMargin");
this.chkMargin.Name = "chkMargin";
this.chkMargin.CheckedChanged += new System.EventHandler(this.chkMargin_CheckedChanged);
//
// chkReverse
//
resources.ApplyResources(this.chkReverse, "chkReverse");
this.chkReverse.Name = "chkReverse";
this.chkReverse.CheckedChanged += new System.EventHandler(this.chkReverse_CheckedChanged);
//
// chkInterlaced
//
resources.ApplyResources(this.chkInterlaced, "chkInterlaced");
this.chkInterlaced.Name = "chkInterlaced";
this.chkInterlaced.CheckedChanged += new System.EventHandler(this.chkInterlaced_CheckedChanged);
//
// chkScalar
//
resources.ApplyResources(this.chkScalar, "chkScalar");
this.chkScalar.Name = "chkScalar";
this.chkScalar.CheckedChanged += new System.EventHandler(this.chkScalar_CheckedChanged);
//
// chkLogScale
//
resources.ApplyResources(this.chkLogScale, "chkLogScale");
this.chkLogScale.Name = "chkLogScale";
this.chkLogScale.CheckedChanged += new System.EventHandler(this.chkLogScale_CheckedChanged);
//
// groupBox1
//
resources.ApplyResources(this.groupBox1, "groupBox1");
this.groupBox1.Controls.Add(this.cbMajorGLStyle);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.chkMajorGLShow);
this.groupBox1.Controls.Add(this.tbMajorGLWidth);
this.groupBox1.Controls.Add(this.bMajorGLColor);
this.groupBox1.Controls.Add(this.cbMajorGLColor);
this.groupBox1.Controls.Add(this.label7);
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Name = "groupBox1";
this.groupBox1.TabStop = false;
//
// chkMajorGLShow
//
resources.ApplyResources(this.chkMajorGLShow, "chkMajorGLShow");
this.chkMajorGLShow.Name = "chkMajorGLShow";
this.chkMajorGLShow.CheckedChanged += new System.EventHandler(this.chkMajorGLShow_CheckedChanged);
//
// tbMajorGLWidth
//
resources.ApplyResources(this.tbMajorGLWidth, "tbMajorGLWidth");
this.tbMajorGLWidth.Name = "tbMajorGLWidth";
this.tbMajorGLWidth.TextChanged += new System.EventHandler(this.tbMajorGLWidth_TextChanged);
//
// bMajorGLColor
//
resources.ApplyResources(this.bMajorGLColor, "bMajorGLColor");
this.bMajorGLColor.Name = "bMajorGLColor";
this.bMajorGLColor.Click += new System.EventHandler(this.bMajorGLColor_Click);
//
// cbMajorGLColor
//
resources.ApplyResources(this.cbMajorGLColor, "cbMajorGLColor");
this.cbMajorGLColor.Name = "cbMajorGLColor";
this.cbMajorGLColor.SelectedIndexChanged += new System.EventHandler(this.cbMajorGLColor_SelectedIndexChanged);
//
// cbMajorGLStyle
//
resources.ApplyResources(this.cbMajorGLStyle, "cbMajorGLStyle");
this.cbMajorGLStyle.Items.AddRange(new object[] {
resources.GetString("cbMajorGLStyle.Items"),
resources.GetString("cbMajorGLStyle.Items1"),
resources.GetString("cbMajorGLStyle.Items2"),
resources.GetString("cbMajorGLStyle.Items3"),
resources.GetString("cbMajorGLStyle.Items4"),
resources.GetString("cbMajorGLStyle.Items5"),
resources.GetString("cbMajorGLStyle.Items6"),
resources.GetString("cbMajorGLStyle.Items7"),
resources.GetString("cbMajorGLStyle.Items8"),
resources.GetString("cbMajorGLStyle.Items9")});
this.cbMajorGLStyle.Name = "cbMajorGLStyle";
this.cbMajorGLStyle.SelectedIndexChanged += new System.EventHandler(this.cbMajorGLStyle_SelectedIndexChanged);
//
// label7
//
resources.ApplyResources(this.label7, "label7");
this.label7.Name = "label7";
//
// label6
//
resources.ApplyResources(this.label6, "label6");
this.label6.Name = "label6";
//
// label3
//
resources.ApplyResources(this.label3, "label3");
this.label3.Name = "label3";
//
// groupBox2
//
resources.ApplyResources(this.groupBox2, "groupBox2");
this.groupBox2.Controls.Add(this.cbMinorGLStyle);
this.groupBox2.Controls.Add(this.label8);
this.groupBox2.Controls.Add(this.chkMinorGLShow);
this.groupBox2.Controls.Add(this.tbMinorGLWidth);
this.groupBox2.Controls.Add(this.bMinorGLColor);
this.groupBox2.Controls.Add(this.cbMinorGLColor);
this.groupBox2.Controls.Add(this.label4);
this.groupBox2.Controls.Add(this.label5);
this.groupBox2.Name = "groupBox2";
this.groupBox2.TabStop = false;
//
// chkMinorGLShow
//
resources.ApplyResources(this.chkMinorGLShow, "chkMinorGLShow");
this.chkMinorGLShow.Name = "chkMinorGLShow";
this.chkMinorGLShow.CheckedChanged += new System.EventHandler(this.chkMinorGLShow_CheckedChanged);
//
// tbMinorGLWidth
//
resources.ApplyResources(this.tbMinorGLWidth, "tbMinorGLWidth");
this.tbMinorGLWidth.Name = "tbMinorGLWidth";
this.tbMinorGLWidth.TextChanged += new System.EventHandler(this.tbMinorGLWidth_TextChanged);
//
// bMinorGLColor
//
resources.ApplyResources(this.bMinorGLColor, "bMinorGLColor");
this.bMinorGLColor.Name = "bMinorGLColor";
this.bMinorGLColor.Click += new System.EventHandler(this.bMinorGLColor_Click);
//
// cbMinorGLColor
//
resources.ApplyResources(this.cbMinorGLColor, "cbMinorGLColor");
this.cbMinorGLColor.Name = "cbMinorGLColor";
this.cbMinorGLColor.SelectedIndexChanged += new System.EventHandler(this.cbMinorGLColor_SelectedIndexChanged);
//
// cbMinorGLStyle
//
resources.ApplyResources(this.cbMinorGLStyle, "cbMinorGLStyle");
this.cbMinorGLStyle.Items.AddRange(new object[] {
resources.GetString("cbMinorGLStyle.Items"),
resources.GetString("cbMinorGLStyle.Items1"),
resources.GetString("cbMinorGLStyle.Items2"),
resources.GetString("cbMinorGLStyle.Items3"),
resources.GetString("cbMinorGLStyle.Items4"),
resources.GetString("cbMinorGLStyle.Items5"),
resources.GetString("cbMinorGLStyle.Items6"),
resources.GetString("cbMinorGLStyle.Items7"),
resources.GetString("cbMinorGLStyle.Items8"),
resources.GetString("cbMinorGLStyle.Items9")});
this.cbMinorGLStyle.Name = "cbMinorGLStyle";
this.cbMinorGLStyle.SelectedIndexChanged += new System.EventHandler(this.cbMinorGLStyle_SelectedIndexChanged);
//
// label4
//
resources.ApplyResources(this.label4, "label4");
this.label4.Name = "label4";
//
// label5
//
resources.ApplyResources(this.label5, "label5");
this.label5.Name = "label5";
//
// label8
//
resources.ApplyResources(this.label8, "label8");
this.label8.Name = "label8";
//
// label9
//
resources.ApplyResources(this.label9, "label9");
this.label9.Name = "label9";
//
// tbMajorInterval
//
resources.ApplyResources(this.tbMajorInterval, "tbMajorInterval");
this.tbMajorInterval.Name = "tbMajorInterval";
this.tbMajorInterval.TextChanged += new System.EventHandler(this.tbMajorInterval_TextChanged);
//
// tbMinorInterval
//
resources.ApplyResources(this.tbMinorInterval, "tbMinorInterval");
this.tbMinorInterval.Name = "tbMinorInterval";
this.tbMinorInterval.TextChanged += new System.EventHandler(this.tbMinorInterval_TextChanged);
//
// label10
//
resources.ApplyResources(this.label10, "label10");
this.label10.Name = "label10";
//
// tbMax
//
resources.ApplyResources(this.tbMax, "tbMax");
this.tbMax.Name = "tbMax";
this.tbMax.TextChanged += new System.EventHandler(this.tbMax_TextChanged);
//
// label11
//
resources.ApplyResources(this.label11, "label11");
this.label11.Name = "label11";
//
// tbMin
//
resources.ApplyResources(this.tbMin, "tbMin");
this.tbMin.Name = "tbMin";
this.tbMin.TextChanged += new System.EventHandler(this.tbMin_TextChanged);
//
// label12
//
resources.ApplyResources(this.label12, "label12");
this.label12.Name = "label12";
//
// bMinorIntervalExpr
//
resources.ApplyResources(this.bMinorIntervalExpr, "bMinorIntervalExpr");
this.bMinorIntervalExpr.Name = "bMinorIntervalExpr";
this.bMinorIntervalExpr.Tag = "minorinterval";
this.bMinorIntervalExpr.Click += new System.EventHandler(this.bExpr_Click);
//
// bMajorIntervalExpr
//
resources.ApplyResources(this.bMajorIntervalExpr, "bMajorIntervalExpr");
this.bMajorIntervalExpr.Name = "bMajorIntervalExpr";
this.bMajorIntervalExpr.Tag = "majorinterval";
this.bMajorIntervalExpr.Click += new System.EventHandler(this.bExpr_Click);
//
// bMinExpr
//
resources.ApplyResources(this.bMinExpr, "bMinExpr");
this.bMinExpr.Name = "bMinExpr";
this.bMinExpr.Tag = "min";
this.bMinExpr.Click += new System.EventHandler(this.bExpr_Click);
//
// bMaxExpr
//
resources.ApplyResources(this.bMaxExpr, "bMaxExpr");
this.bMaxExpr.Name = "bMaxExpr";
this.bMaxExpr.Tag = "max";
this.bMaxExpr.Click += new System.EventHandler(this.bExpr_Click);
//
// chkCanOmit
//
resources.ApplyResources(this.chkCanOmit, "chkCanOmit");
this.chkCanOmit.Name = "chkCanOmit";
this.chkCanOmit.CheckedChanged += new System.EventHandler(this.chkCanOmit_CheckedChanged);
//
// chkMonth
//
resources.ApplyResources(this.chkMonth, "chkMonth");
this.chkMonth.Name = "chkMonth";
this.chkMonth.CheckedChanged += new System.EventHandler(this.chkMonth_CheckedChanged);
//
// ChartAxisCtl
//
resources.ApplyResources(this, "$this");
this.Controls.Add(this.chkReverse);
this.Controls.Add(this.chkMonth);
this.Controls.Add(this.chkCanOmit);
this.Controls.Add(this.bMaxExpr);
this.Controls.Add(this.bMinExpr);
this.Controls.Add(this.bMajorIntervalExpr);
this.Controls.Add(this.bMinorIntervalExpr);
this.Controls.Add(this.tbMax);
this.Controls.Add(this.label11);
this.Controls.Add(this.tbMin);
this.Controls.Add(this.label12);
this.Controls.Add(this.tbMinorInterval);
this.Controls.Add(this.label10);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.chkLogScale);
this.Controls.Add(this.chkScalar);
this.Controls.Add(this.chkInterlaced);
this.Controls.Add(this.chkMargin);
this.Controls.Add(this.chkVisible);
this.Controls.Add(this.cbMinorTickMarks);
this.Controls.Add(this.cbMajorTickMarks);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.tbMajorInterval);
this.Controls.Add(this.label9);
this.Name = "ChartAxisCtl";
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
public bool IsValid()
{
return true;
}
public void Apply()
{
// take information in control and apply to all the style nodes
// Only change information that has been marked as modified;
// this way when group is selected it is possible to change just
// the items you want and keep the rest the same.
foreach (XmlNode riNode in this._ReportItems)
ApplyChanges(riNode);
fMonth = fVisible = fMajorTickMarks = fMargin=fReverse=fInterlaced=
fMajorGLWidth=fMajorGLColor=fMajorGLStyle=
fMinorGLWidth=fMinorGLColor=fMinorGLStyle=
fMajorInterval= fMinorInterval=fMax=fMin=
fMinorTickMarks=fScalar=fLogScale=fMajorGLShow=fMinorGLShow=fCanOmit=false;
}
public void ApplyChanges(XmlNode node)
{
if (fMonth)
{
_Draw.SetElement(node, "fyi:Month", this.chkMonth.Checked? "true" : "false");
}
if (fVisible)
{
_Draw.SetElement(node, "Visible", this.chkVisible.Checked? "true": "false");
}
if (fMajorTickMarks)
{
_Draw.SetElement(node, "MajorTickMarks", this.cbMajorTickMarks.Text);
}
if (fMargin)
{
_Draw.SetElement(node, "Margin", this.chkMargin.Checked? "true": "false");
}
if (fReverse)
{
_Draw.SetElement(node, "Reverse", this.chkReverse.Checked? "true": "false");
}
if (fInterlaced)
{
_Draw.SetElement(node, "Interlaced", this.chkInterlaced.Checked? "true": "false");
}
if (fMajorGLShow || fMajorGLWidth || fMajorGLColor || fMajorGLStyle)
{
ApplyGridLines(node, "MajorGridLines", chkMajorGLShow, cbMajorGLColor, cbMajorGLStyle, tbMajorGLWidth);
}
if (fMinorGLShow || fMinorGLWidth || fMinorGLColor || fMinorGLStyle)
{
ApplyGridLines(node, "MinorGridLines", chkMinorGLShow, cbMinorGLColor, cbMinorGLStyle, tbMinorGLWidth);
}
if (fMajorInterval)
{
_Draw.SetElement(node, "MajorInterval", this.tbMajorInterval.Text);
}
if (fMinorInterval)
{
_Draw.SetElement(node, "MinorInterval", this.tbMinorInterval.Text);
}
if (fMax)
{
_Draw.SetElement(node, "Max", this.tbMax.Text);
}
if (fMin)
{
_Draw.SetElement(node, "Min", this.tbMin.Text);
}
if (fMinorTickMarks)
{
_Draw.SetElement(node, "MinorTickMarks", this.cbMinorTickMarks.Text);
}
if (fScalar)
{
_Draw.SetElement(node, "Scalar", this.chkScalar.Checked? "true": "false");
}
if (fLogScale)
{
_Draw.SetElement(node, "LogScale", this.chkLogScale.Checked? "true": "false");
}
if (fCanOmit)
{
_Draw.SetElement(node, "fyi:CanOmit", this.chkCanOmit.Checked ? "true" : "false");
}
}
private void ApplyGridLines(XmlNode node, string type, CheckBox show, ComboBox color, ComboBox style, TextBox width)
{
XmlNode m = _Draw.GetNamedChildNode(node, type);
if (m == null)
{
m = _Draw.CreateElement(node, type, null);
}
_Draw.SetElement(m, "ShowGridLines", show.Checked? "true": "false");
XmlNode st = _Draw.GetNamedChildNode(m, "Style");
if (st == null)
st = _Draw.CreateElement(m, "Style", null);
XmlNode work = _Draw.GetNamedChildNode(st, "BorderColor");
if (work == null)
work = _Draw.CreateElement(st, "BorderColor", null);
_Draw.SetElement(work, "Default", color.Text);
work = _Draw.GetNamedChildNode(st, "BorderStyle");
if (work == null)
work = _Draw.CreateElement(st, "BorderStyle", null);
_Draw.SetElement(work, "Default", style.Text);
work = _Draw.GetNamedChildNode(st, "BorderWidth");
if (work == null)
work = _Draw.CreateElement(st, "BorderWidth", null);
_Draw.SetElement(work, "Default", width.Text);
}
private void cbMajorTickMarks_SelectedIndexChanged(object sender, System.EventArgs e)
{
fMajorTickMarks = true;
}
private void cbMinorTickMarks_SelectedIndexChanged(object sender, System.EventArgs e)
{
fMinorTickMarks = true;
}
private void cbMajorGLStyle_SelectedIndexChanged(object sender, System.EventArgs e)
{
fMajorGLStyle = true;
}
private void cbMajorGLColor_SelectedIndexChanged(object sender, System.EventArgs e)
{
fMajorGLColor = true;
}
private void tbMajorGLWidth_TextChanged(object sender, System.EventArgs e)
{
fMajorGLWidth = true;
}
private void cbMinorGLStyle_SelectedIndexChanged(object sender, System.EventArgs e)
{
fMinorGLStyle = true;
}
private void cbMinorGLColor_SelectedIndexChanged(object sender, System.EventArgs e)
{
fMinorGLColor = true;
}
private void tbMinorGLWidth_TextChanged(object sender, System.EventArgs e)
{
fMinorGLWidth = true;
}
private void tbMajorInterval_TextChanged(object sender, System.EventArgs e)
{
fMajorInterval = true;
}
private void tbMinorInterval_TextChanged(object sender, System.EventArgs e)
{
fMinorInterval = true;
}
private void tbMin_TextChanged(object sender, System.EventArgs e)
{
fMin = true;
}
private void tbMax_TextChanged(object sender, System.EventArgs e)
{
fMax = true;
}
private void chkMonth_CheckedChanged(object sender, System.EventArgs e)
{
fMonth = true;
}
private void chkVisible_CheckedChanged(object sender, System.EventArgs e)
{
fVisible = true;
}
private void chkLogScale_CheckedChanged(object sender, System.EventArgs e)
{
fLogScale = true;
}
private void chkCanOmit_CheckedChanged(object sender, System.EventArgs e)
{
fCanOmit = true;
}
private void chkMargin_CheckedChanged(object sender, System.EventArgs e)
{
fMargin = true;
}
private void chkScalar_CheckedChanged(object sender, System.EventArgs e)
{
fScalar = true;
}
private void chkReverse_CheckedChanged(object sender, System.EventArgs e)
{
fReverse = true;
}
private void chkInterlaced_CheckedChanged(object sender, System.EventArgs e)
{
fInterlaced = true;
}
private void chkMajorGLShow_CheckedChanged(object sender, System.EventArgs e)
{
fMajorGLShow = true;
}
private void chkMinorGLShow_CheckedChanged(object sender, System.EventArgs e)
{
fMinorGLShow = true;
}
private void bMajorGLColor_Click(object sender, System.EventArgs e)
{
SetColor(this.cbMajorGLColor);
}
private void bMinorGLColor_Click(object sender, System.EventArgs e)
{
SetColor(this.cbMinorGLColor);
}
private void SetColor(ComboBox cbColor)
{
ColorDialog cd = new ColorDialog();
cd.AnyColor = true;
cd.FullOpen = true;
cd.CustomColors = RdlDesigner.GetCustomColors();
cd.Color = DesignerUtility.ColorFromHtml(cbColor.Text, System.Drawing.Color.Empty);
try
{
if (cd.ShowDialog() != DialogResult.OK)
return;
RdlDesigner.SetCustomColors(cd.CustomColors);
cbColor.Text = ColorTranslator.ToHtml(cd.Color);
}
finally
{
cd.Dispose();
}
return;
}
private void bExpr_Click(object sender, System.EventArgs e)
{
Button b = sender as Button;
if (b == null)
return;
Control c = null;
bool bColor=false;
switch (b.Tag as string)
{
case "min":
c = this.tbMin;
break;
case "max":
c = this.tbMax;
break;
case "majorinterval":
c = this.tbMajorInterval;
break;
case "minorinterval":
c = this.tbMinorInterval;
break;
}
if (c == null)
return;
XmlNode sNode = _ReportItems[0];
DialogExprEditor ee = new DialogExprEditor(_Draw, c.Text, sNode, bColor);
try
{
DialogResult dr = ee.ShowDialog();
if (dr == DialogResult.OK)
c.Text = ee.Expression;
}
finally
{
ee.Dispose();
}
return;
}
}
}
================================================
FILE: RdlDesign/ChartAxisCtl.resx
================================================
text/microsoft-resx
2.0
System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
6
tbMajorInterval
6
7
14
21
Color
7
MiddleLeft
$this
72, 21
groupBox1
302, 152
fx
4
3
Scalar
5
System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
7
10
15
chkReverse
MiddleLeft
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
bMajorIntervalExpr
Cross
cbMajorGLStyle
Can Omit Values on Truncation
0
21
16
4
11
400, 48
64, 18
80, 16
Cross
System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
88, 16
cbMinorTickMarks
tbMajorGLWidth
65, 20
$this
groupBox2
9
96, 16
7
320, 18
Maximum Value
0
label10
400, 48
groupBox2
15
groupBox2
chkLogScale
88, 24
$this
128, 8
3
24
$this
6
label11
24, 224
145, 24
$this
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
12
13
groupBox1
22, 16
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
72, 21
112, 16
System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Arial, 8.25pt, style=Bold, Italic
chkMajorGLShow
22
23
36, 16
groupBox1
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
7
$this
MiddleLeft
5
93, 48
$this
23
56, 24
groupBox2
chkMargin
224, 8
22, 16
25
72, 21
22, 16
40, 16
System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
9
177, 154
Double
8, 14
14
84, 16
3
24, 24
288, 14
groupBox1
$this
None
334, 224
groupBox2
Arial, 8.25pt, style=Bold, Italic
0
Show
label12
352, 16
Color
16, 184
bMaxExpr
$this
216, 184
tbMin
System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
302, 182
120, 24
24
2
104, 16
bMinorGLColor
16
label8
Arial, 8.25pt, style=Bold, Italic
16, 154
$this
5
label9
208, 16
Groove
72, 24
240, 248
23
label1
Inside
80, 21
3
22, 16
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
fx
65, 20
$this
104, 152
groupBox2
4
Major Tick Marks
chkMonth
17
36, 16
None
chkMinorGLShow
groupBox1
System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
$this
16, 32
177, 184
System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
24, 248
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
$this
Width
System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
108, 248
groupBox1
bMajorGLColor
36, 16
320, 18
12
bMinExpr
label2
$this
MiddleLeft
40, 16
Inside
3
MiddleLeft
System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
5
4
8
Minor Tick Marks
240, 224
System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
8
Solid
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
$this
System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
tbMinorInterval
fx
cbMinorGLStyle
Outside
375, 154
1
System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
7
System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Style
18
$this
$this
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
208, 16
System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
16, 88
104, 182
4
$this
1
22
16, 8
None
60, 24
336, 8
fx
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
tbMinorGLWidth
WindowInset
Outset
108, 224
$this
80, 21
Dotted
Dashed
88, 24
Double
56, 24
Ridge
Inset
$this
40, 20
ChartAxisCtl
40, 20
System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
tbMax
System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
2
2
Major Grid Lines
bMinorIntervalExpr
groupBox2
6
10
None
...
32, 16
Minor Grid Lines
chkScalar
cbMajorGLColor
Show
120, 24
System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
20
5
System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
72, 21
Width
label7
chkCanOmit
Groove
groupBox1
6
376, 184
WindowInset
Outset
$this
groupBox2
System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Ridge
Inset
Dotted
13
Solid
6
18
1
Style
4
$this
25
chkInterlaced
Month Category Scale
288, 14
1
80, 16
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
24, 24
11
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
MiddleLeft
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
440, 303
17
24, 272
2
20
2
3
217, 154
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Minor Interval
352, 16
$this
65, 20
MiddleLeft
Major Interval
MiddleLeft
label4
groupBox1
groupBox1
Interlaced
cbMinorGLColor
64, 18
System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
96, 16
65, 20
label5
1
groupBox2
cbMajorTickMarks
MiddleLeft
label3
$this
8, 14
Visible
chkVisible
176, 18
0
$this
2
Reverse Direction
0
Minimum Value
Dashed
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
19
Outside
176, 18
5
$this
1
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
...
Arial, 8.25pt, style=Bold, Italic
label6
Margin
System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
19
MiddleLeft
Log Scale
True
================================================
FILE: RdlDesign/ChartAxisCtl.ru-RU.resx
================================================
text/microsoft-resx
2.0
System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
115, 16
Основные деления
230, 8
148, 21
Дополнительные деления
137, 8
384, 8
Видимые
266, 224
92, 24
Отступ
152, 24
Обратное направление
266, 248
92, 24
Переплетать
88, 24
Скалярные
108, 220
152, 32
Логарифмическая шкала
448, 48
Основные линии сетки
8, 17
96, 24
Показывать
402, 16
329, 14
251, 17
142, 17
218, 18
Цвет
354, 17
46, 16
Ширина
101, 20
40, 16
Стиль
448, 48
Дополнительные линии сетки
8, 16
96, 24
Показывать
402, 18
329, 15
251, 18
142, 18
218, 19
32, 16
Цвет
354, 19
46, 16
Ширина
101, 19
Стиль
115, 16
Основной интервал
137, 152
365, 151
237, 146
122, 30
Дополнительный интервал
MiddleRight
365, 181
237, 176
122, 30
Максимальное значение
MiddleRight
137, 182
16, 177
115, 30
Минимальное значение
MiddleRight
435, 154
208, 154
208, 184
436, 184
364, 224
93, 72
Можно пропускать значения на усечении
160, 24
Шкала категории месяца
480, 303
================================================
FILE: RdlDesign/ChartCtl - Copy.cs
================================================
/* ====================================================================
Copyright (C) 2004-2008 fyiReporting Software, LLC
Copyright (C) 2011 Peter Gill
This file is part of the fyiReporting RDL project.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
For additional information, email info@fyireporting.com or visit
the website www.fyiReporting.com.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using System.Xml;
namespace fyiReporting.RdlDesign
{
///
/// Summary description for ChartCtl.
///
internal class ChartCtl : System.Windows.Forms.UserControl, IProperty
{
private List _ReportItems;
private DesignXmlDraw _Draw;
//AJM GJL 14082008 Adding more flags
bool fChartType, fVector, fSubtype, fPalette, fRenderElement, fPercentWidth;
bool fNoRows, fDataSet, fPageBreakStart, fPageBreakEnd;
bool fChartData;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.ComboBox cbChartType;
private System.Windows.Forms.ComboBox cbSubType;
private System.Windows.Forms.ComboBox cbPalette;
private System.Windows.Forms.ComboBox cbRenderElement;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.NumericUpDown tbPercentWidth;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.TextBox tbNoRows;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.ComboBox cbDataSet;
private System.Windows.Forms.CheckBox chkPageBreakStart;
private System.Windows.Forms.CheckBox chkPageBreakEnd;
private System.Windows.Forms.ComboBox cbChartData;
private ComboBox cbDataLabel;
private CheckBox chkDataLabel;
private Button bDataLabelExpr;
private System.Windows.Forms.Label lData1;
private ComboBox cbChartData2;
private Label lData2;
private ComboBox cbChartData3;
private Label lData3;
private Button bDataExpr;
private Button bDataExpr3;
private Button bDataExpr2;
private ComboBox cbVector;
private Button btnVectorExp;
private Label label8;
private Button button1;
private Button button2;
private Button button3;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
internal ChartCtl(DesignXmlDraw dxDraw, List ris)
{
_ReportItems = ris;
_Draw = dxDraw;
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
// Initialize form using the style node values
InitValues();
}
private void InitValues()
{
XmlNode node = _ReportItems[0];
string type = _Draw.GetElementValue(node, "Type", "Column");
this.cbChartType.Text = type;
type = type.ToLowerInvariant();
lData2.Enabled = cbChartData2.Enabled = bDataExpr2.Enabled = (type == "scatter" || type == "bubble");
lData3.Enabled = cbChartData3.Enabled = bDataExpr3.Enabled = (type == "bubble");
//AJM GJL 14082008
this.cbVector.Text = _Draw.GetElementValue(node, "fyi:RenderAsVector", "False");
this.cbSubType.Text = _Draw.GetElementValue(node, "Subtype", "Plain");
this.cbPalette.Text = _Draw.GetElementValue(node, "Palette", "Default");
this.cbRenderElement.Text = _Draw.GetElementValue(node, "ChartElementOutput", "Output");
this.tbPercentWidth.Text = _Draw.GetElementValue(node, "PointWidth", "0");
this.tbNoRows.Text = _Draw.GetElementValue(node, "NoRows", "");
// Handle the dataset for this dataregion
object[] dsNames = _Draw.DataSetNames;
string defName="";
if (dsNames != null && dsNames.Length > 0)
{
this.cbDataSet.Items.AddRange(_Draw.DataSetNames);
defName = (string) dsNames[0];
}
cbDataSet.Text = _Draw.GetDataSetNameValue(node);
if (_Draw.GetReportItemDataRegionContainer(node) != null)
cbDataSet.Enabled = false;
// page breaks
this.chkPageBreakStart.Checked = _Draw.GetElementValue(node, "PageBreakAtStart", "false").ToLower() == "true"? true: false;
this.chkPageBreakEnd.Checked = _Draw.GetElementValue(node, "PageBreakAtEnd", "false").ToLower() == "true"? true: false;
// Chart data-- this is a simplification of what is possible (TODO)
string cdata=string.Empty;
string cdata2 = string.Empty;
string cdata3 = string.Empty;
//
//
//
//
//
//
// =Sum(Fields!Sales.Value)
//
//
// =Fields!Year.Value ----- only scatter and bubble
//
//
// =Sum(Fields!Sales.Value) ----- only bubble
//
//
//
//
//
//
//
//
//
//
//Determine if we have a static series or not... We are not allowing this to be changed here. That decision is taken when creating the chart. 05122007GJL
XmlNode ss = DesignXmlDraw.FindNextInHierarchy(node, "SeriesGroupings", "SeriesGrouping", "StaticSeries");
bool StaticSeries = ss != null;
XmlNode dvs = DesignXmlDraw.FindNextInHierarchy(node,
"ChartData", "ChartSeries", "DataPoints", "DataPoint", "DataValues");
int iter = 0;
XmlNode cnode;
foreach (XmlNode dv in dvs.ChildNodes)
{
if (dv.Name != "DataValue")
continue;
iter++;
cnode = DesignXmlDraw.FindNextInHierarchy(dv, "Value");
if (cnode == null)
continue;
switch (iter)
{
case 1:
cdata = cnode.InnerText;
break;
case 2:
cdata2 = cnode.InnerText;
break;
case 3:
cdata3 = cnode.InnerText;
break;
default:
break;
}
}
this.cbChartData.Text = cdata;
this.cbChartData2.Text = cdata2;
this.cbChartData3.Text = cdata3;
//If the chart doesn't have a static series then dont show the datalabel values. 05122007GJL
if (!StaticSeries)
{
//GJL 131107 Added data labels
XmlNode labelExprNode = DesignXmlDraw.FindNextInHierarchy(node,
"ChartData", "ChartSeries", "DataPoints", "DataPoint", "DataLabel", "Value");
if (labelExprNode != null)
this.cbDataLabel.Text = labelExprNode.InnerText;
XmlNode labelVisNode = DesignXmlDraw.FindNextInHierarchy(node,
"ChartData", "ChartSeries", "DataPoints", "DataPoint", "DataLabel", "Visible");
if (labelVisNode != null)
this.chkDataLabel.Checked = labelVisNode.InnerText.ToUpper().Equals("TRUE");
}
chkDataLabel.Enabled = bDataLabelExpr.Enabled = cbDataLabel.Enabled =
bDataExpr.Enabled = cbChartData.Enabled = !StaticSeries;
// Don't allow the datalabel OR datavalues to be changed here if we have a static series GJL
fChartType = fSubtype = fPalette = fRenderElement = fPercentWidth =
fNoRows = fDataSet = fPageBreakStart = fPageBreakEnd = fChartData = false;
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Component Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.cbChartType = new System.Windows.Forms.ComboBox();
this.cbSubType = new System.Windows.Forms.ComboBox();
this.cbPalette = new System.Windows.Forms.ComboBox();
this.cbRenderElement = new System.Windows.Forms.ComboBox();
this.label5 = new System.Windows.Forms.Label();
this.tbPercentWidth = new System.Windows.Forms.NumericUpDown();
this.label6 = new System.Windows.Forms.Label();
this.tbNoRows = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.cbDataSet = new System.Windows.Forms.ComboBox();
this.chkPageBreakStart = new System.Windows.Forms.CheckBox();
this.chkPageBreakEnd = new System.Windows.Forms.CheckBox();
this.cbChartData = new System.Windows.Forms.ComboBox();
this.cbDataLabel = new System.Windows.Forms.ComboBox();
this.chkDataLabel = new System.Windows.Forms.CheckBox();
this.bDataLabelExpr = new System.Windows.Forms.Button();
this.lData1 = new System.Windows.Forms.Label();
this.cbChartData2 = new System.Windows.Forms.ComboBox();
this.lData2 = new System.Windows.Forms.Label();
this.cbChartData3 = new System.Windows.Forms.ComboBox();
this.lData3 = new System.Windows.Forms.Label();
this.bDataExpr = new System.Windows.Forms.Button();
this.bDataExpr3 = new System.Windows.Forms.Button();
this.bDataExpr2 = new System.Windows.Forms.Button();
this.cbVector = new System.Windows.Forms.ComboBox();
this.btnVectorExp = new System.Windows.Forms.Button();
this.label8 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.tbPercentWidth)).BeginInit();
this.SuspendLayout();
//
// label1
//
this.label1.Location = new System.Drawing.Point(16, 12);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(72, 16);
this.label1.TabIndex = 0;
this.label1.Text = "Chart Type";
//
// label2
//
this.label2.Location = new System.Drawing.Point(16, 37);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(72, 16);
this.label2.TabIndex = 1;
this.label2.Text = "Palette";
//
// label3
//
this.label3.Location = new System.Drawing.Point(16, 62);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(128, 16);
this.label3.TabIndex = 2;
this.label3.Text = "Render XML Element";
//
// label4
//
this.label4.Location = new System.Drawing.Point(16, 84);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(340, 19);
this.label4.TabIndex = 3;
this.label4.Text = "Percent width for Bars/Columns (>100% will cause overlap of columns)";
//
// cbChartType
//
this.cbChartType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbChartType.Items.AddRange(new object[] {
"Area",
"Bar",
"Column",
"Doughnut",
"Line",
"Map",
"Pie",
"Bubble",
"Scatter"});
this.cbChartType.Location = new System.Drawing.Point(126, 9);
this.cbChartType.Name = "cbChartType";
this.cbChartType.Size = new System.Drawing.Size(121, 21);
this.cbChartType.TabIndex = 0;
this.cbChartType.SelectedIndexChanged += new System.EventHandler(this.cbChartType_SelectedIndexChanged);
//
// cbSubType
//
this.cbSubType.Location = new System.Drawing.Point(331, 9);
this.cbSubType.Name = "cbSubType";
this.cbSubType.Size = new System.Drawing.Size(80, 21);
this.cbSubType.TabIndex = 1;
this.cbSubType.SelectedIndexChanged += new System.EventHandler(this.cbSubType_SelectedIndexChanged);
this.cbSubType.TextUpdate += new System.EventHandler(this.cbSubType_SelectedIndexChanged);
this.cbSubType.TextChanged += new System.EventHandler(this.cbSubType_SelectedIndexChanged);
//
// cbPalette
//
this.cbPalette.Items.AddRange(new object[] {
"Default",
"EarthTones",
"Excel",
"GrayScale",
"Light",
"Pastel",
"SemiTransparent",
"Patterned",
"PatternedBlack"});
this.cbPalette.Location = new System.Drawing.Point(126, 34);
this.cbPalette.Name = "cbPalette";
this.cbPalette.Size = new System.Drawing.Size(121, 21);
this.cbPalette.TabIndex = 2;
this.cbPalette.SelectedIndexChanged += new System.EventHandler(this.cbPalette_SelectedIndexChanged);
//
// cbRenderElement
//
this.cbRenderElement.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbRenderElement.Items.AddRange(new object[] {
"Output",
"NoOutput"});
this.cbRenderElement.Location = new System.Drawing.Point(126, 59);
this.cbRenderElement.Name = "cbRenderElement";
this.cbRenderElement.Size = new System.Drawing.Size(121, 21);
this.cbRenderElement.TabIndex = 3;
this.cbRenderElement.SelectedIndexChanged += new System.EventHandler(this.cbRenderElement_SelectedIndexChanged);
//
// label5
//
this.label5.Location = new System.Drawing.Point(275, 12);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(53, 23);
this.label5.TabIndex = 8;
this.label5.Text = "Sub-type";
//
// tbPercentWidth
//
this.tbPercentWidth.Location = new System.Drawing.Point(363, 80);
this.tbPercentWidth.Name = "tbPercentWidth";
this.tbPercentWidth.Size = new System.Drawing.Size(48, 20);
this.tbPercentWidth.TabIndex = 4;
this.tbPercentWidth.ValueChanged += new System.EventHandler(this.tbPercentWidth_ValueChanged);
//
// label6
//
this.label6.Location = new System.Drawing.Point(16, 106);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(100, 23);
this.label6.TabIndex = 10;
this.label6.Text = "No Rows Message";
//
// tbNoRows
//
this.tbNoRows.Location = new System.Drawing.Point(156, 106);
this.tbNoRows.Name = "tbNoRows";
this.tbNoRows.Size = new System.Drawing.Size(255, 20);
this.tbNoRows.TabIndex = 5;
this.tbNoRows.TextChanged += new System.EventHandler(this.tbNoRows_TextChanged);
//
// label7
//
this.label7.Location = new System.Drawing.Point(16, 135);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(100, 23);
this.label7.TabIndex = 12;
this.label7.Text = "Data Set Name";
//
// cbDataSet
//
this.cbDataSet.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbDataSet.Location = new System.Drawing.Point(156, 133);
this.cbDataSet.Name = "cbDataSet";
this.cbDataSet.Size = new System.Drawing.Size(255, 21);
this.cbDataSet.TabIndex = 6;
this.cbDataSet.SelectedIndexChanged += new System.EventHandler(this.cbDataSet_SelectedIndexChanged);
//
// chkPageBreakStart
//
this.chkPageBreakStart.Location = new System.Drawing.Point(20, 260);
this.chkPageBreakStart.Name = "chkPageBreakStart";
this.chkPageBreakStart.Size = new System.Drawing.Size(136, 24);
this.chkPageBreakStart.TabIndex = 13;
this.chkPageBreakStart.Text = "Page Break at Start";
this.chkPageBreakStart.CheckedChanged += new System.EventHandler(this.chkPageBreakStart_CheckedChanged);
//
// chkPageBreakEnd
//
this.chkPageBreakEnd.Location = new System.Drawing.Point(280, 260);
this.chkPageBreakEnd.Name = "chkPageBreakEnd";
this.chkPageBreakEnd.Size = new System.Drawing.Size(136, 24);
this.chkPageBreakEnd.TabIndex = 14;
this.chkPageBreakEnd.Text = "Page Break at End";
this.chkPageBreakEnd.CheckedChanged += new System.EventHandler(this.chkPageBreakEnd_CheckedChanged);
//
// cbChartData
//
this.cbChartData.Location = new System.Drawing.Point(156, 157);
this.cbChartData.Name = "cbChartData";
this.cbChartData.Size = new System.Drawing.Size(255, 21);
this.cbChartData.TabIndex = 7;
this.cbChartData.TextChanged += new System.EventHandler(this.cbChartData_Changed);
//
// cbDataLabel
//
this.cbDataLabel.Enabled = false;
this.cbDataLabel.Location = new System.Drawing.Point(156, 237);
this.cbDataLabel.Name = "cbDataLabel";
this.cbDataLabel.Size = new System.Drawing.Size(254, 21);
this.cbDataLabel.TabIndex = 17;
this.cbDataLabel.TextChanged += new System.EventHandler(this.cbChartData_Changed);
//
// chkDataLabel
//
this.chkDataLabel.AutoSize = true;
this.chkDataLabel.Location = new System.Drawing.Point(20, 240);
this.chkDataLabel.Name = "chkDataLabel";
this.chkDataLabel.Size = new System.Drawing.Size(75, 17);
this.chkDataLabel.TabIndex = 19;
this.chkDataLabel.Text = "DataLabel";
this.chkDataLabel.UseVisualStyleBackColor = true;
this.chkDataLabel.CheckedChanged += new System.EventHandler(this.chkDataLabel_CheckedChanged);
//
// bDataLabelExpr
//
this.bDataLabelExpr.Enabled = false;
this.bDataLabelExpr.Font = new System.Drawing.Font("Arial", 8.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))));
this.bDataLabelExpr.Location = new System.Drawing.Point(415, 237);
this.bDataLabelExpr.Name = "bDataLabelExpr";
this.bDataLabelExpr.Size = new System.Drawing.Size(22, 21);
this.bDataLabelExpr.TabIndex = 20;
this.bDataLabelExpr.Text = "fx";
this.bDataLabelExpr.UseVisualStyleBackColor = true;
this.bDataLabelExpr.Click += new System.EventHandler(this.bDataLabelExpr_Click);
//
// lData1
//
this.lData1.Location = new System.Drawing.Point(16, 157);
this.lData1.Name = "lData1";
this.lData1.Size = new System.Drawing.Size(137, 23);
this.lData1.TabIndex = 16;
this.lData1.Text = "Chart Data (X Coordinate)";
//
// cbChartData2
//
this.cbChartData2.Location = new System.Drawing.Point(156, 182);
this.cbChartData2.Name = "cbChartData2";
this.cbChartData2.Size = new System.Drawing.Size(255, 21);
this.cbChartData2.TabIndex = 9;
this.cbChartData2.TextChanged += new System.EventHandler(this.cbChartData_Changed);
//
// lData2
//
this.lData2.Location = new System.Drawing.Point(16, 182);
this.lData2.Name = "lData2";
this.lData2.Size = new System.Drawing.Size(100, 23);
this.lData2.TabIndex = 18;
this.lData2.Text = "Y Coordinate";
//
// cbChartData3
//
this.cbChartData3.Location = new System.Drawing.Point(156, 207);
this.cbChartData3.Name = "cbChartData3";
this.cbChartData3.Size = new System.Drawing.Size(255, 21);
this.cbChartData3.TabIndex = 11;
this.cbChartData3.TextChanged += new System.EventHandler(this.cbChartData_Changed);
//
// lData3
//
this.lData3.Location = new System.Drawing.Point(16, 207);
this.lData3.Name = "lData3";
this.lData3.Size = new System.Drawing.Size(100, 23);
this.lData3.TabIndex = 20;
this.lData3.Text = "Bubble Size";
//
// bDataExpr
//
this.bDataExpr.Font = new System.Drawing.Font("Arial", 8.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.bDataExpr.Location = new System.Drawing.Point(415, 157);
this.bDataExpr.Name = "bDataExpr";
this.bDataExpr.Size = new System.Drawing.Size(22, 21);
this.bDataExpr.TabIndex = 8;
this.bDataExpr.Tag = "d1";
this.bDataExpr.Text = "fx";
this.bDataExpr.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.bDataExpr.Click += new System.EventHandler(this.bDataExpr_Click);
//
// bDataExpr3
//
this.bDataExpr3.Font = new System.Drawing.Font("Arial", 8.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.bDataExpr3.Location = new System.Drawing.Point(415, 207);
this.bDataExpr3.Name = "bDataExpr3";
this.bDataExpr3.Size = new System.Drawing.Size(22, 21);
this.bDataExpr3.TabIndex = 12;
this.bDataExpr3.Tag = "d3";
this.bDataExpr3.Text = "fx";
this.bDataExpr3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.bDataExpr3.Click += new System.EventHandler(this.bDataExpr_Click);
//
// bDataExpr2
//
this.bDataExpr2.Font = new System.Drawing.Font("Arial", 8.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.bDataExpr2.Location = new System.Drawing.Point(415, 182);
this.bDataExpr2.Name = "bDataExpr2";
this.bDataExpr2.Size = new System.Drawing.Size(22, 21);
this.bDataExpr2.TabIndex = 10;
this.bDataExpr2.Tag = "d2";
this.bDataExpr2.Text = "fx";
this.bDataExpr2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.bDataExpr2.Click += new System.EventHandler(this.bDataExpr_Click);
//
// cbVector
//
this.cbVector.Items.AddRange(new object[] {
"False",
"True"});
this.cbVector.Location = new System.Drawing.Point(330, 36);
this.cbVector.Name = "cbVector";
this.cbVector.Size = new System.Drawing.Size(80, 21);
this.cbVector.TabIndex = 21;
this.cbVector.SelectedIndexChanged += new System.EventHandler(this.cbVector_SelectedIndexChanged);
//
// btnVectorExp
//
this.btnVectorExp.Font = new System.Drawing.Font("Arial", 8.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnVectorExp.Location = new System.Drawing.Point(415, 36);
this.btnVectorExp.Name = "btnVectorExp";
this.btnVectorExp.Size = new System.Drawing.Size(22, 21);
this.btnVectorExp.TabIndex = 22;
this.btnVectorExp.Tag = "d4";
this.btnVectorExp.Text = "fx";
this.btnVectorExp.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnVectorExp.Click += new System.EventHandler(this.bDataExpr_Click);
//
// label8
//
this.label8.Location = new System.Drawing.Point(275, 32);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(53, 27);
this.label8.TabIndex = 23;
this.label8.Text = "Render As Vector";
//
// button1
//
this.button1.Font = new System.Drawing.Font("Arial", 8.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button1.Location = new System.Drawing.Point(415, 9);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(22, 21);
this.button1.TabIndex = 24;
this.button1.Tag = "d7";
this.button1.Text = "fx";
this.button1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.button1.Click += new System.EventHandler(this.bDataExpr_Click);
//
// button2
//
this.button2.Font = new System.Drawing.Font("Arial", 8.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button2.Location = new System.Drawing.Point(251, 9);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(22, 21);
this.button2.TabIndex = 25;
this.button2.Tag = "d5";
this.button2.Text = "fx";
this.button2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.button2.Visible = false;
this.button2.Click += new System.EventHandler(this.bDataExpr_Click);
//
// button3
//
this.button3.Font = new System.Drawing.Font("Arial", 8.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button3.Location = new System.Drawing.Point(251, 32);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(22, 21);
this.button3.TabIndex = 26;
this.button3.Tag = "d6";
this.button3.Text = "fx";
this.button3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.button3.Click += new System.EventHandler(this.bDataExpr_Click);
//
// ChartCtl
//
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.label8);
this.Controls.Add(this.btnVectorExp);
this.Controls.Add(this.cbVector);
this.Controls.Add(this.bDataExpr2);
this.Controls.Add(this.bDataExpr3);
this.Controls.Add(this.bDataExpr);
this.Controls.Add(this.cbChartData3);
this.Controls.Add(this.lData3);
this.Controls.Add(this.cbChartData2);
this.Controls.Add(this.lData2);
this.Controls.Add(this.bDataLabelExpr);
this.Controls.Add(this.chkDataLabel);
this.Controls.Add(this.cbDataLabel);
this.Controls.Add(this.cbChartData);
this.Controls.Add(this.lData1);
this.Controls.Add(this.chkPageBreakEnd);
this.Controls.Add(this.chkPageBreakStart);
this.Controls.Add(this.cbDataSet);
this.Controls.Add(this.label7);
this.Controls.Add(this.tbNoRows);
this.Controls.Add(this.label6);
this.Controls.Add(this.tbPercentWidth);
this.Controls.Add(this.label5);
this.Controls.Add(this.cbRenderElement);
this.Controls.Add(this.cbPalette);
this.Controls.Add(this.cbSubType);
this.Controls.Add(this.cbChartType);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Name = "ChartCtl";
this.Size = new System.Drawing.Size(440, 288);
((System.ComponentModel.ISupportInitialize)(this.tbPercentWidth)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
public bool IsValid()
{
return true;
}
public void Apply()
{
// take information in control and apply to all the style nodes
// Only change information that has been marked as modified;
// this way when group is selected it is possible to change just
// the items you want and keep the rest the same.
foreach (XmlNode riNode in this._ReportItems)
ApplyChanges(riNode);
// No more changes
//AJM GJL 14082008
fChartType = fVector = fSubtype = fPalette = fRenderElement = fPercentWidth =
fNoRows = fDataSet = fPageBreakStart = fPageBreakEnd = fChartData = false;
}
public void ApplyChanges(XmlNode node)
{
if (fChartType)
{
_Draw.SetElement(node, "Type", this.cbChartType.Text);
}
if (fVector) //AJM GJL 14082008
{
_Draw.SetElement(node, "fyi:RenderAsVector", this.cbVector.Text);
}
if (fSubtype)
{
_Draw.SetElement(node, "Subtype", this.cbSubType.Text);
}
if (fPalette)
{
_Draw.SetElement(node, "Palette", this.cbPalette.Text);
}
if (fRenderElement)
{
_Draw.SetElement(node, "ChartElementOutput", this.cbRenderElement.Text);
}
if (fPercentWidth)
{
_Draw.SetElement(node, "PointWidth", this.tbPercentWidth.Text);
}
if (fNoRows)
{
_Draw.SetElement(node, "NoRows", this.tbNoRows.Text);
}
if (fDataSet)
{
_Draw.SetElement(node, "DataSetName", this.cbDataSet.Text);
}
if (fPageBreakStart)
{
_Draw.SetElement(node, "PageBreakAtStart", this.chkPageBreakStart.Checked? "true": "false");
}
if (fPageBreakEnd)
{
_Draw.SetElement(node, "PageBreakAtEnd", this.chkPageBreakEnd.Checked? "true": "false");
}
if (fChartData)
{
//
//
//
//
//
//
// =Sum(Fields!Sales.Value)
// --- you can have up to 3 DataValue elements
//
//
//
//
//
//
//
//
//
XmlNode chartdata = _Draw.SetElement(node, "ChartData", null);
XmlNode chartseries = _Draw.SetElement(chartdata, "ChartSeries", null);
XmlNode datapoints = _Draw.SetElement(chartseries, "DataPoints", null);
XmlNode datapoint = _Draw.SetElement(datapoints, "DataPoint", null);
XmlNode datavalues = _Draw.SetElement(datapoint, "DataValues", null);
_Draw.RemoveElementAll(datavalues, "DataValue");
XmlNode datalabel = _Draw.SetElement(datapoint, "DataLabel", null);
XmlNode datavalue = _Draw.SetElement(datavalues, "DataValue", null);
_Draw.SetElement(datavalue, "Value", this.cbChartData.Text);
string type = cbChartType.Text.ToLowerInvariant();
if (type == "scatter" || type == "bubble")
{
datavalue = _Draw.CreateElement(datavalues, "DataValue", null);
_Draw.SetElement(datavalue, "Value", this.cbChartData2.Text);
if (type == "bubble")
{
datavalue = _Draw.CreateElement(datavalues, "DataValue", null);
_Draw.SetElement(datavalue, "Value", this.cbChartData3.Text);
}
}
_Draw.SetElement(datalabel, "Value", this.cbDataLabel.Text);
_Draw.SetElement(datalabel, "Visible", this.chkDataLabel.Checked.ToString());
}
}
private void cbChartType_SelectedIndexChanged(object sender, System.EventArgs e)
{
fChartType = true;
// Change the potential sub-types
string savesub = cbSubType.Text;
string[] subItems = new string [] {"Plain"};
bool bEnableY = false;
bool bEnableBubble = false;
switch (cbChartType.Text)
{
case "Column":
subItems = new string [] {"Plain", "Stacked", "PercentStacked"};
break;
case "Bar":
subItems = new string [] {"Plain", "Stacked", "PercentStacked"};
break;
case "Line":
subItems = new string [] {"Plain", "Smooth"};
break;
case "Pie":
subItems = new string [] {"Plain", "Exploded"};
break;
case "Area":
subItems = new string [] {"Plain", "Stacked"};
break;
case "Doughnut":
break;
case "Map":
subItems = RdlDesigner.MapSubtypes;
break;
case "Scatter":
subItems = new string [] {"Plain", "Line", "SmoothLine"};
bEnableY = true;
break;
case "Stock":
break;
case "Bubble":
bEnableY = bEnableBubble = true;
break;
default:
break;
}
cbSubType.Items.Clear();
cbSubType.Items.AddRange(subItems);
lData2.Enabled = cbChartData2.Enabled = bDataExpr2.Enabled = bEnableY;
lData3.Enabled = cbChartData3.Enabled = bDataExpr3.Enabled = bEnableBubble;
int i=0;
foreach (string s in subItems)
{
if (s == savesub)
{
cbSubType.SelectedIndex = i;
return;
}
i++;
}
// Didn't match old style
cbSubType.SelectedIndex = 0;
}
//AJM GJL 14082008
private void cbVector_SelectedIndexChanged(object sender, EventArgs e)
{
fVector = true;
}
private void cbSubType_SelectedIndexChanged(object sender, System.EventArgs e)
{
fSubtype = true;
}
private void cbPalette_SelectedIndexChanged(object sender, System.EventArgs e)
{
fPalette = true;
}
private void cbRenderElement_SelectedIndexChanged(object sender, System.EventArgs e)
{
fRenderElement = true;
}
private void tbPercentWidth_ValueChanged(object sender, System.EventArgs e)
{
fPercentWidth = true;
}
private void tbNoRows_TextChanged(object sender, System.EventArgs e)
{
fNoRows = true;
}
private void cbDataSet_SelectedIndexChanged(object sender, System.EventArgs e)
{
fDataSet = true;
}
private void chkPageBreakStart_CheckedChanged(object sender, System.EventArgs e)
{
fPageBreakStart = true;
}
private void chkPageBreakEnd_CheckedChanged(object sender, System.EventArgs e)
{
fPageBreakEnd = true;
}
private void cbChartData_Changed(object sender, System.EventArgs e)
{
fChartData = true;
}
private void bDataExpr_Click(object sender, System.EventArgs e)
{
Button bs = sender as Button;
if (bs == null)
return;
Control ctl = null;
switch (bs.Tag as string)
{
case "d1":
ctl = cbChartData;
break;
case "d2":
ctl = cbChartData2;
break;
case "d3":
ctl = cbChartData3;
break;
//AJM GJL 14082008
case "d4":
ctl = cbVector;
fVector = true;
break;
case "d5":
ctl = cbChartType;
fChartType = true;
break;
case "d6":
ctl = cbPalette;
fPalette = true;
break;
case "d7":
ctl = cbSubType;
fSubtype = true;
break;
default:
return;
}
DialogExprEditor ee = new DialogExprEditor(_Draw, ctl.Text, _ReportItems[0], false);
try
{
DialogResult dlgr = ee.ShowDialog();
if (dlgr == DialogResult.OK)
{
ctl.Text = ee.Expression;
fChartData = true;
}
}
finally
{
ee.Dispose();
}
}
private void chkDataLabel_CheckedChanged(object sender, EventArgs e)
{
cbDataLabel.Enabled = bDataLabelExpr.Enabled = chkDataLabel.Checked;
}
private void bDataLabelExpr_Click(object sender, EventArgs e)
{
DialogExprEditor ee = new DialogExprEditor(_Draw, cbDataLabel.Text,_ReportItems[0] , false);
try
{
if (ee.ShowDialog() == DialogResult.OK)
{
cbDataLabel.Text = ee.Expression;
}
}
finally
{
ee.Dispose();
}
return;
}
}
}
================================================
FILE: RdlDesign/ChartCtl.cs
================================================
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using System.Xml;
namespace Majorsilence.Reporting.RdlDesign
{
///
/// Summary description for ChartCtl.
///
internal class ChartCtl : System.Windows.Forms.UserControl, IProperty
{
private List _ReportItems;
private DesignXmlDraw _Draw;
//AJM GJL 14082008 Adding more flags
bool fChartType, fVector, fSubtype, fPalette, fRenderElement, fPercentWidth, ftooltip,ftooltipX;
bool fNoRows, fDataSet, fPageBreakStart, fPageBreakEnd, tooltipYFormat, tooltipXFormat;
bool fChartData;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.ComboBox cbChartType;
private System.Windows.Forms.ComboBox cbSubType;
private System.Windows.Forms.ComboBox cbPalette;
private System.Windows.Forms.ComboBox cbRenderElement;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.NumericUpDown tbPercentWidth;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.TextBox tbNoRows;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.ComboBox cbDataSet;
private System.Windows.Forms.CheckBox chkPageBreakStart;
private System.Windows.Forms.CheckBox chkPageBreakEnd;
private System.Windows.Forms.ComboBox cbChartData;
private ComboBox cbDataLabel;
private CheckBox chkDataLabel;
private Button bDataLabelExpr;
private System.Windows.Forms.Label lData1;
private ComboBox cbChartData2;
private Label lData2;
private ComboBox cbChartData3;
private Label lData3;
private Button bDataExpr;
private Button bDataExpr3;
private Button bDataExpr2;
private ComboBox cbVector;
private Button btnVectorExp;
private Label label8;
private Button button1;
private Button button2;
private Button button3;
private CheckBox chkToolTip;
private CheckBox checkBox1;
private TextBox txtYToolFormat;
private TextBox txtXToolFormat;
private Label label9;
private Label label10;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
internal ChartCtl(DesignXmlDraw dxDraw, List ris)
{
_ReportItems = ris;
_Draw = dxDraw;
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
// Initialize form using the style node values
InitValues();
}
private void InitValues()
{
XmlNode node = _ReportItems[0];
string type = _Draw.GetElementValue(node, "Type", "Column");
this.cbChartType.Text = type;
type = type.ToLowerInvariant();
lData2.Enabled = cbChartData2.Enabled = bDataExpr2.Enabled = (type == "scatter" || type == "bubble");
lData3.Enabled = cbChartData3.Enabled = bDataExpr3.Enabled = (type == "bubble");
//AJM GJL 14082008
this.chkToolTip.Checked = _Draw.GetElementValue(node, "fyi:Tooltip", "false").ToLower() == "true" ? true : false;
this.checkBox1.Checked = _Draw.GetElementValue(node, "fyi:TooltipX", "false").ToLower() == "true" ? true : false;
this.txtXToolFormat.Text = _Draw.GetElementValue(node, "fyi:TooltipXFormat","");
this.txtYToolFormat.Text = _Draw.GetElementValue(node, "fyi:TooltipYFormat","");
this.cbVector.Text = _Draw.GetElementValue(node, "fyi:RenderAsVector", "False");
this.cbSubType.Text = _Draw.GetElementValue(node, "Subtype", "Plain");
this.cbPalette.Text = _Draw.GetElementValue(node, "Palette", "Default");
this.cbRenderElement.Text = _Draw.GetElementValue(node, "ChartElementOutput", "Output");
this.tbPercentWidth.Text = _Draw.GetElementValue(node, "PointWidth", "0");
this.tbNoRows.Text = _Draw.GetElementValue(node, "NoRows", "");
// Handle the dataset for this dataregion
object[] dsNames = _Draw.DataSetNames;
string defName="";
if (dsNames != null && dsNames.Length > 0)
{
this.cbDataSet.Items.AddRange(_Draw.DataSetNames);
defName = (string) dsNames[0];
}
cbDataSet.Text = _Draw.GetDataSetNameValue(node);
if (_Draw.GetReportItemDataRegionContainer(node) != null)
cbDataSet.Enabled = false;
// page breaks
this.chkPageBreakStart.Checked = _Draw.GetElementValue(node, "PageBreakAtStart", "false").ToLower() == "true"? true: false;
this.chkPageBreakEnd.Checked = _Draw.GetElementValue(node, "PageBreakAtEnd", "false").ToLower() == "true"? true: false;
// Chart data-- this is a simplification of what is possible (TODO)
string cdata=string.Empty;
string cdata2 = string.Empty;
string cdata3 = string.Empty;
//
//
//
//
//
//
// =Sum(Fields!Sales.Value)
//
//
// =Fields!Year.Value ----- only scatter and bubble
//
//
// =Sum(Fields!Sales.Value) ----- only bubble
//
//
//
//
//
//
//
//
//
//
//Determine if we have a static series or not... We are not allowing this to be changed here. That decision is taken when creating the chart. 05122007GJL
XmlNode ss = DesignXmlDraw.FindNextInHierarchy(node, "SeriesGroupings", "SeriesGrouping", "StaticSeries");
bool StaticSeries = ss != null;
XmlNode dvs = DesignXmlDraw.FindNextInHierarchy(node,
"ChartData", "ChartSeries", "DataPoints", "DataPoint", "DataValues");
int iter = 0;
XmlNode cnode;
foreach (XmlNode dv in dvs.ChildNodes)
{
if (dv.Name != "DataValue")
continue;
iter++;
cnode = DesignXmlDraw.FindNextInHierarchy(dv, "Value");
if (cnode == null)
continue;
switch (iter)
{
case 1:
cdata = cnode.InnerText;
break;
case 2:
cdata2 = cnode.InnerText;
break;
case 3:
cdata3 = cnode.InnerText;
break;
default:
break;
}
}
this.cbChartData.Text = cdata;
this.cbChartData2.Text = cdata2;
this.cbChartData3.Text = cdata3;
//If the chart doesn't have a static series then dont show the datalabel values. 05122007GJL
if (!StaticSeries)
{
//GJL 131107 Added data labels
XmlNode labelExprNode = DesignXmlDraw.FindNextInHierarchy(node,
"ChartData", "ChartSeries", "DataPoints", "DataPoint", "DataLabel", "Value");
if (labelExprNode != null)
this.cbDataLabel.Text = labelExprNode.InnerText;
XmlNode labelVisNode = DesignXmlDraw.FindNextInHierarchy(node,
"ChartData", "ChartSeries", "DataPoints", "DataPoint", "DataLabel", "Visible");
if (labelVisNode != null)
this.chkDataLabel.Checked = labelVisNode.InnerText.ToUpper().Equals("TRUE");
}
chkDataLabel.Enabled = bDataLabelExpr.Enabled = cbDataLabel.Enabled =
bDataExpr.Enabled = cbChartData.Enabled = !StaticSeries;
// Don't allow the datalabel OR datavalues to be changed here if we have a static series GJL
fChartType = fSubtype = fPalette = fRenderElement = fPercentWidth =
fNoRows = fDataSet = fPageBreakStart = fPageBreakEnd = fChartData = false;
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Component Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ChartCtl));
this.DoubleBuffered = true;
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.cbChartType = new System.Windows.Forms.ComboBox();
this.cbSubType = new System.Windows.Forms.ComboBox();
this.cbPalette = new System.Windows.Forms.ComboBox();
this.cbRenderElement = new System.Windows.Forms.ComboBox();
this.label5 = new System.Windows.Forms.Label();
this.tbPercentWidth = new System.Windows.Forms.NumericUpDown();
this.label6 = new System.Windows.Forms.Label();
this.tbNoRows = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.cbDataSet = new System.Windows.Forms.ComboBox();
this.chkPageBreakStart = new System.Windows.Forms.CheckBox();
this.chkPageBreakEnd = new System.Windows.Forms.CheckBox();
this.cbChartData = new System.Windows.Forms.ComboBox();
this.cbDataLabel = new System.Windows.Forms.ComboBox();
this.chkDataLabel = new System.Windows.Forms.CheckBox();
this.bDataLabelExpr = new System.Windows.Forms.Button();
this.lData1 = new System.Windows.Forms.Label();
this.cbChartData2 = new System.Windows.Forms.ComboBox();
this.lData2 = new System.Windows.Forms.Label();
this.cbChartData3 = new System.Windows.Forms.ComboBox();
this.lData3 = new System.Windows.Forms.Label();
this.bDataExpr = new System.Windows.Forms.Button();
this.bDataExpr3 = new System.Windows.Forms.Button();
this.bDataExpr2 = new System.Windows.Forms.Button();
this.cbVector = new System.Windows.Forms.ComboBox();
this.btnVectorExp = new System.Windows.Forms.Button();
this.label8 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.chkToolTip = new System.Windows.Forms.CheckBox();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.txtYToolFormat = new System.Windows.Forms.TextBox();
this.txtXToolFormat = new System.Windows.Forms.TextBox();
this.label9 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.tbPercentWidth)).BeginInit();
this.SuspendLayout();
//
// label1
//
resources.ApplyResources(this.label1, "label1");
this.label1.Name = "label1";
//
// label2
//
resources.ApplyResources(this.label2, "label2");
this.label2.Name = "label2";
//
// label3
//
resources.ApplyResources(this.label3, "label3");
this.label3.Name = "label3";
//
// label4
//
resources.ApplyResources(this.label4, "label4");
this.label4.Name = "label4";
//
// cbChartType
//
resources.ApplyResources(this.cbChartType, "cbChartType");
this.cbChartType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbChartType.Items.AddRange(new object[] {
resources.GetString("cbChartType.Items"),
resources.GetString("cbChartType.Items1"),
resources.GetString("cbChartType.Items2"),
resources.GetString("cbChartType.Items3"),
resources.GetString("cbChartType.Items4"),
resources.GetString("cbChartType.Items5"),
resources.GetString("cbChartType.Items6"),
resources.GetString("cbChartType.Items7"),
resources.GetString("cbChartType.Items8")});
this.cbChartType.Name = "cbChartType";
this.cbChartType.SelectedIndexChanged += new System.EventHandler(this.cbChartType_SelectedIndexChanged);
//
// cbSubType
//
resources.ApplyResources(this.cbSubType, "cbSubType");
this.cbSubType.Name = "cbSubType";
this.cbSubType.SelectedIndexChanged += new System.EventHandler(this.cbSubType_SelectedIndexChanged);
//
// cbPalette
//
resources.ApplyResources(this.cbPalette, "cbPalette");
this.cbPalette.Items.AddRange(new object[] {
resources.GetString("cbPalette.Items"),
resources.GetString("cbPalette.Items1"),
resources.GetString("cbPalette.Items2"),
resources.GetString("cbPalette.Items3"),
resources.GetString("cbPalette.Items4"),
resources.GetString("cbPalette.Items5"),
resources.GetString("cbPalette.Items6"),
resources.GetString("cbPalette.Items7"),
resources.GetString("cbPalette.Items8"),
resources.GetString("cbPalette.Items9")});
this.cbPalette.Name = "cbPalette";
this.cbPalette.SelectedIndexChanged += new System.EventHandler(this.cbPalette_SelectedIndexChanged);
//
// cbRenderElement
//
resources.ApplyResources(this.cbRenderElement, "cbRenderElement");
this.cbRenderElement.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbRenderElement.Items.AddRange(new object[] {
resources.GetString("cbRenderElement.Items"),
resources.GetString("cbRenderElement.Items1")});
this.cbRenderElement.Name = "cbRenderElement";
this.cbRenderElement.SelectedIndexChanged += new System.EventHandler(this.cbRenderElement_SelectedIndexChanged);
//
// label5
//
resources.ApplyResources(this.label5, "label5");
this.label5.Name = "label5";
//
// tbPercentWidth
//
resources.ApplyResources(this.tbPercentWidth, "tbPercentWidth");
this.tbPercentWidth.Name = "tbPercentWidth";
this.tbPercentWidth.ValueChanged += new System.EventHandler(this.tbPercentWidth_ValueChanged);
//
// label6
//
resources.ApplyResources(this.label6, "label6");
this.label6.Name = "label6";
//
// tbNoRows
//
resources.ApplyResources(this.tbNoRows, "tbNoRows");
this.tbNoRows.Name = "tbNoRows";
this.tbNoRows.TextChanged += new System.EventHandler(this.tbNoRows_TextChanged);
//
// label7
//
resources.ApplyResources(this.label7, "label7");
this.label7.Name = "label7";
//
// cbDataSet
//
resources.ApplyResources(this.cbDataSet, "cbDataSet");
this.cbDataSet.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbDataSet.Name = "cbDataSet";
this.cbDataSet.SelectedIndexChanged += new System.EventHandler(this.cbDataSet_SelectedIndexChanged);
//
// chkPageBreakStart
//
resources.ApplyResources(this.chkPageBreakStart, "chkPageBreakStart");
this.chkPageBreakStart.Name = "chkPageBreakStart";
this.chkPageBreakStart.CheckedChanged += new System.EventHandler(this.chkPageBreakStart_CheckedChanged);
//
// chkPageBreakEnd
//
resources.ApplyResources(this.chkPageBreakEnd, "chkPageBreakEnd");
this.chkPageBreakEnd.Name = "chkPageBreakEnd";
this.chkPageBreakEnd.CheckedChanged += new System.EventHandler(this.chkPageBreakEnd_CheckedChanged);
//
// cbChartData
//
resources.ApplyResources(this.cbChartData, "cbChartData");
this.cbChartData.Name = "cbChartData";
this.cbChartData.TextChanged += new System.EventHandler(this.cbChartData_Changed);
//
// cbDataLabel
//
resources.ApplyResources(this.cbDataLabel, "cbDataLabel");
this.cbDataLabel.Name = "cbDataLabel";
this.cbDataLabel.TextChanged += new System.EventHandler(this.cbChartData_Changed);
//
// chkDataLabel
//
resources.ApplyResources(this.chkDataLabel, "chkDataLabel");
this.chkDataLabel.Name = "chkDataLabel";
this.chkDataLabel.UseVisualStyleBackColor = true;
this.chkDataLabel.CheckedChanged += new System.EventHandler(this.chkDataLabel_CheckedChanged);
//
// bDataLabelExpr
//
resources.ApplyResources(this.bDataLabelExpr, "bDataLabelExpr");
this.bDataLabelExpr.Name = "bDataLabelExpr";
this.bDataLabelExpr.UseVisualStyleBackColor = true;
this.bDataLabelExpr.Click += new System.EventHandler(this.bDataLabelExpr_Click);
//
// lData1
//
resources.ApplyResources(this.lData1, "lData1");
this.lData1.Name = "lData1";
//
// cbChartData2
//
resources.ApplyResources(this.cbChartData2, "cbChartData2");
this.cbChartData2.Name = "cbChartData2";
this.cbChartData2.TextChanged += new System.EventHandler(this.cbChartData_Changed);
//
// lData2
//
resources.ApplyResources(this.lData2, "lData2");
this.lData2.Name = "lData2";
//
// cbChartData3
//
resources.ApplyResources(this.cbChartData3, "cbChartData3");
this.cbChartData3.Name = "cbChartData3";
this.cbChartData3.TextChanged += new System.EventHandler(this.cbChartData_Changed);
//
// lData3
//
resources.ApplyResources(this.lData3, "lData3");
this.lData3.Name = "lData3";
//
// bDataExpr
//
resources.ApplyResources(this.bDataExpr, "bDataExpr");
this.bDataExpr.Name = "bDataExpr";
this.bDataExpr.Tag = "d1";
this.bDataExpr.Click += new System.EventHandler(this.bDataExpr_Click);
//
// bDataExpr3
//
resources.ApplyResources(this.bDataExpr3, "bDataExpr3");
this.bDataExpr3.Name = "bDataExpr3";
this.bDataExpr3.Tag = "d3";
this.bDataExpr3.Click += new System.EventHandler(this.bDataExpr_Click);
//
// bDataExpr2
//
resources.ApplyResources(this.bDataExpr2, "bDataExpr2");
this.bDataExpr2.Name = "bDataExpr2";
this.bDataExpr2.Tag = "d2";
this.bDataExpr2.Click += new System.EventHandler(this.bDataExpr_Click);
//
// cbVector
//
resources.ApplyResources(this.cbVector, "cbVector");
this.cbVector.Items.AddRange(new object[] {
resources.GetString("cbVector.Items"),
resources.GetString("cbVector.Items1")});
this.cbVector.Name = "cbVector";
this.cbVector.SelectedIndexChanged += new System.EventHandler(this.cbVector_SelectedIndexChanged);
//
// btnVectorExp
//
resources.ApplyResources(this.btnVectorExp, "btnVectorExp");
this.btnVectorExp.Name = "btnVectorExp";
this.btnVectorExp.Tag = "d4";
this.btnVectorExp.Click += new System.EventHandler(this.bDataExpr_Click);
//
// label8
//
resources.ApplyResources(this.label8, "label8");
this.label8.Name = "label8";
//
// button1
//
resources.ApplyResources(this.button1, "button1");
this.button1.Name = "button1";
this.button1.Tag = "d7";
this.button1.Click += new System.EventHandler(this.bDataExpr_Click);
//
// button2
//
resources.ApplyResources(this.button2, "button2");
this.button2.Name = "button2";
this.button2.Tag = "d5";
this.button2.Click += new System.EventHandler(this.bDataExpr_Click);
//
// button3
//
resources.ApplyResources(this.button3, "button3");
this.button3.Name = "button3";
this.button3.Tag = "d6";
this.button3.Click += new System.EventHandler(this.bDataExpr_Click);
//
// chkToolTip
//
resources.ApplyResources(this.chkToolTip, "chkToolTip");
this.chkToolTip.Name = "chkToolTip";
this.chkToolTip.UseVisualStyleBackColor = true;
this.chkToolTip.CheckedChanged += new System.EventHandler(this.chkToolTip_CheckedChanged);
//
// checkBox1
//
resources.ApplyResources(this.checkBox1, "checkBox1");
this.checkBox1.Name = "checkBox1";
this.checkBox1.UseVisualStyleBackColor = true;
this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
//
// txtYToolFormat
//
resources.ApplyResources(this.txtYToolFormat, "txtYToolFormat");
this.txtYToolFormat.Name = "txtYToolFormat";
this.txtYToolFormat.TextChanged += new System.EventHandler(this.txtYToolFormat_TextChanged);
//
// txtXToolFormat
//
resources.ApplyResources(this.txtXToolFormat, "txtXToolFormat");
this.txtXToolFormat.Name = "txtXToolFormat";
this.txtXToolFormat.TextChanged += new System.EventHandler(this.txtXToolFormat_TextChanged);
//
// label9
//
resources.ApplyResources(this.label9, "label9");
this.label9.Name = "label9";
//
// label10
//
resources.ApplyResources(this.label10, "label10");
this.label10.Name = "label10";
//
// ChartCtl
//
resources.ApplyResources(this, "$this");
this.Controls.Add(this.cbDataLabel);
this.Controls.Add(this.chkPageBreakStart);
this.Controls.Add(this.chkDataLabel);
this.Controls.Add(this.label10);
this.Controls.Add(this.label9);
this.Controls.Add(this.txtXToolFormat);
this.Controls.Add(this.txtYToolFormat);
this.Controls.Add(this.checkBox1);
this.Controls.Add(this.chkToolTip);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.label8);
this.Controls.Add(this.btnVectorExp);
this.Controls.Add(this.cbVector);
this.Controls.Add(this.bDataExpr2);
this.Controls.Add(this.bDataExpr3);
this.Controls.Add(this.bDataExpr);
this.Controls.Add(this.cbChartData3);
this.Controls.Add(this.lData3);
this.Controls.Add(this.cbChartData2);
this.Controls.Add(this.lData2);
this.Controls.Add(this.bDataLabelExpr);
this.Controls.Add(this.cbChartData);
this.Controls.Add(this.lData1);
this.Controls.Add(this.chkPageBreakEnd);
this.Controls.Add(this.cbDataSet);
this.Controls.Add(this.label7);
this.Controls.Add(this.tbNoRows);
this.Controls.Add(this.label6);
this.Controls.Add(this.tbPercentWidth);
this.Controls.Add(this.label5);
this.Controls.Add(this.cbRenderElement);
this.Controls.Add(this.cbPalette);
this.Controls.Add(this.cbSubType);
this.Controls.Add(this.cbChartType);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Name = "ChartCtl";
((System.ComponentModel.ISupportInitialize)(this.tbPercentWidth)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
public bool IsValid()
{
return true;
}
public void Apply()
{
// take information in control and apply to all the style nodes
// Only change information that has been marked as modified;
// this way when group is selected it is possible to change just
// the items you want and keep the rest the same.
foreach (XmlNode riNode in this._ReportItems)
ApplyChanges(riNode);
// No more changes
//AJM GJL 14082008
fChartType = fVector = fSubtype = fPalette = fRenderElement = fPercentWidth =
fNoRows = fDataSet = fPageBreakStart = fPageBreakEnd = fChartData = ftooltip = ftooltipX = ftooltip = ftooltipX = false;
}
public void ApplyChanges(XmlNode node)
{
if (fChartType)
{
_Draw.SetElement(node, "Type", this.cbChartType.Text);
}
if (ftooltip)//now controls the displaying of Y value
{
_Draw.SetElement(node, "fyi:Tooltip", this.chkToolTip.Checked.ToString());
}
if (ftooltipX)// controls the displaying of X value
{
_Draw.SetElement(node, "fyi:TooltipX", this.chkToolTip.Checked.ToString());
}
if (tooltipXFormat)
{
_Draw.SetElement(node, "fyi:TooltipXFormat", this.txtXToolFormat.Text);
}
if (tooltipYFormat)
{
_Draw.SetElement(node, "fyi:TooltipYFormat", this.txtYToolFormat.Text);
}
if (fVector) //AJM GJL 14082008
{
_Draw.SetElement(node, "fyi:RenderAsVector", this.cbVector.Text);
}
if (fSubtype)
{
_Draw.SetElement(node, "Subtype", this.cbSubType.Text);
}
if (fPalette)
{
_Draw.SetElement(node, "Palette", this.cbPalette.Text);
}
if (fRenderElement)
{
_Draw.SetElement(node, "ChartElementOutput", this.cbRenderElement.Text);
}
if (fPercentWidth)
{
_Draw.SetElement(node, "PointWidth", this.tbPercentWidth.Text);
}
if (fNoRows)
{
_Draw.SetElement(node, "NoRows", this.tbNoRows.Text);
}
if (fDataSet)
{
_Draw.SetElement(node, "DataSetName", this.cbDataSet.Text);
}
if (fPageBreakStart)
{
_Draw.SetElement(node, "PageBreakAtStart", this.chkPageBreakStart.Checked? "true": "false");
}
if (fPageBreakEnd)
{
_Draw.SetElement(node, "PageBreakAtEnd", this.chkPageBreakEnd.Checked? "true": "false");
}
if (fChartData)
{
//
//
//
//
//
//
// =Sum(Fields!Sales.Value)
// --- you can have up to 3 DataValue elements
//
//
//
//
//
//
//
//
//
XmlNode chartdata = _Draw.SetElement(node, "ChartData", null);
XmlNode chartseries = _Draw.SetElement(chartdata, "ChartSeries", null);
XmlNode datapoints = _Draw.SetElement(chartseries, "DataPoints", null);
XmlNode datapoint = _Draw.SetElement(datapoints, "DataPoint", null);
XmlNode datavalues = _Draw.SetElement(datapoint, "DataValues", null);
_Draw.RemoveElementAll(datavalues, "DataValue");
XmlNode datalabel = _Draw.SetElement(datapoint, "DataLabel", null);
XmlNode datavalue = _Draw.SetElement(datavalues, "DataValue", null);
_Draw.SetElement(datavalue, "Value", this.cbChartData.Text);
string type = cbChartType.Text.ToLowerInvariant();
if (type == "scatter" || type == "bubble")
{
datavalue = _Draw.CreateElement(datavalues, "DataValue", null);
_Draw.SetElement(datavalue, "Value", this.cbChartData2.Text);
if (type == "bubble")
{
datavalue = _Draw.CreateElement(datavalues, "DataValue", null);
_Draw.SetElement(datavalue, "Value", this.cbChartData3.Text);
}
}
_Draw.SetElement(datalabel, "Value", this.cbDataLabel.Text);
_Draw.SetElement(datalabel, "Visible", this.chkDataLabel.Checked.ToString());
}
}
private void cbChartType_SelectedIndexChanged(object sender, System.EventArgs e)
{
fChartType = true;
// Change the potential sub-types
string savesub = cbSubType.Text;
string[] subItems = new string [] {"Plain"};
bool bEnableY = false;
bool bEnableBubble = false;
switch (cbChartType.Text)
{
case "Column":
subItems = new string [] {"Plain", "Stacked", "PercentStacked"};
break;
case "Bar":
subItems = new string [] {"Plain", "Stacked", "PercentStacked"};
break;
case "Line":
subItems = new string [] {"Plain", "Smooth"};
break;
case "Pie":
subItems = new string [] {"Plain", "Exploded"};
break;
case "Area":
subItems = new string [] {"Plain", "Stacked"};
break;
case "Doughnut":
break;
case "Map":
subItems = RdlDesigner.MapSubtypes;
break;
case "Scatter":
subItems = new string [] {"Plain", "Line", "SmoothLine"};
bEnableY = true;
break;
case "Stock":
break;
case "Bubble":
bEnableY = bEnableBubble = true;
break;
default:
break;
}
cbSubType.Items.Clear();
cbSubType.Items.AddRange(subItems);
lData2.Enabled = cbChartData2.Enabled = bDataExpr2.Enabled = bEnableY;
lData3.Enabled = cbChartData3.Enabled = bDataExpr3.Enabled = bEnableBubble;
int i=0;
foreach (string s in subItems)
{
if (s == savesub)
{
cbSubType.SelectedIndex = i;
return;
}
i++;
}
// Didn't match old style
cbSubType.SelectedIndex = 0;
}
//AJM GJL 14082008
private void cbVector_SelectedIndexChanged(object sender, EventArgs e)
{
fVector = true;
}
private void cbSubType_SelectedIndexChanged(object sender, System.EventArgs e)
{
fSubtype = true;
}
private void cbPalette_SelectedIndexChanged(object sender, System.EventArgs e)
{
fPalette = true;
}
private void cbRenderElement_SelectedIndexChanged(object sender, System.EventArgs e)
{
fRenderElement = true;
}
private void tbPercentWidth_ValueChanged(object sender, System.EventArgs e)
{
fPercentWidth = true;
}
private void tbNoRows_TextChanged(object sender, System.EventArgs e)
{
fNoRows = true;
}
private void cbDataSet_SelectedIndexChanged(object sender, System.EventArgs e)
{
fDataSet = true;
}
private void chkPageBreakStart_CheckedChanged(object sender, System.EventArgs e)
{
fPageBreakStart = true;
}
private void chkPageBreakEnd_CheckedChanged(object sender, System.EventArgs e)
{
fPageBreakEnd = true;
}
private void cbChartData_Changed(object sender, System.EventArgs e)
{
fChartData = true;
}
private void bDataExpr_Click(object sender, System.EventArgs e)
{
Button bs = sender as Button;
if (bs == null)
return;
Control ctl = null;
switch (bs.Tag as string)
{
case "d1":
ctl = cbChartData;
break;
case "d2":
ctl = cbChartData2;
break;
case "d3":
ctl = cbChartData3;
break;
//AJM GJL 14082008
case "d4":
ctl = cbVector;
fVector = true;
break;
case "d5":
ctl = cbChartType;
fChartType = true;
break;
case "d6":
ctl = cbPalette;
fPalette = true;
break;
case "d7":
ctl = cbSubType;
fSubtype = true;
break;
default:
return;
}
DialogExprEditor ee = new DialogExprEditor(_Draw, ctl.Text, _ReportItems[0], false);
try
{
DialogResult dlgr = ee.ShowDialog();
if (dlgr == DialogResult.OK)
{
ctl.Text = ee.Expression;
fChartData = true;
}
}
finally
{
ee.Dispose();
}
}
private void chkDataLabel_CheckedChanged(object sender, EventArgs e)
{
cbDataLabel.Enabled = bDataLabelExpr.Enabled = chkDataLabel.Checked;
}
private void bDataLabelExpr_Click(object sender, EventArgs e)
{
DialogExprEditor ee = new DialogExprEditor(_Draw, cbDataLabel.Text,_ReportItems[0] , false);
try
{
if (ee.ShowDialog() == DialogResult.OK)
{
cbDataLabel.Text = ee.Expression;
}
}
finally
{
ee.Dispose();
}
return;
}
private void chkToolTip_CheckedChanged(object sender, EventArgs e)
{
ftooltip = true;
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
ftooltipX = true;
}
private void txtYToolFormat_TextChanged(object sender, EventArgs e)
{
tooltipYFormat = true;
}
private void txtXToolFormat_TextChanged(object sender, EventArgs e)
{
tooltipXFormat = true;
}
}
}
================================================
FILE: RdlDesign/ChartCtl.resx
================================================
text/microsoft-resx
2.0
System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
2
System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
cbDataLabel
$this
26
29
System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Data Set Name
31
fx
25
System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
100, 23
19, 249
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
$this
2
255, 21
14
32
$this
MiddleLeft
22, 21
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
75, 17
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
251, 9
$this
21
Scatter
lData1
True
156, 104
Output
16, 12
16, 62
42, 19
17
lData3
415, 153
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
331, 253
cbPalette
16, 182
System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
$this
30
134, 24
255, 21
1
label10
Map
$this
48, 20
12
137, 23
Bubble Size
22, 21
255, 21
275, 31
Percent width for Bars/Columns (>100% causes column overlap)
33
15
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
78, 20
$this
156, 228
Pie
16
cbChartData
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
80, 21
DataLabel
19, 231
22, 21
72, 16
38
MiddleLeft
39
13
53, 23
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
415, 228
31
128, 16
tbPercentWidth
331, 9
Line
Doughnut
$this
Default
16, 37
19
5
System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
340, 19
21
System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
19, 272
16, 207
MiddleLeft
254, 21
cbRenderElement
134, 24
$this
4
286, 256
22, 21
22, 21
19
16, 104
28
System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
True
fx
$this
$this
$this
fx
bDataLabelExpr
True
$this
363, 80
System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
SemiTransparent
chkPageBreakStart
72, 16
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
label8
24
30
Arial, 8.25pt, style=Bold, Italic
System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
False
17
100, 23
24
EarthTones
MiddleLeft
14
$this
label1
Y Coordinate
12
330, 34
label7
9
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
$this
False
Chart Type
Y Tooltips?
415, 178
100, 23
$this
1
Arial, 8.25pt, style=Bold, Italic
11
GrayScale
$this
True
X Tooltips?
Sub-type
NoOutput
78, 20
23
28
156, 178
fx
fx
275, 12
$this
3
3
label2
10
Custom
$this
22
53, 27
Chart Data (X Coordinate)
22
79, 17
cbSubType
System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
False
126, 59
Arial, 8.25pt, style=Bold, Italic
Palette
$this
txtYToolFormat
9
System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
$this
415, 9
18
lData2
$this
201, 255
2
Bubble
button1
Page Break at End
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
chkDataLabel
System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
156, 153
255, 21
fx
Area
18
Page Break at Start
button2
fx
chkToolTip
$this
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
34
79, 17
$this
Arial, 8.25pt, style=Bold, Italic
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
23
201, 274
20
button3
Render As Vector
8
cbDataSet
txtXToolFormat
$this
cbChartType
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
3
29
$this
MiddleLeft
5
Arial, 8.25pt, style=Bold, Italic
ChartCtl
System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
cbChartData2
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Light
11
$this
8
$this
25
fx
7
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
100, 23
22, 21
251, 34
$this
cbChartData3
22, 21
415, 33
checkBox1
tbNoRows
20
6
1
No Rows Message
$this
27
System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
80, 21
System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
$this
6
16, 157
$this
$this
10
12
Render XML Element
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Excel
4
Format
0
42, 19
chkPageBreakEnd
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
126, 34
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
MiddleLeft
440, 303
20
126, 9
$this
27
bDataExpr2
35
PatternedBlack
156, 203
286, 276
$this
255, 20
8
121, 21
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
bDataExpr3
$this
System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
32
Format
cbVector
label4
331, 273
16
Bar
bDataExpr
36
label5
MiddleLeft
0
System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
$this
$this
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
label3
$this
Arial, 8.25pt, style=Bold, Italic
16, 84
$this
False
Arial, 8.25pt, style=Bold, Italic
121, 21
415, 203
Column
Pastel
Patterned
Arial, 8.25pt, style=Bold, Italic
13
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
26
7
16, 130
37
0
System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
22, 21
label6
156, 128
btnVectorExp
label9
10
121, 21
True
================================================
FILE: RdlDesign/ChartCtl.ru-RU.resx
================================================
text/microsoft-resx
2.0
System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
16, 10
100, 16
Тип диаграммы
MiddleLeft
16, 35
100, 16
Палитра
MiddleLeft
16, 53
100, 31
Выводить XML-элемент
MiddleLeft
364, 19
% ширины бары/столбцы (> 100% вызывает перекрытие столбцов)
122, 9
354, 9
122, 34
122, 59
282, 9
66, 19
Подтип
MiddleRight
386, 82
157, 23
Сообщение, когда нет строк
179, 105
157, 23
Набор данных
179, 129
176, 24
Разрывать страницу вначале
176, 24
Разрывать страницу вконце
179, 154
180, 229
98, 17
Матка данных
439, 228
16, 150
157, 29
Данные диаграммы (X-координата)
179, 179
157, 23
Y-координата
179, 204
157, 23
Размер пузырька
439, 153
439, 203
439, 178
353, 34
439, 33
279, 31
72, 27
Выводить как вектор
MiddleRight
439, 9
249, 9
249, 34
96, 17
Y-подсказки?
96, 17
X-подсказки?
356, 253
356, 273
299, 254
51, 19
Формат
299, 275
51, 19
Формат
480, 303
================================================
FILE: RdlDesign/ChartLegendCtl.cs
================================================
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using System.Xml;
namespace Majorsilence.Reporting.RdlDesign
{
///
/// Summary description for ChartCtl.
///
internal class ChartLegendCtl : System.Windows.Forms.UserControl, IProperty
{
private List _ReportItems;
private DesignXmlDraw _Draw;
bool fVisible, fLayout, fPosition, fInsidePlotArea;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ComboBox cbPosition;
private System.Windows.Forms.ComboBox cbLayout;
private System.Windows.Forms.CheckBox chkVisible;
private System.Windows.Forms.CheckBox chkInsidePlotArea;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
internal ChartLegendCtl(DesignXmlDraw dxDraw, List ris)
{
_ReportItems = ris;
_Draw = dxDraw;
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
// Initialize form using the style node values
InitValues();
}
private void InitValues()
{
XmlNode node = _ReportItems[0];
this.cbPosition.Text = _Draw.GetElementValue(node, "Position", "RightTop");
this.cbLayout.Text = _Draw.GetElementValue(node, "Layout", "Column");
this.chkVisible.Checked = _Draw.GetElementValue(node, "Visible", "false").ToLower() == "true"? true: false;
this.chkInsidePlotArea.Checked = _Draw.GetElementValue(node, "InsidePlotArea", "false").ToLower() == "true"? true: false;
fVisible = fLayout = fPosition = fInsidePlotArea = false;
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Component Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ChartLegendCtl));
this.DoubleBuffered = true;
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.cbPosition = new System.Windows.Forms.ComboBox();
this.cbLayout = new System.Windows.Forms.ComboBox();
this.chkVisible = new System.Windows.Forms.CheckBox();
this.chkInsidePlotArea = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// label1
//
resources.ApplyResources(this.label1, "label1");
this.label1.Name = "label1";
//
// label2
//
resources.ApplyResources(this.label2, "label2");
this.label2.Name = "label2";
//
// cbPosition
//
resources.ApplyResources(this.cbPosition, "cbPosition");
this.cbPosition.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbPosition.Items.AddRange(new object[] {
resources.GetString("cbPosition.Items"),
resources.GetString("cbPosition.Items1"),
resources.GetString("cbPosition.Items2"),
resources.GetString("cbPosition.Items3"),
resources.GetString("cbPosition.Items4"),
resources.GetString("cbPosition.Items5"),
resources.GetString("cbPosition.Items6"),
resources.GetString("cbPosition.Items7"),
resources.GetString("cbPosition.Items8"),
resources.GetString("cbPosition.Items9"),
resources.GetString("cbPosition.Items10"),
resources.GetString("cbPosition.Items11")});
this.cbPosition.Name = "cbPosition";
this.cbPosition.SelectedIndexChanged += new System.EventHandler(this.cbPosition_SelectedIndexChanged);
//
// cbLayout
//
resources.ApplyResources(this.cbLayout, "cbLayout");
this.cbLayout.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbLayout.Items.AddRange(new object[] {
resources.GetString("cbLayout.Items"),
resources.GetString("cbLayout.Items1"),
resources.GetString("cbLayout.Items2")});
this.cbLayout.Name = "cbLayout";
this.cbLayout.SelectedIndexChanged += new System.EventHandler(this.cbLayout_SelectedIndexChanged);
//
// chkVisible
//
resources.ApplyResources(this.chkVisible, "chkVisible");
this.chkVisible.Name = "chkVisible";
this.chkVisible.CheckedChanged += new System.EventHandler(this.chkVisible_CheckedChanged);
//
// chkInsidePlotArea
//
resources.ApplyResources(this.chkInsidePlotArea, "chkInsidePlotArea");
this.chkInsidePlotArea.Name = "chkInsidePlotArea";
this.chkInsidePlotArea.CheckedChanged += new System.EventHandler(this.chkInsidePlotArea_CheckedChanged);
//
// ChartLegendCtl
//
resources.ApplyResources(this, "$this");
this.Controls.Add(this.chkInsidePlotArea);
this.Controls.Add(this.chkVisible);
this.Controls.Add(this.cbLayout);
this.Controls.Add(this.cbPosition);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Name = "ChartLegendCtl";
this.ResumeLayout(false);
}
#endregion
public bool IsValid()
{
return true;
}
public void Apply()
{
// take information in control and apply to all the style nodes
// Only change information that has been marked as modified;
// this way when group is selected it is possible to change just
// the items you want and keep the rest the same.
foreach (XmlNode riNode in this._ReportItems)
ApplyChanges(riNode);
// No more changes
fVisible = fLayout = fPosition = fInsidePlotArea = false;
}
public void ApplyChanges(XmlNode node)
{
if (fVisible)
{
_Draw.SetElement(node, "Visible", this.chkVisible.Checked? "true": "false");
}
if (fLayout)
{
_Draw.SetElement(node, "Layout", this.cbLayout.Text);
}
if (fPosition)
{
_Draw.SetElement(node, "Position", this.cbPosition.Text);
}
if (fInsidePlotArea)
{
_Draw.SetElement(node, "InsidePlotArea", this.chkInsidePlotArea.Checked? "true": "false");
}
}
private void cbPosition_SelectedIndexChanged(object sender, System.EventArgs e)
{
fPosition = true;
}
private void cbLayout_SelectedIndexChanged(object sender, System.EventArgs e)
{
fLayout = true;
}
private void chkVisible_CheckedChanged(object sender, System.EventArgs e)
{
fVisible = true;
}
private void chkInsidePlotArea_CheckedChanged(object sender, System.EventArgs e)
{
fInsidePlotArea = true;
}
}
}
================================================
FILE: RdlDesign/ChartLegendCtl.resx
================================================
text/microsoft-resx
2.0
System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
16, 80
Position in Chart
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Column
ChartLegendCtl
104, 16
label1
16, 50
System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
$this
Row
$this
2
15
$this
Visible
cbLayout
$this
144, 16
5
0
$this
1
BottomLeft
16, 18
136, 24
4
112, 16
System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
14
121, 21
1
chkInsidePlotArea
TopLeft
136, 24
16, 112
RightBottom
BottomRight
LeftCenter
LeftBottom
RightTop
RightCenter
TopCenter
TopRight
LeftTop
Table
cbPosition
440, 288
System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Layout within Legend
4
0
System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
144, 48
3
Draw Inside Plot Area
label2
6
chkVisible
121, 21
System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
BottomCenter
$this
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
True
================================================
FILE: RdlDesign/ChartLegendCtl.ru-RU.resx
================================================
text/microsoft-resx
2.0
System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
146, 16
Позиция в диаграмме
146, 16
Расположение в легенде
168, 15
168, 47
Видимая
170, 24
Рисовать внутри участка
================================================
FILE: RdlDesign/CodeCtl.cs
================================================
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using System.Text;
using System.Xml;
using System.IO;
using System.Threading;
using System.Reflection;
using System.CodeDom;
using System.CodeDom.Compiler;
using Microsoft.VisualBasic;
using Majorsilence.Reporting.RdlDesign.Resources;
namespace Majorsilence.Reporting.RdlDesign
{
///
/// Summary description for CodeCtl.
///
internal class CodeCtl : System.Windows.Forms.UserControl, IProperty
{
static internal long Counter; // counter used for unique expression count
private DesignXmlDraw _Draw;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button bCheckSyntax;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.TextBox tbCode;
private System.Windows.Forms.ListBox lbErrors;
private System.Windows.Forms.Label label2;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
internal CodeCtl(DesignXmlDraw dxDraw)
{
_Draw = dxDraw;
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
// Initialize form using the style node values
InitValues();
}
private void InitValues()
{
XmlNode rNode = _Draw.GetReportNode();
XmlNode cNode = _Draw.GetNamedChildNode(rNode, "Code");
tbCode.Text = "";
if (cNode == null)
return;
StringReader tr = new StringReader(cNode.InnerText);
List ar = new List();
while (tr.Peek() >= 0)
{
string line = tr.ReadLine();
ar.Add(line);
}
tr.Close();
// tbCode.Lines = ar.ToArray("".GetType()) as string[];
tbCode.Lines = ar.ToArray();
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Component Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CodeCtl));
this.DoubleBuffered = true;
this.label1 = new System.Windows.Forms.Label();
this.bCheckSyntax = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
this.tbCode = new System.Windows.Forms.TextBox();
this.lbErrors = new System.Windows.Forms.ListBox();
this.label2 = new System.Windows.Forms.Label();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// label1
//
resources.ApplyResources(this.label1, "label1");
this.label1.Name = "label1";
//
// bCheckSyntax
//
resources.ApplyResources(this.bCheckSyntax, "bCheckSyntax");
this.bCheckSyntax.Name = "bCheckSyntax";
this.bCheckSyntax.Click += new System.EventHandler(this.bCheckSyntax_Click);
//
// panel1
//
resources.ApplyResources(this.panel1, "panel1");
this.panel1.Controls.Add(this.tbCode);
this.panel1.Controls.Add(this.lbErrors);
this.panel1.Name = "panel1";
//
// tbCode
//
this.tbCode.AcceptsReturn = true;
this.tbCode.AcceptsTab = true;
resources.ApplyResources(this.tbCode, "tbCode");
this.tbCode.HideSelection = false;
this.tbCode.Name = "tbCode";
//
// lbErrors
//
resources.ApplyResources(this.lbErrors, "lbErrors");
this.lbErrors.Name = "lbErrors";
this.lbErrors.SelectedIndexChanged += new System.EventHandler(this.lbErrors_SelectedIndexChanged);
//
// label2
//
resources.ApplyResources(this.label2, "label2");
this.label2.Name = "label2";
//
// CodeCtl
//
resources.ApplyResources(this, "$this");
this.Controls.Add(this.label2);
this.Controls.Add(this.panel1);
this.Controls.Add(this.bCheckSyntax);
this.Controls.Add(this.label1);
this.Name = "CodeCtl";
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.ResumeLayout(false);
}
#endregion
public bool IsValid()
{
return true;
}
public void Apply()
{
XmlNode rNode = _Draw.GetReportNode();
if (tbCode.Text.Trim().Length > 0)
_Draw.SetElement(rNode, "Code", tbCode.Text);
else
_Draw.RemoveElement(rNode, "Code");
}
private void bCheckSyntax_Click(object sender, System.EventArgs e)
{
CheckAssembly();
}
private void CheckAssembly()
{
lbErrors.Items.Clear(); // clear out existing items
// Generate the proxy source code
List lines = new List(); // hold lines in array in case of error
VBCodeProvider vbcp = new VBCodeProvider();
StringBuilder sb = new StringBuilder();
// Generate code with the following general form
//Imports System
//Imports Microsoft.VisualBasic
//Imports System.Convert
//Imports System.Math
//Namespace Majorsilence.Reporting.vbgen
//Public Class MyClassn // where n is a uniquely generated integer
//Sub New()
//End Sub
// ' this is the code in the tag
//End Class
//End Namespace
string unique = Interlocked.Increment(ref CodeCtl.Counter).ToString();
lines.Add("Imports System");
lines.Add("Imports Microsoft.VisualBasic");
lines.Add("Imports System.Convert");
lines.Add("Imports System.Math");
lines.Add("Imports Majorsilence.Reporting.Rdl");
lines.Add("Namespace Majorsilence.Reporting.vbgen");
string classname = "MyClass" + unique;
lines.Add("Public Class " + classname);
lines.Add("Private Shared _report As CodeReport");
lines.Add("Sub New()");
lines.Add("End Sub");
lines.Add("Sub New(byVal def As Report)");
lines.Add(classname + "._report = New CodeReport(def)");
lines.Add("End Sub");
lines.Add("Public Shared ReadOnly Property Report As CodeReport");
lines.Add("Get");
lines.Add("Return " + classname + "._report");
lines.Add("End Get");
lines.Add("End Property");
int pre_lines = lines.Count; // number of lines prior to user VB code
// Read and write code as lines
StringReader tr = new StringReader(this.tbCode.Text);
while (tr.Peek() >= 0)
{
string line = tr.ReadLine();
lines.Add(line);
}
tr.Close();
lines.Add("End Class");
lines.Add("End Namespace");
foreach (string l in lines)
{
sb.Append(l);
sb.Append(Environment.NewLine);
}
string vbcode = sb.ToString();
// Create Assembly
CompilerParameters cp = new CompilerParameters();
cp.ReferencedAssemblies.Add("System.dll");
string re = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Majorsilence.Reporting.RdlEngine.dll"); // Issue #35
cp.ReferencedAssemblies.Add(re);
// also allow access to classes that have been added to report
XmlNode rNode = _Draw.GetReportNode();
XmlNode cNode = _Draw.GetNamedChildNode(rNode, "CodeModules");
if (cNode != null)
{
foreach (XmlNode xn in cNode.ChildNodes)
{
if (xn.Name != "CodeModule")
continue;
cp.ReferencedAssemblies.Add(xn.InnerText);
}
}
cp.GenerateExecutable = false;
cp.GenerateInMemory = true;
cp.IncludeDebugInformation = false;
CompilerResults cr = vbcp.CompileAssemblyFromSource(cp, vbcode);
if(cr.Errors.Count > 0)
{
StringBuilder err = new StringBuilder(string.Format("Code has {0} error(s).", cr.Errors.Count));
foreach (CompilerError ce in cr.Errors)
{
lbErrors.Items.Add(string.Format("Ln {0}- {1}", ce.Line - pre_lines, ce.ErrorText));
}
}
else
MessageBox.Show(Resources.Strings.CodeCtl_Show_NoErrors, Resources.Strings.CodeCtl_Show_CodeVerification);
return ;
}
private void lbErrors_SelectedIndexChanged(object sender, System.EventArgs e)
{
if (lbErrors.Items.Count == 0)
return;
string line = lbErrors.Items[lbErrors.SelectedIndex] as string;
if (!line.StartsWith("Ln"))
return;
int l = line.IndexOf('-');
if (l < 0)
return;
line = line.Substring(3, l-3);
try
{
int i = Convert.ToInt32(line);
Goto(i);
}
catch {} // we don't care about the error
return;
}
public void Goto(int nLine)
{
int offset = 0;
nLine = Math.Min(nLine, tbCode.Lines.Length); // don't go off the end
for ( int i = 0; i < nLine - 1 && i < tbCode.Lines.Length; ++i )
offset += (this.tbCode.Lines[i].Length + 2);
Control savectl = this.ActiveControl;
tbCode.Focus();
tbCode.Select( offset, this.tbCode.Lines[nLine > 0? nLine-1: 0].Length);
this.ActiveControl = savectl;
}
}
}
================================================
FILE: RdlDesign/CodeCtl.resx
================================================
text/microsoft-resx
2.0
System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Visual Basic Function Code
System.Windows.Forms.ListBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
True
5, 252
2
panel1
Top, Bottom, Left
bCheckSyntax
System.Windows.Forms.Splitter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
label1
Both
Top, Bottom, Left, Right
False
1
0
439, 252
panel1
1
4
1
$this
System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
3
0, 0
0
5
144, 16
Check Syntax
panel1
0
82, 23
365, 3
$this
87, 0
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
1
$this
Top, Bottom, Left, Right
0
System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Top, Right
label2
True
System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
panel1
98, 6
472, 288
Msgs
69, 15
2
15, 7
$this
82, 252
0, 0
tbCode
13, 31
lbErrors
CodeCtl
352, 252
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
False
2
splitter1
True
================================================
FILE: RdlDesign/CodeCtl.ru-RU.resx
================================================
text/microsoft-resx
2.0
System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
97, 6
161, 16
Код функции на Visual Basic
350, 3
97, 23
Проверить код
Сообщения
================================================
FILE: RdlDesign/ColorPicker.cs
================================================
using System.Drawing;
using System.Windows.Forms;
namespace Majorsilence.Reporting.RdlDesign
{
///
/// It's very crazy control. Need replace it. TODO
///
public class ColorPicker : ComboBox
{
private const int RECTCOLOR_LEFT = 4;
private const int RECTCOLOR_TOP = 2;
private const int RECTCOLOR_WIDTH = 10;
ColorPickerPopup _DropListBox;
public ColorPicker()
{
DrawMode = DrawMode.OwnerDrawFixed;
DropDownStyle = ComboBoxStyle.DropDownList; // DropDownList
DropDownHeight = 1;
Font = new Font("Arial", 8, FontStyle.Bold | FontStyle.Italic);
_DropListBox = new ColorPickerPopup(this);
if (!DesignMode)
{
Items.AddRange(StaticLists.ColorList);
}
}
public override string Text
{
get
{
return base.Text;
}
set
{
string v = value == null ? "" : value;
if (!this.Items.Contains(v)) // make sure item is always in the list
this.Items.Add(v);
base.Text = v;
}
}
protected override void OnDrawItem(DrawItemEventArgs e)
{
Graphics g = e.Graphics;
Color BlockColor = Color.Empty;
int left = RECTCOLOR_LEFT;
if (e.State == DrawItemState.Selected || e.State == DrawItemState.None)
e.DrawBackground();
if (e.Index == -1)
{
BlockColor = SelectedIndex < 0 ? BackColor : DesignerUtility.ColorFromHtml(this.Text, Color.Empty);
}
else
BlockColor = DesignerUtility.ColorFromHtml((string)this.Items[e.Index], Color.Empty);
// Fill rectangle
if (BlockColor.IsEmpty && this.Text.StartsWith("="))
{
g.DrawString("fx", this.Font, Brushes.Black, e.Bounds);
}
else
{
g.FillRectangle(new SolidBrush(BlockColor), left, e.Bounds.Top + RECTCOLOR_TOP, RECTCOLOR_WIDTH,
ItemHeight - 2 * RECTCOLOR_TOP);
}
base.OnDrawItem(e);
}
protected override void OnDropDown(System.EventArgs e)
{
_DropListBox.Location = this.PointToScreen(new Point(0, this.Height));
_DropListBox.Show();
}
}
}
================================================
FILE: RdlDesign/ColorPickerPopup.Designer.cs
================================================
using System;
using System.Windows.Forms;
using System.Drawing;
using System.ComponentModel;
using System.Collections;
namespace Majorsilence.Reporting.RdlDesign
{
public partial class ColorPickerPopup : System.Windows.Forms.Form
{
#region Windows Form Designer generated code
ColorPicker _ColorPicker;
private Label lStatus;
private System.ComponentModel.Container components = null;
private void InitializeComponent()
{
this.lStatus = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// lStatus
//
this.lStatus.Dock = System.Windows.Forms.DockStyle.Bottom;
this.lStatus.Location = new System.Drawing.Point(0, 174);
this.lStatus.Name = "lStatus";
this.lStatus.Size = new System.Drawing.Size(233, 13);
this.lStatus.TabIndex = 0;
this.lStatus.Text = "Color";
//
// ColorPickerPopup
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.CausesValidation = false;
this.ClientSize = new System.Drawing.Size(233, 187);
this.ControlBox = false;
this.Controls.Add(this.lStatus);
this.DoubleBuffered = true;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "ColorPickerPopup";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.TopMost = true;
this.Deactivate += new System.EventHandler(this.lbColors_Hide);
this.Load += new System.EventHandler(this.ColorPickerPopup_Load);
this.Shown += new System.EventHandler(this.ColorPickerPopup_Shown);
this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ColorPickerPopup_KeyPress);
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.ColorPickerPopup_MouseMove);
this.Leave += new System.EventHandler(this.lbColors_Hide);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.ColorPickerPopup_MouseDown);
this.ResumeLayout(false);
}
#endregion
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
}
}
================================================
FILE: RdlDesign/ColorPickerPopup.cs
================================================
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace Majorsilence.Reporting.RdlDesign
{
///
/// Summary description for DialogNew.
///
public partial class ColorPickerPopup
{
private const int ITEM_HEIGHT = 12;
private const int ITEM_PAD = 2;
public ColorPickerPopup(ColorPicker cp)
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
lStatus.Text = "";
_ColorPicker = cp;
}
protected override void OnPaint(PaintEventArgs e)
{
Graphics g = e.Graphics;
//base.OnPaint(e);
int row = 0;
int col = 0;
int max_rows = MaxRows;
int max_cols = MaxColumns;
int col_width = ColumnWidth;
foreach (string c in StaticLists.ColorListColorSort)
{
Color clr = DesignerUtility.ColorFromHtml(c, Color.Empty);
g.FillRectangle(new SolidBrush(clr),
new Rectangle((col * col_width)+ITEM_PAD, (row * ITEM_HEIGHT)+ITEM_PAD, col_width-ITEM_PAD, ITEM_HEIGHT-ITEM_PAD));
row++;
if (row >= max_rows)
{
row = 0;
col++;
}
}
}
private void lbColors_Hide(object sender, EventArgs e)
{
this.Hide();
}
private void ColorPickerPopup_MouseDown(object sender, MouseEventArgs e)
{
int col = e.Location.X / ColumnWidth;
int row = e.Location.Y / ITEM_HEIGHT;
int item = col * MaxRows + row;
if (item >= StaticLists.ColorListColorSort.Length)
return;
_ColorPicker.Text = StaticLists.ColorListColorSort[item];
this.Hide();
}
private void ColorPickerPopup_MouseMove(object sender, MouseEventArgs e)
{
string status;
if (e.Location.Y > this.Height - lStatus.Height) // past bottom of rectangle
status = "";
else
{ // calc position in box
int col = e.Location.X / ColumnWidth;
int row = e.Location.Y / ITEM_HEIGHT;
int item = col * MaxRows + row;
status = item >= StaticLists.ColorListColorSort.Length ? "" : StaticLists.ColorListColorSort[item] as string;
}
lStatus.Text = status;
}
private int MaxRows
{
get { return (this.Height - lStatus.Height) / ITEM_HEIGHT; }
}
private int MaxColumns
{
get
{
int max_rows = MaxRows;
return (StaticLists.ColorListColorSort.Length / max_rows) + (StaticLists.ColorListColorSort.Length % max_rows == 0 ? 0 : 1);
}
}
private int ColumnWidth
{
get { return this.Width / MaxColumns; }
}
private void ColorPickerPopup_Shown(object sender, EventArgs e)
{
lStatus.Text = _ColorPicker.Text;
}
private void ColorPickerPopup_KeyPress(object sender, KeyPressEventArgs e)
{
if ((int)e.KeyChar == (int)System.Windows.Forms.Keys.Escape)
{
Hide();
}
}
private void ColorPickerPopup_Load(object sender, EventArgs e)
{
}
}
}
================================================
FILE: RdlDesign/ColorPickerPopup.resx
================================================
text/microsoft-resx
2.0
System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
================================================
FILE: RdlDesign/Conversions.cs
================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Majorsilence.Reporting.RdlDesign
{
public class Conversions
{
public static int MeasurementTypeAsHundrethsOfAnInch(string value)
{
string measurementType = value.Trim().ToLower();
string measurementValue = "0";
if (measurementType.Length >= 2)
{
measurementValue = measurementType.Substring(0, measurementType.Length - 2);
measurementType = measurementType.Substring(measurementType.Length - 2);
}
if (measurementType == "mm")
{
// metric. Convert to imperial for now
return (int)((decimal.Parse(measurementValue) / 25.4m) * 100);
}
else if(measurementType == "in")
{
// assume imperial
return (int)(decimal.Parse(measurementValue) * 100);
}
throw new Exception("Invalid measurment type. mm and in are only supported types");
}
}
}
================================================
FILE: RdlDesign/CustomReportItemCtl.cs
================================================
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using System.Xml;
using System.Text;
using System.IO;
using System.Reflection;
using Majorsilence.Reporting.Rdl;
namespace Majorsilence.Reporting.RdlDesign
{
///
/// CustomReportItemCtl provides property values for a CustomReportItem
///
internal class CustomReportItemCtl : System.Windows.Forms.UserControl, IProperty
{
private List _ReportItems;
private DesignXmlDraw _Draw;
private string _Type;
private PropertyGrid pgProps;
private Button bExpr;
private XmlNode _RiNode;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
internal CustomReportItemCtl(DesignXmlDraw dxDraw, List reportItems)
{
_Draw = dxDraw;
this._ReportItems = reportItems;
_Type = _Draw.GetElementValue(_ReportItems[0], "Type", "");
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
// Initialize form using the style node values
InitValues();
}
private void InitValues()
{
ICustomReportItem cri=null;
try
{
cri = RdlEngineConfig.CreateCustomReportItem(_Type);
_RiNode = _Draw.GetNamedChildNode(_ReportItems[0], "CustomProperties").Clone();
object props = cri.GetPropertiesInstance(_RiNode);
pgProps.SelectedObject = props;
}
catch
{
return;
}
finally
{
if (cri != null)
cri.Dispose();
}
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Component Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CustomReportItemCtl));
this.DoubleBuffered = true;
this.pgProps = new System.Windows.Forms.PropertyGrid();
this.bExpr = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// pgProps
//
resources.ApplyResources(this.pgProps, "pgProps");
this.pgProps.Name = "pgProps";
//
// bExpr
//
resources.ApplyResources(this.bExpr, "bExpr");
this.bExpr.Name = "bExpr";
this.bExpr.Tag = "sd";
this.bExpr.Click += new System.EventHandler(this.bExpr_Click);
//
// CustomReportItemCtl
//
this.Controls.Add(this.bExpr);
this.Controls.Add(this.pgProps);
this.Name = "CustomReportItemCtl";
resources.ApplyResources(this, "$this");
this.ResumeLayout(false);
}
#endregion
public bool IsValid()
{
return true;
}
public void Apply()
{
ICustomReportItem cri = null;
try
{
cri = RdlEngineConfig.CreateCustomReportItem(_Type);
foreach (XmlNode node in _ReportItems)
{
cri.SetPropertiesInstance(_Draw.GetNamedChildNode(node, "CustomProperties"),
pgProps.SelectedObject);
}
}
catch
{
return;
}
finally
{
if (cri != null)
cri.Dispose();
}
return;
}
private void bExpr_Click(object sender, EventArgs e)
{
GridItem gi = this.pgProps.SelectedGridItem;
XmlNode sNode = _ReportItems[0];
DialogExprEditor ee = new DialogExprEditor(_Draw, gi.Value.ToString(), sNode, false);
try
{
DialogResult dr = ee.ShowDialog();
if (dr == DialogResult.OK)
{
// There's probably a better way without reflection but this works fine.
object sel = pgProps.SelectedObject;
gi.PropertyDescriptor.SetValue(sel, ee.Expression);
gi.Select();
}
}
finally
{
ee.Dispose();
}
}
}
}
================================================
FILE: RdlDesign/CustomReportItemCtl.resx
================================================
text/microsoft-resx
2.0
System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
13, 17
406, 260
3
pgProps
System.Windows.Forms.PropertyGrid, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
$this
1
Arial, 8.25pt, style=Bold, Italic
422, 57
22, 16
4
fx
MiddleLeft
bExpr
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
$this
0
True
464, 304
CustomReportItemCtl
System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
================================================
FILE: RdlDesign/DataSetRowsCtl.Designer.cs
================================================
namespace Majorsilence.Reporting.RdlDesign
{
partial class DataSetRowsCtl
{
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Component Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DataSetRowsCtl));
this.DoubleBuffered = true;
this.dgRows = new System.Windows.Forms.DataGridView();
this.bDelete = new System.Windows.Forms.Button();
this.bUp = new System.Windows.Forms.Button();
this.bDown = new System.Windows.Forms.Button();
this.chkRowsFile = new System.Windows.Forms.CheckBox();
this.tbRowsFile = new System.Windows.Forms.TextBox();
this.bRowsFile = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.bLoad = new System.Windows.Forms.Button();
this.bClear = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.dgRows)).BeginInit();
this.SuspendLayout();
//
// dgRows
//
resources.ApplyResources(this.dgRows, "dgRows");
this.dgRows.DataMember = "";
this.dgRows.Name = "dgRows";
//
// bDelete
//
resources.ApplyResources(this.bDelete, "bDelete");
this.bDelete.Name = "bDelete";
this.bDelete.Click += new System.EventHandler(this.bDelete_Click);
//
// bUp
//
resources.ApplyResources(this.bUp, "bUp");
this.bUp.Name = "bUp";
this.bUp.Click += new System.EventHandler(this.bUp_Click);
//
// bDown
//
resources.ApplyResources(this.bDown, "bDown");
this.bDown.Name = "bDown";
this.bDown.Click += new System.EventHandler(this.bDown_Click);
//
// chkRowsFile
//
resources.ApplyResources(this.chkRowsFile, "chkRowsFile");
this.chkRowsFile.Name = "chkRowsFile";
this.chkRowsFile.CheckedChanged += new System.EventHandler(this.chkRowsFile_CheckedChanged);
//
// tbRowsFile
//
resources.ApplyResources(this.tbRowsFile, "tbRowsFile");
this.tbRowsFile.Name = "tbRowsFile";
//
// bRowsFile
//
resources.ApplyResources(this.bRowsFile, "bRowsFile");
this.bRowsFile.Name = "bRowsFile";
this.bRowsFile.Click += new System.EventHandler(this.bRowsFile_Click);
//
// label1
//
resources.ApplyResources(this.label1, "label1");
this.label1.ForeColor = System.Drawing.Color.Maroon;
this.label1.Name = "label1";
//
// bLoad
//
resources.ApplyResources(this.bLoad, "bLoad");
this.bLoad.Name = "bLoad";
this.bLoad.Click += new System.EventHandler(this.bLoad_Click);
//
// bClear
//
resources.ApplyResources(this.bClear, "bClear");
this.bClear.Name = "bClear";
this.bClear.Click += new System.EventHandler(this.bClear_Click);
//
// DataSetRowsCtl
//
resources.ApplyResources(this, "$this");
this.Controls.Add(this.bClear);
this.Controls.Add(this.bLoad);
this.Controls.Add(this.label1);
this.Controls.Add(this.bRowsFile);
this.Controls.Add(this.tbRowsFile);
this.Controls.Add(this.chkRowsFile);
this.Controls.Add(this.bDown);
this.Controls.Add(this.bUp);
this.Controls.Add(this.bDelete);
this.Controls.Add(this.dgRows);
this.Name = "DataSetRowsCtl";
this.VisibleChanged += new System.EventHandler(this.DataSetRowsCtl_VisibleChanged);
((System.ComponentModel.ISupportInitialize)(this.dgRows)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button bDelete;
private System.Windows.Forms.Button bUp;
private System.Windows.Forms.Button bDown;
private System.Windows.Forms.CheckBox chkRowsFile;
private System.Windows.Forms.Button bRowsFile;
private System.Windows.Forms.DataGridView dgRows;
private System.Windows.Forms.TextBox tbRowsFile;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button bLoad;
private System.Windows.Forms.Button bClear;
}
}
================================================
FILE: RdlDesign/DataSetRowsCtl.cs
================================================
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using System.Xml;
using System.Text;
using System.IO;
using System.Globalization;
using Majorsilence.Reporting.RdlDesign.Resources;
namespace Majorsilence.Reporting.RdlDesign
{
///
/// Control supports the properties for DataSet/Rows elements. This is an extension to
/// the RDL specification allowing data to be defined within a report.
///
internal partial class DataSetRowsCtl : System.Windows.Forms.UserControl, IProperty
{
private DesignXmlDraw _Draw;
private DataSetValues _dsv;
private XmlNode _dsNode;
private DataTable _DataTable;
internal DataSetRowsCtl(DesignXmlDraw dxDraw, XmlNode dsNode, DataSetValues dsv)
{
_Draw = dxDraw;
_dsv = dsv;
_dsNode = dsNode;
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
// Initialize form using the style node values
InitValues();
}
private void InitValues()
{
CreateDataTable(); // create data table based on the existing fields
XmlNode rows = _Draw.GetNamedChildNode(_dsNode, "Rows");
if (rows == null)
rows = _Draw.GetNamedChildNode(_dsNode, "fyi:Rows");
string file=null;
if (rows != null)
{
file = _Draw.GetElementAttribute(rows, "File", null);
PopulateRows(rows);
}
this.dgRows.DataSource = _DataTable;
if (file != null)
{
tbRowsFile.Text = file;
this.chkRowsFile.Checked = true;
}
chkRowsFile_CheckedChanged(this, new EventArgs());
}
private void CreateDataTable()
{
_DataTable = new DataTable();
foreach (DataRow dr in _dsv.Fields.Rows)
{
if (dr[0] == DBNull.Value)
continue;
if (dr[2] == DBNull.Value)
{}
else if (((string) dr[2]).Length > 0)
continue;
string name = (string) dr[0];
string type = dr["TypeName"] as string;
Type t = type == null || type.Length == 0? typeof(string):
Majorsilence.Reporting.Rdl.DataType.GetStyleType(type);
_DataTable.Columns.Add(new DataColumn(name,t));
}
}
private void PopulateRows(XmlNode rows)
{
object[] rowValues = new object[_DataTable.Columns.Count];
bool bSkipMsg = false;
foreach (XmlNode rNode in rows.ChildNodes)
{
if (rNode.Name != "Row")
continue;
int col=0;
bool bBuiltRow=false; // if all columns will be null we won't add the row
foreach (DataColumn dc in _DataTable.Columns)
{
XmlNode dNode = _Draw.GetNamedChildNode(rNode, dc.ColumnName);
if (dNode != null)
bBuiltRow = true;
if (dNode == null)
rowValues[col] = null;
else if (dc.DataType == typeof(string))
rowValues[col] = dNode.InnerText;
else
{
object box;
try
{
if (dc.DataType == typeof(int))
box = Convert.ToInt32(dNode.InnerText, NumberFormatInfo.InvariantInfo);
else if (dc.DataType == typeof(decimal))
box = Convert.ToDecimal(dNode.InnerText, NumberFormatInfo.InvariantInfo);
else if (dc.DataType == typeof(long))
box = Convert.ToInt64(dNode.InnerText, NumberFormatInfo.InvariantInfo);
else if (DesignerUtility.IsNumeric(dc.DataType)) // catch all numeric
box = Convert.ToDouble(dNode.InnerText, NumberFormatInfo.InvariantInfo);
else if (dc.DataType == typeof(DateTime))
{
box = Convert.ToDateTime(dNode.InnerText,
System.Globalization.DateTimeFormatInfo.InvariantInfo);
}
else
{
box = dNode.InnerText;
}
rowValues[col] = box;
}
catch (Exception e)
{
if (!bSkipMsg)
{
if (MessageBox.Show(string.Format(Strings.DataSetRowsCtl_ShowB_UnableConvert,
dc.DataType, dNode.InnerText, e.Message) + Environment.NewLine + Strings.DataSetRowsCtl_ShowB_WantSeeErrors,
Strings.DataSetRowsCtl_ShowB_ErrorReadingDataRows, MessageBoxButtons.YesNo) == DialogResult.No)
bSkipMsg = true;
}
rowValues[col] = dNode.InnerText;
}
}
col++;
}
if (bBuiltRow)
_DataTable.Rows.Add(rowValues);
}
}
public bool IsValid()
{
if (chkRowsFile.Checked && tbRowsFile.Text.Length == 0)
{
MessageBox.Show(Strings.DataSetRowsCtl_ShowC_FileNameRequired);
return false;
}
return true;
}
public void Apply()
{
// Remove the old row
XmlNode rows = _Draw.GetNamedChildNode(this._dsNode, "Rows");
if (rows == null)
rows = _Draw.GetNamedChildNode(this._dsNode, "fyi:Rows");
if (rows != null)
_dsNode.RemoveChild(rows);
// different result if we just want the file
if (this.chkRowsFile.Checked)
{
rows = _Draw.GetCreateNamedChildNode(_dsNode, "fyi:Rows");
_Draw.SetElementAttribute(rows, "File", this.tbRowsFile.Text);
}
else
{
rows = GetXmlData();
if (rows.HasChildNodes)
_dsNode.AppendChild(rows);
}
}
private void bDelete_Click(object sender, System.EventArgs e)
{
this._DataTable.Rows.RemoveAt(this.dgRows.CurrentRow.Index);
}
private void bUp_Click(object sender, System.EventArgs e)
{
int cr = dgRows.CurrentRow.Index;
if (cr <= 0) // already at the top
return;
SwapRow(_DataTable.Rows[cr-1], _DataTable.Rows[cr]);
if (cr >= 0 && cr < dgRows.Rows.Count)
{
dgRows.CurrentCell = dgRows.Rows[cr - 1].Cells[0];
}
}
private void bDown_Click(object sender, System.EventArgs e)
{
int cr = dgRows.CurrentRow.Index;
if (cr < 0) // invalid index
return;
if (cr + 1 >= _DataTable.Rows.Count)
return; // already at end
SwapRow(_DataTable.Rows[cr+1], _DataTable.Rows[cr]);
if (cr >= 0 && cr < dgRows.Rows.Count)
{
dgRows.CurrentCell = dgRows.Rows[cr + 1].Cells[0];
}
}
private void SwapRow(DataRow tdr, DataRow fdr)
{
// Loop thru all the columns in a row and swap the data
for (int ci=0; ci < _DataTable.Columns.Count; ci++)
{
object save = tdr[ci];
tdr[ci] = fdr[ci];
fdr[ci] = save;
}
return;
}
private void chkRowsFile_CheckedChanged(object sender, System.EventArgs e)
{
this.tbRowsFile.Enabled = chkRowsFile.Checked;
this.bRowsFile.Enabled = chkRowsFile.Checked;
this.bDelete.Enabled = !chkRowsFile.Checked;
this.bUp.Enabled = !chkRowsFile.Checked;
this.bDown.Enabled = !chkRowsFile.Checked;
this.dgRows.Enabled = !chkRowsFile.Checked;
}
private void bRowsFile_Click(object sender, System.EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = Strings.DataSetRowsCtl_bRowsFile_Click_XMLFilesFilter;
ofd.FilterIndex = 1;
ofd.FileName = "*.xml";
ofd.Title = Strings.DataSetRowsCtl_bRowsFile_Click_XMLFilesTitle;
ofd.DefaultExt = "xml";
ofd.AddExtension = true;
try
{
if (ofd.ShowDialog() == DialogResult.OK)
{
string file = Path.GetFileName(ofd.FileName);
this.tbRowsFile.Text = file;
}
}
finally
{
ofd.Dispose();
}
}
private bool DidFieldsChange()
{
int col=0;
foreach (DataRow dr in _dsv.Fields.Rows)
{
if (col >= _DataTable.Columns.Count)
return true;
if (dr[0] == DBNull.Value)
continue;
if (dr[2] == DBNull.Value)
{}
else if (((string) dr[2]).Length > 0)
continue;
string name = (string) (dr[1] == DBNull.Value? dr[0]: dr[1]);
if (_DataTable.Columns[col].ColumnName != name)
return true;
col++;
}
if (col == _DataTable.Columns.Count)
return false;
else
return true;
}
private XmlNode GetXmlData()
{
XmlDocumentFragment fDoc = _Draw.ReportDocument.CreateDocumentFragment();
XmlNode rows = _Draw.CreateElement(fDoc, "fyi:Rows", null);
foreach (DataRow dr in _DataTable.Rows)
{
XmlNode row = _Draw.CreateElement(rows, "Row", null);
bool bRowBuilt=false;
foreach (DataColumn dc in _DataTable.Columns)
{
if (dr[dc] == DBNull.Value)
continue;
string val;
if (dc.DataType == typeof(DateTime))
{
val = Convert.ToString(dr[dc],
System.Globalization.DateTimeFormatInfo.InvariantInfo);
}
else
{
val = Convert.ToString(dr[dc], NumberFormatInfo.InvariantInfo);
}
if (val == null)
continue;
_Draw.CreateElement(row, dc.ColumnName, val);
bRowBuilt = true; // we've populated at least one column; so keep row
}
if (!bRowBuilt)
rows.RemoveChild(row);
}
return rows;
}
private void DataSetRowsCtl_VisibleChanged(object sender, System.EventArgs e)
{
if (!DidFieldsChange()) // did the structure of the fields change
return;
// Need to reset the data; this assumes that some of the data rows are similar
XmlNode rows = GetXmlData(); // get old data
CreateDataTable(); // this recreates the datatable
PopulateRows(rows); // repopulate the datatable
this.dgRows.DataSource = _DataTable; // this recreates the datatable so reset grid
}
private void bClear_Click(object sender, System.EventArgs e)
{
this._DataTable.Rows.Clear();
}
private void bLoad_Click(object sender, System.EventArgs e)
{
// Load the data from the SQL; we append the data to what already exists
try
{
// Obtain the connection information
XmlNode rNode = _Draw.GetReportNode();
XmlNode dsNode = _Draw.GetNamedChildNode(rNode, "DataSources");
if (dsNode == null)
return;
XmlNode datasource=null;
foreach (XmlNode dNode in dsNode)
{
if (dNode.Name != "DataSource")
continue;
XmlAttribute nAttr = dNode.Attributes["Name"];
if (nAttr == null) // shouldn't really happen
continue;
if (nAttr.Value != _dsv.DataSourceName)
continue;
datasource = dNode;
break;
}
if (datasource == null)
{
MessageBox.Show(string.Format(Strings.DataSetRowsCtl_Show_DatasourceNotFound, _dsv.DataSourceName), Strings.DataSetRowsCtl_Show_LoadFailed);
return;
}
// get the connection information
string connection = "";
string dataProvider = "";
string dataSourceReference = _Draw.GetElementValue(datasource, "DataSourceReference", null);
if (dataSourceReference != null)
{
// This is not very pretty code since it is assuming the structure of the windows parenting.
// But there isn't any other way to get this information from here.
Control p = _Draw;
MDIChild mc = null;
while (p != null && !(p is RdlDesigner))
{
if (p is MDIChild)
mc = (MDIChild)p;
p = p.Parent;
}
if (p == null || mc == null || mc.SourceFile == null)
{
MessageBox.Show(Strings.DataSetRowsCtl_ShowC_UnableLocateDSR);
return;
}
Uri filename = new Uri(Path.GetDirectoryName(mc.SourceFile.LocalPath) + Path.DirectorySeparatorChar + dataSourceReference);
if (!DesignerUtility.GetSharedConnectionInfo((RdlDesigner)p, filename.LocalPath, out dataProvider, out connection))
{
return;
}
}
else
{
XmlNode cpNode = DesignXmlDraw.FindNextInHierarchy(datasource, "ConnectionProperties", "ConnectString");
connection = cpNode == null ? "" : cpNode.InnerText;
XmlNode datap = DesignXmlDraw.FindNextInHierarchy(datasource, "ConnectionProperties", "DataProvider");
dataProvider = datap == null ? "" : datap.InnerText;
}
// Populate the data table
DesignerUtility.GetSqlData(dataProvider, connection, _dsv.CommandText, null, _DataTable);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, Strings.DataSetRowsCtl_Show_LoadFailed);
}
}
}
}
================================================
FILE: RdlDesign/DataSetRowsCtl.resx
================================================
text/microsoft-resx
2.0
System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Microsoft Sans Serif, 8pt
144, 10
7
Down
bClear
tbRowsFile
430, 212
430, 135
bRowsFile
Top, Right
8, 48
...
$this
label1
Top, Right
8, 10
$this
430, 77
chkRowsFile
72, 23
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
5
240, 20
3
bUp
dgTableStyle
10
$this
dgRows
72, 23
Top, Left, Right
9
421, 32
24, 23
Top, Right
2
8
System.Windows.Forms.DataGrid, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
430, 106
430, 48
Up
Delete
6
1
Top, Right
Load From SQL
System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
$this
72, 23
bDelete
8
bLoad
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.DataGridTableStyle, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
4
$this
$this
3, 272
Top, Right
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
4
2
72, 36
Bottom, Left
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
9
$this
7
Clear
System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
136, 20
1
Use XML file for data
400, 9
505, 304
$this
bDown
Top, Bottom, Left, Right
416, 221
0
System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
$this
$this
5
3
DataSetRowsCtl
6
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
72, 23
Top, Right
Warning: this panel supports an extension to the RDL specification. This information will be ignored in RDL processors other than in fyiReporting.
True
================================================
FILE: RdlDesign/DataSetRowsCtl.ru-RU.resx
================================================
text/microsoft-resx
2.0
System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Удалить
Вверх
Вниз
228, 20
Использовать XML файл для данных
242, 10
230, 20
478, 8
Предупреждение: эта панель поддерживает расширение к спецификации RDL. Эта информация будет игнорироваться в других RDL процессорах.
Загрузить из SQL
Очистить
================================================
FILE: RdlDesign/DataSetsCtl.Designer.cs
================================================
namespace Majorsilence.Reporting.RdlDesign
{
///
/// Summary description for StyleCtl.
///
partial class DataSetsCtl
{
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
///
/// Clean up any resources being used.
///
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}
#region Component Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DataSetsCtl));
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
this.DoubleBuffered = true;
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.panel2 = new System.Windows.Forms.Panel();
this.panel4 = new System.Windows.Forms.Panel();
this.scintillaSQL = new ScintillaNET.Scintilla();
this.panel3 = new System.Windows.Forms.Panel();
this.bRefresh = new System.Windows.Forms.Button();
this.bEditSQL = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
this.lDataSetName = new System.Windows.Forms.Label();
this.tbDSName = new System.Windows.Forms.TextBox();
this.tbTimeout = new System.Windows.Forms.NumericUpDown();
this.label3 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.cbDataSource = new System.Windows.Forms.ComboBox();
this.lDataSource = new System.Windows.Forms.Label();
this.bDeleteField = new System.Windows.Forms.Button();
this.dgFields = new System.Windows.Forms.DataGridView();
this.dgtbName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dgtbQueryName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dgtbValue = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dgtbTypeName = new System.Windows.Forms.DataGridViewComboBoxColumn();
this.label2 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.panel2.SuspendLayout();
this.panel4.SuspendLayout();
this.panel3.SuspendLayout();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.tbTimeout)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dgFields)).BeginInit();
this.SuspendLayout();
//
// splitContainer1
//
resources.ApplyResources(this.splitContainer1, "splitContainer1");
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.panel2);
this.splitContainer1.Panel1.Controls.Add(this.panel1);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.bDeleteField);
this.splitContainer1.Panel2.Controls.Add(this.dgFields);
this.splitContainer1.Panel2.Controls.Add(this.label2);
//
// panel2
//
this.panel2.Controls.Add(this.panel4);
this.panel2.Controls.Add(this.panel3);
resources.ApplyResources(this.panel2, "panel2");
this.panel2.Name = "panel2";
//
// panel4
//
this.panel4.Controls.Add(this.scintillaSQL);
resources.ApplyResources(this.panel4, "panel4");
this.panel4.Name = "panel4";
//
// scintillaSQL
//
resources.ApplyResources(this.scintillaSQL, "scintillaSQL");
this.scintillaSQL.Lexer = ScintillaNET.Lexer.Sql;
this.scintillaSQL.Name = "scintillaSQL";
this.scintillaSQL.UseTabs = false;
this.scintillaSQL.TextChanged += new System.EventHandler(this.tbSQL_TextChanged);
//
// panel3
//
this.panel3.Controls.Add(this.bRefresh);
this.panel3.Controls.Add(this.bEditSQL);
resources.ApplyResources(this.panel3, "panel3");
this.panel3.Name = "panel3";
//
// bRefresh
//
resources.ApplyResources(this.bRefresh, "bRefresh");
this.bRefresh.Name = "bRefresh";
this.bRefresh.Click += new System.EventHandler(this.bRefresh_Click);
//
// bEditSQL
//
resources.ApplyResources(this.bEditSQL, "bEditSQL");
this.bEditSQL.Name = "bEditSQL";
this.bEditSQL.Click += new System.EventHandler(this.bEditSQL_Click);
//
// panel1
//
this.panel1.Controls.Add(this.lDataSetName);
this.panel1.Controls.Add(this.tbDSName);
this.panel1.Controls.Add(this.tbTimeout);
this.panel1.Controls.Add(this.label3);
this.panel1.Controls.Add(this.label1);
this.panel1.Controls.Add(this.cbDataSource);
this.panel1.Controls.Add(this.lDataSource);
resources.ApplyResources(this.panel1, "panel1");
this.panel1.Name = "panel1";
//
// lDataSetName
//
resources.ApplyResources(this.lDataSetName, "lDataSetName");
this.lDataSetName.Name = "lDataSetName";
//
// tbDSName
//
resources.ApplyResources(this.tbDSName, "tbDSName");
this.tbDSName.Name = "tbDSName";
this.tbDSName.TextChanged += new System.EventHandler(this.tbDSName_TextChanged);
//
// tbTimeout
//
resources.ApplyResources(this.tbTimeout, "tbTimeout");
this.tbTimeout.Maximum = new decimal(new int[] {
2147483647,
0,
0,
0});
this.tbTimeout.Name = "tbTimeout";
this.tbTimeout.ValueChanged += new System.EventHandler(this.tbTimeout_ValueChanged);
//
// label3
//
resources.ApplyResources(this.label3, "label3");
this.label3.Name = "label3";
//
// label1
//
resources.ApplyResources(this.label1, "label1");
this.label1.Name = "label1";
//
// cbDataSource
//
resources.ApplyResources(this.cbDataSource, "cbDataSource");
this.cbDataSource.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbDataSource.Name = "cbDataSource";
this.cbDataSource.SelectedIndexChanged += new System.EventHandler(this.cbDataSource_SelectedIndexChanged);
//
// lDataSource
//
resources.ApplyResources(this.lDataSource, "lDataSource");
this.lDataSource.Name = "lDataSource";
//
// bDeleteField
//
resources.ApplyResources(this.bDeleteField, "bDeleteField");
this.bDeleteField.Name = "bDeleteField";
this.bDeleteField.Click += new System.EventHandler(this.bDeleteField_Click);
//
// dgFields
//
resources.ApplyResources(this.dgFields, "dgFields");
this.dgFields.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dgFields.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
this.dgFields.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.dgtbName,
this.dgtbQueryName,
this.dgtbValue,
this.dgtbTypeName});
this.dgFields.Name = "dgFields";
//
// dgtbName
//
this.dgtbName.DataPropertyName = "Name";
resources.ApplyResources(this.dgtbName, "dgtbName");
this.dgtbName.Name = "dgtbName";
//
// dgtbQueryName
//
this.dgtbQueryName.DataPropertyName = "QueryName";
resources.ApplyResources(this.dgtbQueryName, "dgtbQueryName");
this.dgtbQueryName.Name = "dgtbQueryName";
//
// dgtbValue
//
this.dgtbValue.DataPropertyName = "Value";
resources.ApplyResources(this.dgtbValue, "dgtbValue");
this.dgtbValue.Name = "dgtbValue";
//
// dgtbTypeName
//
this.dgtbTypeName.DataPropertyName = "TypeName";
resources.ApplyResources(this.dgtbTypeName, "dgtbTypeName");
this.dgtbTypeName.Items.AddRange(new object[] {
"System.String",
"System.Int16",
"System.Int32",
"System.Int64",
"System.UInt16",
"System.UInt32",
"System.UInt64",
"System.Single",
"System.Double",
"System.Decimal",
"System.DateTime",
"System.Char",
"System.Boolean",
"System.Byte"});
this.dgtbTypeName.Name = "dgtbTypeName";
this.dgtbTypeName.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.dgtbTypeName.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
//
// label2
//
resources.ApplyResources(this.label2, "label2");
this.label2.Name = "label2";
//
// DataSetsCtl
//
this.Controls.Add(this.splitContainer1);
resources.ApplyResources(this, "$this");
this.Name = "DataSetsCtl";
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.panel4.ResumeLayout(false);
this.panel3.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.tbTimeout)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dgFields)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.NumericUpDown tbTimeout;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button bRefresh;
private System.Windows.Forms.Button bEditSQL;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ComboBox cbDataSource;
private System.Windows.Forms.Label lDataSource;
private System.Windows.Forms.TextBox tbDSName;
private System.Windows.Forms.Label lDataSetName;
private System.Windows.Forms.Button bDeleteField;
private System.Windows.Forms.DataGridView dgFields;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.DataGridViewTextBoxColumn dgtbName;
private System.Windows.Forms.DataGridViewTextBoxColumn dgtbQueryName;
private System.Windows.Forms.DataGridViewTextBoxColumn dgtbValue;
private System.Windows.Forms.DataGridViewComboBoxColumn dgtbTypeName;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Panel panel4;
private ScintillaNET.Scintilla scintillaSQL;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.Panel panel1;
}
}
================================================
FILE: RdlDesign/DataSetsCtl.cs
================================================
using Majorsilence.Reporting.RdlDesign.Resources;
using Majorsilence.Reporting.RdlDesign.Syntax;
using System;
using System.Collections.Generic;
using System.Data;
using System.Windows.Forms;
using System.Xml;
namespace Majorsilence.Reporting.RdlDesign
{
///
/// Summary description for StyleCtl.
///
internal partial class DataSetsCtl : System.Windows.Forms.UserControl, IProperty
{
private bool _UseTypenameQualified = false;
private DesignXmlDraw _Draw;
private XmlNode _dsNode;
private DataSetValues _dsv;
internal DataSetsCtl(DesignXmlDraw dxDraw, XmlNode dsNode)
{
_Draw = dxDraw;
_dsNode = dsNode;
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
// Initialize form using the style node values
InitValues();
SetupScintilla();
}
internal DataSetValues DSV
{
get { return _dsv; }
}
private void InitValues()
{
//// cbDataSource
cbDataSource.Items.AddRange(_Draw.DataSourceNames);
//
// Obtain the existing DataSet info
//
XmlNode dNode = this._dsNode;
XmlAttribute nAttr = dNode.Attributes["Name"];
_dsv = new DataSetValues(nAttr == null ? "" : nAttr.Value);
_dsv.Node = dNode;
XmlNode ctNode = DesignXmlDraw.FindNextInHierarchy(dNode, "Query", "CommandText");
_dsv.CommandText = ctNode == null ? "" : ctNode.InnerText;
XmlNode datasource = DesignXmlDraw.FindNextInHierarchy(dNode, "Query", "DataSourceName");
_dsv.DataSourceName = datasource == null ? "" : datasource.InnerText;
XmlNode timeout = DesignXmlDraw.FindNextInHierarchy(dNode, "Query", "Timeout");
try
{
_dsv.Timeout = timeout == null ? 0 : Convert.ToInt32(timeout.InnerText);
}
catch // we don't stop just because timeout isn't convertable
{
_dsv.Timeout = 0;
}
// Get QueryParameters; they are loaded here but used by the QueryParametersCtl
_dsv.QueryParameters = new DataTable();
_dsv.QueryParameters.Columns.Add(new DataColumn("Name", typeof(string)));
_dsv.QueryParameters.Columns.Add(new DataColumn("Value", typeof(string)));
XmlNode qpNode = DesignXmlDraw.FindNextInHierarchy(dNode, "Query", "QueryParameters");
if (qpNode != null)
{
string[] rowValues = new string[2];
foreach (XmlNode qNode in qpNode.ChildNodes)
{
if (qNode.Name != "QueryParameter")
continue;
XmlAttribute xAttr = qNode.Attributes["Name"];
if (xAttr == null)
continue;
rowValues[0] = xAttr.Value;
rowValues[1] = _Draw.GetElementValue(qNode, "Value", "");
_dsv.QueryParameters.Rows.Add(rowValues);
}
}
// Get Fields
_dsv.Fields = new DataTable();
_dsv.Fields.Columns.Add(new DataColumn("Name", typeof(string)));
_dsv.Fields.Columns.Add(new DataColumn("QueryName", typeof(string)));
_dsv.Fields.Columns.Add(new DataColumn("Value", typeof(string)));
_dsv.Fields.Columns.Add(new DataColumn("TypeName", typeof(string)));
XmlNode fsNode = _Draw.GetNamedChildNode(dNode, "Fields");
if (fsNode != null)
{
string[] rowValues = new string[4];
foreach (XmlNode fNode in fsNode.ChildNodes)
{
if (fNode.Name != "Field")
continue;
XmlAttribute xAttr = fNode.Attributes["Name"];
if (xAttr == null)
continue;
rowValues[0] = xAttr.Value;
rowValues[1] = _Draw.GetElementValue(fNode, "DataField", "");
rowValues[2] = _Draw.GetElementValue(fNode, "Value", "");
string typename = null;
typename = _Draw.GetElementValue(fNode, "TypeName", null);
if (typename == null)
{
typename = _Draw.GetElementValue(fNode, "rd:TypeName", null);
if (typename != null)
_UseTypenameQualified = true; // we got it qualified so we'll generate qualified
}
if (typename != null && !dgtbTypeName.Items.Contains(typename))
{
dgtbTypeName.Items.Add(typename);
}
rowValues[3] = typename == null ? "" : typename;
_dsv.Fields.Rows.Add(rowValues);
}
}
this.tbDSName.Text = _dsv.Name;
this.scintillaSQL.Text = _dsv.CommandText.Replace("\r\n", "\n").Replace("\n", Environment.NewLine);
this.cbDataSource.Text = _dsv.DataSourceName;
this.tbTimeout.Value = _dsv.Timeout;
dgFields.DataSource = _dsv.Fields;
}
private void SetupScintilla()
{
new ScintillaSqlStyle(scintillaSQL);
}
public bool IsValid()
{
string nerr = _Draw.NameError(this._dsNode, this.tbDSName.Text);
if (nerr != null)
{
MessageBox.Show(nerr, Strings.DataSetsCtl_Show_Name, MessageBoxButtons.OK,MessageBoxIcon.Error);
return false;
}
return true;
}
public void Apply()
{
XmlNode rNode = _Draw.GetReportNode();
XmlNode dsNode = _Draw.GetNamedChildNode(rNode, "DataSets");
XmlNode dNode = this._dsNode;
// Create the name attribute
_Draw.SetElementAttribute(dNode, "Name", _dsv.Name);
_Draw.RemoveElement(dNode, "Query"); // get rid of old query
XmlNode qNode = _Draw.CreateElement(dNode, "Query", null);
_Draw.SetElement(qNode, "DataSourceName", _dsv.DataSourceName);
if (_dsv.Timeout > 0)
_Draw.SetElement(qNode, "Timeout", _dsv.Timeout.ToString());
_Draw.SetElement(qNode, "CommandText", _dsv.CommandText);
// Handle QueryParameters
_Draw.RemoveElement(qNode, "QueryParameters"); // get rid of old QueryParameters
XmlNode qpsNode = _Draw.CreateElement(qNode, "QueryParameters", null);
foreach (DataRow dr in _dsv.QueryParameters.Rows)
{
if (dr[0] == DBNull.Value || dr[1] == null || dr[1] == DBNull.Value)
continue;
string name = (string)dr[0];
if (name.Length <= 0)
continue;
XmlNode qpNode = _Draw.CreateElement(qpsNode, "QueryParameter", null);
_Draw.SetElementAttribute(qpNode, "Name", name);
_Draw.SetElement(qpNode, "Value", (string)dr[1]);
}
if (!qpsNode.HasChildNodes) // if no parameters we don't need to define them
_Draw.RemoveElement(qNode, "QueryParameters");
// Handle Fields
_Draw.RemoveElement(dNode, "Fields"); // get rid of old Fields
XmlNode fsNode = _Draw.CreateElement(dNode, "Fields", null);
foreach (DataRow dr in _dsv.Fields.Rows)
{
if (dr[0] == DBNull.Value)
continue;
if (dr[1] == DBNull.Value && dr[2] == DBNull.Value)
continue;
XmlNode fNode = _Draw.CreateElement(fsNode, "Field", null);
_Draw.SetElementAttribute(fNode, "Name", (string)dr[0]);
if (dr[1] != DBNull.Value &&
dr[1] is string &&
(string)dr[1] != string.Empty)
_Draw.SetElement(fNode, "DataField", (string)dr[1]);
else if (dr[2] != DBNull.Value &&
dr[2] is string &&
(string)dr[2] != string.Empty)
_Draw.SetElement(fNode, "Value", (string)dr[2]);
else
_Draw.SetElement(fNode, "DataField", (string)dr[0]); // make datafield same as name
// Handle typename if any
if (dr[3] != DBNull.Value &&
dr[3] is string &&
(string)dr[3] != string.Empty)
{
_Draw.SetElement(fNode, _UseTypenameQualified ? "rd:TypeName" : "TypeName", (string)dr[3]);
}
}
}
private void tbDSName_TextChanged(object sender, System.EventArgs e)
{
_dsv.Name = tbDSName.Text;
}
private void cbDataSource_SelectedIndexChanged(object sender, System.EventArgs e)
{
_dsv.DataSourceName = cbDataSource.Text;
}
private void tbSQL_TextChanged(object sender, System.EventArgs e)
{
_dsv.CommandText = scintillaSQL.Text;
}
private void bDeleteField_Click(object sender, System.EventArgs e)
{
if (this.dgFields.CurrentRow.Index < 0)
return;
_dsv.Fields.Rows.RemoveAt(this.dgFields.CurrentRow.Index);
}
private void bRefresh_Click(object sender, System.EventArgs e)
{
// Need to clear all the fields and then replace with the columns
// of the SQL statement
List cols = DesignerUtility.GetSqlColumns(_Draw, cbDataSource.Text, scintillaSQL.Text, _dsv.QueryParameters);
if (cols == null || cols.Count <= 0)
return; // something didn't work right
_dsv.Fields.Rows.Clear();
string[] rowValues = new string[4];
foreach (SqlColumn sc in cols)
{
rowValues[0] = sc.Name;
rowValues[1] = sc.Name;
rowValues[2] = "";
DataGridViewComboBoxColumn TypeColumn = (dgFields.Columns[3] as DataGridViewComboBoxColumn);
if (!TypeColumn.Items.Contains(sc.DataType.FullName))
{
TypeColumn.Items.Add(sc.DataType.FullName);
}
rowValues[3] = sc.DataType.FullName;
_dsv.Fields.Rows.Add(rowValues);
}
}
private void bEditSQL_Click(object sender, System.EventArgs e)
{
SQLCtl sc = new SQLCtl(_Draw, cbDataSource.Text, this.scintillaSQL.Text, _dsv.QueryParameters);
try
{
DialogResult dr = sc.ShowDialog(this);
if (dr == DialogResult.OK)
{
scintillaSQL.Text = sc.SQL;
}
}
finally
{
sc.Dispose();
}
}
private void tbTimeout_ValueChanged(object sender, System.EventArgs e)
{
_dsv.Timeout = Convert.ToInt32(tbTimeout.Value);
}
}
internal class DataSetValues
{
string _Name;
string _DataSourceName;
string _CommandText;
int _Timeout;
DataTable _QueryParameters;
// of type DSQueryParameter
DataTable _Fields;
XmlNode _Node;
internal DataSetValues(string name)
{
_Name = name;
}
internal string Name
{
get { return _Name; }
set { _Name = value; }
}
internal string DataSourceName
{
get { return _DataSourceName; }
set { _DataSourceName = value; }
}
internal string CommandText
{
get { return _CommandText; }
set { _CommandText = value; }
}
internal int Timeout
{
get { return _Timeout; }
set { _Timeout = value; }
}
internal DataTable QueryParameters
{
get { return _QueryParameters; }
set { _QueryParameters = value; }
}
internal XmlNode Node
{
get { return _Node; }
set { _Node = value; }
}
internal DataTable Fields
{
get { return _Fields; }
set { _Fields = value; }
}
override public string ToString()
{
return _Name;
}
}
}
================================================
FILE: RdlDesign/DataSetsCtl.resx
================================================
text/microsoft-resx
2.0
System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Fill
0, 0
Horizontal
Fill
0, 0
406, 120
39
SQL
scintillaSQL
ScintillaNET.Scintilla, ScintillaNET, Version=3.5.6.0, Culture=neutral, PublicKeyToken=null
panel4
0
Fill
0, 0
406, 120
40
panel4
System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
panel2
0
Top
0, 23
74, 34
33
Refresh Fields
bRefresh
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
panel3
0
Top
0, 0
74, 23
32
SQL...
bEditSQL
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
panel3
1
Right
406, 0
74, 120
39
panel3
System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
panel2
1
Fill
0, 59
480, 120
40
panel2
System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
splitContainer1.Panel1
0
3, 7
70, 16
34
Name
MiddleRight
lDataSetName
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
panel1
0
74, 5
144, 20
28
tbDSName
System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
panel1
1
Top, Right
321, 32
154, 20
30
True
tbTimeout
System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
panel1
2
Top, Right
195, 34
120, 15
37
Timeout
MiddleRight
label3
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
panel1
3
3, 40
200, 13
36
SQL Select
label1
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
panel1
4
Top, Right
321, 5
156, 21
29
cbDataSource
System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
panel1
5
Top, Right
198, 7
118, 19
35
Data Source
MiddleRight
lDataSource
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
panel1
6
Top
0, 0
480, 59
39
panel1
System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
splitContainer1.Panel1
1
splitContainer1.Panel1
System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
splitContainer1
0
120
Top, Right
409, 16
71, 23
27
Delete
bDeleteField
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
splitContainer1.Panel2
0
Top, Bottom, Left, Right
True
Name
True
Query Column Name
True
Value
True
TypeName
3, 16
406, 98
26
dgFields
System.Windows.Forms.DataGridView, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
splitContainer1.Panel2
1
3, 0
100, 16
28
Fields
label2
System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
splitContainer1.Panel2
2
splitContainer1.Panel2
System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
splitContainer1
1
480, 300
179
28
splitContainer1
System.Windows.Forms.SplitContainer, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
$this
0
True
480, 300
480, 300
dgtbName
System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
dgtbQueryName
System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
dgtbValue
System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
dgtbTypeName
System.Windows.Forms.DataGridViewComboBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
dataGridTableStyle1
System.Windows.Forms.DataGridTableStyle, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
DataSetsCtl
System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
================================================
FILE: RdlDesign/DataSetsCtl.ru-RU.resx
================================================
text/microsoft-resx
2.0
System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Время ожидания
405, 77
70, 34
Обновить поля
405, 46
70, 23
SQL-запрос
Источник данных
Название
405, 16
70, 23
Удалить
Название
Столбец запроса
Значение
Тип
7, 23
392, 121
9, 8
Поля
480, 300
================================================
FILE: RdlDesign/DesignCtl.Designer.cs
================================================
using System;
using System.Windows.Forms;
using System.Drawing;
using System.ComponentModel;
using System.Collections;
namespace Majorsilence.Reporting.RdlDesign
{
public partial class DesignCtl : System.Windows.Forms.UserControl
{
private ContextMenuStrip ContextMenuDefault;
private System.ComponentModel.IContainer components;
private ToolStripMenuItem MenuDefaultProperties;
private ToolStripSeparator toolStripMenuItem1;
private ToolStripMenuItem MenuDefaultCopy;
private ToolStripMenuItem MenuDefaultPaste;
private ToolStripMenuItem MenuDefaultDelete;
private ToolStripSeparator toolStripMenuItem2;
private ToolStripMenuItem MenuDefaultSelectAll;
private ToolStripSeparator toolStripMenuItem3;
private ToolStripMenuItem MenuDefaultInsert;
private ToolStripMenuItem MenuInsertChart;
private ToolStripMenuItem MenuInsertGrid;
private ToolStripMenuItem MenuInsertImage;
private ToolStripMenuItem MenuInsertLine;
private ToolStripMenuItem MenuInsertList;
private ToolStripMenuItem MenuInsertMatrix;
private ToolStripMenuItem MenuInsertRectangle;
private ToolStripMenuItem MenuInsertSubreport;
private ToolStripMenuItem MenuInsertTable;
private ToolStripMenuItem MenuInsertTextbox;
private ContextMenuStrip ContextMenuChart;
private ToolStripMenuItem MenuChartProperties;
private ToolStripMenuItem MenuChartLegend;
private ToolStripMenuItem MenuChartTitle;
private ToolStripSeparator toolStripMenuItem4;
private ToolStripMenuItem MenuChartInsertCategoryGrouping;
private ToolStripMenuItem MenuChartEditCategoryGrouping;
private ToolStripMenuItem MenuChartDeleteCategoryGrouping;
private ToolStripSeparator toolStripMenuItem5;
private ToolStripMenuItem MenuChartCategoryAxis;
private ToolStripMenuItem MenuChartCategoryAxisTitle;
private ToolStripSeparator toolStripMenuItem6;
private ToolStripMenuItem MenuChartInsertSeriesGrouping;
private ToolStripMenuItem MenuChartEditSeriesGrouping;
private ToolStripMenuItem MenuChartDeleteSeriesGrouping;
private ToolStripSeparator toolStripMenuItem7;
private ToolStripMenuItem MenuChartValueAxis;
private ToolStripMenuItem MenuChartValueAxisTitle;
private ToolStripMenuItem MenuChartValueAxisRightTitle;
private ToolStripSeparator toolStripMenuItem8;
private ToolStripMenuItem MenuChartCopy;
private ToolStripMenuItem MenuChartPaste;
private ToolStripMenuItem MenuChartDelete;
private ToolStripSeparator toolStripMenuItem9;
private ContextMenuStrip ContextMenuMatrix;
private ToolStripMenuItem MenuMatrixProperties;
private ToolStripMenuItem MenuMatrixMatrixProperties;
private ToolStripSeparator toolStripMenuItem10;
private ToolStripMenuItem MenuMatrixInsertColumnGroup;
private ToolStripMenuItem MenuMatrixEditColumnGroup;
private ToolStripMenuItem MenuMatrixDeleteColumnGroup;
private ToolStripSeparator toolStripMenuItem11;
private ToolStripMenuItem MenuMatrixInsertRowGroup;
private ToolStripMenuItem MenuMatrixEditRowGroup;
private ToolStripMenuItem MenuMatrixDeleteRowGroup;
private ToolStripSeparator toolStripMenuItem12;
private ToolStripMenuItem MenuMatrixDeleteMatrix;
private ToolStripSeparator toolStripMenuItem13;
private ToolStripMenuItem MenuMatrixCopy;
private ToolStripMenuItem MenuMatrixPaste;
private ToolStripMenuItem MenuMatrixDelete;
private ToolStripSeparator toolStripMenuItem14;
private ToolStripMenuItem MenuMatrixSelectAll;
private ContextMenuStrip ContextMenuSubreport;
private ToolStripMenuItem MenuSubreportProperties;
private ToolStripMenuItem MenuSubreportOpen;
private ToolStripSeparator toolStripMenuItem15;
private ToolStripMenuItem MenuSubreportCopy;
private ToolStripMenuItem MenuSubreportPaste;
private ToolStripMenuItem MenuSubreportDelete;
private ToolStripSeparator toolStripMenuItem16;
private ToolStripMenuItem MenuSubreportSelectAll;
private ContextMenuStrip ContextMenuGrid;
private ToolStripMenuItem MenuGridProperties;
private ToolStripMenuItem MenuGridGridProperties;
private ToolStripMenuItem MenuGridReplaceCell;
private ToolStripMenuItem MenuGridReplaceCellChart;
private ToolStripMenuItem MenuGridReplaceCellImage;
private ToolStripMenuItem MenuGridReplaceCellList;
private ToolStripMenuItem MenuGridReplaceCellMatrix;
private ToolStripMenuItem MenuGridReplaceCellRectangle;
private ToolStripMenuItem MenuGridReplaceCellSubreport;
private ToolStripMenuItem MenuGridReplaceCellTable;
private ToolStripMenuItem MenuGridReplaceCellTextbox;
private ToolStripSeparator toolStripMenuItem17;
private ToolStripMenuItem MenuGridInsertColumnBefore;
private ToolStripMenuItem MenuGridInsertColumnAfter;
private ToolStripSeparator toolStripMenuItem18;
private ToolStripMenuItem MenuGridInsertRowBefore;
private ToolStripMenuItem MenuGridInsertRowAfter;
private ToolStripSeparator toolStripMenuItem19;
private ToolStripMenuItem MenuGridDeleteColumn;
private ToolStripMenuItem MenuGridDeleteRow;
private ToolStripMenuItem MenuGridDeleteGrid;
private ToolStripSeparator toolStripMenuItem20;
private ToolStripMenuItem MenuGridCopy;
private ToolStripMenuItem MenuGridPaste;
private ToolStripMenuItem MenuGridDelete;
private ToolStripSeparator toolStripMenuItem21;
private ToolStripMenuItem MenuGridSelectAll;
private ContextMenuStrip ContextMenuTable;
private ToolStripMenuItem MenuTableProperties;
private ToolStripMenuItem MenuTableTableProperties;
private ToolStripMenuItem MenuTableReplaceCell;
private ToolStripMenuItem MenuTableReplaceCellChart;
private ToolStripMenuItem MenuTableReplaceCellImage;
private ToolStripMenuItem MenuTableReplaceCellList;
private ToolStripMenuItem MenuTableReplaceCellMatrix;
private ToolStripMenuItem MenuTableReplaceCellRectangle;
private ToolStripMenuItem MenuTableReplaceCellSubreport;
private ToolStripMenuItem MenuTableReplaceCellTable;
private ToolStripMenuItem MenuTableReplaceCellTextbox;
private ToolStripSeparator toolStripMenuItem22;
private ToolStripMenuItem MenuTableInsertColumnBefore;
private ToolStripMenuItem MenuTableInsertColumnAfter;
private ToolStripSeparator toolStripMenuItem23;
private ToolStripMenuItem MenuTableInsertRowBefore;
private ToolStripMenuItem MenuTableInsertRowAfter;
private ToolStripSeparator toolStripMenuItem24;
private ToolStripMenuItem MenuTableInsertGroup;
private ToolStripMenuItem MenuTableEditGroup;
private ToolStripMenuItem MenuTableDeleteGroup;
private ToolStripSeparator toolStripMenuItem25;
private ToolStripMenuItem MenuTableDeleteColumn;
private ToolStripMenuItem MenuTableDeleteRow;
private ToolStripMenuItem MenuTableDeleteTable;
private ToolStripSeparator toolStripMenuItem26;
private ToolStripMenuItem MenuTableCopy;
private ToolStripMenuItem MenuTablePaste;
private ToolStripMenuItem MenuTableDelete;
private ToolStripSeparator toolStripMenuItem27;
private ToolStripMenuItem MenuTableSelectAll;
private ToolStripMenuItem MenuChartSelectAll;
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DesignCtl));
this.DoubleBuffered = true;
this.ContextMenuDefault = new System.Windows.Forms.ContextMenuStrip(this.components);
this.MenuDefaultProperties = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
this.MenuDefaultCopy = new System.Windows.Forms.ToolStripMenuItem();
this.MenuDefaultPaste = new System.Windows.Forms.ToolStripMenuItem();
this.MenuDefaultDelete = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
this.MenuDefaultSelectAll = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator();
this.MenuDefaultInsert = new System.Windows.Forms.ToolStripMenuItem();
this.MenuInsertChart = new System.Windows.Forms.ToolStripMenuItem();
this.MenuInsertGrid = new System.Windows.Forms.ToolStripMenuItem();
this.MenuInsertImage = new System.Windows.Forms.ToolStripMenuItem();
this.MenuInsertLine = new System.Windows.Forms.ToolStripMenuItem();
this.MenuInsertList = new System.Windows.Forms.ToolStripMenuItem();
this.MenuInsertMatrix = new System.Windows.Forms.ToolStripMenuItem();
this.MenuInsertRectangle = new System.Windows.Forms.ToolStripMenuItem();
this.MenuInsertSubreport = new System.Windows.Forms.ToolStripMenuItem();
this.MenuInsertTable = new System.Windows.Forms.ToolStripMenuItem();
this.MenuInsertTextbox = new System.Windows.Forms.ToolStripMenuItem();
this.ContextMenuChart = new System.Windows.Forms.ContextMenuStrip(this.components);
this.MenuChartProperties = new System.Windows.Forms.ToolStripMenuItem();
this.MenuChartLegend = new System.Windows.Forms.ToolStripMenuItem();
this.MenuChartTitle = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripSeparator();
this.MenuChartInsertCategoryGrouping = new System.Windows.Forms.ToolStripMenuItem();
this.MenuChartEditCategoryGrouping = new System.Windows.Forms.ToolStripMenuItem();
this.MenuChartDeleteCategoryGrouping = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripSeparator();
this.MenuChartCategoryAxis = new System.Windows.Forms.ToolStripMenuItem();
this.MenuChartCategoryAxisTitle = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem6 = new System.Windows.Forms.ToolStripSeparator();
this.MenuChartInsertSeriesGrouping = new System.Windows.Forms.ToolStripMenuItem();
this.MenuChartEditSeriesGrouping = new System.Windows.Forms.ToolStripMenuItem();
this.MenuChartDeleteSeriesGrouping = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem7 = new System.Windows.Forms.ToolStripSeparator();
this.MenuChartValueAxis = new System.Windows.Forms.ToolStripMenuItem();
this.MenuChartValueAxisTitle = new System.Windows.Forms.ToolStripMenuItem();
this.MenuChartValueAxisRightTitle = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem8 = new System.Windows.Forms.ToolStripSeparator();
this.MenuChartCopy = new System.Windows.Forms.ToolStripMenuItem();
this.MenuChartPaste = new System.Windows.Forms.ToolStripMenuItem();
this.MenuChartDelete = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem9 = new System.Windows.Forms.ToolStripSeparator();
this.MenuChartSelectAll = new System.Windows.Forms.ToolStripMenuItem();
this.ContextMenuMatrix = new System.Windows.Forms.ContextMenuStrip(this.components);
this.MenuMatrixProperties = new System.Windows.Forms.ToolStripMenuItem();
this.MenuMatrixMatrixProperties = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem10 = new System.Windows.Forms.ToolStripSeparator();
this.MenuMatrixInsertColumnGroup = new System.Windows.Forms.ToolStripMenuItem();
this.MenuMatrixEditColumnGroup = new System.Windows.Forms.ToolStripMenuItem();
this.MenuMatrixDeleteColumnGroup = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem11 = new System.Windows.Forms.ToolStripSeparator();
this.MenuMatrixInsertRowGroup = new System.Windows.Forms.ToolStripMenuItem();
this.MenuMatrixEditRowGroup = new System.Windows.Forms.ToolStripMenuItem();
this.MenuMatrixDeleteRowGroup = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem12 = new System.Windows.Forms.ToolStripSeparator();
this.MenuMatrixDeleteMatrix = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem13 = new System.Windows.Forms.ToolStripSeparator();
this.MenuMatrixCopy = new System.Windows.Forms.ToolStripMenuItem();
this.MenuMatrixPaste = new System.Windows.Forms.ToolStripMenuItem();
this.MenuMatrixDelete = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem14 = new System.Windows.Forms.ToolStripSeparator();
this.MenuMatrixSelectAll = new System.Windows.Forms.ToolStripMenuItem();
this.ContextMenuSubreport = new System.Windows.Forms.ContextMenuStrip(this.components);
this.MenuSubreportProperties = new System.Windows.Forms.ToolStripMenuItem();
this.MenuSubreportOpen = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem15 = new System.Windows.Forms.ToolStripSeparator();
this.MenuSubreportCopy = new System.Windows.Forms.ToolStripMenuItem();
this.MenuSubreportPaste = new System.Windows.Forms.ToolStripMenuItem();
this.MenuSubreportDelete = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem16 = new System.Windows.Forms.ToolStripSeparator();
this.MenuSubreportSelectAll = new System.Windows.Forms.ToolStripMenuItem();
this.ContextMenuGrid = new System.Windows.Forms.ContextMenuStrip(this.components);
this.MenuGridProperties = new System.Windows.Forms.ToolStripMenuItem();
this.MenuGridGridProperties = new System.Windows.Forms.ToolStripMenuItem();
this.MenuGridReplaceCell = new System.Windows.Forms.ToolStripMenuItem();
this.MenuGridReplaceCellChart = new System.Windows.Forms.ToolStripMenuItem();
this.MenuGridReplaceCellImage = new System.Windows.Forms.ToolStripMenuItem();
this.MenuGridReplaceCellList = new System.Windows.Forms.ToolStripMenuItem();
this.MenuGridReplaceCellMatrix = new System.Windows.Forms.ToolStripMenuItem();
this.MenuGridReplaceCellRectangle = new System.Windows.Forms.ToolStripMenuItem();
this.MenuGridReplaceCellSubreport = new System.Windows.Forms.ToolStripMenuItem();
this.MenuGridReplaceCellTable = new System.Windows.Forms.ToolStripMenuItem();
this.MenuGridReplaceCellTextbox = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem17 = new System.Windows.Forms.ToolStripSeparator();
this.MenuGridInsertColumnBefore = new System.Windows.Forms.ToolStripMenuItem();
this.MenuGridInsertColumnAfter = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem18 = new System.Windows.Forms.ToolStripSeparator();
this.MenuGridInsertRowBefore = new System.Windows.Forms.ToolStripMenuItem();
this.MenuGridInsertRowAfter = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem19 = new System.Windows.Forms.ToolStripSeparator();
this.MenuGridDeleteColumn = new System.Windows.Forms.ToolStripMenuItem();
this.MenuGridDeleteRow = new System.Windows.Forms.ToolStripMenuItem();
this.MenuGridDeleteGrid = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem20 = new System.Windows.Forms.ToolStripSeparator();
this.MenuGridCopy = new System.Windows.Forms.ToolStripMenuItem();
this.MenuGridPaste = new System.Windows.Forms.ToolStripMenuItem();
this.MenuGridDelete = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem21 = new System.Windows.Forms.ToolStripSeparator();
this.MenuGridSelectAll = new System.Windows.Forms.ToolStripMenuItem();
this.ContextMenuTable = new System.Windows.Forms.ContextMenuStrip(this.components);
this.MenuTableProperties = new System.Windows.Forms.ToolStripMenuItem();
this.MenuTableTableProperties = new System.Windows.Forms.ToolStripMenuItem();
this.MenuTableReplaceCell = new System.Windows.Forms.ToolStripMenuItem();
this.MenuTableReplaceCellChart = new System.Windows.Forms.ToolStripMenuItem();
this.MenuTableReplaceCellImage = new System.Windows.Forms.ToolStripMenuItem();
this.MenuTableReplaceCellList = new System.Windows.Forms.ToolStripMenuItem();
this.MenuTableReplaceCellMatrix = new System.Windows.Forms.ToolStripMenuItem();
this.MenuTableReplaceCellRectangle = new System.Windows.Forms.ToolStripMenuItem();
this.MenuTableReplaceCellSubreport = new System.Windows.Forms.ToolStripMenuItem();
this.MenuTableReplaceCellTable = new System.Windows.Forms.ToolStripMenuItem();
this.MenuTableReplaceCellTextbox = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem22 = new System.Windows.Forms.ToolStripSeparator();
this.MenuTableInsertColumnBefore = new System.Windows.Forms.ToolStripMenuItem();
this.MenuTableInsertColumnAfter = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem23 = new System.Windows.Forms.ToolStripSeparator();
this.MenuTableInsertRowBefore = new System.Windows.Forms.ToolStripMenuItem();
this.MenuTableInsertRowAfter = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem24 = new System.Windows.Forms.ToolStripSeparator();
this.MenuTableInsertGroup = new System.Windows.Forms.ToolStripMenuItem();
this.MenuTableEditGroup = new System.Windows.Forms.ToolStripMenuItem();
this.MenuTableDeleteGroup = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem25 = new System.Windows.Forms.ToolStripSeparator();
this.MenuTableDeleteColumn = new System.Windows.Forms.ToolStripMenuItem();
this.MenuTableDeleteRow = new System.Windows.Forms.ToolStripMenuItem();
this.MenuTableDeleteTable = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem26 = new System.Windows.Forms.ToolStripSeparator();
this.MenuTableCopy = new System.Windows.Forms.ToolStripMenuItem();
this.MenuTablePaste = new System.Windows.Forms.ToolStripMenuItem();
this.MenuTableDelete = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem27 = new System.Windows.Forms.ToolStripSeparator();
this.MenuTableSelectAll = new System.Windows.Forms.ToolStripMenuItem();
this.ContextMenuDefault.SuspendLayout();
this.ContextMenuChart.SuspendLayout();
this.ContextMenuMatrix.SuspendLayout();
this.ContextMenuSubreport.SuspendLayout();
this.ContextMenuGrid.SuspendLayout();
this.ContextMenuTable.SuspendLayout();
this.SuspendLayout();
//
// ContextMenuDefault
//
resources.ApplyResources(this.ContextMenuDefault, "ContextMenuDefault");
this.ContextMenuDefault.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.MenuDefaultProperties,
this.toolStripMenuItem1,
this.MenuDefaultCopy,
this.MenuDefaultPaste,
this.MenuDefaultDelete,
this.toolStripMenuItem2,
this.MenuDefaultSelectAll,
this.toolStripMenuItem3,
this.MenuDefaultInsert});
this.ContextMenuDefault.Name = "ContextMenuDefault";
this.ContextMenuDefault.Opened += new System.EventHandler(this.menuContext_Popup);
//
// MenuDefaultProperties
//
resources.ApplyResources(this.MenuDefaultProperties, "MenuDefaultProperties");
this.MenuDefaultProperties.Name = "MenuDefaultProperties";
this.MenuDefaultProperties.Click += new System.EventHandler(this.menuProperties_Click);
//
// toolStripMenuItem1
//
resources.ApplyResources(this.toolStripMenuItem1, "toolStripMenuItem1");
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
//
// MenuDefaultCopy
//
resources.ApplyResources(this.MenuDefaultCopy, "MenuDefaultCopy");
this.MenuDefaultCopy.Name = "MenuDefaultCopy";
this.MenuDefaultCopy.Click += new System.EventHandler(this.menuCopy_Click);
//
// MenuDefaultPaste
//
resources.ApplyResources(this.MenuDefaultPaste, "MenuDefaultPaste");
this.MenuDefaultPaste.Name = "MenuDefaultPaste";
this.MenuDefaultPaste.Click += new System.EventHandler(this.menuPaste_Click);
//
// MenuDefaultDelete
//
resources.ApplyResources(this.MenuDefaultDelete, "MenuDefaultDelete");
this.MenuDefaultDelete.Name = "MenuDefaultDelete";
this.MenuDefaultDelete.Click += new System.EventHandler(this.menuDelete_Click);
//
// toolStripMenuItem2
//
resources.ApplyResources(this.toolStripMenuItem2, "toolStripMenuItem2");
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
//
// MenuDefaultSelectAll
//
resources.ApplyResources(this.MenuDefaultSelectAll, "MenuDefaultSelectAll");
this.MenuDefaultSelectAll.Name = "MenuDefaultSelectAll";
this.MenuDefaultSelectAll.Click += new System.EventHandler(this.menuSelectAll_Click);
//
// toolStripMenuItem3
//
resources.ApplyResources(this.toolStripMenuItem3, "toolStripMenuItem3");
this.toolStripMenuItem3.Name = "toolStripMenuItem3";
//
// MenuDefaultInsert
//
resources.ApplyResources(this.MenuDefaultInsert, "MenuDefaultInsert");
this.MenuDefaultInsert.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.MenuInsertChart,
this.MenuInsertGrid,
this.MenuInsertImage,
this.MenuInsertLine,
this.MenuInsertList,
this.MenuInsertMatrix,
this.MenuInsertRectangle,
this.MenuInsertSubreport,
this.MenuInsertTable,
this.MenuInsertTextbox});
this.MenuDefaultInsert.Name = "MenuDefaultInsert";
//
// MenuInsertChart
//
resources.ApplyResources(this.MenuInsertChart, "MenuInsertChart");
this.MenuInsertChart.Name = "MenuInsertChart";
this.MenuInsertChart.Click += new System.EventHandler(this.menuInsertChart_Click);
//
// MenuInsertGrid
//
resources.ApplyResources(this.MenuInsertGrid, "MenuInsertGrid");
this.MenuInsertGrid.Name = "MenuInsertGrid";
this.MenuInsertGrid.Click += new System.EventHandler(this.menuInsertGrid_Click);
//
// MenuInsertImage
//
resources.ApplyResources(this.MenuInsertImage, "MenuInsertImage");
this.MenuInsertImage.Name = "MenuInsertImage";
this.MenuInsertImage.Click += new System.EventHandler(this.menuInsertImage_Click);
//
// MenuInsertLine
//
resources.ApplyResources(this.MenuInsertLine, "MenuInsertLine");
this.MenuInsertLine.Name = "MenuInsertLine";
this.MenuInsertLine.Click += new System.EventHandler(this.menuInsertLine_Click);
//
// MenuInsertList
//
resources.ApplyResources(this.MenuInsertList, "MenuInsertList");
this.MenuInsertList.Name = "MenuInsertList";
this.MenuInsertList.Click += new System.EventHandler(this.menuInsertList_Click);
//
// MenuInsertMatrix
//
resources.ApplyResources(this.MenuInsertMatrix, "MenuInsertMatrix");
this.MenuInsertMatrix.Name = "MenuInsertMatrix";
this.MenuInsertMatrix.Click += new System.EventHandler(this.menuInsertMatrix_Click);
//
// MenuInsertRectangle
//
resources.ApplyResources(this.MenuInsertRectangle, "MenuInsertRectangle");
this.MenuInsertRectangle.Name = "MenuInsertRectangle";
this.MenuInsertRectangle.Click += new System.EventHandler(this.menuInsertRectangle_Click);
//
// MenuInsertSubreport
//
resources.ApplyResources(this.MenuInsertSubreport, "MenuInsertSubreport");
this.MenuInsertSubreport.Name = "MenuInsertSubreport";
this.MenuInsertSubreport.Click += new System.EventHandler(this.menuInsertSubreport_Click);
//
// MenuInsertTable
//
resources.ApplyResources(this.MenuInsertTable, "MenuInsertTable");
this.MenuInsertTable.Name = "MenuInsertTable";
this.MenuInsertTable.Click += new System.EventHandler(this.menuInsertTable_Click);
//
// MenuInsertTextbox
//
resources.ApplyResources(this.MenuInsertTextbox, "MenuInsertTextbox");
this.MenuInsertTextbox.Name = "MenuInsertTextbox";
this.MenuInsertTextbox.Click += new System.EventHandler(this.menuInsertTextbox_Click);
//
// ContextMenuChart
//
resources.ApplyResources(this.ContextMenuChart, "ContextMenuChart");
this.ContextMenuChart.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.MenuChartProperties,
this.MenuChartLegend,
this.MenuChartTitle,
this.toolStripMenuItem4,
this.MenuChartInsertCategoryGrouping,
this.MenuChartEditCategoryGrouping,
this.MenuChartDeleteCategoryGrouping,
this.toolStripMenuItem5,
this.MenuChartCategoryAxis,
this.MenuChartCategoryAxisTitle,
this.toolStripMenuItem6,
this.MenuChartInsertSeriesGrouping,
this.MenuChartEditSeriesGrouping,
this.MenuChartDeleteSeriesGrouping,
this.toolStripMenuItem7,
this.MenuChartValueAxis,
this.MenuChartValueAxisTitle,
this.MenuChartValueAxisRightTitle,
this.toolStripMenuItem8,
this.MenuChartCopy,
this.MenuChartPaste,
this.MenuChartDelete,
this.toolStripMenuItem9,
this.MenuChartSelectAll});
this.ContextMenuChart.Name = "ContextMenuChart";
this.ContextMenuChart.Opened += new System.EventHandler(this.menuContext_Popup);
//
// MenuChartProperties
//
resources.ApplyResources(this.MenuChartProperties, "MenuChartProperties");
this.MenuChartProperties.Name = "MenuChartProperties";
this.MenuChartProperties.Click += new System.EventHandler(this.menuProperties_Click);
//
// MenuChartLegend
//
resources.ApplyResources(this.MenuChartLegend, "MenuChartLegend");
this.MenuChartLegend.Name = "MenuChartLegend";
this.MenuChartLegend.Click += new System.EventHandler(this.menuPropertiesLegend_Click);
//
// MenuChartTitle
//
resources.ApplyResources(this.MenuChartTitle, "MenuChartTitle");
this.MenuChartTitle.Name = "MenuChartTitle";
this.MenuChartTitle.Click += new System.EventHandler(this.menuPropertiesChartTitle_Click);
//
// toolStripMenuItem4
//
resources.ApplyResources(this.toolStripMenuItem4, "toolStripMenuItem4");
this.toolStripMenuItem4.Name = "toolStripMenuItem4";
//
// MenuChartInsertCategoryGrouping
//
resources.ApplyResources(this.MenuChartInsertCategoryGrouping, "MenuChartInsertCategoryGrouping");
this.MenuChartInsertCategoryGrouping.Name = "MenuChartInsertCategoryGrouping";
this.MenuChartInsertCategoryGrouping.Click += new System.EventHandler(this.menuChartInsertCategoryGrouping_Click);
//
// MenuChartEditCategoryGrouping
//
resources.ApplyResources(this.MenuChartEditCategoryGrouping, "MenuChartEditCategoryGrouping");
this.MenuChartEditCategoryGrouping.Name = "MenuChartEditCategoryGrouping";
//
// MenuChartDeleteCategoryGrouping
//
resources.ApplyResources(this.MenuChartDeleteCategoryGrouping, "MenuChartDeleteCategoryGrouping");
this.MenuChartDeleteCategoryGrouping.Name = "MenuChartDeleteCategoryGrouping";
//
// toolStripMenuItem5
//
resources.ApplyResources(this.toolStripMenuItem5, "toolStripMenuItem5");
this.toolStripMenuItem5.Name = "toolStripMenuItem5";
//
// MenuChartCategoryAxis
//
resources.ApplyResources(this.MenuChartCategoryAxis, "MenuChartCategoryAxis");
this.MenuChartCategoryAxis.Name = "MenuChartCategoryAxis";
this.MenuChartCategoryAxis.Click += new System.EventHandler(this.menuPropertiesCategoryAxis_Click);
//
// MenuChartCategoryAxisTitle
//
resources.ApplyResources(this.MenuChartCategoryAxisTitle, "MenuChartCategoryAxisTitle");
this.MenuChartCategoryAxisTitle.Name = "MenuChartCategoryAxisTitle";
this.MenuChartCategoryAxisTitle.Click += new System.EventHandler(this.menuPropertiesCategoryAxisTitle_Click);
//
// toolStripMenuItem6
//
resources.ApplyResources(this.toolStripMenuItem6, "toolStripMenuItem6");
this.toolStripMenuItem6.Name = "toolStripMenuItem6";
//
// MenuChartInsertSeriesGrouping
//
resources.ApplyResources(this.MenuChartInsertSeriesGrouping, "MenuChartInsertSeriesGrouping");
this.MenuChartInsertSeriesGrouping.Name = "MenuChartInsertSeriesGrouping";
this.MenuChartInsertSeriesGrouping.Click += new System.EventHandler(this.menuChartInsertSeriesGrouping_Click);
//
// MenuChartEditSeriesGrouping
//
resources.ApplyResources(this.MenuChartEditSeriesGrouping, "MenuChartEditSeriesGrouping");
this.MenuChartEditSeriesGrouping.Name = "MenuChartEditSeriesGrouping";
//
// MenuChartDeleteSeriesGrouping
//
resources.ApplyResources(this.MenuChartDeleteSeriesGrouping, "MenuChartDeleteSeriesGrouping");
this.MenuChartDeleteSeriesGrouping.Name = "MenuChartDeleteSeriesGrouping";
//
// toolStripMenuItem7
//
resources.ApplyResources(this.toolStripMenuItem7, "toolStripMenuItem7");
this.toolStripMenuItem7.Name = "toolStripMenuItem7";
//
// MenuChartValueAxis
//
resources.ApplyResources(this.MenuChartValueAxis, "MenuChartValueAxis");
this.MenuChartValueAxis.Name = "MenuChartValueAxis";
this.MenuChartValueAxis.Click += new System.EventHandler(this.menuPropertiesValueAxis_Click);
//
// MenuChartValueAxisTitle
//
resources.ApplyResources(this.MenuChartValueAxisTitle, "MenuChartValueAxisTitle");
this.MenuChartValueAxisTitle.Name = "MenuChartValueAxisTitle";
this.MenuChartValueAxisTitle.Click += new System.EventHandler(this.menuPropertiesValueAxisTitle_Click);
//
// MenuChartValueAxisRightTitle
//
resources.ApplyResources(this.MenuChartValueAxisRightTitle, "MenuChartValueAxisRightTitle");
this.MenuChartValueAxisRightTitle.Name = "MenuChartValueAxisRightTitle";
this.MenuChartValueAxisRightTitle.Click += new System.EventHandler(this.menuPropertiesValueAxis2Title_Click);
//
// toolStripMenuItem8
//
resources.ApplyResources(this.toolStripMenuItem8, "toolStripMenuItem8");
this.toolStripMenuItem8.Name = "toolStripMenuItem8";
//
// MenuChartCopy
//
resources.ApplyResources(this.MenuChartCopy, "MenuChartCopy");
this.MenuChartCopy.Name = "MenuChartCopy";
this.MenuChartCopy.Click += new System.EventHandler(this.menuCopy_Click);
//
// MenuChartPaste
//
resources.ApplyResources(this.MenuChartPaste, "MenuChartPaste");
this.MenuChartPaste.Name = "MenuChartPaste";
this.MenuChartPaste.Click += new System.EventHandler(this.menuPaste_Click);
//
// MenuChartDelete
//
resources.ApplyResources(this.MenuChartDelete, "MenuChartDelete");
this.MenuChartDelete.Name = "MenuChartDelete";
this.MenuChartDelete.Click += new System.EventHandler(this.menuDelete_Click);
//
// toolStripMenuItem9
//
resources.ApplyResources(this.toolStripMenuItem9, "toolStripMenuItem9");
this.toolStripMenuItem9.Name = "toolStripMenuItem9";
//
// MenuChartSelectAll
//
resources.ApplyResources(this.MenuChartSelectAll, "MenuChartSelectAll");
this.MenuChartSelectAll.Name = "MenuChartSelectAll";
this.MenuChartSelectAll.Click += new System.EventHandler(this.menuSelectAll_Click);
//
// ContextMenuMatrix
//
resources.ApplyResources(this.ContextMenuMatrix, "ContextMenuMatrix");
this.ContextMenuMatrix.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.MenuMatrixProperties,
this.MenuMatrixMatrixProperties,
this.toolStripMenuItem10,
this.MenuMatrixInsertColumnGroup,
this.MenuMatrixEditColumnGroup,
this.MenuMatrixDeleteColumnGroup,
this.toolStripMenuItem11,
this.MenuMatrixInsertRowGroup,
this.MenuMatrixEditRowGroup,
this.MenuMatrixDeleteRowGroup,
this.toolStripMenuItem12,
this.MenuMatrixDeleteMatrix,
this.toolStripMenuItem13,
this.MenuMatrixCopy,
this.MenuMatrixPaste,
this.MenuMatrixDelete,
this.toolStripMenuItem14,
this.MenuMatrixSelectAll});
this.ContextMenuMatrix.Name = "ContextMenuMatrix";
this.ContextMenuMatrix.Opened += new System.EventHandler(this.menuContext_Popup);
//
// MenuMatrixProperties
//
resources.ApplyResources(this.MenuMatrixProperties, "MenuMatrixProperties");
this.MenuMatrixProperties.Name = "MenuMatrixProperties";
this.MenuMatrixProperties.Click += new System.EventHandler(this.menuProperties_Click);
//
// MenuMatrixMatrixProperties
//
resources.ApplyResources(this.MenuMatrixMatrixProperties, "MenuMatrixMatrixProperties");
this.MenuMatrixMatrixProperties.Name = "MenuMatrixMatrixProperties";
this.MenuMatrixMatrixProperties.Click += new System.EventHandler(this.menuMatrixProperties_Click);
//
// toolStripMenuItem10
//
resources.ApplyResources(this.toolStripMenuItem10, "toolStripMenuItem10");
this.toolStripMenuItem10.Name = "toolStripMenuItem10";
//
// MenuMatrixInsertColumnGroup
//
resources.ApplyResources(this.MenuMatrixInsertColumnGroup, "MenuMatrixInsertColumnGroup");
this.MenuMatrixInsertColumnGroup.Name = "MenuMatrixInsertColumnGroup";
this.MenuMatrixInsertColumnGroup.Click += new System.EventHandler(this.menuMatrixInsertColumnGroup_Click);
//
// MenuMatrixEditColumnGroup
//
resources.ApplyResources(this.MenuMatrixEditColumnGroup, "MenuMatrixEditColumnGroup");
this.MenuMatrixEditColumnGroup.Name = "MenuMatrixEditColumnGroup";
//
// MenuMatrixDeleteColumnGroup
//
resources.ApplyResources(this.MenuMatrixDeleteColumnGroup, "MenuMatrixDeleteColumnGroup");
this.MenuMatrixDeleteColumnGroup.Name = "MenuMatrixDeleteColumnGroup";
//
// toolStripMenuItem11
//
resources.ApplyResources(this.toolStripMenuItem11, "toolStripMenuItem11");
this.toolStripMenuItem11.Name = "toolStripMenuItem11";
//
// MenuMatrixInsertRowGroup
//
resources.ApplyResources(this.MenuMatrixInsertRowGroup, "MenuMatrixInsertRowGroup");
this.MenuMatrixInsertRowGroup.Name = "MenuMatrixInsertRowGroup";
this.MenuMatrixInsertRowGroup.Click += new System.EventHandler(this.menuMatrixInsertRowGroup_Click);
//
// MenuMatrixEditRowGroup
//
resources.ApplyResources(this.MenuMatrixEditRowGroup, "MenuMatrixEditRowGroup");
this.MenuMatrixEditRowGroup.Name = "MenuMatrixEditRowGroup";
//
// MenuMatrixDeleteRowGroup
//
resources.ApplyResources(this.MenuMatrixDeleteRowGroup, "MenuMatrixDeleteRowGroup");
this.MenuMatrixDeleteRowGroup.Name = "MenuMatrixDeleteRowGroup";
//
// toolStripMenuItem12
//
resources.ApplyResources(this.toolStripMenuItem12, "toolStripMenuItem12");
this.toolStripMenuItem12.Name = "toolStripMenuItem12";
//
// MenuMatrixDeleteMatrix
//
resources.ApplyResources(this.MenuMatrixDeleteMatrix, "MenuMatrixDeleteMatrix");
this.MenuMatrixDeleteMatrix.Name = "MenuMatrixDeleteMatrix";
this.MenuMatrixDeleteMatrix.Click += new System.EventHandler(this.menuMatrixDelete_Click);
//
// toolStripMenuItem13
//
resources.ApplyResources(this.toolStripMenuItem13, "toolStripMenuItem13");
this.toolStripMenuItem13.Name = "toolStripMenuItem13";
//
// MenuMatrixCopy
//
resources.ApplyResources(this.MenuMatrixCopy, "MenuMatrixCopy");
this.MenuMatrixCopy.Name = "MenuMatrixCopy";
this.MenuMatrixCopy.Click += new System.EventHandler(this.menuCopy_Click);
//
// MenuMatrixPaste
//
resources.ApplyResources(this.MenuMatrixPaste, "MenuMatrixPaste");
this.MenuMatrixPaste.Name = "MenuMatrixPaste";
this.MenuMatrixPaste.Click += new System.EventHandler(this.menuPaste_Click);
//
// MenuMatrixDelete
//
resources.ApplyResources(this.MenuMatrixDelete, "MenuMatrixDelete");
this.MenuMatrixDelete.Name = "MenuMatrixDelete";
this.MenuMatrixDelete.Click += new System.EventHandler(this.menuDelete_Click);
//
// toolStripMenuItem14
//
resources.ApplyResources(this.toolStripMenuItem14, "toolStripMenuItem14");
this.toolStripMenuItem14.Name = "toolStripMenuItem14";
//
// MenuMatrixSelectAll
//
resources.ApplyResources(this.MenuMatrixSelectAll, "MenuMatrixSelectAll");
this.MenuMatrixSelectAll.Name = "MenuMatrixSelectAll";
this.MenuMatrixSelectAll.Click += new System.EventHandler(this.menuSelectAll_Click);
//
// ContextMenuSubreport
//
resources.ApplyResources(this.ContextMenuSubreport, "ContextMenuSubreport");
this.ContextMenuSubreport.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.MenuSubreportProperties,
this.MenuSubreportOpen,
this.toolStripMenuItem15,
this.MenuSubreportCopy,
this.MenuSubreportPaste,
this.MenuSubreportDelete,
this.toolStripMenuItem16,
this.MenuSubreportSelectAll});
this.ContextMenuSubreport.Name = "ContextMenuSubreport";
this.ContextMenuSubreport.Opened += new System.EventHandler(this.menuContext_Popup);
//
// MenuSubreportProperties
//
resources.ApplyResources(this.MenuSubreportProperties, "MenuSubreportProperties");
this.MenuSubreportProperties.Name = "MenuSubreportProperties";
this.MenuSubreportProperties.Click += new System.EventHandler(this.menuProperties_Click);
//
// MenuSubreportOpen
//
resources.ApplyResources(this.MenuSubreportOpen, "MenuSubreportOpen");
this.MenuSubreportOpen.Name = "MenuSubreportOpen";
this.MenuSubreportOpen.Click += new System.EventHandler(this.menuOpenSubreport_Click);
//
// toolStripMenuItem15
//
resources.ApplyResources(this.toolStripMenuItem15, "toolStripMenuItem15");
this.toolStripMenuItem15.Name = "toolStripMenuItem15";
//
// MenuSubreportCopy
//
resources.ApplyResources(this.MenuSubreportCopy, "MenuSubreportCopy");
this.MenuSubreportCopy.Name = "MenuSubreportCopy";
this.MenuSubreportCopy.Click += new System.EventHandler(this.menuCopy_Click);
//
// MenuSubreportPaste
//
resources.ApplyResources(this.MenuSubreportPaste, "MenuSubreportPaste");
this.MenuSubreportPaste.Name = "MenuSubreportPaste";
this.MenuSubreportPaste.Click += new System.EventHandler(this.menuPaste_Click);
//
// MenuSubreportDelete
//
resources.ApplyResources(this.MenuSubreportDelete, "MenuSubreportDelete");
this.MenuSubreportDelete.Name = "MenuSubreportDelete";
this.MenuSubreportDelete.Click += new System.EventHandler(this.menuDelete_Click);
//
// toolStripMenuItem16
//
resources.ApplyResources(this.toolStripMenuItem16, "toolStripMenuItem16");
this.toolStripMenuItem16.Name = "toolStripMenuItem16";
//
// MenuSubreportSelectAll
//
resources.ApplyResources(this.MenuSubreportSelectAll, "MenuSubreportSelectAll");
this.MenuSubreportSelectAll.Name = "MenuSubreportSelectAll";
this.MenuSubreportSelectAll.Click += new System.EventHandler(this.menuSelectAll_Click);
//
// ContextMenuGrid
//
resources.ApplyResources(this.ContextMenuGrid, "ContextMenuGrid");
this.ContextMenuGrid.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.MenuGridProperties,
this.MenuGridGridProperties,
this.MenuGridReplaceCell,
this.toolStripMenuItem17,
this.MenuGridInsertColumnBefore,
this.MenuGridInsertColumnAfter,
this.toolStripMenuItem18,
this.MenuGridInsertRowBefore,
this.MenuGridInsertRowAfter,
this.toolStripMenuItem19,
this.MenuGridDeleteColumn,
this.MenuGridDeleteRow,
this.MenuGridDeleteGrid,
this.toolStripMenuItem20,
this.MenuGridCopy,
this.MenuGridPaste,
this.MenuGridDelete,
this.toolStripMenuItem21,
this.MenuGridSelectAll});
this.ContextMenuGrid.Name = "ContextMenuGrid";
this.ContextMenuGrid.Opened += new System.EventHandler(this.menuContext_Popup);
//
// MenuGridProperties
//
resources.ApplyResources(this.MenuGridProperties, "MenuGridProperties");
this.MenuGridProperties.Name = "MenuGridProperties";
this.MenuGridProperties.Click += new System.EventHandler(this.menuProperties_Click);
//
// MenuGridGridProperties
//
resources.ApplyResources(this.MenuGridGridProperties, "MenuGridGridProperties");
this.MenuGridGridProperties.Name = "MenuGridGridProperties";
this.MenuGridGridProperties.Click += new System.EventHandler(this.menuTableProperties_Click);
//
// MenuGridReplaceCell
//
resources.ApplyResources(this.MenuGridReplaceCell, "MenuGridReplaceCell");
this.MenuGridReplaceCell.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.MenuGridReplaceCellChart,
this.MenuGridReplaceCellImage,
this.MenuGridReplaceCellList,
this.MenuGridReplaceCellMatrix,
this.MenuGridReplaceCellRectangle,
this.MenuGridReplaceCellSubreport,
this.MenuGridReplaceCellTable,
this.MenuGridReplaceCellTextbox});
this.MenuGridReplaceCell.Name = "MenuGridReplaceCell";
//
// MenuGridReplaceCellChart
//
resources.ApplyResources(this.MenuGridReplaceCellChart, "MenuGridReplaceCellChart");
this.MenuGridReplaceCellChart.Name = "MenuGridReplaceCellChart";
this.MenuGridReplaceCellChart.Click += new System.EventHandler(this.menuInsertChart_Click);
//
// MenuGridReplaceCellImage
//
resources.ApplyResources(this.MenuGridReplaceCellImage, "MenuGridReplaceCellImage");
this.MenuGridReplaceCellImage.Name = "MenuGridReplaceCellImage";
this.MenuGridReplaceCellImage.Click += new System.EventHandler(this.menuInsertImage_Click);
//
// MenuGridReplaceCellList
//
resources.ApplyResources(this.MenuGridReplaceCellList, "MenuGridReplaceCellList");
this.MenuGridReplaceCellList.Name = "MenuGridReplaceCellList";
this.MenuGridReplaceCellList.Click += new System.EventHandler(this.menuInsertList_Click);
//
// MenuGridReplaceCellMatrix
//
resources.ApplyResources(this.MenuGridReplaceCellMatrix, "MenuGridReplaceCellMatrix");
this.MenuGridReplaceCellMatrix.Name = "MenuGridReplaceCellMatrix";
this.MenuGridReplaceCellMatrix.Click += new System.EventHandler(this.menuInsertMatrix_Click);
//
// MenuGridReplaceCellRectangle
//
resources.ApplyResources(this.MenuGridReplaceCellRectangle, "MenuGridReplaceCellRectangle");
this.MenuGridReplaceCellRectangle.Name = "MenuGridReplaceCellRectangle";
this.MenuGridReplaceCellRectangle.Click += new System.EventHandler(this.menuInsertRectangle_Click);
//
// MenuGridReplaceCellSubreport
//
resources.ApplyResources(this.MenuGridReplaceCellSubreport, "MenuGridReplaceCellSubreport");
this.MenuGridReplaceCellSubreport.Name = "MenuGridReplaceCellSubreport";
this.MenuGridReplaceCellSubreport.Click += new System.EventHandler(this.menuInsertSubreport_Click);
//
// MenuGridReplaceCellTable
//
resources.ApplyResources(this.MenuGridReplaceCellTable, "MenuGridReplaceCellTable");
this.MenuGridReplaceCellTable.Name = "MenuGridReplaceCellTable";
this.MenuGridReplaceCellTable.Click += new System.EventHandler(this.menuInsertTable_Click);
//
// MenuGridReplaceCellTextbox
//
resources.ApplyResources(this.MenuGridReplaceCellTextbox, "MenuGridReplaceCellTextbox");
this.MenuGridReplaceCellTextbox.Name = "MenuGridReplaceCellTextbox";
this.MenuGridReplaceCellTextbox.Click += new System.EventHandler(this.menuInsertTextbox_Click);
//
// toolStripMenuItem17
//
resources.ApplyResources(this.toolStripMenuItem17, "toolStripMenuItem17");
this.toolStripMenuItem17.Name = "toolStripMenuItem17";
//
// MenuGridInsertColumnBefore
//
resources.ApplyResources(this.MenuGridInsertColumnBefore, "MenuGridInsertColumnBefore");
this.MenuGridInsertColumnBefore.Name = "MenuGridInsertColumnBefore";
this.MenuGridInsertColumnBefore.Click += new System.EventHandler(this.menuTableInsertColumnBefore_Click);
//
// MenuGridInsertColumnAfter
//
resources.ApplyResources(this.MenuGridInsertColumnAfter, "MenuGridInsertColumnAfter");
this.MenuGridInsertColumnAfter.Name = "MenuGridInsertColumnAfter";
this.MenuGridInsertColumnAfter.Click += new System.EventHandler(this.menuTableInsertColumnAfter_Click);
//
// toolStripMenuItem18
//
resources.ApplyResources(this.toolStripMenuItem18, "toolStripMenuItem18");
this.toolStripMenuItem18.Name = "toolStripMenuItem18";
//
// MenuGridInsertRowBefore
//
resources.ApplyResources(this.MenuGridInsertRowBefore, "MenuGridInsertRowBefore");
this.MenuGridInsertRowBefore.Name = "MenuGridInsertRowBefore";
this.MenuGridInsertRowBefore.Click += new System.EventHandler(this.menuTableInsertRowBefore_Click);
//
// MenuGridInsertRowAfter
//
resources.ApplyResources(this.MenuGridInsertRowAfter, "MenuGridInsertRowAfter");
this.MenuGridInsertRowAfter.Name = "MenuGridInsertRowAfter";
this.MenuGridInsertRowAfter.Click += new System.EventHandler(this.menuTableInsertRowAfter_Click);
//
// toolStripMenuItem19
//
resources.ApplyResources(this.toolStripMenuItem19, "toolStripMenuItem19");
this.toolStripMenuItem19.Name = "toolStripMenuItem19";
//
// MenuGridDeleteColumn
//
resources.ApplyResources(this.MenuGridDeleteColumn, "MenuGridDeleteColumn");
this.MenuGridDeleteColumn.Name = "MenuGridDeleteColumn";
this.MenuGridDeleteColumn.Click += new System.EventHandler(this.menuTableDeleteColumn_Click);
//
// MenuGridDeleteRow
//
resources.ApplyResources(this.MenuGridDeleteRow, "MenuGridDeleteRow");
this.MenuGridDeleteRow.Name = "MenuGridDeleteRow";
this.MenuGridDeleteRow.Click += new System.EventHandler(this.menuTableDeleteRow_Click);
//
// MenuGridDeleteGrid
//
resources.ApplyResources(this.MenuGridDeleteGrid, "MenuGridDeleteGrid");
this.MenuGridDeleteGrid.Name = "MenuGridDeleteGrid";
this.MenuGridDeleteGrid.Click += new System.EventHandler(this.menuTableDelete_Click);
//
// toolStripMenuItem20
//
resources.ApplyResources(this.toolStripMenuItem20, "toolStripMenuItem20");
this.toolStripMenuItem20.Name = "toolStripMenuItem20";
//
// MenuGridCopy
//
resources.ApplyResources(this.MenuGridCopy, "MenuGridCopy");
this.MenuGridCopy.Name = "MenuGridCopy";
this.MenuGridCopy.Click += new System.EventHandler(this.menuCopy_Click);
//
// MenuGridPaste
//
resources.ApplyResources(this.MenuGridPaste, "MenuGridPaste");
this.MenuGridPaste.Name = "MenuGridPaste";
this.MenuGridPaste.Click += new System.EventHandler(this.menuPaste_Click);
//
// MenuGridDelete
//
resources.ApplyResources(this.MenuGridDelete, "MenuGridDelete");
this.MenuGridDelete.Name = "MenuGridDelete";
this.MenuGridDelete.Click += new System.EventHandler(this.menuDelete_Click);
//
// toolStripMenuItem21
//
resources.ApplyResources(this.toolStripMenuItem21, "toolStripMenuItem21");
this.toolStripMenuItem21.Name = "toolStripMenuItem21";
//
// MenuGridSelectAll
//
resources.ApplyResources(this.MenuGridSelectAll, "MenuGridSelectAll");
this.MenuGridSelectAll.Name = "MenuGridSelectAll";
this.MenuGridSelectAll.Click += new System.EventHandler(this.menuSelectAll_Click);
//
// ContextMenuTable
//
resources.ApplyResources(this.ContextMenuTable, "ContextMenuTable");
this.ContextMenuTable.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.MenuTableProperties,
this.MenuTableTableProperties,
this.MenuTableReplaceCell,
this.toolStripMenuItem22,
this.MenuTableInsertColumnBefore,
this.MenuTableInsertColumnAfter,
this.toolStripMenuItem23,
this.MenuTableInsertRowBefore,
this.MenuTableInsertRowAfter,
this.toolStripMenuItem24,
this.MenuTableInsertGroup,
this.MenuTableEditGroup,
this.MenuTableDeleteGroup,
this.toolStripMenuItem25,
this.MenuTableDeleteColumn,
this.MenuTableDeleteRow,
this.MenuTableDeleteTable,
this.toolStripMenuItem26,
this.MenuTableCopy,
this.MenuTablePaste,
this.MenuTableDelete,
this.toolStripMenuItem27,
this.MenuTableSelectAll});
this.ContextMenuTable.Name = "ContextMenuTable";
this.ContextMenuTable.Opened += new System.EventHandler(this.menuContext_Popup);
//
// MenuTableProperties
//
resources.ApplyResources(this.MenuTableProperties, "MenuTableProperties");
this.MenuTableProperties.Name = "MenuTableProperties";
this.MenuTableProperties.Click += new System.EventHandler(this.menuProperties_Click);
//
// MenuTableTableProperties
//
resources.ApplyResources(this.MenuTableTableProperties, "MenuTableTableProperties");
this.MenuTableTableProperties.Name = "MenuTableTableProperties";
this.MenuTableTableProperties.Click += new System.EventHandler(this.menuTableProperties_Click);
//
// MenuTableReplaceCell
//
resources.ApplyResources(this.MenuTableReplaceCell, "MenuTableReplaceCell");
this.MenuTableReplaceCell.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.MenuTableReplaceCellChart,
this.MenuTableReplaceCellImage,
this.MenuTableReplaceCellList,
this.MenuTableReplaceCellMatrix,
this.MenuTableReplaceCellRectangle,
this.MenuTableReplaceCellSubreport,
this.MenuTableReplaceCellTable,
this.MenuTableReplaceCellTextbox});
this.MenuTableReplaceCell.Name = "MenuTableReplaceCell";
//
// MenuTableReplaceCellChart
//
resources.ApplyResources(this.MenuTableReplaceCellChart, "MenuTableReplaceCellChart");
this.MenuTableReplaceCellChart.Name = "MenuTableReplaceCellChart";
this.MenuTableReplaceCellChart.Click += new System.EventHandler(this.menuInsertChart_Click);
//
// MenuTableReplaceCellImage
//
resources.ApplyResources(this.MenuTableReplaceCellImage, "MenuTableReplaceCellImage");
this.MenuTableReplaceCellImage.Name = "MenuTableReplaceCellImage";
this.MenuTableReplaceCellImage.Click += new System.EventHandler(this.menuInsertImage_Click);
//
// MenuTableReplaceCellList
//
resources.ApplyResources(this.MenuTableReplaceCellList, "MenuTableReplaceCellList");
this.MenuTableReplaceCellList.Name = "MenuTableReplaceCellList";
this.MenuTableReplaceCellList.Click += new System.EventHandler(this.menuInsertList_Click);
//
// MenuTableReplaceCellMatrix
//
resources.ApplyResources(this.MenuTableReplaceCellMatrix, "MenuTableReplaceCellMatrix");
this.MenuTableReplaceCellMatrix.Name = "MenuTableReplaceCellMatrix";
this.MenuTableReplaceCellMatrix.Click += new System.EventHandler(this.menuInsertMatrix_Click);
//
// MenuTableReplaceCellRectangle
//
resources.ApplyResources(this.MenuTableReplaceCellRectangle, "MenuTableReplaceCellRectangle");
this.MenuTableReplaceCellRectangle.Name = "MenuTableReplaceCellRectangle";
this.MenuTableReplaceCellRectangle.Click += new System.EventHandler(this.menuInsertRectangle_Click);
//
// MenuTableReplaceCellSubreport
//
resources.ApplyResources(this.MenuTableReplaceCellSubreport, "MenuTableReplaceCellSubreport");
this.MenuTableReplaceCellSubreport.Name = "MenuTableReplaceCellSubreport";
this.MenuTableReplaceCellSubreport.Click += new System.EventHandler(this.menuInsertSubreport_Click);
//
// MenuTableReplaceCellTable
//
resources.ApplyResources(this.MenuTableReplaceCellTable, "MenuTableReplaceCellTable");
this.MenuTableReplaceCellTable.Name = "MenuTableReplaceCellTable";
this.MenuTableReplaceCellTable.Click += new System.EventHandler(this.menuInsertTable_Click);
//
// MenuTableReplaceCellTextbox
//
resources.ApplyResources(this.MenuTableReplaceCellTextbox, "MenuTableReplaceCellTextbox");
this.MenuTableReplaceCellTextbox.Name = "MenuTableReplaceCellTextbox";
this.MenuTableReplaceCellTextbox.Click += new System.EventHandler(this.menuInsertTextbox_Click);
//
// toolStripMenuItem22
//
resources.ApplyResources(this.toolStripMenuItem22, "toolStripMenuItem22");
this.toolStripMenuItem22.Name = "toolStripMenuItem22";
//
// MenuTableInsertColumnBefore
//
resources.ApplyResources(this.MenuTableInsertColumnBefore, "MenuTableInsertColumnBefore");
this.MenuTableInsertColumnBefore.Name = "MenuTableInsertColumnBefore";
this.MenuTableInsertColumnBefore.Click += new System.EventHandler(this.menuTableInsertColumnBefore_Click);
//
// MenuTableInsertColumnAfter
//
resources.ApplyResources(this.MenuTableInsertColumnAfter, "MenuTableInsertColumnAfter");
this.MenuTableInsertColumnAfter.Name = "MenuTableInsertColumnAfter";
this.MenuTableInsertColumnAfter.Click += new System.EventHandler(this.menuTableInsertColumnAfter_Click);
//
// toolStripMenuItem23
//
resources.ApplyResources(this.toolStripMenuItem23, "toolStripMenuItem23");
this.toolStripMenuItem23.Name = "toolStripMenuItem23";
//
// MenuTableInsertRowBefore
//
resources.ApplyResources(this.MenuTableInsertRowBefore, "MenuTableInsertRowBefore");
this.MenuTableInsertRowBefore.Name = "MenuTableInsertRowBefore";
this.MenuTableInsertRowBefore.Click += new System.EventHandler(this.menuTableInsertRowBefore_Click);
//
// MenuTableInsertRowAfter
//
resources.ApplyResources(this.MenuTableInsertRowAfter, "MenuTableInsertRowAfter");
this.MenuTableInsertRowAfter.Name = "MenuTableInsertRowAfter";
this.MenuTableInsertRowAfter.Click += new System.EventHandler(this.menuTableInsertRowAfter_Click);
//
// toolStripMenuItem24
//
resources.ApplyResources(this.toolStripMenuItem24, "toolStripMenuItem24");
this.toolStripMenuItem24.Name = "toolStripMenuItem24";
//
// MenuTableInsertGroup
//
resources.ApplyResources(this.MenuTableInsertGroup, "MenuTableInsertGroup");
this.MenuTableInsertGroup.Name = "MenuTableInsertGroup";
this.MenuTableInsertGroup.Click += new System.EventHandler(this.menuTableInsertGroup_Click);
//
// MenuTableEditGroup
//
resources.ApplyResources(this.MenuTableEditGroup, "MenuTableEditGroup");
this.MenuTableEditGroup.Name = "MenuTableEditGroup";
//
// MenuTableDeleteGroup
//
resources.ApplyResources(this.MenuTableDeleteGroup, "MenuTableDeleteGroup");
this.MenuTableDeleteGroup.Name = "MenuTableDeleteGroup";
//
// toolStripMenuItem25
//
resources.ApplyResources(this.toolStripMenuItem25, "toolStripMenuItem25");
this.toolStripMenuItem25.Name = "toolStripMenuItem25";
//
// MenuTableDeleteColumn
//
resources.ApplyResources(this.MenuTableDeleteColumn, "MenuTableDeleteColumn");
this.MenuTableDeleteColumn.Name = "MenuTableDeleteColumn";
this.MenuTableDeleteColumn.Click += new System.EventHandler(this.menuTableDeleteColumn_Click);
//
// MenuTableDeleteRow
//
resources.ApplyResources(this.MenuTableDeleteRow, "MenuTableDeleteRow");
this.MenuTableDeleteRow.Name = "MenuTableDeleteRow";
this.MenuTableDeleteRow.Click += new System.EventHandler(this.menuTableDeleteRow_Click);
//
// MenuTableDeleteTable
//
resources.ApplyResources(this.MenuTableDeleteTable, "MenuTableDeleteTable");
this.MenuTableDeleteTable.Name = "MenuTableDeleteTable";
this.MenuTableDeleteTable.Click += new System.EventHandler(this.menuTableDelete_Click);
//
// toolStripMenuItem26
//
resources.ApplyResources(this.toolStripMenuItem26, "toolStripMenuItem26");
this.toolStripMenuItem26.Name = "toolStripMenuItem26";
//
// MenuTableCopy
//
resources.ApplyResources(this.MenuTableCopy, "MenuTableCopy");
this.MenuTableCopy.Name = "MenuTableCopy";
this.MenuTableCopy.Click += new System.EventHandler(this.menuCopy_Click);
//
// MenuTablePaste
//
resources.ApplyResources(this.MenuTablePaste, "MenuTablePaste");
this.MenuTablePaste.Name = "MenuTablePaste";
this.MenuTablePaste.Click += new System.EventHandler(this.menuPaste_Click);
//
// MenuTableDelete
//
resources.ApplyResources(this.MenuTableDelete, "MenuTableDelete");
this.MenuTableDelete.Name = "MenuTableDelete";
this.MenuTableDelete.Click += new System.EventHandler(this.menuDelete_Click);
//
// toolStripMenuItem27
//
resources.ApplyResources(this.toolStripMenuItem27, "toolStripMenuItem27");
this.toolStripMenuItem27.Name = "toolStripMenuItem27";
//
// MenuTableSelectAll
//
resources.ApplyResources(this.MenuTableSelectAll, "MenuTableSelectAll");
this.MenuTableSelectAll.Name = "MenuTableSelectAll";
this.MenuTableSelectAll.Click += new System.EventHandler(this.menuSelectAll_Click);
//
// DesignCtl
//
resources.ApplyResources(this, "$this");
this.Name = "DesignCtl";
this.ContextMenuDefault.ResumeLayout(false);
this.ContextMenuChart.ResumeLayout(false);
this.ContextMenuMatrix.ResumeLayout(false);
this.ContextMenuSubreport.ResumeLayout(false);
this.ContextMenuGrid.ResumeLayout(false);
this.ContextMenuTable.ResumeLayout(false);
this.ResumeLayout(false);
}
}
}
================================================
FILE: RdlDesign/DesignCtl.cs
================================================
using Majorsilence.Reporting.Rdl;
using Majorsilence.Reporting.RdlDesign.Resources;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml;
using System.Xml.Linq;
namespace Majorsilence.Reporting.RdlDesign
{
///
/// DesignCtl is a designer view of an RDL report
///
public partial class DesignCtl
{
public delegate void OpenSubreportEventHandler(object source, SubReportEventArgs e);
public delegate void HeightEventHandler(object source, HeightEventArgs e);
public event System.EventHandler ReportChanged;
public event System.EventHandler SelectionChanged;
public event System.EventHandler SelectionMoved;
public event System.EventHandler ReportItemInserted;
public event System.EventHandler VerticalScrollChanged;
public event System.EventHandler HorizontalScrollChanged;
public event OpenSubreportEventHandler OpenSubreport;
public event HeightEventHandler HeightChanged;
bool _InPaint; // to prevent recursively invoking paint
// Scrollbars
public VScrollBar _vScroll;
public HScrollBar _hScroll;
private float _DpiX;
private float _DpiY;
private XmlDocument _ReportDoc; // the xml document we're editting
private Undo _Undo; // the undo object tied to the _ReportDoc;
private string _CurrentInsert; // current object to insert; null if none
// Mouse control
private XmlNode _MouseDownNode; // XmlNode affected by the mouse down event
private HitLocationEnum _MouseDownLoc; // hit location affected by the mouse down event
private Point _MousePosition= new Point(); // position of the mouse
private Point _ptRBOriginal = new Point(); // starting position of the mouse (rubber banding)
private Point _ptRBLast = new Point(); // last position of mouse (rubber banding)
private bool _bHaveMouse; // flag indicates we're rubber banding
private bool _AdjustScroll = false; // when adjusting band height we may need to adjust scroll bars
public DesignXmlDraw _DrawPanel; // the main drawing panel
public RdlDesigner RdlDesigner;
public float SCALEX = 1;
public float SCALEY = 1;
public DesignCtl()
{
InitializeComponent();
// Get our graphics DPI
Graphics g = null;
try
{
g = this.CreateGraphics();
_DpiX = g.DpiX;
_DpiY = g.DpiY;
}
catch
{
_DpiX = _DpiY = 96;
}
finally
{
if (g != null)
g.Dispose();
}
// Handle the controls
_vScroll = new VScrollBar();
_vScroll.Scroll += new ScrollEventHandler(this.VerticalScroll);
_vScroll.Enabled = false;
_hScroll = new HScrollBar();
_hScroll.Scroll += new ScrollEventHandler(this.HorizontalScroll);
_hScroll.Enabled = false;
_DrawPanel = new DesignXmlDraw();
_DrawPanel.Paint += new PaintEventHandler(this.DrawPanelPaint);
_DrawPanel.MouseUp += new MouseEventHandler(this.DrawPanelMouseUp);
_DrawPanel.MouseDown += new MouseEventHandler(this.DrawPanelMouseDown);
_DrawPanel.Resize += new EventHandler(this.DrawPanelResize);
_DrawPanel.MouseWheel +=new MouseEventHandler(DrawPanelMouseWheel);
_DrawPanel.KeyDown += new KeyEventHandler(DrawPanelKeyDown);
_DrawPanel.MouseMove += new MouseEventHandler(DrawPanelMouseMove);
_DrawPanel.DoubleClick += new EventHandler(DrawPanelDoubleClick);
this.Layout +=new LayoutEventHandler(DesignCtl_Layout);
this.SuspendLayout();
// Must be added in this order for DockStyle to work correctly
this.Controls.Add(_DrawPanel);
this.Controls.Add(_vScroll);
this.Controls.Add(_hScroll);
this.ResumeLayout(false);
BuildContextMenus();
}
public void SignalReportChanged()
{
ReportChanged(this, new EventArgs());
}
public void SignalSelectionMoved()
{
SelectionMoved(this, new EventArgs());
}
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string CurrentInsert
{
get {return _CurrentInsert; }
set
{
_CurrentInsert = value;
}
}
public int VerticalScrollPosition
{
get { return _vScroll.Value; }
}
public int HorizontalScrollPosition
{
get { return _hScroll.Value; }
}
internal Color SepColor
{
get { return _DrawPanel.SepColor; }
}
internal float SepHeight
{
get { return _DrawPanel.SepHeight; }
}
internal float PageHeaderHeight
{
get {return _DrawPanel.PageHeaderHeight; }
}
internal float PageFooterHeight
{
get { return _DrawPanel.PageFooterHeight; }
}
internal float BodyHeight
{
get { return _DrawPanel.BodyHeight; }
}
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public XmlDocument ReportDocument
{
get {return _ReportDoc;}
set
{
_ReportDoc = value;
if (_ReportDoc != null)
{
_Undo = new Undo(_ReportDoc, 300);
_Undo.GroupsOnly = true; // don't record changes that we don't group.
}
int selCount = _DrawPanel.SelectedCount;
this._DrawPanel.ReportDocument = _ReportDoc;
if (selCount > 0) // changing report document forces change to selection
SelectionChanged(this, new EventArgs());
}
}
internal DesignXmlDraw DrawCtl
{
get {return _DrawPanel;}
}
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string ReportSource
{
get
{
if (_ReportDoc == null)
return null;
string result="";
try
{
// Convert the document into a string
StringWriter sw = new StringWriter();
var settings = new XmlWriterSettings
{
NewLineChars = RdlDesigner.XmlNewLine == NewLineChar.Unix ? "\n" : "\r\n",
Indent = true,
IndentChars = " "
};
var xw = XmlWriter.Create(sw, settings);
_ReportDoc.WriteContentTo(xw);
xw.Close();
sw.Close();
result = sw.ToString();
result = result.Replace("xmlns=\"\"", "");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, Strings.DesignCtl_Show_UnableCreateRDL);
}
return result;
}
set
{
if (value == null || value == "")
{
ReportDocument = null;
return;
}
XmlDocument xDoc = new XmlDocument();
xDoc.PreserveWhitespace = false;
xDoc.LoadXml(value); // this will throw an exception if invalid XML
ReportDocument = xDoc;
}
}
public void ClearUndo()
{
_Undo.Reset();
}
internal Undo UndoObject
{
get { return _Undo; }
}
public void Undo()
{
_Undo.undo();
_DrawPanel.ReportNames = null; // may not be required; but if reportitem deleted/inserted it must be
// determine if any of the selected nodes has been affected
bool clearSelect = false;
foreach (XmlNode n in _DrawPanel.SelectedList)
{
// this is an imperfect test but it shows if the node has been unchained.
if (n.ParentNode == null)
{
clearSelect = true;
break;
}
}
if (clearSelect)
_DrawPanel.SelectedList.Clear();
_DrawPanel.Invalidate();
}
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool ShowReportItemOutline
{
get { return _DrawPanel.ShowReportItemOutline; }
set
{
_DrawPanel.ShowReportItemOutline = value;
}
}
public void Redo()
{
}
public string UndoDescription
{
get { return _Undo.Description; }
}
public bool CanUndo
{
get { return _Undo.CanUndo; }
}
public void StartUndoGroup(string description)
{
_Undo.StartUndoGroup(description);
}
public void EndUndoGroup(bool keepChanges)
{
_Undo.EndUndoGroup(keepChanges);
}
public void Align(TextAlignEnum ta)
{
if (_DrawPanel.SelectedCount < 1)
return;
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_Align);
_Undo.EndUndoGroup();
return;
}
public void AlignLefts()
{
if (_DrawPanel.SelectedCount < 2)
return;
XmlNode model = _DrawPanel.SelectedList[0] as XmlNode;
XmlNode l = _DrawPanel.GetNamedChildNode(model, "Left");
string left = l == null? "0pt": l.InnerText;
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_Align);
foreach (XmlNode xNode in _DrawPanel.SelectedList)
{ // we even reset the first one; in case the attribute wasn't specified
_DrawPanel.SetElement(xNode, "Left", left);
}
_Undo.EndUndoGroup();
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
public void AlignRights()
{
if (_DrawPanel.SelectedCount < 2)
return;
XmlNode model = _DrawPanel.SelectedList[0] as XmlNode;
RectangleF mrect = _DrawPanel.GetReportItemRect(model); // size attributes in points
if (mrect.Width == float.MinValue)
return; // model doesn't have width specified
float mright = mrect.Left + mrect.Width; // the right side of the model
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_Align);
foreach (XmlNode xNode in _DrawPanel.SelectedList)
{
if (xNode == model)
continue;
RectangleF nrect = _DrawPanel.GetReportItemRect(xNode);
if (nrect.Width == float.MinValue)
continue;
float nleft = mright - nrect.Width;
if (nleft < 0)
nleft = 0;
string left = string.Format(NumberFormatInfo.InvariantInfo, "{0:0.00}pt", nleft);
_DrawPanel.SetElement(xNode, "Left", left);
}
_Undo.EndUndoGroup();
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
public void AlignCenters()
{
if (_DrawPanel.SelectedCount < 2)
return;
XmlNode model = _DrawPanel.SelectedList[0] as XmlNode;
RectangleF mrect = _DrawPanel.GetReportItemRect(model); // size attributes in points
if (mrect.Width == float.MinValue)
return; // model doesn't have width specified
float mc = mrect.Left + mrect.Width/2; // the middle of the model
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_Align);
foreach (XmlNode xNode in _DrawPanel.SelectedList)
{
if (xNode == model)
continue;
RectangleF nrect = _DrawPanel.GetReportItemRect(xNode);
if (nrect.Width == float.MinValue)
continue;
float nleft = (mc - (nrect.Left + nrect.Width/2));
nleft += nrect.Left;
if (nleft < 0)
nleft = 0;
string left = string.Format(NumberFormatInfo.InvariantInfo,"{0:0.00}pt", nleft);
_DrawPanel.SetElement(xNode, "Left", left);
}
_Undo.EndUndoGroup();
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
///
/// Align to center in a container a selected item.
/// Items Tested : Simple TextBox , Rectangle , TextBox inside Rectangle , Line , Table
/// For a selected Item the container can be a Section (PageHeader,Body,PageFooter) or another item (typ. rectangle)
/// For Table alignment select only 1 cell
///
///
public void HorizontalCenterInsideContainer()
{
// Get the selected node
XmlNode model = _DrawPanel.SelectedList[0] as XmlNode;
RectangleF mrect;
float W;
//
// If item selected is inside Table
//
if (_DrawPanel.InTable(model) == true)
{
// Get parent table of the selected node
XmlNode NodoTable = _DrawPanel.TMParent(model);
// Get size of table
mrect = _DrawPanel.GetRectangle(NodoTable);
//
// Get the size in point of the container and its center
//
W= _DrawPanel.WidthOfContainer(NodoTable) / 2;
//
// Calculate new Left position for table
//
float nleft = W - mrect.Width / 2;
//
// Set new left position of table
//
string left = string.Format(NumberFormatInfo.InvariantInfo, "{0:0.00}pt", nleft);
_DrawPanel.SetElement(NodoTable, "Left", left);
}
else
{
// Get rectangle that contains the model
mrect = _DrawPanel.GetReportItemRect(model);
if (mrect.Width == float.MinValue) return;
//
// Get the size in point of the container and its center
//
W = _DrawPanel.WidthOfContainer(model) / 2;
//
// Calculate new Left position for model
//
float nleft = W - mrect.Width / 2;
//
// Set new left position of model
//
string left = string.Format(NumberFormatInfo.InvariantInfo, "{0:0.00}pt", nleft);
_DrawPanel.SetElement(model, "Left", left);
}
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
///
/// Vertical center alignment.
/// Alignment can be done only on item inside a container (ie rectangle) or only PageHeader or Footer
///
public void VerticalCenterInsideContainer()
{
// Get the selected node
XmlNode model = _DrawPanel.SelectedList[0] as XmlNode;
RectangleF mrect;
float SectionHeight;
float NewTop;
//
// If item selected is inside Table do nothing
//
if (_DrawPanel.InTable(model) == true)
{
return;
}
//
// Get the Height of the model container
//
SectionHeight=_DrawPanel.HeightOfContainer(model);
//
// do nothing if invalid section Height
//
if(SectionHeight == 0) return;
// Get rectangle that contains the model
mrect = _DrawPanel.GetReportItemRect(model);
// Calculate new Top for model
NewTop=(SectionHeight- mrect.Height) / 2;
string top = string.Format(NumberFormatInfo.InvariantInfo, "{0:0.00}pt", NewTop);
_DrawPanel.SetElement(model, "Top", top);
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
public void AlignTops()
{
if (_DrawPanel.SelectedCount < 2)
return;
XmlNode model = _DrawPanel.SelectedList[0] as XmlNode;
XmlNode t = _DrawPanel.GetNamedChildNode(model, "Top");
string top = t == null? "0pt": t.InnerText;
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_Align);
foreach (XmlNode xNode in _DrawPanel.SelectedList)
{ // we even reset the first one; in case the attribute wasn't specified
_DrawPanel.SetElement(xNode, "Top", top);
}
_Undo.EndUndoGroup();
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
public void AlignBottoms()
{
if (_DrawPanel.SelectedCount < 2)
return;
XmlNode model = _DrawPanel.SelectedList[0] as XmlNode;
RectangleF mrect = _DrawPanel.GetReportItemRect(model); // size attributes in points
if (mrect.Height == float.MinValue)
return; // model doesn't have height specified
float mbottom = mrect.Top + mrect.Height; // the bottom side of the model
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_Align);
foreach (XmlNode xNode in _DrawPanel.SelectedList)
{
if (xNode == model)
continue;
RectangleF nrect = _DrawPanel.GetReportItemRect(xNode);
if (nrect.Height == float.MinValue)
continue;
float ntop = mbottom - nrect.Height;
if (ntop < 0)
ntop = 0;
string top = string.Format(NumberFormatInfo.InvariantInfo, "{0:0.00}pt", ntop);
_DrawPanel.SetElement(xNode, "Top", top);
}
_Undo.EndUndoGroup();
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
public void AlignMiddles()
{
if (_DrawPanel.SelectedCount < 2)
return;
XmlNode model = _DrawPanel.SelectedList[0] as XmlNode;
RectangleF mrect = _DrawPanel.GetReportItemRect(model); // size attributes in points
if (mrect.Height == float.MinValue)
return; // model doesn't have height specified
float mc = mrect.Top + mrect.Height/2; // the middle of the model
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_Align);
foreach (XmlNode xNode in _DrawPanel.SelectedList)
{
if (xNode == model)
continue;
RectangleF nrect = _DrawPanel.GetReportItemRect(xNode);
if (nrect.Height == float.MinValue)
continue;
float ntop = (mc - (nrect.Top + nrect.Height/2));
ntop += nrect.Top;
if (ntop < 0)
ntop = 0;
string top = string.Format(NumberFormatInfo.InvariantInfo, "{0:0.00}pt", ntop);
_DrawPanel.SetElement(xNode, "Top", top);
}
_Undo.EndUndoGroup();
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
public void SizeHeights()
{
XmlNode model = _DrawPanel.SelectedList[0] as XmlNode;
XmlNode h = _DrawPanel.GetNamedChildNode(model, "Height");
if (h == null)
return;
string height = h.InnerText;
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_Size);
foreach (XmlNode xNode in _DrawPanel.SelectedList)
{ // we even reset the first one; in case the attribute wasn't specified
_DrawPanel.SetElement(xNode, "Height", height);
}
_Undo.EndUndoGroup();
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
public void SizeWidths()
{
XmlNode model = _DrawPanel.SelectedList[0] as XmlNode;
XmlNode w = _DrawPanel.GetNamedChildNode(model, "Width");
if (w == null)
return;
string width = w.InnerText;
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_Size);
foreach (XmlNode xNode in _DrawPanel.SelectedList)
{ // we even reset the first one; in case the attribute wasn't specified
_DrawPanel.SetElement(xNode, "Width", width);
}
_Undo.EndUndoGroup();
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
public void SizeBoth()
{
XmlNode model = _DrawPanel.SelectedList[0] as XmlNode;
XmlNode w = _DrawPanel.GetNamedChildNode(model, "Width");
if (w == null)
return;
string width = w.InnerText;
XmlNode h = _DrawPanel.GetNamedChildNode(model, "Height");
if (h == null)
return;
string height = h.InnerText;
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_Size);
foreach (XmlNode xNode in _DrawPanel.SelectedList)
{ // we even reset the first one; in case the attribute wasn't specified
_DrawPanel.SetElement(xNode, "Height", height);
_DrawPanel.SetElement(xNode, "Width", width);
}
_Undo.EndUndoGroup();
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
void HorzSpacing(float diff)
{
XmlNode model = _DrawPanel.SelectedList[0] as XmlNode;
RectangleF rectm = _DrawPanel.GetReportItemRect(model);
if (rectm.Width == float.MinValue)
return;
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_Spacing);
float x = rectm.Left + rectm.Width + diff;
foreach (XmlNode xNode in _DrawPanel.SelectedList)
{
if (xNode == model)
continue;
string left = string.Format(NumberFormatInfo.InvariantInfo,"{0:0.00}pt", x);
_DrawPanel.SetElement(xNode, "Left", left);
RectangleF rectn = _DrawPanel.GetReportItemRect(xNode);
if (rectn.Width == float.MinValue)
rectn.Width = 77;
x += (rectn.Width + diff);
}
_Undo.EndUndoGroup();
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
float HorzSpacingDiff()
{
float diff = 0;
if (_DrawPanel.SelectedList.Count < 2)
return diff;
XmlNode m1 = _DrawPanel.SelectedList[0] as XmlNode;
RectangleF r1 = _DrawPanel.GetReportItemRect(m1);
if (r1.Width == float.MinValue)
return diff;
XmlNode m2 = _DrawPanel.SelectedList[1] as XmlNode;
RectangleF r2 = _DrawPanel.GetReportItemRect(m2);
diff = r2.Left - (r1.Left + r1.Width);
if (diff < 0)
diff = 0;
return diff;
}
public void HorzSpacingMakeEqual()
{
if (_DrawPanel.SelectedList.Count < 2)
return;
HorzSpacing(HorzSpacingDiff());
}
public void HorzSpacingIncrease()
{
float diff = HorzSpacingDiff() + 8;
HorzSpacing(diff);
}
public void HorzSpacingDecrease()
{
float diff = HorzSpacingDiff() - 8;
if (diff < 0)
diff = 0;
HorzSpacing(diff);
}
public void HorzSpacingMakeZero()
{
HorzSpacing(0);
}
void VertSpacing(float diff)
{
XmlNode model = _DrawPanel.SelectedList[0] as XmlNode;
RectangleF rectm = _DrawPanel.GetReportItemRect(model);
if (rectm.Height == float.MinValue)
return;
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_Spacing);
float y = rectm.Top + rectm.Height + diff;
foreach (XmlNode xNode in _DrawPanel.SelectedList)
{
if (xNode == model)
continue;
string top = string.Format(NumberFormatInfo.InvariantInfo, "{0:0.00}pt", y);
_DrawPanel.SetElement(xNode, "Top", top);
RectangleF rectn = _DrawPanel.GetReportItemRect(xNode);
if (rectn.Height == float.MinValue)
rectn.Height = 16;
y += (rectn.Height + diff);
}
_Undo.EndUndoGroup();
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
float VertSpacingDiff()
{
float diff = 0;
if (_DrawPanel.SelectedList.Count < 2)
return diff;
XmlNode m1 = _DrawPanel.SelectedList[0] as XmlNode;
RectangleF r1 = _DrawPanel.GetReportItemRect(m1);
if (r1.Height == float.MinValue)
return diff;
XmlNode m2 = _DrawPanel.SelectedList[1] as XmlNode;
RectangleF r2 = _DrawPanel.GetReportItemRect(m2);
diff = r2.Top - (r1.Top + r1.Height);
if (diff < 0)
diff = 0;
return diff;
}
public void VertSpacingMakeEqual()
{
if (_DrawPanel.SelectedList.Count < 2)
return;
VertSpacing(VertSpacingDiff());
}
public void VertSpacingIncrease()
{
float diff = VertSpacingDiff() + 8;
VertSpacing(diff);
}
public void VertSpacingDecrease()
{
float diff = VertSpacingDiff() - 8;
if (diff < 0)
diff = 0;
VertSpacing(diff);
}
public void VertSpacingMakeZero()
{
VertSpacing(0);
}
public void SetPadding(string name, int diff)
{
if (_DrawPanel.SelectedList.Count < 1)
return;
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_Padding);
foreach (XmlNode n in _DrawPanel.SelectedList)
{
XmlNode sNode = this._DrawPanel.GetCreateNamedChildNode(n, "Style");
if (diff == 0)
_DrawPanel.SetElement(sNode, name, "0pt");
else
{
float pns = _DrawPanel.GetSize(sNode, name);
pns += diff;
if (pns < 0)
pns = 0;
string pad = string.Format(NumberFormatInfo.InvariantInfo, "{0:0.00}pt", pns);
_DrawPanel.SetElement(sNode, name, pad);
}
}
_Undo.EndUndoGroup();
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
public void Cut()
{
if (_DrawPanel.SelectedCount <= 0)
return;
Clipboard.SetDataObject(GetCopy(), true);
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_Cut);
_DrawPanel.DeleteSelected();
_Undo.EndUndoGroup();
SelectionChanged(this, new EventArgs());
}
public void Copy()
{
Clipboard.SetDataObject(GetCopy(), true);
}
public void Clear()
{
return;
}
public void Delete()
{
if (_DrawPanel.SelectedCount > 0)
{
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_Delete);
_DrawPanel.DeleteSelected();
_Undo.EndUndoGroup();
ReportChanged(this, new EventArgs());
SelectionChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
}
public void Paste()
{
DoPaste(null,new PointF(0,0));
}
public void SelectAll()
{
doSelectAll();
}
public int SelectionCount
{
get { return this._DrawPanel.SelectedCount; }
}
public string SelectedText
{
get
{
if (_DrawPanel.SelectedCount == 0)
return "";
return GetCopy();
}
}
public string SelectionName
{
get
{
if (_DrawPanel.SelectedCount == 0)
return "";
if (_DrawPanel.SelectedCount > 1)
return Strings.DesignCtl_SelectionName_GroupSelection;
XmlNode xNode = _DrawPanel.SelectedList[0];
if (xNode.Name == "TableColumn" || xNode.Name == "TableRow")
return "";
var xAttr = xNode.Attributes != null ? xNode.Attributes["Name"] : null;
if (xAttr == null)
return Strings.DesignCtl_SelectionName_Unnamed;
XmlNode cNode = _DrawPanel.GetReportItemContainer(xNode);
if (cNode == null)
return xAttr.Value;
var cAttr = cNode.Attributes != null ? cNode.Attributes["Name"] : null;
if (cAttr == null)
return xAttr.Value + " " + Strings.DesignCtl_SelectionName_in + " " + cNode.Name;
var title = xAttr.Value + " " + Strings.DesignCtl_SelectionName_in + " " + cNode.Name.Replace("fyi:", "") + " " + cAttr.Value;
if (!(cNode.Name == "Table" || cNode.Name == "fyi:Grid"))
return title;
XmlNode pNode = xNode.ParentNode.ParentNode;
if (pNode.Name != "TableCell")
return title;
XmlNode trNode = pNode.ParentNode.ParentNode; // should be TableRow
if (trNode.Name != "TableRow")
return title;
// Find the number of the TableRow -- e.g. 1st, 2nd, 3rd, ...
int trNumber=1;
foreach (XmlNode n in trNode.ParentNode.ChildNodes)
{
if (n == trNode)
break;
trNumber++;
}
pNode = trNode.ParentNode.ParentNode; // Details, Header or Footer
string rowTitle = trNumber > 1? string.Format("{0}({1})", pNode.Name, trNumber): pNode.Name;
if (pNode.Name == "Details")
return title + " " + rowTitle;
// We've got a Header or a Footer; could be a group header/footer
pNode = pNode.ParentNode;
if (pNode.Name != "TableGroup")
return title + " " + rowTitle;
// We're in a group; find out the group name
XmlNode gNode = this._DrawPanel.GetNamedChildNode(pNode, "Grouping");
if (gNode == null)
return title + " " + rowTitle;
XmlAttribute gAttr = gNode.Attributes["Name"];
if (gAttr == null)
return title + " " + rowTitle;
return title + ", " + Strings.DesignCtl_SelectionName_Group + " " + gAttr.Value + " " + rowTitle;
}
}
public PointF SelectionPosition
{
get
{
if (_DrawPanel.SelectedCount == 0)
return new PointF(float.MinValue,float.MinValue);
XmlNode xNode = _DrawPanel.SelectedList[0];
return _DrawPanel.SelectionPosition(xNode);
}
}
public SizeF SelectionSize
{
get
{
if (_DrawPanel.SelectedCount == 0)
return new SizeF(float.MinValue,float.MinValue);
XmlNode xNode = _DrawPanel.SelectedList[0];
return _DrawPanel.SelectionSize(xNode);
}
}
public StyleInfo SelectedStyle
{
get
{
if (_DrawPanel.SelectedCount == 0)
return null;
XmlNode xNode = _DrawPanel.SelectedList[0];
// HACK: async
return Task.Run(async () => await _DrawPanel.GetStyleInfo(xNode)).GetAwaiter().GetResult();
}
}
public void ApplyStyleToSelected(string name, string v)
{
if (_DrawPanel.SelectedCount == 0)
return;
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_Style);
_DrawPanel.ApplyStyleToSelected(name, v);
_Undo.EndUndoGroup(true);
ReportChanged(this, new EventArgs());
}
public void SetSelectedText(string v)
{
if (_DrawPanel.SelectedCount != 1)
return;
XmlNode tn = _DrawPanel.SelectedList[0] as XmlNode;
if (tn == null || tn.Name != "Textbox")
return;
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_TextboxValue);
_DrawPanel.SetElement(tn, "Value", v);
_Undo.EndUndoGroup(true);
_DrawPanel.Invalidate(); // force a repaint
ReportChanged(this, new EventArgs());
}
private void BuildContextMenus()
{
BuildContextMenusCustom(MenuDefaultInsert);
}
private void BuildContextMenusCustom(ToolStripDropDownItem menuItem)
{
try
{
var sa = RdlEngineConfig.GetCustomReportTypes();
if (sa == null || sa.Length == 0)
return;
var separator = menuItem.DropDownItems["CustomSeparator"];
if (separator == null)
{
separator = new ToolStripSeparator { Name = "CustomSeparator" };
menuItem.DropDownItems.Add(separator); // put a separator
}
else
{
var index = menuItem.DropDownItems.IndexOf(separator) + 1;
while (menuItem.DropDownItems.Count > index)
{
menuItem.DropDownItems.RemoveAt(index);
}
}
// Add the custom report items to the insert menu
foreach (var m in sa)
{
var mi = new ToolStripMenuItem(m + "...");
mi.Click += menuInsertCustomReportItem_Click;
mi.Tag = m;
menuItem.DropDownItems.Add(mi);
}
}
catch (Exception ex)
{
MessageBox.Show(string.Format(Strings.DesignCtl_ShowB_CustomReportItemError, ex.Message), Strings.DesignCtl_Show_Insert, MessageBoxButtons.OK);
}
}
private Bitmap _buffer;
// HACK: async shenanigans
bool doGraphicsDraw;
private async void DrawPanelPaint(object sender, System.Windows.Forms.PaintEventArgs e)
{
// HACK: async shenanigans
if (doGraphicsDraw && _buffer != null)
{
e.Graphics.DrawImage(_buffer, 0, 0);
_buffer.Dispose();
_buffer = null;
doGraphicsDraw = false;
}
else
{
// HACK: async shenanigans
await Internal_DrawPanelPaint();
doGraphicsDraw = true;
// HACK: async shenanigans, force a repaint where e.Graphics is still valid
_DrawPanel.Invalidate();
}
}
private async Task Internal_DrawPanelPaint()
{
// Only handle one paint at a time
lock (this)
{
if (_InPaint)
return;
_InPaint = true;
}
// Create a self-contained Graphics object
_buffer = new Bitmap(Math.Max(1, _DrawPanel.Width), Math.Max(1, _DrawPanel.Height));
using (Graphics g = Graphics.FromImage(_buffer))
{
try // never want to die in here
{
if (this._ReportDoc == null) // if no report force the simplest one
CreateEmptyReportDoc();
//g.ClipBounds;
var clip = new Rectangle(PixelsX(_hScroll.Value), PixelsY(_vScroll.Value),
PixelsX(_DrawPanel.Width), PixelsY(_DrawPanel.Height));
// Draw the report asynchronously
await _DrawPanel.Draw(g, PointsX(_hScroll.Value), PointsY(_vScroll.Value), clip);
}
catch (Exception ex)
{ // don't want to kill process if we die -- put up some kind of error message
StringFormat format = new StringFormat();
string msg = string.Format("Error drawing report. Likely error in syntax. Switch to syntax and correct report syntax.{0}{1}{0}{2}",
Environment.NewLine, ex.Message, ex.StackTrace);
g.DrawString(msg, this.Font, Brushes.Black, new Rectangle(2, 2, this.Width, this.Height), format);
}
}
lock (this)
{
_InPaint = false;
}
}
private void CreateEmptyReportDoc()
{
XmlDocument xDoc = new XmlDocument();
xDoc.PreserveWhitespace = false;
xDoc.LoadXml("0pt");
ReportDocument = xDoc;
}
private void DrawPanelResize(object sender, EventArgs e)
{
_DrawPanel.Refresh();
SetScrollControls();
}
internal float PointsX(float x) // pixels to points
{
return x * DesignXmlDraw.POINTSIZED / _DpiX;
}
internal float PointsY(float y)
{
return y * DesignXmlDraw.POINTSIZED / _DpiY;
}
internal int PixelsX(float x) // points to pixels
{
return (int)(x * _DpiX / DesignXmlDraw.POINTSIZED);
}
internal int PixelsY(float y)
{
return (int)(y * _DpiY / DesignXmlDraw.POINTSIZED);
}
internal void SetScrollControls()
{
if (_ReportDoc == null) // nothing loaded; nothing to do
{
_vScroll.Enabled = _hScroll.Enabled = false;
_vScroll.Value = _hScroll.Value = 0;
return;
}
SetScrollControlsV();
SetScrollControlsH();
}
private void SetScrollControlsV()
{
// calculate the vertical scroll needed
int h = PixelsY(_DrawPanel.VerticalMax); // size we need to show
int sh = this.Height - _hScroll.Height;
if (sh > h || sh < 0)
{
_vScroll.Enabled = false;
if (_vScroll.Value != 0)
{
_vScroll.Value = 0;
_DrawPanel.Invalidate(); // force a repaint
}
return;
}
_vScroll.Minimum = 0;
_vScroll.Maximum = h;
int sValue = Math.Min(_vScroll.Value, _vScroll.Maximum);
if (_vScroll.Value != sValue)
{
_vScroll.Value = sValue;
_DrawPanel.Invalidate(); // force a repaint
}
_vScroll.LargeChange = sh;
_vScroll.SmallChange = _vScroll.LargeChange / 5;
_vScroll.Enabled = true;
return;
}
private void SetScrollControlsH()
{
int w = PixelsX(_DrawPanel.HorizontalMax);
int sw = this.Width - _hScroll.Width;
if (sw > w)
{
_hScroll.Enabled = false;
if (_hScroll.Value != 0)
{
_hScroll.Value = 0;
_DrawPanel.Invalidate();
}
return;
}
_hScroll.Maximum = w;
_hScroll.Minimum = 0;
int sValue = Math.Min(_hScroll.Value, _hScroll.Maximum);
if (_hScroll.Value != sValue)
{
_hScroll.Value = sValue;
_DrawPanel.Invalidate();
}
if (sw < 0)
sw = 0;
_hScroll.LargeChange = sw;
_hScroll.SmallChange = _hScroll.LargeChange / 5;
_hScroll.Enabled = true;
_hScroll.Visible=true;
return;
}
private new void HorizontalScroll(object sender, System.Windows.Forms.ScrollEventArgs e)
{
if (e.NewValue == _hScroll.Value) // don't need to scroll if already there
return;
_DrawPanel.Invalidate();
if (HorizontalScrollChanged != null)
HorizontalScrollChanged(this, new EventArgs());
}
private new void VerticalScroll(object sender, System.Windows.Forms.ScrollEventArgs e)
{
if (e.NewValue == _vScroll.Value) // don't need to scroll if already there
return;
_DrawPanel.Invalidate();
if (VerticalScrollChanged != null)
VerticalScrollChanged(this, new EventArgs());
}
private void DrawPanelMouseUp(object sender, MouseEventArgs E)
{
MouseEventArgsE e = new MouseEventArgsE(E, SCALEX, SCALEY);
if (e.Button == MouseButtons.Left)
_Undo.EndUndoGroup(true);
if (_MouseDownNode != null && _MouseDownNode.Name == "Height")
HeightChanged(this, new HeightEventArgs(_MouseDownNode, null)); // reset any mousemove
_MouseDownNode = null;
if (this._bHaveMouse)
{ // Handle the end of the rubber banding
_bHaveMouse = false;
// remove last rectangle if necessary
if (this._ptRBLast.X != -1)
{
this.DrawPanelRubberBand(this._ptRBOriginal, this._ptRBLast);
// Process the rectangle
Rectangle r = DrawPanelRectFromPoints(this._ptRBOriginal, this._ptRBLast);
if ((Control.ModifierKeys & Keys.Control) != Keys.Control) // we allow addition to selection
_DrawPanel.ClearSelected();
_DrawPanel.SelectInRectangle(r, PointsX(_hScroll.Value), PointsY(_vScroll.Value));
SelectionChanged(this, new EventArgs());
}
// clear out the points for the next time
_ptRBOriginal.X = _ptRBOriginal.Y = _ptRBLast.X = _ptRBLast.Y = -1;
}
else if (e.Button == MouseButtons.Right)
{
DrawPanelContextMenu(new Point(e.X, e.Y));
}
if (_AdjustScroll)
{
this.SetScrollControls();
_AdjustScroll = false;
}
}
private void DrawPanelContextMenu(Point p)
{
if (_DrawPanel.SelectedCount == 1)
{
XmlNode cNode = _DrawPanel.SelectedList[0];
if (cNode.Name == "Chart")
DrawPanelContextMenuChart(p, cNode);
else if (cNode.Name == "Subreport")
DrawPanelContextMenuSubreport(p, cNode);
else if (_DrawPanel.InTable(cNode))
DrawPanelContextMenuTable(p, cNode);
else if (_DrawPanel.InMatrix(cNode))
DrawPanelContextMenuMatrix(p, cNode);
else
DrawPanelContextMenuDefault(p);
}
else
DrawPanelContextMenuDefault(p);
}
private void DrawPanelContextMenuChart(Point p, XmlNode riNode)
{
// Get the Category Groupings
var catGroupNames = _DrawPanel.GetChartCategoryGroupNames(riNode);
MenuChartEditCategoryGrouping.DropDownItems.Clear();
MenuChartDeleteCategoryGrouping.DropDownItems.Clear();
MenuChartEditCategoryGrouping.Enabled = catGroupNames != null;
MenuChartDeleteCategoryGrouping.Enabled = catGroupNames != null;
if (catGroupNames != null)
{
foreach (var gname in catGroupNames)
{
var em = new ToolStripMenuItem(gname);
em.Click += menuChartEditGrouping_Click;
MenuChartEditCategoryGrouping.DropDownItems.Add(em);
em = new ToolStripMenuItem(gname);
em.Click += menuChartDeleteGrouping_Click;
MenuChartDeleteCategoryGrouping.DropDownItems.Add(em);
}
}
// Get the Series Groupings
var serGroupNames = _DrawPanel.GetChartSeriesGroupNames(riNode);
MenuChartEditSeriesGrouping.DropDownItems.Clear();
MenuChartDeleteSeriesGrouping.DropDownItems.Clear();
MenuChartEditSeriesGrouping.Enabled = serGroupNames != null;
MenuChartDeleteSeriesGrouping.Enabled = serGroupNames != null;
if (serGroupNames != null)
{
foreach (var gname in serGroupNames)
{
var em = new ToolStripMenuItem(gname);
em.Click += menuChartEditGrouping_Click;
MenuChartEditSeriesGrouping.DropDownItems.Add(em);
em = new ToolStripMenuItem(gname);
em.Click += menuChartDeleteGrouping_Click;
MenuChartDeleteSeriesGrouping.DropDownItems.Add(em);
}
}
ContextMenuChart.Show(this, p);
}
private void DrawPanelContextMenuDefault(Point p)
{
ContextMenuDefault.Show(this, p);
}
private void DrawPanelContextMenuMatrix(Point p, XmlNode riNode)
{
// Get the column groupings
var colGroupNames = _DrawPanel.GetMatrixColumnGroupNames(riNode);
var rowGroupNames = _DrawPanel.GetMatrixRowGroupNames(riNode);
MenuMatrixEditColumnGroup.DropDownItems.Clear();
MenuMatrixDeleteColumnGroup.DropDownItems.Clear();
MenuMatrixEditRowGroup.DropDownItems.Clear();
MenuMatrixDeleteRowGroup.DropDownItems.Clear();
MenuMatrixEditColumnGroup.Enabled = colGroupNames != null;
MenuMatrixDeleteColumnGroup.Enabled = colGroupNames != null;
MenuMatrixEditRowGroup.Enabled = rowGroupNames != null;
MenuMatrixDeleteRowGroup.Enabled = rowGroupNames != null;
if (colGroupNames != null)
{
foreach (var gname in colGroupNames)
{
var em = new ToolStripMenuItem(gname);
em.Click += menuMatrixEditGroup_Click;
MenuMatrixEditColumnGroup.DropDownItems.Add(em);
em = new ToolStripMenuItem(gname);
em.Click += menuMatrixDeleteGroup_Click;
MenuMatrixDeleteColumnGroup.DropDownItems.Add(em);
}
}
if (rowGroupNames != null)
{
foreach (var gname in rowGroupNames)
{
var em = new ToolStripMenuItem(gname);
em.Click += menuMatrixEditGroup_Click;
MenuMatrixEditRowGroup.DropDownItems.Add(em);
em = new ToolStripMenuItem(gname);
em.Click += menuMatrixDeleteGroup_Click;
MenuMatrixDeleteRowGroup.DropDownItems.Add(em);
}
}
ContextMenuMatrix.Show(this, p);
}
private void DrawPanelContextMenuSubreport(Point p, XmlNode sr)
{
ContextMenuSubreport.Show(this, p);
}
private void DrawPanelContextMenuTable(Point p, XmlNode riNode)
{
var bTable = !_DrawPanel.InGrid(riNode);
var tblGroupNames = _DrawPanel.GetTableGroupNames(riNode);
if (!bTable)
{
ContextMenuGrid.Show(this, p);
}
else
{
MenuTableEditGroup.DropDownItems.Clear();
MenuTableDeleteGroup.DropDownItems.Clear();
MenuTableEditGroup.Enabled = tblGroupNames != null;
MenuTableDeleteGroup.Enabled = tblGroupNames != null;
if (tblGroupNames != null)
{
foreach (var gname in tblGroupNames)
{
var em = new ToolStripMenuItem(gname);
em.Click += menuTableEditGroup_Click;
MenuTableEditGroup.DropDownItems.Add(em);
em = new ToolStripMenuItem(gname);
em.Click += menuTableDeleteGroup_Click;
MenuTableDeleteGroup.DropDownItems.Add(em);
}
}
ContextMenuTable.Show(this, p);
}
}
private void DrawPanelMouseMove(object sender, MouseEventArgs E)
{
MouseEventArgsE e = new MouseEventArgsE(E, SCALEX, SCALEY);
XmlNode b=null;
HitLocationEnum hle = HitLocationEnum.Inside;
Point newMousePosition = new Point(e.X, e.Y);
if (_bHaveMouse)
{ // we're rubber banding
// If we drew previously; we'll draw again to remove old rectangle
if( this._ptRBLast.X != -1 )
{
this.DrawPanelRubberBand( this._ptRBOriginal, _ptRBLast );
}
_MousePosition = newMousePosition;
// Update last point; but don't rubber band outside our client area
if (newMousePosition.X < 0)
newMousePosition.X = 0;
if (newMousePosition.X > _DrawPanel.Width)
newMousePosition.X = _DrawPanel.Width;
if (newMousePosition.Y < 0)
newMousePosition.Y = 0;
if (newMousePosition.Y > _DrawPanel.Height)
newMousePosition.Y = _DrawPanel.Height;
_ptRBLast = newMousePosition;
if (_ptRBLast.X < 0)
_ptRBLast.X = 0;
if (_ptRBLast.Y < 0)
_ptRBLast.Y = 0;
// Draw new lines.
this.DrawPanelRubberBand( _ptRBOriginal, newMousePosition );
this.Cursor = Cursors.Cross; // use cross hair to indicate drawing
return;
}
else if (_MouseDownNode != null)
{
if (e.Button != MouseButtons.Left)
b = _MouseDownNode;
else
{
b = _MouseDownNode;
switch (_MouseDownNode.Name)
{
case "TableColumn":
case "RowGrouping":
case "MatrixColumn":
hle = HitLocationEnum.TableColumnResize;
if (e.X == _MousePosition.X)
break;
if (_DrawPanel.TableColumnResize(_MouseDownNode, e.X - _MousePosition.X))
{
SelectionMoved(this, new EventArgs());
ReportChanged(this, new EventArgs());
_AdjustScroll = true;
_DrawPanel.Invalidate();
}
else // trying to drag into invalid area; disallow
{
Cursor.Position = this.PointToScreen(_MousePosition);
newMousePosition = this.PointToClient(Cursor.Position);
}
break;
case "TableRow":
case "ColumnGrouping":
case "MatrixRow":
hle = HitLocationEnum.TableRowResize;
if (e.Y == _MousePosition.Y)
break;
if (_DrawPanel.TableRowResize(_MouseDownNode, e.Y - _MousePosition.Y))
{
SelectionMoved(this, new EventArgs());
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
else // trying to drag into invalid area; disallow
{
Cursor.Position = this.PointToScreen(_MousePosition);
newMousePosition = this.PointToClient(Cursor.Position);
}
break;
case "Height":
if (e.Y == _MousePosition.Y)
break;
if (_DrawPanel.ChangeHeight(_MouseDownNode, e.Y - _MousePosition.Y, 0))
{
ReportChanged(this, new EventArgs());
HeightChanged(this, new HeightEventArgs(_MouseDownNode, b.InnerText));
_DrawPanel.Invalidate();
_AdjustScroll = true; // this will force scroll bars to be adjusted on MouseUp
}
else // trying to drag into invalid area; disallow
{
Cursor.Position = this.PointToScreen(_MousePosition);
newMousePosition = this.PointToClient(Cursor.Position);
}
// Force scroll when off end of page
//if (e.Y > _DrawPanel.Height)
//{
// int hs = _vScroll.Value + _vScroll.SmallChange;
// _vScroll.Value = Math.Min(_vScroll.Maximum, hs);
// _DrawPanel.Refresh();
//}
break;
case "Textbox":
case "Image":
case "Rectangle":
case "List":
case "Table":
case "fyi:Grid":
case "Matrix":
case "Chart":
case "Subreport":
case "Line":
case "CustomReportItem":
hle = this._MouseDownLoc;
if (e.Y == _MousePosition.Y && e.X == _MousePosition.X)
break;
if (_DrawPanel.MoveSelectedItems(e.X - _MousePosition.X, e.Y - _MousePosition.Y, this._MouseDownLoc))
{
SelectionMoved(this, new EventArgs());
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
_AdjustScroll = true;
}
else // trying to drag into invalid area; disallow
{
Cursor.Position = this.PointToScreen(_MousePosition);
newMousePosition = this.PointToClient(Cursor.Position);
}
break;
}
}
}
else
{
HitLocation hl = _DrawPanel.HitNode(newMousePosition, PointsX(_hScroll.Value), PointsY(_vScroll.Value));
if (hl != null)
{
b = hl.HitNode;
hle = hl.HitSpot;
}
}
_MousePosition = newMousePosition;
DrawPanelSetCursor(b, hle);
}
private void DrawPanelMouseDown(object sender, MouseEventArgs E)
{
MouseEventArgsE e = new MouseEventArgsE(E, SCALEX, SCALEY);
bool baseOnly = false; //Josh: Added so base form can be force selected for inserting/selecting
//Hold shift to select the base form instead of the control the mouse is over.
if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift)
{
baseOnly = true;
}
_MousePosition = new Point(e.X, e.Y);
HitLocation hl = _DrawPanel.HitNode(_MousePosition, PointsX(_hScroll.Value), PointsY(_vScroll.Value), baseOnly);
_MouseDownNode = hl == null? null: hl.HitNode;
_MouseDownLoc = hl == null? HitLocationEnum.Inside: hl.HitSpot;
if (DrawPanelMouseDownInsert(hl, sender, e)) // Handle ReportItem insertion
return;
if (e.Button == MouseButtons.Left)
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_Move_Size);
if (DrawPanelMouseDownRubberBand(sender, e)) // Handle rubber banding
return;
if (DrawPanelMouseDownTableColumnResize(sender, e)) // Handle column resize
return;
if (DrawPanelMouseDownTableRowResize(sender, e)) // Handle row resize
return;
if (_MouseDownNode.Name == "Height")
{
_DrawPanel.ClearSelected();
SelectionChanged(this, new EventArgs());
HeightChanged(this, new HeightEventArgs(_MouseDownNode, _MouseDownNode.InnerText)); // Set the height
}
else if ((Control.ModifierKeys & Keys.Control) == Keys.Control)
{
_DrawPanel.AddRemoveSelection(_MouseDownNode);
SelectionChanged(this, new EventArgs());
}
else
{
_DrawPanel.SetSelection(_MouseDownNode, true);
SelectionChanged(this, new EventArgs());
}
DrawPanelSetCursor(_MouseDownNode, hl.HitSpot);
}
internal void SetSelection(XmlNode node)
{
if (node == null)
_DrawPanel.ClearSelected();
else
_DrawPanel.SetSelection(node, false);
SelectionChanged(this, new EventArgs());
}
private bool DrawPanelMouseDownRubberBand(object sender, MouseEventArgsE e)
{
if (_MouseDownLoc != HitLocationEnum.Inside)
return false; // must hit inside a region
// Now determine if object hit allows for rubber banding
bool bRubber = false;
bool bDeselect = true;
if (_MouseDownNode == null)
bRubber = true;
else if (_MouseDownNode.Name == "List" || _MouseDownNode.Name == "Rectangle")
{
if (_DrawPanel.SelectedCount == 1 && _DrawPanel.IsNodeSelected(_MouseDownNode))
{
bRubber = true;
bDeselect = false;
}
}
else if (_MouseDownNode.Name == "Body" ||
_MouseDownNode.Name == "PageHeader" ||
_MouseDownNode.Name == "PageFooter")
bRubber = true;
if (!bRubber)
return false;
// We have a rubber band operation
if (e.Button != MouseButtons.Left)
{
if (bDeselect)
{
_DrawPanel.ClearSelected();
SelectionChanged(this, new EventArgs());
}
return true; // well no rubber band but it's been handled
}
if ((Control.ModifierKeys & Keys.Control) != Keys.Control) // we allow addition to selection
{
if (bDeselect)
{
_DrawPanel.ClearSelected();
SelectionChanged(this, new EventArgs());
}
}
_bHaveMouse = true;
// keep the starting point of the rectangular rubber band
this._ptRBOriginal.X = e.X;
this._ptRBOriginal.Y = e.Y;
// -1 indicates no previous rubber band
this._ptRBLast.X = this._ptRBLast.Y = -1;
this.Cursor = Cursors.Cross; // use cross hair to indicate drawing
return true;
}
private bool DrawPanelMouseDownTableColumnResize(object sender, MouseEventArgsE e)
{
if (_MouseDownNode == null ||
_MouseDownLoc != HitLocationEnum.TableColumnResize)
return false;
this.Cursor = Cursors.VSplit;
return true;
}
private bool DrawPanelMouseDownTableRowResize(object sender, MouseEventArgsE e)
{
if (_MouseDownNode == null ||
_MouseDownLoc != HitLocationEnum.TableRowResize)
return false;
this.Cursor = Cursors.HSplit;
return true;
}
private bool DrawPanelMouseDownInsert(HitLocation hl, object sender, MouseEventArgsE e)
{
if (!(_CurrentInsert != null && // should we be inserting?
_MouseDownNode != null &&
(_MouseDownNode.Name == "List" ||
_MouseDownNode.Name == "Rectangle" ||
_MouseDownNode.Name == "Body" ||
_MouseDownNode.Name == "PageHeader" ||
_MouseDownNode.Name == "PageFooter")))
{
if (_CurrentInsert == null || _CurrentInsert == "Line" || hl == null ||
hl.HitContainer == null || (!(hl.HitContainer.Name == "Table" || hl.HitContainer.Name=="fyi:Grid")))
return false;
if (MessageBox.Show(Strings.DesignCtl_ShowB_WantReplaceCell, Strings.DesignCtl_Show_Insert, MessageBoxButtons.YesNo) != DialogResult.Yes)
return false;
}
switch (_CurrentInsert)
{
case "Textbox":
menuInsertTextbox_Click(sender, e);
break;
case "Chart":
menuInsertChart_Click(sender, e);
break;
case "Rectangle":
menuInsertRectangle_Click(sender, e);
break;
case "Table":
case "fyi:Grid":
menuInsertTable_Click(sender, e);
break;
case "Matrix":
menuInsertMatrix_Click(sender, e);
break;
case "List":
menuInsertList_Click(sender, e);
break;
case "Line":
menuInsertLine_Click(sender, e);
break;
case "Image":
menuInsertImage_Click(sender, e);
break;
case "Subreport":
menuInsertSubreport_Click(sender, e);
break;
default:
var types = RdlEngineConfig.GetCustomReportTypes();
if (types.Contains(_CurrentInsert))
{
menuInsertCustomReportItem(sender, e, _CurrentInsert);
}
break;
}
return true;
}
private void DrawPanelDoubleClick(object sender, EventArgs e)
{
menuProperties_Click(); // treat double click like a property menu click
}
private void DrawPanelRubberBand(Point p1, Point p2)
{
// Convert the points to screen coordinates
p1 = PointToScreen(p1);
p2 = PointToScreen(p2);
// Get a rectangle from the two points
Rectangle rc = DrawPanelRectFromPoints(p1, p2);
// Draw reversibleFrame
ControlPaint.DrawReversibleFrame(rc, Color.Red, FrameStyle.Dashed);
return;
}
private Rectangle DrawPanelRectFromPoints(Point p1, Point p2)
{
Rectangle r = new Rectangle();
// set the width and x of rectangle
if (p1.X < p2.X)
{
r.X = p1.X;
r.Width = p2.X - p1.X;
}
else
{
r.X = p2.X;
r.Width = p1.X - p2.X;
}
// set the height and y of rectangle
if (p1.Y < p2.Y)
{
r.Y = p1.Y;
r.Height = p2.Y - p1.Y;
}
else
{
r.Y = p2.Y;
r.Height = p1.Y - p2.Y;
}
return r;
}
private void DrawPanelSetCursor(XmlNode node, HitLocationEnum hle)
{
Cursor c;
if (node == null)
c = Cursors.Arrow;
else if (node.Name == "Height")
c = Cursors.SizeNS;
else if (hle == HitLocationEnum.TableColumnResize) // doesn't need to be selected
c = Cursors.VSplit;
else if (hle == HitLocationEnum.TableRowResize) // doesn't need to be selected
c = Cursors.HSplit;
else if (this._DrawPanel.IsNodeSelected(node))
{
switch (hle)
{
case HitLocationEnum.BottomLeft:
case HitLocationEnum.TopRight:
c = Cursors.SizeNESW;
break;
case HitLocationEnum.LeftMiddle:
case HitLocationEnum.RightMiddle:
c = Cursors.SizeWE;
break;
case HitLocationEnum.BottomRight:
case HitLocationEnum.TopLeft:
c = Cursors.SizeNWSE;
break;
case HitLocationEnum.TopMiddle:
case HitLocationEnum.BottomMiddle:
c = Cursors.SizeNS;
break;
case HitLocationEnum.Move:
c = Cursors.SizeAll;
break;
case HitLocationEnum.TableColumnResize:
c = Cursors.VSplit;
break;
case HitLocationEnum.TableRowResize:
c = Cursors.HSplit;
break;
case HitLocationEnum.LineLeft:
case HitLocationEnum.LineRight:
// c = Cursors.Cross; bug in C# runtime? Cross doesn't work!
c = Cursors.Hand;
break;
case HitLocationEnum.Inside:
default:
c = Cursors.Arrow;
break;
}
}
else
c = Cursors.Arrow;
if (c != this.Cursor)
this.Cursor = c;
}
private void DrawPanelMouseWheel(object sender, MouseEventArgs E)
{
MouseEventArgsE e = new MouseEventArgsE(E, SCALEX, SCALEY);
if (!_vScroll.Enabled)
return; // scroll not enabled
int wvalue;
bool bNotify = false;
if (e.Delta < 0)
{
if (_vScroll.Value < _vScroll.Maximum)
{
wvalue = _vScroll.Value + _vScroll.SmallChange;
_vScroll.Value = Math.Min(_vScroll.Maximum, wvalue);
bNotify = true;
}
}
else
{
if (_vScroll.Value > _vScroll.Minimum)
{
wvalue = _vScroll.Value - _vScroll.SmallChange;
_vScroll.Value = Math.Max(_vScroll.Minimum, wvalue);
bNotify = true;
}
}
if (bNotify)
{
if (VerticalScrollChanged != null)
VerticalScrollChanged(this, new EventArgs());
_DrawPanel.Refresh();
}
}
private void DrawPanelKeyDown(object sender, KeyEventArgs e)
{
int incX=0;
int incY=0;
int vScroll=_vScroll.Value;
int hScroll=_hScroll.Value;
// Force scroll up and down
if (e.KeyCode == Keys.Down)
{
incY=1;
}
else if (e.KeyCode == Keys.Up)
{
incY=-1;
}
else if (e.KeyCode == Keys.Left)
{
incX=-1;
}
else if (e.KeyCode == Keys.Right)
{
incX=1;
}
else if (e.KeyCode == Keys.PageDown)
{
vScroll = Math.Min(_vScroll.Value + _vScroll.LargeChange, _vScroll.Maximum);
}
else if (e.KeyCode == Keys.PageUp)
{
vScroll = Math.Max(_vScroll.Value - _vScroll.LargeChange, 0);
}
else if (e.KeyCode == Keys.Enter)
{
e.Handled = true;
menuProperties_Click();
return;
}
else if (e.KeyCode == Keys.Tab)
{
if (_DrawPanel.SelectNext((Control.ModifierKeys & Keys.Shift) == Keys.Shift))
{
RectangleF r = _DrawPanel.GetRectangle(_DrawPanel.SelectedList[0]);
Rectangle nr = new Rectangle(PixelsX(r.X), PixelsY(r.Y), PixelsX(r.Width), PixelsY(r.Height));
if (nr.Right > _hScroll.Value + Width - _vScroll.Width ||
nr.Left < _hScroll.Value - _vScroll.Width)
hScroll = Math.Min(nr.Left, _hScroll.Maximum);
if (nr.Bottom > _vScroll.Value + Height - _hScroll.Height ||
nr.Top < _vScroll.Value - _hScroll.Height)
vScroll = Math.Min(nr.Top, _vScroll.Maximum);
this.SelectionChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
e.Handled = true;
}
else if (e.KeyCode == Keys.Delete)
{
this.Delete();
e.Handled = true;
}
bool bRefresh = false;
if (vScroll != _vScroll.Value && _vScroll.Enabled)
{
_vScroll.Value = Math.Max(vScroll, 0);
bRefresh = true;
e.Handled = true;
}
if (hScroll != _hScroll.Value && _hScroll.Enabled)
{
_hScroll.Value = Math.Max(hScroll,0);
bRefresh = true;
e.Handled = true;
}
if (incX != 0 || incY != 0)
{
HitLocationEnum hle = HitLocationEnum.Move;
if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift) // if shift key on resize
{
hle = incX != 0? HitLocationEnum.RightMiddle: HitLocationEnum.BottomMiddle;
}
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_Move);
if (_DrawPanel.MoveSelectedItems(incX, incY, hle))
{
_Undo.EndUndoGroup(true);
SelectionMoved(this, new EventArgs());
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
else
_Undo.EndUndoGroup(false);
e.Handled = true;
}
if (bRefresh)
_DrawPanel.Refresh();
}
private void DesignCtl_Layout(object sender, LayoutEventArgs e)
{
_DrawPanel.Location = new Point(0, 0);
_DrawPanel.Width = this.Width - _vScroll.Width;
_DrawPanel.Height = this.Height - _hScroll.Height;
_hScroll.Location = new Point(0, this.Height - _hScroll.Height);
_hScroll.Width = _DrawPanel.Width;
_vScroll.Location = new Point(this.Width - _vScroll.Width, _DrawPanel.Location.Y);
_vScroll.Height = _DrawPanel.Height;
}
private void menuCopy_Click(object sender, EventArgs e)
{
Clipboard.SetDataObject(GetCopy(), true);
}
private string GetCopy()
{
// When copying multiple report items that are in the same table/matrix
// ask if you want to instead copy the table/matrix
if (_DrawPanel.SelectedCount > 1)
{
XmlNode tn = _DrawPanel.TMParent(_DrawPanel.SelectedList[0]);
bool bTorM = tn != null;
for (int i=1; i < _DrawPanel.SelectedCount && bTorM; i++)
{
if (tn != _DrawPanel.TMParent(_DrawPanel.SelectedList[i]))
bTorM = false;
}
if (bTorM)
{ // all selected items are in the same table or matrix
if (MessageBox.Show(string.Format(Strings.DesignCtl_ShowB_WantSelect, tn.Name),
Strings.DesignCtl_ShowB_Copy, MessageBoxButtons.YesNo) == DialogResult.Yes)
{
StringBuilder tb = new StringBuilder();
// Build XML representing the selected objects
tb.Append(""); // surround by ReportItems element
tb.Append(tn.OuterXml);
tb.Append("");
return tb.ToString();
}
}
}
StringBuilder sb = new StringBuilder();
// Build XML representing the selected objects
sb.Append(""); // surround by ReportItems element
foreach (XmlNode riNode in _DrawPanel.SelectedList)
{
sb.Append(riNode.OuterXml);
}
sb.Append("");
return sb.ToString();
}
private void menuPaste_Click(object sender, EventArgs e)
{
HitLocation hl = _DrawPanel.HitNode(_MousePosition, PointsX(_hScroll.Value), PointsY(_vScroll.Value));
XmlNode lNode = hl == null? null: hl.HitNode;
if (lNode == null)
return;
if (!(lNode.Name == "List" ||
lNode.Name == "Body" ||
lNode.Name == "Rectangle" ||
lNode.Name == "PageHeader" ||
lNode.Name == "PageFooter"))
{
if (hl.HitContainer != null && (hl.HitContainer.Name == "Table" || hl.HitContainer.Name == "fyi:Grid"))
{
// When table we need to replace the tablecell contents; ask first
if (MessageBox.Show(Strings.DesignCtl_ShowB_WantReplaceCell, Strings.DesignCtl_Show_Paste, MessageBoxButtons.YesNo) != DialogResult.Yes)
return;
XmlNode repItems = lNode.ParentNode;
if (repItems.Name != "ReportItems")
return;
XmlNode p = repItems.ParentNode;
p.RemoveChild(repItems);
DoPaste(p, hl.HitRelative);
}
return;
}
DoPaste(lNode, hl.HitRelative);
}
private void DoPaste(XmlNode lNode, PointF p)
{
IDataObject iData = Clipboard.GetDataObject();
if (iData == null)
return;
if (!(iData.GetDataPresent(DataFormats.Text) ||
iData.GetDataPresent(DataFormats.Bitmap)))
return;
if (lNode == null)
{
lNode = _DrawPanel.Body;
if (lNode == null)
return;
}
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_Paste);
if (iData.GetDataPresent(DataFormats.Text))
{
// Build the xml string in case it is a straight pasting of text
string t = (string) iData.GetData(DataFormats.Text);
if (!(t.Length >= 27 && t.Substring(0, 13) == ""))
{
t = t.Replace("&", "&");
t = t.Replace("<", "<");
// Josh: Added a default ZIndex of 1 so that a "Backgroud" image can be applied to the form.
t = string.Format("12pt1in{0}1", t);
}
// PasteReportItems throws exception when you try to paste an illegal object
try
{
_DrawPanel.PasteReportItems(lNode, t, p);
}
catch (Exception e)
{
MessageBox.Show(e.Message, Strings.DesignCtl_Show_Paste);
}
}
else
{
// Build the xml string for an image; but we also need to put an
// embedded image into the report.
System.Drawing.Bitmap bo = (System.Drawing.Bitmap) iData.GetData(DataFormats.Bitmap);
_DrawPanel.PasteImage(lNode, bo, p);
}
_Undo.EndUndoGroup();
_DrawPanel.Invalidate();
ReportChanged(this, new EventArgs());
SelectionChanged(this, new EventArgs());
}
private void menuDelete_Click(object sender, EventArgs e)
{
Delete();
}
private void menuInsertChart_Click(object sender, EventArgs e)
{
HitLocation hl = _DrawPanel.HitContainer(_MousePosition,
PointsX(_hScroll.Value), PointsY(_vScroll.Value));
if (hl == null || hl.HitContainer == null)
return;
// Charts aren't allowed in PageHeader or PageFooter
if (_DrawPanel.InPageHeaderOrFooter(hl.HitContainer))
{
MessageBox.Show(Strings.DesignCtl_Show_ChartsInsert, Strings.DesignCtl_Show_Insert);
return;
}
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_InsertChart);
DialogNewChart dnc = new DialogNewChart(this._DrawPanel, hl.HitContainer);
try
{
DialogResult dr = dnc.ShowDialog(this);
if (dr != DialogResult.OK)
{
_Undo.EndUndoGroup(false);
return;
}
}
finally
{
dnc.Dispose();
}
XmlNode chart;
if (hl.HitContainer.Name == "Table" || hl.HitContainer.Name == "fyi:Grid")
{
chart = _DrawPanel.ReplaceTableMatrixOrChart(hl, dnc.ChartXml);
}
else
chart = _DrawPanel.PasteTableMatrixOrChart(hl.HitContainer, dnc.ChartXml, hl.HitRelative);
if (chart == null)
{
_Undo.EndUndoGroup(false);
return;
}
_Undo.EndUndoGroup(true);
ReportChanged(this, new EventArgs());
SelectionChanged(this, new EventArgs());
ReportItemInserted(this, new EventArgs());
_DrawPanel.Invalidate();
// Now bring up the property dialog
//List ar = new List();
//ar.Add(chart);
//_Undo.StartUndoGroup("Dialog");
//PropertyDialog pd = new PropertyDialog(_DrawPanel, ar, PropertyTypeEnum.ReportItems);
//dr = pd.ShowDialog(this);
//if (pd.Changed || dr == DialogResult.OK)
//{
// _Undo.EndUndoGroup(true);
// ReportChanged(this, new EventArgs());
// _DrawPanel.Invalidate();
//}
//else
// _Undo.EndUndoGroup(false);
SetFocus();
}
private void menuInsertCustomReportItem_Click(object sender, EventArgs e)
{
var mi = (ToolStripMenuItem)sender;
menuInsertCustomReportItem(sender, e, (string) mi.Tag);
}
private void menuInsertCustomReportItem(object sender, EventArgs e, string customName)
{
string ri;
ICustomReportItem cri = null;
try
{
cri = RdlEngineConfig.CreateCustomReportItem(customName);
var criXml = cri.GetCustomReportItemXml().Trim();
if (!(criXml.StartsWith("") && criXml.EndsWith("")))
{
MessageBox.Show(
string.Format(Strings.DesignCtl_Show_CustomReportItem, customName, criXml), Strings.DesignCtl_Show_Insert);
return;
}
ri = "" +
string.Format(criXml, customName) + // substitute the type of custom report item
"";
}
catch (Exception ex)
{
MessageBox.Show(string.Format(Strings.DesignCtl_Show_CustomReportItemException, ex.Message), Strings.DesignCtl_Show_Insert);
return;
}
finally
{
if (cri != null)
cri.Dispose();
}
menuInsertReportItem(sender, e, ri);
}
private void menuInsertGrid_Click(object sender, EventArgs e)
{
string ri = @""+
"" +
@"
83.7pt
92.7pt
93.7pt
12 pt
Grid Column 1
Grid Column 2
Grid Column 3
true
12 pt
r1c1
true
r1c2
true
r1c3
true
12 pt
r2c1
r2c2
r2c3
515.68pt
11.34pt
";
menuInsertReportItem(sender, e, ri);
}
private void menuInsertLine_Click(object sender, EventArgs e)
{
string ri = "0in1in";
menuInsertReportItem(sender, e, ri);
}
private void menuInsertList_Click(object sender, EventArgs e)
{
string ri = "1.5in1.5in
";
// Lists aren't allowed in PageHeader or PageFooter
HitLocation hl = _DrawPanel.HitContainer(_MousePosition,
PointsX(_hScroll.Value), PointsY(_vScroll.Value));
if (hl == null || hl.HitContainer == null)
return;
if (_DrawPanel.InPageHeaderOrFooter(hl.HitContainer))
{
MessageBox.Show(Strings.DesignCtl_Show_ListsInBody, Strings.DesignCtl_Show_Insert);
return;
}
menuInsertReportItem(hl, ri);
}
private void menuInsertImage_Click(object sender, EventArgs e)
{
string ri = "1.5in1.5in";
menuInsertReportItem(sender, e, ri);
}
private void menuInsertMatrix_Click(object sender, EventArgs e)
{
HitLocation hl = _DrawPanel.HitContainer(_MousePosition,
PointsX(_hScroll.Value), PointsY(_vScroll.Value));
if (hl == null || hl.HitContainer == null)
return;
// Matrixs aren't allowed in PageHeader or PageFooter
if (_DrawPanel.InPageHeaderOrFooter(hl.HitContainer))
{
MessageBox.Show(Strings.DesignCtl_Show_MatrixsInBody, Strings.DesignCtl_Show_Insert);
return;
}
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_InsertMatrix);
DialogNewMatrix dnm = new DialogNewMatrix(this._DrawPanel, hl.HitContainer);
try
{
DialogResult dr = dnm.ShowDialog(this);
if (dr != DialogResult.OK)
{
_Undo.EndUndoGroup(false);
return;
}
}
finally
{
dnm.Dispose();
}
XmlNode matrix;
if (hl.HitContainer.Name == "Table" || hl.HitContainer.Name == "fyi:Grid")
matrix = _DrawPanel.ReplaceTableMatrixOrChart(hl, dnm.MatrixXml);
else
matrix = _DrawPanel.PasteTableMatrixOrChart(hl.HitContainer, dnm.MatrixXml, hl.HitRelative);
if (matrix == null)
{
_Undo.EndUndoGroup(false);
return;
}
_Undo.EndUndoGroup(true);
ReportChanged(this, new EventArgs());
SelectionChanged(this, new EventArgs());
ReportItemInserted(this, new EventArgs());
_DrawPanel.Invalidate();
// Now bring up the property dialog
//List ar = new List();
//ar.Add(matrix);
//_Undo.StartUndoGroup("Dialog");
//PropertyDialog pd = new PropertyDialog(_DrawPanel, ar, PropertyTypeEnum.ReportItems);
//dr = pd.ShowDialog(this);
//_Undo.EndUndoGroup(pd.Changed || dr == DialogResult.OK);
//if (pd.Changed || dr == DialogResult.OK)
//{
// ReportChanged(this, new EventArgs());
// _DrawPanel.Invalidate();
//}
SetFocus();
}
private void menuInsertRectangle_Click(object sender, EventArgs e)
{
string ri = "1.5in1.5in";
menuInsertReportItem(sender, e, ri);
}
private void menuInsertReportItem(object sender, EventArgs e, string reportItem)
{
HitLocation hl = _DrawPanel.HitContainer(_MousePosition,
PointsX(_hScroll.Value), PointsY(_vScroll.Value));
if (hl == null || hl.HitContainer == null)
return;
menuInsertReportItem(hl, reportItem);
}
private void menuInsertReportItem(HitLocation hl, string reportItem)
{
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_Insert);
try
{
if (hl.HitContainer.Name == "Table" || hl.HitContainer.Name == "fyi:Grid")
{
_DrawPanel.ReplaceReportItems(hl, reportItem);
}
else
_DrawPanel.PasteReportItems(hl.HitContainer, reportItem, hl.HitRelative);
}
catch (Exception ex)
{
MessageBox.Show(Strings.DesignCtl_ShowC_IllegalInsertSyntax + Environment.NewLine +
reportItem + Environment.NewLine + ex.Message);
return;
}
finally
{
_Undo.EndUndoGroup(true);
}
_DrawPanel.Invalidate();
ReportChanged(this, new EventArgs());
SelectionChanged(this, new EventArgs());
ReportItemInserted(this, new EventArgs());
if (reportItem.Contains(" ar = new List();
//ar.Add(table);
//_Undo.StartUndoGroup("Dialog");
//PropertyDialog pd = new PropertyDialog(_DrawPanel, ar, PropertyTypeEnum.ReportItems);
//dr = pd.ShowDialog(this);
//_Undo.EndUndoGroup(pd.Changed || dr == DialogResult.OK);
//if (pd.Changed || dr == DialogResult.OK)
//{
// ReportChanged(this, new EventArgs());
// _DrawPanel.Invalidate();
//}
SetFocus();
}
private void menuInsertTextbox_Click(object sender, EventArgs e)
{
// Josh: Added a default ZIndex of 1 so that a "Backgroud" image can be applied to the form.
string ri = "12pt1inText1";
menuInsertReportItem(sender, e, ri);
}
private void menuOpenSubreport_Click(object sender, EventArgs e)
{
if (_DrawPanel.SelectedList.Count == 0)
return;
XmlNode sr = _DrawPanel.SelectedList[0];
if (sr.Name != "Subreport")
return;
string name = _DrawPanel.GetElementValue(sr, "ReportName", "");
if (name == null || name.Length == 0)
return;
if (OpenSubreport != null)
OpenSubreport(this, new SubReportEventArgs(name));
}
private void menuSelectAll_Click(object sender, EventArgs e)
{
doSelectAll();
}
private void doSelectAll()
{
IEnumerable list = _DrawPanel.GetReportItems(null); // get all the report items
if (list == null)
return;
_DrawPanel.ClearSelected();
foreach (XmlNode riNode in list)
{
if (riNode.Name == "Table" || riNode.Name == "fyi:Grid" || riNode.Name == "List" || riNode.Name == "Rectangle")
continue; // we'll just select all the sub objects in these containers
_DrawPanel.AddSelection(riNode);
SelectionChanged(this, new EventArgs());
}
_DrawPanel.Invalidate();
return;
}
internal void menuProperties_Click(object sender, EventArgs e)
{
menuProperties_Click();
}
internal void menuProperties_Click()
{
if (_DrawPanel.SelectedCount > 0)
{
DoPropertyDialog(PropertyTypeEnum.ReportItems);
}
else
{ // Put up the Report Property sheets
DoPropertyDialog(PropertyTypeEnum.Report);
}
SelectionChanged(this, new EventArgs());
}
private void menuChartDeleteGrouping_Click(object sender, EventArgs e)
{
if (_DrawPanel.SelectedCount != 1)
return;
var menu = (ToolStripMenuItem)sender;
var gname = menu.Text;
XmlNode cNode = _DrawPanel.SelectedList[0];
_DrawPanel.ClearSelected();
this.SelectionChanged(this, new EventArgs());
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_DeleteGrouping);
bool bSuccess=false;
if (_DrawPanel.DeleteChartGrouping(cNode, gname))
{
bSuccess = true;
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
_Undo.EndUndoGroup(bSuccess);
}
private void menuChartEditGrouping_Click(object sender, EventArgs e)
{
if (_DrawPanel.SelectedCount != 1)
return;
var menu = (ToolStripMenuItem)sender;
var gname = menu.Text;
XmlNode cNode = _DrawPanel.SelectedList[0];
XmlNode group = _DrawPanel.GetChartGrouping(cNode, gname);
List ar = new List(); // need to put this is a list for dialog to handle
ar.Add(group.ParentNode);
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_DialogGrouping);
PropertyDialog pd = new PropertyDialog(_DrawPanel, ar, PropertyTypeEnum.Grouping);
try
{
DialogResult dr = pd.ShowDialog(this);
_Undo.EndUndoGroup(pd.Changed || dr == DialogResult.OK);
if (pd.Changed || dr == DialogResult.OK)
{
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
}
finally
{
pd.Dispose();
}
}
private void menuChartInsertCategoryGrouping_Click(object sender, EventArgs e)
{
if (_DrawPanel.SelectedCount != 1)
return;
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_InsertCategoryGrouping);
XmlNode cNode = _DrawPanel.SelectedList[0];
XmlNode colGroup = _DrawPanel.InsertChartCategoryGrouping(cNode);
if (colGroup == null)
{
_Undo.EndUndoGroup(false);
return;
}
List ar = new List(); // need to put this is a list for dialog to handle
ar.Add(colGroup);
PropertyDialog pd = new PropertyDialog(_DrawPanel, ar, PropertyTypeEnum.Grouping);
try
{
DialogResult dr = pd.ShowDialog(this);
if (pd.Changed || dr == DialogResult.OK)
{
_Undo.EndUndoGroup(true);
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
else
{
_DrawPanel.DeleteChartGrouping(colGroup);
_Undo.EndUndoGroup(false);
}
}
finally
{
pd.Dispose();
}
}
private void menuChartInsertSeriesGrouping_Click(object sender, EventArgs e)
{
if (_DrawPanel.SelectedCount != 1)
return;
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_InsertSeriesGrouping);
XmlNode cNode = _DrawPanel.SelectedList[0];
XmlNode colGroup = _DrawPanel.InsertChartSeriesGrouping(cNode);
if (colGroup == null)
{
_Undo.EndUndoGroup(false);
return;
}
List ar = new List(); // need to put this is a list for dialog to handle
ar.Add(colGroup);
PropertyDialog pd = new PropertyDialog(_DrawPanel, ar, PropertyTypeEnum.Grouping);
try
{
DialogResult dr = pd.ShowDialog(this);
if (pd.Changed || dr == DialogResult.OK)
{
_Undo.EndUndoGroup(true);
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
else
{
_DrawPanel.DeleteChartGrouping(colGroup);
_Undo.EndUndoGroup(false);
}
}
finally
{
pd.Dispose();
}
}
private void menuPropertiesLegend_Click(object sender, EventArgs e)
{
DoPropertyDialog(PropertyTypeEnum.ChartLegend);
}
private void menuPropertiesCategoryAxis_Click(object sender, EventArgs e)
{
DoPropertyDialog(PropertyTypeEnum.CategoryAxis);
}
private void menuPropertiesValueAxis_Click(object sender, EventArgs e)
{
DoPropertyDialog(PropertyTypeEnum.ValueAxis);
}
private void menuPropertiesCategoryAxisTitle_Click(object sender, EventArgs e)
{
DoPropertyDialog(PropertyTypeEnum.CategoryAxisTitle);
}
private void menuPropertiesValueAxisTitle_Click(object sender, EventArgs e)
{
DoPropertyDialog(PropertyTypeEnum.ValueAxisTitle);
}
// 20022008 AJM GJL - Second Y axis support
private void menuPropertiesValueAxis2Title_Click(object sender, EventArgs e)
{
DoPropertyDialog(PropertyTypeEnum.ValueAxis2Title);
}
private void menuPropertiesChartTitle_Click(object sender, EventArgs e)
{
DoPropertyDialog(PropertyTypeEnum.ChartTitle);
}
private void menuMatrixProperties_Click(object sender, EventArgs e)
{
if (_DrawPanel.SelectedCount != 1)
return;
XmlNode riNode = _DrawPanel.SelectedList[0];
XmlNode table = _DrawPanel.GetMatrixFromReportItem(riNode);
if (table == null)
return;
List ar = new List(); // need to put this is a list for dialog to handle
ar.Add(table);
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_MatrixDialog);
PropertyDialog pd = new PropertyDialog(_DrawPanel, ar, PropertyTypeEnum.ReportItems);
try
{
DialogResult dr = pd.ShowDialog(this);
_Undo.EndUndoGroup(pd.Changed || dr == DialogResult.OK);
if (pd.Changed || dr == DialogResult.OK)
{
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
}
finally
{
pd.Dispose();
}
}
private void menuMatrixDelete_Click(object sender, EventArgs e)
{
if (_DrawPanel.SelectedCount != 1)
return;
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_MatrixDelete);
XmlNode cNode = _DrawPanel.SelectedList[0];
_DrawPanel.ClearSelected();
this.SelectionChanged(this, new EventArgs());
if (_DrawPanel.DeleteMatrix(cNode))
{
_Undo.EndUndoGroup(true);
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
else
_Undo.EndUndoGroup(false);
}
private void menuMatrixDeleteGroup_Click(object sender, EventArgs e)
{
if (_DrawPanel.SelectedCount != 1)
return;
var menu = (ToolStripMenuItem)sender;
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_MatrixDeleteGroup);
var gname = menu.Text;
XmlNode cNode = _DrawPanel.SelectedList[0];
_DrawPanel.ClearSelected();
this.SelectionChanged(this, new EventArgs());
if (_DrawPanel.DeleteMatrixGroup(cNode, gname))
{
_Undo.EndUndoGroup(true);
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
else
_Undo.EndUndoGroup(false);
}
private void menuMatrixEditGroup_Click(object sender, EventArgs e)
{
if (_DrawPanel.SelectedCount != 1)
return;
var menu = (ToolStripMenuItem)sender;
var gname = menu.Text;
XmlNode cNode = _DrawPanel.SelectedList[0];
XmlNode group = _DrawPanel.GetMatrixGroup(cNode, gname);
List ar = new List(); // need to put this is a list for dialog to handle
ar.Add(group.ParentNode);
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_MatrixEdit);
PropertyDialog pd = new PropertyDialog(_DrawPanel, ar, PropertyTypeEnum.Grouping);
try
{
DialogResult dr = pd.ShowDialog(this);
_Undo.EndUndoGroup(pd.Changed || dr == DialogResult.OK);
if (pd.Changed || dr == DialogResult.OK)
{
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
}
finally
{
pd.Dispose();
}
}
private void menuMatrixInsertColumnGroup_Click(object sender, EventArgs e)
{
if (_DrawPanel.SelectedCount != 1)
return;
XmlNode cNode = _DrawPanel.SelectedList[0];
XmlNode colGroup = _DrawPanel.InsertMatrixColumnGroup(cNode);
if (colGroup == null)
return;
List ar = new List(); // need to put this is a list for dialog to handle
ar.Add(colGroup);
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_MatrixInsertColumnGroup);
PropertyDialog pd = new PropertyDialog(_DrawPanel, ar, PropertyTypeEnum.Grouping);
try
{
DialogResult dr = pd.ShowDialog(this);
if (pd.Changed || dr == DialogResult.OK)
{
_Undo.EndUndoGroup(true);
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
else
{
_DrawPanel.DeleteMatrixGroup(colGroup);
_Undo.EndUndoGroup(false);
}
}
finally
{
pd.Dispose();
}
}
private void menuMatrixInsertRowGroup_Click(object sender, EventArgs e)
{
if (_DrawPanel.SelectedCount != 1)
return;
XmlNode cNode = _DrawPanel.SelectedList[0];
XmlNode rowGroup = _DrawPanel.InsertMatrixRowGroup(cNode);
if (rowGroup == null)
return;
List ar = new List(); // need to put this is a list for dialog to handle
ar.Add(rowGroup);
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_MatrixInsertRowGroup);
PropertyDialog pd = new PropertyDialog(_DrawPanel, ar, PropertyTypeEnum.Grouping);
try
{
DialogResult dr = pd.ShowDialog(this);
if (pd.Changed || dr == DialogResult.OK)
{
_Undo.EndUndoGroup(true);
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
else
{
_DrawPanel.DeleteMatrixGroup(rowGroup);
_Undo.EndUndoGroup(false);
}
}
finally
{
pd.Dispose();
}
}
private void menuTableDeleteColumn_Click(object sender, EventArgs e)
{
if (_DrawPanel.SelectedCount != 1)
return;
XmlNode cNode = _DrawPanel.SelectedList[0];
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_DeleteTableColumn);
_DrawPanel.ClearSelected();
this.SelectionChanged(this, new EventArgs());
if (_DrawPanel.DeleteTableColumn(cNode))
{
_Undo.EndUndoGroup(true);
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
else
_Undo.EndUndoGroup(false);
}
private void menuTableDelete_Click(object sender, EventArgs e)
{
if (_DrawPanel.SelectedCount != 1)
return;
XmlNode cNode = _DrawPanel.SelectedList[0];
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_DeleteTable);
_DrawPanel.ClearSelected();
this.SelectionChanged(this, new EventArgs());
if (_DrawPanel.DeleteTable(cNode))
{
_Undo.EndUndoGroup(true);
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
else
_Undo.EndUndoGroup(false);
}
private void menuTableDeleteRow_Click(object sender, EventArgs e)
{
if (_DrawPanel.SelectedCount != 1)
return;
XmlNode cNode = _DrawPanel.SelectedList[0];
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_DeleteTableRow);
_DrawPanel.ClearSelected();
this.SelectionChanged(this, new EventArgs());
if (_DrawPanel.DeleteTableRow(cNode))
{
_Undo.EndUndoGroup(true);
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
else
_Undo.EndUndoGroup(false);
}
private void menuTableDeleteGroup_Click(object sender, EventArgs e)
{
if (_DrawPanel.SelectedCount != 1)
return;
var menu = (ToolStripMenuItem)sender;
var gname = menu.Text;
XmlNode cNode = _DrawPanel.SelectedList[0];
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_DeleteTableGroup);
_DrawPanel.ClearSelected();
this.SelectionChanged(this, new EventArgs());
if (_DrawPanel.DeleteTableGroup(cNode, gname))
{
_Undo.EndUndoGroup(true);
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
else
_Undo.EndUndoGroup(false);
}
private void menuTableEditGroup_Click(object sender, EventArgs e)
{
if (_DrawPanel.SelectedCount != 1)
return;
var menu = (ToolStripMenuItem)sender;
var gname = menu.Text;
XmlNode cNode = _DrawPanel.SelectedList[0];
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_DialogTableGroupEdit);
XmlNode tblGroup = _DrawPanel.GetTableGroup(cNode, gname);
List ar = new List(); // need to put this is a list for dialog to handle
ar.Add(tblGroup);
PropertyDialog pd = new PropertyDialog(_DrawPanel, ar, PropertyTypeEnum.Grouping);
try
{
DialogResult dr = pd.ShowDialog(this);
_Undo.EndUndoGroup(pd.Changed || dr == DialogResult.OK);
if (pd.Changed || dr == DialogResult.OK)
{
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
}
finally
{
pd.Dispose();
}
}
private void menuTableInsertColumnBefore_Click(object sender, EventArgs e)
{
if (_DrawPanel.SelectedCount != 1)
return;
XmlNode cNode = _DrawPanel.SelectedList[0];
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_InsertTableColumn);
if (_DrawPanel.InsertTableColumn(cNode, true))
{
_Undo.EndUndoGroup(true);
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
else
_Undo.EndUndoGroup(false);
}
private void menuTableInsertColumnAfter_Click(object sender, EventArgs e)
{
if (_DrawPanel.SelectedCount != 1)
return;
XmlNode cNode = _DrawPanel.SelectedList[0];
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_InsertTableColumn);
if (_DrawPanel.InsertTableColumn(cNode, false))
{
_Undo.EndUndoGroup(true);
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
else
_Undo.EndUndoGroup(false);
}
private void menuTableInsertGroup_Click(object sender, EventArgs e)
{
if (_DrawPanel.SelectedCount != 1)
return;
XmlNode cNode = _DrawPanel.SelectedList[0];
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_InsertTableGroup);
XmlNode tblGroup = _DrawPanel.InsertTableGroup(cNode);
if (tblGroup == null)
{
_Undo.EndUndoGroup(false);
return;
}
List ar = new List(); // need to put this is a list for dialog to handle
ar.Add(tblGroup);
PropertyDialog pd = new PropertyDialog(_DrawPanel, ar, PropertyTypeEnum.Grouping);
try
{
DialogResult dr = pd.ShowDialog(this);
if (pd.Changed || dr == DialogResult.OK)
{
_Undo.EndUndoGroup(true);
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
else
{
_DrawPanel.DeleteTableGroup(tblGroup);
_Undo.EndUndoGroup(false);
}
}
finally
{
pd.Dispose();
}
}
private void menuTableInsertRowBefore_Click(object sender, EventArgs e)
{
if (_DrawPanel.SelectedCount != 1)
return;
XmlNode cNode = _DrawPanel.SelectedList[0];
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_InsertTableRow);
if (_DrawPanel.InsertTableRow(cNode, true))
{
_Undo.EndUndoGroup(true);
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
else
_Undo.EndUndoGroup(false);
}
private void menuTableInsertRowAfter_Click(object sender, EventArgs e)
{
if (_DrawPanel.SelectedCount != 1)
return;
XmlNode cNode = _DrawPanel.SelectedList[0];
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_InsertTableRow);
if (_DrawPanel.InsertTableRow(cNode, false))
{
_Undo.EndUndoGroup(true);
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
else
_Undo.EndUndoGroup(false);
}
private void menuTableProperties_Click(object sender, EventArgs e)
{
if (_DrawPanel.SelectedCount != 1)
return;
XmlNode riNode = _DrawPanel.SelectedList[0];
XmlNode table = _DrawPanel.GetTableFromReportItem(riNode);
if (table == null)
return;
XmlNode tc = _DrawPanel.GetTableColumn(riNode);
XmlNode tr = _DrawPanel.GetTableRow(riNode);
List ar = new List(); // need to put this is a list for dialog to handle
ar.Add(table);
_Undo.StartUndoGroup(Strings.DesignCtl_Undo_TableDialog);
PropertyDialog pd = new PropertyDialog(_DrawPanel, ar, PropertyTypeEnum.ReportItems, tc, tr);
try
{
DialogResult dr = pd.ShowDialog(this);
_Undo.EndUndoGroup(pd.Changed || dr == DialogResult.OK);
if (pd.Changed || dr == DialogResult.OK)
{
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
}
finally
{
pd.Dispose();
}
}
private void DoPropertyDialog(PropertyTypeEnum type)
{
StartUndoGroup(Strings.DesignCtl_Undo_Dialog);
PropertyDialog pd = new PropertyDialog(_DrawPanel, _DrawPanel.SelectedList, type);
try
{
DialogResult dr = pd.ShowDialog(this);
this.EndUndoGroup(pd.Changed || dr == DialogResult.OK);
if (pd.Changed || dr == DialogResult.OK)
{
ReportChanged(this, new EventArgs());
_DrawPanel.Invalidate();
}
}
finally
{
pd.Dispose();
}
SetFocus();
}
internal void SetFocus()
{
this._DrawPanel.Focus();
}
private void menuContext_Popup(object sender, EventArgs e)
{
var bEnable = _DrawPanel.SelectedCount > 0;
MenuDefaultCopy.Enabled = bEnable;
MenuDefaultDelete.Enabled = bEnable;
var al = new List();
var iData = Clipboard.GetDataObject();
if (iData == null)
bEnable = false;
else if (iData.GetDataPresent(al.GetType()))
bEnable = true;
else if (iData.GetDataPresent(DataFormats.Text))
bEnable = true;
else if (iData.GetDataPresent(DataFormats.Bitmap))
bEnable = true;
else
bEnable = false;
MenuDefaultPaste.Enabled = bEnable;
MenuChartPaste.Enabled = bEnable;
MenuGridPaste.Enabled = bEnable;
MenuMatrixPaste.Enabled = bEnable;
MenuSubreportPaste.Enabled = bEnable;
MenuTablePaste.Enabled = bEnable;
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
// Dispose managed resources
_buffer?.Dispose();
}
base.Dispose(disposing);
}
}
public class SubReportEventArgs : EventArgs
{
string _name; // name of subreport user has requested be opened
public SubReportEventArgs(string name) : base()
{
_name = name;
}
public string SubReportName
{
get {return _name;}
}
}
public class HeightEventArgs : EventArgs
{
XmlNode _node; // current node
string _height; // current height
public HeightEventArgs(XmlNode node, string height)
: base()
{
_node = node;
_height = height;
}
public XmlNode Node
{
get { return _node; }
}
public string Height
{
get { return _height; }
}
}
///
/// Nuova classe embbedded nel controllo per passare gli eventi del mouse e i fattori di scala correnti
///
public class MouseEventArgsE : EventArgs
{
private MouseButtons button;
private int clicks;
private int x;
private int y;
private int delta;
private Point location;
public MouseButtons Button => button;
public int Clicks => clicks;
public int X => x;
public int Y => y;
public int Delta => delta;
public Point Location => location;
///
/// Costruttore
///
///
///
///
public MouseEventArgsE(MouseEventArgs B, float ScaleX, float ScaleY)
{
this.button = B.Button;
this.clicks = B.Clicks;
this.x = (int)(B.X / ScaleX);
this.y = (int)(B.Y / ScaleY);
this.location = new Point(x, y);
this.delta = B.Delta;
}
}
}
================================================
FILE: RdlDesign/DesignCtl.resx
================================================
text/microsoft-resx
2.0
System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
&Matrix...
MenuInsertTextbox
Legend...
126, 22
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Edit Category Grouping
MenuTableInsertColumnAfter
Insert Column Before
&Subreport
MenuMatrixDeleteMatrix
&Line
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
219, 22
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
186, 22
&Chart...
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
MenuTableEditGroup
toolStripMenuItem13
System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
MenuChartValueAxis
MenuChartProperties
System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
MenuChartEditCategoryGrouping
MenuTableDeleteGroup
&Chart...
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
216, 6
MenuDefaultCopy
System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
186, 22
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
186, 22
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Value (Y) Axis (Right) Title...
Select &All
MenuTableDelete
186, 22
&Delete
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
&Delete
toolStripMenuItem18
System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
219, 22
&Delete
System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
MenuGridDeleteGrid
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
158, 22
194, 22
MenuTableCopy
Ta&ble...
MenuInsertRectangle
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Insert Row After
MenuTablePaste
&Properties...
toolStripMenuItem15
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Select &All
Delete Column Group
System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
MenuInsertSubreport
186, 22
&Copy
System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
MenuChartDelete
MenuTableInsertRowBefore
MenuGridInsertColumnBefore
126, 22
158, 22
158, 22
194, 22
MenuDefaultPaste
219, 22
System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
&List
136, 22
MenuMatrixEditColumnGroup
Select &All
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
126, 22
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
MenuTableDeleteColumn
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
155, 6
Edit Column Group
MenuTableReplaceCellTextbox
126, 22
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Value (Y) Axis Title...
126, 22
194, 22
126, 22
186, 22
137, 154
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Category (X) Axis Title...
126, 22
MenuGridPaste
&Image
MenuSubreportOpen
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
MenuGridSelectAll
Edit Row Group
&Copy
&Chart...
ContextMenuGrid
Insert Row Group...
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
&Copy
ContextMenuDefault
126, 22
&Delete
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Value (Y) Axis...
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
183, 6
&Copy
MenuGridInsertRowAfter
toolStripMenuItem25
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
toolStripMenuItem9
126, 22
Paste
MenuInsertGrid
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
158, 22
toolStripMenuItem7
&Rectangle
System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
194, 22
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
toolStripMenuItem6
toolStripMenuItem26
186, 22
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
&Properties...
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
&Textbox
Table Properties...
155, 6
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
&Copy
&Copy
126, 22
System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
183, 6
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Insert Column Before
toolStripMenuItem27
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
191, 6
219, 22
Delete Category Grouping
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
&Properties...
126, 22
MenuMatrixMatrixProperties
133, 6
toolStripMenuItem8
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
136, 22
toolStripMenuItem20
&Delete
183, 6
191, 6
126, 22
Select &All
&Matrix...
MenuGridReplaceCellList
186, 22
ContextMenuMatrix
MenuGridReplaceCellTable
MenuTableTableProperties
MenuInsertLine
MenuChartInsertSeriesGrouping
183, 6
Paste
194, 22
MenuInsertList
MenuMatrixCopy
toolStripMenuItem22
toolStripMenuItem21
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Delete Group
186, 22
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
&Matrix...
186, 22
Insert Column Group...
&Properties...
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
MenuTableReplaceCellChart
219, 22
Title...
System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
MenuTableReplaceCellRectangle
186, 22
158, 22
toolStripMenuItem16
toolStripMenuItem12
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
186, 22
System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
126, 22
ContextMenuSubreport
MenuInsertMatrix
MenuMatrixProperties
&Grid
MenuChartEditSeriesGrouping
&Rectangle
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
toolStripMenuItem5
MenuChartCategoryAxisTitle
133, 6
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
toolStripMenuItem24
Insert Table Group...
MenuChartCopy
toolStripMenuItem23
126, 22
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Delete Row Group
Delete Grid Row
216, 6
186, 22
Delete Series Grouping
183, 6
MenuChartValueAxisTitle
194, 22
&Subreport
&Replace Cell with
MenuSubreportPaste
183, 6
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
MenuMatrixSelectAll
126, 22
Insert Series Grouping...
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
195, 320
194, 22
Paste
MenuTableReplaceCellMatrix
MenuGridReplaceCellChart
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
MenuGridCopy
186, 22
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
MenuChartSelectAll
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
191, 6
Paste
186, 22
MenuMatrixDelete
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
187, 342
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Delete Grid
183, 6
191, 6
System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
183, 6
&Properties...
Grid Properties...
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
216, 6
&Subreport
219, 22
220, 436
183, 6
186, 22
MenuDefaultDelete
MenuGridReplaceCell
219, 22
186, 22
System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
MenuGridDeleteRow
ContextMenuChart
System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
183, 6
Delete Table Column
Insert Column After
&Textbox
Ta&ble...
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Edit Group
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
194, 22
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
MenuMatrixDeleteRowGroup
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Delete Table
MenuTableProperties
126, 22
&List
Insert Row Before
System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
MenuTableReplaceCell
&Rectangle
toolStripMenuItem4
126, 22
186, 22
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
186, 22
158, 22
219, 22
191, 6
Ta&ble...
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
219, 22
&Image
MenuGridInsertColumnAfter
MenuChartValueAxisRightTitle
MenuTableReplaceCellImage
MenuDefaultInsert
126, 22
MenuTableReplaceCellSubreport
MenuTableInsertGroup
126, 22
Select &All
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
186, 22
219, 22
MenuSubreportCopy
126, 22
System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Delete Matrix
MenuGridDeleteColumn
&Replace Cell with
&Properties...
toolStripMenuItem19
186, 22
187, 414
183, 6
Open Subreport
System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
MenuGridReplaceCellMatrix
MenuTableSelectAll
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Delete Table Row
194, 22
Matrix Properties...
MenuGridReplaceCellSubreport
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Insert Row After
Delete Grid Column
MenuInsertImage
186, 22
186, 22
186, 22
MenuSubreportProperties
MenuGridReplaceCellTextbox
MenuGridReplaceCellImage
136, 22
186, 22
MenuTableInsertColumnBefore
194, 22
MenuInsertTable
186, 22
MenuSubreportDelete
133, 6
MenuMatrixInsertRowGroup
System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
toolStripMenuItem3
136, 22
216, 6
MenuMatrixInsertColumnGroup
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
MenuMatrixEditRowGroup
126, 22
toolStripMenuItem2
MenuTableReplaceCellList
MenuGridGridProperties
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
126, 22
MenuDefaultSelectAll
Select &All
Insert Column After
System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
MenuGridReplaceCellRectangle
System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
MenuChartDeleteSeriesGrouping
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
216, 6
&Insert
136, 22
toolStripMenuItem17
186, 22
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
&Image
DesignCtl
MenuSubreportSelectAll
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
186, 22
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
MenuTableDeleteTable
MenuMatrixPaste
219, 22
toolStripMenuItem14
Paste
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
MenuChartTitle
MenuTableDeleteRow
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Paste
MenuTableReplaceCellTable
MenuGridProperties
&Textbox
219, 22
219, 22
&List
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
ContextMenuTable
219, 22
System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
MenuInsertChart
&Delete
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
136, 22
219, 22
MenuGridDelete
194, 22
MenuChartLegend
MenuGridInsertRowBefore
Edit Series Grouping
Category (X) Axis...
219, 22
toolStripMenuItem10
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
MenuChartDeleteCategoryGrouping
MenuChartInsertCategoryGrouping
186, 22
126, 22
System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Insert Row Before
MenuDefaultProperties
186, 22
toolStripMenuItem1
194, 22
126, 22
219, 22
MenuChartPaste
159, 148
toolStripMenuItem11
126, 22
219, 22
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
MenuMatrixDeleteColumnGroup
MenuChartCategoryAxis
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
194, 22
126, 22
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
186, 22
MenuTableInsertRowAfter
216, 6
Insert Category Grouping...
182, 17
497, 17
True
337, 17
677, 17
17, 17
17, 56
================================================
FILE: RdlDesign/DesignCtl.ru-RU.resx
================================================
text/microsoft-resx
2.0
System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
142, 22
Свойства
139, 6
142, 22
Копировать
142, 22
Вставить
142, 22
Удалить
139, 6
142, 22
Выбрать все
139, 6
163, 22
Диаграмму...
163, 22
Сетку
163, 22
Изображение
163, 22
Линию
163, 22
Список
163, 22
Матрицу...
163, 22
Прямоугольник
163, 22
Подотчёт
163, 22
Таблицу...
163, 22
Текстовое поле
142, 22
Создать
143, 154
276, 22
Свойства...
276, 22
Легенда...
276, 22
Заголовок...
273, 6
276, 22
Добавить группу категории...
276, 22
Редактировать группу категории
276, 22
Удалить группу категории
273, 6
276, 22
Категория (ось X)...
276, 22
Заголовок категории (ось X)...
273, 6
276, 22
Добавить группу серии...
276, 22
Редактировать группу серии
276, 22
Удалить группу серии
273, 6
276, 22
Значение (ось Y)...
276, 22
Заголовок значения (ось Y)...
276, 22
Заголовок значения справа (ось Y)...
273, 6
276, 22
Копировать
276, 22
Вставить
276, 22
Удалить
273, 6
276, 22
Выбрать все
277, 436
260, 22
Свойства...
260, 22
Свойства матрицы...
257, 6
260, 22
Добавить группу по столбцу...
260, 22
Редактировать группу по столбцу
260, 22
Удалить группу по столбцу
257, 6
260, 22
Добавить группу по строке...
260, 22
Редактировать группу по строке
260, 22
Удалить группу по строке
257, 6
260, 22
Удалить матрицу
257, 6
260, 22
Копировать
260, 22
Вставить
260, 22
Удалить
257, 6
260, 22
Выбрать все
261, 320
174, 22
Свойства...
174, 22
Открыть подотчёт
171, 6
174, 22
Копировать
174, 22
Вставить
174, 22
Удалить
171, 6
174, 22
Выбрать все
175, 148
206, 22
Свойства...
206, 22
Свойства сетки...
163, 22
Диаграмму...
163, 22
Изображение
163, 22
Список
163, 22
Матрицу...
163, 22
Прямоугольник
163, 22
Подотчёт
163, 22
Талбицу...
163, 22
Текстовое поле
206, 22
Заменить ячейку на
203, 6
206, 22
Вставить столбец перед
206, 22
Вставить столбец после
203, 6
206, 22
Вставить строку перед
206, 22
Вставить строку после
203, 6
206, 22
Удалить столбец сетки
206, 22
Удалить строку сетки
206, 22
Удалить сетку
203, 6
206, 22
Копировать
206, 22
Вставить
206, 22
Удалить
203, 6
206, 22
Выбрать все
207, 342
206, 22
Свойства...
206, 22
Свойства таблицы...
163, 22
Диаграмму...
163, 22
Изображение
163, 22
Список
163, 22
Матрицу...
163, 22
Прямоугольник
163, 22
Подотчёт
163, 22
Таблицу...
163, 22
Текстовое поле
206, 22
Заменить ячейку на
203, 6
206, 22
Вставить столбец перед
206, 22
Вставить столбец после
203, 6
206, 22
Вставить строку перед
206, 22
Вставить строку после
203, 6
206, 22
Добавить группу...
206, 22
Редактировать группу
206, 22
Удалить группу
203, 6
206, 22
Удалить столбец
206, 22
Удалить строку
206, 22
Удалить таблицу
203, 6
206, 22
Копировать
206, 22
Вставить
206, 22
Удалить
203, 6
206, 22
Выбрать все
207, 414
================================================
FILE: RdlDesign/DesignEditLines.cs
================================================
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Windows.Forms;
using System.Globalization;
using System.Net;
namespace Majorsilence.Reporting.RdlDesign
{
///
/// Control for providing a designer image of RDL. Works directly off the RDL XML.
///
public class DesignEditLines : UserControl, System.ComponentModel.ISupportInitialize
{
System.Windows.Forms.RichTextBox editor=null;
int saveTbEditorLines = -1;
int _LineHeight = -1;
public DesignEditLines()
: base()
{
// force to double buffering for smoother drawing
this.DoubleBuffered = true;
this.Paint += new PaintEventHandler(DesignEditLinesPaint);
}
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
internal System.Windows.Forms.RichTextBox Editor
{
get { return editor; }
set
{
editor = value;
editor.TextChanged += new System.EventHandler(editor_TextChanged);
editor.Resize += new System.EventHandler(editor_Resize);
editor.VScroll += new System.EventHandler(editor_VScroll);
}
}
private void DesignEditLinesPaint(object sender, System.Windows.Forms.PaintEventArgs e)
{
Lines_Draw(e.Graphics);
}
private void Lines_Draw(Graphics g)
{
if (!this.Visible || editor == null)
return;
try
{ // its possible that there are less than 2 lines; so trap the error
if (_LineHeight <= 0)
_LineHeight = editor.GetPositionFromCharIndex(editor.GetFirstCharIndexFromLine(2)).Y -
editor.GetPositionFromCharIndex(editor.GetFirstCharIndexFromLine(1)).Y;
}
catch { return; }
if (_LineHeight <= 0)
return;
// Get the first line index and location
int first_index;
int first_line;
int first_line_y;
first_index = editor.GetCharIndexFromPosition(new
Point(0, (int)(g.VisibleClipBounds.Y + _LineHeight / 3)));
first_line = editor.GetLineFromCharIndex(first_index);
first_line_y = editor.GetPositionFromCharIndex(first_index).Y;
// Draw the lines
SolidBrush sb = new SolidBrush(Control.DefaultBackColor);
g.FillRectangle(sb, g.VisibleClipBounds);
sb.Dispose();
int i = first_line;
float y = first_line_y + _LineHeight * (i - first_line - 1);
int lCount = this.saveTbEditorLines < 0? editor.Lines.Length:
this.saveTbEditorLines; // calc lines if not initialized
Font eFont = editor.Font;
float maxHeight = g.VisibleClipBounds.Y + g.VisibleClipBounds.Height;
while (y < maxHeight)
{
string l = i.ToString();
g.DrawString(l, editor.Font, Brushes.DarkBlue,
this.Width - (g.MeasureString(l, eFont).Width + 4), y);
i += 1;
if (i > lCount)
break;
y = first_line_y + _LineHeight * (i - first_line - 1);
}
}
private void editor_Resize(object sender, EventArgs e)
{
using (Graphics g = this.CreateGraphics())
{
Lines_Draw(g);
}
}
private void editor_VScroll(object sender, EventArgs e)
{
using (Graphics g = this.CreateGraphics())
{
Lines_Draw(g);
}
}
private void editor_TextChanged(object sender, System.EventArgs e)
{
if (editor == null)
return;
// when # of lines change we may need to repaint the line #s
int eLines = editor.Lines.Length;
if (saveTbEditorLines != eLines)
{
saveTbEditorLines = eLines;
using (Graphics g = this.CreateGraphics())
{
Lines_Draw(g);
}
}
}
#region ISupportInitialize Members
void System.ComponentModel.ISupportInitialize.BeginInit()
{
return;
}
void System.ComponentModel.ISupportInitialize.EndInit()
{
return;
}
#endregion
}
}
================================================
FILE: RdlDesign/DesignEditLines.resx
================================================
text/microsoft-resx
1.0.0.0
System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
================================================
FILE: RdlDesign/DesignRuler.cs
================================================
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Windows.Forms;
using System.Globalization;
using System.Net;
using System.Xml;
namespace Majorsilence.Reporting.RdlDesign
{
///
/// Control for providing a designer image of RDL. Works directly off the RDL XML.
///
internal class DesignRuler : UserControl, System.ComponentModel.ISupportInitialize
{
DesignCtl _Design = null;
bool _Vertical = false;
int _Offset = 0; // offset to start with (in pixels)
bool _IsMetric;
int _Intervals;
// Background colors for gradient
static readonly Color BEGINCOLOR = Color.White;
static readonly Color ENDCOLOR = Color.FromArgb(30, Color.LightSkyBlue);
static readonly Color GAPCOLOR = Color.FromArgb(30, Color.LightSkyBlue);
internal DesignRuler()
: base()
{
// force to double buffering for smoother drawing
this.DoubleBuffered = true;
//editor = e;
//editor.TextChanged += new System.EventHandler(editor_TextChanged);
//editor.Resize += new System.EventHandler(editor_Resize);
//editor.VScroll += new System.EventHandler(editor_VScroll);
//RegionInfo rinfo = new RegionInfo(CultureInfo.CurrentCulture.Name);
//_IsMetric = rinfo.IsMetric;
//_Intervals = _IsMetric ? 4 : 8;
this.Paint += new PaintEventHandler(DesignRulerPaint);
}
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
internal DesignCtl Design
{
get { return _Design; }
set
{
_Design = value;
if (_Design == null)
return;
if (_Vertical)
{
_Design.VerticalScrollChanged += new System.EventHandler(ScrollChanged);
// need to know when the various heights change as well
_Design.HeightChanged += new DesignCtl.HeightEventHandler(HeightChanged);
}
else
_Design.HorizontalScrollChanged += new System.EventHandler(ScrollChanged);
}
}
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool Vertical
{
get { return _Vertical; }
set { _Vertical = value; }
}
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public int Offset
{
get { return _Offset; }
set { _Offset = value; }
}
private int ScrollPosition
{
get
{
if (_Design == null)
return 0;
return _Vertical ? _Design.VerticalScrollPosition : _Design.HorizontalScrollPosition;
}
}
private void DesignRulerPaint(object sender, System.Windows.Forms.PaintEventArgs e)
{
_IsMetric = RdlDesign.RdlDesigner.MeasureUnits == "cm" ? true : false;
_Intervals = _IsMetric ? 4 : 8;
if (_Vertical)
Ruler_DrawVert(e.Graphics);
else
Ruler_DrawHorz(e.Graphics);
}
private void HeightChanged(object sender, HeightEventArgs e)
{
if (e.Node != null)
{
// Only need to invalidate when the Body, PageHeader or PageFooter change height
XmlNode p = e.Node.ParentNode;
if (p != null &&
(p.Name == "Body" || p.Name == "PageHeader" || p.Name == "PageFooter"))
{
this.Invalidate();
}
}
}
private void ScrollChanged(object sender, System.EventArgs e)
{
this.Invalidate();
_Design.Invalidate();
}
private void Ruler_DrawHorz(Graphics g)
{
float xoff, yoff, xinc;
StringFormat drawFormat=null;
Font f = null;
LinearGradientBrush lgb=null;
try
{
drawFormat = new StringFormat();
drawFormat.FormatFlags |= StringFormatFlags.NoWrap;
drawFormat.Alignment = StringAlignment.Near;
float mod;
yoff = this.Height/2 -2;
mod = g.DpiX;
if (_IsMetric)
mod = mod / 2.54f;
mod *= _Design.SCALEX;
xinc = mod / (_Intervals * _Design.SCALEX);
xinc *= _Design.SCALEX;
float scroll = ScrollPosition;
if (scroll == 0)
xoff = 0;
else
xoff = scroll + (xinc - scroll % xinc);
RectangleF rf;
if (Offset > 0) // Fill in the left gap; if any
{
rf = new RectangleF(0, 0, Offset, this.Height);
if (rf.IntersectsWith(g.ClipBounds))
{
lgb = new LinearGradientBrush(rf, BEGINCOLOR, ENDCOLOR, LinearGradientMode.ForwardDiagonal);
g.FillRectangle(lgb, rf);
lgb.Dispose();
lgb = null;
// g.FillRectangle(new SolidBrush(GAPCOLOR), rf);
}
}
// Fill in the background for the entire ruler
rf = new RectangleF(this.Offset, 0, this.Width, this.Height);
if (rf.IntersectsWith(g.ClipBounds))
{
lgb = new LinearGradientBrush(rf, BEGINCOLOR, ENDCOLOR, LinearGradientMode.Vertical);
g.FillRectangle(lgb, rf);
lgb.Dispose();
lgb = null;
}
else // nothing to draw
return;
f = new Font("Arial", 8, FontStyle.Regular);
// Loop thru and draw the ruler
while (xoff - scroll < this.Width-Offset)
{
// if (xoff % mod < .001f )
if (xoff % mod < .1f || Math.Abs((xoff % mod) - mod) < .1f)
{
if (xoff != 0) // Don't draw the zero
{
string l = string.Format("{0:0}", xoff / mod);
SizeF sz = g.MeasureString(l, f);
g.DrawString(l, f, Brushes.Black,
Offset + xoff - (sz.Width / 2) - scroll, yoff - (sz.Height / 2), drawFormat);
}
g.DrawLine(Pens.Black, Offset + xoff - scroll, this.Height, Offset + xoff - scroll, this.Height - 2);
}
else
{
g.DrawLine(Pens.Black, Offset + xoff - scroll, yoff, Offset + xoff - scroll, yoff + 2);
}
xoff += xinc;
}
}
finally
{
if (lgb != null)
lgb.Dispose();
if (drawFormat != null)
drawFormat.Dispose();
if (f != null)
f.Dispose();
}
}
private void Ruler_DrawVert(Graphics g)
{
StringFormat strFormat = null;
Font fontOutput = null;
SolidBrush sb = null; // brush for non-ruler portions of ruler
SolidBrush bb = null; // brush for drawing the areas next to band separator
float SectionHeigth = 0f;
g.ScaleTransform(1f, 1f);
g.PageUnit = GraphicsUnit.Point;
try
{
// create some drawing resources
strFormat = new StringFormat();
strFormat.FormatFlags |= StringFormatFlags.NoWrap;
strFormat.Alignment = StringAlignment.Near;
fontOutput = new Font("Arial", 8, FontStyle.Regular);
sb = new SolidBrush(GAPCOLOR);
bb = new SolidBrush(Design.SepColor);
// Go thru the regions
float sp = Design.PointsY(this.ScrollPosition) * _Design.SCALEY;
// 1) Offset
RectangleF rf;
float off = 0;
float offset = Design.PointsY(this.Offset);
float width = Design.PointsX(this.Width);
if (this.Offset > 0)
{
rf = new RectangleF(0, 0, width, offset); // scrolling doesn't affect offset
if (rf.IntersectsWith(g.ClipBounds))
{
LinearGradientBrush lgb = new LinearGradientBrush(rf, BEGINCOLOR, ENDCOLOR, LinearGradientMode.ForwardDiagonal);
g.FillRectangle(lgb, rf);
lgb.Dispose();
lgb = null;
}
off = offset;
}
// 2) PageHeader
if (Design.PageHeaderHeight > 0)
{
SectionHeigth = Design.PageHeaderHeight * _Design.SCALEY;
Ruler_DrawVertPart(g, fontOutput, strFormat, off, SectionHeigth);
off += SectionHeigth;
}
// 3) PageHeader separator
SectionHeigth = Design.SepHeight * _Design.SCALEY;
rf = new RectangleF(0, off - sp, width, SectionHeigth);
if (rf.IntersectsWith(g.ClipBounds))
g.FillRectangle(bb, rf);
off += SectionHeigth;
// 4) Body
if (Design.BodyHeight > 0)
{
SectionHeigth = Design.BodyHeight * _Design.SCALEY;
Ruler_DrawVertPart(g, fontOutput, strFormat, off, SectionHeigth);
off += SectionHeigth;
}
// 5) Body separator
SectionHeigth = Design.SepHeight * _Design.SCALEY;
rf = new RectangleF(0, off - sp, width, SectionHeigth);
if (rf.IntersectsWith(g.ClipBounds))
g.FillRectangle(bb, rf);
off += SectionHeigth;
// 6) PageFooter
if (Design.PageFooterHeight > 0)
{
SectionHeigth = Design.PageFooterHeight * _Design.SCALEY;
Ruler_DrawVertPart(g, fontOutput, strFormat, off, SectionHeigth);
off += SectionHeigth;
}
// 7) PageFooter separator
SectionHeigth = Design.SepHeight * _Design.SCALEY;
rf = new RectangleF(0, off - sp, width, SectionHeigth);
if (rf.IntersectsWith(g.ClipBounds))
g.FillRectangle(bb, rf);
off += SectionHeigth;
// 8) The rest to end
rf = new RectangleF(0, off - sp, width, Design.PointsY(this.Height) - (off - sp));
if (rf.IntersectsWith(g.ClipBounds))
g.FillRectangle(sb, rf);
}
finally
{
if (strFormat != null)
strFormat.Dispose();
if (fontOutput != null)
fontOutput.Dispose();
if (sb != null)
sb.Dispose();
if (bb != null)
bb.Dispose();
}
}
private void Ruler_DrawVertPart(Graphics g, Font f, StringFormat df, float offset, float height)
{
float xoff, yoff, yinc, sinc;
float mod;
xoff = Design.PointsX(this.Width / 2 - 2);
mod = Design.PointsY(g.DpiY);
if (_IsMetric)
mod = Design.PointsY(g.DpiY / 2.54f);
mod *= _Design.SCALEY;
yinc = mod / (_Intervals * _Design.SCALEY);
yinc *= _Design.SCALEY;
float scroll = Design.PointsY(ScrollPosition)*_Design.SCALEY;
sinc = yoff = 0;
if (scroll > offset)
sinc += (yinc - scroll % yinc);
// Fill in the background for the entire ruler
RectangleF rf = new RectangleF(0, yoff + offset - scroll, this.Width, height);
// RectangleF rf = new RectangleF(0, offset - scroll, Design.PointsX(this.Width), height);
if (rf.IntersectsWith(g.ClipBounds))
{
LinearGradientBrush lgb = new LinearGradientBrush(rf, BEGINCOLOR, ENDCOLOR, LinearGradientMode.Horizontal);
g.FillRectangle(lgb, rf);
lgb.Dispose();
}
else
return; // nothing to draw
// Loop thru and draw the ruler
float width = Design.PointsX(this.Width);
while (sinc + offset + yoff - scroll < (offset + height) - scroll &&
sinc + offset + yoff - scroll < g.ClipBounds.Bottom)
{
if (sinc + offset + yoff - scroll < g.ClipBounds.Top - 20)
{ // we don't need to do anything here
}
else if (yoff % mod < .1f || Math.Abs((yoff % mod) - mod) < .1f)
{
if (yoff != 0) // Don't draw the 0
{
string l = string.Format("{0:0}", yoff / mod);
SizeF sz = g.MeasureString(l, f);
g.DrawString(l, f, Brushes.Black,
xoff - (sz.Width / 2), sinc+offset + yoff - (sz.Height / 2) - scroll, df);
}
g.DrawLine(Pens.Black, width, sinc + offset + yoff - scroll, width - 2, sinc+offset + yoff - scroll);
}
else
{
g.DrawLine(Pens.Black, xoff, sinc + offset + yoff - scroll, xoff + 2, sinc+offset + yoff - scroll);
}
yoff += yinc;
}
}
#region ISupportInitialize Members
void System.ComponentModel.ISupportInitialize.BeginInit()
{
return;
}
void System.ComponentModel.ISupportInitialize.EndInit()
{
return;
}
#endregion
}
}
================================================
FILE: RdlDesign/DesignRuler.resx
================================================
text/microsoft-resx
1.0.0.0
System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
================================================
FILE: RdlDesign/DesignXmlDraw.cs
================================================
using Majorsilence.Reporting.Rdl;
using Majorsilence.Reporting.RdlDesign.Resources;
using Majorsilence.Reporting.Rdl.Utility;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml;
using System.ComponentModel;
namespace Majorsilence.Reporting.RdlDesign
{
///
/// Control for providing a designer image of RDL. Works directly off the RDL XML.
///
public class DesignXmlDraw: UserControl
{
static internal readonly float POINTSIZED = 72.27f;
static internal readonly decimal POINTSIZEM = 72.27m;
readonly Color BANDBORDERCOLOR = Color.DimGray; //Josh: added for Band Border
readonly BorderStyleEnum BANDBORDERSTYLE = BorderStyleEnum.Solid; //Josh: Band Border Style
const float BANDBORDERWIDTH = 1f; //Josh: Band border width
readonly Color AREABACKCOLOR = Color.LightGray; //Josh: added for area background color (behind page)
readonly Color OUTWORKAREACOLOR = Color.Azure; //out work area background color (on page, but in margin)
readonly Color OUTITEMCOLOR = Color.Salmon; //color of out work area parts of item
const float RADIUS = 2.5f;
readonly Color BANDCOLOR = Color.LightGray;
const int BANDHEIGHT = 12; // height of band (e.g. body, pageheader, pagefooter) in pts
const float LEFTGAP = 0f; // keep a gap on the left size of the screen
// Various page measurements that we keep
public float ReportVisualSize;
public float ReportVisualSizeBase;
// rWidth is now ReportVisualSizeBase i.e. the report real w size
public float pHeight, pWidth;
public float lMargin, rMargin, tMargin, bMargin;
XmlNode bodyNode;
XmlNode phNode;
XmlNode pfNode;
private XmlDocument rDoc; // the reporting XML document
private List _SelectedReportItems = new List();
private ReportNames _ReportNames; // holds the names of the report items
float DpiX;
float DpiY;
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string Folder { get; set; }
// During drawing these are set
Graphics g;
float _vScroll;
float _hScroll;
RectangleF _clip;
// During hit testing
PointF _HitPoint;
RectangleF _HitRect;
// Durning GetRectangle
XmlNode _RectNode;
RectangleF _GetRect;
bool _ShowReportItemOutline=false;
// For Scaling and AlignMent grid display
public float SCALAX = 1;
public float SCALAY = 1;
public bool EnableDrawGriglia = false;
public Size SizeGridPt = new Size(4, 4);
public Size SizeGridTwips = new Size(8, 8);
internal DesignXmlDraw():base()
{
this.DoubleBuffered = true;
// Get our graphics DPI
Graphics ga = null;
try
{
ga = this.CreateGraphics();
DpiX = ga.DpiX;
DpiY = ga.DpiY;
}
catch
{
DpiX = DpiY = 96;
}
finally
{
if (ga != null)
ga.Dispose();
}
// force to double buffering for smoother drawing
this.SetStyle(ControlStyles.DoubleBuffer |
ControlStyles.UserPaint |
ControlStyles.AllPaintingInWmPaint,
true);
}
///
/// Need to override otherwise don't get key events for up/down/left/right
///
///
///
override protected bool IsInputKey(Keys keyData)
{
if (keyData == Keys.Escape)
return false;
return true;
}
internal Color SepColor
{
get { return BANDCOLOR; }
}
internal float SepHeight
{
get { return BANDHEIGHT; }
}
internal float PageHeaderHeight
{
get
{
if (rDoc == null)
return 0;
XmlNode r = rDoc.LastChild;
XmlNode ph = this.GetNamedChildNode(r, "PageHeader");
if (ph == null)
return 0;
XmlNode h = this.GetNamedChildNode(ph, "Height");
if (h == null)
return 0;
float height = GetSize(h.InnerText);
return height;
}
}
internal float PageFooterHeight
{
get
{
if (rDoc == null)
return 0;
XmlNode r = rDoc.LastChild;
XmlNode ph = this.GetNamedChildNode(r, "PageFooter");
if (ph == null)
return 0;
XmlNode h = this.GetNamedChildNode(ph, "Height");
if (h == null)
return 0;
float height = GetSize(h.InnerText);
return height;
}
}
internal float BodyHeight
{
get
{
if (rDoc == null)
return 0;
XmlNode r = rDoc.LastChild;
XmlNode ph = this.GetNamedChildNode(r, "Body");
if (ph == null)
return 0;
XmlNode h = this.GetNamedChildNode(ph, "Height");
if (h == null)
return 0;
float height = GetSize(h.InnerText);
return height;
}
}
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
internal bool ShowReportItemOutline
{
get { return _ShowReportItemOutline; }
set
{
if (value != _ShowReportItemOutline)
this.Invalidate();
_ShowReportItemOutline = value;
}
}
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
internal ReportNames ReportNames
{
get
{
if (_ReportNames == null && ReportDocument != null)
_ReportNames = new ReportNames(rDoc); // rebuild report names on demand
return _ReportNames;
}
set {_ReportNames = value;}
}
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
internal XmlDocument ReportDocument
{
get {return rDoc;}
set
{
rDoc = value;
if (rDoc != null)
{
ReportNames = null; // this needs to get rebuilt
ProcessReport(rDoc.LastChild);
this.ClearSelected();
}
else
{
this._SelectedReportItems.Clear();
ReportNames = null;
this.ClearSelected();
}
}
}
internal XmlNode Body
{
get { return bodyNode; }
}
internal RectangleF GetRectangle(XmlNode xNode)
{
_RectNode = xNode; // this is the rectangle we're trying to find;
float yLoc=0;
_GetRect = RectangleF.Empty;
try
{
yLoc += GetRectReportPrimaryRegions(phNode, LEFTGAP, yLoc);
yLoc += GetRectReportPrimaryRegions(bodyNode, LEFTGAP, yLoc);
yLoc += GetRectReportPrimaryRegions(pfNode, LEFTGAP, yLoc);
}
catch (Exception e)
{
// this is the normal exit; we throw exception when node is found
if (e.Message == "found it!")
return _GetRect;
}
return RectangleF.Empty;
}
private float GetRectReportPrimaryRegions(XmlNode xNode, float xLoc, float yLoc)
{
if (xNode == null)
return yLoc;
XmlNode items=null;
float height=0;
foreach(XmlNode xNodeLoop in xNode.ChildNodes)
{
if (xNodeLoop.NodeType != XmlNodeType.Element)
continue;
switch (xNodeLoop.Name)
{
case "Height":
height = GetSize(xNodeLoop.InnerText);
break;
case "ReportItems":
items = xNodeLoop;
break;
}
}
RectangleF b = new RectangleF(xLoc, yLoc, int.MaxValue, height);
GetRectReportItems(items, b); // now draw the report items
return height+BANDHEIGHT;
}
private void GetRectReportItems(XmlNode xNode, RectangleF r)
{
if (xNode == null)
return;
foreach(XmlNode xNodeLoop in xNode.ChildNodes)
{
if (xNodeLoop.NodeType != XmlNodeType.Element)
continue;
RectangleF rir=RectangleF.Empty;
switch (xNodeLoop.Name)
{
case "Textbox":
case "Image":
case "Subreport":
case "Chart":
case "Line":
case "CustomReportItem":
rir = GetRectRI(xNodeLoop, r);
break;
case "Table":
case "fyi:Grid":
rir = GetRectTable(xNodeLoop, r);
break;
case "Rectangle":
case "List":
rir = GetRectListRectangle(xNodeLoop, r);
break;
case "Matrix":
rir = GetRectMatrix(xNodeLoop, r);
break;
}
if (xNodeLoop == _RectNode)
{
_GetRect = rir;
throw new RdlException("found it!");
}
}
}
private RectangleF GetRectRI(XmlNode xNode, RectangleF r)
{
RectangleF ir = GetReportItemRect(xNode, r);
return ir;
}
private RectangleF GetRectListRectangle(XmlNode xNode, RectangleF r)
{
RectangleF listR = GetReportItemRect(xNode, r);
XmlNode items = this.GetNamedChildNode(xNode, "ReportItems");
if (items != null)
GetRectReportItems(items, listR);
return listR;
}
private RectangleF GetRectMatrix(XmlNode xNode, RectangleF r)
{
RectangleF mr = GetReportItemRect(xNode, r); // get the matrix rectangle
return mr;
}
private RectangleF GetRectTable(XmlNode xNode, RectangleF r)
{
RectangleF tr = GetReportItemRect(xNode, r); // get the table rectangle
// For Table width is really defined by the table columns
float[] colWidths;
colWidths = GetTableColumnWidths(GetNamedChildNode(xNode, "TableColumns"));
// calc the total width
float w=0;
foreach (float cw in colWidths)
w += cw;
tr.Width = w;
// For Table height is really defined the sum of the RowHeights
List trs = GetTableRows(xNode);
tr.Height = GetTableRowsHeight(trs);
// Loop thru the TableRows and the columns in each of them to get at the
// individual cell
float yPos = tr.Y;
foreach (XmlNode trow in trs)
{
XmlNode tcells=GetNamedChildNode(trow, "TableCells");
float h = GetSize(GetNamedChildNode(trow, "Height").InnerText);
float xPos = tr.X;
int col=0;
foreach (XmlNode tcell in tcells)
{
if (tcell.Name != "TableCell")
continue;
// Calculate width based on cell span
float width = 0;
int colSpan = Convert.ToInt32(GetElementValue(tcell, "ColSpan", "1"));
for (int i = 0; i < colSpan && col+i
/// Returns a collection of the DataSetNames
///
internal object[] DataSetNames
{
get {return ReportNames.DataSetNames;}
}
///
/// Returns a collection of the DataSourceNames
///
internal object[] DataSourceNames
{
get {return ReportNames.DataSourceNames;}
}
internal XmlNode DataSourceName(string dsn)
{
return ReportNames.DataSourceName(dsn);
}
///
/// Returns a collection of the Groupings
///
internal object[] GroupingNames
{
get {return ReportNames.GroupingNames;}
}
internal string[] GetFields(string dataSetName, bool asExpression)
{
return ReportNames.GetFields(dataSetName, asExpression);
}
internal string GetReportParameterDefaultValue(string parameterExpression)
{
return ReportNames.GetReportParameterDefaultValue(parameterExpression);
}
internal string[] GetReportParameters(bool asExpression)
{
return ReportNames.GetReportParameters(asExpression);
}
///
/// EBN 30/03/2014
///
///
///
internal string[] GetReportModules(bool asExpression)
{
return ReportNames.GetReportModules(asExpression);
}
///
/// EBN 30/03/2014
///
///
///
internal string[] GetReportClasses(bool asExpression)
{
return ReportNames.GetReportClasses(asExpression);
}
internal PointF SelectionPosition(XmlNode xNode)
{
RectangleF r = this.GetReportItemRect(xNode);
return new PointF(r.X, r.Y);
}
internal SizeF SelectionSize(XmlNode xNode)
{
SizeF rs = new SizeF(float.MinValue, float.MinValue);
if (this.InTable(xNode))
{
XmlNode tcol = this.GetTableColumn(xNode);
XmlNode tcell = this.GetTableCell(xNode);
if (tcol != null && tcell != null)
{
int colSpan = Convert.ToInt32(GetElementValue(tcell, "ColSpan", "1"));
float width=0;
while (colSpan > 0 && tcol != null)
{
XmlNode w = this.GetNamedChildNode(tcol, "Width");
if (w != null)
width += GetSize(w.InnerText);
colSpan--;
tcol = tcol.NextSibling;
}
if (width > 0)
rs.Width = width;
}
XmlNode tr = this.GetTableRow(xNode);
if (tr != null)
{
XmlNode h = this.GetNamedChildNode(tr, "Height");
if (h != null)
rs.Height = GetSize(h.InnerText);
}
}
else
{
RectangleF r = this.GetReportItemRect(xNode);
rs.Width = r.Width;
rs.Height = r.Height;
}
// we want both values or neither
if (rs.Width == float.MinValue || rs.Height == float.MinValue)
rs.Width = rs.Height = float.MinValue;
return rs;
}
///
/// Adds the node to the selection unless the node is already there in which case it removes it
///
///
internal void AddRemoveSelection(XmlNode node)
{
if (_SelectedReportItems.IndexOf(node) >= 0)
_SelectedReportItems.Remove(node); // remove from list if already in list
else
_SelectedReportItems.Add(node); // add to list otherwise
this.Invalidate();
}
internal void AddSelection(XmlNode node)
{
if (_SelectedReportItems.IndexOf(node) < 0)
{
_SelectedReportItems.Add(node); // add to list otherwise
}
}
internal void ClearSelected()
{
if (_SelectedReportItems.Count > 0)
{
_SelectedReportItems.Clear();
this.Invalidate();
}
}
internal void DeleteSelected()
{
if (_SelectedReportItems.Count <= 0)
return;
foreach (XmlNode n in _SelectedReportItems)
{
DeleteReportItem(n);
}
_SelectedReportItems.Clear();
this.Invalidate();
}
internal bool IsNodeSelected(XmlNode node)
{
bool bSelected=false;
foreach (XmlNode lNode in this._SelectedReportItems)
{
if (lNode == node)
{
bSelected=true;
break;
}
}
return bSelected;
}
internal void RemoveSelection(XmlNode node)
{
_SelectedReportItems.Remove(node);
this.Invalidate();
}
internal bool SelectNext(bool bReverse)
{
XmlNode sNode;
if (_SelectedReportItems.Count > 0)
sNode = _SelectedReportItems[0];
else
sNode = null;
XmlNode nNode = bReverse? ReportNames.FindPrior(sNode): ReportNames.FindNext(sNode);
if (nNode == null)
return false;
this.ClearSelected();
this.AddSelection(nNode);
return true;
}
static internal int CountChildren(XmlNode node, params string[] names)
{
return CountChildren(node, names, 0);
}
static private int CountChildren(XmlNode node, string[] names, int index)
{
int count = 0;
foreach (XmlNode c in node.ChildNodes)
{
if (c.Name != names[index])
continue;
if (names.Length-1 == index)
count++;
else
count += CountChildren(c, names, index+1);
}
return count;
}
internal XmlNode FindCreateNextInHierarchy(XmlNode xNode, params string[] names)
{
XmlNode rNode = xNode;
foreach (string name in names)
{
XmlNode node = null;
foreach (XmlNode cNode in rNode.ChildNodes)
{
if (cNode.NodeType == XmlNodeType.Element &&
cNode.Name == name)
{
node = cNode;
break;
}
}
if (node == null)
node = this.CreateElement(rNode, name, null);
rNode = node;
}
return rNode;
}
static internal XmlNode FindNextInHierarchy(XmlNode xNode, params string [] names)
{
XmlNode rNode=xNode;
foreach (string name in names)
{
XmlNode node = null;
foreach (XmlNode cNode in rNode.ChildNodes)
{
if (cNode.NodeType == XmlNodeType.Element &&
cNode.Name == name)
{
node = cNode;
break;
}
}
rNode = node;
if (rNode == null)
break;
}
return rNode;
}
internal bool AllowGroupOperationOnSelected
{
get
{
if (_SelectedReportItems.Count <= 1)
return false;
foreach (XmlNode xNode in SelectedList)
{
if (InMatrix(xNode) || InTable(xNode))
return false;
}
return true;
}
}
internal int SelectedCount
{
get {return _SelectedReportItems.Count;}
}
///
/// Changes the current selection;
///
/// Report item node to select
/// When true check if node is already selected
internal void SetSelection(XmlNode node, bool bGroup)
{
if (bGroup && _SelectedReportItems.IndexOf(node) >= 0) // already part of selection
return;
_SelectedReportItems.Clear(); // clear out all selected
_SelectedReportItems.Add(node); // and add in the new one
this.Invalidate();
}
internal List SelectedList
{
get {return _SelectedReportItems;}
}
// Adjust for scale
internal float VerticalMax
{
get
{
float TotaleH= GetSize(bodyNode, "Height") +
GetSize(phNode, "Height") +
GetSize(pfNode, "Height") +
BANDHEIGHT * 3 +
3 * 10; // plus about 3 lines
return TotaleH * SCALAY;
}
}
internal float HorizontalMax
{
get
{
ProcessReport(rDoc.LastChild); // make sure pWidth and ReportVisualSize are up to date
float hm = Math.Max(pWidth, ReportVisualSize);
return Math.Max(hm, RightMost(rDoc.LastChild)+90); // 90: just to give a little extra room on right
}
}
///
/// Find the Right most (largest x) position of a report item
///
/// Should be the "Report" node
/// x + width of rightmost object
private float RightMost(XmlNode xNode)
{
float rm=0; // current rightmost position
// Loop thru all the child nodes
foreach(XmlNode xNodeLoop in xNode.ChildNodes)
{
if (xNodeLoop.NodeType != XmlNodeType.Element)
continue;
switch (xNodeLoop.Name)
{
case "Body":
case "PageHeader":
case "PageFooter":
rm = Math.Max(rm, RightMostRI(GetNamedChildNode(xNodeLoop, "ReportItems")));
break;
}
}
return rm;
}
private float RightMostRI(XmlNode xNode)
{
if (xNode == null)
return 0;
float rm = 0;
foreach(XmlNode xNodeLoop in xNode.ChildNodes)
{
RectangleF r = GetReportItemRect(xNodeLoop); // get the ReportItem rectangle
switch (xNodeLoop.Name)
{
case "Table":
case "fyi:Grid":
// Table width is really defined by the table columns
float[] colWidths;
colWidths = GetTableColumnWidths(GetNamedChildNode(xNodeLoop, "TableColumns"));
// calc the total width
float w=0;
foreach (float cw in colWidths)
w += cw;
rm = Math.Max(rm, r.Left + w);
break;
case "Matrix":
MatrixView matrix = new MatrixView(this, xNodeLoop);
rm = Math.Max(rm, r.Left + matrix.Width);
break;
default:
rm = Math.Max(rm, r.Right);
break;
}
}
return rm;
}
///
/// Delete the matrix that contains the passed node
///
///
/// true if table is deleted
internal bool DeleteMatrix(XmlNode node)
{
// Get the table
XmlNode matrix = this.GetMatrixFromReportItem(node);
if (matrix == null)
return false;
return DeleteReportItem(matrix);
}
///
/// Deletes the specified ReportItem node but ensures that the report remains syntactically correct.
/// e.g. TableCells must contain a ReportItems which must contain a ReportItem
/// e.g. The parent ReportsItems node must be deleted if this is the only node.
///
///
/// true when deleted; false when node is changed into Textbox with value = ""
internal bool DeleteReportItem(XmlNode node)
{
bool rc = true;
bool bRebuildNames=false;
if (node.Name == "Table" ||
node.Name == "fyi:Grid" ||
node.Name == "List" ||
node.Name == "Matrix" ||
node.Name == "Rectangle")
bRebuildNames = true;
XmlNode reportItemsNode = node.ParentNode;
if (reportItemsNode == null)
return false; // can't delete this; it is already deleted
XmlNode pReportItems = reportItemsNode.ParentNode;
if (pReportItems.Name == "TableCell")
{ // Report item is part of a table; just convert it to an Textbox with no text
rc = false;
XmlNode styleNode = GetNamedChildNode(node, "Style"); // want to retain style if possible
if (styleNode != null)
styleNode = styleNode.CloneNode(true);
reportItemsNode.RemoveChild(node);
ReportNames.RemoveName(node);
XmlElement tbnode = this.CreateElement(reportItemsNode,"Textbox", null);
ReportNames.GenerateName(tbnode);
XmlElement vnode = this.CreateElement(tbnode, "Value", "");
if (styleNode != null)
tbnode.AppendChild(styleNode);
}
else
{
reportItemsNode.RemoveChild(node);
ReportNames.RemoveName(node);
if (!reportItemsNode.HasChildNodes)
{ // ReportItems now has no nodes and needs to be removed
pReportItems.RemoveChild(reportItemsNode);
}
}
if (bRebuildNames)
ReportNames = null; // this will force a rebuild when next needed
return rc;
}
///
/// Delete the table that contains the passed node
///
///
/// true if table is deleted
internal bool DeleteTable(XmlNode node)
{
// Get the table
XmlNode table = this.GetTableFromReportItem(node);
if (table == null)
return false;
return DeleteReportItem(table);
}
///
/// Draw the report definition
///
///
/// Horizontal scroll position
/// Vertical scroll position
///
internal async Task Draw(Graphics ag, float hScroll, float vScroll, System.Drawing.Rectangle clipRectangle)
{
g = ag;
_hScroll = hScroll;
_vScroll = vScroll;
g.PageUnit = GraphicsUnit.Point;
// Now use scale value
g.ScaleTransform(SCALAX, SCALAY);
_clip = new RectangleF(PointsX(clipRectangle.X) + _hScroll,
PointsY(clipRectangle.Y) + _vScroll,
PointsX(clipRectangle.Width),
PointsY(clipRectangle.Height));
XmlNode xNode = rDoc.LastChild;
if (xNode == null || xNode.Name != "Report")
{
throw new Exception(Strings.DesignXmlDraw_Error_NoReport);
}
ProcessReport(xNode);
// Render the report
DrawMargins(_clip);
float yLoc=0;
yLoc += await DrawReportPrimaryRegions(phNode, LEFTGAP, yLoc, Strings.DesignXmlDraw_PageHeaderRegion_Title);
yLoc += await DrawReportPrimaryRegions(bodyNode, LEFTGAP, yLoc, Strings.DesignXmlDraw_BodyRegion_Title);
yLoc += await DrawReportPrimaryRegions(pfNode, LEFTGAP, yLoc, Strings.DesignXmlDraw_PageFooterRegion_Title);
}
// Process the report
private void ProcessReport(XmlNode xNode)
{
bodyNode=null;
phNode=null;
pfNode=null;
ReportVisualSize = pHeight = pWidth = lMargin = rMargin = tMargin = bMargin = 0;
// Loop thru all the child nodes
foreach(XmlNode xNodeLoop in xNode.ChildNodes)
{
if (xNodeLoop.NodeType != XmlNodeType.Element)
continue;
switch (xNodeLoop.Name)
{
case "Body":
bodyNode = xNodeLoop;
break;
case "PageHeader":
phNode = xNodeLoop;
break;
case "PageFooter":
pfNode = xNodeLoop;
break;
case "Width":
ReportVisualSizeBase = GetSize(xNodeLoop.InnerText);
ReportVisualSize = ReportVisualSizeBase;
break;
case "PageHeight":
pHeight = GetSize(xNodeLoop.InnerText);
break;
case "PageWidth":
pWidth = GetSize(xNodeLoop.InnerText);
break;
case "LeftMargin":
lMargin = GetSize(xNodeLoop.InnerText);
break;
case "RightMargin":
rMargin = GetSize(xNodeLoop.InnerText);
break;
case "TopMargin":
tMargin = GetSize(xNodeLoop.InnerText);
break;
case "BottomMargin":
bMargin = GetSize(xNodeLoop.InnerText);
break;
}
}
// Set the default sizes (if not specified)
if (pWidth == 0)
pWidth = GetSize("8.5in");
if (pHeight == 0)
pHeight = GetSize("11in");
if (ReportVisualSize == 0)
ReportVisualSize = pWidth;
if (phNode == null)
phNode = CreatePrimaryRegion("PageHeader");
if (pfNode == null)
phNode = CreatePrimaryRegion("PageFooter");
if (bodyNode == null)
bodyNode = CreatePrimaryRegion("Body");
return;
}
private XmlNode CreatePrimaryRegion(string name)
{
// Create a primary region: e.g. Page Header, Body, Page Footer
XmlNode xNode = rDoc.CreateElement(name);
// Add in the height element
XmlNode hNode = rDoc.CreateElement("Height");
hNode.InnerText = "0pt";
xNode.AppendChild(hNode);
// Now link it under the Report element
XmlNode rNode = rDoc.LastChild;
rNode.AppendChild(xNode);
return xNode;
}
private async Task DrawReportPrimaryRegions(XmlNode xNode, float xLoc, float yLoc, string title)
{
RectangleF TempRect = new RectangleF(); // To be used on grid backgroung design
if (xNode == null)
return yLoc;
XmlNode items=null;
float CurrentSectionheight=float.MinValue;
foreach(XmlNode xNodeLoop in xNode.ChildNodes)
{
if (xNodeLoop.NodeType != XmlNodeType.Element)
continue;
switch (xNodeLoop.Name)
{
case "Height":
CurrentSectionheight = GetSize(xNodeLoop.InnerText);
break;
case "ReportItems":
items = xNodeLoop;
break;
}
}
if (CurrentSectionheight == float.MinValue)
{ // Shouldn't happen with correctly defined report; so create a Height element for the region
this.CreateElement(xNode, "Height", "0pt");
CurrentSectionheight = 0;
}
// Josh:
// Added the effect of "paper" so that
// the displayed page size would not extend
// past the paper size selected. If a region
// is extended past the end of the paper
// the paper will no longer display and the
// items placed will only be shown with an outline
// in the "off-paper" area.
//White "Paper"
StyleInfo si = new StyleInfo();
// Entire Paper
si.BackgroundColor = OUTWORKAREACOLOR;
RectangleF b = new RectangleF(xLoc, yLoc + 1, /*PointsX(Width)*/(pWidth) /*+ _hScroll*/, /*height*/ ((CurrentSectionheight > TotalPageHeight /* - yLoc*/) ? TotalPageHeight/* - yLoc*/ : CurrentSectionheight));//displayHeight > 0 ? displayHeight : 0);
DrawBackground(b, si);
// Work area
si.BackgroundColor = Color.White;
b = new RectangleF(xLoc + lMargin, yLoc + 1, /*PointsX(Width)*/(pWidth - lMargin - rMargin) /*+ _hScroll*/, /*height*/ ((CurrentSectionheight > TotalPageHeight /* - yLoc*/) ? TotalPageHeight/* - yLoc*/ : CurrentSectionheight));//displayHeight > 0 ? displayHeight : 0);
DrawBackground(b, si);
// The alignment grid is displayed on Work area
// La griglia e' disegnata sulla superficie di lavoro e deve tenere conto dei valori dello scroll
// perche' i valori dello scroll dei singoli items sono computati nelle varie routines che disegnano
// la linea o il background
//
if (EnableDrawGriglia == true)
{
TempRect = b;
// adjust coordinates for scrolling
TempRect.X -= _hScroll - 1;
TempRect.Y -= _vScroll - 1;
ControlPaint.DrawGrid(g, Rectangle.Round(TempRect), SizeGridPt, Color.White);
}
//Edge of paper
DrawLine(Color.Gray, BorderStyleEnum.Solid, 1, pWidth, yLoc + 1, pWidth, yLoc + CurrentSectionheight);
//End "Paper"
// Josh:
// Draws the items before the band
// so that the items will appear "below" the band.
//Items
await DrawReportItems(items, b); // now draw the report items
//End Items
//Band and Text
RectangleF bm = new RectangleF(_hScroll,yLoc+CurrentSectionheight, PointsX(Width)+_hScroll, BANDHEIGHT);
si.BackgroundColor = BANDCOLOR;
si.FontFamily = "Arial";
si.FontSize = 8;
si.FontWeight = FontWeightEnum.Bold;
//Josh: Added border styles for the dividing bars.
//Makes it easier to see where page stops in a section.
//Added padding on the left side of the text too due to the border line
si.BStyleBottom = si.BStyleLeft = si.BStyleRight = si.BStyleTop = BANDBORDERSTYLE;
si.BWidthBottom = si.BWidthLeft = si.BWidthRight = si.BWidthTop = BANDBORDERWIDTH;
si.BColorBottom = si.BColorLeft = si.BColorRight = si.BColorTop = BANDBORDERCOLOR;
si.PaddingLeft = BANDBORDERWIDTH + SCALAY*1f;
DrawString(title, si, bm);
//End Band and Text
return CurrentSectionheight+BANDHEIGHT;
}
private async Task DrawReportItems(XmlNode xNode, RectangleF r)
{
if (xNode == null)
return;
IEnumerable olist;
if (xNode.ChildNodes.Count > 1)
olist = DrawReportItemsOrdered(xNode); // Get list with ordered report items
else
olist = xNode.ChildNodes;
foreach(XmlNode xNodeLoop in olist)
{
if (xNodeLoop.NodeType != XmlNodeType.Element)
continue;
RectangleF rir=RectangleF.Empty;
switch (xNodeLoop.Name)
{
case "Textbox":
rir = await DrawTextbox(xNodeLoop, r);
break;
case "Table":
case "fyi:Grid":
rir = await DrawTable(xNodeLoop, r);
break;
case "Image":
rir = await DrawImage(xNodeLoop, r);
break;
case "CustomReportItem":
rir = await DrawCustomReportItem(xNodeLoop, r);
break;
case "Rectangle":
rir = await DrawRectangle(xNodeLoop, r);
break;
case "List":
rir = await DrawList(xNodeLoop, r);
break;
case "Matrix":
rir = await DrawMatrix(xNodeLoop, r);
break;
case "Subreport":
rir = await DrawSubreport(xNodeLoop, r);
break;
case "Chart":
rir = await DrawChart(xNodeLoop, r);
break;
case "Line":
rir = await DrawLine(xNodeLoop, r);
break;
}
// Josh:
// Draws the item "Out of bounds" if the item is
// "off paper".
if (!r.Contains(rir))
{
await DrawOutOfBounds(xNodeLoop, r);
}
if (!rir.IsEmpty)
{
if (this._SelectedReportItems.IndexOf(xNodeLoop) >= 0)
DrawSelected(xNodeLoop, rir);
}
}
}
// Josh: Modified so that items can be returned in reverse order as well
// That way, items can be drawn on top of each other correctly.
// This is useful when attempting to have text boxes over an image for example.
private List DrawReportItemsOrdered(XmlNode xNode)
{
return DrawReportItemsOrdered(xNode, false);
}
//Josh: Modified so that items can be returned in reverse order as well
private List DrawReportItemsOrdered(XmlNode xNode, bool reverse)
{
// build the array
List al = new List(xNode.ChildNodes.Count);
foreach (XmlNode n in xNode.ChildNodes)
{
al.Add(n);
}
// Josh: See above comment.
if (!reverse)
{
al.Sort(new ReportItemSorter(this));
}
else
{
al.Sort(new ReportItemReverseSorter(this));
}
return al;
}
public RectangleF GetReportItemRect(XmlNode xNode, RectangleF r)
{
RectangleF rir = GetReportItemRect(xNode);
if (rir.Width == float.MinValue)
rir.Width = r.Width - rir.Left;
if (rir.Height == float.MinValue)
rir.Height = r.Height - rir.Top;
rir = new RectangleF(rir.Left + r.Left, rir.Top + r.Top , rir.Width, rir.Height);
//rir.Intersect(r); //Josh: Removed so that the items will still display
// an outline if they go farther than
// the edge of the page
return rir;
}
// Josh: This method returns the rectangle to the Right of the paper border where the
// item should be outlined only.
private RectangleF GetOutOfBoundsRightReportItemRect(XmlNode xNode, RectangleF r)
{
RectangleF rir = GetReportItemRect(xNode);
if (rir.Right + LEFTGAP + lMargin <= r.Right)
{
return rir;
}
else
{
if (rir.Width == float.MinValue)
rir.Width = r.Width - rir.Left;
if (rir.Height == float.MinValue)
rir.Height = r.Height - rir.Top;
RectangleF ibr = new RectangleF(rir.Left + r.Left, rir.Top + r.Top, rir.Width, rir.Height);
ibr.Intersect(r);
rir = new RectangleF(ibr.X + ibr.Width, ibr.Y, rir.Width - ibr.Width, rir.Height);
return rir;
}
}
// Josh: This method returns the rectangle to the Bottom of the paper border where the
// item should be outlined only.
private RectangleF GetOutOfBoundsBottomReportItemRect(XmlNode xNode, RectangleF r)
{
RectangleF rir = GetReportItemRect(xNode);
if (rir.Bottom <= r.Bottom)
{
return rir;
}
else
{
if (rir.Width == float.MinValue)
rir.Width = r.Width - rir.Left;
if (rir.Height == float.MinValue)
rir.Height = r.Height - rir.Top;
RectangleF ibr = new RectangleF(rir.Left + r.Left, rir.Top + r.Top, rir.Width, rir.Height);
ibr.Intersect(r);
rir = new RectangleF(ibr.X, ibr.Y + ibr.Height, ibr.Width, rir.Height - ibr.Height);
return rir;
}
}
///
/// Return the rectangle as specified by Left, Top, Height, Width elements
///
///
///
internal RectangleF GetReportItemRect(XmlNode xNode)
{
float t=0;
float l=0;
float w=float.MinValue;
float h=float.MinValue;
foreach(XmlNode xNodeLoop in xNode.ChildNodes)
{
if (xNodeLoop.NodeType != XmlNodeType.Element)
continue;
switch (xNodeLoop.Name)
{
case "Top":
t = GetSize(xNodeLoop.InnerText);
break;
case "Left":
l = GetSize(xNodeLoop.InnerText);
break;
case "Height":
h = GetSize(xNodeLoop.InnerText);
break;
case "Width":
w = GetSize(xNodeLoop.InnerText);
break;
}
}
RectangleF rir = new RectangleF(l, t, w, h);
return rir;
}
private void GetLineEnds(XmlNode xNode, RectangleF r, out PointF l1, out PointF l2)
{
float x=0;
float y=0;
float w=0;
float h=0;
foreach(XmlNode xNodeLoop in xNode.ChildNodes)
{
if (xNodeLoop.NodeType != XmlNodeType.Element)
continue;
switch (xNodeLoop.Name)
{
case "Top":
y = GetSize(xNodeLoop.InnerText);
break;
case "Left":
x = GetSize(xNodeLoop.InnerText);
break;
case "Height":
h = GetSize(xNodeLoop.InnerText);
break;
case "Width":
w = GetSize(xNodeLoop.InnerText);
break;
}
}
l1 = new PointF(r.Left + x, r.Top + y);
l2 = new PointF(l1.X+w, l1.Y+h);
return;
}
private void SetReportItemHeightWidth(XmlNode xNode, float height, float width)
{
this.SetElement(xNode, "Height", string.Format(NumberFormatInfo.InvariantInfo, "{0:0.##}pt", height));
this.SetElement(xNode, "Width", string.Format(NumberFormatInfo.InvariantInfo, "{0:0.##}pt", width));
}
private void SetReportItemXY(XmlNode xNode, float x, float y)
{
this.SetElement(xNode, "Left", string.Format(NumberFormatInfo.InvariantInfo, "{0:0.##}pt", x));
this.SetElement(xNode, "Top", string.Format(NumberFormatInfo.InvariantInfo, "{0:0.##}pt", y));
}
private void RemoveReportItemLTHW(XmlNode ri)
{
XmlNode w = this.GetNamedChildNode(ri, "Left");
if (w != null)
ri.RemoveChild(w);
w = this.GetNamedChildNode(ri, "Top");
if (w != null)
ri.RemoveChild(w);
w = this.GetNamedChildNode(ri, "Height");
if (w != null)
ri.RemoveChild(w);
w = this.GetNamedChildNode(ri, "Width");
if (w != null)
ri.RemoveChild(w);
}
private async Task DrawChart(XmlNode xNode, RectangleF r)
{
RectangleF ir = GetReportItemRect(xNode, r);
XmlNode title = this.GetNamedChildNode(xNode, "Title");
StyleInfo csi = await GetStyleInfo(xNode);
csi.TextAlign = TextAlignEnum.Left;
if (title != null)
{
DrawString("", csi, ir); // for the chart background
string caption = this.GetElementValue(title, "Caption", "");
if (caption == "")
caption = "Chart";
else
caption = "Chart: " + caption;
// Blend the styles of the chart and the title;
StyleInfo tsi = await GetStyleInfo(title);
csi.FontFamily = tsi.FontFamily;
csi.FontSize = tsi.FontSize;
csi.FontStyle = tsi.FontStyle;
csi.FontWeight = tsi.FontWeight;
csi.Color = tsi.Color;
csi.TextAlign = TextAlignEnum.Left;
DrawString(caption, csi, ir, false);
}
else
DrawString(xNode.Name, csi, ir, false);
return ir;
}
internal string GetCustomReportItemType(string type)
{
// type can be the type or it can be an rdl parameter
// implement for both
if (type.StartsWith("={?"))
{
// handle types like ={?BarcodeType}
// lookup the pareamter
string paramName = type.Substring(3, type.Length - 4);
XmlNode pNode = this.GetNamedChildNode(rDoc.LastChild, "ReportParameters");
if (pNode != null)
{
foreach (XmlNode xNode in pNode.ChildNodes)
{
if (xNode.NodeType != XmlNodeType.Element || xNode.Name != "ReportParameter")
continue;
System.Xml.XmlAttribute na = xNode.Attributes["Name"];
if (na.Value == paramName)
{
XmlNode dvNode = this.GetNamedChildNode(xNode, "DefaultValue");
if (dvNode != null)
{
XmlNode vNode = this.GetNamedChildNode(dvNode, "Values");
if (vNode != null && vNode.HasChildNodes)
{
type = vNode.FirstChild.InnerText;
break;
}
}
}
}
}
}
return type;
}
private async Task DrawCustomReportItem(XmlNode xNode, RectangleF r)
{
RectangleF ir = GetReportItemRect(xNode, r);
if (!ir.IntersectsWith(_clip))
return ir;
StyleInfo si = await GetStyleInfo(xNode);
XmlNode tNode = this.GetNamedChildNode(xNode, "Type");
if (tNode == null)
{ // shouldn't really ever happen
DrawString("CustomReportItem requires type.", si, ir);
return ir;
}
string type = GetCustomReportItemType(tNode.InnerText);
ICustomReportItem cri = null;
Bitmap bm = null;
try
{
cri = RdlEngineConfig.CreateCustomReportItem(type);
int width = (int)PixelsX(ir.Width - (si.PaddingLeft + si.PaddingRight));
int height = (int)PixelsY(ir.Height - (si.PaddingTop + si.PaddingBottom));
if (width <= 0)
width = 1;
if (height <= 0)
height = 1;
bm = new Bitmap(width, height);
cri.DrawDesignerImage(ref bm);
DrawImageSized(xNode,ImageSizingEnum.Clip, bm, si, ir);
DrawBorder(si, ir);
}
catch
{
DrawString("CustomReportItem type is unknown.", si, ir);
}
finally
{
if (cri != null)
cri.Dispose();
if (bm != null)
bm.Dispose();
}
return ir;
}
private async Task DrawImage(XmlNode xNode, RectangleF r)
{
RectangleF ir = GetReportItemRect(xNode, r);
if (!ir.IntersectsWith(_clip))
return ir;
StyleInfo si = await GetStyleInfo(xNode);
XmlNode sNode = this.GetNamedChildNode(xNode, "Source");
XmlNode vNode = this.GetNamedChildNode(xNode, "Value");
if (sNode == null || vNode == null)
{ // shouldn't really ever happen
DrawString("Image with invalid source or value.", si, ir);
return ir;
}
switch (sNode.InnerText)
{
case "External":
if (await DrawImageExternal(xNode, sNode, vNode, si, ir))
ir = GetReportItemRect(xNode, r);
DrawBorder(si, ir);
break;
case "Embedded":
// Josh: adds base rectangle so the "paper" size is known when drawing image.
if (DrawImageEmbedded(xNode, sNode, vNode, si, ir, r))
{
ir = GetReportItemRect(xNode, r);
}
DrawBorder(si, ir);
break;
case "Database":
DrawString(string.Format("Database Image: {0}.", vNode.InnerText), si, ir);
break;
default:
DrawString(string.Format("Image, invalid source={0}.", sNode.InnerText), si, ir);
break;
}
return ir;
}
// Josh: adds base rectangle so the "paper" size is known when drawing image.
private bool DrawImageEmbedded(XmlNode iNode, XmlNode sNode, XmlNode vNode, StyleInfo si, RectangleF r, RectangleF rBase)
{
// First we need to find the embedded image list
XmlNode emNode = this.GetNamedChildNode(rDoc.LastChild, "EmbeddedImages");
if (emNode == null)
{
DrawString(string.Format("Image: embedded image {0} requested but there are no embedded images defined.",vNode.InnerText), si, r);
return false;
}
// Next find the requested embedded image by name
XmlNode eiNode=null;
foreach (XmlNode xNode in emNode.ChildNodes)
{
if (xNode.NodeType != XmlNodeType.Element || xNode.Name != "EmbeddedImage")
continue;
System.Xml.XmlAttribute na = xNode.Attributes["Name"];
if (na.Value == vNode.InnerText)
{
eiNode = xNode;
break;
}
}
if (eiNode == null)
{
DrawString(string.Format("Image: embedded image {0} not found.",vNode.InnerText), si, r);
return false;
}
// Get the image data out
XmlNode id = this.GetNamedChildNode(eiNode, "ImageData");
byte[] ba = Convert.FromBase64String(id.InnerText);
Stream strm=null;
System.Drawing.Image im=null;
bool bResize=false;
try
{
strm = new MemoryStream(ba);
im = System.Drawing.Image.FromStream(strm);
// Draw based on sizing options
// Josh: adds base rectangle so the "paper" size is known when drawing image.
bResize = DrawImageSized(iNode, im, si, r, rBase);
}
catch (Exception e)
{
DrawString(string.Format("Image: {0}",e.Message), si, r);
}
finally
{
if (strm != null)
strm.Close();
if (im != null)
im.Dispose();
}
return bResize;
}
private System.Drawing.Image GetImageEmbedded(string emName)
{
// First we need to find the embedded image list
XmlNode emNode = this.GetNamedChildNode(rDoc.LastChild, "EmbeddedImages");
if (emNode == null)
return null; // no embedded images exist
// Next find the requested embedded image by name
XmlNode eiNode = null;
foreach (XmlNode xNode in emNode.ChildNodes)
{
if (xNode.NodeType != XmlNodeType.Element || xNode.Name != "EmbeddedImage")
continue;
System.Xml.XmlAttribute na = xNode.Attributes["Name"];
if (na.Value == emName)
{
eiNode = xNode;
break;
}
}
if (eiNode == null)
return null; // no embedded image with that name
// Get the image data out
XmlNode id = this.GetNamedChildNode(eiNode, "ImageData");
byte[] ba = Convert.FromBase64String(id.InnerText);
Stream strm = null;
System.Drawing.Image im = null;
try
{
strm = new MemoryStream(ba);
im = System.Drawing.Image.FromStream(strm);
}
catch
{
im = null;
}
finally
{
if (strm != null)
strm.Close();
}
return im;
}
private async Task DrawImageExternal(XmlNode iNode, XmlNode sNode, XmlNode vNode, StyleInfo si, RectangleF r)
{
Stream strm = null;
System.Drawing.Image im = null;
bool bResize = false;
try
{
if (vNode.InnerText[0] == '=')
{ // Image is an expression; can't calculate at design time
DrawString(string.Format("Image: {0}", vNode.InnerText), si, r);
}
else
{
// TODO: should probably put this into cached memory: instead of reading all the time
string fname = vNode.InnerText;
if (fname.StartsWith("http:") || fname.StartsWith("file:") || fname.StartsWith("https:"))
{
using HttpClient httpClient = new HttpClient();
httpClient.AddMajorsilenceReportingUserAgent();
HttpResponseMessage response =await httpClient.GetAsync(fname);
response.EnsureSuccessStatusCode();
strm = await response.Content.ReadAsStreamAsync();
}
else
{
strm = new FileStream(fname, FileMode.Open, FileAccess.Read, FileShare.Read);
}
im = System.Drawing.Image.FromStream(strm);
// Draw based on sizing options
bResize = DrawImageSized(iNode, im, si, r);
}
}
catch (Exception e)
{
DrawString(string.Format("Image: {0}", e.Message), si, r);
}
finally
{
if (strm != null)
strm.Close();
if (im != null)
im.Dispose();
}
return bResize;
}
ImageSizingEnum GetSizing(XmlNode iNode)
{
XmlNode szNode = this.GetNamedChildNode(iNode, "Sizing");
ImageSizingEnum ise = szNode == null ? ImageSizingEnum.AutoSize :
ImageSizing.GetStyle(szNode.InnerText);
return ise;
}
// Josh: adds the base rectange so the paper size is known.
private bool DrawImageSized(XmlNode iNode, Image im, StyleInfo si, RectangleF r, RectangleF rBase)
{
return DrawImageSized(iNode, GetSizing(iNode), im, si, r, rBase);
}
private bool DrawImageSized(XmlNode iNode, ImageSizingEnum ise, Image im, StyleInfo si, RectangleF r)
{
return DrawImageSized(iNode, ise, im, si, r, r);
}
private bool DrawImageSized(XmlNode iNode, Image im, StyleInfo si, RectangleF r)
{
return DrawImageSized(iNode, GetSizing(iNode), im, si, r);
}
// Josh: adds the base rectange so the paper size is known.
private bool DrawImageSized(XmlNode iNode, ImageSizingEnum ise, Image im, StyleInfo si, RectangleF r, RectangleF rBase)
{
// calculate new rectangle based on padding and scroll
RectangleF r2 = new RectangleF(r.Left + si.PaddingLeft - _hScroll,
r.Top + si.PaddingTop - _vScroll,
r.Width - si.PaddingLeft - si.PaddingRight,
r.Height - si.PaddingTop - si.PaddingBottom);
bool bResize = false;
float height, width; // some work variables
Rectangle ir; // int work rectangle
GraphicsUnit gu;
switch (ise)
{
case ImageSizingEnum.AutoSize:
// Note: GDI+ will stretch an image when you only provide
// the left/top coordinates. This seems pretty stupid since
// it results in the image being out of focus even though
// you don't want the image resized.
// g.DrawImage(im, r2.Left, r2.Top);
// correct the height and width of the image: to match size of image
width = PointsX(im.Width) + si.PaddingLeft + si.PaddingRight;
height = PointsY(im.Height) + si.PaddingTop + si.PaddingBottom;
this.SetReportItemHeightWidth(iNode, height, width);
gu = g.PageUnit;
g.PageUnit = GraphicsUnit.Pixel;
ir = new Rectangle(PixelsX(r2.Left), PixelsY(r2.Top), im.Width, im.Height);
g.DrawImage(im, ir);
g.PageUnit = gu;
bResize = true;
break;
case ImageSizingEnum.Clip:
Region saveRegion = g.Clip;
Region clipRegion = new Region(g.Clip.GetRegionData());
//RectangleF r3 = new RectangleF(PointsX(r2.Left), PointsY(r2.Top), PointsX(r2.Width), PointsY(r2.Height));
clipRegion.Intersect(r2);
g.Clip = clipRegion;
gu = g.PageUnit;
g.PageUnit = GraphicsUnit.Pixel;
ir = new Rectangle(PixelsX(r2.Left), PixelsY(r2.Top), im.Width, im.Height);
g.DrawImage(im, ir);
g.PageUnit = gu;
g.Clip = saveRegion;
break;
case ImageSizingEnum.FitProportional: //Josh: Modified to allow
//accurate scaling of image
//when scrolling page.
// Previously, the image would
// "shrink" as it's box was
// scrolled off the page.
float ratioIm = (float) im.Height / (float) im.Width;
float ratioR = r2.Height / r2.Width;
height = r2.Height;
width = r2.Width;
if (ratioIm > ratioR)
{ // this means the rectangle width must be corrected
width = height * (1/ratioIm);
}
else if (ratioIm < ratioR)
{ // this means the ractangle height must be corrected
height = width * ratioIm;
}
// Josh: creates another rectangle used to determine the area to draw
// so that the entire image is not "drawn" off screen and only the
// portion displayed is drawn.
RectangleF r3 = new RectangleF(r2.X, r2.Y, width, height);
width = (float)im.Width / (float)PixelsX(width);
height = (float)im.Height / (float)PixelsY(height);
r3.Y = rBase.Y;
r3.X = rBase.X;
r3.Intersect(rBase);
r3.Y = r2.Y;
r3.X = r2.X;
width = PixelsX(r3.Width) * width;
height = PixelsY(r3.Height) * height;
float startingX = PixelsX(/*(_hScroll > rBase.X) ? (_hScroll - */si.PaddingLeft/* + rBase.X) : 0*/);
float startingY = PixelsY(/*(_vScroll > rBase.Y) ? (_vScroll - */si.PaddingTop/* + rBase.Y) : 0*/);
g.DrawImage(im, r3,
new RectangleF(
startingX,
startingY,
(width > im.Width ? im.Width : width) - startingX,
(height > im.Height ? im.Height : height) - startingY),
GraphicsUnit.Pixel);
break;
case ImageSizingEnum.Fit:
default:
g.DrawImage(im, r2);
break;
}
return bResize;
}
private async Task DrawList(XmlNode xNode, RectangleF r)
{
RectangleF listR = GetReportItemRect(xNode, r);
StyleInfo si = await GetStyleInfo(xNode);
DrawBackground(listR, si);
DrawBorder(si, listR);
XmlNode items = this.GetNamedChildNode(xNode, "ReportItems");
if (items != null)
await DrawReportItems(items, listR);
return listR;
}
private async Task DrawLine(XmlNode xNode, RectangleF r)
{
PointF l1;
PointF l2;
GetLineEnds(xNode, r, out l1, out l2);
StyleInfo si = await GetStyleInfo(xNode);
BorderStyleEnum ls = si.BStyleLeft;
if (!(ls == BorderStyleEnum.Solid ||
ls == BorderStyleEnum.Dashed ||
ls == BorderStyleEnum.Dotted))
ls = BorderStyleEnum.Solid;
DrawLine(si.BColorLeft, ls, si.BWidthLeft,
l1.X, l1.Y, l2.X, l2.Y);
return r;
}
private async Task DrawMatrix(XmlNode xNode, RectangleF r)
{
RectangleF mr = GetReportItemRect(xNode, r); // get the matrix rectangle
if (mr.IsEmpty)
return mr;
MatrixView matrix = new MatrixView(this, xNode);
mr.Height = matrix.Height;
mr.Width = matrix.Width;
float ypos = mr.Top;
for (int row=0; row < matrix.Rows; row++)
{
float xpos = mr.Left;
for (int col=0; col DrawRectangle(XmlNode xNode, RectangleF r)
{
StyleInfo si = await GetStyleInfo(xNode);
RectangleF ri = GetReportItemRect(xNode, r);
DrawBackground(ri, si);
DrawBorder(si, ri);
XmlNode items = this.GetNamedChildNode(xNode, "ReportItems");
if (items != null)
await DrawReportItems(items, ri);
return ri;
}
private void DrawSelected(XmlNode xNode, RectangleF r)
{
if (xNode.Name == "Line")
{
DrawSelectedLine(xNode, r);
return;
}
StyleInfo si = new StyleInfo();
XmlNode parent = GetReportItemDataRegionContainer(xNode);
if (parent != null)
{
RectangleF rect = GetRectangle(parent);
rect.X += lMargin;
rect.Y += BANDBORDERWIDTH;
DrawSelected(parent, rect);
}
si.BStyleBottom = si.BStyleLeft = si.BStyleTop = si.BStyleRight = BorderStyleEnum.Solid;
si.BWidthBottom = si.BWidthLeft = si.BWidthRight = si.BWidthTop = 1;
// Josh: Changed to DimGray (personal preference)
si.BColorBottom = si.BColorLeft = si.BColorRight = si.BColorTop = Color.DimGray; //Color.LightGray;
if (!IsDataRegion(xNode) || xNode.Name == "List")
{
DrawBorder(si, r);
DrawCircle(Color.Black, BorderStyleEnum.Solid, 1,
r.X - RADIUS, r.Y - RADIUS, RADIUS * 2, true); // top left
DrawCircle(Color.Black, BorderStyleEnum.Solid, 1,
r.X + r.Width - RADIUS, r.Y - RADIUS, RADIUS * 2, true); // top right
DrawCircle(Color.Black, BorderStyleEnum.Solid, 1,
r.X - RADIUS, r.Y + r.Height - RADIUS, RADIUS * 2, true); // bottom left
DrawCircle(Color.Black, BorderStyleEnum.Solid, 1,
r.X + r.Width - RADIUS, r.Y + r.Height - RADIUS, RADIUS * 2, true); // bottom right
}
else
{
if (xNode.Name == "Table")
{
HighLightTableRegion(xNode, r);
}
}
}
private void HighLightTableRegion(XmlNode xNode,RectangleF r)
{
Color[] defaultTableGroupColors =
{
Color.LightBlue,Color.LightGreen,Color.LightYellow,Color.Pink,Color.Orange,Color.Aquamarine
};
int descBandWitdh = 100;
int descColumnsHeight = 10;
StyleInfo siDefault = new StyleInfo();
siDefault.BackgroundColor = Color.Aqua;
siDefault.FontFamily = "Arial";
siDefault.FontSize = 8;
siDefault.FontWeight = FontWeightEnum.Bold;
siDefault.BStyleBottom = siDefault.BStyleLeft = siDefault.BStyleRight = siDefault.BStyleTop = BorderStyleEnum.Solid;
siDefault.BColorBottom = siDefault.BColorLeft = siDefault.BColorRight = siDefault.BColorTop = Color.Black;
RectangleF bandPos = r;
bandPos.X = r.X + r.Width;
bandPos.Width = descBandWitdh;
StyleInfo si = (StyleInfo) siDefault.Clone();
Dictionary assignedGroupColors = new Dictionary();
Dictionary> sections = GetTableSections(xNode);
int colorGroupIndex = 0;
foreach (var s in sections)
{
foreach (var p in s.Value)
{
float h = GetSize(GetNamedChildNode(p, "Height").InnerText);
si = (StyleInfo)siDefault.Clone();
// Scale Band Height
bandPos.Height = h*SCALAY;
if (s.Key.StartsWith("G"))
{
int sepGroup = s.Key.IndexOf('_');
string groupDesc = s.Key.Substring(sepGroup + 1);
if (groupDesc.Length > 0)
{
Color groupColor;
if (!assignedGroupColors.TryGetValue(groupDesc, out groupColor))
{
if (colorGroupIndex > defaultTableGroupColors.Length - 1)
groupColor = defaultTableGroupColors[defaultTableGroupColors.Length-1];
else
groupColor = defaultTableGroupColors[colorGroupIndex];
assignedGroupColors.Add(groupDesc, groupColor);
colorGroupIndex++;
}
si.BackgroundColor = groupColor;
}
}
DrawString(s.Key, si, bandPos);
bandPos.Y += h;
}
}
//columns
bandPos = r;
bandPos.Y -= descColumnsHeight;
bandPos.Height = descColumnsHeight;
si = (StyleInfo)siDefault.Clone();
si.TextAlign = TextAlignEnum.Center;
DrawString("Columns", si, bandPos);
}
private void DrawSelectedLine(XmlNode xNode, RectangleF r)
{
PointF p1;
PointF p2;
this.GetLineEnds(xNode, r, out p1, out p2);
DrawCircle(Color.Black, BorderStyleEnum.Solid, 1,
p1.X - RADIUS, p1.Y - RADIUS, RADIUS*2, true);
DrawCircle(Color.Black, BorderStyleEnum.Solid, 1,
p2.X + - RADIUS, p2.Y - RADIUS, RADIUS*2, true);
}
// Josh: Draws the "out of bounds" area of the "off paper" controls.
private async Task DrawOutOfBounds(XmlNode xNode, RectangleF r)
{
StyleInfo si = await GetStyleInfo(xNode);
RectangleF ri = GetOutOfBoundsRightReportItemRect(xNode, r);
si.BackgroundColor = OUTITEMCOLOR;
if (ri.Right > r.Right)//(!r.Contains(ri))
{
DrawBackground(ri, si);
}
ri = GetOutOfBoundsBottomReportItemRect(xNode, r);
if (ri.Bottom > r.Bottom)
{
DrawBackground(ri, si);
}
return;
}
private async Task DrawSubreport(XmlNode xNode, RectangleF r)
{
RectangleF tr = GetReportItemRect(xNode, r);
string subreport = this.GetElementValue(xNode, "ReportName", "");
string title = string.Format("Subreport: {0}", subreport);
DrawString(title, await GetStyleInfo(xNode), tr, false);
return tr;
}
private async Task DrawTable(XmlNode xNode, RectangleF r)
{
RectangleF tr = GetReportItemRect(xNode, r); // get the table rectangle
if (tr.IsEmpty)
return tr;
// For Table width is really defined by the table columns
float[] colWidths;
colWidths = GetTableColumnWidths(GetNamedChildNode(xNode, "TableColumns"));
// calc the total width
float w=0;
foreach (float cw in colWidths)
w += cw;
tr.Width = w;
// For Table height is really defined the sum of the RowHeights
List trs = GetTableRows(xNode);
tr.Height = GetTableRowsHeight(trs);
DrawBackground(tr, await GetStyleInfo(xNode));
// Loop thru the TableRows and the columns in each of them to get at the
// individual cell
float yPos = tr.Y;
foreach (XmlNode trow in trs)
{
XmlNode tcells=GetNamedChildNode(trow, "TableCells");
float h = GetSize(GetNamedChildNode(trow, "Height").InnerText);
float xPos = tr.X;
int col=0;
foreach (XmlNode tcell in tcells)
{
if (tcell.Name != "TableCell")
continue;
// Calculate width based on cell span
float width = 0;
int colSpan = Convert.ToInt32(GetElementValue(tcell, "ColSpan", "1"));
for (int i = 0; i < colSpan && col+i> GetTableSections(XmlNode xNode)
{
Dictionary mainSections=new Dictionary();
Dictionary> resultSections = new Dictionary>();
XmlNode tableNode;
mainSections.Add("Header", null);
mainSections.Add("Details", null);
mainSections.Add("Footer", null);
mainSections.Add("TableGroups", null);
foreach (XmlNode cNode in xNode)
{
if (cNode.NodeType != XmlNodeType.Element)
continue;
if (mainSections.ContainsKey(cNode.Name))
{
mainSections[cNode.Name] = cNode;
}
}
if (mainSections.TryGetValue("Header", out tableNode) && tableNode != null)
{
resultSections.Add("Header",GetTableRowsNodes(GetNamedChildNode(tableNode, "TableRows")));
}
if (mainSections.TryGetValue("TableGroups", out tableNode)&&tableNode!=null)
{
foreach(var tg in GetTableGroupRowsNodes(tableNode, "Header", (s) => "GH_" + s, false))
resultSections.Add(tg.Key,tg.Value);
}
if (mainSections.TryGetValue("Details", out tableNode) && tableNode != null)
{
resultSections.Add("Details", GetTableRowsNodes(GetNamedChildNode(tableNode, "TableRows")));
}
if (mainSections.TryGetValue("TableGroups", out tableNode) && tableNode != null)
{
foreach (var tg in GetTableGroupRowsNodes(tableNode, "Footer", (s) => "GF_" + s, true))
resultSections.Add(tg.Key, tg.Value);
}
if (mainSections.TryGetValue("Footer", out tableNode) && tableNode != null)
{
resultSections.Add("Footer", GetTableRowsNodes(GetNamedChildNode(tableNode, "TableRows")));
}
return resultSections;
}
private List GetTableRows(XmlNode xNode)
{
List trs = new List();
XmlNode tblGroups = null, header = null, footer = null, details = null;
// Find the major groups that have TableRows
foreach (XmlNode cNode in xNode)
{
if (cNode.NodeType != XmlNodeType.Element)
continue;
switch (cNode.Name)
{
case "Header":
header = cNode;
break;
case "Details":
details = cNode;
break;
case "Footer":
footer = cNode;
break;
case "TableGroups":
tblGroups = cNode;
break;
}
}
GetTableRowsAdd(GetNamedChildNode(header, "TableRows"), trs);
GetTableGroupsRows(tblGroups, trs, "Header", false);
GetTableRowsAdd(GetNamedChildNode(details, "TableRows"), trs);
GetTableGroupsRows(tblGroups, trs, "Footer", true);
GetTableRowsAdd(GetNamedChildNode(footer, "TableRows"), trs);
return trs;
}
private void GetTableGroupsRows(XmlNode xNode, List trs, string name, bool reverse)
{
if (xNode == null)
return;
IEnumerable childs;
if (reverse) //Need for correct footer order in nested groups
childs = xNode.ChildNodes.Cast().Reverse();
else
childs = xNode.ChildNodes.Cast();
foreach (XmlNode xNodeLoop in childs)
{
if (xNodeLoop.NodeType == XmlNodeType.Element &&
xNodeLoop.Name == "TableGroup")
{
XmlNode n = GetNamedChildNode(xNodeLoop, name);
if (n == null)
continue;
n = GetNamedChildNode(n, "TableRows");
if (n == null)
continue;
GetTableRowsAdd(n, trs);
}
}
}
private Dictionary> GetTableGroupRowsNodes(XmlNode xNode,string sectionGroup,Func groupNameKey, bool reverse)
{
Dictionary> result = new Dictionary>();
IEnumerable childs;
if (reverse) //Need for correct footer order in nested groups
childs = xNode.ChildNodes.Cast().Reverse();
else
childs = xNode.ChildNodes.Cast();
foreach (XmlNode xNodeLoop in childs)
{
if (xNodeLoop.NodeType == XmlNodeType.Element &&
xNodeLoop.Name == "TableGroup")
{
XmlNode groupNode = GetNamedChildNode(xNodeLoop, "Grouping");
XmlAttribute groupName = groupNode.Attributes["Name"];
XmlNode headerNode = GetNamedChildNode(xNodeLoop, sectionGroup);
if (headerNode != null)
{
result.Add( groupNameKey(groupName.InnerText), GetTableRowsNodes(GetNamedChildNode(headerNode, "TableRows")));
}
}
}
return result;
}
private void GetTableRowsAdd(XmlNode xNode, List trs)
{
if (xNode == null)
return;
foreach (XmlNode xNodeLoop in xNode.ChildNodes)
{
if (xNodeLoop.NodeType == XmlNodeType.Element &&
xNodeLoop.Name == "TableRow")
{
trs.Add(xNodeLoop);
}
}
}
private List GetTableRowsNodes(XmlNode xNode)
{
if (xNode == null)
return null;
List result = new List();
foreach (XmlNode xNodeLoop in xNode.ChildNodes)
{
if (xNodeLoop.NodeType == XmlNodeType.Element &&
xNodeLoop.Name == "TableRow")
{
result.Add( xNodeLoop);
}
}
return result;
}
private float GetTableRowsHeight(List trs)
{
float h=0;
foreach (XmlNode tr in trs)
{
XmlNode cNode = GetNamedChildNode(tr, "Height");
if (cNode != null)
h += GetSize(cNode.InnerText);
}
return h;
}
private float[] GetTableColumnWidths(XmlNode xNode)
{
if (xNode == null)
return new float[0];
List cl = new List();
foreach (XmlNode xNodeLoop in xNode.ChildNodes)
{
if (xNodeLoop.NodeType == XmlNodeType.Element &&
xNodeLoop.Name == "TableColumn")
{
XmlNode cNode = GetNamedChildNode(xNodeLoop, "Width");
if (cNode != null)
cl.Add(GetSize(cNode.InnerText));
}
}
float[] r = cl.ToArray();
return r;
}
private async Task DrawTextbox(XmlNode xNode, RectangleF r)
{
StyleInfo si = await GetStyleInfo(xNode);
if (si.Color == Color.Empty)
si.Color = Color.Black;
XmlNode v = GetNamedChildNode(xNode, "Value");
string t = v == null? "": v.InnerText;
RectangleF ir = GetReportItemRect(xNode, r);
DrawString(t, si, ir, !t.StartsWith("="));
return ir;
}
private void DrawMargins(RectangleF behindPage)
{
StyleInfo si = new StyleInfo();
si.BackgroundColor = AREABACKCOLOR;
DrawBackground(behindPage, si);
}
//private void DrawMargins(float lowerEdge) //Josh: Added Lower Edge so that the area would be filled behind the page.
//{
// // left margin
// // left margin //Removed Left Margin, as right margin will fill full beind page
// //RectangleF m = new RectangleF(0, 0, LEFTGAP, /*TotalPageHeight + LEFTGAP*/ lowerEdge); //Josh: Add a margin on bottom too.
// StyleInfo si = new StyleInfo();
// si.BackgroundColor = Color.LightGray;
// si.BackgroundColor = AREABACKCOLOR; //Josh: Changed to use variable to ease page customizing.
// //Full Margin // right margin
// RectangleF m = new RectangleF(/*pWidth - rMargin*/0, 0, PointsX(Width), /*TotalPageHeight + LEFTGAP*/ lowerEdge); //Josh: Add a margin on bottom too.
// DrawBackground(m, si);
//}
private float TotalPageHeight
{
get {return pHeight;} // eventually we'll need to add in the sizes of the separating bars
}
// "ReportParameter", "Name", pname
internal XmlNode GetNamedChildNode(XmlNode xNode, string elementName, string attributeName)
{
// look for the parameter
// e.g. ...
if (xNode == null)
return null;
foreach (XmlNode cNode in xNode.ChildNodes)
{
if (cNode.NodeType == XmlNodeType.Element &&
cNode.Name == elementName)
{
System.Xml.XmlAttribute na = cNode.Attributes[attributeName];
if (na != null && na.Value == attributeName)
return cNode; // found it
}
}
return null;
}
internal XmlNode GetNamedChildNode(XmlNode xNode, string name)
{
if (xNode == null)
return null;
foreach (XmlNode cNode in xNode.ChildNodes)
{
if (cNode.NodeType == XmlNodeType.Element &&
cNode.Name == name)
return cNode;
}
return null;
}
///
/// Returns the named child node; if not there it is created
///
///
///
///
internal XmlNode GetCreateNamedChildNode(XmlNode xNode, string name)
{
if (xNode == null) // Must have parent to create
return null;
XmlNode node = GetNamedChildNode(xNode, name);
if (node == null)
node = CreateElement(xNode, name, null);
return node;
}
///
/// Returns the named child node; if not there it is created and the default is applied
///
///
///
///
///
internal XmlNode GetCreateNamedChildNode(XmlNode xNode, string name, string def)
{
if (xNode == null) // Must have parent to create
return null;
XmlNode node = GetNamedChildNode(xNode, name);
if (node == null)
{
node = CreateElement(xNode, name, null);
if (def != null)
node.InnerText = def;
}
return node;
}
internal async Task GetStyleInfo(XmlNode xNode)
{
StyleInfo si = new StyleInfo();
XmlNode sNode= this.GetNamedChildNode(xNode, "Style");
if (sNode == null)
return si;
foreach(XmlNode xNodeLoop in sNode.ChildNodes)
{
if (xNodeLoop.NodeType != XmlNodeType.Element)
continue;
switch (xNodeLoop.Name)
{
case "BorderColor":
GetStyleInfoBorderColor(xNodeLoop, si);
break;
case "BorderStyle":
GetStyleInfoBorderStyle(xNodeLoop, si);
break;
case "BorderWidth":
GetStyleInfoBorderWidth(xNodeLoop, si);
break;
case "BackgroundColor":
si.BackgroundColor = GetStyleColor(xNodeLoop.InnerText);
if (si.BackgroundColor.IsEmpty)
si.BackgroundColorText = xNodeLoop.InnerText;
break;
case "BackgroundGradientType":
si.BackgroundGradientType = StyleInfo.GetBackgroundGradientType(xNodeLoop.InnerText, BackgroundGradientTypeEnum.None);
break;
case "BackgroundGradientEndColor":
si.BackgroundGradientEndColor = GetStyleColor(xNodeLoop.InnerText);
break;
case "BackgroundImage":
await GetStyleInfoBackgroundImage(xNodeLoop, si);
break;
case "FontStyle":
si.FontStyle = StyleInfo.GetFontStyle(xNodeLoop.InnerText, FontStyleEnum.Normal);
break;
case "FontFamily":
si.FontFamily = xNodeLoop.InnerText[0] == '='? "Arial": xNodeLoop.InnerText;
break;
case "FontSize":
si.FontSize = xNodeLoop.InnerText[0] == '='? 10: GetSize(xNodeLoop.InnerText);
break;
case "FontWeight":
si.FontWeight = StyleInfo.GetFontWeight(xNodeLoop.InnerText, FontWeightEnum.Normal);
break;
case "Format":
break;
case "TextDecoration":
si.TextDecoration = StyleInfo.GetTextDecoration(xNodeLoop.InnerText, TextDecorationEnum.None);
break;
case "TextAlign":
si.TextAlign = StyleInfo.GetTextAlign(xNodeLoop.InnerText, TextAlignEnum.General);
break;
case "VerticalAlign":
si.VerticalAlign = StyleInfo.GetVerticalAlign(xNodeLoop.InnerText, VerticalAlignEnum.Middle);
break;
case "Color":
si.Color = GetStyleColor(xNodeLoop.InnerText);
if (si.Color.IsEmpty)
si.ColorText = xNodeLoop.InnerText;
break;
case "PaddingLeft":
si.PaddingLeft = GetSize(xNodeLoop.InnerText);
break;
case "PaddingRight":
si.PaddingRight = GetSize(xNodeLoop.InnerText);
break;
case "PaddingTop":
si.PaddingTop = GetSize(xNodeLoop.InnerText);
break;
case "PaddingBottom":
si.PaddingBottom = GetSize(xNodeLoop.InnerText);
break;
case "LineHeight":
si.LineHeight = GetSize(xNodeLoop.InnerText);
break;
case "Direction":
si.Direction = StyleInfo.GetDirection(xNodeLoop.InnerText, DirectionEnum.LTR);
break;
case "WritingMode":
si.WritingMode = StyleInfo.GetWritingMode(xNodeLoop.InnerText, WritingModeEnum.lr_tb);
break;
case "Language":
si.Language = xNodeLoop.InnerText;
break;
case "UnicodeBiDi":
si.UnicodeBiDirectional = StyleInfo.GetUnicodeBiDirectional(xNodeLoop.InnerText, UnicodeBiDirectionalEnum.Normal);
break;
case "Calendar":
si.Calendar = StyleInfo.GetCalendar(xNodeLoop.InnerText, CalendarEnum.Gregorian);
break;
case "NumeralLanguage":
break;
case "NumeralVariant":
break;
}
}
return si;
}
private Color GetStyleColor(string c)
{
if (c == null || c.Length < 1 || c[0] == '=')
return Color.Empty;
Color clr;
try
{
clr = ColorTranslator.FromHtml(c);
}
catch
{
clr = Color.White;
}
return clr;
}
private void GetStyleInfoBorderColor(XmlNode xNode, StyleInfo si)
{
Color dColor=Color.Black;
si.BColorLeft = si.BColorRight = si.BColorTop = si.BColorBottom = Color.Empty;
foreach(XmlNode xNodeLoop in xNode.ChildNodes)
{
if (xNodeLoop.NodeType != XmlNodeType.Element)
continue;
switch (xNodeLoop.Name)
{
case "Default":
dColor = GetStyleColor(xNodeLoop.InnerText);
break;
case "Left":
si.BColorLeft = GetStyleColor(xNodeLoop.InnerText);
break;
case "Right":
si.BColorRight = GetStyleColor(xNodeLoop.InnerText);
break;
case "Top":
si.BColorTop = GetStyleColor(xNodeLoop.InnerText);
break;
case "Bottom":
si.BColorBottom = GetStyleColor(xNodeLoop.InnerText);
break;
}
}
if (si.BColorLeft == Color.Empty)
si.BColorLeft = dColor;
if (si.BColorRight == Color.Empty)
si.BColorRight = dColor;
if (si.BColorTop == Color.Empty)
si.BColorTop = dColor;
if (si.BColorBottom == Color.Empty)
si.BColorBottom = dColor;
}
private void GetStyleInfoBorderStyle(XmlNode xNode, StyleInfo si)
{
BorderStyleEnum def = BorderStyleEnum.None;
string l=null;
string r=null;
string t=null;
string b=null;
foreach(XmlNode xNodeLoop in xNode.ChildNodes)
{
if (xNodeLoop.NodeType != XmlNodeType.Element)
continue;
switch (xNodeLoop.Name)
{
case "Default":
def = GetBorderStyle(xNodeLoop.InnerText, BorderStyleEnum.None);
break;
case "Left":
l = xNodeLoop.InnerText;
break;
case "Right":
r = xNodeLoop.InnerText;
break;
case "Top":
t = xNodeLoop.InnerText;
break;
case "Bottom":
b = xNodeLoop.InnerText;
break;
}
}
si.BStyleLeft = l == null? def: GetBorderStyle(l, def);
si.BStyleRight = r == null? def: GetBorderStyle(r, def);
si.BStyleBottom = b == null? def: GetBorderStyle(b, def);
si.BStyleTop = t == null? def: GetBorderStyle(t, def);
}
// return the BorderStyleEnum given a particular string value
BorderStyleEnum GetBorderStyle(string v, BorderStyleEnum def)
{
BorderStyleEnum bs;
try
{
bs = (BorderStyleEnum)Enum.Parse(typeof(BorderStyleEnum), v);
}
catch
{
bs = def;
}
return bs;
}
private void GetStyleInfoBorderWidth(XmlNode xNode, StyleInfo si)
{
string l=null;
string r=null;
string t=null;
string b=null;
float def= GetSize("1pt");
foreach(XmlNode xNodeLoop in xNode.ChildNodes)
{
if (xNodeLoop.NodeType != XmlNodeType.Element)
continue;
switch (xNodeLoop.Name)
{
case "Default":
def = GetSize(xNodeLoop.InnerText);
break;
case "Left":
l = xNodeLoop.InnerText;
break;
case "Right":
r = xNodeLoop.InnerText;
break;
case "Top":
t = xNodeLoop.InnerText;
break;
case "Bottom":
b = xNodeLoop.InnerText;
break;
}
}
si.BWidthTop = t == null? def: GetSize(t);
si.BWidthBottom = b == null? def: GetSize(b);
si.BWidthLeft = l == null? def: GetSize(l);
si.BWidthRight = r == null? def: GetSize(r);
}
private async Task GetStyleInfoBackgroundImage(XmlNode xNode, StyleInfo si)
{
// TODO: this is problematic since it require a PageImage
Stream strm = null;
System.Drawing.Image im = null;
ImageRepeat repeat = ImageRepeat.Repeat;
string source = null;
string val = null;
try
{
foreach (XmlNode xNodeLoop in xNode.ChildNodes)
{
if (xNodeLoop.NodeType != XmlNodeType.Element)
continue;
switch (xNodeLoop.Name)
{ // TODO
case "Source":
if (!xNodeLoop.InnerText.StartsWith("="))
{
if (xNodeLoop.InnerText == "External" ||
xNodeLoop.InnerText == "Embedded")
source = xNodeLoop.InnerText;
}
break;
case "Value":
if (!xNodeLoop.InnerText.StartsWith("="))
{
val = xNodeLoop.InnerText;
}
break;
case "MIMEType": // MimeType doesn't help us
break;
case "BackgroundRepeat":
switch (xNodeLoop.InnerText.ToLowerInvariant())
{
case "repeat":
repeat = ImageRepeat.Repeat;
break;
case "norepeat":
repeat = ImageRepeat.NoRepeat;
break;
case "repeatx":
repeat = ImageRepeat.RepeatX;
break;
case "repeaty":
repeat = ImageRepeat.RepeatY;
break;
}
break;
}
}
if (source == null || val == null)
return; // don't have image to show in background (at least at design time)
if (source == "External")
{
if (val.StartsWith("http:") ||
val.StartsWith("file:") ||
val.StartsWith("https:"))
{
using HttpClient httpClient = new HttpClient();
httpClient.AddMajorsilenceReportingUserAgent();
HttpResponseMessage response = await httpClient.GetAsync(val);
response.EnsureSuccessStatusCode();
strm = await response.Content.ReadAsStreamAsync();
}
else
strm = new FileStream(val, FileMode.Open, FileAccess.Read, FileShare.Read);
im = System.Drawing.Image.FromStream(strm);
}
else // Embedded case
{
im = GetImageEmbedded(val);
}
int height = im.Height; // save height and width
int width = im.Width;
MemoryStream ostrm = new MemoryStream();
System.Drawing.Imaging.ImageCodecInfo[] info;
info = ImageCodecInfo.GetImageEncoders();
EncoderParameters encoderParameters;
encoderParameters = new EncoderParameters(1);
encoderParameters.Param[0] = new EncoderParameter(Encoder.Quality, 100L);
System.Drawing.Imaging.ImageCodecInfo codec = null;
for (int i = 0; i < info.Length; i++)
{
if (info[i].FormatDescription == "JPEG")
{
codec = info[i];
break;
}
}
im.Save(ostrm, codec, encoderParameters);
byte[] ba = ostrm.ToArray();
ostrm.Close();
si.BackgroundImage = new PageImage(ImageFormat.Jpeg, ba, width, height); // Create an image
si.BackgroundImage.Repeat = repeat;
}
catch
{
// we just won't end up drawing the background image;
}
finally
{
if (strm != null)
strm.Close();
if (im != null)
im.Dispose();
}
}
internal float GetSize(XmlNode pNode, string name)
{
XmlNode xNode = this.GetNamedChildNode(pNode, name);
if (xNode == null)
return 0;
return GetSize(xNode.InnerText);
}
static internal float GetSize(string t)
{
if (t == null || t.Length == 0 || t[0] == '=')
return 0;
// Size is specified in CSS Length Units
// format is
// in -> inches (1 inch = 2.54 cm)
// cm -> centimeters (.01 meters)
// mm -> millimeters (.001 meters)
// pt -> points (1 point = 1/72 inches)
// pc -> Picas (1 pica = 12 points)
t = t.Trim();
int space = t.LastIndexOf(' ');
string n=""; // number string
string u="in"; // unit string
decimal d; // initial number
try // Convert.ToDecimal can be very picky
{
if (space != -1) // any spaces
{
n = t.Substring(0,space).Trim(); // number string
u = t.Substring(space).Trim(); // unit string
}
else if (t.Length >= 3)
{
n = t.Substring(0, t.Length-2);
u = t.Substring(t.Length-2);
}
else
{
// Illegal unit
return 0;
}
d = Convert.ToDecimal(n, NumberFormatInfo.InvariantInfo);
}
catch
{
return 0;
}
int size;
switch(u) // convert to millimeters
{
case "in":
size = (int) (d * 2540m);
break;
case "cm":
size = (int) (d * 1000m);
break;
case "mm":
size = (int) (d * 100m);
break;
case "pt":
return Convert.ToSingle(d);
case "pc":
size = (int) (d * (2540m / POINTSIZEM * 12m));
break;
default:
// Illegal unit
size = (int) (d * 2540m);
break;
}
// and return as points
return (float) ((double) size / 2540.0 * POINTSIZED);
}
private void DrawBackground(System.Drawing.RectangleF rect, StyleInfo si)
{
if (!rect.IntersectsWith(_clip))
return;
RectangleF dr = new RectangleF(rect.X - _hScroll, rect.Y - _vScroll, rect.Width, rect.Height);
LinearGradientBrush linGrBrush = null;
SolidBrush sb=null;
try
{
if (si.BackgroundGradientType != BackgroundGradientTypeEnum.None &&
!si.BackgroundGradientEndColor.IsEmpty &&
!si.BackgroundColor.IsEmpty)
{
Color c = si.BackgroundColor;
Color ec = si.BackgroundGradientEndColor;
switch (si.BackgroundGradientType)
{
case BackgroundGradientTypeEnum.LeftRight:
linGrBrush = new LinearGradientBrush(rect, c, ec, LinearGradientMode.Horizontal);
break;
case BackgroundGradientTypeEnum.TopBottom:
linGrBrush = new LinearGradientBrush(rect, c, ec, LinearGradientMode.Vertical);
break;
case BackgroundGradientTypeEnum.Center:
linGrBrush = new LinearGradientBrush(rect, c, ec, LinearGradientMode.Horizontal);
break;
case BackgroundGradientTypeEnum.DiagonalLeft:
linGrBrush = new LinearGradientBrush(rect, c, ec, LinearGradientMode.ForwardDiagonal);
break;
case BackgroundGradientTypeEnum.DiagonalRight:
linGrBrush = new LinearGradientBrush(rect, c, ec, LinearGradientMode.BackwardDiagonal);
break;
case BackgroundGradientTypeEnum.HorizontalCenter:
linGrBrush = new LinearGradientBrush(rect, c, ec, LinearGradientMode.Horizontal);
break;
case BackgroundGradientTypeEnum.VerticalCenter:
linGrBrush = new LinearGradientBrush(rect, c, ec, LinearGradientMode.Vertical);
break;
default:
break;
}
}
if (linGrBrush != null)
{
g.FillRectangle(linGrBrush, dr);
}
else if (!si.BackgroundColor.IsEmpty)
{
sb = new SolidBrush(si.BackgroundColor);
g.FillRectangle(sb, dr);
}
}
finally
{
if (linGrBrush != null)
linGrBrush.Dispose();
if (sb != null)
sb.Dispose();
}
if (si.BackgroundImage == null)
return;
// Handle any background image
DrawImageBackground(si.BackgroundImage, si,rect);
return;
}
private void DrawImageBackground(PageImage pi, StyleInfo si, RectangleF r)
{
Stream strm = null;
System.Drawing.Image im = null;
try
{
RectangleF r2 = new RectangleF(r.Left + si.PaddingLeft,
r.Top + si.PaddingTop,
r.Width - (si.PaddingLeft + si.PaddingRight),
r.Height - (si.PaddingTop + si.PaddingBottom));
strm = new MemoryStream(pi.GetImageData((int)r2.Width, (int)r2.Height));
im = System.Drawing.Image.FromStream(strm);
int repeatX = 0;
int repeatY = 0;
float imW = PointsX(pi.SamplesW);
float imH = PointsY(pi.SamplesH);
switch (pi.Repeat)
{
case ImageRepeat.Repeat:
repeatX = (int)Math.Floor(r2.Width / imW);
repeatY = (int)Math.Floor(r2.Height / imH);
break;
case ImageRepeat.RepeatX:
repeatX = (int)Math.Floor(r2.Width / imW);
repeatY = 1;
break;
case ImageRepeat.RepeatY:
repeatY = (int)Math.Floor(r2.Height / imH);
repeatX = 1;
break;
case ImageRepeat.NoRepeat:
default:
repeatX = repeatY = 1;
break;
}
//make sure the image is drawn at least 1 times
repeatX = Math.Max(repeatX, 1);
repeatY = Math.Max(repeatY, 1);
RectangleF dr = new RectangleF(r2.X - _hScroll, r2.Y - _vScroll, r2.Width, r2.Height);
float startX = dr.Left;
float startY = dr.Top;
Region saveRegion = g.Clip;
Region clipRegion = new Region(g.Clip.GetRegionData());
clipRegion.Intersect(dr);
g.Clip = clipRegion;
for (int i = 0; i < repeatX; i++)
{
for (int j = 0; j < repeatY; j++)
{
float currX = startX + i * imW;
float currY = startY + j * imH;
g.DrawImage(im, new RectangleF(currX, currY, imW, imH));
}
}
g.Clip = saveRegion;
}
finally
{
if (strm != null)
strm.Close();
if (im != null)
im.Dispose();
}
}
private void DrawBorder(StyleInfo si, RectangleF r)
{
if (!r.IntersectsWith(_clip))
return;
if (r.Height <= 0 || r.Width <= 0) // no bounding box to use
return;
DrawLine(si.BColorTop, si.BStyleTop, si.BWidthTop, r.X, r.Y, r.Right, r.Y);
DrawLine(si.BColorRight, si.BStyleRight, si.BWidthRight, r.Right, r.Y, r.Right, r.Bottom);
DrawLine(si.BColorLeft, si.BStyleLeft, si.BWidthLeft, r.X, r.Y, r.X, r.Bottom);
DrawLine(si.BColorBottom, si.BStyleBottom, si.BWidthBottom, r.X, r.Bottom, r.Right, r.Bottom);
return;
}
private void DrawCircle(Color c, BorderStyleEnum bs, float penWidth, float x, float y, float d, bool bFill)
{
if (bs == BorderStyleEnum.None || c.IsEmpty || d <= 0) // nothing to draw
return;
// adjust coordinates for scrolling
x -= _hScroll;
y -= _vScroll;
Pen p=null;
try
{
p = new Pen(c, penWidth);
switch (bs)
{
case BorderStyleEnum.Dashed:
p.DashStyle = DashStyle.Dash;
break;
case BorderStyleEnum.Dotted:
p.DashStyle = DashStyle.Dot;
break;
case BorderStyleEnum.Double:
case BorderStyleEnum.Groove:
case BorderStyleEnum.Inset:
case BorderStyleEnum.Solid:
case BorderStyleEnum.Outset:
case BorderStyleEnum.Ridge:
case BorderStyleEnum.WindowInset:
default:
p.DashStyle = DashStyle.Solid;
break;
}
if (bFill)
g.FillEllipse(Brushes.Black, x, y, d, d);
else
g.DrawEllipse(p, x, y, d, d);
}
finally
{
if (p != null)
p.Dispose();
}
}
private void DrawLine(Color c, BorderStyleEnum bs, float w,
float x, float y, float x2, float y2)
{
Color lc = c;
if (this.ShowReportItemOutline)
{ // force an outline
lc = (bs == BorderStyleEnum.None || c.IsEmpty)? Color.LightGray : c;
if (w <= 0)
w = 1;
}
else if (bs == BorderStyleEnum.None || c.IsEmpty || w <= 0) // nothing to draw
{
return;
}
// adjust coordinates for scrolling
x -= _hScroll;
y -= _vScroll;
x2 -= _hScroll;
y2 -= _vScroll;
Pen p=null;
try
{
p = new Pen(lc, w);
switch (bs)
{
case BorderStyleEnum.Dashed:
p.DashStyle = DashStyle.Dash;
break;
case BorderStyleEnum.Dotted:
p.DashStyle = DashStyle.Dot;
break;
case BorderStyleEnum.Double:
case BorderStyleEnum.Groove:
case BorderStyleEnum.Inset:
case BorderStyleEnum.Solid:
case BorderStyleEnum.Outset:
case BorderStyleEnum.Ridge:
case BorderStyleEnum.WindowInset:
default:
p.DashStyle = DashStyle.Solid;
break;
}
g.DrawLine(p, x, y, x2, y2);
}
finally
{
if (p != null)
p.Dispose();
}
}
private void DrawString(string text, StyleInfo si, RectangleF r, bool bWrap = true)
{
if (!r.IntersectsWith(_clip))
return;
Font drawFont = null;
StringFormat drawFormat = null;
Brush drawBrush = null;
var graphicsState = g.Save();
try
{
// STYLE
FontStyle fs = 0;
if (si.FontStyle == FontStyleEnum.Italic)
fs |= FontStyle.Italic;
switch (si.TextDecoration)
{
case TextDecorationEnum.Underline:
fs |= FontStyle.Underline;
break;
case TextDecorationEnum.LineThrough:
fs |= FontStyle.Strikeout;
break;
case TextDecorationEnum.Overline:
case TextDecorationEnum.None:
break;
}
// WEIGHT
switch (si.FontWeight)
{
case FontWeightEnum.Bold:
case FontWeightEnum.Bolder:
case FontWeightEnum.W500:
case FontWeightEnum.W600:
case FontWeightEnum.W700:
case FontWeightEnum.W800:
case FontWeightEnum.W900:
fs |= FontStyle.Bold;
break;
}
if (si.FontSize <= 0) // can't have zero length font; force to default
si.FontSize = 10;
try
{
drawFont = new Font(si.FontFamily, si.FontSize, fs); // si.FontSize already in points
}
catch (ArgumentException ae) // fonts that don't exist can throw exception; but we don't want it to
{
text = ae.Message; // show the error msg (allows report designer to see error)
drawFont = new Font("Arial", si.FontSize, fs); // if this throws exception; we'll let it
}
// ALIGNMENT
drawFormat = new StringFormat();
if (!bWrap)
drawFormat.FormatFlags |= StringFormatFlags.NoWrap;
switch (si.TextAlign)
{
case TextAlignEnum.Left:
drawFormat.Alignment = StringAlignment.Near;
break;
case TextAlignEnum.Center:
drawFormat.Alignment = StringAlignment.Center;
break;
case TextAlignEnum.Right:
drawFormat.Alignment = StringAlignment.Far;
break;
}
switch (si.VerticalAlign)
{
case VerticalAlignEnum.Top:
drawFormat.LineAlignment = StringAlignment.Near;
break;
case VerticalAlignEnum.Middle:
drawFormat.LineAlignment = StringAlignment.Center;
break;
case VerticalAlignEnum.Bottom:
drawFormat.LineAlignment = StringAlignment.Far;
break;
}
DrawBackground(r, si);
if (si.WritingMode == WritingModeEnum.tb_rl)
{
drawFormat.FormatFlags |= StringFormatFlags.DirectionRightToLeft;
drawFormat.FormatFlags |= StringFormatFlags.DirectionVertical;
}
RectangleF drawRectangle;
switch(si.WritingMode)
{
case WritingModeEnum.lr_tb:
case WritingModeEnum.tb_rl:
drawRectangle = new RectangleF(
r.Left + si.PaddingLeft - _hScroll,
r.Top + si.PaddingTop - _vScroll,
r.Width - si.PaddingLeft - si.PaddingRight,
r.Height - si.PaddingTop - si.PaddingBottom
);
break;
case WritingModeEnum.tb_lr:
drawRectangle = new RectangleF(
-r.Top - r.Height + si.PaddingBottom,
r.Left + si.PaddingLeft,
r.Height - si.PaddingTop - si.PaddingBottom,
r.Width - si.PaddingLeft - si.PaddingRight
);
break;
default:
throw new NotSupportedException($"Writing mode {si.WritingMode} is not supported");
}
if(si.WritingMode == WritingModeEnum.tb_lr)
{
g.RotateTransform(270);
}
drawBrush = new SolidBrush(si.Color);
g.DrawString(text, drawFont, drawBrush, drawRectangle, drawFormat);
g.Restore(graphicsState);
}
finally
{
drawFont?.Dispose();
drawFormat?.Dispose();
drawBrush?.Dispose();
}
DrawBorder(si, r); // Draw the border if needed
}
internal void PasteImage(XmlNode parent, System.Drawing.Bitmap img, PointF p)
{
// Josh: Adds a default ZIndex of 1 to paste above "background".
string t = string.Format(NumberFormatInfo.InvariantInfo,
"