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"
21 class InsetCaption : public InsetText {
24 InsetCaption(Buffer const &);
26 std::string const & type() const { return type_; }
27 /// return the mandatory argument (LaTeX format) only
28 int getArgument(odocstream & os, OutputParams const &) const;
29 /// return the optional argument(s) only
30 int getOptArg(odocstream & os, OutputParams const &) const;
33 void write(std::ostream & os) const;
35 void read(Lexer & lex);
37 DisplayType display() const { return AlignCenter; }
39 bool neverIndent() const { return true; }
41 InsetCode lyxCode() const { return CAPTION_CODE; }
43 docstring editMessage() const;
45 void cursorPos(BufferView const & bv,
46 CursorSlice const & sl, bool boundary, int & x, int & y) const;
48 bool descendable() const { return true; }
50 void metrics(MetricsInfo & mi, Dimension & dim) const;
52 void draw(PainterInfo & pi, int x, int y) const;
54 void edit(Cursor & cur, bool front, EntryDirection entry_from);
56 Inset * editXY(Cursor & cur, int x, int y);
58 bool insetAllowed(InsetCode code) const;
60 bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
61 // Update the counters of this inset and of its contents
62 void updateLabels(ParIterator const &);
64 int latex(odocstream & os, OutputParams const &) const;
66 int plaintext(odocstream & os, OutputParams const & runparams) const;
68 int docbook(odocstream & os, OutputParams const & runparams) const;
70 void setCustomLabel(docstring const & label);
72 void addToToc(ParConstIterator const &) const;
74 virtual bool forceEmptyLayout(idx_type = 0) const { return true; }
75 /// Captions don't accept alignment, spacing, etc.
76 virtual bool allowParagraphCustomization(idx_type = 0) const { return false; }
78 Inset * clone() const { return new InsetCaption(*this); }
81 mutable docstring full_label_;
83 mutable int labelwidth_;
89 docstring custom_label_;