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));
        }
        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));
        }
示例#3
0
 public override ControlViewBase AddControl(SectionView sectionView, Control control)
 {
     MonoReports.Model.Controls.Image img = control as MonoReports.Model.Controls.Image;
     ImageView imageView = sectionView.AddControl(img) as ImageView;
     sectionView.Section.Controls.Add(img);
     imageView.ParentSection = sectionView;
     designService.SelectedControl = imageView;
     return imageView;
 }
示例#4
0
 public override ControlViewBase AddControl(SectionView sectionView, Control control)
 {
     var tb = control as TextBlock;
     TextBlockView textBlockView = sectionView.AddControl(tb) as TextBlockView;
     sectionView.Section.Controls.Add(tb);
     textBlockView.ParentSection = sectionView;
     designService.SelectedControl = textBlockView;
     return textBlockView;
 }
示例#5
0
        public Control[] BreakOffControlAtMostAtHeight(Control control, double height)
        {
            Control[] controls = new Control[2];

             Type controlType = control.GetType();
            if(renderersDictionary.ContainsKey(controlType)){
                var renderer = renderersDictionary[controlType] as IControlRenderer;
                 controls = renderer.BreakOffControlAtMostAtHeight(context,control,height);
            }

            return controls;
        }
 public Control[] BreakOffControlAtMostAtHeight(Cairo.Context c, Control control, double height)
 {
     Control[] controls = new Control[2];
     var newControl = control.CreateControl();
     var newControl1 = control.CreateControl();
     newControl.Height = height;
     newControl1.Height = control.Height - height;
     newControl1.Top = 0;
     controls[1] = newControl1;
     controls[0] = newControl;
     return controls;
 }
示例#7
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();
        }
示例#8
0
 public Control[] BreakOffControlAtMostAtHeight(Cairo.Context c, Control control, double height)
 {
     Control[] controls = new Control[2];
     var newControl = control.CreateControl();
     var newControl1 = control.CreateControl() as Image;
     newControl.Height = height;
     newControl1.Height = control.Height - height;
     newControl1.Offset = new MonoReports.Model.Point(0,-height);
     newControl1.Top = 0;
     controls[1] = newControl1;
     controls[0] = newControl;
     return controls;
 }
        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();
        }
示例#10
0
        /// <summary>
        /// Breaks off contol at most at height.
        /// </summary>
        /// <returns>
        /// Array of two controls: broken control with height equal to height param or lower and second control representing rest part of oryginal control
        /// </returns>
        /// <param name='control'>
        /// Control to broke off
        /// </param>
        /// <param name='height'>
        /// Height.
        /// </param>
        public Control[] BreakOffControlAtMostAtHeight(Cairo.Context c, Control control, double height)
        {
            Control[] controls = new Control[2];

            TextBlock textBlock = control.CreateControl() as TextBlock;
            controls[1] = textBlock;
            var newTextBlock = control.CreateControl() as TextBlock;
            textBlock.Top = 0;
            int charNumber = c.GetBreakLineCharacterIndexbyMaxHeight (textBlock,height);

            if (charNumber > 0) {
                newTextBlock.Text = textBlock.Text.Substring (0,charNumber-1);
                newTextBlock.Padding = new Thickness(textBlock.Padding.Left,0,textBlock.Padding.Right,textBlock.Padding.Bottom);
                var newSize = c.DrawTextBlock (newTextBlock, false);
                newTextBlock.Height = newSize.Height;
                textBlock.Height = textBlock.Height - newSize.Height;
                textBlock.Text = textBlock.Text.Substring (charNumber-1);

            }
            else if (charNumber == 0)
            {
                newTextBlock.Height = textBlock.Padding.Top;
                newTextBlock.Text = String.Empty;
                textBlock.Height = textBlock.Height - newTextBlock.Height;
            }
            else if (charNumber == -1) {
                newTextBlock.Height = height;
                newTextBlock.Text = String.Empty;
                textBlock.Height = textBlock.Height - height;
                textBlock.Padding =   new Thickness (textBlock.Padding.Left,textBlock.Padding.Top - height,textBlock.Padding.Right,textBlock.Padding.Bottom);

            } else if (charNumber == -2) {

                newTextBlock.Height = height;
                textBlock.Text = String.Empty;
                textBlock.FieldName = String.Empty;
                textBlock.Height = textBlock.Height - height;
                textBlock.Padding =   new Thickness (textBlock.Padding.Left,textBlock.Padding.Top - height,textBlock.Padding.Right,textBlock.Padding.Bottom);

            }
            controls[0] = newTextBlock;

            return controls;
        }
