UnsafeSetParent() публичный статический Метод

public static UnsafeSetParent ( CssBox box, CssBox parent ) : void
box CssBox
parent CssBox
Результат void
Пример #1
0
        public void Clear()
        {
            var linkNode = this._boxes.First;

            while (linkNode != null)
            {
                var box = linkNode.Value;
                CssBox.UnsafeSetParent(box, null);
                linkNode = linkNode.Next;
            }
            this._boxes.Clear();
        }
        public static CssBox CreateListItemBox(CssBox parent, HtmlElement childElement)
        {
            var spec   = childElement.Spec;
            var newBox = new CssBoxListItem(spec, parent.RootGfx);

            newBox.SetController(childElement);
            parent.AppendChild(newBox);
            if (spec.ListStyleType != CssListStyleType.None)
            {
                //create sub item collection
                var itemBulletBox = new CssBox(spec.GetAnonVersion(), parent.RootGfx);
                newBox.BulletBox = itemBulletBox;
                CssBox.UnsafeSetParent(itemBulletBox, newBox);
                CssBox.ChangeDisplayType(itemBulletBox, CssDisplay.Inline);
                //---------------------------------------------------------------
                //set content of bullet
                char[] text_content = null;
                switch (spec.ListStyleType)
                {
                case CssListStyleType.Disc:
                {
                    text_content = discItem;
                }
                break;

                case CssListStyleType.Circle:
                {
                    text_content = circleItem;
                }
                break;

                case CssListStyleType.Square:
                {
                    text_content = squareItem;
                }
                break;

                case CssListStyleType.Decimal:
                {
                    text_content = (GetIndexForList(newBox, childElement).ToString(CultureInfo.InvariantCulture) + ".").ToCharArray();
                }
                break;

                case CssListStyleType.DecimalLeadingZero:
                {
                    text_content = (GetIndexForList(newBox, childElement).ToString("00", CultureInfo.InvariantCulture) + ".").ToCharArray();
                }
                break;

                default:
                {
                    text_content = (BulletNumberFormatter.ConvertToAlphaNumber(GetIndexForList(newBox, childElement), spec.ListStyleType) + ".").ToCharArray();
                }
                break;
                }
                //---------------------------------------------------------------
                CssBox.UnsafeSetTextBuffer(itemBulletBox, text_content);
                List <CssRun> runlist = new List <CssRun>();
                bool          hasSomeCharacter;
                splitter.ParseWordContent(text_content, spec, itemBulletBox.IsBlock, runlist, out hasSomeCharacter);
                RunListHelper.AddRunList(itemBulletBox, spec, runlist, text_content, false);
            }
            return(newBox);
        }