diff --git a/doc/commands.doc b/doc/commands.doc
index 7054c11..81564f0 100644
--- a/doc/commands.doc
+++ b/doc/commands.doc
@@ -65,6 +65,7 @@ documentation:
 \refitem cmddefgroup \\defgroup
 \refitem cmddeprecated \\deprecated
 \refitem cmddetails \\details
+\refitem cmddiafile \\diafile
 \refitem cmddir \\dir
 \refitem cmddocbookonly \\docbookonly
 \refitem cmddontinclude \\dontinclude
@@ -2487,6 +2488,24 @@ class Receiver
   \sa section \ref cmdmsc "\\msc".
 
 <hr>
+\section cmddiafile \\diafile <file> ["caption"]
+
+  \addindex \\diafile
+  Inserts an image made in dia from \<file\> into the documentation.
+
+  The first argument specifies the file name of the image.
+  doxygen will look for files in the paths (or files) that you specified
+  after the \ref cfg_diafile_dirs "DIAFILE_DIRS" tag.
+  If the dia file is found it will be used as an input file dia.
+  The resulting image will be put into the correct output directory.
+  If the dia file name contains spaces you'll have to put quotes ("...") around it.
+
+  The second argument is optional and can be used to specify the caption
+  that is displayed below the image. This argument has to be specified
+  between quotes even if it does not contain any spaces. The quotes are
+  stripped before the caption is displayed.
+
+<hr>
 \section cmde \\e <word>
 
   \addindex \\e
diff --git a/doc/config.doc b/doc/config.doc
index de563ad..429a125 100644
--- a/doc/config.doc
+++ b/doc/config.doc
@@ -88,6 +88,8 @@ followed by the descriptions of the tags grouped by category.
 \refitem cfg_compact_rtf COMPACT_RTF
 \refitem cfg_cpp_cli_support CPP_CLI_SUPPORT
 \refitem cfg_create_subdirs CREATE_SUBDIRS
+\refitem cfg_dia_path DIA_PATH
+\refitem cfg_diafile_dirs DIAFILE_DIRS
 \refitem cfg_directory_graph DIRECTORY_GRAPH
 \refitem cfg_disable_index DISABLE_INDEX
 \refitem cfg_distribute_group_doc DISTRIBUTE_GROUP_DOC
@@ -3306,6 +3308,14 @@ The default value is: <code>YES</code>.
  specify the directory where the \c mscgen tool resides. If left empty the tool is assumed to 
  be found in the default search path.
 
+ \anchor cfg_dia_path
+<dt>\c DIA_PATH <dd>
+ \addindex DIA_PATH
+ You can include diagrams drawn in dia using the \ref cmddiafile "\\diafile" command. 
+ Doxygen will run dia to produce the appropriate image and insert it in the documentation. 
+ The <code>DIA_PATH</code> tag allows you to specify the directory where the \c dia 
+ binary resides. If left empty the tool is assumed to be found in the default search path.
+
  \anchor cfg_hide_undoc_relations
 <dt>\c HIDE_UNDOC_RELATIONS <dd>
  \addindex HIDE_UNDOC_RELATIONS
@@ -3592,6 +3602,13 @@ This tag requires that the tag \ref cfg_have_dot "HAVE_DOT" is set to \c YES.
  contain msc files that are included in the documentation (see the
  \ref cmdmscfile "\\mscfile" command).
 
+ \anchor cfg_diafile_dirs
+<dt>\c DIAFILE_DIRS <dd>
+ \addindex DIAFILE_DIRS
+ The \c DIAFILE_DIRS tag can be used to specify one or more directories that 
+ contain dia files that are included in the documentation (see the
+ \ref cmddiafile "\\diafile" command).
+
  \anchor cfg_dot_graph_max_nodes
 <dt>\c DOT_GRAPH_MAX_NODES <dd>
  \addindex DOT_GRAPH_MAX_NODES
diff --git a/src/cmdmapper.cpp b/src/cmdmapper.cpp
index f148085..cdd3850 100644
--- a/src/cmdmapper.cpp
+++ b/src/cmdmapper.cpp
@@ -132,6 +132,7 @@ CommandMap cmdMap[] =
   { "docbookonly",   CMD_DBONLY },
   { "enddocbookonly",CMD_ENDDBONLY },
   { "endinternal",   CMD_ENDINTERNAL },
+  { "diafile",       CMD_DIAFILE },
   { 0,               0 },
 };
 
diff --git a/src/cmdmapper.h b/src/cmdmapper.h
index 88028f1..721244c 100644
--- a/src/cmdmapper.h
+++ b/src/cmdmapper.h
@@ -121,7 +121,8 @@ enum CommandType
   CMD_VHDLFLOW     = 91,
   CMD_DBONLY       = 92,
   CMD_ENDDBONLY    = 93,
-  CMD_ENDINTERNAL  = 94
+  CMD_ENDINTERNAL  = 94,
+  CMD_DIAFILE      = 95
 };
 
 enum HtmlTagType
diff --git a/src/config.l b/src/config.l
index 19f0267..cc0a2f8 100644
--- a/src/config.l
+++ b/src/config.l
@@ -1311,7 +1311,30 @@ void Config::check()
     mscgenPath="";
   }
 
