2001-12-28 13:26:54 +00:00
|
|
|
/* This file is part of
|
2002-03-21 17:27:08 +00:00
|
|
|
* ======================================================
|
|
|
|
*
|
2001-12-28 13:26:54 +00:00
|
|
|
* LyX, The Document Processor
|
2002-03-21 17:27:08 +00:00
|
|
|
*
|
2001-12-28 13:26:54 +00:00
|
|
|
* Copyright 1995 Matthias Ettrich
|
|
|
|
* Copyright 1995-2001 The LyX Team.
|
|
|
|
*
|
|
|
|
* ======================================================
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include "lyxtextclass.h"
|
|
|
|
#include "debug.h"
|
|
|
|
#include "lyxlex.h"
|
2002-09-06 14:48:01 +00:00
|
|
|
#include "counters.h"
|
2002-09-11 07:39:55 +00:00
|
|
|
#include "FloatList.h"
|
2001-12-28 13:26:54 +00:00
|
|
|
|
|
|
|
#include "support/lstrings.h"
|
|
|
|
#include "support/LAssert.h"
|
|
|
|
#include "support/lyxfunctional.h"
|
|
|
|
#include "support/filetools.h"
|
|
|
|
|
2001-12-28 14:52:28 +00:00
|
|
|
#include <algorithm>
|
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
using std::endl;
|
2002-01-07 14:17:54 +00:00
|
|
|
using std::find_if;
|
|
|
|
using std::remove_if;
|
2002-02-16 15:59:55 +00:00
|
|
|
using std::ostream;
|
2001-12-28 13:26:54 +00:00
|
|
|
|
2002-06-24 20:28:12 +00:00
|
|
|
namespace { // anon
|
|
|
|
|
|
|
|
struct compare_name {
|
2003-03-14 11:57:12 +00:00
|
|
|
|
2002-06-24 20:28:12 +00:00
|
|
|
compare_name(string const & name)
|
2003-03-14 11:57:12 +00:00
|
|
|
: name_(name)
|
|
|
|
{}
|
|
|
|
|
|
|
|
bool operator()(boost::shared_ptr<LyXLayout> const & c)
|
|
|
|
{
|
2002-06-24 20:28:12 +00:00
|
|
|
return c->name() == name_;
|
|
|
|
}
|
2003-03-14 11:57:12 +00:00
|
|
|
|
2002-06-24 20:28:12 +00:00
|
|
|
string name_;
|
2003-03-14 11:57:12 +00:00
|
|
|
|
2002-06-24 20:28:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // anon
|
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
|
|
|
|
LyXTextClass::LyXTextClass(string const & fn, string const & cln,
|
2003-05-03 19:24:36 +00:00
|
|
|
string const & desc, bool texClassAvail )
|
2002-09-11 07:39:55 +00:00
|
|
|
: name_(fn), latexname_(cln), description_(desc),
|
2003-05-03 19:24:36 +00:00
|
|
|
floatlist_(new FloatList), ctrs_(new Counters), texClassAvail_(texClassAvail)
|
2001-12-28 13:26:54 +00:00
|
|
|
{
|
|
|
|
outputType_ = LATEX;
|
|
|
|
columns_ = 1;
|
|
|
|
sides_ = OneSide;
|
|
|
|
secnumdepth_ = 3;
|
|
|
|
tocdepth_ = 3;
|
|
|
|
pagestyle_ = "default";
|
|
|
|
maxcounter_ = LABEL_COUNTER_CHAPTER;
|
|
|
|
defaultfont_ = LyXFont(LyXFont::ALL_SANE);
|
|
|
|
opt_fontsize_ = "10|11|12";
|
|
|
|
opt_pagestyle_ = "empty|plain|headings|fancy";
|
|
|
|
provides_ = nothing;
|
2003-02-13 17:49:09 +00:00
|
|
|
titletype_ = TITLE_COMMAND_AFTER;
|
|
|
|
titlename_ = "maketitle";
|
2001-12-28 13:26:54 +00:00
|
|
|
loaded = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-05-03 19:24:36 +00:00
|
|
|
bool LyXTextClass::isTeXClassAvailable() const
|
|
|
|
{
|
|
|
|
return texClassAvail_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
bool LyXTextClass::do_readStyle(LyXLex & lexrc, LyXLayout & lay)
|
|
|
|
{
|
|
|
|
lyxerr[Debug::TCLASS] << "Reading style " << lay.name() << endl;
|
|
|
|
if (!lay.Read(lexrc, *this)) {
|
2002-02-26 10:50:48 +00:00
|
|
|
// Resolve fonts
|
2001-12-28 13:26:54 +00:00
|
|
|
lay.resfont = lay.font;
|
|
|
|
lay.resfont.realize(defaultfont());
|
|
|
|
lay.reslabelfont = lay.labelfont;
|
|
|
|
lay.reslabelfont.realize(defaultfont());
|
|
|
|
return false; // no errors
|
2002-03-21 17:27:08 +00:00
|
|
|
}
|
2002-11-27 10:30:28 +00:00
|
|
|
lyxerr << "Error parsing style `" << lay.name() << '\'' << endl;
|
2001-12-28 13:26:54 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
enum TextClassTags {
|
|
|
|
TC_OUTPUTTYPE = 1,
|
|
|
|
TC_INPUT,
|
|
|
|
TC_STYLE,
|
2002-03-02 16:39:54 +00:00
|
|
|
TC_DEFAULTSTYLE,
|
2003-03-21 12:48:20 +00:00
|
|
|
TC_ENVIRONMENT,
|
2001-12-28 13:26:54 +00:00
|
|
|
TC_NOSTYLE,
|
|
|
|
TC_COLUMNS,
|
|
|
|
TC_SIDES,
|
|
|
|
TC_PAGESTYLE,
|
|
|
|
TC_DEFAULTFONT,
|
|
|
|
TC_MAXCOUNTER,
|
|
|
|
TC_SECNUMDEPTH,
|
|
|
|
TC_TOCDEPTH,
|
|
|
|
TC_CLASSOPTIONS,
|
|
|
|
TC_PREAMBLE,
|
|
|
|
TC_PROVIDESAMSMATH,
|
2002-04-23 22:34:24 +00:00
|
|
|
TC_PROVIDESNATBIB,
|
2001-12-28 13:26:54 +00:00
|
|
|
TC_PROVIDESMAKEIDX,
|
|
|
|
TC_PROVIDESURL,
|
|
|
|
TC_LEFTMARGIN,
|
2002-09-04 06:52:26 +00:00
|
|
|
TC_RIGHTMARGIN,
|
2002-09-06 14:48:01 +00:00
|
|
|
TC_FLOAT,
|
2002-09-11 07:39:55 +00:00
|
|
|
TC_COUNTER,
|
2003-02-13 17:49:09 +00:00
|
|
|
TC_NOFLOAT,
|
|
|
|
TC_TITLELATEXNAME,
|
2003-03-21 12:48:20 +00:00
|
|
|
TC_TITLELATEXTYPE
|
2001-12-28 13:26:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Reads a textclass structure from file.
|
|
|
|
bool LyXTextClass::Read(string const & filename, bool merge)
|
|
|
|
{
|
|
|
|
keyword_item textClassTags[] = {
|
|
|
|
{ "classoptions", TC_CLASSOPTIONS },
|
|
|
|
{ "columns", TC_COLUMNS },
|
2002-09-06 14:48:01 +00:00
|
|
|
{ "counter", TC_COUNTER },
|
2001-12-28 13:26:54 +00:00
|
|
|
{ "defaultfont", TC_DEFAULTFONT },
|
2002-03-02 16:39:54 +00:00
|
|
|
{ "defaultstyle", TC_DEFAULTSTYLE },
|
2003-03-21 12:48:20 +00:00
|
|
|
{ "environment", TC_ENVIRONMENT },
|
2002-09-04 06:52:26 +00:00
|
|
|
{ "float", TC_FLOAT },
|
2001-12-28 13:26:54 +00:00
|
|
|
{ "input", TC_INPUT },
|
|
|
|
{ "leftmargin", TC_LEFTMARGIN },
|
|
|
|
{ "maxcounter", TC_MAXCOUNTER },
|
2002-09-11 07:39:55 +00:00
|
|
|
{ "nofloat", TC_NOFLOAT },
|
2001-12-28 13:26:54 +00:00
|
|
|
{ "nostyle", TC_NOSTYLE },
|
|
|
|
{ "outputtype", TC_OUTPUTTYPE },
|
|
|
|
{ "pagestyle", TC_PAGESTYLE },
|
|
|
|
{ "preamble", TC_PREAMBLE },
|
|
|
|
{ "providesamsmath", TC_PROVIDESAMSMATH },
|
|
|
|
{ "providesmakeidx", TC_PROVIDESMAKEIDX },
|
2002-04-23 22:34:24 +00:00
|
|
|
{ "providesnatbib", TC_PROVIDESNATBIB },
|
2001-12-28 13:26:54 +00:00
|
|
|
{ "providesurl", TC_PROVIDESURL },
|
|
|
|
{ "rightmargin", TC_RIGHTMARGIN },
|
|
|
|
{ "secnumdepth", TC_SECNUMDEPTH },
|
|
|
|
{ "sides", TC_SIDES },
|
|
|
|
{ "style", TC_STYLE },
|
2003-02-13 17:49:09 +00:00
|
|
|
{ "titlelatexname", TC_TITLELATEXNAME },
|
|
|
|
{ "titlelatextype", TC_TITLELATEXTYPE },
|
2001-12-28 13:26:54 +00:00
|
|
|
{ "tocdepth", TC_TOCDEPTH }
|
|
|
|
};
|
|
|
|
|
|
|
|
if (!merge)
|
|
|
|
lyxerr[Debug::TCLASS] << "Reading textclass "
|
|
|
|
<< MakeDisplayPath(filename)
|
|
|
|
<< endl;
|
|
|
|
else
|
|
|
|
lyxerr[Debug::TCLASS] << "Reading input file "
|
|
|
|
<< MakeDisplayPath(filename)
|
|
|
|
<< endl;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2003-03-21 12:48:20 +00:00
|
|
|
LyXLex lexrc(textClassTags,
|
|
|
|
sizeof(textClassTags) / sizeof(textClassTags[0]));
|
2001-12-28 13:26:54 +00:00
|
|
|
bool error = false;
|
|
|
|
|
2002-03-21 17:27:08 +00:00
|
|
|
lexrc.setFile(filename);
|
|
|
|
if (!lexrc.isOK()) error = true;
|
2001-12-28 13:26:54 +00:00
|
|
|
|
|
|
|
// parsing
|
|
|
|
while (lexrc.isOK() && !error) {
|
|
|
|
int le = lexrc.lex();
|
2003-03-14 12:08:15 +00:00
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
switch (le) {
|
|
|
|
case LyXLex::LEX_FEOF:
|
2002-03-21 17:27:08 +00:00
|
|
|
continue;
|
2001-12-28 13:26:54 +00:00
|
|
|
|
2002-03-21 17:27:08 +00:00
|
|
|
case LyXLex::LEX_UNDEF:
|
2001-12-28 13:26:54 +00:00
|
|
|
lexrc.printError("Unknown TextClass tag `$$Token'");
|
|
|
|
error = true;
|
2002-03-21 17:27:08 +00:00
|
|
|
continue;
|
2003-03-14 12:08:15 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
2001-12-28 13:26:54 +00:00
|
|
|
}
|
2003-03-14 12:08:15 +00:00
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
switch (static_cast<TextClassTags>(le)) {
|
2003-03-14 12:08:15 +00:00
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
case TC_OUTPUTTYPE: // output type definition
|
|
|
|
readOutputType(lexrc);
|
|
|
|
break;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
case TC_INPUT: // Include file
|
2002-03-21 17:27:08 +00:00
|
|
|
if (lexrc.next()) {
|
|
|
|
string tmp = LibFileSearch("layouts",
|
|
|
|
lexrc.getString(),
|
2001-12-28 13:26:54 +00:00
|
|
|
"layout");
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
if (Read(tmp, true)) {
|
|
|
|
lexrc.printError("Error reading input"
|
|
|
|
"file: "+tmp);
|
|
|
|
error = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2002-03-02 16:39:54 +00:00
|
|
|
case TC_DEFAULTSTYLE:
|
|
|
|
if (lexrc.next()) {
|
2002-03-03 20:25:07 +00:00
|
|
|
string const name = subst(lexrc.getString(),
|
|
|
|
'_', ' ');
|
2002-03-02 16:39:54 +00:00
|
|
|
defaultlayout_ = name;
|
|
|
|
}
|
|
|
|
break;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
case TC_STYLE:
|
|
|
|
if (lexrc.next()) {
|
2002-03-03 20:25:07 +00:00
|
|
|
string const name = subst(lexrc.getString(),
|
2001-12-28 13:26:54 +00:00
|
|
|
'_', ' ');
|
|
|
|
if (hasLayout(name)) {
|
2003-03-14 11:57:12 +00:00
|
|
|
LyXLayout * lay = operator[](name).get();
|
2002-06-24 20:28:12 +00:00
|
|
|
error = do_readStyle(lexrc, *lay);
|
2001-12-28 13:26:54 +00:00
|
|
|
} else {
|
|
|
|
LyXLayout lay;
|
|
|
|
lay.setName(name);
|
|
|
|
if (!(error = do_readStyle(lexrc, lay)))
|
2003-03-21 12:48:20 +00:00
|
|
|
layoutlist_.push_back
|
|
|
|
(boost::shared_ptr<LyXLayout>(new LyXLayout(lay)));
|
2002-03-03 20:25:07 +00:00
|
|
|
if (defaultlayout_.empty()) {
|
|
|
|
// We do not have a default
|
|
|
|
// layout yet, so we choose
|
|
|
|
// the first layout we
|
|
|
|
// encounter.
|
|
|
|
defaultlayout_ = name;
|
|
|
|
}
|
2001-12-28 13:26:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
lexrc.printError("No name given for style: `$$Token'.");
|
|
|
|
error = true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2003-03-14 11:57:12 +00:00
|
|
|
case TC_ENVIRONMENT:
|
|
|
|
if (lexrc.next()) {
|
|
|
|
string const name = subst(lexrc.getString(),
|
|
|
|
'_', ' ');
|
|
|
|
if (hasLayout(name)) {
|
|
|
|
LyXLayout * lay = operator[](name).get();
|
|
|
|
error = do_readStyle(lexrc, *lay);
|
|
|
|
} else {
|
|
|
|
LyXLayout lay;
|
|
|
|
lay.setName(name);
|
|
|
|
if (!(error = do_readStyle(lexrc, lay)))
|
|
|
|
envlist_.push_back
|
|
|
|
(boost::shared_ptr<LyXLayout>(new LyXLayout(lay)));
|
|
|
|
else
|
|
|
|
lexrc.printError("Problems reading environment: `$$Token'.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
lexrc.printError("No name given for style: `$$Token'.");
|
|
|
|
error = true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
case TC_NOSTYLE:
|
|
|
|
if (lexrc.next()) {
|
2002-03-03 20:25:07 +00:00
|
|
|
string const style = subst(lexrc.getString(),
|
2001-12-28 13:26:54 +00:00
|
|
|
'_', ' ');
|
|
|
|
if (!delete_layout(style))
|
2002-11-27 10:30:28 +00:00
|
|
|
lyxerr << "Cannot delete style `"
|
|
|
|
<< style << '\'' << endl;
|
2002-03-02 16:39:54 +00:00
|
|
|
// lexrc.printError("Cannot delete style"
|
|
|
|
// " `$$Token'");
|
2001-12-28 13:26:54 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TC_COLUMNS:
|
|
|
|
if (lexrc.next())
|
|
|
|
columns_ = lexrc.getInteger();
|
|
|
|
break;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
case TC_SIDES:
|
|
|
|
if (lexrc.next()) {
|
|
|
|
switch (lexrc.getInteger()) {
|
|
|
|
case 1: sides_ = OneSide; break;
|
|
|
|
case 2: sides_ = TwoSides; break;
|
|
|
|
default:
|
|
|
|
lyxerr << "Impossible number of page"
|
|
|
|
" sides, setting to one."
|
|
|
|
<< endl;
|
|
|
|
sides_ = OneSide;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
case TC_PAGESTYLE:
|
2002-03-21 17:27:08 +00:00
|
|
|
lexrc.next();
|
2002-07-28 22:50:13 +00:00
|
|
|
pagestyle_ = rtrim(lexrc.getString());
|
2001-12-28 13:26:54 +00:00
|
|
|
break;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
case TC_DEFAULTFONT:
|
|
|
|
defaultfont_.lyxRead(lexrc);
|
|
|
|
if (!defaultfont_.resolved()) {
|
|
|
|
lexrc.printError("Warning: defaultfont should "
|
|
|
|
"be fully instantiated!");
|
|
|
|
defaultfont_.realize(LyXFont(LyXFont::ALL_SANE));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TC_MAXCOUNTER:
|
|
|
|
readMaxCounter(lexrc);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TC_SECNUMDEPTH:
|
|
|
|
lexrc.next();
|
|
|
|
secnumdepth_ = lexrc.getInteger();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TC_TOCDEPTH:
|
|
|
|
lexrc.next();
|
|
|
|
tocdepth_ = lexrc.getInteger();
|
|
|
|
break;
|
|
|
|
|
2002-03-21 17:27:08 +00:00
|
|
|
// First step to support options
|
|
|
|
case TC_CLASSOPTIONS:
|
2001-12-28 13:26:54 +00:00
|
|
|
readClassOptions(lexrc);
|
2002-03-21 17:27:08 +00:00
|
|
|
break;
|
2001-12-28 13:26:54 +00:00
|
|
|
|
|
|
|
case TC_PREAMBLE:
|
|
|
|
preamble_ = lexrc.getLongString("EndPreamble");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TC_PROVIDESAMSMATH:
|
|
|
|
if (lexrc.next() && lexrc.getInteger())
|
|
|
|
provides_ |= amsmath;
|
|
|
|
break;
|
|
|
|
|
2002-04-23 22:34:24 +00:00
|
|
|
case TC_PROVIDESNATBIB:
|
|
|
|
if (lexrc.next() && lexrc.getInteger())
|
|
|
|
provides_ |= natbib;
|
|
|
|
break;
|
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
case TC_PROVIDESMAKEIDX:
|
|
|
|
if (lexrc.next() && lexrc.getInteger())
|
|
|
|
provides_ |= makeidx;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TC_PROVIDESURL:
|
|
|
|
if (lexrc.next() && lexrc.getInteger())
|
2002-04-17 21:05:37 +00:00
|
|
|
provides_ |= url;
|
2001-12-28 13:26:54 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TC_LEFTMARGIN: // left margin type
|
2002-03-21 17:27:08 +00:00
|
|
|
if (lexrc.next())
|
2001-12-28 13:26:54 +00:00
|
|
|
leftmargin_ = lexrc.getString();
|
2002-03-21 17:27:08 +00:00
|
|
|
break;
|
2001-12-28 13:26:54 +00:00
|
|
|
|
|
|
|
case TC_RIGHTMARGIN: // right margin type
|
|
|
|
if (lexrc.next())
|
|
|
|
rightmargin_ = lexrc.getString();
|
|
|
|
break;
|
2002-09-04 06:52:26 +00:00
|
|
|
case TC_FLOAT:
|
|
|
|
readFloat(lexrc);
|
|
|
|
break;
|
2002-09-06 14:48:01 +00:00
|
|
|
case TC_COUNTER:
|
|
|
|
readCounter(lexrc);
|
|
|
|
break;
|
2003-02-13 17:49:09 +00:00
|
|
|
case TC_TITLELATEXTYPE:
|
|
|
|
readTitleType(lexrc);
|
|
|
|
break;
|
|
|
|
case TC_TITLELATEXNAME:
|
|
|
|
if (lexrc.next())
|
|
|
|
titlename_ = lexrc.getString();
|
|
|
|
break;
|
2002-09-11 07:39:55 +00:00
|
|
|
case TC_NOFLOAT:
|
|
|
|
if (lexrc.next()) {
|
|
|
|
string const nofloat = lexrc.getString();
|
|
|
|
floatlist_->erase(nofloat);
|
|
|
|
}
|
|
|
|
break;
|
2001-12-28 13:26:54 +00:00
|
|
|
}
|
2002-03-21 17:27:08 +00:00
|
|
|
}
|
2001-12-28 13:26:54 +00:00
|
|
|
|
|
|
|
if (!merge) { // we are at top level here.
|
2002-03-21 17:27:08 +00:00
|
|
|
lyxerr[Debug::TCLASS] << "Finished reading textclass "
|
2001-12-28 13:26:54 +00:00
|
|
|
<< MakeDisplayPath(filename)
|
|
|
|
<< endl;
|
2002-03-02 16:39:54 +00:00
|
|
|
if (defaultlayout_.empty()) {
|
|
|
|
lyxerr << "Error: Textclass '" << name_
|
|
|
|
<< "' is missing a defaultstyle." << endl;
|
|
|
|
error = true;
|
|
|
|
}
|
2001-12-28 13:26:54 +00:00
|
|
|
} else
|
2002-03-21 17:27:08 +00:00
|
|
|
lyxerr[Debug::TCLASS] << "Finished reading input file "
|
2001-12-28 13:26:54 +00:00
|
|
|
<< MakeDisplayPath(filename)
|
|
|
|
<< endl;
|
|
|
|
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-02-13 17:49:09 +00:00
|
|
|
void LyXTextClass::readTitleType(LyXLex & lexrc)
|
|
|
|
{
|
|
|
|
keyword_item titleTypeTags[] = {
|
|
|
|
{ "commandafter", TITLE_COMMAND_AFTER },
|
|
|
|
{ "environment", TITLE_ENVIRONMENT }
|
|
|
|
};
|
|
|
|
|
|
|
|
pushpophelper pph(lexrc, titleTypeTags, TITLE_ENVIRONMENT);
|
|
|
|
|
|
|
|
int le = lexrc.lex();
|
|
|
|
switch (le) {
|
|
|
|
case LyXLex::LEX_UNDEF:
|
|
|
|
lexrc.printError("Unknown output type `$$Token'");
|
|
|
|
return;
|
|
|
|
case TITLE_COMMAND_AFTER:
|
|
|
|
case TITLE_ENVIRONMENT:
|
|
|
|
titletype_ = static_cast<LYX_TITLE_LATEX_TYPES>(le);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
lyxerr << "Unhandled value " << le
|
|
|
|
<< " in LyXTextClass::readTitleType." << endl;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
void LyXTextClass::readOutputType(LyXLex & lexrc)
|
|
|
|
{
|
|
|
|
keyword_item outputTypeTags[] = {
|
|
|
|
{ "docbook", DOCBOOK },
|
|
|
|
{ "latex", LATEX },
|
|
|
|
{ "linuxdoc", LINUXDOC },
|
|
|
|
{ "literate", LITERATE }
|
|
|
|
};
|
|
|
|
|
|
|
|
pushpophelper pph(lexrc, outputTypeTags, LITERATE);
|
|
|
|
|
|
|
|
int le = lexrc.lex();
|
|
|
|
switch (le) {
|
|
|
|
case LyXLex::LEX_UNDEF:
|
|
|
|
lexrc.printError("Unknown output type `$$Token'");
|
|
|
|
return;
|
|
|
|
case LATEX:
|
|
|
|
case LINUXDOC:
|
|
|
|
case DOCBOOK:
|
|
|
|
case LITERATE:
|
|
|
|
outputType_ = static_cast<OutputType>(le);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
lyxerr << "Unhandled value " << le
|
|
|
|
<< " in LyXTextClass::readOutputType." << endl;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
enum MaxCounterTags {
|
|
|
|
MC_COUNTER_CHAPTER = 1,
|
|
|
|
MC_COUNTER_SECTION,
|
|
|
|
MC_COUNTER_SUBSECTION,
|
|
|
|
MC_COUNTER_SUBSUBSECTION,
|
|
|
|
MC_COUNTER_PARAGRAPH,
|
|
|
|
MC_COUNTER_SUBPARAGRAPH,
|
|
|
|
MC_COUNTER_ENUMI,
|
|
|
|
MC_COUNTER_ENUMII,
|
|
|
|
MC_COUNTER_ENUMIII,
|
|
|
|
MC_COUNTER_ENUMIV
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
void LyXTextClass::readMaxCounter(LyXLex & lexrc)
|
|
|
|
{
|
|
|
|
keyword_item maxCounterTags[] = {
|
|
|
|
{"counter_chapter", MC_COUNTER_CHAPTER },
|
|
|
|
{"counter_enumi", MC_COUNTER_ENUMI },
|
|
|
|
{"counter_enumii", MC_COUNTER_ENUMII },
|
|
|
|
{"counter_enumiii", MC_COUNTER_ENUMIII },
|
|
|
|
{"counter_enumiv", MC_COUNTER_ENUMIV },
|
|
|
|
{"counter_paragraph", MC_COUNTER_PARAGRAPH },
|
|
|
|
{"counter_section", MC_COUNTER_SECTION },
|
|
|
|
{"counter_subparagraph", MC_COUNTER_SUBPARAGRAPH },
|
|
|
|
{"counter_subsection", MC_COUNTER_SUBSECTION },
|
|
|
|
{"counter_subsubsection", MC_COUNTER_SUBSUBSECTION }
|
|
|
|
};
|
|
|
|
|
|
|
|
pushpophelper pph(lexrc, maxCounterTags, MC_COUNTER_ENUMIV);
|
2003-03-14 12:08:15 +00:00
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
int le = lexrc.lex();
|
|
|
|
switch (le) {
|
|
|
|
case LyXLex::LEX_UNDEF:
|
|
|
|
lexrc.printError("Unknown MaxCounter tag `$$Token'");
|
2002-03-21 17:27:08 +00:00
|
|
|
return;
|
2003-03-14 12:08:15 +00:00
|
|
|
default:
|
|
|
|
break;
|
2001-12-28 13:26:54 +00:00
|
|
|
}
|
2003-03-14 12:08:15 +00:00
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
switch (static_cast<MaxCounterTags>(le)) {
|
|
|
|
case MC_COUNTER_CHAPTER:
|
|
|
|
maxcounter_ = LABEL_COUNTER_CHAPTER;
|
|
|
|
break;
|
|
|
|
case MC_COUNTER_SECTION:
|
|
|
|
maxcounter_ = LABEL_COUNTER_SECTION;
|
|
|
|
break;
|
|
|
|
case MC_COUNTER_SUBSECTION:
|
|
|
|
maxcounter_ = LABEL_COUNTER_SUBSECTION;
|
|
|
|
break;
|
|
|
|
case MC_COUNTER_SUBSUBSECTION:
|
|
|
|
maxcounter_ = LABEL_COUNTER_SUBSUBSECTION;
|
|
|
|
break;
|
|
|
|
case MC_COUNTER_PARAGRAPH:
|
|
|
|
maxcounter_ = LABEL_COUNTER_PARAGRAPH;
|
|
|
|
break;
|
|
|
|
case MC_COUNTER_SUBPARAGRAPH:
|
|
|
|
maxcounter_ = LABEL_COUNTER_SUBPARAGRAPH;
|
|
|
|
break;
|
|
|
|
case MC_COUNTER_ENUMI:
|
|
|
|
maxcounter_ = LABEL_COUNTER_ENUMI;
|
|
|
|
break;
|
|
|
|
case MC_COUNTER_ENUMII:
|
|
|
|
maxcounter_ = LABEL_COUNTER_ENUMII;
|
|
|
|
break;
|
|
|
|
case MC_COUNTER_ENUMIII:
|
|
|
|
maxcounter_ = LABEL_COUNTER_ENUMIII;
|
|
|
|
break;
|
|
|
|
case MC_COUNTER_ENUMIV:
|
|
|
|
maxcounter_ = LABEL_COUNTER_ENUMIV;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
enum ClassOptionsTags {
|
|
|
|
CO_FONTSIZE = 1,
|
|
|
|
CO_PAGESTYLE,
|
|
|
|
CO_OTHER,
|
|
|
|
CO_END
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
void LyXTextClass::readClassOptions(LyXLex & lexrc)
|
|
|
|
{
|
|
|
|
keyword_item classOptionsTags[] = {
|
|
|
|
{"end", CO_END },
|
|
|
|
{"fontsize", CO_FONTSIZE },
|
|
|
|
{"other", CO_OTHER },
|
|
|
|
{"pagestyle", CO_PAGESTYLE }
|
|
|
|
};
|
|
|
|
|
|
|
|
lexrc.pushTable(classOptionsTags, CO_END);
|
|
|
|
bool getout = false;
|
|
|
|
while (!getout && lexrc.isOK()) {
|
|
|
|
int le = lexrc.lex();
|
|
|
|
switch (le) {
|
|
|
|
case LyXLex::LEX_UNDEF:
|
|
|
|
lexrc.printError("Unknown ClassOption tag `$$Token'");
|
2002-03-21 17:27:08 +00:00
|
|
|
continue;
|
2001-12-28 13:26:54 +00:00
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
switch (static_cast<ClassOptionsTags>(le)) {
|
|
|
|
case CO_FONTSIZE:
|
|
|
|
lexrc.next();
|
2002-07-28 22:50:13 +00:00
|
|
|
opt_fontsize_ = rtrim(lexrc.getString());
|
2001-12-28 13:26:54 +00:00
|
|
|
break;
|
|
|
|
case CO_PAGESTYLE:
|
|
|
|
lexrc.next();
|
2002-07-28 22:50:13 +00:00
|
|
|
opt_pagestyle_ = rtrim(lexrc.getString());
|
2001-12-28 13:26:54 +00:00
|
|
|
break;
|
|
|
|
case CO_OTHER:
|
|
|
|
lexrc.next();
|
|
|
|
options_ = lexrc.getString();
|
|
|
|
break;
|
|
|
|
case CO_END:
|
|
|
|
getout = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
lexrc.popTable();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-09-04 06:52:26 +00:00
|
|
|
enum FloatTags {
|
|
|
|
FT_TYPE = 1,
|
|
|
|
FT_NAME,
|
|
|
|
FT_PLACEMENT,
|
|
|
|
FT_EXT,
|
|
|
|
FT_WITHIN,
|
|
|
|
FT_STYLE,
|
|
|
|
FT_LISTNAME,
|
|
|
|
FT_BUILTIN,
|
|
|
|
FT_END
|
|
|
|
};
|
|
|
|
|
|
|
|
void LyXTextClass::readFloat(LyXLex & lexrc)
|
|
|
|
{
|
|
|
|
keyword_item floatTags[] = {
|
|
|
|
{ "end", FT_END },
|
|
|
|
{ "extension", FT_EXT },
|
|
|
|
{ "guiname", FT_NAME },
|
|
|
|
{ "latexbuiltin", FT_BUILTIN },
|
|
|
|
{ "listname", FT_LISTNAME },
|
|
|
|
{ "numberwithin", FT_WITHIN },
|
|
|
|
{ "placement", FT_PLACEMENT },
|
|
|
|
{ "style", FT_STYLE },
|
|
|
|
{ "type", FT_TYPE }
|
|
|
|
};
|
|
|
|
|
|
|
|
lexrc.pushTable(floatTags, FT_END);
|
|
|
|
|
|
|
|
string type;
|
|
|
|
string placement;
|
|
|
|
string ext;
|
|
|
|
string within;
|
|
|
|
string style;
|
|
|
|
string name;
|
|
|
|
string listname;
|
|
|
|
bool builtin = false;
|
|
|
|
|
|
|
|
bool getout = false;
|
|
|
|
while (!getout && lexrc.isOK()) {
|
|
|
|
int le = lexrc.lex();
|
|
|
|
switch (le) {
|
|
|
|
case LyXLex::LEX_UNDEF:
|
|
|
|
lexrc.printError("Unknown ClassOption tag `$$Token'");
|
|
|
|
continue;
|
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
switch (static_cast<FloatTags>(le)) {
|
|
|
|
case FT_TYPE:
|
|
|
|
lexrc.next();
|
|
|
|
type = lexrc.getString();
|
|
|
|
// Here we could check if this type is already defined
|
|
|
|
// and modify it with the rest of the vars instead.
|
|
|
|
break;
|
|
|
|
case FT_NAME:
|
|
|
|
lexrc.next();
|
|
|
|
name = lexrc.getString();
|
|
|
|
break;
|
|
|
|
case FT_PLACEMENT:
|
|
|
|
lexrc.next();
|
|
|
|
placement = lexrc.getString();
|
|
|
|
break;
|
|
|
|
case FT_EXT:
|
|
|
|
lexrc.next();
|
|
|
|
ext = lexrc.getString();
|
|
|
|
break;
|
|
|
|
case FT_WITHIN:
|
|
|
|
lexrc.next();
|
|
|
|
within = lexrc.getString();
|
|
|
|
if (within == "none")
|
|
|
|
within.erase();
|
|
|
|
break;
|
|
|
|
case FT_STYLE:
|
|
|
|
lexrc.next();
|
|
|
|
style = lexrc.getString();
|
|
|
|
break;
|
|
|
|
case FT_LISTNAME:
|
|
|
|
lexrc.next();
|
|
|
|
listname = lexrc.getString();
|
|
|
|
break;
|
|
|
|
case FT_BUILTIN:
|
|
|
|
lexrc.next();
|
|
|
|
builtin = lexrc.getBool();
|
|
|
|
break;
|
|
|
|
case FT_END:
|
|
|
|
getout = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Here if have a full float if getout == true
|
|
|
|
if (getout) {
|
|
|
|
Floating newfloat(type, placement, ext, within,
|
|
|
|
style, name, listname, builtin);
|
2002-09-11 07:39:55 +00:00
|
|
|
floatlist_->newFloat(newfloat);
|
2002-09-04 06:52:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
lexrc.popTable();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-09-06 14:48:01 +00:00
|
|
|
enum CounterTags {
|
|
|
|
CT_NAME = 1,
|
|
|
|
CT_WITHIN,
|
|
|
|
CT_END
|
|
|
|
};
|
|
|
|
|
|
|
|
void LyXTextClass::readCounter(LyXLex & lexrc)
|
|
|
|
{
|
|
|
|
keyword_item counterTags[] = {
|
|
|
|
{ "end", CT_END },
|
|
|
|
{ "name", CT_NAME },
|
|
|
|
{ "within", CT_WITHIN }
|
|
|
|
};
|
|
|
|
|
|
|
|
lexrc.pushTable(counterTags, CT_END);
|
|
|
|
|
|
|
|
string name;
|
|
|
|
string within;
|
|
|
|
|
|
|
|
bool getout = false;
|
|
|
|
while (!getout && lexrc.isOK()) {
|
|
|
|
int le = lexrc.lex();
|
|
|
|
switch (le) {
|
|
|
|
case LyXLex::LEX_UNDEF:
|
|
|
|
lexrc.printError("Unknown ClassOption tag `$$Token'");
|
|
|
|
continue;
|
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
switch (static_cast<CounterTags>(le)) {
|
|
|
|
case CT_NAME:
|
|
|
|
lexrc.next();
|
|
|
|
name = lexrc.getString();
|
|
|
|
break;
|
|
|
|
case CT_WITHIN:
|
|
|
|
lexrc.next();
|
|
|
|
within = lexrc.getString();
|
|
|
|
if (within == "none")
|
|
|
|
within.erase();
|
|
|
|
break;
|
|
|
|
case CT_END:
|
|
|
|
getout = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Here if have a full float if getout == true
|
|
|
|
if (getout) {
|
|
|
|
if (within.empty()) {
|
|
|
|
ctrs_->newCounter(name);
|
|
|
|
} else {
|
|
|
|
ctrs_->newCounter(name, within);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
lexrc.popTable();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
LyXFont const & LyXTextClass::defaultfont() const
|
|
|
|
{
|
|
|
|
return defaultfont_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string const & LyXTextClass::leftmargin() const
|
|
|
|
{
|
|
|
|
return leftmargin_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string const & LyXTextClass::rightmargin() const
|
|
|
|
{
|
|
|
|
return rightmargin_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-02 16:39:54 +00:00
|
|
|
bool LyXTextClass::hasLayout(string const & n) const
|
2001-12-28 13:26:54 +00:00
|
|
|
{
|
2002-03-03 20:25:07 +00:00
|
|
|
string const name = (n.empty() ? defaultLayoutName() : n);
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2002-08-27 15:51:19 +00:00
|
|
|
return find_if(layoutlist_.begin(), layoutlist_.end(),
|
2002-06-24 20:28:12 +00:00
|
|
|
compare_name(name))
|
2002-08-27 15:51:19 +00:00
|
|
|
!= layoutlist_.end();
|
2001-12-28 13:26:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-06-24 20:28:12 +00:00
|
|
|
LyXLayout_ptr const & LyXTextClass::operator[](string const & n) const
|
2001-12-28 13:26:54 +00:00
|
|
|
{
|
2002-03-05 23:02:37 +00:00
|
|
|
lyx::Assert(!n.empty());
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2002-03-02 16:39:54 +00:00
|
|
|
if (n.empty())
|
2003-03-14 11:57:12 +00:00
|
|
|
lyxerr << "LyXTextClass::operator[] called with empty n" << endl;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2002-03-03 20:25:07 +00:00
|
|
|
string const name = (n.empty() ? defaultLayoutName() : n);
|
2002-03-12 18:11:49 +00:00
|
|
|
|
|
|
|
static string lastLayoutName;
|
|
|
|
static LayoutList::difference_type lastLayoutIndex;
|
|
|
|
|
|
|
|
if (name == lastLayoutName)
|
2002-08-27 15:51:19 +00:00
|
|
|
return layoutlist_[lastLayoutIndex];
|
2002-03-12 18:11:49 +00:00
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
LayoutList::const_iterator cit =
|
2002-08-27 15:51:19 +00:00
|
|
|
find_if(layoutlist_.begin(),
|
|
|
|
layoutlist_.end(),
|
2002-06-24 20:28:12 +00:00
|
|
|
compare_name(name));
|
2002-03-02 16:39:54 +00:00
|
|
|
|
2002-08-27 15:51:19 +00:00
|
|
|
if (cit == layoutlist_.end()) {
|
2002-03-02 16:39:54 +00:00
|
|
|
lyxerr << "We failed to find the layout '" << name
|
|
|
|
<< "' in the layout list. You MUST investigate!"
|
|
|
|
<< endl;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2002-03-02 16:39:54 +00:00
|
|
|
// we require the name to exist
|
|
|
|
lyx::Assert(false);
|
|
|
|
}
|
|
|
|
|
2002-03-12 18:11:49 +00:00
|
|
|
lastLayoutName = name;
|
2002-08-27 15:51:19 +00:00
|
|
|
lastLayoutIndex = std::distance(layoutlist_.begin(), cit);
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2002-06-24 20:28:12 +00:00
|
|
|
return (*cit);
|
2001-12-28 13:26:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-03-14 11:57:12 +00:00
|
|
|
LyXLayout_ptr const & LyXTextClass::getEnv(string const & name) const
|
|
|
|
{
|
|
|
|
lyx::Assert(!name.empty());
|
|
|
|
|
|
|
|
if (name.empty())
|
|
|
|
lyxerr << "LyXTextClass::getEnv() called with empty n" << endl;
|
|
|
|
|
|
|
|
LayoutList::const_iterator cit =
|
|
|
|
find_if(envlist_.begin(), envlist_.end(), compare_name(name));
|
|
|
|
|
|
|
|
if (cit == envlist_.end()) {
|
|
|
|
lyxerr << "We failed to find the environment '" << name
|
|
|
|
<< "' in the layout list. You MUST investigate!"
|
|
|
|
<< endl;
|
|
|
|
// we require the name to exist
|
|
|
|
lyx::Assert(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
return *cit;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-03 20:25:07 +00:00
|
|
|
bool LyXTextClass::delete_layout(string const & name)
|
2001-12-28 13:26:54 +00:00
|
|
|
{
|
2002-03-02 16:39:54 +00:00
|
|
|
if (name == defaultLayoutName())
|
|
|
|
return false;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
LayoutList::iterator it =
|
2002-08-27 15:51:19 +00:00
|
|
|
remove_if(layoutlist_.begin(), layoutlist_.end(),
|
2002-06-24 20:28:12 +00:00
|
|
|
compare_name(name));
|
|
|
|
|
2002-08-27 15:51:19 +00:00
|
|
|
LayoutList::iterator end = layoutlist_.end();
|
2001-12-28 13:26:54 +00:00
|
|
|
bool const ret = (it != end);
|
2002-08-27 15:51:19 +00:00
|
|
|
layoutlist_.erase(it, end);
|
2001-12-28 13:26:54 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Load textclass info if not loaded yet
|
2002-03-02 16:39:54 +00:00
|
|
|
bool LyXTextClass::load() const
|
2001-12-28 13:26:54 +00:00
|
|
|
{
|
2002-03-02 16:39:54 +00:00
|
|
|
if (loaded)
|
|
|
|
return true;
|
2001-12-28 13:26:54 +00:00
|
|
|
|
|
|
|
// Read style-file
|
|
|
|
string const real_file = LibFileSearch("layouts", name_, "layout");
|
|
|
|
|
2002-03-02 16:39:54 +00:00
|
|
|
if (const_cast<LyXTextClass*>(this)->Read(real_file)) {
|
2001-12-28 13:26:54 +00:00
|
|
|
lyxerr << "Error reading `"
|
|
|
|
<< MakeDisplayPath(real_file)
|
|
|
|
<< "'\n(Check `" << name_
|
|
|
|
<< "')\nCheck your installation and "
|
|
|
|
"try Options/Reconfigure..." << endl;
|
2002-03-02 16:39:54 +00:00
|
|
|
loaded = false;
|
2001-12-28 13:26:54 +00:00
|
|
|
}
|
|
|
|
loaded = true;
|
2002-03-02 16:39:54 +00:00
|
|
|
return loaded;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-08-27 15:51:19 +00:00
|
|
|
FloatList & LyXTextClass::floats()
|
|
|
|
{
|
2002-09-11 07:39:55 +00:00
|
|
|
return *floatlist_.get();
|
2002-08-27 15:51:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FloatList const & LyXTextClass::floats() const
|
|
|
|
{
|
2002-09-11 07:39:55 +00:00
|
|
|
return *floatlist_.get();
|
2002-08-27 15:51:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-09-06 14:48:01 +00:00
|
|
|
Counters & LyXTextClass::counters() const
|
|
|
|
{
|
|
|
|
return *ctrs_.get();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string const & LyXTextClass::defaultLayoutName() const
|
2002-03-02 16:39:54 +00:00
|
|
|
{
|
|
|
|
// This really should come from the actual layout... (Lgb)
|
|
|
|
return defaultlayout_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-06-24 20:28:12 +00:00
|
|
|
LyXLayout_ptr const & LyXTextClass::defaultLayout() const
|
2002-03-02 16:39:54 +00:00
|
|
|
{
|
|
|
|
return operator[](defaultLayoutName());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string const & LyXTextClass::name() const
|
|
|
|
{
|
|
|
|
return name_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string const & LyXTextClass::latexname() const
|
|
|
|
{
|
|
|
|
const_cast<LyXTextClass*>(this)->load();
|
|
|
|
return latexname_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string const & LyXTextClass::description() const
|
|
|
|
{
|
|
|
|
return description_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string const & LyXTextClass::opt_fontsize() const
|
|
|
|
{
|
|
|
|
return opt_fontsize_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string const & LyXTextClass::opt_pagestyle() const
|
|
|
|
{
|
|
|
|
return opt_pagestyle_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string const & LyXTextClass::options() const
|
|
|
|
{
|
|
|
|
return options_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string const & LyXTextClass::pagestyle() const
|
|
|
|
{
|
|
|
|
return pagestyle_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string const & LyXTextClass::preamble() const
|
|
|
|
{
|
|
|
|
return preamble_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
LyXTextClass::PageSides LyXTextClass::sides() const
|
|
|
|
{
|
|
|
|
return sides_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int LyXTextClass::secnumdepth() const
|
|
|
|
{
|
|
|
|
return secnumdepth_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int LyXTextClass::tocdepth() const
|
|
|
|
{
|
|
|
|
return tocdepth_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
OutputType LyXTextClass::outputType() const
|
|
|
|
{
|
|
|
|
return outputType_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool LyXTextClass::provides(LyXTextClass::Provides p) const
|
|
|
|
{
|
|
|
|
return provides_ & p;
|
|
|
|
}
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2002-03-02 16:39:54 +00:00
|
|
|
|
|
|
|
unsigned int LyXTextClass::columns() const
|
|
|
|
{
|
|
|
|
return columns_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int LyXTextClass::maxcounter() const
|
|
|
|
{
|
|
|
|
return maxcounter_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-02-13 17:49:09 +00:00
|
|
|
LYX_TITLE_LATEX_TYPES LyXTextClass::titletype() const
|
|
|
|
{
|
|
|
|
return titletype_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string const & LyXTextClass::titlename() const
|
|
|
|
{
|
|
|
|
return titlename_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2002-03-02 16:39:54 +00:00
|
|
|
int LyXTextClass::size() const
|
|
|
|
{
|
2002-08-27 15:51:19 +00:00
|
|
|
return layoutlist_.size();
|
2001-12-28 13:26:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-02-16 15:59:55 +00:00
|
|
|
ostream & operator<<(ostream & os, LyXTextClass::PageSides p)
|
2001-12-28 13:26:54 +00:00
|
|
|
{
|
|
|
|
switch (p) {
|
|
|
|
case LyXTextClass::OneSide:
|
2002-11-27 10:30:28 +00:00
|
|
|
os << '1';
|
2001-12-28 13:26:54 +00:00
|
|
|
break;
|
|
|
|
case LyXTextClass::TwoSides:
|
2002-11-27 10:30:28 +00:00
|
|
|
os << '2';
|
2001-12-28 13:26:54 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return os;
|
|
|
|
}
|