]> git.lyx.org Git - lyx.git/blob - src/insets/InsetCaption.h
Output a parbreak after a command.
[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 *, std::string const &);
25         ///
26         std::string const & floattype() const { return floattype_; }
27         ///
28         docstring layoutName() const;
29         /// return the mandatory argument (LaTeX format) only
30         void getArgument(otexstream & os, OutputParams const &) const;
31         /// return the caption text
32         int getCaptionAsPlaintext(odocstream & os, OutputParams const &) const;
33         /// return the caption text as HTML
34         docstring getCaptionAsHTML(XHTMLStream & os, OutputParams const &) const;
35         ///
36         std::string contextMenuName() const;
37 private:
38         ///
39         void write(std::ostream & os) const;
40         ///
41         DisplayType display() const { return AlignCenter; }
42         ///
43         bool neverIndent() const { return true; }
44         ///
45         InsetCode lyxCode() const { return CAPTION_CODE; }
46         ///
47         void cursorPos(BufferView const & bv,
48                 CursorSlice const & sl, bool boundary, int & x, int & y) const;
49         ///
50         bool descendable(BufferView const &) const { return true; }
51         ///
52         void metrics(MetricsInfo & mi, Dimension & dim) const;
53         ///     
54         void drawBackground(PainterInfo & pi, int x, int y) const;
55         ///
56         void draw(PainterInfo & pi, int x, int y) const;
57         ///
58         void edit(Cursor & cur, bool front, EntryDirection entry_from);
59         ///
60         Inset * editXY(Cursor & cur, int x, int y);
61         ///
62         bool insetAllowed(InsetCode code) const;
63         ///
64         void doDispatch(Cursor & cur, FuncRequest & cmd);
65         ///
66         bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
67         // Update the counters of this inset and of its contents
68         void updateBuffer(ParIterator const &, UpdateType);
69         ///
70         void latex(otexstream & os, OutputParams const &) const;
71         ///
72         int plaintext(odocstringstream & ods, OutputParams const & op,
73                       size_t max_length = INT_MAX) const;
74         ///
75         int docbook(odocstream & os, OutputParams const & runparams) const;
76         /// 
77         docstring xhtml(XHTMLStream & os, OutputParams const & runparams) const;
78         ///
79         void setCustomLabel(docstring const & label);
80         /// \param output_active : is the toc being generated for use by the
81         /// output routines?
82         void addToToc(DocIterator const & di, bool output_active) const;
83         /// 
84         virtual bool forcePlainLayout(idx_type = 0) const { return true; }
85         /// Captions don't accept alignment, spacing, etc.
86         virtual bool allowParagraphCustomization(idx_type = 0) const { return false; }
87         ///
88         Inset * clone() const { return new InsetCaption(*this); }
89
90         ///
91         mutable docstring full_label_;
92         ///
93         mutable int labelwidth_;
94         ///
95         std::string floattype_;
96         ///
97         std::string type_;
98         ///
99         docstring custom_label_;
100 };
101
102
103 } // namespace lyx
104
105 #endif