Пример #1
0
 internal Hyperlink(ReportComponentBase parent)
 {
     SetParent(parent);
     FExpression       = "";
     FValue            = "";
     FDetailReportName = "";
     FDetailPageName   = "";
     FReportParameter  = "";
     FValuesSeparator  = ";";
 }
Пример #2
0
        internal ReportComponentBase HitTest(PointF mouse)
        {
            mouse.X -= LeftMargin * Units.Millimeters;
            mouse.Y -= TopMargin * Units.Millimeters;

            ObjectCollection allObjects = AllObjects;

            for (int i = allObjects.Count - 1; i >= 0; i--)
            {
                ReportComponentBase c = allObjects[i] as ReportComponentBase;
                if (c != null)
                {
                    if (c.PointInObject(mouse))
                    {
                        return(c);
                    }
                }
            }
            return(null);
        }
Пример #3
0
        /// <inheritdoc/>
        public override void AssignFormat(ReportComponentBase source)
        {
            base.AssignFormat(source);

            TextObject src = source as TextObject;

            HorzAlign      = src.HorzAlign;
            VertAlign      = src.VertAlign;
            Angle          = src.Angle;
            Underlines     = src.Underlines;
            Font           = src.Font;
            TextFill       = src.TextFill.Clone();
            Trimming       = src.Trimming;
            FontWidthRatio = src.FontWidthRatio;
            FirstTabOffset = src.FirstTabOffset;
            TabWidth       = src.TabWidth;
            Clip           = src.Clip;
            Wysiwyg        = src.Wysiwyg;
            LineHeight     = src.LineHeight;
            HtmlTags       = src.HtmlTags;
        }
Пример #4
0
        /// <summary>
        /// Initializes a new instance of the <b>ReportComponentMenuBase</b>
        /// class with default settings.
        /// </summary>
        /// <param name="designer">The reference to a report designer.</param>
        public ReportComponentBaseMenu(Designer designer) : base(designer)
        {
            miCanGrow = CreateMenuItem(Res.Get("ComponentMenu,ReportComponent,CanGrow"), new EventHandler(miCanGrow_Click));
            miCanGrow.AutoCheckOnClick = true;
            miCanGrow.BeginGroup       = true;
            miCanShrink = CreateMenuItem(Res.Get("ComponentMenu,ReportComponent,CanShrink"), new EventHandler(miCanShrink_Click));
            miCanShrink.AutoCheckOnClick = true;
            miGrowToBottom = CreateMenuItem(Res.Get("ComponentMenu,ReportComponent,GrowToBottom"), new EventHandler(miGrowToBottom_Click));
            miGrowToBottom.AutoCheckOnClick = true;
            miHyperlink = CreateMenuItem(Res.GetImage(167), Res.Get("ComponentMenu,ReportComponent,Hyperlink"), new EventHandler(miHyperlink_Click));

            int insertPos = Items.IndexOf(miEdit) + 1;

            Items.Insert(insertPos, miHyperlink);
            insertPos = Items.IndexOf(miCut);
            Items.Insert(insertPos, miCanGrow);
            Items.Insert(insertPos + 1, miCanShrink);
            Items.Insert(insertPos + 2, miGrowToBottom);

            if (!miEdit.Visible)
            {
                miHyperlink.BeginGroup = true;
            }

            bool enabled = Designer.SelectedReportComponents.Enabled;

            miCanGrow.Enabled      = enabled;
            miCanShrink.Enabled    = enabled;
            miGrowToBottom.Enabled = enabled;

            if (enabled)
            {
                ReportComponentBase first = Designer.SelectedReportComponents.First;
                miCanGrow.Checked      = first.CanGrow;
                miCanShrink.Checked    = first.CanShrink;
                miGrowToBottom.Checked = first.GrowToBottom;
            }
        }
