summaryrefslogtreecommitdiffstats
path: root/src/rtfdocvisitor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/rtfdocvisitor.cpp')
-rw-r--r--src/rtfdocvisitor.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/rtfdocvisitor.cpp b/src/rtfdocvisitor.cpp
index 3cf6a5e..5d73c57 100644
--- a/src/rtfdocvisitor.cpp
+++ b/src/rtfdocvisitor.cpp
@@ -29,6 +29,7 @@
#include <qfileinfo.h>
#include "parserintf.h"
#include "msc.h"
+#include "dia.h"
#include "filedef.h"
#include "config.h"
@@ -1245,6 +1246,22 @@ void RTFDocVisitor::visitPost(DocMscFile *)
popEnabled();
}
+void RTFDocVisitor::visitPre(DocDiaFile *df)
+{
+ DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocDiaFile)}\n");
+ writeDiaFile(df->file());
+
+ // hide caption since it is not supported at the moment
+ pushEnabled();
+ m_hide=TRUE;
+}
+
+void RTFDocVisitor::visitPost(DocDiaFile *)
+{
+ DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocDiaFile)}\n");
+ popEnabled();
+}
+
void RTFDocVisitor::visitPre(DocLink *lnk)
{
if (m_hide) return;
@@ -1846,3 +1863,23 @@ void RTFDocVisitor::writeMscFile(const QCString &fileName)
m_lastIsPara=TRUE;
}
+void RTFDocVisitor::writeDiaFile(const QCString &fileName)
+{
+ QCString baseName=fileName;
+ int i;
+ if ((i=baseName.findRev('/'))!=-1)
+ {
+ baseName=baseName.right(baseName.length()-i-1);
+ }
+ QCString outDir = Config_getString("RTF_OUTPUT");
+ writeDiaGraphFromFile(fileName+".dia",outDir,baseName,DIA_BITMAP);
+ if (!m_lastIsPara) m_t << "\\par" << endl;
+ m_t << "{" << endl;
+ m_t << rtf_Style_Reset;
+ m_t << "\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \"";
+ m_t << baseName << ".png";
+ m_t << "\" \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par" << endl;
+ m_t << "}" << endl;
+ m_lastIsPara=TRUE;
+}
+