1 29 30 package com.caucho.xtpdoc; 31 32 import com.caucho.config.Config; 33 import com.caucho.vfs.Path; 34 import com.caucho.vfs.Vfs; 35 36 import java.io.IOException ; 37 import java.io.PrintWriter ; 38 import java.util.logging.Logger ; 39 40 public class LinkedChapterSection extends ChapterSection { 41 private static final Logger log = Logger.getLogger(Anchor.class.getName()); 42 private String _link; 43 44 public void setLink(String link) 45 { 46 _link = link; 47 } 48 49 private Document configureDocument(Path xtpFile) 50 { 51 Document document = new Document(xtpFile, null); 52 53 try { 54 56 Config config = new Config(); 57 58 config.configure(document, xtpFile); 59 60 return document; 61 } catch (Exception e) { 62 System.err.println("Error configuring document (" + xtpFile + "): " + e); 63 64 if (e.getCause() != null) 65 e.getCause().printStackTrace(); 66 else 67 e.printStackTrace(); 68 69 return null; 70 } 71 } 72 73 public void writeLaTeX(PrintWriter out) 74 throws IOException  75 { 76 Path xtpFile = Vfs.lookup(_link); 77 Document document = configureDocument(xtpFile); 78 79 try { 80 if (document != null) 81 document.writeLaTeX(out); 82 } catch (Exception e) { 83 System.err.println("Error configuring document (" + xtpFile + "): " + e); 84 85 if (e.getCause() != null) 86 e.getCause().printStackTrace(); 87 else 88 e.printStackTrace(); 89 90 return; 91 } 92 } 93 94 public void writeLaTeXEnclosed(PrintWriter out) 95 throws IOException  96 { 97 Path xtpFile = Vfs.lookup(_link); 98 Document document = configureDocument(xtpFile); 99 100 try { 101 if (document != null) 102 document.writeLaTeXEnclosed(out); 103 } catch (Exception e) { 104 System.err.println("Error configuring document (" + xtpFile + "): " + e); 105 106 if (e.getCause() != null) 107 e.getCause().printStackTrace(); 108 else 109 e.printStackTrace(); 110 111 return; 112 } 113 } 114 } 115 | Popular Tags |