]> git.lyx.org Git - lyx.git/blob - src/insets/InsetCaption.h
Pure HTML output for math macros.
[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 "support/strfwd.h"
17
18 namespace lyx {
19
20 /** A caption inset
21 */
22 class InsetCaption : public InsetText {
23 public:
24         ///
25         InsetCaption(Buffer *);
26         ///
27         std::string const & type() const { return type_; }
28         ///
29         docstring name() const;
30         /// return the mandatory argument (LaTeX format) only
31         int getArgument(odocstream & os, OutputParams const &) const;
32         /// return the optional argument(s) only
33         int getOptArg(odocstream & os, OutputParams const &) const;
34         /// return the caption text
35         int getCaptionAsPlaintext(odocstream & os, OutputParams const &) const;
36         /// return the caption text as HTML
37         docstring getCaptionAsHTML(XHTMLStream & os, OutputParams const &) const;
38 private:
39         ///
40         void write(std::ostream & os) const;
41         ///
42         void read(Lexer & lex);
43         ///
44         DisplayType display() const { return AlignCenter; }
45         ///
46         bool neverIndent() const { return true; }
47         ///
48         InsetCode lyxCode() const { return CAPTION_CODE; }
49         ///
50         void cursorPos(BufferView const & bv,
51                 CursorSlice const & sl, bool boundary, int & x, int & y) const;
52         ///
53         bool descendable(BufferView const &) const { return true; }
54         ///
55         void metrics(MetricsInfo & mi, Dimension & dim) const;
56         ///
57         void draw(PainterInfo & pi, int x, int y) const;
58         ///
59         void edit(Cursor & cur, bool front, EntryDirection entry_from);
60         ///
61         Inset * editXY(Cursor & cur, int x, int y);
62         ///
63         bool insetAllowed(InsetCode code) const;
64         ///
65         bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
66         // Update the counters of this inset and of its contents
67         void updateBuffer(ParIterator const &, UpdateType);
68         ///
69         int latex(odocstream & os, OutputParams const &) const;
70         ///
71         int plaintext(odocstream & os, OutputParams const & runparams) const;
72         ///
73         int docbook(odocstream & os, OutputParams const & runparams) const;
74         /// 
75         docstring xhtml(XHTMLStream & os, OutputParams const & runparams) const;
76         ///
77         void setCustomLabel(docstring const & label);
78         ///
79         void addToToc(DocIterator const &);
80         /// 
81         virtual bool forcePlainLayout(idx_type = 0) const { return true; }
82         /// Captions don't accept alignment, spacing, etc.
83         virtual bool allowParagraphCustomization(idx_type = 0) const { return false; }
84         ///
85         Inset * clone() const { return new InsetCaption(*this); }
86
87         ///
88         mutable docstring full_label_;
89         ///
90         mutable int labelwidth_;
91         ///
92         std::string type_;
93         ///
94         docstring custom_label_;
95 };
96
97
98 } // namespace lyx
99
100 #endif