예제 #1
0
 internal virtual IList <ICompiledParagraphInstance> Parse(string richText)
 {
     m_currentStyle                = new CompiledStyleInfo();
     m_currentParagraph            = new CompiledParagraphInfo();
     m_paragraphInstanceCollection = m_IRichTextInstanceCreator.CreateParagraphInstanceCollection();
     if (!string.IsNullOrEmpty(richText))
     {
         InternalParse(richText);
     }
     m_currentParagraph = new CompiledParagraphInfo();
     if (m_paragraphInstanceCollection.Count == 0)
     {
         m_currentParagraphInstance       = CreateParagraphInstance();
         m_currentTextRunInstance         = CreateTextRunInstance();
         m_currentParagraphInstance.Style = m_IRichTextInstanceCreator.CreateStyleInstance(isParagraph: true);
         m_currentTextRunInstance.Style   = m_IRichTextInstanceCreator.CreateStyleInstance(isParagraph: false);
     }
     else
     {
         for (int i = 0; i < m_paragraphInstanceCollection.Count; i++)
         {
             m_currentParagraphInstance = m_paragraphInstanceCollection[i];
             if (m_currentParagraphInstance.CompiledTextRunInstances == null || m_currentParagraphInstance.CompiledTextRunInstances.Count == 0)
             {
                 m_currentTextRunInstance       = CreateTextRunInstance();
                 m_currentTextRunInstance.Style = m_IRichTextInstanceCreator.CreateStyleInstance(isParagraph: true);
             }
         }
     }
     CloseParagraph();
     return(m_paragraphInstanceCollection);
 }
예제 #2
0
 public virtual IList <ICompiledParagraphInstance> Parse(string richText)
 {
     this.m_currentStyle                = new CompiledStyleInfo();
     this.m_currentParagraph            = new CompiledParagraphInfo();
     this.m_paragraphInstanceCollection = this.m_IRichTextInstanceCreator.CreateParagraphInstanceCollection();
     if (!string.IsNullOrEmpty(richText))
     {
         this.InternalParse(richText);
     }
     this.m_currentParagraph = new CompiledParagraphInfo();
     if (this.m_paragraphInstanceCollection.Count == 0)
     {
         this.m_currentParagraphInstance       = this.CreateParagraphInstance();
         this.m_currentTextRunInstance         = this.CreateTextRunInstance();
         this.m_currentParagraphInstance.Style = this.m_IRichTextInstanceCreator.CreateStyleInstance(true);
         this.m_currentTextRunInstance.Style   = this.m_IRichTextInstanceCreator.CreateStyleInstance(false);
     }
     else
     {
         for (int i = 0; i < this.m_paragraphInstanceCollection.Count; i++)
         {
             this.m_currentParagraphInstance = this.m_paragraphInstanceCollection[i];
             if (this.m_currentParagraphInstance.CompiledTextRunInstances == null || this.m_currentParagraphInstance.CompiledTextRunInstances.Count == 0)
             {
                 this.m_currentTextRunInstance       = this.CreateTextRunInstance();
                 this.m_currentTextRunInstance.Style = this.m_IRichTextInstanceCreator.CreateStyleInstance(true);
             }
         }
     }
     this.CloseParagraph();
     return(this.m_paragraphInstanceCollection);
 }
예제 #3
0
        protected override ICompiledTextRunInstance CreateTextRunInstance()
        {
            ICompiledTextRunInstance compiledTextRunInstance = base.CreateTextRunInstance();

            compiledTextRunInstance.MarkupType = MarkupType.HTML;
            if (this.m_currentHyperlinkText != null)
            {
                IActionInstance actionInstance = base.m_IRichTextInstanceCreator.CreateActionInstance();
                actionInstance.SetHyperlinkText(this.m_currentHyperlinkText);
                compiledTextRunInstance.ActionInstance = actionInstance;
            }
            return(compiledTextRunInstance);
        }
