Ejemplo n.º 1
0
        public void AddCellDiagonal(int cellIndex, RPLFormat.BorderStyles style, string width, string color, bool slantUp)
        {
            BorderCode borderCode = new BorderCode();
            byte       b          = (byte)(slantUp ? 32 : 16);

            borderCode.Ico24 = Word97Writer.ToIco24(color);
            double num = Word97Writer.ToPoints(width);

            borderCode.LineWidth = (byte)(num * 8.0);
            borderCode.Style     = this.ConvertBorderStyle(style);
            byte[] array = new byte[11]
            {
                (byte)cellIndex,
                (byte)(cellIndex + 1),
                b,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0
            };
            borderCode.Serialize2K3(array, 3);
            this.m_tapx.AddSprm(54831, 0, array);
        }
Ejemplo n.º 2
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);
        }
        private OpenXmlBorderPropertiesModel.BorderStyle RPLFormatToBorderStyle(RPLFormat.BorderStyles style)
        {
            OpenXmlBorderPropertiesModel.BorderStyle result = OpenXmlBorderPropertiesModel.BorderStyle.None;
            switch (style)
            {
            case RPLFormat.BorderStyles.Dashed:
                result = OpenXmlBorderPropertiesModel.BorderStyle.Dashed;
                break;

            case RPLFormat.BorderStyles.Dotted:
                result = OpenXmlBorderPropertiesModel.BorderStyle.Dotted;
                break;

            case RPLFormat.BorderStyles.Double:
                result = OpenXmlBorderPropertiesModel.BorderStyle.Double;
                break;

            case RPLFormat.BorderStyles.None:
                result = OpenXmlBorderPropertiesModel.BorderStyle.None;
                break;

            case RPLFormat.BorderStyles.Solid:
                result = OpenXmlBorderPropertiesModel.BorderStyle.Solid;
                break;
            }
            return(result);
        }
 private void SetBorderStyle(IHaveABorderAndShading borderHolder, RPLFormat.BorderStyles style)
 {
     this.SetBorderStyle(borderHolder, style, TableData.Positions.Top);
     this.SetBorderStyle(borderHolder, style, TableData.Positions.Bottom);
     this.SetBorderStyle(borderHolder, style, TableData.Positions.Left);
     this.SetBorderStyle(borderHolder, style, TableData.Positions.Right);
 }
Ejemplo n.º 5
0
 public DrawRectangleOp(Color color, float width, RPLFormat.BorderStyles style, RectangleF rectangle)
 {
     this.Color     = color;
     this.Width     = width;
     this.Style     = style;
     this.Rectangle = rectangle;
 }
Ejemplo n.º 6
0
 private void SetDefaultBorderStyle(RPLFormat.BorderStyles style)
 {
     for (int i = 0; i < this.m_tableBorders.Length; i++)
     {
         this.m_tableBorders[i].Style = this.ConvertBorderStyle(style);
     }
 }
Ejemplo n.º 7
0
 internal DrawRectangleOp(Color color, float width, RPLFormat.BorderStyles style, RectangleF rectangle)
 {
     Color     = color;
     Width     = width;
     Style     = style;
     Rectangle = rectangle;
 }
Ejemplo n.º 8
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);
        }
        public void WriteCellDiagonal(int cellIndex, RPLFormat.BorderStyles style, string width, string color, bool slantUp)
        {
            OpenXmlTableCellModel        currentCell = this._document.TableContext.CurrentCell;
            OpenXmlBorderPropertiesModel openXmlBorderPropertiesModel = slantUp ? currentCell.CellProperties.BorderDiagonalUp : currentCell.CellProperties.BorderDiagonalDown;

            openXmlBorderPropertiesModel.Color = WordOpenXmlUtils.RgbColor(new RPLReportColor(color).ToColor());
            openXmlBorderPropertiesModel.Style = this.RPLFormatToBorderStyle(style);
            openXmlBorderPropertiesModel.WidthInEighthPoints = (int)Math.Floor(new RPLReportSize(width).ToPoints() * 8.0);
        }
