コード例 #1
0
        public ControlViewFactory(DesignService designService)
        {
            this.designService = designService;
            controlViewDictionary = new Dictionary<System.Type, Func<MonoReports.Model.Controls.Control,SectionView,ControlViewBase> >();

            controlViewDictionary
                .Add(
                     typeof(TextBlock),
                     	(ctrl, section) => {
                                return new TextBlockView(ctrl as TextBlock,section);
                        }
                );

            controlViewDictionary
                .Add(
                     typeof(Line),
                     	(ctrl, section) => {
                                return new LineView(ctrl as Line,section);
                        }
                );

            controlViewDictionary
                .Add(
                     typeof(Image),
                     	(ctrl, section) => {
                                var image = ctrl as Image;
                                if(!string.IsNullOrEmpty(image.ImageKey))
                                    designService.PixbufRepository.AddOrUpdatePixbufByName(image.ImageKey);
                                return new ImageView(image,section,designService.PixbufRepository);
                        }
                );

            controlViewDictionary
                .Add(
                     typeof(SubReport),
                     	(ctrl, section) => {
                                var subreport = ctrl as SubReport;
                                return new SubreportView(subreport,section);
                        }
                );
        }
コード例 #2
0
 public LineTool(DesignService designService)
     : base(designService)
 {
 }
コード例 #3
0
ファイル: TextBlockTool.cs プロジェクト: modesto/monoreports
 public TextBlockTool(DesignService designService)
     : base(designService)
 {
 }
コード例 #4
0
ファイル: ZoomTool.cs プロジェクト: modesto/monoreports
 public ZoomTool(DesignService designService)
     : base(designService)
 {
 }
コード例 #5
0
ファイル: LineTool.cs プロジェクト: elsupergomez/monoreports
 public LineTool(DesignService designService)
     : base(designService)
 {
     designService.OnZoomChanged += HandleDesignServiceOnZoomChanged;
     lineDistance = 2 / (designService.Zoom > 1.5 ? (designService.Zoom / 2) : 1);
 }
コード例 #6
0
ファイル: BaseTool.cs プロジェクト: modesto/monoreports
 public BaseTool(DesignService designService)
 {
     this.designService = designService;
 }
コード例 #7
0
ファイル: ImageTool.cs プロジェクト: modesto/monoreports
 public ImageTool(DesignService designService)
     : base(designService)
 {
 }
コード例 #8
0
 public SectionTool(DesignService designService)
     : base(designService)
 {
 }
コード例 #9
0
 public SubreportTool(DesignService designService)
     : base(designService)
 {
 }
コード例 #10
0
        public MonoreportsDesignerControl()
        {
            Build ();
              		MonoReports.Model.Engine.ReportEngine.EvaluatorInit();

            Report startReport = newReportTemplate();

            double resolutionX = ((double)  Gdk.Screen.Default.Width) / ((double) Gdk.Screen.Default.WidthMm) * 25.4;

            compilerService = new CompilerService(ReportExtensions.ScriptTemplateForDataSourceEvaluation);

            pixbufRepository = new PixbufRepository () { Report = startReport };
            workspaceService = new WorkspaceService (this,maindesignview1.DesignDrawingArea,maindesignview1.PreviewDrawingArea,mainPropertygrid, StatusBarLabel);
            var reportRenderer = new ReportRenderer(){ ResolutionX =  resolutionX};
            reportRenderer.RegisterRenderer(typeof(Controls.TextBlock), new TextBlockRenderer());
            reportRenderer.RegisterRenderer(typeof(Controls.Line), new LineRenderer());
            reportRenderer.RegisterRenderer(typeof(MonoReports.Model.Controls.Image),
                new ImageRenderer(){ PixbufRepository = pixbufRepository});
            SectionRenderer sr = new SectionRenderer();
            reportRenderer.RegisterRenderer(typeof(Controls.ReportHeaderSection), sr);
            reportRenderer.RegisterRenderer(typeof(Controls.ReportFooterSection), sr);
            reportRenderer.RegisterRenderer(typeof(Controls.DetailSection), sr);
            reportRenderer.RegisterRenderer(typeof(Controls.PageHeaderSection), sr);
            reportRenderer.RegisterRenderer(typeof(Controls.PageFooterSection), sr);
            designService = new DesignService (workspaceService,reportRenderer,pixbufRepository,compilerService, startReport);

            toolBoxService = new ToolBoxService ();
            designService.ToolBoxService = toolBoxService;
            maindesignview1.DesignService = designService;
            maindesignview1.WorkSpaceService = workspaceService;
            maindesignview1.ReportRenderer = reportRenderer;
            workspaceService.InvalidateDesignArea ();
            reportExplorer.DesignService = designService;
            reportExplorer.Workspace = workspaceService;
            toolBoxService.AddTool (new ZoomTool (designService));
            toolBoxService.AddTool (new LineTool (designService));
            toolBoxService.AddTool (new LineToolV (designService));
            toolBoxService.AddTool (new LineToolH (designService));
            toolBoxService.AddTool (new TextBlockTool (designService));
            //TODO 3tk: currently not supported
            //toolBoxService.AddTool (new SubreportTool (designService));
            toolBoxService.AddTool (new SectionTool (designService));
            toolBoxService.AddTool (new ImageTool (designService));
            toolBoxService.AddTool (new RectTool (designService));
            toolBoxService.BuildToolBar (mainToolbar);

            ToolBarButton exportPdfToolButton = new ToolBarButton ("pdf.png","exportPdf",Catalog.GetString("Export to pdf"));
            exportPdfToolButton.Clicked += delegate(object sender, EventArgs e) {
            designService.ExportToPdf();
            };

            var sep = new Gtk.SeparatorToolItem();

            mainToolbar.Insert (sep,mainToolbar.NItems);
            mainToolbar.Insert (exportPdfToolButton,mainToolbar.NItems);

            //ToolBarButton btn = new ToolBarButton("gtk-media-play","execute","Execute report");
            //mainToolbar.Insert (btn,mainToolbar.NItems);

            mainPropertygrid.LoadMonoreportsExtensions();
             		designService.Report = startReport;
        }
