2001-12-28 13:26:54 +00:00
|
|
|
// -*- C++ -*-
|
2003-08-22 09:44:59 +00:00
|
|
|
/**
|
2007-04-29 18:58:28 +00:00
|
|
|
* \file Layout.h
|
2003-08-22 09:44:59 +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
|
|
|
*
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author Lars Gullik Bjønnes
|
2003-08-22 09:44:59 +00:00
|
|
|
* \author Jean-Marc Lasgouttes
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author André Pönitz
|
2002-03-21 17:27:08 +00:00
|
|
|
*
|
2003-08-22 09:44:59 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
2001-12-28 13:26:54 +00:00
|
|
|
|
2007-09-29 20:02:32 +00:00
|
|
|
#ifndef LAYOUT_H
|
|
|
|
#define LAYOUT_H
|
2001-12-28 13:26:54 +00:00
|
|
|
|
2007-10-28 18:51:54 +00:00
|
|
|
#include "FontInfo.h"
|
2007-09-29 20:02:32 +00:00
|
|
|
#include "LayoutEnums.h"
|
2001-12-28 13:26:54 +00:00
|
|
|
#include "Spacing.h"
|
2012-11-19 13:21:02 +00:00
|
|
|
#include "support/debug.h"
|
2006-10-20 22:17:16 +00:00
|
|
|
#include "support/docstring.h"
|
2003-10-06 15:43:21 +00:00
|
|
|
|
2012-11-19 13:21:02 +00:00
|
|
|
#include <map>
|
2008-02-01 15:12:04 +00:00
|
|
|
#include <set>
|
2008-01-07 16:59:10 +00:00
|
|
|
#include <string>
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
namespace lyx {
|
|
|
|
|
2007-04-26 11:30:54 +00:00
|
|
|
class Lexer;
|
2007-04-29 19:53:54 +00:00
|
|
|
class TextClass;
|
2001-12-28 13:26:54 +00:00
|
|
|
|
2009-10-24 20:21:54 +00:00
|
|
|
/* Fixed labels are printed flushright, manual labels flushleft.
|
2007-04-29 22:04:32 +00:00
|
|
|
* MARGIN_MANUAL and MARGIN_FIRST_DYNAMIC are *only* for LABEL_MANUAL,
|
|
|
|
* MARGIN_DYNAMIC and MARGIN_STATIC are *not* for LABEL_MANUAL.
|
|
|
|
* This seems a funny restriction, but I think other combinations are
|
|
|
|
* not needed, so I will not change it yet.
|
2009-10-24 20:21:54 +00:00
|
|
|
* Correction: MARGIN_FIRST_DYNAMIC also usable with LABEL_STATIC.
|
2007-04-29 22:04:32 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/* There is a parindent and a parskip. Which one is used depends on the
|
|
|
|
* paragraph_separation-flag of the text-object.
|
|
|
|
* BUT: parindent is only thrown away, if a parskip is defined! So if you
|
|
|
|
* want a space between the paragraphs and a parindent at the same time,
|
|
|
|
* you should set parskip to zero and use topsep, parsep and bottomsep.
|
|
|
|
*
|
|
|
|
* The standard layout is an exception: its parindent is only set, if the
|
|
|
|
* previous paragraph is standard too. Well, this is LateX and it is good!
|
|
|
|
*/
|
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2007-04-29 18:58:28 +00:00
|
|
|
class Layout {
|
2001-12-28 13:26:54 +00:00
|
|
|
public:
|
|
|
|
///
|
2007-04-29 18:58:28 +00:00
|
|
|
Layout();
|
2008-07-11 02:43:02 +00:00
|
|
|
/// is this layout a default layout created for an unknown layout
|
|
|
|
bool isUnknown() const { return unknown_; }
|
|
|
|
void setUnknown(bool unknown) { unknown_ = unknown; }
|
2007-09-29 20:02:32 +00:00
|
|
|
/// Reads a layout definition from file
|
2008-02-14 04:12:15 +00:00
|
|
|
/// \return true on success.
|
2020-09-29 02:07:08 +00:00
|
|
|
bool read(Lexer &, TextClass const &, bool validating = false);
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2007-04-26 11:30:54 +00:00
|
|
|
void readAlign(Lexer &);
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2007-04-26 11:30:54 +00:00
|
|
|
void readAlignPossible(Lexer &);
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2007-04-26 11:30:54 +00:00
|
|
|
void readLabelType(Lexer &);
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2007-04-26 11:30:54 +00:00
|
|
|
void readEndLabelType(Lexer &);
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2007-04-26 11:30:54 +00:00
|
|
|
void readMargin(Lexer &);
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2007-04-26 11:30:54 +00:00
|
|
|
void readLatexType(Lexer &);
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2007-04-26 11:30:54 +00:00
|
|
|
void readSpacing(Lexer &);
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2020-09-29 02:07:08 +00:00
|
|
|
void readArgument(Lexer &, bool);
|
2013-03-31 13:33:26 +00:00
|
|
|
/// Write a layout definition in utf8 encoding
|
|
|
|
void write(std::ostream &) const;
|
2012-11-19 13:21:02 +00:00
|
|
|
///
|
2009-11-15 02:30:02 +00:00
|
|
|
docstring const & name() const { return name_; }
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2009-06-02 13:45:32 +00:00
|
|
|
void setName(docstring const & n) { name_ = n; }
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2009-06-02 13:45:32 +00:00
|
|
|
docstring const & obsoleted_by() const { return obsoleted_by_; }
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2009-06-02 13:45:32 +00:00
|
|
|
docstring const & depends_on() const { return depends_on_; }
|
2002-07-20 20:47:54 +00:00
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string const & latexname() const { return latexname_; }
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2012-12-19 15:55:22 +00:00
|
|
|
std::string const & itemcommand() const { return itemcommand_; }
|
2021-02-14 06:07:04 +00:00
|
|
|
/// One argument of this layout
|
2012-11-19 13:21:02 +00:00
|
|
|
struct latexarg {
|
|
|
|
docstring labelstring;
|
2012-12-09 18:15:41 +00:00
|
|
|
docstring menustring;
|
2020-09-29 01:30:40 +00:00
|
|
|
bool mandatory = false;
|
|
|
|
bool nodelims = false;
|
2012-11-19 13:21:02 +00:00
|
|
|
docstring ldelim;
|
|
|
|
docstring rdelim;
|
2013-02-24 10:29:21 +00:00
|
|
|
docstring defaultarg;
|
2012-12-10 13:09:51 +00:00
|
|
|
docstring presetarg;
|
2012-11-19 13:21:02 +00:00
|
|
|
docstring tooltip;
|
2020-05-03 06:18:17 +00:00
|
|
|
std::string required;
|
2012-11-26 08:10:14 +00:00
|
|
|
std::string decoration;
|
2020-09-29 01:30:40 +00:00
|
|
|
FontInfo font = inherit_font;
|
|
|
|
FontInfo labelfont = inherit_font;
|
|
|
|
bool autoinsert = false;
|
|
|
|
bool insertcotext = false;
|
|
|
|
bool insertonnewline = false;
|
|
|
|
ArgPassThru passthru = PT_INHERITED;
|
2015-05-08 07:32:31 +00:00
|
|
|
docstring pass_thru_chars;
|
2020-09-29 01:30:40 +00:00
|
|
|
bool is_toc_caption = false;
|
|
|
|
bool free_spacing = false;
|
2019-04-18 09:35:03 +00:00
|
|
|
std::string newlinecmd;
|
2021-02-14 06:07:04 +00:00
|
|
|
/// The DocBook tag corresponding to this argument.
|
2020-10-21 12:54:25 +00:00
|
|
|
docstring docbooktag;
|
|
|
|
docstring docbooktagtype;
|
|
|
|
docstring docbookattr;
|
2022-02-15 11:50:25 +00:00
|
|
|
/// Whether this argument should be output after the main tag (default: inside). The result if the argument
|
|
|
|
/// should be output both before and after the main tag is undefined.
|
2020-11-28 21:43:00 +00:00
|
|
|
bool docbookargumentbeforemaintag = false;
|
2022-02-15 11:50:25 +00:00
|
|
|
/// Whether this argument should be output before the main tag (default: inside). The result if the argument
|
|
|
|
/// should be output both before and after the main tag is undefined.
|
2021-02-14 06:07:04 +00:00
|
|
|
bool docbookargumentaftermaintag = false;
|
2012-11-19 13:21:02 +00:00
|
|
|
};
|
|
|
|
///
|
2012-11-29 14:34:20 +00:00
|
|
|
typedef std::map<std::string, latexarg> LaTeXArgMap;
|
2012-11-19 13:21:02 +00:00
|
|
|
///
|
|
|
|
LaTeXArgMap const & latexargs() const { return latexargs_; }
|
|
|
|
///
|
2012-12-28 10:21:24 +00:00
|
|
|
LaTeXArgMap const & postcommandargs() const { return postcommandargs_; }
|
|
|
|
///
|
2018-08-17 08:22:32 +00:00
|
|
|
LaTeXArgMap const & listpreamble() const { return listpreamble_; }
|
|
|
|
///
|
2012-11-29 14:34:20 +00:00
|
|
|
LaTeXArgMap const & itemargs() const { return itemargs_; }
|
2017-05-12 22:51:21 +00:00
|
|
|
/// Returns true is the layout has arguments. If false, then an
|
|
|
|
/// InsetArgument in this layout stands for the parent InsetText.
|
|
|
|
bool hasArgs() const;
|
2014-04-07 06:46:35 +00:00
|
|
|
/// Returns latexargs() + postcommandargs() + itemargs().
|
|
|
|
/// But note that it returns a *copy*, not a reference, so do not do
|
|
|
|
/// anything like:
|
2014-04-07 15:02:21 +00:00
|
|
|
/// Layout::LaTeXArgMap::iterator it = args().begin();
|
|
|
|
/// Layout::LaTeXArgMap::iterator en = args().end();
|
2014-04-07 06:46:35 +00:00
|
|
|
/// Those are iterators for different containers.
|
|
|
|
LaTeXArgMap args() const;
|
2012-11-29 14:34:20 +00:00
|
|
|
///
|
2012-11-19 13:21:02 +00:00
|
|
|
int optArgs() const;
|
|
|
|
///
|
|
|
|
int requiredArgs() const;
|
2009-06-02 13:45:32 +00:00
|
|
|
///
|
2017-07-03 17:45:58 +00:00
|
|
|
docstring const & labelstring(bool in_appendix) const
|
2009-07-12 21:48:50 +00:00
|
|
|
{ return in_appendix ? labelstring_appendix_ : labelstring_; }
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2007-09-20 20:44:08 +00:00
|
|
|
docstring const & endlabelstring() const { return endlabelstring_; }
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2008-03-06 05:01:44 +00:00
|
|
|
docstring const & category() const { return category_; }
|
|
|
|
///
|
2006-11-08 17:22:44 +00:00
|
|
|
docstring const & preamble() const { return preamble_; }
|
2009-02-04 20:06:50 +00:00
|
|
|
/// Get language dependent macro definitions needed for this layout
|
|
|
|
/// for language \p lang
|
2012-04-10 18:21:01 +00:00
|
|
|
docstring const langpreamble() const { return langpreamble_; }
|
2009-02-17 20:25:56 +00:00
|
|
|
/// Get language and babel dependent macro definitions needed for
|
|
|
|
/// this layout for language \p lang
|
2012-04-10 18:21:01 +00:00
|
|
|
docstring const babelpreamble() const { return babelpreamble_; }
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2020-05-04 18:05:44 +00:00
|
|
|
std::set<std::string> const & required() const { return required_; }
|
2008-01-07 16:59:10 +00:00
|
|
|
///
|
2017-12-29 09:03:00 +00:00
|
|
|
std::set<docstring> const & autonests() const { return autonests_; }
|
2017-12-28 16:44:54 +00:00
|
|
|
///
|
2017-12-29 09:36:03 +00:00
|
|
|
std::set<docstring> const & isAutonestedBy() const { return autonested_by_; }
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string const & latexparam() const { return latexparam_; }
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2012-11-25 18:10:16 +00:00
|
|
|
docstring leftdelim() const { return leftdelim_; }
|
|
|
|
///
|
|
|
|
docstring rightdelim() const { return rightdelim_; }
|
|
|
|
///
|
2003-11-14 14:05:03 +00:00
|
|
|
std::string const & innertag() const { return innertag_; }
|
|
|
|
///
|
2003-11-25 17:23:36 +00:00
|
|
|
std::string const & labeltag() const { return labeltag_; }
|
|
|
|
///
|
|
|
|
std::string const & itemtag() const { return itemtag_; }
|
2017-07-03 17:45:58 +00:00
|
|
|
///
|
2009-10-27 13:29:26 +00:00
|
|
|
std::string const & htmltag() const;
|
2017-07-03 17:45:58 +00:00
|
|
|
///
|
2022-12-06 04:42:50 +00:00
|
|
|
std::string const & htmlattr() const { return htmlattr_; }
|
2017-07-03 17:45:58 +00:00
|
|
|
///
|
2022-12-04 18:27:19 +00:00
|
|
|
std::string const & htmlclass() const;
|
|
|
|
/// Returns a complete attribute string, including class, etc.
|
|
|
|
std::string const & htmlGetAttrString() const;
|
|
|
|
///
|
2009-10-27 13:29:26 +00:00
|
|
|
std::string const & htmlitemtag() const;
|
2017-07-03 17:45:58 +00:00
|
|
|
///
|
2009-10-26 20:45:29 +00:00
|
|
|
std::string const & htmlitemattr() const;
|
2017-07-03 17:45:58 +00:00
|
|
|
///
|
2009-10-27 13:29:26 +00:00
|
|
|
std::string const & htmllabeltag() const;
|
2017-07-03 17:45:58 +00:00
|
|
|
///
|
2009-10-26 20:45:29 +00:00
|
|
|
std::string const & htmllabelattr() const;
|
2009-06-06 03:32:55 +00:00
|
|
|
///
|
2022-12-04 05:33:14 +00:00
|
|
|
bool htmlintoc() const { return htmlintoc_; }
|
|
|
|
///
|
2009-12-10 18:30:48 +00:00
|
|
|
std::string defaultCSSClass() const;
|
|
|
|
///
|
2009-06-06 03:32:55 +00:00
|
|
|
bool htmllabelfirst() const { return htmllabelfirst_; }
|
2017-07-03 17:45:58 +00:00
|
|
|
///
|
2009-10-26 16:13:09 +00:00
|
|
|
docstring htmlstyle() const;
|
2017-07-03 17:45:58 +00:00
|
|
|
///
|
2009-06-05 19:42:56 +00:00
|
|
|
docstring const & htmlpreamble() const { return htmlpreamble_; }
|
2003-11-25 17:23:36 +00:00
|
|
|
///
|
2010-01-19 19:43:15 +00:00
|
|
|
bool htmltitle() const { return htmltitle_; }
|
|
|
|
///
|
2020-06-08 21:27:49 +00:00
|
|
|
std::string const & docbooktag() const;
|
|
|
|
///
|
|
|
|
std::string const & docbookattr() const;
|
|
|
|
///
|
2020-08-17 21:06:26 +00:00
|
|
|
std::string const & docbooktagtype() const;
|
|
|
|
///
|
2020-10-07 04:05:22 +00:00
|
|
|
std::string const & docbookinnertag() const;
|
|
|
|
///
|
|
|
|
std::string const & docbookinnerattr() const;
|
|
|
|
///
|
|
|
|
std::string const & docbookinnertagtype() const;
|
|
|
|
///
|
2020-06-08 21:27:49 +00:00
|
|
|
std::string const & docbookininfo() const;
|
|
|
|
///
|
2020-08-03 14:04:26 +00:00
|
|
|
bool docbookabstract() const { return docbookabstract_; }
|
|
|
|
///
|
2020-06-08 21:27:49 +00:00
|
|
|
std::string const & docbookwrappertag() const;
|
|
|
|
///
|
|
|
|
std::string const & docbookwrapperattr() const;
|
|
|
|
///
|
2020-08-17 21:06:26 +00:00
|
|
|
std::string const & docbookwrappertagtype() const;
|
|
|
|
///
|
2020-08-02 15:07:38 +00:00
|
|
|
bool docbookwrappermergewithprevious() const { return docbookwrappermergewithprevious_; }
|
|
|
|
///
|
2020-06-08 21:27:49 +00:00
|
|
|
std::string const & docbooksectiontag() const;
|
|
|
|
///
|
2020-10-21 12:54:25 +00:00
|
|
|
bool docbooksection() const { return docbooksection_; }
|
|
|
|
///
|
2020-06-08 21:27:49 +00:00
|
|
|
std::string const & docbookitemwrappertag() const;
|
|
|
|
///
|
|
|
|
std::string const & docbookitemwrapperattr() const;
|
|
|
|
///
|
2020-08-17 21:06:26 +00:00
|
|
|
std::string const & docbookitemwrappertagtype() const;
|
|
|
|
///
|
2020-06-08 21:27:49 +00:00
|
|
|
std::string const & docbookitemlabeltag() const;
|
|
|
|
///
|
|
|
|
std::string const & docbookitemlabelattr() const;
|
|
|
|
///
|
2020-08-17 21:06:26 +00:00
|
|
|
std::string const & docbookitemlabeltagtype() const;
|
|
|
|
///
|
2020-06-08 21:27:49 +00:00
|
|
|
std::string const & docbookiteminnertag() const;
|
|
|
|
///
|
|
|
|
std::string const & docbookiteminnerattr() const;
|
|
|
|
///
|
2020-08-17 21:06:26 +00:00
|
|
|
std::string const & docbookiteminnertagtype() const;
|
|
|
|
///
|
2020-06-08 21:27:49 +00:00
|
|
|
std::string const & docbookitemtag() const;
|
|
|
|
///
|
|
|
|
std::string const & docbookitemattr() const;
|
|
|
|
///
|
2020-08-17 21:06:26 +00:00
|
|
|
std::string const & docbookitemtagtype() const;
|
|
|
|
///
|
2020-06-08 21:27:49 +00:00
|
|
|
std::string const & docbookforceabstracttag() const;
|
|
|
|
///
|
2021-02-13 03:34:03 +00:00
|
|
|
bool docbooknofontinside() const { return docbooknofontinside_; }
|
|
|
|
///
|
2008-03-06 21:31:27 +00:00
|
|
|
bool isParagraph() const { return latextype == LATEX_PARAGRAPH; }
|
|
|
|
///
|
|
|
|
bool isCommand() const { return latextype == LATEX_COMMAND; }
|
|
|
|
///
|
|
|
|
bool isEnvironment() const {
|
|
|
|
return latextype == LATEX_ENVIRONMENT
|
|
|
|
|| latextype == LATEX_BIB_ENVIRONMENT
|
|
|
|
|| latextype == LATEX_ITEM_ENVIRONMENT
|
|
|
|
|| latextype == LATEX_LIST_ENVIRONMENT;
|
|
|
|
}
|
2013-02-09 16:13:01 +00:00
|
|
|
/// Is this the kind of layout in which adjacent paragraphs
|
|
|
|
/// are handled as one group?
|
2015-06-01 14:11:05 +00:00
|
|
|
bool isParagraphGroup() const { return par_group_; }
|
2013-02-09 16:13:01 +00:00
|
|
|
///
|
|
|
|
bool labelIsInline() const {
|
|
|
|
return labeltype == LABEL_STATIC
|
|
|
|
|| labeltype == LABEL_SENSITIVE
|
2020-11-03 14:10:19 +00:00
|
|
|
|| labeltype == LABEL_ENUMERATE
|
2013-02-09 16:13:01 +00:00
|
|
|
|| labeltype == LABEL_ITEMIZE;
|
|
|
|
}
|
|
|
|
bool labelIsAbove() const {
|
|
|
|
return labeltype == LABEL_ABOVE
|
|
|
|
|| labeltype == LABEL_CENTERED
|
2020-11-03 14:10:19 +00:00
|
|
|
|| labeltype == LABEL_BIBLIO;
|
2013-02-09 16:13:01 +00:00
|
|
|
}
|
2015-11-03 16:47:25 +00:00
|
|
|
///
|
|
|
|
bool addToToc() const { return add_to_toc_; }
|
|
|
|
///
|
|
|
|
std::string tocType() const { return toc_type_; }
|
|
|
|
///
|
|
|
|
bool isTocCaption() const { return is_toc_caption_; }
|
2008-03-06 21:31:27 +00:00
|
|
|
|
|
|
|
///
|
|
|
|
bool operator==(Layout const &) const;
|
|
|
|
///
|
2017-07-03 17:45:58 +00:00
|
|
|
bool operator!=(Layout const & rhs) const
|
2008-03-06 21:31:27 +00:00
|
|
|
{ return !(*this == rhs); }
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
// members
|
|
|
|
////////////////////////////////////////////////////////////////
|
2001-12-28 13:26:54 +00:00
|
|
|
/** Default font for this layout/environment.
|
|
|
|
The main font for this kind of environment. If an attribute has
|
2007-10-28 18:51:54 +00:00
|
|
|
INHERITED_*, it means that the value is specified by
|
2001-12-28 13:26:54 +00:00
|
|
|
the defaultfont for the entire layout. If we are nested, the
|
|
|
|
font is inherited from the font in the environment one level
|
2007-10-28 18:51:54 +00:00
|
|
|
up until the font is resolved. The values :IGNORE_*
|
|
|
|
and FONT_TOGGLE are illegal here.
|
2001-12-28 13:26:54 +00:00
|
|
|
*/
|
2007-10-28 18:51:54 +00:00
|
|
|
FontInfo font;
|
2001-12-28 13:26:54 +00:00
|
|
|
|
|
|
|
/** Default font for labels.
|
|
|
|
Interpretation the same as for font above
|
|
|
|
*/
|
2007-10-28 18:51:54 +00:00
|
|
|
FontInfo labelfont;
|
2001-12-28 13:26:54 +00:00
|
|
|
|
|
|
|
/** Resolved version of the font for this layout/environment.
|
|
|
|
This is a resolved version the default font. The font is resolved
|
|
|
|
against the defaultfont of the entire layout.
|
|
|
|
*/
|
2007-10-28 18:51:54 +00:00
|
|
|
FontInfo resfont;
|
2001-12-28 13:26:54 +00:00
|
|
|
|
|
|
|
/** Resolved version of the font used for labels.
|
|
|
|
This is a resolved version the label font. The font is resolved
|
|
|
|
against the defaultfont of the entire layout.
|
|
|
|
*/
|
2007-10-28 18:51:54 +00:00
|
|
|
FontInfo reslabelfont;
|
2001-12-28 13:26:54 +00:00
|
|
|
|
|
|
|
/// Text that dictates how wide the left margin is on the screen
|
2007-08-18 13:21:12 +00:00
|
|
|
docstring leftmargin;
|
2001-12-28 13:26:54 +00:00
|
|
|
/// Text that dictates how wide the right margin is on the screen
|
2007-08-18 13:21:12 +00:00
|
|
|
docstring rightmargin;
|
2001-12-28 13:26:54 +00:00
|
|
|
/// Text that dictates how much space to leave after a potential label
|
2007-08-18 13:21:12 +00:00
|
|
|
docstring labelsep;
|
2001-12-28 13:26:54 +00:00
|
|
|
/// Text that dictates how much space to leave before a potential label
|
2007-08-18 13:21:12 +00:00
|
|
|
docstring labelindent;
|
2003-03-14 10:39:47 +00:00
|
|
|
/// Text that dictates the width of the indentation of indented pars
|
2007-08-18 13:21:12 +00:00
|
|
|
docstring parindent;
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2005-01-27 21:05:44 +00:00
|
|
|
double parskip;
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2005-01-27 21:05:44 +00:00
|
|
|
double itemsep;
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2005-01-27 21:05:44 +00:00
|
|
|
double topsep;
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2005-01-27 21:05:44 +00:00
|
|
|
double bottomsep;
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2005-01-27 21:05:44 +00:00
|
|
|
double labelbottomsep;
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2005-01-27 21:05:44 +00:00
|
|
|
double parsep;
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
|
|
|
Spacing spacing;
|
|
|
|
///
|
|
|
|
LyXAlignment align;
|
|
|
|
///
|
|
|
|
LyXAlignment alignpossible;
|
|
|
|
///
|
2007-09-29 20:02:32 +00:00
|
|
|
LabelType labeltype;
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2007-09-29 20:02:32 +00:00
|
|
|
EndLabelType endlabeltype;
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2007-09-29 20:02:32 +00:00
|
|
|
MarginType margintype;
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
|
|
|
bool newline_allowed;
|
|
|
|
///
|
|
|
|
bool nextnoindent;
|
|
|
|
///
|
2014-05-29 12:10:32 +00:00
|
|
|
ToggleIndentation toggle_indent;
|
|
|
|
///
|
2001-12-28 13:26:54 +00:00
|
|
|
bool free_spacing;
|
|
|
|
///
|
|
|
|
bool pass_thru;
|
2015-04-20 16:13:49 +00:00
|
|
|
/// Individual chars to be passed verbatim
|
|
|
|
docstring pass_thru_chars;
|
2010-08-09 21:20:29 +00:00
|
|
|
///
|
|
|
|
bool parbreak_is_newline;
|
2003-09-15 15:51:48 +00:00
|
|
|
/// show this in toc
|
|
|
|
int toclevel;
|
2005-05-12 10:16:04 +00:00
|
|
|
/// special value of toclevel for non-section layouts
|
|
|
|
static const int NOT_IN_TOC;
|
2001-12-28 13:26:54 +00:00
|
|
|
|
|
|
|
/** true when the fragile commands in the paragraph need to be
|
|
|
|
\protect'ed. */
|
|
|
|
bool needprotect;
|
2018-04-14 17:25:35 +00:00
|
|
|
/** true when the verbatim stuff of this layout needs to be
|
2018-04-14 10:57:23 +00:00
|
|
|
\cprotect'ed. */
|
|
|
|
bool needcprotect;
|
2019-03-12 13:08:05 +00:00
|
|
|
/** true when specific commands in this paragraph need to be
|
|
|
|
protected in an \mbox. */
|
|
|
|
bool needmboxprotect;
|
2001-12-28 13:26:54 +00:00
|
|
|
/// true when empty paragraphs should be kept.
|
|
|
|
bool keepempty;
|
|
|
|
/// Type of LaTeX object
|
2007-09-29 20:02:32 +00:00
|
|
|
LatexType latextype;
|
2001-12-28 13:26:54 +00:00
|
|
|
/// Does this object belong in the title part of the document?
|
|
|
|
bool intitle;
|
2009-12-01 14:34:05 +00:00
|
|
|
/// Is the content to go in the preamble rather than the body?
|
|
|
|
bool inpreamble;
|
2003-09-12 17:13:22 +00:00
|
|
|
/// Which counter to step
|
2007-09-20 20:44:08 +00:00
|
|
|
docstring counter;
|
2016-10-14 18:08:12 +00:00
|
|
|
/// Resume counter?
|
|
|
|
bool resumecounter;
|
2020-11-02 22:36:58 +00:00
|
|
|
/// Step parent counter?
|
|
|
|
bool stepparentcounter;
|
2010-03-17 12:23:24 +00:00
|
|
|
/// Prefix to use when creating labels
|
|
|
|
docstring refprefix;
|
2003-11-14 14:05:03 +00:00
|
|
|
/// Depth of XML command
|
|
|
|
int commanddepth;
|
2002-09-04 06:41:38 +00:00
|
|
|
|
2010-02-13 17:57:11 +00:00
|
|
|
/// Is this spellchecked?
|
|
|
|
bool spellcheck;
|
2013-05-15 05:19:49 +00:00
|
|
|
/**
|
|
|
|
* Should this layout definition always be written to the document preamble?
|
|
|
|
* Possible values are:
|
|
|
|
* 0: Do not enforce local layout
|
|
|
|
* >=1: Enforce local layout with version forcelocal
|
|
|
|
* -1: Enforce local layout with infinite version
|
|
|
|
* On reading, the forced local layout is only used if its version
|
|
|
|
* number is greater than the version number of the same layout in the
|
|
|
|
* document class. Otherwise, it is ignored.
|
|
|
|
*/
|
|
|
|
int forcelocal;
|
2010-02-13 17:57:11 +00:00
|
|
|
|
2009-06-02 13:45:32 +00:00
|
|
|
|
|
|
|
private:
|
2013-05-15 05:19:49 +00:00
|
|
|
/// Reads a layout definition from file
|
|
|
|
/// \return true on success.
|
2020-09-29 02:07:08 +00:00
|
|
|
bool readIgnoreForcelocal(Lexer &, TextClass const &, bool validating);
|
2009-10-26 16:13:09 +00:00
|
|
|
/// generates the default CSS for this layout
|
|
|
|
void makeDefaultCSS() const;
|
2009-10-27 13:29:26 +00:00
|
|
|
///
|
2009-10-27 14:32:45 +00:00
|
|
|
std::string defaultCSSItemClass() const { return defaultCSSClass() + "_item"; }
|
2009-10-27 13:29:26 +00:00
|
|
|
///
|
2009-10-27 14:32:45 +00:00
|
|
|
std::string defaultCSSLabelClass() const { return defaultCSSClass() + "_label"; }
|
2017-07-03 17:45:58 +00:00
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
/// Name of the layout/paragraph environment
|
2007-07-11 13:39:08 +00:00
|
|
|
docstring name_;
|
2009-06-02 13:45:32 +00:00
|
|
|
|
2008-04-05 19:01:43 +00:00
|
|
|
/// LaTeX name for environment
|
|
|
|
std::string latexname_;
|
2001-12-28 13:26:54 +00:00
|
|
|
|
2009-06-02 13:45:32 +00:00
|
|
|
/** Is this layout the default layout for an unknown layout? If
|
|
|
|
* so, its name will be displayed as xxx (unknown).
|
|
|
|
*/
|
|
|
|
bool unknown_;
|
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
/** Name of an layout that has replaced this layout.
|
|
|
|
This is used to rename a layout, while keeping backward
|
2002-03-21 17:27:08 +00:00
|
|
|
compatibility
|
2001-12-28 13:26:54 +00:00
|
|
|
*/
|
2007-07-11 13:39:08 +00:00
|
|
|
docstring obsoleted_by_;
|
2001-12-28 13:26:54 +00:00
|
|
|
|
2002-07-20 20:47:54 +00:00
|
|
|
/** Name of an layout which preamble must come before this one
|
|
|
|
This is used when the preamble snippet uses macros defined in
|
|
|
|
another preamble
|
|
|
|
*/
|
2007-07-11 13:39:08 +00:00
|
|
|
docstring depends_on_;
|
2002-07-20 20:47:54 +00:00
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
/// Label string. "Abstract", "Reference", "Caption"...
|
2007-09-20 20:44:08 +00:00
|
|
|
docstring labelstring_;
|
2001-12-28 13:26:54 +00:00
|
|
|
///
|
2007-09-20 20:44:08 +00:00
|
|
|
docstring endlabelstring_;
|
2001-12-28 13:26:54 +00:00
|
|
|
/// Label string inside appendix. "Appendix", ...
|
2007-09-20 20:44:08 +00:00
|
|
|
docstring labelstring_appendix_;
|
2001-12-28 13:26:54 +00:00
|
|
|
/// LaTeX parameter for environment
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string latexparam_;
|
2012-12-19 15:55:22 +00:00
|
|
|
/// Item command in lists
|
|
|
|
std::string itemcommand_;
|
2012-11-25 18:10:16 +00:00
|
|
|
/// Left delimiter of the content
|
|
|
|
docstring leftdelim_;
|
|
|
|
/// Right delimiter of the content
|
|
|
|
docstring rightdelim_;
|
2003-11-14 14:05:03 +00:00
|
|
|
/// Internal tag to use (e.g., <title></title> for sect header)
|
|
|
|
std::string innertag_;
|
2009-10-24 20:25:35 +00:00
|
|
|
/// Internal tag to use (e.g. to surround varentrylist label)
|
2003-11-25 17:23:36 +00:00
|
|
|
std::string labeltag_;
|
2009-10-24 20:25:35 +00:00
|
|
|
/// Internal tag to surround the item text in a list.
|
2003-11-25 17:23:36 +00:00
|
|
|
std::string itemtag_;
|
2009-10-26 20:45:29 +00:00
|
|
|
/// The interpretation of this tag varies depending upon the latextype.
|
2017-07-03 17:45:58 +00:00
|
|
|
/// In an environment, it is the tag enclosing all content for this set of
|
|
|
|
/// paragraphs. So for quote, e.g,. it would be: blockquote. For itemize,
|
2009-10-26 20:45:29 +00:00
|
|
|
/// it would be: ul. (You get the idea.)
|
|
|
|
///
|
|
|
|
/// For a command, it is the tag enclosing the content of the command.
|
|
|
|
/// So, for section, it might be: h2.
|
2017-07-03 17:45:58 +00:00
|
|
|
///
|
2009-10-26 20:45:29 +00:00
|
|
|
/// For the paragraph type, it is the tag that will enclose each paragraph.
|
|
|
|
///
|
|
|
|
/// Defaults to "div".
|
|
|
|
mutable std::string htmltag_;
|
2022-12-04 18:27:19 +00:00
|
|
|
/// Additional attributes for inclusion with the start tag.
|
|
|
|
/// Note that the CSS class is handled separately.
|
|
|
|
std::string htmlattr_;
|
|
|
|
/// The CSS class to use. Calculated from the layout name if not given.
|
|
|
|
mutable std::string htmlclass_;
|
|
|
|
/// cached
|
|
|
|
mutable std::string htmlfullattrs_;
|
2009-06-05 17:26:30 +00:00
|
|
|
/// Tag for individual paragraphs in an environment. In lists, this
|
|
|
|
/// would be something like "li". But it also needs to be set for
|
2017-07-03 17:45:58 +00:00
|
|
|
/// quotation, e.g., since the paragraphs in a quote need to be
|
2009-10-26 02:21:59 +00:00
|
|
|
/// in "p" tags. Default is "div".
|
2009-10-26 20:45:29 +00:00
|
|
|
/// Note that when I said "environment", I meant it: This has no
|
|
|
|
/// effect for LATEX_PARAGRAPH type layouts.
|
2009-10-27 13:29:26 +00:00
|
|
|
mutable std::string htmlitemtag_;
|
2009-10-27 14:14:24 +00:00
|
|
|
/// Attributes for htmlitemtag_. Default is: class="layoutname_item".
|
2009-10-26 20:45:29 +00:00
|
|
|
mutable std::string htmlitemattr_;
|
2009-06-05 17:26:30 +00:00
|
|
|
/// Tag for labels, of whatever sort. One use for this is in setting
|
|
|
|
/// descriptions, in which case it would be: dt. Another use is to
|
2017-07-03 17:45:58 +00:00
|
|
|
/// customize the display of, say, the auto-generated label for
|
2009-10-26 02:21:59 +00:00
|
|
|
/// sections. Defaults to "span".
|
2009-10-26 02:51:51 +00:00
|
|
|
/// If set to "NONE", this suppresses the printing of the label.
|
2009-10-27 13:29:26 +00:00
|
|
|
mutable std::string htmllabeltag_;
|
2009-10-27 14:14:24 +00:00
|
|
|
/// Attributes for the label. Defaults to: class="layoutname_label".
|
2009-10-26 20:45:29 +00:00
|
|
|
mutable std::string htmllabelattr_;
|
2009-06-06 03:32:55 +00:00
|
|
|
/// Whether to put the label before the item, or within the item.
|
|
|
|
/// I.e., do we have (true):
|
|
|
|
/// <label>...</label><item>...</item>
|
|
|
|
/// or instead (false):
|
|
|
|
/// <item><label>...</label>...</item>
|
|
|
|
/// The latter is the default.
|
|
|
|
bool htmllabelfirst_;
|
2022-12-04 05:33:14 +00:00
|
|
|
/// Is this to be output with the toc?
|
|
|
|
bool htmlintoc_;
|
2009-06-05 17:26:30 +00:00
|
|
|
/// CSS information needed by this layout.
|
|
|
|
docstring htmlstyle_;
|
2020-06-08 21:27:49 +00:00
|
|
|
/// DocBook tag corresponding to this layout.
|
|
|
|
mutable std::string docbooktag_;
|
|
|
|
/// Roles to add to docbooktag_, if any (default: none).
|
|
|
|
mutable std::string docbookattr_;
|
2020-08-17 21:06:26 +00:00
|
|
|
/// DocBook tag type corresponding to this layout (block, paragraph, or inline; default: block).
|
|
|
|
mutable std::string docbooktagtype_;
|
2020-10-07 04:05:22 +00:00
|
|
|
/// DocBook inner tag corresponding to this layout.
|
|
|
|
mutable std::string docbookinnertag_;
|
|
|
|
/// Roles to add to docbookinnertag_, if any (default: none).
|
|
|
|
mutable std::string docbookinnerattr_;
|
|
|
|
/// DocBook inner-tag type corresponding to this layout (block, paragraph, or inline; default: block).
|
|
|
|
mutable std::string docbookinnertagtype_;
|
2020-06-08 21:27:49 +00:00
|
|
|
/// DocBook tag corresponding to this item (mainly for lists).
|
|
|
|
mutable std::string docbookitemtag_;
|
|
|
|
/// Roles to add to docbookitemtag_, if any (default: none).
|
|
|
|
mutable std::string docbookitemattr_;
|
2020-08-17 21:06:26 +00:00
|
|
|
/// DocBook tag type corresponding to this item (block, paragraph, or inline; default: block).
|
|
|
|
mutable std::string docbookitemtagtype_;
|
2020-06-08 21:27:49 +00:00
|
|
|
/// DocBook tag corresponding to the wrapper around an item (mainly for lists).
|
|
|
|
mutable std::string docbookitemwrappertag_;
|
|
|
|
/// Roles to add to docbookitemwrappertag_, if any (default: none).
|
|
|
|
mutable std::string docbookitemwrapperattr_;
|
2020-08-17 21:06:26 +00:00
|
|
|
/// DocBook tag type corresponding to the wrapper around an item (block, paragraph, or inline; default: block).
|
|
|
|
mutable std::string docbookitemwrappertagtype_;
|
|
|
|
/// DocBook tag corresponding to this label (mostly for description lists;
|
2020-06-08 21:27:49 +00:00
|
|
|
/// labels in the common sense do not exist with DocBook).
|
|
|
|
mutable std::string docbookitemlabeltag_;
|
|
|
|
/// Roles to add to docbooklabeltag_, if any (default: none).
|
|
|
|
mutable std::string docbookitemlabelattr_;
|
2020-08-17 21:06:26 +00:00
|
|
|
/// DocBook tag corresponding to this label (block, paragraph, or inline; default: block).
|
|
|
|
mutable std::string docbookitemlabeltagtype_;
|
2020-06-08 21:27:49 +00:00
|
|
|
/// DocBook tag to add within the item, around its direct content (mainly for lists).
|
|
|
|
mutable std::string docbookiteminnertag_;
|
|
|
|
/// Roles to add to docbookiteminnertag_, if any (default: none).
|
|
|
|
mutable std::string docbookiteminnerattr_;
|
2020-08-17 21:06:26 +00:00
|
|
|
/// DocBook tag to add within the item, around its direct content (block, paragraph, or inline; default: block).
|
|
|
|
mutable std::string docbookiteminnertagtype_;
|
2020-06-08 21:27:49 +00:00
|
|
|
/// DocBook tag corresponding to this wrapper around the main tag.
|
|
|
|
mutable std::string docbookwrappertag_;
|
|
|
|
/// Roles to add to docbookwrappertag_, if any (default: none).
|
|
|
|
mutable std::string docbookwrapperattr_;
|
2020-08-17 21:06:26 +00:00
|
|
|
/// DocBook tag corresponding to this wrapper around the main tag (block, paragraph, or inline; default: block).
|
|
|
|
mutable std::string docbookwrappertagtype_;
|
2020-08-02 15:07:38 +00:00
|
|
|
/// Whether this wrapper tag may be merged with the previously opened wrapper tag.
|
|
|
|
bool docbookwrappermergewithprevious_;
|
2020-08-03 14:04:26 +00:00
|
|
|
/// Outer tag for this section, only if this layout represent a sectionning item, including chapters
|
|
|
|
/// (default: section).
|
2020-06-08 21:27:49 +00:00
|
|
|
mutable std::string docbooksectiontag_;
|
2020-10-21 12:54:25 +00:00
|
|
|
/// Whether this element should be considered as a section-level element in DocBook.
|
|
|
|
bool docbooksection_;
|
2020-06-08 21:27:49 +00:00
|
|
|
/// Whether this tag must/can/can't go into an <info> tag (default: never, as it only makes sense for metadata).
|
|
|
|
mutable std::string docbookininfo_;
|
2022-12-22 02:40:50 +00:00
|
|
|
/// Whether this paragraph should be considered as abstract. Such paragraphs are output as a part of the document
|
|
|
|
/// abstract element (corresponding to the root tag).
|
2020-08-03 14:04:26 +00:00
|
|
|
bool docbookabstract_;
|
|
|
|
/// Whether this element (root or not) does not accept text without a section (i.e. the first text that is met
|
2020-06-08 21:27:49 +00:00
|
|
|
/// in LyX must be considered as the abstract if this is true); this text must be output with the specific tag
|
|
|
|
/// held by this attribute
|
|
|
|
mutable std::string docbookforceabstracttag_;
|
2021-02-13 03:34:03 +00:00
|
|
|
/// Whether font tags are allowed inside this tag.
|
|
|
|
bool docbooknofontinside_ = false;
|
2009-10-26 16:13:09 +00:00
|
|
|
/// Should we generate the default CSS for this layout, even if HTMLStyle
|
|
|
|
/// has been given? Default is false.
|
|
|
|
/// Note that the default CSS is output first, then the user CSS, so it is
|
|
|
|
/// possible to override what one does not want.
|
2009-10-27 14:14:24 +00:00
|
|
|
bool htmlforcecss_;
|
2009-10-26 16:13:09 +00:00
|
|
|
/// A cache for the default style info so generated.
|
|
|
|
mutable docstring htmldefaultstyle_;
|
2009-06-05 19:42:56 +00:00
|
|
|
/// Any other info for the HTML header.
|
|
|
|
docstring htmlpreamble_;
|
2010-01-19 19:43:15 +00:00
|
|
|
/// Whether this is the <title> paragraph.
|
|
|
|
bool htmltitle_;
|
2009-10-27 13:58:23 +00:00
|
|
|
/// calculating this is expensive, so we cache it.
|
|
|
|
mutable std::string defaultcssclass_;
|
2008-03-06 05:01:44 +00:00
|
|
|
/// This is the `category' for this layout. The following are
|
|
|
|
/// recommended basic categories: FrontMatter, BackMatter, MainText,
|
2015-02-14 10:35:40 +00:00
|
|
|
/// Sectioning, Starred, List, Reasoning.
|
2008-03-06 05:01:44 +00:00
|
|
|
docstring category_;
|
2001-12-28 13:26:54 +00:00
|
|
|
/// Macro definitions needed for this layout
|
2006-11-08 17:22:44 +00:00
|
|
|
docstring preamble_;
|
2009-02-04 20:06:50 +00:00
|
|
|
/// Language dependent macro definitions needed for this layout
|
2009-02-17 20:25:56 +00:00
|
|
|
docstring langpreamble_;
|
|
|
|
/// Language and babel dependent macro definitions needed for this layout
|
|
|
|
docstring babelpreamble_;
|
2015-06-01 14:11:05 +00:00
|
|
|
/// Are adjacent paragraphs handled as one group?
|
|
|
|
bool par_group_;
|
2008-01-07 16:59:10 +00:00
|
|
|
/// Packages needed for this layout
|
2020-05-04 18:05:44 +00:00
|
|
|
std::set<std::string> required_;
|
2017-12-28 16:44:54 +00:00
|
|
|
/// Layouts that are by default nested after this one
|
2017-12-29 09:03:00 +00:00
|
|
|
std::set<docstring> autonests_;
|
2017-12-29 09:36:03 +00:00
|
|
|
/// Layouts that by auto-nest this one
|
|
|
|
std::set<docstring> autonested_by_;
|
2012-11-19 13:21:02 +00:00
|
|
|
///
|
|
|
|
LaTeXArgMap latexargs_;
|
2012-11-29 14:34:20 +00:00
|
|
|
///
|
2012-12-28 10:21:24 +00:00
|
|
|
LaTeXArgMap postcommandargs_;
|
|
|
|
///
|
2018-08-17 08:22:32 +00:00
|
|
|
LaTeXArgMap listpreamble_;
|
|
|
|
///
|
2012-11-29 14:34:20 +00:00
|
|
|
LaTeXArgMap itemargs_;
|
2015-11-03 16:47:25 +00:00
|
|
|
///
|
|
|
|
bool add_to_toc_;
|
|
|
|
///
|
|
|
|
std::string toc_type_;
|
|
|
|
///
|
|
|
|
bool is_toc_caption_;
|
2001-12-28 13:26:54 +00:00
|
|
|
};
|
|
|
|
|
2015-11-03 16:47:25 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
} // namespace lyx
|
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
#endif
|