Ejemplo n.º 10
0
        private void SetCellBorderStyle(int cellIndex, RPLFormat.BorderStyles borderStyle)
        {
            LineStyle style = this.ConvertBorderStyle(borderStyle);

            for (int i = 0; i < this.m_cellBorders.Length; i++)
            {
                this.m_cellBorders[i].Style = style;
            }
        }
Ejemplo n.º 11
0
 internal DrawLineOp(Color color, float width, RPLFormat.BorderStyles style, float x1, float y1, float x2, float y2)
 {
     Color = color;
     Width = width;
     Style = style;
     X1    = x1;
     Y1    = y1;
     X2    = x2;
     Y2    = y2;
 }
Ejemplo n.º 12
0
 public DrawLineOp(Color color, float width, RPLFormat.BorderStyles style, float x1, float y1, float x2, float y2)
 {
     this.Color = color;
     this.Width = width;
     this.Style = style;
     this.X1    = x1;
     this.Y1    = y1;
     this.X2    = x2;
     this.Y2    = y2;
 }
Ejemplo n.º 13
0
        private static string GetKey(Color color, float size, RPLFormat.BorderStyles style)
        {
            string text = color.ToString() + size;

            if ((int)(style & RPLFormat.BorderStyles.Dashed) > 0)
            {
                text += "s";
            }
            if ((int)(style & RPLFormat.BorderStyles.Dotted) > 0)
            {
                text += "t";
            }
            if ((int)(style & RPLFormat.BorderStyles.Solid) > 0)
            {
                text += "d";
            }
            return(text);
        }
Ejemplo n.º 14
0
        internal static ExcelBorderStyle ToBorderLineStyle(RPLFormat.BorderStyles val)
        {
            switch (val)
            {
            case RPLFormat.BorderStyles.Dotted:
                return(ExcelBorderStyle.Dotted);

            case RPLFormat.BorderStyles.Dashed:
                return(ExcelBorderStyle.Dashed);

            case RPLFormat.BorderStyles.Solid:
                return(ExcelBorderStyle.Medium);

            case RPLFormat.BorderStyles.Double:
                return(ExcelBorderStyle.Double);

            default:
                return(ExcelBorderStyle.None);
            }
        }
        private void SetBorderStyle(IHaveABorderAndShading borderHolder, RPLFormat.BorderStyles style, TableData.Positions side)
        {
            OpenXmlBorderPropertiesModel.BorderStyle style2 = this.RPLFormatToBorderStyle(style);
            switch (side)
            {
            case TableData.Positions.Top:
                borderHolder.BorderTop.Style = style2;
                break;

            case TableData.Positions.Bottom:
                borderHolder.BorderBottom.Style = style2;
                break;

            case TableData.Positions.Left:
                borderHolder.BorderLeft.Style = style2;
                break;

            case TableData.Positions.Right:
                borderHolder.BorderRight.Style = style2;
                break;
            }
        }
Ejemplo n.º 16
0
        private LineStyle ConvertBorderStyle(RPLFormat.BorderStyles style)
        {
            switch (style)
            {
            case RPLFormat.BorderStyles.Dashed:
                return(LineStyle.DashSmallGap);

            case RPLFormat.BorderStyles.Dotted:
                return(LineStyle.Dot);

            case RPLFormat.BorderStyles.Double:
                return(LineStyle.Double);

            case RPLFormat.BorderStyles.None:
                return(LineStyle.None);

            case RPLFormat.BorderStyles.Solid:
                return(LineStyle.Single);

            default:
                return(LineStyle.None);
            }
        }
Ejemplo n.º 17
0
        public static string GetValue(RPLFormat.BorderStyles val)
        {
            switch (val)
            {
            case RPLFormat.BorderStyles.None:
                return("none");

            case RPLFormat.BorderStyles.Dotted:
                return("dotted");

            case RPLFormat.BorderStyles.Dashed:
                return("dashed");

            case RPLFormat.BorderStyles.Solid:
                return("solid");

            case RPLFormat.BorderStyles.Double:
                return("double");

            default:
                return(null);
            }
        }
Ejemplo n.º 18
0
 public virtual void DrawRectangle(Color color, float size, RPLFormat.BorderStyles style, RectangleF rectangle)
 {
 }
