public override void WriteStyles(StyleWriterMode mode, IRPLStyle style)
        {
            string text = style[20] as string;

            if (text != null)
            {
                text = HTML4Renderer.HandleSpecialFontCharacters(text);
            }
            base.WriteStyle(HTML4Renderer.m_fontFamily, text);
            base.WriteStyle(HTML4Renderer.m_fontSize, style[21]);
            object obj   = style[22];
            string text2 = null;

            if (obj != null)
            {
                text2 = EnumStrings.GetValue((RPLFormat.FontWeights)obj);
                base.WriteStyle(HTML4Renderer.m_fontWeight, text2);
            }
            obj = style[19];
            if (obj != null)
            {
                text2 = EnumStrings.GetValue((RPLFormat.FontStyles)obj);
                base.WriteStyle(HTML4Renderer.m_fontStyle, text2);
            }
            obj = style[24];
            if (obj != null)
            {
                text2 = EnumStrings.GetValue((RPLFormat.TextDecorations)obj);
                base.WriteStyle(HTML4Renderer.m_textDecoration, text2);
            }
            base.WriteStyle(HTML4Renderer.m_color, style[27]);
        }
Ejemplo n.º 2
0
        private void RenderVMLLine(RPLLine line, RPLItemMeasurement measurement, StyleContext styleContext)
        {
            if (!this.hasSlantedLines)
            {
                this.html5Renderer.WriteStream("<?XML:NAMESPACE PREFIX=v /><?IMPORT NAMESPACE=\"v\" IMPLEMENTATION=\"#default#VML\" />");
                this.hasSlantedLines = true;
            }
            this.html5Renderer.WriteStream(HTMLElements.m_openVGroup);
            this.html5Renderer.WriteStream(HTMLElements.m_openStyle);
            this.html5Renderer.WriteStream(HTMLElements.m_styleWidth);
            if (styleContext.InTablix)
            {
                this.html5Renderer.WriteStream(HTMLElements.m_percent);
                this.html5Renderer.WriteStream(HTMLElements.m_semiColon);
                this.html5Renderer.WriteStream(HTMLElements.m_styleHeight);
                this.html5Renderer.WriteStream(HTMLElements.m_percent);
            }
            else
            {
                this.html5Renderer.WriteRSStream(measurement.Width);
                this.html5Renderer.WriteStream(HTMLElements.m_semiColon);
                this.html5Renderer.WriteStream(HTMLElements.m_styleHeight);
                this.html5Renderer.WriteRSStream(measurement.Height);
            }
            this.html5Renderer.WriteStream(HTMLElements.m_closeQuote);
            this.html5Renderer.WriteStream(HTMLElements.m_openVLine);
            if (((RPLLinePropsDef)line.ElementProps.Definition).Slant)
            {
                this.html5Renderer.WriteStream(HTMLElements.m_rightSlant);
            }
            else
            {
                this.html5Renderer.WriteStream(HTMLElements.m_leftSlant);
            }
            IRPLStyle style = line.ElementProps.Style;
            string    text  = (string)style[0];
            string    text2 = (string)style[10];

            if (text != null && text2 != null)
            {
                int value = new RPLReportColor(text).ToColor().ToArgb() & 0xFFFFFF;
                this.html5Renderer.WriteStream(HTMLElements.m_strokeColor);
                this.html5Renderer.WriteStream("#");
                this.html5Renderer.WriteStream(Convert.ToString(value, 16));
                this.html5Renderer.WriteStream(HTMLElements.m_quote);
                this.html5Renderer.WriteStream(HTMLElements.m_strokeWeight);
                this.html5Renderer.WriteStream(text2);
                this.html5Renderer.WriteStream(HTMLElements.m_closeQuote);
            }
            string theString = "solid";
            string text3     = null;
            object obj       = style[5];

            if (obj != null)
            {
                string value2 = EnumStrings.GetValue((RPLFormat.BorderStyles)obj);
                if (string.CompareOrdinal(value2, "dashed") == 0)
                {
                    theString = "dash";
                }
                else if (string.CompareOrdinal(value2, "dotted") == 0)
                {
                    theString = "dot";
                }
                if (string.CompareOrdinal(value2, "double") == 0)
                {
                    text3 = "thinthin";
                }
            }
            this.html5Renderer.WriteStream(HTMLElements.m_dashStyle);
            this.html5Renderer.WriteStream(theString);
            if (text3 != null)
            {
                this.html5Renderer.WriteStream(HTMLElements.m_quote);
                this.html5Renderer.WriteStream(HTMLElements.m_slineStyle);
                this.html5Renderer.WriteStream(text3);
            }
            this.html5Renderer.WriteStream(HTMLElements.m_quote);
            this.html5Renderer.WriteStream(HTMLElements.m_closeTag);
            this.html5Renderer.WriteStreamCR(HTMLElements.m_closeVGroup);
        }
        public override void WriteStyles(StyleWriterMode mode, IRPLStyle style)
        {
            RPLParagraph    paragraph       = this.m_paragraph;
            RPLTextBox      textBox         = this.m_textBox;
            RPLTextBoxProps rPLTextBoxProps = textBox.ElementProps as RPLTextBoxProps;

            if (paragraph != null)
            {
                RPLParagraphProps    rPLParagraphProps    = paragraph.ElementProps as RPLParagraphProps;
                RPLParagraphPropsDef rPLParagraphPropsDef = rPLParagraphProps.Definition as RPLParagraphPropsDef;
                RPLReportSize        rPLReportSize        = null;
                RPLReportSize        rPLReportSize2       = null;
                RPLReportSize        rPLReportSize3       = null;
                RPLReportSize        rPLReportSize4       = null;
                RPLReportSize        rPLReportSize5       = null;
                switch (mode)
                {
                case StyleWriterMode.All:
                    rPLReportSize = rPLParagraphProps.HangingIndent;
                    if (rPLReportSize == null)
                    {
                        rPLReportSize = rPLParagraphPropsDef.HangingIndent;
                    }
                    rPLReportSize2 = rPLParagraphProps.LeftIndent;
                    if (rPLReportSize2 == null)
                    {
                        rPLReportSize2 = rPLParagraphPropsDef.LeftIndent;
                    }
                    rPLReportSize3 = rPLParagraphProps.RightIndent;
                    if (rPLReportSize3 == null)
                    {
                        rPLReportSize3 = rPLParagraphPropsDef.RightIndent;
                    }
                    rPLReportSize4 = rPLParagraphProps.SpaceBefore;
                    if (rPLReportSize4 == null)
                    {
                        rPLReportSize4 = rPLParagraphPropsDef.SpaceBefore;
                    }
                    rPLReportSize5 = rPLParagraphProps.SpaceAfter;
                    if (rPLReportSize5 == null)
                    {
                        rPLReportSize5 = rPLParagraphPropsDef.SpaceAfter;
                    }
                    break;

                case StyleWriterMode.NonShared:
                {
                    RPLStyleProps nonSharedStyle = this.m_textBox.ElementProps.NonSharedStyle;
                    rPLReportSize  = rPLParagraphProps.HangingIndent;
                    rPLReportSize3 = rPLParagraphProps.RightIndent;
                    rPLReportSize2 = rPLParagraphProps.LeftIndent;
                    rPLReportSize5 = rPLParagraphProps.SpaceAfter;
                    rPLReportSize4 = rPLParagraphProps.SpaceBefore;
                    if (this.m_outputSharedInNonShared)
                    {
                        if (rPLReportSize == null)
                        {
                            rPLReportSize = rPLParagraphPropsDef.HangingIndent;
                        }
                        if (rPLReportSize3 == null)
                        {
                            rPLReportSize3 = rPLParagraphPropsDef.RightIndent;
                        }
                        if (rPLReportSize2 == null)
                        {
                            rPLReportSize2 = rPLParagraphPropsDef.LeftIndent;
                        }
                        if (rPLReportSize5 == null)
                        {
                            rPLReportSize5 = rPLParagraphPropsDef.SpaceAfter;
                        }
                        if (rPLReportSize4 == null)
                        {
                            rPLReportSize4 = rPLParagraphPropsDef.SpaceBefore;
                        }
                    }
                    else
                    {
                        bool flag = HTML5Renderer.IsDirectionRTL(this.m_textBox.ElementProps.Style);
                        if (rPLReportSize == null)
                        {
                            if (flag)
                            {
                                if (rPLReportSize3 != null)
                                {
                                    rPLReportSize = rPLParagraphPropsDef.HangingIndent;
                                }
                            }
                            else if (rPLReportSize2 != null)
                            {
                                rPLReportSize = rPLParagraphPropsDef.HangingIndent;
                            }
                        }
                        else if (flag)
                        {
                            if (rPLReportSize3 == null)
                            {
                                rPLReportSize3 = rPLParagraphPropsDef.RightIndent;
                            }
                        }
                        else if (rPLReportSize2 == null)
                        {
                            rPLReportSize2 = rPLParagraphPropsDef.LeftIndent;
                        }
                    }
                    break;
                }

                case StyleWriterMode.Shared:
                {
                    RPLStyleProps sharedStyle = this.m_textBox.ElementPropsDef.SharedStyle;
                    rPLReportSize  = rPLParagraphPropsDef.HangingIndent;
                    rPLReportSize2 = rPLParagraphPropsDef.LeftIndent;
                    rPLReportSize3 = rPLParagraphPropsDef.RightIndent;
                    rPLReportSize4 = rPLParagraphPropsDef.SpaceBefore;
                    rPLReportSize5 = rPLParagraphPropsDef.SpaceAfter;
                    break;
                }
                }
                if (this.m_currentListLevel > 0 && rPLReportSize != null && rPLReportSize.ToMillimeters() < 0.0)
                {
                    rPLReportSize = null;
                }
                if (this.m_mode != Mode.ParagraphOnly)
                {
                    this.FixIndents(ref rPLReportSize2, ref rPLReportSize3, ref rPLReportSize4, ref rPLReportSize5, rPLReportSize);
                    bool flag2 = HTML5Renderer.IsWritingModeVertical(rPLTextBoxProps.Style);
                    if (flag2)
                    {
                        base.WriteStyle(HTMLElements.m_paddingLeft, rPLReportSize2);
                    }
                    else
                    {
                        base.WriteStyle(HTMLElements.m_marginLeft, rPLReportSize2);
                    }
                    base.WriteStyle(HTMLElements.m_marginRight, rPLReportSize3);
                    base.WriteStyle(HTMLElements.m_marginTop, rPLReportSize4);
                    if (flag2)
                    {
                        base.WriteStyle(HTMLElements.m_marginBottom, rPLReportSize5);
                    }
                    else
                    {
                        base.WriteStyle(HTMLElements.m_paddingBottom, rPLReportSize5);
                    }
                }
                if (this.m_mode == Mode.ListOnly)
                {
                    base.WriteStyle(HTMLElements.m_fontFamily, "Arial");
                    base.WriteStyle(HTMLElements.m_fontSize, "10pt");
                }
                else if (rPLReportSize != null && rPLReportSize.ToMillimeters() < 0.0)
                {
                    base.WriteStyle(HTMLElements.m_textIndent, rPLReportSize);
                }
            }
            if (style != null)
            {
                if (this.m_mode != Mode.All && this.m_mode != Mode.ParagraphOnly)
                {
                    return;
                }
                object obj = style[25];
                if (obj != null || mode != 0)
                {
                    RPLFormat.TextAlignments textAlignments = RPLFormat.TextAlignments.General;
                    if (obj != null)
                    {
                        textAlignments = (RPLFormat.TextAlignments)obj;
                    }
                    if (textAlignments == RPLFormat.TextAlignments.General)
                    {
                        bool flag3 = HTML5Renderer.GetTextAlignForType(rPLTextBoxProps);
                        if (HTML5Renderer.IsDirectionRTL(rPLTextBoxProps.Style))
                        {
                            flag3 = ((byte)((!flag3) ? 1 : 0) != 0);
                        }
                        base.WriteStream(HTMLElements.m_textAlign);
                        if (flag3)
                        {
                            base.WriteStream(HTMLElements.m_rightValue);
                        }
                        else
                        {
                            base.WriteStream(HTMLElements.m_leftValue);
                        }
                        base.WriteStream(HTMLElements.m_semiColon);
                    }
                    else
                    {
                        base.WriteStyle(HTMLElements.m_textAlign, EnumStrings.GetValue(textAlignments), null);
                    }
                }
                base.WriteStyle(HTMLElements.m_lineHeight, style[28]);
            }
        }