]> git.lyx.org Git - lyx.git/blob - src/insets/InsetArgument.h
Refactor InsetQuotes.h enums
[lyx.git] / src / insets / InsetArgument.h
1 // -*- C++ -*-
2 /**
3  * \file InsetArgument.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Martin Vermeer
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef INSETARGUMENT_H
13 #define INSETARGUMENT_H
14
15
16 #include "InsetCollapsible.h"
17
18
19 namespace lyx {
20
21
22 /**
23  * InsetArgument. Used to insert a short version of sectioning header etc.
24  * automatically, or other optional LaTeX arguments
25  */
26 class InsetArgument : public InsetCollapsible
27 {
28 public:
29         ///
30         InsetArgument(Buffer *, std::string const &);
31
32         ///
33         InsetArgument const * asInsetArgument() const override { return this; }
34
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;
39
40         std::string name() const { return name_; }
41
42         bool docbookargumentbeforemaintag() const { return docbookargumentbeforemaintag_; }
43
44         /// \name Public functions inherited from Inset class
45         //@{
46         ///
47         bool hasSettings() const override { return false; }
48         ///
49         InsetCode lyxCode() const override { return ARG_CODE; }
50         ///
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;
54         ///
55         void latex(otexstream &, OutputParams const &) const override { }
56         ///
57         int plaintext(odocstringstream &, OutputParams const &, size_t) const override { return 0; }
58         ///
59         void docbook(XMLStream & xs, OutputParams const &) const override;
60         ///
61         docstring xhtml(XMLStream &, OutputParams const &) const override
62                 { return docstring(); }
63         ///
64         void write(std::ostream & os) const override;
65         ///
66         void read(Lexer & lex) override;
67         ///
68         bool neverIndent() const override { return true; }
69         ///
70         std::string contextMenuName() const override;
71         ///
72         bool isPassThru() const override { return pass_thru_; }
73         ///
74         bool isFreeSpacing() const override { return free_spacing_; }
75         ///
76         bool isTocCaption() const { return is_toc_caption_; }
77         ///
78         bool resetFontEdit() const override { return false; }
79         //@}
80         /// \name Public functions inherited from InsetCollapsible class
81         //@{
82         ///
83         InsetLayout::InsetDecoration decoration() const override;
84         ///
85         FontInfo getFont() const override;
86         ///
87         FontInfo getLabelfont() const override;
88         ///
89         ColorCode labelColor() const override;
90         ///
91         void setButtonLabel() override;
92         //@}
93         ///
94         void addToToc(DocIterator const & dit, bool output_active,
95                       UpdateType utype, TocBackend & backend) const override;
96
97 private:
98         ///
99         docstring toolTip(BufferView const & bv, int, int) const override;
100         ///
101         void fixParagraphLanguage(Language const *);
102         ///
103         std::string name_;
104         ///
105         docstring labelstring_;
106         ///
107         docstring tooltip_;
108         ///
109         FontInfo font_;
110         ///
111         FontInfo labelfont_;
112         ///
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)
119         bool pass_thru_;
120         ///
121         bool free_spacing_;
122         ///
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_;
136         ///
137         bool docbookargumentbeforemaintag_ = false;
138
139 protected:
140         /// \name Protected functions inherited from Inset class
141         //@{
142         ///
143         bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const override;
144         ///
145         void doDispatch(Cursor & cur, FuncRequest & cmd) override;
146         ///
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; }
150         //@}
151 };
152
153
154 } // namespace lyx
155
156 #endif // INSETARGUMENT_H