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