コード例 #1
0
ファイル: ImageView.cs プロジェクト: elsupergomez/monoreports
 public ImageView(MonoReports.Model.Controls.Image image,ImageRenderer renderer, SectionView parentSection)
     : base(image)
 {
     this.ParentSection = parentSection;
     AbsoluteBound = new Rectangle (parentSection.AbsoluteDrawingStartPoint.X + image.Location.X, parentSection.AbsoluteDrawingStartPoint.Y + image.Location.Y, image.Width, image.Height);
     ImageRenderer = renderer;
 }
コード例 #2
0
ファイル: ImageView.cs プロジェクト: modesto/monoreports
 public ImageView(MonoReports.Model.Controls.Image image, SectionView parentSection, PixbufRepository pixbufRepository)
     : base(image)
 {
     this.ParentSection = parentSection;
     AbsoluteBound = new Rectangle (parentSection.AbsoluteDrawingStartPoint.X + image.Location.X, parentSection.AbsoluteDrawingStartPoint.Y + image.Location.Y, image.Width, image.Height);
     ImageRenderer = new ImageRenderer(){ PixbufRepository = pixbufRepository, DesignMode = true};
 }
コード例 #3
0
 public SubreportView(MonoReports.Model.Controls.SubReport subreport,SubreportRenderer renderer, SectionView parentSection)
     : base(subreport)
 {
     this.subreport = subreport;
     this.ParentSection = parentSection;
     AbsoluteBound = new Rectangle (parentSection.AbsoluteDrawingStartPoint.X + subreport.Location.X, parentSection.AbsoluteDrawingStartPoint.Y + subreport.Location.Y, subreport.Width, subreport.Height);
     SubreportRenderer = renderer;
 }
コード例 #4
0
 public void Render(Cairo.Context c, MonoReports.Model.Controls.Control control)
 {
     Section section = control as Section;
     Rectangle borderRect;
     c.Save ();
     borderRect = new Rectangle (section.Location.X * unitMulitipier , section.Location.Y * unitMulitipier , section.Width * unitMulitipier, section.Height * unitMulitipier);
     c.FillRectangle (borderRect, section.BackgroundColor.ToCairoColor());
     c.Restore ();
 }
コード例 #5
0
 public void Render(Cairo.Context c, MonoReports.Model.Controls.Control control)
 {
     SubReport subreport = control as SubReport;
     Rectangle borderRect;
     c.Save ();
     borderRect = new Rectangle (subreport.Location.X, subreport.Location.Y, subreport.Width, subreport.Height);
     c.ClipRectangle (borderRect);
     borderRect = new Rectangle (subreport.Location.X, subreport.Location.Y, subreport.Width, subreport.Height);
     c.FillRectangle (borderRect, subreport.BackgroundColor.ToCairoColor ());
     c.Restore ();
 }
コード例 #6
0
ファイル: ImageRenderer.cs プロジェクト: modesto/monoreports
 public void Render(Cairo.Context c, MonoReports.Model.Controls.Control control)
 {
     Image image = control as Image;
     Rectangle borderRect;
     c.Save ();
     borderRect = new Rectangle (image.Location.X, image.Location.Y, image.Width, image.Height);
     c.ClipRectangle (borderRect);
     borderRect = new Rectangle (image.Location.X, image.Location.Y, image.Width, image.Height);
     c.FillRectangle (borderRect, image.BackgroundColor.ToCairoColor ());
     if ( PixbufRepository.ContainsKey(image.ImageKey)) {
     var pixbuf = PixbufRepository[image.ImageKey];
         c.DrawPixbuf (pixbuf, image.Location.ToCairoPointD (), image.Offset.ToCairoPointD ());
     }
     c.DrawInsideBorder (borderRect, image.Border, true);
     c.Restore ();
 }
コード例 #7
0
 private static Pango.Weight ReportToPangoWeight(MonoReports.Model.FontWeight weight)
 {
     return (weight == MonoReports.Model.FontWeight.Bold) ? Pango.Weight.Bold : Pango.Weight.Normal;
 }
