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;
31 /// return the caption text
32 int getCaptionAsPlaintext(odocstream & os, OutputParams const &) const;
33 /// return the caption text as HTML
34 docstring getCaptionAsHTML(odocstream & os, OutputParams const &) const;
37 void write(std::ostream & os) const;
39 void read(Lexer & lex);
41 DisplayType display() const { return AlignCenter; }
43 bool neverIndent() const { return true; }
45 InsetCode lyxCode() const { return CAPTION_CODE; }
47 void cursorPos(BufferView const & bv,
48 CursorSlice const & sl, bool boundary, int & x, int & y) const;
50 bool descendable() const { return true; }
52 void metrics(MetricsInfo & mi, Dimension & dim) const;
54 void draw(PainterInfo & pi, int x, int y) const;
56 void edit(Cursor & cur, bool front, EntryDirection entry_from);
58 Inset * editXY(Cursor & cur, int x, int y);
60 bool insetAllowed(InsetCode code) const;
62 bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
63 // Update the counters of this inset and of its contents
64 void updateLabels(ParIterator const &);
66 int latex(odocstream & os, OutputParams const &) const;
68 int plaintext(odocstream & os, OutputParams const & runparams) const;
70 int docbook(odocstream & os, OutputParams const & runparams) const;
72 docstring xhtml(odocstream & os, OutputParams const & runparams) const;
74 void setCustomLabel(docstring const & label);
76 void addToToc(DocIterator const &);
78 virtual bool forcePlainLayout(idx_type = 0) const { return true; }
79 /// Captions don't accept alignment, spacing, etc.
80 virtual bool allowParagraphCustomization(idx_type = 0) const { return false; }
82 Inset * clone() const { return new InsetCaption(*this); }
85 mutable docstring full_label_;
87 mutable int labelwidth_;
91 docstring custom_label_;