private Image DrawOutline(Image Target, BlockOutlines pOutlines, Pen pPen)
        {
            Bitmap BuildResult = new Bitmap(Target);

            using (Graphics g = Graphics.FromImage(BuildResult))
            {
                g.CompositingQuality = CompositingQuality.HighSpeed;
                g.InterpolationMode  = InterpolationMode.NearestNeighbor;
                g.SmoothingMode      = SmoothingMode.HighSpeed;
                if (pOutlines.HasFlag(BlockOutlines.Outline_Top))
                {
                    g.DrawLine(pPen, 0, 0, BuildResult.Width, 0);
                }

                if (pOutlines.HasFlag(BlockOutlines.Outline_Bottom))
                {
                    g.DrawLine(pPen, 0, BuildResult.Height, BuildResult.Width, BuildResult.Height);
                }
                if (pOutlines.HasFlag(BlockOutlines.Outline_Left))
                {
                    g.DrawLine(pPen, 0, 0, 0, BuildResult.Height);
                }
                if (pOutlines.HasFlag(BlockOutlines.Outline_Right))
                {
                    g.DrawLine(pPen, BuildResult.Width, 0, BuildResult.Width, BuildResult.Height);
                }
                //TODO: handle drawing dotted corners...

                if (pOutlines.HasFlag(BlockOutlines.Square_Top_Left))
                {
                    g.FillRectangle(pPen.Brush, new RectangleF(0, 0, PenWidth, PenWidth));
                }
                else if (pOutlines.HasFlag(BlockOutlines.Square_Top_Right))
                {
                    g.FillRectangle(pPen.Brush, new RectangleF(Target.Width - PenWidth, 0, PenWidth, PenWidth));
                }
                else if (pOutlines.HasFlag(BlockOutlines.Square_Bottom_Left))
                {
                    g.FillRectangle(pPen.Brush, new RectangleF(0, Target.Height - PenWidth, PenWidth, PenWidth));
                }
                else if (pOutlines.HasFlag(BlockOutlines.Square_Bottom_Right))
                {
                    g.FillRectangle(pPen.Brush, new RectangleF(Target.Width - PenWidth, Target.Height - PenWidth, PenWidth, PenWidth));
                }
            }
            return(BuildResult);
        }
        private Image GetOutlinedImage(BlockOutlines outline, Color BaseColor)
        {
            string sKey = getCacheKey(outline, BaseColor);

            if (!StoredImages.ContainsKey(sKey))
            {
                Bitmap BuildImage = new Bitmap(StandardDrawSize.Width, StandardDrawSize.Height);
                using (Graphics g = Graphics.FromImage(BuildImage))
                {
                    g.CompositingQuality = CompositingQuality.HighSpeed;
                    g.InterpolationMode  = InterpolationMode.NearestNeighbor;
                    g.SmoothingMode      = SmoothingMode.HighSpeed;
                    g.Clear(BaseColor);
                }
                var ResultImage = DrawOutline(BuildImage, outline, OutlinePen);
                StoredImages.Add(sKey, ResultImage);
            }
            return(StoredImages[sKey]);
        }
 private String getCacheKey(BlockOutlines outline, Color BaseColor)
 {
     return("(" + BaseColor.R + "," + BaseColor.G + "," + BaseColor.B + ")-" + ((int)outline).ToString());
 }
