summaryrefslogtreecommitdiffstats
path: root/src/rtfdocvisitor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/rtfdocvisitor.cpp')
-rw-r--r--src/rtfdocvisitor.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/rtfdocvisitor.cpp b/src/rtfdocvisitor.cpp
index fb0b1e1..05fe40d 100644
--- a/src/rtfdocvisitor.cpp
+++ b/src/rtfdocvisitor.cpp
@@ -27,6 +27,7 @@
#include "message.h"
#include <qfileinfo.h>
#include "parserintf.h"
+#include "msc.h"
//#define DBG_RTF(x) m_t << x
@@ -372,6 +373,31 @@ void RTFDocVisitor::visit(DocVerbatim *s)
if (Config_getBool("DOT_CLEANUP")) file.remove();
}
break;
+ case DocVerbatim::Msc:
+ {
+ static int mscindex = 1;
+ QCString baseName(4096);
+
+ baseName.sprintf("%s%d",
+ (Config_getString("RTF_OUTPUT")+"/inline_mscgraph_").data(),
+ mscindex++
+ );
+ QFile file(baseName+".msc");
+ if (!file.open(IO_WriteOnly))
+ {
+ err("Could not open file %s for writing\n",baseName.data());
+ }
+ QCString text = "msc {";
+ text+=s->text();
+ text+="}";
+ file.writeBlock( text, text.length() );
+ file.close();
+ m_t << "\\par{\\qc "; // center picture
+ writeMscFile(baseName);
+ m_t << "} ";
+ if (Config_getBool("DOT_CLEANUP")) file.remove();
+ }
+ break;
}
m_lastIsPara=FALSE;
}
@@ -1420,4 +1446,23 @@ void RTFDocVisitor::writeDotFile(const QString &fileName)
m_lastIsPara=TRUE;
}
+void RTFDocVisitor::writeMscFile(const QString &fileName)
+{
+ QString baseName=fileName;
+ int i;
+ if ((i=baseName.findRev('/'))!=-1)
+ {
+ baseName=baseName.right(baseName.length()-i-1);
+ }
+ QString outDir = Config_getString("RTF_OUTPUT");
+ writeMscGraphFromFile(fileName,outDir,baseName,MSC_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;
+}