-  
+  // check dia path
+  QCString &diaPath = Config_getString("DIA_PATH");
+  if (!diaPath.isEmpty())
+  {
+    QFileInfo dp(diaPath+"/dia"+portable_commandExtension());
+    if (!dp.exists() || !dp.isFile())
+    {
+      config_err("Warning: dia could not be found at %s\n",diaPath.data());
+      diaPath="";
+    }
+    else
+    {
+      diaPath=dp.dirPath(TRUE).utf8()+"/";
+#if defined(_WIN32) // convert slashes
+      uint i=0,l=diaPath.length();
+      for (i=0;i<l;i++) if (diaPath.at(i)=='/') diaPath.at(i)='\\';
+#endif
+    }
+  }
+  else // make sure the string is empty but not null!
+  {
+    diaPath="";
+  }
+
   // check input
   QStrList &inputSources=Config_getList("INPUT");
   if (inputSources.count()==0)
diff --git a/src/config.xml b/src/config.xml
index 1174fab..0b4edae 100644
--- a/src/config.xml
+++ b/src/config.xml
@@ -3012,6 +3012,16 @@ where `loc1` and `loc2` can be relative or absolute paths or URLs.
 ]]>
       </docs>
     </option>
+    <option type='string' id='DIA_PATH' format='dir' defval=''>
+      <docs>
+<![CDATA[
+You can include diagrams made with dia in doxygen documentation. Doxygen will then run 
+dia to produce the diagram and insert it in the documentation. The DIA_PATH tag allows 
+you to specify the directory where the dia binary resides. If left empty dia is assumed 
+to be found in the default search path.
+]]>
+      </docs>
+    </option>
     <option type='bool' id='HIDE_UNDOC_RELATIONS' defval='1'>
       <docs>
 <![CDATA[
@@ -3246,6 +3256,15 @@ where `loc1` and `loc2` can be relative or absolute paths or URLs.
 ]]>
       </docs>
     </option>
