2000-03-10 13:52:19 +00:00
|
|
|
// -*- C++ -*-
|
2003-08-23 00:17:00 +00:00
|
|
|
/**
|
2007-04-26 04:41:58 +00:00
|
|
|
* \file Language.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
|
|
|
*
|
2010-01-19 10:22:08 +00:00
|
|
|
* \author Lars Gullik Bjønnes
|
2003-08-23 00:17:00 +00:00
|
|
|
* \author Jean-Marc Lasgouttes
|
|
|
|
* \author Dekel Tsur
|
2010-01-19 10:22:08 +00:00
|
|
|
* \author Jürgen Vigna
|
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.
|
|
|
|
*/
|
2000-07-24 13:53:19 +00:00
|
|
|
|
2000-03-10 13:52:19 +00:00
|
|
|
#ifndef LANGUAGE_H
|
|
|
|
#define LANGUAGE_H
|
|
|
|
|
|
|
|
#include <map>
|
2003-10-06 15:43:21 +00:00
|
|
|
#include <string>
|
|
|
|
|
2000-03-10 13:52:19 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
namespace lyx {
|
|
|
|
|
2006-11-26 21:30:39 +00:00
|
|
|
namespace support { class FileName; }
|
2006-10-21 00:16:43 +00:00
|
|
|
|
2000-07-04 20:32:37 +00:00
|
|
|
class Encoding;
|
2008-04-05 12:23:27 +00:00
|
|
|
class Lexer;
|
2000-07-04 20:32:37 +00:00
|
|
|
|
2000-06-08 23:16:16 +00:00
|
|
|
///
|
|
|
|
class Language {
|
|
|
|
public:
|
|
|
|
///
|
2005-07-16 12:02:31 +00:00
|
|
|
Language() : rightToLeft_(false) {}
|
2000-06-08 23:16:16 +00:00
|
|
|
///
|
2005-07-16 12:02:31 +00:00
|
|
|
std::string const & lang() const { return lang_; }
|
2000-06-08 23:16:16 +00:00
|
|
|
///
|
2005-07-16 12:02:31 +00:00
|
|
|
std::string const & babel() const { return babel_; }
|
2000-09-27 15:23:24 +00:00
|
|
|
///
|
2005-07-16 12:02:31 +00:00
|
|
|
std::string const & display() const { return display_; }
|
2000-06-08 23:16:16 +00:00
|
|
|
///
|
2006-04-09 00:26:19 +00:00
|
|
|
bool rightToLeft() const { return rightToLeft_; }
|
2000-07-04 20:32:37 +00:00
|
|
|
///
|
2005-07-16 12:02:31 +00:00
|
|
|
Encoding const * encoding() const { return encoding_; }
|
2000-09-22 15:09:51 +00:00
|
|
|
///
|
2005-07-16 15:55:36 +00:00
|
|
|
std::string const & encodingStr() const { return encodingStr_; }
|
|
|
|
///
|
2005-07-16 12:02:31 +00:00
|
|
|
std::string const & code() const { return code_; }
|
2001-01-20 14:16:01 +00:00
|
|
|
///
|
2010-01-19 10:22:08 +00:00
|
|
|
std::string const & variety() const { return variety_; }
|
|
|
|
///
|
2005-07-16 12:02:31 +00:00
|
|
|
std::string const & latex_options() const { return latex_options_; }
|
2008-04-05 12:23:27 +00:00
|
|
|
///
|
2008-11-21 14:53:47 +00:00
|
|
|
bool internalFontEncoding() const;
|
|
|
|
///
|
2008-04-05 12:23:27 +00:00
|
|
|
bool read(Lexer & lex);
|
2000-06-08 23:16:16 +00:00
|
|
|
private:
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string lang_;
|
2000-06-08 23:16:16 +00:00
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string babel_;
|
2000-09-27 15:23:24 +00:00
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string display_;
|
2000-06-08 23:16:16 +00:00
|
|
|
///
|
2005-07-16 12:02:31 +00:00
|
|
|
bool rightToLeft_;
|
2000-07-04 20:32:37 +00:00
|
|
|
///
|
2005-07-16 15:55:36 +00:00
|
|
|
std::string encodingStr_;
|
|
|
|
///
|
2000-07-04 20:32:37 +00:00
|
|
|
Encoding const * encoding_;
|
2000-09-22 15:09:51 +00:00
|
|
|
///
|
2010-01-19 10:22:08 +00:00
|
|
|
std::string codeStr_;
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string code_;
|
2001-01-20 14:16:01 +00:00
|
|
|
///
|
2010-01-19 10:22:08 +00:00
|
|
|
std::string variety_;
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string latex_options_;
|
2000-03-10 13:52:19 +00:00
|
|
|
};
|
|
|
|
|
2000-10-10 12:36:36 +00:00
|
|
|
class Languages
|
2000-04-26 13:57:28 +00:00
|
|
|
{
|
2000-10-10 12:36:36 +00:00
|
|
|
public:
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
typedef std::map<std::string, Language> LanguageList;
|
2000-10-10 12:36:36 +00:00
|
|
|
///
|
|
|
|
typedef LanguageList::const_iterator const_iterator;
|
|
|
|
///
|
2001-03-21 13:27:03 +00:00
|
|
|
typedef LanguageList::size_type size_type;
|
|
|
|
///
|
2006-11-26 21:30:39 +00:00
|
|
|
void read(support::FileName const & filename);
|
2000-10-10 12:36:36 +00:00
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
Language const * getLanguage(std::string const & language) const;
|
2000-10-10 12:36:36 +00:00
|
|
|
///
|
2005-07-16 12:02:31 +00:00
|
|
|
size_type size() const { return languagelist.size(); }
|
2001-03-21 13:27:03 +00:00
|
|
|
///
|
2005-07-16 12:02:31 +00:00
|
|
|
const_iterator begin() const { return languagelist.begin(); }
|
2002-03-21 17:27:08 +00:00
|
|
|
///
|
2005-07-16 12:02:31 +00:00
|
|
|
const_iterator end() const { return languagelist.end(); }
|
2002-03-21 17:27:08 +00:00
|
|
|
///
|
|
|
|
|
2000-10-10 12:36:36 +00:00
|
|
|
private:
|
|
|
|
///
|
|
|
|
LanguageList languagelist;
|
|
|
|
};
|
2000-04-26 13:57:28 +00:00
|
|
|
|
2008-05-07 18:53:48 +00:00
|
|
|
/// Global singleton instance.
|
2000-03-10 13:52:19 +00:00
|
|
|
extern Languages languages;
|
2008-05-07 18:53:48 +00:00
|
|
|
/// Default language defined in LyXRC
|
2000-03-17 10:14:46 +00:00
|
|
|
extern Language const * default_language;
|
2008-05-07 18:53:48 +00:00
|
|
|
/// Used to indicate that the language should be left unchanged when
|
|
|
|
/// applying a font change.
|
2001-03-21 13:27:03 +00:00
|
|
|
extern Language const * ignore_language;
|
2008-05-07 18:53:48 +00:00
|
|
|
/// Default language defined in LyXRC
|
2001-08-11 18:31:14 +00:00
|
|
|
extern Language const * latex_language;
|
2008-05-07 18:53:48 +00:00
|
|
|
/// Used to indicate that the language should be reset to the Buffer
|
|
|
|
// language when applying a font change.
|
|
|
|
extern Language const * reset_language;
|
2000-03-10 13:52:19 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
2000-03-10 13:52:19 +00:00
|
|
|
#endif
|