3 * \file InsetArgument.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Martin Vermeer
9 * Full author contact details are available in file CREDITS.
12 #ifndef INSETARGUMENT_H
13 #define INSETARGUMENT_H
16 #include "InsetCollapsible.h"
23 * InsetArgument. Used to insert a short version of sectioning header etc.
24 * automatically, or other optional LaTeX arguments
26 class InsetArgument : public InsetCollapsible
30 InsetArgument(Buffer *, std::string const &);
33 InsetArgument const * asInsetArgument() const override { return this; }
35 /// Outputting the parameter of a LaTeX command
36 void latexArgument(otexstream & os, OutputParams const & runparams_in,
37 docstring const & ldelim, docstring const & rdelim,
38 docstring const & presetarg) const;
40 std::string name() const { return name_; }
42 bool docbookargumentbeforemaintag() const { return docbookargumentbeforemaintag_; }
44 bool docbookargumentaftermaintag() const { return docbookargumentaftermaintag_; }
46 /// \name Public functions inherited from Inset class
49 bool hasSettings() const override { return false; }
51 InsetCode lyxCode() const override { return ARG_CODE; }
53 docstring layoutName() const override { return from_ascii("Argument"); }
55 /// Initialize the members of this inset when inserted in \c par.
56 void init(Paragraph const & par);
57 /// Update the label string of this inset
58 void updateBuffer(ParIterator const &, UpdateType, bool const deleted = false) override;
60 void latex(otexstream &, OutputParams const &) const override { }
62 int plaintext(odocstringstream &, OutputParams const &, size_t) const override { return 0; }
64 void docbook(XMLStream & xs, OutputParams const &) const override;
66 docstring xhtml(XMLStream &, OutputParams const &) const override
67 { return docstring(); }
69 void write(std::ostream & os) const override;
71 void read(Lexer & lex) override;
73 bool neverIndent() const override { return true; }
75 std::string contextMenuName() const override;
77 bool isPassThru() const override { return pass_thru_; }
79 bool isFreeSpacing() const override { return free_spacing_; }
81 bool isTocCaption() const { return is_toc_caption_; }
83 bool resetFontEdit() const override { return false; }
85 /// \name Public functions inherited from InsetCollapsible class
88 InsetDecoration decoration() const override;
90 FontInfo getFont() const override;
92 FontInfo getLabelfont() const override;
94 ColorCode labelColor() const override;
96 void setButtonLabel() override;
99 void addToToc(DocIterator const & dit, bool output_active,
100 UpdateType utype, TocBackend & backend) const override;
104 docstring toolTip(BufferView const & bv, int, int) const override;
106 void fixParagraphLanguage(Language const *);
110 docstring labelstring_;
118 std::string decoration_;
119 /// Are we in a pass-thru context?
120 bool pass_thru_context_;
121 /// Is the argument itself have an explicitly pass-thru?
122 bool pass_thru_local_;
123 /// Effective pass-thru setting (inherited or local)
128 docstring pass_thru_chars_;
129 /// Does this argument provide content for the TOC?
130 bool is_toc_caption_;
131 /// The type of Toc this is the caption of, empty otherwise.
132 std::string caption_of_toc_;
133 /// Specific line break macro
134 std::string newline_cmd_;
135 /// DocBook tag for this argument, if any (otherwise, NONE).
136 docstring docbooktag_;
137 /// Type of DocBook tag (controls how new lines are inserted around this argument).
138 docstring docbooktagtype_;
139 /// DocBook attributes.
140 docstring docbookattr_;
142 bool docbookargumentbeforemaintag_ = false;
144 bool docbookargumentaftermaintag_ = false;
147 /// \name Protected functions inherited from Inset class
150 bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const override;
152 void doDispatch(Cursor & cur, FuncRequest & cmd) override;
154 Inset * clone() const override { return new InsetArgument(*this); }
155 /// Is the content of this inset part of the immediate (visible) text sequence?
156 bool isPartOfTextSequence() const override { return false; }
163 #endif // INSETARGUMENT_H