Пример #5
0
        /// <inheritdoc/>
        public override void Serialize(FRWriter writer)
        {
            ReportComponentBase c = writer.DiffObject as ReportComponentBase;

            base.Serialize(writer);

            if (Exportable != c.Exportable)
            {
                writer.WriteBool("Exportable", Exportable);
            }
            Border.Serialize(writer, "Border", c.Border);
            //if(Fill != c.Fill)
            Fill.Serialize(writer, "Fill", c.Fill);
            if (Cursor != c.Cursor && !Config.WebMode)
            {
                writer.WriteValue("Cursor", Cursor);
            }
            Hyperlink.Serialize(writer, c.Hyperlink);
            if (Bookmark != c.Bookmark)
            {
                writer.WriteStr("Bookmark", Bookmark);
            }
            if (writer.SerializeTo != SerializeTo.Preview)
            {
                if (CanGrow != c.CanGrow)
                {
                    writer.WriteBool("CanGrow", CanGrow);
                }
                if (CanShrink != c.CanShrink)
                {
                    writer.WriteBool("CanShrink", CanShrink);
                }
                if (GrowToBottom != c.GrowToBottom)
                {
                    writer.WriteBool("GrowToBottom", GrowToBottom);
                }
                if (ShiftMode != c.ShiftMode)
                {
                    writer.WriteValue("ShiftMode", ShiftMode);
                }
                if (FlagSerializeStyle && Style != c.Style)
                {
                    writer.WriteStr("Style", Style);
                }
                if (EvenStyle != c.EvenStyle)
                {
                    writer.WriteStr("EvenStyle", EvenStyle);
                }
                if (EvenStylePriority != c.EvenStylePriority)
                {
                    writer.WriteValue("EvenStylePriority", EvenStylePriority);
                }
                if (HoverStyle != c.HoverStyle)
                {
                    writer.WriteStr("HoverStyle", HoverStyle);
                }
                if (PrintOn != c.PrintOn)
                {
                    writer.WriteValue("PrintOn", PrintOn);
                }
                if (BeforePrintEvent != c.BeforePrintEvent)
                {
                    writer.WriteStr("BeforePrintEvent", BeforePrintEvent);
                }
                if (AfterPrintEvent != c.AfterPrintEvent)
                {
                    writer.WriteStr("AfterPrintEvent", AfterPrintEvent);
                }
                if (AfterDataEvent != c.AfterDataEvent)
                {
                    writer.WriteStr("AfterDataEvent", AfterDataEvent);
                }
                if (ClickEvent != c.ClickEvent)
                {
                    writer.WriteStr("ClickEvent", ClickEvent);
                }
                if (MouseMoveEvent != c.MouseMoveEvent)
                {
                    writer.WriteStr("MouseMoveEvent", MouseMoveEvent);
                }
                if (MouseUpEvent != c.MouseUpEvent)
                {
                    writer.WriteStr("MouseUpEvent", MouseUpEvent);
                }
                if (MouseDownEvent != c.MouseDownEvent)
                {
                    writer.WriteStr("MouseDownEvent", MouseDownEvent);
                }
                if (MouseEnterEvent != c.MouseEnterEvent)
                {
                    writer.WriteStr("MouseEnterEvent", MouseEnterEvent);
                }
                if (MouseLeaveEvent != c.MouseLeaveEvent)
                {
                    writer.WriteStr("MouseLeaveEvent", MouseLeaveEvent);
                }
            }
        }
Пример #6
0
        /// <inheritdoc/>
        public override void Draw(FRPaintEventArgs e)
        {
            if (IsDesigning)
            {
                return;
            }

            Graphics   g        = e.Graphics;
            RectangleF pageRect = new RectangleF(0, 0,
                                                 WidthInPixels - 1 / e.ScaleX, HeightInPixels - 1 / e.ScaleY);
            RectangleF printableRect = new RectangleF(
                LeftMargin * Units.Millimeters,
                TopMargin * Units.Millimeters,
                (PaperWidth - LeftMargin - RightMargin) * Units.Millimeters,
                (PaperHeight - TopMargin - BottomMargin) * Units.Millimeters);

            DrawBackground(e, pageRect);
            Border.Draw(e, printableRect);
            if (Watermark.Enabled)
            {
                if (!Watermark.ShowImageOnTop)
                {
                    Watermark.DrawImage(e, pageRect, Report, IsPrinting);
                }
                if (!Watermark.ShowTextOnTop)
                {
                    Watermark.DrawText(e, pageRect, Report, IsPrinting);
                }
            }

            float leftMargin = (int)Math.Round(LeftMargin * Units.Millimeters * e.ScaleX);
            float topMargin  = (int)Math.Round(TopMargin * Units.Millimeters * e.ScaleY);

            g.TranslateTransform(leftMargin, topMargin);

            try
            {
                foreach (Base c in AllObjects)
                {
                    if (c is ReportComponentBase && c.HasFlag(Flags.CanDraw))
                    {
                        ReportComponentBase obj = c as ReportComponentBase;
                        if (!IsPrinting)
                        {
#if !MONO
                            if (!obj.IsVisible(e))
                            {
                                continue;
                            }
#endif
                        }
                        else
                        {
                            if (!obj.Printable)
                            {
                                continue;
                            }
                            else if (obj.Parent is BandBase && !(obj.Parent as BandBase).Printable)
                            {
                                continue;
                            }
                        }
                        obj.SetDesigning(false);
                        obj.SetPrinting(IsPrinting);
                        obj.Draw(e);
                        obj.SetPrinting(false);
                    }
                }
            }
            finally
            {
                g.TranslateTransform(-leftMargin, -topMargin);
            }

            if (Watermark.Enabled)
            {
                if (Watermark.ShowImageOnTop)
                {
                    Watermark.DrawImage(e, pageRect, Report, IsPrinting);
                }
                if (Watermark.ShowTextOnTop)
                {
                    Watermark.DrawText(e, pageRect, Report, IsPrinting);
                }
            }
        }
