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 if (!readStyle(lex, lay)) {
245 // FIXME: Couldn't we provide some feedback to the user here?
246 // Use ExceptionMessage maybe?
249 layoutlist_.push_back(boost::shared_ptr<Layout>(new Layout(lay)));
252 Lexer lexrc(textClassTags,
253 sizeof(textClassTags) / sizeof(textClassTags[0]));
255 lexrc.setFile(filename);
256 bool error = !lexrc.isOK();
258 // Format of files before the 'Format' tag was introduced
262 while (lexrc.isOK() && !error) {
263 int le = lexrc.lex();
266 case Lexer::LEX_FEOF:
269 case Lexer::LEX_UNDEF:
270 lexrc.printError("Unknown TextClass tag `$$Token'");
278 switch (static_cast<TextClassTags>(le)) {
282 format = lexrc.getInteger();
285 case TC_OUTPUTTYPE: // output type definition
286 readOutputType(lexrc);
289 case TC_INPUT: // Include file
291 string const inc = lexrc.getString();
292 FileName tmp = libFileSearch("layouts", inc,
296 lexrc.printError("Could not find input file: " + inc);
298 } else if (read(tmp, MERGE)) {
299 lexrc.printError("Error reading input"
300 "file: " + tmp.absFilename());
306 case TC_DEFAULTSTYLE:
308 docstring const name = from_utf8(subst(lexrc.getString(),
310 defaultlayout_ = name;
317 docstring const name = from_utf8(subst(lexrc.getString(),
320 string s = "Could not read name for style: `$$Token' "
321 + lexrc.getString() + " is probably not valid UTF-8!";
322 lexrc.printError(s.c_str());
324 error = readStyle(lexrc, lay);
325 } else if (hasLayout(name)) {
326 Layout * lay = operator[](name).get();
327 error = readStyle(lexrc, *lay);
331 if (le == TC_ENVIRONMENT)
332 lay.is_environment = true;
333 error = readStyle(lexrc, lay);
335 layoutlist_.push_back(
336 boost::shared_ptr<Layout>(new Layout(lay))
339 if (defaultlayout_.empty()) {
340 // We do not have a default
341 // layout yet, so we choose
342 // the first layout we
344 defaultlayout_ = name;
349 lexrc.printError("No name given for style: `$$Token'.");
356 docstring const style = from_utf8(subst(lexrc.getString(),
358 if (!deleteLayout(style))
359 lyxerr << "Cannot delete style `"
360 << to_utf8(style) << '\'' << endl;
361 // lexrc.printError("Cannot delete style"
368 columns_ = lexrc.getInteger();
373 switch (lexrc.getInteger()) {
374 case 1: sides_ = OneSide; break;
375 case 2: sides_ = TwoSides; break;
377 lyxerr << "Impossible number of page"
378 " sides, setting to one."
388 pagestyle_ = rtrim(lexrc.getString());
392 defaultfont_ = lyxRead(lexrc);
393 if (!defaultfont_.resolved()) {
394 lexrc.printError("Warning: defaultfont should "
395 "be fully instantiated!");
396 defaultfont_.realize(sane_font);
402 secnumdepth_ = lexrc.getInteger();
407 tocdepth_ = lexrc.getInteger();
410 // First step to support options
411 case TC_CLASSOPTIONS:
412 readClassOptions(lexrc);
416 preamble_ = from_utf8(lexrc.getLongString("EndPreamble"));
421 string const feature = lexrc.getString();
423 if (lexrc.getInteger())
424 provides_.insert(feature);
426 provides_.erase(feature);
432 vector<string> const req
433 = getVectorFromString(lexrc.getString());
434 requires_.insert(req.begin(), req.end());
438 case TC_LEFTMARGIN: // left margin type
440 leftmargin_ = lexrc.getDocString();
443 case TC_RIGHTMARGIN: // right margin type
445 rightmargin_ = lexrc.getDocString();
449 docstring const name = subst(lexrc.getDocString(), '_', ' ');
450 readInsetLayout(lexrc, name);
459 case TC_TITLELATEXTYPE:
460 readTitleType(lexrc);
462 case TC_TITLELATEXNAME:
464 titlename_ = lexrc.getString();
468 string const nofloat = lexrc.getString();
469 floatlist_->erase(nofloat);
473 if (format != FORMAT)
477 if (format != FORMAT) {
478 LYXERR(Debug::TCLASS, "Converting layout file from format "
479 << format << " to " << FORMAT);
480 FileName const tempfile = FileName::tempName();
481 error = !layout2layout(filename, tempfile);
483 error = read(tempfile, rt);
484 tempfile.removeFile();
488 LYXERR(Debug::TCLASS, "Finished reading " + translateRT(rt) + ": " +
489 to_utf8(makeDisplayPath(filename.absFilename())));
494 if (defaultlayout_.empty()) {
495 lyxerr << "Error: Textclass '" << name_
496 << "' is missing a defaultstyle." << endl;
500 //Try to erase "stdinsets" from the provides_ set.
502 // Provides stdinsets 1
503 //declaration simply tells us that the standard insets have been
504 //defined. (It's found in stdinsets.inc but could also be used in
505 //user-defined files.) There isn't really any such package. So we
506 //might as well go ahead and erase it.
507 //If we do not succeed, then it was not there, which means that
508 //the textclass did not provide the definitions of the standard
509 //insets. So we need to try to load them.
510 int erased = provides_.erase("stdinsets");
512 FileName tmp = libFileSearch("layouts", "stdinsets.inc");
515 throw ExceptionMessage(WarningException, _("Missing File"),
516 _("Could not find stdinsets.inc! This may lead to data loss!"));
518 } else if (read(tmp, MERGE)) {
519 throw ExceptionMessage(WarningException, _("Corrupt File"),
520 _("Could not read stdinsets.inc! This may lead to data loss!"));
525 min_toclevel_ = Layout::NOT_IN_TOC;
526 max_toclevel_ = Layout::NOT_IN_TOC;
527 const_iterator cit = begin();
528 const_iterator the_end = end();
529 for ( ; cit != the_end ; ++cit) {
530 int const toclevel = (*cit)->toclevel;
531 if (toclevel != Layout::NOT_IN_TOC) {
532 if (min_toclevel_ == Layout::NOT_IN_TOC)
533 min_toclevel_ = toclevel;
535 min_toclevel_ = min(min_toclevel_,
537 max_toclevel_ = max(max_toclevel_,
541 LYXERR(Debug::TCLASS, "Minimum TocLevel is " << min_toclevel_
542 << ", maximum is " << max_toclevel_);
548 void TextClass::readTitleType(Lexer & lexrc)
550 keyword_item titleTypeTags[] = {
551 { "commandafter", TITLE_COMMAND_AFTER },
552 { "environment", TITLE_ENVIRONMENT }
555 PushPopHelper pph(lexrc, titleTypeTags, TITLE_ENVIRONMENT);
557 int le = lexrc.lex();
559 case Lexer::LEX_UNDEF:
560 lexrc.printError("Unknown output type `$$Token'");
562 case TITLE_COMMAND_AFTER:
563 case TITLE_ENVIRONMENT:
564 titletype_ = static_cast<TitleLatexType>(le);
567 lyxerr << "Unhandled value " << le
568 << " in TextClass::readTitleType." << endl;
575 void TextClass::readOutputType(Lexer & lexrc)
577 keyword_item outputTypeTags[] = {
578 { "docbook", DOCBOOK },
580 { "literate", LITERATE }
583 PushPopHelper pph(lexrc, outputTypeTags, LITERATE);
585 int le = lexrc.lex();
587 case Lexer::LEX_UNDEF:
588 lexrc.printError("Unknown output type `$$Token'");
593 outputType_ = static_cast<OutputType>(le);
596 lyxerr << "Unhandled value " << le
597 << " in TextClass::readOutputType." << endl;
604 enum ClassOptionsTags {
613 void TextClass::readClassOptions(Lexer & lexrc)
615 keyword_item classOptionsTags[] = {
617 {"fontsize", CO_FONTSIZE },
618 {"header", CO_HEADER },
619 {"other", CO_OTHER },
620 {"pagestyle", CO_PAGESTYLE }
623 lexrc.pushTable(classOptionsTags, CO_END);
625 while (!getout && lexrc.isOK()) {
626 int le = lexrc.lex();
628 case Lexer::LEX_UNDEF:
629 lexrc.printError("Unknown ClassOption tag `$$Token'");
633 switch (static_cast<ClassOptionsTags>(le)) {
636 opt_fontsize_ = rtrim(lexrc.getString());
640 opt_pagestyle_ = rtrim(lexrc.getString());
644 options_ = lexrc.getString();
648 class_header_ = subst(lexrc.getString(), """, "\"");
659 enum InsetLayoutTags {
681 void TextClass::readInsetLayout(Lexer & lexrc, docstring const & name)
683 keyword_item elementTags[] = {
684 { "bgcolor", IL_BGCOLOR },
685 { "decoration", IL_DECORATION },
688 { "forceltr", IL_FORCELTR },
689 { "freespacing", IL_FREESPACING },
690 { "keepempty", IL_KEEPEMPTY },
691 { "labelfont", IL_LABELFONT },
692 { "labelstring", IL_LABELSTRING },
693 { "latexname", IL_LATEXNAME },
694 { "latexparam", IL_LATEXPARAM },
695 { "latextype", IL_LATEXTYPE },
696 { "lyxtype", IL_LYXTYPE },
697 { "multipar", IL_MULTIPAR },
698 { "needprotect", IL_NEEDPROTECT },
699 { "passthru", IL_PASSTHRU },
700 { "preamble", IL_PREAMBLE },
701 { "requires", IL_REQUIRES }
704 lexrc.pushTable(elementTags, IL_END);
707 docstring labelstring;
712 FontInfo font = inherit_font;
713 FontInfo labelfont = inherit_font;
714 ColorCode bgcolor(Color_background);
716 set<string> requires;
717 bool multipar = false;
718 bool passthru = false;
719 bool needprotect = false;
720 bool keepempty = false;
721 bool freespacing = false;
722 bool forceltr = false;
725 while (!getout && lexrc.isOK()) {
726 int le = lexrc.lex();
728 case Lexer::LEX_UNDEF:
729 lexrc.printError("Unknown InsetLayout tag `$$Token'");
733 switch (static_cast<InsetLayoutTags>(le)) {
736 lyxtype = lexrc.getString();
740 latextype = lexrc.getString();
744 labelstring = lexrc.getDocString();
748 decoration = lexrc.getString();
752 latexname = lexrc.getString();
756 latexparam = subst(lexrc.getString(), """, "\"");
759 labelfont = lyxRead(lexrc, inherit_font);
763 forceltr = lexrc.getBool();
767 multipar = lexrc.getBool();
771 passthru = lexrc.getBool();
775 keepempty = lexrc.getBool();
779 freespacing = lexrc.getBool();
783 needprotect = lexrc.getBool();
786 font = lyxRead(lexrc, inherit_font);
787 // So: define font before labelfont
792 string const token = lexrc.getString();
793 bgcolor = lcolor.getFromLyXName(token);
797 preamble = lexrc.getLongString("EndPreamble");
801 vector<string> const req
802 = getVectorFromString(lexrc.getString());
803 requires.insert(req.begin(), req.end());
812 // Here add element to list if getout == true
815 il.name = to_ascii(name);
816 il.lyxtype = lyxtype;
817 il.labelstring = labelstring;
818 il.decoration = decoration;
819 il.latextype = latextype;
820 il.latexname = latexname;
821 il.latexparam = latexparam;
822 il.multipar = multipar;
823 il.passthru = passthru;
824 il.needprotect = needprotect;
825 il.freespacing = freespacing;
826 il.forceltr = forceltr;
827 il.keepempty = keepempty;
829 // The label font is generally used as-is without
830 // any realization against a given context.
831 labelfont.realize(sane_font);
832 il.labelfont = labelfont;
833 il.bgcolor = bgcolor;
834 il.preamble = preamble;
835 il.requires = requires;
836 insetlayoutlist_[name] = il;
857 void TextClass::readFloat(Lexer & lexrc)
859 keyword_item floatTags[] = {
861 { "extension", FT_EXT },
862 { "guiname", FT_NAME },
863 { "latexbuiltin", FT_BUILTIN },
864 { "listname", FT_LISTNAME },
865 { "numberwithin", FT_WITHIN },
866 { "placement", FT_PLACEMENT },
867 { "style", FT_STYLE },
871 lexrc.pushTable(floatTags, FT_END);
880 bool builtin = false;
883 while (!getout && lexrc.isOK()) {
884 int le = lexrc.lex();
886 case Lexer::LEX_UNDEF:
887 lexrc.printError("Unknown float tag `$$Token'");
891 switch (static_cast<FloatTags>(le)) {
894 type = lexrc.getString();
895 if (floatlist_->typeExist(type)) {
896 Floating const & fl = floatlist_->getType(type);
897 placement = fl.placement();
899 within = fl.within();
902 listName = fl.listName();
903 builtin = fl.builtin();
908 name = lexrc.getString();
912 placement = lexrc.getString();
916 ext = lexrc.getString();
920 within = lexrc.getString();
921 if (within == "none")
926 style = lexrc.getString();
930 listName = lexrc.getString();
934 builtin = lexrc.getBool();
942 // Here if have a full float if getout == true
944 Floating fl(type, placement, ext, within,
945 style, name, listName, builtin);
946 floatlist_->newFloat(fl);
947 // each float has its own counter
948 counters_->newCounter(from_ascii(type), from_ascii(within),
949 docstring(), docstring());
960 CT_LABELSTRING_APPENDIX,
965 void TextClass::readCounter(Lexer & lexrc)
967 keyword_item counterTags[] = {
969 { "labelstring", CT_LABELSTRING },
970 { "labelstringappendix", CT_LABELSTRING_APPENDIX },
972 { "within", CT_WITHIN }
975 lexrc.pushTable(counterTags, CT_END);
979 docstring labelstring;
980 docstring labelstring_appendix;
983 while (!getout && lexrc.isOK()) {
984 int le = lexrc.lex();
986 case Lexer::LEX_UNDEF:
987 lexrc.printError("Unknown counter tag `$$Token'");
991 switch (static_cast<CounterTags>(le)) {
994 name = lexrc.getDocString();
995 if (counters_->hasCounter(name))
996 LYXERR(Debug::TCLASS, "Reading existing counter " << to_utf8(name));
998 LYXERR(Debug::TCLASS, "Reading new counter " << to_utf8(name));
1002 within = lexrc.getDocString();
1003 if (within == "none")
1006 case CT_LABELSTRING:
1008 labelstring = lexrc.getDocString();
1009 labelstring_appendix = labelstring;
1011 case CT_LABELSTRING_APPENDIX:
1013 labelstring_appendix = lexrc.getDocString();
1021 // Here if have a full counter if getout == true
1023 counters_->newCounter(name, within,
1024 labelstring, labelstring_appendix);
1030 FontInfo const & TextClass::defaultfont() const
1032 return defaultfont_;
1036 docstring const & TextClass::leftmargin() const
1042 docstring const & TextClass::rightmargin() const
1044 return rightmargin_;
1048 bool TextClass::hasLayout(docstring const & n) const
1050 docstring const name = n.empty() ? defaultLayoutName() : n;
1052 return find_if(layoutlist_.begin(), layoutlist_.end(),
1053 LayoutNamesEqual(name))
1054 != layoutlist_.end();
1059 LayoutPtr const & TextClass::operator[](docstring const & name) const
1061 BOOST_ASSERT(!name.empty());
1063 LayoutList::const_iterator cit =
1064 find_if(layoutlist_.begin(),
1066 LayoutNamesEqual(name));
1068 if (cit == layoutlist_.end()) {
1069 lyxerr << "We failed to find the layout '" << to_utf8(name)
1070 << "' in the layout list. You MUST investigate!"
1072 for (LayoutList::const_iterator it = layoutlist_.begin();
1073 it != layoutlist_.end(); ++it)
1074 lyxerr << " " << to_utf8(it->get()->name()) << endl;
1076 // we require the name to exist
1077 BOOST_ASSERT(false);
1084 bool TextClass::deleteLayout(docstring const & name)
1086 if (name == defaultLayoutName() || name == emptyLayoutName())
1089 LayoutList::iterator it =
1090 remove_if(layoutlist_.begin(), layoutlist_.end(),
1091 LayoutNamesEqual(name));
1093 LayoutList::iterator end = layoutlist_.end();
1094 bool const ret = (it != end);
1095 layoutlist_.erase(it, end);
1100 // Load textclass info if not loaded yet
1101 bool TextClass::load(string const & path) const
1106 // Read style-file, provided path is searched before the system ones
1107 FileName layout_file;
1109 layout_file = FileName(addName(path, name_ + ".layout"));
1110 if (layout_file.empty() || !layout_file.exists())
1111 layout_file = libFileSearch("layouts", name_, "layout");
1112 loaded_ = const_cast<TextClass*>(this)->read(layout_file) == 0;
1115 lyxerr << "Error reading `"
1116 << to_utf8(makeDisplayPath(layout_file.absFilename()))
1117 << "'\n(Check `" << name_
1118 << "')\nCheck your installation and "
1119 "try Options/Reconfigure..." << endl;
1126 FloatList & TextClass::floats()
1128 return *floatlist_.get();
1132 FloatList const & TextClass::floats() const
1134 return *floatlist_.get();
1138 Counters & TextClass::counters() const
1140 return *counters_.get();
1144 // Return the layout object of an inset given by name. If the name
1145 // is not found as such, the part after the ':' is stripped off, and
1146 // searched again. In this way, an error fallback can be provided:
1147 // An erroneous 'CharStyle:badname' (e.g., after a documentclass switch)
1148 // will invoke the layout object defined by name = 'CharStyle'.
1149 // If that doesn't work either, an empty object returns (shouldn't
1150 // happen). -- Idea JMarc, comment MV
1151 InsetLayout const & TextClass::insetlayout(docstring const & name) const
1154 while (!n.empty()) {
1155 if (insetlayoutlist_.count(n) > 0)
1156 return insetlayoutlist_[n];
1157 docstring::size_type i = n.find(':');
1158 if (i == string::npos)
1162 static InsetLayout empty;
1163 empty.labelstring = from_utf8("UNDEFINED");
1164 empty.labelfont = sane_font;
1165 empty.labelfont.setColor(Color_error);
1166 empty.bgcolor = Color_error;
1171 docstring const & TextClass::defaultLayoutName() const
1173 // This really should come from the actual layout... (Lgb)
1174 return defaultlayout_;
1178 LayoutPtr const & TextClass::defaultLayout() const
1180 return operator[](defaultLayoutName());
1184 string const & TextClass::name() const
1190 string const & TextClass::latexname() const
1192 const_cast<TextClass*>(this)->load();
1197 string const & TextClass::description() const
1199 return description_;
1203 string const & TextClass::opt_fontsize() const
1205 return opt_fontsize_;
1209 string const & TextClass::opt_pagestyle() const
1211 return opt_pagestyle_;
1215 string const & TextClass::options() const
1221 string const & TextClass::class_header() const
1223 return class_header_;
1227 string const & TextClass::pagestyle() const
1233 docstring const & TextClass::preamble() const
1239 PageSides TextClass::sides() const
1245 int TextClass::secnumdepth() const
1247 return secnumdepth_;
1251 int TextClass::tocdepth() const
1257 OutputType TextClass::outputType() const
1263 bool TextClass::provides(string const & p) const
1265 return provides_.find(p) != provides_.end();
1269 unsigned int TextClass::columns() const
1275 TitleLatexType TextClass::titletype() const
1281 string const & TextClass::titlename() const
1287 int TextClass::size() const
1289 return layoutlist_.size();
1293 int TextClass::min_toclevel() const
1295 return min_toclevel_;
1299 int TextClass::max_toclevel() const
1301 return max_toclevel_;
1305 bool TextClass::hasTocLevels() const
1307 return min_toclevel_ != Layout::NOT_IN_TOC;
1311 ostream & operator<<(ostream & os, PageSides p)