]> git.lyx.org Git - lyx.git/blob - src/insets/insetfloat.h
* src/LyXAction.C: mark goto-clear-bookmark as working without 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 "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         int latex(Buffer const &, odocstream &,
61                   OutputParams const &) const;
62         ///
63         int docbook(Buffer const &, odocstream &,
64                     OutputParams const &) const;
65         ///
66         virtual docstring 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(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 class InsetFloatMailer : public MailInset {
96 public:
97         ///
98         InsetFloatMailer(InsetFloat & inset);
99         ///
100         virtual InsetBase & inset() const { return inset_; }
101         ///
102         virtual std::string const & name() const { return name_; }
103         ///
104         virtual std::string const inset2string(Buffer const &) const;
105         ///
106         static void string2params(std::string const &, InsetFloatParams &);
107         ///
108         static std::string const params2string(InsetFloatParams const &);
109 private:
110         ///
111         static std::string const name_;
112         ///
113         InsetFloat & inset_;
114 };
115
116
117 } // namespace lyx
118
119 #endif