Exemplo n.º 4
0
        private static void ReadTablixCellProperties(RPLTablixCell cell, ALayout layout, int[] rowTops, int[] columnLefts, int generationIndex, bool isRTL, BlockOutlines blockOutlines, Dictionary <string, ToggleParent> toggleParents, bool suppressOutlines, string subreportLanguage)
        {
            int  num  = columnLefts[cell.ColIndex];
            int  num2 = rowTops[cell.RowIndex];
            int  num3 = columnLefts[cell.ColIndex + cell.ColSpan] - num;
            int  num4 = rowTops[cell.RowIndex + cell.RowSpan] - num2;
            bool flag = false;

            if (num3 == 0 && cell.ColSpan != 0)
            {
                return;
            }
            if (num4 == 0 && cell.RowSpan != 0)
            {
                return;
            }
            if (!suppressOutlines && cell is RPLTablixMemberCell && blockOutlines != (BlockOutlines)3)
            {
                RPLTablixMemberCell rPLTablixMemberCell = (RPLTablixMemberCell)cell;
                TogglePosition      togglePosition      = TogglePosition.None;
                flag = rPLTablixMemberCell.HasToggle;
                if (rPLTablixMemberCell.TablixMemberDef.IsColumn)
                {
                    if ((blockOutlines & BlockOutlines.Columns) != 0)
                    {
                        flag = false;
                    }
                    togglePosition = TogglePosition.Above;
                }
                else
                {
                    if ((blockOutlines & BlockOutlines.Rows) != 0)
                    {
                        flag = false;
                    }
                    togglePosition = (TogglePosition)((!isRTL) ? 1 : 2);
                }
                int left = num;
                if (isRTL && num3 == 0 && cell.ColIndex > 0)
                {
                    left = columnLefts[cell.ColIndex - 1];
                }
                layout.AddStructuralItem(num2, left, num3, num4, flag, generationIndex, rPLTablixMemberCell, togglePosition);
            }
            RPLItem element = cell.Element;

            if (element != null)
            {
                byte         b         = default(byte);
                RPLItemProps itemProps = layout.RPLReport.GetItemProps(element.RPLSource, out b);
                if (b == 7)
                {
                    RPLTextBoxPropsDef rPLTextBoxPropsDef = (RPLTextBoxPropsDef)itemProps.Definition;
                    if (rPLTextBoxPropsDef.IsSimple)
                    {
                        layout.AddReportItem(element.RPLSource, num2, num, num3, num4, generationIndex, cell.ElementState, subreportLanguage, toggleParents);
                    }
                    else
                    {
                        layout.AddReportItem(element, num2, num, num3, num4, generationIndex, cell.ElementState, subreportLanguage, toggleParents);
                    }
                    if (!suppressOutlines && rPLTextBoxPropsDef.IsToggleParent && !toggleParents.ContainsKey(rPLTextBoxPropsDef.Name))
                    {
                        toggleParents.Add(rPLTextBoxPropsDef.Name, new ToggleParent(num2, num, num3, num4));
                    }
                }
                else
                {
                    layout.AddReportItem(element.RPLSource, num2, num, num3, num4, generationIndex, cell.ElementState, subreportLanguage, toggleParents);
                }
                if (!suppressOutlines)
                {
                    if (rowTops.Length > 2)
                    {
                        blockOutlines |= BlockOutlines.Columns;
                    }
                    if (columnLefts.Length > 2)
                    {
                        blockOutlines |= BlockOutlines.Rows;
                    }
                }
                Reader.ReadMeasurement(element, layout, num2, num, generationIndex + 1, blockOutlines, toggleParents, suppressOutlines, num3, subreportLanguage);
            }
        }
