Пример #1
0
 /// <summary>
 /// 设置行间距在单元格中
 /// </summary>
 /// <param name="cell"></param>
 /// <param name="lsr"></param>
 /// <param name="ls"></param>
 public void setLineSpacingInCell(Cell cell, LineSpacingRule lsr, double ls)
 {
     foreach (Node n in cell.ChildNodes)
     {
         if (n is Paragraph)
         {
             ((Paragraph)n).ParagraphFormat.LineSpacingRule = lsr;
             ((Paragraph)n).ParagraphFormat.LineSpacing     = ls;
         }
     }
 }
Пример #2
0
    private void method_79()
    {
        LineSpacingRule multiple = LineSpacingRule.Multiple;

        if (base.wordAttrCollection_0.method_6(0x677))
        {
            multiple = (LineSpacingRule)base.wordAttrCollection_0.method_32(0x677);
        }
        if (base.wordAttrCollection_0.method_6(0x672))
        {
            int num  = (int)Math.Round((double)(((float)base.wordAttrCollection_0.method_32(0x672)) * 20f));
            int num2 = ((multiple != LineSpacingRule.Exactly) || (num <= 0)) ? num : -num;
            base.class345_0.method_5(SprmCode.PDyaLine);
            base.class345_0.Write((short)num2);
            base.class345_0.Write((multiple == LineSpacingRule.Multiple) ? ((short)1) : ((short)0));
        }
    }
Пример #3
0
    internal static string smethod_17(LineSpacingRule A_0, bool A_1)
    {
        int num = 4;

        switch (A_0)
        {
        case LineSpacingRule.AtLeast:
            if (A_1)
            {
                return(BookmarkStart.b("䬩堫戭唯匱䜳䈵", num));
            }
            return(BookmarkStart.b("䬩堫̭尯圱唳䔵䰷", num));

        case LineSpacingRule.Exactly:
            return(BookmarkStart.b("伩含伭匯䘱", num));

        case LineSpacingRule.Multiple:
            return(BookmarkStart.b("䬩夫娭弯", num));
        }
        return("");
    }
Пример #4
0
 /**
  * Specifies how the spacing between lines is calculated as stored in the
  * line attribute. If this attribute is omitted, then it shall be assumed to
  * be of a value auto if a line attribute value is present.
  *
  * @param rule
  * @see LineSpacingRule
  */
 public void SetSpacingLineRule(LineSpacingRule rule)
 {
     CT_Spacing spacing = GetCTSpacing(true);
     spacing.lineRule = EnumConverter.ValueOf<ST_LineSpacingRule, LineSpacingRule>(rule);
 }
Пример #5
0
        /// <summary>
        /// Renders a ParagraphFormat object.
        /// </summary>
        internal override void Render()
        {
            _useEffectiveValue = true; //unfortunately has to be true always.

            Translate("Alignment", "q");
            Translate("SpaceBefore", "sb");
            Translate("SpaceAfter", "sa");

            TranslateBool("WidowControl", "widctlpar", "nowidctlpar", false);
            Translate("PageBreakBefore", "pagebb");
            Translate("KeepTogether", "keep");
            Translate("KeepWithNext", "keepn");
            Translate("FirstLineIndent", "fi");

            Translate("LeftIndent", "li");
            Translate("LeftIndent", "lin");

            Translate("RightIndent", "ri");
            Translate("RightIndent", "rin");

            object ol = GetValueAsIntended("OutlineLevel");

            if (ol != null && ((OutlineLevel)ol) != OutlineLevel.BodyText)
            {
                Translate("OutlineLevel", "outlinelevel");
            }

            Unit            lineSpc     = (Unit)GetValueAsIntended("LineSpacing");
            LineSpacingRule lineSpcRule = (LineSpacingRule)GetValueAsIntended("LineSpacingRule");

            switch (lineSpcRule)
            {
            case LineSpacingRule.Exactly:     // A bit strange, but follows the RTF specification:
                _rtfWriter.WriteControl("sl", ToTwips(-lineSpc.Point));
                break;

            case LineSpacingRule.AtLeast:
                Translate("LineSpacing", "sl");
                break;

            case LineSpacingRule.Multiple:
                _rtfWriter.WriteControl("sl", ToRtfUnit(lineSpc, RtfUnit.Lines));
                break;

            case LineSpacingRule.Double:
                _rtfWriter.WriteControl("sl", 480);     // equals 12 * 2 * 20 (Standard line height * 2  in twips)
                break;

            case LineSpacingRule.OnePtFive:
                _rtfWriter.WriteControl("sl", 360);     // equals 12 * 1.5 * 20 (Standard lineheight * 1.5  in twips)
                break;
            }
            Translate("LineSpacingRule", "slmult");
            object shad = GetValueAsIntended("Shading");

            if (shad != null)
            {
                new ShadingRenderer((DocumentObject)shad, _docRenderer).Render();
            }

            object font = GetValueAsIntended("Font");

            if (font != null)
            {
                RendererFactory.CreateRenderer((Font)font, _docRenderer).Render();
            }

            object brdrs = GetValueAsIntended("Borders");

            if (brdrs != null)
            {
                BordersRenderer brdrsRndrr = new BordersRenderer((Borders)brdrs, _docRenderer);
                brdrsRndrr.ParentFormat = _format;
                brdrsRndrr.Render();
            }

            object tabStops = GetValueAsIntended("TabStops");

            if (tabStops != null)
            {
                RendererFactory.CreateRenderer((TabStops)tabStops, _docRenderer).Render();
            }

            // TODO: ListInfo is still under construction.
            object listInfo = GetValueAsIntended("ListInfo");

            if (listInfo != null)
            {
                int nr = ListInfoOverrideRenderer.GetListNumber((ListInfo)listInfo);
                if (nr > 0)
                {
                    _rtfWriter.WriteControl("ls", nr);
                }
            }
        }