+    <option type='list' id='DIAFILE_DIRS' format='dir'>
+      <docs>
+<![CDATA[
+ The \c DIAFILE_DIRS tag can be used to specify one or more directories that 
+ contain dia files that are included in the documentation (see the
+ \ref cmdmscfile "\\diafile" command).
+]]>
+      </docs>
+    </option>
     <option type='int' id='DOT_GRAPH_MAX_NODES' minval='0' maxval='10000' defval='50' depends='HAVE_DOT'>
       <docs>
 <![CDATA[
diff --git a/src/configoptions.cpp b/src/configoptions.cpp
index d37163b..d25922e 100644
--- a/src/configoptions.cpp
+++ b/src/configoptions.cpp
@@ -2693,6 +2693,15 @@ void addConfigOptions(Config *cfg)
              );
   cs->setWidgetType(ConfigString::Dir);
   //----
+  cs = cfg->addString(
+              "DIA_PATH",
+              "You can include diagrams made with dia in doxygen documentation. Doxygen will\n"
+              "then run dia to produce the diagram and insert it in the documentation. The\n"
+              "DIA_PATH tag allows you to specify the directory where the dia binary resides.\n"
+              "If left empty dia is assumed to be found in the default search path."
+             );
+  cs->setWidgetType(ConfigString::Dir);
+  //----
   cb = cfg->addBool(
              "HIDE_UNDOC_RELATIONS",
               "If set to YES, the inheritance and collaboration graphs will hide inheritance\n"
@@ -2963,6 +2972,14 @@ void addConfigOptions(Config *cfg)
              );
   cl->setWidgetType(ConfigList::Dir);
   //----
+  cl = cfg->addList(
+              "DIAFILE_DIRS",
+              "The DIAFILE_DIRS tag can be used to specify one or more directories that\n"
+              "contain dia files that are included in the documentation (see the \\diafile\n"
+              "command)."
+             );
+  cl->setWidgetType(ConfigList::Dir);
+  //----
   ci = cfg->addInt(
               "DOT_GRAPH_MAX_NODES",
               "The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes\n"
diff --git a/src/dia.cpp b/src/dia.cpp
new file mode 100644
index 0000000..112dea8
--- /dev/null
+++ b/src/dia.cpp
@@ -0,0 +1,91 @@
+/******************************************************************************
+ *
+ * 
+ *
+ * Copyright (C) 1997-2013 by Dimitri van Heesch.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation under the terms of the GNU General Public License is hereby 
+ * granted. No representations are made about the suitability of this software 
+ * for any purpose. It is provided "as is" without express or implied warranty.
+ * See the GNU General Public License for more details.
+ *
+ * Documents produced by Doxygen are derivative works derived from the
+ * input used in their production; they are not affected by this license.
+ *
+ */
+
+#include "dia.h"
+#include "portable.h"
+#include "config.h"
+#include "message.h"
+#include "docparser.h"
+#include "doxygen.h"
+#include "util.h"
+
+#include <qtextstream.h>
+#include <qdir.h>
+
+static const int maxCmdLine = 40960;
+
+void writeDiaGraphFromFile(const char *inFile,const char *outDir,
+                           const char *outFile,DiaOutputFormat format)
+{
+  QCString absOutFile = outDir;
+  absOutFile+=portable_pathSeparator();
+  absOutFile+=outFile;
+
+  // chdir to the output dir, so dot can find the font file.
+  QCString oldDir = QDir::currentDirPath().utf8();
+  // go to the html output directory (i.e. path)
+  QDir::setCurrent(outDir);
+  //printf("Going to dir %s\n",QDir::currentDirPath().data());
+  QCString diaExe = Config_getString("DIA_PATH")+"dia"+portable_commandExtension();
+  QCString diaArgs;
+  QCString extension;
+  diaArgs+="-n ";
+  if (format==DIA_BITMAP)
+  {
+    diaArgs+="-t cairo-alpha-png";
+    extension=".png";
+  }
+  else if (format==DIA_EPS)
+  {
+    diaArgs+="-t eps";
+    extension=".eps";
+  }
+
+  diaArgs+=" -e \"";
+  diaArgs+=outFile;
+  diaArgs+=extension+"\"";
+
+  diaArgs+=" \"";
+  diaArgs+=inFile;
+  diaArgs+="\"";
+
+  int exitCode;
+  //printf("*** running: %s %s outDir:%s %s\n",diaExe.data(),diaArgs.data(),outDir,outFile);
+  portable_sysTimerStart();
+  if ((exitCode=portable_system(diaExe,diaArgs,FALSE))!=0)
+  {
+    portable_sysTimerStop();
+    goto error;
+  }
+  portable_sysTimerStop();
+  if ( (format==DIA_EPS) && (Config_getBool("USE_PDFLATEX")) )
+  {
+    QCString epstopdfArgs(maxCmdLine);
+    epstopdfArgs.sprintf("\"%s.eps\" --outfile=\"%s.pdf\"",
+                         outFile,outFile);
+    portable_sysTimerStart();
+    if (portable_system("epstopdf",epstopdfArgs)!=0)
+    {
+      err("Problems running epstopdf. Check your TeX installation!\n");
+    }
+    portable_sysTimerStop();
+  }
+
+error:
+  QDir::setCurrent(oldDir);
+}
+
diff --git a/src/dia.h b/src/dia.h
new file mode 100644
index 0000000..01d5962
--- /dev/null
+++ b/src/dia.h
@@ -0,0 +1,30 @@
+/******************************************************************************
+ *
+ * 
+ *
+ * Copyright (C) 1997-2013 by Dimitri van Heesch.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation under the terms of the GNU General Public License is hereby 
+ * granted. No representations are made about the suitability of this software 
+ * for any purpose. It is provided "as is" without express or implied warranty.
+ * See the GNU General Public License for more details.
+ *
+ * Documents produced by Doxygen are derivative works derived from the
+ * input used in their production; they are not affected by this license.
+ *
+ */
+
+#ifndef _DIA_H
+#define _DIA_H
+
+class QCString;
+class FTextStream;
+
+enum DiaOutputFormat { DIA_BITMAP , DIA_EPS };
+
+void writeDiaGraphFromFile(const char *inFile,const char *outDir,
+                           const char *outFile,DiaOutputFormat format);
+
+#endif
+
diff --git a/src/docbookvisitor.cpp b/src/docbookvisitor.cpp
index ad5965d..d938c44 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;
@@ -1327,6 +1340,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;
diff --git a/src/docbookvisitor.h b/src/docbookvisitor.h
index c79301d..80d4783 100644
--- a/src/docbookvisitor.h
+++ b/src/docbookvisitor.h
@@ -103,6 +103,8 @@ class DocbookDocVisitor : public DocVisitor
     void visitPost(DocDotFile *);
     void visitPre(DocMscFile *);
     void visitPost(DocMscFile *);
+    void visitPre(DocDiaFile *);
+    void visitPost(DocDiaFile *);
     void visitPre(DocLink *);
     void visitPost(DocLink *);
     void visitPre(DocRef *);
@@ -143,6 +145,10 @@ class DocbookDocVisitor : public DocVisitor
     const QCString &height, bool hasCaption);
     void endMscFile(bool hasCaption);
     void writeMscFile(const QCString &fileName);
+    void startDiaFile(const QCString &fileName,const QCString &width,
+    const QCString &height, bool hasCaption);
+    void endDiaFile(bool hasCaption);
+    void writeDiaFile(const QCString &fileName);
     void startDotFile(const QCString &fileName,const QCString &width,
     const QCString &height, bool hasCaption);
     void endDotFile(bool hasCaption);
diff --git a/src/docparser.cpp b/src/docparser.cpp
index 5259d46..4e17b04 100644
--- a/src/docparser.cpp
+++ b/src/docparser.cpp
@@ -2874,6 +2874,92 @@ void DocMscFile::parse()
 
 //---------------------------------------------------------------------------
 
+DocDiaFile::DocDiaFile(DocNode *parent,const QCString &name,const QCString &context) :
+      m_name(name), m_relPath(g_relPath), m_context(context)
+{
+  m_parent = parent;
+}
+
+void DocDiaFile::parse()
+{
+  g_nodeStack.push(this);
+  DBG(("DocDiaFile::parse() start\n"));
+
+  doctokenizerYYsetStateTitle();
+  int tok;
+  while ((tok=doctokenizerYYlex()))
+  {
+    if (!defaultHandleToken(this,tok,m_children))
+    {
+      switch (tok)
+      {
+        case TK_COMMAND:
+          warn_doc_error(g_fileName,doctokenizerYYlineno,"Illegal command %s as part of a \\diafile",
+	       qPrint(g_token->name));
+          break;
+        case TK_SYMBOL:
+	  warn_doc_error(g_fileName,doctokenizerYYlineno,"Unsupported symbol %s found",
+               qPrint(g_token->name));
+          break;
+        default:
+	  warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected token %s",
+		tokToString(tok));
+          break;
+      }
+    }
+  }
+  tok=doctokenizerYYlex();
+  while (tok==TK_WORD) // there are values following the title
+  {
+    if (g_token->name=="width")
+    {
+      m_width=g_token->chars;
+    }
+    else if (g_token->name=="height")
+    {
+      m_height=g_token->chars;
+    }
+    else
+    {
+      warn_doc_error(g_fileName,doctokenizerYYlineno,"Unknown option %s after image title",
+            qPrint(g_token->name));
+    }
+    tok=doctokenizerYYlex();
+  }
+  ASSERT(tok==0);
+  doctokenizerYYsetStatePara();
+  handlePendingStyleCommands(this,m_children);
+
+  bool ambig;
+  FileDef *fd = findFileDef(Doxygen::diaFileNameDict,m_name,ambig);
+  if (fd==0 && m_name.right(4)!=".dia") // try with .dia extension as well
+  {
+    fd = findFileDef(Doxygen::diaFileNameDict,m_name+".dia",ambig);
+  }
+  if (fd)
+  {
+    m_file = fd->absFilePath();
+  }
+  else if (ambig)
+  {
+    warn_doc_error(g_fileName,doctokenizerYYlineno,"included dia file name %s is ambiguous.\n"
+           "Possible candidates:\n%s",qPrint(m_name),
+           qPrint(showFileDefMatches(Doxygen::exampleNameDict,m_name))
+          );
+  }
+  else
+  {
+    warn_doc_error(g_fileName,doctokenizerYYlineno,"included dia file %s is not found "
+           "in any of the paths specified via MSCFILE_DIRS!",qPrint(m_name));
+  }
+
+  DBG(("DocDiaFile::parse() end\n"));
+  DocNode *n=g_nodeStack.pop();
+  ASSERT(n==this);
+}
+
+//---------------------------------------------------------------------------
+
 DocVhdlFlow::DocVhdlFlow(DocNode *parent)
 {
   m_parent = parent;
@@ -5077,6 +5163,30 @@ void DocPara::handleMscFile(const QCString &cmdName)
   df->parse();
 }
 
