Пример #1
0
        private void GetPaddings(PageContext pageContext)
        {
            PaddingsStyle paddingsStyle = null;

            if (pageContext.ItemPaddingsStyle != null)
            {
                paddingsStyle = (PaddingsStyle)pageContext.ItemPaddingsStyle[base.m_source.ID];
            }
            double num = 0.0;

            if (paddingsStyle != null)
            {
                paddingsStyle.GetPaddingValues(base.m_source, out this.m_padVertical, out this.m_padHorizontal, out num);
            }
            else
            {
                PaddingsStyle.CreatePaddingsStyle(pageContext, base.m_source, out this.m_padVertical, out this.m_padHorizontal, out num);
            }
        }
        public void GetPaddingValues(ReportItem source, out double padVertical, out double padHorizontal, out double padTop)
        {
            padVertical   = this.m_padVertical;
            padHorizontal = this.m_padHorizontal;
            padTop        = this.m_padTop;
            ReportSize reportSize = null;

            if ((this.m_state & PaddingState.Top) == PaddingState.Clear)
            {
                reportSize = PaddingsStyle.GetStyleValue(StyleAttributeNames.PaddingTop, source);
                if (reportSize != null)
                {
                    padTop       = reportSize.ToMillimeters();
                    padVertical += padTop;
                }
            }
            if ((this.m_state & PaddingState.Bottom) == PaddingState.Clear)
            {
                reportSize = PaddingsStyle.GetStyleValue(StyleAttributeNames.PaddingBottom, source);
                if (reportSize != null)
                {
                    padVertical += reportSize.ToMillimeters();
                }
            }
            if ((this.m_state & PaddingState.Left) == PaddingState.Clear)
            {
                reportSize = PaddingsStyle.GetStyleValue(StyleAttributeNames.PaddingLeft, source);
                if (reportSize != null)
                {
                    padHorizontal += reportSize.ToMillimeters();
                }
            }
            if ((this.m_state & PaddingState.Right) == PaddingState.Clear)
            {
                reportSize = PaddingsStyle.GetStyleValue(StyleAttributeNames.PaddingRight, source);
                if (reportSize != null)
                {
                    padHorizontal += reportSize.ToMillimeters();
                }
            }
        }
        public static void CreatePaddingsStyle(PageContext pageContext, ReportItem source, out double padVertical, out double padHorizontal, out double padTop)
        {
            padVertical   = 0.0;
            padHorizontal = 0.0;
            padTop        = 0.0;
            PaddingsStyle paddingsStyle = null;
            bool          flag          = true;
            double        num           = 0.0;
            ReportSize    styleValue    = PaddingsStyle.GetStyleValue(StyleAttributeNames.PaddingTop, ref flag, source);

            if (styleValue != null)
            {
                num = styleValue.ToMillimeters();
                if (flag)
                {
                    if (paddingsStyle == null)
                    {
                        paddingsStyle = new PaddingsStyle();
                    }
                    paddingsStyle.PadVertical += num;
                    paddingsStyle.PadTop       = num;
                    paddingsStyle.State       |= PaddingState.Top;
                }
                padTop       = num;
                padVertical += num;
            }
            flag       = true;
            styleValue = PaddingsStyle.GetStyleValue(StyleAttributeNames.PaddingBottom, ref flag, source);
            if (styleValue != null)
            {
                num = styleValue.ToMillimeters();
                if (flag)
                {
                    if (paddingsStyle == null)
                    {
                        paddingsStyle = new PaddingsStyle();
                    }
                    paddingsStyle.PadVertical += num;
                    paddingsStyle.State       |= PaddingState.Bottom;
                }
                padVertical += num;
            }
            flag       = true;
            styleValue = PaddingsStyle.GetStyleValue(StyleAttributeNames.PaddingLeft, ref flag, source);
            if (styleValue != null)
            {
                num = styleValue.ToMillimeters();
                if (flag)
                {
                    if (paddingsStyle == null)
                    {
                        paddingsStyle = new PaddingsStyle();
                    }
                    paddingsStyle.PadHorizontal += num;
                    paddingsStyle.State         |= PaddingState.Left;
                }
                padHorizontal += num;
            }
            flag       = true;
            styleValue = PaddingsStyle.GetStyleValue(StyleAttributeNames.PaddingRight, ref flag, source);
            if (styleValue != null)
            {
                num = styleValue.ToMillimeters();
                if (flag)
                {
                    if (paddingsStyle == null)
                    {
                        paddingsStyle = new PaddingsStyle();
                    }
                    paddingsStyle.PadHorizontal += num;
                    paddingsStyle.State         |= PaddingState.Right;
                }
                padHorizontal += num;
            }
            if (paddingsStyle != null)
            {
                if (pageContext.ItemPaddingsStyle == null)
                {
                    pageContext.ItemPaddingsStyle = new Hashtable();
                }
                pageContext.ItemPaddingsStyle.Add(source.ID, paddingsStyle);
            }
        }
        private static ReportSize GetStyleValue(StyleAttributeNames styleName, ReportItem source)
        {
            bool flag = false;

            return(PaddingsStyle.GetStyleValue(styleName, ref flag, source));
        }