1999-09-27 18:44:28 +00:00
|
|
|
|
// -*- C++ -*-
|
2003-08-23 00:17:00 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file LaTeXFeatures.h
|
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
* \author Jean-Marc Lasgouttes
|
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
1999-10-02 16:21:10 +00:00
|
|
|
|
#ifndef LATEXFEATURES_H
|
|
|
|
|
#define LATEXFEATURES_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
|
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "OutputParams.h"
|
2006-10-21 19:40:29 +00:00
|
|
|
|
#include "support/docstring.h"
|
2006-03-28 18:49:46 +00:00
|
|
|
|
|
2000-03-17 10:14:46 +00:00
|
|
|
|
#include <set>
|
2001-11-19 15:34:11 +00:00
|
|
|
|
#include <list>
|
2001-12-28 13:26:54 +00:00
|
|
|
|
#include <map>
|
2003-10-07 06:45:25 +00:00
|
|
|
|
#include <string>
|
1999-10-02 16:21:10 +00:00
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
|
2003-09-18 14:13:23 +00:00
|
|
|
|
class Buffer;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
class BufferParams;
|
2005-01-19 15:03:31 +00:00
|
|
|
|
class Language;
|
1999-10-02 16:21:10 +00:00
|
|
|
|
|
2001-11-19 15:34:11 +00:00
|
|
|
|
/** The packages and commands that a buffer needs. This class
|
2004-10-05 10:11:42 +00:00
|
|
|
|
* contains a list<string>. Each of the LaTeX packages that a buffer needs
|
|
|
|
|
* should be added with void require(string const & name).
|
|
|
|
|
*
|
|
|
|
|
* i.e require("amssymb")
|
|
|
|
|
*
|
|
|
|
|
* To add support you should only need to require() the package name as
|
|
|
|
|
* packages which don't have special requirements are handled automatically.
|
|
|
|
|
* If your new package does need special consideration you'll need to alter
|
|
|
|
|
* string const getPackages() const;
|
2007-04-26 04:41:58 +00:00
|
|
|
|
* Remember to update the validate function in Buffer.cpp and Paragraph.cpp
|
2004-10-05 10:11:42 +00:00
|
|
|
|
* when you do so.
|
|
|
|
|
*/
|
2001-11-19 15:34:11 +00:00
|
|
|
|
class LaTeXFeatures {
|
|
|
|
|
public:
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2006-03-28 18:49:46 +00:00
|
|
|
|
LaTeXFeatures(Buffer const &, BufferParams const &,
|
2006-04-05 23:56:29 +00:00
|
|
|
|
OutputParams const &);
|
2001-11-09 13:44:48 +00:00
|
|
|
|
/// The packages needed by the document
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string const getPackages() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
/// The macros definitions needed by the document
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string const getMacros() const;
|
2002-05-10 12:58:07 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string const getBabelOptions() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
/// The definitions needed by the document's textclass
|
2006-11-08 17:22:44 +00:00
|
|
|
|
docstring const getTClassPreamble() const;
|
2006-08-23 12:43:46 +00:00
|
|
|
|
/// The sgml definitions needed by the document (docbook)
|
2006-10-21 19:40:29 +00:00
|
|
|
|
docstring const getLyXSGMLEntities() const;
|
2001-11-19 15:34:11 +00:00
|
|
|
|
/// The SGML Required to include the files added with includeFile();
|
2006-10-21 19:40:29 +00:00
|
|
|
|
docstring const getIncludedFiles(std::string const & fname) const;
|
2001-11-19 15:34:11 +00:00
|
|
|
|
/// Include a file for use with the SGML entities
|
2006-10-21 19:40:29 +00:00
|
|
|
|
void includeFile(docstring const & key, std::string const & name);
|
2001-11-19 15:34:11 +00:00
|
|
|
|
/// The float definitions.
|
2001-05-09 15:20:58 +00:00
|
|
|
|
void getFloatDefinitions(std::ostream & os) const;
|
2001-11-19 15:34:11 +00:00
|
|
|
|
/// Print requirements to lyxerr
|
2001-05-08 17:08:44 +00:00
|
|
|
|
void showStruct() const;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
///
|
2007-01-20 17:08:39 +00:00
|
|
|
|
void addPreambleSnippet(std::string const &);
|
2000-06-12 11:27:15 +00:00
|
|
|
|
/// Provide a string name-space to the requirements
|
2003-10-06 15:43:21 +00:00
|
|
|
|
void require(std::string const & name);
|
2005-01-24 17:12:19 +00:00
|
|
|
|
/// Which of the required packages are installed?
|
|
|
|
|
static void getAvailable();
|
2007-02-08 10:40:33 +00:00
|
|
|
|
/// Is the (required) package available?
|
|
|
|
|
static bool isAvailable(std::string const & name);
|
2007-04-06 09:02:23 +00:00
|
|
|
|
/// Has the package been required?
|
2003-10-06 15:43:21 +00:00
|
|
|
|
bool isRequired(std::string const & name) const;
|
2007-04-06 09:02:23 +00:00
|
|
|
|
/* Is it necessary to load the package? This is true is
|
|
|
|
|
isRequired is true and the feature is not provided by the
|
|
|
|
|
textclass.
|
|
|
|
|
*/
|
|
|
|
|
bool mustProvide(std::string const & name) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
void useFloat(std::string const & name);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2001-11-19 15:34:11 +00:00
|
|
|
|
void useLanguage(Language const *);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-02-16 00:54:43 +00:00
|
|
|
|
bool hasLanguages() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string getLanguages() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::set<std::string> getEncodingSet(std::string const & doc_encoding) const;
|
2000-05-19 16:46:01 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
void useLayout(std::string const & lyt);
|
2000-06-12 11:27:15 +00:00
|
|
|
|
///
|
2003-09-18 14:13:23 +00:00
|
|
|
|
Buffer const & buffer() const;
|
|
|
|
|
///
|
2004-04-08 10:09:09 +00:00
|
|
|
|
void setBuffer(Buffer const &);
|
|
|
|
|
///
|
2001-11-19 15:34:11 +00:00
|
|
|
|
BufferParams const & bufferParams() const;
|
2003-05-23 11:18:43 +00:00
|
|
|
|
/// the return value is dependent upon both LyXRC and LaTeXFeatures.
|
|
|
|
|
bool useBabel() const;
|
2006-03-28 18:49:46 +00:00
|
|
|
|
/// Runparams that will be used for exporting this file.
|
|
|
|
|
OutputParams const & runparams() const { return runparams_; }
|
2000-08-07 20:58:24 +00:00
|
|
|
|
|
2001-11-19 15:34:11 +00:00
|
|
|
|
private:
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::list<std::string> usedLayouts_;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
|
2001-11-19 15:34:11 +00:00
|
|
|
|
/// Static preamble bits from the external material insets
|
2003-10-06 15:43:21 +00:00
|
|
|
|
typedef std::list<std::string> FeaturesList;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-09-18 14:01:02 +00:00
|
|
|
|
FeaturesList features_;
|
2000-03-17 10:14:46 +00:00
|
|
|
|
///
|
2003-09-18 14:01:02 +00:00
|
|
|
|
FeaturesList preamble_snippets_;
|
2005-01-24 17:12:19 +00:00
|
|
|
|
/// The available (required) packages
|
|
|
|
|
typedef std::list<std::string> PackagesList;
|
|
|
|
|
///
|
|
|
|
|
static PackagesList packages_;
|
2003-09-04 01:49:21 +00:00
|
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
|
typedef std::set<Language const *> LanguageList;
|
2000-03-17 10:14:46 +00:00
|
|
|
|
///
|
2003-09-18 14:01:02 +00:00
|
|
|
|
LanguageList UsedLanguages_;
|
2000-06-28 13:35:52 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
typedef std::set<std::string> UsedFloats;
|
2000-06-28 13:35:52 +00:00
|
|
|
|
///
|
2003-09-18 14:01:02 +00:00
|
|
|
|
UsedFloats usedFloats_;
|
2000-07-01 12:54:45 +00:00
|
|
|
|
///
|
2006-10-21 19:40:29 +00:00
|
|
|
|
typedef std::map<docstring , std::string> FileMap;
|
2000-07-01 12:54:45 +00:00
|
|
|
|
///
|
2003-09-18 14:01:02 +00:00
|
|
|
|
FileMap IncludedFiles_;
|
2004-04-08 10:09:09 +00:00
|
|
|
|
/** Buffer of the file being processed.
|
|
|
|
|
* This may be a child buffer of the to-be-exported file and
|
|
|
|
|
* therefore may not be the buffer that belongs to params_.
|
|
|
|
|
* Only needed by InsetInclude::validate().
|
|
|
|
|
*/
|
|
|
|
|
Buffer const * buffer_;
|
2003-09-18 14:13:23 +00:00
|
|
|
|
///
|
2003-09-18 14:01:02 +00:00
|
|
|
|
BufferParams const & params_;
|
2006-03-28 18:49:46 +00:00
|
|
|
|
/** Some insets need to know details about the to-be-produced file
|
|
|
|
|
* in validate().
|
2004-01-21 17:52:07 +00:00
|
|
|
|
*/
|
2006-03-28 18:49:46 +00:00
|
|
|
|
OutputParams const & runparams_;
|
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
|