+void DocPara::handleDiaFile(const QCString &cmdName)
+{
+  int tok=doctokenizerYYlex();
+  if (tok!=TK_WHITESPACE)
+  {
+    warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after %s command",
+        qPrint(cmdName));
+    return;
+  }
+  doctokenizerYYsetStateFile();
+  tok=doctokenizerYYlex();
+  doctokenizerYYsetStatePara();
+  if (tok!=TK_WORD)
+  {
+    warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected token %s as the argument of %s",
+        tokToString(tok),qPrint(cmdName));
+    return;
+  }
+  QCString name = g_token->name;
+  DocDiaFile *df = new DocDiaFile(this,name,g_context);
+  m_children.append(df);
+  df->parse();
+}
+
 void DocPara::handleVhdlFlow()
 {
   DocVhdlFlow *vf = new DocVhdlFlow(this);
@@ -5615,6 +5725,9 @@ int DocPara::handleCommand(const QCString &cmdName)
     case CMD_MSCFILE:
       handleMscFile(cmdName);
       break;
+    case CMD_DIAFILE:
+      handleDiaFile(cmdName);
+      break;
     case CMD_LINK:
       handleLink(cmdName,FALSE);
       break;
diff --git a/src/docparser.h b/src/docparser.h
index b80e5e1..621e4eb 100644
--- a/src/docparser.h
+++ b/src/docparser.h
@@ -130,7 +130,8 @@ class DocNode
                 Kind_Text           = 47,
                 Kind_MscFile        = 48,
                 Kind_HtmlBlockQuote = 49,
-                Kind_VhdlFlow       = 50
+                Kind_VhdlFlow       = 50,
+                Kind_DiaFile        = 51
               };
     /*! Creates a new node */
     DocNode() : m_parent(0), m_insidePre(FALSE) {}
@@ -687,6 +688,30 @@ class DocMscFile : public CompAccept<DocMscFile>, public DocNode
     QCString  m_context;
 };
 
