1999-09-27 18:44:28 +00:00
|
|
|
|
// -*- C++ -*-
|
2003-08-23 00:17:00 +00:00
|
|
|
|
/**
|
2007-04-26 04:41:58 +00:00
|
|
|
|
* \file BufferParams.h
|
2003-08-23 00:17:00 +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
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
* \author Jean-Marc Lasgouttes
|
|
|
|
|
* \author John Levon
|
|
|
|
|
* \author Andr<EFBFBD> P<EFBFBD>nitz
|
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.
|
|
|
|
|
*/
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
1999-11-04 01:40:20 +00:00
|
|
|
|
#ifndef BUFFERPARAMS_H
|
|
|
|
|
#define BUFFERPARAMS_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2008-02-23 11:36:15 +00:00
|
|
|
|
#include "Font.h"
|
2008-04-20 15:00:11 +00:00
|
|
|
|
#include "Citation.h"
|
2003-07-26 23:04:39 +00:00
|
|
|
|
#include "paper.h"
|
2001-12-28 13:26:54 +00:00
|
|
|
|
|
2007-04-25 01:24:38 +00:00
|
|
|
|
#include "insets/InsetQuotes.h"
|
2001-12-28 13:26:54 +00:00
|
|
|
|
|
2003-09-15 20:23:57 +00:00
|
|
|
|
#include "support/copied_ptr.h"
|
2003-09-07 01:45:40 +00:00
|
|
|
|
|
2008-10-14 14:04:21 +00:00
|
|
|
|
#include <list>
|
2008-07-27 17:46:27 +00:00
|
|
|
|
#include <set>
|
2003-03-12 23:25:59 +00:00
|
|
|
|
#include <vector>
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
namespace lyx {
|
|
|
|
|
|
2008-03-15 00:22:54 +00:00
|
|
|
|
namespace support { class FileName; }
|
2007-11-28 15:25:07 +00:00
|
|
|
|
|
2003-09-09 17:00:19 +00:00
|
|
|
|
class AuthorList;
|
|
|
|
|
class BranchList;
|
|
|
|
|
class Bullet;
|
2008-02-28 01:42:02 +00:00
|
|
|
|
class DocumentClass;
|
2006-12-10 16:08:52 +00:00
|
|
|
|
class Encoding;
|
2007-11-07 23:25:08 +00:00
|
|
|
|
class Language;
|
2003-02-16 00:54:43 +00:00
|
|
|
|
class LatexFeatures;
|
This is the last of the commits that hopes to enforce the distinction between "layout files" and "document classes" that was introduced by the modules code. For the most part, these changes just refactor code from TextClass between: (a) a TextClass base class; (b) a LayoutFile subclass, which represents the information in a .layout file; and (c) a DocumentClass subclass, which represents the layout information associated with a Buffer---a LayoutFile plus Modules. Methods from TextClass have been apportioned between the three classes depending upon what is needed where, and signatures have been changed where necessary so that the right kind of class is required.
At this point, there are no simple TextClass objects in the main LyX code, and it is impossible to create them, since the TextClass constructor is protected. Only LayoutFile and DocumentClass objects can be constructed, and for the most part these are constructed only by their respective containers: BaseClassList and DocumentClassBundle. There is an exception: LayoutFile does have a public default constructor, but if anyone knows how to make it go away, please do.
There will be one or two more commits along these lines, but these will be simple renamings. For example, BaseClassList should be LayoutFileList.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23343 a592a061-630c-0410-9148-cb99ea01b6c8
2008-02-29 02:45:33 +00:00
|
|
|
|
class LayoutFile;
|
2008-02-29 02:50:12 +00:00
|
|
|
|
class LayoutFileIndex;
|
|
|
|
|
class Lexer;
|
2007-11-07 23:25:08 +00:00
|
|
|
|
class PDFOptions;
|
2003-09-09 17:00:19 +00:00
|
|
|
|
class Spacing;
|
2003-02-16 00:54:43 +00:00
|
|
|
|
class TexRow;
|
2003-09-09 17:00:19 +00:00
|
|
|
|
class VSpace;
|
2000-03-17 10:14:46 +00:00
|
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
|
/** Buffer parameters.
|
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 first patch does some reworking of the infrastructrue. We need to distinguish between the TextClass that a particular document is using and the layout of that document, since modules, in particular, can modify the layout. The solution adopted here is to add a TextClass pointer to BufferParams, which will hold the layout. The layout itself is then constructed from the TextClass the document is using. At present, this is completely trivial, but that will change when modules are added.
The pointer in question is a boost::shared_ptr. This is needed because CutAndPaste saves a copy of the layout with each cut or copied selection. We cannot assume the selection vanishes when the document is closed, so there are two options: (i) keep a list of all the layouts that have ever been used by any document; (ii) used some kind of smart pointer. The latter seems preferable, as the former would waste memory. More importantly, the use of a smart pointer allows modules to be modified on disk and then reloaded while LyX is running, and it will eventually allow the same for layout files.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19756 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-23 16:41:13 +00:00
|
|
|
|
* This class contains all the parameters for this buffer's use. Some
|
2003-09-15 20:23:57 +00:00
|
|
|
|
* work needs to be done on this class to make it nice. Now everything
|
|
|
|
|
* is in public.
|
|
|
|
|
*/
|
1999-09-27 18:44:28 +00:00
|
|
|
|
class BufferParams {
|
|
|
|
|
public:
|
2008-07-27 17:46:27 +00:00
|
|
|
|
///
|
2008-10-14 14:04:21 +00:00
|
|
|
|
typedef std::list<std::string> LayoutModuleList;
|
1999-11-15 12:01:38 +00:00
|
|
|
|
///
|
2008-03-15 00:22:54 +00:00
|
|
|
|
enum ParagraphSeparation {
|
1999-11-15 12:01:38 +00:00
|
|
|
|
///
|
2008-03-15 00:22:54 +00:00
|
|
|
|
ParagraphIndentSeparation,
|
1999-11-15 12:01:38 +00:00
|
|
|
|
///
|
2008-03-15 00:22:54 +00:00
|
|
|
|
ParagraphSkipSeparation
|
1999-11-15 12:01:38 +00:00
|
|
|
|
};
|
|
|
|
|
///
|
1999-09-27 18:44:28 +00:00
|
|
|
|
BufferParams();
|
|
|
|
|
|
2007-05-01 08:26:40 +00:00
|
|
|
|
/// get l10n translated to the buffers language
|
2008-03-15 00:22:54 +00:00
|
|
|
|
docstring B_(std::string const & l10n) const;
|
2007-05-01 08:26:40 +00:00
|
|
|
|
|
2003-03-12 02:39:12 +00:00
|
|
|
|
/// read a header token, if unrecognised, return it or an unknown class name
|
2008-03-15 00:22:54 +00:00
|
|
|
|
std::string readToken(Lexer & lex,
|
2007-11-28 15:25:07 +00:00
|
|
|
|
std::string const & token, ///< token to read.
|
2008-04-20 03:08:11 +00:00
|
|
|
|
support::FileName const & filepath);
|
2003-03-12 02:39:12 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
|
void writeFile(std::ostream &) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2007-12-14 14:51:47 +00:00
|
|
|
|
/// check what features are implied by the buffer parameters.
|
|
|
|
|
void validate(LaTeXFeatures &) const;
|
|
|
|
|
|
2003-05-22 22:44:30 +00:00
|
|
|
|
/** \returns true if the babel package is used (interogates
|
2003-09-15 20:23:57 +00:00
|
|
|
|
* the BufferParams and a LyXRC variable).
|
|
|
|
|
* This returned value can then be passed to the insets...
|
2003-05-22 22:44:30 +00:00
|
|
|
|
*/
|
2006-10-21 00:16:43 +00:00
|
|
|
|
bool writeLaTeX(odocstream &, LaTeXFeatures &, TexRow &) const;
|
2003-02-16 00:54:43 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
|
|
|
|
void useClassDefaults();
|
2001-09-17 15:39:58 +00:00
|
|
|
|
///
|
|
|
|
|
bool hasClassDefaults() const;
|
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-09-09 17:00:19 +00:00
|
|
|
|
VSpace const & getDefSkip() const;
|
2000-02-04 09:38:32 +00:00
|
|
|
|
///
|
2003-09-09 17:00:19 +00:00
|
|
|
|
void setDefSkip(VSpace const & vs);
|
1999-09-27 18:44:28 +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 first patch does some reworking of the infrastructrue. We need to distinguish between the TextClass that a particular document is using and the layout of that document, since modules, in particular, can modify the layout. The solution adopted here is to add a TextClass pointer to BufferParams, which will hold the layout. The layout itself is then constructed from the TextClass the document is using. At present, this is completely trivial, but that will change when modules are added.
The pointer in question is a boost::shared_ptr. This is needed because CutAndPaste saves a copy of the layout with each cut or copied selection. We cannot assume the selection vanishes when the document is closed, so there are two options: (i) keep a list of all the layouts that have ever been used by any document; (ii) used some kind of smart pointer. The latter seems preferable, as the former would waste memory. More importantly, the use of a smart pointer allows modules to be modified on disk and then reloaded while LyX is running, and it will eventually allow the same for layout files.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19756 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-23 16:41:13 +00:00
|
|
|
|
/** Whether paragraphs are separated by using a indent like in
|
2003-09-15 20:23:57 +00:00
|
|
|
|
* articles or by using a little skip like in letters.
|
|
|
|
|
*/
|
2008-03-15 00:22:54 +00:00
|
|
|
|
ParagraphSeparation paragraph_separation;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2008-03-15 00:18:48 +00:00
|
|
|
|
InsetQuotes::QuoteLanguage quotes_language;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2008-03-15 00:18:48 +00:00
|
|
|
|
InsetQuotes::QuoteTimes quotes_times;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string fontsize;
|
This is the last of the commits that hopes to enforce the distinction between "layout files" and "document classes" that was introduced by the modules code. For the most part, these changes just refactor code from TextClass between: (a) a TextClass base class; (b) a LayoutFile subclass, which represents the information in a .layout file; and (c) a DocumentClass subclass, which represents the layout information associated with a Buffer---a LayoutFile plus Modules. Methods from TextClass have been apportioned between the three classes depending upon what is needed where, and signatures have been changed where necessary so that the right kind of class is required.
At this point, there are no simple TextClass objects in the main LyX code, and it is impossible to create them, since the TextClass constructor is protected. Only LayoutFile and DocumentClass objects can be constructed, and for the most part these are constructed only by their respective containers: BaseClassList and DocumentClassBundle. There is an exception: LayoutFile does have a public default constructor, but if anyone knows how to make it go away, please do.
There will be one or two more commits along these lines, but these will be simple renamings. For example, BaseClassList should be LayoutFileList.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23343 a592a061-630c-0410-9148-cb99ea01b6c8
2008-02-29 02:45:33 +00:00
|
|
|
|
///Get the LayoutFile this document is using.
|
|
|
|
|
LayoutFile const * baseClass() const;
|
2008-02-28 21:04:55 +00:00
|
|
|
|
///
|
This is the last of the commits that hopes to enforce the distinction between "layout files" and "document classes" that was introduced by the modules code. For the most part, these changes just refactor code from TextClass between: (a) a TextClass base class; (b) a LayoutFile subclass, which represents the information in a .layout file; and (c) a DocumentClass subclass, which represents the layout information associated with a Buffer---a LayoutFile plus Modules. Methods from TextClass have been apportioned between the three classes depending upon what is needed where, and signatures have been changed where necessary so that the right kind of class is required.
At this point, there are no simple TextClass objects in the main LyX code, and it is impossible to create them, since the TextClass constructor is protected. Only LayoutFile and DocumentClass objects can be constructed, and for the most part these are constructed only by their respective containers: BaseClassList and DocumentClassBundle. There is an exception: LayoutFile does have a public default constructor, but if anyone knows how to make it go away, please do.
There will be one or two more commits along these lines, but these will be simple renamings. For example, BaseClassList should be LayoutFileList.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23343 a592a061-630c-0410-9148-cb99ea01b6c8
2008-02-29 02:45:33 +00:00
|
|
|
|
LayoutFileIndex const & baseClassID() const;
|
|
|
|
|
/// Set the LyX layout file this document is using.
|
2008-02-28 01:42:02 +00:00
|
|
|
|
/// NOTE: This does not call makeDocumentClass() to update the local
|
|
|
|
|
/// DocumentClass. That needs to be done manually.
|
2008-02-28 21:04:55 +00:00
|
|
|
|
/// \param filename the name of the layout file
|
|
|
|
|
bool setBaseClass(std::string const & classname);
|
2008-01-05 17:04:56 +00:00
|
|
|
|
/// Adds the module information to the baseClass information to
|
2008-02-28 01:42:02 +00:00
|
|
|
|
/// create our local DocumentClass.
|
|
|
|
|
void makeDocumentClass();
|
|
|
|
|
/// Returns the DocumentClass currently in use: the BaseClass as modified
|
2008-01-05 17:04:56 +00:00
|
|
|
|
/// by modules.
|
2008-02-28 01:42:02 +00:00
|
|
|
|
DocumentClass const & documentClass() const;
|
|
|
|
|
/// \return A pointer to the DocumentClass currently in use: the BaseClass
|
|
|
|
|
/// as modified by modules.
|
2008-05-22 14:02:35 +00:00
|
|
|
|
DocumentClass const * documentClassPtr() const;
|
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 first patch does some reworking of the infrastructrue. We need to distinguish between the TextClass that a particular document is using and the layout of that document, since modules, in particular, can modify the layout. The solution adopted here is to add a TextClass pointer to BufferParams, which will hold the layout. The layout itself is then constructed from the TextClass the document is using. At present, this is completely trivial, but that will change when modules are added.
The pointer in question is a boost::shared_ptr. This is needed because CutAndPaste saves a copy of the layout with each cut or copied selection. We cannot assume the selection vanishes when the document is closed, so there are two options: (i) keep a list of all the layouts that have ever been used by any document; (ii) used some kind of smart pointer. The latter seems preferable, as the former would waste memory. More importantly, the use of a smart pointer allows modules to be modified on disk and then reloaded while LyX is running, and it will eventually allow the same for layout files.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19756 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-23 16:41:13 +00:00
|
|
|
|
/// This bypasses the baseClass and sets the textClass directly.
|
|
|
|
|
/// Should be called with care and would be better not being here,
|
|
|
|
|
/// but it seems to be needed by CutAndPaste::putClipboard().
|
2008-02-28 01:42:02 +00:00
|
|
|
|
void setDocumentClass(DocumentClass const * const);
|
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
|
|
|
|
/// List of modules in use
|
2008-07-27 17:46:27 +00:00
|
|
|
|
LayoutModuleList const & getModules() const { return layoutModules_; }
|
|
|
|
|
/// List of default modules the user has removed
|
|
|
|
|
std::set<std::string> const & getRemovedModules() const
|
|
|
|
|
{ return removedModules_; }
|
|
|
|
|
///
|
2008-10-20 19:48:32 +00:00
|
|
|
|
/// Add a module to the list of modules in use. This checks only that the
|
|
|
|
|
/// module is not already in the list, so use moduleIsCompatible first if
|
|
|
|
|
/// you want to check for compatibility.
|
|
|
|
|
/// \return true if module was successfully added.
|
2008-01-06 18:17:25 +00:00
|
|
|
|
bool addLayoutModule(std::string const & modName);
|
2008-10-20 19:48:32 +00:00
|
|
|
|
/// checks to make sure module's requriements are satisfied, that it does
|
|
|
|
|
/// not conflict with already-present modules, isn't already loaded, etc.
|
|
|
|
|
bool moduleCanBeAdded(std::string const & modName) const;
|
2008-07-27 17:46:27 +00:00
|
|
|
|
///
|
|
|
|
|
void addRemovedModule(std::string const & modName)
|
|
|
|
|
{ removedModules_.insert(modName); }
|
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
|
|
|
|
/// Clear the list
|
2008-07-27 17:46:27 +00:00
|
|
|
|
void clearLayoutModules() { layoutModules_.clear(); }
|
|
|
|
|
/// Clear the removed module list
|
|
|
|
|
void clearRemovedModules() { removedModules_.clear(); }
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2006-02-05 13:20:16 +00:00
|
|
|
|
/// returns the main font for the buffer (document)
|
2007-04-29 18:17:15 +00:00
|
|
|
|
Font const getFont() const;
|
2006-02-05 13:20:16 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
/* this are for the PaperLayout */
|
2005-07-16 16:57:55 +00:00
|
|
|
|
/// the papersize
|
2003-06-10 14:39:45 +00:00
|
|
|
|
PAPER_SIZE papersize;
|
2001-11-29 17:12:21 +00:00
|
|
|
|
///
|
2003-06-10 14:39:45 +00:00
|
|
|
|
PAPER_ORIENTATION orientation;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
/// use custom margins
|
2001-11-29 17:12:21 +00:00
|
|
|
|
bool use_geometry;
|
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string paperwidth;
|
2001-11-29 17:12:21 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string paperheight;
|
2001-11-29 17:12:21 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string leftmargin;
|
2001-11-29 17:12:21 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string topmargin;
|
2001-11-29 17:12:21 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string rightmargin;
|
2001-11-29 17:12:21 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string bottommargin;
|
2001-11-29 17:12:21 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string headheight;
|
2001-11-29 17:12:21 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string headsep;
|
2001-11-29 17:12:21 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string footskip;
|
2008-02-19 05:24:48 +00:00
|
|
|
|
///
|
|
|
|
|
std::string columnsep;
|
2001-11-29 17:12:21 +00:00
|
|
|
|
|
|
|
|
|
/* some LaTeX options */
|
1999-09-27 18:44:28 +00:00
|
|
|
|
/// The graphics driver
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string graphicsDriver;
|
The Grand Font Selection Redesign:
* lib/lyx2lyx/LyX.py (format_relation): add file format 247 (from Georg BAUM).
* lib/lyx2lyx/lyx_1_5.py: add convert_font_settings, revert_font_settings (from Georg BAUM).
* lib/chkconfig.ltx: Test for newly supported font packages
* lib/doc/LaTeXConfig.lyx.in: document newly supported font packages
* lib/doc/UserGuide.lyx: document new UI.
* lib/doc/Extended.lyx: update PostScript font documentation
* development/FORMAT: document file format change 246->247.
* src/tex-strings.[Ch]: new strings tex_fonts_roman, tex_fonts_sans,
tex_fonts_monospaced (with GUI equivalents).
* src/buffer.C: Format up to 247.
* src/bufferparams.C:
new params fontsRoman, fontsSans, fontsTypewriter, fontsDefaultFamily,
fontsSC, fontsOSF, fontsSansScale and fontsTypewriterScale
(LyXFont const BufferParams::getFont): consider switch of default family.
(string const BufferParams::loadFonts): new method to get all the LaTeX
font stuff done.
* src/paragraph.C
(LyXFont const Paragraph::getFont):
(LyXFont const Paragraph::getLabelFont):
(LyXFont const Paragraph::getLayoutFont): user buffer's not textclass's
default font
* src/text.C
(int LyXText::leftMargin):
(int LyXText::rightMargin): user buffer's not textclass's default font
* src/text2.C
(LyXFont LyXText::getFont):
(LyXFont LyXText::getLayoutFont):
(LyXFont LyXText::getLabelFont): check if the family of the default document
font has been customized.
* src/frontends/gtk/GDocument.[Ch]: implement new font ui (from Georg BAUM).
* src/frontends/gtk/glade/document.glade: implement new font ui (from Georg BAUM).
* src/frontends/qt3/Makefile.dialogs: add new FontModuleBase
* src/frontends/qt3/ui/FontModuleBase.ui: new File
* src/frontends/qt3/ui/TextLayoutModuleBase.ui: remove font widgets
* src/frontends/qt3/QDocument.C
* src/frontends/qt3/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/Makefile.dialogs: add new FontUi
* src/frontends/qt4/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/ui/FontUi.ui: new File
* src/frontends/qt4/ui/TextLayoutUi.ui: remove font widgets
* src/frontends/qt4/ui/compile_uic.sh: add new FontUi
* src/frontends/xforms/FormDocument.[Ch]: implement new font ui
* src/frontends/xforms/forms/form_document.fd: add new font tab.
* src/frontends/controllers/ControlDocument.[Ch]
(char ControlDocument::fontfamilies):
(char ControlDocument::fontfamilies_gui):
(bool ControlDocument::isFontAvailable):
(bool ControlDocument::providesSC):
(bool ControlDocument::providesOSF):
(bool ControlDocument::providesScale): new methods, providing font info.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14143 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-19 08:10:17 +00:00
|
|
|
|
/// the rm font
|
|
|
|
|
std::string fontsRoman;
|
|
|
|
|
/// the sf font
|
|
|
|
|
std::string fontsSans;
|
|
|
|
|
/// the tt font
|
|
|
|
|
std::string fontsTypewriter;
|
|
|
|
|
/// the default family (rm, sf, tt)
|
|
|
|
|
std::string fontsDefaultFamily;
|
|
|
|
|
/// use expert Small Caps
|
|
|
|
|
bool fontsSC;
|
|
|
|
|
/// use Old Style Figures
|
|
|
|
|
bool fontsOSF;
|
|
|
|
|
/// the scale factor of the sf font
|
|
|
|
|
int fontsSansScale;
|
|
|
|
|
/// the scale factor of the tt font
|
|
|
|
|
int fontsTypewriterScale;
|
2008-06-05 06:18:34 +00:00
|
|
|
|
/// the font used by the CJK command
|
|
|
|
|
std::string fontsCJK;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-09-09 17:00:19 +00:00
|
|
|
|
Spacing & spacing();
|
|
|
|
|
Spacing const & spacing() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
|
int secnumdepth;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
|
int tocdepth;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2000-10-10 12:36:36 +00:00
|
|
|
|
Language const * language;
|
2003-08-17 11:28:23 +00:00
|
|
|
|
/// BranchList:
|
2003-09-09 17:00:19 +00:00
|
|
|
|
BranchList & branchlist();
|
|
|
|
|
BranchList const & branchlist() const;
|
2006-08-15 07:08:58 +00:00
|
|
|
|
/**
|
|
|
|
|
* The input encoding for LaTeX. This can be one of
|
2007-01-13 14:36:54 +00:00
|
|
|
|
* - \c auto: find out the input encoding from the used languages
|
|
|
|
|
* - \c default: ditto
|
2006-08-15 07:08:58 +00:00
|
|
|
|
* - any encoding supported by the inputenc package
|
|
|
|
|
* The encoding of the LyX file is always utf8 and has nothing to
|
|
|
|
|
* do with this setting.
|
2007-01-13 14:36:54 +00:00
|
|
|
|
* The difference between \c auto and \c default is that \c auto also
|
|
|
|
|
* causes loading of the inputenc package, while \c default does not.
|
|
|
|
|
* \c default will not work unless the user takes additional measures
|
|
|
|
|
* (such as using special environments like the CJK environment from
|
|
|
|
|
* CJK.sty).
|
|
|
|
|
* \c default can be seen as an unspecified 8bit encoding, since LyX
|
|
|
|
|
* does not interpret it in any way apart from display on screen.
|
2006-08-15 07:08:58 +00:00
|
|
|
|
*/
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string inputenc;
|
2006-12-10 16:08:52 +00:00
|
|
|
|
/// The main encoding used by this buffer for LaTeX output.
|
|
|
|
|
/// Individual pieces of text can use different encodings.
|
|
|
|
|
Encoding const & encoding() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string preamble;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2008-03-24 12:31:07 +00:00
|
|
|
|
std::string local_layout;
|
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string options;
|
2008-10-12 09:36:00 +00:00
|
|
|
|
/// use the class options defined in the layout?
|
|
|
|
|
bool use_default_options;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2008-04-28 16:38:56 +00:00
|
|
|
|
std::string master;
|
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string float_placement;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
|
unsigned int columns;
|
Add support for listings package. Two listings command \lstinline, \lstinputlisting and an environment \lstlisting are supported, along with preamble \lstset. \lstinputlisting is implemented through Include dialog, and the other two are implemented with a new inset listings, along with its dialog.
* src/LyXAction.cpp: listing-insert action
* src/insets/Inset.h,cpp: LISTINGS_CODE
* src/insets/InsetInclude.cpp: handle \lstinputlisting
* src/insets/InsetListings.h,cpp: new listings inset
* src/insets/InsetListingsParams.h,cpp: parameters from listings package
* src/insets/InsetCommandParams.h,cpp: handle lstinputlisting option
* src/Bidi.cpp: handle LISTINGS_CODE
* src/frontends/qt4/ui/TextLayoutUi.ui: update UI
* src/frontends/qt4/ui/ListingsUi.ui: new dialog
* src/frontends/qt4/ui/IncludeUi.ui: update UI
* src/frontends/qt4/QInclude.h,cpp: add lstinputlisting
* src/frontends/qt4/QDocument.h,cpp: add textedit for preamble listings_params
* src/frontends/qt4/QListings.h,cpp: new listings inset
* src/frontends/qt4/Dialogs.cpp: new listings dialog
* src/frontends/controllers/ControlInclude.h,cpp: add lstinputlisting
* src/frontends/controllers/ControlListings.h,cpp: new listings inset
* src/LyXFunc.cpp: handle LISTING_CODE
* src/Paragraph.cpp: handle LISTING_CODE
* src/factory.cpp: new listings inset
* src/CutAndPaste.cpp: handle LISTINGS_CODE
* src/LaTeXFeatures.cpp: require listings
* src/Text3.cpp: Handle LISTINGS_CODE
* src/lfuns.h: add LFUN_LISTING_INSERT
* src/Buffer.cpp: change lyx file format to 269
* src/BufferParams.h,cpp: add listings_params to preamble
* lib/lyx2lyx/LyX.py: lyx2lyx
* lib/lyx2lyx/lyx_1_5.py: lyx2lyx
* lib/ui/stdmenus.inc: new menu item (no shortcut!)
* src/insets/Makefile.am: update autotools
* src/frontends/controllers/Makefile.am
* src/frontends/qt4/Makefile.dialogs
* src/frontends/qt4/Makefile.am
* po/POTFILES.in: a few more translatable files.
* development/scons/scons_manifest.py: scons build system
* development/FORMAT: document format changes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18243 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-09 19:11:42 +00:00
|
|
|
|
/// parameters for the listings package
|
|
|
|
|
std::string listings_params;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2007-11-07 23:25:08 +00:00
|
|
|
|
PageSides sides;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string pagestyle;
|
2003-09-09 17:00:19 +00:00
|
|
|
|
/// \param index should lie in the range 0 <= \c index <= 3.
|
2006-10-21 00:16:43 +00:00
|
|
|
|
Bullet & temp_bullet(size_type index);
|
|
|
|
|
Bullet const & temp_bullet(size_type index) const;
|
2003-09-09 17:00:19 +00:00
|
|
|
|
/// \param index should lie in the range 0 <= \c index <= 3.
|
2006-10-21 00:16:43 +00:00
|
|
|
|
Bullet & user_defined_bullet(size_type index);
|
|
|
|
|
Bullet const & user_defined_bullet(size_type index) const;
|
2003-03-06 11:07:55 +00:00
|
|
|
|
|
2006-11-13 17:35:18 +00:00
|
|
|
|
/// Whether to load a package such as amsmath or esint.
|
|
|
|
|
/// The enum values must not be changed (file format!)
|
|
|
|
|
enum Package {
|
|
|
|
|
/// Don't load the package. For experts only.
|
|
|
|
|
package_off = 0,
|
|
|
|
|
/// Load the package if needed (recommended)
|
|
|
|
|
package_auto = 1,
|
|
|
|
|
/// Always load the package (e.g. if the document contains
|
|
|
|
|
/// some ERT that needs the package)
|
|
|
|
|
package_on = 2
|
2003-03-06 11:07:55 +00:00
|
|
|
|
};
|
2006-11-13 17:35:18 +00:00
|
|
|
|
/// Whether and how to load amsmath
|
|
|
|
|
Package use_amsmath;
|
|
|
|
|
/// Whether and how to load esint
|
|
|
|
|
Package use_esint;
|
2001-07-19 14:12:37 +00:00
|
|
|
|
///
|
2004-03-29 13:17:25 +00:00
|
|
|
|
bool use_bibtopic;
|
2003-02-08 19:18:01 +00:00
|
|
|
|
/// revision tracking for this buffer ?
|
2006-10-06 18:53:35 +00:00
|
|
|
|
bool trackChanges;
|
2007-05-08 17:46:03 +00:00
|
|
|
|
/** This param decides whether change tracking marks should be used
|
|
|
|
|
* in output (irrespective of how these marks are actually defined;
|
|
|
|
|
* for instance, they may differ for DVI and PDF generation)
|
2005-01-24 17:12:19 +00:00
|
|
|
|
*/
|
2006-10-06 18:53:35 +00:00
|
|
|
|
bool outputChanges;
|
2003-07-28 14:40:29 +00:00
|
|
|
|
///
|
|
|
|
|
bool compressed;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
|
2003-09-09 17:00:19 +00:00
|
|
|
|
/// the author list for the document
|
|
|
|
|
AuthorList & authors();
|
|
|
|
|
AuthorList const & authors() const;
|
|
|
|
|
|
2003-03-12 23:25:59 +00:00
|
|
|
|
/// map of the file's author IDs to buffer author IDs
|
2006-06-07 17:05:25 +00:00
|
|
|
|
std::vector<unsigned int> author_map;
|
2003-07-17 08:23:33 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string const dvips_options() const;
|
2008-01-25 12:54:25 +00:00
|
|
|
|
/** The return value of paperSizeName() depends on the
|
|
|
|
|
* purpose for which the paper size is needed, since they
|
|
|
|
|
* support different subsets of paper sizes.
|
|
|
|
|
*/
|
2008-03-15 00:22:54 +00:00
|
|
|
|
enum PapersizePurpose {
|
2008-01-25 12:54:25 +00:00
|
|
|
|
///
|
|
|
|
|
DVIPS,
|
|
|
|
|
///
|
|
|
|
|
DVIPDFM,
|
|
|
|
|
///
|
|
|
|
|
XDVI
|
|
|
|
|
};
|
2003-07-17 08:23:33 +00:00
|
|
|
|
///
|
2008-03-15 00:22:54 +00:00
|
|
|
|
std::string paperSizeName(PapersizePurpose purpose) const;
|
2008-10-12 17:21:18 +00:00
|
|
|
|
/// set up if and how babel is called
|
|
|
|
|
std::string babelCall(std::string const & lang_opts) const;
|
2008-12-19 09:33:50 +00:00
|
|
|
|
/// return supported drivers for specific packages
|
|
|
|
|
docstring getGraphicsDriver(std::string const & package) const;
|
2007-05-28 07:43:15 +00:00
|
|
|
|
/// handle inputenc etc.
|
2007-05-28 12:25:53 +00:00
|
|
|
|
void writeEncodingPreamble(odocstream & os, LaTeXFeatures & features,
|
2007-05-28 07:43:15 +00:00
|
|
|
|
TexRow & texrow) const;
|
The Grand Font Selection Redesign:
* lib/lyx2lyx/LyX.py (format_relation): add file format 247 (from Georg BAUM).
* lib/lyx2lyx/lyx_1_5.py: add convert_font_settings, revert_font_settings (from Georg BAUM).
* lib/chkconfig.ltx: Test for newly supported font packages
* lib/doc/LaTeXConfig.lyx.in: document newly supported font packages
* lib/doc/UserGuide.lyx: document new UI.
* lib/doc/Extended.lyx: update PostScript font documentation
* development/FORMAT: document file format change 246->247.
* src/tex-strings.[Ch]: new strings tex_fonts_roman, tex_fonts_sans,
tex_fonts_monospaced (with GUI equivalents).
* src/buffer.C: Format up to 247.
* src/bufferparams.C:
new params fontsRoman, fontsSans, fontsTypewriter, fontsDefaultFamily,
fontsSC, fontsOSF, fontsSansScale and fontsTypewriterScale
(LyXFont const BufferParams::getFont): consider switch of default family.
(string const BufferParams::loadFonts): new method to get all the LaTeX
font stuff done.
* src/paragraph.C
(LyXFont const Paragraph::getFont):
(LyXFont const Paragraph::getLabelFont):
(LyXFont const Paragraph::getLayoutFont): user buffer's not textclass's
default font
* src/text.C
(int LyXText::leftMargin):
(int LyXText::rightMargin): user buffer's not textclass's default font
* src/text2.C
(LyXFont LyXText::getFont):
(LyXFont LyXText::getLayoutFont):
(LyXFont LyXText::getLabelFont): check if the family of the default document
font has been customized.
* src/frontends/gtk/GDocument.[Ch]: implement new font ui (from Georg BAUM).
* src/frontends/gtk/glade/document.glade: implement new font ui (from Georg BAUM).
* src/frontends/qt3/Makefile.dialogs: add new FontModuleBase
* src/frontends/qt3/ui/FontModuleBase.ui: new File
* src/frontends/qt3/ui/TextLayoutModuleBase.ui: remove font widgets
* src/frontends/qt3/QDocument.C
* src/frontends/qt3/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/Makefile.dialogs: add new FontUi
* src/frontends/qt4/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/ui/FontUi.ui: new File
* src/frontends/qt4/ui/TextLayoutUi.ui: remove font widgets
* src/frontends/qt4/ui/compile_uic.sh: add new FontUi
* src/frontends/xforms/FormDocument.[Ch]: implement new font ui
* src/frontends/xforms/forms/form_document.fd: add new font tab.
* src/frontends/controllers/ControlDocument.[Ch]
(char ControlDocument::fontfamilies):
(char ControlDocument::fontfamilies_gui):
(bool ControlDocument::isFontAvailable):
(bool ControlDocument::providesSC):
(bool ControlDocument::providesOSF):
(bool ControlDocument::providesScale): new methods, providing font info.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14143 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-19 08:10:17 +00:00
|
|
|
|
/// set up the document fonts
|
2007-02-08 15:18:36 +00:00
|
|
|
|
std::string const loadFonts(std::string const & rm,
|
The Grand Font Selection Redesign:
* lib/lyx2lyx/LyX.py (format_relation): add file format 247 (from Georg BAUM).
* lib/lyx2lyx/lyx_1_5.py: add convert_font_settings, revert_font_settings (from Georg BAUM).
* lib/chkconfig.ltx: Test for newly supported font packages
* lib/doc/LaTeXConfig.lyx.in: document newly supported font packages
* lib/doc/UserGuide.lyx: document new UI.
* lib/doc/Extended.lyx: update PostScript font documentation
* development/FORMAT: document file format change 246->247.
* src/tex-strings.[Ch]: new strings tex_fonts_roman, tex_fonts_sans,
tex_fonts_monospaced (with GUI equivalents).
* src/buffer.C: Format up to 247.
* src/bufferparams.C:
new params fontsRoman, fontsSans, fontsTypewriter, fontsDefaultFamily,
fontsSC, fontsOSF, fontsSansScale and fontsTypewriterScale
(LyXFont const BufferParams::getFont): consider switch of default family.
(string const BufferParams::loadFonts): new method to get all the LaTeX
font stuff done.
* src/paragraph.C
(LyXFont const Paragraph::getFont):
(LyXFont const Paragraph::getLabelFont):
(LyXFont const Paragraph::getLayoutFont): user buffer's not textclass's
default font
* src/text.C
(int LyXText::leftMargin):
(int LyXText::rightMargin): user buffer's not textclass's default font
* src/text2.C
(LyXFont LyXText::getFont):
(LyXFont LyXText::getLayoutFont):
(LyXFont LyXText::getLabelFont): check if the family of the default document
font has been customized.
* src/frontends/gtk/GDocument.[Ch]: implement new font ui (from Georg BAUM).
* src/frontends/gtk/glade/document.glade: implement new font ui (from Georg BAUM).
* src/frontends/qt3/Makefile.dialogs: add new FontModuleBase
* src/frontends/qt3/ui/FontModuleBase.ui: new File
* src/frontends/qt3/ui/TextLayoutModuleBase.ui: remove font widgets
* src/frontends/qt3/QDocument.C
* src/frontends/qt3/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/Makefile.dialogs: add new FontUi
* src/frontends/qt4/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/ui/FontUi.ui: new File
* src/frontends/qt4/ui/TextLayoutUi.ui: remove font widgets
* src/frontends/qt4/ui/compile_uic.sh: add new FontUi
* src/frontends/xforms/FormDocument.[Ch]: implement new font ui
* src/frontends/xforms/forms/form_document.fd: add new font tab.
* src/frontends/controllers/ControlDocument.[Ch]
(char ControlDocument::fontfamilies):
(char ControlDocument::fontfamilies_gui):
(bool ControlDocument::isFontAvailable):
(bool ControlDocument::providesSC):
(bool ControlDocument::providesOSF):
(bool ControlDocument::providesScale): new methods, providing font info.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14143 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-19 08:10:17 +00:00
|
|
|
|
std::string const & sf, std::string const & tt,
|
|
|
|
|
bool const & sc, bool const & osf,
|
|
|
|
|
int const & sfscale, int const & ttscale) const;
|
2007-11-28 15:25:07 +00:00
|
|
|
|
|
2007-03-22 07:22:16 +00:00
|
|
|
|
/// get the appropriate cite engine (natbib handling)
|
2008-04-20 15:00:11 +00:00
|
|
|
|
CiteEngine citeEngine() const;
|
2007-03-25 01:12:38 +00:00
|
|
|
|
///
|
2008-04-20 15:00:11 +00:00
|
|
|
|
void setCiteEngine(CiteEngine const);
|
2003-03-12 23:25:59 +00:00
|
|
|
|
|
2007-09-20 22:31:18 +00:00
|
|
|
|
/// options for pdf output
|
|
|
|
|
PDFOptions & pdfoptions();
|
|
|
|
|
PDFOptions const & pdfoptions() const;
|
|
|
|
|
|
2003-03-12 11:52:23 +00:00
|
|
|
|
private:
|
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 first patch does some reworking of the infrastructrue. We need to distinguish between the TextClass that a particular document is using and the layout of that document, since modules, in particular, can modify the layout. The solution adopted here is to add a TextClass pointer to BufferParams, which will hold the layout. The layout itself is then constructed from the TextClass the document is using. At present, this is completely trivial, but that will change when modules are added.
The pointer in question is a boost::shared_ptr. This is needed because CutAndPaste saves a copy of the layout with each cut or copied selection. We cannot assume the selection vanishes when the document is closed, so there are two options: (i) keep a list of all the layouts that have ever been used by any document; (ii) used some kind of smart pointer. The latter seems preferable, as the former would waste memory. More importantly, the use of a smart pointer allows modules to be modified on disk and then reloaded while LyX is running, and it will eventually allow the same for layout files.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19756 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-23 16:41:13 +00:00
|
|
|
|
///
|
|
|
|
|
void readPreamble(Lexer &);
|
|
|
|
|
///
|
2008-03-24 12:31:07 +00:00
|
|
|
|
void readLocalLayout(Lexer &);
|
|
|
|
|
///
|
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 first patch does some reworking of the infrastructrue. We need to distinguish between the TextClass that a particular document is using and the layout of that document, since modules, in particular, can modify the layout. The solution adopted here is to add a TextClass pointer to BufferParams, which will hold the layout. The layout itself is then constructed from the TextClass the document is using. At present, this is completely trivial, but that will change when modules are added.
The pointer in question is a boost::shared_ptr. This is needed because CutAndPaste saves a copy of the layout with each cut or copied selection. We cannot assume the selection vanishes when the document is closed, so there are two options: (i) keep a list of all the layouts that have ever been used by any document; (ii) used some kind of smart pointer. The latter seems preferable, as the former would waste memory. More importantly, the use of a smart pointer allows modules to be modified on disk and then reloaded while LyX is running, and it will eventually allow the same for layout files.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19756 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-23 16:41:13 +00:00
|
|
|
|
void readLanguage(Lexer &);
|
|
|
|
|
///
|
|
|
|
|
void readGraphicsDriver(Lexer &);
|
|
|
|
|
///
|
|
|
|
|
void readBullets(Lexer &);
|
|
|
|
|
///
|
|
|
|
|
void readBulletsLaTeX(Lexer &);
|
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
|
|
|
|
///
|
|
|
|
|
void readModules(Lexer &);
|
2008-07-27 17:46:27 +00:00
|
|
|
|
///
|
|
|
|
|
void readRemovedModules(Lexer &);
|
2008-11-05 19:42:16 +00:00
|
|
|
|
/// Called when the document class changes. Removes modules
|
|
|
|
|
/// excluded by, provided by, etc, the document class.
|
|
|
|
|
/// \return true if modules were consistent, false if changes had
|
|
|
|
|
/// to be made.
|
|
|
|
|
bool removeBadModules();
|
|
|
|
|
/// Adds default modules, if they're addable.
|
2008-10-16 17:14:46 +00:00
|
|
|
|
void addDefaultModules();
|
2008-10-23 00:27:03 +00:00
|
|
|
|
/// checks for consistency among modules: makes sure requirements
|
|
|
|
|
/// are met, no modules exclude one another, etc, and resolves any
|
|
|
|
|
/// such conflicts, leaving us with a consistent collection.
|
|
|
|
|
/// \return true if modules were consistent, false if changes had
|
|
|
|
|
/// to be made.
|
|
|
|
|
bool checkModuleConsistency();
|
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 first patch does some reworking of the infrastructrue. We need to distinguish between the TextClass that a particular document is using and the layout of that document, since modules, in particular, can modify the layout. The solution adopted here is to add a TextClass pointer to BufferParams, which will hold the layout. The layout itself is then constructed from the TextClass the document is using. At present, this is completely trivial, but that will change when modules are added.
The pointer in question is a boost::shared_ptr. This is needed because CutAndPaste saves a copy of the layout with each cut or copied selection. We cannot assume the selection vanishes when the document is closed, so there are two options: (i) keep a list of all the layouts that have ever been used by any document; (ii) used some kind of smart pointer. The latter seems preferable, as the former would waste memory. More importantly, the use of a smart pointer allows modules to be modified on disk and then reloaded while LyX is running, and it will eventually allow the same for layout files.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19756 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-23 16:41:13 +00:00
|
|
|
|
|
|
|
|
|
/// for use with natbib
|
2008-04-20 15:00:11 +00:00
|
|
|
|
CiteEngine cite_engine_;
|
2008-02-28 01:42:02 +00:00
|
|
|
|
///
|
|
|
|
|
DocumentClass * doc_class_;
|
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
|
|
|
|
///
|
|
|
|
|
LayoutModuleList layoutModules_;
|
2008-07-27 17:46:27 +00:00
|
|
|
|
/// this is for modules that are required by the document class but that
|
|
|
|
|
/// the user has chosen not to use
|
|
|
|
|
std::set<std::string> removedModules_;
|
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 first patch does some reworking of the infrastructrue. We need to distinguish between the TextClass that a particular document is using and the layout of that document, since modules, in particular, can modify the layout. The solution adopted here is to add a TextClass pointer to BufferParams, which will hold the layout. The layout itself is then constructed from the TextClass the document is using. At present, this is completely trivial, but that will change when modules are added.
The pointer in question is a boost::shared_ptr. This is needed because CutAndPaste saves a copy of the layout with each cut or copied selection. We cannot assume the selection vanishes when the document is closed, so there are two options: (i) keep a list of all the layouts that have ever been used by any document; (ii) used some kind of smart pointer. The latter seems preferable, as the former would waste memory. More importantly, the use of a smart pointer allows modules to be modified on disk and then reloaded while LyX is running, and it will eventually allow the same for layout files.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19756 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-23 16:41:13 +00:00
|
|
|
|
|
2003-09-09 17:00:19 +00:00
|
|
|
|
/** Use the Pimpl idiom to hide those member variables that would otherwise
|
2003-09-15 20:23:57 +00:00
|
|
|
|
* drag in other header files.
|
2003-09-09 17:00:19 +00:00
|
|
|
|
*/
|
|
|
|
|
class Impl;
|
2005-01-19 15:03:31 +00:00
|
|
|
|
class MemoryTraits {
|
|
|
|
|
public:
|
2003-09-15 20:23:57 +00:00
|
|
|
|
static Impl * clone(Impl const *);
|
|
|
|
|
static void destroy(Impl *);
|
|
|
|
|
};
|
2006-10-21 00:16:43 +00:00
|
|
|
|
support::copied_ptr<Impl, MemoryTraits> pimpl_;
|
2007-03-25 01:12:38 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
};
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
} // namespace lyx
|
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
#endif
|