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"
23 class InsetCaption : public InsetText {
26 InsetCaption(InsetCaption const &);
27 InsetCaption(BufferParams const &);
29 virtual ~InsetCaption() {}
31 void write(Buffer const & buf, std::ostream & os) const;
33 void read(Buffer const & buf, Lexer & lex);
35 virtual DisplayType display() const;
37 virtual bool neverIndent(Buffer const &) const { return true; }
39 virtual InsetCode lyxCode() const;
41 virtual docstring const editMessage() const;
43 virtual void cursorPos(BufferView const & bv,
44 CursorSlice const & sl, bool boundary, int & x, int & y) const;
46 bool descendable() const { return true; }
48 virtual void metrics(MetricsInfo & mi, Dimension & dim) const;
50 virtual void draw(PainterInfo & pi, int x, int y) const;
52 virtual void edit(Cursor & cur, bool front, EntryDirectionType entry_from);
54 virtual Inset * editXY(Cursor & cur, int x, int y);
56 bool insetAllowed(InsetCode code) const;
58 virtual bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
59 // Update the counters of this inset and of its contents
60 virtual void updateLabels(Buffer const &, ParIterator const &);
62 int latex(Buffer const & buf, odocstream & os,
63 OutputParams const &) const;
65 int plaintext(Buffer const & buf, odocstream & os,
66 OutputParams const & runparams) const;
68 int docbook(Buffer const & buf, odocstream & os,
69 OutputParams const & runparams) const;
70 /// return the mandatory argument (LaTeX format) only
71 int getArgument(Buffer const & buf, odocstream & os,
72 OutputParams const &) const;
73 /// return the optional argument(s) only
74 int getOptArg(Buffer const & buf, odocstream & os,
75 OutputParams const &) const;
77 std::string const & type() const { return type_; }
79 void setType(std::string const & type) { type_ = type; }
81 void setCustomLabel(docstring const & label);
83 void addToToc(TocList &, Buffer const &, ParConstIterator const &) const;
84 /// Captions don't accept alignment, spacing, etc.
85 bool forceDefaultParagraphs(idx_type) const { return true; }
89 virtual Inset * clone() const;
91 mutable docstring full_label_;
93 mutable int labelwidth_;
97 docstring custom_label_;
99 TextClass const & textclass_;
104 Inset::DisplayType InsetCaption::display() const
111 InsetCode InsetCaption::lyxCode() const