rtfdocvisitor.h 5.16 KB
Newer Older
1 2
/******************************************************************************
 *
3
 * 
4 5
 *
 *
Dimitri van Heesch's avatar
Dimitri van Heesch committed
6
 * Copyright (C) 1997-2013 by Dimitri van Heesch.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation under the terms of the GNU General Public License is hereby 
 * granted. No representations are made about the suitability of this software 
 * for any purpose. It is provided "as is" without express or implied warranty.
 * See the GNU General Public License for more details.
 *
 * Documents produced by Doxygen are derivative works derived from the
 * input used in their production; they are not affected by this license.
 *
 */

#ifndef _RTFDOCVISITOR_H
#define _RTFDOCVISITOR_H

#include "docvisitor.h"
23
#include <qstack.h>
24
#include <qcstring.h>
25

26
class FTextStream;
27
class CodeOutputInterface;
28 29 30 31 32

/*! @brief Concrete visitor implementation for RTF output. */
class RTFDocVisitor : public DocVisitor
{
  public:
33
    RTFDocVisitor(FTextStream &t,CodeOutputInterface &ci,const char *langExt);
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
    
    //--------------------------------------
    // visitor functions for leaf nodes
    //--------------------------------------
    
    void visit(DocWord *);
    void visit(DocLinkedWord *);
    void visit(DocWhiteSpace *);
    void visit(DocSymbol *);
    void visit(DocURL *);
    void visit(DocLineBreak *);
    void visit(DocHorRuler *);
    void visit(DocStyleChange *);
    void visit(DocVerbatim *);
    void visit(DocAnchor *);
    void visit(DocInclude *);
    void visit(DocIncOperator *);
    void visit(DocFormula *);
52
    void visit(DocIndexEntry *);
53
    void visit(DocSimpleSectSep *);
54
    void visit(DocCite *);
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81

    //--------------------------------------
    // visitor functions for compound nodes
    //--------------------------------------
    
    void visitPre(DocAutoList *);
    void visitPost(DocAutoList *);
    void visitPre(DocAutoListItem *);
    void visitPost(DocAutoListItem *);
    void visitPre(DocPara *);
    void visitPost(DocPara *);
    void visitPre(DocRoot *);
    void visitPost(DocRoot *);
    void visitPre(DocSimpleSect *);
    void visitPost(DocSimpleSect *);
    void visitPre(DocTitle *);
    void visitPost(DocTitle *);
    void visitPre(DocSimpleList *);
    void visitPost(DocSimpleList *);
    void visitPre(DocSimpleListItem *);
    void visitPost(DocSimpleListItem *);
    void visitPre(DocSection *s);
    void visitPost(DocSection *);
    void visitPre(DocHtmlList *s);
    void visitPost(DocHtmlList *s);
    void visitPre(DocHtmlListItem *);
    void visitPost(DocHtmlListItem *);
82 83
    //void visitPre(DocHtmlPre *);
    //void visitPost(DocHtmlPre *);
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
    void visitPre(DocHtmlDescList *);
    void visitPost(DocHtmlDescList *);
    void visitPre(DocHtmlDescTitle *);
    void visitPost(DocHtmlDescTitle *);
    void visitPre(DocHtmlDescData *);
    void visitPost(DocHtmlDescData *);
    void visitPre(DocHtmlTable *t);
    void visitPost(DocHtmlTable *t);
    void visitPre(DocHtmlCaption *);
    void visitPost(DocHtmlCaption *);
    void visitPre(DocHtmlRow *);
    void visitPost(DocHtmlRow *) ;
    void visitPre(DocHtmlCell *);
    void visitPost(DocHtmlCell *);
    void visitPre(DocInternal *);
    void visitPost(DocInternal *);
    void visitPre(DocHRef *);
    void visitPost(DocHRef *);
    void visitPre(DocHtmlHeader *);
    void visitPost(DocHtmlHeader *) ;
    void visitPre(DocImage *);
    void visitPost(DocImage *);
    void visitPre(DocDotFile *);
    void visitPost(DocDotFile *);
108 109 110
    void visitPre(DocMscFile *);
    void visitPost(DocMscFile *);
    void visitPre(DocLink *);
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
    void visitPost(DocLink *);
    void visitPre(DocRef *ref);
    void visitPost(DocRef *);
    void visitPre(DocSecRefItem *);
    void visitPost(DocSecRefItem *);
    void visitPre(DocSecRefList *);
    void visitPost(DocSecRefList *);
    void visitPre(DocParamSect *);
    void visitPost(DocParamSect *);
    void visitPre(DocParamList *);
    void visitPost(DocParamList *);
    void visitPre(DocXRefItem *);
    void visitPost(DocXRefItem *);
    void visitPre(DocInternalRef *);
    void visitPost(DocInternalRef *);
    void visitPre(DocCopy *);
    void visitPost(DocCopy *);
128 129
    void visitPre(DocText *);
    void visitPost(DocText *);
130 131
    void visitPre(DocHtmlBlockQuote *);
    void visitPost(DocHtmlBlockQuote *);
132 133
    void visitPre(DocVhdlFlow *);
    void visitPost(DocVhdlFlow *);
134 135 136 137 138 139 140

  private:

    //--------------------------------------
    // helper functions 
    //--------------------------------------
    
141
    void filter(const char *str,bool verbatim=FALSE);
142 143 144 145
    void startLink(const QCString &ref,const QCString &file,
                   const QCString &anchor);
    void endLink(const QCString &ref);
    QCString getStyle(const char *name);
146 147
    void incIndentLevel();
    void decIndentLevel();
148

149 150
    void pushEnabled();
    void popEnabled();
151 152
    void writeDotFile(const QCString &fileName);
    void writeMscFile(const QCString &fileName);
153

154 155 156 157
    //--------------------------------------
    // state variables
    //--------------------------------------

158
    FTextStream &m_t;
159
    CodeOutputInterface &m_ci;
160 161 162
    bool m_insidePre;
    bool m_hide;
    int m_indentLevel;
163
    QStack<bool> m_enabled;
164
    bool m_lastIsPara;
165
    QCString m_langExt;
166 167 168
};

#endif