private static void CacheItem( int numberingInstanceId, ParagraphStateCache cache, List <int> vector, NumberItem item) { var targetedIdentationLevel = item.IndentationLevel; var currentIndentationLevel = vector.Count - 1; if (targetedIdentationLevel <= currentIndentationLevel) { vector[targetedIdentationLevel]++; if (targetedIdentationLevel < currentIndentationLevel) { vector.RemoveRange(targetedIdentationLevel + 1, vector.Count - targetedIdentationLevel - 1); } } else { while (vector.Count <= item.IndentationLevel) { vector.Add(0); } } var itemVector = new int[vector.Count]; vector.CopyTo(itemVector); cache.Add(item.Paragraph, new ParagraphState { Indentations = itemVector, NumberingInstanceId = numberingInstanceId }); }
public ParagraphStateCache Create() { var cache = new ParagraphStateCache(); CacheNumberLists(cache); return(cache); }
private void Initialize() { try { _nconfCache = new ConfigCache(_numbering, _styles, new ConfigFactory()); _pstateCache = new ParagraphStateCacheFactory(_styles, _body).Create(); } catch { } }
private void Initialize() { try { _nconfCache = new ConfigCache(_numbering, _styles, new ConfigFactory()); var fac = new ParagraphStateCacheFactory { Body = _body, Styles = _styles, Numbering = _numbering }; _pstateCache = fac.Create(); } catch { } }
private void CacheNumberLists(ParagraphStateCache cache) { foreach (var numberList in NumberLists) { // Parallel.ForEach(NumberLists, numberList => //{ var vector = new List <int>(); foreach (var item in numberList.Items) { CacheItem(numberList.NumberingInstanceId, cache, vector, item); } //}); } }