1 29 30 package com.caucho.xtpdoc; 31 32 import javax.xml.stream.XMLStreamException; 33 import javax.xml.stream.XMLStreamWriter; 34 import java.io.IOException ; 35 import java.io.PrintWriter ; 36 37 public class BlockQuote extends FormattedTextWithAnchors { 38 private String _title; 39 private boolean longQuote = false; 40 41 public BlockQuote(Document document) 42 { 43 super(document); 44 } 45 46 public void setTitle(String title) 47 { 48 _title = title; 49 } 50 51 public Paragraph createP() 52 { 53 longQuote = true; 54 55 Paragraph paragraph = new Paragraph(getDocument()); 56 addItem(paragraph); 57 return paragraph; 58 } 59 60 public void writeHtml(XMLStreamWriter out) 61 throws XMLStreamException 62 { 63 out.writeStartElement("blockquote"); 64 65 if (_title != null) 66 out.writeCharacters(_title + ": "); 67 68 super.writeHtml(out); 69 70 out.writeEndElement(); } 72 73 public void writeLaTeX(PrintWriter out) 74 throws IOException 75 { 76 if (longQuote) 77 out.println("\\begin{quotation}"); 78 else 79 out.println("\\begin{quote}"); 80 81 if (_title != null) 82 out.print(_title + ": "); 83 84 super.writeLaTeX(out); 85 86 if (longQuote) 87 out.println("\\end{quotation}"); 88 else 89 out.println("\\end{quote}"); 90 } 91 } 92 | Popular Tags |