예제 #1
0
        internal override void WriteStyles(StyleWriterMode mode, IRPLStyle style)
        {
            string text = style[20] as string;

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

            if (obj != null)
            {
                text2 = EnumStrings.GetValue((RPLFormat.FontWeights)obj);
                WriteStyle(HTML4Renderer.m_fontWeight, text2);
            }
            obj = style[19];
            if (obj != null)
            {
                text2 = EnumStrings.GetValue((RPLFormat.FontStyles)obj);
                WriteStyle(HTML4Renderer.m_fontStyle, text2);
            }
            obj = style[24];
            if (obj != null)
            {
                text2 = EnumStrings.GetValue((RPLFormat.TextDecorations)obj);
                WriteStyle(HTML4Renderer.m_textDecoration, text2);
            }
            WriteStyle(HTML4Renderer.m_color, style[27]);
        }
예제 #2
0
        internal override void WriteStyles(StyleWriterMode mode, IRPLStyle style)
        {
            RPLParagraph    paragraph       = m_paragraph;
            RPLTextBox      textBox         = 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        leftIndent           = null;
                RPLReportSize        rightIndent          = null;
                RPLReportSize        spaceBefore          = null;
                RPLReportSize        spaceAfter           = null;
                IRPLStyle            iRPLStyle            = null;
                switch (mode)
                {
                case StyleWriterMode.All:
                    rPLReportSize = rPLParagraphProps.HangingIndent;
                    if (rPLReportSize == null)
                    {
                        rPLReportSize = rPLParagraphPropsDef.HangingIndent;
                    }
                    leftIndent = rPLParagraphProps.LeftIndent;
                    if (leftIndent == null)
                    {
                        leftIndent = rPLParagraphPropsDef.LeftIndent;
                    }
                    rightIndent = rPLParagraphProps.RightIndent;
                    if (rightIndent == null)
                    {
                        rightIndent = rPLParagraphPropsDef.RightIndent;
                    }
                    spaceBefore = rPLParagraphProps.SpaceBefore;
                    if (spaceBefore == null)
                    {
                        spaceBefore = rPLParagraphPropsDef.SpaceBefore;
                    }
                    spaceAfter = rPLParagraphProps.SpaceAfter;
                    if (spaceAfter == null)
                    {
                        spaceAfter = rPLParagraphPropsDef.SpaceAfter;
                    }
                    break;

                case StyleWriterMode.NonShared:
                {
                    iRPLStyle     = m_textBox.ElementProps.NonSharedStyle;
                    rPLReportSize = rPLParagraphProps.HangingIndent;
                    rightIndent   = rPLParagraphProps.RightIndent;
                    leftIndent    = rPLParagraphProps.LeftIndent;
                    spaceAfter    = rPLParagraphProps.SpaceAfter;
                    spaceBefore   = rPLParagraphProps.SpaceBefore;
                    if (m_outputSharedInNonShared)
                    {
                        if (rPLReportSize == null)
                        {
                            rPLReportSize = rPLParagraphPropsDef.HangingIndent;
                        }
                        if (rightIndent == null)
                        {
                            rightIndent = rPLParagraphPropsDef.RightIndent;
                        }
                        if (leftIndent == null)
                        {
                            leftIndent = rPLParagraphPropsDef.LeftIndent;
                        }
                        if (spaceAfter == null)
                        {
                            spaceAfter = rPLParagraphPropsDef.SpaceAfter;
                        }
                        if (spaceBefore == null)
                        {
                            spaceBefore = rPLParagraphPropsDef.SpaceBefore;
                        }
                        break;
                    }
                    bool flag = HTML5Renderer.IsDirectionRTL(m_textBox.ElementProps.Style);
                    if (rPLReportSize == null)
                    {
                        if (flag)
                        {
                            if (rightIndent != null)
                            {
                                rPLReportSize = rPLParagraphPropsDef.HangingIndent;
                            }
                        }
                        else if (leftIndent != null)
                        {
                            rPLReportSize = rPLParagraphPropsDef.HangingIndent;
                        }
                    }
                    else if (flag)
                    {
                        if (rightIndent == null)
                        {
                            rightIndent = rPLParagraphPropsDef.RightIndent;
                        }
                    }
                    else if (leftIndent == null)
                    {
                        leftIndent = rPLParagraphPropsDef.LeftIndent;
                    }
                    break;
                }

                case StyleWriterMode.Shared:
                    iRPLStyle     = m_textBox.ElementPropsDef.SharedStyle;
                    rPLReportSize = rPLParagraphPropsDef.HangingIndent;
                    leftIndent    = rPLParagraphPropsDef.LeftIndent;
                    rightIndent   = rPLParagraphPropsDef.RightIndent;
                    spaceBefore   = rPLParagraphPropsDef.SpaceBefore;
                    spaceAfter    = rPLParagraphPropsDef.SpaceAfter;
                    break;
                }
                if (m_currentListLevel > 0 && rPLReportSize != null && rPLReportSize.ToMillimeters() < 0.0)
                {
                    rPLReportSize = null;
                }
                if (m_mode != Mode.ParagraphOnly)
                {
                    FixIndents(ref leftIndent, ref rightIndent, ref spaceBefore, ref spaceAfter, rPLReportSize);
                    bool flag2 = HTML5Renderer.IsWritingModeVertical(rPLTextBoxProps.Style);
                    if (flag2)
                    {
                        WriteStyle(HTMLElements.m_paddingLeft, leftIndent);
                    }
                    else
                    {
                        WriteStyle(HTMLElements.m_marginLeft, leftIndent);
                    }
                    WriteStyle(HTMLElements.m_marginRight, rightIndent);
                    WriteStyle(HTMLElements.m_marginTop, spaceBefore);
                    if (flag2)
                    {
                        WriteStyle(HTMLElements.m_marginBottom, spaceAfter);
                    }
                    else
                    {
                        WriteStyle(HTMLElements.m_paddingBottom, spaceAfter);
                    }
                }
                if (m_mode == Mode.ListOnly)
                {
                    WriteStyle(HTMLElements.m_fontFamily, "Arial");
                    WriteStyle(HTMLElements.m_fontSize, "10pt");
                }
                else if (rPLReportSize != null && rPLReportSize.ToMillimeters() < 0.0)
                {
                    WriteStyle(HTMLElements.m_textIndent, rPLReportSize);
                }
            }
            if (style == null || (m_mode != Mode.All && 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 = ((!flag3) ? true : false);
                    }
                    WriteStream(HTMLElements.m_textAlign);
                    if (flag3)
                    {
                        WriteStream(HTMLElements.m_rightValue);
                    }
                    else
                    {
                        WriteStream(HTMLElements.m_leftValue);
                    }
                    WriteStream(HTMLElements.m_semiColon);
                }
                else
                {
                    WriteStyle(HTMLElements.m_textAlign, EnumStrings.GetValue(textAlignments), null);
                }
            }
            WriteStyle(HTMLElements.m_lineHeight, style[28]);
        }
