]> git.lyx.org Git - lyx.git/blob - src/insets/InsetCaption.h
631181b9224e55bfda69eb391b6bffddd4c16ce2
[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(InsetCaption const &);
25         InsetCaption(Buffer const &);
26         ///
27         virtual ~InsetCaption() {}
28         ///
29         void write(std::ostream & os) const;
30         ///
31         void read(Lexer & lex);
32         ///
33         virtual DisplayType display() const;
34         ///
35         virtual bool neverIndent() const { return true; }
36         ///
37         virtual InsetCode lyxCode() const;
38         ///
39         docstring editMessage() const;
40         ///
41         virtual void cursorPos(BufferView const & bv,
42                 CursorSlice const & sl, bool boundary, int & x, int & y) const;
43         ///
44         bool descendable() const { return true; }
45         ///
46         virtual void metrics(MetricsInfo & mi, Dimension & dim) const;
47         ///
48         virtual void draw(PainterInfo & pi, int x, int y) const;
49         ///
50         virtual void edit(Cursor & cur, bool front, EntryDirection entry_from);
51         ///
52         virtual Inset * editXY(Cursor & cur, int x, int y);
53         ///
54         bool insetAllowed(InsetCode code) const;
55         ///
56         virtual bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
57         // Update the counters of this inset and of its contents
58         virtual void updateLabels(ParIterator const &);
59         ///
60         int latex(odocstream & os, OutputParams const &) const;
61         ///
62         int plaintext(odocstream & os, OutputParams const & runparams) const;
63         ///
64         int docbook(odocstream & os, OutputParams const & runparams) const;
65         /// return the mandatory argument (LaTeX format) only
66         int getArgument(odocstream & os, OutputParams const &) const;
67         /// return the optional argument(s) only
68         int getOptArg(odocstream & os, OutputParams const &) const;
69         ///
70         std::string const & type() const { return type_; }
71         ///
72         void setCustomLabel(docstring const & label);
73         ///
74         void addToToc(ParConstIterator const &) const;
75         /// 
76         virtual bool forceEmptyLayout() const { return true; }
77         /// Captions don't accept alignment, spacing, etc.
78         virtual bool allowParagraphCustomization(idx_type) const { return false; }
79
80 private:
81         ///
82         virtual Inset * clone() const;
83         ///
84         mutable docstring full_label_;
85         ///
86         mutable int labelwidth_;
87         ///
88         std::string type_;
89         ///
90         bool in_subfloat_;
91         ///
92         docstring custom_label_;
93 };
94
95
96 inline
97 Inset::DisplayType InsetCaption::display() const
98 {
99         return AlignCenter;
100 }
101
102
103 inline
104 InsetCode InsetCaption::lyxCode() const
105 {
106         return CAPTION_CODE;
107 }
108
109
110 } // namespace lyx
111
112 #endif