Exemplo n.º 5
0
 private static void ReadTablixStructure(RPLTablix tablix, ALayout layout, int top, int left, int generationIndex, BlockOutlines blockOutlines, Dictionary <string, ToggleParent> toggleParents, bool suppressOutlines, string subreportLanguage)
 {
     if (tablix != null)
     {
         int num = 0;
         if (tablix.ColumnWidths != null)
         {
             num = tablix.ColumnWidths.Length;
         }
         int[] array = new int[num + 1];
         array[0] = left;
         double num2           = (double)left;
         int    num3           = 0;
         int    rowHeaderWidth = 0;
         for (int i = 1; i <= num; i++)
         {
             num2    += LayoutConvert.ConvertMMTo20thPointsUnrounded((double)tablix.ColumnWidths[i - 1]);
             array[i] = (int)Math.Round(num2);
             if (tablix.ColsBeforeRowHeaders == 0 && i == tablix.RowHeaderColumns)
             {
                 rowHeaderWidth = (int)Math.Round(num2 - (double)left);
             }
         }
         num3 = (int)Math.Round(num2 - (double)left);
         int num4 = 0;
         if (tablix.RowHeights != null)
         {
             num4 = tablix.RowHeights.Length;
         }
         int[] array2 = new int[num4 + 1];
         array2[0] = top;
         double num5 = (double)top;
         int    num6 = 0;
         int    columnHeaderHeight = 0;
         for (int j = 1; j <= num4; j++)
         {
             num5     += LayoutConvert.ConvertMMTo20thPointsUnrounded((double)tablix.RowHeights[j - 1]);
             array2[j] = (int)Math.Round(num5);
             if (j == tablix.ColumnHeaderRows)
             {
                 columnHeaderHeight = (int)Math.Round(num5 - (double)top);
             }
         }
         num6 = (int)Math.Round(num5 - (double)top);
         List <RelativeStaticLocation> list = new List <RelativeStaticLocation>();
         bool         flag = false;
         RPLTablixRow nextRow;
         while ((nextRow = tablix.GetNextRow()) != null)
         {
             bool flag2 = false;
             RelativeStaticLocation relativeStaticLocation = new RelativeStaticLocation();
             if (!suppressOutlines && nextRow.OmittedHeaders != null)
             {
                 for (int k = 0; k < nextRow.OmittedHeaders.Count; k++)
                 {
                     RPLTablixMemberCell rPLTablixMemberCell = nextRow.OmittedHeaders[k];
                     if (Reader.SetRelativeStaticLocation(rPLTablixMemberCell, layout, relativeStaticLocation, list, ref flag2))
                     {
                         flag = true;
                     }
                     Reader.ReadTablixCellProperties(rPLTablixMemberCell, layout, array2, array, generationIndex + 1, tablix.LayoutDirection == RPLFormat.Directions.RTL, blockOutlines, toggleParents, suppressOutlines, subreportLanguage);
                     nextRow.OmittedHeaders[k] = null;
                 }
             }
             for (int l = 0; l < nextRow.NumCells; l++)
             {
                 RPLTablixCell rPLTablixCell = nextRow[l];
                 if (!suppressOutlines)
                 {
                     RPLTablixMemberCell rPLTablixMemberCell2 = rPLTablixCell as RPLTablixMemberCell;
                     if (rPLTablixMemberCell2 != null && Reader.SetRelativeStaticLocation(rPLTablixMemberCell2, layout, relativeStaticLocation, list, ref flag2))
                     {
                         flag = true;
                     }
                 }
                 Reader.ReadTablixCellProperties(rPLTablixCell, layout, array2, array, generationIndex + 1, tablix.LayoutDirection == RPLFormat.Directions.RTL, blockOutlines, toggleParents, suppressOutlines, subreportLanguage);
                 nextRow[l] = null;
             }
             if (!suppressOutlines && flag2 && !layout.SummaryColumnAfter.HasValue)
             {
                 layout.SummaryColumnAfter = relativeStaticLocation.IsSummaryAfter();
             }
         }
         if (!suppressOutlines)
         {
             int num7 = 0;
             while (!layout.SummaryRowAfter.HasValue && num7 < list.Count)
             {
                 RelativeStaticLocation relativeStaticLocation2 = list[num7];
                 layout.SummaryRowAfter = relativeStaticLocation2.IsSummaryAfter();
                 num7++;
             }
             if (flag)
             {
                 layout.AddStructuralItem(top, left, num3, num6, ALayout.TablixStructStart + ALayout.TablixStructGenerationOffset * generationIndex, rowHeaderWidth, columnHeaderHeight, tablix.LayoutDirection == RPLFormat.Directions.RTL);
             }
         }
     }
 }
