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(BufferParams const &);
28 virtual ~InsetCaption() {}
30 void write(Buffer const & buf, std::ostream & os) const;
32 void read(Buffer const & buf, Lexer & lex);
34 virtual bool display() const;
36 virtual bool neverIndent(Buffer const &) const { return true; }
38 virtual Inset::Code lyxCode() const;
40 virtual docstring const editMessage() const;
42 virtual void cursorPos(BufferView const & bv,
43 CursorSlice const & sl, bool boundary, int & x, int & y) const;
45 bool descendable() const { return true; }
47 virtual bool metrics(MetricsInfo & mi, Dimension & dim) const;
49 virtual void draw(PainterInfo & pi, int x, int y) const;
51 void drawSelection(PainterInfo & pi, int x, int y) const;
53 virtual void edit(Cursor & cur, bool left);
55 virtual Inset * editXY(Cursor & cur, int x, int y);
57 bool insetAllowed(Inset::Code code) const;
59 virtual bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
61 virtual bool wide() const { return false; }
63 int latex(Buffer const & buf, odocstream & os,
64 OutputParams const &) const;
66 int plaintext(Buffer const & buf, odocstream & os,
67 OutputParams const & runparams) const;
69 int docbook(Buffer const & buf, odocstream & os,
70 OutputParams const & runparams) const;
72 void setCount(int c) { counter_ = c; }
74 std::string const & type() const { return type_; }
76 void setType(std::string const & type) { type_ = type; }
78 void setCustomLabel(docstring const & label);
80 void addToToc(TocList &, Buffer const &) const;
81 /// Captions don't accept alignment, spacing, etc.
82 bool forceDefaultParagraphs(idx_type) const { return true; }
86 void computeFullLabel() const;
88 virtual std::auto_ptr<Inset> doClone() const;
90 mutable docstring full_label_;
92 mutable int labelwidth_;
96 docstring custom_label_;
100 TextClass const & textclass_;
105 bool InsetCaption::display() const
112 Inset::Code InsetCaption::lyxCode() const