示例#11
0
        public Control[] BreakOffControlAtMostAtHeight(Cairo.Context c, Control control, double height)
        {
            Control[] controls = new Control[2];
            var first = control.CreateControl () as Line;
            var second = control.CreateControl () as Line;
            double newX = 0;

            if ( first.Location.X != first.End.X ) {

                if ( first.Location.Y > first.End.Y ) {
                    newX = calculateXAtYZero(first.End.X,height,first.Location.X,-(first.Height - height));
                    first.Location = new MonoReports.Model.Point(newX, first.End.Y + height);
                    double deltaW = second.End.X - newX;
                    second.Left -= deltaW;
                    second.Top = 0;
                    second.Location = new MonoReports.Model.Point(second.Location.X + deltaW , second.Location.Y - height);
                } else if (first.Location.Y < first.End.Y) {

                    newX = calculateXAtYZero(first.Location.X,height,first.End.X,-(first.Height - height));
                    first.End = new MonoReports.Model.Point(newX, first.Location.Y + height);
                    double deltaW = second.Location.X - newX;
                    second.Left -= deltaW;
                    second.Top = 0;
                    second.End = new MonoReports.Model.Point(second.End.X + deltaW , second.End.Y - height);
                }
            } else {
                if ( first.Location.Y > first.End.Y ) {
                    first.Location = new MonoReports.Model.Point(first.Location.X, first.End.Y + height);
                    second.Top = 0;
                    second.Location = new MonoReports.Model.Point(second.Location.X, second.Location.Y - height);
                } else if (first.Location.Y < first.End.Y) {
                    first.End = new MonoReports.Model.Point(first.End.X, first.Location.Y + height);
                    second.Top = 0;
                    second.End = new MonoReports.Model.Point(second.End.X , second.End.Y - height);
                }

            }

            controls [0] = first;
            controls [1] = second;
            return controls;
        }
 public void RenderControl(Control control)
 {
 }
 public Size MeasureControl(Control control)
 {
     return new Size(control.Size);
 }
 public Control[] BreakOffControlAtMostAtHeight(Control control, double height)
 {
     return new Control[]{ control.CreateControl(), control.CreateControl() };
 }
示例#15
0
 public void RenderControl(Control control )
 {
     Type controlType = control.GetType();
     if(renderersDictionary.ContainsKey(controlType)){
         var renderer = renderersDictionary[controlType] as IControlRenderer;
         renderer.Render(context,control);
     }
 }
示例#16
0
 public Size MeasureControl(Control control)
 {
     Type controlType = control.GetType();
     if(renderersDictionary.ContainsKey(controlType)){
         var renderer = renderersDictionary[controlType] as IControlRenderer;
         return renderer.Measure(context,control);
     }
     return default(Size);
 }
 public ControlViewBase(MonoReports.Model.Controls.Control controlModel)
 {
     ControlModel = controlModel;
 }
示例#18
0
 public ControlViewBase AddControl(Control controlToAdd)
 {
     var controlView = controlViewFactory.CreateControlView (controlToAdd, this);
     AddControlView (controlView);
     return controlView;
 }
示例#19
0
 public virtual ControlViewBase AddControl(SectionView sectionView, Control control)
 {
     return null;
 }
 public Control[] BreakOffControlAtMostAtHeight(Cairo.Context c, Control control, double height)
 {
     Control[] controls = new Control[2];
     controls[1] = control;
     return controls;
 }
示例#21
0
 internal void CopyBasicProperties(Control c)
 {
     c.Location = new Point (Location.X,Location.Y);
     c.Size = new Size (Size.Width,Size.Height);
     c.IsVisible = IsVisible;
     c.BackgroundColor = new Color (BackgroundColor.R,BackgroundColor.G,BackgroundColor.B,BackgroundColor.A);
     c.TemplateControl = this;
 }
示例#22
0
 public Size Measure(Cairo.Context c, Control control)
 {
     Line line = control as Line;
     Cairo.PointD p1 = new Cairo.PointD (line.Location.X ,line.Location.Y);
     Cairo.PointD p2 = new Cairo.PointD (line.End.X, line.End.Y);
     var r = c.DrawLine (p1, p2, line.BackgroundColor.ToCairoColor (), line.LineWidth, line.LineType, false);
     return new Size (r.Width, r.Height);
 }
示例#23
0
 public override ControlViewBase AddControl(SectionView sectionView, Control control)
 {
     var l = control as Line;
     var lineView = sectionView.AddControl(l);
     sectionView.Section.Controls.Add(l);
     lineView.ParentSection = sectionView;
     designService.SelectedControl = lineView;
     return lineView;
 }
