My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions | Variables
latexdocvisitor.cpp File Reference
#include "htmlattrib.h"
#include <qfileinfo.h>
#include "latexdocvisitor.h"
#include "docparser.h"
#include "language.h"
#include "doxygen.h"
#include "outputgen.h"
#include "dot.h"
#include "util.h"
#include "message.h"
#include "parserintf.h"
#include "msc.h"
#include "dia.h"
#include "cite.h"
#include "filedef.h"
#include "config.h"
#include "htmlentity.h"
#include "plantuml.h"

Go to the source code of this file.

Functions

static QCString escapeLabelName (const char *s)
 
static const char * getSectionName (int level)
 
static void visitPreStart (FTextStream &t, const bool hasCaption, QCString name, QCString width, QCString height)
 
static void visitPostEnd (FTextStream &t, const bool hasCaption)
 
static void visitCaption (LatexDocVisitor *parent, QList< DocNode > children)
 
static bool tableIsNested (const DocNode *n)
 
static void writeStartTableCommand (FTextStream &t, const DocNode *n, int cols)
 
static void writeEndTableCommand (FTextStream &t, const DocNode *n)
 

Variables

const int maxLevels =5
 
static const char * secLabels [maxLevels]
 

Function Documentation

static QCString escapeLabelName ( const char *  s)
static

Definition at line 37 of file latexdocvisitor.cpp.

Referenced by LatexDocVisitor::visit().

{
QCString result;
const char *p=s;
char c;
if (p)
{
while ((c=*p++))
{
switch (c)
{
case '%': result+="\\%"; break;
case '|': result+="\\texttt{\"|}"; break;
case '!': result+="\"!"; break;
case '{': result+="\\lcurly{}"; break;
case '}': result+="\\rcurly{}"; break;
case '~': result+="````~"; break; // to get it a bit better in index together with other special characters
default: result+=c;
}
}
}
return result;
}
static const char* getSectionName ( int  level)
static

Definition at line 65 of file latexdocvisitor.cpp.

References Config_getBool, Doxygen::insideMainPage, maxLevels, and secLabels.

Referenced by LatexDocVisitor::visitPre().

{
static bool compactLatex = Config_getBool(COMPACT_LATEX);
int l = level;
if (compactLatex) l++;
return secLabels[QMIN(maxLevels-1,l)];
}
static bool tableIsNested ( const DocNode n)
static

Definition at line 911 of file latexdocvisitor.cpp.

References DocNode::kind(), DocNode::Kind_HtmlTable, DocNode::Kind_ParamSect, and DocNode::parent().

Referenced by writeEndTableCommand(), and writeStartTableCommand().

{
bool isNested=FALSE;
while (n && !isNested)
{
n = n->parent();
}
return isNested;
}
static void visitCaption ( LatexDocVisitor parent,
QList< DocNode children 
)
static

Definition at line 136 of file latexdocvisitor.cpp.

References DocNode::accept().

Referenced by LatexDocVisitor::visit(), LatexDocVisitor::visitPre(), LatexDocVisitor::writeDiaFile(), LatexDocVisitor::writeMscFile(), and LatexDocVisitor::writePlantUMLFile().

{
QListIterator<DocNode> cli(children);
DocNode *n;
for (cli.toFirst();(n=cli.current());++cli) n->accept(parent);
}
static void visitPostEnd ( FTextStream t,
const bool  hasCaption 
)
static

Definition at line 123 of file latexdocvisitor.cpp.

Referenced by LatexDocVisitor::endDiaFile(), LatexDocVisitor::endDotFile(), LatexDocVisitor::endMscFile(), LatexDocVisitor::visitPost(), LatexDocVisitor::writeDiaFile(), LatexDocVisitor::writeMscFile(), and LatexDocVisitor::writePlantUMLFile().

{
t << "}\n"; // end mbox or caption
if (hasCaption)
{
t << "\\end{DoxyImage}\n";
}
else{
t << "\\end{DoxyImageNoCaption}\n";
}
}
static void visitPreStart ( FTextStream t,
const bool  hasCaption,
QCString  name,
QCString  width,
QCString  height 
)
static

Definition at line 74 of file latexdocvisitor.cpp.

Referenced by LatexDocVisitor::startDiaFile(), LatexDocVisitor::startDotFile(), LatexDocVisitor::startMscFile(), LatexDocVisitor::visitPre(), LatexDocVisitor::writeDiaFile(), LatexDocVisitor::writeMscFile(), and LatexDocVisitor::writePlantUMLFile().

{
if (hasCaption)
{
t << "\n\\begin{DoxyImage}\n";
}
else
{
t << "\n\\begin{DoxyImageNoCaption}\n"
" \\mbox{";
}
t << "\\includegraphics";
if (!width.isEmpty() || !height.isEmpty())
{
t << "[";
}
if (!width.isEmpty())
{
t << "width=" << width;
}
if (!width.isEmpty() && !height.isEmpty())
{
t << ",";
}
if (!height.isEmpty())
{
t << "height=" << height;
}
if (width.isEmpty() && height.isEmpty())
{
/* default setting */
t << "[width=\\textwidth,height=\\textheight/2,keepaspectratio=true]";
}
else
{
t << "]";
}
t << "{" << name << "}";
if (hasCaption)
{
t << "\n\\doxyfigcaption{";
}
}
static void writeEndTableCommand ( FTextStream t,
const DocNode n 
)
static

Definition at line 935 of file latexdocvisitor.cpp.

References tableIsNested().

Referenced by LatexDocVisitor::visitPost().

{
if (tableIsNested(n))
{
t << "\\end{tabularx}\n";
}
else
{
t << "\\end{longtabu}\n";
}
//return isNested ? "TabularNC" : "TabularC";
}
static void writeStartTableCommand ( FTextStream t,
const DocNode n,
int  cols 
)
static

Definition at line 922 of file latexdocvisitor.cpp.

References tableIsNested().

Referenced by LatexDocVisitor::visitPre().

{
if (tableIsNested(n))
{
t << "\\begin{tabularx}{\\linewidth}{|*{" << cols << "}{>{\\raggedright\\arraybackslash}X|}}";
}
else
{
t << "\\tabulinesep=1mm\n\\begin{longtabu} spread 0pt [c]{*{" << cols << "}{|X[-1]}|}\n";
}
//return isNested ? "TabularNC" : "TabularC";
}

Variable Documentation

const int maxLevels =5

Definition at line 61 of file latexdocvisitor.cpp.

Referenced by getSectionName().

const char* secLabels[maxLevels]
static
Initial value:
=
{ "section","subsection","subsubsection","paragraph","subparagraph" }

Definition at line 62 of file latexdocvisitor.cpp.

Referenced by getSectionName().