Beispiel #1
0
        private void WriteElementProps(BinaryWriter spbifWriter, PageContext pageContext, bool hideDuplicates, TextBox.TextBoxOffset startPosition, TextBox.TextBoxOffset endPosition, int previousRunCount, List <Microsoft.ReportingServices.Rendering.RichText.TextRun> richTextRuns)
        {
            StyleWriterStream styleWriterStream = new StyleWriterStream(spbifWriter);
            string            text = m_source.ID;
            bool flag = true;
            ReportStringProperty value = m_source.Value;

            if ((m_startCharacterOffset > 0 || endPosition != null || startPosition != null) && value != null && !m_source.FormattedValueExpressionBased)
            {
                text += "_NV";
                flag  = false;
            }
            TextRunItemizedData glyphData = null;
            string    value2             = null;
            Hashtable itemPropsStart     = pageContext.ItemPropsStart;
            long      primitiveFromCache = pageContext.Common.GetPrimitiveFromCache <long>(text, out itemPropsStart);

            if (primitiveFromCache <= 0)
            {
                primitiveFromCache   = spbifWriter.BaseStream.Position;
                itemPropsStart[text] = primitiveFromCache;
                spbifWriter.Write((byte)15);
                spbifWriter.Write((byte)0);
                spbifWriter.Write((byte)6);
                spbifWriter.Write((byte)0);
                WriteSharedStyles(styleWriterStream, m_source.Style);
                spbifWriter.Write(byte.MaxValue);
                styleWriterStream.WriteNotNull(5, text);
                styleWriterStream.WriteNotNull(8, m_source.Label);
                if (m_source.MarkupType != null)
                {
                    styleWriterStream.Write(7, StyleEnumConverter.Translate(m_source.MarkupType.Value));
                }
                styleWriterStream.WriteSharedProperty(9, m_source.ToolTip);
                if (flag && !hideDuplicates && value != null && !m_source.FormattedValueExpressionBased)
                {
                    if (m_source.SharedTypeCode == TypeCode.String)
                    {
                        styleWriterStream.WriteNotNull(10, GetStringValue(value.Value, null, null, previousRunCount, richTextRuns, out glyphData));
                    }
                    else
                    {
                        styleWriterStream.WriteNotNull(10, GetStringValue(m_source.Instance.Value, null, null, previousRunCount, richTextRuns, out glyphData));
                    }
                }
                spbifWriter.Write(byte.MaxValue);
            }
            else
            {
                spbifWriter.Write((byte)15);
                spbifWriter.Write((byte)2);
                spbifWriter.Write(primitiveFromCache);
                if (richTextRuns != null && flag && !hideDuplicates && value != null && !m_source.FormattedValueExpressionBased)
                {
                    glyphData = GetGlyphValue(value.Value, previousRunCount, richTextRuns);
                }
            }
            spbifWriter.Write((byte)1);
            TextRunItemizedData glyphData2 = null;

            if (!flag)
            {
                if (!hideDuplicates && value != null)
                {
                    value2 = ((m_source.SharedTypeCode != TypeCode.String) ? GetStringValue(m_source.Instance.Value, startPosition, endPosition, previousRunCount, richTextRuns, out glyphData2) : GetStringValue(value.Value, startPosition, endPosition, previousRunCount, richTextRuns, out glyphData2));
                }
            }
            else
            {
                value2 = GetStringValue(m_text, startPosition, endPosition, previousRunCount, richTextRuns, out glyphData2);
            }
            if (glyphData2 == null)
            {
                glyphData2 = glyphData;
            }
            pageContext.RegisterTextRunData(glyphData2);
            styleWriterStream.WriteNotNull(10, value2);
            styleWriterStream.WriteNotNull(9, m_toolTip);
            styleWriterStream.WriteNotNull(4, m_uniqueName);
            styleWriterStream.WriteNotNull(7, m_markup);
            spbifWriter.Write((byte)6);
            spbifWriter.Write((byte)1);
            if (m_styles != null)
            {
                styleWriterStream.WriteAll(m_styles);
            }
            spbifWriter.Write(byte.MaxValue);
            WriteActions(spbifWriter);
            spbifWriter.Write(byte.MaxValue);
            spbifWriter.Write(byte.MaxValue);
        }
Beispiel #2
0
        private void WriteElementProps(RPLTextRunProps props, PageContext pageContext, bool hideDuplicates, TextBox.TextBoxOffset startPosition, TextBox.TextBoxOffset endPosition, int previousRunCount, List <Microsoft.ReportingServices.Rendering.RichText.TextRun> richTextRuns)
        {
            Hashtable            itemPropsStart = pageContext.ItemPropsStart;
            string               text           = m_source.ID;
            bool                 flag           = true;
            ReportStringProperty value          = m_source.Value;

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

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

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

            if (m_styles != null)
            {
                rPLStyleProps = new RPLStyleProps();
                new StyleWriterOM(rPLStyleProps).WriteAll(m_styles);
            }
            props.NonSharedStyle = rPLStyleProps;
        }