X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetListings.h;h=84acbb93db75e8c968651bb558523855347fca13;hb=3d7ede605978461a6bd67b250925fcc8bf8404c3;hp=4b0afc53f2931688d4a8910168885ef3ed3e3ecb;hpb=3d443b4c9dc657663a7d67c8254894345e551a06;p=lyx.git diff --git a/src/insets/InsetListings.h b/src/insets/InsetListings.h index 4b0afc53f2..84acbb93db 100644 --- a/src/insets/InsetListings.h +++ b/src/insets/InsetListings.h @@ -9,43 +9,53 @@ * Full author contact details are available in file CREDITS. */ -#ifndef INSETLISTINGS_H -#define INSETLISTINGS_H +#ifndef INSET_LISTINGS_H +#define INSET_LISTINGS_H -#include "LaTeXFeatures.h" -#include "InsetERT.h" #include "InsetListingsParams.h" -#include "MailInset.h" namespace lyx { -/** A collapsable text inset for program listings. - */ +class LaTeXFeatures; +///////////////////////////////////////////////////////////////////////// +// +// InsetListings +// +///////////////////////////////////////////////////////////////////////// -class InsetListings : public InsetCollapsable { +/// A captionable and collapsable text inset for program listings. +class InsetListings : public InsetCaptionable +{ public: /// - InsetListings(BufferParams const &, InsetListingsParams const & par = InsetListingsParams()); + InsetListings(Buffer *, InsetListingsParams const & par = InsetListingsParams()); /// ~InsetListings(); /// + static void string2params(std::string const &, InsetListingsParams &); + /// + static std::string params2string(InsetListingsParams const &); +private: + /// + bool isLabeled() const { return true; } + /// false is needed since listings do their own font handling. + bool inheritFont() const { return false; } + /// InsetCode lyxCode() const { return LISTINGS_CODE; } /// lstinline is inlined, normal listing is displayed - virtual DisplayType display() const; + DisplayType display() const; /// - docstring name() const { return from_ascii("Listings"); } - // Update the counters of this inset and of its contents - virtual void updateLabels(Buffer const &, ParIterator const &); + docstring layoutName() const { return from_ascii("Listings"); } /// - void write(Buffer const & buf, std::ostream & os) const; + void write(std::ostream & os) const; /// - void read(Buffer const & buf, Lexer & lex); + void read(Lexer & lex); /// - virtual docstring const editMessage() const; + void latex(otexstream &, OutputParams const &) const; /// - int latex(Buffer const &, odocstream &, OutputParams const &) const; + docstring xhtml(XHTMLStream &, OutputParams const &) const; /// void validate(LaTeXFeatures &) const; /// @@ -54,48 +64,25 @@ public: InsetListingsParams const & params() const { return params_; } /// InsetListingsParams & params() { return params_; } -protected: - InsetListings(InsetListings const &); /// - virtual void doDispatch(Cursor & cur, FuncRequest & cmd); + std::string contextMenuName() const; + /// + void doDispatch(Cursor & cur, FuncRequest & cmd); /// bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const; -private: - virtual Inset * clone() const; /// - void init(); + Inset * clone() const { return new InsetListings(*this); } /// - void setButtonLabel(); + docstring const buttonLabel(BufferView const & bv) const; /// - docstring getCaption(Buffer const &, OutputParams const &) const; + docstring getCaption(OutputParams const &) const; /// - InsetListingsParams params_; -}; + bool insetAllowed(InsetCode c) const { return c == CAPTION_CODE; } - -class InsetListingsMailer : public MailInset { -public: /// - InsetListingsMailer(InsetListings & inset); - /// - virtual Inset & inset() const { return inset_; } - /// - virtual std::string const & name() const { return name_; } - /// - virtual std::string const inset2string(Buffer const &) const; - /// - static void string2params(std::string const &, - InsetListingsParams &); - /// - static std::string const params2string(InsetListingsParams const &); -private: - /// - static std::string const name_; - /// - InsetListings & inset_; + InsetListingsParams params_; }; - } // namespace lyx -#endif +#endif // INSET_LISTINGS_H