]> git.lyx.org Git - lyx.git/blobdiff - src/BufferParams.cpp
Use context-sensitive command termination
[lyx.git] / src / BufferParams.cpp
index bae97f68004e37e6df11c7bba5f11db817a60d1f..7832b268d21d8f29952c644fd48732eca09c7ef9 100644 (file)
@@ -1452,7 +1452,7 @@ void BufferParams::validate(LaTeXFeatures & features) const
 
        // some languages are only available via polyglossia
        if (features.hasPolyglossiaExclusiveLanguages())
-          features.require("polyglossia");
+               features.require("polyglossia");
 
        if (useNonTeXFonts && fontsMath() != "auto")
                features.require("unicode-math");
@@ -2182,14 +2182,17 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
                        os << "[" << from_ascii(language->polyglossiaOpts()) << "]";
                os << "{" << from_ascii(language->polyglossia()) << "}\n";
                // now setup the other languages
-               std::map<std::string, std::string> const polylangs =
+               set<string> const polylangs =
                        features.getPolyglossiaLanguages();
-               for (std::map<std::string, std::string>::const_iterator mit = polylangs.begin();
+               for (set<string>::const_iterator mit = polylangs.begin();
                     mit != polylangs.end() ; ++mit) {
+                       // We do not output the options here; they are output in
+                       // the language switch commands. This is safer if multiple
+                       // varieties are used.
+                       if (*mit == language->polyglossia())
+                               continue;
                        os << "\\setotherlanguage";
-                       if (!mit->second.empty())
-                               os << "[" << from_ascii(mit->second) << "]";
-                       os << "{" << from_ascii(mit->first) << "}\n";
+                       os << "{" << from_ascii(*mit) << "}\n";
                }
        }
 
@@ -2391,13 +2394,15 @@ string BufferParams::bufferFormat() const
 }
 
 
-bool BufferParams::isExportable(string const & format) const
+bool BufferParams::isExportable(string const & format, bool need_viewable) const
 {
-       vector<string> backs = backends();
-       for (vector<string>::const_iterator it = backs.begin();
-            it != backs.end(); ++it)
-               if (theConverters().isReachable(*it, format))
+       FormatList const & formats = exportableFormats(need_viewable);
+       FormatList::const_iterator fit = formats.begin();
+       FormatList::const_iterator end = formats.end();
+       for (; fit != end ; ++fit) {
+               if ((*fit)->name() == format)
                        return true;
+       }
        return false;
 }
 
@@ -2432,19 +2437,6 @@ FormatList const & BufferParams::exportableFormats(bool only_viewable) const
 }
 
 
-bool BufferParams::isExportableFormat(string const & format) const
-{
-       FormatList const & formats = exportableFormats(true);
-       FormatList::const_iterator fit = formats.begin();
-       FormatList::const_iterator end = formats.end();
-       for (; fit != end ; ++fit) {
-               if ((*fit)->name() == format)
-                       return true;
-       }
-       return false;
-}
-
-
 vector<string> BufferParams::backends() const
 {
        vector<string> v;