]> git.lyx.org Git - lyx.git/blob - src/insets/insetbox.h
rename priv_dispatch to doDispatch
[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         ///
60         ~InsetBox();
61         ///
62         std::string const editMessage() const;
63         ///
64         InsetOld::Code lyxCode() const { return InsetOld::BOX_CODE; }
65         ///
66         void write(Buffer const &, std::ostream &) const;
67         ///
68         void read(Buffer const & buf, LyXLex & lex);
69         ///
70         void setButtonLabel();
71         ///
72         void metrics(MetricsInfo &, Dimension &) const;
73         /// show the Box dialog
74         bool showInsetDialog(BufferView * bv) const;
75         ///
76         bool display() const { return false; }
77         ///
78         int latex(Buffer const &, std::ostream &,
79                         OutputParams const &) const;
80         ///
81         int linuxdoc(Buffer const &, std::ostream &,
82                      OutputParams const &) const;
83         ///
84         int docbook(Buffer const &, std::ostream &,
85                     OutputParams const &) const;
86         ///
87         int plaintext(Buffer const &, std::ostream &,
88                   OutputParams const & runparams) const;
89         ///
90         void validate(LaTeXFeatures &) const;
91         ///
92         InsetBoxParams const & params() const { return params_; }
93         ///
94         enum BoxType {
95                 Frameless,
96                 Boxed,
97                 ovalbox,
98                 Ovalbox,
99                 Shadowbox,
100                 Doublebox
101         };
102 protected:
103         InsetBox(InsetBox const &);
104         virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
105 private:
106         friend class InsetBoxParams;
107
108         virtual std::auto_ptr<InsetBase> doClone() const;
109
110         /// used by the constructors
111         void init();
112         ///
113         InsetBoxParams params_;
114 };
115
116
117 #include "mailinset.h"
118
119 class InsetBoxMailer : public MailInset {
120 public:
121         ///
122         InsetBoxMailer(InsetBox & inset);
123         ///
124         virtual InsetBase & inset() const { return inset_; }
125         ///
126         virtual std::string const & name() const { return name_; }
127         ///
128         virtual std::string const inset2string(Buffer const &) const;
129         ///
130         static std::string const params2string(InsetBoxParams const &);
131         ///
132         static void string2params(std::string const &, InsetBoxParams &);
133
134 private:
135         ///
136         static std::string const name_;
137         ///
138         InsetBox & inset_;
139 };
140
141 #endif // INSET_BOX_H