]> git.lyx.org Git - lyx.git/blobdiff - src/insets/ExternalTemplate.C
The package reworking.
[lyx.git] / src / insets / ExternalTemplate.C
index 0bffe07c0fdc1f8612fee3fe58586ee0a63d870d..197667759426db5dd075d07a37e8ec985710ae39 100644 (file)
 
 #include "support/filetools.h"
 #include "support/lstrings.h"
+#include "support/package.h"
 #include "support/path.h"
-#include "support/path_defines.h"
-#include "support/translator.h"
-
-#include <boost/assert.hpp>
-
-#include <algorithm>
 
 namespace support = lyx::support;
 
@@ -59,7 +54,7 @@ Template::Format::Format()
 
 TemplateManager::TemplateManager()
 {
-       readTemplates(support::user_lyxdir());
+       readTemplates(support::package().user_support());
        if (lyxerr.debugging(Debug::EXTERNAL)) {
                dumpPreambleDefs(lyxerr);
                lyxerr << '\n';
@@ -151,6 +146,18 @@ public:
                        ost << "\t\tPreamble " << *pit << '\n';
                }
 
+               typedef Template::Format::FileMap FileMap;
+               FileMap::const_iterator rit  = ft.referencedFiles.begin();
+               FileMap::const_iterator rend = ft.referencedFiles.end();
+               for (; rit != rend; ++rit) {
+                       vector<string>::const_iterator fit  = rit->second.begin();
+                       vector<string>::const_iterator fend = rit->second.end();
+                       for (; fit != fend; ++fit) {
+                               ost << "\t\tReferencedFile " << rit->first
+                                   << " \"" << *fit << "\"\n";
+                       }
+               }
+
                ost << "\tFormatEnd\n";
        }
 private:
@@ -457,6 +464,7 @@ void Template::Format::readFormat(LyXLex & lex)
                FO_PREAMBLE,
                FO_TRANSFORMCOMMAND,
                FO_TRANSFORMOPTION,
+               FO_REFERENCEDFILE,
                FO_END
        };
 
@@ -465,6 +473,7 @@ void Template::Format::readFormat(LyXLex & lex)
                { "option", FO_OPTION },
                { "preamble", FO_PREAMBLE },
                { "product", FO_PRODUCT },
+               { "referencedfile", FO_REFERENCEDFILE },
                { "requirement", FO_REQUIREMENT },
                { "transformcommand", FO_TRANSFORMCOMMAND },
                { "transformoption", FO_TRANSFORMOPTION },
@@ -526,6 +535,15 @@ void Template::Format::readFormat(LyXLex & lex)
                        break;
                }
 
+               case FO_REFERENCEDFILE: {
+                       lex.next(true);
+                       string const format = lex.getString();
+                       lex.next(true);
+                       string const file = lex.getString();
+                       referencedFiles[format].push_back(file);
+                       break;
+               }
+
                case FO_END:
                        return;
                }