]> git.lyx.org Git - lyx.git/blobdiff - src/LaTeXFeatures.cpp
After a hiatus, I'm returning to the rewrite of InsetCommandParams, the purpose of...
[lyx.git] / src / LaTeXFeatures.cpp
index 15547477c6560919aecc44943232f3daaa03ec02..903b87c72244b05d53dc48e2027af5489aa0de17 100644 (file)
@@ -18,7 +18,6 @@
 
 #include "Color.h"
 #include "BufferParams.h"
-#include "support/debug.h"
 #include "Encoding.h"
 #include "Floating.h"
 #include "FloatList.h"
 #include "LyXRC.h"
 #include "TextClass.h"
 
+#include "support/debug.h"
 #include "support/docstream.h"
 #include "support/FileName.h"
 #include "support/filetools.h"
+#include "support/lstrings.h"
 
 using namespace std;
 using namespace lyx::support;
@@ -374,7 +375,7 @@ void LaTeXFeatures::useLayout(docstring const & layoutname)
                return;
        }
 
-       TextClass const & tclass = params_.getTextClass();
+       TextClass const & tclass = params_.textClass();
        if (tclass.hasLayout(layoutname)) {
                // Is this layout already in usedLayouts?
                if (find(usedLayouts_.begin(), usedLayouts_.end(), layoutname) 
@@ -408,19 +409,18 @@ bool LaTeXFeatures::isRequired(string const & name) const
 
 bool LaTeXFeatures::mustProvide(string const & name) const
 {
-       return isRequired(name) && !params_.getTextClass().provides(name);
+       return isRequired(name) && !params_.textClass().provides(name);
 }
 
 
 bool LaTeXFeatures::isAvailable(string const & name)
 {
-       string n = name;
        if (packages_.empty())
                getAvailable();
-       size_t loc = n.rfind(".sty");
-       if (loc == n.length() - 4) 
-               n = n.erase(name.length() - 4);
-       return find(packages_.begin(), packages_.end(), n) != packages_.end();
+       string n = name;
+       if (suffixIs(n, ".sty"))
+               n.erase(name.length() - 4);
+       return packages_.find(n) != packages_.end();
 }
 
 
@@ -439,7 +439,7 @@ void LaTeXFeatures::useFloat(string const & name)
        // We only need float.sty if we use non builtin floats, or if we
        // use the "H" modifier. This includes modified table and
        // figure floats. (Lgb)
-       Floating const & fl = params_.getTextClass().floats().getType(name);
+       Floating const & fl = params_.textClass().floats().getType(name);
        if (!fl.type().empty() && !fl.builtin()) {
                require("float");
        }
@@ -526,6 +526,7 @@ char const * simplefeatures[] = {
        "calc",
        "units",
        "tipa",
+       "tipx",
        "framed",
        "soul",
        "textcomp",
@@ -554,7 +555,7 @@ int const nb_simplefeatures = sizeof(simplefeatures) / sizeof(char const *);
 string const LaTeXFeatures::getPackages() const
 {
        ostringstream packages;
-       TextClass const & tclass = params_.getTextClass();
+       TextClass const & tclass = params_.textClass();
 
        // FIXME: currently, we can only load packages and macros known
        // to LyX.
@@ -827,7 +828,7 @@ string const LaTeXFeatures::getBabelOptions() const
 docstring const LaTeXFeatures::getTClassPreamble() const
 {
        // the text class specific preamble
-       TextClass const & tclass = params_.getTextClass();
+       TextClass const & tclass = params_.textClass();
        odocstringstream tcpreamble;
 
        tcpreamble << tclass.preamble();
@@ -902,7 +903,7 @@ BufferParams const & LaTeXFeatures::bufferParams() const
 
 void LaTeXFeatures::getFloatDefinitions(ostream & os) const
 {
-       FloatList const & floats = params_.getTextClass().floats();
+       FloatList const & floats = params_.textClass().floats();
 
        // Here we will output the code to create the needed float styles.
        // We will try to do this as minimal as possible.