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