diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2013-10-06 19:28:00 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2013-10-06 21:39:40 (GMT) |
commit | 4fc5b2b154331fbf35800935889f1d0372334f0a (patch) | |
tree | a87e075516435e0d855a4af6aecb356a517c4b33 /src/docbookvisitor.cpp | |
parent | 983507e0a65e5c2d51209740a89311e122e4f389 (diff) | |
download | Doxygen-4fc5b2b154331fbf35800935889f1d0372334f0a.zip Doxygen-4fc5b2b154331fbf35800935889f1d0372334f0a.tar.gz Doxygen-4fc5b2b154331fbf35800935889f1d0372334f0a.tar.bz2 |
Bug 707713 - Add support for dia diagrams
Diffstat (limited to 'src/docbookvisitor.cpp')
-rw-r--r-- | src/docbookvisitor.cpp | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/src/docbookvisitor.cpp b/src/docbookvisitor.cpp index a70c58f..402f3c0 100644 --- a/src/docbookvisitor.cpp +++ b/src/docbookvisitor.cpp @@ -32,6 +32,7 @@ #include "config.h" #include "filedef.h" #include "msc.h" +#include "dia.h" DocbookDocVisitor::DocbookDocVisitor(FTextStream &t,CodeOutputInterface &ci) : DocVisitor(DocVisitor_Docbook), m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE) @@ -1007,6 +1008,18 @@ void DocbookDocVisitor::visitPost(DocMscFile *df) if (m_hide) return; endMscFile(df->hasCaption()); } +void DocbookDocVisitor::visitPre(DocDiaFile *df) +{ + if (m_hide) return; + startDiaFile(df->file(),df->width(),df->height(),df->hasCaption()); +} + +void DocbookDocVisitor::visitPost(DocDiaFile *df) +{ + if (m_hide) return; + endDiaFile(df->hasCaption()); +} + void DocbookDocVisitor::visitPre(DocLink *lnk) { if (m_hide) return; @@ -1336,6 +1349,80 @@ void DocbookDocVisitor::endMscFile(bool hasCaption) m_t << "</para>" << endl; } +void DocbookDocVisitor::writeDiaFile(const QCString &baseName) +{ + QCString shortName = baseName; + int i; + if ((i=shortName.findRev('/'))!=-1) + { + shortName=shortName.right(shortName.length()-i-1); + } + QCString outDir = Config_getString("DOCBOOK_OUTPUT"); + writeDiaGraphFromFile(baseName+".dia",outDir,shortName,DIA_BITMAP); + m_t << " <imagedata"; + m_t << " align=\"center\" fileref=\"" << shortName << ".png" << "\">"; + m_t << "</imagedata>" << endl; +} + +void DocbookDocVisitor::startDiaFile(const QCString &fileName, + const QCString &width, + const QCString &height, + bool hasCaption + ) +{ + QCString baseName=fileName; + int i; + if ((i=baseName.findRev('/'))!=-1) + { + baseName=baseName.right(baseName.length()-i-1); + } + if ((i=baseName.find('.'))!=-1) + { + baseName=baseName.left(i); + } + baseName.prepend("msc_"); + QCString outDir = Config_getString("DOCBOOK_OUTPUT"); + writeDiaGraphFromFile(fileName,outDir,baseName,DIA_BITMAP); + m_t << "<para>" << endl; + m_t << " <figure>" << endl; + m_t << " <title></title>" << endl; + m_t << " <mediaobject>" << endl; + m_t << " <imageobject>" << endl; + m_t << " <imagedata"; + if (!width.isEmpty()) + { + m_t << " width=\""; + m_t << width; + m_t << "\""; + } + else if (!height.isEmpty()) + { + m_t << " depth=\""; + m_t << height; + m_t << "\""; + } + m_t << " align=\"center\" fileref=\"" << baseName << ".png" << "\">"; + m_t << "</imagedata>" << endl; + m_t << " </imageobject>" << endl; + if (hasCaption) + { + m_t << " <caption>" << endl; + } +} + +void DocbookDocVisitor::endDiaFile(bool hasCaption) +{ + if (m_hide) return; + m_t << "endl"; + if (hasCaption) + { + m_t << " </caption>" << endl; + } + m_t << " </mediaobject>" << endl; + m_t << " </figure>" << endl; + m_t << "</para>" << endl; +} + void DocbookDocVisitor::writeDotFile(const QCString &baseName) { QCString shortName = baseName; |