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.

38 {
40  const char *p=s;
41  char c;
42  if (p)
43  {
44  while ((c=*p++))
45  {
46  switch (c)
47  {
48  case '%': result+="\\%"; break;
49  case '|': result+="\\texttt{\"|}"; break;
50  case '!': result+="\"!"; break;
51  case '{': result+="\\lcurly{}"; break;
52  case '}': result+="\\rcurly{}"; break;
53  case '~': result+="````~"; break; // to get it a bit better in index together with other special characters
54  default: result+=c;
55  }
56  }
57  }
58  return result;
59 }
static QCString result
p
Definition: test.py:223
static QCString * s
Definition: config.cpp:1042
static const char* getSectionName ( int  level)
static

Definition at line 65 of file latexdocvisitor.cpp.

66 {
67  static bool compactLatex = Config_getBool("COMPACT_LATEX");
68  int l = level;
69  if (compactLatex) l++;
70  if (Doxygen::insideMainPage) l--;
71  return secLabels[QMIN(maxLevels-1,l)];
72 }
static QStrList * l
Definition: config.cpp:1044
static bool insideMainPage
Definition: doxygen.h:104
#define QMIN(a, b)
Definition: qglobal.h:391
static const char * secLabels[maxLevels]
const int maxLevels
#define Config_getBool(val)
Definition: config.cpp:664
static bool tableIsNested ( const DocNode n)
static

Definition at line 892 of file latexdocvisitor.cpp.

893 {
894  bool isNested=FALSE;
895  while (n && !isNested)
896  {
897  isNested = n->kind()==DocNode::Kind_HtmlTable || n->kind()==DocNode::Kind_ParamSect;
898  n = n->parent();
899  }
900  return isNested;
901 }
DocNode * parent() const
Definition: docparser.h:147
const bool FALSE
Definition: qglobal.h:370
virtual Kind kind() const =0
static void visitCaption ( LatexDocVisitor parent,
QList< DocNode children 
)
static

Definition at line 136 of file latexdocvisitor.cpp.

137 {
138  QListIterator<DocNode> cli(children);
139  DocNode *n;
140  for (cli.toFirst();(n=cli.current());++cli) n->accept(parent);
141 }
def cli(ctx)
Definition: main.py:7
std::void_t< T > n
virtual void accept(DocVisitor *v)=0
static void visitPostEnd ( FTextStream t,
const bool  hasCaption 
)
static

Definition at line 123 of file latexdocvisitor.cpp.

124 {
125  t << "}\n"; // end mbox or caption
126  if (hasCaption)
127  {
128  t << "\\end{DoxyImage}\n";
129  }
130  else{
131  t << "\\end{DoxyImageNoCaption}\n";
132  }
133 }
static void visitPreStart ( FTextStream t,
const bool  hasCaption,
QCString  name,
QCString  width,
QCString  height 
)
static

Definition at line 74 of file latexdocvisitor.cpp.

75 {
76  if (hasCaption)
77  {
78  t << "\n\\begin{DoxyImage}\n";
79  }
80  else
81  {
82  t << "\n\\begin{DoxyImageNoCaption}\n"
83  " \\mbox{";
84  }
85 
86  t << "\\includegraphics";
87  if (!width.isEmpty() || !height.isEmpty())
88  {
89  t << "[";
90  }
91  if (!width.isEmpty())
92  {
93  t << "width=" << width;
94  }
95  if (!width.isEmpty() && !height.isEmpty())
96  {
97  t << ",";
98  }
99  if (!height.isEmpty())
100  {
101  t << "height=" << height;
102  }
103  if (width.isEmpty() && height.isEmpty())
104  {
105  /* default setting */
106  t << "[width=\\textwidth,height=\\textheight/2,keepaspectratio=true]";
107  }
108  else
109  {
110  t << "]";
111  }
112 
113  t << "{" << name << "}";
114 
115  if (hasCaption)
116  {
117  t << "\n\\caption{";
118  }
119 }
bool isEmpty() const
Definition: qcstring.h:189
static void writeEndTableCommand ( FTextStream t,
const DocNode n 
)
static

Definition at line 916 of file latexdocvisitor.cpp.

917 {
918  if (tableIsNested(n))
919  {
920  t << "\\end{tabularx}\n";
921  }
922  else
923  {
924  t << "\\end{longtabu}\n";
925  }
926  //return isNested ? "TabularNC" : "TabularC";
927 }
static bool tableIsNested(const DocNode *n)
static void writeStartTableCommand ( FTextStream t,
const DocNode n,
int  cols 
)
static

Definition at line 903 of file latexdocvisitor.cpp.

904 {
905  if (tableIsNested(n))
906  {
907  t << "\\begin{tabularx}{\\linewidth}{|*{" << cols << "}{>{\\raggedright\\arraybackslash}X|}}";
908  }
909  else
910  {
911  t << "\\tabulinesep=1mm\n\\begin{longtabu} spread 0pt [c]{*" << cols << "{|X[-1]}|}\n";
912  }
913  //return isNested ? "TabularNC" : "TabularC";
914 }
static bool tableIsNested(const DocNode *n)

Variable Documentation

const int maxLevels =5

Definition at line 61 of file latexdocvisitor.cpp.

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

Definition at line 62 of file latexdocvisitor.cpp.