コード例 #11
0
        public MonoreportsDesignerControl()
        {
            Build ();
            dpi =   Gdk.Screen.Default.Resolution;

            Report startReport = new Report(){
            DataScript = @"
            datasource = new [] {
             new { Name=""Alfred"", Surname = ""Tarski"", Age = ""82"" },
             new { Name=""Saul"", Surname = ""Kripke"", Age = ""70"" },
             new { Name=""Gotlob"", Surname = ""Frege"", Age = ""85"" },
             new { Name=""Kurt"", Surname = ""Gödel"", Age = ""72"" },
            };

            parameters.Add(""Title"",new { Title = ""The Logicans"", SubTitle = ""...and philosophers...""});

            "};

            string template = @"
            using System;
            using System.Collections.Generic;
            {0}

            public sealed class GenerateDataSource {{
            public object Generate()
            {{
            object datasource = null;
            Dictionary<string,object> parameters = new Dictionary<string,object>();
             {1}
            return new object[] {{datasource,parameters}};
            }}
            }}

            ";

            compilerService = new CompilerService(template);
            workspaceService = new WorkspaceService (this,maindesignview1.DesignDrawingArea,maindesignview1.PreviewDrawingArea,mainPropertygrid, StatusBarLabel);

            designService = new DesignService (workspaceService,compilerService,startReport);
            toolBoxService = new ToolBoxService ();
            designService.ToolBoxService = toolBoxService;
            maindesignview1.DesignService = designService;
            maindesignview1.WorkSpaceService = workspaceService;
            maindesignview1.Compiler = compilerService;

            var reportRenderer = new ReportRenderer();
            reportRenderer.RegisterRenderer(typeof(Controls.TextBlock), new TextBlockRenderer(){ DPI = dpi});
            reportRenderer.RegisterRenderer(typeof(Controls.Line), new LineRenderer(){ DPI = dpi});
            reportRenderer.RegisterRenderer(typeof(MonoReports.Model.Controls.Image), new ImageRenderer(){ PixbufRepository = designService.PixbufRepository, DPI = dpi});
            SectionRenderer sr = new SectionRenderer() { DPI = dpi};
            reportRenderer.RegisterRenderer(typeof(Controls.ReportHeaderSection), sr);
            reportRenderer.RegisterRenderer(typeof(Controls.ReportFooterSection), sr);
            reportRenderer.RegisterRenderer(typeof(Controls.DetailSection), sr);
            reportRenderer.RegisterRenderer(typeof(Controls.PageHeaderSection), sr);
            reportRenderer.RegisterRenderer(typeof(Controls.PageFooterSection), sr);

            maindesignview1.ReportRenderer = reportRenderer;
            workspaceService.InvalidateDesignArea ();
            reportExplorer.DesignService = designService;
            reportExplorer.Workspace = workspaceService;
            toolBoxService.AddTool (new ZoomTool (designService));
            toolBoxService.AddTool (new LineTool (designService));
            toolBoxService.AddTool (new LineToolV (designService));
            toolBoxService.AddTool (new LineToolH (designService));

            toolBoxService.AddTool (new TextBlockTool (designService));
            toolBoxService.AddTool (new SubreportTool (designService));
            toolBoxService.AddTool (new SectionTool (designService));
            toolBoxService.AddTool (new ImageTool (designService));
            toolBoxService.AddTool (new RectTool (designService));
            toolBoxService.BuildToolBar (mainToolbar);

            ToolBarButton exportPdfToolButton = new ToolBarButton ("pdf.png","exportPdf","export to pdf");
            exportPdfToolButton.Clicked += delegate(object sender, EventArgs e) {
            designService.ExportToPdf();
            };

            mainToolbar.Insert (exportPdfToolButton,7);

            mainPropertygrid.LoadMonoreportsExtensions();
        }
コード例 #12
0
ファイル: RectTool.cs プロジェクト: elsupergomez/monoreports
 public RectTool(DesignService designService)
     : base(designService)
 {
     selectBorder = new Border (1);
 }