예제 #4
0
        protected virtual ICompiledTextRunInstance CreateTextRunInstance()
        {
            if (m_currentParagraphInstance == null)
            {
                m_currentParagraphInstance = CreateParagraphInstance();
            }
            IList <ICompiledTextRunInstance> compiledTextRunInstances = m_currentParagraphInstance.CompiledTextRunInstances;
            ICompiledTextRunInstance         compiledTextRunInstance  = m_IRichTextInstanceCreator.CreateTextRunInstance();
            ICompiledStyleInstance           styleInstance            = compiledTextRunInstance.Style = m_IRichTextInstanceCreator.CreateStyleInstance(isParagraph: false);

            m_currentStyle.PopulateStyleInstance(styleInstance, isParagraphStyle: false);
            compiledTextRunInstances.Add(compiledTextRunInstance);
            return(compiledTextRunInstance);
        }
 private void Parse()
 {
     if (m_parsed)
     {
         return;
     }
     try
     {
         m_parsed = true;
         m_paragraphDef.CriGenerationPhase = ReportElement.CriGenerationPhases.Definition;
         m_textRunDef.CriGenerationPhase   = ReportElement.CriGenerationPhases.Definition;
         ReportEnumProperty <MarkupType> markupType = m_textRunDef.MarkupType;
         MarkupType     markupType2    = (!markupType.IsExpression) ? markupType.Value : m_textRunDef.Instance.MarkupType;
         RichTextParser richTextParser = null;
         if (markupType2 != MarkupType.HTML)
         {
             return;
         }
         richTextParser = new HtmlParser(m_multipleParagraphsAllowed, this, this);
         InternalTextRunInstance internalTextRunInstance = (InternalTextRunInstance)m_textRunDef.Instance;
         Microsoft.ReportingServices.RdlExpressions.VariantResult originalValue = internalTextRunInstance.GetOriginalValue();
         if (!originalValue.ErrorOccurred && originalValue.TypeCode != 0)
         {
             try
             {
                 string richText = (originalValue.TypeCode != TypeCode.String) ? internalTextRunInstance.TextRunDef.FormatTextRunValue(originalValue.Value, originalValue.TypeCode, m_textRunDef.RenderingContext.OdpContext) : (originalValue.Value as string);
                 m_compiledParagraphCollection = (CompiledParagraphInstanceCollection)richTextParser.Parse(richText);
             }
             catch (Exception ex)
             {
                 m_errorContext.Register(ProcessingErrorCode.rsInvalidRichTextParseFailed, Severity.Warning, "TextRun", internalTextRunInstance.TextRunDef.Name, ex.Message);
                 m_parseErrorOccured         = true;
                 CreateSingleTextRun().Value = RPRes.rsRichTextParseErrorValue;
             }
         }
         else
         {
             ICompiledTextRunInstance compiledTextRunInstance = CreateSingleTextRun();
             if (originalValue.ErrorOccurred)
             {
                 compiledTextRunInstance.Value = RPRes.rsExpressionErrorValue;
             }
         }
     }
     finally
     {
         m_textRunDef.CriGenerationPhase   = ReportElement.CriGenerationPhases.None;
         m_paragraphDef.CriGenerationPhase = ReportElement.CriGenerationPhases.None;
     }
 }
예제 #6
0
        protected virtual ICompiledTextRunInstance CreateTextRunInstance()
        {
            if (this.m_currentParagraphInstance == null)
            {
                this.m_currentParagraphInstance = this.CreateParagraphInstance();
            }
            IList <ICompiledTextRunInstance> compiledTextRunInstances = this.m_currentParagraphInstance.CompiledTextRunInstances;
            ICompiledTextRunInstance         compiledTextRunInstance  = this.m_IRichTextInstanceCreator.CreateTextRunInstance();
            ICompiledStyleInstance           styleInstance            = compiledTextRunInstance.Style = this.m_IRichTextInstanceCreator.CreateStyleInstance(false);

            this.m_currentStyle.PopulateStyleInstance(styleInstance, false);
            compiledTextRunInstances.Add(compiledTextRunInstance);
            return(compiledTextRunInstance);
        }
