diff options
author | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2008-08-19 13:23:22 (GMT) |
---|---|---|
committer | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2008-08-19 13:23:22 (GMT) |
commit | 121f4fc934238b83ff343a17631962cf10b6f6bf (patch) | |
tree | f3b6964844667670f731ee30328142b6eb54ce4f /src/latexdocvisitor.cpp | |
parent | 016a22cd3abf688848cbe07315790fa4f14b0eef (diff) | |
download | Doxygen-121f4fc934238b83ff343a17631962cf10b6f6bf.zip Doxygen-121f4fc934238b83ff343a17631962cf10b6f6bf.tar.gz Doxygen-121f4fc934238b83ff343a17631962cf10b6f6bf.tar.bz2 |
Release-1.5.6-20080819
Diffstat (limited to 'src/latexdocvisitor.cpp')
-rw-r--r-- | src/latexdocvisitor.cpp | 67 |
1 files changed, 64 insertions, 3 deletions
diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp index 0516e37..a1baa95 100644 --- a/src/latexdocvisitor.cpp +++ b/src/latexdocvisitor.cpp @@ -26,6 +26,7 @@ #include "message.h" #include "parserintf.h" #include "msc.h" +#include "htmlattrib.h" static QString escapeLabelName(const char *s) { @@ -57,6 +58,21 @@ static const char *getSectionName(int level) return secLabels[QMIN(maxLevels-1,l)]; } +static int rowspan(DocHtmlCell *cell) +{ + int retval = 0; + HtmlAttribList attrs = cell->attribs (); + for (unsigned int i = 0; i < attrs.count(); ++i) + { + if ("rowspan" == attrs.at(i)->name.lower()) + { + retval = attrs.at(i)->value.toInt(); + break; + } + } + return retval; +} + QString LatexDocVisitor::escapeMakeIndexChars(const char *s) { QString result; @@ -84,7 +100,7 @@ LatexDocVisitor::LatexDocVisitor(QTextStream &t,CodeOutputInterface &ci, const char *langExt,bool insideTabbing) : DocVisitor(DocVisitor_Latex), m_t(t), m_ci(ci), m_insidePre(FALSE), m_insideItem(FALSE), m_hide(FALSE), m_insideTabbing(insideTabbing), - m_langExt(langExt) + m_langExt(langExt), m_currentColumn(0), m_inRowspan(FALSE) { } @@ -672,6 +688,7 @@ void LatexDocVisitor::visitPost(DocHtmlDescData *) void LatexDocVisitor::visitPre(DocHtmlTable *t) { + m_rowspanIndices.clear(); if (m_hide) return; if (t->hasCaption()) { @@ -707,21 +724,65 @@ void LatexDocVisitor::visitPost(DocHtmlCaption *) void LatexDocVisitor::visitPre(DocHtmlRow *) { + m_currentColumn = 0; } void LatexDocVisitor::visitPost(DocHtmlRow *) { if (m_hide) return; - m_t << "\\\\\\hline\n"; + + m_t << "\\\\"; + + QMap<int, int>::Iterator it; + int col = 1; + for (it = m_rowspanIndices.begin(); it != m_rowspanIndices.end(); ++it) + { + it.data()--; + if (it.data () <= 0) + m_rowspanIndices.remove (it); + else if (0 < it.data() - col) + m_t << "\\cline{" << col << "-" << it.data() - col << "}"; + + col = 1 + it.data (); + } + + if (col <= m_currentColumn) + m_t << "\\cline{" << col << "-" << m_currentColumn << "}"; + + m_t << "\n"; } -void LatexDocVisitor::visitPre(DocHtmlCell *) +void LatexDocVisitor::visitPre(DocHtmlCell *cell) { + if (m_hide) return; + + m_currentColumn++; + //Skip columns that span from above. + QMap<int, int>::Iterator it = m_rowspanIndices.find(m_currentColumn); + while (0 < it.data() && it != m_rowspanIndices.end()) + { + m_t << "&"; + m_currentColumn++; + it++; + } + + int rs = rowspan(cell); + if (0 < rs) + { + m_inRowspan = TRUE; + m_rowspanIndices[m_currentColumn] = rs; + m_t << "\\multirow{" << rs << "}{\\linewidth}{"; + } } void LatexDocVisitor::visitPost(DocHtmlCell *c) { if (m_hide) return; + if (m_inRowspan) + { + m_inRowspan = FALSE; + m_t << "}"; + } if (!c->isLast()) m_t << "&"; } |