]> git.lyx.org Git - lyx.git/blobdiff - src/BufferParams.cpp
* do not ignore "requires" field in MathMacro
[lyx.git] / src / BufferParams.cpp
index d2c068d0fba777cc599eafba11a01bdbe0f1dee8..052da14fd4c14d8604f18c89f46acc8502c76acf 100644 (file)
 #include "gettext.h"
 #include "Language.h"
 #include "LaTeXFeatures.h"
+#include "Messages.h"
 #include "Color.h"
 #include "Font.h"
 #include "Lexer.h"
 #include "LyXRC.h"
 #include "TextClassList.h"
 #include "OutputParams.h"
-#include "tex-strings.h"
 #include "Spacing.h"
 #include "TexRow.h"
 #include "VSpace.h"
 
 #include <sstream>
 
-
-namespace lyx {
-
-using support::bformat;
-using support::rtrim;
-using support::tokenPos;
-
 using std::endl;
 using std::string;
 using std::istringstream;
@@ -60,9 +53,45 @@ using std::ostream;
 using std::ostringstream;
 using std::pair;
 
-namespace Alert = lyx::frontend::Alert;
+using lyx::support::bformat;
+using lyx::support::rtrim;
+using lyx::support::tokenPos;
+
+
+static char const * const string_paragraph_separation[] = {
+       "indent", "skip", ""
+};
+
+
+static char const * const string_quotes_language[] = {
+       "english", "swedish", "german", "polish", "french", "danish", ""
+};
+
+
+static char const * const string_papersize[] = {
+       "default", "custom", "letterpaper", "executivepaper", "legalpaper",
+       "a3paper", "a4paper", "a5paper", "b3paper", "b4paper", "b5paper", ""
+};
+
+
+static char const * const string_orientation[] = {
+       "portrait", "landscape", ""
+};
 
 
+static char const * const string_footnotekinds[] = {
+       "footnote", "margin", "fig", "tab", "alg", "wide-fig", "wide-tab", ""
+};
+
+
+static char const * const tex_graphics[] = {
+       "default", "dvips", "dvitops", "emtex",
+       "ln", "oztex", "textures", "none", ""
+};
+
+
+namespace lyx {
+
 // Local translators
 namespace {
 
@@ -335,6 +364,13 @@ BufferParams::~BufferParams()
 {}
 
 
+docstring const BufferParams::B_(string const & l10n) const
+{
+       BOOST_ASSERT(language);
+       return getMessages(language->code()).get(l10n);
+}
+
+
 AuthorList & BufferParams::authors()
 {
        return pimpl_->authorlist;
@@ -441,7 +477,7 @@ string const BufferParams::readToken(Lexer & lex, string const & token)
                                                 "class or style file required by it is not\n"
                                                 "available. See the Customization documentation\n"
                                                 "for more information.\n"), from_utf8(classname));
-                       Alert::warning(_("Document class not available"),
+                       frontend::Alert::warning(_("Document class not available"),
                                       msg + _("LyX will not be able to produce output."));
                }
        } else if (token == "\\begin_preamble") {
@@ -862,7 +898,7 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
                // thailatex does not use the inputenc package, but sets up
                // babel directly for tis620-0 encoding, therefore we must
                // not request inputenc for tis620-0 encoding
-               if (!encodings.empty() || doc_encoding != "tis620-0") {
+               if (!encodings.empty() && doc_encoding != "tis620-0") {
                        os << "\\usepackage[";
                        std::set<string>::const_iterator it = encodings.begin();
                        std::set<string>::const_iterator const end = encodings.end();
@@ -880,13 +916,21 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
                        os << "]{inputenc}\n";
                        texrow.newline();
                }
+       // utf8-plain is for XeTeX users (inputenc not desired)
        } else if (inputenc != "default" && inputenc != "tis620-0" &&
-                  inputenc != "ascii") {
+                  inputenc != "ascii" &&  inputenc != "utf8-plain") {
                os << "\\usepackage[" << from_ascii(inputenc)
                   << "]{inputenc}\n";
                texrow.newline();
        }
 
+       // The encoding "armscii8" is only available when the package "armtex" is loaded.
+       // armscii8 is used for Armenian.
+       if (language->encoding()->latexName() == "armscii8" || inputenc == "armscii8") {
+               os << "\\usepackage{armtex}\n";
+               texrow.newline();
+       }
+
        if (use_geometry || nonstandard_papersize) {
                os << "\\usepackage{geometry}\n";
                texrow.newline();