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 "support/strfwd.h"
22 class InsetCaption : public InsetText {
25 InsetCaption(Buffer *);
27 std::string const & type() const { return type_; }
29 docstring name() const;
30 /// return the mandatory argument (LaTeX format) only
31 int getArgument(odocstream & os, OutputParams const &) const;
32 /// return the optional argument(s) only
33 int getOptArg(odocstream & os, OutputParams const &) const;
34 /// return the caption text
35 int getCaptionAsPlaintext(odocstream & os, OutputParams const &) const;
36 /// return the caption text as HTML
37 docstring getCaptionAsHTML(XHTMLStream & os, OutputParams const &) const;
40 void write(std::ostream & os) const;
42 void read(Lexer & lex);
44 DisplayType display() const { return AlignCenter; }
46 bool neverIndent() const { return true; }
48 InsetCode lyxCode() const { return CAPTION_CODE; }
50 void cursorPos(BufferView const & bv,
51 CursorSlice const & sl, bool boundary, int & x, int & y) const;
53 bool descendable(BufferView const &) const { return true; }
55 void metrics(MetricsInfo & mi, Dimension & dim) const;
57 void draw(PainterInfo & pi, int x, int y) const;
59 void edit(Cursor & cur, bool front, EntryDirection entry_from);
61 Inset * editXY(Cursor & cur, int x, int y);
63 bool insetAllowed(InsetCode code) const;
65 bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
66 // Update the counters of this inset and of its contents
67 void updateLabels(ParIterator const &, UpdateType);
69 int latex(odocstream & os, OutputParams const &) const;
71 int plaintext(odocstream & os, OutputParams const & runparams) const;
73 int docbook(odocstream & os, OutputParams const & runparams) const;
75 docstring xhtml(XHTMLStream & os, OutputParams const & runparams) const;
77 void setCustomLabel(docstring const & label);
79 void addToToc(DocIterator const &);
81 virtual bool forcePlainLayout(idx_type = 0) const { return true; }
82 /// Captions don't accept alignment, spacing, etc.
83 virtual bool allowParagraphCustomization(idx_type = 0) const { return false; }
85 Inset * clone() const { return new InsetCaption(*this); }
88 mutable docstring full_label_;
90 mutable int labelwidth_;
94 docstring custom_label_;