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 InsetERT {
30 InsetListings(BufferParams const &, InsetListingsParams const & par = InsetListingsParams());
34 Inset::Code lyxCode() const { return Inset::LISTINGS_CODE; }
35 /// lstinline is inlined, normal listing is displayed
36 virtual DisplayType display() const;
38 docstring name() const { return from_ascii("Listings"); }
40 void write(Buffer const & buf, std::ostream & os) const;
42 void read(Buffer const & buf, Lexer & lex);
44 virtual docstring const editMessage() const;
46 int latex(Buffer const &, odocstream &, OutputParams const &) const;
48 void validate(LaTeXFeatures &) const;
50 bool metrics(MetricsInfo &, Dimension &) const;
52 void draw(PainterInfo & pi, int x, int y) const;
54 bool showInsetDialog(BufferView *) const;
56 void getDrawFont(Font &) const;
58 InsetListingsParams const & params() const { return params_; }
60 InsetListingsParams & params() { return params_; }
62 InsetListings(InsetListings const &);
64 virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
66 bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
68 virtual std::auto_ptr<Inset> doClone() const;
72 void setButtonLabel();
74 docstring getCaption(Buffer const &, OutputParams const &) const;
76 InsetListingsParams params_;
80 class InsetListingsMailer : public MailInset {
83 InsetListingsMailer(InsetListings & inset);
85 virtual Inset & inset() const { return inset_; }
87 virtual std::string const & name() const { return name_; }
89 virtual std::string const inset2string(Buffer const &) const;
91 static void string2params(std::string const &,
92 InsetListingsParams &);
94 static std::string const params2string(InsetListingsParams const &);
97 static std::string const name_;
99 InsetListings & inset_;