]> git.lyx.org Git - lyx.git/blob - src/insets/InsetListings.h
This is intended to be a pure renaming of the Inset::name() routine,
[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
22 /////////////////////////////////////////////////////////////////////////
23 //
24 // InsetListings
25 //
26 /////////////////////////////////////////////////////////////////////////
27
28 /// A collapsable text inset for program listings.
29 class InsetListings : public InsetCollapsable
30 {
31 public:
32         ///
33         InsetListings(Buffer *, InsetListingsParams const & par = InsetListingsParams());
34         ///
35         ~InsetListings();
36         ///
37         static void string2params(std::string const &, InsetListingsParams &);
38         ///
39         static std::string params2string(InsetListingsParams const &);
40 private:
41         ///
42         bool isLabeled() const { return true; }
43         /// false is needed since listings do their own font handling.
44         bool inheritFont() const { return false; }
45         ///
46         InsetCode lyxCode() const { return LISTINGS_CODE; }
47         /// lstinline is inlined, normal listing is displayed
48         DisplayType display() const;
49         ///
50         docstring layoutName() const { return from_ascii("Listings"); }
51         // Update the counters of this inset and of its contents
52         void updateBuffer(ParIterator const &, UpdateType);
53         ///
54         void write(std::ostream & os) const;
55         ///
56         void read(Lexer & lex);
57         ///
58         void latex(otexstream &, OutputParams const &) const;
59         ///
60         docstring xhtml(XHTMLStream &, OutputParams const &) const;
61         ///
62         void validate(LaTeXFeatures &) const;
63         ///
64         bool showInsetDialog(BufferView *) const;
65         ///
66         InsetListingsParams const & params() const { return params_; }
67         ///
68         InsetListingsParams & params() { return params_; }
69         ///
70         docstring contextMenuName() const;
71         ///
72         void doDispatch(Cursor & cur, FuncRequest & cmd);
73         ///
74         bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
75         ///
76         Inset * clone() const { return new InsetListings(*this); }
77         ///
78         docstring const buttonLabel(BufferView const & bv) const;
79         ///
80         docstring getCaption(OutputParams const &) const;
81         ///
82         bool insetAllowed(InsetCode c) const { return c == CAPTION_CODE; } 
83
84         ///
85         InsetListingsParams params_;
86 };
87
88 } // namespace lyx
89
90 #endif // INSET_LISTINGS_H