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"
23 /////////////////////////////////////////////////////////////////////////
27 /////////////////////////////////////////////////////////////////////////
29 /// A captionable and collapsible text inset for program listings.
30 class InsetListings : public InsetCaptionable
34 InsetListings(Buffer *, InsetListingsParams const & par = InsetListingsParams());
38 static void string2params(std::string const &, InsetListingsParams &);
40 static std::string params2string(InsetListingsParams const &);
43 bool isLabeled() const { return true; }
44 /// false is needed since listings do their own font handling.
45 bool inheritFont() const { return false; }
47 InsetCode lyxCode() const { return LISTINGS_CODE; }
48 /// lstinline is inlined, normal listing is displayed
49 RowFlags rowFlags() const;
51 docstring layoutName() const;
53 void write(std::ostream & os) const;
55 void read(Lexer & lex);
57 void latex(otexstream &, OutputParams const &) const;
59 docstring xhtml(XMLStream &, OutputParams const &) const;
61 void docbook(XMLStream &, OutputParams const &) const;
63 void validate(LaTeXFeatures &) const;
65 bool showInsetDialog(BufferView *) const;
67 InsetListingsParams const & params() const { return params_; }
69 InsetListingsParams & params() { return params_; }
71 std::string contextMenuName() const;
73 void doDispatch(Cursor & cur, FuncRequest & cmd);
75 bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
77 Inset * clone() const { return new InsetListings(*this); }
79 docstring const buttonLabel(BufferView const & bv) const;
81 TexString getCaption(OutputParams const &) const;
83 bool insetAllowed(InsetCode c) const { return c == CAPTION_CODE || c == QUOTE_CODE; }
85 Encoding const * forcedEncoding(Encoding const *, Encoding const *) const;
88 InsetListingsParams params_;
93 #endif // INSET_LISTINGS_H