#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)
{}
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();
}
string const LaTeXFeatures::getPackages() const
{
ostringstream packages;
- LyXTextClass const & tclass =
- textclasslist.TextClass(params.textclass);
+ LyXTextClass const & tclass = textclasslist[params.textclass];
/**
<< "]{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";
//}
macros << boldsymbol_def << '\n';
if (isRequired("binom") && !isRequired("amsmath"))
macros << binom_def << '\n';
-
+ if (isRequired("mathcircumflex"))
+ macros << mathcircumflex_def << '\n';
+
// other
if (isRequired("NeedLyXMinipageIndent"))
macros << minipageindent_def;
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();
}
-
- // DEC's implementation of ostringstream has a bug which can be
- // overcome with this forcing.
- tcpreamble.seekp(std::ios::beg);
-
+
return tcpreamble.str().c_str();
}
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();
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.