Polish some of the recent changes in accord with suggestions
[lyx.git] / src / insets / InsetCaption.h
bloba942752126ad194e95bbb70aa8e1699c8722881a
1 // -*- C++ -*-
2 /**
3 * \file InsetCaption.h
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"
17 namespace lyx {
19 /** A caption inset
21 class InsetCaption : public InsetText {
22 public:
23 ///
24 InsetCaption(Buffer const &);
25 ///
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;
35 private:
36 ///
37 void write(std::ostream & os) const;
38 ///
39 void read(Lexer & lex);
40 ///
41 DisplayType display() const { return AlignCenter; }
42 ///
43 bool neverIndent() const { return true; }
44 ///
45 InsetCode lyxCode() const { return CAPTION_CODE; }
46 ///
47 docstring editMessage() const;
48 ///
49 void cursorPos(BufferView const & bv,
50 CursorSlice const & sl, bool boundary, int & x, int & y) const;
51 ///
52 bool descendable() const { return true; }
53 ///
54 void metrics(MetricsInfo & mi, Dimension & dim) const;
55 ///
56 void draw(PainterInfo & pi, int x, int y) const;
57 ///
58 void edit(Cursor & cur, bool front, EntryDirection entry_from);
59 ///
60 Inset * editXY(Cursor & cur, int x, int y);
61 ///
62 bool insetAllowed(InsetCode code) const;
63 ///
64 bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
65 // Update the counters of this inset and of its contents
66 void updateLabels(ParIterator const &);
67 ///
68 int latex(odocstream & os, OutputParams const &) const;
69 ///
70 int plaintext(odocstream & os, OutputParams const & runparams) const;
71 ///
72 int docbook(odocstream & os, OutputParams const & runparams) const;
73 /// This does nothing here. Instead, it is handled inside the float.
74 docstring xhtml(odocstream & os, OutputParams const & runparams) const;
75 ///
76 void setCustomLabel(docstring const & label);
77 ///
78 void addToToc(DocIterator const &);
79 ///
80 virtual bool forcePlainLayout(idx_type = 0) const { return true; }
81 /// Captions don't accept alignment, spacing, etc.
82 virtual bool allowParagraphCustomization(idx_type = 0) const { return false; }
83 ///
84 Inset * clone() const { return new InsetCaption(*this); }
86 ///
87 mutable docstring full_label_;
88 ///
89 mutable int labelwidth_;
90 ///
91 std::string type_;
92 ///
93 docstring custom_label_;
97 } // namespace lyx
99 #endif