]> git.lyx.org Git - lyx.git/blob - src/insets/InsetArgument.h
DocBook: don't use a surrounding <para> for rendered insets.
[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 #include "FontInfo.h"
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         bool docbookargumentaftermaintag() const { return docbookargumentaftermaintag_; }
45
46         /// \name Public functions inherited from Inset class
47         //@{
48         ///
49         bool hasSettings() const override { return false; }
50         ///
51         InsetCode lyxCode() const override { return ARG_CODE; }
52         ///
53         docstring layoutName() const override { return from_ascii("Argument"); }
54         /// Update the label string of this inset
55         void updateBuffer(ParIterator const &, UpdateType, bool const deleted = false) override;
56         ///
57         void latex(otexstream &, OutputParams const &) const override { }
58         ///
59         int plaintext(odocstringstream &, OutputParams const &, size_t) const override { return 0; }
60         ///
61         void docbook(XMLStream & xs, OutputParams const &) const override;
62         ///
63         docstring xhtml(XMLStream &, OutputParams const &) const override
64                 { return docstring(); }
65         ///
66         void write(std::ostream & os) const override;
67         ///
68         void read(Lexer & lex) override;
69         ///
70         bool neverIndent() const override { return true; }
71         ///
72         std::string contextMenuName() const override;
73         ///
74         bool isPassThru() const override { return pass_thru_; }
75         ///
76         bool isFreeSpacing() const override { return free_spacing_; }
77         ///
78         bool isTocCaption() const { return is_toc_caption_; }
79         ///
80         bool resetFontEdit() const override { return false; }
81         //@}
82         /// \name Public functions inherited from InsetCollapsible class
83         //@{
84         ///
85         InsetDecoration decoration() const override;
86         ///
87         FontInfo getFont() const override;
88         ///
89         FontInfo getLabelfont() const override;
90         ///
91         ColorCode labelColor() const override;
92         ///
93         void setButtonLabel() override;
94         //@}
95         ///
96         void addToToc(DocIterator const & dit, bool output_active,
97                       UpdateType utype, TocBackend & backend) const override;
98
99 private:
100         ///
101         docstring toolTip(BufferView const & bv, int, int) const override;
102         ///
103         void fixParagraphLanguage(Language const *);
104         ///
105         std::string name_;
106         ///
107         docstring labelstring_;
108         ///
109         docstring tooltip_;
110         ///
111         FontInfo font_;
112         ///
113         FontInfo labelfont_;
114         ///
115         std::string decoration_;
116         /// Are we in a pass-thru context?
117         bool pass_thru_context_;
118         /// Is the argument itself have an explicitly pass-thru?
119         bool pass_thru_local_;
120         /// Effective pass-thru setting (inherited or local)
121         bool pass_thru_;
122         ///
123         bool free_spacing_;
124         ///
125         docstring pass_thru_chars_;
126         /// Does this argument provide content for the TOC?
127         bool is_toc_caption_;
128         /// The type of Toc this is the caption of, empty otherwise.
129         std::string caption_of_toc_;
130         /// Specific line break macro
131         std::string newline_cmd_;
132         /// DocBook tag for this argument, if any (otherwise, NONE).
133         docstring docbooktag_;
134         /// Type of DocBook tag (controls how new lines are inserted around this argument).
135         docstring docbooktagtype_;
136         /// DocBook attributes.
137         docstring docbookattr_;
138         ///
139         bool docbookargumentbeforemaintag_ = false;
140         ///
141         bool docbookargumentaftermaintag_ = false;
142
143 protected:
144         /// \name Protected functions inherited from Inset class
145         //@{
146         ///
147         bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const override;
148         ///
149         void doDispatch(Cursor & cur, FuncRequest & cmd) override;
150         ///
151         Inset * clone() const override { return new InsetArgument(*this); }
152         /// Is the content of this inset part of the immediate (visible) text sequence?
153         bool isPartOfTextSequence() const override { return false; }
154         //@}
155 };
156
157
158 } // namespace lyx
159
160 #endif // INSETARGUMENT_H