Ejemplo n.º 1
0
        internal void ProcessBorders(GdiWriter writer, RPLItemProps properties, RectangleF bounds, byte state)
        {
            RPLFormat.BorderStyles stylePropertyValueBorderStyle = SharedRenderer.GetStylePropertyValueBorderStyle(properties, 5, RPLFormat.BorderStyles.None);
            m_borderLeft.Style   = SharedRenderer.GetStylePropertyValueBorderStyle(properties, 6, stylePropertyValueBorderStyle);
            m_borderRight.Style  = SharedRenderer.GetStylePropertyValueBorderStyle(properties, 7, stylePropertyValueBorderStyle);
            m_borderTop.Style    = SharedRenderer.GetStylePropertyValueBorderStyle(properties, 8, stylePropertyValueBorderStyle);
            m_borderBottom.Style = SharedRenderer.GetStylePropertyValueBorderStyle(properties, 9, stylePropertyValueBorderStyle);
            if (m_borderLeft.Style == RPLFormat.BorderStyles.None && m_borderRight.Style == RPLFormat.BorderStyles.None && m_borderTop.Style == RPLFormat.BorderStyles.None && m_borderBottom.Style == RPLFormat.BorderStyles.None)
            {
                return;
            }
            float stylePropertyValueSizeMM = GdiContext.GetStylePropertyValueSizeMM(properties, 10);

            m_borderLeft.Width = GdiContext.GetStylePropertyValueSizeMM(properties, 11);
            if (float.IsNaN(m_borderLeft.Width) && !float.IsNaN(stylePropertyValueSizeMM))
            {
                m_borderLeft.Width = stylePropertyValueSizeMM;
            }
            m_borderRight.Width = GdiContext.GetStylePropertyValueSizeMM(properties, 12);
            if (float.IsNaN(m_borderRight.Width) && !float.IsNaN(stylePropertyValueSizeMM))
            {
                m_borderRight.Width = stylePropertyValueSizeMM;
            }
            m_borderTop.Width = GdiContext.GetStylePropertyValueSizeMM(properties, 13);
            if (float.IsNaN(m_borderTop.Width) && !float.IsNaN(stylePropertyValueSizeMM))
            {
                m_borderTop.Width = stylePropertyValueSizeMM;
            }
            m_borderBottom.Width = GdiContext.GetStylePropertyValueSizeMM(properties, 14);
            if (float.IsNaN(m_borderBottom.Width) && !float.IsNaN(stylePropertyValueSizeMM))
            {
                m_borderBottom.Width = stylePropertyValueSizeMM;
            }
            if (!float.IsNaN(m_borderLeft.Width) || !float.IsNaN(m_borderRight.Width) || !float.IsNaN(m_borderTop.Width) || !float.IsNaN(m_borderBottom.Width))
            {
                Color stylePropertyValueColor = GdiContext.GetStylePropertyValueColor(properties, 0);
                m_borderLeft.Color = GdiContext.GetStylePropertyValueColor(properties, 1);
                if (m_borderLeft.Color == Color.Empty && stylePropertyValueColor != Color.Empty)
                {
                    m_borderLeft.Color = stylePropertyValueColor;
                }
                m_borderRight.Color = GdiContext.GetStylePropertyValueColor(properties, 2);
                if (m_borderRight.Color == Color.Empty && stylePropertyValueColor != Color.Empty)
                {
                    m_borderRight.Color = stylePropertyValueColor;
                }
                m_borderTop.Color = GdiContext.GetStylePropertyValueColor(properties, 3);
                if (m_borderTop.Color == Color.Empty && stylePropertyValueColor != Color.Empty)
                {
                    m_borderTop.Color = stylePropertyValueColor;
                }
                m_borderBottom.Color = GdiContext.GetStylePropertyValueColor(properties, 4);
                if (m_borderBottom.Color == Color.Empty && stylePropertyValueColor != Color.Empty)
                {
                    m_borderBottom.Color = stylePropertyValueColor;
                }
                if (!(m_borderLeft.Color == Color.Empty) || !(m_borderRight.Color == Color.Empty) || !(m_borderTop.Color == Color.Empty) || !(m_borderBottom.Color == Color.Empty))
                {
                    ProcessBorders(writer, ref m_borderTop, ref m_borderLeft, ref m_borderBottom, ref m_borderRight, base.Position, bounds, state);
                }
            }
        }
        internal void Search(GdiContext context, int paragraphIndex)
        {
            if (string.IsNullOrEmpty(context.SearchText))
            {
                m_searchResults    = null;
                m_firstSearchIndex = -1;
                m_lastSearchIndex  = -1;
                return;
            }
            if (m_searchResults != null)
            {
                m_searchResults.Clear();
            }
            string text  = Text;
            string text2 = context.SearchText;

            if (text2.IndexOf(' ') >= 0)
            {
                text2 = text2.Replace('\u00a0', ' ');
                text  = text.Replace('\u00a0', ' ');
            }
            int num = text.IndexOf(text2, 0, StringComparison.OrdinalIgnoreCase);

            if (num == -1)
            {
                return;
            }
            if (context.SearchMatches == null)
            {
                context.SearchMatches = new List <SearchMatch>();
            }
            if (m_searchResults == null)
            {
                m_searchResults = new List <SearchMatch>();
            }
            m_firstSearchIndex = context.SearchMatches.Count;
            int    num2  = -1;
            int    num3  = 0;
            string text3 = null;

            do
            {
                num2++;
                text3 = m_textRuns[num2].Text;
            }while (string.IsNullOrEmpty(text3) && num2 < m_textRuns.Count);
            while (num > -1)
            {
                while (num > num3 + text3.Length && num2 + 1 < m_textRuns.Count)
                {
                    num3 += text3.Length;
                    num2++;
                    text3 = m_textRuns[num2].Text;
                }
                TextBoxContext textBoxContext = new TextBoxContext();
                textBoxContext.ParagraphIndex        = paragraphIndex;
                textBoxContext.TextRunIndex          = num2;
                textBoxContext.TextRunCharacterIndex = num - num3;
                while (num3 + text3.Length < num + text2.Length && num2 + 1 < m_textRuns.Count)
                {
                    num3 += text3.Length;
                    num2++;
                    text3 = m_textRuns[num2].Text;
                }
                TextBoxContext textBoxContext2 = new TextBoxContext();
                textBoxContext2.ParagraphIndex        = paragraphIndex;
                textBoxContext2.TextRunIndex          = num2;
                textBoxContext2.TextRunCharacterIndex = num + text2.Length - num3;
                SearchMatch searchMatch = new SearchMatch(new RTSelectionHighlight(textBoxContext, textBoxContext2, SystemColors.Highlight));
                searchMatch.Point = new PointF(TextPosition.X, TextPosition.Y);
                m_searchResults.Add(searchMatch);
                context.SearchMatches.Add(searchMatch);
                m_lastSearchIndex = context.SearchMatches.Count - 1;
                num = text.IndexOf(text2, num + text2.Length, StringComparison.OrdinalIgnoreCase);
            }
        }
