]> git.lyx.org Git - lyx.git/blob - src/insets/InsetCaption.h
Inset::addToToc(): change signature. Use DocIterator instead of ParConstIterator...
[lyx.git] / src / insets / InsetCaption.h
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.
6  *
7  * \author Lars Gullik Bjønnes
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef INSETCAPTION_H
13 #define INSETCAPTION_H
14
15 #include "InsetText.h"
16
17 namespace lyx {
18
19 /** A caption inset
20 */
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 getCaptionText(odocstream & os, OutputParams const &) const;
33 private:
34         ///
35         void write(std::ostream & os) const;
36         ///
37         void read(Lexer & lex);
38         ///
39         DisplayType display() const { return AlignCenter; }
40         ///
41         bool neverIndent() const { return true; }
42         ///
43         InsetCode lyxCode() const { return CAPTION_CODE; }
44         ///
45         docstring editMessage() const;
46         ///
47         void cursorPos(BufferView const & bv,
48                 CursorSlice const & sl, bool boundary, int & x, int & y) const;
49         ///
50         bool descendable() const { return true; }
51         ///
52         void metrics(MetricsInfo & mi, Dimension & dim) const;
53         ///
54         void draw(PainterInfo & pi, int x, int y) const;
55         ///
56         void edit(Cursor & cur, bool front, EntryDirection entry_from);
57         ///
58         Inset * editXY(Cursor & cur, int x, int y);
59         ///
60         bool insetAllowed(InsetCode code) const;
61         ///
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 &);
65         ///
66         int latex(odocstream & os, OutputParams const &) const;
67         ///
68         int plaintext(odocstream & os, OutputParams const & runparams) const;
69         ///
70         int docbook(odocstream & os, OutputParams const & runparams) const;
71         ///
72         void setCustomLabel(docstring const & label);
73         ///
74         void addToToc(DocIterator const &);
75         /// 
76         virtual bool forceEmptyLayout(idx_type = 0) const { return true; }
77         /// Captions don't accept alignment, spacing, etc.
78         virtual bool allowParagraphCustomization(idx_type = 0) const { return false; }
79         ///
80         Inset * clone() const { return new InsetCaption(*this); }
81
82         ///
83         mutable docstring full_label_;
84         ///
85         mutable int labelwidth_;
86         ///
87         std::string type_;
88         ///
89         bool in_subfloat_;
90         ///
91         docstring custom_label_;
92 };
93
94
95 } // namespace lyx
96
97 #endif