1999-09-27 18:44:28 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/* This file is part of
|
|
|
|
* ======================================================
|
1999-11-04 01:40:20 +00:00
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
|
|
|
* Copyright 1995 Matthias Ettrich
|
2001-05-30 13:53:44 +00:00
|
|
|
* Copyright 1995-2001 The LyX Team.
|
1999-11-04 01:40:20 +00:00
|
|
|
*
|
|
|
|
* ====================================================== */
|
1999-09-27 18:44:28 +00:00
|
|
|
|
1999-11-04 01:40:20 +00:00
|
|
|
#ifndef LAYOUT_H
|
|
|
|
#define LAYOUT_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2000-04-08 17:02:02 +00:00
|
|
|
#include <vector>
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
2001-07-29 15:34:18 +00:00
|
|
|
class LyXLeX;
|
1999-09-27 18:44:28 +00:00
|
|
|
#include "lyxfont.h"
|
|
|
|
#include "Spacing.h"
|
2000-10-02 00:55:02 +00:00
|
|
|
#include <boost/utility.hpp>
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/// Reads the style files
|
1999-11-04 01:40:20 +00:00
|
|
|
extern void LyXSetStyle();
|
1999-09-27 18:44:28 +00:00
|
|
|
|
1999-11-15 12:01:38 +00:00
|
|
|
///
|
2000-08-07 20:58:24 +00:00
|
|
|
enum no_good_name_for_this {
|
1999-11-15 12:01:38 +00:00
|
|
|
///
|
|
|
|
LYX_ENVIRONMENT_DEFAULT = 97,
|
|
|
|
///
|
|
|
|
LYX_LAYOUT_DEFAULT = 99
|
|
|
|
};
|
2000-07-24 21:49:58 +00:00
|
|
|
|
|
|
|
|
1999-11-15 12:01:38 +00:00
|
|
|
// Could this cause confusion that both DUMMY_LAYOUT and LAYOUT_DEFAULT has
|
|
|
|
// the same value? (Lgb)
|
|
|
|
///
|
|
|
|
#define LYX_DUMMY_LAYOUT 99
|
|
|
|
|
2000-07-24 21:49:58 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/// The different output types
|
|
|
|
enum OutputType {
|
|
|
|
///
|
2000-02-29 02:19:17 +00:00
|
|
|
LATEX = 1,
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
LINUXDOC,
|
|
|
|
///
|
|
|
|
DOCBOOK,
|
|
|
|
///
|
|
|
|
LITERATE
|
|
|
|
};
|
|
|
|
|
|
|
|
/// The different margin types
|
|
|
|
enum LYX_MARGIN_TYPE {
|
|
|
|
///
|
2000-02-29 02:19:17 +00:00
|
|
|
MARGIN_MANUAL = 1,
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
MARGIN_FIRST_DYNAMIC,
|
|
|
|
///
|
|
|
|
MARGIN_DYNAMIC,
|
|
|
|
///
|
|
|
|
MARGIN_STATIC,
|
|
|
|
///
|
|
|
|
MARGIN_RIGHT_ADDRESS_BOX
|
|
|
|
};
|
|
|
|
|
2000-02-03 19:51:27 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
enum LyXAlignment {
|
|
|
|
///
|
|
|
|
LYX_ALIGN_NONE = 0,
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
LYX_ALIGN_BLOCK = 1,
|
|
|
|
///
|
|
|
|
LYX_ALIGN_LEFT = 2,
|
|
|
|
///
|
|
|
|
LYX_ALIGN_RIGHT = 4,
|
|
|
|
///
|
|
|
|
LYX_ALIGN_CENTER = 8,
|
|
|
|
///
|
|
|
|
LYX_ALIGN_LAYOUT = 16,
|
|
|
|
///
|
|
|
|
LYX_ALIGN_SPECIAL = 32
|
|
|
|
};
|
1999-12-16 06:43:25 +00:00
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-03-07 01:14:37 +00:00
|
|
|
inline
|
|
|
|
void operator|=(LyXAlignment & la1, LyXAlignment la2) {
|
1999-11-04 01:40:20 +00:00
|
|
|
la1 = static_cast<LyXAlignment>(la1 | la2);
|
|
|
|
}
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/// The different LaTeX-Types
|
|
|
|
enum LYX_LATEX_TYPES {
|
|
|
|
///
|
2000-02-29 02:19:17 +00:00
|
|
|
LATEX_PARAGRAPH = 1,
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
LATEX_COMMAND,
|
|
|
|
///
|
|
|
|
LATEX_ENVIRONMENT,
|
|
|
|
///
|
|
|
|
LATEX_ITEM_ENVIRONMENT,
|
|
|
|
///
|
|
|
|
LATEX_LIST_ENVIRONMENT
|
|
|
|
};
|
|
|
|
|
|
|
|
/// The different label types
|
|
|
|
enum LYX_LABEL_TYPES {
|
|
|
|
///
|
|
|
|
LABEL_NO_LABEL,
|
|
|
|
///
|
|
|
|
LABEL_MANUAL,
|
|
|
|
///
|
|
|
|
LABEL_BIBLIO,
|
|
|
|
///
|
|
|
|
LABEL_TOP_ENVIRONMENT,
|
|
|
|
///
|
|
|
|
LABEL_CENTERED_TOP_ENVIRONMENT,
|
|
|
|
|
|
|
|
// the flushright labels following now must start with LABEL_STATIC
|
|
|
|
///
|
|
|
|
LABEL_STATIC,
|
|
|
|
///
|
|
|
|
LABEL_SENSITIVE,
|
|
|
|
///
|
|
|
|
LABEL_COUNTER_CHAPTER,
|
|
|
|
///
|
|
|
|
LABEL_COUNTER_SECTION,
|
|
|
|
///
|
|
|
|
LABEL_COUNTER_SUBSECTION,
|
|
|
|
///
|
|
|
|
LABEL_COUNTER_SUBSUBSECTION,
|
|
|
|
///
|
|
|
|
LABEL_COUNTER_PARAGRAPH,
|
|
|
|
///
|
|
|
|
LABEL_COUNTER_SUBPARAGRAPH,
|
|
|
|
///
|
|
|
|
LABEL_COUNTER_ENUMI,
|
|
|
|
///
|
|
|
|
LABEL_COUNTER_ENUMII,
|
|
|
|
///
|
|
|
|
LABEL_COUNTER_ENUMIII,
|
|
|
|
///
|
2000-07-17 18:27:53 +00:00
|
|
|
LABEL_COUNTER_ENUMIV
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-03-10 13:22:20 +00:00
|
|
|
enum LYX_END_LABEL_TYPES {
|
|
|
|
///
|
|
|
|
END_LABEL_NO_LABEL,
|
|
|
|
///
|
|
|
|
END_LABEL_BOX,
|
|
|
|
///
|
|
|
|
END_LABEL_FILLED_BOX,
|
|
|
|
///
|
2000-05-12 13:11:20 +00:00
|
|
|
END_LABEL_STATIC,
|
|
|
|
///
|
2000-03-10 13:22:20 +00:00
|
|
|
END_LABEL_ENUM_FIRST = END_LABEL_NO_LABEL,
|
|
|
|
///
|
2000-05-12 13:11:20 +00:00
|
|
|
END_LABEL_ENUM_LAST = END_LABEL_STATIC
|
2000-03-10 13:22:20 +00:00
|
|
|
};
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/* Fix labels are printed flushright, manual labels flushleft.
|
1999-11-04 01:40:20 +00:00
|
|
|
* MARGIN_MANUAL and MARGIN_FIRST_DYNAMIC are *only* for LABEL_MANUAL,
|
|
|
|
* MARGIN_DYNAMIC and MARGIN_STATIC are *not* for LABEL_MANUAL.
|
|
|
|
* This seems a funny restriction, but I think other combinations are
|
|
|
|
* not needed, so I will not change it yet.
|
|
|
|
* Correction: MARGIN_FIRST_DYNAMIC also usable with LABEL_STATIC
|
|
|
|
*/
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* There is a parindent and a parskip. Which one is used depends on the
|
1999-11-04 01:40:20 +00:00
|
|
|
* paragraph_separation-flag of the text-object.
|
|
|
|
* BUT: parindent is only thrown away, if a parskip is defined! So if you
|
|
|
|
* want a space between the paragraphs and a parindent at the same time,
|
|
|
|
* you should set parskip to zero and use topsep, parsep and bottomsep.
|
|
|
|
*
|
|
|
|
* The standard layout is an exception: its parindent is only set, if the
|
|
|
|
* previous paragraph is standard too. Well, this is LateX and it is good!
|
|
|
|
*/
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
// Attributes of a layout/paragraph environment
|
1999-11-04 01:40:20 +00:00
|
|
|
class LyXTextClass;
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
class LyXLayout {
|
|
|
|
public:
|
|
|
|
///
|
|
|
|
LyXLayout ();
|
|
|
|
|
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
bool Read (LyXLex &, LyXTextClass const &);
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
1999-12-01 00:57:31 +00:00
|
|
|
void readAlign(LyXLex &);
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
1999-12-01 00:57:31 +00:00
|
|
|
void readAlignPossible(LyXLex &);
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
1999-12-01 00:57:31 +00:00
|
|
|
void readLabelType(LyXLex &);
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-03-10 13:22:20 +00:00
|
|
|
void readEndLabelType(LyXLex &);
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
1999-12-01 00:57:31 +00:00
|
|
|
void readMargin(LyXLex &);
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
1999-12-01 00:57:31 +00:00
|
|
|
void readLatexType(LyXLex &);
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
1999-12-01 00:57:31 +00:00
|
|
|
void readSpacing(LyXLex &);
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
string const & name() const { return name_; }
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-10-12 00:11:06 +00:00
|
|
|
void setName(string const & n) { name_ = n; }
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
string const & obsoleted_by() const { return obsoleted_by_; }
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
string const & latexname() const { return latexname_; }
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
string const & labelstring() const { return labelstring_; }
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-05-12 13:11:20 +00:00
|
|
|
string const & endlabelstring() const { return endlabelstring_; }
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
string const & preamble() const { return preamble_; }
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
string const & latexparam() const { return latexparam_; }
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
1999-12-16 06:43:25 +00:00
|
|
|
string const & labelstring_appendix() const {
|
|
|
|
return labelstring_appendix_;
|
|
|
|
}
|
1999-11-04 01:40:20 +00:00
|
|
|
/** Default font for this layout/environment.
|
|
|
|
The main font for this kind of environment. If an attribute has
|
|
|
|
LyXFont::INHERITED_*, it means that the value is specified by
|
|
|
|
the defaultfont for the entire layout. If we are nested, the
|
|
|
|
font is inherited from the font in the environment one level
|
|
|
|
up until the font is resolved. The values LyXFont::IGNORE_*
|
|
|
|
and LyXFont::TOGGLE are illegal here.
|
1999-09-27 18:44:28 +00:00
|
|
|
*/
|
|
|
|
LyXFont font;
|
|
|
|
|
1999-11-04 01:40:20 +00:00
|
|
|
/** Default font for labels.
|
|
|
|
Interpretation the same as for font above
|
|
|
|
*/
|
1999-09-27 18:44:28 +00:00
|
|
|
LyXFont labelfont;
|
|
|
|
|
1999-11-04 01:40:20 +00:00
|
|
|
/** Resolved version of the font for this layout/environment.
|
|
|
|
This is a resolved version the default font. The font is resolved
|
|
|
|
against the defaultfont of the entire layout.
|
|
|
|
*/
|
1999-09-27 18:44:28 +00:00
|
|
|
LyXFont resfont;
|
|
|
|
|
1999-11-04 01:40:20 +00:00
|
|
|
/** Resolved version of the font used for labels.
|
|
|
|
This is a resolved version the label font. The font is resolved
|
|
|
|
against the defaultfont of the entire layout.
|
|
|
|
*/
|
1999-09-27 18:44:28 +00:00
|
|
|
LyXFont reslabelfont;
|
|
|
|
|
|
|
|
/// Text that dictates how wide the left margin is on the screen
|
1999-10-02 16:21:10 +00:00
|
|
|
string leftmargin;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/// Text that dictates how wide the right margin is on the screen
|
1999-10-02 16:21:10 +00:00
|
|
|
string rightmargin;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/// Text that dictates how much space to leave after a potential label
|
1999-10-02 16:21:10 +00:00
|
|
|
string labelsep;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/// Text that dictates how much space to leave before a potential label
|
1999-10-02 16:21:10 +00:00
|
|
|
string labelindent;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
1999-11-04 01:40:20 +00:00
|
|
|
/** Text that dictates the width of the indentation of
|
|
|
|
indented paragraphs.
|
|
|
|
*/
|
1999-10-02 16:21:10 +00:00
|
|
|
string parindent;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
///
|
|
|
|
float parskip;
|
|
|
|
|
|
|
|
///
|
|
|
|
float itemsep;
|
|
|
|
|
|
|
|
///
|
|
|
|
float topsep;
|
|
|
|
|
|
|
|
///
|
|
|
|
float bottomsep;
|
|
|
|
|
|
|
|
///
|
|
|
|
float labelbottomsep;
|
|
|
|
|
|
|
|
///
|
|
|
|
float parsep;
|
|
|
|
|
|
|
|
///
|
|
|
|
Spacing spacing;
|
|
|
|
|
|
|
|
///
|
2000-01-06 02:44:26 +00:00
|
|
|
LyXAlignment align;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
///
|
2000-01-06 02:44:26 +00:00
|
|
|
LyXAlignment alignpossible;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
///
|
2000-01-06 02:44:26 +00:00
|
|
|
char labeltype; // add approp. type
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2000-03-10 13:22:20 +00:00
|
|
|
///
|
|
|
|
char endlabeltype;
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-02-29 02:19:17 +00:00
|
|
|
LYX_MARGIN_TYPE margintype;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
///
|
|
|
|
bool fill_top;
|
|
|
|
|
|
|
|
///
|
|
|
|
bool fill_bottom;
|
|
|
|
|
|
|
|
///
|
|
|
|
bool newline_allowed;
|
|
|
|
|
|
|
|
///
|
|
|
|
bool nextnoindent;
|
|
|
|
|
|
|
|
///
|
|
|
|
bool free_spacing;
|
2001-07-17 09:41:34 +00:00
|
|
|
|
|
|
|
///
|
|
|
|
bool pass_thru;
|
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
/** true when the fragile commands in the paragraph need to be
|
|
|
|
\protect'ed. */
|
1999-09-27 18:44:28 +00:00
|
|
|
bool needprotect;
|
|
|
|
/// true when empty paragraphs should be kept.
|
|
|
|
bool keepempty;
|
|
|
|
///
|
|
|
|
bool isParagraph() const {
|
|
|
|
return latextype == LATEX_PARAGRAPH;
|
|
|
|
}
|
|
|
|
///
|
|
|
|
bool isCommand() const {
|
1999-12-16 06:43:25 +00:00
|
|
|
return latextype == LATEX_COMMAND;
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
///
|
|
|
|
bool isEnvironment() const {
|
|
|
|
return (latextype == LATEX_ENVIRONMENT
|
|
|
|
|| latextype == LATEX_ITEM_ENVIRONMENT
|
|
|
|
|| latextype == LATEX_LIST_ENVIRONMENT);
|
|
|
|
}
|
|
|
|
/// Type of LaTeX object
|
|
|
|
LYX_LATEX_TYPES latextype;
|
|
|
|
/// Does this object belong in the title part of the document?
|
|
|
|
bool intitle;
|
1999-11-04 01:40:20 +00:00
|
|
|
private:
|
|
|
|
/// Name of the layout/paragraph environment
|
|
|
|
string name_;
|
|
|
|
|
|
|
|
/** Name of an layout that has replaced this layout.
|
|
|
|
This is used to rename a layout, while keeping backward
|
|
|
|
compatibility
|
|
|
|
*/
|
|
|
|
string obsoleted_by_;
|
|
|
|
|
|
|
|
/// LaTeX name for environment
|
|
|
|
string latexname_;
|
|
|
|
|
|
|
|
/// Label string. "Abstract", "Reference", "Caption"...
|
|
|
|
string labelstring_;
|
|
|
|
|
2000-05-12 13:11:20 +00:00
|
|
|
///
|
|
|
|
string endlabelstring_;
|
|
|
|
|
1999-11-04 01:40:20 +00:00
|
|
|
/// Label string inside appendix. "Appendix", ...
|
|
|
|
string labelstring_appendix_;
|
|
|
|
|
|
|
|
/// LaTeX parameter for environment
|
|
|
|
string latexparam_;
|
|
|
|
|
|
|
|
/// Macro definitions needed for this layout
|
|
|
|
string preamble_;
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
class LyXTextClass {
|
1999-09-27 18:44:28 +00:00
|
|
|
public:
|
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
typedef std::vector<LyXLayout> LayoutList;
|
1999-12-21 06:10:21 +00:00
|
|
|
///
|
|
|
|
typedef LayoutList::const_iterator const_iterator;
|
2000-01-06 02:44:26 +00:00
|
|
|
///
|
|
|
|
typedef LayoutList::size_type size_type;
|
1999-11-04 01:40:20 +00:00
|
|
|
///
|
2000-04-08 17:02:02 +00:00
|
|
|
explicit
|
1999-11-04 01:40:20 +00:00
|
|
|
LyXTextClass (string const & = string(),
|
|
|
|
string const & = string(),
|
|
|
|
string const & = string());
|
|
|
|
|
|
|
|
///
|
1999-12-21 06:10:21 +00:00
|
|
|
const_iterator begin() const { return layoutlist.begin(); }
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-12-21 06:10:21 +00:00
|
|
|
const_iterator end() const { return layoutlist.end(); }
|
1999-11-04 01:40:20 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
bool Read(string const & filename, bool merge = false);
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
1999-12-01 00:57:31 +00:00
|
|
|
void readOutputType(LyXLex &);
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
1999-12-01 00:57:31 +00:00
|
|
|
void readMaxCounter(LyXLex &);
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
1999-12-01 00:57:31 +00:00
|
|
|
void readClassOptions(LyXLex &);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
bool hasLayout(string const & name) const;
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
LyXLayout const & GetLayout(string const & vname) const;
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
LyXLayout & GetLayout(string const & vname);
|
|
|
|
|
|
|
|
/// Sees to that the textclass structure has been loaded
|
|
|
|
void load();
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
string const & name() const { return name_; }
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
string const & latexname() const { return latexname_; }
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
string const & description() const { return description_; }
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
string const & opt_fontsize() const { return opt_fontsize_; }
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
string const & opt_pagestyle() const { return opt_pagestyle_; }
|
|
|
|
///
|
|
|
|
string const & options() const { return options_; }
|
|
|
|
///
|
|
|
|
string const & pagestyle() const { return pagestyle_; }
|
|
|
|
///
|
|
|
|
string const & preamble() const { return preamble_; }
|
1999-09-27 18:44:28 +00:00
|
|
|
|
1999-11-04 01:40:20 +00:00
|
|
|
/// Packages that are already loaded by the class
|
|
|
|
enum Provides {
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
nothing = 0,
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
amsmath = 1,
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
makeidx = 2,
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
url = 4
|
|
|
|
};
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
bool provides(Provides p) const { return provides_ & p; }
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
unsigned int columns() const { return columns_; }
|
|
|
|
///
|
|
|
|
enum PageSides {
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
OneSide,
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
TwoSides
|
|
|
|
};
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
PageSides sides() const { return sides_; }
|
|
|
|
///
|
|
|
|
int secnumdepth() const { return secnumdepth_; }
|
|
|
|
///
|
|
|
|
int tocdepth() const { return tocdepth_; }
|
1999-09-27 18:44:28 +00:00
|
|
|
|
1999-11-04 01:40:20 +00:00
|
|
|
///
|
|
|
|
OutputType outputType() const { return outputType_; }
|
1999-09-27 18:44:28 +00:00
|
|
|
|
1999-11-04 01:40:20 +00:00
|
|
|
///
|
|
|
|
LyXFont const & defaultfont() const { return defaultfont_; }
|
1999-09-27 18:44:28 +00:00
|
|
|
|
1999-11-04 01:40:20 +00:00
|
|
|
/// Text that dictates how wide the left margin is on the screen
|
|
|
|
string const & leftmargin() const { return leftmargin_; }
|
1999-09-27 18:44:28 +00:00
|
|
|
|
1999-11-04 01:40:20 +00:00
|
|
|
/// Text that dictates how wide the right margin is on the screen
|
|
|
|
string const & rightmargin() const { return rightmargin_; }
|
|
|
|
///
|
|
|
|
int maxcounter() const { return maxcounter_; }
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-01-06 02:44:26 +00:00
|
|
|
size_type numLayouts() const { return layoutlist.size(); }
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-01-06 02:44:26 +00:00
|
|
|
LyXLayout const & operator[](size_type i) const {
|
1999-11-04 01:40:20 +00:00
|
|
|
return layoutlist[i];
|
|
|
|
}
|
|
|
|
private:
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
bool delete_layout(string const &);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
bool do_readStyle(LyXLex &, LyXLayout &);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
string name_;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
string latexname_;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
string description_;
|
|
|
|
/// Specific class options
|
|
|
|
string opt_fontsize_;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
string opt_pagestyle_;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
string options_;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
string pagestyle_;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
string preamble_;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
Provides provides_;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
unsigned int columns_;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
PageSides sides_;
|
|
|
|
///
|
|
|
|
int secnumdepth_;
|
|
|
|
///
|
|
|
|
int tocdepth_;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
OutputType outputType_;
|
|
|
|
/** Base font. The paragraph and layout fonts are resolved against
|
|
|
|
this font. This has to be fully instantiated. Attributes
|
|
|
|
LyXFont::INHERIT, LyXFont::IGNORE, and LyXFont::TOGGLE are
|
|
|
|
extremely illegal.
|
|
|
|
*/
|
|
|
|
LyXFont defaultfont_;
|
|
|
|
/// Text that dictates how wide the left margin is on the screen
|
|
|
|
string leftmargin_;
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/// Text that dictates how wide the right margin is on the screen
|
1999-11-04 01:40:20 +00:00
|
|
|
string rightmargin_;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
int maxcounter_; // add approp. signedness
|
|
|
|
|
|
|
|
///
|
|
|
|
LayoutList layoutlist;
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/// Has this layout file been loaded yet?
|
|
|
|
bool loaded;
|
|
|
|
};
|
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-03-07 01:14:37 +00:00
|
|
|
inline
|
|
|
|
void operator|=(LyXTextClass::Provides & p1, LyXTextClass::Provides p2)
|
1999-11-04 01:40:20 +00:00
|
|
|
{
|
|
|
|
p1 = static_cast<LyXTextClass::Provides>(p1 | p2);
|
|
|
|
}
|
|
|
|
|
1999-12-16 06:43:25 +00:00
|
|
|
|
1999-12-07 00:44:53 +00:00
|
|
|
///
|
2000-04-08 17:02:02 +00:00
|
|
|
std::ostream & operator<<(std::ostream & os, LyXTextClass::PageSides p);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
1999-12-16 06:43:25 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-04-17 14:00:20 +00:00
|
|
|
class LyXTextClassList : boost::noncopyable {
|
1999-09-27 18:44:28 +00:00
|
|
|
public:
|
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
typedef std::vector<LyXTextClass> ClassList;
|
1999-12-21 06:10:21 +00:00
|
|
|
///
|
|
|
|
typedef ClassList::const_iterator const_iterator;
|
|
|
|
///
|
2000-01-06 02:44:26 +00:00
|
|
|
typedef ClassList::size_type size_type;
|
|
|
|
///
|
1999-12-21 06:10:21 +00:00
|
|
|
const_iterator begin() const { return classlist.begin(); }
|
|
|
|
///
|
|
|
|
const_iterator end() const { return classlist.end(); }
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/// Gets layout structure from layout number and textclass number
|
2000-01-06 02:44:26 +00:00
|
|
|
LyXLayout const & Style(size_type textclass,
|
|
|
|
LyXTextClass::size_type layout) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/// Gets layout number from textclass number and layout name
|
2000-09-14 17:53:12 +00:00
|
|
|
std::pair<bool, LyXTextClass::size_type> const
|
2000-01-06 02:44:26 +00:00
|
|
|
NumberOfLayout(size_type textclass,
|
1999-11-04 01:40:20 +00:00
|
|
|
string const & name) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/// Gets a layout name from layout number and textclass number
|
1999-11-04 01:40:20 +00:00
|
|
|
string const &
|
2000-01-06 02:44:26 +00:00
|
|
|
NameOfLayout(size_type textclass,
|
|
|
|
LyXTextClass::size_type layout) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
1999-11-04 01:40:20 +00:00
|
|
|
/** Gets textclass number from name.
|
|
|
|
Returns -1 if textclass name does not exist
|
|
|
|
*/
|
2000-09-14 17:53:12 +00:00
|
|
|
std::pair<bool, size_type> const
|
1999-11-04 01:40:20 +00:00
|
|
|
NumberOfClass(string const & textclass) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
///
|
2000-01-06 02:44:26 +00:00
|
|
|
string const & NameOfClass(size_type number) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
///
|
2000-01-06 02:44:26 +00:00
|
|
|
string const & LatexnameOfClass(size_type number) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
///
|
2000-01-06 02:44:26 +00:00
|
|
|
string const & DescOfClass(size_type number) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
///
|
2000-01-06 02:44:26 +00:00
|
|
|
LyXTextClass const & TextClass(size_type textclass) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
1999-11-04 01:40:20 +00:00
|
|
|
/** Read textclass list.
|
|
|
|
Returns false if this fails
|
|
|
|
*/
|
1999-09-27 18:44:28 +00:00
|
|
|
bool Read();
|
|
|
|
|
1999-11-04 01:40:20 +00:00
|
|
|
/** Load textclass.
|
|
|
|
Returns false if this fails
|
|
|
|
*/
|
2000-01-06 02:44:26 +00:00
|
|
|
bool Load(size_type number) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
private:
|
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
mutable ClassList classlist;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
void Add (LyXTextClass const &);
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
extern LyXTextClassList textclasslist;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
#endif
|