private DqNumbering ConvertAbstractNum(AbstractNum abstractNum) { var dqNumbering = new DqNumbering(); dqNumbering.Levels.AddRange(abstractNum.Descendants <Level>().Select(ConvertLevel)); return(dqNumbering); }
/// <summary> /// Create a NumberingConfig from an AbstractNum. /// </summary> /// <param name="abstractNum">AbstractNum used as template for the numbering config.</param> /// <returns>NumeringConfig created from the AbstractNum.</returns> public Config CreateFromAbstractNumbering(AbstractNum abstractNum) { var numberingConfig = new Config(); numberingConfig.AbstractNumberingId = abstractNum.AbstractNumberId.Value; var levels = abstractNum.Descendants <Level>(); if (levels.Count() == 0 && abstractNum.Descendants <NumberingStyleLink>().SingleOrDefault() != null) { var numberingStyleLink = abstractNum.Descendants <NumberingStyleLink>().SingleOrDefault(); throw new LinkedStyleNumberingException(numberingStyleLink.Val.Value); } foreach (var level in levels) { var indentation = CreateIndentationConfigForAbstract(numberingConfig.AbstractNumberingId, level); numberingConfig.AddLevel(indentation); } return(numberingConfig); }