4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
9 * Full author contact details are available in file CREDITS.
12 #ifndef INSETCAPTION_H
13 #define INSETCAPTION_H
15 #include "InsetText.h"
16 #include "TextClass.h"
23 class InsetCaption : public InsetText {
26 InsetCaption(InsetCaption const &);
27 InsetCaption(BufferParams const &);
29 virtual ~InsetCaption() {}
31 void write(Buffer const & buf, std::ostream & os) const;
33 void read(Buffer const & buf, Lexer & lex);
35 virtual bool display() const;
37 virtual bool neverIndent(Buffer const &) const { return true; }
39 virtual Inset::Code lyxCode() const;
41 virtual docstring const editMessage() const;
43 virtual void cursorPos(BufferView const & bv,
44 CursorSlice const & sl, bool boundary, int & x, int & y) const;
46 bool descendable() const { return true; }
48 virtual bool metrics(MetricsInfo & mi, Dimension & dim) const;
50 virtual void draw(PainterInfo & pi, int x, int y) const;
52 void drawSelection(PainterInfo & pi, int x, int y) const;
54 virtual void edit(Cursor & cur, bool left);
56 virtual Inset * editXY(Cursor & cur, int x, int y);
58 bool insetAllowed(Inset::Code code) const;
60 virtual bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
62 virtual bool wide() const { return false; }
64 int latex(Buffer const & buf, odocstream & os,
65 OutputParams const &) const;
67 int plaintext(Buffer const & buf, odocstream & os,
68 OutputParams const & runparams) const;
70 int docbook(Buffer const & buf, odocstream & os,
71 OutputParams const & runparams) const;
73 void setCount(int c) { counter_ = c; }
75 std::string const & type() const { return type_; }
77 void setType(std::string const & type) { type_ = type; }
79 void setCustomLabel(docstring const & label);
81 void addToToc(TocList &, Buffer const &) const;
82 /// Captions don't accept alignment, spacing, etc.
83 bool forceDefaultParagraphs(idx_type) const { return true; }
87 void computeFullLabel() const;
89 virtual std::auto_ptr<Inset> doClone() const;
91 mutable docstring full_label_;
93 mutable int labelwidth_;
97 docstring custom_label_;
101 TextClass const & textclass_;
106 bool InsetCaption::display() const
113 Inset::Code InsetCaption::lyxCode() const