]> git.lyx.org Git - lyx.git/blob - src/insets/insetcaption.h
The caption inset patch by Georg, Martin and myself.
[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         virtual void edit(LCursor & cur, bool left);
52         ///
53         virtual InsetBase * editXY(LCursor & cur, int x, int y);
54         ///
55         virtual bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus &) const;
56         ///
57         virtual bool wide() const { return false; }
58         ///
59         virtual int latex(Buffer const & buf, odocstream & os,
60                           OutputParams const &) const;
61         ///
62         int plaintext(Buffer const & buf, odocstream & os,
63                   OutputParams const & runparams) const;
64         ///
65         int docbook(Buffer const & buf, odocstream & os,
66                     OutputParams const & runparams) const;
67         ///
68         void setCount(int c) { counter_ = c; }
69         ///
70         void setLabel(docstring const & label);
71
72 private:
73         ///
74         virtual std::auto_ptr<InsetBase> doClone() const;
75         ///
76         mutable docstring full_label_;
77         ///
78         mutable int labelwidth_;
79         ///
80         docstring label_;
81         ///
82         int counter_;
83         ///
84         LyXTextClass const & textclass_;
85 };
86
87
88 inline
89 bool InsetCaption::display() const
90 {
91         return true;
92 }
93
94
95 inline
96 InsetBase::Code InsetCaption::lyxCode() const
97 {
98         return CAPTION_CODE;
99 }
100
101
102 } // namespace lyx
103
104 #endif