示例#24
0
 public void Render(Cairo.Context c, Control control)
 {
     Line line = control as Line;
     double realLineWidth = line.LineWidth * UnitMulitipier;
     c.DrawLineWithLocationInUnit (line.Location.X, line.Location.Y,line.End.X,line.End.Y, line.BackgroundColor.ToCairoColor (),realLineWidth , line.LineType, true);
 }
示例#25
0
 internal void FireBeforeControlProcessing(ReportContext rc, Control c)
 {
     if (OnBeforeControlProcessing != null) {
         OnBeforeControlProcessing(rc, c);
     }
 }
示例#26
0
 public void Render(Cairo.Context c, Control control)
 {
     Line line = control as Line;
     Cairo.PointD p1 = new Cairo.PointD (line.Location.X ,line.Location.Y);
     Cairo.PointD p2 = new Cairo.PointD (line.End.X, line.End.Y);
     c.DrawLine (p1, p2, line.BackgroundColor.ToCairoColor (), line.LineWidth, line.LineType, true);
 }
		public ControlViewBase CreateControlView (MonoReports.Model.Controls.Control control, SectionView sectionView) 	
		{			
			return controlViewDictionary[control.GetType()](control,sectionView);
		}
        public Size Measure(Cairo.Context c, Control control)
        {
            TextBlock textBlock = control as TextBlock;
            Rectangle borderRect;
            var rect = c.DrawTextBlock (textBlock,false);

            if(textBlock.CanGrow && rect.Height > textBlock.Height || textBlock.CanShrink && rect.Height < textBlock.Height){
                borderRect = new Rectangle (textBlock.Location.X, textBlock.Location.Y, textBlock.Width, rect.Height);
            } else {
                borderRect = new Rectangle (textBlock.Location.X, textBlock.Location.Y, textBlock.Width, textBlock.Height);
            }

            return new Size(borderRect.Width, borderRect.Height);
        }
        public void Render(Cairo.Context c,Control control)
        {
            TextBlock textBlock = control as TextBlock;
            Rectangle borderRect;
            c.Save();
            borderRect = new Rectangle (textBlock.Location.X * unitMulitipier , textBlock.Location.Y  * unitMulitipier, textBlock.Width  * unitMulitipier, textBlock.Height  * unitMulitipier);
            if(!textBlock.CanGrow || DesignMode)
                c.ClipRectangle(borderRect);

            var rect = c.DrawTextBlock (textBlock,false);
            if(!DesignMode && (textBlock.CanGrow && rect.Height > textBlock.Height  || textBlock.CanShrink && rect.Height < textBlock.Height )){
                borderRect = new Rectangle (textBlock.Location.X, textBlock.Location.Y, textBlock.Width, rect.Height);
            } else {
                borderRect = new Rectangle (textBlock.Location.X, textBlock.Location.Y, textBlock.Width, textBlock.Height);

            }

            c.FillRectangleInUnit(borderRect,textBlock.BackgroundColor.ToCairoColor());
            if(DesignMode){
                c.DrawInsideSelectorInUnits  (borderRect, new Border(1),4);
            }
            c.DrawTextBlock (textBlock,true);
            c.DrawInsideBorderInUnit  (borderRect, textBlock.Border,true);
            c.Restore();
            if(MonoreportsSettings.debugMode)
                c.DrawDebug( string.Format(Catalog.GetString("bottom: {0}"),textBlock.Bottom.ToUnitString()),borderRect.X,textBlock.Bottom);
        }
示例#30
0
        public void Render(Cairo.Context c,Control control)
        {
            TextBlock textBlock = control as TextBlock;
            Rectangle borderRect;
            c.Save();
            borderRect = new Rectangle (textBlock.Location.X, textBlock.Location.Y, textBlock.Width, textBlock.Height);
            if(!textBlock.CanGrow || DesignMode)
                c.ClipRectangle(borderRect);

            var rect = c.DrawTextBlock (textBlock,false);
            if(!DesignMode && (textBlock.CanGrow && rect.Height > textBlock.Height || textBlock.CanShrink && rect.Height < textBlock.Height)){
                borderRect = new Rectangle (textBlock.Location.X, textBlock.Location.Y, textBlock.Width, rect.Height);
            } else {
                borderRect = new Rectangle (textBlock.Location.X, textBlock.Location.Y, textBlock.Width, textBlock.Height);
            }

            c.FillRectangle(borderRect,textBlock.BackgroundColor.ToCairoColor());
            c.DrawTextBlock (textBlock,true);
            c.DrawInsideBorder  (borderRect, textBlock.Border,true);
            c.Restore();
        }