2001-12-28 13:26:54 +00:00
|
|
|
// -*- C++ -*-
|
2002-11-07 19:51:22 +00:00
|
|
|
/**
|
2007-04-29 19:53:54 +00:00
|
|
|
* \file TextClass.h
|
2002-11-07 19:51:22 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-03-21 17:27:08 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-11-07 19:51:22 +00:00
|
|
|
*/
|
2001-12-28 13:26:54 +00:00
|
|
|
|
|
|
|
#ifndef LYXTEXTCLASS_H
|
|
|
|
#define LYXTEXTCLASS_H
|
|
|
|
|
2007-08-27 08:36:18 +00:00
|
|
|
#include "Color.h"
|
2007-09-29 20:02:32 +00:00
|
|
|
#include "Font.h"
|
|
|
|
#include "LayoutEnums.h"
|
2007-10-23 21:41:17 +00:00
|
|
|
#include "LayoutPtr.h"
|
2001-12-28 13:26:54 +00:00
|
|
|
|
2002-09-06 14:48:01 +00:00
|
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
#include <vector>
|
2007-04-06 09:02:23 +00:00
|
|
|
#include <set>
|
2007-08-13 12:13:17 +00:00
|
|
|
#include <map>
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
2006-11-26 21:30:39 +00:00
|
|
|
namespace support { class FileName; }
|
|
|
|
|
2007-09-29 20:02:32 +00:00
|
|
|
class Layout;
|
2007-04-26 11:30:54 +00:00
|
|
|
class Lexer;
|
2002-09-06 14:48:01 +00:00
|
|
|
class Counters;
|
2002-09-11 07:39:55 +00:00
|
|
|
class FloatList;
|
2001-12-28 13:26:54 +00:00
|
|
|
|
2003-09-15 15:51:48 +00:00
|
|
|
|
2003-11-12 14:38:26 +00:00
|
|
|
///
|
2007-08-13 12:13:17 +00:00
|
|
|
class InsetLayout {
|
|
|
|
public:
|
2007-08-17 15:38:58 +00:00
|
|
|
std::string name;
|
|
|
|
std::string lyxtype;
|
2007-08-13 12:13:17 +00:00
|
|
|
docstring labelstring;
|
2007-08-25 09:57:32 +00:00
|
|
|
std::string decoration;
|
2007-08-13 12:13:17 +00:00
|
|
|
std::string latextype;
|
|
|
|
std::string latexname;
|
|
|
|
std::string latexparam;
|
|
|
|
Font font;
|
|
|
|
Font labelfont;
|
2007-08-26 20:32:58 +00:00
|
|
|
Color::color bgcolor;
|
2007-08-22 14:36:07 +00:00
|
|
|
std::string preamble;
|
2007-10-09 17:07:24 +00:00
|
|
|
bool multipar;
|
2007-10-20 17:07:08 +00:00
|
|
|
bool verbatim;
|
2007-08-13 12:13:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// List of inset layouts
|
|
|
|
typedef std::map<docstring, InsetLayout> InsetLayouts;
|
2003-11-12 14:38:26 +00:00
|
|
|
|
2002-11-07 19:51:22 +00:00
|
|
|
/// Stores the layout specification of a LyX document class.
|
2007-04-29 19:53:54 +00:00
|
|
|
class TextClass {
|
2001-12-28 13:26:54 +00:00
|
|
|
public:
|
2002-11-07 19:51:22 +00:00
|
|
|
/// The individual styles comprising the document class
|
2007-08-23 19:59:07 +00:00
|
|
|
typedef std::vector<LayoutPtr> LayoutList;
|
2002-11-07 19:51:22 +00:00
|
|
|
/// Enumerate the paragraph styles.
|
2001-12-28 13:26:54 +00:00
|
|
|
typedef LayoutList::const_iterator const_iterator;
|
2002-11-07 19:51:22 +00:00
|
|
|
/// Construct a layout with default values. Actual values loaded later.
|
2001-12-28 13:26:54 +00:00
|
|
|
explicit
|
2007-04-29 19:53:54 +00:00
|
|
|
TextClass(std::string const & = std::string(),
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string const & = std::string(),
|
|
|
|
std::string const & = std::string(),
|
This is one of a series of patches that will merge the layout modules development in personal/branches/rgheck back into the tree.
Design goal: Allow the use of layout "modules", which are to LaTeX packages as layout files are to LaTeX document classes. Thus, one could have a module that defined certain character styles, environments, commands, or what have you, and include it in various documents, each of which uses a different document class, without having to modify the layout files themselves. For example, a theorems.module could be used with article.layout to provide support for theorem-type environments, without having to modify article.layout itself, and the same module could be used with book.layout, etc.
This patch adds the backend. The ModuleList class holds a list of the available modules, which are retrieved from lyxmodules.lst, itself generated by configure.py. There are two LFUNs available: modules-clear and module-add, which do the obvious thing; you can test by typing these into the minibuffer, along with the name of one of the available modules: URL (a CharStyle), Endnote (a Custom Inset), and---with the spaces---End To Foot (View>LaTeX and look at the user preamble), which are themselves in lib/layouts. There are some others, too, that allow theorems to be added to classes like article and book.
The GUI will come next.
Issues: (i) The configure.py script could be improved. It'd be nice, for example, if it tested for the presence of the LaTeX packages a particular module needs. But this would mean re-working the LaTeX script, and I don't know how to do that. Note that at present, the packages are ignored. This will change shortly. (ii) I've used std::string in LyXModule, following what seemed to be a precedent in TextClass. If some of these should be docstrings, please let me know, and I'll change them. (iii) There is at present no distinction between LaTeX and DocBook modules. Should there be? That is: Should there be modules that are available when the document class is a LaTeX class and others that are available only when it is DocBook? Or should there just be one set of modules? Each module can of course indicate for what it is suitable in its description.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19893 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-29 17:59:49 +00:00
|
|
|
bool texClassAvail = false);
|
|
|
|
|
2003-05-03 19:24:36 +00:00
|
|
|
/// check whether the TeX class is available
|
|
|
|
bool isTeXClassAvailable() const;
|
2001-12-28 13:26:54 +00:00
|
|
|
|
2002-11-07 19:51:22 +00:00
|
|
|
/// paragraph styles begin iterator.
|
2002-08-27 15:51:19 +00:00
|
|
|
const_iterator begin() const { return layoutlist_.begin(); }
|
2002-11-07 19:51:22 +00:00
|
|
|
/// paragraph styles end iterator
|
2002-08-27 15:51:19 +00:00
|
|
|
const_iterator end() const { return layoutlist_.end(); }
|
2002-03-21 17:27:08 +00:00
|
|
|
|
This is one of a series of patches that will merge the layout modules development in personal/branches/rgheck back into the tree.
Design goal: Allow the use of layout "modules", which are to LaTeX packages as layout files are to LaTeX document classes. Thus, one could have a module that defined certain character styles, environments, commands, or what have you, and include it in various documents, each of which uses a different document class, without having to modify the layout files themselves. For example, a theorems.module could be used with article.layout to provide support for theorem-type environments, without having to modify article.layout itself, and the same module could be used with book.layout, etc.
This patch adds the backend. The ModuleList class holds a list of the available modules, which are retrieved from lyxmodules.lst, itself generated by configure.py. There are two LFUNs available: modules-clear and module-add, which do the obvious thing; you can test by typing these into the minibuffer, along with the name of one of the available modules: URL (a CharStyle), Endnote (a Custom Inset), and---with the spaces---End To Foot (View>LaTeX and look at the user preamble), which are themselves in lib/layouts. There are some others, too, that allow theorems to be added to classes like article and book.
The GUI will come next.
Issues: (i) The configure.py script could be improved. It'd be nice, for example, if it tested for the presence of the LaTeX packages a particular module needs. But this would mean re-working the LaTeX script, and I don't know how to do that. Note that at present, the packages are ignored. This will change shortly. (ii) I've used std::string in LyXModule, following what seemed to be a precedent in TextClass. If some of these should be docstrings, please let me know, and I'll change them. (iii) There is at present no distinction between LaTeX and DocBook modules. Should there be? That is: Should there be modules that are available when the document class is a LaTeX class and others that are available only when it is DocBook? Or should there just be one set of modules? Each module can of course indicate for what it is suitable in its description.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19893 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-29 17:59:49 +00:00
|
|
|
///Enum used with TextClass::read
|
|
|
|
enum ReadType {
|
|
|
|
BASECLASS, //>This is a base class, i.e., top-level layout file
|
|
|
|
MERGE, //>This is a file included in a layout file
|
|
|
|
MODULE //>This is a layout module
|
|
|
|
};
|
2002-11-07 19:51:22 +00:00
|
|
|
/// Performs the read of the layout file.
|
This is one of a series of patches that will merge the layout modules development in personal/branches/rgheck back into the tree.
Design goal: Allow the use of layout "modules", which are to LaTeX packages as layout files are to LaTeX document classes. Thus, one could have a module that defined certain character styles, environments, commands, or what have you, and include it in various documents, each of which uses a different document class, without having to modify the layout files themselves. For example, a theorems.module could be used with article.layout to provide support for theorem-type environments, without having to modify article.layout itself, and the same module could be used with book.layout, etc.
This patch adds the backend. The ModuleList class holds a list of the available modules, which are retrieved from lyxmodules.lst, itself generated by configure.py. There are two LFUNs available: modules-clear and module-add, which do the obvious thing; you can test by typing these into the minibuffer, along with the name of one of the available modules: URL (a CharStyle), Endnote (a Custom Inset), and---with the spaces---End To Foot (View>LaTeX and look at the user preamble), which are themselves in lib/layouts. There are some others, too, that allow theorems to be added to classes like article and book.
The GUI will come next.
Issues: (i) The configure.py script could be improved. It'd be nice, for example, if it tested for the presence of the LaTeX packages a particular module needs. But this would mean re-working the LaTeX script, and I don't know how to do that. Note that at present, the packages are ignored. This will change shortly. (ii) I've used std::string in LyXModule, following what seemed to be a precedent in TextClass. If some of these should be docstrings, please let me know, and I'll change them. (iii) There is at present no distinction between LaTeX and DocBook modules. Should there be? That is: Should there be modules that are available when the document class is a LaTeX class and others that are available only when it is DocBook? Or should there just be one set of modules? Each module can of course indicate for what it is suitable in its description.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19893 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-29 17:59:49 +00:00
|
|
|
bool read(support::FileName const & filename, ReadType rt = BASECLASS);
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2007-04-26 11:30:54 +00:00
|
|
|
void readOutputType(Lexer &);
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2007-04-26 11:30:54 +00:00
|
|
|
void readTitleType(Lexer &);
|
2003-02-13 17:49:09 +00:00
|
|
|
///
|
2007-04-26 11:30:54 +00:00
|
|
|
void readMaxCounter(Lexer &);
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2007-04-26 11:30:54 +00:00
|
|
|
void readClassOptions(Lexer &);
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2007-04-26 11:30:54 +00:00
|
|
|
void readCharStyle(Lexer &, std::string const &);
|
2003-11-12 14:38:26 +00:00
|
|
|
///
|
2007-08-13 12:13:17 +00:00
|
|
|
void readInsetLayout(Lexer &, docstring const &);
|
|
|
|
///
|
2007-04-26 11:30:54 +00:00
|
|
|
void readFloat(Lexer &);
|
2002-09-04 06:52:26 +00:00
|
|
|
///
|
2007-04-26 11:30:54 +00:00
|
|
|
void readCounter(Lexer &);
|
2002-09-06 14:48:01 +00:00
|
|
|
///
|
2007-07-11 13:39:08 +00:00
|
|
|
bool hasLayout(docstring const & name) const;
|
2001-12-28 13:26:54 +00:00
|
|
|
|
|
|
|
///
|
2007-08-23 19:59:07 +00:00
|
|
|
LayoutPtr const & operator[](docstring const & vname) const;
|
2001-12-28 13:26:54 +00:00
|
|
|
|
|
|
|
/// Sees to that the textclass structure has been loaded
|
2006-10-20 22:17:16 +00:00
|
|
|
bool load(std::string const & path = std::string()) const;
|
2004-03-30 16:19:50 +00:00
|
|
|
/// Has this layout file been loaded yet?
|
|
|
|
bool loaded() const { return loaded_; }
|
2001-12-28 13:26:54 +00:00
|
|
|
|
2002-11-07 19:51:22 +00:00
|
|
|
/// the list of floats defined in the document class
|
2002-08-27 15:51:19 +00:00
|
|
|
FloatList & floats();
|
2002-11-07 19:51:22 +00:00
|
|
|
/// the list of floats defined in the document class
|
2002-08-27 15:51:19 +00:00
|
|
|
FloatList const & floats() const;
|
2002-11-07 19:51:22 +00:00
|
|
|
/// The Counters present in this document class.
|
2002-09-06 14:48:01 +00:00
|
|
|
Counters & counters() const;
|
2007-08-25 07:46:42 +00:00
|
|
|
/// Inset layouts of this doc class
|
|
|
|
InsetLayouts & insetlayouts() const { return insetlayoutlist_; };
|
|
|
|
///
|
2007-08-13 12:13:17 +00:00
|
|
|
InsetLayout const & insetlayout(docstring const & name) const;
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2007-07-11 13:39:08 +00:00
|
|
|
docstring const & defaultLayoutName() const;
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2007-08-23 19:59:07 +00:00
|
|
|
LayoutPtr const & defaultLayout() const;
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string const & name() const;
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2007-08-13 12:13:17 +00:00
|
|
|
docstring const & labelstring() const;
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string const & latexname() const;
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string const & description() const;
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
This is one of a series of patches that will merge the layout modules development in personal/branches/rgheck back into the tree.
Design goal: Allow the use of layout "modules", which are to LaTeX packages as layout files are to LaTeX document classes. Thus, one could have a module that defined certain character styles, environments, commands, or what have you, and include it in various documents, each of which uses a different document class, without having to modify the layout files themselves. For example, a theorems.module could be used with article.layout to provide support for theorem-type environments, without having to modify article.layout itself, and the same module could be used with book.layout, etc.
This patch adds the backend. The ModuleList class holds a list of the available modules, which are retrieved from lyxmodules.lst, itself generated by configure.py. There are two LFUNs available: modules-clear and module-add, which do the obvious thing; you can test by typing these into the minibuffer, along with the name of one of the available modules: URL (a CharStyle), Endnote (a Custom Inset), and---with the spaces---End To Foot (View>LaTeX and look at the user preamble), which are themselves in lib/layouts. There are some others, too, that allow theorems to be added to classes like article and book.
The GUI will come next.
Issues: (i) The configure.py script could be improved. It'd be nice, for example, if it tested for the presence of the LaTeX packages a particular module needs. But this would mean re-working the LaTeX script, and I don't know how to do that. Note that at present, the packages are ignored. This will change shortly. (ii) I've used std::string in LyXModule, following what seemed to be a precedent in TextClass. If some of these should be docstrings, please let me know, and I'll change them. (iii) There is at present no distinction between LaTeX and DocBook modules. Should there be? That is: Should there be modules that are available when the document class is a LaTeX class and others that are available only when it is DocBook? Or should there just be one set of modules? Each module can of course indicate for what it is suitable in its description.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19893 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-29 17:59:49 +00:00
|
|
|
bool isModular() const { return modular_; }
|
|
|
|
/// Sets the layout as a modular one. There is never any
|
|
|
|
/// need to reset this.
|
|
|
|
void markAsModular() { modular_ = true; }
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string const & opt_fontsize() const;
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string const & opt_pagestyle() const;
|
2002-03-02 16:39:54 +00:00
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string const & options() const;
|
2002-03-02 16:39:54 +00:00
|
|
|
///
|
2003-11-27 16:57:12 +00:00
|
|
|
std::string const & class_header() const;
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string const & pagestyle() const;
|
2002-03-02 16:39:54 +00:00
|
|
|
///
|
2006-11-08 17:22:44 +00:00
|
|
|
docstring const & preamble() const;
|
2001-12-28 13:26:54 +00:00
|
|
|
|
2007-04-06 09:02:23 +00:00
|
|
|
/// is this feature already provided by the class?
|
|
|
|
bool provides(std::string const & p) const;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2002-03-02 16:39:54 +00:00
|
|
|
unsigned int columns() const;
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
|
|
|
enum PageSides {
|
|
|
|
///
|
|
|
|
OneSide,
|
|
|
|
///
|
|
|
|
TwoSides
|
|
|
|
};
|
|
|
|
///
|
2002-03-02 16:39:54 +00:00
|
|
|
PageSides sides() const;
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2002-03-02 16:39:54 +00:00
|
|
|
int secnumdepth() const;
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2002-03-02 16:39:54 +00:00
|
|
|
int tocdepth() const;
|
2001-12-28 13:26:54 +00:00
|
|
|
|
2006-08-23 12:43:46 +00:00
|
|
|
/// Can be LaTeX, DocBook, etc.
|
2002-03-02 16:39:54 +00:00
|
|
|
OutputType outputType() const;
|
2001-12-28 13:26:54 +00:00
|
|
|
|
|
|
|
///
|
2007-04-29 18:17:15 +00:00
|
|
|
Font const & defaultfont() const;
|
2001-12-28 13:26:54 +00:00
|
|
|
|
|
|
|
/// Text that dictates how wide the left margin is on the screen
|
2007-08-18 13:21:12 +00:00
|
|
|
docstring const & leftmargin() const;
|
2001-12-28 13:26:54 +00:00
|
|
|
|
|
|
|
/// Text that dictates how wide the right margin is on the screen
|
2007-08-18 13:21:12 +00:00
|
|
|
docstring const & rightmargin() const;
|
2003-02-13 17:49:09 +00:00
|
|
|
|
|
|
|
/// The type of command used to produce a title
|
2007-09-29 20:02:32 +00:00
|
|
|
TitleLatexType titletype() const;
|
2003-02-13 17:49:09 +00:00
|
|
|
/// The name of the title command
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string const & titlename() const;
|
2003-02-13 17:49:09 +00:00
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2002-03-02 16:39:54 +00:00
|
|
|
int size() const;
|
2005-05-12 10:16:04 +00:00
|
|
|
/// The minimal TocLevel of sectioning layouts
|
|
|
|
int min_toclevel() const;
|
|
|
|
/// The maximal TocLevel of sectioning layouts
|
|
|
|
int max_toclevel() const;
|
2006-03-24 11:57:19 +00:00
|
|
|
/// returns true if the class has a ToC structure
|
|
|
|
bool hasTocLevels() const;
|
2001-12-28 13:26:54 +00:00
|
|
|
private:
|
|
|
|
///
|
2007-07-11 13:39:08 +00:00
|
|
|
bool delete_layout(docstring const &);
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2007-04-29 18:58:28 +00:00
|
|
|
bool do_readStyle(Lexer &, Layout &);
|
2002-11-07 19:51:22 +00:00
|
|
|
/// Layout file name
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string name_;
|
2002-11-07 19:51:22 +00:00
|
|
|
/// document class name
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string latexname_;
|
2002-11-07 19:51:22 +00:00
|
|
|
/// document class description
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string description_;
|
This is one of a series of patches that will merge the layout modules development in personal/branches/rgheck back into the tree.
Design goal: Allow the use of layout "modules", which are to LaTeX packages as layout files are to LaTeX document classes. Thus, one could have a module that defined certain character styles, environments, commands, or what have you, and include it in various documents, each of which uses a different document class, without having to modify the layout files themselves. For example, a theorems.module could be used with article.layout to provide support for theorem-type environments, without having to modify article.layout itself, and the same module could be used with book.layout, etc.
This patch adds the backend. The ModuleList class holds a list of the available modules, which are retrieved from lyxmodules.lst, itself generated by configure.py. There are two LFUNs available: modules-clear and module-add, which do the obvious thing; you can test by typing these into the minibuffer, along with the name of one of the available modules: URL (a CharStyle), Endnote (a Custom Inset), and---with the spaces---End To Foot (View>LaTeX and look at the user preamble), which are themselves in lib/layouts. There are some others, too, that allow theorems to be added to classes like article and book.
The GUI will come next.
Issues: (i) The configure.py script could be improved. It'd be nice, for example, if it tested for the presence of the LaTeX packages a particular module needs. But this would mean re-working the LaTeX script, and I don't know how to do that. Note that at present, the packages are ignored. This will change shortly. (ii) I've used std::string in LyXModule, following what seemed to be a precedent in TextClass. If some of these should be docstrings, please let me know, and I'll change them. (iii) There is at present no distinction between LaTeX and DocBook modules. Should there be? That is: Should there be modules that are available when the document class is a LaTeX class and others that are available only when it is DocBook? Or should there just be one set of modules? Each module can of course indicate for what it is suitable in its description.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19893 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-29 17:59:49 +00:00
|
|
|
/// whether this is a modular layout, i.e., whether it has been
|
|
|
|
/// modified by loading of layout modules.
|
|
|
|
bool modular_;
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string opt_fontsize_;
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string opt_pagestyle_;
|
This is one of a series of patches that will merge the layout modules development in personal/branches/rgheck back into the tree.
Design goal: Allow the use of layout "modules", which are to LaTeX packages as layout files are to LaTeX document classes. Thus, one could have a module that defined certain character styles, environments, commands, or what have you, and include it in various documents, each of which uses a different document class, without having to modify the layout files themselves. For example, a theorems.module could be used with article.layout to provide support for theorem-type environments, without having to modify article.layout itself, and the same module could be used with book.layout, etc.
This patch adds the backend. The ModuleList class holds a list of the available modules, which are retrieved from lyxmodules.lst, itself generated by configure.py. There are two LFUNs available: modules-clear and module-add, which do the obvious thing; you can test by typing these into the minibuffer, along with the name of one of the available modules: URL (a CharStyle), Endnote (a Custom Inset), and---with the spaces---End To Foot (View>LaTeX and look at the user preamble), which are themselves in lib/layouts. There are some others, too, that allow theorems to be added to classes like article and book.
The GUI will come next.
Issues: (i) The configure.py script could be improved. It'd be nice, for example, if it tested for the presence of the LaTeX packages a particular module needs. But this would mean re-working the LaTeX script, and I don't know how to do that. Note that at present, the packages are ignored. This will change shortly. (ii) I've used std::string in LyXModule, following what seemed to be a precedent in TextClass. If some of these should be docstrings, please let me know, and I'll change them. (iii) There is at present no distinction between LaTeX and DocBook modules. Should there be? That is: Should there be modules that are available when the document class is a LaTeX class and others that are available only when it is DocBook? Or should there just be one set of modules? Each module can of course indicate for what it is suitable in its description.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19893 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-29 17:59:49 +00:00
|
|
|
/// Specific class options
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string options_;
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string pagestyle_;
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2003-11-27 16:57:12 +00:00
|
|
|
std::string class_header_;
|
|
|
|
///
|
2007-07-11 13:39:08 +00:00
|
|
|
docstring defaultlayout_;
|
2002-11-07 19:51:22 +00:00
|
|
|
/// preamble text to support layout styles
|
2006-11-08 17:22:44 +00:00
|
|
|
docstring preamble_;
|
2002-11-07 19:51:22 +00:00
|
|
|
/// latex packages loaded by document class.
|
2007-04-06 09:02:23 +00:00
|
|
|
std::set<std::string> provides_;
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
|
|
|
unsigned int columns_;
|
|
|
|
///
|
|
|
|
PageSides sides_;
|
2002-11-07 19:51:22 +00:00
|
|
|
/// header depth to have numbering
|
2001-12-28 13:26:54 +00:00
|
|
|
int secnumdepth_;
|
2002-11-07 19:51:22 +00:00
|
|
|
/// header depth to appear in table of contents
|
2001-12-28 13:26:54 +00:00
|
|
|
int tocdepth_;
|
2006-08-23 12:43:46 +00:00
|
|
|
/// Can be LaTeX, DocBook, etc.
|
2001-12-28 13:26:54 +00:00
|
|
|
OutputType outputType_;
|
|
|
|
/** Base font. The paragraph and layout fonts are resolved against
|
|
|
|
this font. This has to be fully instantiated. Attributes
|
2007-04-29 18:17:15 +00:00
|
|
|
Font::INHERIT, Font::IGNORE, and Font::TOGGLE are
|
2001-12-28 13:26:54 +00:00
|
|
|
extremely illegal.
|
|
|
|
*/
|
2007-04-29 18:17:15 +00:00
|
|
|
Font defaultfont_;
|
2001-12-28 13:26:54 +00:00
|
|
|
/// Text that dictates how wide the left margin is on the screen
|
2007-08-18 13:21:12 +00:00
|
|
|
docstring leftmargin_;
|
2001-12-28 13:26:54 +00:00
|
|
|
|
|
|
|
/// Text that dictates how wide the right margin is on the screen
|
2007-08-18 13:21:12 +00:00
|
|
|
docstring rightmargin_;
|
2001-12-28 13:26:54 +00:00
|
|
|
|
2003-02-13 17:49:09 +00:00
|
|
|
/// The type of command used to produce a title
|
2007-09-29 20:02:32 +00:00
|
|
|
TitleLatexType titletype_;
|
2003-02-13 17:49:09 +00:00
|
|
|
/// The name of the title command
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string titlename_;
|
2003-02-13 17:49:09 +00:00
|
|
|
|
2002-11-07 19:51:22 +00:00
|
|
|
/// Paragraph styles used in this layout
|
2002-08-27 15:51:19 +00:00
|
|
|
LayoutList layoutlist_;
|
2004-01-31 15:30:24 +00:00
|
|
|
|
2007-08-13 12:13:17 +00:00
|
|
|
/// Input layouts available to this layout
|
|
|
|
mutable InsetLayouts insetlayoutlist_;
|
|
|
|
|
2002-11-07 19:51:22 +00:00
|
|
|
/// available types of float, eg. figure, algorithm.
|
2002-09-11 07:39:55 +00:00
|
|
|
boost::shared_ptr<FloatList> floatlist_;
|
2001-12-28 13:26:54 +00:00
|
|
|
|
2002-11-07 19:51:22 +00:00
|
|
|
/// Types of counters, eg. sections, eqns, figures, avail. in document class.
|
2007-08-16 15:26:00 +00:00
|
|
|
boost::shared_ptr<Counters> counters_;
|
2002-09-06 14:48:01 +00:00
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
/// Has this layout file been loaded yet?
|
2004-03-30 16:19:50 +00:00
|
|
|
mutable bool loaded_;
|
2003-05-03 19:24:36 +00:00
|
|
|
|
|
|
|
/// Is the TeX class available?
|
|
|
|
bool texClassAvail_;
|
2005-05-12 10:16:04 +00:00
|
|
|
|
|
|
|
/// The minimal TocLevel of sectioning layouts
|
|
|
|
int min_toclevel_;
|
|
|
|
/// The maximal TocLevel of sectioning layouts
|
|
|
|
int max_toclevel_;
|
2001-12-28 13:26:54 +00:00
|
|
|
};
|
|
|
|
|
2002-03-02 16:39:54 +00:00
|
|
|
|
2002-11-07 19:51:22 +00:00
|
|
|
/// convert page sides option to text 1 or 2
|
2007-04-29 19:53:54 +00:00
|
|
|
std::ostream & operator<<(std::ostream & os, TextClass::PageSides p);
|
2001-12-28 13:26:54 +00:00
|
|
|
|
2007-09-19 22:37:22 +00:00
|
|
|
/** Shared pointer for possibly modular layout. Needed so that paste,
|
|
|
|
* for example, will still be able to retain the pointer, even when
|
|
|
|
* the buffer itself is closed.
|
|
|
|
*/
|
|
|
|
typedef boost::shared_ptr<TextClass> TextClassPtr;
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
#endif
|