/// <summary> /// Based on the current numbering creates and returns the appropriate ListItemNumberComponent along with a few other appropriate bits. /// </summary> /// <param name="item">The list item to build the Number component for</param> /// <param name="itemstyle">The full style of this list item</param> /// <param name="halign">The alignment as set, can be updated to explict item alignment</param> /// <param name="type">The current type of numbering</param> /// <param name="itemWidth">If an explicit width has been set then this is returned (otherwise -1)</param> /// <param name="text">If this item has explict text (e.g Definiton list) then this is returned, otherwise empty</param> /// <returns>The correct PDFListItemLabel for the item</returns> private Component BuildAListNumberComponent(ListItem item, Style itemstyle, ref HorizontalAlignment halign, out ListNumberingGroupStyle type, out PDFUnit itemWidth, out string text) { PDFListNumbering numbers = this.Component.Document.ListNumbering; type = numbers.CurrentGroup.Style; itemWidth = itemstyle.GetValue(StyleKeys.ListInsetKey, (PDFUnit)(-1)); text = itemstyle.GetValue(StyleKeys.ListLabelKey, string.Empty); halign = itemstyle.GetValue(StyleKeys.ListAlignmentKey, halign); ListItemLabel label; if (type == ListNumberingGroupStyle.Labels) { PDFListDefinitionItemLabel defn = new PDFListDefinitionItemLabel(); label = defn; } else if (type == ListNumberingGroupStyle.Bullet) { label = new PDFListBulletItemLabel(); } else { label = new ListItemLabel(); } label.StyleClass = item.StyleClass; return(label); }
// // open and close the list numbering // #region private void OpenListNumbering() private void OpenListNumbering() { string groupname = string.Empty; StyleValue <string> grp; if (this.FullStyle.TryGetValue(StyleKeys.ListGroupKey, out grp)) { groupname = grp.Value; } PDFListNumbering numbering = this.Component.Document.ListNumbering; numbering.PushGroup(groupname, this.FullStyle); }