]> git.lyx.org Git - lyx.git/blobdiff - src/LaTeXFeatures.cpp
do what the FIXME suggested
[lyx.git] / src / LaTeXFeatures.cpp
index 903b87c72244b05d53dc48e2027af5489aa0de17..8a142ce876d9910376db17dce35b3dd27597c13d 100644 (file)
@@ -375,7 +375,7 @@ void LaTeXFeatures::useLayout(docstring const & layoutname)
                return;
        }
 
-       TextClass const & tclass = params_.textClass();
+       DocumentClass const & tclass = params_.documentClass();
        if (tclass.hasLayout(layoutname)) {
                // Is this layout already in usedLayouts?
                if (find(usedLayouts_.begin(), usedLayouts_.end(), layoutname) 
@@ -409,7 +409,7 @@ bool LaTeXFeatures::isRequired(string const & name) const
 
 bool LaTeXFeatures::mustProvide(string const & name) const
 {
-       return isRequired(name) && !params_.textClass().provides(name);
+       return isRequired(name) && !params_.documentClass().provides(name);
 }
 
 
@@ -433,13 +433,16 @@ void LaTeXFeatures::addPreambleSnippet(string const & preamble)
 }
 
 
-void LaTeXFeatures::useFloat(string const & name)
+void LaTeXFeatures::useFloat(string const & name, bool subfloat)
 {
-       usedFloats_.insert(name);
+       if (!usedFloats_[name])
+               usedFloats_[name] = subfloat;
+       if (subfloat)
+               require("subfig");
        // 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_.textClass().floats().getType(name);
+       Floating const & fl = params_.documentClass().floats().getType(name);
        if (!fl.type().empty() && !fl.builtin()) {
                require("float");
        }
@@ -510,7 +513,7 @@ char const * simplefeatures[] = {
        "rotating",
        "latexsym",
        "pifont",
-       "subfigure",
+       "subfig",
        "varioref",
        "prettyref",
        /*For a successful cooperation of the `wrapfig' package with the
@@ -555,7 +558,7 @@ int const nb_simplefeatures = sizeof(simplefeatures) / sizeof(char const *);
 string const LaTeXFeatures::getPackages() const
 {
        ostringstream packages;
-       TextClass const & tclass = params_.textClass();
+       DocumentClass const & tclass = params_.documentClass();
 
        // FIXME: currently, we can only load packages and macros known
        // to LyX.
@@ -828,7 +831,7 @@ string const LaTeXFeatures::getBabelOptions() const
 docstring const LaTeXFeatures::getTClassPreamble() const
 {
        // the text class specific preamble
-       TextClass const & tclass = params_.textClass();
+       DocumentClass const & tclass = params_.documentClass();
        odocstringstream tcpreamble;
 
        tcpreamble << tclass.preamble();
@@ -903,7 +906,7 @@ BufferParams const & LaTeXFeatures::bufferParams() const
 
 void LaTeXFeatures::getFloatDefinitions(ostream & os) const
 {
-       FloatList const & floats = params_.textClass().floats();
+       FloatList const & floats = params_.documentClass().floats();
 
        // Here we will output the code to create the needed float styles.
        // We will try to do this as minimal as possible.
@@ -914,7 +917,7 @@ void LaTeXFeatures::getFloatDefinitions(ostream & os) const
        UsedFloats::const_iterator end = usedFloats_.end();
        // ostringstream floats;
        for (; cit != end; ++cit) {
-               Floating const & fl = floats.getType((*cit));
+               Floating const & fl = floats.getType((cit->first));
 
                // For builtin floats we do nothing.
                if (fl.builtin()) continue;
@@ -959,6 +962,8 @@ void LaTeXFeatures::getFloatDefinitions(ostream & os) const
                        // used several times, when the same style is still in
                        // effect. (Lgb)
                }
+               if (cit->second)
+                       os << "\n\\newsubfloat{" << fl.type() << "}\n";
        }
 }