Exemplo n.º 1
0
 private void Dispose(bool disposing)
 {
     if (!disposing)
     {
         return;
     }
     if (m_fontCache != null)
     {
         m_fontCache.Dispose();
         m_fontCache = null;
     }
     if (m_gdiWriter != null)
     {
         m_gdiWriter.Dispose();
         m_gdiWriter = null;
     }
     if (SharedImages == null)
     {
         return;
     }
     foreach (Image value in SharedImages.Values)
     {
         value.Dispose();
     }
     SharedImages = null;
 }
        private void GetSortImage(GdiWriter writer, out Bitmap image, out SortOrder nextOrder)
        {
            string key = null;

            nextOrder = SortOrder.Descending;
            switch (((RPLTextBoxProps)InstanceProperties).SortState)
            {
            case RPLFormat.SortOptions.None:
                nextOrder = SortOrder.Ascending;
                key       = "unsorted";
                break;

            case RPLFormat.SortOptions.Ascending:
                key = "sortAsc";
                break;

            case RPLFormat.SortOptions.Descending:
                nextOrder = SortOrder.Ascending;
                key       = "sortDesc";
                break;
            }
            image = GdiContext.ImageResources[key];
            float num  = writer.ConvertToMillimeters(image.Width);
            float num2 = writer.ConvertToMillimeters(image.Height);

            if (m_sortRectangleMM == RectangleF.Empty)
            {
                float num3 = Math.Max(TextPosition.Right - num, TextPosition.X) - 0.34f;
                float num4 = TextPosition.Y + 0.34f;
                if (TextPosition.Height < num2 + 0.34f)
                {
                    num2  = TextPosition.Height;
                    num4 -= 0.34f;
                }
                if (TextPosition.Width < num + 0.34f)
                {
                    num   = TextPosition.Width;
                    num3 += 0.34f;
                }
                m_sortRectangleMM = new RectangleF(num3, num4, num, num2);
            }
        }
        private void GetToggleImage(GdiWriter writer, out Bitmap image)
        {
            image = GdiContext.ImageResources[((RPLTextBoxProps)InstanceProperties).ToggleState ? "toggleMinus" : "togglePlus"];
            float num  = writer.ConvertToMillimeters(image.Width);
            float num2 = writer.ConvertToMillimeters(image.Height);

            if (m_toggleRectangleMM == RectangleF.Empty)
            {
                float num3 = TextPosition.X + 1f;
                float num4 = TextPosition.Y + 1f;
                if (TextPosition.Height < num2 + 1f)
                {
                    num2  = TextPosition.Height;
                    num4 -= 1f;
                }
                if (TextPosition.Width < num + 1f)
                {
                    num   = TextPosition.Width;
                    num3 -= 1f;
                }
                m_toggleRectangleMM = new RectangleF(num3, num4, num, num2);
            }
        }
        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);
                }
            }
        }
