]> git.lyx.org Git - lyx.git/blob - src/insets/insetfloat.h
* BufferParams:
[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 "mailinset.h"
18
19
20 namespace lyx {
21
22
23 class InsetFloatParams {
24 public:
25         ///
26         InsetFloatParams() : wide(false), sideways(false) {}
27         ///
28         void write(std::ostream & os) const;
29         ///
30         void read(LyXLex & lex);
31         ///
32         std::string type;
33         ///
34         std::string placement;
35         ///
36         bool wide;
37         ///
38         bool sideways;
39 };
40
41
42 /** The float inset
43
44 */
45 class InsetFloat : public InsetCollapsable {
46 public:
47         ///
48         InsetFloat(BufferParams const &, std::string const &);
49         ///
50         ~InsetFloat();
51         ///
52         void write(Buffer const & buf, std::ostream & os) const;
53         ///
54         void read(Buffer const & buf, LyXLex & lex);
55         ///
56         void validate(LaTeXFeatures & features) const;
57         ///
58         InsetBase::Code lyxCode() const { return InsetBase::FLOAT_CODE; }
59         ///
60         virtual bool wide() const { return false; }
61         ///
62         int latex(Buffer const &, odocstream &,
63                   OutputParams const &) const;
64         ///
65         int plaintext(Buffer const &, odocstream &,
66                       OutputParams const &) const;
67         ///
68         int docbook(Buffer const &, odocstream &,
69                     OutputParams const &) const;
70         ///
71         virtual docstring const editMessage() const;
72         ///
73         bool insetAllowed(InsetBase::Code) const;
74         /** returns true if, when outputing LaTeX, font changes should
75             be closed before generating this inset. This is needed for
76             insets that may contain several paragraphs */
77         bool noFontChange() const { return true; }
78         ///
79         void wide(bool w, BufferParams const &);
80         ///
81         void sideways(bool s, BufferParams const &);
82         ///
83         void addToToc(TocList &, Buffer const &) const;
84         ///
85         bool  showInsetDialog(BufferView *) const;
86         ///
87         InsetFloatParams const & params() const { return params_; }
88         ///
89         bool getStatus(LCursor &, FuncRequest const &, FuncStatus &) const;
90 protected:
91         virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
92 private:
93         virtual std::auto_ptr<InsetBase> doClone() const;
94
95         ///
96         InsetFloatParams params_;
97 };
98
99
100 class InsetFloatMailer : public MailInset {
101 public:
102         ///
103         InsetFloatMailer(InsetFloat & inset);
104         ///
105         virtual InsetBase & inset() const { return inset_; }
106         ///
107         virtual std::string const & name() const { return name_; }
108         ///
109         virtual std::string const inset2string(Buffer const &) const;
110         ///
111         static void string2params(std::string const &, InsetFloatParams &);
112         ///
113         static std::string const params2string(InsetFloatParams const &);
114 private:
115         ///
116         static std::string const name_;
117         ///
118         InsetFloat & inset_;
119 };
120
121
122 } // namespace lyx
123
124 #endif