示例#1
0
        private static void ProcessSingleListEntry(bool isCloseTag, ref int numberCount, FormattedText currentFormattedText, TinyHTMLParsersData parserData)
        {
            FormattedText.HTMLLikeListType listType = parserData.lastListType.Peek();
            currentFormattedText.ShouldDisplayBullet = !isCloseTag;
            if (listType != FormattedText.HTMLLikeListType.OrderedList)
            {
                return;
            }

            if (!isCloseTag)
            {
                ++numberCount;
            }

            currentFormattedText.Number = numberCount;
        }
示例#2
0
 public FormattedText(FormattedText prototypeFormattedText)
 {
     this.FontName         = prototypeFormattedText.fontName;
     this.fontColor        = prototypeFormattedText.fontColor;
     this.fontStyle        = prototypeFormattedText.fontStyle;
     this.FontSize         = prototypeFormattedText.FontSize;
     this.contentAlignment = prototypeFormattedText.contentAlignment;
     this.htmlTag          = prototypeFormattedText.htmlTag;
     this.bgColor          = prototypeFormattedText.bgColor;
     this.link             = prototypeFormattedText.link;
     this.offset           = prototypeFormattedText.offset;
     this.offsetSize       = prototypeFormattedText.offsetSize;
     this.number           = prototypeFormattedText.number;
     this.listType         = prototypeFormattedText.listType;
     this.bulletFontName   = prototypeFormattedText.bulletFontName;
     this.bulletFontSize   = prototypeFormattedText.bulletFontSize;
     this.bulletFontStyle  = prototypeFormattedText.bulletFontStyle;
     if (!string.IsNullOrEmpty(prototypeFormattedText.text))
     {
         return;
     }
     this.shouldDisplayBullet = prototypeFormattedText.shouldDisplayBullet;
 }
示例#3
0
        private static void ProcessListEntry(bool isCloseTag,
                                             FormattedText.HTMLLikeListType listType,
                                             Stack <FormattedText.HTMLLikeListType> lastListType,
                                             Stack <int> lastListNumber,
                                             FormattedText currentFormattedText)
        {
            if (!isCloseTag)
            {
                currentFormattedText.ListType = listType;
                lastListType.Push(listType);
                ++currentFormattedText.Offset;
                //format bullets
                currentFormattedText.BulletFontName  = currentFormattedText.FontName;
                currentFormattedText.BulletFontStyle = currentFormattedText.FontStyle;
                currentFormattedText.BulletFontSize  = currentFormattedText.FontSize;

                lastListNumber.Push(0);
            }
            else
            {
                if (lastListType.Count > 1)
                {
                    lastListType.Pop();
                    currentFormattedText.ListType = lastListType.Peek();
                }
                else
                {
                    currentFormattedText.ListType = FormattedText.HTMLLikeListType.None;
                }

                --currentFormattedText.Offset;
                if (lastListNumber.Count > 0)
                {
                    lastListNumber.Pop();
                }
            }
        }