]> git.lyx.org Git - lyx.git/blob - src/insets/insetbox.h
Use UTF8 for LaTeX export.
[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
17 #include "insetcollapsable.h"
18 #include "lyxlength.h"
19
20
21 class InsetBoxParams {
22 public:
23         ///
24         InsetBoxParams(std::string const &);
25         ///
26         void write(std::ostream & os) const;
27         ///
28         void read(LyXLex & lex);
29         ///
30         std::string type;
31         /// Use a parbox (true) or minipage (false)
32         bool use_parbox;
33         /// Do we have an inner parbox or minipage to format paragraphs to
34         /// columnwidth?
35         bool inner_box;
36         ///
37         LyXLength width;
38         /// "special" widths, see usrguide.dvi ยง3.5
39         std::string special;
40         ///
41         char pos;
42         ///
43         char hor_pos;
44         ///
45         char inner_pos;
46         ///
47         LyXLength height;
48         ///
49         std::string height_special;
50 };
51
52
53 /** The fbox/fancybox inset
54
55 */
56 class InsetBox : public InsetCollapsable {
57 public:
58         ///
59         InsetBox(BufferParams const &, std::string const &);
60         ///
61         ~InsetBox();
62         ///
63         virtual lyx::docstring const editMessage() const;
64         ///
65         InsetBase::Code lyxCode() const { return InsetBase::BOX_CODE; }
66         ///
67         void write(Buffer const &, std::ostream &) const;
68         ///
69         void read(Buffer const & buf, LyXLex & lex);
70         ///
71         void setButtonLabel();
72         ///
73         void metrics(MetricsInfo &, Dimension &) const;
74         /// show the Box dialog
75         bool showInsetDialog(BufferView * bv) const;
76         ///
77         bool display() const { return false; }
78         ///
79         bool forceDefaultParagraphs(idx_type) const;
80         ///
81         bool neverIndent() const { return true; }
82         ///
83         bool noFontChange() const { return true; }
84         ///
85         int latex(Buffer const &, lyx::odocstream &,
86                         OutputParams const &) const;
87         ///
88         int docbook(Buffer const &, std::ostream &,
89                     OutputParams const &) const;
90         ///
91         int plaintext(Buffer const &, lyx::odocstream &,
92                   OutputParams const & runparams) const;
93         ///
94         void validate(LaTeXFeatures &) const;
95         ///
96         InsetBoxParams const & params() const { return params_; }
97         ///
98         bool getStatus(LCursor &, FuncRequest const &, FuncStatus &) const;
99         ///
100         enum BoxType {
101                 Frameless,
102                 Boxed,
103                 ovalbox,
104                 Ovalbox,
105                 Shadowbox,
106                 Doublebox
107         };
108 protected:
109         InsetBox(InsetBox const &);
110         virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
111 private:
112         friend class InsetBoxParams;
113
114         virtual std::auto_ptr<InsetBase> doClone() const;
115
116         /// used by the constructors
117         void init();
118         ///
119         InsetBoxParams params_;
120 };
121
122
123 #include "mailinset.h"
124
125 class InsetBoxMailer : public MailInset {
126 public:
127         ///
128         InsetBoxMailer(InsetBox & inset);
129         ///
130         virtual InsetBase & inset() const { return inset_; }
131         ///
132         virtual std::string const & name() const { return name_; }
133         ///
134         virtual std::string const inset2string(Buffer const &) const;
135         ///
136         static std::string const params2string(InsetBoxParams const &);
137         ///
138         static void string2params(std::string const &, InsetBoxParams &);
139
140 private:
141         ///
142         static std::string const name_;
143         ///
144         InsetBox & inset_;
145 };
146
147 #endif // INSET_BOX_H