Exemplo n.º 1
0
        public RPLTextRun GetRPLTextRun(PageContext pageContext, bool hideDuplicates, TextBox.TextBoxOffset startPosition, TextBox.TextBoxOffset endPosition, int previousCount, List <AspNetCore.ReportingServices.Rendering.RichText.TextRun> richTextRuns)
        {
            RPLTextRun      rPLTextRun = new RPLTextRun();
            RPLTextRunProps props      = rPLTextRun.ElementProps as RPLTextRunProps;

            this.WriteElementProps(props, pageContext, hideDuplicates, startPosition, endPosition, previousCount, richTextRuns);
            return(rPLTextRun);
        }
Exemplo n.º 2
0
        public override void WriteNonSharedItemProps(RPLElementProps elemProps, RPLWriter rplWriter, PageContext pageContext)
        {
            AspNetCore.ReportingServices.OnDemandReportRendering.TextRun textRun = base.m_source as AspNetCore.ReportingServices.OnDemandReportRendering.TextRun;
            RSTrace.RenderingTracer.Assert(textRun != null, "The text run definition cannot be null");
            TextRunInstance textRunInstance = null;
            bool            flag            = false;

            if (this.m_compiledSource != null)
            {
                textRunInstance = this.m_compiledSource;
                flag            = true;
            }
            else
            {
                textRunInstance = textRun.Instance;
                RSTrace.RenderingTracer.Assert(textRunInstance != null, "The text run instance cannot be null");
            }
            elemProps.UniqueName = textRunInstance.UniqueName;
            RPLTextRunProps rPLTextRunProps = elemProps as RPLTextRunProps;

            if (!flag)
            {
                rPLTextRunProps.ProcessedWithError = textRunInstance.ProcessedWithError;
                if (textRun.MarkupType.IsExpression)
                {
                    rPLTextRunProps.Markup = (RPLFormat.MarkupStyles)StyleEnumConverter.Translate(textRunInstance.MarkupType);
                }
                if (textRun.ToolTip != null && textRun.ToolTip.IsExpression && textRunInstance.ToolTip != null)
                {
                    rPLTextRunProps.ToolTip = textRunInstance.ToolTip;
                }
                rPLTextRunProps.ActionInfo = base.WriteActionInfo(textRun.ActionInfo, pageContext);
            }
            else
            {
                rPLTextRunProps.Markup = (RPLFormat.MarkupStyles)StyleEnumConverter.Translate(textRunInstance.MarkupType);
                if (textRunInstance.ToolTip != null)
                {
                    rPLTextRunProps.ToolTip = textRunInstance.ToolTip;
                }
                if (this.m_compiledSource.ActionInstance != null)
                {
                    rPLTextRunProps.ActionInfo = this.WriteActionInstance(this.m_compiledSource.ActionInstance, pageContext);
                }
            }
            if ((pageContext.HideDuplicates || textRun.FormattedValueExpressionBased) && textRunInstance.Value != null)
            {
                rPLTextRunProps.Value = textRunInstance.Value;
            }
            pageContext.HideDuplicates     = false;
            pageContext.TypeCodeNonString  = false;
            rPLTextRunProps.NonSharedStyle = this.WriteNonSharedStyle(null, null, pageContext, this.m_compiledSource);
        }
Exemplo n.º 3
0
        public override void WriteSharedItemProps(RPLElementProps elemProps, RPLWriter rplWriter, PageContext pageContext)
        {
            AspNetCore.ReportingServices.OnDemandReportRendering.TextRun textRun = base.m_source as AspNetCore.ReportingServices.OnDemandReportRendering.TextRun;
            RSTrace.RenderingTracer.Assert(textRun != null, "The text run definition cannot be null");
            Hashtable hashtable = pageContext.ItemPropsStart;

            if (hashtable != null)
            {
                object obj = hashtable[this.SourceID];
                if (obj != null)
                {
                    elemProps.Definition = (RPLTextRunPropsDef)obj;
                    return;
                }
            }
            RPLTextRunProps    rPLTextRunProps    = elemProps as RPLTextRunProps;
            RPLTextRunPropsDef rPLTextRunPropsDef = rPLTextRunProps.Definition as RPLTextRunPropsDef;

            if (hashtable == null)
            {
                hashtable = (pageContext.ItemPropsStart = new Hashtable());
            }
            hashtable.Add(this.SourceID, rPLTextRunPropsDef);
            rPLTextRunPropsDef.ID = this.SourceID;
            if (!textRun.MarkupType.IsExpression)
            {
                rPLTextRunPropsDef.Markup = (RPLFormat.MarkupStyles)StyleEnumConverter.Translate(textRun.MarkupType.Value);
            }
            if (textRun.Label != null)
            {
                rPLTextRunPropsDef.Label = textRun.Label;
            }
            if (textRun.ToolTip != null && !textRun.ToolTip.IsExpression && textRun.ToolTip.Value != null)
            {
                rPLTextRunPropsDef.ToolTip = textRun.ToolTip.Value;
            }
            if (textRun.Value.IsExpression)
            {
                rPLTextRunPropsDef.Formula = textRun.Value.ExpressionString;
            }
            if (!pageContext.HideDuplicates && !textRun.FormattedValueExpressionBased && textRun.Value.Value != null)
            {
                if (textRun.SharedTypeCode == TypeCode.String)
                {
                    rPLTextRunPropsDef.Value = textRun.Value.Value;
                }
                else
                {
                    rPLTextRunPropsDef.Value = textRun.Instance.Value;
                }
            }
            rPLTextRunPropsDef.SharedStyle = this.WriteSharedStyle(null, pageContext);
        }
