/// <summary> /// Get the abstract Word numbering definition that maps to the given design style. /// </summary> public int GetNumbering(s.BulletStyle style, int level) { Dictionary <int, AbstractNumberingDefinition> inner = null; AbstractNumberingDefinition def = null; bool found = _abstractDefinitions.TryGetValue(style, out inner); if (found) { found = inner.TryGetValue(level, out def); if (found) { return(def.Id); } } throw new Exception($"Numbering style {style}@{level} not found."); }
/// <summary> /// Create and add a new Word numbering style to represent the given design /// bullet style at the given level. If the bullet style already has a /// representation at this level then return that representation's id. /// </summary> public int AddAbstractDefinition(s.BulletStyle style, int level, string bulletText) { Dictionary <int, AbstractNumberingDefinition> inner = null; AbstractNumberingDefinition def = null; bool found = _abstractDefinitions.TryGetValue(style, out inner); if (found) { found = inner.TryGetValue(level, out def); if (found) { return(def.Id); } } if (inner == null) { inner = new Dictionary <int, AbstractNumberingDefinition>(); _abstractDefinitions.Add(style, inner); } def = new AbstractNumberingDefinition(style, level, bulletText); inner.Add(level, def); return(def.Id); }