]> git.lyx.org Git - lyx.git/blobdiff - src/Layout.cpp
Add test-refstyle-references to cmake. Also added missing file test-refstyle-referenc...
[lyx.git] / src / Layout.cpp
index 7e0308db9bf1d8fbe1a646e2b262e3bb5607b173..78485d49969a235e676a5e2d6a39372e0221efbe 100644 (file)
@@ -13,7 +13,6 @@
 #include <config.h>
 
 #include "Layout.h"
-#include "Encoding.h"
 #include "FontInfo.h"
 #include "Language.h"
 #include "Lexer.h"
@@ -328,6 +327,7 @@ bool Layout::read(Lexer & lex, TextClass const & tclass)
                        if (reset) {
                                latexargs_.clear();
                                itemargs_.clear();
+                               postcommandargs_.clear();
                        }
                        break;
 
@@ -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;
 }