/** * */ public CssAppliers() { chunk = new ChunkCssApplier(); paragraph = new ParagraphCssApplier(); nonewlineparagraph = new NoNewLineParagraphCssApplier(); htmlcell = new HtmlCellCssApplier(); list = new ListStyleTypeCssApplier(); lineseparator = new LineSeparatorCssApplier(); image = new ImageCssApplier(); }
/** * Adds currentContent list to a paragraph element. If addNewLines is true a * Paragraph object is returned, else a NoNewLineParagraph object is * returned. * * @param currentContent IList<IElement> of the current elements to be added. * @param addNewLines bool to declare which paragraph element should be * returned, true if new line should be added or not. * @param applyCSS true if CSS should be applied on the paragraph * @param tag the relevant tag * @return a List with paragraphs */ public virtual IList<IElement> CurrentContentToParagraph(IList<IElement> currentContent, bool addNewLines, bool applyCSS, Tag tag, IWorkerContext ctx) { try { IList<IElement> list = new List<IElement>(); if (currentContent.Count > 0) { if (addNewLines) { Paragraph p = new Paragraph(); foreach (IElement e in currentContent) { p.Add(e); } if (applyCSS) { p = new ParagraphCssApplier(GetHtmlPipelineContext(ctx)).Apply(p, tag); } list.Add(p); } else { NoNewLineParagraph p = new NoNewLineParagraph(); foreach (IElement e in currentContent) { p.Add(e); } p = new NoNewLineParagraphCssApplier(GetHtmlPipelineContext(ctx)).Apply(p, tag); list.Add(p); } // TODO enhance } return list; } catch (NoCustomContextException e) { throw new RuntimeWorkerException(LocaleMessages.GetInstance().GetMessage(LocaleMessages.NO_CUSTOM_CONTEXT), e); } }