-///
-class LyXTextClass {
-public:
- ///
- typedef vector<LyXLayout> LayoutList;
- ///
- typedef LayoutList::const_iterator const_iterator;
- ///
- typedef LayoutList::size_type size_type;
- ///
- LyXTextClass (string const & = string(),
- string const & = string(),
- string const & = string());
-
- ///
- const_iterator begin() const { return layoutlist.begin(); }
- ///
- const_iterator end() const { return layoutlist.end(); }
-
- ///
- bool Read(string const & filename, bool merge = false);
- void readOutputType(LyXLex &);
- void readMaxCounter(LyXLex &);
- void readClassOptions(LyXLex &);
- ///
- bool hasLayout(string const & name) const;
-
- ///
- LyXLayout const & GetLayout(string const & vname) const;
-
- ///
- LyXLayout & GetLayout(string const & vname);
-
- /// Sees to that the textclass structure has been loaded
- void load();
-
- ///
- string const & name() const { return name_; }
- ///
- string const & latexname() const { return latexname_; }
- ///
- string const & description() const { return description_; }
- ///
- string const & opt_fontsize() const { return opt_fontsize_; }
- ///
- string const & opt_pagestyle() const { return opt_pagestyle_; }
- ///
- string const & options() const { return options_; }
- ///
- string const & pagestyle() const { return pagestyle_; }
- ///
- string const & preamble() const { return preamble_; }
-
- /// Packages that are already loaded by the class
- enum Provides {
- nothing = 0,
- amsmath = 1,
- makeidx = 2,
- url = 4
- };
- bool provides(Provides p) const { return provides_ & p; }
-
- ///
- unsigned int columns() const { return columns_; }
- ///
- enum PageSides {
- OneSide,
- TwoSides
- };
- ///
- PageSides sides() const { return sides_; }
- ///
- int secnumdepth() const { return secnumdepth_; }
- ///
- int tocdepth() const { return tocdepth_; }
-
- ///
- OutputType outputType() const { return outputType_; }
-
- ///
- LyXFont const & defaultfont() const { return defaultfont_; }
-
- /// Text that dictates how wide the left margin is on the screen
- string const & leftmargin() const { return leftmargin_; }
-
- /// Text that dictates how wide the right margin is on the screen
- string const & rightmargin() const { return rightmargin_; }
- ///
- int maxcounter() const { return maxcounter_; }
- ///
- size_type numLayouts() const { return layoutlist.size(); }
- ///
- LyXLayout const & operator[](size_type i) const {
- return layoutlist[i];
- }
-private:
- ///
- bool delete_layout(string const &);
- ///
- bool do_readStyle(LyXLex &, LyXLayout &);
- ///
- string name_;
- ///
- string latexname_;
- ///
- string description_;
- /// Specific class options
- string opt_fontsize_;
- ///
- string opt_pagestyle_;
- ///
- string options_;
- ///
- string pagestyle_;
- ///
- string preamble_;
- ///
- Provides provides_;
- ///
- unsigned int columns_;
- ///
- PageSides sides_;
- ///
- int secnumdepth_;
- ///
- int tocdepth_;
- ///
- OutputType outputType_;
- /** Base font. The paragraph and layout fonts are resolved against
- this font. This has to be fully instantiated. Attributes
- LyXFont::INHERIT, LyXFont::IGNORE, and LyXFont::TOGGLE are
- extremely illegal.
- */
- LyXFont defaultfont_;
- /// Text that dictates how wide the left margin is on the screen
- string leftmargin_;
-
- /// Text that dictates how wide the right margin is on the screen
- string rightmargin_;
- ///
- int maxcounter_; // add approp. signedness
-
- ///
- LayoutList layoutlist;
-
- /// Has this layout file been loaded yet?
- bool loaded;
-};
-
-
-///
-inline void operator|=(LyXTextClass::Provides & p1, LyXTextClass::Provides p2)
-{
- p1 = static_cast<LyXTextClass::Provides>(p1 | p2);
-}
-
-
-///
-inline ostream & operator<<(ostream & os, LyXTextClass::PageSides p)
-{
- switch (p) {
- case LyXTextClass::OneSide:
- os << "1";
- break;
- case LyXTextClass::TwoSides:
- os << "2";
- break;
- }
- return os;
-}
-
-
-///
-class LyXTextClassList {
-public:
- ///
- typedef vector<LyXTextClass> ClassList;
- ///
- typedef ClassList::const_iterator const_iterator;
- ///
- typedef ClassList::size_type size_type;
- ///
- const_iterator begin() const { return classlist.begin(); }
- ///
- const_iterator end() const { return classlist.end(); }
-
- /// Gets layout structure from layout number and textclass number
- LyXLayout const & Style(size_type textclass,
- LyXTextClass::size_type layout) const;
-
- /// Gets layout number from textclass number and layout name
- pair<bool, LyXTextClass::size_type>
- NumberOfLayout(size_type textclass,
- string const & name) const;
-
- /// Gets a layout name from layout number and textclass number
- string const &
- NameOfLayout(size_type textclass,
- LyXTextClass::size_type layout) const;
-
- /** Gets textclass number from name.
- Returns -1 if textclass name does not exist
- */
- pair<bool, size_type>
- NumberOfClass(string const & textclass) const;
-
- ///
- string const & NameOfClass(size_type number) const;
-
- ///
- string const & LatexnameOfClass(size_type number) const;
-
- ///
- string const & DescOfClass(size_type number) const;
-
- ///
- LyXTextClass const & TextClass(size_type textclass) const;