예제 #3
0
        private void RenderVMLLine(RPLLine line, RPLItemMeasurement measurement, StyleContext styleContext)
        {
            if (!hasSlantedLines)
            {
                html5Renderer.WriteStream("<?XML:NAMESPACE PREFIX=v /><?IMPORT NAMESPACE=\"v\" IMPLEMENTATION=\"#default#VML\" />");
                hasSlantedLines = true;
            }
            html5Renderer.WriteStream(HTMLElements.m_openVGroup);
            html5Renderer.WriteStream(HTMLElements.m_openStyle);
            html5Renderer.WriteStream(HTMLElements.m_styleWidth);
            if (styleContext.InTablix)
            {
                html5Renderer.WriteStream(HTMLElements.m_percent);
                html5Renderer.WriteStream(HTMLElements.m_semiColon);
                html5Renderer.WriteStream(HTMLElements.m_styleHeight);
                html5Renderer.WriteStream(HTMLElements.m_percent);
            }
            else
            {
                html5Renderer.WriteRSStream(measurement.Width);
                html5Renderer.WriteStream(HTMLElements.m_semiColon);
                html5Renderer.WriteStream(HTMLElements.m_styleHeight);
                html5Renderer.WriteRSStream(measurement.Height);
            }
            html5Renderer.WriteStream(HTMLElements.m_closeQuote);
            html5Renderer.WriteStream(HTMLElements.m_openVLine);
            if (((RPLLinePropsDef)line.ElementProps.Definition).Slant)
            {
                html5Renderer.WriteStream(HTMLElements.m_rightSlant);
            }
            else
            {
                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;
                html5Renderer.WriteStream(HTMLElements.m_strokeColor);
                html5Renderer.WriteStream("#");
                html5Renderer.WriteStream(Convert.ToString(value, 16));
                html5Renderer.WriteStream(HTMLElements.m_quote);
                html5Renderer.WriteStream(HTMLElements.m_strokeWeight);
                html5Renderer.WriteStream(text2);
                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";
                }
            }
            html5Renderer.WriteStream(HTMLElements.m_dashStyle);
            html5Renderer.WriteStream(theString);
            if (text3 != null)
            {
                html5Renderer.WriteStream(HTMLElements.m_quote);
                html5Renderer.WriteStream(HTMLElements.m_slineStyle);
                html5Renderer.WriteStream(text3);
            }
            html5Renderer.WriteStream(HTMLElements.m_quote);
            html5Renderer.WriteStream(HTMLElements.m_closeTag);
            html5Renderer.WriteStreamCR(HTMLElements.m_closeVGroup);
        }