3 * \file InsetListings.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
12 #ifndef INSETLISTINGS_H
13 #define INSETLISTINGS_H
15 #include "LaTeXFeatures.h"
17 #include "InsetListingsParams.h"
18 #include "MailInset.h"
23 /** A collapsable text inset for program listings.
27 class InsetListings : public InsetCollapsable {
30 InsetListings(BufferParams const &, InsetListingsParams const & par = InsetListingsParams());
34 InsetCode lyxCode() const { return LISTINGS_CODE; }
35 /// lstinline is inlined, normal listing is displayed
36 virtual DisplayType display() const;
38 docstring name() const { return from_ascii("Listings"); }
39 // Update the counters of this inset and of its contents
40 virtual void updateLabels(Buffer const &, ParIterator const &);
42 void write(Buffer const & buf, std::ostream & os) const;
44 void read(Buffer const & buf, Lexer & lex);
46 virtual docstring const editMessage() const;
48 int latex(Buffer const &, odocstream &, OutputParams const &) const;
50 void validate(LaTeXFeatures &) const;
52 bool showInsetDialog(BufferView *) const;
54 InsetListingsParams const & params() const { return params_; }
56 InsetListingsParams & params() { return params_; }
58 InsetListings(InsetListings const &);
60 virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
62 bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
64 virtual Inset * clone() const;
68 void setButtonLabel();
70 docstring getCaption(Buffer const &, OutputParams const &) const;
72 InsetListingsParams params_;
76 class InsetListingsMailer : public MailInset {
79 InsetListingsMailer(InsetListings & inset);
81 virtual Inset & inset() const { return inset_; }
83 virtual std::string const & name() const { return name_; }
85 virtual std::string const inset2string(Buffer const &) const;
87 static void string2params(std::string const &,
88 InsetListingsParams &);
90 static std::string const params2string(InsetListingsParams const &);
93 static std::string const name_;
95 InsetListings & inset_;