Exemplo n.º 6
0
        private static void ReadMeasurement(RPLElement element, ALayout layout, int top, int left, int generationIndex, BlockOutlines blockOutlines, Dictionary <string, ToggleParent> toggleParents, bool suppressOutlines, int elementWidth, string subreportLanguage)
        {
            RPLContainer rPLContainer = element as RPLContainer;

            if (rPLContainer != null)
            {
                if (rPLContainer.Children != null)
                {
                    bool         flag         = false;
                    int          num          = 0;
                    RPLSubReport rPLSubReport = element as RPLSubReport;
                    if (rPLSubReport != null)
                    {
                        flag = true;
                        if (!suppressOutlines)
                        {
                            toggleParents = new Dictionary <string, ToggleParent>();
                        }
                        string language = ((RPLSubReportProps)rPLSubReport.ElementProps).Language;
                        if (!string.IsNullOrEmpty(language))
                        {
                            subreportLanguage = language;
                        }
                    }
                    int[]     array  = new int[rPLContainer.Children.Length];
                    int[]     array2 = new int[rPLContainer.Children.Length];
                    int[]     array3 = new int[rPLContainer.Children.Length];
                    RPLItem[] array4 = new RPLItem[rPLContainer.Children.Length];
                    for (int i = 0; i < rPLContainer.Children.Length; i++)
                    {
                        RPLItemMeasurement rPLItemMeasurement = rPLContainer.Children[i];
                        if (0.0 == rPLItemMeasurement.Width && 0.0 == rPLItemMeasurement.Height)
                        {
                            rPLContainer.Children[i] = null;
                        }
                        else
                        {
                            if ((0.0 == rPLItemMeasurement.Width || 0.0 == rPLItemMeasurement.Height) && !(rPLItemMeasurement.Element is RPLLine))
                            {
                                rPLContainer.Children[i] = null;
                                continue;
                            }
                            int num2 = LayoutConvert.ConvertMMTo20thPoints((double)rPLItemMeasurement.Height);
                            int num3 = 0;
                            if (flag)
                            {
                                num3      = elementWidth;
                                array2[i] = LayoutConvert.ConvertMMTo20thPoints((double)rPLItemMeasurement.Top) + top + num;
                                num      += num2;
                            }
                            else
                            {
                                num3      = LayoutConvert.ConvertMMTo20thPoints((double)rPLItemMeasurement.Width);
                                array2[i] = LayoutConvert.ConvertMMTo20thPoints((double)rPLItemMeasurement.Top) + top;
                            }
                            array[i]  = num3;
                            array3[i] = LayoutConvert.ConvertMMTo20thPoints((double)rPLItemMeasurement.Left) + left;
                            RPLItem      rPLItem   = array4[i] = rPLItemMeasurement.Element;
                            byte         b         = default(byte);
                            RPLItemProps itemProps = layout.RPLReport.GetItemProps(rPLItem.RPLSource, out b);
                            if (b == 7)
                            {
                                RPLTextBoxPropsDef rPLTextBoxPropsDef = (RPLTextBoxPropsDef)itemProps.Definition;
                                if (rPLTextBoxPropsDef.IsSimple)
                                {
                                    layout.AddReportItem(rPLItem.RPLSource, array2[i], array3[i], num3, num2, generationIndex, rPLItemMeasurement.State, subreportLanguage, toggleParents);
                                }
                                else
                                {
                                    layout.AddReportItem(rPLItem, array2[i], array3[i], num3, num2, generationIndex, rPLItemMeasurement.State, subreportLanguage, toggleParents);
                                }
                                if (!suppressOutlines && rPLTextBoxPropsDef.IsToggleParent && !toggleParents.ContainsKey(rPLTextBoxPropsDef.Name))
                                {
                                    toggleParents.Add(rPLTextBoxPropsDef.Name, new ToggleParent(array2[i], array3[i], num3, num2));
                                }
                            }
                            else
                            {
                                layout.AddReportItem(rPLItem.RPLSource, array2[i], array3[i], num3, num2, generationIndex, rPLItemMeasurement.State, subreportLanguage, toggleParents);
                            }
                        }
                    }
                    for (int j = 0; j < rPLContainer.Children.Length; j++)
                    {
                        if (rPLContainer.Children[j] != null)
                        {
                            Reader.ReadMeasurement(array4[j], layout, array2[j], array3[j], generationIndex + 1, blockOutlines, toggleParents, suppressOutlines, array[j], subreportLanguage);
                            rPLContainer.Children[j] = null;
                            array4[j] = null;
                        }
                    }
                    rPLContainer.Children = null;
                }
            }
            else
            {
                Reader.ReadTablixStructure(element as RPLTablix, layout, top, left, generationIndex, blockOutlines, toggleParents, suppressOutlines, subreportLanguage);
            }
        }