using std::list;
using lyx::pos_type;
-using lyx::layout_type;
using lyx::textclass_type;
// all these externs should eventually be removed.
string const layoutname = lex.getString();
//lyxerr << "Looking for layout '"
// << layoutname << "'!" << endl;
-
- pair<bool, layout_type> pp
- = textclasslist.NumberOfLayout(params.textclass, layoutname);
//lyxerr << "Result: " << pp.first << "/" << pp.second << endl;
par = new Paragraph(par);
}
pos = 0;
- if (pp.first) {
- par->layout = pp.second;
-#ifndef NO_COMPABILITY
- } else if (ert_comp.active) {
- par->layout = 0;
-#endif
- } else {
- // layout not found
- // use default layout "Standard" (0)
- //lyxerr << "Layout '" << layoutname
- // << "' was not found!" << endl;
-
- par->layout = 0;
- ++unknown_layouts;
- string const s = _("Layout had to be changed from\n")
- + layoutname + _(" to ")
- + textclasslist.NameOfLayout(params.textclass, par->layout);
- InsetError * new_inset = new InsetError(s);
- par->insertInset(0, new_inset,
- LyXFont(LyXFont::ALL_INHERIT,
- params.language));
- }
+ par->layout(layoutname);
// Test whether the layout is obsolete.
LyXLayout const & layout =
- textclasslist.Style(params.textclass,
- par->layout);
+ textclasslist[params.textclass][par->layout()];
if (!layout.obsoleted_by().empty())
- par->layout = textclasslist
- .NumberOfLayout(params.textclass,
- layout.obsoleted_by())
- .second;
+ par->layout(layout.obsoleted_by());
par->params().depth(depth);
font = LyXFont(LyXFont::ALL_INHERIT, params.language);
if (file_format < 216
string(_("LyX will not be able to produce output correctly.")));
params.textclass = 0;
}
- if (!textclasslist.Load(params.textclass)) {
+ if (!textclasslist[params.textclass].load()) {
// if the textclass wasn't loaded properly
// we need to either substitute another
// or stop loading the file.
// stop loading... ideas?? ARRae980418
Alert::alert(_("Textclass Loading Error!"),
string(_("Can't load textclass ")) +
- textclasslist.NameOfClass(params.textclass),
+ textclasslist[params.textclass].name(),
_("-- substituting default"));
params.textclass = 0;
}
#endif
} else if (token == "\\SpecialChar") {
LyXLayout const & layout =
- textclasslist.Style(params.textclass,
- par->getLayout());
+ textclasslist[params.textclass][par->layout()];
// Insets don't make sense in a free-spacing context! ---Kayvan
if (layout.free_spacing || par->isFreeSpacing()) {
// Remove it later some time...introduced with fileformat
// 2.16. (Lgb)
LyXLayout const & layout =
- textclasslist.Style(params.textclass,
- par->getLayout());
+ textclasslist[params.textclass][par->layout()];
if (layout.free_spacing || par->isFreeSpacing()) {
par->insertChar(pos, ' ', font);
if (checkminipage && (call_depth == 1)) {
checkminipage = false;
if (minipar && (minipar != par) &&
- (par->params().pextraType()==Paragraph::PEXTRA_MINIPAGE))
- {
+ (par->params().pextraType() == Paragraph::PEXTRA_MINIPAGE)) {
lyxerr << "minipages in a row" << endl;
if (par->params().pextraStartMinipage()) {
lyxerr << "start new minipage" << endl;
// create a new paragraph to insert the
// minipages in the following case
if (par->params().pextraStartMinipage() &&
- !par->params().pextraHfill())
- {
+ !par->params().pextraHfill()) {
Paragraph * p = new Paragraph;
- p->layout = 0;
+ p->layout(textclasslist[params.textclass].defaultLayoutName());
+
p->previous(parBeforeMinipage);
parBeforeMinipage->next(p);
p->next(0);
// a sequence of minipages
// in its own paragraph.
Paragraph * p = new Paragraph;
- p->layout = 0;
+ p->layout(textclasslist[params.textclass].defaultLayoutName());
p->previous(par->previous());
p->next(0);
p->params().depth(depth);
void Buffer::insertStringAsLines(Paragraph *& par, pos_type & pos,
LyXFont const & fn,string const & str) const
{
- LyXLayout const & layout = textclasslist.Style(params.textclass,
- par->getLayout());
+ LyXLayout const & layout =
+ textclasslist[params.textclass][par->layout()];
LyXFont font = fn;
- (void)par->checkInsertChar(font);
+ par->checkInsertChar(font);
// insert the string, don't insert doublespace
bool space_inserted = true;
for(string::const_iterator cit = str.begin();
#endif
// First write the layout
- string const tmp = textclasslist.NameOfLayout(params.textclass, par->layout);
- if (tmp == "Itemize") {
+ string const & tmp = lowercase(par->layout());
+ if (tmp == "itemize") {
ltype = 1;
ltype_depth = depth + 1;
- } else if (tmp == "Enumerate") {
+ } else if (tmp == "enumerate") {
ltype = 2;
ltype_depth = depth + 1;
} else if (contains(tmp, "ection")) {
} else if (contains(tmp, "aragraph")) {
ltype = 4;
ltype_depth = depth + 1;
- } else if (tmp == "Description") {
+ } else if (tmp == "description") {
ltype = 5;
ltype_depth = depth + 1;
- } else if (tmp == "Abstract") {
+ } else if (tmp == "abstract") {
ltype = 6;
ltype_depth = 0;
- } else if (tmp == "Bibliography") {
+ } else if (tmp == "bibliography") {
ltype = 7;
ltype_depth = 0;
} else {
tex_code_break_column = lyxrc.ascii_linelen;
LyXTextClass const & tclass =
- textclasslist.TextClass(params.textclass);
+ textclasslist[params.textclass];
ofstream ofs(fname.c_str());
if (!ofs) {
// validate the buffer.
lyxerr[Debug::LATEX] << " Validating buffer..." << endl;
- LaTeXFeatures features(params, tclass.numLayouts());
+ LaTeXFeatures features(params, tclass.size());
validate(features);
lyxerr[Debug::LATEX] << " Buffer validation done." << endl;
}
ofs << '{'
- << textclasslist.LatexnameOfClass(params.textclass)
+ << textclasslist[params.textclass].latexname()
<< "}\n";
texrow.newline();
// end of \documentclass defs
// any environment other then "Standard" to be valid!
if ((in == 0) || !in->forceDefaultParagraphs(in)) {
LyXLayout const & layout =
- textclasslist.Style(params.textclass, par->layout);
+ textclasslist[params.textclass][par->layout()];
if (layout.intitle) {
if (already_title) {
bool Buffer::isLatex() const
{
- return textclasslist.TextClass(params.textclass).outputType() == LATEX;
+ return textclasslist[params.textclass].outputType() == LATEX;
}
bool Buffer::isLinuxDoc() const
{
- return textclasslist.TextClass(params.textclass).outputType() == LINUXDOC;
+ return textclasslist[params.textclass].outputType() == LINUXDOC;
}
bool Buffer::isLiterate() const
{
- return textclasslist.TextClass(params.textclass).outputType() == LITERATE;
+ return textclasslist[params.textclass].outputType() == LITERATE;
}
bool Buffer::isDocBook() const
{
- return textclasslist.TextClass(params.textclass).outputType() == DOCBOOK;
+ return textclasslist[params.textclass].outputType() == DOCBOOK;
}
bool Buffer::isSGML() const
{
- return textclasslist.TextClass(params.textclass).outputType() == LINUXDOC ||
- textclasslist.TextClass(params.textclass).outputType() == DOCBOOK;
+ LyXTextClass const & tclass = textclasslist[params.textclass];
+
+ return tclass.outputType() == LINUXDOC ||
+ tclass.outputType() == DOCBOOK;
}
niceFile = nice; // this will be used by included files.
- LyXTextClass const & tclass =
- textclasslist.TextClass(params.textclass);
+ LyXTextClass const & tclass = textclasslist[params.textclass];
- LaTeXFeatures features(params, tclass.numLayouts());
+ LaTeXFeatures features(params, tclass.size());
+
validate(features);
texrow.reset();
- string top_element = textclasslist.LatexnameOfClass(params.textclass);
+ string top_element = textclasslist[params.textclass].latexname();
if (!body_only) {
ofs << "<!doctype linuxdoc system";
while (par) {
LyXLayout const & style =
- textclasslist.Style(params.textclass,
- par->layout);
+ textclasslist[params.textclass][par->layout()];
// treat <toc> as a special case for compatibility with old code
if (par->isInset(0)) {
Paragraph * par,
Paragraph::depth_type /*depth*/)
{
- LyXLayout const & style = textclasslist.Style(params.textclass,
- par->getLayout());
+ LyXLayout const & style =
+ textclasslist[params.textclass][par->layout()];
string::size_type char_line_count = 5; // Heuristic choice ;-)
// gets paragraph main font
niceFile = nice; // this will be used by Insetincludes.
LyXTextClass const & tclass =
- textclasslist.TextClass(params.textclass);
+ textclasslist[params.textclass];
- LaTeXFeatures features(params, tclass.numLayouts());
+ LaTeXFeatures features(params, tclass.size());
validate(features);
texrow.reset();
- string top_element = textclasslist.LatexnameOfClass(params.textclass);
+ string top_element = textclasslist[params.textclass].latexname();
if (!only_body) {
ofs << "<!DOCTYPE " << top_element
int desc_on = 0; // description mode
LyXLayout const & style =
- textclasslist.Style(params.textclass,
- par->layout);
+ textclasslist[params.textclass][par->layout()];
// environment tag closing
for (; depth > par->params().depth(); --depth) {
{
bool emph_flag = false;
- LyXLayout const & style = textclasslist.Style(params.textclass,
- par->getLayout());
+ LyXLayout const & style =
+ textclasslist[params.textclass][par->layout()];
LyXFont font_old = style.labeltype == LABEL_MANUAL ? style.labelfont : style.font;
void Buffer::validate(LaTeXFeatures & features) const
{
Paragraph * par = paragraph;
- LyXTextClass const & tclass =
- textclasslist.TextClass(params.textclass);
+ LyXTextClass const & tclass = textclasslist[params.textclass];
// AMS Style is at document level
if (params.use_amsmath || tclass.provides(LyXTextClass::amsmath))
Lists l;
Paragraph * par = paragraph;
-#if 1
- std::pair<bool, textclass_type> const tmp =
- textclasslist.NumberOfLayout(params.textclass, "Caption");
- bool const found = tmp.first;
- textclass_type const cap = tmp.second;
-
-#else
- // This is the prefered way to to this, but boost::tie can break
- // some compilers
- bool found;
- textclass_type cap;
- boost::tie(found, cap) = textclasslist
- .NumberOfLayout(params.textclass, "Caption");
-#endif
+ LyXTextClass const & textclass = textclasslist[params.textclass];
+ bool found = textclass.hasLayout("caption");
+ string const layout("caption");
while (par) {
- char const labeltype =
- textclasslist.Style(params.textclass,
- par->getLayout()).labeltype;
+ char const labeltype = textclass[par->layout()].labeltype;
if (labeltype >= LABEL_COUNTER_CHAPTER
&& labeltype <= LABEL_COUNTER_CHAPTER + params.tocdepth) {
SingleList & item = l["TOC"];
int depth = max(0,
labeltype -
- textclasslist.TextClass(params.textclass).maxcounter());
+ textclass.maxcounter());
item.push_back(TocItem(par, depth, par->asString(this, true)));
}
// For each paragrph, traverse its insets and look for
// the inset...
Paragraph * tmp = il->inset.paragraph();
while (tmp) {
- if (tmp->layout == cap) {
+ if (tmp->layout() == layout) {
SingleList & item = l[type];
string const str =
tostr(item.size()+1) + ". " + tmp->asString(this, false);