Пример #7
0
        /// <inheritdoc/>
        public override bool Break(BreakableComponent breakTo)
        {
            // first we find the break line. It's a minimum Top coordinate of the object that cannot break.
            float breakLine      = Height;
            bool  breakLineFound = true;

            do
            {
                breakLineFound = true;
                foreach (ReportComponentBase obj in Objects)
                {
                    bool canBreak = true;
                    if (obj.Top < breakLine && obj.Bottom > breakLine)
                    {
                        canBreak = false;
                        BreakableComponent breakable = obj as BreakableComponent;
                        if (breakable != null && breakable.CanBreak)
                        {
                            using (BreakableComponent clone = Activator.CreateInstance(breakable.GetType()) as BreakableComponent)
                            {
                                clone.AssignAll(breakable);
                                clone.Height = breakLine - clone.Top;
                                // to allow access to the Report
                                clone.Parent = breakTo;
                                canBreak     = clone.Break(null);
                            }
                        }
                    }

                    if (!canBreak)
                    {
                        breakLine = Math.Min(obj.Top, breakLine);
                        // enumerate objects again
                        breakLineFound = false;
                        break;
                    }
                }
            }while (!breakLineFound);

            // now break the components
            int i = 0;

            while (i < Objects.Count)
            {
                ReportComponentBase obj = Objects[i];
                if (obj.Bottom > breakLine)
                {
                    if (obj.Top < breakLine)
                    {
                        BreakableComponent breakComp = Activator.CreateInstance(obj.GetType()) as BreakableComponent;
                        breakComp.AssignAll(obj);
                        breakComp.Parent = breakTo;

                        breakComp.CanGrow   = true;
                        breakComp.CanShrink = false;
                        breakComp.Height   -= breakLine - obj.Top;
                        breakComp.Top       = 0;
                        obj.Height          = breakLine - obj.Top;
                        (obj as BreakableComponent).Break(breakComp);
                    }
                    else
                    {
                        obj.Top   -= breakLine;
                        obj.Parent = breakTo;
                        continue;
                    }
                }
                i++;
            }

            Height          = breakLine;
            breakTo.Height -= breakLine;
            return(Objects.Count > 0);
        }
Пример #8
0
        /// <inheritdoc/>
        public override float CalcHeight()
        {
            OnBeforeLayout(EventArgs.Empty);

            // sort objects by Top
            ReportComponentCollection sortedObjects = Objects.SortByTop();

            // calc height of each object
            float[] heights = new float[sortedObjects.Count];
            for (int i = 0; i < sortedObjects.Count; i++)
            {
                ReportComponentBase obj = sortedObjects[i];
                float height            = obj.Height;
                if (obj.Visible && (obj.CanGrow || obj.CanShrink))
                {
                    float height1 = obj.CalcHeight();
                    if ((obj.CanGrow && height1 > height) || (obj.CanShrink && height1 < height))
                    {
                        height = height1;
                    }
                }
                heights[i] = height;
            }

            // calc shift amounts
            float[] shifts = new float[sortedObjects.Count];
            for (int i = 0; i < sortedObjects.Count; i++)
            {
                ReportComponentBase parent = sortedObjects[i];
                float shift = heights[i] - parent.Height;
                if (shift == 0)
                {
                    continue;
                }

                for (int j = i + 1; j < sortedObjects.Count; j++)
                {
                    ReportComponentBase child = sortedObjects[j];
                    if (child.ShiftMode == ShiftMode.Never)
                    {
                        continue;
                    }

                    if (child.Top >= parent.Bottom - 1e-4)
                    {
                        if (child.ShiftMode == ShiftMode.WhenOverlapped &&
                            (child.Left > parent.Right - 1e-4 || parent.Left > child.Right - 1e-4))
                        {
                            continue;
                        }

                        float parentShift = shifts[i];
                        float childShift  = shifts[j];
                        if (shift > 0)
                        {
                            childShift = Math.Max(shift + parentShift, childShift);
                        }
                        else
                        {
                            childShift = Math.Min(shift + parentShift, childShift);
                        }
                        shifts[j] = childShift;
                    }
                }
            }

            // update location and size of each component, calc max height
            float maxHeight = 0;

            for (int i = 0; i < sortedObjects.Count; i++)
            {
                ReportComponentBase obj      = sortedObjects[i];
                DockStyle           saveDock = obj.Dock;
                obj.Dock   = DockStyle.None;
                obj.Height = heights[i];
                obj.Top   += shifts[i];
                if (obj.Visible && obj.Bottom > maxHeight)
                {
                    maxHeight = obj.Bottom;
                }
                obj.Dock = saveDock;
            }

            if ((CanGrow && maxHeight > Height) || (CanShrink && maxHeight < Height))
            {
                Height = maxHeight;
            }

            // perform grow to bottom
            foreach (ReportComponentBase obj in Objects)
            {
                if (obj.GrowToBottom)
                {
                    obj.Height = Height - obj.Top;
                }
            }

            OnAfterLayout(EventArgs.Empty);
            return(Height);
        }
Пример #9
0
 internal void SetParent(ReportComponentBase parent)
 {
     FParent = parent;
 }
Пример #10
0
 private bool CanModify(ReportComponentBase c)
 {
     return(!c.HasRestriction(Restrictions.DontModify));
 }