Пример #1
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);
        }
Пример #2
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;
        }