Example #1
0
        protected override bool StartList()
        {
            this.listLevel++;
            this.StartBlockContainer();
            if (this.listLevel == 1)
            {
                PropertyValue property = base.CurrentNode.Parent.GetProperty(PropertyId.ListStart);
                if (!property.IsNull)
                {
                    this.listIndex = property.Integer;
                }
                else
                {
                    this.listIndex = 1;
                }
            }
            PropertyValue effectiveProperty = base.GetEffectiveProperty(PropertyId.RightToLeft);
            bool          flag          = effectiveProperty.IsNull || !effectiveProperty.Bool;
            int           num           = 0;
            PropertyValue propertyValue = flag ? base.CurrentNode.Parent.GetProperty(PropertyId.LeftMargin) : base.CurrentNode.Parent.GetProperty(PropertyId.RightMargin);

            if (!propertyValue.IsNull && propertyValue.IsAbsLength)
            {
                num = propertyValue.PointsInteger / 30;
                num = EnrichedFormatOutput.CheckRange(0, num, 50);
            }
            num++;
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("<ParaIndent><Param>");
            bool flag2 = false;

            while (num-- != 0)
            {
                if (flag2)
                {
                    stringBuilder.Append(',');
                }
                stringBuilder.Append("Left");
                flag2 = true;
            }
            stringBuilder.Append("</Param>");
            this.lineLength += stringBuilder.Length;
            this.output.Write(stringBuilder.ToString());
            this.ApplyCharFormat();
            return(true);
        }
Example #2
0
        protected override void EndBlockContainer()
        {
            PropertyValue effectiveProperty = base.GetEffectiveProperty(PropertyId.Preformatted);

            if (!effectiveProperty.IsNull && effectiveProperty.Bool)
            {
                this.insideNofill--;
                this.output.Write("</Nofill>");
                this.lineLength += "</Nofill>".Length;
            }
            else
            {
                StringBuilder stringBuilder      = null;
                PropertyValue effectiveProperty2 = base.GetEffectiveProperty(PropertyId.TextAlignment);
                if (!effectiveProperty2.IsNull)
                {
                    if (stringBuilder == null)
                    {
                        stringBuilder = new StringBuilder();
                    }
                    switch (effectiveProperty2.Enum)
                    {
                    case 1:
                        stringBuilder.Append("</Center>");
                        break;

                    case 3:
                        stringBuilder.Append("</FlushLeft>");
                        break;

                    case 4:
                        stringBuilder.Append("</FlushRight>");
                        break;

                    case 6:
                        stringBuilder.Append("</FlushBoth>");
                        break;
                    }
                }
                PropertyValue effectiveProperty3 = base.GetEffectiveProperty(PropertyId.LeftPadding);
                PropertyValue effectiveProperty4 = base.GetEffectiveProperty(PropertyId.RightPadding);
                PropertyValue effectiveProperty5 = base.GetEffectiveProperty(PropertyId.FirstLineIndent);
                int           num  = 0;
                int           num2 = 0;
                int           num3 = 0;
                if (!effectiveProperty3.IsNull && effectiveProperty3.IsAbsLength)
                {
                    num = (effectiveProperty3.PointsInteger + 12) / 30;
                    num = EnrichedFormatOutput.CheckRange(0, num, 50);
                }
                if (!effectiveProperty5.IsNull && effectiveProperty5.IsAbsLength)
                {
                    num3 = (effectiveProperty5.PointsInteger + ((effectiveProperty5.PointsInteger > 0) ? 12 : -12)) / 30;
                    num3 = EnrichedFormatOutput.CheckRange(-50, num3, 50);
                }
                if (!effectiveProperty4.IsNull && effectiveProperty4.IsAbsLength)
                {
                    num2 = effectiveProperty4.PointsInteger / 30;
                    num2 = EnrichedFormatOutput.CheckRange(0, num2, 50);
                }
                if (num != 0 || num2 != 0 || num3 != 0)
                {
                    if (stringBuilder == null)
                    {
                        stringBuilder = new StringBuilder();
                    }
                    stringBuilder.Append("</ParaIndent>");
                }
                PropertyValue effectiveProperty6 = base.GetEffectiveProperty(PropertyId.QuotingLevelDelta);
                if (!effectiveProperty6.IsNull && effectiveProperty6.IsInteger && effectiveProperty6.Integer > 0)
                {
                    if (stringBuilder == null)
                    {
                        stringBuilder = new StringBuilder();
                    }
                    for (int i = 0; i < effectiveProperty6.Integer; i++)
                    {
                        stringBuilder.Append("</Excerpt>");
                    }
                }
                if (stringBuilder != null && stringBuilder.Length != 0)
                {
                    this.lineLength += stringBuilder.Length;
                    this.output.Write(stringBuilder.ToString());
                }
            }
            this.blockEnd = true;
            PropertyValue effectiveProperty7 = base.GetEffectiveProperty(PropertyId.BottomMargin);

            if (!effectiveProperty7.IsNull && effectiveProperty7.IsAbsLength)
            {
                this.spaceBefore = Math.Max(this.spaceBefore, effectiveProperty7.PointsInteger);
            }
        }
