2001-12-28 13:26:54 +00:00
|
|
|
|
// -*- C++ -*-
|
2003-08-23 00:17:00 +00:00
|
|
|
|
/**
|
2007-04-29 19:53:54 +00:00
|
|
|
|
* \file TextClassList.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
|
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.
|
|
|
|
|
*/
|
2001-12-28 13:26:54 +00:00
|
|
|
|
|
2007-11-07 21:52:11 +00:00
|
|
|
|
#ifndef TEXTCLASSLIST_H
|
|
|
|
|
#define TEXTCLASSLIST_H
|
2001-12-28 13:26:54 +00:00
|
|
|
|
|
2007-04-29 19:53:54 +00:00
|
|
|
|
#include "TextClass.h"
|
2004-11-16 20:41:38 +00:00
|
|
|
|
|
2007-11-07 21:52:11 +00:00
|
|
|
|
#include "support/strfwd.h"
|
2001-12-28 13:26:54 +00:00
|
|
|
|
#include "support/types.h"
|
|
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
|
2007-04-29 18:58:28 +00:00
|
|
|
|
class Layout;
|
2001-12-28 13:26:54 +00:00
|
|
|
|
|
|
|
|
|
/// Reads the style files
|
2006-07-05 17:01:26 +00:00
|
|
|
|
extern bool LyXSetStyle();
|
2001-12-28 13:26:54 +00:00
|
|
|
|
|
|
|
|
|
///
|
2007-11-07 21:52:11 +00:00
|
|
|
|
class TextClassList {
|
2001-12-28 13:26:54 +00:00
|
|
|
|
public:
|
2007-11-07 21:59:19 +00:00
|
|
|
|
///
|
|
|
|
|
TextClassList() {}
|
2001-12-28 13:26:54 +00:00
|
|
|
|
///
|
2007-04-29 19:53:54 +00:00
|
|
|
|
typedef std::vector<TextClass> ClassList;
|
2001-12-28 13:26:54 +00:00
|
|
|
|
///
|
|
|
|
|
typedef ClassList::const_iterator const_iterator;
|
|
|
|
|
///
|
2002-07-21 21:21:06 +00:00
|
|
|
|
const_iterator begin() const { return classlist_.begin(); }
|
2001-12-28 13:26:54 +00:00
|
|
|
|
///
|
2002-07-21 21:21:06 +00:00
|
|
|
|
const_iterator end() const { return classlist_.end(); }
|
2007-09-26 19:36:09 +00:00
|
|
|
|
///
|
|
|
|
|
bool empty() const { return classlist_.empty(); }
|
2001-12-28 13:26:54 +00:00
|
|
|
|
|
2002-05-29 13:28:11 +00:00
|
|
|
|
/// Gets textclass number from name, -1 if textclass name does not exist
|
2008-02-23 11:36:15 +00:00
|
|
|
|
std::pair<bool, TextClassIndex> const
|
|
|
|
|
numberOfClass(std::string const & textClassName) const;
|
2001-12-28 13:26:54 +00:00
|
|
|
|
|
|
|
|
|
///
|
2008-02-23 11:36:15 +00:00
|
|
|
|
TextClass const & operator[](TextClassIndex index) const;
|
|
|
|
|
TextClass & at(TextClassIndex index);
|
2001-12-28 13:26:54 +00:00
|
|
|
|
|
2002-05-29 13:28:11 +00:00
|
|
|
|
/// Read textclass list. Returns false if this fails.
|
2006-04-09 00:26:19 +00:00
|
|
|
|
bool read();
|
2007-09-11 16:42:22 +00:00
|
|
|
|
|
|
|
|
|
/// Clears the textclass so as to force it to be reloaded
|
2008-02-23 11:36:15 +00:00
|
|
|
|
void reset(TextClassIndex const & index);
|
2007-05-28 22:27:45 +00:00
|
|
|
|
|
|
|
|
|
/// add a textclass from user local directory.
|
|
|
|
|
/// Return ture/false, and textclass number
|
2008-02-23 11:36:15 +00:00
|
|
|
|
std::pair<bool, TextClassIndex> const
|
2007-05-28 22:27:45 +00:00
|
|
|
|
addTextClass(std::string const & textclass, std::string const & path);
|
2006-04-09 04:35:24 +00:00
|
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
|
private:
|
2007-11-07 21:52:11 +00:00
|
|
|
|
/// noncopyable
|
|
|
|
|
TextClassList(TextClassList const &);
|
|
|
|
|
void operator=(TextClassList const &);
|
|
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
|
///
|
2002-07-21 21:21:06 +00:00
|
|
|
|
mutable ClassList classlist_;
|
2001-12-28 13:26:54 +00:00
|
|
|
|
};
|
|
|
|
|
|
2002-03-21 17:27:08 +00:00
|
|
|
|
///
|
2007-04-29 19:53:54 +00:00
|
|
|
|
extern TextClassList textclasslist;
|
2007-10-21 10:50:56 +00:00
|
|
|
|
///
|
2008-02-23 11:36:15 +00:00
|
|
|
|
TextClassIndex defaultTextclass();
|
2001-12-28 13:26:54 +00:00
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
|
#endif
|