00001 /****************************************************************************** 00002 * 00003 * $Id: $ 00004 * 00005 * 00006 * Copyright (C) 1997-2008 by Dimitri van Heesch. 00007 * 00008 * Permission to use, copy, modify, and distribute this software and its 00009 * documentation under the terms of the GNU General Public License is hereby 00010 * granted. No representations are made about the suitability of this software 00011 * for any purpose. It is provided "as is" without express or implied warranty. 00012 * See the GNU General Public License for more details. 00013 * 00014 * Documents produced by Doxygen are derivative works derived from the 00015 * input used in their production; they are not affected by this license. 00016 * 00017 */ 00018 00019 #ifndef _LATEXDOCVISITOR_H 00020 #define _LATEXDOCVISITOR_H 00021 00022 #include "docvisitor.h" 00023 #include <qstack.h> 00024 #include <qcstring.h> 00025 00026 class QTextStream; 00027 class CodeOutputInterface; 00028 class QString; 00029 00031 class LatexDocVisitor : public DocVisitor 00032 { 00033 public: 00034 LatexDocVisitor(QTextStream &t,CodeOutputInterface &ci, 00035 const char *langExt,bool insideTabbing); 00036 00037 //-------------------------------------- 00038 // visitor functions for leaf nodes 00039 //-------------------------------------- 00040 00041 void visit(DocWord *); 00042 void visit(DocLinkedWord *); 00043 void visit(DocWhiteSpace *); 00044 void visit(DocSymbol *); 00045 void visit(DocURL *); 00046 void visit(DocLineBreak *); 00047 void visit(DocHorRuler *); 00048 void visit(DocStyleChange *); 00049 void visit(DocVerbatim *); 00050 void visit(DocAnchor *); 00051 void visit(DocInclude *); 00052 void visit(DocIncOperator *); 00053 void visit(DocFormula *); 00054 void visit(DocIndexEntry *); 00055 00056 //-------------------------------------- 00057 // visitor functions for compound nodes 00058 //-------------------------------------- 00059 00060 void visitPre(DocAutoList *); 00061 void visitPost(DocAutoList *); 00062 void visitPre(DocAutoListItem *); 00063 void visitPost(DocAutoListItem *); 00064 void visitPre(DocPara *); 00065 void visitPost(DocPara *); 00066 void visitPre(DocRoot *); 00067 void visitPost(DocRoot *); 00068 void visitPre(DocSimpleSect *); 00069 void visitPost(DocSimpleSect *); 00070 void visitPre(DocTitle *); 00071 void visitPost(DocTitle *); 00072 void visitPre(DocSimpleList *); 00073 void visitPost(DocSimpleList *); 00074 void visitPre(DocSimpleListItem *); 00075 void visitPost(DocSimpleListItem *); 00076 void visitPre(DocSection *s); 00077 void visitPost(DocSection *); 00078 void visitPre(DocHtmlList *s); 00079 void visitPost(DocHtmlList *s); 00080 void visitPre(DocHtmlListItem *); 00081 void visitPost(DocHtmlListItem *); 00082 //void visitPre(DocHtmlPre *); 00083 //void visitPost(DocHtmlPre *); 00084 void visitPre(DocHtmlDescList *); 00085 void visitPost(DocHtmlDescList *); 00086 void visitPre(DocHtmlDescTitle *); 00087 void visitPost(DocHtmlDescTitle *); 00088 void visitPre(DocHtmlDescData *); 00089 void visitPost(DocHtmlDescData *); 00090 void visitPre(DocHtmlTable *t); 00091 void visitPost(DocHtmlTable *t); 00092 void visitPre(DocHtmlCaption *); 00093 void visitPost(DocHtmlCaption *); 00094 void visitPre(DocHtmlRow *); 00095 void visitPost(DocHtmlRow *) ; 00096 void visitPre(DocHtmlCell *); 00097 void visitPost(DocHtmlCell *); 00098 void visitPre(DocInternal *); 00099 void visitPost(DocInternal *); 00100 void visitPre(DocHRef *); 00101 void visitPost(DocHRef *); 00102 void visitPre(DocHtmlHeader *); 00103 void visitPost(DocHtmlHeader *) ; 00104 void visitPre(DocImage *); 00105 void visitPost(DocImage *); 00106 void visitPre(DocDotFile *); 00107 void visitPost(DocDotFile *); 00108 void visitPre(DocLink *lnk); 00109 void visitPost(DocLink *); 00110 void visitPre(DocRef *ref); 00111 void visitPost(DocRef *); 00112 void visitPre(DocSecRefItem *); 00113 void visitPost(DocSecRefItem *); 00114 void visitPre(DocSecRefList *); 00115 void visitPost(DocSecRefList *); 00116 //void visitPre(DocLanguage *); 00117 //void visitPost(DocLanguage *); 00118 void visitPre(DocParamSect *); 00119 void visitPost(DocParamSect *); 00120 void visitPre(DocParamList *); 00121 void visitPost(DocParamList *); 00122 void visitPre(DocXRefItem *); 00123 void visitPost(DocXRefItem *); 00124 void visitPre(DocInternalRef *); 00125 void visitPost(DocInternalRef *); 00126 void visitPre(DocCopy *); 00127 void visitPost(DocCopy *); 00128 void visitPre(DocText *); 00129 void visitPost(DocText *); 00130 00131 private: 00132 00133 //-------------------------------------- 00134 // helper functions 00135 //-------------------------------------- 00136 00137 void filter(const char *str); 00138 void startLink(const QString &ref,const QString &file, 00139 const QString &anchor); 00140 void endLink(const QString &ref,const QString &file, 00141 const QString &anchor); 00142 QString escapeMakeIndexChars(const char *s); 00143 void startDotFile(const QString &fileName,const QString &width, 00144 const QString &height, bool hasCaption); 00145 void endDotFile(bool hasCaption); 00146 void writeMscFile(const QString &fileName); 00147 00148 void pushEnabled(); 00149 void popEnabled(); 00150 00151 //-------------------------------------- 00152 // state variables 00153 //-------------------------------------- 00154 00155 QTextStream &m_t; 00156 CodeOutputInterface &m_ci; 00157 bool m_insidePre; 00158 bool m_insideItem; 00159 bool m_hide; 00160 bool m_insideTabbing; 00161 QStack<bool> m_enabled; 00162 QCString m_langExt; 00163 }; 00164 00165 #endif