internal virtual void DrawContent(GdiContext context)
 {
 }
 internal virtual void ProcessRenderingElementContent(RPLElement rplElement, GdiContext context, RectangleF bounds)
 {
 }
Пример #3
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);
                }
            }
        }
Пример #4
0
        internal override void DrawContent(GdiContext context)
        {
            RPLTextBoxPropsDef rPLTextBoxPropsDef = DefinitionProperties as RPLTextBoxPropsDef;
            RPLTextBoxProps    rPLTextBoxProps    = InstanceProperties as RPLTextBoxProps;

            if (rPLTextBoxProps.IsToggleParent)
            {
                GetToggleImage(context.GdiWriter, out Bitmap image);
                if (m_toggleRectangleMM.Width > 0f)
                {
                    DrawResourceImage(imageRectanglePX: new RectangleF(0f, 0f, image.Width, image.Height), context: context, image: image, itemRectangleMM: m_toggleRectangleMM);
                }
            }
            if (rPLTextBoxPropsDef.CanSort)
            {
                GetSortImage(context.GdiWriter, out Bitmap image2, out SortOrder _);
                if (m_sortRectangleMM.Width > 0f)
                {
                    DrawResourceImage(imageRectanglePX: new RectangleF(0f, 0f, image2.Width, image2.Height), context: context, image: image2, itemRectangleMM: m_sortRectangleMM);
                }
            }
            if (TextPosition.Width <= 0f || TextPosition.Height <= 0f)
            {
                return;
            }
            RPLFormat.WritingModes writingMode = WritingMode;
            float contentHeight  = 0f;
            float contentHeight2 = 0f;

            if (writingMode == RPLFormat.WritingModes.Horizontal)
            {
                contentHeight = rPLTextBoxProps.ContentHeight;
            }
            else
            {
                contentHeight2 = rPLTextBoxProps.ContentHeight;
            }
            List <Paragraph>            list  = null;
            List <RTSelectionHighlight> list2 = null;
            FlowContext flowContext           = new FlowContext(TextPosition.Width, TextPosition.Height);
            bool        flag = !rPLTextBoxPropsDef.CanGrow && !rPLTextBoxPropsDef.CanShrink;

            if (flag)
            {
                m_richTextBox.Paragraphs = new List <Paragraph>(m_paragraphs.Count);
                for (int i = 0; i < m_paragraphs.Count; i++)
                {
                    RTSelectionHighlight searchHit = m_paragraphs[i].GetSearchHit(context);
                    if (searchHit != null)
                    {
                        context.TextRunIndexHitStart = searchHit.SelectionStart.TextRunIndex;
                        context.TextRunIndexHitEnd   = searchHit.SelectionEnd.TextRunIndex;
                    }
                    m_paragraphs[i].DrawContent(context);
                    m_richTextBox.Paragraphs.Add(m_paragraphs[i].RichParagraph);
                    context.TextRunIndexHitStart = -1;
                    context.TextRunIndexHitEnd   = -1;
                }
                m_richTextBox.ScriptItemize();
                if (writingMode == RPLFormat.WritingModes.Horizontal)
                {
                    TextBox.MeasureFullHeight(m_richTextBox, context.Graphics, context.FontCache, flowContext, out contentHeight);
                }
                else
                {
                    TextBox.MeasureFullHeight(m_richTextBox, context.Graphics, context.FontCache, flowContext, out contentHeight2);
                }
                list = m_richTextBox.Paragraphs;
                m_richTextBox.Paragraphs = null;
            }
            if (writingMode == RPLFormat.WritingModes.Horizontal)
            {
                if (contentHeight + 0.001f > TextPosition.Height)
                {
                    flowContext.LineLimit = false;
                }
            }
            else if (contentHeight2 + 0.001f > TextPosition.Width)
            {
                flowContext.LineLimit = false;
            }
            m_richTextBox.Paragraphs = new List <Paragraph>(1);
            bool  flag2 = true;
            float num   = 0f;
            float num2  = 0f;

            for (int j = 0; j < m_paragraphs.Count; j++)
            {
                if (writingMode == RPLFormat.WritingModes.Horizontal)
                {
                    if (num > 0f)
                    {
                        if (num >= TextPosition.Height)
                        {
                            break;
                        }
                        flowContext.Height = TextPosition.Height - num;
                    }
                }
                else if (num2 > 0f)
                {
                    if (num2 >= TextPosition.Width)
                    {
                        break;
                    }
                    flowContext.Width = TextPosition.Width - num2;
                }
                RTSelectionHighlight searchHit2 = m_paragraphs[j].GetSearchHit(context);
                if (!flag)
                {
                    if (searchHit2 != null)
                    {
                        context.TextRunIndexHitStart = searchHit2.SelectionStart.TextRunIndex;
                        context.TextRunIndexHitEnd   = searchHit2.SelectionEnd.TextRunIndex;
                    }
                    m_paragraphs[j].DrawContent(context);
                    m_richTextBox.Paragraphs.Add(m_paragraphs[j].RichParagraph);
                    context.TextRunIndexHitStart = -1;
                    context.TextRunIndexHitEnd   = -1;
                    m_richTextBox.ScriptItemize();
                }
                else
                {
                    m_richTextBox.Paragraphs.Add(list[0]);
                }
                if (searchHit2 != null)
                {
                    searchHit2.SelectionStart.ParagraphIndex = 0;
                    searchHit2.SelectionEnd.ParagraphIndex   = 0;
                    list2 = new List <RTSelectionHighlight>(0);
                    list2.Add(searchHit2);
                }
                float            height          = 0f;
                List <Paragraph> rTParagraphs    = LineBreaker.Flow(m_richTextBox, context.Graphics, context.FontCache, flowContext, keepLines: true, out height);
                RectangleF       layoutParagraph = RectangleF.Empty;
                PointF           offset          = PointF.Empty;
                float            delta           = 0f;
                if (writingMode == RPLFormat.WritingModes.Horizontal)
                {
                    AdjustParagraphLayout(contentHeight, height, num, flag2, writingMode, ref delta, ref layoutParagraph, ref offset);
                }
                else
                {
                    AdjustParagraphLayout(contentHeight2, height, num2, flag2, writingMode, ref delta, ref layoutParagraph, ref offset);
                }
                m_context = context;
                m_paragraphs[j].TextPosition = layoutParagraph;
                RichTextRenderer richTextRenderer = new RichTextRenderer();
                try
                {
                    richTextRenderer.SetTextbox(m_richTextBox);
                    richTextRenderer.RTParagraphs = rTParagraphs;
                    richTextRenderer.FontCache    = context.FontCache;
                    if (writingMode == RPLFormat.WritingModes.Horizontal)
                    {
                        RenderRichText(richTextRenderer, context.Graphics, TextPosition, offset, list2);
                    }
                    else
                    {
                        RenderRichText(richTextRenderer, context.Graphics, layoutParagraph, offset, list2);
                    }
                    richTextRenderer.FontCache = null;
                }
                finally
                {
                    if (richTextRenderer != null)
                    {
                        richTextRenderer.Dispose();
                        richTextRenderer = null;
                    }
                }
                m_context = null;
                flowContext.Reset();
                if (writingMode == RPLFormat.WritingModes.Horizontal)
                {
                    if (flag2)
                    {
                        num  += delta;
                        flag2 = false;
                    }
                    num += height;
                }
                else
                {
                    if (flag2)
                    {
                        num2 += delta;
                        flag2 = false;
                    }
                    num2 += height;
                }
                if (searchHit2 != null)
                {
                    searchHit2.SelectionStart.ParagraphIndex = j;
                    searchHit2.SelectionEnd.ParagraphIndex   = j;
                }
                m_richTextBox.Paragraphs.RemoveAt(0);
                if (!flag)
                {
                    m_paragraphs[j].RichParagraph = null;
                }
                else
                {
                    list.RemoveAt(0);
                }
            }
            if (list != null && list.Count > 0)
            {
                list.Clear();
            }
            list = null;
        }
Пример #5
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);
        }