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