]> git.lyx.org Git - lyx.git/blobdiff - src/LaTeXFeatures.C
get rid of LYX_LIBS
[lyx.git] / src / LaTeXFeatures.C
index 039beb85faeaf40bebb17e52b3c276243f977817..cf8cec1380241a1bf446aed5e481a9dd0e1ba78b 100644 (file)
 #include "support/filetools.h"
 #include "support/lstrings.h"
 
-using lyx::layout_type;
 using lyx::textclass_type;
 
 using std::endl;
 using std::set;
+using std::vector;
+using std::find;
+using std::ostream;
 
-LaTeXFeatures::LaTeXFeatures(BufferParams const & p, layout_type n)
-       : layout(n, false), params(p)
+
+LaTeXFeatures::LaTeXFeatures(BufferParams const & p)
+       : params(p)
 {}
 
 
@@ -44,26 +47,21 @@ void LaTeXFeatures::require(string const & name)
        if (isRequired(name))
                return;
        
-       // INSET_GRAPHICS: remove this when InsetFig is thrown.
-       if (name == "graphics") {
-               features.push_back("graphicx");
-               features.push_back("graphics");
-       } else
-               features.push_back(name);
+       features.push_back(name);
 }
 
 
-void LaTeXFeatures::useLayout(std::vector<bool>::size_type const & idx)
+void LaTeXFeatures::useLayout(string const & lyt)
 {
-       layout[idx] = true;
+       layout.insert(lyt);
 }
 
 
 bool LaTeXFeatures::isRequired(string const & name) const
 {
-       FeaturesList::const_iterator i = std::find(features.begin(), 
-                                                  features.end(),
-                                                  name);
+       FeaturesList::const_iterator i = find(features.begin(), 
+                                             features.end(),
+                                             name);
        return i != features.end();
 }
 
@@ -153,8 +151,7 @@ const int nb_simplefeatures = sizeof(simplefeatures) / sizeof(char const *);
 string const LaTeXFeatures::getPackages() const
 {
        ostringstream packages;
-       LyXTextClass const & tclass =
-               textclasslist.TextClass(params.textclass);
+       LyXTextClass const & tclass = textclasslist[params.textclass];
 
 
        /**
@@ -205,17 +202,6 @@ string const LaTeXFeatures::getPackages() const
                                 << "]{graphicx}\n";
        }
 
-       // INSET_GRAPHICS: remove this when InsetFig is thrown.
-       // graphics.sty
-       if (isRequired("graphics") && params.graphicsDriver != "none") {
-               if (params.graphicsDriver == "default")
-                       packages << "\\usepackage{graphics}\n";
-               else
-                       packages << "\\usepackage[" 
-                                << params.graphicsDriver
-                                << "]{graphics}\n";
-       }
-
        //if (algorithm) {
        //      packages << "\\usepackage{algorithm}\n";
        //}
@@ -337,17 +323,17 @@ string const LaTeXFeatures::getMacros() const
 string const LaTeXFeatures::getTClassPreamble() const
 {
        // the text class specific preamble 
-       LyXTextClass const & tclass = textclasslist.TextClass(params.textclass);
+       LyXTextClass const & tclass = textclasslist[params.textclass];
        ostringstream tcpreamble;
 
        tcpreamble << tclass.preamble();
 
-       for (layout_type i = 0; i < tclass.numLayouts(); ++i) {
-               if (layout[i]) {
-                       tcpreamble << tclass[i].preamble();
-               }
+       set<string>::const_iterator cit = layout.begin();
+       set<string>::const_iterator end = layout.end();
+       for (; cit != end; ++cit) {
+               tcpreamble << tclass[*cit].preamble();
        }
-
+       
        return tcpreamble.str().c_str();
 }      
 
@@ -374,7 +360,7 @@ string const LaTeXFeatures::getIncludedFiles(string const & fname) const
        for (FileMap::const_iterator fi = IncludedFiles.begin();
             fi != end; ++fi)
                sgmlpreamble << "\n<!ENTITY " << fi->first
-                            << (IsSGMLFilename(fi->second) ? " SYSTEM \"" : " \"" )
+                            << (IsSGMLFilename(fi->second) ? " SYSTEM \"" : " \"")
                             << MakeRelPath(fi->second, basename) << "\">";
 
        return sgmlpreamble.str().c_str();
@@ -395,7 +381,8 @@ BufferParams const & LaTeXFeatures::bufferParams() const
        return params;
 }
 
-void LaTeXFeatures::getFloatDefinitions(std::ostream & os) const
+
+void LaTeXFeatures::getFloatDefinitions(ostream & os) const
 {
        // Here we will output the code to create the needed float styles.
        // We will try to do this as minimal as possible.