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