Exemplo n.º 4
0
 public RPLTextRun(RPLTextRunProps rplElementProps)
     : base(rplElementProps)
 {
 }
        public void DrawTextRun(TextRun run, Paragraph paragraph, Win32DCSafeHandle hdc, float dpiX, FontCache fontCache, int x, int y, int baselineY, int lineHeight, Rectangle layoutRectangle)
        {
            RPLFormat.WritingModes writingMode = WritingMode;
            if (string.IsNullOrEmpty(run.Text))
            {
                return;
            }
            Underline underline = null;

            if (run.UnderlineHeight > 0)
            {
                underline = new Underline(run, hdc, fontCache, layoutRectangle, x, baselineY, writingMode);
            }
            int x2;
            int baselineY2;

            switch (writingMode)
            {
            case RPLFormat.WritingModes.Horizontal:
                x2         = layoutRectangle.X + x;
                baselineY2 = layoutRectangle.Y + baselineY;
                break;

            case RPLFormat.WritingModes.Vertical:
                x2         = layoutRectangle.X + (layoutRectangle.Width - baselineY);
                baselineY2 = layoutRectangle.Y + x;
                break;

            case RPLFormat.WritingModes.Rotate270:
                x2         = layoutRectangle.X + baselineY;
                baselineY2 = layoutRectangle.Y + layoutRectangle.Height - x;
                break;

            default:
                throw new NotSupportedException();
            }
            if (!m_context.TestMode)
            {
                TextBox.DrawTextRun(run, hdc, fontCache, x2, baselineY2, underline);
            }
            else
            {
                TextBox.ExtDrawTextRun(run, hdc, fontCache, x2, baselineY2, underline);
            }
            RenderingTextRun renderingTextRun = run.TextRunProperties as RenderingTextRun;

            if (renderingTextRun == null)
            {
                return;
            }
            RPLTextRunProps rPLTextRunProps = renderingTextRun.InstanceProperties as RPLTextRunProps;

            if (rPLTextRunProps == null)
            {
                return;
            }
            float  num      = SharedRenderer.ConvertToMillimeters(run.GetWidth(hdc, fontCache), dpiX);
            float  num2     = SharedRenderer.ConvertToMillimeters(run.GetHeight(hdc, fontCache), dpiX);
            float  num3     = SharedRenderer.ConvertToMillimeters(x, dpiX);
            float  num4     = SharedRenderer.ConvertToMillimeters(y, dpiX);
            SizeF  empty    = SizeF.Empty;
            PointF location = PointF.Empty;

            if (writingMode == RPLFormat.WritingModes.Horizontal)
            {
                empty    = new SizeF(num, num2);
                location = new PointF(num3 + TextPosition.X, num4 - num2 + TextPosition.Y);
            }
            else
            {
                empty = new SizeF(num2, num);
                if (writingMode == RPLFormat.WritingModes.Vertical)
                {
                    float num5 = SharedRenderer.ConvertToMillimeters(layoutRectangle.Right, dpiX);
                    float num6 = SharedRenderer.ConvertToMillimeters(layoutRectangle.Y, dpiX);
                    location = new PointF(num5 - num4, num6 + num3);
                }
                else
                {
                    float num7 = SharedRenderer.ConvertToMillimeters(layoutRectangle.X, dpiX);
                    float num8 = SharedRenderer.ConvertToMillimeters(layoutRectangle.Bottom, dpiX);
                    location = new PointF(num7 + num4 - num2, num8 - num3 - num);
                }
            }
            RectangleF position = new RectangleF(location, empty);

            renderingTextRun.ProcessActions(m_context, rPLTextRunProps.UniqueName, rPLTextRunProps.ActionInfo, position);
            string toolTip = renderingTextRun.ToolTip;

            if (!string.IsNullOrEmpty(toolTip))
            {
                m_context.RenderingReport.ToolTips.Add(new ReportToolTip(rPLTextRunProps.UniqueName, position, toolTip));
            }
        }