Ejemplo n.º 19
0
        internal static void ProcessBottomBorder(WriterBase writer, List <Operation> operations, float borderWidthBottom, RPLFormat.BorderStyles borderStyleBottom, Color borderColorBottom, Color borderColorLeft, Color borderColorRight, float borderBottom, float borderBottomEdge, float borderLeftEdge, float borderRightEdge, float borderBottomEdgeUnclipped, float borderLeftEdgeUnclipped, float borderRightEdgeUnclipped, float borderWidthLeft, float borderWidthRight, float borderWidthBottomUnclipped, float borderWidthLeftUnclipped, float borderWidthRightUnclipped)
        {
            switch (borderStyleBottom)
            {
            case RPLFormat.BorderStyles.None:
                return;

            case RPLFormat.BorderStyles.Solid:
                if (borderWidthBottom > writer.HalfPixelWidthY * 2f && ((borderWidthLeft > 0f && borderColorBottom != borderColorLeft) || (borderWidthRight > 0f && borderColorBottom != borderColorRight)))
                {
                    PointF[] polygon = new PointF[4]
                    {
                        new PointF(borderLeftEdge, borderBottomEdge),
                        new PointF(borderRightEdge, borderBottomEdge),
                        new PointF(borderRightEdge - borderWidthRight, borderBottomEdge - borderWidthBottom),
                        new PointF(borderLeftEdge + borderWidthLeft, borderBottomEdge - borderWidthBottom)
                    };
                    if (operations == null)
                    {
                        writer.FillPolygon(borderColorBottom, polygon);
                    }
                    else
                    {
                        operations.Add(new FillPolygonOp(borderColorBottom, polygon));
                    }
                    return;
                }
                break;
            }
            if (borderStyleBottom == RPLFormat.BorderStyles.Double)
            {
                PointF[] array = new PointF[4];
                float    num   = borderWidthBottomUnclipped / 3f;
                if (borderBottomEdge >= borderBottomEdgeUnclipped - num)
                {
                    float num2 = Math.Max(borderWidthLeft - borderWidthLeftUnclipped / 3f * 2f, 0f);
                    float num3 = Math.Max(borderWidthRight - borderWidthRightUnclipped / 3f * 2f, 0f);
                    array[0] = new PointF(borderLeftEdge, borderBottomEdge);
                    array[1] = new PointF(borderRightEdge, borderBottomEdge);
                    array[2] = new PointF(borderRightEdge - num3, borderBottomEdgeUnclipped - num);
                    array[3] = new PointF(borderLeftEdge + num2, borderBottomEdgeUnclipped - num);
                    if (operations == null)
                    {
                        writer.FillPolygon(borderColorBottom, array);
                    }
                    else
                    {
                        operations.Add(new FillPolygonOp(borderColorBottom, array));
                    }
                }
                array = new PointF[4];
                float num4 = borderBottomEdgeUnclipped - borderWidthBottomUnclipped / 3f * 2f;
                float x;
                float x2;
                if (borderWidthLeft > 0f)
                {
                    x  = borderLeftEdgeUnclipped + borderWidthLeftUnclipped / 3f * 2f;
                    x2 = borderLeftEdgeUnclipped + borderWidthLeftUnclipped;
                }
                else
                {
                    x = (x2 = borderLeftEdge);
                }
                float x3;
                float x4;
                if (borderWidthRight > 0f)
                {
                    x3 = borderRightEdgeUnclipped - borderWidthRightUnclipped / 3f * 2f;
                    x4 = borderRightEdgeUnclipped - borderWidthRightUnclipped;
                }
                else
                {
                    x3 = (x4 = borderRightEdge);
                }
                array[0] = new PointF(x, num4);
                array[1] = new PointF(x3, num4);
                array[2] = new PointF(x4, num4 - num);
                array[3] = new PointF(x2, num4 - num);
                if (operations == null)
                {
                    writer.FillPolygon(borderColorBottom, array);
                }
                else
                {
                    operations.Add(new FillPolygonOp(borderColorBottom, array));
                }
            }
            else if (operations == null)
            {
                writer.DrawLine(borderColorBottom, borderWidthBottom, borderStyleBottom, borderLeftEdge, borderBottom, borderRightEdge, borderBottom);
            }
            else
            {
                operations.Add(new DrawLineOp(borderColorBottom, borderWidthBottom, borderStyleBottom, borderLeftEdge, borderBottom, borderRightEdge, borderBottom));
            }
        }
