示例#1
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);
        }
示例#2
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);
        }
        internal void PopulateStyleInstance(ICompiledStyleInstance styleInstance, bool isParagraphStyle)
        {
            if (isParagraphStyle)
            {
                TextAlignments textAlign = TextAlign;
                if (textAlign != 0)
                {
                    styleInstance.TextAlign = textAlign;
                }
                return;
            }
            ReportColor color = Color;

            if (color != null)
            {
                styleInstance.Color = color;
            }
            string fontFamily = FontFamily;

            if (!string.IsNullOrEmpty(fontFamily))
            {
                styleInstance.FontFamily = fontFamily;
            }
            ReportSize fontSize = FontSize;

            if (fontSize != null)
            {
                styleInstance.FontSize = fontSize;
            }
            FontStyles fontStyle = FontStyle;

            if (fontStyle != 0)
            {
                styleInstance.FontStyle = fontStyle;
            }
            FontWeights fontWeight = FontWeight;

            if (fontWeight != 0)
            {
                styleInstance.FontWeight = fontWeight;
            }
            TextDecorations textDecoration = TextDecoration;

            if (textDecoration != 0)
            {
                styleInstance.TextDecoration = textDecoration;
            }
        }
示例#4
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;
 }
示例#5
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;
 }
示例#6
0
        protected virtual ICompiledParagraphInstance CreateParagraphInstance()
        {
            if (!m_allowMultipleParagraphs && m_onlyParagraphInstance != null)
            {
                m_currentParagraphInstance = m_onlyParagraphInstance;
                AppendText(Environment.NewLine, onlyIfValueExists: true);
                return(m_onlyParagraphInstance);
            }
            ICompiledParagraphInstance compiledParagraphInstance = m_IRichTextInstanceCreator.CreateParagraphInstance();

            if (m_allowMultipleParagraphs)
            {
                m_currentParagraph.PopulateParagraph(compiledParagraphInstance);
                int listLevel = compiledParagraphInstance.ListLevel;
                if (listLevel > 9)
                {
                    if (!m_loggedListLevelWarning)
                    {
                        m_richTextLogger.RegisterOutOfRangeSizeWarning("ListLevel", Convert.ToString(listLevel, CultureInfo.InvariantCulture), Convert.ToString(0, CultureInfo.InvariantCulture), Convert.ToString(9, CultureInfo.InvariantCulture));
                        m_loggedListLevelWarning = true;
                    }
                    compiledParagraphInstance.ListLevel = 9;
                }
            }
            else
            {
                m_onlyParagraphInstance = compiledParagraphInstance;
            }
            ICompiledStyleInstance compiledStyleInstance = m_IRichTextInstanceCreator.CreateStyleInstance(isParagraph: true);

            m_currentStyle.PopulateStyleInstance(compiledStyleInstance, isParagraphStyle: true);
            compiledParagraphInstance.Style = compiledStyleInstance;
            IList <ICompiledTextRunInstance> list2 = compiledParagraphInstance.CompiledTextRunInstances = m_IRichTextInstanceCreator.CreateTextRunInstanceCollection();

            m_paragraphInstanceCollection.Add(compiledParagraphInstance);
            return(compiledParagraphInstance);
        }