public void AddPadding(int cellIndex, byte code, object value, int defaultValue)
        {
            double num = new RPLReportSize((string)value).ToPoints();

            switch (code)
            {
            case 15:
                this._document.TableContext.CurrentCell.CellProperties.PaddingLeft = num;
                break;

            case 16:
                this._document.TableContext.CurrentCell.CellProperties.PaddingRight = num;
                break;

            case 17:
                this._document.TableContext.CurrentCell.CellProperties.PaddingTop = num;
                this._document.TableContext.CurrentRow.RowProperties.SetCellPaddingTop(num);
                break;

            case 18:
                this._document.TableContext.CurrentCell.CellProperties.PaddingBottom = num;
                this._document.TableContext.CurrentRow.RowProperties.SetCellPaddingBottom(num);
                break;
            }
        }
Exemplo n.º 2
0
        private void RenderLineHeight(string size)
        {
            RPLReportSize rPLReportSize = new RPLReportSize(size);
            int           param         = Word97Writer.ToTwips((float)rPLReportSize.ToMillimeters());

            this.m_parFormat.AddSprm(25618, param, null);
        }
Exemplo n.º 3
0
        public void RenderFontSize(string size, RPLFormat.Directions dir)
        {
            RPLReportSize rPLReportSize = new RPLReportSize(size);
            double        num           = rPLReportSize.ToPoints();
            int           param         = (int)Math.Round(num * 2.0);

            this.m_charFormat.AddSprm(19011, param, null);
            if (dir == RPLFormat.Directions.RTL)
            {
                this.m_charFormat.AddSprm(19041, param, null);
            }
        }
Exemplo n.º 4
0
        internal RPLReportSize FixHangingIndent(RPLReportSize leftIndent, RPLReportSize hangingIndent)
        {
            if (hangingIndent == null)
            {
                return(leftIndent);
            }
            double num = hangingIndent.ToMillimeters();

            if (num < 0.0)
            {
                double num2 = 0.0;
                if (leftIndent != null)
                {
                    num2 = leftIndent.ToMillimeters();
                }
                num2      -= num;
                leftIndent = new RPLReportSize(num2);
            }
            return(leftIndent);
        }
Exemplo n.º 5
0
        public static double GetSizeProp(byte rplId, StyleAttributeNames styleAttributeName, float defaultValue, Style styleDef, Dictionary <byte, object> styles)
        {
            object obj = null;

            if (styles != null && styles.TryGetValue(rplId, out obj))
            {
                string text = obj as string;
                if (text != null)
                {
                    RPLReportSize rPLReportSize = new RPLReportSize(text);
                    return(rPLReportSize.ToPoints());
                }
            }
            ReportSizeProperty reportSizeProperty = ((StyleBase)styleDef)[styleAttributeName] as ReportSizeProperty;

            if (reportSizeProperty != null && !reportSizeProperty.IsExpression && reportSizeProperty.Value != null)
            {
                return(reportSizeProperty.Value.ToPoints());
            }
            return((double)defaultValue);
        }
Exemplo n.º 6
0
        internal void FixIndents(ref RPLReportSize leftIndent, ref RPLReportSize rightIndent, ref RPLReportSize spaceBefore, ref RPLReportSize spaceAfter, RPLReportSize hangingIndent)
        {
            RPLTextBoxProps rPLTextBoxProps = m_textBox.ElementProps as RPLTextBoxProps;

            if (HTML5Renderer.IsDirectionRTL(rPLTextBoxProps.Style))
            {
                rightIndent = FixHangingIndent(rightIndent, hangingIndent);
            }
            else
            {
                leftIndent = FixHangingIndent(leftIndent, hangingIndent);
            }
            object obj = rPLTextBoxProps.Style[30];

            if (obj != null && HTML5Renderer.IsWritingModeVertical((RPLFormat.WritingModes)obj))
            {
                RPLReportSize rPLReportSize = leftIndent;
                leftIndent  = spaceAfter;
                spaceAfter  = rightIndent;
                rightIndent = spaceBefore;
                spaceBefore = rPLReportSize;
            }
        }
Exemplo n.º 7
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]);
        }
Exemplo n.º 8
0
        public static ushort ToTwips(string size)
        {
            RPLReportSize rPLReportSize = new RPLReportSize(size);

            return((ushort)(rPLReportSize.ToPoints() * 20.0));
        }
Exemplo n.º 9
0
        public static double ToPoints(string size)
        {
            RPLReportSize rPLReportSize = new RPLReportSize(size);

            return(rPLReportSize.ToPoints());
        }
        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]);
            }
        }
        private void SetLineHeight(string height)
        {
            double lineHeight = new RPLReportSize(height).ToPoints();

            this.GetCurrentParagraph().Properties.LineHeight = lineHeight;
        }