Пример #1
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));
        }
Пример #2
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));
        }
Пример #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;
        }
Пример #6
0
 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;
 }
Пример #9
0
        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;
        }
Пример #12
0
 public void RenderControl(Control control)
 {
 }
Пример #13
0
 public Size MeasureControl(Control control)
 {
     return new Size(control.Size);
 }
Пример #14
0
 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);
 }
Пример #17
0
 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;
 }
Пример #20
0
 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);
		}
Пример #28
0
        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);
        }
Пример #29
0
        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();
        }