예제 #7
0
 protected virtual bool AppendText(string value, bool onlyIfValueExists)
 {
     if (m_currentParagraphInstance != null)
     {
         IList <ICompiledTextRunInstance> compiledTextRunInstances = m_currentParagraphInstance.CompiledTextRunInstances;
         if (compiledTextRunInstances.Count > 0)
         {
             m_currentTextRunInstance = compiledTextRunInstances[compiledTextRunInstances.Count - 1];
             if (onlyIfValueExists && string.IsNullOrEmpty(m_currentTextRunInstance.Value))
             {
                 m_currentTextRunInstance = null;
                 return(false);
             }
         }
     }
     SetTextRunValue(value);
     return(true);
 }
예제 #8
0
 protected virtual void SetTextRunValue(string value)
 {
     if (m_currentTextRunInstance == null)
     {
         m_currentTextRunInstance = CreateTextRunInstance();
     }
     m_currentTextRunInstance.Value += value;
     if (m_currentTextRunInstance.Style == null)
     {
         ICompiledStyleInstance compiledStyleInstance = m_IRichTextInstanceCreator.CreateStyleInstance(isParagraph: false);
         m_currentStyle.PopulateStyleInstance(compiledStyleInstance, isParagraphStyle: false);
         m_currentTextRunInstance.Style = compiledStyleInstance;
     }
     if (m_currentParagraphInstance.Style == null)
     {
         m_currentParagraphInstance.Style = m_IRichTextInstanceCreator.CreateStyleInstance(isParagraph: true);
     }
     m_currentTextRunInstance = null;
 }
예제 #9
0
 protected virtual void SetTextRunValue(string value)
 {
     if (this.m_currentTextRunInstance == null)
     {
         this.m_currentTextRunInstance = this.CreateTextRunInstance();
     }
     this.m_currentTextRunInstance.Value = this.m_currentTextRunInstance.Value + value;
     if (this.m_currentTextRunInstance.Style == null)
     {
         ICompiledStyleInstance compiledStyleInstance = this.m_IRichTextInstanceCreator.CreateStyleInstance(false);
         this.m_currentStyle.PopulateStyleInstance(compiledStyleInstance, false);
         this.m_currentTextRunInstance.Style = compiledStyleInstance;
     }
     if (this.m_currentParagraphInstance.Style == null)
     {
         this.m_currentParagraphInstance.Style = this.m_IRichTextInstanceCreator.CreateStyleInstance(true);
     }
     this.m_currentTextRunInstance = null;
 }
예제 #10
0
 protected virtual void CloseParagraph()
 {
     m_currentParagraphInstance = null;
     m_currentTextRunInstance   = null;
 }
 bool ICollection <ICompiledTextRunInstance> .Contains(ICompiledTextRunInstance item)
 {
     return(this.m_compiledTextRunInstances.Contains((CompiledTextRunInstance)item));
 }
 void ICollection <ICompiledTextRunInstance> .Add(ICompiledTextRunInstance item)
 {
     this.m_compiledTextRunInstances.Add((CompiledTextRunInstance)item);
 }
 void IList <ICompiledTextRunInstance> .Insert(int index, ICompiledTextRunInstance item)
 {
     this.m_compiledTextRunInstances.Insert(index, (CompiledTextRunInstance)item);
 }
 int IList <ICompiledTextRunInstance> .IndexOf(ICompiledTextRunInstance item)
 {
     return(this.m_compiledTextRunInstances.IndexOf((CompiledTextRunInstance)item));
 }
 bool ICollection <ICompiledTextRunInstance> .Remove(ICompiledTextRunInstance item)
 {
     return(this.m_compiledTextRunInstances.Remove((CompiledTextRunInstance)item));
 }