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
|
|
|
|
2007-11-04 09:51:26 +00:00
|
|
|
#ifndef TEXTCLASS_H
|
|
|
|
#define TEXTCLASS_H
|
2001-12-28 13:26:54 +00:00
|
|
|
|
2007-10-25 12:41:02 +00:00
|
|
|
#include "ColorCode.h"
|
2007-10-28 18:51:54 +00:00
|
|
|
#include "FontInfo.h"
|
2007-09-29 20:02:32 +00:00
|
|
|
#include "LayoutEnums.h"
|
2007-10-23 21:41:17 +00:00
|
|
|
#include "LayoutPtr.h"
|
2001-12-28 13:26:54 +00:00
|
|
|
|
2007-11-07 22:31:07 +00:00
|
|
|
#include "insets/InsetLayout.h"
|
|
|
|
|
2007-10-25 12:41:02 +00:00
|
|
|
#include "support/docstring.h"
|
2007-11-07 23:25:08 +00:00
|
|
|
#include "support/types.h"
|
2007-10-25 12:41:02 +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
|
|
|
|
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
|
|
|
|
2008-02-23 11:36:15 +00:00
|
|
|
/// Index in globel text class list. Basically a 'strong typedef'/
|
|
|
|
class TextClassIndex
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
///
|
|
|
|
TextClassIndex(size_t t) : data_(t) {}
|
|
|
|
///
|
|
|
|
operator size_t() const { return data_; }
|
|
|
|
private:
|
|
|
|
///
|
|
|
|
size_t data_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
2008-02-14 03:38:08 +00:00
|
|
|
/// \return true on success.
|
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-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;
|
Fix bug 4037 and related problems. The patch has been cleaned up a bit
from the one posted to the list.
The basic idea has two parts. First, we hard code an "empty layout"
(called PlainLayout, for want of a better name) in TextClass and read it
before doing anything else. It can therefore be customized by classes,
if they want---say, to make it left-aligned. Second, InsetText's are
divided into three types: (i) normal ones, that use the "default" layout
defined by the text class; (ii) highly restrictive ones, such as ERT and
(not quite an inset) table cells, which demand the empty layout; (iii)
middling ones, which default to an empty layout and use the empty layout
in place of the default. (This is so we don't get the same problem we
had with ERT in e.g. footnotes.) The type of inset is signaled by new
methods InsetText::forceEmptyLayout() and InsetText::useEmptyLayout().
(The latter might better be called: useEmptyLayoutInsteadOfDefault(),
but that's silly.) The old InsetText::forceDefaultParagraphs() has been
split into these, plus a new method InsetText::allowParagraphCustomization().
A lot of the changes just adapt to this change.
The other big change is in GuiToolbar: We want to show LyXDefault and
the "default" layout only when they're active.
There are a handful of places where I'm not entirely sure whether we
should be using forceEmptyLayout or !allowParagraphCustomization() or
both. The InsetCaption is one of these. These places, and some others,
are marked with FIXMEs, so I'd appreciate it if people would search
through the patch and let me know whether these need changing. If they
don't, the FIXMEs can be deleted.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22966 a592a061-630c-0410-9148-cb99ea01b6c8
2008-02-12 17:31:07 +00:00
|
|
|
/// returns a special layout for use when we don't really want one,
|
|
|
|
/// e.g., in table cells
|
|
|
|
LayoutPtr const & emptyLayout() const
|
|
|
|
{ return operator[](emptylayout_); };
|
|
|
|
///
|
|
|
|
docstring const & emptyLayoutName() const
|
|
|
|
{ return emptylayout_; }
|
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;
|
2008-01-07 16:59:10 +00:00
|
|
|
/// features required by the class?
|
2008-02-01 15:12:04 +00:00
|
|
|
std::set<std::string> const & requires() const { return requires_; }
|
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
|
|
|
///
|
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-10-28 18:51:54 +00:00
|
|
|
FontInfo 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;
|
2008-02-21 16:31:59 +00:00
|
|
|
///
|
|
|
|
static InsetLayout const & emptyInsetLayout() { return empty_insetlayout_; }
|
2001-12-28 13:26:54 +00:00
|
|
|
private:
|
|
|
|
///
|
2007-11-04 09:51:26 +00:00
|
|
|
bool deleteLayout(docstring const &);
|
2008-02-13 14:39:16 +00:00
|
|
|
/// \return true for success.
|
2007-11-04 09:51:26 +00:00
|
|
|
bool 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_;
|
Fix bug 4037 and related problems. The patch has been cleaned up a bit
from the one posted to the list.
The basic idea has two parts. First, we hard code an "empty layout"
(called PlainLayout, for want of a better name) in TextClass and read it
before doing anything else. It can therefore be customized by classes,
if they want---say, to make it left-aligned. Second, InsetText's are
divided into three types: (i) normal ones, that use the "default" layout
defined by the text class; (ii) highly restrictive ones, such as ERT and
(not quite an inset) table cells, which demand the empty layout; (iii)
middling ones, which default to an empty layout and use the empty layout
in place of the default. (This is so we don't get the same problem we
had with ERT in e.g. footnotes.) The type of inset is signaled by new
methods InsetText::forceEmptyLayout() and InsetText::useEmptyLayout().
(The latter might better be called: useEmptyLayoutInsteadOfDefault(),
but that's silly.) The old InsetText::forceDefaultParagraphs() has been
split into these, plus a new method InsetText::allowParagraphCustomization().
A lot of the changes just adapt to this change.
The other big change is in GuiToolbar: We want to show LyXDefault and
the "default" layout only when they're active.
There are a handful of places where I'm not entirely sure whether we
should be using forceEmptyLayout or !allowParagraphCustomization() or
both. The InsetCaption is one of these. These places, and some others,
are marked with FIXMEs, so I'd appreciate it if people would search
through the patch and let me know whether these need changing. If they
don't, the FIXMEs can be deleted.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22966 a592a061-630c-0410-9148-cb99ea01b6c8
2008-02-12 17:31:07 +00:00
|
|
|
/// name of empty layout
|
|
|
|
static const docstring emptylayout_;
|
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_;
|
2008-01-07 16:59:10 +00:00
|
|
|
/// latex packages requested by document class.
|
2008-02-01 15:12:04 +00:00
|
|
|
std::set<std::string> requires_;
|
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-10-28 18:51:54 +00:00
|
|
|
FONT_INHERIT, FONT_IGNORE, and FONT_TOGGLE are
|
2001-12-28 13:26:54 +00:00
|
|
|
extremely illegal.
|
|
|
|
*/
|
2007-10-28 18:51:54 +00:00
|
|
|
FontInfo 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_;
|
2008-02-21 16:31:59 +00:00
|
|
|
///
|
|
|
|
static InsetLayout empty_insetlayout_;
|
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-11-07 23:25:08 +00:00
|
|
|
std::ostream & operator<<(std::ostream & os, PageSides p);
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
#endif
|