Exemplo n.º 5
0
        internal void ProcessBorders(GdiWriter writer, RPLItemProps properties, RectangleF bounds, byte state)
        {
            RPLFormat.BorderStyles stylePropertyValueBorderStyle = SharedRenderer.GetStylePropertyValueBorderStyle(properties, 5, RPLFormat.BorderStyles.None);
            m_borderLeft.Style   = SharedRenderer.GetStylePropertyValueBorderStyle(properties, 6, stylePropertyValueBorderStyle);
            m_borderRight.Style  = SharedRenderer.GetStylePropertyValueBorderStyle(properties, 7, stylePropertyValueBorderStyle);
            m_borderTop.Style    = SharedRenderer.GetStylePropertyValueBorderStyle(properties, 8, stylePropertyValueBorderStyle);
            m_borderBottom.Style = SharedRenderer.GetStylePropertyValueBorderStyle(properties, 9, stylePropertyValueBorderStyle);
            if (m_borderLeft.Style == RPLFormat.BorderStyles.None && m_borderRight.Style == RPLFormat.BorderStyles.None && m_borderTop.Style == RPLFormat.BorderStyles.None && m_borderBottom.Style == RPLFormat.BorderStyles.None)
            {
                return;
            }
            float stylePropertyValueSizeMM = GdiContext.GetStylePropertyValueSizeMM(properties, 10);

            m_borderLeft.Width = GdiContext.GetStylePropertyValueSizeMM(properties, 11);
            if (float.IsNaN(m_borderLeft.Width) && !float.IsNaN(stylePropertyValueSizeMM))
            {
                m_borderLeft.Width = stylePropertyValueSizeMM;
            }
            m_borderRight.Width = GdiContext.GetStylePropertyValueSizeMM(properties, 12);
            if (float.IsNaN(m_borderRight.Width) && !float.IsNaN(stylePropertyValueSizeMM))
            {
                m_borderRight.Width = stylePropertyValueSizeMM;
            }
            m_borderTop.Width = GdiContext.GetStylePropertyValueSizeMM(properties, 13);
            if (float.IsNaN(m_borderTop.Width) && !float.IsNaN(stylePropertyValueSizeMM))
            {
                m_borderTop.Width = stylePropertyValueSizeMM;
            }
            m_borderBottom.Width = GdiContext.GetStylePropertyValueSizeMM(properties, 14);
            if (float.IsNaN(m_borderBottom.Width) && !float.IsNaN(stylePropertyValueSizeMM))
            {
                m_borderBottom.Width = stylePropertyValueSizeMM;
            }
            if (!float.IsNaN(m_borderLeft.Width) || !float.IsNaN(m_borderRight.Width) || !float.IsNaN(m_borderTop.Width) || !float.IsNaN(m_borderBottom.Width))
            {
                Color stylePropertyValueColor = GdiContext.GetStylePropertyValueColor(properties, 0);
                m_borderLeft.Color = GdiContext.GetStylePropertyValueColor(properties, 1);
                if (m_borderLeft.Color == Color.Empty && stylePropertyValueColor != Color.Empty)
                {
                    m_borderLeft.Color = stylePropertyValueColor;
                }
                m_borderRight.Color = GdiContext.GetStylePropertyValueColor(properties, 2);
                if (m_borderRight.Color == Color.Empty && stylePropertyValueColor != Color.Empty)
                {
                    m_borderRight.Color = stylePropertyValueColor;
                }
                m_borderTop.Color = GdiContext.GetStylePropertyValueColor(properties, 3);
                if (m_borderTop.Color == Color.Empty && stylePropertyValueColor != Color.Empty)
                {
                    m_borderTop.Color = stylePropertyValueColor;
                }
                m_borderBottom.Color = GdiContext.GetStylePropertyValueColor(properties, 4);
                if (m_borderBottom.Color == Color.Empty && stylePropertyValueColor != Color.Empty)
                {
                    m_borderBottom.Color = stylePropertyValueColor;
                }
                if (!(m_borderLeft.Color == Color.Empty) || !(m_borderRight.Color == Color.Empty) || !(m_borderTop.Color == Color.Empty) || !(m_borderBottom.Color == Color.Empty))
                {
                    ProcessBorders(writer, ref m_borderTop, ref m_borderLeft, ref m_borderBottom, ref m_borderRight, base.Position, bounds, state);
                }
            }
        }
