]> git.lyx.org Git - lyx.git/blob - src/insets/insetbox.h
* src/LyXAction.C: mark goto-clear-bookmark as working without buffer
[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 "lyxlength.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(LyXLex & 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         LyXLength 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         LyXLength 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         InsetBox(BufferParams const &, std::string const &);
62         ///
63         ~InsetBox();
64         ///
65         virtual docstring const editMessage() const;
66         ///
67         InsetBase::Code lyxCode() const { return InsetBase::BOX_CODE; }
68         ///
69         void write(Buffer const &, std::ostream &) const;
70         ///
71         void read(Buffer const & buf, LyXLex & lex);
72         ///
73         void setButtonLabel();
74         ///
75         bool metrics(MetricsInfo &, Dimension &) const;
76         /// show the Box dialog
77         bool showInsetDialog(BufferView * bv) const;
78         ///
79         bool display() const { return false; }
80         ///
81         bool forceDefaultParagraphs(idx_type) const;
82         ///
83         bool neverIndent(Buffer const &) const { return true; }
84         ///
85         bool noFontChange() const { return true; }
86         ///
87         int latex(Buffer const &, odocstream &, OutputParams const &) const;
88         ///
89         int docbook(Buffer const &, odocstream &, OutputParams const &) const;
90         ///
91         int plaintext(Buffer const &, 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         /// Is the width forced to some value?
112         virtual bool hasFixedWidth() const;
113 private:
114         friend class InsetBoxParams;
115
116         virtual std::auto_ptr<InsetBase> doClone() const;
117
118         /// used by the constructors
119         void init();
120         ///
121         InsetBoxParams params_;
122 };
123
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
148 } // namespace lyx
149
150 #endif // INSET_BOX_H