]> git.lyx.org Git - lyx.git/blob - src/insets/InsetBox.h
Change the signature of forceEmptyLayout(), so that we can pass a cell index with...
[lyx.git] / src / insets / InsetBox.h
1 // -*- C++ -*-
2 /**
3  * \file InsetBox.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Angus Leeming
8  * \author Martin Vermeer
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef INSETBOX_H
14 #define INSETBOX_H
15
16 #include "InsetCollapsable.h"
17 #include "Length.h"
18 #include "MailInset.h"
19
20
21 namespace lyx {
22
23 class InsetBoxParams {
24 public:
25         ///
26         InsetBoxParams(std::string const &);
27         ///
28         void write(std::ostream & os) const;
29         ///
30         void read(Lexer & lex);
31         ///
32         std::string type;
33         /// Use a parbox (true) or minipage (false)
34         bool use_parbox;
35         /// Do we have an inner parbox or minipage to format paragraphs to
36         /// columnwidth?
37         bool inner_box;
38         ///
39         Length width;
40         /// "special" widths, see usrguide.dvi ยง3.5
41         std::string special;
42         ///
43         char pos;
44         ///
45         char hor_pos;
46         ///
47         char inner_pos;
48         ///
49         Length height;
50         ///
51         std::string height_special;
52 };
53
54
55 /** The fbox/fancybox inset
56
57 */
58 class InsetBox : public InsetCollapsable {
59 public:
60         ///
61         enum BoxType {
62                 Frameless,
63                 Boxed,
64                 Framed,
65                 ovalbox,
66                 Ovalbox,
67                 Shadowbox,
68                 Shaded,
69                 Doublebox
70         };
71         ///
72         InsetBox(Buffer const &, std::string const &);
73         ///
74         ~InsetBox();
75 private:
76         ///
77         friend class InsetBoxParams;
78         friend class InsetBoxMailer;
79         ///
80         docstring editMessage() const;
81         ///
82         InsetCode lyxCode() const { return BOX_CODE; }
83         ///
84         docstring name() const;
85         ///
86         void write(std::ostream &) const;
87         ///
88         void read(Lexer & lex);
89         ///
90         void setButtonLabel();
91         ///
92         void metrics(MetricsInfo &, Dimension &) const;
93         /// show the Box dialog
94         bool showInsetDialog(BufferView * bv) const;
95         ///
96         DisplayType display() const { return Inline; }
97         ///
98         virtual bool allowParagraphCustomization(idx_type = 0)
99                 { return forceEmptyLayout(); }
100         ///
101         virtual bool forceEmptyLayout(idx_type = 0) const;
102         ///
103         bool neverIndent() const { return true; }
104         ///
105         bool noFontChange() const { return true; }
106         ///
107         int latex(odocstream &, OutputParams const &) const;
108         ///
109         int plaintext(odocstream &, OutputParams const &) const;
110         ///
111         int docbook(odocstream &, OutputParams const &) const;
112         ///
113         void validate(LaTeXFeatures &) const;
114         ///
115         InsetBoxParams const & params() const { return params_; }
116         ///
117         bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
118         ///
119         void doDispatch(Cursor & cur, FuncRequest & cmd);
120         /// Is the width forced to some value?
121         bool hasFixedWidth() const;
122         ///
123         Inset * clone() const { return new InsetBox(*this); }
124         /// used by the constructors
125         void init();
126
127         ///
128         InsetBoxParams params_;
129 };
130
131
132 class InsetBoxMailer : public MailInset {
133 public:
134         ///
135         InsetBoxMailer(InsetBox & inset);
136         ///
137         virtual Inset & inset() const { return inset_; }
138         ///
139         virtual std::string const & name() const { return name_; }
140         ///
141         virtual std::string const inset2string(Buffer const &) const;
142         ///
143         static std::string const params2string(InsetBoxParams const &);
144         ///
145         static void string2params(std::string const &, InsetBoxParams &);
146
147 private:
148         ///
149         static std::string const name_;
150         ///
151         InsetBox & inset_;
152 };
153
154
155 } // namespace lyx
156
157 #endif // INSET_BOX_H