]> git.lyx.org Git - lyx.git/blob - src/insets/InsetArgument.h
cd036128623c8f03a201dc8ea769b5602a8998c8
[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 "InsetCollapsable.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 InsetCollapsable
27 {
28 public:
29         ///
30         InsetArgument(Buffer *, std::string const &);
31
32         ///
33         InsetArgument const * asInsetArgument() const { 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         /// \name Public functions inherited from Inset class
43         //@{
44         ///
45         bool hasSettings() const { return false; }
46         ///
47         InsetCode lyxCode() const { return ARG_CODE; }
48         ///
49         docstring layoutName() const { return from_ascii("Argument"); }
50         /// Update the label string of this inset
51         void updateBuffer(ParIterator const &, UpdateType);
52         ///
53         void latex(otexstream &, OutputParams const &) const { }
54         ///
55         int plaintext(odocstringstream &, OutputParams const &, size_t) const { return 0; }
56         ///
57         int docbook(odocstream &, OutputParams const &) const { return 0; }
58         ///
59         docstring xhtml(XHTMLStream &, OutputParams const &) const 
60                 { return docstring(); }
61         ///
62         void write(std::ostream & os) const;
63         ///
64         void read(Lexer & lex);
65         ///
66         bool neverIndent() const { return true; }
67         ///
68         std::string contextMenuName() const;
69         ///
70         bool isPassThru() const { return pass_thru_; }
71         ///
72         bool resetFontEdit() const { return false; }
73         //@}
74         /// \name Public functions inherited from InsetCollapsable class
75         //@{
76         ///
77         InsetLayout::InsetDecoration decoration() const;
78         ///
79         FontInfo getFont() const;
80         ///
81         FontInfo getLabelfont() const;
82         ///
83         ColorCode labelColor() const;
84         ///
85         void setButtonLabel();
86         //@}
87         ///
88         void addToToc(DocIterator const & dit, bool output_active,
89                       UpdateType utype, TocBackend & backend) const; //override
90
91 private:
92         ///
93         docstring toolTip(BufferView const & bv, int, int) const;
94         ///
95         std::string name_;
96         ///
97         docstring labelstring_;
98         ///
99         docstring tooltip_;
100         ///
101         FontInfo font_;
102         ///
103         FontInfo labelfont_;
104         ///
105         std::string decoration_;
106         /// Are we in a pass-thru context?
107         bool pass_thru_context_;
108         /// Is the argument itself have an explicitly pass-thru?
109         bool pass_thru_local_;
110         /// Effective pass-thru setting (inherited or local)
111         bool pass_thru_;
112         ///
113         docstring pass_thru_chars_;
114         /// The type of Toc this is the caption of, empty otherwise.
115         std::string caption_of_toc_;
116
117 protected:
118         /// \name Protected functions inherited from Inset class
119         //@{
120         ///
121         bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
122         ///
123         void doDispatch(Cursor & cur, FuncRequest & cmd);
124         ///
125         Inset * clone() const { return new InsetArgument(*this); }
126         /// Is the content of this inset part of the immediate (visible) text sequence?
127         bool isPartOfTextSequence() const { return false; }
128         //@}
129 };
130
131
132 } // namespace lyx
133
134 #endif // INSETARGUMENT_H