]> git.lyx.org Git - lyx.git/blobdiff - src/Layout.cpp
Support for command argument placement after the workarea argument
[lyx.git] / src / Layout.cpp
index 7e0308db9bf1d8fbe1a646e2b262e3bb5607b173..1eaa38aa5fa3b495a590ba70f858bfa736a6eb47 100644 (file)
@@ -896,6 +896,7 @@ void Layout::readArgument(Lexer & lex)
        string id;
        lex >> id;
        bool const itemarg = prefixIs(id, "item:");
+       bool const postcmd = prefixIs(id, "post:");
 
        while (!finished && lex.isOK() && !error) {
                lex.next();
@@ -952,6 +953,8 @@ void Layout::readArgument(Lexer & lex)
                LYXERR0("Incomplete Argument definition!");
        else if (itemarg)
                itemargs_[id] = arg;
+       else if (postcmd)
+               postcommandargs_[id] = arg;
        else
                latexargs_[id] = arg;
 }
@@ -960,6 +963,8 @@ void Layout::readArgument(Lexer & lex)
 Layout::LaTeXArgMap Layout::args() const
 {
        LaTeXArgMap args = latexargs_;
+       if (!postcommandargs_.empty())
+               args.insert(postcommandargs_.begin(), postcommandargs_.end());
        if (!itemargs_.empty())
                args.insert(itemargs_.begin(), itemargs_.end());
        return args;
@@ -974,6 +979,11 @@ int Layout::optArgs() const
                if (!(*it).second.mandatory)
                        ++nr;
        }
+       LaTeXArgMap::const_iterator iit = postcommandargs_.begin();
+       for (; iit != postcommandargs_.end(); ++iit) {
+               if (!(*iit).second.mandatory)
+                       ++nr;
+       }
        return nr;
 }
 
@@ -986,6 +996,11 @@ int Layout::requiredArgs() const
                if ((*it).second.mandatory)
                        ++nr;
        }
+       LaTeXArgMap::const_iterator iit = postcommandargs_.begin();
+       for (; iit != postcommandargs_.end(); ++iit) {
+               if (!(*iit).second.mandatory)
+                       ++nr;
+       }
        return nr;
 }