]> git.lyx.org Git - features.git/blob - src/insets/InsetCaption.h
Completion: handle undo in insets' insertCompletion methods
[features.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 override;
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         /// write the caption text as DocBook in os
34         void getCaptionAsDocBook(XMLStream & os, OutputParams const &) const;
35         /// return the caption text as HTML
36         docstring getCaptionAsHTML(XMLStream & os, OutputParams const &) const;
37         ///
38         std::string contextMenuName() const override;
39 private:
40         ///
41         void write(std::ostream & os) const override;
42         ///
43         int rowFlags() const override { return Display; }
44         ///
45         bool neverIndent() const override { return true; }
46         ///
47         bool forceLocalFontSwitch() const override { return true; }
48         ///
49         InsetCode lyxCode() const override { return CAPTION_CODE; }
50         ///
51         void cursorPos(BufferView const & bv,
52                 CursorSlice const & sl, bool boundary, int & x, int & y) const override;
53         ///
54         bool descendable(BufferView const &) const override { return true; }
55         ///
56         void metrics(MetricsInfo & mi, Dimension & dim) const override;
57         ///
58         void drawBackground(PainterInfo & pi, int x, int y) const override;
59         ///
60         void draw(PainterInfo & pi, int x, int y) const override;
61         /// Strike out the inset when deleted.
62         bool canPaintChange(BufferView const &) const override { return true; }
63         ///
64         void edit(Cursor & cur, bool front, EntryDirection entry_from) override;
65         ///
66         Inset * editXY(Cursor & cur, int x, int y) override;
67         ///
68         bool insetAllowed(InsetCode code) const override;
69         ///
70         void doDispatch(Cursor & cur, FuncRequest & cmd) override;
71         ///
72         bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const override;
73         // Update the counters of this inset and of its contents
74         void updateBuffer(ParIterator const &, UpdateType, bool const deleted) override;
75         ///
76         void latex(otexstream & os, OutputParams const &) const override;
77         ///
78         int plaintext(odocstringstream & ods, OutputParams const & op,
79                       size_t max_length = INT_MAX) const override;
80         ///
81         void docbook(XMLStream &, OutputParams const &) const override;
82         ///
83         docstring xhtml(XMLStream & os, OutputParams const & runparams) const override;
84         ///
85         void addToToc(DocIterator const & di, bool output_active, UpdateType utype,
86                       TocBackend & backend) const override;
87         ///
88         docstring toolTip(BufferView const & bv, int x, int y) const override;
89         ///
90         bool forcePlainLayout(idx_type = 0) const override { return true; }
91         /// Captions don't accept alignment, spacing, etc.
92         bool allowParagraphCustomization(idx_type = 0) const override { return false; }
93         ///
94         Inset * clone() const override { return new InsetCaption(*this); }
95
96         ///
97         mutable docstring full_label_;
98         ///
99         mutable int labelwidth_ = 0;
100         ///
101         mutable bool rtl_ = false;
102         ///
103         std::string floattype_;
104         ///
105         bool is_subfloat_ = false;
106         ///
107         bool is_deleted_ = false;
108         ///
109         bool non_float_ = false;
110         ///
111         std::string type_;
112 };
113
114
115 } // namespace lyx
116
117 #endif