Example #3
0
        protected override bool StartBlockContainer()
        {
            if (!this.blockEmpty)
            {
                if (this.lineLength != 0 && this.insideNofill == 0)
                {
                    this.output.Write("\r\n");
                }
                this.output.Write("\r\n");
                this.lineLength = 0;
                this.blockEmpty = true;
            }
            this.blockEnd = false;
            PropertyValue effectiveProperty = base.GetEffectiveProperty(PropertyId.Margins);

            if (!effectiveProperty.IsNull && effectiveProperty.IsAbsLength)
            {
                this.spaceBefore = Math.Max(this.spaceBefore, effectiveProperty.PointsInteger);
            }
            PropertyValue effectiveProperty2 = base.GetEffectiveProperty(PropertyId.Preformatted);

            if (!effectiveProperty2.IsNull && effectiveProperty2.Bool)
            {
                this.output.Write("<Nofill>");
                this.lineLength = "<Nofill>".Length;
                this.insideNofill++;
            }
            else
            {
                StringBuilder stringBuilder      = null;
                PropertyValue effectiveProperty3 = base.GetEffectiveProperty(PropertyId.QuotingLevelDelta);
                if (!effectiveProperty3.IsNull && effectiveProperty3.IsInteger && effectiveProperty3.Integer > 0)
                {
                    if (stringBuilder == null)
                    {
                        stringBuilder = new StringBuilder();
                    }
                    for (int i = 0; i < effectiveProperty3.Integer; i++)
                    {
                        stringBuilder.Append("<Excerpt>");
                    }
                }
                PropertyValue effectiveProperty4 = base.GetEffectiveProperty(PropertyId.RightToLeft);
                bool          flag               = effectiveProperty4.IsNull || !effectiveProperty4.Bool;
                PropertyValue propertyValue      = flag ? base.GetEffectiveProperty(PropertyId.LeftPadding) : base.GetEffectiveProperty(PropertyId.RightPadding);
                PropertyValue propertyValue2     = flag ? base.GetEffectiveProperty(PropertyId.RightPadding) : base.GetEffectiveProperty(PropertyId.LeftPadding);
                PropertyValue effectiveProperty5 = base.GetEffectiveProperty(PropertyId.FirstLineIndent);
                int           num  = 0;
                int           num2 = 0;
                int           num3 = 0;
                if (!propertyValue.IsNull && propertyValue.IsAbsLength)
                {
                    num = (propertyValue.PointsInteger + 12) / 30;
                    num = EnrichedFormatOutput.CheckRange(0, num, 50);
                }
                if (!effectiveProperty5.IsNull && effectiveProperty5.IsAbsLength)
                {
                    num3 = (effectiveProperty5.PointsInteger + ((effectiveProperty5.PointsInteger > 0) ? 12 : -12)) / 30;
                    num3 = EnrichedFormatOutput.CheckRange(-50, num3, 50);
                }
                if (!propertyValue2.IsNull && propertyValue2.IsAbsLength)
                {
                    num2 = propertyValue2.PointsInteger / 30;
                    num2 = EnrichedFormatOutput.CheckRange(0, num2, 50);
                }
                if (num != 0 || num2 != 0 || num3 != 0)
                {
                    if (stringBuilder == null)
                    {
                        stringBuilder = new StringBuilder();
                    }
                    int num4 = 0;
                    if (num3 < 0)
                    {
                        num4 = -num3;
                        num3 = 0;
                        num -= num4;
                        if (num < 0)
                        {
                            num = 0;
                        }
                    }
                    stringBuilder.Append("<ParaIndent><Param>");
                    bool flag2 = false;
                    while (num-- != 0)
                    {
                        if (flag2)
                        {
                            stringBuilder.Append(',');
                        }
                        stringBuilder.Append("Left");
                        flag2 = true;
                    }
                    while (num2-- != 0)
                    {
                        if (flag2)
                        {
                            stringBuilder.Append(',');
                        }
                        stringBuilder.Append("Right");
                        flag2 = true;
                    }
                    while (num3-- != 0)
                    {
                        if (flag2)
                        {
                            stringBuilder.Append(',');
                        }
                        stringBuilder.Append("In");
                        flag2 = true;
                    }
                    while (num4-- != 0)
                    {
                        if (flag2)
                        {
                            stringBuilder.Append(',');
                        }
                        stringBuilder.Append("Out");
                        flag2 = true;
                    }
                    stringBuilder.Append("</Param>");
                }
                PropertyValue effectiveProperty6 = base.GetEffectiveProperty(PropertyId.TextAlignment);
                if (!effectiveProperty6.IsNull)
                {
                    if (stringBuilder == null)
                    {
                        stringBuilder = new StringBuilder();
                    }
                    switch (effectiveProperty6.Enum)
                    {
                    case 1:
                        stringBuilder.Append("<Center>");
                        break;

                    case 3:
                        stringBuilder.Append("<FlushLeft>");
                        break;

                    case 4:
                        stringBuilder.Append("<FlushRight>");
                        break;

                    case 6:
                        stringBuilder.Append("<FlushBoth>");
                        break;
                    }
                }
                if (stringBuilder != null && stringBuilder.Length != 0)
                {
                    this.lineLength += stringBuilder.Length;
                    this.output.Write(stringBuilder.ToString());
                }
            }
            return(true);
        }