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 "lyxtextclass.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, LyXLex & lex);
34 virtual bool display() const;
36 virtual bool neverIndent(Buffer const &) const { return true; }
38 virtual InsetBase::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(LCursor & cur, bool left);
55 virtual InsetBase * editXY(LCursor & cur, int x, int y);
57 bool insetAllowed(InsetBase::Code code) const;
59 virtual bool getStatus(LCursor & 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 void setType(std::string const & type) { type_ = type; }
76 void setCustomLabel(docstring const & label);
78 void addToToc(TocList &, Buffer const &) const;
82 void computeFullLabel() const;
84 virtual std::auto_ptr<InsetBase> doClone() const;
86 mutable docstring full_label_;
88 mutable int labelwidth_;
92 docstring custom_label_;
96 LyXTextClass const & textclass_;
101 bool InsetCaption::display() const
108 InsetBase::Code InsetCaption::lyxCode() const