]> git.lyx.org Git - lyx.git/blob - src/insets/insetcaption.h
* BufferParams:
[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 #include "lyxtextclass.h"
17
18
19 namespace lyx {
20
21 /** A caption inset
22 */
23 class InsetCaption : public InsetText {
24 public:
25         ///
26         InsetCaption(BufferParams const &);
27         ///
28         virtual ~InsetCaption() {}
29         ///
30         void write(Buffer const & buf, std::ostream & os) const;
31         ///
32         void read(Buffer const & buf, LyXLex & lex);
33         ///
34         virtual bool display() const;
35         ///
36         virtual bool neverIndent(Buffer const &) const { return true; }
37         ///
38         virtual InsetBase::Code lyxCode() const;
39         ///
40         virtual docstring const editMessage() const;
41         ///
42         virtual void cursorPos(BufferView const & bv,
43                 CursorSlice const & sl, bool boundary, int & x, int & y) const;
44         ///
45         bool descendable() const { return true; }
46         ///
47         virtual bool metrics(MetricsInfo & mi, Dimension & dim) const;
48         ///
49         virtual void draw(PainterInfo & pi, int x, int y) const;
50         ///
51         void drawSelection(PainterInfo & pi, int x, int y) const;
52         ///
53         virtual void edit(LCursor & cur, bool left);
54         ///
55         virtual InsetBase * editXY(LCursor & cur, int x, int y);
56         ///
57         bool insetAllowed(InsetBase::Code code) const;
58         ///
59         virtual bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus &) const;
60         ///
61         virtual bool wide() const { return false; }
62         ///
63         int latex(Buffer const & buf, odocstream & os,
64                   OutputParams const &) const;
65         ///
66         int plaintext(Buffer const & buf, odocstream & os,
67                       OutputParams const & runparams) const;
68         ///
69         int docbook(Buffer const & buf, odocstream & os,
70                     OutputParams const & runparams) const;
71         ///
72         void setCount(int c) { counter_ = c; }
73         ///
74         std::string const & type() const { return type_; }
75         ///
76         void setType(std::string const & type) { type_ = type; }
77         ///
78         void setCustomLabel(docstring const & label);
79         ///
80         void addToToc(TocList &, Buffer const &) const;
81
82 private:
83         ///
84         void computeFullLabel() const;
85         ///
86         virtual std::auto_ptr<InsetBase> doClone() const;
87         ///
88         mutable docstring full_label_;
89         ///
90         mutable int labelwidth_;
91         ///
92         std::string type_;
93         ///
94         docstring custom_label_;
95         ///
96         int counter_;
97         ///
98         LyXTextClass const & textclass_;
99 };
100
101
102 inline
103 bool InsetCaption::display() const
104 {
105         return true;
106 }
107
108
109 inline
110 InsetBase::Code InsetCaption::lyxCode() const
111 {
112         return CAPTION_CODE;
113 }
114
115
116 } // namespace lyx
117
118 #endif