private void AddNumberingProps(CssClass cssClass, RunClassParam param) { if (!param.NumberingId.HasValue || !param.NumberingLevel.HasValue) { return; } cssClass.Props.AddMany(_numPropsCache.Get(param.NumberingId.Value, param.NumberingLevel.Value)); }
private void AddRunStyle(CssClass cssClass, string styleId) { if (styleId == null) { return; } cssClass.Props.AddMany(_rStylePropsCache.Get(styleId)); }
private void AddOrSet(CssClass cssClass, CssPropertiesSet props) { if (cssClass.Props.Count > 0) { cssClass.Props.AddMany(props); } else { cssClass.Props = props; } }
private void AddNumberingStyleProps(ParagraphClassParam param, CssClass cssClass) { if (!param.NumberingId.HasValue || !param.NumberingLevel.HasValue) { return; } AddOrSet( cssClass, _numPropsCache.Get( param.NumberingId.Value, param.NumberingLevel.Value)); }
private void AddTableStyle(CssClass cssClass, List <OpenXmlElement> tableProperties) { if (tableProperties == null || tableProperties.Count == 0) { return; } for (int i = tableProperties.Count - 1; i >= 0; i--) { var cssPropSet = _propsFac.Build(tableProperties[i]); cssClass.Props.AddMany(cssPropSet); } }
private void AddStyleProps(string styleId, CssClass cssClass) { if (styleId != null) { AddOrSet(cssClass, _stylePropsCache.Get(styleId)); return; } if (_defaultsProvider.DefaultParagraphStyle != null) { var props = _stylePropsCache.Get(_defaultsProvider.DefaultParagraphStyle); AddOrSet(cssClass, props); } }
private void AddTableProps(List <OpenXmlElement> tableProperties, CssClass cssClass) { if (tableProperties == null || tableProperties.Count == 0) { return; } for (int i = tableProperties.Count - 1; i >= 0; i--) { var elem = tableProperties[i]; var props = _propsFac.Build(elem); AddOrSet(cssClass, props); } }
private void AddRunStyle(CssClass cssClass, string styleId) { if (styleId != null) { cssClass.Props.AddMany(_rStylePropsCache.Get(styleId)); return; } if (_defaults.DefaultRunStyle != null) { var props = _rStylePropsCache.Get(_defaults.DefaultRunStyle); cssClass.Props.AddMany(props); } }
public CssClass Build(ParagraphClassParam param) { var cssClass = new CssClass(); cssClass.Props = BuildInline(param.InlineProperties); //AddVanish(param, cssClass); AddNumberingStyleProps(param, cssClass); AddStyleProps(param.StyleId, cssClass); AddTableProps(param.TableProperties, cssClass); AddDefaultsProps(cssClass); cssClass.Name = GenerateDynName(); cssClass.Tag = Tag; return(cssClass); }
public CssClass Build(RunClassParam param) { var cssClass = new CssClass { Name = GenerageDynamicName() }; var inline = BuildInline(param.InlineProperties); // This is according to me cssClass.Props.AddMany(inline); AddRunStyle(cssClass, param.RunStyleId); AddNumberingProps(cssClass, param); AddParagraphStyle(cssClass, param.ParagraphStyleId); AddTableStyle(cssClass, param.TableProperties); AddDefaults(cssClass); return(cssClass); }
private void AddVanish(ParagraphClassParam param, CssClass cssClass) { var vanish = param.InlineProperties?.Descendants <Vanish>().FirstOrDefault(); if (vanish != null) { cssClass.Props.Add(new Properties.VanishCssProperty() { OpenXmlElement = vanish }); } var specVanish = param.InlineProperties?.Descendants <SpecVanish>().FirstOrDefault(); if (specVanish != null) { cssClass.Props.Add(new Properties.SpecVanishCssProperty() { OpenXmlElement = specVanish }); } }
private void AddDefaultsProps(CssClass cssClass) { AddOrSet(cssClass, _defaultsProvider.Paragraph); }
private void AddDefaults(CssClass cssClass) { cssClass.Props.AddMany(_defaults.Run); }