+/** Node representing a dia file */
+class DocDiaFile : public CompAccept<DocDiaFile>, public DocNode
+{
+  public:
+    DocDiaFile(DocNode *parent,const QCString &name,const QCString &context);
+    void parse();
+    Kind kind() const          { return Kind_DiaFile; }
+    QCString name() const      { return m_name; }
+    QCString file() const      { return m_file; }
+    QCString relPath() const   { return m_relPath; }
+    bool hasCaption() const    { return !m_children.isEmpty(); }
+    QCString width() const     { return m_width; }
+    QCString height() const    { return m_height; }
+    QCString context() const   { return m_context; }
+    void accept(DocVisitor *v) { CompAccept<DocDiaFile>::accept(this,v); }
+  private:
+    QCString  m_name;
+    QCString  m_file;
+    QCString  m_relPath;
+    QCString  m_width;
+    QCString  m_height;
+    QCString  m_context;
+};
+
 /** Node representing a VHDL flow chart */
 class DocVhdlFlow : public CompAccept<DocVhdlFlow>, public DocNode
 {
@@ -1027,6 +1052,7 @@ class DocPara : public CompAccept<DocPara>, public DocNode
     void handleImage(const QCString &cmdName);
     void handleDotFile(const QCString &cmdName);
     void handleMscFile(const QCString &cmdName);
+    void handleDiaFile(const QCString &cmdName);
     void handleInclude(const QCString &cmdName,DocInclude::Type t);
     void handleLink(const QCString &cmdName,bool isJavaLink);
     void handleCite();
diff --git a/src/docvisitor.h b/src/docvisitor.h
index 240e137..6fe962c 100644
--- a/src/docvisitor.h
+++ b/src/docvisitor.h
@@ -67,6 +67,7 @@ class DocHtmlHeader;
 class DocImage;
 class DocDotFile;
 class DocMscFile;
+class DocDiaFile;
 class DocLink;
 class DocCite;
 class DocRef;
@@ -165,6 +166,8 @@ class DocVisitor
     virtual void visitPost(DocDotFile *) = 0;
     virtual void visitPre(DocMscFile *) = 0;
     virtual void visitPost(DocMscFile *) = 0;   
+    virtual void visitPre(DocDiaFile *) = 0;
+    virtual void visitPost(DocDiaFile *) = 0;
     virtual void visitPre(DocLink *) = 0;
     virtual void visitPost(DocLink *) = 0;
     virtual void visitPre(DocRef *) = 0;
diff --git a/src/doxygen.cpp b/src/doxygen.cpp
index 972d758..e8314ab 100644
--- a/src/doxygen.cpp
+++ b/src/doxygen.cpp
@@ -132,7 +132,8 @@ FileNameDict    *Doxygen::includeNameDict = 0;     // include names
 FileNameDict    *Doxygen::exampleNameDict = 0;     // examples
 FileNameDict    *Doxygen::imageNameDict = 0;       // images
 FileNameDict    *Doxygen::dotFileNameDict = 0;     // dot files
-FileNameDict    *Doxygen::mscFileNameDict = 0;     // dot files
+FileNameDict    *Doxygen::mscFileNameDict = 0;     // msc files
+FileNameDict    *Doxygen::diaFileNameDict = 0;     // dia files
 StringDict       Doxygen::namespaceAliasDict(257); // all namespace aliases
 StringDict       Doxygen::tagDestinationDict(257); // all tag locations
 QDict<void>      Doxygen::expandAsDefinedDict(257); // all macros that should be expanded
@@ -196,6 +197,7 @@ void clearAll()
   Doxygen::imageNameDict->clear();
   Doxygen::dotFileNameDict->clear();
   Doxygen::mscFileNameDict->clear();
+  Doxygen::diaFileNameDict->clear();
   Doxygen::formulaDict->clear();
   Doxygen::formulaNameDict->clear();
   Doxygen::tagDestinationDict.clear();
@@ -262,6 +264,8 @@ void statistics()
   Doxygen::dotFileNameDict->statistics();
   fprintf(stderr,"--- mscFileNameDict stats ----\n");
   Doxygen::mscFileNameDict->statistics();
+  fprintf(stderr,"--- diaFileNameDict stats ----\n");
+  Doxygen::diaFileNameDict->statistics();
   //fprintf(stderr,"--- g_excludeNameDict stats ----\n");
   //g_excludeNameDict.statistics();
   fprintf(stderr,"--- aliasDict stats ----\n");
@@ -9863,6 +9867,7 @@ void initDoxygen()
   Doxygen::imageNameDict->setAutoDelete(TRUE);
   Doxygen::dotFileNameDict = new FileNameDict(257);
   Doxygen::mscFileNameDict = new FileNameDict(257);
+  Doxygen::diaFileNameDict = new FileNameDict(257);
   Doxygen::memGrpInfoDict.setAutoDelete(TRUE);
   Doxygen::tagDestinationDict.setAutoDelete(TRUE);
   Doxygen::dirRelations.setAutoDelete(TRUE);
@@ -9903,6 +9908,7 @@ void cleanUpDoxygen()
   delete Doxygen::imageNameDict;
   delete Doxygen::dotFileNameDict;
   delete Doxygen::mscFileNameDict;
+  delete Doxygen::diaFileNameDict;
   delete Doxygen::mainPage;
   delete Doxygen::pageSDict;  
   delete Doxygen::exampleSDict;
@@ -10525,6 +10531,18 @@ void searchInputFiles()
   }
   g_s.end();
 
+  g_s.begin("Searching for dia files...\n");
+  QStrList &diaFileList=Config_getList("DIAFILE_DIRS");
+  s=diaFileList.first();
+  while (s)
+  {
+    readFileOrDirectory(s,0,Doxygen::diaFileNameDict,0,0,
+                        0,0,0,
+                        alwaysRecursive);
+    s=diaFileList.next();
+  }
+  g_s.end();
+
   g_s.begin("Searching for files to exclude\n");
   QStrList &excludeList = Config_getList("EXCLUDE");
   s=excludeList.first();
diff --git a/src/doxygen.css b/src/doxygen.css
index 3e9451f..e1e4df2 100644
--- a/src/doxygen.css
+++ b/src/doxygen.css
@@ -1065,6 +1065,11 @@ dl.section dd {
         text-align: center;
 }
 
