3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Lars Gullik Bjønnes
7 * \author Jean-Marc Lasgouttes
8 * \author Angus Leeming
10 * \author André Pönitz
12 * Full author contact details are available in file CREDITS.
17 #include "TextClass.h"
21 #include "support/debug.h"
22 #include "support/gettext.h"
24 #include "FloatList.h"
29 #include "frontends/alert.h"
31 #include "support/ExceptionMessage.h"
32 #include "support/lstrings.h"
33 #include "support/FileName.h"
34 #include "support/filetools.h"
35 #include "support/os.h"
41 using namespace lyx::support;
47 class LayoutNamesEqual : public unary_function<LayoutPtr, bool> {
49 LayoutNamesEqual(docstring const & name)
52 bool operator()(LayoutPtr const & c) const
54 return c->name() == name_;
64 bool layout2layout(FileName const & filename, FileName const & tempfile)
66 FileName const script = libFileSearch("scripts", "layout2layout.py");
68 lyxerr << "Could not find layout conversion "
69 "script layout2layout.py." << endl;
73 ostringstream command;
74 command << os::python() << ' ' << quoteName(script.toFilesystemEncoding())
75 << ' ' << quoteName(filename.toFilesystemEncoding())
76 << ' ' << quoteName(tempfile.toFilesystemEncoding());
77 string const command_str = command.str();
79 LYXERR(Debug::TCLASS, "Running `" << command_str << '\'');
82 runCommand(command_str);
84 lyxerr << "Could not run layout conversion "
85 "script layout2layout.py." << endl;
92 std::string translateRT(TextClass::ReadType rt)
95 case TextClass::BASECLASS:
97 case TextClass::MERGE:
99 case TextClass::MODULE:
100 return "module file";
109 TextClass::TextClass(string const & fn, string const & cln,
110 string const & desc, bool texClassAvail )
111 : name_(fn), latexname_(cln), description_(desc),
112 floatlist_(new FloatList), counters_(new Counters),
113 texClassAvail_(texClassAvail)
121 pagestyle_ = "default";
122 defaultfont_ = sane_font;
123 opt_fontsize_ = "10|11|12";
124 opt_pagestyle_ = "empty|plain|headings|fancy";
125 titletype_ = TITLE_COMMAND_AFTER;
126 titlename_ = "maketitle";
128 // a hack to make this available for translation
129 // i'm sure there must be a better way (rgh)
134 docstring const TextClass::emptylayout_ = from_ascii("PlainLayout");
137 bool TextClass::isTeXClassAvailable() const
139 return texClassAvail_;
143 bool TextClass::readStyle(Lexer & lexrc, Layout & lay)
145 LYXERR(Debug::TCLASS, "Reading style " << to_utf8(lay.name()));
146 if (!lay.read(lexrc, *this)) {
148 lay.resfont = lay.font;
149 lay.resfont.realize(defaultfont());
150 lay.reslabelfont = lay.labelfont;
151 lay.reslabelfont.realize(defaultfont());
152 return false; // no errors
154 lyxerr << "Error parsing style `" << to_utf8(lay.name()) << '\'' << endl;
188 // Reads a textclass structure from file.
189 bool TextClass::read(FileName const & filename, ReadType rt)
191 if (!filename.isReadableFile()) {
192 lyxerr << "Cannot read layout file `" << filename << "'."
197 keyword_item textClassTags[] = {
198 { "classoptions", TC_CLASSOPTIONS },
199 { "columns", TC_COLUMNS },
200 { "counter", TC_COUNTER },
201 { "defaultfont", TC_DEFAULTFONT },
202 { "defaultstyle", TC_DEFAULTSTYLE },
203 { "environment", TC_ENVIRONMENT },
204 { "float", TC_FLOAT },
205 { "format", TC_FORMAT },
206 { "input", TC_INPUT },
207 { "insetlayout", TC_INSETLAYOUT },
208 { "leftmargin", TC_LEFTMARGIN },
209 { "nofloat", TC_NOFLOAT },
210 { "nostyle", TC_NOSTYLE },
211 { "outputtype", TC_OUTPUTTYPE },
212 { "pagestyle", TC_PAGESTYLE },
213 { "preamble", TC_PREAMBLE },
214 { "provides", TC_PROVIDES },
215 { "requires", TC_REQUIRES },
216 { "rightmargin", TC_RIGHTMARGIN },
217 { "secnumdepth", TC_SECNUMDEPTH },
218 { "sides", TC_SIDES },
219 { "style", TC_STYLE },
220 { "titlelatexname", TC_TITLELATEXNAME },
221 { "titlelatextype", TC_TITLELATEXTYPE },
222 { "tocdepth", TC_TOCDEPTH }
225 LYXERR(Debug::TCLASS, "Reading " + translateRT(rt) + ": " +
226 to_utf8(makeDisplayPath(filename.absFilename())));
228 // Define the `empty' layout used in table cells, ert, etc. Note that
229 // we do this before loading any layout file, so that classes can
230 // override features of this layout if they should choose to do so.
231 if (rt == BASECLASS) {
232 static char const * s = "Margin Static\n"
233 "LatexType Paragraph\n"
236 "AlignPossible Left, Right, Center\n"
237 "LabelType No_Label\n"
240 Lexer lex(textClassTags, sizeof(textClassTags) / sizeof(textClassTags[0]));
243 lay.setName(emptylayout_);
244 /*bool error =*/ readStyle(lex, lay);
245 BOOST_ASSERT(!error);
246 layoutlist_.push_back(boost::shared_ptr<Layout>(new Layout(lay)));
249 Lexer lexrc(textClassTags,
250 sizeof(textClassTags) / sizeof(textClassTags[0]));
252 lexrc.setFile(filename);
253 bool error = !lexrc.isOK();
255 // Format of files before the 'Format' tag was introduced
259 while (lexrc.isOK() && !error) {
260 int le = lexrc.lex();
263 case Lexer::LEX_FEOF:
266 case Lexer::LEX_UNDEF:
267 lexrc.printError("Unknown TextClass tag `$$Token'");
275 switch (static_cast<TextClassTags>(le)) {
279 format = lexrc.getInteger();
282 case TC_OUTPUTTYPE: // output type definition
283 readOutputType(lexrc);
286 case TC_INPUT: // Include file
288 string const inc = lexrc.getString();
289 FileName tmp = libFileSearch("layouts", inc,
293 lexrc.printError("Could not find input file: " + inc);
295 } else if (read(tmp, MERGE)) {
296 lexrc.printError("Error reading input"
297 "file: " + tmp.absFilename());
303 case TC_DEFAULTSTYLE:
305 docstring const name = from_utf8(subst(lexrc.getString(),
307 defaultlayout_ = name;
314 docstring const name = from_utf8(subst(lexrc.getString(),
317 string s = "Could not read name for style: `$$Token' "
318 + lexrc.getString() + " is probably not valid UTF-8!";
319 lexrc.printError(s.c_str());
321 error = readStyle(lexrc, lay);
322 } else if (hasLayout(name)) {
323 Layout * lay = operator[](name).get();
324 error = readStyle(lexrc, *lay);
328 if (le == TC_ENVIRONMENT)
329 lay.is_environment = true;
330 error = readStyle(lexrc, lay);
332 layoutlist_.push_back(
333 boost::shared_ptr<Layout>(new Layout(lay))
336 if (defaultlayout_.empty()) {
337 // We do not have a default
338 // layout yet, so we choose
339 // the first layout we
341 defaultlayout_ = name;
346 lexrc.printError("No name given for style: `$$Token'.");
353 docstring const style = from_utf8(subst(lexrc.getString(),
355 if (!deleteLayout(style))
356 lyxerr << "Cannot delete style `"
357 << to_utf8(style) << '\'' << endl;
358 // lexrc.printError("Cannot delete style"
365 columns_ = lexrc.getInteger();
370 switch (lexrc.getInteger()) {
371 case 1: sides_ = OneSide; break;
372 case 2: sides_ = TwoSides; break;
374 lyxerr << "Impossible number of page"
375 " sides, setting to one."
385 pagestyle_ = rtrim(lexrc.getString());
389 defaultfont_ = lyxRead(lexrc);
390 if (!defaultfont_.resolved()) {
391 lexrc.printError("Warning: defaultfont should "
392 "be fully instantiated!");
393 defaultfont_.realize(sane_font);
399 secnumdepth_ = lexrc.getInteger();
404 tocdepth_ = lexrc.getInteger();
407 // First step to support options
408 case TC_CLASSOPTIONS:
409 readClassOptions(lexrc);
413 preamble_ = from_utf8(lexrc.getLongString("EndPreamble"));
418 string const feature = lexrc.getString();
420 if (lexrc.getInteger())
421 provides_.insert(feature);
423 provides_.erase(feature);
429 vector<string> const req
430 = getVectorFromString(lexrc.getString());
431 requires_.insert(req.begin(), req.end());
435 case TC_LEFTMARGIN: // left margin type
437 leftmargin_ = lexrc.getDocString();
440 case TC_RIGHTMARGIN: // right margin type
442 rightmargin_ = lexrc.getDocString();
446 docstring const name = subst(lexrc.getDocString(), '_', ' ');
447 readInsetLayout(lexrc, name);
456 case TC_TITLELATEXTYPE:
457 readTitleType(lexrc);
459 case TC_TITLELATEXNAME:
461 titlename_ = lexrc.getString();
465 string const nofloat = lexrc.getString();
466 floatlist_->erase(nofloat);
470 if (format != FORMAT)
474 if (format != FORMAT) {
475 LYXERR(Debug::TCLASS, "Converting layout file from format "
476 << format << " to " << FORMAT);
477 FileName const tempfile = FileName::tempName();
478 error = !layout2layout(filename, tempfile);
480 error = read(tempfile, rt);
481 tempfile.removeFile();
485 LYXERR(Debug::TCLASS, "Finished reading " + translateRT(rt) + ": " +
486 to_utf8(makeDisplayPath(filename.absFilename())));
491 if (defaultlayout_.empty()) {
492 lyxerr << "Error: Textclass '" << name_
493 << "' is missing a defaultstyle." << endl;
497 //Try to erase "stdinsets" from the provides_ set.
499 // Provides stdinsets 1
500 //declaration simply tells us that the standard insets have been
501 //defined. (It's found in stdinsets.inc but could also be used in
502 //user-defined files.) There isn't really any such package. So we
503 //might as well go ahead and erase it.
504 //If we do not succeed, then it was not there, which means that
505 //the textclass did not provide the definitions of the standard
506 //insets. So we need to try to load them.
507 int erased = provides_.erase("stdinsets");
509 FileName tmp = libFileSearch("layouts", "stdinsets.inc");
512 throw ExceptionMessage(WarningException, _("Missing File"),
513 _("Could not find stdinsets.inc! This may lead to data loss!"));
515 } else if (read(tmp, MERGE)) {
516 throw ExceptionMessage(WarningException, _("Corrupt File"),
517 _("Could not read stdinsets.inc! This may lead to data loss!"));
522 min_toclevel_ = Layout::NOT_IN_TOC;
523 max_toclevel_ = Layout::NOT_IN_TOC;
524 const_iterator cit = begin();
525 const_iterator the_end = end();
526 for ( ; cit != the_end ; ++cit) {
527 int const toclevel = (*cit)->toclevel;
528 if (toclevel != Layout::NOT_IN_TOC) {
529 if (min_toclevel_ == Layout::NOT_IN_TOC)
530 min_toclevel_ = toclevel;
532 min_toclevel_ = min(min_toclevel_,
534 max_toclevel_ = max(max_toclevel_,
538 LYXERR(Debug::TCLASS, "Minimum TocLevel is " << min_toclevel_
539 << ", maximum is " << max_toclevel_);
545 void TextClass::readTitleType(Lexer & lexrc)
547 keyword_item titleTypeTags[] = {
548 { "commandafter", TITLE_COMMAND_AFTER },
549 { "environment", TITLE_ENVIRONMENT }
552 PushPopHelper pph(lexrc, titleTypeTags, TITLE_ENVIRONMENT);
554 int le = lexrc.lex();
556 case Lexer::LEX_UNDEF:
557 lexrc.printError("Unknown output type `$$Token'");
559 case TITLE_COMMAND_AFTER:
560 case TITLE_ENVIRONMENT:
561 titletype_ = static_cast<TitleLatexType>(le);
564 lyxerr << "Unhandled value " << le
565 << " in TextClass::readTitleType." << endl;
572 void TextClass::readOutputType(Lexer & lexrc)
574 keyword_item outputTypeTags[] = {
575 { "docbook", DOCBOOK },
577 { "literate", LITERATE }
580 PushPopHelper pph(lexrc, outputTypeTags, LITERATE);
582 int le = lexrc.lex();
584 case Lexer::LEX_UNDEF:
585 lexrc.printError("Unknown output type `$$Token'");
590 outputType_ = static_cast<OutputType>(le);
593 lyxerr << "Unhandled value " << le
594 << " in TextClass::readOutputType." << endl;
601 enum ClassOptionsTags {
610 void TextClass::readClassOptions(Lexer & lexrc)
612 keyword_item classOptionsTags[] = {
614 {"fontsize", CO_FONTSIZE },
615 {"header", CO_HEADER },
616 {"other", CO_OTHER },
617 {"pagestyle", CO_PAGESTYLE }
620 lexrc.pushTable(classOptionsTags, CO_END);
622 while (!getout && lexrc.isOK()) {
623 int le = lexrc.lex();
625 case Lexer::LEX_UNDEF:
626 lexrc.printError("Unknown ClassOption tag `$$Token'");
630 switch (static_cast<ClassOptionsTags>(le)) {
633 opt_fontsize_ = rtrim(lexrc.getString());
637 opt_pagestyle_ = rtrim(lexrc.getString());
641 options_ = lexrc.getString();
645 class_header_ = subst(lexrc.getString(), """, "\"");
656 enum InsetLayoutTags {
678 void TextClass::readInsetLayout(Lexer & lexrc, docstring const & name)
680 keyword_item elementTags[] = {
681 { "bgcolor", IL_BGCOLOR },
682 { "decoration", IL_DECORATION },
685 { "forceltr", IL_FORCELTR },
686 { "freespacing", IL_FREESPACING },
687 { "keepempty", IL_KEEPEMPTY },
688 { "labelfont", IL_LABELFONT },
689 { "labelstring", IL_LABELSTRING },
690 { "latexname", IL_LATEXNAME },
691 { "latexparam", IL_LATEXPARAM },
692 { "latextype", IL_LATEXTYPE },
693 { "lyxtype", IL_LYXTYPE },
694 { "multipar", IL_MULTIPAR },
695 { "needprotect", IL_NEEDPROTECT },
696 { "passthru", IL_PASSTHRU },
697 { "preamble", IL_PREAMBLE },
698 { "requires", IL_REQUIRES }
701 lexrc.pushTable(elementTags, IL_END);
704 docstring labelstring;
709 FontInfo font = inherit_font;
710 FontInfo labelfont = inherit_font;
711 ColorCode bgcolor(Color_background);
713 set<string> requires;
714 bool multipar = false;
715 bool passthru = false;
716 bool needprotect = false;
717 bool keepempty = false;
718 bool freespacing = false;
719 bool forceltr = false;
722 while (!getout && lexrc.isOK()) {
723 int le = lexrc.lex();
725 case Lexer::LEX_UNDEF:
726 lexrc.printError("Unknown InsetLayout tag `$$Token'");
730 switch (static_cast<InsetLayoutTags>(le)) {
733 lyxtype = lexrc.getString();
737 latextype = lexrc.getString();
741 labelstring = lexrc.getDocString();
745 decoration = lexrc.getString();
749 latexname = lexrc.getString();
753 latexparam = subst(lexrc.getString(), """, "\"");
756 labelfont = lyxRead(lexrc, inherit_font);
760 forceltr = lexrc.getBool();
764 multipar = lexrc.getBool();
768 passthru = lexrc.getBool();
772 keepempty = lexrc.getBool();
776 freespacing = lexrc.getBool();
780 needprotect = lexrc.getBool();
783 font = lyxRead(lexrc, inherit_font);
784 // So: define font before labelfont
789 string const token = lexrc.getString();
790 bgcolor = lcolor.getFromLyXName(token);
794 preamble = lexrc.getLongString("EndPreamble");
798 vector<string> const req
799 = getVectorFromString(lexrc.getString());
800 requires.insert(req.begin(), req.end());
809 // Here add element to list if getout == true
812 il.name = to_ascii(name);
813 il.lyxtype = lyxtype;
814 il.labelstring = labelstring;
815 il.decoration = decoration;
816 il.latextype = latextype;
817 il.latexname = latexname;
818 il.latexparam = latexparam;
819 il.multipar = multipar;
820 il.passthru = passthru;
821 il.needprotect = needprotect;
822 il.freespacing = freespacing;
823 il.forceltr = forceltr;
824 il.keepempty = keepempty;
826 // The label font is generally used as-is without
827 // any realization against a given context.
828 labelfont.realize(sane_font);
829 il.labelfont = labelfont;
830 il.bgcolor = bgcolor;
831 il.preamble = preamble;
832 il.requires = requires;
833 insetlayoutlist_[name] = il;
854 void TextClass::readFloat(Lexer & lexrc)
856 keyword_item floatTags[] = {
858 { "extension", FT_EXT },
859 { "guiname", FT_NAME },
860 { "latexbuiltin", FT_BUILTIN },
861 { "listname", FT_LISTNAME },
862 { "numberwithin", FT_WITHIN },
863 { "placement", FT_PLACEMENT },
864 { "style", FT_STYLE },
868 lexrc.pushTable(floatTags, FT_END);
877 bool builtin = false;
880 while (!getout && lexrc.isOK()) {
881 int le = lexrc.lex();
883 case Lexer::LEX_UNDEF:
884 lexrc.printError("Unknown float tag `$$Token'");
888 switch (static_cast<FloatTags>(le)) {
891 type = lexrc.getString();
892 if (floatlist_->typeExist(type)) {
893 Floating const & fl = floatlist_->getType(type);
894 placement = fl.placement();
896 within = fl.within();
899 listName = fl.listName();
900 builtin = fl.builtin();
905 name = lexrc.getString();
909 placement = lexrc.getString();
913 ext = lexrc.getString();
917 within = lexrc.getString();
918 if (within == "none")
923 style = lexrc.getString();
927 listName = lexrc.getString();
931 builtin = lexrc.getBool();
939 // Here if have a full float if getout == true
941 Floating fl(type, placement, ext, within,
942 style, name, listName, builtin);
943 floatlist_->newFloat(fl);
944 // each float has its own counter
945 counters_->newCounter(from_ascii(type), from_ascii(within),
946 docstring(), docstring());
957 CT_LABELSTRING_APPENDIX,
962 void TextClass::readCounter(Lexer & lexrc)
964 keyword_item counterTags[] = {
966 { "labelstring", CT_LABELSTRING },
967 { "labelstringappendix", CT_LABELSTRING_APPENDIX },
969 { "within", CT_WITHIN }
972 lexrc.pushTable(counterTags, CT_END);
976 docstring labelstring;
977 docstring labelstring_appendix;
980 while (!getout && lexrc.isOK()) {
981 int le = lexrc.lex();
983 case Lexer::LEX_UNDEF:
984 lexrc.printError("Unknown counter tag `$$Token'");
988 switch (static_cast<CounterTags>(le)) {
991 name = lexrc.getDocString();
992 if (counters_->hasCounter(name))
993 LYXERR(Debug::TCLASS, "Reading existing counter " << to_utf8(name));
995 LYXERR(Debug::TCLASS, "Reading new counter " << to_utf8(name));
999 within = lexrc.getDocString();
1000 if (within == "none")
1003 case CT_LABELSTRING:
1005 labelstring = lexrc.getDocString();
1006 labelstring_appendix = labelstring;
1008 case CT_LABELSTRING_APPENDIX:
1010 labelstring_appendix = lexrc.getDocString();
1018 // Here if have a full counter if getout == true
1020 counters_->newCounter(name, within,
1021 labelstring, labelstring_appendix);
1027 FontInfo const & TextClass::defaultfont() const
1029 return defaultfont_;
1033 docstring const & TextClass::leftmargin() const
1039 docstring const & TextClass::rightmargin() const
1041 return rightmargin_;
1045 bool TextClass::hasLayout(docstring const & n) const
1047 docstring const name = n.empty() ? defaultLayoutName() : n;
1049 return find_if(layoutlist_.begin(), layoutlist_.end(),
1050 LayoutNamesEqual(name))
1051 != layoutlist_.end();
1056 LayoutPtr const & TextClass::operator[](docstring const & name) const
1058 BOOST_ASSERT(!name.empty());
1060 LayoutList::const_iterator cit =
1061 find_if(layoutlist_.begin(),
1063 LayoutNamesEqual(name));
1065 if (cit == layoutlist_.end()) {
1066 lyxerr << "We failed to find the layout '" << to_utf8(name)
1067 << "' in the layout list. You MUST investigate!"
1069 for (LayoutList::const_iterator it = layoutlist_.begin();
1070 it != layoutlist_.end(); ++it)
1071 lyxerr << " " << to_utf8(it->get()->name()) << endl;
1073 // we require the name to exist
1074 BOOST_ASSERT(false);
1081 bool TextClass::deleteLayout(docstring const & name)
1083 if (name == defaultLayoutName() || name == emptyLayoutName())
1086 LayoutList::iterator it =
1087 remove_if(layoutlist_.begin(), layoutlist_.end(),
1088 LayoutNamesEqual(name));
1090 LayoutList::iterator end = layoutlist_.end();
1091 bool const ret = (it != end);
1092 layoutlist_.erase(it, end);
1097 // Load textclass info if not loaded yet
1098 bool TextClass::load(string const & path) const
1103 // Read style-file, provided path is searched before the system ones
1104 FileName layout_file;
1106 layout_file = FileName(addName(path, name_ + ".layout"));
1107 if (layout_file.empty() || !layout_file.exists())
1108 layout_file = libFileSearch("layouts", name_, "layout");
1109 loaded_ = const_cast<TextClass*>(this)->read(layout_file) == 0;
1112 lyxerr << "Error reading `"
1113 << to_utf8(makeDisplayPath(layout_file.absFilename()))
1114 << "'\n(Check `" << name_
1115 << "')\nCheck your installation and "
1116 "try Options/Reconfigure..." << endl;
1123 FloatList & TextClass::floats()
1125 return *floatlist_.get();
1129 FloatList const & TextClass::floats() const
1131 return *floatlist_.get();
1135 Counters & TextClass::counters() const
1137 return *counters_.get();
1141 // Return the layout object of an inset given by name. If the name
1142 // is not found as such, the part after the ':' is stripped off, and
1143 // searched again. In this way, an error fallback can be provided:
1144 // An erroneous 'CharStyle:badname' (e.g., after a documentclass switch)
1145 // will invoke the layout object defined by name = 'CharStyle'.
1146 // If that doesn't work either, an empty object returns (shouldn't
1147 // happen). -- Idea JMarc, comment MV
1148 InsetLayout const & TextClass::insetlayout(docstring const & name) const
1151 while (!n.empty()) {
1152 if (insetlayoutlist_.count(n) > 0)
1153 return insetlayoutlist_[n];
1154 docstring::size_type i = n.find(':');
1155 if (i == string::npos)
1159 static InsetLayout empty;
1160 empty.labelstring = from_utf8("UNDEFINED");
1161 empty.labelfont = sane_font;
1162 empty.labelfont.setColor(Color_error);
1163 empty.bgcolor = Color_error;
1168 docstring const & TextClass::defaultLayoutName() const
1170 // This really should come from the actual layout... (Lgb)
1171 return defaultlayout_;
1175 LayoutPtr const & TextClass::defaultLayout() const
1177 return operator[](defaultLayoutName());
1181 string const & TextClass::name() const
1187 string const & TextClass::latexname() const
1189 const_cast<TextClass*>(this)->load();
1194 string const & TextClass::description() const
1196 return description_;
1200 string const & TextClass::opt_fontsize() const
1202 return opt_fontsize_;
1206 string const & TextClass::opt_pagestyle() const
1208 return opt_pagestyle_;
1212 string const & TextClass::options() const
1218 string const & TextClass::class_header() const
1220 return class_header_;
1224 string const & TextClass::pagestyle() const
1230 docstring const & TextClass::preamble() const
1236 PageSides TextClass::sides() const
1242 int TextClass::secnumdepth() const
1244 return secnumdepth_;
1248 int TextClass::tocdepth() const
1254 OutputType TextClass::outputType() const
1260 bool TextClass::provides(string const & p) const
1262 return provides_.find(p) != provides_.end();
1266 unsigned int TextClass::columns() const
1272 TitleLatexType TextClass::titletype() const
1278 string const & TextClass::titlename() const
1284 int TextClass::size() const
1286 return layoutlist_.size();
1290 int TextClass::min_toclevel() const
1292 return min_toclevel_;
1296 int TextClass::max_toclevel() const
1298 return max_toclevel_;
1302 bool TextClass::hasTocLevels() const
1304 return min_toclevel_ != Layout::NOT_IN_TOC;
1308 ostream & operator<<(ostream & os, PageSides p)