コード例 #8
0
 private static Pango.Style ReportToPangoSlant(MonoReports.Model.FontSlant slant)
 {
     switch (slant) {
     case MonoReports.Model.FontSlant.Italic:
         return Pango.Style.Italic;
     case MonoReports.Model.FontSlant.Oblique:
         return Pango.Style.Oblique;
     default:
         return Pango.Style.Normal;
     }
 }
コード例 #9
0
 public Size Measure(Cairo.Context c, MonoReports.Model.Controls.Control control)
 {
     Image image = control as Image;
     Rectangle borderRect = new Rectangle (image.Location.X, image.Location.Y, image.Width, image.Height);
     return new MonoReports.Model.Size(borderRect.Width,borderRect.Height);
 }
コード例 #10
0
 public ControlViewBase(MonoReports.Model.Controls.Control controlModel)
 {
     ControlModel = controlModel;
 }
コード例 #11
0
 public Size Measure(Cairo.Context c, MonoReports.Model.Controls.Control control)
 {
     Section section = control as Section;
     Rectangle borderRect = new Rectangle (section.Location.X, section.Location.Y, section.Width, section.Height);
     return new MonoReports.Model.Size(borderRect.Width,borderRect.Height);
 }
コード例 #12
0
 public ControlViewBase CreateControlView(MonoReports.Model.Controls.Control control, SectionView sectionView)
 {
     return controlViewDictionary[control.GetType()](control,sectionView);
 }
コード例 #13
0
        public static bool EvalDataSourceScript(this Report report, MonoReports.Services.CompilerService compiler)
        {
            if(!assemblyResolverHandlerSet) {

                AppDomain
                    .CurrentDomain
                        .AssemblyResolve+=  delegate(object sender, ResolveEventArgs args) {
                            Assembly myAssembly = null;
                            string asmName = args.Name.Substring(0,	args.Name.IndexOf(',')) +".dll";

                            string assemblyPath = report.References.FirstOrDefault(asm => asm.EndsWith(asmName));
                            if( !string.IsNullOrEmpty(assemblyPath) && System.IO.File.Exists(assemblyPath))
                                return  Assembly.LoadFrom(assemblyPath);
                            assemblyPath = System.IO.Path.Combine(report.AlternativeReferencedAssembliesPath,asmName);
                            if(System.IO.File.Exists(assemblyPath))
                                return  Assembly.LoadFrom(assemblyPath);

                            assemblyPath = System.IO.Path.Combine(Assembly.GetExecutingAssembly().Location,asmName);
                            if(System.IO.File.Exists(assemblyPath))
                                return  Assembly.LoadFrom(assemblyPath);

                            return  myAssembly;
                        };
                assemblyResolverHandlerSet = true;
            }

            string code = report.DataScript;

            object result = null;
            string message = null;
            bool res = false;
            StringBuilder stb = new StringBuilder();
            stb.AppendLine("using Newtonsoft.Json.Linq;");
            stb.AppendLine("using System.Linq;");
            stb.AppendLine("using MonoReports.Model.Data;");

            foreach (string s in report.Usings) {
                stb.Append("using ");
                stb.Append(s);
                stb.AppendLine(";");
            }
            string usings = stb.ToString();

            compiler.References.Clear();
            compiler.References.Add("Newtonsoft.Json.dll");
            compiler.References.Add("MonoReports.Model.dll");

            foreach (string r in report.References) {
                string toAdd = r;
                if (!System.IO.File.Exists (r))
                    if(!string.IsNullOrEmpty (report.AlternativeReferencedAssembliesPath))
                        toAdd = System.IO.Path.Combine (report.AlternativeReferencedAssembliesPath,System.IO.Path.GetFileName (r));

                if (!compiler.References.Contains (toAdd))
                    compiler.References.Add (toAdd);
            }

            if( compiler.Evaluate (out result, out message , new string[]{usings,code}, new object[]{ report })  ) {

                report.FillFieldsFromDataSource();

                updateReportWithParamaters(report);

            }else {
                Console.Error.WriteLine(message);
            }
            return res;
        }