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 /// \name Public functions inherited from Inset class
47 bool hasSettings() const override { return false; }
49 InsetCode lyxCode() const override { return ARG_CODE; }
51 docstring layoutName() const override { return from_ascii("Argument"); }
52 /// Update the label string of this inset
53 void updateBuffer(ParIterator const &, UpdateType, bool const deleted = false) override;
55 void latex(otexstream &, OutputParams const &) const override { }
57 int plaintext(odocstringstream &, OutputParams const &, size_t) const override { return 0; }
59 void docbook(XMLStream & xs, OutputParams const &) const override;
61 docstring xhtml(XMLStream &, OutputParams const &) const override
62 { return docstring(); }
64 void write(std::ostream & os) const override;
66 void read(Lexer & lex) override;
68 bool neverIndent() const override { return true; }
70 std::string contextMenuName() const override;
72 bool isPassThru() const override { return pass_thru_; }
74 bool isFreeSpacing() const override { return free_spacing_; }
76 bool isTocCaption() const { return is_toc_caption_; }
78 bool resetFontEdit() const override { return false; }
80 /// \name Public functions inherited from InsetCollapsible class
83 InsetDecoration decoration() const override;
85 FontInfo getFont() const override;
87 FontInfo getLabelfont() const override;
89 ColorCode labelColor() const override;
91 void setButtonLabel() override;
94 void addToToc(DocIterator const & dit, bool output_active,
95 UpdateType utype, TocBackend & backend) const override;
99 docstring toolTip(BufferView const & bv, int, int) const override;
101 void fixParagraphLanguage(Language const *);
105 docstring labelstring_;
113 std::string decoration_;
114 /// Are we in a pass-thru context?
115 bool pass_thru_context_;
116 /// Is the argument itself have an explicitly pass-thru?
117 bool pass_thru_local_;
118 /// Effective pass-thru setting (inherited or local)
123 docstring pass_thru_chars_;
124 /// Does this argument provide content for the TOC?
125 bool is_toc_caption_;
126 /// The type of Toc this is the caption of, empty otherwise.
127 std::string caption_of_toc_;
128 /// Specific line break macro
129 std::string newline_cmd_;
130 /// DocBook tag for this argument, if any (otherwise, NONE).
131 docstring docbooktag_;
132 /// Type of DocBook tag (controls how new lines are inserted around this argument).
133 docstring docbooktagtype_;
134 /// DocBook attributes.
135 docstring docbookattr_;
137 bool docbookargumentbeforemaintag_ = false;
140 /// \name Protected functions inherited from Inset class
143 bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const override;
145 void doDispatch(Cursor & cur, FuncRequest & cmd) override;
147 Inset * clone() const override { return new InsetArgument(*this); }
148 /// Is the content of this inset part of the immediate (visible) text sequence?
149 bool isPartOfTextSequence() const override { return false; }
156 #endif // INSETARGUMENT_H