2007-11-07 22:31:07 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
|
|
|
* \file InsetLayout.h
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
2008-02-22 02:32:52 +00:00
|
|
|
* \author Martin Vermeer
|
|
|
|
* \author Richard Heck
|
|
|
|
*
|
2007-11-07 22:31:07 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef INSET_LAYOUT_H
|
|
|
|
#define INSET_LAYOUT_H
|
|
|
|
|
|
|
|
#include "ColorCode.h"
|
|
|
|
#include "FontInfo.h"
|
|
|
|
|
|
|
|
#include "support/docstring.h"
|
2009-10-27 19:17:52 +00:00
|
|
|
#include "support/debug.h"
|
2007-11-07 22:31:07 +00:00
|
|
|
|
2008-02-01 15:12:04 +00:00
|
|
|
#include <set>
|
2008-01-07 16:59:10 +00:00
|
|
|
#include <string>
|
|
|
|
|
2007-11-07 22:31:07 +00:00
|
|
|
namespace lyx {
|
|
|
|
|
2008-02-22 03:39:10 +00:00
|
|
|
class Lexer;
|
2008-07-28 15:14:37 +00:00
|
|
|
class TextClass;
|
2008-02-22 16:15:21 +00:00
|
|
|
|
2007-11-07 22:31:07 +00:00
|
|
|
///
|
|
|
|
class InsetLayout {
|
|
|
|
public:
|
2008-02-22 02:32:52 +00:00
|
|
|
///
|
|
|
|
InsetLayout();
|
|
|
|
///
|
2008-02-22 16:24:55 +00:00
|
|
|
enum InsetDecoration {
|
2008-10-25 13:41:02 +00:00
|
|
|
CLASSIC,
|
|
|
|
MINIMALISTIC,
|
|
|
|
CONGLOMERATE,
|
|
|
|
DEFAULT
|
2008-02-22 16:24:55 +00:00
|
|
|
};
|
2009-10-26 20:53:46 +00:00
|
|
|
///
|
2008-10-25 13:32:54 +00:00
|
|
|
enum InsetLyXType {
|
|
|
|
NOLYXTYPE,
|
|
|
|
CHARSTYLE,
|
|
|
|
CUSTOM,
|
|
|
|
ELEMENT,
|
|
|
|
END,
|
|
|
|
STANDARD
|
|
|
|
};
|
2009-10-26 20:53:46 +00:00
|
|
|
///
|
2008-10-25 14:02:25 +00:00
|
|
|
enum InsetLaTeXType {
|
|
|
|
NOLATEXTYPE,
|
|
|
|
COMMAND,
|
|
|
|
ENVIRONMENT,
|
|
|
|
ILT_ERROR
|
|
|
|
};
|
2008-02-22 16:24:55 +00:00
|
|
|
///
|
2008-12-16 14:13:02 +00:00
|
|
|
bool read(Lexer & lexrc, TextClass const & tclass);
|
2008-02-22 03:27:42 +00:00
|
|
|
///
|
2009-06-06 03:02:43 +00:00
|
|
|
docstring name() const { return name_; }
|
2008-02-22 02:32:52 +00:00
|
|
|
///
|
2008-12-16 16:11:15 +00:00
|
|
|
void setName(docstring const & n) { name_ = n; }
|
|
|
|
///
|
2009-06-06 03:02:43 +00:00
|
|
|
InsetLyXType lyxtype() const { return lyxtype_; }
|
2008-02-22 02:32:52 +00:00
|
|
|
///
|
2009-06-06 03:02:43 +00:00
|
|
|
docstring labelstring() const { return labelstring_; }
|
2008-02-22 02:32:52 +00:00
|
|
|
///
|
2009-06-06 03:02:43 +00:00
|
|
|
InsetDecoration decoration() const { return decoration_; }
|
2008-02-22 02:32:52 +00:00
|
|
|
///
|
2009-06-06 03:02:43 +00:00
|
|
|
InsetLaTeXType latextype() const { return latextype_; }
|
2008-02-22 02:32:52 +00:00
|
|
|
///
|
2009-06-06 03:02:43 +00:00
|
|
|
std::string latexname() const { return latexname_; }
|
2008-02-22 02:32:52 +00:00
|
|
|
///
|
2009-06-06 03:02:43 +00:00
|
|
|
std::string latexparam() const { return latexparam_; }
|
2008-02-22 02:32:52 +00:00
|
|
|
///
|
2009-06-06 03:02:43 +00:00
|
|
|
FontInfo font() const { return font_; }
|
2008-02-22 02:32:52 +00:00
|
|
|
///
|
2009-06-06 03:02:43 +00:00
|
|
|
FontInfo labelfont() const { return labelfont_; }
|
2008-02-22 02:32:52 +00:00
|
|
|
///
|
2009-06-06 03:02:43 +00:00
|
|
|
ColorCode bgcolor() const { return bgcolor_; }
|
2008-02-22 02:32:52 +00:00
|
|
|
///
|
2009-06-06 03:02:43 +00:00
|
|
|
docstring preamble() const { return preamble_; }
|
|
|
|
///
|
|
|
|
docstring counter() const { return counter_; }
|
|
|
|
///
|
2009-10-27 19:46:47 +00:00
|
|
|
std::string const & htmltag() const;
|
2009-06-05 17:36:51 +00:00
|
|
|
///
|
2009-10-27 19:17:52 +00:00
|
|
|
std::string const & htmlattr() const;
|
|
|
|
///
|
|
|
|
std::string const & htmlinnertag() const { return htmlinnertag_; }
|
|
|
|
///
|
|
|
|
std::string const & htmlinnerattr() const;
|
2009-06-06 03:02:43 +00:00
|
|
|
///
|
|
|
|
std::string const & htmllabel() const { return htmllabel_; }
|
2009-10-27 19:17:52 +00:00
|
|
|
///
|
|
|
|
inline std::string htmllabeltag() const { return "span"; }
|
|
|
|
///
|
|
|
|
std::string htmllabelattr() const
|
|
|
|
{ return "class=\"" + defaultCSSClass() + "_label\""; }
|
2009-06-05 17:36:51 +00:00
|
|
|
///
|
2009-10-27 14:33:01 +00:00
|
|
|
docstring htmlstyle() const;
|
2009-06-05 19:42:56 +00:00
|
|
|
///
|
|
|
|
docstring htmlpreamble() const { return htmlpreamble_; }
|
2008-02-22 02:32:52 +00:00
|
|
|
///
|
2009-10-26 20:53:46 +00:00
|
|
|
bool htmlisblock() const { return htmlisblock_; }
|
|
|
|
///
|
2009-12-03 23:10:08 +00:00
|
|
|
std::set<std::string> requires() const { return requires_; }
|
2008-02-22 02:32:52 +00:00
|
|
|
///
|
2009-12-03 23:10:08 +00:00
|
|
|
bool isMultiPar() const { return multipar_; }
|
2008-02-22 02:32:52 +00:00
|
|
|
///
|
2008-10-05 19:38:22 +00:00
|
|
|
bool forcePlainLayout() const { return forceplain_; }
|
|
|
|
///
|
|
|
|
bool allowParagraphCustomization() const { return custompars_; }
|
|
|
|
///
|
2009-12-03 23:10:08 +00:00
|
|
|
bool isPassThru() const { return passthru_; }
|
2008-02-22 02:32:52 +00:00
|
|
|
///
|
2009-12-03 23:10:08 +00:00
|
|
|
bool isNeedProtect() const { return needprotect_; }
|
2008-02-22 02:32:52 +00:00
|
|
|
///
|
2009-12-03 23:10:08 +00:00
|
|
|
bool isFreeSpacing() const { return freespacing_; }
|
2008-02-22 02:32:52 +00:00
|
|
|
///
|
2009-12-03 23:10:08 +00:00
|
|
|
bool isKeepEmpty() const { return keepempty_; }
|
2008-02-22 02:32:52 +00:00
|
|
|
///
|
2009-12-03 23:10:08 +00:00
|
|
|
bool forceLTR() const { return forceltr_; }
|
2009-02-06 17:54:33 +00:00
|
|
|
///
|
2009-12-03 23:10:08 +00:00
|
|
|
bool isInToc() const { return intoc_; }
|
2009-10-27 14:33:01 +00:00
|
|
|
///
|
2008-02-22 02:32:52 +00:00
|
|
|
private:
|
2009-10-27 14:33:01 +00:00
|
|
|
///
|
|
|
|
void makeDefaultCSS() const;
|
|
|
|
///
|
|
|
|
std::string defaultCSSClass() const;
|
|
|
|
///
|
|
|
|
std::string defaultCSSLabelClass() const { return defaultCSSClass() + "_label"; }
|
2008-02-22 02:32:52 +00:00
|
|
|
///
|
2008-02-22 03:27:42 +00:00
|
|
|
docstring name_;
|
2008-04-06 16:17:03 +00:00
|
|
|
/**
|
|
|
|
* This is only used (at present) to decide where to put them on the menus.
|
|
|
|
* Values are 'charstyle', 'custom' (things that by default look like a
|
|
|
|
* footnote), 'element' (docbook), 'standard'.
|
|
|
|
*/
|
2008-10-25 13:32:54 +00:00
|
|
|
InsetLyXType lyxtype_;
|
2008-02-22 02:32:52 +00:00
|
|
|
///
|
|
|
|
docstring labelstring_;
|
|
|
|
///
|
2008-02-22 16:15:21 +00:00
|
|
|
InsetDecoration decoration_;
|
2008-02-22 02:32:52 +00:00
|
|
|
///
|
2008-10-25 14:02:25 +00:00
|
|
|
InsetLaTeXType latextype_;
|
2008-02-22 02:32:52 +00:00
|
|
|
///
|
|
|
|
std::string latexname_;
|
|
|
|
///
|
|
|
|
std::string latexparam_;
|
|
|
|
///
|
|
|
|
FontInfo font_;
|
|
|
|
///
|
|
|
|
FontInfo labelfont_;
|
|
|
|
///
|
|
|
|
ColorCode bgcolor_;
|
|
|
|
///
|
2009-06-06 03:02:43 +00:00
|
|
|
docstring counter_;
|
|
|
|
///
|
2009-06-03 23:44:31 +00:00
|
|
|
docstring preamble_;
|
2009-10-27 19:46:47 +00:00
|
|
|
/// The tag enclosing all the material in this inset. Default is "span".
|
|
|
|
mutable std::string htmltag_;
|
2009-10-27 14:33:01 +00:00
|
|
|
/// Additional attributes for inclusion with the start tag. Default (if
|
|
|
|
/// a tag is provided) is: class="name".
|
2009-10-27 19:17:52 +00:00
|
|
|
mutable std::string htmlattr_;
|
2009-10-27 14:33:01 +00:00
|
|
|
/// Tag for individual paragraphs in the inset. Default is none.
|
2009-06-06 03:02:43 +00:00
|
|
|
std::string htmlinnertag_;
|
2009-10-27 14:33:01 +00:00
|
|
|
/// Attributes for that tag. Default (if a tag is provided) is:
|
|
|
|
/// class="name_inner".
|
2009-10-27 19:17:52 +00:00
|
|
|
mutable std::string htmlinnerattr_;
|
2009-10-26 20:53:46 +00:00
|
|
|
/// A label for this environment, possibly including a reference
|
|
|
|
/// to a counter. E.g., for footnote, it might be:
|
2009-12-03 23:10:08 +00:00
|
|
|
/// \arabic{footnote}
|
2009-10-27 14:33:01 +00:00
|
|
|
/// No default.
|
|
|
|
/// FIXME Could we get this from the layout?
|
2009-06-06 03:02:43 +00:00
|
|
|
std::string htmllabel_;
|
2009-10-26 20:53:46 +00:00
|
|
|
/// CSS associated with this inset.
|
2009-06-05 17:36:51 +00:00
|
|
|
docstring htmlstyle_;
|
2009-10-27 14:33:01 +00:00
|
|
|
/// Cache for default CSS info for this inset.
|
|
|
|
mutable docstring htmldefaultstyle_;
|
|
|
|
///
|
|
|
|
mutable std::string defaultcssclass_;
|
|
|
|
/// Whether to force generation of default CSS even if some is given.
|
|
|
|
/// False by default.
|
|
|
|
bool htmlforcecss_;
|
2009-10-26 20:53:46 +00:00
|
|
|
/// Additional material for the header.
|
2009-06-05 19:42:56 +00:00
|
|
|
docstring htmlpreamble_;
|
2009-10-26 20:53:46 +00:00
|
|
|
/// Whether this inset represents a "block" of material, i.e., a set
|
|
|
|
/// of paragraphs of its own (true), or should be run into the previous
|
|
|
|
/// paragraph (false). Examples:
|
|
|
|
/// For branches, this is false.
|
|
|
|
/// For footnotes, this is true.
|
|
|
|
/// Defaults to true.
|
|
|
|
bool htmlisblock_;
|
2008-02-22 02:32:52 +00:00
|
|
|
///
|
|
|
|
std::set<std::string> requires_;
|
|
|
|
///
|
|
|
|
bool multipar_;
|
2008-10-05 19:38:22 +00:00
|
|
|
///
|
|
|
|
bool custompars_;
|
|
|
|
///
|
|
|
|
bool forceplain_;
|
2008-02-22 02:32:52 +00:00
|
|
|
///
|
|
|
|
bool passthru_;
|
|
|
|
///
|
|
|
|
bool needprotect_;
|
|
|
|
///
|
|
|
|
bool freespacing_;
|
|
|
|
///
|
|
|
|
bool keepempty_;
|
|
|
|
///
|
|
|
|
bool forceltr_;
|
2009-02-06 17:54:33 +00:00
|
|
|
/// should the contents be written to TOC strings?
|
|
|
|
bool intoc_;
|
2007-11-07 22:31:07 +00:00
|
|
|
};
|
|
|
|
|
2008-10-25 13:32:54 +00:00
|
|
|
///
|
|
|
|
InsetLayout::InsetLyXType translateLyXType(std::string const & str);
|
|
|
|
|
2007-11-07 22:31:07 +00:00
|
|
|
} // namespace lyx
|
|
|
|
|
|
|
|
#endif
|