// true in the returned pair, then `second' is the textclass
// number; if it is false, second is 0. In both cases, second
// is what we want.
- textclass(textclasslist.NumberOfClass("article").second),
+ textclass(textclasslist.numberOfClass("article").second),
pimpl_(new Impl)
{
paragraph_separation = PARSEP_INDENT;
lex.next();
string const classname = lex.getString();
pair<bool, lyx::textclass_type> pp =
- textclasslist.NumberOfClass(classname);
+ textclasslist.numberOfClass(classname);
if (pp.first) {
textclass = pp.second;
} else {
- textclass = 0;
- return classname;
+ // if text class does not exist, try to load it from filepath
+ pp = textclasslist.addTextClass(classname, filepath);
+ if (pp.first) {
+ textclass = pp.second;
+ } else {
+ textclass = 0;
+ return classname;
+ }
}
+ // FIXME: isTeXClassAvailable will try to load the layout file, but will
+ // fail because of the lack of path info. Warnings will be given although
+ // the layout file will be correctly loaded later.
if (!getLyXTextClass().isTeXClassAvailable()) {
string const msg =
bformat(_("The document uses a missing "
"TeX class \"%1$s\".\n"), classname);
Alert::warning(_("Document class not available"),
- msg + _("LyX will not be able to produce output."));
+ msg + _("LyX will not be able to produce output."));
}
} else if (token == "\\begin_preamble") {
readPreamble(lex);
for (; it != end; ++it) {
os << "\\branch " << it->getBranch()
<< "\n\\selected " << it->getSelected()
- << "\n\\color " << it->getColor()
+ << "\n\\color " << lyx::X11hexname(it->getColor())
<< "\n\\end_branch"
<< "\n";
}
if (inputenc == "auto") {
string const doc_encoding =
- language->encoding()->LatexName();
+ language->encoding()->latexName();
// Create a list with all the input encodings used
// in the document
texrow.newline();
}
- if (secnumdepth != tclass.secnumdepth()) {
- os << "\\setcounter{secnumdepth}{"
- << secnumdepth
- << "}\n";
- texrow.newline();
- }
- if (tocdepth != tclass.tocdepth()) {
- os << "\\setcounter{tocdepth}{"
- << tocdepth
- << "}\n";
- texrow.newline();
+ // Only if class has a ToC hierarchy
+ if (tclass.hasTocLevels()) {
+ if (secnumdepth != tclass.secnumdepth()) {
+ os << "\\setcounter{secnumdepth}{"
+ << secnumdepth
+ << "}\n";
+ texrow.newline();
+ }
+ if (tocdepth != tclass.tocdepth()) {
+ os << "\\setcounter{tocdepth}{"
+ << tocdepth
+ << "}\n";
+ texrow.newline();
+ }
}
if (paragraph_separation) {
if (user_defined_bullet(i) != ITEMIZE_DEFAULTS[i]) {
if (bullets_def.empty())
bullets_def="\\AtBeginDocument{\n";
- bullets_def += " \\renewcommand{\\labelitemi";
+ bullets_def += " \\def\\labelitemi";
switch (i) {
// `i' is one less than the item to modify
case 0:
bullets_def += 'v';
break;
}
- bullets_def += "}{" +
+ bullets_def += '{' +
user_defined_bullet(i).getText()
+ "}\n";
}
columns = tclass.columns();
pagestyle = tclass.pagestyle();
options = tclass.options();
- secnumdepth = tclass.secnumdepth();
- tocdepth = tclass.tocdepth();
+ // Only if class has a ToC hierarchy
+ if (tclass.hasTocLevels()) {
+ secnumdepth = tclass.secnumdepth();
+ tocdepth = tclass.tocdepth();
+ }
}