예제 #1
0
        internal override void DrawRectangle(Color color, float size, RPLFormat.BorderStyles style, RectangleF rectangle)
        {
            Pen pen = new Pen(color, size);

            pen.DashStyle = RenderingItem.TranslateBorderStyle(style);
            Graphics.DrawRectangle(pen, rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
        }
예제 #2
0
        internal override void DrawLine(Color color, float size, RPLFormat.BorderStyles style, float x1, float y1, float x2, float y2)
        {
            Pen pen = new Pen(color, size);

            pen.DashStyle = RenderingItem.TranslateBorderStyle(style);
            Graphics.DrawLine(pen, x1, y1, x2, y2);
        }
        internal RenderingReport(GdiContext context)
        {
            RPLPageContent rPLPageContent = context.RplReport.RPLPaginatedPages[0];
            RPLPageLayout  pageLayout     = rPLPageContent.PageLayout;

            context.RenderingReport = this;
            float maxSectionWidth = rPLPageContent.MaxSectionWidth;

            m_position.X      = float.MaxValue;
            m_position.Y      = 0f;
            m_position.Width  = maxSectionWidth;
            m_position.Height = 0f;
            m_reportSections  = new List <RenderingReportSection>(rPLPageContent.ReportSectionSizes.Length);
            int num = 0;

            while (rPLPageContent.HasNextReportSection())
            {
                RPLReportSection nextReportSection = rPLPageContent.GetNextReportSection();
                RPLSizes         rPLSizes          = rPLPageContent.ReportSectionSizes[num];
                m_reportSections.Add(new RenderingReportSection(context, nextReportSection, rPLSizes, num, maxSectionWidth, m_position.Height));
                m_position.X       = Math.Min(m_position.X, rPLSizes.Left);
                m_position.Height += rPLSizes.Height;
                num++;
            }
            object obj = pageLayout.Style[34];

            if (obj != null)
            {
                BackgroundColor = new RPLReportColor((string)obj).ToColor();
            }
            object obj2 = pageLayout.Style[33];

            if (obj2 != null)
            {
                BackgroundImage = RenderingItem.GetImage(context, (RPLImageData)obj2);
                object obj3 = pageLayout.Style[35];
                if (obj3 == null)
                {
                    BackgroundRepeat = RPLFormat.BackgroundRepeatTypes.Repeat;
                }
                else
                {
                    BackgroundRepeat = (RPLFormat.BackgroundRepeatTypes)obj3;
                }
            }
            ProcessBorders(context.GdiWriter, pageLayout.Style, m_position, m_position, 0);
        }
 internal void DrawToPage(GdiContext context)
 {
     if (BackgroundColor != Color.Empty)
     {
         using (SolidBrush brush = new SolidBrush(BackgroundColor))
         {
             context.Graphics.FillRectangle(brush, Position);
         }
     }
     if (BackgroundImage != null)
     {
         RenderingItem.DrawBackgroundImage(context, BackgroundImage, BackgroundRepeat, Position);
     }
     foreach (RenderingReportSection reportSection in m_reportSections)
     {
         reportSection.DrawToPage(context);
     }
     DrawPageBorders(context);
 }
예제 #5
0
 internal override void ProcessRenderingElementContent(RPLElement rplElement, GdiContext context, RectangleF bounds)
 {
     Image = RenderingItem.GetImage(context, ((RPLImageProps)InstanceProperties).Image);
     if (Image == null)
     {
         Image  = GdiContext.ImageResources["InvalidImage"];
         Sizing = RPLFormat.Sizings.Clip;
     }
     else
     {
         Sizing = ((RPLImagePropsDef)DefinitionProperties).Sizing;
     }
     ImagePosition = new RectangleF(base.Position.Location, base.Position.Size);
     GdiContext.CalculateUsableReportItemRectangle(InstanceProperties, ref ImagePosition);
     if (!(ImagePosition.Width <= 0f))
     {
         _ = ImagePosition.Height;
         _ = 0f;
     }
 }
예제 #6
0
 internal void Search(GdiContext context)
 {
     EnsureSortedRenderingItemIndices();
     if (m_sortedRenderingItemIndices == null)
     {
         return;
     }
     for (int i = 0; i < m_sortedRenderingItemIndices.Count; i++)
     {
         RenderingItem renderingItem = Children[m_sortedRenderingItemIndices[i]];
         if (renderingItem is RenderingItemContainer)
         {
             ((RenderingItemContainer)renderingItem).Search(context);
         }
         else if (renderingItem is RenderingTextBox)
         {
             ((RenderingTextBox)renderingItem).Search(context);
         }
     }
 }
예제 #7
0
        internal override void ProcessRenderingElementContent(RPLElement rplElement, GdiContext context, RectangleF bounds)
        {
            RPLContainer rPLContainer = (RPLContainer)rplElement;

            if (rPLContainer.Children == null)
            {
                return;
            }
            if (rPLContainer.Children.Length == 1)
            {
                RenderingItem renderingItem = RenderingItem.CreateRenderingItem(context, rPLContainer.Children[0], bounds);
                if (renderingItem != null)
                {
                    base.Children.Add(renderingItem);
                }
                rPLContainer.Children = null;
                return;
            }
            List <RPLItemMeasurement> list = new List <RPLItemMeasurement>(rPLContainer.Children.Length);

            for (int i = 0; i < rPLContainer.Children.Length; i++)
            {
                list.Add(rPLContainer.Children[i]);
            }
            rPLContainer.Children = null;
            RectangleF bounds2 = bounds;

            for (int j = 0; j < list.Count; j++)
            {
                RPLItemMeasurement rPLItemMeasurement = list[j];
                rPLItemMeasurement.Width = bounds.Width;
                bounds2.Height           = rPLItemMeasurement.Height;
                RenderingItem renderingItem2 = RenderingItem.CreateRenderingItem(context, rPLItemMeasurement, bounds2);
                if (renderingItem2 != null)
                {
                    base.Children.Add(renderingItem2);
                }
                bounds2.Y += rPLItemMeasurement.Height;
                list[j]    = null;
            }
        }
예제 #8
0
        internal override void ProcessRenderingElementContent(RPLElement rplElement, GdiContext context, RectangleF bounds)
        {
            RPLContainer rPLContainer = (RPLContainer)rplElement;

            if (rPLContainer.Children == null)
            {
                return;
            }
            if (rPLContainer.Children.Length == 1)
            {
                RenderingItem renderingItem = RenderingItem.CreateRenderingItem(context, rPLContainer.Children[0], bounds);
                if (renderingItem != null)
                {
                    Children.Add(renderingItem);
                }
                rPLContainer.Children = null;
                return;
            }
            List <RPLItemMeasurement> list = new List <RPLItemMeasurement>(rPLContainer.Children.Length);

            for (int i = 0; i < rPLContainer.Children.Length; i++)
            {
                list.Add(rPLContainer.Children[i]);
            }
            rPLContainer.Children = null;
            list.Sort(new ZIndexComparer());
            for (int j = 0; j < list.Count; j++)
            {
                RenderingItem renderingItem2 = RenderingItem.CreateRenderingItem(context, list[j], bounds);
                if (renderingItem2 != null)
                {
                    Children.Add(renderingItem2);
                }
                list[j] = null;
            }
        }
        private void ProcessBorders(GdiWriter writer, RPLElementStyle style, RectangleF position, RectangleF bounds, byte state)
        {
            RPLFormat.BorderStyles stylePropertyValueBorderStyle = SharedRenderer.GetStylePropertyValueBorderStyle(style, 5, RPLFormat.BorderStyles.None);
            BorderLeft.Style   = SharedRenderer.GetStylePropertyValueBorderStyle(style, 6, stylePropertyValueBorderStyle);
            BorderTop.Style    = SharedRenderer.GetStylePropertyValueBorderStyle(style, 8, stylePropertyValueBorderStyle);
            BorderRight.Style  = SharedRenderer.GetStylePropertyValueBorderStyle(style, 7, stylePropertyValueBorderStyle);
            BorderBottom.Style = SharedRenderer.GetStylePropertyValueBorderStyle(style, 9, stylePropertyValueBorderStyle);
            if (BorderLeft.Style == RPLFormat.BorderStyles.None && BorderTop.Style == RPLFormat.BorderStyles.None && BorderRight.Style == RPLFormat.BorderStyles.None && BorderBottom.Style == RPLFormat.BorderStyles.None)
            {
                return;
            }
            float reportSizeStyleMM = SharedRenderer.GetReportSizeStyleMM(style, 10);

            BorderLeft.Width = SharedRenderer.GetReportSizeStyleMM(style, 11);
            if (float.IsNaN(BorderLeft.Width) && !float.IsNaN(reportSizeStyleMM))
            {
                BorderLeft.Width = reportSizeStyleMM;
            }
            BorderTop.Width = SharedRenderer.GetReportSizeStyleMM(style, 13);
            if (float.IsNaN(BorderTop.Width) && !float.IsNaN(reportSizeStyleMM))
            {
                BorderTop.Width = reportSizeStyleMM;
            }
            BorderRight.Width = SharedRenderer.GetReportSizeStyleMM(style, 12);
            if (float.IsNaN(BorderRight.Width) && !float.IsNaN(reportSizeStyleMM))
            {
                BorderRight.Width = reportSizeStyleMM;
            }
            BorderBottom.Width = SharedRenderer.GetReportSizeStyleMM(style, 14);
            if (float.IsNaN(BorderBottom.Width) && !float.IsNaN(reportSizeStyleMM))
            {
                BorderBottom.Width = reportSizeStyleMM;
            }
            if (!float.IsNaN(BorderLeft.Width) || !float.IsNaN(BorderTop.Width) || !float.IsNaN(BorderRight.Width) || !float.IsNaN(BorderBottom.Width))
            {
                Color reportColorStyle = SharedRenderer.GetReportColorStyle(style, 0);
                BorderLeft.Color = SharedRenderer.GetReportColorStyle(style, 1);
                if (BorderLeft.Color == Color.Empty && reportColorStyle != Color.Empty)
                {
                    BorderLeft.Color = reportColorStyle;
                }
                BorderTop.Color = SharedRenderer.GetReportColorStyle(style, 3);
                if (BorderTop.Color == Color.Empty && reportColorStyle != Color.Empty)
                {
                    BorderTop.Color = reportColorStyle;
                }
                BorderRight.Color = SharedRenderer.GetReportColorStyle(style, 2);
                if (BorderRight.Color == Color.Empty && reportColorStyle != Color.Empty)
                {
                    BorderRight.Color = reportColorStyle;
                }
                BorderBottom.Color = SharedRenderer.GetReportColorStyle(style, 4);
                if (BorderBottom.Color == Color.Empty && reportColorStyle != Color.Empty)
                {
                    BorderBottom.Color = reportColorStyle;
                }
                if (!(BorderLeft.Color == Color.Empty) || !(BorderTop.Color == Color.Empty) || !(BorderRight.Color == Color.Empty) || !(BorderBottom.Color == Color.Empty))
                {
                    RenderingItem.ProcessBorders(writer, ref BorderTop, ref BorderLeft, ref BorderBottom, ref BorderRight, position, bounds, state);
                }
            }
        }
예제 #10
0
        internal override void ProcessRenderingElementContent(RPLElement rplElement, GdiContext context, RectangleF bounds)
        {
            RPLTablix       rPLTablix        = (RPLTablix)rplElement;
            FixedHeaderItem fixedHeaderItem  = null;
            FixedHeaderItem fixedHeaderItem2 = null;
            FixedHeaderItem fixedHeaderItem3 = null;
            float           num  = 0f;
            float           num2 = bounds.Top;

            float[] array = null;
            array = ((rPLTablix.ColumnWidths == null) ? new float[0] : new float[rPLTablix.ColumnWidths.Length]);
            int[] array2 = new int[array.Length];
            for (int i = 0; i < array2.Length; i++)
            {
                array2[i] = int.MaxValue;
            }
            for (int j = 0; j < array.Length; j++)
            {
                if (j > 0)
                {
                    array[j] = array[j - 1] + rPLTablix.ColumnWidths[j - 1];
                }
                if (rPLTablix.FixedColumns[j])
                {
                    if (fixedHeaderItem3 == null)
                    {
                        fixedHeaderItem3              = new FixedHeaderItem(this, base.Position, FixedHeaderItem.LayoutType.Vertical);
                        fixedHeaderItem3.Bounds.X    += array[j];
                        fixedHeaderItem3.Bounds.Width = rPLTablix.ColumnWidths[j];
                    }
                    else
                    {
                        fixedHeaderItem3.Bounds.X      = Math.Min(fixedHeaderItem3.Bounds.X, base.Position.X + array[j]);
                        fixedHeaderItem3.Bounds.Width += rPLTablix.ColumnWidths[j];
                    }
                }
            }
            if (rPLTablix.FixedRow(0))
            {
                fixedHeaderItem = new FixedHeaderItem(this, base.Position, FixedHeaderItem.LayoutType.Horizontal);
                fixedHeaderItem.Bounds.Height = 0f;
                context.RenderingReport.FixedHeaders.Add(fixedHeaderItem);
            }
            if (fixedHeaderItem3 != null)
            {
                context.RenderingReport.FixedHeaders.Add(fixedHeaderItem3);
                if (rPLTablix.FixedRow(0))
                {
                    fixedHeaderItem2 = new FixedHeaderItem(this, base.Position, FixedHeaderItem.LayoutType.Corner);
                    context.RenderingReport.FixedHeaders.Add(fixedHeaderItem2);
                }
            }
            int          num3 = 0;
            int          num4 = -1;
            RPLTablixRow nextRow;

            while ((nextRow = rPLTablix.GetNextRow()) != null)
            {
                if (nextRow is RPLTablixOmittedRow)
                {
                    continue;
                }
                SharedRenderer.CalculateColumnZIndexes(rPLTablix, nextRow, num3, array2);
                if (nextRow.OmittedHeaders != null)
                {
                    for (int k = 0; k < nextRow.OmittedHeaders.Count; k++)
                    {
                        RPLTablixMemberCell rPLTablixMemberCell = nextRow.OmittedHeaders[k];
                        if (!string.IsNullOrEmpty(rPLTablixMemberCell.GroupLabel))
                        {
                            float x = bounds.X;
                            if (rPLTablixMemberCell.ColIndex < array.Length)
                            {
                                x = array[rPLTablixMemberCell.ColIndex];
                            }
                            context.RenderingReport.Labels.Add(rPLTablixMemberCell.UniqueName, new LabelPoint(x, num2));
                        }
                    }
                }
                int num5 = int.MaxValue;
                for (int l = 0; l < nextRow.NumCells; l++)
                {
                    RPLTablixCell      rPLTablixCell      = nextRow[l];
                    RPLItemMeasurement rPLItemMeasurement = new RPLItemMeasurement();
                    rPLItemMeasurement.Element = rPLTablixCell.Element;
                    rPLItemMeasurement.Left    = array[rPLTablixCell.ColIndex];
                    rPLItemMeasurement.Top     = num;
                    rPLItemMeasurement.Width   = rPLTablix.GetColumnWidth(rPLTablixCell.ColIndex, rPLTablixCell.ColSpan);
                    rPLItemMeasurement.Height  = rPLTablix.GetRowHeight(rPLTablixCell.RowIndex, rPLTablixCell.RowSpan);
                    RenderingItem renderingItem = RenderingItem.CreateRenderingItem(context, rPLItemMeasurement, bounds);
                    if (renderingItem == null)
                    {
                        continue;
                    }
                    if (renderingItem is RenderingDynamicImage)
                    {
                        ((RenderingDynamicImage)renderingItem).Sizing = RPLFormat.Sizings.Fit;
                    }
                    RPLTablixMemberCell rPLTablixMemberCell2 = rPLTablixCell as RPLTablixMemberCell;
                    if (rPLTablixMemberCell2 != null && !string.IsNullOrEmpty(rPLTablixMemberCell2.GroupLabel))
                    {
                        context.RenderingReport.Labels.Add(rPLTablixMemberCell2.UniqueName, new LabelPoint(rPLItemMeasurement.Left, rPLItemMeasurement.Top));
                    }
                    if (renderingItem.HasBorders)
                    {
                        renderingItem.DelayDrawBorders = true;
                        if (num3 < rPLTablix.ColumnHeaderRows && rPLTablixCell is RPLTablixCornerCell)
                        {
                            m_cornerBorders.Add(new RenderingItemBorderTablix(0, 0, rPLTablixCell.RowIndex, rPLTablixCell.ColIndex, renderingItem));
                        }
                        else
                        {
                            if (num5 == int.MaxValue)
                            {
                                num5 = SharedRenderer.CalculateRowZIndex(nextRow);
                            }
                            if (num5 == int.MaxValue)
                            {
                                num5 = num4;
                            }
                            RenderingItemBorderTablix renderingItemBorderTablix = new RenderingItemBorderTablix(num5, array2[rPLTablixCell.ColIndex], rPLTablixCell.RowIndex, rPLTablixCell.ColIndex, renderingItem);
                            if (rPLTablixMemberCell2 != null)
                            {
                                if (num3 < rPLTablix.ColumnHeaderRows)
                                {
                                    m_columnHeaderBorders.Add(renderingItemBorderTablix);
                                }
                                else
                                {
                                    renderingItemBorderTablix.CompareRowFirst = false;
                                    m_rowHeaderBorders.Add(renderingItemBorderTablix);
                                }
                            }
                            else
                            {
                                m_detailCellBorders.Add(renderingItemBorderTablix);
                            }
                        }
                    }
                    base.Children.Add(renderingItem);
                    fixedHeaderItem?.RenderingItems.Add(renderingItem);
                    if (rPLTablix.FixedColumns[rPLTablixCell.ColIndex])
                    {
                        fixedHeaderItem3.RenderingItems.Add(renderingItem);
                    }
                    if (fixedHeaderItem2 != null && rPLTablixCell is RPLTablixCornerCell)
                    {
                        fixedHeaderItem2.RenderingItems.Add(renderingItem);
                        fixedHeaderItem2.Bounds = renderingItem.Position;
                    }
                }
                num4 = num5;
                if (fixedHeaderItem != null)
                {
                    fixedHeaderItem.Bounds.Height += rPLTablix.RowHeights[num3];
                    if (num3 == rPLTablix.RowHeights.Length - 1 || !rPLTablix.FixedRow(num3 + 1))
                    {
                        fixedHeaderItem = null;
                    }
                }
                num  += rPLTablix.RowHeights[num3];
                num2 += rPLTablix.RowHeights[num3];
                num3++;
                for (int m = 0; m < nextRow.NumCells; m++)
                {
                    nextRow[m] = null;
                }
            }
            m_detailCellBorders.Sort(new ZIndexComparer());
            m_columnHeaderBorders.Sort(new ZIndexComparer());
            m_rowHeaderBorders.Sort(new ZIndexComparer());
            m_cornerBorders.Sort(new ZIndexComparer());
            RectangleF position = base.Position;

            if (array.Length != 0)
            {
                position.Width = array[array.Length - 1] + rPLTablix.ColumnWidths[rPLTablix.ColumnWidths.Length - 1];
            }
            position.Height = num;
        }
예제 #11
0
        internal static RenderingItem CreateRenderingItem(GdiContext context, RPLItemMeasurement measurement, RectangleF bounds)
        {
            if (!(measurement.Element is RPLLine) && (measurement.Width <= 0f || measurement.Height <= 0f))
            {
                return(null);
            }
            RenderingItem renderingItem = null;
            string        text          = null;

            if (measurement.Element is RPLTextBox)
            {
                renderingItem = new RenderingTextBox();
                text          = ReportPreviewStrings.ReportItemAccessibleNameTextBox;
            }
            else if (measurement.Element is RPLTablix)
            {
                renderingItem = new RenderingTablix();
                text          = ReportPreviewStrings.ReportItemAccessibleNameTablix;
            }
            else if (measurement.Element is RPLRectangle)
            {
                renderingItem = new RenderingRectangle();
                text          = ReportPreviewStrings.ReportItemAccessibleNameRectangle;
            }
            else if (measurement.Element is RPLSubReport)
            {
                renderingItem = new RenderingSubReport();
                text          = ReportPreviewStrings.ReportItemAccessibleNameSubreport;
            }
            else if (measurement.Element is RPLImage)
            {
                renderingItem = new RenderingImage();
                text          = ReportPreviewStrings.ReportItemAccessibleNameImage;
            }
            else if (measurement.Element is RPLChart)
            {
                renderingItem = new RenderingDynamicImage();
                text          = ReportPreviewStrings.ReportItemAccessibleNameChart;
            }
            else if (measurement.Element is RPLGaugePanel)
            {
                renderingItem = new RenderingDynamicImage();
                text          = ReportPreviewStrings.ReportItemAccessibleNameGaugePanel;
            }
            else if (measurement.Element is RPLMap)
            {
                renderingItem = new RenderingDynamicImage();
                text          = ReportPreviewStrings.ReportItemAccessibleNameMap;
            }
            else if (measurement.Element is RPLLine)
            {
                renderingItem = new RenderingLine();
                text          = ReportPreviewStrings.ReportItemAccessibleNameLine;
            }
            else
            {
                if (!(measurement.Element is RPLBody))
                {
                    return(null);
                }
                renderingItem = new RenderingBody();
                text          = ReportPreviewStrings.ReportItemAccessibleNameBody;
            }
            renderingItem.Initialize(context, measurement, bounds, text);
            return(renderingItem);
        }