]> git.lyx.org Git - lyx.git/blob - src/insets/insetfloat.h
* Buffer
[lyx.git] / src / insets / insetfloat.h
1 // -*- C++ -*-
2 /**
3  * \file insetfloat.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Jürgen Vigna
8  * \author Lars Gullik Bjønnes
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef INSETFLOAT_H
14 #define INSETFLOAT_H
15
16 #include "insetcollapsable.h"
17 #include "TocBackend.h"
18 #include "mailinset.h"
19
20
21 namespace lyx {
22
23
24 class InsetFloatParams {
25 public:
26         ///
27         InsetFloatParams() : wide(false), sideways(false) {}
28         ///
29         void write(std::ostream & os) const;
30         ///
31         void read(LyXLex & lex);
32         ///
33         std::string type;
34         ///
35         std::string placement;
36         ///
37         bool wide;
38         ///
39         bool sideways;
40 };
41
42
43 /** The float inset
44
45 */
46 class InsetFloat : public InsetCollapsable {
47 public:
48         ///
49         InsetFloat(BufferParams const &, std::string const &);
50         ///
51         ~InsetFloat();
52         ///
53         void write(Buffer const & buf, std::ostream & os) const;
54         ///
55         void read(Buffer const & buf, LyXLex & lex);
56         ///
57         void validate(LaTeXFeatures & features) const;
58         ///
59         InsetBase::Code lyxCode() const { return InsetBase::FLOAT_CODE; }
60         ///
61         int latex(Buffer const &, odocstream &,
62                   OutputParams const &) const;
63         ///
64         int docbook(Buffer const &, odocstream &,
65                     OutputParams const &) const;
66         ///
67         virtual docstring const editMessage() const;
68         ///
69         bool insetAllowed(InsetBase::Code) const;
70         /** returns true if, when outputing LaTeX, font changes should
71             be closed before generating this inset. This is needed for
72             insets that may contain several paragraphs */
73         bool noFontChange() const { return true; }
74         ///
75         void wide(bool w, BufferParams const &);
76         ///
77         void sideways(bool s, BufferParams const &);
78         ///
79         void addToToc(TocBackend::TocList &, Buffer const &) const;
80         ///
81         bool  showInsetDialog(BufferView *) const;
82         ///
83         InsetFloatParams const & params() const { return params_; }
84         ///
85         bool getStatus(LCursor &, FuncRequest const &, FuncStatus &) const;
86 protected:
87         virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
88 private:
89         virtual std::auto_ptr<InsetBase> doClone() const;
90
91         ///
92         InsetFloatParams params_;
93 };
94
95
96 class InsetFloatMailer : public MailInset {
97 public:
98         ///
99         InsetFloatMailer(InsetFloat & inset);
100         ///
101         virtual InsetBase & inset() const { return inset_; }
102         ///
103         virtual std::string const & name() const { return name_; }
104         ///
105         virtual std::string const inset2string(Buffer const &) const;
106         ///
107         static void string2params(std::string const &, InsetFloatParams &);
108         ///
109         static std::string const params2string(InsetFloatParams const &);
110 private:
111         ///
112         static std::string const name_;
113         ///
114         InsetFloat & inset_;
115 };
116
117
118 } // namespace lyx
119
120 #endif