Ejemplo n.º 20
0
 public void WriteCellDiagonal(int cellIndex, RPLFormat.BorderStyles style, string width, string color, bool slantUp)
 {
     this.m_currentRow.AddCellDiagonal(cellIndex, style, width, color, slantUp);
 }
Ejemplo n.º 21
0
        internal static Pen GetPen(Dictionary <string, Pen> pens, Color color, float size, RPLFormat.BorderStyles style)
        {
            string key = GetKey(color, size, style);

            if (pens.TryGetValue(key, out Pen value))
            {
                return(value);
            }
            value = new Pen(color, size);
            switch (style)
            {
            case RPLFormat.BorderStyles.Dashed:
                value.DashStyle = DashStyle.Dash;
                break;

            case RPLFormat.BorderStyles.Dotted:
                value.DashStyle = DashStyle.Dot;
                break;
            }
            pens.Add(key, value);
            return(value);
        }
Ejemplo n.º 22
0
        internal static void ProcessLeftBorder(WriterBase writer, List <Operation> operations, float borderWidthLeft, RPLFormat.BorderStyles borderStyleLeft, Color borderColorLeft, Color borderColorTop, Color borderColorBottom, float borderLeft, float borderLeftEdge, float borderTopEdge, float borderBottomEdge, float borderLeftEdgeUnclipped, float borderTopEdgeUnclipped, float borderBottomEdgeUnclipped, float borderWidthTop, float borderWidthBottom, float borderWidthLeftUnclipped, float borderWidthTopUnclipped, float borderWidthBottomUnclipped)
        {
            switch (borderStyleLeft)
            {
            case RPLFormat.BorderStyles.None:
                return;

            case RPLFormat.BorderStyles.Solid:
                if (borderWidthLeft > writer.HalfPixelWidthX * 2f && ((borderWidthTop > 0f && borderColorLeft != borderColorTop) || (borderWidthBottom > 0f && borderColorLeft != borderColorBottom)))
                {
                    PointF[] polygon = new PointF[4]
                    {
                        new PointF(borderLeftEdge, borderTopEdge),
                        new PointF(borderLeftEdge, borderBottomEdge),
                        new PointF(borderLeftEdge + borderWidthLeft, borderBottomEdge - borderWidthBottom),
                        new PointF(borderLeftEdge + borderWidthLeft, borderTopEdge + borderWidthTop)
                    };
                    if (operations == null)
                    {
                        writer.FillPolygon(borderColorLeft, polygon);
                    }
                    else
                    {
                        operations.Add(new FillPolygonOp(borderColorLeft, polygon));
                    }
                    return;
                }
                break;
            }
            if (borderStyleLeft == RPLFormat.BorderStyles.Double)
            {
                PointF[] array = new PointF[4];
                float    num   = borderWidthLeftUnclipped / 3f;
                if (borderLeftEdge <= borderLeftEdgeUnclipped + num)
                {
                    float num2 = Math.Max(borderWidthTop - borderWidthTopUnclipped / 3f * 2f, 0f);
                    float num3 = Math.Max(borderWidthBottom - borderWidthBottomUnclipped / 3f * 2f, 0f);
                    array[0] = new PointF(borderLeftEdge, borderTopEdge);
                    array[1] = new PointF(borderLeftEdge, borderBottomEdge);
                    array[2] = new PointF(borderLeftEdgeUnclipped + num, borderBottomEdge - num3);
                    array[3] = new PointF(borderLeftEdgeUnclipped + num, borderTopEdge + num2);
                    if (operations == null)
                    {
                        writer.FillPolygon(borderColorLeft, array);
                    }
                    else
                    {
                        operations.Add(new FillPolygonOp(borderColorLeft, array));
                    }
                }
                array = new PointF[4];
                float num4 = borderLeftEdgeUnclipped + borderWidthLeftUnclipped / 3f * 2f;
                float y;
                float y2;
                if (borderWidthTop > 0f)
                {
                    y  = borderTopEdgeUnclipped + borderWidthTopUnclipped / 3f * 2f;
                    y2 = borderTopEdgeUnclipped + borderWidthTopUnclipped;
                }
                else
                {
                    y = (y2 = borderTopEdge);
                }
                float y3;
                float y4;
                if (borderWidthBottom > 0f)
                {
                    y3 = borderBottomEdgeUnclipped - borderWidthBottomUnclipped / 3f * 2f;
                    y4 = borderBottomEdgeUnclipped - borderWidthBottomUnclipped;
                }
                else
                {
                    y3 = (y4 = borderBottomEdge);
                }
                array[0] = new PointF(num4, y);
                array[1] = new PointF(num4, y3);
                array[2] = new PointF(num4 + num, y4);
                array[3] = new PointF(num4 + num, y2);
                if (operations == null)
                {
                    writer.FillPolygon(borderColorLeft, array);
                }
                else
                {
                    operations.Add(new FillPolygonOp(borderColorLeft, array));
                }
            }
            else if (operations == null)
            {
                writer.DrawLine(borderColorLeft, borderWidthLeft, borderStyleLeft, borderLeft, borderTopEdge, borderLeft, borderBottomEdge);
            }
            else
            {
                operations.Add(new DrawLineOp(borderColorLeft, borderWidthLeft, borderStyleLeft, borderLeft, borderTopEdge, borderLeft, borderBottomEdge));
            }
        }
        public static RPLFormat.BorderStyles GetStylePropertyValueBorderStyle(RPLElementStyle properties, byte style, RPLFormat.BorderStyles defaultStyle)
        {
            object obj = properties[style];

            if (obj != null)
            {
                return((RPLFormat.BorderStyles)obj);
            }
            return(defaultStyle);
        }
        public static RPLFormat.BorderStyles GetStylePropertyValueBorderStyle(RPLElementProps properties, byte style, RPLFormat.BorderStyles defaultStyle)
        {
            object stylePropertyValueObject = SharedRenderer.GetStylePropertyValueObject(properties, style);

            if (stylePropertyValueObject != null)
            {
                return((RPLFormat.BorderStyles)stylePropertyValueObject);
            }
            return(defaultStyle);
        }
        public static void ProcessRightBorder(WriterBase writer, List <Operation> operations, float borderWidthRight, RPLFormat.BorderStyles borderStyleRight, Color borderColorRight, Color borderColorTop, Color borderColorBottom, float borderRight, float borderRightEdge, float borderTopEdge, float borderBottomEdge, float borderRightEdgeUnclipped, float borderTopEdgeUnclipped, float borderBottomEdgeUnclipped, float borderWidthTop, float borderWidthBottom, float borderWidthRightUnclipped, float borderWidthTopUnclipped, float borderWidthBottomUnclipped)
        {
            switch (borderStyleRight)
            {
            case RPLFormat.BorderStyles.None:
                return;

            case RPLFormat.BorderStyles.Solid:
            {
                if (!(borderWidthRight > writer.HalfPixelWidthX * 2.0))
                {
                    break;
                }
                if (!(borderWidthTop > 0.0) || !(borderColorRight != borderColorTop))
                {
                    if (!(borderWidthBottom > 0.0))
                    {
                        break;
                    }
                    if (!(borderColorRight != borderColorBottom))
                    {
                        break;
                    }
                }
                PointF[] polygon = new PointF[4]
                {
                    new PointF(borderRightEdge, borderTopEdge),
                    new PointF(borderRightEdge, borderBottomEdge),
                    new PointF(borderRightEdge - borderWidthRight, borderBottomEdge - borderWidthBottom),
                    new PointF(borderRightEdge - borderWidthRight, borderTopEdge + borderWidthTop)
                };
                if (operations == null)
                {
                    writer.FillPolygon(borderColorRight, polygon);
                }
                else
                {
                    operations.Add(new FillPolygonOp(borderColorRight, polygon));
                }
                return;
            }
            }
            if (borderStyleRight == RPLFormat.BorderStyles.Double)
            {
                PointF[] array = new PointF[4];
                float    num   = (float)(borderWidthRightUnclipped / 3.0);
                if (borderRightEdge >= borderRightEdgeUnclipped - num)
                {
                    float num2 = Math.Max((float)(borderWidthTop - borderWidthTopUnclipped / 3.0 * 2.0), 0f);
                    float num3 = Math.Max((float)(borderWidthBottom - borderWidthBottomUnclipped / 3.0 * 2.0), 0f);
                    array[0] = new PointF(borderRightEdge, borderTopEdge);
                    array[1] = new PointF(borderRightEdge, borderBottomEdge);
                    array[2] = new PointF(borderRightEdgeUnclipped - num, borderBottomEdge - num3);
                    array[3] = new PointF(borderRightEdgeUnclipped - num, borderTopEdge + num2);
                    if (operations == null)
                    {
                        writer.FillPolygon(borderColorRight, array);
                    }
                    else
                    {
                        operations.Add(new FillPolygonOp(borderColorRight, array));
                    }
                }
                array = new PointF[4];
                float num4 = (float)(borderRightEdgeUnclipped - borderWidthRightUnclipped / 3.0 * 2.0);
                float y;
                float y2;
                if (borderWidthTop > 0.0)
                {
                    y  = (float)(borderTopEdgeUnclipped + borderWidthTopUnclipped / 3.0 * 2.0);
                    y2 = borderTopEdgeUnclipped + borderWidthTopUnclipped;
                }
                else
                {
                    y = (y2 = borderTopEdge);
                }
                float y3;
                float y4;
                if (borderWidthBottom > 0.0)
                {
                    y3 = (float)(borderBottomEdgeUnclipped - borderWidthBottomUnclipped / 3.0 * 2.0);
                    y4 = borderBottomEdgeUnclipped - borderWidthBottomUnclipped;
                }
                else
                {
                    y3 = (y4 = borderBottomEdge);
                }
                array[0] = new PointF(num4, y);
                array[1] = new PointF(num4, y3);
                array[2] = new PointF(num4 - num, y4);
                array[3] = new PointF(num4 - num, y2);
                if (operations == null)
                {
                    writer.FillPolygon(borderColorRight, array);
                }
                else
                {
                    operations.Add(new FillPolygonOp(borderColorRight, array));
                }
            }
            else if (operations == null)
            {
                writer.DrawLine(borderColorRight, borderWidthRight, borderStyleRight, borderRight, borderTopEdge, borderRight, borderBottomEdge);
            }
            else
            {
                operations.Add(new DrawLineOp(borderColorRight, borderWidthRight, borderStyleRight, borderRight, borderTopEdge, borderRight, borderBottomEdge));
            }
        }
        public static void ProcessTopBorder(WriterBase writer, List <Operation> operations, float borderWidthTop, RPLFormat.BorderStyles borderStyleTop, Color borderColorTop, Color borderColorLeft, Color borderColorRight, float borderTop, float borderTopEdge, float borderLeftEdge, float borderRightEdge, float borderTopEdgeUnclipped, float borderLeftEdgeUnclipped, float borderRightEdgeUnclipped, float borderWidthLeft, float borderWidthRight, float borderWidthTopUnclipped, float borderWidthLeftUnclipped, float borderWidthRightUnclipped)
        {
            switch (borderStyleTop)
            {
            case RPLFormat.BorderStyles.None:
                return;

            case RPLFormat.BorderStyles.Solid:
            {
                if (!(borderWidthTop > writer.HalfPixelWidthY * 2.0))
                {
                    break;
                }
                if (!(borderWidthLeft > 0.0) || !(borderColorTop != borderColorLeft))
                {
                    if (!(borderWidthRight > 0.0))
                    {
                        break;
                    }
                    if (!(borderColorTop != borderColorRight))
                    {
                        break;
                    }
                }
                PointF[] polygon = new PointF[4]
                {
                    new PointF(borderLeftEdge, borderTopEdge),
                    new PointF(borderRightEdge, borderTopEdge),
                    new PointF(borderRightEdge - borderWidthRight, borderTopEdge + borderWidthTop),
                    new PointF(borderLeftEdge + borderWidthLeft, borderTopEdge + borderWidthTop)
                };
                if (operations == null)
                {
                    writer.FillPolygon(borderColorTop, polygon);
                }
                else
                {
                    operations.Add(new FillPolygonOp(borderColorTop, polygon));
                }
                return;
            }
            }
            if (borderStyleTop == RPLFormat.BorderStyles.Double)
            {
                PointF[] array = new PointF[4];
                float    num   = (float)(borderWidthTopUnclipped / 3.0);
                if (borderTopEdge <= borderTopEdgeUnclipped + num)
                {
                    float num2 = Math.Max((float)(borderWidthLeft - borderWidthLeftUnclipped / 3.0 * 2.0), 0f);
                    float num3 = Math.Max((float)(borderWidthRight - borderWidthRightUnclipped / 3.0 * 2.0), 0f);
                    array[0] = new PointF(borderLeftEdge, borderTopEdge);
                    array[1] = new PointF(borderRightEdge, borderTopEdge);
                    array[2] = new PointF(borderRightEdge - num3, borderTopEdgeUnclipped + num);
                    array[3] = new PointF(borderLeftEdge + num2, borderTopEdgeUnclipped + num);
                    if (operations == null)
                    {
                        writer.FillPolygon(borderColorTop, array);
                    }
                    else
                    {
                        operations.Add(new FillPolygonOp(borderColorTop, array));
                    }
                }
                array = new PointF[4];
                float num4 = (float)(borderTopEdgeUnclipped + borderWidthTopUnclipped / 3.0 * 2.0);
                float x;
                float x2;
                if (borderWidthLeft > 0.0)
                {
                    x  = (float)(borderLeftEdgeUnclipped + borderWidthLeftUnclipped / 3.0 * 2.0);
                    x2 = borderLeftEdgeUnclipped + borderWidthLeftUnclipped;
                }
                else
                {
                    x = (x2 = borderLeftEdge);
                }
                float x3;
                float x4;
                if (borderWidthRight > 0.0)
                {
                    x3 = (float)(borderRightEdgeUnclipped - borderWidthRightUnclipped / 3.0 * 2.0);
                    x4 = borderRightEdgeUnclipped - borderWidthRightUnclipped;
                }
                else
                {
                    x3 = (x4 = borderRightEdge);
                }
                array[0] = new PointF(x, num4);
                array[1] = new PointF(x3, num4);
                array[2] = new PointF(x4, num4 + num);
                array[3] = new PointF(x2, num4 + num);
                if (operations == null)
                {
                    writer.FillPolygon(borderColorTop, array);
                }
                else
                {
                    operations.Add(new FillPolygonOp(borderColorTop, array));
                }
            }
            else if (operations == null)
            {
                writer.DrawLine(borderColorTop, borderWidthTop, borderStyleTop, borderLeftEdge, borderTop, borderRightEdge, borderTop);
            }
            else
            {
                operations.Add(new DrawLineOp(borderColorTop, borderWidthTop, borderStyleTop, borderLeftEdge, borderTop, borderRightEdge, borderTop));
            }
        }
Ejemplo n.º 27
0
 private void SetBorderStyle(RPLFormat.BorderStyles style, Positions position)
 {
     this.m_tableBorders[(int)position].Style = this.ConvertBorderStyle(style);
 }
Ejemplo n.º 28
0
        public static Pen GetPen(Dictionary <string, Pen> pens, Color color, float size, RPLFormat.BorderStyles style)
        {
            string key = GDIPen.GetKey(color, size, style);
            Pen    pen = default(Pen);

            if (pens.TryGetValue(key, out pen))
            {
                return(pen);
            }
            pen = new Pen(color, size);
            switch (style)
            {
            case RPLFormat.BorderStyles.Dashed:
                pen.DashStyle = DashStyle.Dash;
                break;

            case RPLFormat.BorderStyles.Dotted:
                pen.DashStyle = DashStyle.Dot;
                break;
            }
            pens.Add(key, pen);
            return(pen);
        }
Ejemplo n.º 29
0
        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);
                }
            }
        }
Ejemplo n.º 30
0
 private void SetCellBorderStyle(int cellIndex, RPLFormat.BorderStyles borderStyle, Positions position)
 {
     this.m_cellBorders[(int)position].Style = this.ConvertBorderStyle(borderStyle);
 }