+/// A DocumentClass represents the layout information associated with a
+/// Buffer. It is based upon a LayoutFile, but may be modified by loading
+/// various Modules.
+///
+/// In that regard, DocumentClass objects are "dynamic". But this is really
+/// an illusion, since DocumentClass objects are not (currently) changed
+/// when, say, a new Module is loaded. Rather, the old DocumentClass is
+/// discarded---actually, it will be kept around if something on the cut
+/// stack needs it---and a new one is created from scratch.
+class DocumentClass : public TextClass {
+public:
+ ///
+ virtual ~DocumentClass() {}
+
+ ///////////////////////////////////////////////////////////////////
+ // Layout Info
+ ///////////////////////////////////////////////////////////////////
+ /// \return true if there is a Layout with latexname lay
+ bool hasLaTeXLayout(std::string const & lay) const;
+ /// A DocumentClass nevers count as loaded, since it is dynamic
+ virtual bool loaded() const { return false; }
+ /// \return the layout object of an inset given by name. If the name
+ /// is not found as such, the part after the ':' is stripped off, and
+ /// searched again. In this way, an error fallback can be provided:
+ /// An erroneous 'CharStyle:badname' (e.g., after a documentclass switch)
+ /// will invoke the layout object defined by name = 'CharStyle'.
+ /// If that doesn't work either, an empty object returns (shouldn't
+ /// happen). -- Idea JMarc, comment MV
+ InsetLayout const & insetLayout(docstring const & name) const;
+ /// a plain inset layout for use as a default
+ static InsetLayout const & plainInsetLayout();
+ /// add a new layout \c name if it does not exist in layoutlist_
+ /// \return whether we had to add one.
+ bool addLayoutIfNeeded(docstring const & name) const;
+ /// Forced layouts in layout file syntax
+ std::string forcedLayouts() const;
+
+ ///////////////////////////////////////////////////////////////////
+ // accessors
+ ///////////////////////////////////////////////////////////////////
+ /// the list of floats defined in the document class
+ FloatList const & floats() const { return floatlist_; }
+ ///
+ Counters & counters() const { return counters_; }
+ ///
+ std::string const & opt_enginetype() const { return opt_enginetype_; }
+ ///
+ std::string const & opt_fontsize() const { return opt_fontsize_; }
+ ///
+ std::string const & opt_pagestyle() const { return opt_pagestyle_; }
+ ///
+ std::string const & options() const { return options_; }
+ ///
+ std::string const & class_header() const { return class_header_; }
+ ///
+ std::string const & pagestyle() const { return pagestyle_; }
+ ///
+ docstring const & preamble() const { return preamble_; }
+ ///
+ docstring const & htmlpreamble() const { return htmlpreamble_; }
+ ///
+ docstring const & htmlstyles() const { return htmlstyles_; }
+ /// Looks for the layout of "highest level", other than Part (or other
+ /// layouts with a negative toc number), for use in constructing TOCs and
+ /// similar information.
+ Layout const & getTOCLayout() const;
+ /// the paragraph style to use for TOCs, Bibliography, etc
+ /// we will attempt to calculate this if it was not given
+ Layout const & htmlTOCLayout() const;
+ /// is this feature already provided by the class?
+ bool provides(std::string const & p) const;
+ /// features required by the class?
+ std::set<std::string> const & requires() const { return requires_; }
+ /// package options to write to LaTeX file
+ std::map<std::string, std::string> const & packageOptions() const
+ { return package_options_; }
+ ///
+ unsigned int columns() const { return columns_; }
+ ///
+ PageSides sides() const { return sides_; }
+ ///
+ int secnumdepth() const { return secnumdepth_; }
+ ///
+ int tocdepth() const { return tocdepth_; }
+ ///
+ FontInfo const & defaultfont() const { return defaultfont_; }
+ /// Text that dictates how wide the left margin is on the screen
+ docstring const & leftmargin() const { return leftmargin_; }
+ /// Text that dictates how wide the right margin is on the screen
+ docstring const & rightmargin() const { return rightmargin_; }
+ /// The type of command used to produce a title
+ TitleLatexType titletype() const { return titletype_; }
+ /// The name of the title command
+ std::string const & titlename() const { return titlename_; }
+ ///
+ int size() const { return layoutlist_.size(); }
+ /// The minimal TocLevel of sectioning layouts
+ int min_toclevel() const { return min_toclevel_; }
+ /// The maximal TocLevel of sectioning layouts
+ int max_toclevel() const { return max_toclevel_; }
+ /// returns true if the class has a ToC structure
+ bool hasTocLevels() const;
+ ///
+ std::string const & getCiteFormat(CiteEngineType const & type,
+ std::string const & entry, std::string const & fallback = "") const;
+ ///
+ std::string const & getCiteMacro(CiteEngineType const & type,
+ std::string const & macro) const;
+ ///
+ std::vector<std::string> const citeCommands(CiteEngineType const &) const;
+ ///
+ std::vector<CitationStyle> const & citeStyles(CiteEngineType const &) const;
+ ///
+ std::string const & defaultBiblioStyle() const { return cite_default_biblio_style_; }
+ ///
+ bool const & fullAuthorList() const { return cite_full_author_list_; }
+protected:
+ /// Constructs a DocumentClass based upon a LayoutFile.
+ DocumentClass(LayoutFile const & tc);
+ /// Needed in tex2lyx
+ DocumentClass() {}
+private:
+ /// The only way to make a DocumentClass is to call this function.
+ friend DocumentClassPtr
+ getDocumentClass(LayoutFile const &, LayoutModuleList const &,
+ bool const clone);
+};
+
+
+/// The only way to make a DocumentClass is to call this function.
+/// The shared_ptr is needed because DocumentClass objects can be kept
+/// in memory long after their associated Buffer is destroyed, mostly
+/// on the CutStack.
+DocumentClassPtr getDocumentClass(LayoutFile const & baseClass,
+ LayoutModuleList const & modlist,
+ bool const clone = false);
+