+.diagraph
+{
+        text-align: center;
+}
+
 .caption
 {
 	font-weight: bold;
diff --git a/src/doxygen.h b/src/doxygen.h
index 4edf395..ff9c620 100644
--- a/src/doxygen.h
+++ b/src/doxygen.h
@@ -109,6 +109,7 @@ class Doxygen
     static FileNameDict             *imageNameDict;
     static FileNameDict             *dotFileNameDict;
     static FileNameDict             *mscFileNameDict;
+    static FileNameDict             *diaFileNameDict;
     static QStrList                  tagfileList;
     static MemberNameSDict          *memberNameSDict;
     static MemberNameSDict          *functionNameSDict;
diff --git a/src/doxygen_css.h b/src/doxygen_css.h
index 38ffa19..5f572ec 100644
--- a/src/doxygen_css.h
+++ b/src/doxygen_css.h
@@ -1065,6 +1065,11 @@
 "        text-align: center;\n"
 "}\n"
 "\n"
+".diagraph\n"
+"{\n"
+"        text-align: center;\n"
+"}\n"
+"\n"
 ".caption\n"
 "{\n"
 "	font-weight: bold;\n"
diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp
index 6fe4f35..ff1f7aa 100644
--- a/src/htmldocvisitor.cpp
+++ b/src/htmldocvisitor.cpp
@@ -28,6 +28,7 @@
 #include "htmlgen.h"
 #include "parserintf.h"
 #include "msc.h"
+#include "dia.h"
 #include "util.h"
 #include "vhdldocgen.h"
 #include "filedef.h"
@@ -1493,6 +1494,26 @@ void HtmlDocVisitor::visitPost(DocMscFile *df)
   m_t << "</div>" << endl;
 }
 
