/** * */ public CssAppliers() { chunk = new ChunkCssApplier(); paragraph = new ParagraphCssApplier(); nonewlineparagraph = new NoNewLineParagraphCssApplier(); htmlcell = new HtmlCellCssApplier(); list = new ListStyleTypeCssApplier(); lineseparator = new LineSeparatorCssApplier(); image = new ImageCssApplier(); }
/** * */ public CssAppliersImpl() { map = new Dictionary <Type, ICssApplier>(); map[typeof(Chunk)] = new ChunkCssApplier(null); map[typeof(Paragraph)] = new ParagraphCssApplier(this); map[typeof(NoNewLineParagraph)] = new NoNewLineParagraphCssApplier(); map[typeof(HtmlCell)] = new HtmlCellCssApplier(); map[typeof(List)] = new ListStyleTypeCssApplier(); map[typeof(LineSeparator)] = new LineSeparatorCssApplier(); map[typeof(text.Image)] = new ImageCssApplier(); map[typeof(PdfDiv)] = new DivCssApplier(); }
/** * 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); } }
/* * (non-Javadoc) * * @see * com.itextpdf.tool.xml.ITagProcessor#endElement(com.itextpdf.tool.xml.Tag, * java.util.List, com.itextpdf.text.Document) */ public override IList <IElement> End(IWorkerContext context, Tag tag, IList <IElement> currentContent) { try { Paragraph p = null; IList <IElement> l = new List <IElement>(1); foreach (IElement e in currentContent) { if (e is Paragraph) { if (p != null) { p = new ParagraphCssApplier(GetHtmlPipelineContext(context)).Apply(p, tag); l.Add(p); p = null; } l.Add(e); } else { if (p == null) { p = new Paragraph(); } p.Add(e); } } if (p != null) { p = new ParagraphCssApplier(GetHtmlPipelineContext(context)).Apply(p, tag); l.Add(p); } return(l); } catch (NoCustomContextException e) { throw new RuntimeWorkerException(LocaleMessages.GetInstance().GetMessage(LocaleMessages.NO_CUSTOM_CONTEXT), e); } }