]> git.lyx.org Git - lyx.git/blob - src/insets/insetminipage.h
Rename LatexRunParams::fragile as moving_arg.
[lyx.git] / src / insets / insetminipage.h
1 // -*- C++ -*-
2 /**
3  * \file insetminipage.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 INSETMINIPAGE_H
14 #define INSETMINIPAGE_H
15
16 #include "insetcollapsable.h"
17 #include "lyxlength.h"
18
19 /** The minipage inset
20
21 */
22 class InsetMinipage : public InsetCollapsable {
23 public:
24         ///
25         enum Position {
26                 top,
27                 center,
28                 bottom
29         };
30         ///
31         enum InnerPosition {
32                 inner_center,
33                 inner_top,
34                 inner_bottom,
35                 inner_stretch
36         };
37
38         ///
39         struct Params {
40                 ///
41                 Params();
42                 ///
43                 Position pos;
44                 ///
45                 InnerPosition inner_pos;
46                 ///
47                 LyXLength height;
48                 ///
49                 LyXLength width;
50                 ///
51                 void write(std::ostream & os) const;
52                 ///
53                 void read(LyXLex & lex);
54         };
55
56         ///
57         InsetMinipage(BufferParams const &);
58         ///
59         InsetMinipage(InsetMinipage const &, bool same_id = false);
60         ///
61         ~InsetMinipage();
62         ///
63         virtual dispatch_result localDispatch(FuncRequest const & cmd); 
64         ///
65         void write(Buffer const * buf, std::ostream & os) const;
66         ///
67         void read(Buffer const * buf, LyXLex & lex);
68         ///
69         Inset * clone(Buffer const &, bool same_id = false) const;
70         ///
71         void dimension(BufferView *, LyXFont const &, Dimension &) const;
72         ///
73         Inset::Code lyxCode() const { return Inset::MINIPAGE_CODE; }
74         ///
75         int latex(Buffer const *, std::ostream &,
76                   LatexRunParams const &) const;
77         ///
78         string const editMessage() const;
79         ///
80         bool insetAllowed(Inset::Code) const;
81         ///
82         int getMaxWidth(BufferView *, UpdatableInset const *) const;
83         ///
84         bool needFullRow() const { return false; }
85         /** returns true if, when outputing LaTeX, font changes should
86             be closed before generating this inset. This is needed for
87             insets that may contain several paragraphs */
88         bool noFontChange() const { return true; }
89         ///
90         bool showInsetDialog(BufferView *) const;
91         ///
92         int latexTextWidth(BufferView *) const;
93         ///
94         void params(Params const & p) { params_ = p; }
95         ///
96         Params const & params() const { return params_; }
97 private:
98         ///
99         Params params_;
100 };
101
102
103 #include "mailinset.h"
104
105
106 class InsetMinipageMailer : public MailInset {
107 public:
108         ///
109         InsetMinipageMailer(InsetMinipage & inset);
110         ///
111         virtual InsetBase & inset() const { return inset_; }
112         ///
113         virtual string const & name() const { return name_; }
114         ///
115         virtual string const inset2string() const;
116         ///
117         static void string2params(string const &, InsetMinipage::Params &);
118         ///
119         static string const params2string(InsetMinipage::Params const &);
120 private:
121         ///
122         static string const name_;
123         ///
124         InsetMinipage & inset_;
125 };
126
127 #endif