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