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