Ejemplo n.º 3
0
        internal static RenderingItem CreateRenderingItem(GdiContext context, RPLItemMeasurement measurement, RectangleF bounds)
        {
            if (!(measurement.Element is RPLLine) && (measurement.Width <= 0f || measurement.Height <= 0f))
            {
                return(null);
            }
            RenderingItem renderingItem = null;
            string        text          = null;

            if (measurement.Element is RPLTextBox)
            {
                renderingItem = new RenderingTextBox();
                text          = ReportPreviewStrings.ReportItemAccessibleNameTextBox;
            }
            else if (measurement.Element is RPLTablix)
            {
                renderingItem = new RenderingTablix();
                text          = ReportPreviewStrings.ReportItemAccessibleNameTablix;
            }
            else if (measurement.Element is RPLRectangle)
            {
                renderingItem = new RenderingRectangle();
                text          = ReportPreviewStrings.ReportItemAccessibleNameRectangle;
            }
            else if (measurement.Element is RPLSubReport)
            {
                renderingItem = new RenderingSubReport();
                text          = ReportPreviewStrings.ReportItemAccessibleNameSubreport;
            }
            else if (measurement.Element is RPLImage)
            {
                renderingItem = new RenderingImage();
                text          = ReportPreviewStrings.ReportItemAccessibleNameImage;
            }
            else if (measurement.Element is RPLChart)
            {
                renderingItem = new RenderingDynamicImage();
                text          = ReportPreviewStrings.ReportItemAccessibleNameChart;
            }
            else if (measurement.Element is RPLGaugePanel)
            {
                renderingItem = new RenderingDynamicImage();
                text          = ReportPreviewStrings.ReportItemAccessibleNameGaugePanel;
            }
            else if (measurement.Element is RPLMap)
            {
                renderingItem = new RenderingDynamicImage();
                text          = ReportPreviewStrings.ReportItemAccessibleNameMap;
            }
            else if (measurement.Element is RPLLine)
            {
                renderingItem = new RenderingLine();
                text          = ReportPreviewStrings.ReportItemAccessibleNameLine;
            }
            else
            {
                if (!(measurement.Element is RPLBody))
                {
                    return(null);
                }
                renderingItem = new RenderingBody();
                text          = ReportPreviewStrings.ReportItemAccessibleNameBody;
            }
            renderingItem.Initialize(context, measurement, bounds, text);
            return(renderingItem);
        }
 internal void Initialize(RPLElement rplElement, RectangleF bounds, int indexInParagraph)
 {
     Initialize(rplElement);
     m_indexInParagraph = indexInParagraph;
     m_position         = GdiContext.GetMeasurementRectangle(null, bounds);
 }