+void HtmlDocVisitor::visitPre(DocDiaFile *df)
+{
+  if (m_hide) return;
+  m_t << "<div class=\"diagraph\">" << endl;
+  writeDiaFile(df->file(),df->relPath(),df->context());
+  if (df->hasCaption())
+  {
+    m_t << "<div class=\"caption\">" << endl;
+  }
+}
+void HtmlDocVisitor::visitPost(DocDiaFile *df)
+{
+  if (m_hide) return;
+  if (df->hasCaption())
+  {
+    m_t << "</div>" << endl;
+  }
+  m_t << "</div>" << endl;
+}
+
 void HtmlDocVisitor::visitPre(DocLink *lnk)
 {
   if (m_hide) return;
@@ -1946,6 +1967,27 @@ void HtmlDocVisitor::writeMscFile(const QCString &fileName,
   writeMscImageMapFromFile(m_t,fileName,outDir,relPath,baseName,context);
 }
 
+void HtmlDocVisitor::writeDiaFile(const QCString &fileName,
+                                  const QCString &relPath,
+                                  const QCString &context)
+{
+  QCString baseName=fileName;
+  int i;
+  if ((i=baseName.findRev('/'))!=-1) // strip path
+  {
+    baseName=baseName.right(baseName.length()-i-1);
+  }
+  if ((i=baseName.find('.'))!=-1) // strip extension
+  {
+    baseName=baseName.left(i);
+  }
+  baseName.prepend("dia_");
+  QCString outDir = Config_getString("HTML_OUTPUT");
+  writeDiaGraphFromFile(fileName,outDir,baseName,DIA_BITMAP);
+
+  m_t << "<img src=\"" << outDir << '/' << baseName << ".png" << "\" />" << endl;
+}
+
 /** Used for items found inside a paragraph, which due to XHTML restrictions
  *  have to be outside of the paragraph. This method will forcefully end
  *  the current paragraph and forceStartParagraph() will restart it.
diff --git a/src/htmldocvisitor.h b/src/htmldocvisitor.h
index 3624224..1a547ea 100644
--- a/src/htmldocvisitor.h
+++ b/src/htmldocvisitor.h
@@ -108,6 +108,8 @@ class HtmlDocVisitor : public DocVisitor
     void visitPost(DocDotFile *);
     void visitPre(DocMscFile *);
     void visitPost(DocMscFile *);
+    void visitPre(DocDiaFile *);
+    void visitPost(DocDiaFile *);
     void visitPre(DocLink *);
     void visitPost(DocLink *);
     void visitPre(DocRef *);
@@ -148,6 +150,7 @@ class HtmlDocVisitor : public DocVisitor
     void endLink();
     void writeDotFile(const QCString &fileName,const QCString &relPath,const QCString &context);
     void writeMscFile(const QCString &fileName,const QCString &relPath,const QCString &context);
+    void writeDiaFile(const QCString &fileName,const QCString &relPath,const QCString &context);
 
     void pushEnabled();
     void popEnabled();
diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp
index 19e6903..6c08342 100644
--- a/src/latexdocvisitor.cpp
+++ b/src/latexdocvisitor.cpp
@@ -27,6 +27,7 @@
 #include "message.h"
 #include "parserintf.h"
 #include "msc.h"
+#include "dia.h"
 #include "cite.h"
 #include "filedef.h"
 #include "config.h"
@@ -1255,6 +1256,18 @@ void LatexDocVisitor::visitPost(DocMscFile *df)
   if (m_hide) return;
   endMscFile(df->hasCaption());
 }
+
+void LatexDocVisitor::visitPre(DocDiaFile *df)
+{
+  if (m_hide) return;
+  startDiaFile(df->file(),df->width(),df->height(),df->hasCaption());
+}
+
+void LatexDocVisitor::visitPost(DocDiaFile *df)
+{
+  if (m_hide) return;
+  endDiaFile(df->hasCaption());
+}
 void LatexDocVisitor::visitPre(DocLink *lnk)
 {
   if (m_hide) return;
@@ -1803,3 +1816,94 @@ void LatexDocVisitor::writeMscFile(const QCString &baseName)
   m_t << "\\end{DoxyImageNoCaption}\n";
 }
 
+void LatexDocVisitor::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("dia_");
+
+  QCString outDir = Config_getString("LATEX_OUTPUT");
+  writeDiaGraphFromFile(fileName,outDir,baseName,DIA_EPS);
+  if (hasCaption)
+  {
+    m_t << "\n\\begin{DoxyImage}\n";
+  }
+  else
+  {
+    m_t << "\n\\begin{DoxyImageNoCaption}\n"
+           "  \\mbox{";
+  }
+  m_t << "\\includegraphics";
+  if (!width.isEmpty())
+  {
+    m_t << "[width=" << width << "]";
+  }
+  else if (!height.isEmpty())
+  {
+    m_t << "[height=" << height << "]";
+  }
+  else
+  {
+    m_t << "[width=\\textwidth,height=\\textheight/2,keepaspectratio=true]";
+  }
+  m_t << "{" << baseName;
+  //if (Config_getBool("USE_PDFLATEX"))
+  //{
+  //  m_t << ".pdf";
+  //}
+  //else
+  //{
+  //  m_t << ".eps";
+  //}
+  m_t << "}";
+
+  if (hasCaption)
+  {
+    m_t << "\n\\caption{";
+  }
+}
+
+void LatexDocVisitor::endDiaFile(bool hasCaption)
+{
+  if (m_hide) return;
+  m_t << "}\n"; // end caption or mbox
+  if (hasCaption)
+  {
+    m_t << "\\end{DoxyImage}\n";
+  }
+  else
+  {
+    m_t << "\\end{DoxyImageNoCaption}\n";
+  }
+}
+
+
+void LatexDocVisitor::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("LATEX_OUTPUT");
+  writeDiaGraphFromFile(baseName+".dia",outDir,shortName,DIA_EPS);
+  m_t << "\n\\begin{DoxyImageNoCaption}"
+         "  \\mbox{\\includegraphics";
+  m_t << "{" << shortName << "}";
+  m_t << "}\n"; // end mbox
+  m_t << "\\end{DoxyImageNoCaption}\n";
+}
+
diff --git a/src/latexdocvisitor.h b/src/latexdocvisitor.h
index 3fea33c..fa3395d 100644
--- a/src/latexdocvisitor.h
+++ b/src/latexdocvisitor.h
@@ -110,6 +110,8 @@ class LatexDocVisitor : public DocVisitor
     void visitPost(DocDotFile *);
     void visitPre(DocMscFile *);
     void visitPost(DocMscFile *);
+    void visitPre(DocDiaFile *);
+    void visitPost(DocDiaFile *);
     void visitPre(DocLink *lnk);
     void visitPost(DocLink *);
     void visitPre(DocRef *ref);
@@ -168,6 +170,11 @@ class LatexDocVisitor : public DocVisitor
     void endMscFile(bool hasCaption);
     void writeMscFile(const QCString &fileName);
 
+    void startDiaFile(const QCString &fileName,const QCString &width,
+                      const QCString &height, bool hasCaption);
+    void endDiaFile(bool hasCaption);
+    void writeDiaFile(const QCString &fileName);
+
     void pushEnabled();
     void popEnabled();
 
diff --git a/src/libdoxygen.pro.in b/src/libdoxygen.pro.in
index c4e79da..1e2fd1d 100644
--- a/src/libdoxygen.pro.in
+++ b/src/libdoxygen.pro.in
@@ -92,6 +92,7 @@ HEADERS      =	arguments.h \
 		membername.h \
 		message.h \
                 msc.h \
+                dia.h \
 		namespacedef.h \
 		navtree_css.h \
 		navtree_js.h \
@@ -238,6 +239,7 @@ SOURCES      =	arguments.cpp \
 		membername.cpp \
 		message.cpp \
                 msc.cpp \
+                dia.cpp \
 		namespacedef.cpp \
                 objcache.cpp \
 		outputgen.cpp \
diff --git a/src/mandocvisitor.cpp b/src/mandocvisitor.cpp
index 18f93bb..8ec80fb 100644
--- a/src/mandocvisitor.cpp
+++ b/src/mandocvisitor.cpp
@@ -775,6 +775,13 @@ void ManDocVisitor::visitPost(DocMscFile *)
 {
 }
 
+void ManDocVisitor::visitPre(DocDiaFile *)
+{
+}
+
+void ManDocVisitor::visitPost(DocDiaFile *)
+{
+}
 
 void ManDocVisitor::visitPre(DocLink *)
 {
diff --git a/src/mandocvisitor.h b/src/mandocvisitor.h
index cc4e85f..f0d2e6d 100644
--- a/src/mandocvisitor.h
+++ b/src/mandocvisitor.h
@@ -107,6 +107,8 @@ class ManDocVisitor : public DocVisitor
     void visitPost(DocDotFile *);
     void visitPre(DocMscFile *);
     void visitPost(DocMscFile *);
+    void visitPre(DocDiaFile *);
+    void visitPost(DocDiaFile *);
     void visitPre(DocLink *lnk);
     void visitPost(DocLink *);
     void visitPre(DocRef *ref);
diff --git a/src/perlmodgen.cpp b/src/perlmodgen.cpp
index 9257df0..0ca7b7a 100644
--- a/src/perlmodgen.cpp
+++ b/src/perlmodgen.cpp
@@ -364,6 +364,8 @@ public:
   void visitPost(DocDotFile *);
   void visitPre(DocMscFile *);
   void visitPost(DocMscFile *);
+  void visitPre(DocDiaFile *);
+  void visitPost(DocDiaFile *);
   void visitPre(DocLink *);
   void visitPost(DocLink *);
   void visitPre(DocRef *);
@@ -1207,6 +1209,20 @@ void PerlModDocVisitor::visitPost(DocMscFile *)
 #endif
 }
 
+void PerlModDocVisitor::visitPre(DocDiaFile *)
+{
+#if 0
+  m_output.add("<diafile name=\""); m_output.add(df->file()); m_output.add("\">");
+#endif
+}
+
+void PerlModDocVisitor::visitPost(DocDiaFile *)
+{
+#if 0
+  m_output.add("</diafile>");
+#endif
+}
+
 
 void PerlModDocVisitor::visitPre(DocLink *lnk)
 {
diff --git a/src/printdocvisitor.h b/src/printdocvisitor.h
index dc28d26..e815720 100644
--- a/src/printdocvisitor.h
+++ b/src/printdocvisitor.h
@@ -597,6 +597,16 @@ class PrintDocVisitor : public DocVisitor
       indent_post();
       printf("</mscfile>\n");
     }
+    void visitPre(DocDiaFile *df)
+    {
+      indent_pre();
+      printf("<diafile src=\"%s\">\n",df->name().data());
+    }
+    void visitPost(DocDiaFile *)
+    {
+      indent_post();
+      printf("</diafile>\n");
+    }
     void visitPre(DocLink *lnk)
     {
       indent_pre();
diff --git a/src/rtfdocvisitor.cpp b/src/rtfdocvisitor.cpp
index 9489145..3666c35 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;
@@ -1836,3 +1853,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;
+}
+
diff --git a/src/rtfdocvisitor.h b/src/rtfdocvisitor.h
index eb841e5..66718d0 100644
--- a/src/rtfdocvisitor.h
+++ b/src/rtfdocvisitor.h
@@ -107,6 +107,8 @@ class RTFDocVisitor : public DocVisitor
     void visitPost(DocDotFile *);
     void visitPre(DocMscFile *);
     void visitPost(DocMscFile *);
+    void visitPre(DocDiaFile *);
+    void visitPost(DocDiaFile *);
     void visitPre(DocLink *);
     void visitPost(DocLink *);
     void visitPre(DocRef *ref);
@@ -150,6 +152,7 @@ class RTFDocVisitor : public DocVisitor
     void popEnabled();
     void writeDotFile(const QCString &fileName);
     void writeMscFile(const QCString &fileName);
+    void writeDiaFile(const QCString &fileName);
 
     //--------------------------------------
     // state variables
diff --git a/src/textdocvisitor.h b/src/textdocvisitor.h
index 81fd9e8..4473210 100644
--- a/src/textdocvisitor.h
+++ b/src/textdocvisitor.h
@@ -106,6 +106,8 @@ class TextDocVisitor : public DocVisitor
 
     void visitPre(DocMscFile *) {}
     void visitPost(DocMscFile *) {}
+    void visitPre(DocDiaFile *) {}
+    void visitPost(DocDiaFile *) {}
     void visitPre(DocLink *) {}
     void visitPost(DocLink *) {}
     void visitPre(DocRef *) {}
diff --git a/src/xmldocvisitor.cpp b/src/xmldocvisitor.cpp
index d9b5df9..2f55135 100644
--- a/src/xmldocvisitor.cpp
+++ b/src/xmldocvisitor.cpp
@@ -836,6 +836,19 @@ void XmlDocVisitor::visitPost(DocMscFile *)
   if (m_hide) return;
   m_t << "</mscfile>" << endl;
 }
+
+void XmlDocVisitor::visitPre(DocDiaFile *df)
+{
+  if (m_hide) return;
+  m_t << "<diafile name=\"" << df->file() << "\">";
+}
+
+void XmlDocVisitor::visitPost(DocDiaFile *)
+{
+  if (m_hide) return;
+  m_t << "</diafile>" << endl;
+}
+
 void XmlDocVisitor::visitPre(DocLink *lnk)
 {
   if (m_hide) return;
diff --git a/src/xmldocvisitor.h b/src/xmldocvisitor.h
index 42290cc..a3f80b7 100644
--- a/src/xmldocvisitor.h
+++ b/src/xmldocvisitor.h
@@ -109,6 +109,8 @@ class XmlDocVisitor : public DocVisitor
 
     void visitPre(DocMscFile *);
     void visitPost(DocMscFile *);
+    void visitPre(DocDiaFile *);
+    void visitPost(DocDiaFile *);
     void visitPre(DocLink *);
     void visitPost(DocLink *);
     void visitPre(DocRef *);
