]> git.lyx.org Git - lyx.git/blobdiff - src/insets/ExternalTemplate.C
Don't remove cell selections after fontchange.
[lyx.git] / src / insets / ExternalTemplate.C
index 377429edcd833a51a28a4453fa391dcda0e82620..cdf429ea22951b613498d814fb4d6fd60e077803 100644 (file)
@@ -34,12 +34,11 @@ extern string user_lyxdir;
 // We have to have dummy default commands for security reasons!
 
 ExternalTemplate::ExternalTemplate()
-       : viewCommand("true"), editCommand("true")
 {}
 
 
 ExternalTemplate::FormatTemplate::FormatTemplate()
-       : updateCommand("true") {}
+{}
 
 
 ExternalTemplateManager::ExternalTemplateManager()
@@ -53,7 +52,7 @@ ExternalTemplateManager::ExternalTemplateManager()
 
 class dumpTemplate {
 public:
-       dumpTemplate(std::ostream & o) 
+       dumpTemplate(ostream & o) 
                : ost(o) {}
        void operator()(ExternalTemplateManager::Templates::value_type const & vt) {
                ExternalTemplate const & et = vt.second;
@@ -85,6 +84,7 @@ public:
                ost << "\tFormat " << vt.first << "\n"
                    << "\t\tProduct " << ft.product << "\n"
                    << "\t\tUpdateCommand " << ft.updateCommand << "\n"
+                   << "\t\tUpdateResult " << ft.updateResult << "\n"
                    << "\t\tRequirement " << ft.requirement << "\n"
                    << "\t\tPreamble\n"
                    << ft.preamble
@@ -163,11 +163,11 @@ void ExternalTemplateManager::readTemplates(string const & path)
                return;
        }
        
-       while (lex.IsOK()) {
+       while (lex.isOK()) {
                switch (lex.lex()) {
                case TM_TEMPLATE: {
                        lex.next();
-                       string temp = lex.GetString();
+                       string const temp = lex.getString();
                        ExternalTemplate & tmp = templates[temp];
                        tmp.lyxName = temp;
                        tmp.readTemplate(lex);
@@ -208,11 +208,11 @@ void ExternalTemplate::readTemplate(LyXLex & lex)
 
        pushpophelper pph(lex, templateoptiontags, TO_END);
        
-       while (lex.IsOK()) {
+       while (lex.isOK()) {
                switch (lex.lex()) {
                case TO_GUINAME:
                        lex.next(true);
-                       guiName = lex.GetString();
+                       guiName = lex.getString();
                        break;
                        
                case TO_HELPTEXT:
@@ -221,33 +221,27 @@ void ExternalTemplate::readTemplate(LyXLex & lex)
                        
                case TO_FILTER:
                        lex.next(true);
-                       fileRegExp = lex.GetString();
+                       fileRegExp = lex.getString();
                        break;
                        
                case TO_VIEWCMD:
                        lex.next(true);
-                       viewCommand = lex.GetString();
-                       // For security reasons, a command may not be empty!
-                       if (viewCommand.empty())
-                               viewCommand = "true";
+                       viewCommand = lex.getString();
                        break;
                        
                case TO_EDITCMD:
                        lex.next(true);
-                       editCommand = lex.GetString();
-                       // For security reasons, a command may not be empty!
-                       if (editCommand.empty())
-                               editCommand = "true";
+                       editCommand = lex.getString();
                        break;
                        
                case TO_AUTOMATIC:
                        lex.next();
-                       automaticProduction = lex.GetBool();
+                       automaticProduction = lex.getBool();
                        break;
                        
                case TO_FORMAT:
                        lex.next(true);
-                       formats[lex.GetString()].readFormat(lex);
+                       formats[lex.getString()].readFormat(lex);
                        break;
                        
                case TO_END:
@@ -268,6 +262,7 @@ void ExternalTemplate::FormatTemplate::readFormat(LyXLex & lex)
        enum FormatTags {
                FO_PRODUCT = 1,
                FO_UPDATECMD,
+               FO_UPDATERESULT,
                FO_REQUIREMENT,
                FO_PREAMBLE,
                FO_END
@@ -278,29 +273,32 @@ void ExternalTemplate::FormatTemplate::readFormat(LyXLex & lex)
                { "preamble", FO_PREAMBLE },
                { "product", FO_PRODUCT },
                { "requirement", FO_REQUIREMENT },
-               { "updatecommand", FO_UPDATECMD }
+               { "updatecommand", FO_UPDATECMD },
+               { "updateresult", FO_UPDATERESULT }
        };
 
        pushpophelper pph(lex, formattags, FO_END);
        
-       while (lex.IsOK()) {
+       while (lex.isOK()) {
                switch (lex.lex()) {
                case FO_PRODUCT:
                        lex.next(true);
-                       product = lex.GetString();
+                       product = lex.getString();
                        break;
                        
                case FO_UPDATECMD:
                        lex.next(true);
-                       updateCommand = lex.GetString();
-                       // For security reasons, a command may not be empty!
-                       if (updateCommand.empty())
-                               updateCommand = "true";
+                       updateCommand = lex.getString();
+                       break;
+
+               case FO_UPDATERESULT:
+                       lex.next(true);
+                       updateResult = lex.getString();
                        break;
                        
                case FO_REQUIREMENT:
                        lex.next(true);
-                       requirement = lex.GetString();
+                       requirement = lex.getString();
                        break;
                        
                case FO_PREAMBLE: