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 *, std::string const &);
26 std::string const & floattype() const { return floattype_; }
28 docstring layoutName() const;
29 /// return the mandatory argument (LaTeX format) only
30 void getArgument(otexstream & 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(XMLStream & os, OutputParams const &) const;
36 std::string contextMenuName() const;
39 void write(std::ostream & os) const;
41 DisplayType display() const { return AlignCenter; }
43 bool neverIndent() const { return true; }
45 bool forceLocalFontSwitch() const { return true; }
47 InsetCode lyxCode() const { return CAPTION_CODE; }
49 void cursorPos(BufferView const & bv,
50 CursorSlice const & sl, bool boundary, int & x, int & y) const;
52 bool descendable(BufferView const &) const { return true; }
54 void metrics(MetricsInfo & mi, Dimension & dim) const;
56 void drawBackground(PainterInfo & pi, int x, int y) const;
58 void draw(PainterInfo & pi, int x, int y) const;
59 /// Strike out the inset when deleted.
60 bool canPaintChange(BufferView const &) const { return true; }
62 void edit(Cursor & cur, bool front, EntryDirection entry_from);
64 Inset * editXY(Cursor & cur, int x, int y);
66 bool insetAllowed(InsetCode code) const;
68 void doDispatch(Cursor & cur, FuncRequest & cmd);
70 bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
71 // Update the counters of this inset and of its contents
72 void updateBuffer(ParIterator const &, UpdateType, bool const deleted);
74 void latex(otexstream & os, OutputParams const &) const;
76 int plaintext(odocstringstream & ods, OutputParams const & op,
77 size_t max_length = INT_MAX) const;
79 int docbook(odocstream & os, OutputParams const & runparams) const;
81 docstring xhtml(XMLStream & os, OutputParams const & runparams) const;
83 void addToToc(DocIterator const & di, bool output_active, UpdateType utype,
84 TocBackend & backend) const;
86 virtual bool forcePlainLayout(idx_type = 0) const { return true; }
87 /// Captions don't accept alignment, spacing, etc.
88 virtual bool allowParagraphCustomization(idx_type = 0) const { return false; }
90 Inset * clone() const { return new InsetCaption(*this); }
93 mutable docstring full_label_;
95 mutable int labelwidth_;
97 std::string floattype_;