Пример #6
0
 public void SetSpacingLineRule(LineSpacingRule rule)
 {
     this.GetCTSpacing(true).lineRule = EnumConverter.ValueOf <ST_LineSpacingRule, LineSpacingRule>(rule);
 }
Пример #7
0
 public MezParagraph LineSpacingRule(LineSpacingRule rule)
 {
     Paragraph.Format.LineSpacingRule = rule;
     return(this);
 }
Пример #8
0
    private void method_5(Interface46 A_0, AttrCollection A_1, bool A_2)
    {
        int            num   = 7;
        AttrCollection attrs = this.method_11(A_0, A_1, A_2);

        this.class972_0.class1048_0.bool_0 = false;
        ParagraphFormat paraPr = null;

        if (A_0 is Paragraph)
        {
            paraPr = (A_0 as Paragraph).Format;
        }
        else if (A_0 is Style)
        {
            paraPr = (A_0 as Style).ParaPr;
        }
        if (A_2)
        {
            this.class972_0.string_14 = BookmarkStart.b("䐬䬮吰尲刴䔶堸䬺唼ሾ⁀⽂㕄⽆⡈", num);
            this.class972_0.string_15 = BookmarkStart.b("䔬丮弰吲尴夶常", num);
        }
        HorizontalAlignment left = HorizontalAlignment.Left;
        bool flag = false;

        for (int i = 0; i < attrs.Count; i++)
        {
            int    num3;
            int    num5 = attrs.method_18(i);
            object obj2 = attrs.method_19(i);
            if (obj2 != null)
            {
                this.class972_0.int_0++;
                num3 = num5;
                if (num3 <= 0x4ba)
                {
                    if (num3 <= 0x442)
                    {
                        if (num3 <= 0x410)
                        {
                            switch (num3)
                            {
                            case 20:
                            {
                                Borders borders = obj2 as Borders;
                                if (!borders.Left.IsDefault)
                                {
                                    this.class972_0.class1048_0.class411_2.border_0 = borders.Left;
                                }
                                if (!borders.Right.IsDefault)
                                {
                                    this.class972_0.class1048_0.class411_3.border_0 = borders.Right;
                                }
                                if (!borders.Top.IsDefault)
                                {
                                    this.class972_0.class1048_0.class411_0.border_0 = borders.Top;
                                }
                                if (!borders.Bottom.IsDefault)
                                {
                                    this.class972_0.class1048_0.class411_1.border_0 = borders.Bottom;
                                }
                                if (borders.IsDefault || (borders == null))
                                {
                                    this.class972_0.int_0--;
                                }
                                continue;
                            }

                            case 0x3fc:
                            {
                                flag = true;
                                left = (HorizontalAlignment)obj2;
                                continue;
                            }
                            }
                            if (num3 != 0x410)
                            {
                                goto Label_09CD;
                            }
                            if ((bool)obj2)
                            {
                                this.class972_0.string_9 = BookmarkStart.b("䰬䌮䘰刲䰴䐶", num);
                            }
                            else
                            {
                                this.class972_0.int_0--;
                            }
                        }
                        else
                        {
                            switch (num3)
                            {
                            case 0x41a:
                            {
                                if ((bool)obj2)
                                {
                                    this.class972_0.string_8 = BookmarkStart.b("䰬䌮䘰刲䰴䐶", num);
                                }
                                else
                                {
                                    this.class972_0.int_0--;
                                }
                                continue;
                            }

                            case 0x424:
                            {
                                this.class972_0.string_0 = ((bool)obj2) ? BookmarkStart.b("崬丮嘰嘲", num) : BookmarkStart.b("䰬娮䔰尲", num);
                                continue;
                            }
                            }
                            if (num3 != 0x442)
                            {
                                goto Label_09CD;
                            }
                            if (!((bool)obj2))
                            {
                                this.class972_0.string_15 = BookmarkStart.b("帬䘮尰䌲头制", num);
                            }
                            else
                            {
                                this.class972_0.int_0--;
                            }
                        }
                    }
                    else if (num3 <= 0x47e)
                    {
                        switch (num3)
                        {
                        case 0x46a:
                        {
                            if (!((bool)obj2))
                            {
                                this.class972_0.string_11 = BookmarkStart.b("夬崮䐰嘲", num);
                            }
                            else
                            {
                                this.class972_0.int_0--;
                            }
                            continue;
                        }

                        case 0x474:
                        {
                            if ((obj2 != null) && (((TabCollection)obj2).Count != 0))
                            {
                                this.class972_0.tabCollection_0 = (TabCollection)obj2;
                            }
                            this.class972_0.int_0--;
                            continue;
                        }
                        }
                        if (num3 != 0x47e)
                        {
                            goto Label_09CD;
                        }
                        if (((A_0 is Paragraph) && ((Paragraph)A_0).IsList) && (((Paragraph)A_0).ListFormat.method_31(0x47e) != null))
                        {
                            this.class972_0.int_0--;
                        }
                        else
                        {
                            this.class972_0.class1048_0.class411_3.string_3 = Class576.smethod_42((double)((float)obj2));
                            this.method_7(A_0);
                        }
                    }
                    else if (num3 <= 0x492)
                    {
                        if (num3 == 0x488)
                        {
                            if (((A_0 is Paragraph) && ((Paragraph)A_0).IsList) && (((Paragraph)A_0).ListFormat.method_31(0x488) != null))
                            {
                                this.class972_0.int_0--;
                            }
                            else
                            {
                                this.class972_0.class1048_0.class411_2.string_3 = Class576.smethod_42((double)((float)obj2));
                                this.method_7(A_0);
                            }
                            this.class972_0.int_1 = (int)((float)obj2);
                        }
                        else
                        {
                            if (num3 != 0x492)
                            {
                                goto Label_09CD;
                            }
                            if ((A_0 is Paragraph) && (((float)obj2) < 0f))
                            {
                                if ((A_0 is Paragraph) && !(A_0 as Paragraph).IsList)
                                {
                                    this.class972_0.string_6 = Class576.smethod_42((double)((float)obj2));
                                }
                                else
                                {
                                    this.class972_0.int_0--;
                                }
                            }
                            else
                            {
                                this.class972_0.string_6 = Class576.smethod_42((double)((float)obj2));
                            }
                        }
                    }
                    else if (num3 != 0x4b0)
                    {
                        if (num3 != 0x4ba)
                        {
                            goto Label_09CD;
                        }
                        this.class972_0.bool_0 = (bool)obj2;
                        this.class972_0.int_0--;
                    }
                    else
                    {
                        this.class972_0.class1048_0.class411_0.string_3 = Class576.smethod_42((double)((float)obj2));
                    }
                }
                else
                {
                    if (num3 > 0x5aa)
                    {
                        goto Label_0837;
                    }
                    if (num3 > 0x4d8)
                    {
                        goto Label_073E;
                    }
                    switch (num3)
                    {
                    case 0x4c4:
                    {
                        if (!(A_0 is Paragraph))
                        {
                            goto Label_0717;
                        }
                        Paragraph paragraph = (Paragraph)A_0;
                        if ((paragraph.NextSibling == null) || !(paragraph.NextSibling is Paragraph))
                        {
                            goto Label_06E9;
                        }
                        Paragraph nextSibling = (Paragraph)paragraph.NextSibling;
                        object    obj3        = nextSibling.Format.method_31(0x4b0);
                        if ((obj3 != null) && nextSibling.Format.BeforeAutoSpacing)
                        {
                            obj3 = 280f;
                        }
                        if ((obj3 != null) && (((float)obj3) > ((float)obj2)))
                        {
                            this.class972_0.int_0--;
                        }
                        else
                        {
                            this.class972_0.class1048_0.class411_1.string_3 = Class576.smethod_42((double)((float)obj2));
                            this.method_7(A_0);
                        }
                        continue;
                    }

                    case 0x4ce:
                    {
                        this.class972_0.bool_1 = (bool)obj2;
                        this.class972_0.int_0--;
                        continue;
                    }
                    }
                    if (num3 != 0x4d8)
                    {
                        goto Label_09CD;
                    }
                    this.class972_0.string_14 = ((bool)obj2) ? BookmarkStart.b("䐬䬮吰尲刴䔶堸䬺唼ሾ⁀⽂㕄⽆⡈", num) : BookmarkStart.b("䌬䀮弰嘲", num);
                }
            }
            continue;
Label_06E9:
            this.class972_0.class1048_0.class411_1.string_3 = Class576.smethod_42((double)((float)obj2));
            this.method_7(A_0);
            continue;
Label_0717:
            this.class972_0.class1048_0.class411_1.string_3 = Class576.smethod_42((double)((float)obj2));
            continue;
Label_073E:
            if (num3 <= 0x500)
            {
                if (num3 != 0x4ec)
                {
                    if (num3 != 0x500)
                    {
                        goto Label_09CD;
                    }
                    this.class972_0.int_2 = (byte)obj2;
                }
                else if ((bool)obj2)
                {
                    this.class972_0.string_13 = BookmarkStart.b("夬崮䐰嘲", num);
                }
                else
                {
                    this.class972_0.int_0--;
                }
            }
            else if (num3 != 0x582)
            {
                if (num3 != 0x5aa)
                {
                    goto Label_09CD;
                }
                this.class972_0.string_4 = ((int)obj2).ToString();
                this.class972_0.int_0--;
            }
            else if ((bool)obj2)
            {
                this.class972_0.string_16 = BookmarkStart.b("䌬䀮ᰰ弲尴娶倸伺", num);
            }
            else
            {
                this.class972_0.int_0--;
            }
            continue;
Label_0837:
            if (num3 <= 0x5dc)
            {
                switch (num3)
                {
                case 0x5b4:
                {
                    this.class972_0.string_1 = Class576.smethod_83((Class16)obj2);
                    if (this.class972_0.string_1 == null)
                    {
                        this.class972_0.int_0--;
                    }
                    continue;
                }

                case 0x5be:
                {
                    if ((bool)obj2)
                    {
                        this.class972_0.bool_2 = true;
                    }
                    else
                    {
                        this.class972_0.bool_2 = false;
                        this.class972_0.int_0--;
                    }
                    continue;
                }
                }
                if (num3 != 0x5dc)
                {
                    goto Label_09CD;
                }
                if (attrs.HasValue(0x5aa))
                {
                    this.class972_0.string_5 = Class576.smethod_35(obj2);
                }
                this.class972_0.int_0--;
                continue;
            }
            if (num3 <= 0x618)
            {
                if (num3 == 0x5e6)
                {
                    this.class972_0.string_17 = Class922.smethod_42((BaselineAlignment)obj2);
                    if (this.class972_0.string_17 == null)
                    {
                        this.class972_0.int_0--;
                    }
                }
                else
                {
                    if (num3 != 0x618)
                    {
                        goto Label_09CD;
                    }
                    if ((bool)obj2)
                    {
                        this.class972_0.string_10 = BookmarkStart.b("弬䌮ᰰ䜲圴", num);
                    }
                    else
                    {
                        this.class972_0.string_10 = BookmarkStart.b("䄬崮ᰰ䜲圴", num);
                    }
                }
                continue;
            }
            switch (num3)
            {
            case 0x672:
            {
                float           num4 = Math.Abs((float)obj2);
                LineSpacingRule rule = (LineSpacingRule)attrs.method_31(0x677);
                this.class972_0.lineSpacingRule_0 = rule;
                if (((A_0 is Paragraph) && ((Paragraph)A_0).Format.HasKey(0x532)) || (!(A_0 is Paragraph) && !(A_0 is Style)))
                {
                    goto Label_0A84;
                }
                this.class972_0.string_7 = Class576.smethod_9(num4, rule);
                continue;
            }

            case 0x271a:
            {
                this.class972_0.class580_0 = (Class580)obj2;
                this.class972_0.int_0--;
                continue;
            }
            }
Label_09CD:
            this.class972_0.int_0--;
            continue;
Label_0A84:
            this.class972_0.int_0--;
        }
        this.method_8(A_0);
        this.method_9(A_0, paraPr, left, flag);
        if (this.class972_0.bool_0 && (this.class972_0.class1048_0.class411_0.string_3 != null))
        {
            if ((A_0 is Paragraph) && (((Paragraph)A_0).PreviousSibling == null))
            {
                this.class972_0.class1048_0.class411_0.string_3 = null;
                this.class972_0.int_0--;
            }
            else
            {
                this.class972_0.class1048_0.class411_0.string_3 = Class576.smethod_42(280.0);
            }
        }
        if (this.class972_0.bool_1 && (this.class972_0.class1048_0.class411_1.string_3 != null))
        {
            if ((A_0 is Paragraph) && (((Paragraph)A_0).NextSibling == null))
            {
                this.class972_0.class1048_0.class411_1.string_3 = null;
                this.class972_0.int_0--;
            }
            else
            {
                this.class972_0.class1048_0.class411_1.string_3 = Class576.smethod_42(280.0);
            }
        }
        this.method_6(A_0, paraPr);
    }
Пример #9
0
 public void method_56(LineSpacingRule A_0)
 {
     this.lineSpacingRule_0 = A_0;
 }