Exemplo n.º 6
0
        internal static void ProcessBorders(GdiWriter writer, ref RenderingItemBorder top, ref RenderingItemBorder left, ref RenderingItemBorder bottom, ref RenderingItemBorder right, RectangleF position, RectangleF bounds, byte state)
        {
            if (!top.IsVisible && !left.IsVisible && !bottom.IsVisible && !right.IsVisible)
            {
                return;
            }
            left.Point = position.Left;
            left.Edge  = position.Left;
            float borderLeftEdgeUnclipped = 0f;

            right.Point = position.Right;
            right.Edge  = position.Right;
            float borderRightEdgeUnclipped = 0f;

            top.Point = position.Top;
            top.Edge  = position.Top;
            float borderTopEdgeUnclipped = 0f;

            bottom.Point = position.Bottom;
            bottom.Edge  = position.Bottom;
            float borderBottomEdgeUnclipped = 0f;
            float width  = left.Width;
            float width2 = right.Width;
            float width3 = top.Width;
            float width4 = bottom.Width;

            if (left.Style == RPLFormat.BorderStyles.Double && left.Width < 0.5292f)
            {
                left.Style = RPLFormat.BorderStyles.Solid;
            }
            if (right.Style == RPLFormat.BorderStyles.Double && right.Width < 0.5292f)
            {
                right.Style = RPLFormat.BorderStyles.Solid;
            }
            if (top.Style == RPLFormat.BorderStyles.Double && top.Width < 0.5292f)
            {
                top.Style = RPLFormat.BorderStyles.Solid;
            }
            if (bottom.Style == RPLFormat.BorderStyles.Double && bottom.Width < 0.5292f)
            {
                bottom.Style = RPLFormat.BorderStyles.Solid;
            }
            if (left.IsVisible)
            {
                left.Edge -= left.Width / 2f;
                borderLeftEdgeUnclipped = left.Edge;
                if (left.Edge < bounds.Left)
                {
                    float num = bounds.Left - left.Edge;
                    left.Width -= num;
                    left.Point += num / 2f;
                    left.Edge   = bounds.Left;
                }
            }
            else
            {
                left.Width = 0f;
            }
            if (right.IsVisible)
            {
                right.Edge += right.Width / 2f;
                borderRightEdgeUnclipped = right.Edge;
                if (right.Edge > bounds.Right)
                {
                    float num2 = right.Edge - bounds.Right;
                    right.Width -= num2;
                    right.Point -= num2 / 2f;
                    right.Edge   = bounds.Right;
                }
            }
            else
            {
                right.Width = 0f;
            }
            if (top.IsVisible)
            {
                top.Edge -= top.Width / 2f;
                borderTopEdgeUnclipped = top.Edge;
                if (top.Edge < bounds.Top)
                {
                    float num3 = bounds.Top - top.Edge;
                    top.Width -= num3;
                    top.Point += num3 / 2f;
                    top.Edge   = bounds.Top;
                }
            }
            else
            {
                top.Width = 0f;
            }
            if (bottom.IsVisible)
            {
                bottom.Edge += bottom.Width / 2f;
                borderBottomEdgeUnclipped = bottom.Edge;
                if (bottom.Edge > bounds.Bottom)
                {
                    float num4 = bottom.Edge - bounds.Bottom;
                    bottom.Width -= num4;
                    bottom.Point -= num4 / 2f;
                    bottom.Edge   = bounds.Bottom;
                }
            }
            else
            {
                bottom.Width = 0f;
            }
            left.Edge   = Math.Max(bounds.Left, left.Edge);
            right.Edge  = Math.Min(bounds.Right, right.Edge);
            top.Edge    = Math.Max(bounds.Top, top.Edge);
            bottom.Edge = Math.Min(bounds.Bottom, bottom.Edge);
            if (top.Style != RPLFormat.BorderStyles.Double && state == 0 && top.Style == left.Style && top.Style == bottom.Style && top.Style == right.Style && top.Width == left.Width && top.Width == bottom.Width && top.Width == right.Width && top.Color == left.Color && top.Color == bottom.Color && top.Color == right.Color)
            {
                RectangleF rectangle = new RectangleF(left.Point, top.Point, right.Point - left.Point, bottom.Point - top.Point);
                top.Operations = new List <Operation>(1);
                top.Operations.Add(new DrawRectangleOp(top.Color, top.Width, top.Style, rectangle));
                return;
            }
            float halfPixelWidthX = writer.HalfPixelWidthX;
            float halfPixelWidthY = writer.HalfPixelWidthY;
            float num5            = Math.Min(halfPixelWidthY, top.Width / 2f);
            float num6            = Math.Min(halfPixelWidthX, left.Width / 2f);
            float num7            = Math.Min(halfPixelWidthY, bottom.Width / 2f);
            float num8            = Math.Min(halfPixelWidthX, right.Width / 2f);

            top.Operations = new List <Operation>();
            SharedRenderer.ProcessTopBorder(writer, top.Operations, top.Width, top.Style, top.Color, left.Color, right.Color, top.Point, top.Edge, left.Edge + num6, right.Edge - num8, borderTopEdgeUnclipped, borderLeftEdgeUnclipped, borderRightEdgeUnclipped, left.Width, right.Width, width3, width, width2);
            right.Operations = new List <Operation>();
            SharedRenderer.ProcessRightBorder(writer, right.Operations, right.Width, right.Style, right.Color, top.Color, bottom.Color, right.Point, right.Edge, top.Edge + num5, bottom.Edge - num7, borderRightEdgeUnclipped, borderTopEdgeUnclipped, borderBottomEdgeUnclipped, top.Width, bottom.Width, width2, width3, width4);
            left.Operations = new List <Operation>();
            SharedRenderer.ProcessLeftBorder(writer, left.Operations, left.Width, left.Style, left.Color, top.Color, bottom.Color, left.Point, left.Edge, top.Edge + num5, bottom.Edge - num7, borderLeftEdgeUnclipped, borderTopEdgeUnclipped, borderBottomEdgeUnclipped, top.Width, bottom.Width, width, width3, width4);
            bottom.Operations = new List <Operation>();
            SharedRenderer.ProcessBottomBorder(writer, bottom.Operations, bottom.Width, bottom.Style, bottom.Color, left.Color, right.Color, bottom.Point, bottom.Edge, left.Edge + num6, right.Edge - num8, borderBottomEdgeUnclipped, borderLeftEdgeUnclipped, borderRightEdgeUnclipped, left.Width, right.Width, width4, width, width2);
        }