Exemplo n.º 1
0
 /// <summary>
 /// Serializes the fill.
 /// </summary>
 /// <param name="writer">Writer object.</param>
 /// <param name="prefix">Name of the fill property.</param>
 /// <param name="fill">Fill object to compare with.</param>
 /// <remarks>
 /// This method is for internal use only.
 /// </remarks>
 public virtual void Serialize(FRWriter writer, string prefix, FillBase fill)
 {
     if (fill.GetType() != GetType())
     {
         writer.WriteStr(prefix, Name);
     }
 }
Exemplo n.º 2
0
 /// <inheritdoc/>
 public override void SaveState()
 {
     base.SaveState();
     FSavedText     = Text;
     FSavedTextFill = TextFill;
     FSavedFont     = Font;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ReportPage"/> class with default settings.
 /// </summary>
 public ReportPage()
 {
     paperWidth   = 210;
     paperHeight  = 297;
     leftMargin   = 10;
     topMargin    = 10;
     rightMargin  = 10;
     bottomMargin = 10;
     InitPreview();
     bands                = new BandCollection(this);
     guides               = new FloatCollection();
     columns              = new PageColumns(this);
     border               = new Border();
     fill                 = new SolidFill(SystemColors.Window);
     watermark            = new Watermark();
     titleBeforeHeader    = true;
     startPageEvent       = "";
     finishPageEvent      = "";
     manualBuildEvent     = "";
     BaseName             = "Page";
     unlimitedHeight      = false;
     printOnRollPaper     = false;
     unlimitedWidth       = false;
     unlimitedHeightValue = MAX_PAPER_SIZE_MM * Units.Millimeters;
     unlimitedWidthValue  = MAX_PAPER_SIZE_MM * Units.Millimeters;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ReportComponentBase"/> class with default settings.
 /// </summary>
 public ReportComponentBase()
 {
     border             = new Border();
     fill               = new SolidFill();
     hyperlink          = new Hyperlink(this);
     bookmark           = "";
     exportable         = true;
     flagUseFill        = true;
     flagUseBorder      = true;
     flagPreviewVisible = true;
     flagSerializeStyle = true;
     shiftMode          = ShiftMode.Always;
     style              = "";
     evenStyle          = "";
     hoverStyle         = "";
     printOn            = PrintOn.FirstPage | PrintOn.LastPage | PrintOn.OddPages | PrintOn.EvenPages | PrintOn.RepeatedBand | PrintOn.SinglePage;
     beforePrintEvent   = "";
     afterPrintEvent    = "";
     afterDataEvent     = "";
     clickEvent         = "";
     cursor             = Cursors.Default;
     mouseMoveEvent     = "";
     mouseUpEvent       = "";
     mouseDownEvent     = "";
     mouseEnterEvent    = "";
     mouseLeaveEvent    = "";
     backlight          = false;
     SetFlags(Flags.CanGroup, true);
     if (BaseName.EndsWith("Object"))
     {
         BaseName = ClassName.Substring(0, ClassName.Length - 6);
     }
 }
Exemplo n.º 5
0
        /// <inheritdoc/>
        public override void Serialize(FRWriter writer, string prefix, FillBase fill)
        {
            base.Serialize(writer, prefix, fill);
            LinearGradientFill c = fill as LinearGradientFill;

            if (c == null || c.StartColor != StartColor)
            {
                writer.WriteValue(prefix + ".StartColor", StartColor);
            }
            if (c == null || c.EndColor != EndColor)
            {
                writer.WriteValue(prefix + ".EndColor", EndColor);
            }
            if (c == null || c.Angle != Angle)
            {
                writer.WriteInt(prefix + ".Angle", Angle);
            }
            if (c == null || FloatDiff(c.Focus, Focus))
            {
                writer.WriteFloat(prefix + ".Focus", Focus);
            }
            if (c == null || FloatDiff(c.Contrast, Contrast))
            {
                writer.WriteFloat(prefix + ".Contrast", Contrast);
            }
        }
Exemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StyleBase"/> class with default settings.
 /// </summary>
 public StyleBase()
 {
     Border   = new Border();
     Fill     = new SolidFill();
     TextFill = new SolidFill(Color.Black);
     Font     = GetDefaultFontInternal();
 }
Exemplo n.º 7
0
 /// <summary>
 /// Saves the object's state before printing it.
 /// </summary>
 /// <remarks>
 /// This method is called by the report engine before processing the object.
 /// <para/>Do not call it directly. You may override it if you are developing a new FastReport component.
 /// In this method you should save any object properties that may be changed during the object printing.
 /// The standard implementation saves the object's bounds, visibility, bookmark and hyperlink.
 /// </remarks>
 public virtual void SaveState()
 {
     savedBounds   = Bounds;
     savedVisible  = Visible;
     savedBookmark = Bookmark;
     savedBorder   = Border;
     savedFill     = Fill;
     Hyperlink.SaveState();
 }
Exemplo n.º 8
0
 /// <summary>
 /// Sets the fill for the selected objects.
 /// </summary>
 /// <param name="fill">Fill.</param>
 public void SetFill(FillBase fill)
 {
     foreach (ReportComponentBase c in ModifyList)
     {
         c.Fill = fill.Clone();
     }
     FDesigner.LastFormatting.Fill = fill.Clone();
     FDesigner.SetModified();
 }
Exemplo n.º 9
0
        /// <inheritdoc/>
        public override void Serialize(FRWriter writer, string prefix, FillBase fill)
        {
            base.Serialize(writer, prefix, fill);
            SolidFill c = fill as SolidFill;

            if (c == null || c.Color != Color)
            {
                writer.WriteValue(prefix + ".Color", Color);
            }
        }
Exemplo n.º 10
0
 /// <summary>
 /// Assigns values from another source.
 /// </summary>
 /// <param name="source">Source to assign from.</param>
 public virtual void Assign(StyleBase source)
 {
     Border        = source.Border.Clone();
     Fill          = source.Fill.Clone();
     TextFill      = source.TextFill.Clone();
     Font          = source.Font;
     ApplyBorder   = source.ApplyBorder;
     ApplyFill     = source.ApplyFill;
     ApplyTextFill = source.ApplyTextFill;
     ApplyFont     = source.ApplyFont;
 }
Exemplo n.º 11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TextObject"/> class with default settings.
 /// </summary>
 public TextObject()
 {
     FWordWrap          = true;
     FFont              = Config.DesignerSettings.DefaultFont;
     FTextFill          = new SolidFill(Color.Black);
     FTrimming          = StringTrimming.None;
     FFontWidthRatio    = 1;
     FTabWidth          = 58;
     FClip              = true;
     FHighlight         = new ConditionCollection();
     FlagSerializeStyle = false;
     SetFlags(Flags.HasSmartTag, true);
 }
Exemplo n.º 12
0
        /// <inheritdoc/>
        public override void Serialize(FRWriter writer, string prefix, FillBase fill)
        {
            base.Serialize(writer, prefix, fill);
            GlassFill c = fill as GlassFill;

            if (c == null || c.Color != Color)
            {
                writer.WriteValue(prefix + ".Color", Color);
            }
            if (c == null || c.Blend != Blend)
            {
                writer.WriteFloat(prefix + ".Blend", Blend);
            }
            if (c == null || c.Hatch != Hatch)
            {
                writer.WriteBool(prefix + ".Hatch", Hatch);
            }
        }
Exemplo n.º 13
0
        /// <inheritdoc/>
        public override void Serialize(FRWriter writer, string prefix, FillBase fill)
        {
            base.Serialize(writer, prefix, fill);
            HatchFill c = fill as HatchFill;

            if (c == null || c.ForeColor != ForeColor)
            {
                writer.WriteValue(prefix + ".ForeColor", ForeColor);
            }
            if (c == null || c.BackColor != BackColor)
            {
                writer.WriteValue(prefix + ".BackColor", BackColor);
            }
            if (c == null || c.Style != Style)
            {
                writer.WriteValue(prefix + ".Style", Style);
            }
        }
Exemplo n.º 14
0
        /// <inheritdoc/>
        public override void Serialize(FRWriter writer, string prefix, FillBase fill)
        {
            base.Serialize(writer, prefix, fill);
            PathGradientFill c = fill as PathGradientFill;

            if (c == null || c.CenterColor != CenterColor)
            {
                writer.WriteValue(prefix + ".CenterColor", CenterColor);
            }
            if (c == null || c.EdgeColor != EdgeColor)
            {
                writer.WriteValue(prefix + ".EdgeColor", EdgeColor);
            }
            if (c == null || c.Style != Style)
            {
                writer.WriteValue(prefix + ".Style", Style);
            }
        }
Exemplo n.º 15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ReportPage"/> class with default settings.
 /// </summary>
 public ReportPage()
 {
     FPaperWidth        = 210;
     FPaperHeight       = 297;
     FLeftMargin        = 10;
     FTopMargin         = 10;
     FRightMargin       = 10;
     FBottomMargin      = 10;
     FFirstPageSource   = 7;
     FOtherPagesSource  = 7;
     FDuplex            = Duplex.Default;
     FBands             = new BandCollection(this);
     FGuides            = new FloatCollection();
     FColumns           = new PageColumns(this);
     FBorder            = new Border();
     FFill              = new SolidFill(SystemColors.Window);
     FWatermark         = new Watermark();
     FTitleBeforeHeader = true;
     FStartPageEvent    = "";
     FFinishPageEvent   = "";
     FManualBuildEvent  = "";
     BaseName           = "Page";
 }
Exemplo n.º 16
0
 /// <summary>
 /// Saves the current style.
 /// </summary>
 public virtual void SaveStyle()
 {
     savedBorder = Border;
     savedFill   = Fill;
 }
Exemplo n.º 17
0
        /// <inheritdoc/>
        public override void Serialize(FRWriter writer, string prefix, FillBase fill)
        {
            base.Serialize(writer, prefix, fill);
            TextureFill c = fill as TextureFill;

            if (c == null || c.ImageWidth != ImageWidth)
            {
                writer.WriteValue(prefix + ".ImageWidth", ImageWidth);
            }
            if (c == null || c.ImageHeight != ImageHeight)
            {
                writer.WriteValue(prefix + ".ImageHeight", ImageHeight);
            }
            if (c == null || c.PreserveAspectRatio != PreserveAspectRatio)
            {
                writer.WriteBool(prefix + ".PreserveAspectRatio", PreserveAspectRatio);
            }
            if (c == null || c.WrapMode != WrapMode)
            {
                writer.WriteValue(prefix + ".WrapMode", WrapMode);
            }
            if (c == null || c.ImageOffsetX != ImageOffsetX)
            {
                writer.WriteValue(prefix + ".ImageOffsetX", ImageOffsetX);
            }
            if (c == null || c.ImageOffsetY != ImageOffsetY)
            {
                writer.WriteValue(prefix + ".ImageOffsetY", ImageOffsetY);
            }

            // store image data
            if (writer.SerializeTo != SerializeTo.SourcePages)
            {
                if (writer.BlobStore != null)
                {
                    // check FImageIndex >= writer.BlobStore.Count is needed when we close the designer
                    // and run it again, the BlobStore is empty, but FImageIndex is pointing to
                    // previous BlobStore item and is not -1.
                    if (imageIndex == -1 || imageIndex >= writer.BlobStore.Count)
                    {
                        byte[] bytes = imageData;
                        if (bytes == null)
                        {
                            using (MemoryStream stream = new MemoryStream())
                            {
                                ImageHelper.Save(image, stream, ImageFormat.Png);
                                bytes = stream.ToArray();
                            }
                        }
                        if (bytes != null)
                        {
                            string imgHash = BitConverter.ToString(new Murmur3().ComputeHash(bytes));
                            if (imgHash != dummyImageHash)
                            {
                                imageIndex = writer.BlobStore.AddOrUpdate(bytes, imgHash.Replace("-", String.Empty));
                            }
                        }
                    }
                }
                else
                {
                    if (imageData != null)
                    {
                        string hash = BitConverter.ToString(new Murmur3().ComputeHash(imageData));
                        if (hash != dummyImageHash)
                        {
                            if (c == null || !writer.AreEqual(ImageData, c.ImageData))
                            {
                                writer.WriteStr(prefix + ".ImageData", Convert.ToBase64String(ImageData));
                            }
                        }
                    }
                }

                if (writer.BlobStore != null || writer.SerializeTo == SerializeTo.Undo)
                {
                    writer.WriteInt(prefix + ".ImageIndex", imageIndex);
                }
            }
        }