Exemplo n.º 6
0
        private void WriteElementProps(RPLTextRunProps props, PageContext pageContext, bool hideDuplicates, TextBox.TextBoxOffset startPosition, TextBox.TextBoxOffset endPosition, int previousRunCount, List <AspNetCore.ReportingServices.Rendering.RichText.TextRun> richTextRuns)
        {
            Hashtable            itemPropsStart = pageContext.ItemPropsStart;
            string               text           = this.m_source.ID;
            bool                 flag           = true;
            ReportStringProperty value          = this.m_source.Value;

            if ((this.m_startCharacterOffset > 0 || endPosition != null || startPosition != null) && value != null && !this.m_source.FormattedValueExpressionBased)
            {
                text += "_NV";
                flag  = false;
            }
            RPLTextRunPropsDef  rPLTextRunPropsDef  = pageContext.Common.GetFromCache <RPLTextRunPropsDef>(text, out itemPropsStart);
            TextRunItemizedData textRunItemizedData = null;

            if (rPLTextRunPropsDef == null)
            {
                rPLTextRunPropsDef             = new RPLTextRunPropsDef();
                rPLTextRunPropsDef.SharedStyle = new RPLStyleProps();
                this.WriteSharedStyles(new StyleWriterOM(rPLTextRunPropsDef.SharedStyle), this.m_source.Style);
                if (this.m_source.Label != null)
                {
                    rPLTextRunPropsDef.Label = this.m_source.Label;
                }
                if (this.m_source.MarkupType != null && !this.m_source.MarkupType.IsExpression)
                {
                    rPLTextRunPropsDef.Markup = (RPLFormat.MarkupStyles)StyleEnumConverter.Translate(this.m_source.MarkupType.Value);
                }
                if (this.m_source.ToolTip != null && !this.m_source.ToolTip.IsExpression)
                {
                    rPLTextRunPropsDef.ToolTip = this.m_source.ToolTip.Value;
                }
                if (flag && value != null && !this.m_source.FormattedValueExpressionBased && !hideDuplicates)
                {
                    if (this.m_source.SharedTypeCode == TypeCode.String)
                    {
                        rPLTextRunPropsDef.Value = this.GetStringValue(value.Value, (TextBox.TextBoxOffset)null, (TextBox.TextBoxOffset)null, previousRunCount, richTextRuns, out textRunItemizedData);
                    }
                    else
                    {
                        rPLTextRunPropsDef.Value = this.GetStringValue(this.m_source.Instance.Value, (TextBox.TextBoxOffset)null, (TextBox.TextBoxOffset)null, previousRunCount, richTextRuns, out textRunItemizedData);
                    }
                }
                rPLTextRunPropsDef.ID = text;
                itemPropsStart[text]  = rPLTextRunPropsDef;
            }
            else if (richTextRuns != null && flag && !hideDuplicates && value != null && !this.m_source.FormattedValueExpressionBased)
            {
                textRunItemizedData = this.GetGlyphValue(value.Value, previousRunCount, richTextRuns);
            }
            props.Definition = rPLTextRunPropsDef;
            props.UniqueName = this.m_uniqueName;
            if (((int?)this.m_markup).HasValue)
            {
                props.Markup = (RPLFormat.MarkupStyles) this.m_markup.Value;
            }
            props.ToolTip = this.m_toolTip;
            TextRunItemizedData textRunItemizedData2 = null;

            if (!flag)
            {
                if (value != null && !hideDuplicates)
                {
                    if (this.m_source.SharedTypeCode == TypeCode.String)
                    {
                        props.Value = this.GetStringValue(value.Value, startPosition, endPosition, previousRunCount, richTextRuns, out textRunItemizedData2);
                    }
                    else
                    {
                        props.Value = this.GetStringValue(this.m_source.Instance.Value, startPosition, endPosition, previousRunCount, richTextRuns, out textRunItemizedData2);
                    }
                }
            }
            else
            {
                props.Value = this.GetStringValue(this.m_text, startPosition, endPosition, previousRunCount, richTextRuns, out textRunItemizedData2);
            }
            if (textRunItemizedData2 == null)
            {
                textRunItemizedData2 = textRunItemizedData;
            }
            pageContext.RegisterTextRunData(textRunItemizedData2);
            if (this.m_hyperlinks != null)
            {
                int count = this.m_hyperlinks.Count;
                props.ActionInfo = new RPLActionInfo(count);
                for (int i = 0; i < count; i++)
                {
                    string    text2     = this.m_hyperlinks[i];
                    RPLAction rPLAction = new RPLAction();
                    if (text2 != null)
                    {
                        rPLAction.Hyperlink = text2;
                    }
                    props.ActionInfo.Actions[i] = rPLAction;
                }
            }
            RPLStyleProps rPLStyleProps = null;

            if (this.m_styles != null)
            {
                rPLStyleProps = new RPLStyleProps();
                StyleWriterOM styleWriterOM = new StyleWriterOM(rPLStyleProps);
                styleWriterOM.WriteAll(this.m_styles);
            }
            props.NonSharedStyle = rPLStyleProps;
        }
Exemplo n.º 7
0
 internal RPLTextRun(RPLTextRunProps rplElementProps)
     : base(rplElementProps)
 {
 }
Exemplo n.º 8
0
 internal RPLTextRun()
 {
     m_rplElementProps            = new RPLTextRunProps();
     m_rplElementProps.Definition = new RPLTextRunPropsDef();
 }