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 INSET_LISTINGS_H
13 #define INSET_LISTINGS_H
15 #include "InsetListingsParams.h"
22 /////////////////////////////////////////////////////////////////////////
26 /////////////////////////////////////////////////////////////////////////
28 /// A collapsable text inset for program listings.
29 class InsetListings : public InsetCollapsable
33 InsetListings(Buffer *, InsetListingsParams const & par = InsetListingsParams());
37 static void string2params(std::string const &, InsetListingsParams &);
39 static std::string params2string(InsetListingsParams const &);
42 bool isLabeled() const { return true; }
43 /// false is needed since listings do their own font handling.
44 bool inheritFont() const { return false; }
46 InsetCode lyxCode() const { return LISTINGS_CODE; }
47 /// lstinline is inlined, normal listing is displayed
48 DisplayType display() const;
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);
54 void write(std::ostream & os) const;
56 void read(Lexer & lex);
58 void latex(otexstream &, OutputParams const &) const;
60 docstring xhtml(XHTMLStream &, OutputParams const &) const;
62 void validate(LaTeXFeatures &) const;
64 bool showInsetDialog(BufferView *) const;
66 InsetListingsParams const & params() const { return params_; }
68 InsetListingsParams & params() { return params_; }
70 std::string contextMenuName() const;
72 void doDispatch(Cursor & cur, FuncRequest & cmd);
74 bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
76 Inset * clone() const { return new InsetListings(*this); }
78 docstring const buttonLabel(BufferView const & bv) const;
80 docstring getCaption(OutputParams const &) const;
82 bool insetAllowed(InsetCode c) const { return c == CAPTION_CODE; }
85 InsetListingsParams params_;
90 #endif // INSET_LISTINGS_H