X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Flyxtextclass.h;h=c2e36f3ea4a08bf6c0ca6fbf5d985a82e5468c77;hb=969ab85d985485f503790cb13f98a582d4e1cdb5;hp=2d1021f792d438591087ed20f1887b4a27c2f246;hpb=a0d71b53fea6dfb12489f937de0eb7218b0d20ea;p=lyx.git diff --git a/src/lyxtextclass.h b/src/lyxtextclass.h index 2d1021f792..c2e36f3ea4 100644 --- a/src/lyxtextclass.h +++ b/src/lyxtextclass.h @@ -1,92 +1,130 @@ // -*- C++ -*- -/* This file is part of - * ====================================================== +/** + * \file lyxtextclass.h + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. * - * LyX, The Document Processor - * - * Copyright 1995 Matthias Ettrich - * Copyright 1995-2001 The LyX Team. - * - * ====================================================== */ + * Full author contact details are available in file CREDITS. + */ #ifndef LYXTEXTCLASS_H #define LYXTEXTCLASS_H -#ifdef __GNUG__ -#pragma interface -#endif - #include "lyxlayout.h" -#include "LString.h" #include "lyxlayout_ptr_fwd.h" -#include "FloatList.h" -#include "support/types.h" +#include #include + +namespace lyx { + +namespace support { class FileName; } + class LyXLex; +class Counters; +class FloatList; + /// +class CharStyle { +public: + std::string name; + std::string latextype; + std::string latexname; + std::string latexparam; + LyXFont font; + LyXFont labelfont; + docstring preamble; +}; + + +/// List of semantically defined character style insets +typedef std::vector CharStyles; + + +/// Stores the layout specification of a LyX document class. class LyXTextClass { public: - /// + /// The individual styles comprising the document class typedef std::vector LayoutList; - /// + /// Enumerate the paragraph styles. typedef LayoutList::const_iterator const_iterator; - /// + /// Construct a layout with default values. Actual values loaded later. explicit - LyXTextClass (string const & = string(), - string const & = string(), - string const & = string()); + LyXTextClass(std::string const & = std::string(), + std::string const & = std::string(), + std::string const & = std::string(), + bool = false); - /// + /// check whether the TeX class is available + bool isTeXClassAvailable() const; + + /// paragraph styles begin iterator. const_iterator begin() const { return layoutlist_.begin(); } - /// + /// paragraph styles end iterator const_iterator end() const { return layoutlist_.end(); } - /// - bool Read(string const & filename, bool merge = false); + /// Performs the read of the layout file. + bool read(support::FileName const & filename, bool merge = false); /// void readOutputType(LyXLex &); /// + void readTitleType(LyXLex &); + /// void readMaxCounter(LyXLex &); /// void readClassOptions(LyXLex &); /// - bool hasLayout(string const & name) const; + void readCharStyle(LyXLex &, std::string const &); + /// + void readFloat(LyXLex &); + /// + void readCounter(LyXLex &); + /// + bool hasLayout(std::string const & name) const; /// - LyXLayout_ptr const & operator[](string const & vname) const; + LyXLayout_ptr const & operator[](std::string const & vname) const; /// Sees to that the textclass structure has been loaded - bool load() const; + bool load(std::string const & path = std::string()) const; + /// Has this layout file been loaded yet? + bool loaded() const { return loaded_; } - /// the list of floats defined in the class + /// the list of floats defined in the document class FloatList & floats(); - /// the list of floats defined in the class + /// the list of floats defined in the document class FloatList const & floats() const; - + /// The Counters present in this document class. + Counters & counters() const; + /// CharStyles of this doc class + CharStyles & charstyles() const { return charstylelist_; }; + /// Retrieve element of name s: + CharStyles::iterator charstyle(std::string const & s) const; /// - string const defaultLayoutName() const; + std::string const & defaultLayoutName() const; /// LyXLayout_ptr const & defaultLayout() const; /// - string const & name() const; + std::string const & name() const; /// - string const & latexname() const; + std::string const & latexname() const; /// - string const & description() const; + std::string const & description() const; /// - string const & opt_fontsize() const; + std::string const & opt_fontsize() const; /// - string const & opt_pagestyle() const; + std::string const & opt_pagestyle() const; /// - string const & options() const; + std::string const & options() const; /// - string const & pagestyle() const; + std::string const & class_header() const; /// - string const & preamble() const; + std::string const & pagestyle() const; + /// + docstring const & preamble() const; /// Packages that are already loaded by the class enum Provides { @@ -120,55 +158,67 @@ public: /// int tocdepth() const; - /// + /// Can be LaTeX, DocBook, etc. OutputType outputType() const; /// LyXFont const & defaultfont() const; /// Text that dictates how wide the left margin is on the screen - string const & leftmargin() const; + std::string const & leftmargin() const; /// Text that dictates how wide the right margin is on the screen - string const & rightmargin() const; - /// - int maxcounter() const; + std::string const & rightmargin() const; + + /// The type of command used to produce a title + LYX_TITLE_LATEX_TYPES titletype() const; + /// The name of the title command + std::string const & titlename() const; + /// int size() const; + /// The minimal TocLevel of sectioning layouts + int min_toclevel() const; + /// The maximal TocLevel of sectioning layouts + int max_toclevel() const; + /// returns true if the class has a ToC structure + bool hasTocLevels() const; private: /// - bool delete_layout(string const &); + bool delete_layout(std::string const &); /// bool do_readStyle(LyXLex &, LyXLayout &); - /// - string name_; - /// - string latexname_; - /// - string description_; + /// Layout file name + std::string name_; + /// document class name + std::string latexname_; + /// document class description + std::string description_; /// Specific class options - string opt_fontsize_; + std::string opt_fontsize_; /// - string opt_pagestyle_; + std::string opt_pagestyle_; /// - string options_; + std::string options_; /// - string pagestyle_; + std::string pagestyle_; /// - string defaultlayout_; - /// - string preamble_; + std::string class_header_; /// + std::string defaultlayout_; + /// preamble text to support layout styles + docstring preamble_; + /// latex packages loaded by document class. Provides provides_; /// unsigned int columns_; /// PageSides sides_; - /// + /// header depth to have numbering int secnumdepth_; - /// + /// header depth to appear in table of contents int tocdepth_; - /// + /// Can be LaTeX, DocBook, etc. OutputType outputType_; /** Base font. The paragraph and layout fonts are resolved against this font. This has to be fully instantiated. Attributes @@ -177,25 +227,41 @@ private: */ LyXFont defaultfont_; /// Text that dictates how wide the left margin is on the screen - string leftmargin_; + std::string leftmargin_; /// Text that dictates how wide the right margin is on the screen - string rightmargin_; - /// - int maxcounter_; // add approp. signedness + std::string rightmargin_; - /// + /// The type of command used to produce a title + LYX_TITLE_LATEX_TYPES titletype_; + /// The name of the title command + std::string titlename_; + + /// Paragraph styles used in this layout LayoutList layoutlist_; + /// CharStyles available to this layout + mutable CharStyles charstylelist_; - /// - FloatList floatlist_; + /// available types of float, eg. figure, algorithm. + boost::shared_ptr floatlist_; + + /// Types of counters, eg. sections, eqns, figures, avail. in document class. + boost::shared_ptr ctrs_; /// Has this layout file been loaded yet? - mutable bool loaded; + mutable bool loaded_; + + /// Is the TeX class available? + bool texClassAvail_; + + /// The minimal TocLevel of sectioning layouts + int min_toclevel_; + /// The maximal TocLevel of sectioning layouts + int max_toclevel_; }; -/// +/// Merge two different provides flags into one bit field record inline void operator|=(LyXTextClass::Provides & p1, LyXTextClass::Provides p2) { @@ -203,7 +269,10 @@ void operator|=(LyXTextClass::Provides & p1, LyXTextClass::Provides p2) } -/// +/// convert page sides option to text 1 or 2 std::ostream & operator<<(std::ostream & os, LyXTextClass::PageSides p); + +} // namespace lyx + #endif