]> git.lyx.org Git - lyx.git/blobdiff - src/insets/ExternalTemplate.C
Re-add the RasterImage template.
[lyx.git] / src / insets / ExternalTemplate.C
index 959706e9944b41953fb8ec7e04e2b7a96857e6fa..49d9e3cf7f88a8234e46bc9e624232bc04e114b7 100644 (file)
 
 #include "ExternalTemplate.h"
 
-#include "lyxlex.h"
 #include "debug.h"
-#include "support/path.h"
-#include "support/LAssert.h"
+#include "lyxlex.h"
+
 #include "support/filetools.h"
 #include "support/lstrings.h"
+#include "support/path.h"
 #include "support/path_defines.h"
 
+#include <boost/assert.hpp>
+
 #include <algorithm>
 
 namespace support = lyx::support;
 
 using std::endl;
-using std::ostream;
 using std::for_each;
 
+using std::ostream;
+using std::vector;
+
+
 // We have to have dummy default commands for security reasons!
 
 ExternalTemplate::ExternalTemplate()
@@ -41,7 +46,6 @@ ExternalTemplate::FormatTemplate::FormatTemplate()
 
 ExternalTemplateManager::ExternalTemplateManager()
 {
-       // gimp gnuchess gnuplot ical netscape tetris xpaint
        readTemplates(support::user_lyxdir());
        if (lyxerr.debugging(Debug::EXTERNAL)) {
                dumpPreambleDefs(lyxerr);
@@ -107,9 +111,15 @@ public:
                    << "\t\tProduct " << ft.product << '\n'
                    << "\t\tUpdateFormat " << ft.updateFormat << '\n'
                    << "\t\tUpdateResult " << ft.updateResult << '\n'
-                   << "\t\tRequirement " << ft.requirement << '\n'
-                   << "\t\tPreamble " << ft.preambleName << '\n'
-                   << "\tFormatEnd\n";
+                   << "\t\tRequirement " << ft.requirement << '\n';
+
+               vector<string>::const_iterator it  = ft.preambleNames.begin();
+               vector<string>::const_iterator end = ft.preambleNames.end();
+               for (; it != end; ++it) {
+                       ost << "\t\tPreamble " << *it << '\n';
+               }
+
+               ost << "\tFormatEnd\n";
        }
 private:
        ostream & ost;
@@ -155,9 +165,11 @@ ExternalTemplateManager::getTemplates() const
 }
 
 
-ExternalTemplate const & ExternalTemplateManager::getTemplateByName(string const & name)
+ExternalTemplate const *
+ExternalTemplateManager::getTemplateByName(string const & name) const
 {
-       return templates[name];
+       Templates::const_iterator it = templates.find(name);
+       return (it == templates.end()) ? 0 : &it->second;
 }
 
 
@@ -304,7 +316,7 @@ void ExternalTemplate::readTemplate(LyXLex & lex)
                default:
                        lex.printError("ExternalTemplate::readTemplate: "
                                       "Wrong tag: $$Token");
-                       support::Assert(false);
+                       BOOST_ASSERT(false);
                        break;
                }
        }
@@ -357,7 +369,7 @@ void ExternalTemplate::FormatTemplate::readFormat(LyXLex & lex)
 
                case FO_PREAMBLE:
                        lex.next(true);
-                       preambleName = lex.getString();
+                       preambleNames.push_back(lex.getString());
                        break;
 
                case FO_END: