]> git.lyx.org Git - lyx.git/blob - src/insets/InsetListings.h
aa46765c59c55ea730ac37858062f077289f6f71
[lyx.git] / src / insets / InsetListings.h
1 // -*- C++ -*-
2 /**
3  * \file InsetListings.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Bo Peng
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef INSET_LISTINGS_H
13 #define INSET_LISTINGS_H
14
15 #include "InsetListingsParams.h"
16
17
18 namespace lyx {
19
20 class LaTeXFeatures;
21 struct TexString;
22
23 /////////////////////////////////////////////////////////////////////////
24 //
25 // InsetListings
26 //
27 /////////////////////////////////////////////////////////////////////////
28
29 /// A captionable and collapsable text inset for program listings.
30 class InsetListings : public InsetCaptionable
31 {
32 public:
33         ///
34         InsetListings(Buffer *, InsetListingsParams const & par = InsetListingsParams());
35         ///
36         ~InsetListings();
37         ///
38         static void string2params(std::string const &, InsetListingsParams &);
39         ///
40         static std::string params2string(InsetListingsParams const &);
41 private:
42         ///
43         bool isLabeled() const { return true; }
44         /// false is needed since listings do their own font handling.
45         bool inheritFont() const { return false; }
46         ///
47         InsetCode lyxCode() const { return LISTINGS_CODE; }
48         /// lstinline is inlined, normal listing is displayed
49         DisplayType display() const;
50         ///
51         docstring layoutName() const;
52         ///
53         void write(std::ostream & os) const;
54         ///
55         void read(Lexer & lex);
56         ///
57         void latex(otexstream &, OutputParams const &) const;
58         ///
59         docstring xhtml(XHTMLStream &, OutputParams const &) const;
60         ///
61         void validate(LaTeXFeatures &) const;
62         ///
63         bool showInsetDialog(BufferView *) const;
64         ///
65         InsetListingsParams const & params() const { return params_; }
66         ///
67         InsetListingsParams & params() { return params_; }
68         ///
69         std::string contextMenuName() const;
70         ///
71         void doDispatch(Cursor & cur, FuncRequest & cmd);
72         ///
73         bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
74         ///
75         Inset * clone() const { return new InsetListings(*this); }
76         ///
77         docstring const buttonLabel(BufferView const & bv) const;
78         ///
79         TexString getCaption(OutputParams const &) const;
80         ///
81         bool insetAllowed(InsetCode c) const { return c == CAPTION_CODE || c == QUOTE_CODE; }
82
83         ///
84         InsetListingsParams params_;
85 };
86
87 } // namespace lyx
88
89 #endif // INSET_LISTINGS_H